/* ==========================================================================
   Pokémon Guess Who - Stadium-broadcast plastic
   Radius rule: panels 20 / cards 14 / tiles 12 / inputs 10 / buttons pill
   Elevation ladder: ground -> panel (line + top highlight) -> tile (solid offset + soft) -> floating
   ========================================================================== */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-wdth.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/nunito-wght.woff2') format('woff2-variations');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --ink-950: #0a0f2c;
  --ink-900: #101a42;
  --ink-800: #182457;
  --ink-700: #23326f;
  --ink-600: #34478f;
  --line: rgba(190, 205, 255, 0.30);
  --line-strong: rgba(190, 205, 255, 0.42);
  --paper: #f5f7ff;
  --paper-2: #e3e8fb;
  --paper-3: #c9d2f2;
  --text: #f2f4ff;
  --text-2: #b9c3ea;
  --text-3: #8592c9;
  --ink-on-paper: #121a42;
  --ink-on-paper-2: #4a5690;

  --red: #ef3b4a;
  --red-deep: #b5202e;
  --red-soft: #ff8a94;
  --blue: #2f6bf5;
  --blue-deep: #1c46b4;
  --blue-soft: #8fb2ff;
  --gold: #ffcb05;
  --gold-deep: #cc9e00;
  --gold-ink: #3d2f00;
  --yes: #35d97c;
  --yes-deep: #178f4a;
  --no: #ff7a2f;
  --no-deep: #b84e12;

  --r-panel: 20px;
  --r-card: 14px;
  --r-tile: 12px;
  --r-input: 10px;

  --font-display: 'Archivo', 'Arial Black', Impact, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --shadow-tile: 0 5px 0 var(--paper-3), 0 12px 24px -8px rgba(4, 8, 40, 0.55);
  --shadow-panel: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 4px 0 #05081f;
  --shadow-float: 0 30px 70px -20px rgba(2, 5, 30, 0.8), 0 8px 0 rgba(4, 8, 40, 0.5);
  --r-micro: 6px;

  --p1: var(--red); --p1-deep: var(--red-deep); --p1-soft: var(--red-soft);
  --p2: var(--blue); --p2-deep: var(--blue-deep); --p2-soft: var(--blue-soft);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-950);
  background-image:
    radial-gradient(1200px 700px at 50% -10%, rgba(64, 90, 200, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(239, 59, 74, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(47, 107, 245, 0.12), transparent 60%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
::selection { background: var(--gold); color: var(--gold-ink); }
[hidden] { display: none !important; }
a { color: var(--gold); }

/* ---------- Type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 850;
  font-stretch: 118%;
  letter-spacing: -0.01em;
  line-height: 0.95;
  text-transform: uppercase;
}
.display-tight { font-stretch: 100%; letter-spacing: -0.02em; }
.label {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 110%;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Boot ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; gap: 16px; text-align: center; color: var(--text-2); }
.boot-mark { width: 56px; height: 56px; margin: 0 auto; border-radius: 14px; background: linear-gradient(90deg, var(--red) 50%, var(--blue) 50%); animation: boot-spin 1.1s var(--ease-in-out) infinite; }
@keyframes boot-spin { 0% { transform: rotate(0); } 50% { transform: rotate(180deg) scale(0.9); } 100% { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--ink-700);
  --btn-fg: var(--text);
  --btn-deep: var(--ink-950);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--font-display); font-weight: 800; font-stretch: 108%; font-size: 15px;
  letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 4px 0 var(--btn-deep);
  transform: translateY(0);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out), filter 160ms ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-deep); }
@media (hover: hover) and (pointer: fine) { .btn:hover { filter: brightness(1.08); } }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-gold { --btn-bg: var(--gold); --btn-fg: var(--gold-ink); --btn-deep: var(--gold-deep); }
.btn-red { --btn-bg: var(--red); --btn-fg: #fff5f6; --btn-deep: var(--red-deep); }
.btn-blue { --btn-bg: var(--blue); --btn-fg: #f2f6ff; --btn-deep: var(--blue-deep); }
.btn-yes { --btn-bg: var(--yes); --btn-fg: #06301a; --btn-deep: var(--yes-deep); }
.btn-no { --btn-bg: var(--no); --btn-fg: #2b1200; --btn-deep: var(--no-deep); }
.btn-ghost { --btn-bg: transparent; --btn-deep: transparent; box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn-ghost:active { box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn-lg { min-height: 60px; padding: 0 30px; font-size: 18px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 12px; box-shadow: 0 3px 0 var(--btn-deep); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; }

/* ---------- Panels ---------- */
.panel {
  background: var(--ink-900);
  border: 2px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}
.panel-pad { padding: 24px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 22px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 800; font-size: 14px; }
.field .help { font-size: 13px; color: var(--text-3); margin: 0; }
.input, select.input {
  width: 100%; min-height: 46px; padding: 0 14px;
  background: var(--ink-950); border: 2px solid var(--line-strong); border-radius: var(--r-input);
  color: var(--text); font-weight: 700;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--gold); outline: none; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.switch { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: var(--ink-950); border: 2px solid var(--line); border-radius: var(--r-input); cursor: pointer; }
.switch:has(input:checked) { border-color: var(--gold); }
.switch .sw-text { display: grid; gap: 2px; }
.switch .sw-text b { font-size: 14px; }
.switch .sw-text span { font-size: 13px; color: var(--text-3); }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: var(--ink-700); position: relative; flex: none; margin: 0; transition: background 160ms ease; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform 160ms var(--ease-out); }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(20px); background: var(--gold-ink); }
.gens { display: flex; flex-wrap: wrap; gap: 6px; }
.gens label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--ink-950); border: 2px solid var(--line); border-radius: 999px; font-weight: 800; font-size: 13px; cursor: pointer; }
.gens label:has(input:checked) { border-color: var(--gold); color: var(--gold); }
.gens input { appearance: none; width: 0; height: 0; margin: 0; }
.settings-group { margin-bottom: 24px; }
.settings-group > .label { margin-bottom: 12px; display: block; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text); font-stretch: 100%; }
.settings-group.locked { opacity: 0.6; pointer-events: none; }

/* ==========================================================================
   LOBBY
   ========================================================================== */
