/* kbDrop live survey. Terrarium materials (docs/design/terrarium-design-spec.md):
   obsidian hardware, paper cards, phosphor glass. Day is Himalaya, night is moss garden. */

@font-face { font-family: "Departure Mono"; src: url("/fonts/DepartureMono-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light;
  --page: #eceff0; --surface: #f6f8f8; --surface-strong: #ffffff;
  --line: #d3d9dc; --line-strong: #b8c2c8;
  --ink: #171c20; --ink-soft: #303841; --muted: #59636a;
  --obs: #1b1f24; --obs-lit: #292e34; --obs-rim: #737a82; --on-obs: #e4e9ec; --on-obs-muted: #a4adb4; --obs-shade: #0a0b0a;
  --phosphor: #0f2a24; --phosphor-2: #193639; --mint: #a2dab4; --mint-bright: #cceac7; --haze: #8fab98; --cell-off: #1f4a3e;
  --water: #3dade0; --water-text: #1b6f9a; --water-on-obs: #62c4ea; --focus: #1b6f9a;
  --primary: #3dade0; --primary-hover: #55bbe8; --on-primary: #171c20;
  --lime: #94d21e; --lime-bright: #b8ef4b; --on-lime: #14201c; --olive: #47630d;
  --amber: #d6c34f; --danger: #b33b24; --danger-soft: #fbe9e4; --danger-line: #e0a898;
  --tag: #dde8ee; --tag-ink: #1e3a4a; --tag-line: #a3bccb;
  --bar-track: #e3e8ea;
  /* Choice keys: shape and colour together, so no answer relies on colour alone. */
  --c0: #3dade0; --c1: #cf6a3c; --c2: #d6c34f; --c3: #a2dab4; --on-choice: #14201c;
  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --bitmap: "Departure Mono", "IBM Plex Mono", ui-monospace, monospace;
  --r-lg: 12px; --r-md: 8px; --r-sm: 6px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #111613; --surface: #181e1a; --surface-strong: #1f2620;
    --line: #2a332c; --line-strong: #3a463d;
    --ink: #e0e7df; --ink-soft: #c6cfc5; --muted: #a2ada3;
    --obs: #212822; --obs-lit: #303a31; --obs-rim: #7e887f; --on-obs: #e1e8e0; --on-obs-muted: #a6b0a5;
    --water-text: #62c4ea; --focus: #62c4ea;
    --primary: #cf6a3c; --primary-hover: #dc7b4e; --on-primary: #e1e8e0;
    --olive: #b8ef4b; --danger: #f0937e; --danger-soft: #3a211b; --danger-line: #7a4a3c;
    --tag: #253327; --tag-ink: #c6dcc4; --tag-line: #3f5442;
    --bar-track: #2a332c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111613; --surface: #181e1a; --surface-strong: #1f2620;
  --line: #2a332c; --line-strong: #3a463d;
  --ink: #e0e7df; --ink-soft: #c6cfc5; --muted: #a2ada3;
  --obs: #212822; --obs-lit: #303a31; --obs-rim: #7e887f; --on-obs: #e1e8e0; --on-obs-muted: #a6b0a5;
  --water-text: #62c4ea; --focus: #62c4ea;
  --primary: #cf6a3c; --primary-hover: #dc7b4e; --on-primary: #e1e8e0;
  --olive: #b8ef4b; --danger: #f0937e; --danger-soft: #3a211b; --danger-line: #7a4a3c;
  --tag: #253327; --tag-ink: #c6dcc4; --tag-line: #3f5442;
  --bar-track: #2a332c;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 16px/1.45 var(--sans); font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--water-text); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h1, h2, h3 { margin: 0; font-weight: 800; font-variation-settings: "wdth" 112; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }

/* ---------- shared materials ---------- */

.nameplate {
  display: flex; align-items: center; gap: 14px;
  background: var(--obs); color: var(--on-obs); border-radius: var(--r-lg);
  padding: 8px 10px 8px 16px; min-height: 60px;
  box-shadow: 0 3px 0 var(--obs-shade), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.brand { display: inline-flex; flex: none; align-items: center; min-height: 44px; color: inherit; }
.brand img { display: block; width: 160px; height: 32px; }
.plate-label {
  font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  font-variation-settings: "wdth" 125; color: var(--on-obs-muted);
}
.lamp { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--lime-bright); box-shadow: 0 0 10px rgba(184, 239, 75, .55); }
.eyebrow {
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: "// "; color: var(--water-text); }
.meta { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.card {
  background: var(--surface-strong); border: 2px solid var(--ink); border-radius: 12px 12px 4px 12px;
  box-shadow: 0 3px 0 var(--ink); padding: 18px;
}
.glass {
  position: relative; background: var(--phosphor); color: var(--mint);
  border: 6px solid var(--obs-lit); outline: 2px solid var(--obs-rim); outline-offset: 0;
  border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .1), inset 0 -2px 0 rgba(0, 0, 0, .28), 0 3px 0 var(--obs-shade);
}
.glass .bitmap { font-family: var(--bitmap); color: var(--mint-bright); }
.shape { display: block; flex: none; }
.shape path, .shape rect, .shape circle { fill: currentColor; }

.key {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r-md); cursor: pointer;
  font: 800 13px/1 var(--sans); font-variation-settings: "wdth" 125; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surface-strong); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s, background-color .12s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.key:disabled { opacity: .5; cursor: not-allowed; }
.key.primary { background: var(--primary); color: var(--on-primary); }
.key.primary:hover:not(:disabled) { background: var(--primary-hover); }
.key.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); box-shadow: 0 3px 0 var(--danger); }
.key kbd { font: 600 13px/1 var(--mono); letter-spacing: 0; text-transform: none; opacity: .72; }

