/* Site chat: a soft panel that slides in from the right */
.chat-toggle { position: fixed; z-index: 44; right: 18px; bottom: 18px; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: #fff; font-size: 24px; box-shadow: 0 12px 30px -10px var(--magenta), var(--soft);
  transition: transform .3s var(--ease), opacity .25s; }
.chat-toggle:hover { transform: translateY(-2px) scale(1.04); }
.chat-toggle:active { transform: scale(.92); }
.chat-toggle.on { transform: scale(.6); opacity: 0; pointer-events: none; }
.chat-toggle.has::after { content: attr(data-count); position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--cyan); color: #10202a; font-size: 12px; font-weight: 900; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--ink); animation: chat-pop .4s var(--ease); }
@keyframes chat-pop { from { transform: scale(0); } }

.chat { position: fixed; z-index: 45; top: 76px; right: 12px; bottom: 12px; width: min(360px, calc(100vw - 24px)); display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; border-radius: 26px; background: #1a1324f2; border: 1px solid var(--line);
  backdrop-filter: blur(16px); box-shadow: 0 30px 80px -30px #000, var(--soft);
  transform: translateX(calc(100% + 24px)); transition: transform .45s var(--ease-out); }
.chat.open { transform: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.chat-head b { font-size: 15px; }
.chat-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-size: 18px; }
.chat-list { overflow-y: auto; padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; overscroll-behavior: contain; }
.chat-list::-webkit-scrollbar { display: none; }
.chat-msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; animation: chat-in .3s var(--ease-out); }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } }
.chat-msg img, .chat-ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; }
.chat-meta b { font-size: 13px; } .chat-msg.mine .chat-meta b { color: var(--cyan); }
.chat-meta small { color: var(--muted); font-size: 11px; }
.chat-del { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .2s; font-size: 15px; }
.chat-msg:hover .chat-del { opacity: 1; }
.chat-msg p { margin: 2px 0 0; padding: 8px 11px; border-radius: 4px 14px 14px 14px; background: var(--card); line-height: 1.4; font-size: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.mine p { background: #e21cf01c; border: 1px solid #e21cf033; }
.chat-sys { align-self: center; text-align: center; font-size: 12.5px; color: var(--pink); padding: 6px 12px; border-radius: 999px; background: #e21cf012; }
.chat-sys small { display: block; color: var(--muted); font-size: 10.5px; }
.chat-empty { color: var(--muted); text-align: center; margin: auto; }
.chat-form { position: relative; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--ink-2); color: var(--text); font: inherit; font-size: 14px; scrollbar-width: none; }
.chat-form textarea:focus { outline: none; border-color: var(--pink); }
.chat-form button { flex: none; height: 40px; }
.chat-form[data-err]::before { content: attr(data-err); position: absolute; left: 12px; right: 12px; bottom: 100%; margin-bottom: 6px; padding: 6px 10px;
  border-radius: 10px; background: #e21cf030; color: #ffd2ec; font-size: 12.5px; }
@media (max-width: 600px) { .chat { top: auto; height: 70vh; } }
/* guests read the chat; posting needs an account */
.chat-guest { display: grid; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line); text-align: center; }
.chat-guest p { margin: 0; font-size: 13px; color: var(--muted); }
.chat-guest div { display: flex; gap: 8px; justify-content: center; }
