/*
 * Jaybirds: a flat midnight card table with feathers on it. Snow answer cards, Acorn Gold
 * prompts and barred Blue Jay card backs. Only things you could pick up off the table look
 * like cards (ink borders, hard shadows, tilts); controls are flat and square. Jay Blue on
 * a control means it can be pressed.
 * Dark only. Components keep one class each (.card, .card-back, .prompt-card,
 * .stamp, .score-equation …) and tilt through --tilt, so motion can be layered
 * on later without touching the markup.
 */

/* The pixel face is Jersey 10. Pixelify Sans (the mocks' face) draws C, B and 5 so
 * close to O, G and S that "BOB" read as "GOG" from the sofa, at every weight.
 * Jersey has one weight, already heavy: claiming 400–700 stops browsers faking a
 * bold, and size-adjust brings its cap height up to Pixelify's so layouts hold. */
@font-face {
  font-family: "Jersey 10";
  src: url("/fonts/Jersey10.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  size-adjust: 125%;
}
/* Readable mode's names in seats (bold, 75% wide): the TV's seats are too narrow for long
 * names in the full width. Only downloaded when something uses it. */
@font-face {
  font-family: "Bricolage Grotesque Condensed";
  src: url("/fonts/BricolageGrotesqueCondensed.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --table: #0d1b2a;
  --table-boss: #3d0f1b;
  --ink: #121821;
  --snow: #f4f2ec;
  --jay: #4ea5fa;
  --chip: #1f57a8;
  --chip-ink: #ffffff;
  --muted: #b8c7d9;
  /* --dim clears 4.5:1 on the table. */
  --dim: #98aec7;
  --dashed: #4b647e; /* disabled and decorative outlines only */
  /* Outlines that are the only edge of a control (an "off" toggle, a switch track):
   * 3:1 on the table, even over a feather's pale tip (WCAG 1.4.11). */
  --edge: #7993ae;
  --rule: #283e56;
  --gold: #f7c95c;
  --prompt: var(--gold); /* never Jay Blue, which is for pressing */
  --on-snow-muted: #525b68;
  --boss-red: #a1263b;
  --boss-pink: #f4b8c4;
  --error: #ff98a6;
  --shadow: var(--ink); /* hard offset shadows; black on the boss table so they still show */

  --feather-vane: #4ea5fa;
  --feather-bar: #0a1f3d;
  --feather-tip: #f4f2ec;

  --font-pixel: "Jersey 10", ui-monospace, Menlo, monospace;
  --font-card: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --min-text: 0px; /* readable mode raises it; small text is set as max(its size, this) */

  color-scheme: dark;
}

/* Readable mode (readable.js): the pixel face gives way to the card face, nothing under 20px,
 * secondary text a step stronger. Stamps and card backs are decoration and keep their look. */
.is-readable {
  --font-pixel: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --min-text: 20px;
  --muted: #d6e0eb;
  --dim: #c2d0df;
  --on-snow-muted: #3b424c;
}
.is-readable :is(.stamp, .card-back, .wordmark) { --font-pixel: "Jersey 10", ui-monospace, Menlo, monospace; }
/* The plain face is wider: things that sat side by side make room. */
.is-readable :is(.room-pill, .rejoin-bar) { flex-wrap: wrap; }
/* The TV is read from across the room: its smallest text is bigger (stage px, 1920 × 1080). */
.is-readable body.display { --min-text: 32px; }
.is-readable .blank__n { font-size: var(--min-text); }
.is-readable .others__text { font-size: max(0.84em, var(--min-text)); }
/* Names sized to fit a TV seat (display.js, nameEm) go condensed, so a long one is no smaller
 * than in the pixel face. */
/* "The Jay" and "Away" in a seat's slot go over two lines rather than out of it. */
.is-readable .table-seat .slot { white-space: normal; padding: 4px; line-height: 1.05; }
.is-readable :is(.seat-card__name, .table-seat__name) { font-family: "Bricolage Grotesque Condensed", var(--font-card); font-weight: 700; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--table);
  color: var(--snow);
  font: 600 max(18px, var(--min-text))/1.3 var(--font-card);
}
/* The boss round's table: the same names, so everything on it turns red with it. */
body.is-boss, .screen.is-boss {
  --table: var(--table-boss);
  --shadow: #16060a;
  --muted: #f0cfd6;
  --dim: #f4b8c4;
  --dashed: #8f5b68;
  --edge: #b98a96;
  --rule: #74404c;
  --feather-vane: #e0697f;
  --feather-bar: #5a1526;
  --feather-tip: #f4b8c4;
}

h1, h2, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--snow); }

button, input, textarea, select { font: inherit; color: inherit; }
/* Cream, with a gap that tells it from a chosen option, which is solid cream. */
:focus-visible { outline: 4px solid var(--snow); outline-offset: 4px; }
/* Buttons pressed twice (MOVE ON, END GAME) mustn't zoom the page on the second tap. */
.btn, .option, .hand-card { touch-action: manipulation; }
/* Headings take focus when a screen changes (see phone.js); they aren't controls, so no ring. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pixel { font-family: var(--font-pixel); }

/* ---------- Shared components ---------- */

/* A face-up card. */
.card {
  background: var(--snow);
  color: var(--ink);
  border: var(--card-border, 4px) solid var(--ink);
  border-radius: var(--card-radius, 10px);
  box-shadow: var(--card-shadow, 8px) var(--card-shadow, 8px) 0 var(--shadow);
  transform: rotate(var(--tilt, 0deg));
}

/* A face-down card: overlapping macro jay plumage in the player's species. */
.card-back {
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  background-color: var(--card-colour, var(--jay));
  border: var(--card-border, 3px) solid var(--ink);
  border-radius: var(--card-radius, 6px);
  transform: rotate(var(--tilt, 0deg));
}

/* The macro plumage band on its own, across a player or seat card. */
.band {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: var(--card-colour, var(--jay));
  border-bottom: var(--card-border, 4px) solid var(--ink);
}

.plumage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* An empty place at the table. */
.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px dashed var(--dim);
  border-radius: 8px;
  color: var(--dim);
  font-family: var(--font-pixel);
  text-align: center;
  transform: rotate(var(--tilt, 0deg));
}

.prompt-card {
  background: var(--prompt);
  color: var(--ink);
  border: var(--card-border, 3px) solid var(--ink);
  border-radius: var(--card-radius, 8px);
  box-shadow: var(--card-shadow, 5px) var(--card-shadow, 5px) 0 var(--shadow);
  transform: rotate(var(--tilt, -1deg));
  font-family: var(--font-card);
  font-weight: 800;
  overflow-wrap: break-word;
}
.blank {
  position: relative;
  display: inline-block;
  width: 3.2em;
  height: 0.8em;
  border-bottom: 0.12em solid currentColor;
  vertical-align: baseline;
}
/* The blank's number, matching its answer box, sitting on the line. */
.blank__n { position: absolute; inset: auto 0 0.15em; text-align: center; font-family: var(--font-pixel); font-size: 0.55em; line-height: 1; }
/* A player's words in a filled card: underlined, so the joke reads as one sentence. */
mark.fill { background: none; color: inherit; text-decoration: underline; text-decoration-thickness: 0.1em; text-underline-offset: 0.15em; }