@keyframes pop-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- phone ---------- */

body.play { min-height: 100dvh; }
.phone {
  max-width: 540px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px;
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}
.play .nameplate .plate-label { display: none; }
@media (max-width: 400px) { .play .brand img { width: 120px; height: 24px; } }
.link-state { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding-right: 6px; }
.link-label { font: 700 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--on-obs-muted); }
.link-state[data-state="connecting"] .lamp,
.link-state[data-state="reconnecting"] .lamp { background: var(--amber); box-shadow: 0 0 10px rgba(214, 195, 79, .5); animation: blink 1.2s steps(2, jump-none) infinite; }
.link-state[data-state="offline"] .lamp { background: var(--danger); box-shadow: none; }
.phone-main { flex: 1; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.intro { display: grid; gap: 10px; }
.intro h1 { font-size: clamp(26px, 7.5vw, 34px); line-height: 1.08; }
.lede { color: var(--ink-soft); }

.join-form { display: grid; gap: 12px; }
.join-form label { font-weight: 700; font-size: 14px; }
.name-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.name-row input {
  width: 100%; min-height: 52px; font: 600 18px/1.2 var(--sans); color: var(--ink);
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-md); padding: 10px 14px;
}
.name-row input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.name-row .key { min-width: 52px; padding: 0 12px; font-size: 20px; }
.join-form .key.primary { min-height: 56px; font-size: 15px; width: 100%; }
.notice {
  padding: 12px 14px; border-radius: var(--r-md); border: 2px solid var(--danger-line);
  background: var(--danger-soft); color: var(--danger); font-size: 15px;
}
.fine { font-size: 14px; color: var(--muted); }

.wait { display: grid; gap: 14px; padding: 22px 20px 20px; text-align: center; justify-items: center; }
.wait .bitmap { font-size: 15px; letter-spacing: .14em; color: var(--haze); }
.wait .who { font: 800 clamp(28px, 9vw, 40px)/1.05 var(--sans); font-variation-settings: "wdth" 118; color: var(--mint-bright); overflow-wrap: anywhere; }
.wait p:not(.bitmap):not(.who) { color: var(--mint); }
.sprout-lamp { display: flex; gap: 6px; }
.sprout-lamp span { width: 10px; height: 10px; background: var(--lime); box-shadow: 0 0 8px rgba(148, 210, 30, .5); animation: blink 1.6s steps(2, jump-none) infinite; }
.sprout-lamp span:nth-child(2) { animation-delay: .4s; }
.sprout-lamp span:nth-child(3) { animation-delay: .8s; }
.text-link { background: none; border: 0; padding: 10px; color: var(--water-text); text-decoration: underline; cursor: pointer; font-size: 15px; min-height: 44px; }

.round-head { display: grid; gap: 4px; }
.round-head h1 { font-size: clamp(24px, 6.6vw, 30px); line-height: 1.1; }
.round-head .prompt { color: var(--ink-soft); font-size: 16px; }

