/* Bingo — one phone, one hand, one screen. Dark hall, warm lights.
   Layout law: the play screen never scrolls. The card is the hero, the called
   panel is the index beneath it, and all 75 tokens are on screen at once.

   This is the PHONE's stylesheet. The wall's sound chip — its three states
   (sound on / blocked / muted) — lives in monitor.css, beside the page that
   uses it; this file holds no blocked-state rule and the phone is unchanged. */

:root {
  --bg: #0b1017;
  --bg2: #0e151e;
  --panel: #111a24;
  --cell: #16202b;
  --line: #24313f;
  --ink: #e9f0f8;
  --dim: #8ea0b4;
  --dimmer: #5d6d80;
  --gold: #ffbb2b;
  --gold-ink: #1a1405;
  --good: #4ade80;
  --bad: #f87171;
  --b: #4aa3ff;
  --i: #4ade80;
  --n: #f9a8d4;
  --g: #fbbf24;
  --o: #a78bfa;
  --radius: 12px;

  /* The claim badge's palette, from Rob's approved mockup and his 2026-12-04
     amendment that the whole word speaks the board's column colours. All five
     are mapped here, in one place: a palette change is this block and nothing
     else. Rob has also said he may want the name gold or white later: that is
     the last line. */
  --badge-b: var(--b);
  --badge-i: var(--i);
  --badge-n: var(--n);
  --badge-g: var(--g);
  --badge-o: var(--o);
  --badge-name: var(--gold);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* A class with `display` beats the UA stylesheet's [hidden] rule; make `hidden`
   mean hidden, everywhere, so a banner or a host control never leaks through. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #14202c 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
}

#app {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------------ topbar */
#topbar {
  flex: 0 0 auto;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
}
/* One span per letter, each carrying the colour of its card column — the same
   `--c` convention as .card-head span, so the two can never drift apart. */