.lobby { max-width: 1240px; margin: 0 auto; padding: 32px 20px 60px; }
.lobby { container-type: inline-size; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 8px 10px; border-radius: 999px; background: var(--ink-900); border: 2px solid var(--line); }
.topbar-room { font-weight: 800; color: var(--text-2); font-size: 14px; }
.topbar-room b { color: var(--gold); letter-spacing: 0.08em; }
.topbar-links { margin-left: auto; display: flex; gap: 6px; }
.player .topbar { margin-bottom: 0; }
.roundover .row.secondary { margin-top: 4px; }
.spec-help a { color: var(--text-2); margin-left: 8px; }
.lobby-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 24px; }
.lockup { display: grid; gap: 6px; }
.lockup .kicker { color: var(--gold); font-family: var(--font-display); font-weight: 800; font-stretch: 110%; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }
.lockup h1 { margin: 0; font-size: clamp(40px, 12cqi, 92px); }
.lockup h1 .r { color: var(--red); }
.lockup h1 .b { color: var(--blue); }
.lockup p { margin: 6px 0 0; max-width: 60ch; color: var(--text-2); font-size: 17px; }
.mini-trays { display: flex; gap: 10px; }
.mini-tray { width: 96px; height: 120px; border-radius: 14px; padding: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; box-shadow: 0 8px 0 rgba(4, 8, 40, 0.4); }
.mini-tray.red { background: var(--red); box-shadow: 0 8px 0 var(--red-deep); }
.mini-tray.blue { background: var(--blue); box-shadow: 0 8px 0 var(--blue-deep); }
.mini-tray i { display: block; border-radius: 4px; background: var(--paper); }
.mini-tray i.down { background: rgba(4, 8, 40, 0.45); }

.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.room-code { font-family: var(--font-display); font-weight: 850; font-stretch: 118%; font-size: 64px; letter-spacing: 0.08em; line-height: 1; color: var(--gold); }
.link-cards { display: grid; gap: 12px; }
.link-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--r-card); background: var(--ink-950); border: 2px solid var(--line); }
.link-card .swatch { width: 44px; height: 44px; border-radius: var(--r-tile); display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 18px; }
.link-card.p1 .swatch { background: var(--red); box-shadow: 0 4px 0 var(--red-deep); }
.link-card.p2 .swatch { background: var(--blue); box-shadow: 0 4px 0 var(--blue-deep); }
.link-card.spec .swatch { background: var(--gold); color: var(--gold-ink); box-shadow: 0 4px 0 var(--gold-deep); }
.link-card b { display: block; font-size: 15px; }
.link-card span { display: block; font-size: 13px; color: var(--text-3); }
.link-card .actions { display: flex; gap: 6px; }
.qr-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.qr { background: var(--paper); border-radius: 12px; padding: 8px; display: grid; place-items: center; gap: 4px; }
.qr img { width: 100%; image-rendering: pixelated; }
.qr small { color: var(--ink-on-paper-2); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.presence { display: grid; gap: 8px; margin-top: 16px; }
.presence-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-card); background: var(--ink-950); border: 2px solid var(--line); }
.presence-row .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-600); flex: none; }
.presence-row.joined .dot { background: var(--gold); }
.presence-row.ready .dot { background: var(--yes); box-shadow: 0 0 0 4px rgba(53, 217, 124, 0.25); }
.presence-row b { flex: 1; }
.footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; max-width: 80ch; }
.rules-card { display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.rules-card li { margin-bottom: 4px; }

/* ==========================================================================
   SHARED GAME CHROME: scorebug, trays, doors
   ========================================================================== */
.scorebug {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 0;
  border-radius: var(--r-panel); overflow: hidden;
  background: var(--ink-900); border: 1px solid var(--line); box-shadow: var(--shadow-panel);
}
.scorebug .side { display: flex; align-items: center; gap: 14px; padding: 12px 20px; min-width: 0; position: relative; transition: box-shadow 200ms ease; }
.scorebug .side.p1 { background: var(--red-deep); }
.scorebug .side.p2 { background: var(--blue-deep); flex-direction: row-reverse; text-align: right; }
.scorebug .side.active { box-shadow: inset 0 -8px 0 var(--gold); }
.scorebug .side > * { position: relative; }
.scorebug .chip { display: none; }
.scorebug .who { display: grid; gap: 2px; min-width: 0; }
.scorebug .who .name { font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 24px; text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scorebug .who .sub { font-size: 14px; font-weight: 800; color: var(--text); opacity: 0.85; }
.scorebug .score { font-family: var(--font-display); font-weight: 900; font-stretch: 120%; font-size: 40px; line-height: 1; margin-left: auto; }
.scorebug .side.p2 .score { margin-left: 0; margin-right: auto; }
.scorebug .center { display: grid; place-items: center; gap: 4px; padding: 10px 22px; background: var(--ink-950); border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 190px; text-align: center; }
.scorebug .center .round { font-family: var(--font-display); font-weight: 850; font-stretch: 118%; font-size: 18px; text-transform: uppercase; color: var(--gold); }
.scorebug .center .state { font-size: 14px; font-weight: 800; color: var(--text-2); white-space: nowrap; }
.scorebug .conn { font-size: 12px; font-weight: 800; color: var(--no); }
.scorebug .conn:empty { display: none; }
.scorebug .pips { display: flex; gap: 4px; }
.scorebug .pip { width: 12px; height: 12px; border-radius: 3px; background: rgba(4, 8, 40, 0.45); }
.scorebug .pip.on { background: var(--gold); }
.scorebug .side .active-tag { position: absolute; top: -1px; font-family: var(--font-display); font-weight: 900; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; background: var(--gold); color: var(--gold-ink); padding: 3px 12px; border-radius: 0 0 var(--r-micro) var(--r-micro); opacity: 0; transform: translateY(-6px); transition: opacity 200ms ease, transform 200ms var(--ease-out); }
.scorebug .side .active-tag { left: 50%; transform: translate(-50%, -6px); }
.scorebug .side.active .active-tag { transform: translate(-50%, 0); }
.scorebug .side.active .active-tag { opacity: 1; }

/* Timer ring */
.timer { --p: 1; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; background: conic-gradient(var(--gold) calc(var(--p) * 100%), var(--ink-700) 0); }
.timer::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--ink-950); }
.timer span { position: relative; font-family: var(--font-display); font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; }
.timer.paused { opacity: 0.5; }
.timer.hot { background: conic-gradient(var(--no) calc(var(--p) * 100%), var(--ink-700) 0); animation: timer-pulse 500ms ease-in-out infinite alternate; }
@keyframes timer-pulse { from { transform: scale(1); } to { transform: scale(1.07); } }