.clock { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-width: 4px; border-radius: 12px; }
.clock .secs { font-family: var(--bitmap); font-size: 22px; color: var(--mint-bright); min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.clock .secs.untimed { font-size: 13px; letter-spacing: .1em; color: var(--haze); }
.meter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 14px; }
.meter i { background: var(--cell-off); border-radius: 1px; }
.meter i.on { background: var(--lime); }
.meter.warn i.on { background: var(--amber); }
.meter.late i.on { background: var(--danger); }

.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.picks li { position: relative; display: flex; flex: 1 1 0; min-height: 0; }
.pick {
  position: relative; flex: 1; display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; align-items: stretch;
  min-height: 84px; max-height: 168px; padding: 0; text-align: left; cursor: pointer; overflow: hidden;
  background: var(--surface-strong); border: 2px solid var(--ink); border-radius: 12px 12px 4px 12px; box-shadow: 0 4px 0 var(--ink);
  transition: transform .06s, box-shadow .06s, opacity .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
.pick:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.pick-key { display: grid; place-items: center; align-content: center; gap: 4px; background: var(--choice); color: var(--on-choice); border-right: 2px solid var(--ink); }
.pick-key .shape { width: 26px; height: 26px; }
.pick-key b { font: 800 14px/1 var(--mono); }
.pick-text { display: grid; align-content: center; gap: 3px; padding: 10px 14px; min-width: 0; }
.pick-text strong { font-size: 18px; line-height: 1.2; font-weight: 750; font-variation-settings: "wdth" 106; overflow-wrap: anywhere; }
.pick-text span { font-size: 14px; color: var(--muted); line-height: 1.3; }
.pick-thumb { position: relative; align-self: center; margin-right: 10px; width: 92px; height: 60px; border-radius: var(--r-sm); background: var(--obs); overflow: hidden; border: 1.5px solid var(--ink); }
.pick-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pick-thumb .play-mark { position: absolute; inset: auto 4px 4px auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 11, 10, .72); color: #fff; }
.pick-thumb .play-mark svg { width: 9px; height: 9px; margin-left: 1px; }
/* Sits over the thumbnail: 10px margin plus the 2px border from the right edge. */
.zoom { position: absolute; top: 50%; right: 12px; width: 92px; height: 60px; transform: translateY(-50%); border: 0; padding: 0; border-radius: var(--r-sm); background: transparent; cursor: zoom-in; }
.pick[aria-pressed="true"] {
  background: color-mix(in srgb, var(--choice) 22%, var(--surface-strong));
  transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); outline: 3px solid var(--water-text); outline-offset: 2px;
}
/* Other options stay readable, so switching is easy; only their colour and preview fade. */
.pick-key, .pick-thumb { transition: opacity .15s, filter .15s; }
.picks.chosen .pick[aria-pressed="false"] .pick-key { filter: saturate(.3); opacity: .6; }
.picks.chosen .pick[aria-pressed="false"] .pick-thumb { opacity: .6; }
.pick .mine {
  position: absolute; top: 6px; right: 6px; z-index: 1; padding: 3px 7px; border-radius: 4px;
  font: 800 10px/1 var(--sans); font-variation-settings: "wdth" 125; letter-spacing: .1em; text-transform: uppercase;
  background: var(--ink); color: var(--surface-strong);
}
.pick:disabled { cursor: default; }
.hint { text-align: center; font-size: 14px; color: var(--muted); }