/* Pixel buttons: flat and square. Solid Jay Blue is the main thing to press; the rest are
 * outlines, solid behind so no feather shows through a label. A chosen option is cream. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 48px;
  padding: 12px 22px;
  background: var(--jay);
  color: var(--ink);
  border: 4px solid var(--jay);
  border-radius: 0;
  font-family: var(--font-pixel);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--table);
  color: var(--dim);
  border: 4px dashed var(--dashed);
  cursor: default;
}
.btn.is-wide { width: 100%; }
.toggle[aria-pressed="false"] {
  background: var(--table);
  color: var(--snow);
  border-color: var(--edge);
}
.toggle[aria-pressed="true"] { background: var(--snow); border-color: var(--snow); }

/* A secondary action (the host's MOVE ON): an outline, so it never competes with the
 * screen's main button. Armed for a second tap, it turns gold. */
.btn--quiet {
  background: var(--table);
  color: var(--snow);
  border: 3px solid var(--edge);
  font-size: 20px;
}
/* Waiting for its second press: solid Jay Blue, the colour of pressing. */
.btn--quiet.is-armed { background: var(--jay); border-color: var(--jay); color: var(--ink); }
.link-btn.kick.is-armed { background: var(--jay); color: var(--ink); }

/* "No timer": stands where the seconds would be when a phase has no clock. */
.no-timer { font-family: var(--font-pixel); font-size: 22px; font-weight: 700; white-space: nowrap; }
.display .no-timer { font-size: 44px; }

/* A message that can't be missed, over whatever's on. */
.clock-chip {
  display: inline-block;
  padding: 4px 10px;
  border: 3px solid var(--edge);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: max(18px, var(--min-text));
  font-weight: 400;
  line-height: 1.1;
  white-space: nowrap;
}

/* "RECONNECTING…": the room is out of reach and the clock is held. Same look as the TV's. */
.link-chip { border-color: var(--gold); background: var(--ink); color: var(--gold); }
.display .link-chip {
  position: absolute;
  top: 8px;
  left: 50%;
  translate: -50% 0;
  z-index: 10;
  padding: 6px 18px;
  border: 4px solid var(--gold);
  border-radius: 6px;
  font-family: var(--font-pixel);
  font-size: 28px;
  line-height: 1.1;
}

.link-btn {
  min-height: 44px;
  padding: 4px 8px;
  background: none;
  border: 0;
  color: var(--dim);
  font-family: var(--font-pixel);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* A checkbox drawn as a pixel switch. The real input stays on top, invisible. */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-family: var(--font-pixel);
  color: var(--muted);
  cursor: pointer;
}
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch__track {
  flex: none;
  position: relative;
  width: 56px;
  height: 32px;
  border: 3px solid var(--edge);
  background: var(--table);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--dim);
}
.switch input:checked + .switch__track { background: var(--jay); border-color: var(--jay); }
.switch input:checked + .switch__track::after { left: auto; right: 3px; background: var(--ink); }
.switch input:focus-visible + .switch__track { outline: 4px solid var(--snow); outline-offset: 4px; }

/* Labels in the pixel face. */
/* Jersey 10 draws small for its size (cap height 0.67em, and narrow), so 18px is
 * the smallest it's set on a phone. */
.label { font-family: var(--font-pixel); font-size: 20px; font-weight: 700; color: var(--snow); }
.card-label { font-family: var(--font-card); font-weight: 600; color: var(--on-snow-muted); }

.flash {
  padding: 10px 14px;
  border: 3px solid var(--error);
  border-radius: 6px;
  background: var(--ink);
  color: var(--error);
  font-family: var(--font-pixel);
  font-size: max(18px, var(--min-text));
}
.flash:empty { padding: 0; border: 0; }
/* News rather than a refusal: the same red border as an error, with white text. */
.flash.is-info { color: var(--snow); }

/* Chips × mult. */
.score-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--eq-gap, 12px);
  font-family: var(--font-pixel);
}
/* Flat outlined boxes in cream on the table: Jay Blue is for pressing and gold is the prompt's. */
.chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--chip-pad, 8px 12px);
  border: var(--card-border, 3px) solid var(--snow);
  border-radius: 8px;
  color: var(--snow);
  transform: rotate(var(--tilt, 0deg));
}
.chip__label { font-size: max(var(--chip-label, 18px), var(--min-text)); color: var(--muted); }
.chip__value { font-size: var(--chip-value, 28px); font-weight: 700; line-height: 1; }
.op { font-size: var(--op-size, 28px); font-weight: 700; }
/* "× box" (and "= total") travel together: a row wraps between terms, never inside one. */
.term { display: inline-flex; align-items: center; gap: var(--eq-gap, 12px); white-space: nowrap; }
.score-total { font-size: var(--total-size, 40px); font-weight: 700; line-height: 1; color: var(--snow); }

.stamp {
  display: inline-block;
  padding: 6px 14px;
  border: 5px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1.1;
  transform: rotate(var(--tilt, 14deg));
}

.stamp-feather { display: block; width: var(--feather, 40px); height: var(--feather, 40px); transform: rotate(var(--tilt, 0deg)); }

/* Played-down tag on a card back. */
.tag {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--font-pixel);
  font-weight: 700;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { display: block; flex: none; }
.wordmark { font-family: var(--font-pixel); font-weight: 700; letter-spacing: 0.1em; }

/* ---------- Phone ---------- */

/* Feathers on the table: flat, still and mostly see-through. 0.2 is as strong as they can
 * be: control outlines only just keep 3:1 over a pale tip. */
.feather-field { position: absolute; left: 0; top: 0; z-index: -1; overflow: visible; opacity: 0.2; pointer-events: none; }
.feather-field__vane { fill: var(--feather-vane); }
.feather-field__tip { fill: var(--feather-tip); }
.feather-field__bar { fill: none; stroke: var(--feather-bar); }
.feather-field__quill { fill: none; stroke: var(--feather-vane); stroke-width: 6; stroke-linecap: round; }
@media (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  .feather-field { display: none; }
}
.is-readable .feather-field { display: none; }

body.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
/* The space a screen leaves under it, however much that is. */
.phone-feathers { position: relative; z-index: -1; flex: 1 0 0; overflow: hidden; pointer-events: none; }
.phone-feathers .feather-field { left: 50%; translate: -50%; }
/* Behind the lobby's seat card. */
.phone-feathers--lobby { display: none; position: absolute; inset: 0 0 auto; height: 215px; }
body.phone[data-phase="lobby"] .phone-feathers--lobby { display: block; }