/* Tray */
.tray { --tray: var(--ink-700); --tray-deep: var(--ink-950); position: relative; border-radius: var(--r-panel); padding: 14px; background: var(--tray); box-shadow: 0 10px 0 var(--tray-deep), 0 30px 50px -20px rgba(2, 5, 30, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.22); }
.tray.p1 { --tray: var(--red); --tray-deep: var(--red-deep); }
.tray.p2 { --tray: var(--blue); --tray-deep: var(--blue-deep); }
.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 6px 12px; color: var(--text); }
.tray-head .tname { font-family: var(--font-display); font-weight: 850; font-stretch: 114%; font-size: 20px; text-transform: uppercase; line-height: 1; }
.tray-head .remain { font-family: var(--font-display); font-weight: 900; font-size: 15px; letter-spacing: 0.02em; text-transform: uppercase; background: rgba(4, 8, 40, 0.35); padding: 6px 12px; border-radius: 999px; }
.tray-head .remain b { font-size: 20px; margin-right: 4px; }
.board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 10px; perspective: 1400px; }
.board[data-size="48"] { --cols: 8; }

/* Door (tile) */
.door { position: relative; aspect-ratio: 0.92; border: 0; padding: 0; background: transparent; border-radius: var(--r-tile); transform-style: preserve-3d; transition: transform 260ms var(--ease-out); text-align: center; -webkit-tap-highlight-color: transparent; }
.door .face, .door .back { position: absolute; inset: 0; border-radius: var(--r-tile); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.door .face { background: var(--paper); color: var(--ink-on-paper); box-shadow: 0 5px 0 var(--tray-deep), 0 12px 24px -8px rgba(4, 8, 40, 0.55); display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.door .art { display: grid; place-items: center; padding: 8% 8% 2%; min-height: 0; }
.door .art img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(18, 26, 66, 0.25)); }
.door .plate { background: var(--ink-950); color: var(--text); font-family: var(--font-display); font-weight: 800; font-stretch: 90%; font-size: clamp(10px, 1.0vw, 13px); text-transform: uppercase; letter-spacing: 0; padding: 6px 4px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.door .back { transform: rotateX(180deg); background: var(--ink-950); border: 2px solid rgba(255, 255, 255, 0.28); box-shadow: inset 0 -5px 0 rgba(4, 8, 40, 0.55); display: grid; place-items: center; align-content: center; gap: 4px; color: var(--text-3); }
.door .back .x { font-family: var(--font-display); font-weight: 900; font-size: 34px; line-height: 1; color: var(--text-3); }
.door .back small { font-family: var(--font-display); font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 6px; }
.door.down { transform: rotateX(-180deg); }
.door.down .face { box-shadow: none; }
.door.secret .face::after { content: 'SECRET'; position: absolute; top: 6px; left: 6px; background: var(--gold); color: var(--gold-ink); font-family: var(--font-display); font-weight: 900; font-size: 10px; letter-spacing: 0.06em; padding: 3px 7px; border-radius: var(--r-micro); }
.door.guessed .face::after { content: 'GUESS'; position: absolute; top: 6px; left: 6px; background: var(--red); color: var(--text); font-family: var(--font-display); font-weight: 900; font-size: 10px; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; }
.door.pickable { cursor: pointer; }
.door.interactive { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .door.interactive:not(.down):hover { transform: translateY(-3px); }
  .door.interactive.down:hover { transform: rotateX(-180deg) translateY(3px); }
}
.door.interactive:active { transform: scale(0.97); }
.door.interactive.down:active { transform: rotateX(-180deg) scale(0.97); }
.board.picking .door:not(.down) .face { box-shadow: var(--shadow-tile), 0 0 0 3px transparent; }
.door.highlight .face { box-shadow: 0 0 0 4px var(--gold), var(--shadow-tile); }

/* Secret card */
.secret-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: var(--r-card); background: var(--paper); color: var(--ink-on-paper); box-shadow: var(--shadow-tile); position: relative; overflow: hidden; }
.secret-card img { width: 96px; height: 96px; object-fit: contain; position: relative; filter: drop-shadow(0 4px 4px rgba(18, 26, 66, 0.25)); }
.secret-card .sname { font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 22px; text-transform: uppercase; line-height: 1; }
.secret-card .stag { font-family: var(--font-display); font-weight: 900; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-on-paper-2); margin-bottom: 6px; }
.secret-card .types { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.type { display: inline-block; padding: 3px 9px; border-radius: 999px; font-family: var(--font-display); font-weight: 800; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-on-paper); background: var(--tc, var(--paper-3)); }
.type[data-t="ghost"], .type[data-t="dark"], .type[data-t="dragon"], .type[data-t="fighting"], .type[data-t="poison"], .type[data-t="water"], .type[data-t="fire"], .type[data-t="psychic"], .type[data-t="rock"] { color: var(--text); }
.type.gen { color: var(--text); background: var(--ink-700); }
.secret-card.hidden-secret img { filter: brightness(0) opacity(0.25); }
.secret-card.hidden-secret .sname { color: var(--ink-on-paper-2); }