.verdict { display: grid; gap: 8px; padding: 18px; }
.verdict .bitmap { font-size: 13px; letter-spacing: .14em; color: var(--haze); }
.verdict .crowd { display: flex; align-items: center; gap: 12px; font: 800 22px/1.15 var(--sans); font-variation-settings: "wdth" 110; color: var(--mint-bright); }
.verdict .crowd .badge-key { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--choice); color: var(--on-choice); flex: none; }
.verdict .crowd .badge-key .shape { width: 22px; height: 22px; }
.verdict p:last-child { color: var(--mint); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; row-gap: 5px; align-items: center; }
.bar .tiny-key { grid-row: span 2; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--choice); color: var(--on-choice); border: 1.5px solid var(--ink); }
.bar .tiny-key .shape { width: 14px; height: 14px; }
.bar .bar-label { font-weight: 650; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.bar .bar-num { font: 700 14px/1 var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.bar .track { grid-column: 2 / 4; height: 10px; border-radius: 3px; background: var(--bar-track); overflow: hidden; }
.bar .fill { height: 100%; width: 0; background: var(--choice); border-radius: 3px; transition: width .9s var(--ease-out); }
.you { margin-left: 6px; padding: 2px 6px; border-radius: 4px; font: 800 10px/1 var(--sans); font-variation-settings: "wdth" 125; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--surface-strong); vertical-align: 2px; }

.wrap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wrap-list li { display: grid; gap: 4px; padding: 12px 14px; background: var(--surface-strong); border: 2px solid var(--ink); border-radius: 10px 10px 3px 10px; }
.wrap-list .eyebrow { font-size: 12px; }
.wrap-list .line { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.wrap-list .line .tiny-key { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; background: var(--choice); color: var(--on-choice); flex: none; }
.wrap-list .line .tiny-key .shape { width: 11px; height: 11px; }
.wrap-list .who-said { font: 700 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 6ch; }
.match { color: var(--olive); font-weight: 700; }

.viewer { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: auto 1fr; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); background: rgba(10, 11, 10, .94); color: var(--on-obs); }
.viewer header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.viewer header strong { font-size: 17px; }
.viewer .key { background: var(--obs-lit); color: var(--on-obs); border-color: var(--obs-rim); box-shadow: 0 3px 0 var(--obs-shade); }
.viewer img, .viewer video { width: 100%; height: 100%; object-fit: contain; min-height: 0; }

/* ---------- presenter screen ---------- */

body.host {
  --u: min(1vw, 1.7778vh);
  height: 100dvh; overflow: hidden;
}
.host-frame { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: calc(var(--u) * 1.2); padding: calc(var(--u) * 1.2); }
.host .nameplate { min-height: calc(var(--u) * 3.6); padding: calc(var(--u) * .45) calc(var(--u) * .9); gap: calc(var(--u) * 1.2); border-radius: calc(var(--u) * .7); }
.host .brand img { width: calc(var(--u) * 9.6); height: calc(var(--u) * 1.92); }
.host .plate-label { font-size: max(11px, calc(var(--u) * .72)); }
.plate-status { margin-left: auto; display: flex; align-items: center; gap: calc(var(--u) * 1.6); font: 600 max(12px, calc(var(--u) * .9))/1 var(--mono); color: var(--on-obs-muted); }
.plate-status .stat { display: inline-flex; align-items: center; gap: calc(var(--u) * .5); white-space: nowrap; }
.plate-status b { color: var(--on-obs); font-weight: 700; font-variant-numeric: tabular-nums; }
.plate-status .address { color: var(--water-on-obs); font-weight: 600; font-size: max(13px, calc(var(--u) * 1.05)); }
.plate-status .lamp { width: calc(var(--u) * .6); height: calc(var(--u) * .6); min-width: 8px; min-height: 8px; }
.plate-status .lamp.off { background: var(--amber); box-shadow: none; animation: blink 1.2s steps(2, jump-none) infinite; }

.screen { min-height: 0; position: relative; }
.screen-note { display: grid; place-items: center; height: 100%; font: 600 calc(var(--u) * 1.4)/1.3 var(--mono); color: var(--muted); text-align: center; }
.host .eyebrow { font-size: max(12px, calc(var(--u) * .95)); }

/* lobby */
.lobby { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto; gap: calc(var(--u) * 1.6) calc(var(--u) * 3); }
.lobby-copy { container-type: inline-size; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * 1.3); min-width: 0; padding-left: calc(var(--u) * .6); }
.lobby-copy h1 { font-size: calc(var(--u) * 5.2); line-height: 1; font-variation-settings: "wdth" 116; }
.lobby-copy .sub { font-size: calc(var(--u) * 1.9); color: var(--ink-soft); max-width: 34ch; text-wrap: pretty; }
.join-steps { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--u) * 1.4); margin-top: calc(var(--u) * .8); }
.address-glass { max-width: 100%; padding: calc(var(--u) * .9) calc(var(--u) * 1.8); border-width: calc(var(--u) * .4); border-radius: calc(var(--u) * 1.1); }
/* Departure Mono advances .64em a character, which browsers round up to whole pixels; .7 leaves
   room for that. 4.4u is the glass's padding and bezel. */
