/* PROTOTYPE - NOT FOR PRODUCTION */
:root {
  --ink: #0a0f24;
  --deep: #070c1f;
  --panel: rgba(14, 22, 54, 0.95);
  --panel-2: #0b1330;
  --line: #2b3f7a;
  --line-2: #1d2b5a;
  --text: #eaf2ff;
  --muted: #8fa3d6;
  --coral: #ff7a59;
  --teal: #2ec4b6;
  --yellow: #ffd23f;
  --violet: #9b6bff;
  --blue: #3a86ff;
  --lime: #9be564;
  --red: #ef476f;
  --aqua: #5ce1e6;
  --magenta: #ff4fd8;
  --t0: #5a6a8f;
  --t1: #9fb3c8;
  --t2: #ffd23f;
  --t3: #ff9f6b;
  --t4: #b388ff;
  --t5: #ff4fd8;
  --pix: 'Press Start 2P', ui-monospace, monospace;
  --body: 'Pixelify Sans', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#scene {
  position: fixed; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges;
  z-index: 0;
}

/* ── top bar ─────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; display: flex; gap: 8px; align-items: center; }
.chip, .icon-btn {
  font-family: var(--pix); font-size: 10px; line-height: 1;
  background: #0e1636; color: var(--text);
  border: 3px solid var(--line); box-shadow: 0 0 0 2px var(--ink);
  padding: 10px 12px; min-height: 40px;
}
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#roomChip { color: var(--yellow); letter-spacing: 2px; }
.ghost-chip { color: var(--muted); }
.icon-btn { width: 40px; padding: 0; font-size: 14px; display: grid; place-items: center; }
.icon-btn.off { opacity: 0.4; }
.chip.leave { color: var(--coral); }

.conn {
  position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 25;
  font-family: var(--pix); font-size: 10px; background: var(--red); color: #fff;
  padding: 8px 12px; border: 3px solid var(--ink);
}

/* ── shared pieces ───────────────────────────────────── */
.screen { position: relative; z-index: 1; }
.panel {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 0 0 0 3px var(--ink), 6px 6px 0 3px rgba(0, 0, 0, 0.35);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; font-family: var(--pix); font-size: 11px; color: #cfe0ff;
}
.mini {
  font-family: var(--pix); font-size: 8px; background: transparent; color: var(--muted);
  border: 2px solid var(--line); padding: 6px 8px;
}
.label, .kicker { font-family: var(--pix); font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.muted { color: var(--muted); }
.input {
  width: 100%; min-height: 52px; padding: 10px 14px;
  background: var(--deep); border: 3px solid var(--line); color: var(--text);
  font-family: var(--body); font-weight: 600; font-size: 20px; border-radius: 0;
}
.input::placeholder { color: #4d5f91; }
.input:focus { outline: none; border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(92, 225, 230, 0.25); }

.btn {
  --c: var(--teal);
  font-family: var(--pix); font-size: 14px; line-height: 1.25; text-transform: uppercase;
  color: var(--ink); background: var(--c);
  border: 3px solid var(--ink);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 4px 0 var(--ink);
  padding: 14px 12px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.05s, filter 0.1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22), 0 1px 0 var(--ink); }
.btn:focus-visible, .opt:focus-visible, .vbtn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn:disabled { filter: grayscale(0.7) brightness(0.6); cursor: not-allowed; transform: none; }
.btn small { font-size: 8px; opacity: 0.75; letter-spacing: 1px; }
.btn.coral { --c: var(--coral); }
.btn.teal { --c: var(--teal); }
.btn.yellow { --c: var(--yellow); }
.btn.lime { --c: var(--lime); }
.btn.violet { --c: var(--violet); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); }
.btn.blue { --c: var(--blue); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); }
.btn.red { --c: var(--red); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); }
.btn.dark { --c: #26346a; color: var(--text); }
.btn.big { font-size: 18px; padding: 16px; }
.btn.small { font-size: 11px; padding: 8px 12px; min-height: 44px; }
.row { display: flex; gap: 10px; align-items: stretch; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── menu ────────────────────────────────────────────── */
.menu {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: 72px 16px 24px;
}
.logo {
  font-family: var(--pix); font-weight: 400; margin: 8px 0 0; text-align: center;
  font-size: clamp(26px, 8.2vw, 80px); letter-spacing: 1px; line-height: 1.1; white-space: nowrap;
}
.logo span { display: inline-block; }
.logo .l1 {
  color: var(--aqua);
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 3px 0 var(--ink),
    0 8px 0 #1b8a9a, 3px 8px 0 var(--ink), -3px 8px 0 var(--ink), 0 11px 0 var(--ink);
}
.logo .l2 {
  color: var(--coral); margin-left: 0.12em;
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 3px 0 var(--ink),
    0 8px 0 #b8432a, 3px 8px 0 var(--ink), -3px 8px 0 var(--ink), 0 11px 0 var(--ink);
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(6px); } }
.tagline {
  max-width: 560px; text-align: center; font-size: 19px; font-weight: 600; margin: 18px 0 18px;
  text-shadow: 2px 2px 0 var(--ink);
}
.menu-panel { width: min(560px, 100%); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.avatar-btn {
  flex: 0 0 auto; width: 58px; min-height: 52px; padding: 0; background: var(--deep);
  border: 3px solid var(--line); display: grid; place-items: center;
}
.avatar-btn img { width: 48px; height: 42px; image-rendering: pixelated; }
.avatar-btn:hover { border-color: var(--aqua); }
.code-input { text-align: center; font-family: var(--pix); font-size: 22px; letter-spacing: 10px; text-transform: uppercase; }
#joinBtn { flex: 0 0 120px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-family: var(--pix); font-size: 9px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 3px; background: var(--line-2); }
.foot { margin-top: auto; padding-top: 20px; font-size: 14px; color: var(--muted); text-shadow: 1px 1px 0 var(--ink); }

/* ── game layout ─────────────────────────────────────── */
.game {
  display: grid; grid-template-columns: 290px minmax(0, 660px) 230px; gap: 22px;
  justify-content: center; align-items: start;
  padding: 68px 16px 28px; min-height: 100dvh;
}
.center { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.chat { position: sticky; top: 68px; height: calc(100dvh - 100px); max-height: 660px; display: flex; flex-direction: column; }
.chat.collapsed { height: auto; }
.chat.collapsed .chat-list, .chat.collapsed .chat-form { display: none; }
.chat-list {
  flex: 1; overflow-y: auto; list-style: none; margin: 0 10px; padding: 8px 10px;
  background: var(--deep); border: 2px solid var(--line-2); font-size: 16px; line-height: 1.35;
  overscroll-behavior: contain;
}
.chat-list li { padding: 2px 0; overflow-wrap: anywhere; }
.chat-list .who { font-weight: 700; }
.chat-list .sys { color: var(--muted); font-style: italic; font-size: 15px; }
.chat-list .ghost { color: #c3a6ff; }
.chat-form { display: flex; gap: 8px; padding: 10px; }
.chat-form .input { min-height: 46px; font-size: 17px; }
.chat-fab { display: none; }

.legend { position: sticky; top: 68px; padding: 14px; }
.legend-title { font-family: var(--pix); font-size: 11px; color: var(--yellow); text-align: center; margin-bottom: 10px; }
.tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tiers li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-weight: 700; }
.tiers i { width: 14px; height: 14px; background: var(--tc); border: 2px solid var(--ink); }
.tiers b { font-family: var(--pix); font-size: 10px; color: var(--tc); }
.legend-note { margin-top: 12px; font-size: 14px; color: var(--muted); }
.legend-note em { color: var(--aqua); font-style: normal; font-weight: 700; }
.t0 { --tc: var(--t0); } .t1 { --tc: var(--t1); } .t2 { --tc: var(--t2); } .t3 { --tc: var(--t3); } .t4 { --tc: var(--t4); } .t5 { --tc: var(--t5); }

/* ── stage ───────────────────────────────────────────── */
.stage { padding: 18px 20px 20px; }
.round-label { font-family: var(--pix); font-size: 10px; color: var(--muted); letter-spacing: 1px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 8px; line-height: 1.4; }
.round-label span { white-space: nowrap; }
.prompt { font-family: var(--pix); font-size: clamp(18px, 3vw, 27px); line-height: 1.4; margin: 12px 0 14px; color: #fff; text-shadow: 3px 3px 0 var(--ink); }
.timer { display: flex; gap: 10px; align-items: center; }
.bar { flex: 1; height: 16px; background: var(--deep); border: 3px solid var(--line); }
.fill { height: 100%; width: 100%; background: var(--lime); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.fill.low { background: var(--red); }
.tnum { font-family: var(--pix); font-size: 18px; color: var(--yellow); min-width: 2.4em; text-align: right; }
.answer-form { display: flex; gap: 10px; margin: 14px 0 6px; }
.answer-form .btn { flex: 0 0 112px; }
.helper { color: var(--muted); font-size: 15px; margin-top: 8px; }
.mini-legend { display: none; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.mini-legend span { font-family: var(--pix); font-size: 8px; padding: 4px 5px; background: var(--tc); color: var(--ink); }

.hint-box { margin-top: 14px; border: 3px dashed var(--magenta); background: rgba(255, 79, 216, 0.08); padding: 10px 12px; }
.hint-box .kicker { color: #ff8ae6; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hint-text { margin-top: 8px; font-size: 17px; line-height: 1.35; }
.peek { font-family: var(--pix); font-size: 9px; background: transparent; color: #ff8ae6; border: 2px solid #ff8ae6; padding: 6px 8px; }

.locked { margin-top: 14px; padding: 14px; background: var(--panel-2); border: 3px solid var(--lime); text-align: center; }
.locked .kicker { color: var(--lime); }
.locked .ans { font-size: 24px; font-weight: 700; margin-top: 6px; overflow-wrap: anywhere; }

.tier {
  display: inline-block; font-family: var(--pix); font-size: 9px; padding: 4px 6px;
  border: 2px solid var(--ink); color: var(--ink); background: var(--tc); white-space: nowrap;
}
.tier.t0 { color: #fff; }
.tier.t5 { box-shadow: 0 0 12px var(--t5); animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px var(--t5), 0 0 4px #fff; } }

/* imposter cheat sheet */
.cheat { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; }
.cheat li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: var(--deep); border-left: 5px solid var(--tc); font-weight: 700; min-width: 0; }
/* Words matter more than labels here: the tier shows as color + pips (hover for the name). */
.cheat .tier .tn { display: none; }
.cheat .tier .pips { margin-left: 0; }
.cheat li > span:last-child { flex: 1; min-width: 0; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.cheat li.got { opacity: 0.45; text-decoration: line-through; }

/* answer being checked by the judge */
.catch-flash.checking { background: #1d2b5a; color: var(--aqua); }
.catch-flash .dots { display: inline-block; animation: blink 0.8s steps(2) infinite; }

/* grouped category picker */
.packs { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.pg-title { font-family: var(--pix); font-size: 8px; color: var(--muted); margin-bottom: 4px; }
.opt.pack { font-size: 9px; padding: 8px; }
.opt.pack small { font-size: 11px; }

/* depth pips: tier readable without color */
.pips { display: inline-flex; gap: 1px; margin-left: 6px; vertical-align: middle; }
.pips b { width: 4px; height: 8px; background: rgba(10, 15, 36, 0.28); }
.pips.p1 b:nth-child(-n+1), .pips.p2 b:nth-child(-n+2), .pips.p3 b:nth-child(-n+3),
.pips.p4 b:nth-child(-n+4), .pips.p5 b:nth-child(-n+5) { background: currentColor; }

/* instant per-answer feedback */
.catch-flash { margin: 2px 0 10px; padding: 10px 14px; border: 3px solid var(--ink); text-align: center; background: var(--panel-2); }
.catch-flash:empty { display: none; }
.catch-flash.hit { background: var(--tc); color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.catch-flash.t1 { opacity: 0.9; }
.catch-flash.t4 { box-shadow: 0 0 18px var(--t4), 0 4px 0 var(--ink); }
.catch-flash.t5 { box-shadow: 0 0 30px var(--t5), 0 0 6px #fff, 0 4px 0 var(--ink); }
.catch-flash.miss { background: #232c4a; color: var(--muted); }
.catch-flash.dupe { background: #2d2a12; color: var(--yellow); }
.cf-big { font-family: var(--pix); font-size: clamp(13px, 2.4vw, 18px); line-height: 1.4; }
.cf-big .pips b { width: 6px; height: 12px; }
.cf-pts { font-family: var(--pix); font-size: clamp(20px, 4vw, 30px); margin-top: 6px; }
.cf-sub { font-weight: 700; font-size: 17px; margin-top: 4px; }
.catch-flash.show { animation: cfpop 0.35s ease-out; }
.catch-flash.t5.show { animation: cfpop 0.35s ease-out, shake 0.45s 0.05s; }
@keyframes cfpop { 0% { transform: scale(0.7); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 20% { translate: -5px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 3px 0; } }

.haul-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; background: var(--deep); border: 3px solid var(--line); }
.haul-total { font-family: var(--pix); font-size: 26px; color: var(--yellow); margin-top: 6px; text-shadow: 3px 3px 0 var(--ink); }
.haul-meta { text-align: right; font-size: 15px; color: var(--muted); }
.haul-meta b { font-family: var(--pix); font-size: 16px; color: var(--text); }
.feed { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; max-height: 210px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 8px; background: var(--panel-2); border-left: 6px solid var(--tc); }
.feed li:first-child { animation: pop 0.3s ease-out; }
.feed .fd-txt { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li b { font-family: var(--pix); font-size: 11px; color: var(--tc); }

/* reveal */
.reveal { margin-top: 12px; display: grid; gap: 6px; }
.rv-main { min-width: 0; }
.rv-meta { font-size: 13px; color: var(--muted); margin-left: 6px; }
.deepn { color: var(--t5); }
.rv-total { font-family: var(--pix); font-size: 15px !important; }
.hcs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.hc {
  display: inline-flex; align-items: center; font-size: 14px; font-weight: 700; line-height: 1.2;
  padding: 2px 6px; background: var(--tc); color: var(--ink); border: 2px solid var(--ink); max-width: 100%;
}
.hc .pips { margin-left: 5px; }
.hc .pips b { width: 3px; height: 7px; }
.hc.t5 { box-shadow: 0 0 10px var(--t5); }
.lone-star { font-style: normal; margin-left: 4px; }
.lr-main { min-width: 0; }
.lr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.lr-stat { font-size: 14px; color: var(--muted); }
.lr-stat b { color: var(--text); }
.depth-meter { display: inline-block; width: 90px; height: 12px; background: var(--deep); border: 2px solid var(--line); }
.depth-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--t4), var(--t5)); }
.lr-pct { font-family: var(--pix); font-size: 10px; }

/* standings on player cards */
.pcard .rank {
  position: absolute; top: 4px; left: 5px; font-family: var(--pix); font-size: 9px;
  padding: 3px 4px; background: #26346a; color: var(--text); border: 2px solid var(--ink);
}
.pcard .rank.r1 { background: #ffd23f; color: var(--ink); }
.pcard .rank.r2 { background: #cfd8e6; color: var(--ink); }
.pcard .rank.r3 { background: #d9874a; color: var(--ink); }
.pcard .delta { font-family: var(--pix); font-size: 9px; color: var(--lime); margin-top: 4px; animation: pop 0.35s ease-out; }
.pcard .delta.big { color: var(--t4); }
.pcard .delta.huge { color: var(--t5); text-shadow: 0 0 8px var(--t5); }
.rv {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--panel-2); border: 2px solid var(--line-2); border-left: 6px solid var(--tc);
}
.rv img { width: 44px; height: 38px; image-rendering: pixelated; }
.rv .nm { font-size: 14px; color: var(--muted); }
.rv .ans { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.rv .canon { font-size: 13px; color: var(--muted); }
.rv .pts { text-align: right; display: grid; gap: 4px; justify-items: end; }
.rv .pts b { font-family: var(--pix); font-size: 12px; }
.rv .lone { font-family: var(--pix); font-size: 8px; color: var(--aqua); }
.rv.pending { --tc: var(--line-2); }
.rv.pending .ans { color: transparent; text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.rv.pending .pts { visibility: hidden; }
.rv.pop { animation: pop 0.35s ease-out; }
.rv.t5:not(.pending) { background: linear-gradient(90deg, rgba(255, 79, 216, 0.22), var(--panel-2)); }
@keyframes pop { 0% { transform: scale(0.85); opacity: 0.2; } 60% { transform: scale(1.04); } 100% { transform: scale(1); opacity: 1; } }

/* lobby / settings */
.lobby-top { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.bigcode { font-family: var(--pix); font-size: clamp(30px, 6vw, 44px); letter-spacing: 8px; color: var(--yellow); text-shadow: 4px 4px 0 var(--ink); }
.set { margin-top: 16px; }
.set .label { margin-bottom: 8px; display: block; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  font-family: var(--pix); font-size: 10px; padding: 10px 10px; min-height: 40px;
  border: 3px solid var(--ink); background: #1d2b5a; color: #cfe0ff; text-align: left;
}
.opt.on { background: var(--teal); color: var(--ink); }
.opt:disabled { cursor: default; }
.opt:not(.on):disabled { opacity: 0.55; }
.opt small { display: block; font-family: var(--body); font-size: 12px; margin-top: 4px; opacity: 0.8; }
.mode-desc { margin-top: 8px; color: var(--muted); font-size: 15px; }
.toggles { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.toggles label { display: flex; gap: 8px; align-items: center; font-size: 16px; cursor: pointer; }
.toggles input { width: 20px; height: 20px; accent-color: var(--teal); }
.start-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.start-row .btn { flex: 1 1 200px; }
.start-row .btn.small { flex: 0 0 auto; padding-inline: 16px; }
.wait { margin-top: 16px; text-align: center; color: var(--muted); }

/* role card */
.role { text-align: center; padding: 8px 0; }
.role h2 { font-family: var(--pix); font-weight: 400; font-size: clamp(22px, 4.5vw, 34px); margin: 12px 0; }
.role.crew h2 { color: var(--teal); text-shadow: 3px 3px 0 var(--ink); }
.role.imp h2 { color: var(--magenta); text-shadow: 0 0 18px var(--magenta), 3px 3px 0 var(--ink); }
.role.classic h2 { color: var(--yellow); text-shadow: 3px 3px 0 var(--ink); }
.role p { max-width: 460px; margin: 8px auto; font-size: 17px; }
.count { font-family: var(--pix); font-size: 44px; color: var(--yellow); margin-top: 14px; text-shadow: 4px 4px 0 var(--ink); }

/* meeting */
.alarm-title { font-family: var(--pix); font-size: clamp(16px, 3vw, 22px); color: var(--red); text-shadow: 3px 3px 0 var(--ink); animation: blink 1s steps(2) infinite; margin: 10px 0; }
@keyframes blink { 50% { color: #ff9bb1; } }
.log { display: grid; gap: 6px; margin-top: 12px; }
.logrow { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; background: var(--panel-2); border: 2px solid var(--line-2); }
.logrow img { width: 36px; height: 31px; image-rendering: pixelated; }
.logrow .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow.out { opacity: 0.45; }
.lcs { display: flex; flex-wrap: wrap; gap: 4px; }
.lc { font-size: 14px; padding: 2px 6px; background: var(--deep); border-left: 6px solid var(--tc); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; margin-top: 12px; }
.vbtn {
  border: 3px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700;
  position: relative; min-height: 96px;
}
.vbtn img { width: 56px; height: 49px; image-rendering: pixelated; }
.vbtn:not(:disabled):hover { border-color: var(--yellow); }
.vbtn.mine { border-color: var(--yellow); background: #2d2a12; }
.vbtn:disabled { cursor: default; }
.vbtn .vtag { position: absolute; top: 4px; right: 4px; font-family: var(--pix); font-size: 8px; color: var(--lime); }
.vbtn.skipv { justify-content: center; font-family: var(--pix); font-size: 11px; }

/* eject */
.eject { text-align: center; position: relative; overflow: hidden; min-height: 280px; padding-top: 110px; }
.eject .float { position: absolute; left: 50%; top: 150px; width: 96px; height: 84px; margin-left: -48px; image-rendering: pixelated; animation: drift 2s ease-in forwards; }
@keyframes drift { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(-200px) rotate(540deg); opacity: 0; } }
.ej-line { font-family: var(--pix); font-size: clamp(12px, 2.4vw, 16px); line-height: 1.6; opacity: 0; animation: fadein 0.5s forwards; position: relative; }
.ej-line.l1 { animation-delay: 0.5s; }
.ej-line.l2 { animation-delay: 1.2s; margin-top: 12px; }
.ej-line.l3 { animation-delay: 1.7s; margin-top: 10px; color: var(--muted); font-size: 11px; }
.ej-line .imp { color: var(--magenta); text-shadow: 0 0 12px var(--magenta); }
.ej-line .crew { color: var(--teal); }
@keyframes fadein { to { opacity: 1; } }
.tally { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 16px; opacity: 0; animation: fadein 0.4s 1.9s forwards; }
.tally span { font-size: 14px; padding: 4px 8px; background: var(--panel-2); border: 2px solid var(--line-2); }

/* results */
.banner { font-family: var(--pix); font-size: clamp(20px, 4.4vw, 32px); text-align: center; margin: 10px 0 6px; line-height: 1.35; }
.banner.crew { color: var(--teal); text-shadow: 3px 3px 0 var(--ink); }
.banner.imposter { color: var(--magenta); text-shadow: 0 0 18px var(--magenta), 3px 3px 0 var(--ink); }
.banner.classic, .banner.none { color: var(--yellow); text-shadow: 3px 3px 0 var(--ink); }
.outcome { text-align: center; font-family: var(--pix); font-size: 12px; margin-bottom: 8px; }
.outcome.win { color: var(--lime); }
.outcome.lose { color: var(--coral); }
.sub { text-align: center; color: var(--muted); }
.board { display: grid; gap: 6px; margin-top: 14px; }
.brow { display: grid; grid-template-columns: 34px 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 10px; background: var(--panel-2); border: 2px solid var(--line-2); }
.brow .rk { font-family: var(--pix); font-size: 12px; color: var(--muted); }
.brow.first .rk { color: var(--yellow); }
.brow img { width: 40px; height: 35px; image-rendering: pixelated; }
.brow .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .sc { font-family: var(--pix); font-size: 12px; }
.tag { font-family: var(--pix); font-size: 7px; padding: 3px 4px; margin-left: 6px; vertical-align: middle; border: 2px solid var(--ink); }
.tag.imp { background: var(--magenta); color: var(--ink); }
.tag.out { background: var(--t0); color: #fff; }
.tag.mvp { background: var(--yellow); color: var(--ink); }
.tag.bot { background: #26346a; color: var(--muted); }
.next { text-align: center; margin-top: 16px; font-family: var(--pix); font-size: 11px; color: var(--muted); }

/* players */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.pcard {
  position: relative; background: var(--panel); border: 3px solid var(--line); border-bottom: 5px solid var(--pc);
  box-shadow: 0 0 0 2px var(--ink); padding: 10px 6px 6px; text-align: center; min-width: 0;
}
.pcard img { width: 60px; height: 52px; image-rendering: pixelated; }
.pcard .nm { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pscore { font-family: var(--pix); font-size: 12px; margin-top: 4px; }
.pcard .lead { position: absolute; top: 3px; right: 6px; font-size: 13px; color: var(--yellow); }
.pcard .st { min-height: 16px; font-family: var(--pix); font-size: 7px; margin-top: 3px; color: var(--lime); }
.pcard.me { border-color: #4a64b0; }
.pcard.off { opacity: 0.5; }
.pcard.dead img { filter: grayscale(1) brightness(0.7); opacity: 0.6; }
.pcard.dead .nm { text-decoration: line-through; color: var(--muted); }
.pcard.imp { box-shadow: 0 0 0 2px var(--ink), 0 0 12px var(--magenta); }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 8, 20, 0.72); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(560px, 100%); max-height: 86dvh; overflow: auto; }
#modalBody { padding: 4px 16px 18px; }
#modalBody h3 { font-family: var(--pix); font-size: 11px; color: var(--yellow); margin: 16px 0 8px; font-weight: 400; }
#modalBody p, #modalBody li { line-height: 1.4; }
.kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kinds button, .swatches button { border: 3px solid var(--line); background: var(--deep); padding: 8px 4px; }
.kinds button img { width: 56px; height: 49px; image-rendering: pixelated; display: block; margin: 0 auto 4px; }
.kinds button span { font-family: var(--pix); font-size: 8px; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.swatches button { aspect-ratio: 1; padding: 0; }
.kinds .sel, .swatches .sel { border-color: #fff; box-shadow: 0 0 0 2px var(--yellow); }
.room-list { display: grid; gap: 8px; }
.room-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; background: var(--panel-2); border: 2px solid var(--line-2); }
.room-item code { font-family: var(--pix); color: var(--yellow); font-size: 14px; letter-spacing: 2px; }
.empty { text-align: center; color: var(--muted); padding: 18px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  font-family: var(--pix); font-size: 11px; line-height: 1.5; background: var(--yellow); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); padding: 12px 16px; max-width: calc(100vw - 32px); text-align: center;
}

.spark {
  position: fixed; width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--c);
  box-shadow: 0 0 0 2px var(--ink); z-index: 60; pointer-events: none;
  animation: spark 0.7s ease-out forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }
details > summary { list-style: none; }
details > summary::before { content: '▸ '; }
details[open] > summary::before { content: '▾ '; }

/* ── finale + trial: watched turns ───────────────────── */
.answer-form.turn .input { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(155, 229, 100, 0.25); }
.finale-title {
  font-family: var(--pix); font-size: clamp(26px, 6vw, 44px); text-align: center; margin: 18px 0 10px; color: var(--yellow);
  text-shadow: 0 0 18px rgba(255, 210, 63, 0.6), 4px 4px 0 var(--ink); animation: pop 0.5s ease-out;
}
.finale-sub { text-align: center; max-width: 500px; margin: 0 auto 12px; font-size: 17px; line-height: 1.4; }
.turn-order { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 8px; }
.turn-order .to { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px; border: 3px solid var(--line-2); background: var(--panel-2); }
.turn-order .to img { width: 32px; height: 28px; image-rendering: pixelated; }
.turn-order .to.done { opacity: 0.38; }
.turn-order .to.now { border-color: var(--yellow); box-shadow: 0 0 12px rgba(255, 210, 63, 0.6); }
.turn-order .to-meta { font-family: var(--pix); font-size: 9px; color: var(--muted); margin-left: auto; }
.turn-order.big { justify-content: center; gap: 10px; }
.turn-order.big .to { padding: 10px 10px 6px; min-width: 80px; }
.turn-order.big .to img { width: 48px; height: 42px; }
.turn-order.big .to b { position: absolute; top: 3px; left: 5px; font-family: var(--pix); font-size: 9px; color: var(--yellow); }
.turn-order.big .to i { font-style: normal; font-weight: 700; font-size: 14px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spot { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px; margin: 6px 0 10px; background: var(--deep); border: 3px solid var(--line); }
.spot > img { width: 64px; height: 56px; image-rendering: pixelated; }
.spot.typing { border-color: var(--yellow); }
.spot.typing.mine { border-color: var(--lime); }
.spot.typing > img { animation: bob 1.6s ease-in-out infinite; }
.sp-main { min-width: 0; }
.sp-who { font-family: var(--pix); font-size: 10px; color: var(--muted); letter-spacing: 1px; line-height: 1.5; }
.draft { font-family: var(--pix); font-size: clamp(18px, 3.6vw, 28px); line-height: 1.35; color: #fff; margin-top: 8px; min-height: 1.4em; overflow-wrap: anywhere; text-shadow: 3px 3px 0 var(--ink); }
.caret { display: inline-block; width: 0.55em; height: 1em; margin-left: 3px; vertical-align: -0.12em; background: var(--yellow); animation: blink 0.9s steps(2) infinite; }
.spot.checking { border-color: var(--aqua); }
.spot.checking .cf-sub { color: var(--aqua); }
.spot.result { animation: cfpop 0.35s ease-out; }
.spot.result.hit { background: var(--tc); color: var(--ink); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.spot.result.hit .sp-who { color: rgba(10, 15, 36, 0.7); }
.spot.result.t4 { box-shadow: 0 0 18px var(--t4), 0 4px 0 var(--ink); }
.spot.result.t5 { box-shadow: 0 0 30px var(--t5), 0 0 6px #fff, 0 4px 0 var(--ink); animation: cfpop 0.35s ease-out, shake 0.45s 0.05s; }
.spot.result.miss { background: #232c4a; color: var(--muted); }
.spot.result.dupe { background: #2d2a12; color: var(--yellow); }
.spot .cf-big { margin-top: 4px; }

.said { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; }
.said li { display: flex; gap: 8px; align-items: center; padding: 4px 8px; background: var(--panel-2); border-left: 6px solid var(--tc); min-width: 0; }
.said li img { width: 28px; height: 24px; image-rendering: pixelated; flex: 0 0 auto; }
.said .sd-txt { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.said li b { font-family: var(--pix); font-size: 10px; color: var(--tc); }

.trial-pitch { font-size: 17px; line-height: 1.45; margin: 12px 0 4px; }
.accused { display: flex; gap: 14px; align-items: center; margin: 14px 0; padding: 12px; background: var(--deep); border: 3px solid var(--yellow); line-height: 1.45; }
.accused img { width: 64px; height: 56px; image-rendering: pixelated; animation: bob 1.4s ease-in-out infinite; }
.trial-opts { display: grid; gap: 8px; margin-top: 12px; }
.trial-opt {
  position: relative; display: grid; gap: 4px; text-align: left; padding: 12px 14px;
  border: 3px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 700; font-size: 17px;
}
.trial-opt small { font-family: var(--pix); font-size: 8px; color: var(--muted); }
.trial-opt b { position: absolute; top: 9px; right: 10px; font-family: var(--pix); font-size: 9px; color: var(--yellow); }
.trial-opt:not(:disabled):hover { border-color: var(--yellow); }
.trial-opt.mine { border-color: var(--yellow); background: #2d2a12; }
.trial-opt:disabled { cursor: default; }
.eject.cleared { padding-top: 34px; }
.eject .stand { display: block; width: 96px; height: 84px; margin: 0 auto 18px; image-rendering: pixelated; animation: pop 0.6s ease-out; }
.pcard.typing { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--ink), 0 0 14px rgba(255, 210, 63, 0.55); }
.pcard.accused { border-color: var(--yellow); }

/* ── push-to-talk ────────────────────────────────────── */
.voice-row { display: flex; gap: 8px; padding: 0 10px 10px; }
.ptt, .ptt-fab { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.voice-row .ptt { flex: 1; font-size: 10px; }
#voiceMuteBtn { flex: 0 0 auto; width: 44px; min-height: 44px; }
.ptt.talking { --c: var(--red); animation: talkglow 0.9s ease-in-out infinite; }
@keyframes talkglow { 50% { box-shadow: 0 0 18px var(--red), inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 4px 0 var(--ink); } }
.ptt-fab { display: none; }
.pcard .mic { position: absolute; bottom: 4px; right: 5px; font-size: 12px; opacity: 0; transition: opacity 0.1s; }
.pcard.talking { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--lime), 0 0 16px var(--lime); }
.pcard.talking .mic { opacity: 1; }

/* ── responsive ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .game { grid-template-columns: 280px minmax(0, 660px); }
  .legend { display: none; }
  .mini-legend { display: flex; }
}
@media (max-width: 880px) {
  body { font-size: 16px; }
  .game { grid-template-columns: minmax(0, 1fr); padding: 62px 10px 96px; gap: 14px; }
  .chat {
    position: fixed; top: auto; left: 8px; right: 8px; bottom: 8px; z-index: 30;
    height: min(62dvh, 520px); max-height: none;
    transform: translateY(calc(100% + 24px)); transition: transform 0.2s ease-out;
  }
  .chat.open { transform: none; }
  .chat.collapsed .chat-list, .chat.collapsed .chat-form { display: flex; }
  .chat.collapsed .chat-list { display: block; }
  .chat-fab {
    display: flex; align-items: center; gap: 8px; position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 29;
    font-family: var(--pix); font-size: 11px; padding: 14px 16px; background: var(--lime); color: var(--ink);
    border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2), 0 4px 0 var(--ink);
  }
  .chat-fab span { background: var(--red); color: #fff; padding: 3px 6px; font-size: 9px; }
  .ptt-fab {
    display: grid; place-items: center; position: fixed; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 29;
    width: 62px; height: 62px; font-size: 26px; background: var(--violet); border: 3px solid var(--ink);
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2), 0 4px 0 var(--ink);
  }
  .ptt-fab.dim { filter: grayscale(0.6) brightness(0.8); }
  .ptt-fab.talking { background: var(--red); animation: talkglow 0.9s ease-in-out infinite; }
  .spot { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .spot > img { width: 48px; height: 42px; }
  .stage { padding: 14px 14px 16px; }
  .answer-form .btn { flex-basis: 92px; }
  .players { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
  .pcard img { width: 48px; height: 42px; }
  .pcard .nm { font-size: 14px; }
  .logrow { grid-template-columns: 30px minmax(0, 1fr); }
  .depth-meter { width: 56px; }
  .haul-total { font-size: 22px; }
  .chip { padding: 8px 9px; font-size: 9px; min-height: 36px; }
  .icon-btn { width: 36px; min-height: 36px; }
  .menu { padding-top: 64px; }
}
@media (max-width: 560px) {
  /* Long tier names ("Better than nothing") would squeeze the answer text: keep the color + pips. */
  .feed .tier:not(.t0) .tn, .cheat .tier:not(.t0) .tn, .rv .pts .tier:not(.t0) .tn, .said .tier:not(.t0) .tn { display: none; }
  .feed .tier .pips, .cheat .tier .pips, .rv .pts .tier .pips, .said .tier .pips { margin-left: 0; }
}
@media (max-width: 420px) {
  .ghost-chip { display: none; }
  .round-label { font-size: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .btn { font-size: 12px; }
  .btn.big { font-size: 15px; }
  #joinBtn { flex-basis: 96px; }
  .tagline { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition: none !important; }
}