/* Question feed */
.feed { display: grid; gap: 10px; align-content: start; }
.feed-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-card); background: var(--ink-950); border: 2px solid var(--line); }
.feed-item .n { font-family: var(--font-display); font-weight: 900; font-size: 13px; color: var(--text-3); min-width: 28px; }
.feed-item .by { font-family: var(--font-display); font-weight: 900; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.feed-item .by.p1 { color: var(--red-soft); }
.feed-item .by.p2 { color: var(--blue-soft); }
.feed-item .q { font-weight: 800; font-size: 16px; }
.feed-item .ans { font-family: var(--font-display); font-weight: 900; font-stretch: 116%; font-size: 18px; padding: 6px 14px; border-radius: 999px; text-transform: uppercase; }
.feed-item .ans.yes { background: var(--yes); color: #06301a; }
.feed-item .ans.no { background: var(--no); color: #2b1200; }
.feed-item .ans.wait { background: var(--ink-700); color: var(--text-2); font-size: 12px; }
.feed-item.guess { border-color: var(--gold); }
.feed-item.guess .ans.right { background: var(--gold); color: var(--gold-ink); }
.feed-item.guess .ans.wrong { background: var(--red); color: var(--text); }
.feed-item.timeout { opacity: 0.8; }
.panel .feed { gap: 0; }
.panel .feed-item { background: transparent; border: 0; border-top: 2px solid var(--line); border-radius: 0; padding: 12px 0; }
.panel .feed-item:first-child { border-top: 0; padding-top: 4px; }
.feed-empty { color: var(--text-3); font-weight: 700; padding: 18px; text-align: center; border: 2px dashed var(--line); border-radius: var(--r-card); }

/* ==========================================================================
   PLAYER VIEW
   ========================================================================== */
.player { max-width: 1320px; margin: 0 auto; padding: 16px 16px 110px; display: grid; gap: 16px; }
.player-main { display: grid; grid-template-columns: minmax(0, 740px) minmax(300px, 1fr); gap: 16px; align-items: start; }
.only-mobile { display: none; }
.secret-pill.only-mobile { display: none; }
.secret-pill { grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: var(--r-card); background: var(--paper); color: var(--ink-on-paper); box-shadow: var(--shadow-tile); }
.secret-pill img { width: 56px; height: 56px; object-fit: contain; }
.secret-pill .stag { font-family: var(--font-display); font-weight: 900; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-on-paper-2); }
.secret-pill .sname { font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 18px; text-transform: uppercase; line-height: 1; }
.player-side { display: grid; gap: 16px; position: sticky; top: 16px; }
.player .tray-head .tname { font-size: 18px; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(10, 15, 44, 0.98), rgba(10, 15, 44, 0.85) 70%, transparent); display: flex; gap: 10px; justify-content: center; z-index: 20; }
.actionbar .btn { flex: 1; max-width: 300px; }
.hint { font-size: 14px; font-weight: 800; color: var(--text-2); text-align: center; }
.hint.warn { color: var(--gold); }
.status-line { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 8px 14px; border-radius: 999px; font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 16px; text-transform: uppercase; background: var(--ink-900); border: 1px solid var(--line); }
.status-line.mine { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.status-line.theirs { color: var(--text-2); }
.status-line.pending { background: var(--ink-800); color: var(--gold); }

/* Sheets (bottom sheet on phone, side panel on desktop) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(4, 7, 28, 0.65); backdrop-filter: blur(6px); z-index: 30; opacity: 0; transition: opacity 200ms ease; }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: min(880px, 100vw); max-height: 88dvh; z-index: 31; background: var(--ink-900); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--r-panel) var(--r-panel) 0 0; box-shadow: var(--shadow-float); display: grid; grid-template-rows: auto 1fr auto; transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1); }
.sheet.open { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.sheet-head h3 { margin: 0; font-size: 22px; }
.sheet-body { overflow: auto; padding: 0 18px 18px; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 12px; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: transparent; font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.tab.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--ink-950); font-weight: 800; font-size: 14px; text-align: left; transition: transform 120ms var(--ease-out), border-color 120ms ease; }
.chip:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--gold); } }
.chip.sel { border-color: var(--gold); background: var(--gold); color: var(--gold-ink); }
.chip.asked { opacity: 0.55; cursor: not-allowed; text-decoration: line-through; text-decoration-color: var(--text-3); }
.chip .askedtag { font-family: var(--font-display); font-weight: 900; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; text-decoration: none; }
.chip .askedtag.yes { background: var(--yes); color: #06301a; }
.chip .askedtag.no { background: var(--no); color: #2b1200; }
.chip .askedtag.wait { background: var(--ink-700); color: var(--text-2); }
.linkish { background: none; border: 0; padding: 0 4px; color: var(--text-3); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; }
.linkish:hover { color: var(--gold); }
.qr-row.masked .qr { background: var(--ink-950); border: 2px dashed var(--line); min-height: 120px; }
.qr-row.masked .qr img { display: none; }
.qr-row.masked .qr small { color: var(--text-3); }
.room-code .btn { vertical-align: middle; margin-left: 10px; letter-spacing: 0.02em; }
.chip.sel .split { color: var(--gold-ink); }
.chip .split { font-family: var(--font-display); font-weight: 900; font-size: 11px; color: var(--text-3); }
.chip .split b.y { color: var(--yes); }
.chip .split b.n { color: var(--no); }
.freeform { display: grid; gap: 10px; margin-top: 8px; }
.freeform-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.freeform textarea.input { min-height: 48px; padding: 12px 14px; resize: none; }
.guess-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.guess-tile { padding: 8px 6px; border-radius: var(--r-tile); background: var(--paper); color: var(--ink-on-paper); border: 0; box-shadow: var(--shadow-tile); display: grid; gap: 4px; justify-items: center; transition: transform 120ms var(--ease-out); }
.guess-tile img { width: 72px; height: 72px; object-fit: contain; }
.guess-tile b { font-family: var(--font-display); font-weight: 800; font-size: 11px; text-transform: uppercase; }
.guess-tile:active { transform: scale(0.96); }
.guess-tile.sel { outline: 4px solid var(--gold); }
.guess-tile.dim { opacity: 0.45; }
.guess-tile.dim.sel { opacity: 1; }
.confirm-box { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; padding: 14px; border-radius: var(--r-card); background: var(--paper); color: var(--ink-on-paper); }
.confirm-box img { width: 120px; height: 120px; object-fit: contain; }
.confirm-box .big { font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 30px; text-transform: uppercase; line-height: 1; }
.confirm-box p { margin: 6px 0 0; color: var(--ink-on-paper-2); font-weight: 700; }

/* Answer prompt (big, for the answerer) */
.answer-prompt { display: grid; gap: 14px; padding: 18px; border-radius: var(--r-panel); background: var(--ink-800); border: 2px solid var(--gold); box-shadow: var(--shadow-float); }
.answer-prompt .qtext { font-family: var(--font-display); font-weight: 850; font-stretch: 108%; font-size: 24px; text-transform: none; line-height: 1.15; }
.answer-prompt .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer-prompt .about { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 800; }
.answer-prompt .about img { width: 44px; height: 44px; }

/* Round-over overlay (players) */
.roundover { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(6, 9, 34, 0.86); backdrop-filter: blur(8px); }
.roundover { animation: fade-in 300ms ease 1500ms both; }
.roundover .card { width: min(720px, 100%); padding: 24px; border-radius: var(--r-panel); background: var(--ink-900); border: 2px solid var(--line-strong); box-shadow: var(--shadow-float); display: grid; gap: 16px; text-align: center; animation: pop-in 420ms var(--ease-out) 1500ms both; }
@keyframes fade-in { from { opacity: 0; } }
.roundover h2 { margin: 0; font-size: clamp(32px, 4.5vw, 52px); text-wrap: balance; }
.roundover h2.p1 { color: var(--red); }
.roundover h2.p2 { color: var(--blue-soft); }
.roundover .reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.roundover .reveal .secret-card { grid-template-columns: 72px 1fr; }
.roundover .reveal .secret-card img { width: 72px; height: 72px; }
.roundover .why { color: var(--text-2); font-weight: 800; font-size: 16px; }
.roundover .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }

/* ==========================================================================
   SPECTATOR (broadcast, 1920x1080 stage scaled to fit)
   ========================================================================== */
.spec-root { position: fixed; inset: 0; overflow: hidden; display: grid; place-items: center; }
.stage { width: 1920px; height: 1080px; transform-origin: center; display: grid; grid-template-rows: auto 1fr; gap: 24px; padding: 24px 32px 32px; position: relative; }
.stage .scorebug .side { padding: 14px 24px; }
.stage .scorebug .who .name { font-size: 34px; }
.stage .scorebug .who .sub { font-size: 20px; }
.stage .scorebug .pip { width: 16px; height: 16px; border-radius: 4px; }
.stage .scorebug .pips { gap: 6px; }
.stage .scorebug .side .active-tag { font-size: 15px; padding: 5px 14px; }
.stage .scorebug .score { font-size: 58px; }
.stage .scorebug .center { min-width: 260px; }
.stage .scorebug .center .round { font-size: 24px; }
.stage .scorebug .center .state { font-size: 20px; }
.stage .timer { width: 78px; height: 78px; }
.stage .timer span { font-size: 28px; }
.stage-body { display: grid; grid-template-columns: 1fr 440px 1fr; gap: 24px; min-height: 0; }
.stage .tray { padding: 16px; }
.stage .tray-head .tname { font-size: 26px; }
.stage .tray-head .remain { font-size: 18px; }
.stage .tray-head .remain b { font-size: 26px; }
.stage .tray { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.stage .board { gap: 12px; height: 100%; min-height: 0; grid-auto-rows: 1fr; }
.stage .door { aspect-ratio: auto; height: 100%; min-height: 0; }
.stage .door .art { padding: 6% 6% 0; min-height: 0; }
.stage .door .art img { max-height: 100%; }
.stage .door .plate { font-size: 13px; font-stretch: 86%; padding: 7px 4px; }
.stage .door .back .x { font-size: 42px; }
.stage .door .back small { font-size: 14px; }
.stage-center { display: grid; grid-template-rows: auto auto auto 1fr; gap: 16px; min-height: 0; }
.stage .secrets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage .secret-card { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 12px 10px; }
.stage .secret-card img { width: 120px; height: 120px; }
.stage .secret-card .sname { font-size: 22px; }
.stage .secret-card .stag { font-size: 14px; }
.stage .type { font-size: 14px; padding: 4px 11px; }
.stage .secret-card .types { justify-content: center; }
.stage .secret-card.p1 { box-shadow: 0 6px 0 var(--red-deep), 0 12px 24px -8px rgba(4, 8, 40, 0.55); }
.stage .secret-card.p2 { box-shadow: 0 6px 0 var(--blue-deep), 0 12px 24px -8px rgba(4, 8, 40, 0.55); }
.stage .feed-wrap { min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr; gap: 10px; }
.stage .feed { overflow: hidden; }
.stage .feed-item { padding: 12px 14px; }
.stage .feed-item .q { font-size: 21px; }
.stage .feed-item .n { font-size: 16px; }
.stage .feed-item .by { font-size: 14px; }
.stage .feed-item .ans { font-size: 20px; }
.stage .feed-item:first-child { border-color: var(--gold); }
.stage .feed-item:first-child .q { font-size: 23px; }
.stage .now { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r-panel); background: var(--ink-900); border: 1px solid var(--line); box-shadow: var(--shadow-panel); text-align: center; }
.stage .now .big { font-family: var(--font-display); font-weight: 850; font-stretch: 112%; font-size: 26px; text-transform: uppercase; line-height: 1; }
.stage .now .big.p1 { color: var(--red-soft); }
.stage .now .big.p2 { color: var(--blue-soft); }
.stage .now .big.q { text-transform: none; font-stretch: 104%; font-size: 30px; line-height: 1.15; color: var(--gold); }
.stage .now .small { font-weight: 800; color: var(--text-2); font-size: 20px; }
.stage .last { display: grid; gap: 8px; justify-items: center; padding: 16px; border-radius: var(--r-panel); background: var(--ink-950); border: 2px solid var(--gold); text-align: center; }
.stage .last .by { font-family: var(--font-display); font-weight: 900; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.stage .last .by.p1 { color: var(--red-soft); }
.stage .last .by.p2 { color: var(--blue-soft); }
.stage .last .lq { font-weight: 800; font-size: 30px; line-height: 1.15; }
.stage .last .ans { font-family: var(--font-display); font-weight: 900; font-stretch: 116%; font-size: 40px; padding: 6px 30px 10px; border-radius: 999px; text-transform: uppercase; }
.stage .last .ans.yes { background: var(--yes); color: #06301a; }
.stage .last .ans.no { background: var(--no); color: #2b1200; }
.stage .last .ans.wrong { background: var(--red); color: var(--text); }
.stage .last .ans.wait { background: var(--ink-700); color: var(--text); }
.spec-root { background: var(--ink-950); }
.spec-help { position: fixed; right: 14px; bottom: 12px; font-size: 12px; color: var(--text-3); font-weight: 800; opacity: 0; z-index: 5; transition: opacity 200ms ease; }
.spec-root:hover ~ .spec-help, .spec-help:hover { opacity: 1; }
.spec-help kbd { font-family: var(--font-display); background: var(--ink-800); padding: 2px 6px; border-radius: 6px; margin-right: 2px; }
.stage.hide-secrets .secret-card img { filter: brightness(0) opacity(0.3); }
.stage.hide-secrets .secret-card .sname { color: var(--ink-on-paper-2); }
.stage .door.secret .face::after { content: 'TARGET'; }
.stage.hide-secrets .door.secret .face::after { display: none; }
.stage.hide-feed .feed-wrap { visibility: hidden; }

/* Answer stamp (spectator + players) */
.stamp { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(1.25); pointer-events: none; z-index: 45; font-family: var(--font-display); font-weight: 900; font-stretch: 122%; font-size: 150px; line-height: 1; text-transform: uppercase; padding: 10px 50px 18px; border-radius: 20px; border: 10px solid currentColor; opacity: 0; filter: blur(10px); animation: stamp 1500ms var(--ease-out) forwards; box-shadow: var(--shadow-float); }
.stamp.yes { color: #06301a; background: var(--yes); border-color: #0d5c2f; }
.stamp.no { color: #2b1200; background: var(--no); border-color: #7a2f06; }
.stamp.right { color: var(--gold-ink); background: var(--gold); border-color: #7a5d00; font-size: 120px; }
.stamp.wrong { color: var(--text); background: var(--red); border-color: var(--red-deep); font-size: 120px; }
.stamp.time { color: var(--text); background: var(--ink-700); border-color: var(--ink-950); font-size: 100px; }
.stamp.small { font-size: 96px; border-width: 7px; border-radius: 20px; padding: 8px 34px 14px; }
.stamp.small.right, .stamp.small.wrong { font-size: 72px; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.3) rotate(-6deg); filter: blur(10px); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); filter: blur(0); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.96) rotate(-3deg); }
}

/* Turn banner */
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.layer-toast { display: grid; align-content: end; justify-items: center; gap: 8px; padding: 0 16px 24px; z-index: 60; }
.toast { pointer-events: auto; max-width: 560px; padding: 12px 18px; border-radius: 999px; background: var(--paper); color: var(--ink-on-paper); font-weight: 800; box-shadow: var(--shadow-float); animation: toast-in 240ms var(--ease-out); }
.toast.err { background: var(--red); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.banner { position: absolute; left: 0; right: 0; top: 40%; transform: translateY(-50%); display: grid; justify-items: center; }
.banner .band { max-width: 100vw; white-space: nowrap; overflow: hidden; padding: 16px 5vw 22px; font-family: var(--font-display); font-weight: 900; font-stretch: 122%; font-size: clamp(28px, 5.2vw, 104px); line-height: 1; text-transform: uppercase; color: var(--text); text-shadow: 0 6px 0 rgba(4, 8, 40, 0.4); clip-path: inset(0 100% 0 0); animation: band 1400ms var(--ease-in-out) forwards; box-shadow: var(--shadow-float); }
.banner .band.p1 { background: var(--red); }
.banner .band { color: var(--text); }
.banner .band.p2 { background: var(--blue); }
.banner .band.gold { background: var(--gold); color: var(--gold-ink); }
@keyframes band {
  0% { clip-path: inset(0 100% 0 0); }
  25% { clip-path: inset(0 0 0 0); }
  78% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 100%); }
}
.confetti-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 55; }

/* ---------- Champion ---------- */
.champion { display: grid; gap: 10px; text-align: center; }
.champion .crown { font-size: 48px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-hero { grid-template-columns: 1fr; }
  .mini-trays { display: none; }
  .player-main { grid-template-columns: 1fr; }
  .player-side { position: static; }
}
@media (max-width: 720px) {
  .board, .board[data-size="48"] { --cols: 4; gap: 8px; }
  .door .plate { font-size: 10px; }
  .door.secret .face::after, .door.guessed .face::after { font-size: 8px; padding: 2px 5px; }
  .scorebug { grid-template-columns: 1fr 1fr; }
  .scorebug .center { order: 3; grid-column: 1 / -1; border: 0; border-top: 1px solid var(--line); min-width: 0; padding: 6px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
  .scorebug .center .round { font-size: 15px; }
  .scorebug .center .state { white-space: normal; }
  .timer { width: 48px; height: 48px; margin-left: auto; }
  .timer span { font-size: 16px; }
  .timer::before { inset: 5px; }
  .scorebug .side.p2 { order: 2; }
  .only-mobile { display: grid; }
  .only-desktop { display: none !important; }
  .actionbar { gap: 8px; }
  .actionbar .btn { font-size: 13px; padding: 0 10px; min-height: 52px; min-width: 0; }
  .sheet-head h3 { font-size: 18px; }
  .scorebug .who .name { font-size: 16px; font-stretch: 96%; }
  .scorebug .who .you { display: none; }
  .scorebug .score { font-size: 28px; }
  .scorebug .side { padding: 10px 12px; gap: 10px; }
  .secret-pill.only-mobile { display: grid; }
  .player-main.pre-round .player-side { order: -1; }
  .secret-pill > .muted { display: none; }
  .scorebug .side .active-tag { display: none; }
  .tray { padding: 10px; }
  .player { padding: 10px 10px 100px; }
  .qr-row { grid-template-columns: 1fr; }
  .roundover .reveal { grid-template-columns: 1fr; }
  .room-code { font-size: 48px; }
  .stamp.small { font-size: 64px; }
  .stamp.small.right, .stamp.small.wrong { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .door { transition: none; }
  .banner .band { animation: band-reduced 1200ms ease forwards; }
  @keyframes band-reduced { 0% { opacity: 0; clip-path: none; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
  .stamp { animation: stamp-reduced 1400ms ease forwards; }
  @keyframes stamp-reduced { 0% { opacity: 0; transform: translate(-50%, -50%); filter: none; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
  .timer.paused { opacity: 0.5; }
.timer.hot { animation: none; }
  .boot-mark { animation: none; }
}

/* Type colors (official-ish palette, tinted) */
.type[data-t="normal"] { --tc: #9a9a7a; } .type[data-t="fire"] { --tc: #ee7f2f; } .type[data-t="water"] { --tc: #4a86e6; }
.type[data-t="grass"] { --tc: #67b83f; } .type[data-t="electric"] { --tc: #e2b400; } .type[data-t="ice"] { --tc: #5ec3d4; }
.type[data-t="fighting"] { --tc: #c03a2b; } .type[data-t="poison"] { --tc: #9b46b7; } .type[data-t="ground"] { --tc: #c9a548; }
.type[data-t="flying"] { --tc: #8a9be8; } .type[data-t="psychic"] { --tc: #f25d92; } .type[data-t="bug"] { --tc: #97a51b; }
.type[data-t="rock"] { --tc: #a89235; } .type[data-t="ghost"] { --tc: #6a4f9b; } .type[data-t="dragon"] { --tc: #5b4bd6; }
.type[data-t="dark"] { --tc: #5a4b41; } .type[data-t="steel"] { --tc: #8a95b4; } .type[data-t="fairy"] { --tc: #e58fc2; }

/* ==========================================================================
   HALLOWEEN EDITION
   Same trays and broadcast grammar, after dark: aubergine table under a harvest
   moon, bone-white pieces, ruled-out Pokémon become gravestones, and the candy
   bucket is the one authored moment. Red/Blue player identity is untouched.
   ========================================================================== */
:root[data-edition="halloween"] {
  --ink-950: #120a1f;
  --ink-900: #1b1030;
  --ink-800: #261843;
  --ink-700: #352156;
  --ink-600: #4a2f75;
  --line: rgba(214, 190, 255, 0.28);
  --line-strong: rgba(214, 190, 255, 0.42);
  --paper: #f4eedf;
  --paper-2: #e6dcc6;
  --paper-3: #cbbd9f;
  --text: #f6f0ff;
  --text-2: #cdbde9;
  --text-3: #9d8cc0;
  --ink-on-paper: #22122f;
  --ink-on-paper-2: #5e4a6e;
  --gold: #ffc61a;
  --gold-deep: #c98f00;
  --gold-ink: #3a2400;
  --pumpkin: #ff7b1c;
  --pumpkin-deep: #b84a00;
  --pumpkin-ink: #2e1200;
  --treat: #ff6fb5;
  --treat-deep: #b8327a;
  --treat-ink: #3a0a22;
  --witch: #9b5cff;
  --witch-deep: #5a28b0;
  --witch-soft: #c9a8ff;
  --stone: #3d2f57;
  --stone-hi: #52416f;
  --shadow-tile: 0 5px 0 var(--paper-3), 0 12px 24px -8px rgba(10, 4, 24, 0.6);
  --shadow-panel: inset 0 2px 0 rgba(255, 255, 255, 0.07), 0 4px 0 #0a0514;
  --shadow-float: 0 30px 70px -20px rgba(8, 2, 20, 0.85), 0 8px 0 rgba(10, 4, 24, 0.55);
}
[data-edition="halloween"] body {
  background-color: var(--ink-950);
  background-image:
    radial-gradient(64px circle at 88% 10%, #efe2bd 97%, transparent 100%),
    radial-gradient(420px circle at 88% 10%, rgba(255, 214, 140, 0.14), transparent 70%),
    radial-gradient(1100px 600px at 30% -10%, rgba(120, 70, 200, 0.30), transparent 62%),
    radial-gradient(1400px 380px at 50% 112%, rgba(140, 230, 170, 0.08), transparent 70%);
  background-attachment: fixed;
}
[data-edition="halloween"] .spec-root {
  background-color: var(--ink-950);
  background-image:
    radial-gradient(1600px 360px at 50% 115%, rgba(140, 230, 170, 0.07), transparent 70%),
    radial-gradient(1200px 500px at 50% -20%, rgba(120, 70, 200, 0.22), transparent 65%);
}

/* Lockup */
[data-edition="halloween"] .lockup .kicker { color: var(--pumpkin); }
.edition-badge {
  justify-self: start; margin-top: 6px; padding: 6px 16px 8px; border-radius: var(--r-micro);
  font-family: var(--font-display); font-weight: 900; font-stretch: 120%; font-size: clamp(18px, 3cqi, 28px);
  line-height: 1; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--pumpkin-ink); background: var(--pumpkin); box-shadow: 0 5px 0 var(--pumpkin-deep);
  transform: rotate(-2deg);
}
[data-edition="halloween"] .mini-tray i { background: var(--paper); }
[data-edition="halloween"] .mini-tray i.down { background: var(--stone); border-radius: 999px 999px 3px 3px; }
[data-edition="halloween"] .mini-tray { box-shadow: 0 8px 0 rgba(10, 4, 24, 0.5); }

/* Trays: a cobweb hangs off the outer top corner */
[data-edition="halloween"] .tray { box-shadow: 0 10px 0 var(--tray-deep), 0 30px 50px -20px rgba(8, 2, 20, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.2); }
[data-edition="halloween"] .tray::before {
  content: ''; position: absolute; top: -30px; width: 58px; height: 58px; pointer-events: none; z-index: 1; opacity: 0.55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23efe6ff' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M0 0 L100 100 M0 0 L100 38 M0 0 L38 100 M0 0 L100 0 M0 0 L0 100'/%3E%3Cpath d='M18 0 Q16 8 13 13 Q8 16 0 18'/%3E%3Cpath d='M38 0 Q34 17 27 27 Q17 34 0 38'/%3E%3Cpath d='M60 0 Q54 26 42 42 Q26 54 0 60'/%3E%3Cpath d='M84 0 Q75 37 59 59 Q37 75 0 84'/%3E%3C/svg%3E") no-repeat;
}
[data-edition="halloween"] .tray::before { left: -30px; }
[data-edition="halloween"] .stage .tray.p2::before { left: auto; right: -30px; transform: scaleX(-1); }
[data-edition="halloween"] .tray-head .remain { background: rgba(18, 8, 30, 0.38); }

/* Doors: bone faces, gravestones when ruled out */
[data-edition="halloween"] .door .face { box-shadow: 0 5px 0 var(--tray-deep), 0 12px 24px -8px rgba(10, 4, 24, 0.6); }
[data-edition="halloween"] .door .art img { filter: drop-shadow(0 4px 4px rgba(34, 18, 47, 0.28)); }
[data-edition="halloween"] .door .plate { background: var(--ink-950); }
[data-edition="halloween"] .door .back {
  background: linear-gradient(to top, #0e1a14 0 12%, var(--ink-950) 12%);
  border-color: rgba(214, 190, 255, 0.22); box-shadow: none;
}
[data-edition="halloween"] .door .back::before {
  content: ''; position: absolute; left: 8%; right: 8%; top: 9%; bottom: 10%;
  background: var(--stone); border-radius: 50% 50% 4px 4px / 34% 34% 4px 4px;
  box-shadow: inset 0 3px 0 var(--stone-hi), inset 0 -6px 0 rgba(10, 4, 24, 0.35), 0 4px 0 rgba(10, 4, 24, 0.5);
}
[data-edition="halloween"] .door .back > * { position: relative; }
[data-edition="halloween"] .door .back .x { font-size: 0; color: var(--text-3); }
[data-edition="halloween"] .door .back .x::after { content: 'RIP'; font-size: 12px; letter-spacing: 0.1em; }
[data-edition="halloween"] .door .back small { color: var(--text); width: 84%; padding: 0 2px; font-size: 11px; font-stretch: 66%; letter-spacing: 0; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-edition="halloween"] .door .back small[data-long] { font-size: 10px; font-stretch: 62%; }
[data-edition="halloween"] .board[data-size="48"] .door .back small { font-size: 10px; font-stretch: 62%; }
[data-edition="halloween"] .stage .door .back .x::after { font-size: 16px; }
[data-edition="halloween"] .stage .door .back small { font-size: 17px; }
[data-edition="halloween"] .stage .door .back small[data-long] { font-size: 13.5px; }
[data-edition="halloween"] .stage .board[data-size="48"] .door .back small { font-size: 11.5px; }
[data-edition="halloween"] .stage .board[data-size="48"] .door .back small[data-long] { font-size: 9px; }

/* Chrome that had navy baked in */
[data-edition="halloween"] .actionbar { background: linear-gradient(to top, rgba(18, 10, 31, 0.98), rgba(18, 10, 31, 0.85) 70%, transparent); }
[data-edition="halloween"] .sheet-backdrop { background: rgba(10, 4, 24, 0.66); }
[data-edition="halloween"] .roundover { background: rgba(14, 6, 26, 0.86); }
[data-edition="halloween"] .scorebug .pip { background: rgba(18, 8, 30, 0.45); }
[data-edition="halloween"] .banner .band { text-shadow: 0 6px 0 rgba(10, 4, 24, 0.4); }
[data-edition="halloween"] .boot-mark { background: linear-gradient(90deg, var(--pumpkin) 50%, var(--witch) 50%); }

/* Trick or Treat notes, tags, banner */
.banner .band.trick { background: var(--witch); color: var(--ink-950); }
.tot-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tot-note { font-family: var(--font-display); font-weight: 900; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.tot-note.treat { background: var(--treat); color: var(--treat-ink); }
.tot-note.trick { background: var(--witch); color: var(--ink-950); }
.stage .tot-note { font-size: 15px; padding: 4px 12px; }
.stage .last .tot-notes { justify-content: center; margin-top: 2px; }
.scorebug .cursed { display: inline-block; margin-left: 8px; padding: 1px 8px 2px; border-radius: 999px; background: var(--ink-950); color: var(--witch-soft); font-family: var(--font-display); font-weight: 900; font-size: 0.75em; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px; }
.status-line.treat { background: var(--treat); color: var(--treat-ink); }
.status-line.tricked { background: var(--witch); color: var(--ink-950); border-color: transparent; }

/* The bucket moment */
.tot { position: absolute; left: 50%; top: 71%; z-index: 46; pointer-events: none; display: grid; justify-items: center; gap: 6px; width: 900px; transform: translate(-50%, -50%); --bucket: 300px; --word: 150px; --line: 40px; }
.tot.small { position: fixed; top: 50%; width: min(92vw, 560px); --bucket: 170px; --word: 84px; --line: 22px; }
.tot-glow { position: absolute; inset: -18% -10%; background: radial-gradient(closest-side, rgba(18, 10, 31, 0.86), rgba(18, 10, 31, 0.55) 60%, transparent); opacity: 0; animation: tot-fade 2800ms linear forwards; }
.tot-bucket { position: relative; width: var(--bucket); aspect-ratio: 1; opacity: 0; transform-origin: 50% 90%; animation: tot-drop 2800ms var(--ease-out) forwards; }
.tot-bucket > svg:last-child { position: relative; width: 100%; height: 100%; filter: drop-shadow(0 10px 0 rgba(10, 4, 24, 0.55)) drop-shadow(0 0 40px rgba(255, 150, 40, 0.35)); }
.tot-pop { position: absolute; left: 50%; top: 18%; width: 58%; transform: translate(-50%, 30%); opacity: 0; animation: tot-pop 2800ms var(--ease-out) forwards; }
.tot-word { position: relative; margin-top: calc(var(--bucket) * -0.12); font-family: var(--font-display); font-weight: 900; font-stretch: 122%; font-size: var(--word); line-height: 1; text-transform: uppercase; padding: 8px 0.32em 14px; border-radius: 20px; border: calc(var(--word) * 0.065) solid; opacity: 0; animation: tot-word 2800ms var(--ease-out) forwards; box-shadow: var(--shadow-float); }
.tot-treat .tot-word { background: var(--treat); color: var(--treat-ink); border-color: var(--treat-deep); }
.tot-trick .tot-word { background: var(--witch); color: var(--ink-950); border-color: var(--witch-deep); }
.tot-line { position: relative; font-family: var(--font-display); font-weight: 850; font-stretch: 110%; font-size: var(--line); text-transform: uppercase; color: var(--text); background: var(--ink-950); border: 2px solid var(--line-strong); padding: 0.3em 0.8em 0.35em; border-radius: 999px; opacity: 0; animation: tot-line 2800ms var(--ease-out) forwards; text-align: center; text-wrap: balance; }
@keyframes tot-fade { 0% { opacity: 0; } 8% { opacity: 1; } 86% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tot-drop {
  0% { opacity: 0; transform: translateY(-60px) scale(0.92); filter: blur(8px); }
  10% { opacity: 1; transform: translateY(0) scale(1.04, 0.95); filter: blur(0); }
  14% { transform: translateY(0) scale(1); }
  18% { transform: rotate(-9deg); }
  22% { transform: rotate(8deg); }
  26% { transform: rotate(-7deg); }
  30% { transform: rotate(5deg); }
  33% { transform: rotate(0) scale(1); }
  36% { transform: scale(1.06, 0.94); }
  40% { transform: scale(1); }
  86% { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(16px) scale(0.97); filter: blur(4px); }
}
@keyframes tot-pop {
  0%, 33% { opacity: 0; transform: translate(-50%, 30%); }
  42% { opacity: 1; transform: translate(-50%, -62%); }
  86% { opacity: 1; transform: translate(-50%, -58%); }
  100% { opacity: 0; transform: translate(-50%, -70%); }
}
@keyframes tot-word {
  0%, 32% { opacity: 0; transform: scale(1.3) rotate(-6deg); filter: blur(10px); }
  40% { opacity: 1; transform: scale(1) rotate(-3deg); filter: blur(0); }
  86% { opacity: 1; transform: scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: scale(0.96) rotate(-3deg); }
}
@keyframes tot-line {
  0%, 40% { opacity: 0; transform: translateY(8px); }
  48% { opacity: 1; transform: none; }
  86% { opacity: 1; }
  100% { opacity: 0; }
}
@media (max-width: 720px) {
  .tot.small { --bucket: 130px; --word: 64px; --line: 18px; }
  [data-edition="halloween"] .tray::before { width: 40px; height: 40px; top: -12px; left: -10px; }
  [data-edition="halloween"] .door .back .x::after { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tot-bucket, .tot-word, .tot-line, .tot-pop { animation: tot-fade 2600ms linear forwards; }
}

.scorebug .center .ed-tag { font-family: var(--font-display); font-weight: 900; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pumpkin-ink); background: var(--pumpkin); padding: 2px 10px 3px; border-radius: var(--r-micro); }
.stage .scorebug .center .ed-tag { font-size: 15px; padding: 3px 12px 4px; }
@media (max-width: 720px) {
  .scorebug .center .ed-tag { display: none; }
  /* phones: the nav bar wrapped wider than the screen and pushed the tray off the right edge */
  .topbar { flex-wrap: wrap; justify-content: center; gap: 4px 8px; border-radius: var(--r-card); }
  .topbar-links { margin-left: 0; }
}
@media (max-width: 720px) {
  [data-edition="halloween"] body { background-image:
    radial-gradient(30px circle at 90% 2.5%, #efe2bd 97%, transparent 100%),
    radial-gradient(200px circle at 90% 2.5%, rgba(255, 214, 140, 0.12), transparent 70%),
    radial-gradient(700px 400px at 30% -10%, rgba(120, 70, 200, 0.30), transparent 62%); }
}
[data-edition="halloween"] .stage .door .back small[data-xl] { font-size: 12px; }
[data-edition="halloween"] .stage .board[data-size="48"] .door .back small[data-xl] { font-size: 8px; }