.address-glass .bitmap { display: block; font-size: min(calc(var(--u) * 3), calc((100cqi - var(--u) * 4.4) / (var(--chars, 16) * .7))); line-height: 1.1; white-space: nowrap; }
.join-steps .or { font: 600 calc(var(--u) * 1.1)/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.qr-card {
  margin: 0; align-self: center; display: grid; justify-items: center; gap: calc(var(--u) * .8);
  background: #ffffff; color: #171c20; border: 2px solid var(--ink); border-radius: calc(var(--u) * 1.2);
  padding: calc(var(--u) * 1.2) calc(var(--u) * 1.2) calc(var(--u) * .9); box-shadow: 0 calc(var(--u) * .3) 0 var(--ink);
}
.qr-card .qr { display: block; width: min(calc(var(--u) * 26), 52vh); height: auto; image-rendering: pixelated; }
.qr-card figcaption { font: 800 calc(var(--u) * 1.05)/1 var(--sans); font-variation-settings: "wdth" 125; letter-spacing: .14em; text-transform: uppercase; }
.roster {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: calc(var(--u) * 1.6);
  min-height: calc(var(--u) * 7.4); padding: calc(var(--u) * 1) calc(var(--u) * 1.4);
  border-radius: calc(var(--u) * .9) calc(var(--u) * .9) calc(var(--u) * .3) calc(var(--u) * .9);
}
.roster-count { display: grid; justify-items: start; gap: calc(var(--u) * .2); padding-right: calc(var(--u) * 1.6); border-right: 2px solid var(--line); }
.roster-count b { font: 800 calc(var(--u) * 3.4)/1 var(--sans); font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; }
.roster-count span { font: 600 calc(var(--u) * .9)/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .55); max-height: calc(var(--u) * 5.6); overflow: hidden; align-content: flex-start; }
.chip {
  display: inline-flex; align-items: center; gap: calc(var(--u) * .4); max-width: 100%;
  padding: calc(var(--u) * .35) calc(var(--u) * .8); border-radius: calc(var(--u) * .4);
  background: var(--tag); color: var(--tag-ink); border: 1.5px solid var(--tag-line);
  font: 650 calc(var(--u) * 1.15)/1.2 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: pop-in .22s var(--ease-out) both; cursor: pointer;
}
.chip.away { opacity: .55; }
.chip:hover { border-color: var(--danger); }
.roster .waiting { font: 600 calc(var(--u) * 1.2)/1.3 var(--mono); color: var(--muted); }
.chips .more { font: 700 calc(var(--u) * 1.1)/1.2 var(--mono); color: var(--muted); align-self: center; padding: 0 calc(var(--u) * .4); }