.phone main {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.phone .stack { display: flex; flex-direction: column; gap: 18px; }
.phone .center { align-items: center; text-align: center; }

/* Join */
.join .brand { margin: 8px 0 6px; }
.join .brand .brand-icon { width: 44px; height: 44px; }
/* JAYBIRDS stays on one line down to 320px-wide phones. */
.join .wordmark { font-size: clamp(24px, 11vw, 40px); white-space: nowrap; }
.join .tagline { color: var(--muted); font-weight: 600; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field-count { font-family: var(--font-pixel); font-size: max(16px, var(--min-text)); color: var(--dim); }
.field-count.is-max { color: var(--gold); }
.field {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  background: var(--snow);
  color: var(--ink);
  border: 0;
  border-radius: 0;
  font-family: var(--font-pixel);
  font-size: 24px;
  text-transform: uppercase;
}
.field::placeholder { color: #7e8896; opacity: 1; }
.field:disabled { opacity: 0.65; }
.field--code {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  padding-left: calc(14px + 0.35em);
}
.note.is-warn { color: var(--gold); }
/* A fact and what to do about it: the last room, and the one a link is joining. */
.room-pill, .rejoin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border: solid var(--rule);
  border-width: 2px 0;
}
/* One line between the two, not two. */
.rejoin-bar:not([hidden]) + .room-pill { margin-top: -18px; border-top: 0; }
.room-pill__meta, .rejoin-bar__meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.room-pill__code, .rejoin-bar__code { font: 700 28px/1 var(--font-pixel); letter-spacing: 0.12em; }
.room-pill__change { color: var(--snow); font-size: 20px; flex: none; }
.join > .btn { margin-top: 6px; }
.rejoin-bar .btn { flex: none; min-height: 44px; padding-block: 6px; }
.join #join-cancel { margin-top: -6px; }
.btn.is-busy,
.btn.is-busy:disabled {
  background: var(--chip);
  color: var(--chip-ink);
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: wait;
}

/* HUD across the top of every game screen */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-family: var(--font-pixel);
  font-size: 20px;
}
.hud__me { min-width: 0; margin-right: auto; overflow-wrap: anywhere; }
.hud .timer { font-size: 28px; font-weight: 700; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
/* A refusal lies over the HUD instead of pushing the screen down; it goes when the
 * answer is fixed or the screen changes. */
.game { position: relative; }
.game > .flash { position: absolute; top: 0; left: 0; right: 0; z-index: 5; box-shadow: 4px 4px 0 var(--shadow); }
.game > .flash:empty { display: none; }

.note { color: var(--muted); font-weight: 600; }
.big-label { font-family: var(--font-pixel); font-size: 32px; font-weight: 700; line-height: 1.1; }

/* Lobby: your seat card */
.you-card {
  --card-shadow: 8px;
  align-self: center;
  width: min(260px, 100%);
  overflow: hidden;
  --tilt: -2deg;
}
.you-card .band { height: 64px; }
.you-card__body { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px 22px; text-align: center; }
.you-card__name { font-family: var(--font-pixel); font-weight: 700; line-height: 1; overflow-wrap: anywhere; }
.you-card .card-label { font-size: max(18px, var(--min-text)); }
/* The host's card is shorter, so the settings and DEAL ME IN fit on more phones. */
.you-card.is-compact .band { height: 32px; }
.you-card.is-compact .you-card__body { gap: 0; padding: 10px 12px 12px; }
/* A note that belongs to the switch above it. */
.switch-group { display: flex; flex-direction: column; gap: 4px; }
/* DEAL ME IN stays at the bottom of the screen while the host scrolls the settings. */
.deal-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 -16px calc(-1 * max(28px, env(safe-area-inset-bottom)));
  padding: 14px 16px max(16px, env(safe-area-inset-bottom));
  background: var(--table);
  border-top: 3px solid var(--rule);
}
.is-boss .deal-bar { background: var(--table-boss); }
/* Phone switches say ON or OFF in words, not only by the knob's side and colour. */
.phone .switch__track { width: 72px; }
.phone .switch__track::before {
  content: "OFF";
  content: "OFF" / "";
  position: absolute;
  top: 50%;
  right: 6px;
  translate: 0 -50%;
  font-family: var(--font-pixel);
  font-size: max(18px, var(--min-text));
  line-height: 1;
  color: var(--muted);
}
.phone .switch input:checked + .switch__track::before {
  content: "ON";
  content: "ON" / "";
  right: auto;
  left: 8px;
  color: var(--ink);
}
.choice { margin: 0; padding: 0; border: 0; min-width: 0; container-type: inline-size; }
.choice legend { padding: 0; margin-bottom: 10px; }
/* Options side by side, equal widths, sharing their edges. */
.choice__row { display: flex; }
.choice__row .btn + .btn { margin-left: -4px; }
.choice__row .btn { flex: 1 1 0; font-size: 20px; padding-inline: 12px; }
/* Zoomed in, or a narrow phone: one option under the other. */
@container (max-width: 260px) {
  .choice__row { flex-direction: column; }
  .choice__row .btn + .btn { margin-left: 0; margin-top: -4px; }
}
/* The timer's four paces: two to a row, one under the other when there's no room. */
.choice__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); padding: 0 4px 4px 0; }
.choice__grid .btn { margin: 0 -4px -4px 0; font-size: 20px; padding-inline: 12px; }
:is(.choice__row, .choice__grid) .btn:is([aria-pressed="true"], :focus-visible) { position: relative; }
:is(.choice__row, .choice__grid) .btn:focus-visible { z-index: 1; }
.choice__note { margin-top: 10px; }
.pace-readout { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 10px; text-align: center; }
.pace-readout__value { font-family: var(--font-pixel); font-size: 22px; font-weight: 700; }
.pace-readout .note { flex-basis: 100%; }
/* The host's MOVE ON, set apart below the screen's own controls. */
.host-tools { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 18px; border-top: 3px solid var(--rule); }
.host-tools .waiting { font-family: var(--font-pixel); font-weight: 400; color: var(--snow); overflow-wrap: anywhere; }
.host-tools .waiting:empty { display: none; }

/* Answer */
.prompt-card.on-phone { padding: 18px 20px; font-size: 24px; line-height: 1.15; }
.prompt-card.on-phone.is-small { padding: 14px 16px; font-size: 20px; }

.boss-rule {
  --card-border: 4px;
  --card-shadow: 6px;
  --tilt: 1deg;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  }
.boss-wordmark {
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1;
  color: var(--snow);
  -webkit-text-stroke: 0.045em var(--ink);
  paint-order: stroke fill;
}
.boss-rule .card-label { color: var(--boss-red); font-size: max(18px, var(--min-text)); }
.boss-rule__title { font-size: 30px; font-weight: 800; line-height: 1.05; }
.boss-rule__detail { color: var(--on-snow-muted); font-size: max(17px, var(--min-text)); }
.phone .boss-rule { gap: 2px; padding: 10px 16px; }
.phone .boss-rule__title { font-size: 24px; }
.phone .boss-rule__detail { font-size: max(16px, var(--min-text)); line-height: 1.2; }