#brand { font-weight: 800; letter-spacing: 0.3em; }
#brand span { color: var(--c); }
.roomtag {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
  color: var(--ink);
  background: #17222e;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.conn { margin-left: auto; }
.roomtag + .conn { margin-left: 0; }
/* The sound switch: a phone-sized pill in the header, quiet when muted and gold
   when it will speak. It is the only control here that is not about the game. */
.sound {
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  background: #131d28;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  margin-left: auto;
  cursor: pointer;
  flex: 0 0 auto;
}
.sound.on { color: var(--gold-ink); background: var(--gold); border-color: #d99a17; }
.roomtag + .sound { margin-left: auto; }
.sound + .conn { margin-left: 0; }
.conn::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  background: var(--dimmer);
  vertical-align: middle;
}
.conn.live::before { background: var(--good); }
.conn.down::before { background: var(--bad); }

/* ----------------------------------------------------------------- screens */
.screen { display: none; flex: 1 1 auto; min-height: 0; padding: 4px 12px 10px; }
.screen.active { display: flex; flex-direction: column; }
/* The layout law is that the play screen fits without scrolling; this is the
   safety valve for the one phone that does not, so nothing is ever clipped.
   On a screen that fits, it is inert. */
#screenPlay, #screenVote, #screenLobby { overflow-y: auto; }

h1 { font-size: 26px; line-height: 1.1; margin: 6px 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 24px; margin: 4px 0 6px; letter-spacing: -0.01em; }
.lede { color: var(--dim); font-size: 13px; line-height: 1.4; margin: 0 0 14px; }

/* A join that came from a QR or a door: the room is fixed, the name is the ask. */
.join-target {
  margin: 0 0 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101b25;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.35;
}
.hint { color: var(--dim); font-size: 12px; line-height: 1.45; }
.hint.tiny { font-size: 11px; }
.error { color: var(--bad); font-size: 12px; margin: 8px 0 0; }

/* -------------------------------------------------------------------- join */
.join-wrap { overflow-y: auto; padding-bottom: 16px; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.field input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.field input:focus { border-color: var(--gold); }
#joinCode { letter-spacing: 0.28em; text-transform: uppercase; font-weight: 700; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline > span { margin: 0; flex: 1; }
.field.inline input { width: auto; }

button { font: inherit; cursor: pointer; border-radius: var(--radius); border: 1px solid var(--line); background: #17222e; color: var(--ink); padding: 10px 14px; }
button:active { transform: translateY(1px); }
button.big { width: 100%; padding: 14px; font-size: 16px; font-weight: 700; margin-top: 4px; }
button.primary { background: var(--gold); color: var(--gold-ink); border-color: #d99a17; box-shadow: 0 6px 18px rgb(255 187 43 / 0.18); }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
button[disabled] { opacity: 0.45; }

.or { display: flex; align-items: center; gap: 10px; color: var(--dimmer); font-size: 11px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.create summary { font-size: 13px; color: var(--dim); padding: 6px 0; }
.advanced { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0 12px; }
.advanced-head { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.advanced-head span { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--dimmer); }
.setrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 7px 0; border-top: 1px solid #1b2632; }
.setrow:first-child { border-top: 0; }
.setrow label { font-size: 13px; }
.setrow .unit { font-size: 11px; color: var(--dimmer); }
.setrow input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--gold); }
.setrow select {
  grid-column: 1 / -1;
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.setrow select:focus { border-color: var(--gold); }
.setrow output { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); font-size: 14px; }
.setrow .sethelp { grid-column: 1 / -1; font-size: 10.5px; color: var(--dimmer); line-height: 1.35; }

/* The host's settings, in the room: the create form's controls again, painted
   from the same rows. Only the host's page builds them, and only in the lobby
   and the armed wait. Left-aligned inside the centred armed panel, and quiet
   enough that Start stays the one loud control on the screen. */
.host-settings {
  text-align: left;
  margin: 2px 0 10px;
  padding: 8px 12px 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #0f1a24;
}
.host-settings .advanced-head { margin-bottom: 2px; }
.armed-settings { margin: 10px 0 0; }

/* ------------------------------------------------------------------- lobby */
.code-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px;
}
.code-label { font-size: 10px; letter-spacing: 0.18em; color: var(--dim); }
#lobbyCode { font-size: 26px; letter-spacing: 0.24em; font-variant-numeric: tabular-nums; margin-left: auto; }
.seats { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }

/* A monitor is in the room but not in the game: it sits at the very top of the
   list, apart from the players, so the host can see the display was recognised.
   Dashed edge and a steel-blue tag rather than a player's solid card. The player
   list scrolls underneath, so a long room never pushes the display out of sight. */
.seats.monitors { margin-bottom: 6px; flex: 0 0 auto; }
.seats.monitors li { flex: 0 0 auto; border-style: dashed; border-color: #2f4a63; background: #0f1b26; color: var(--dim); }
.seats.monitors .tag.monitor { background: #10222f; color: #7fd1ff; border: 1px solid #23445c; }
.seats.players { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.seats.players li { flex: 0 0 auto; }
.seats li.you { border-color: #3a4d61; }
.seats .tag { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; background: #1d2a37; color: var(--dim); }
.seats .tag.host { background: #3a2f0a; color: var(--gold); }
.seats .tag.bot { background: #1b2330; color: #7f93a8; }
.seats .tag.away { background: #2a1c1c; color: #e4a6a6; }
.seats .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dimmer); margin-left: auto; }
.seats .dot.on { background: var(--good); }

/* The lobby token: the same face the wall draws, at phone size. A photo fills
   the circle; the generic silhouette is the default and the fallback for a
   photo that cannot be fetched. */
.seats .av {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #18232e;
  border: 1px solid #2b3a49;
  color: #b6c6d6;
}
.seats .av .sil { width: 78%; height: 78%; display: block; }
.seats .av .av-img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.host-controls { margin-top: 0; display: flex; flex-direction: column; gap: 8px; }
.lobby-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.bots-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.bots-row b { min-width: 18px; text-align: center; color: var(--ink); }

/* The host's copy of the room door. Small enough for a phone, white enough for
   a camera: a guest can scan the host's screen if the wall is behind them. */
.invite {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1a24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.invite-title { margin: 0; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.invite-qr { width: 150px; height: 150px; padding: 6px; border-radius: 6px; background: #fff; }
.invite-qr svg { width: 100%; height: 100%; display: block; }
.invite-code { margin: 0; font-size: 12px; color: var(--dim); letter-spacing: 0.08em; }
.invite-code strong { color: var(--gold); font-size: 17px; letter-spacing: 0.12em; margin-left: 6px; }
.invite-url { margin: 0; font-size: 10.5px; color: var(--dim); word-break: break-all; text-align: center; }
.danger { color: #e8a0a0; border-color: #4a2626; }
.danger:active { color: #ffb4b4; border-color: #6b3333; }

/* ------------------------------------------------------------ lobby selfie */
/* The optional photo. One card, one question, two ways out: take it, or Skip
   and keep the silhouette. The video is the live viewfinder only — the stored
   avatar is never rendered on this phone. */
.selfie {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1a24;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.selfie-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); }
.selfie-note { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.4; }
.selfie-video {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #33453a;
  align-self: center;
  background: #0b1118;
  transform: scaleX(-1); /* a mirror, so aiming feels natural */
}
.selfie-actions { display: flex; flex-direction: column; gap: 6px; }
.selfie-actions .ghost { align-self: center; }

/* The host's one-tap clear, in the player list. */
.seats .clear-photo {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #4a2626;
  background: transparent;
  color: #e8a0a0;
}
.seats .clear-photo:active { color: #ffb4b4; border-color: #6b3333; }

/* -------------------------------------------------------------------- vote */
.vote-head, .play-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim);
  padding: 2px 0 6px;
}
.clock { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 700; letter-spacing: 0.04em; }
.pattern-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 4px 8px; min-height: 0;
}
.tile.voted { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tile .mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; width: min(46px, 38%); aspect-ratio: 1; }
.tile .mini i { background: #1b2632; border-radius: 1.5px; }
.tile .mini i.on { background: #4b6079; }
.tile .tname { font-size: 10.5px; line-height: 1.15; text-align: center; color: var(--ink); font-weight: 600; }
.tile .pill {
  position: absolute; top: 4px; right: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.02em;
  background: var(--gold); color: var(--gold-ink);
  border-radius: 999px; padding: 2px 5px;
}
.tile .tally {
  position: absolute; top: 3px; left: 4px;
  font-size: 10px; font-weight: 800; color: var(--dim);
  background: #0e1620; border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px;
}
.tile.voted .tally { color: var(--gold); border-color: #4a3a10; }
.vote-foot { flex: 0 0 auto; padding-top: 8px; }
.card-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { font-size: 13px; padding: 10px; }
.toggle.on { border-color: var(--gold); color: var(--gold); background: #221b07; }

/* -------------------------------------------------------------------- play */
#screenPlay { gap: 5px; }
#lateNote { margin: 0; color: var(--gold); }
/* Name, the pattern's own shape, then the round counter: the dots sit beside the
   name and are centred on it, the counter keeps the right edge. */
.play-head { padding-bottom: 0; justify-content: flex-start; align-items: center; gap: 7px; }
#playMeta { font-variant-numeric: tabular-nums; margin-left: auto; }

/* The pattern drawn as the shape itself — 5×5, row-major, only the cells the
   pattern holds. A zero cell renders nothing at all: no cell, no border, no line,
   so a reader sees a line or an X rather than a lattice. Deliberately unlike the
   vote tiles' `mini` field. 5×3px dots + 4×3px gaps = 27px square. */
.pattern-dots {
  display: grid;
  grid-template-columns: repeat(5, 3px);
  grid-template-rows: repeat(5, 3px);
  gap: 3px;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  align-self: center;
  /* Ordered first so the field's left edge is the screen's own 12px padding — the
     shape is the anchor and the name reads after it. The DOM keeps the name first
     for anything reading the head as text; the field is aria-hidden. */
  order: -1;
}
.pattern-dots i { width: 3px; height: 3px; border-radius: 50%; background: #93a8bd; }
.last-ball {
  flex: 0 0 auto; height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(180deg, #16202c, #101821);
  border: 1px solid var(--line); border-radius: 14px;
  position: relative; overflow: hidden;
}
.last-ball::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 120% at 50% 0%, var(--bc, #2b3a4c) 0%, transparent 70%);
  opacity: 0.22;
}
.ball-letter { font-size: 22px; font-weight: 800; color: var(--bc, var(--dim)); letter-spacing: 0.04em; }
.ball-num { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ball-caption { position: absolute; right: 10px; bottom: 4px; font-size: 9px; color: var(--dimmer); letter-spacing: 0.08em; text-transform: uppercase; }

.table {
  flex: 1 1 auto;
  /* Not 0: the table may not shrink below the height its own contents need (the
     card's square, the panel's floor). A screen too short for both scrolls the
     play screen instead of letting the panel slide under the CLAIM button. */
  min-height: min-content;
  width: min(100%, 40dvh, 340px); margin: 0 auto;
  display: flex; flex-direction: column; gap: 3px;
}
.card-head { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; flex: 0 0 auto; padding-bottom: 2px; }
/* One letter per card column. The left padding cancels the trailing letter-space so the glyph
   stays optically centred on its column however far the letters are spread. */
.card-head span { text-align: center; font-size: 13px; font-weight: 800; color: var(--c); letter-spacing: 0.26em; padding-left: 0.26em; }
.card {
  /* minmax(0, 1fr), not 1fr: a 1fr track refuses to shrink below its cell's min-content,
     which let the grid burst out of the table on short screens and left the BINGO letters
     sitting over the wrong columns. */
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 4px; width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto;
}
.cell {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(12px, 4.4vw, 19px); font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--cell); border: 1px solid #1f2b38; border-radius: 7px;
  color: var(--ink); user-select: none; min-height: 0; min-width: 0; padding: 0;
}
/* The free square is lit: deep red fill, pure white lettering (6.95:1), and an
   inset glow so it reads as a lamp rather than a flat swatch. Both shadows are
   inset or zero-spread, so the tile's box and its neighbours are untouched.
   `opacity: 1` overrides button[disabled]'s 0.45, which would otherwise dim both
   the red and the white to a muted maroon/grey. */
.cell.free {
  color: #fff; font-size: 9px; letter-spacing: 0.12em; opacity: 1;
  background: #b3121f; border-color: #d01726;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12),
              inset 0 0 12px rgb(255 96 96 / 0.35);
}
.cell.marked { background: var(--cc); border-color: var(--cc); color: #08111a; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }
.cell.marked::after { content: ""; }
.cell.pulse { animation: pop 420ms ease-out; }
@keyframes pop { 0% { transform: scale(0.86); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

.panel-head { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dimmer); }
.panel {
  flex: 1 1 auto;
  /* A floor, not a shrink-to-nothing: fifteen rows of 5 tokens are the index a
     player reads all game, and below ~8px a row the numbers collide. When the
     screen cannot give the panel this much, the play screen scrolls (the one
     thing it may do) rather than crushing the index or the card. */
  min-height: 150px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(15, minmax(0, 1fr));
  /* Fill DOWN each column, not across: tokens 1-15 stack under B, 16-30 under I, and so on,
     so every token sits in the column of the card it belongs to. */
  grid-auto-flow: column;
  gap: 2px;
}
/* THE CHART'S TOKENS. An uncalled number is the slot it has always been: a dark
   rounded cell. A called number is a BALL — a circle filled with its column's
   colour and the number inside it — and the cell keeps the exact geometry it
   had before (same tracks, same 2px gaps, same height), so nothing on the page
   grows to make room for the circle.

   The diameter comes from the TEXT, not the cell: two digits in this font are
   `2ch` wide — the chart sets font-variant-numeric: tabular-nums, so every digit
   has the same advance and every two-digit number the same width — plus 1px of
   colour on each side. One diameter for all 75 tokens, so a "7" is not a
   smaller ball than a "75". Measured at 390x844: text 11.37px, ball 13.36px,
   cell row 13.42px. */
.tok {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(7.5px, 2.1vw, 10.5px); font-weight: 600; font-variant-numeric: tabular-nums;
  color: #6f8095; background: #101821; border: 1px solid #1a2431; border-radius: 3px;
  min-height: 0; line-height: 1;
  position: relative;
  --ball-d: calc(2ch + 2px);
}
/* The called cell's own rectangle goes away: the ball is the shape now. The text
   keeps the column colour it wore on the dark cell as a fallback, so a stale
   cached script that renders a called token without its ball cannot turn the
   number invisible — it just looks like the previous release for one load. */
.tok.on { color: var(--cc); background: transparent; border-color: transparent; font-weight: 800; }
/* Radius = half the side, so the box is a circle at every point of its
   perimeter. The fill is the column colour and the number sits on it in the same
   near-black the card's marked cells and the monitor's landed ball use.
   The ball is taken OUT OF FLOW on purpose: its height is the number's height in
   this font, which is taller than a chart row, and an in-flow 13px box made the
   grid's min-content taller than the panel — the screen then had to scroll to
   hold a chart that had grown. Positioned, the ball paints over its own cell and
   contributes nothing to layout: every track, gap and height stays byte-for-byte
   the geometry it had before the shape changed. */
.tok.on .ball {
  position: absolute; top: 50%; left: 50%;
  margin: calc(var(--ball-d) / -2) 0 0 calc(var(--ball-d) / -2);
  display: flex; align-items: center; justify-content: center;
  width: var(--ball-d); height: var(--ball-d); border-radius: 50%;
  background: var(--cc); color: #08111a;
}
/* The white ring marks the last call. It is drawn just OUTSIDE the ball, in the
   2px gap the grid already has, so it crosses neither the number nor a
   neighbouring ball (measured clearance at 390x844: 0.4px to the next ball's
   edge). Which ball wears it is decided in app.js from round.lastBall — the
   room's snapshot — never from an animation, so a reload or a reconnect paints
   the correct ring on its first frame. No flight, no grow, no shrink: a called
   ball is simply there, already round. */
.tok.newest .ball { box-shadow: 0 0 0 var(--ball-ring, 1.5px) #fff; }
/* Short phones (≤720px tall): the chart's rows are 10.2px there and two digits
   are 11.4px wide, so the 1px rim would make every ball taller than the row
   pitch and two calls in neighbouring rows of one column would touch. The number
   may not shrink and the cell may not grow, so the PADDING is what gives way —
   the ball becomes exactly the two-digit advance (11.4px in a 12.1px pitch) and
   the ring thins to 1px to stay inside that pitch. Measured on the page at
   390x667, not guessed. */
@media (max-height: 720px) {
  .tok { --ball-d: 2ch; }
  .tok.newest .ball { --ball-ring: 1px; }
}
@media (prefers-reduced-motion: reduce) { .cell.pulse { animation: none; } }

.claim {
  flex: 0 0 auto; margin-top: 2px; height: 46px;
  font-size: 17px; font-weight: 800; letter-spacing: 0.16em;
  background: #1b2836; border: 1px solid #33475c; color: var(--ink);
}
.claim:active { background: #24374a; }

/* Leave — quiet, small, a ghost. Never gold, never close enough to the control
   that decides the round to be hit by mistake: 12px of clear space above it. */
.leave {
  flex: 0 0 auto;
  display: block;
  margin: 12px auto 0;
  padding: 6px 16px;
  min-height: 30px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dimmer);
  background: transparent;
  border: 1px solid #1d2937;
  border-radius: 999px;
}
.leave:active { color: var(--dim); border-color: var(--line); }
.leave[disabled] { opacity: 0.4; }

/* The armed wait — the round the vote chose, before the host calls the first ball.
   The host's Start round button is the one large control on this screen; every
   other seat sees the same facts as a calm sentence. Gold is the house's "this is
   the control that moves the room" colour, used nowhere else on the play screen. */
.armed-panel {
  flex: 0 0 auto;
  margin: 2px 0 5px;
  padding: 12px 14px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #211a07, #121a23 62%);
  border: 1px solid #5a4712;
  text-align: center;
}
.armed-kicker { margin: 0 0 3px; font-size: 10px; letter-spacing: 0.22em; color: var(--gold); }
#armedTitle { margin: 0; font-size: 19px; line-height: 1.2; }
.armed-prize { margin: 6px 0 0; font-size: 13px; line-height: 1.3; color: var(--gold); }
.armed-start {
  width: 100%;
  min-height: 62px;
  margin-top: 10px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.armed-wait { margin: 8px 0 0; font-size: 13px; color: var(--ink); }

/* ------------------------------------------------------------------ result */
.result-wrap { margin: auto 0; text-align: center; padding: 10px 4px 20px; }
.kicker { font-size: 10px; letter-spacing: 0.24em; color: var(--dim); margin: 0 0 6px; }
#resultTitle { font-size: 30px; }
.result-prize { margin: 14px 0 0; padding: 12px; border-radius: 12px; background: #221b07; border: 1px solid #6b520f; color: var(--gold); font-size: 14px; }
.mini-tallies { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.mini-tallies span { font-size: 10px; color: var(--dim); background: #131d27; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: #f3f6fa; color: #10161d;
  font-size: 14px; font-weight: 700;
  padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  z-index: 50; pointer-events: none;
  animation: toastin 180ms ease-out;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Short phones: give the panel room by shrinking the card — but never below the width at
   which the five columns stop being comfortable. 32dvh made the card tiny on a 667-tall
   screen; 44dvh keeps the panel and the card both usable. */
@media (max-height: 720px) {
  .table { width: min(100%, 44dvh, 340px); }
  .last-ball { height: 46px; }
  .ball-num { font-size: 24px; }
  .armed-start { min-height: 54px; font-size: 19px; }
}

/* ------------------------------------------------------------- claim badge */
/*
   Rob's design, 2026-12-04, and the approved mockup. On a phone the letters
   STACK: five across 390 px would leave a 40 px hole and the winner's face would
   disappear. The mockup's numbers are for 390 x 844 and are written against
   --bu: 3.9 px there. min(vw, ...vh) keeps the whole badge — word, ring, name —
   on one screen on a shorter phone; on the reference phone both terms are equal.
   The aperture is 86 x 78 against the 192 px stored avatar, a downscale, so the
   portrait stays sharp. The ring is 20 px wider than the counter on every side:
   the stroke stays visible and the photo never reaches the letter's outer edge.
*/
#screenBadge {
  --bu: min(1vw, 0.4621vh);
  padding: 0;
  background: var(--bg);
}
#screenBadge.active {
  position: fixed;
  inset: 0;
  z-index: 60;
  align-items: center;
  justify-content: center;
}

#screenBadge .bword {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  line-height: 0.84;
  letter-spacing: 0;
  font-size: calc(38.4615 * var(--bu)); /* 150 px at 390 x 844 */
  /* The five column colours are not equal in luminance — amber and pink read
     heavier than the blue — so every letter carries the same subtle dark edge
     and drop. Shared by the word, so it reads as one block. */
  text-shadow:
    0 0.008em 0 rgba(3, 7, 11, 0.60),
    0 0.020em 0.060em rgba(0, 0, 0, 0.45);
}

#screenBadge .bltr { display: block; }
/* The board's own column colours through the word (Rob, 2026-12-04). */
#screenBadge .bltr:nth-of-type(1) { color: var(--badge-b); }
#screenBadge .bltr:nth-of-type(2) { color: var(--badge-i); }
#screenBadge .bltr:nth-of-type(3) { color: var(--badge-n); }
#screenBadge .bltr:nth-of-type(4) { color: var(--badge-g); }
#screenBadge .oslot { display: flex; align-items: center; justify-content: center; }

#screenBadge .oring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(32.3077 * var(--bu));  /* 126 px */
  height: calc(30.2564 * var(--bu)); /* 118 px */
  background: var(--badge-o);
  border-radius: 50%;
}

#screenBadge .ocounter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(22.0513 * var(--bu)); /* 86 px */
  height: calc(20 * var(--bu));     /* 78 px */
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
}

#screenBadge .ocounter .sil {
  display: block;
  width: 74%;
  height: 74%;
  color: var(--dim);
}

/* The photo sits OVER the silhouette, never instead of it: a failed fetch just
   removes this element and the drawing underneath is the outcome. Absolute, so
   the counter's box never moves. */
#screenBadge .ocounter .bimg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  opacity: 0;
}
#screenBadge .ocounter .bimg.on { opacity: 1; }

#screenBadge .bwho {
  margin-top: calc(6.6667 * var(--bu)); /* 26 px */
  max-width: 92%;
  text-align: center;
}

#screenBadge .bname {
  font-weight: 800;
  color: var(--badge-name);
  letter-spacing: 0.005em;
  font-size: calc(8.9744 * var(--bu)); /* 35 px */
  /* A long name ellipsizes; it never resizes the word above it. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#screenBadge .bsub {
  color: var(--dim);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: calc(3.3333 * var(--bu)); /* 13 px */
  margin-top: calc(1.5385 * var(--bu)); /* 6 px */
}