/* a stage */
.stage { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: calc(var(--u) * 1.4); }
.stage-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: calc(var(--u) * 2); padding-left: calc(var(--u) * .4); }
.stage-head h1 { font-size: calc(var(--u) * 3.6); line-height: 1.02; margin-top: calc(var(--u) * .35); }
.stage-head .prompt { font-size: calc(var(--u) * 1.6); color: var(--ink-soft); margin-top: calc(var(--u) * .45); }
.readout {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; column-gap: calc(var(--u) * 1.3); row-gap: calc(var(--u) * .5);
  padding: calc(var(--u) * .8) calc(var(--u) * 1.3); border-width: calc(var(--u) * .35); border-radius: calc(var(--u) * 1);
  min-width: calc(var(--u) * 22);
}
.readout .secs { grid-row: span 2; font-family: var(--bitmap); font-size: calc(var(--u) * 4.2); line-height: 1; color: var(--mint-bright); min-width: 2.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.readout .secs.untimed { font-size: calc(var(--u) * 1.4); letter-spacing: .12em; color: var(--haze); }
.readout .secs.closed { font-size: calc(var(--u) * 1.6); letter-spacing: .1em; color: var(--lime-bright); }
.readout .meter { height: calc(var(--u) * .9); width: calc(var(--u) * 14); gap: calc(var(--u) * .2); }
.readout .tally-line { font: 600 calc(var(--u) * 1.15)/1 var(--mono); color: var(--mint); white-space: nowrap; }
.readout .tally-line b { font-family: var(--bitmap); font-weight: 400; color: var(--mint-bright); font-size: calc(var(--u) * 1.5); }
.readout .all-in { color: var(--lime-bright); }

.choices { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: calc(var(--u) * 1.4); min-height: 0; }
.choice {
  position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; overflow: hidden;
  background: var(--surface-strong); border: 2px solid var(--ink);
  border-radius: calc(var(--u) * .9) calc(var(--u) * .9) calc(var(--u) * .3) calc(var(--u) * .9);
  box-shadow: 0 calc(var(--u) * .3) 0 var(--ink);
  transition: opacity .3s var(--ease-out);
}
.choice-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: calc(var(--u) * .9); padding: calc(var(--u) * .8) calc(var(--u) * 1); background: var(--choice); color: var(--on-choice); border-bottom: 2px solid var(--ink); }
.choice-key { display: grid; place-items: center; width: calc(var(--u) * 3.2); height: calc(var(--u) * 3.2); border-radius: calc(var(--u) * .5); background: rgba(255, 255, 255, .28); border: 2px solid var(--on-choice); }
.choice-key .shape { width: calc(var(--u) * 1.7); height: calc(var(--u) * 1.7); }
.choice-label { display: grid; gap: calc(var(--u) * .2); min-width: 0; }
.choice-label strong { font-size: calc(var(--u) * 1.75); line-height: 1.1; font-weight: 800; font-variation-settings: "wdth" 108; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.choice-caption { font-size: calc(var(--u) * 1.05); line-height: 1.25; font-weight: 550; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.choice-letter { display: flex; align-items: center; gap: calc(var(--u) * .7); min-height: max(19px, calc(var(--u) * 1.3 + 4px)); font: 700 max(10px, calc(var(--u) * .9))/1 var(--mono); letter-spacing: .08em; color: color-mix(in srgb, var(--on-choice) 75%, transparent); }
.media { position: relative; min-height: 0; background: var(--obs); display: grid; place-items: center; overflow: hidden; cursor: zoom-in; }
/* Out of flow, so a tall screenshot fits the box instead of setting its height. */
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
/* An empty slot is a small glass screen with no signal: phosphor inside a basalt bezel. */
.placeholder {
  width: calc(100% - var(--u) * 1.6); height: calc(100% - var(--u) * 1.6); display: grid; place-items: center; align-content: center; gap: calc(var(--u) * .8);
  background: radial-gradient(ellipse at center, var(--phosphor-2) 0%, var(--phosphor) 70%); color: var(--mint);
  border: max(3px, calc(var(--u) * .3)) solid var(--obs-lit); outline: 2px solid var(--obs-rim); border-radius: calc(var(--u) * .9);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .1), inset 0 -2px 0 rgba(0, 0, 0, .28);
  text-align: center; padding: calc(var(--u) * 1);
}
.placeholder .shape { width: calc(var(--u) * 6); height: calc(var(--u) * 6); color: var(--choice); opacity: .9; }
.placeholder .bitmap { font-family: var(--bitmap); font-size: calc(var(--u) * 1.6); color: var(--mint-bright); }
.result { display: none; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: calc(var(--u) * .4) calc(var(--u) * 1.2); padding: calc(var(--u) * .9) calc(var(--u) * 1.1); border-top: 2px solid var(--ink); }
.result .track { grid-column: 1 / -1; height: calc(var(--u) * 1.1); background: var(--bar-track); border-radius: calc(var(--u) * .3); overflow: hidden; border: 1.5px solid var(--ink); }
.result .fill { height: 100%; width: 0; background: var(--choice); transition: width 1.1s var(--ease-out); }
.result .pct { font: 800 calc(var(--u) * 3)/1 var(--sans); font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; }
.result .count { font: 600 calc(var(--u) * 1.3)/1 var(--mono); color: var(--ink-soft); justify-self: end; }
.revealed .result { display: grid; }
/* Dim the media against its own dark glass, so losing cards don't wash out grey. */
.revealed .choice.lose { filter: saturate(.35); }
.revealed .choice.lose .media > * { opacity: .45; }
.revealed .choice.win { box-shadow: 0 calc(var(--u) * .3) 0 var(--ink), 0 0 0 calc(var(--u) * .35) var(--lime-bright); }
/* Fits the OPTION line's height, so the label doesn't move when it appears. */
.crown {
  white-space: nowrap;
  padding: max(3px, calc(var(--u) * .25)) calc(var(--u) * .55); border-radius: calc(var(--u) * .35);
  background: var(--lime-bright); color: var(--on-lime); border: 2px solid var(--on-lime); box-shadow: 0 calc(var(--u) * .2) 0 var(--obs-shade);
  font: 800 max(9px, calc(var(--u) * .8))/1 var(--sans); font-variation-settings: "wdth" 115; letter-spacing: .1em; text-transform: uppercase;
  animation: pop-in .3s var(--ease-out) both .5s;
}

/* the wrap-up */
.finale { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: calc(var(--u) * 1.4); }
.finale-head { display: flex; align-items: end; justify-content: space-between; gap: calc(var(--u) * 2); padding-left: calc(var(--u) * .4); }
.finale-head h1 { font-size: calc(var(--u) * 3.8); line-height: 1; margin-top: calc(var(--u) * .35); }
.finale-stats { padding: calc(var(--u) * .8) calc(var(--u) * 1.4); border-width: calc(var(--u) * .35); border-radius: calc(var(--u) * 1); display: flex; gap: calc(var(--u) * 2.4); }
.finale-stats div { display: grid; gap: calc(var(--u) * .3); }
.finale-stats b { font-family: var(--bitmap); font-weight: 400; font-size: calc(var(--u) * 2.6); line-height: 1; color: var(--mint-bright); }
.finale-stats span { font: 600 calc(var(--u) * .85)/1 var(--mono); color: var(--haze); text-transform: uppercase; letter-spacing: .1em; }
.picks-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: calc(var(--u) * 1.2); min-height: 0; }
.pick-tile {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; overflow: hidden;
  background: var(--surface-strong); border: 2px solid var(--ink); border-radius: calc(var(--u) * .8) calc(var(--u) * .8) calc(var(--u) * .25) calc(var(--u) * .8);
  box-shadow: 0 calc(var(--u) * .25) 0 var(--ink); animation: pop-in .4s var(--ease-out) both;
}
.pick-tile .tile-head { padding: calc(var(--u) * .7) calc(var(--u) * .9) calc(var(--u) * .5); display: grid; gap: calc(var(--u) * .25); }
.pick-tile .tile-head .eyebrow { font-size: max(11px, calc(var(--u) * .8)); }
.pick-tile .tile-head h2 { font-size: calc(var(--u) * 1.35); line-height: 1.1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pick-tile .media { cursor: default; border-block: 2px solid var(--ink); }
.pick-tile .placeholder .shape { width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); }
.pick-tile .placeholder .bitmap { font-size: calc(var(--u) * 1.1); }
.pick-tile .tile-foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: calc(var(--u) * .6); padding: calc(var(--u) * .6) calc(var(--u) * .9); background: var(--choice); color: var(--on-choice); }
.pick-tile .tile-foot .shape { width: calc(var(--u) * 1.2); height: calc(var(--u) * 1.2); }
.pick-tile .tile-foot strong { font-size: calc(var(--u) * 1.15); line-height: 1.15; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pick-tile .tile-foot span { font: 800 calc(var(--u) * 1.4)/1 var(--sans); font-variant-numeric: tabular-nums; }
.pick-tile.none .tile-foot { background: var(--surface); color: var(--muted); }

/* presenter controls */
.controls {
  display: flex; align-items: center; gap: calc(var(--u) * .7); flex-wrap: wrap;
  background: var(--obs); color: var(--on-obs); border-radius: calc(var(--u) * .7);
  padding: calc(var(--u) * .45) calc(var(--u) * .6); box-shadow: 0 3px 0 var(--obs-shade), inset 0 1px 0 rgba(255, 255, 255, .07);
  transition: opacity .35s var(--ease-out), transform .35s var(--ease-out);
}
.controls .key {
  min-height: max(38px, calc(var(--u) * 2.5)); padding: 0 max(12px, calc(var(--u) * .9)); font-size: max(11px, calc(var(--u) * .72));
  background: rgba(27, 31, 36, .6); color: var(--on-obs); border: 1.5px solid var(--obs-rim); box-shadow: 0 2px 0 rgba(10, 11, 10, .55);
}
.controls .key:active:not(:disabled) { box-shadow: 0 0 0 rgba(10, 11, 10, .55); }
.controls .key.primary { background: var(--primary); color: var(--on-primary); border-color: var(--obs-shade); box-shadow: 0 2px 0 var(--obs-shade); min-width: calc(var(--u) * 13); }
/* A thrown toggle: a water line beneath it, as on the main site's switches. */
.controls .key.on { box-shadow: inset 0 -2px 0 var(--water-on-obs), 0 2px 0 rgba(10, 11, 10, .55); }
.controls .spacer { flex: 1; }
.controls .hint { font: 500 max(11px, calc(var(--u) * .72))/1.2 var(--mono); color: var(--on-obs-muted); }
/* Keep the bar to one row on 1280- and 1024-wide projectors. */
@media (max-width: 1500px) { .controls .hint { display: none; } }
@media (max-width: 1180px) { .controls .key kbd { display: none; } }
body.idle .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
body.idle { cursor: none; }

/* a choice on its own, full screen */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; padding: calc(var(--u) * 2); background: rgba(10, 11, 10, .9); }
.overlay .choice { grid-template-rows: auto minmax(0, 1fr); box-shadow: none; }
.overlay .media { cursor: zoom-out; }
.overlay .choice-label strong { font-size: calc(var(--u) * 2.2); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--u) * 6); transform: translateX(-50%); z-index: 40;
  padding: 12px 18px; border-radius: var(--r-md); background: var(--obs); color: var(--on-obs); border: 1.5px solid var(--obs-rim);
  font: 600 14px/1.3 var(--mono); box-shadow: 0 3px 0 var(--obs-shade); animation: pop-in .2s var(--ease-out) both;
}
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 11, 10, .6); }
.dialog { width: min(92vw, 460px); display: grid; gap: 14px; }
.dialog h2 { font-size: 22px; }
.dialog .row { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- results (private) ---------- */

body.results { min-height: 100vh; }
.results-wrap { max-width: 920px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 18px; }
.results-title { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 20px; margin-top: 10px; }
.results-title h1 { font-size: 34px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 600; }
.result-game { display: grid; gap: 18px; }
.result-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 12px; }
.result-head h2 { font-size: 22px; margin: 4px 0; }
.result-stage { display: grid; gap: 8px; padding-top: 14px; border-top: 1.5px solid var(--line); }
.result-stage h3 { font-size: 17px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.result-stage h3 .eyebrow { font-size: 12px; }
.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tally-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(80px, 34%) 9ch; align-items: center; gap: 10px; font-size: 15px; }
.tally-key { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--choice); color: var(--on-choice); font: 800 13px/1 var(--mono); border: 1.5px solid var(--ink); }
.tally-bar { width: 100%; height: 12px; }
.tally-bar .track { fill: var(--bar-track); }
.tally-bar .fill { fill: var(--choice); }
.tally-count { font: 600 13px/1 var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.pick-badge { margin-left: 8px; padding: 2px 6px; border-radius: 4px; font: 800 10px/1 var(--sans); font-variation-settings: "wdth" 125; letter-spacing: .1em; text-transform: uppercase; background: var(--lime-bright); color: var(--on-lime); vertical-align: 2px; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.danger-zone form { display: grid; gap: 10px; justify-items: start; margin-top: 4px; }
@media (max-width: 560px) { .tally-row { grid-template-columns: 28px minmax(0, 1fr) 9ch; } .tally-bar { grid-column: 2 / -1; } }

.c0 { --choice: var(--c0); }
.c1 { --choice: var(--c1); }
.c2 { --choice: var(--c2); }
.c3 { --choice: var(--c3); }

/* Today's design, for comparison. It takes no vote, so it is flat and dashed where the picks are raised keys. */
.today-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 56px; padding: 6px 8px 6px 14px; text-align: left; font: inherit; color: var(--ink); cursor: zoom-in;
  background: var(--surface); border: 2px dashed var(--line-strong); border-radius: 10px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.today-text { display: grid; gap: 2px; min-width: 0; }
.today-text strong { font-size: 15px; font-weight: 750; font-variation-settings: "wdth" 106; }
.today-text span { font-size: 13px; color: var(--muted); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-row .pick-thumb { margin-right: 0; width: 66px; height: 44px; }

.stage-head:has(.today-card) { grid-template-columns: minmax(0, 1fr) auto auto; }
.today-card { display: grid; gap: calc(var(--u) * .5); padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: zoom-in; }
.today-frame {
  display: block; width: calc(var(--u) * 12); aspect-ratio: 3 / 2; overflow: hidden; background: var(--obs);
  border: 2px dashed var(--line-strong); border-radius: calc(var(--u) * .6);
}
.today-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.today-tag { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * .6); font: 700 max(11px, calc(var(--u) * .9))/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.today-tag kbd { font: 600 max(11px, calc(var(--u) * .85))/1 var(--mono); padding: calc(var(--u) * .2) calc(var(--u) * .4); border: 1.5px solid var(--line-strong); border-radius: 4px; color: var(--muted); }
.today-card:hover .today-frame, .today-card:focus-visible .today-frame { border-color: var(--ink); }
.choice.today { --choice: var(--surface-strong); --on-choice: var(--ink); }
.choice.today .choice-head { grid-template-columns: minmax(0, 1fr); }
