/* Nova lobby chat (app/nova-chat.js). Plain look that matches the lobby; artwork and styling by Codex in
   app/art/chat-20261013/chat.css (loaded after this file) – every class and variable: CONTRACT.md there.
   Desktop (>= 900 px): round button bottom right, the panel slides in at the right edge, full height.
   Phone: button above the tab bar, the panel is a sheet from the bottom. Never shown over a game (z-index below
   the game overlay, and nova-chat.js hides it while a game is open). */
:root{
  --nv-chat-w:380px; --nv-chat-sheet-h:min(78vh,640px); --nv-chat-radius:18px;
  --nv-chat-bg:var(--panel,#171b24); --nv-chat-head-bg:var(--panel-2,#1e2330); --nv-chat-line:var(--line,#262c3a);
  --nv-chat-text:var(--text,#eef1f7); --nv-chat-muted:var(--muted,#8c95a8); --nv-chat-accent:var(--accent,#f2b632);
  --nv-chat-bubble:#1f2533; --nv-chat-bubble-mine:#2b2414; --nv-chat-bubble-line:transparent; --nv-chat-bubble-mine-line:#5a4512;
  --nv-chat-win-bg:linear-gradient(90deg,rgba(242,182,50,.16),rgba(242,182,50,.04)); --nv-chat-win-line:rgba(242,182,50,.35);
  --nv-chat-win-x:var(--accent-2,#ffe38a);
  --nv-chat-fab-size:56px; --nv-chat-fab-bg:linear-gradient(180deg,var(--accent-2,#ffe38a),var(--accent,#f2b632) 45%,var(--accent-deep,#b0700f));
  --nv-chat-fab-ink:var(--accent-ink,#1a1207); --nv-chat-unread-bg:var(--bad,#ef6b5b); --nv-chat-unread-ink:#fff;
  --nv-chat-scrim:rgba(5,6,10,.55); --nv-chat-shadow:0 20px 60px rgba(0,0,0,.55);
  --nv-chat-z:34;
}

/* ---------- Button ---------- */
.nv-chat-fab{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(var(--nav-h,64px) + 14px + env(safe-area-inset-bottom));
  z-index:calc(var(--nv-chat-z) - 2);display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:var(--nv-chat-fab-size);
  height:var(--nv-chat-fab-size);padding:0 16px;border-radius:999px;border:1px solid var(--accent-deep,#b0700f);background:var(--nv-chat-fab-bg);
  color:var(--nv-chat-fab-ink);font:700 14px/1 var(--font,system-ui);box-shadow:0 10px 26px rgba(0,0,0,.45);cursor:pointer;transition:transform .15s,filter .15s}
.nv-chat-fab:hover{filter:brightness(1.07);transform:translateY(-1px)}
.nv-chat-fab:focus-visible{outline:2px solid var(--nv-chat-text);outline-offset:3px}
.nv-chat-fab-ico{width:22px;height:22px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center/contain no-repeat}
.nv-chat-fab-label{display:none}
.nv-chat-unread{position:absolute;top:-4px;right:-4px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;display:grid;place-items:center;
  background:var(--nv-chat-unread-bg);color:var(--nv-chat-unread-ink);font:800 12px/1 var(--font,system-ui);box-shadow:0 0 0 2px var(--bg,#0d0f14)}
.nv-chat-fab.is-open{opacity:0;pointer-events:none}
@media (min-width:900px){
  .nv-chat-fab{bottom:24px;right:24px}
  .nv-chat-fab-label{display:inline}
}

/* ---------- Panel ---------- */
.nv-chat-scrim{position:fixed;inset:0;z-index:calc(var(--nv-chat-z) - 1);background:var(--nv-chat-scrim)}
.nv-chat{position:fixed;z-index:var(--nv-chat-z);display:flex;flex-direction:column;background:var(--nv-chat-bg);color:var(--nv-chat-text);
  border:1px solid var(--nv-chat-line);box-shadow:var(--nv-chat-shadow);overflow:hidden;
  left:0;right:0;bottom:0;height:var(--nv-chat-sheet-h);border-radius:var(--nv-chat-radius) var(--nv-chat-radius) 0 0;border-bottom:0;
  padding-bottom:env(safe-area-inset-bottom);animation:nv-chat-up .22s ease-out}
@keyframes nv-chat-up{from{transform:translateY(24px);opacity:.4}to{transform:none;opacity:1}}
@keyframes nv-chat-in{from{transform:translateX(24px);opacity:.4}to{transform:none;opacity:1}}
@media (min-width:900px){
  .nv-chat-scrim{background:transparent}
  .nv-chat{left:auto;top:0;height:auto;width:min(var(--nv-chat-w),100vw);border-radius:0;border-width:0 0 0 1px;animation-name:nv-chat-in}
}
@media (prefers-reduced-motion:reduce){.nv-chat{animation:none}}
@media (max-width:899px){html.nv-chat-open body{overflow:hidden}}

.nv-chat-head{display:flex;align-items:center;gap:10px;padding:14px 14px 12px 16px;background:var(--nv-chat-head-bg);border-bottom:1px solid var(--nv-chat-line);flex:0 0 auto}
.nv-chat-head::before{content:'';display:none}
@media (max-width:899px){.nv-chat-head{padding-top:18px;position:relative}
  .nv-chat-head::before{display:block;position:absolute;top:6px;left:50%;width:40px;height:4px;margin-left:-20px;border-radius:4px;background:var(--nv-chat-line)}}
.nv-chat-dot{width:8px;height:8px;border-radius:50%;background:var(--good,#5fd38a);flex:0 0 auto}
.nv-chat-title{flex:1;font-size:15px;font-weight:700;margin:0;letter-spacing:.01em}
.nv-chat-close{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;color:var(--nv-chat-muted);background:transparent;border:1px solid transparent;cursor:pointer;font-size:15px}
.nv-chat-close:hover{color:var(--nv-chat-text);border-color:var(--nv-chat-line)}
.nv-chat-notice{margin:10px 12px 0;padding:9px 12px;border-radius:10px;font-size:13px;background:var(--bg-2,#12151c);border-left:3px solid var(--bad,#ef6b5b);color:var(--nv-chat-text)}

/* ---------- Messages ---------- */
.nv-chat-list{list-style:none;margin:0;padding:12px 10px;flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:8px;outline:none}
.nv-chat-empty{color:var(--nv-chat-muted);font-size:13px;text-align:center;margin:auto 0;padding:20px}
.nv-chat-msg{position:relative;display:flex;align-items:flex-start;gap:9px;padding:2px 4px;flex-wrap:wrap}
.nv-chat-av{flex:0 0 auto;display:grid}
.nv-chat-av .nv-avatar{--s:30px}
.nv-chat-anon{width:30px;height:30px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#3a4256,#1c2130)}
.nv-chat-body{flex:1;min-width:0;background:var(--nv-chat-bubble);border:1px solid var(--nv-chat-bubble-line);border-radius:4px 14px 14px 14px;padding:6px 10px 7px}
.nv-chat-msg.is-mine .nv-chat-body{background:var(--nv-chat-bubble-mine);border-color:var(--nv-chat-bubble-mine-line)}
.nv-chat-meta{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px}
.nv-chat-name{font-weight:700;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.nv-chat-vip{--nv-vip-size:14px}
.nv-chat-you{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--nv-chat-accent)}
.nv-chat-time{margin-left:auto;font-size:11px;color:var(--nv-chat-muted);font-variant-numeric:tabular-nums;flex:0 0 auto}
.nv-chat-text{margin:2px 0 0;font-size:14px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.nv-chat-report{flex:0 0 auto;align-self:center;width:28px;height:28px;border-radius:8px;border:1px solid transparent;background:transparent;color:var(--nv-chat-muted);
  cursor:pointer;opacity:.55;display:grid;place-items:center}
.nv-chat-report::before{content:'';width:14px;height:14px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4h11l-2 4 2 4H5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4h11l-2 4 2 4H5'/%3E%3C/svg%3E") center/contain no-repeat}
.nv-chat-msg:hover .nv-chat-report,.nv-chat-report:focus-visible{opacity:1}
.nv-chat-report:hover{color:var(--bad,#ef6b5b);border-color:var(--nv-chat-line)}
.nv-chat-msg.is-reported .nv-chat-report{color:var(--bad,#ef6b5b);opacity:.8;cursor:default}
@media (hover:none){.nv-chat-report{opacity:.8}}
.nv-chat-reportbox{flex-basis:100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:2px 0 4px 39px;font-size:12px;color:var(--nv-chat-muted)}
.nv-chat-reportq{margin-right:2px}
.nv-chat-reason,.nv-chat-report-cancel{border:1px solid var(--nv-chat-line);background:var(--bg-2,#12151c);color:var(--nv-chat-text);border-radius:999px;padding:4px 10px;font-size:12px;cursor:pointer}
.nv-chat-reason:hover{border-color:var(--bad,#ef6b5b)}
.nv-chat-report-cancel{color:var(--nv-chat-muted)}

/* win announcement */
.nv-chat-win{align-items:center;padding:7px 10px;border-radius:12px;background:var(--nv-chat-win-bg);border:1px solid var(--nv-chat-win-line)}
.nv-chat-win .nv-chat-av .nv-avatar{--s:26px}
.nv-chat-win-ico{width:26px;height:26px;flex:0 0 auto;border-radius:50%;background:var(--nv-chat-accent);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3 6.5 7 .8-5.2 4.8 1.5 7L12 17.6 5.7 21l1.5-7L2 9.3l7-.8z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3 6.5 7 .8-5.2 4.8 1.5 7L12 17.6 5.7 21l1.5-7L2 9.3l7-.8z'/%3E%3C/svg%3E") center/contain no-repeat}
.nv-chat-win .nv-chat-text{flex:1;min-width:0;margin:0;font-size:13px}
.nv-chat-win .nv-chat-name.is-anon{font-style:italic;color:var(--nv-chat-muted)}
.nv-chat-x{color:var(--nv-chat-win-x);font-variant-numeric:tabular-nums}
.nv-chat-game{display:inline;padding:0;border:0;background:none;color:var(--nv-chat-accent);font:inherit;font-weight:700;cursor:pointer;text-decoration:underline;text-decoration-color:transparent}
.nv-chat-game:hover{text-decoration-color:currentColor}

.nv-chat-jump{position:absolute;left:50%;bottom:118px;transform:translateX(-50%);z-index:2;border:1px solid var(--nv-chat-accent);background:var(--nv-chat-head-bg);color:var(--nv-chat-text);
  border-radius:999px;padding:6px 14px;font-size:12px;font-weight:700;cursor:pointer;box-shadow:0 6px 18px rgba(0,0,0,.4)}

/* ---------- Input ---------- */
.nv-chat-form{display:flex;align-items:center;gap:8px;padding:10px 10px 6px;border-top:1px solid var(--nv-chat-line);flex:0 0 auto;position:relative}
.nv-chat-input{flex:1;min-width:0;width:auto;background:var(--bg-2,#12151c);border:1px solid var(--line-2,#333b4d);border-radius:999px;padding:11px 14px;color:var(--nv-chat-text);font-size:16px;outline:none}
.nv-chat-input:focus{border-color:var(--nv-chat-accent)}
.nv-chat-input:disabled{opacity:.55}
.nv-chat-count{position:absolute;right:92px;top:-18px;font-size:11px;color:var(--nv-chat-muted);font-variant-numeric:tabular-nums}
.nv-chat-count.is-near{color:var(--bad,#ef6b5b)}
.nv-chat-send{flex:0 0 auto;border-radius:999px;padding:11px 16px;font-weight:700;border:1px solid var(--accent-deep,#b0700f);background:var(--nv-chat-fab-bg);color:var(--nv-chat-fab-ink);cursor:pointer}
.nv-chat-send:disabled{opacity:.45;cursor:not-allowed}
.nv-chat-rules{margin:0;padding:0 14px 10px;font-size:11px;line-height:1.35;color:var(--nv-chat-muted);flex:0 0 auto}
.nv-chat.is-banned .nv-chat-rules{display:none}

/* Official announcements: server-created, plain-text messages from NOVA staff. */
.nv-chat-announcement{border:1px solid #b88d38;border-radius:12px;background:linear-gradient(135deg,#342814,#191b23);padding:12px!important;margin:8px 0;align-items:flex-start}
.nv-chat-announcement .nv-chat-body{min-width:0;flex:1}
.nv-chat-announcement .nv-chat-name{color:#f6d277}
.nv-chat-official{font-size:9px;letter-spacing:.08em;font-weight:800;color:#201a0e;background:#edca78;border-radius:4px;padding:2px 5px}
.nv-chat-announcement-icon{font-size:22px;flex:0 0 28px}
.nv-chat-announcement .nv-chat-text{white-space:pre-wrap;overflow-wrap:anywhere}