.answer-form { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.answer-card {
  --tilt: 2deg;
  width: min(340px, calc(100% - 16px));
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Each blank's label, rule hint and character count share a line over its box, so PLAY CARD
 * stays close under the prompt. They wrap when a label is long. */
.answer-field { display: flex; flex-direction: column; gap: 8px; }
.answer-field__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.answer-field__head .card-label { margin-right: auto; }
.rule-hint { font-family: var(--font-pixel); font-size: max(18px, var(--min-text)); color: var(--on-snow-muted); }
.rule-hint:empty { display: none; }
.rule-hint.is-warn { color: var(--boss-red); }
.answer-card .card-label { font-size: max(18px, var(--min-text)); }
.answer-card textarea {
  width: 100%;
  height: 4.6em;
  padding: 0;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-card);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}
/* Inside the snow card the ring is ink: orange on snow is only 2.6:1. */
.answer-card textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.counter { font-family: var(--font-pixel); font-size: max(18px, var(--min-text)); color: var(--on-snow-muted); }
/* Several blanks: a two-line box each, ruled off, and the card grows to fit them. */
.answer-card.is-multi { gap: 12px; }
.answer-card.is-multi textarea { height: 2.4em; font-size: 20px; border-bottom: 2px solid var(--ink); }
.swipe-hint { font-family: var(--font-pixel); font-size: max(18px, var(--min-text)); color: var(--muted); }

/* Played, waiting */
.played { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 12px; text-align: center; }
.played-card {
  --card-border: 4px;
  --tilt: -3deg;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 250px;
  box-shadow: 8px 8px 0 var(--shadow);
}
.played-card .tag { font-size: 22px; }

/* Classic Mode: phone card hand, blank card input, judge card & callout */
.card-hand { display: flex; flex-direction: column; gap: 12px; list-style: none; padding: 0; margin: 0; }
.hand-card {
  --card-border: 3px;
  --card-shadow: 5px;
  --card-radius: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  font-family: var(--font-card);
  font-size: max(19px, var(--min-text));
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  overflow-wrap: anywhere;
}
/* Still cream: gold is the prompt's. */
.hand-card.is-selected { outline: 6px solid var(--jay); outline-offset: 2px; }
/* Room on the right for the order badge, so the words wrap before it. */
.hand-card.has-order { padding-right: 56px; }
.hand-card__order {
  position: absolute;
  top: 10px;
  right: 12px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hand-card--blank .hand-card__hint { color: var(--on-snow-muted); font-size: max(17px, var(--min-text)); }
.blank-card-input {
  width: 100%;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--snow);
  color: var(--ink);
  font-family: var(--font-card);
  font-size: max(18px, var(--min-text));
  font-weight: 700;
}
.blank-card-count { align-self: flex-end; font-family: var(--font-pixel); font-size: max(18px, var(--min-text)); color: var(--on-snow-muted); }
.judge-card {
  --card-border: 4px;
  --card-shadow: 8px;
  --tilt: -1deg;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.judge-card__title { font-family: var(--font-card); font-size: 32px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.judge-card .note { color: var(--on-snow-muted); }
.option.is-readonly { cursor: default; }
.swap { display: flex; flex-direction: column; gap: 6px; }
.classic-reveal-author { align-self: flex-end; font-family: var(--font-pixel); font-size: 26px; font-weight: 700; }

/* Vote */
.hand { display: flex; flex-direction: column; gap: 16px; }
.option {
  hyphens: auto;
  --card-border: 3px;
  --card-shadow: 5px;
  --card-radius: 10px;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  text-align: left;
  font-family: var(--font-card);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.option .corner { min-width: 1ch; font-family: var(--font-pixel); font-size: 28px; line-height: 1; }
.option.is-mine {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
  border-color: var(--dashed);
  box-shadow: none;
  cursor: default;
}
/* Your own card: its number and "Your answer" on one line across the top. */
.option.is-mine { grid-template-columns: 1fr; gap: 8px; }
.option__head { display: flex; align-items: baseline; gap: 12px; }
.option .mine-tag { font-family: var(--font-pixel); font-size: 22px; font-weight: 400; color: var(--snow); }
/* Several blanks: the prompt's own words lighter, so each card's answers stand out. */
.option .given, .fan-card .given, .winner-card .given, .heat-card .given { color: var(--on-snow-muted); font-weight: 600; }
.option.is-mine .given { color: var(--dim); }
/* Chosen, or this phone's vote shown back: blue, as a chosen hand card is. Gold is the prompt's. */
.option.is-selected { outline: 6px solid var(--jay); outline-offset: 2px; }
/* Focus on the chosen one still shows: the cream ring outside the blue. */
:is(.option, .hand-card).is-selected:focus-visible { outline: 4px solid var(--snow); outline-offset: 4px; box-shadow: 0 0 0 4px var(--jay); }
.option.is-picked { outline: 4px solid var(--jay); outline-offset: 3px; }
.vote-rule { margin-top: -4px; }

/* Reveal: your result */
.result {
  --eq-gap: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.result .score-equation { --chip-value: 26px; --total-size: 44px; }
/* Who won the round, under your own result. */
.won-by { display: flex; flex-direction: column; gap: 8px; }
.won-by__list { display: flex; flex-direction: column; gap: 6px; }
.won-by__list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 3px solid var(--rule); }
.won-by__text { font: 700 20px/1.2 var(--font-card); overflow-wrap: anywhere; }
.won-by__name { font: 400 22px/1 var(--font-pixel); color: var(--muted); }

/* Standings */
.standings { display: flex; flex-direction: column; gap: 10px; container-type: inline-size; }
.standing {
  display: grid;
  grid-template-columns: 2.6ch auto 1fr auto auto;
  grid-template-areas: "rank card name gain score";
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 3px solid var(--rule);
  font-family: var(--font-pixel);
  font-size: 22px;
}
.standing .card-back { width: 26px; height: 36px; --card-border: 3px; --card-radius: 4px; }
.standing__rank { grid-area: rank; color: var(--dim); }
.standing > .card-back { grid-area: card; }
.standing__gain { grid-area: gain; }
.standing__score { grid-area: score; }
/* Zoomed in, or a narrow phone: the name gets a line of its own above the numbers. */
@container (max-width: 340px) {
  .standing { grid-template-columns: 2.6ch auto 1fr auto; grid-template-areas: "name name name name" "rank card gain score"; row-gap: 6px; padding-inline: 8px; font-size: 20px; }
  .standing__name { overflow-wrap: break-word; }
  /* Readable, there's no room for both numbers on one line: this round's points go under the total. */
  .is-readable .standing { grid-template-columns: 2.6ch auto 1fr; grid-template-areas: "name name name" "rank card score" "rank card gain"; column-gap: 10px; row-gap: 2px; }
  .is-readable :is(.standing__score, .standing__gain) { justify-self: end; }
}
.standing__name { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
.standing__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.standing.is-me { --card-shadow: 5px; border: 3px solid var(--ink); border-radius: 8px; background: var(--snow); color: var(--ink); box-shadow: 5px 5px 0 var(--shadow); }
.standing.is-me .standing__rank, .standing.is-me .standing__gain { color: var(--on-snow-muted); }
/* This round's points, grey beside the total. */
.standing__gain { font-size: max(18px, var(--min-text)); color: var(--muted); font-variant-numeric: tabular-nums; }
.standing__won { margin-left: 8px; font-size: max(16px, var(--min-text)); vertical-align: middle; }
.screen-title { font-family: var(--font-pixel); font-size: 32px; font-weight: 700; }

/* ---------- Display (browser stand-in for the TV) ---------- */
/* Laid out at 1920 × 1080 like the TV mocks, then scaled to fit the window. */

body.display { height: 100vh; overflow: hidden; }
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  font-family: var(--font-card);
}
.screen {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  padding: 64px 96px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  background-color: var(--table);
}
.screen--lobby { padding: 52px 96px 64px; gap: 28px; }
.screen--vote { gap: 32px; }
.screen--reveal { flex-direction: row; gap: 80px; }

.display .card-back.is-big { --card-border: 4px; }
.tv-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-pixel); }
.tv-label { font-family: var(--font-pixel); font-size: 32px; color: var(--muted); }
.tv-round { font: 700 44px/1 var(--font-pixel); }
.tv-text { font: 600 34px/1.25 var(--font-card); }
.tv-top .brand { gap: 20px; }
.tv-top .brand .brand-icon { width: 60px; height: 60px; }
.tv-top .wordmark { font-size: 56px; letter-spacing: 6px; }
.tv-chip { font-family: var(--font-pixel); font-size: max(30px, var(--min-text)); padding: 10px 18px; background: var(--snow); color: var(--ink); border: 3px solid var(--ink); border-radius: 6px; }
.tv-chip.is-gold { background: var(--gold); color: var(--ink); font-size: 48px; padding: 16px 28px; }
.tv-row { display: flex; gap: 16px; align-items: center; }
.display .btn { font-size: 34px; padding: 18px 28px; }
.display .btn--deal { font-size: 44px; padding: 28px 44px; }
.display .flash { position: absolute; left: 96px; bottom: 24px; font-size: max(26px, var(--min-text)); }
.display .switch { font-size: max(28px, var(--min-text)); }
.display .switch__track { width: 72px; height: 40px; border-width: 4px; }
.display .switch__track::after { width: 24px; height: 24px; top: 4px; left: 4px; }
.display .switch input:checked + .switch__track::after { left: auto; right: 4px; }

/* Home and gone screens */
.screen--home { align-items: center; justify-content: center; gap: 48px; text-align: center; }
.screen--home .brand .brand-icon { width: 128px; height: 128px; }
.screen--home .wordmark { font-size: 140px; }
.screen--home p { font-size: 40px; color: var(--muted); }
.screen--home .card { padding: 40px 56px; font-size: 48px; font-weight: 800; --tilt: -2deg; max-width: 1200px; }

/* Lobby */
.lobby-setup { flex: 1; display: grid; grid-template-columns: 1fr 660px; gap: 84px; align-items: center; }
/* The modes as cards: the chosen one face up and a little higher, the other face down. */
.mode-cards { display: flex; gap: 64px; padding-left: 14px; }
.mode-card {
  --card-border: 5px;
  --card-radius: 12px;
  --card-shadow: 10px;
  --shadow: #060d16;
  --tilt: -2deg;
  position: relative;
  flex: none;
  width: 440px;
  height: 640px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: left;
  cursor: pointer;
  translate: 0 18px;
}
.mode-card + .mode-card { --tilt: 2deg; }
.mode-card.is-selected { justify-content: flex-start; align-items: stretch; translate: 0 -18px; }
.mode-card .band { height: 270px; flex: none; }
.mode-card .card-back { position: absolute; inset: 0; border: 0; border-radius: 0; }
.mode-card__text {
  position: relative;
  width: 372px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border: 5px solid var(--ink);
  background: var(--snow);
  font: 600 32px/1.2 var(--font-card);
}
.mode-card__title { font: 700 66px/1 var(--font-pixel); }
.mode-card.is-selected .mode-card__text { width: auto; padding: 36px; border: 0; font-size: 37px; }
.mode-card.is-selected .mode-card__title { font-size: 80px; }
.setup-options { display: flex; flex-direction: column; gap: 48px; }
.setup-section { display: flex; flex-direction: column; gap: 20px; }
.setup-heading { font: 700 38px/1 var(--font-pixel); }
/* Options side by side, sharing their edges. */
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.segments .btn { padding-inline: 8px; }
.segments .btn + .btn { margin-left: -4px; }
.segments .btn[aria-pressed="true"] { position: relative; }
.segments .btn:focus-visible { position: relative; z-index: 1; }
.setup-advanced {
  padding: 24px 0;
  border: solid var(--rule);
  border-width: 3px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font: 600 max(30px, var(--min-text))/1.3 var(--font-card);
}
.setup-advanced .btn { flex: none; }
.display .btn--open { font-size: 56px; padding: 34px 24px; }
/* Advanced, in place of Game Setup. */
.advanced { flex: 1; display: grid; grid-template-columns: 440px 1fr; gap: 80px; padding-top: 12px; }
.advanced__side { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; }
.advanced__title { font: 700 88px/1 var(--font-pixel); }
.advanced__timer { padding-bottom: 28px; }
.advanced__note { font: 600 max(28px, var(--min-text))/1.3 var(--font-card); color: var(--muted); }
.display .advanced__row {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  padding: 18px 0;
  border-top: 3px solid var(--rule);
  color: var(--snow);
}
.advanced__row:last-child { border-bottom: 3px solid var(--rule); }
.advanced__copy { display: flex; flex-direction: column; gap: 6px; }
/* The track follows its input for :checked, but sits on the right with its state beside it. */
.advanced__row .switch__track { order: 1; margin-left: 80px; }
.advanced__row .switch__track::before {
  content: "Off";
  content: "Off" / "";
  position: absolute;
  top: 50%;
  right: calc(100% + 20px);
  translate: 0 -50%;
  font-size: 32px;
  line-height: 1;
  color: var(--muted);
}
.advanced__row input:checked + .switch__track::before { content: "On"; content: "On" / ""; color: var(--snow); }
.advanced__row:has(input:focus-visible) { outline: 4px solid var(--snow); outline-offset: 4px; }
.display .advanced__row input:focus-visible + .switch__track { outline: 0; }
.join-summary { gap: 44px; }
.join-summary .tv-text { max-width: 900px; text-align: right; }
.join-hero { display: flex; align-items: center; gap: 80px; margin: auto 0; padding-left: 14px; }
.code-card {
  --card-border: 5px;
  --card-radius: 12px;
  --card-shadow: 10px;
  --shadow: #060d16;
  --tilt: -1.5deg;
  width: 900px;
  height: 400px;
  padding: 34px 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.code-card__url { font-size: 38px; font-weight: 600; overflow-wrap: anywhere; }
.code-card__url strong { font-weight: 800; }
.code-card__code { font: 700 230px/1 var(--font-pixel); letter-spacing: 0.12em; }
/* The Jay doesn't play a card: their seat is a gold outline, not a card back. */
.table-seat .slot.is-jay { border: 4px solid var(--gold); color: var(--gold); font: 700 max(26px, var(--min-text))/1.1 var(--font-card); }
.classic-reveal-box { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; font-family: var(--font-pixel); }
.classic-reveal-points { --card-border: 4px; padding: 14px 24px; font-size: 48px; font-weight: 700; line-height: 1; }
.classic-reveal-target { font-size: 36px; color: var(--snow); }
.lobby-bottom { margin-top: auto; display: flex; gap: 28px; align-items: flex-end; }
.seats { display: flex; gap: 20px; align-items: flex-start; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 150px; }
.seat-card {
  --card-shadow: 6px;
  width: 150px;
  height: 212px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.seat-card .band { height: 62px; flex: none; }
.seat-card__body { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 0 6px; text-align: center; }
.seat-card__name { font-family: var(--font-pixel); font-weight: 700; line-height: 1; overflow-wrap: anywhere; }
.seat-card__status { font: 600 max(22px, var(--min-text))/1.2 var(--font-card); color: var(--on-snow-muted); }
.seat.is-away .seat-card__status { color: var(--boss-red); }
.seat.is-away .seat-card { opacity: 0.78; }
.seat .slot { width: 150px; height: 212px; font-size: max(22px, var(--min-text)); border-color: var(--dashed); }
.seat .link-btn { font-size: max(20px, var(--min-text)); }
.deal { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; padding-bottom: 42px; }

/* Answer */
.deck-stack { position: relative; width: 72px; height: 96px; }
.deck-stack .card-back { position: absolute; width: 64px; height: 88px; }
.deck-stack .card-back:first-child { left: 8px; top: 8px; }
.deck-stack .card-back:last-child { left: 0; top: 0; }
.answer-center { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.prompt-card.on-tv {
  --card-border: 5px;
  --card-radius: 10px;
  --card-shadow: 12px;
  --tilt: -1.5deg;
  width: 1180px;
  min-height: 380px;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.prompt-card.on-tv .prompt-text { font-size: 84px; line-height: 1.05; }
.fuse-row { width: 1180px; display: flex; align-items: center; gap: 24px; font-family: var(--font-pixel); }
.fuse { flex: 1; height: 28px; border: 4px solid var(--ink); border-radius: 6px; background: var(--ink); overflow: hidden; }
.fuse__burn { height: 100%; width: 100%; background-color: var(--prompt); background-image: repeating-linear-gradient(90deg, transparent 0 18px, var(--ink) 18px 26px); }
.fuse-row .timer { font-size: 56px; font-weight: 700; min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
.fuse-row__progress { font-size: 34px; white-space: nowrap; }
.fuse-free { flex: 1; display: flex; justify-content: center; }
.display .btn.btn--quiet { font-size: max(28px, var(--min-text)); padding: 12px 22px; border-width: 4px; }
.display .btn.btn--quiet.btn--deal { font-size: 44px; padding: 28px 44px; }
.vote-clock .btn--quiet { margin-top: 8px; }
.table-row { margin-top: auto; display: flex; gap: 24px; justify-content: center; align-items: flex-end; }
.table-seat { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 168px; }
.table-seat .card-back { --card-border: 4px; --card-radius: 8px; width: 120px; height: 168px; box-shadow: 6px 6px 0 var(--shadow); }
.table-seat .slot { width: 120px; height: 168px; font-size: 40px; }
.table-seat .slot.is-away { font: 700 max(26px, var(--min-text))/1.1 var(--font-card); color: var(--dim); border-color: var(--dim); }
.table-seat.is-away .table-seat__name { color: var(--dim); }
/* One line: display.js shrinks a long name to fit; an ellipsis is the last resort. */
.table-seat__name { max-width: 100%; font-family: var(--font-pixel); font-size: max(26px, var(--min-text)); color: var(--dim); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-seat.is-done .table-seat__name { color: var(--snow); }

/* Boss answer */
.join-hint { font: 600 max(30px, var(--min-text))/1.2 var(--font-card); white-space: nowrap; }
.boss-head { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.boss-head .join-hint { position: absolute; top: 0; right: 0; }
.boss-head .boss-wordmark { font-size: 120px; transform: rotate(-2deg); }
.boss-cards { display: flex; gap: 64px; align-items: center; justify-content: center; }
.boss-rule.on-tv {
  --card-border: 6px;
  --tilt: 2deg;
  width: 620px;
  padding: 36px 44px;
  gap: 16px;
}
.boss-rule.on-tv .card-label { font-size: max(28px, var(--min-text)); }
.boss-rule.on-tv .boss-rule__title { font-size: 76px; line-height: 1; }
.boss-rule.on-tv .boss-rule__detail { font-size: 32px; }
.prompt-card.on-tv.is-boss-prompt { width: 900px; min-height: 0; padding: 44px 52px; --card-shadow: 12px; }
.prompt-card.on-tv.is-boss-prompt .prompt-text { font-size: 60px; }
.screen--answer.is-boss { gap: 32px; }
.screen--answer.is-boss .fuse-row { width: 1584px; }
.screen--answer.is-boss .table-seat .card-back, .screen--answer.is-boss .table-seat .slot { width: 96px; height: 134px; }

/* Vote */
.vote-top { display: flex; justify-content: space-between; align-items: flex-start; }
/* Classic: who's picking, the thing to watch while the Jay decides. */
.vote-heading { margin-top: 12px; font: 700 72px/1 var(--font-pixel); color: var(--snow); text-align: center; }
.prompt-card.on-tv-small {
  --card-border: 4px;
  --card-shadow: 8px;
  --tilt: -2deg;
  width: 760px;
  padding: 28px 36px;
  font-size: 44px;
  line-height: 1.1;
}
.vote-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-family: var(--font-pixel); }
.vote-clock .timer { font-size: 72px; font-weight: 700; line-height: 1; }
.vote-clock__time { align-items: baseline; gap: 28px; }
.vote-clock .join-hint { margin-bottom: 8px; }
.fan { flex: 1; display: flex; justify-content: center; align-items: center; }
/* Five or more answers: rows of wide cards, the last row centred. */
.fan.is-grid {
  flex-wrap: wrap;
  align-content: center;
  gap: 28px;
  width: calc(var(--cols) * var(--w) + (var(--cols) - 1) * 28px);
  margin: 0 auto;
}
.fan.is-grid .fan-card { width: var(--w); height: var(--h, 296px); margin: 0; padding: 16px 26px; }
.fan.is-grid .fan-card .corner { font-size: 40px; }
.fan-card {
  --card-border: 5px;
  --card-shadow: 10px;
  flex: none;
  width: calc(380px * var(--k, 1));
  height: calc(480px * var(--k, 1));
  margin: 0 -6px;
  padding: calc(24px * var(--k, 1)) calc(28px * var(--k, 1));
  display: flex;
  flex-direction: column;
  transform: translateY(var(--lift, 0px)) rotate(var(--tilt, 0deg));
}
/* The number top left only: upside down, a 6 reads as a 9. */
.fan-card .corner { font-family: var(--font-pixel); font-size: calc(56px * var(--k, 1)); font-weight: 700; line-height: 1; }
/* Its size is set per answer (cardTextSize). */
.fan-card__text { margin-block: auto; font-weight: 700; line-height: 1.12; overflow-wrap: break-word; }
/* Who's voted: plain names, each with a feather once they have. */
/* Kept clear of the Sound switch in the bottom-right corner when the names wrap. */
.voters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 32px; padding-inline: 150px; font-family: var(--font-pixel); font-size: max(28px, var(--min-text)); }
.voter { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.voter.is-done { color: var(--snow); }
.voter__mark { --feather: 40px; width: 40px; height: 40px; }

/* Reveal */
.screen--reveal { gap: 64px; }
.reveal-left { width: 760px; flex: none; display: flex; flex-direction: column; gap: 36px; justify-content: center; }
/* The prompt over the results, whole and in the prompt's gold. */
.reveal-prompt { margin: 0; font: 700 36px/1.2 var(--font-card); color: var(--prompt); overflow-wrap: break-word; }
.winner { position: relative; }
.winner-card {
  --card-border: 6px;
  --card-radius: 12px;
  --card-shadow: 14px;
  --tilt: -3deg;
  width: 640px;
  height: 720px;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}
.winner-card .corner { font-family: var(--font-pixel); font-size: 60px; font-weight: 700; line-height: 1; }
.winner-card__text { font-size: 62px; font-weight: 800; line-height: 1.08; overflow-wrap: anywhere; }
.winner-card__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.winner-card .feathers { --feather: 58px; display: flex; flex-wrap: wrap; gap: 10px; }
.winner-card .feathers.is-many { --feather: 46px; gap: 6px; }
.signature { margin-left: auto; font-family: var(--font-pixel); font-size: 40px; font-weight: 700; white-space: nowrap; }
.winner .stamp { position: absolute; right: 40px; top: 90px; font-size: 54px; padding: 10px 22px; border-width: 6px; }
/* Everything keeps its size; only the list of other answers gives way, and the compact
 * sizes (four or more others) make sure it never has to. */
.reveal-right { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 40px; font-family: var(--font-pixel); }
.reveal-right > * { flex: none; }
.reveal-right > .others { flex: 0 1 auto; min-height: 0; overflow: hidden; }
.reveal-right .score-equation {
  --eq-gap: 24px;
  --card-border: 5px;
  --card-shadow: 8px;
  --chip-pad: 20px 28px;
  --chip-label: 26px;
  --chip-value: 76px;
  --op-size: 72px;
}
/* The boxes step down as mults pile up, so five still fit on one row. */
.reveal-right.is-compact .score-equation,
.reveal-right .score-equation:is([data-mults="2"], [data-mults="3"]) { --chip-pad: 14px 20px; --chip-label: 22px; --chip-value: 52px; --op-size: 52px; --eq-gap: 16px; }
.reveal-right .score-equation:is([data-mults="4"], [data-mults="5"]) { --chip-pad: 10px 14px; --chip-label: 20px; --chip-value: 40px; --op-size: 40px; --eq-gap: 10px; --card-shadow: 6px; }
.big-total { margin: 0; font: 700 220px/1 var(--font-pixel); color: var(--snow); }
.big-total__digits { display: inline-block; }
.reveal-right.is-compact { gap: 24px; }
.reveal-right.is-compact .big-total { font-size: 150px; }
/* The rest of the round, most points first: answer, who, points. */
.others { display: flex; flex-direction: column; gap: 10px; font-size: 32px; }
.others li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 24px; padding: 10px 0; border-bottom: 3px solid var(--rule); }
.others__text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font: 700 0.84em/1.2 var(--font-card); }
.others__by { white-space: nowrap; color: var(--muted); }
.others .points { min-width: 2.2ch; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.others .points.is-scored { color: var(--snow); }
.reveal-right.is-compact .others, .others.is-columns { gap: 4px; font-size: max(28px, var(--min-text)); }
.reveal-right.is-compact .others li, .others.is-columns li { padding: 6px 0; }
.reveal-end { position: absolute; top: 24px; right: 96px; z-index: 2; display: flex; align-items: center; gap: 32px; }

/* Nobody won: the prompt with a stamp saying why, as the Apple TV has it. */
.reveal-none { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 40px; font-family: var(--font-pixel); }
.reveal-none__prompt { position: relative; align-self: flex-start; margin-bottom: 24px; }
.prompt-card.on-tv.reveal-none__card { width: 1100px; min-height: 0; padding: 44px 52px; }
.reveal-none__card .prompt-text { font-size: 56px; line-height: 1.08; }
.reveal-none .stamp { position: absolute; right: -120px; bottom: -40px; font-size: 64px; padding: 6px 26px; border-width: 7px; --tilt: -8deg; white-space: nowrap; }
.reveal-why { font: 600 40px/1.2 var(--font-card); color: var(--muted); }

/* Dead heat: the tied cards side by side, smaller, with DEAD HEAT stamped across them. */
.dead-heat { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; font-family: var(--font-pixel); }
/* The stamp sits above the cards, clear of their numbers. */
.heat-row { position: relative; flex: none; padding-top: 104px; }
.heat-cards { display: flex; justify-content: center; align-items: flex-start; gap: 56px; }
.heat { width: 480px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.heat-card {
  --card-border: 5px;
  --card-radius: 12px;
  --card-shadow: 10px;
  width: 480px;
  height: 360px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-card);
}
.heat-card .corner { font-family: var(--font-pixel); font-size: 44px; font-weight: 700; line-height: 1; }
.heat-card__text { font-size: 40px; font-weight: 800; line-height: 1.08; overflow-wrap: anywhere; }
.heat-card__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; }
.heat-card .feathers { --feather: 40px; display: flex; flex-wrap: wrap; gap: 6px; }
.heat-card .feathers.is-many { --feather: 32px; gap: 4px; }
.heat-card .signature { font-size: max(30px, var(--min-text)); }
.heat .score-equation.is-small {
  justify-content: center;
  --eq-gap: 8px;
  --card-border: 4px;
  --card-shadow: 4px;
  --chip-pad: 6px 10px;
  --chip-label: 18px;
  --chip-value: 28px;
  --op-size: 28px;
}
.heat-total { font-size: 72px; font-weight: 700; line-height: 1; color: var(--snow); }
.heat--more { width: auto; align-self: center; }
.heat--more .slot { width: 200px; height: 280px; font-size: 40px; border-color: var(--dim); --tilt: 3deg; }
.heat-stamp {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  translate: -50% 0;
  font-size: 64px;
  padding: 6px 26px;
  border-width: 7px;
  --tilt: -4deg;
  white-space: nowrap;
}
.others.is-columns { display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; flex: 0 1 auto; min-height: 0; overflow: hidden; }

/* Scores and end */
.tv-title { margin-top: 40px; font-family: var(--font-pixel); font-size: 64px; font-weight: 700; line-height: 1; }
.standings-body { display: flex; align-items: center; gap: 96px; margin-top: 28px; }
.tv-standings { flex: 0 1 1160px; display: flex; flex-direction: column; font-family: var(--font-pixel); }
.tv-standing {
  position: relative;
  display: grid;
  grid-template-columns: 2.2ch auto 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  border-bottom: 4px solid var(--rule);
  font-size: 44px;
}
.tv-standing .card-back { width: 44px; height: 60px; --card-border: 4px; }
.tv-standing__rank { color: var(--dim); }
.tv-standing__name { min-width: 0; overflow-wrap: anywhere; }
/* This round's points, grey beside the total. */
.tv-standing__gain { font-size: 34px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tv-standing__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-standing__of { color: var(--muted); font-weight: 400; }
.tv-standing.is-top { background: var(--snow); color: var(--ink); border: 5px solid var(--ink); border-radius: 10px; box-shadow: 8px 8px 0 var(--shadow); }
.tv-standing.is-top .tv-standing__rank, .tv-standing.is-top .tv-standing__gain, .tv-standing.is-top .tv-standing__of { color: var(--on-snow-muted); }
/* The end screen's WINNER, stamped beside each winner's name, inside the row so tied winners don't overlap. */
.row-stamp { margin-left: 28px; vertical-align: middle; font-size: 32px; padding: 4px 16px; border-width: 5px; --tilt: -6deg; white-space: nowrap; }
.end-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 360px; }
.end-actions .note { font-size: max(26px, var(--min-text)); }
.scores-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 32px; }
.scores-foot__end { display: flex; align-items: center; gap: 32px; }
.prompt-text { margin: 0; font: inherit; }
.gone-card { padding: 22px 20px; font-size: max(22px, var(--min-text)); font-weight: 700; --tilt: -1deg; }
.gone-card h1, .gone-title { font: inherit; }
.tv-label { font-weight: 400; }
.boss-note { margin-top: 28px; }
.result-card {
  --card-border: 4px;
  --card-shadow: 6px;
  --tilt: -2deg;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  font-size: max(24px, var(--min-text));
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.result-card .feathers { --feather: 36px; display: flex; flex-wrap: wrap; gap: 6px; }
.nowrap { white-space: nowrap; }
/* At 200% zoom a phone is under 260 CSS px wide: a long word and its blank can't share a line. */
@media (max-width: 260px) { .nowrap { white-space: normal; } }

/* ---------- Motion ---------- */
/*
 * The CSS half of the juice: idle loops that run on their own. Dealing, flipping,
 * stamping and counting are in juice.js. Loops animate the individual `rotate`,
 * `translate` and `scale` properties so they stack with each card's `transform`
 * tilt. Their delays include var(--t) (set by keepTime in juice.js) so a rebuilt
 * screen picks each loop up where the old one was instead of jumping.
 */

/* Living cards: a slow sway, out of step from card to card. */
@keyframes sway {
  from { rotate: calc(var(--sway, 1deg) * -1); }
  to { rotate: var(--sway, 1deg); }
}
.prompt-card, .fan-card, .seat-card, .winner-card, .you-card {
  animation: sway var(--sway-time, 3.2s) ease-in-out calc(var(--t, 0ms) + var(--sway-offset, 0ms)) infinite alternate;
}
.prompt-card.on-tv, .winner-card { --sway: 0.6deg; --sway-time: 4.2s; }
.winner-card { --sway-offset: -1.7s; }
.seat:nth-child(4n + 2) .seat-card, .fan-card:nth-child(4n + 2) { --sway-offset: -1.1s; }
.seat:nth-child(4n + 3) .seat-card, .fan-card:nth-child(4n + 3) { --sway-offset: -2.5s; }
.seat:nth-child(4n + 4) .seat-card, .fan-card:nth-child(4n + 4) { --sway-offset: -0.6s; }

/* A card turning over: the barred back that covers the face until halfway. */
.fan-card { position: relative; }
.flip-back {
  position: absolute;
  inset: calc(var(--card-border, 4px) * -1);
  overflow: hidden;
  border: var(--card-border, 4px) solid var(--ink);
  border-radius: var(--card-radius, 10px);
  background-color: var(--card-colour, var(--jay));
  pointer-events: none;
}

/* The fuse burns smoothly between the countdown's quarter-second ticks. */
.fuse__burn { transition: width 0.25s linear; }

/* The last five seconds: the fuse and the seconds pulse. */
@keyframes urgent {
  from { scale: 1; }
  to { scale: 1.12; }
}
@keyframes urgent-fuse {
  from { scale: 1; box-shadow: 0 0 0 0 var(--prompt); }
  to { scale: 1 1.25; box-shadow: 0 0 0 6px var(--prompt); }
}
.is-urgent .fuse-row .timer, .is-urgent .vote-clock .timer, .hud.is-urgent .timer {
  color: var(--gold);
  animation: urgent 0.5s ease-in-out var(--t, 0ms) infinite alternate;
}
.is-urgent .fuse { animation: urgent-fuse 0.5s ease-in-out var(--t, 0ms) infinite alternate; }

/* Swipe to play: touch-action stays auto, so the page still scrolls and zooms from the
 * card and a long answer scrolls in its box; juice.js claims only a touch whose first
 * move is upward (see swipeToPlay). */
.answer-card.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.answer-card.is-dragging textarea { pointer-events: none; }
.swipe-hint { text-align: center; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 60%, 100% { translate: 0 0; }
  75% { translate: 0 -5px; }
}

/* The display's readable and sound switches, in the stage's bottom-right margin (stage px,
 * so they scale with the screen and never land on its content). Kept to the margin's 22px
 * even in readable mode: they're the TV's own settings, not the game. */
.stage-switches {
  position: absolute;
  right: 20px;
  bottom: 6px;
  z-index: 10;
  display: flex;
  gap: 8px;
}
.stage-switches .switch {
  min-height: 48px;
  padding: 4px 12px 4px 8px;
  border-radius: 6px;
  background: rgba(13, 27, 42, 0.8);
  font-size: 22px;
}
.stage-switches .switch__track { width: 48px; height: 28px; border-width: 3px; }
.stage-switches .switch__track::after { width: 16px; height: 16px; top: 3px; left: 3px; }
.stage-switches input:checked + .switch__track::after { left: auto; right: 3px; }

/* Reduced motion: no loops at all. juice.js swaps its moves for quick fades. */
@media (prefers-reduced-motion: reduce) {
  .prompt-card, .fan-card, .seat-card, .winner-card, .you-card,
  .swipe-hint,
  .is-urgent .fuse, .is-urgent .fuse-row .timer, .is-urgent .vote-clock .timer, .hud.is-urgent .timer {
    animation: none;
  }
  .fuse__burn { transition: none; }
}
.is-readable :is(.prompt-card, .fan-card, .seat-card, .winner-card, .you-card, .swipe-hint,
  .is-urgent .fuse, .is-urgent .fuse-row .timer, .is-urgent .vote-clock .timer, .hud.is-urgent .timer) { animation: none; }
.is-readable .fuse__burn { transition: none; }
.readable-switch + .note { margin-top: 4px; }

/* The HUD hides when it has nothing to show (the lobby, with no clock or warning). */
.hud:has(.hud__me:empty):not(:has(.clock-chip:not([hidden]), .no-timer:not([hidden]), .hud__time:not([hidden]))) { display: none; }
