/* ==========================================================================
   I Dont Crow: kc.css, the one stylesheet for every migrated page.
   --------------------------------------------------------------------------
   Built from two design-lab sources, merged into one file (no @import):
     1. design-lab/02-brand/brand-tokens.css                  the brand tokens (colour, type, space, motion)
     2. design-lab/04-ui/direction-b-table/direction.css      the components of direction B, "The Table"
   Stripped on the way in: the mock-up controls bar and its state switcher, the ?bare handling,
   the mock-up reduced-motion (data-motion) and language-toggle switches, and the "sample" badge.
   Kept as in the mock: every component class name, Evening (data-theme="dark", the default) and
   Daylight (data-theme="light"), the TV tier, RTL via logical properties, reduced motion, focus rings.
   Pages load this file and never static/style.css. Add page-only rules at the end of this file
   under the "Pages" heading, or in a <style> block in the page's head_extra.
   Section 22 at the end holds the additions made for the live app.
   ========================================================================== */

/* ==========================================================================
   I Dont Crow: brand tokens (design lab, generated by _brand-build/build_tokens.py)
   Dark-first ("Evening"). Light ("Daylight") via [data-theme="light"], or by the system
   preference when no data-theme is set. Never edit this file by hand: edit tokens_data.py.
   Every colour pair below is contrast-checked in _brand-build/contrast-output.txt.
   Brand name seam: one string, --brand-name; also mark the name with data-brand-name.
   ========================================================================== */

:root {
  color-scheme: dark;
  --brand-name: "I Dont Crow";
  --brand-descriptor: "Team quiz night";
  --brand-line: "Know it? Crow it.";

  /* ---- colour, Evening (dark) ---- */
  --color-bg: #1C1512;  /* Espresso */
  --color-surface: #281E19;  /* Table */
  --color-raised: #35281F;  /* Tray */
  --color-border: #86705E;  /* Grain */
  --color-border-subtle: #4A3A2F;  /* Hairline */
  --color-text: #F7EDDC;  /* Linen */
  --color-text-2: #D8C8B2;  /* Oat */
  --color-text-3: #B0A08A;  /* Dust */
  --color-brand: #F4AE3D;  /* Tea */
  --color-brand-press: #D98F1E;  /* Strong tea */
  --color-brand-text: #F4AE3D;  /* Tea (text) */
  --color-on-brand: #1C1512;  /* Espresso */
  --color-focus: #F7EDDC;  /* Linen */
  --color-disabled: #85745F;  /* Dim */
  --color-team1: #F65F82;  /* Hibiscus */
  --color-on-team1: #1C1512;  /* Espresso */
  --color-team2: #4CCDD3;  /* Lagoon */
  --color-on-team2: #1C1512;  /* Espresso */
  --color-success: #8ED6A8;  /* Mint */
  --color-warning: #FFE08A;  /* Butter */
  --color-danger: #FF8F6B;  /* Paprika */
  --color-tile-200: #FBF4E6;  /* Cream card */
  --color-tile-400: #F0CF8C;  /* Straw card */
  --color-tile-600: #F4AE3D;  /* Tea card */
  --color-on-tile: #1C1512;  /* Espresso */
  --color-tile-edge: #1C1512;  /* Espresso */
  --color-crow-body: #F4AE3D;  /* Tea */
  --color-crow-wing: #D98F1E;  /* Strong tea */
  --color-crow-bill: #94551E;  /* Ember */
  --color-crow-eye: #1C1512;  /* Espresso */
  --color-crow-glint: #F7EDDC;  /* Linen */
  --color-scrim: rgba(28, 21, 18, 0.78);
  --color-crow-roundel: #1C1512;  /* a light ground never holds a bare crow: it stands on this */

  /* ---- spacing: 4 px grid, --space-N = N x 4 px ---- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- radius ---- */
  --radius-xs: 6px;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --radius-tile: var(--radius-m);
  --radius-card: var(--radius-l);
  --radius-input: var(--radius-s);
  --radius-button: var(--radius-pill);

  /* ---- border widths ---- */
  --border-1: 1px;
  --border-2: 2px;
  --border-3: 3px;

  /* ---- shadow: hard offsets, blur is always 0 ---- */
  --shadow-seat: 0 8px 0 rgba(0, 0, 0, 0.28);
  --shadow-tile: 0 5px 0 rgba(0, 0, 0, 0.35);
  --shadow-press: 0 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-sheet: 0 12px 0 rgba(0, 0, 0, 0.30);
  --shadow-none: 0 0 0 0 transparent;

  /* ---- type families ---- */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-text: 'Readex Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ar-display: 'El Messiri', 'Readex Pro', 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
  --font-ar-text: 'Readex Pro', 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;

  /* ---- type scale (modular 1.25 on 1rem; the TV tier scales the root, see --tier-scale) ---- */
  --text-xs: 0.875rem;
  --text-s: 1rem;
  --text-m: 1.25rem;
  --text-l: 1.5625rem;
  --text-xl: 1.953rem;
  --text-2xl: 2.441rem;
  --text-3xl: 3.052rem;
  --text-4xl: 3.815rem;
  --text-5xl: 4.768rem;

  /* ---- semantic sizes (rem + vw, never vh) ---- */
  --text-label: 1rem;
  --text-body: 1rem;
  --text-lead: 1.25rem;
  --text-heading: 1.5625rem;
  --text-title: clamp(1.953rem, 1.2rem + 1.6vw, 2.441rem);
  --text-display: clamp(2.441rem, 1rem + 5vw, 5.96rem);
  --text-category: clamp(1rem, 0.5rem + 1.2vw, 1.6rem);
  --text-team: clamp(1.125rem, 0.6rem + 1.3vw, 1.8rem);
  --text-score: clamp(1.5rem, 0.6rem + 2.7vw, 3.2rem);
  --text-tile: clamp(1.5rem, 0.5rem + 2.4vw, 2.8rem);
  --text-question: clamp(1.375rem, 0.9rem + 1.6vw, 2.4rem);
  --text-timer: clamp(3.5rem, 1rem + 7.3vw, 8rem);

  --leading-display: 1.05;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-body: 1.5;
  --leading-numeral: 1;
  --leading-ar-body: 1.7;
  --leading-ar-heading: 1.45;
  --tracking-display: -0.015em;
  --tracking-label: 0.06em;
  --weight-regular: 400;
  --weight-strong: 600;
  --weight-display: 800;

  /* ---- motion ---- */
  --motion-scale: 1;  /* 1 = full, 0 = instant (set to 0 under prefers-reduced-motion) */
  --dur-1: calc(120ms * var(--motion-scale, 1));
  --dur-2: calc(200ms * var(--motion-scale, 1));
  --dur-3: calc(320ms * var(--motion-scale, 1));
  --dur-4: calc(400ms * var(--motion-scale, 1));
  --dur-beat: 700ms;          /* the silent hold before a reveal: stillness, not a transition */
  --dur-flourish: 900ms;   /* the one hero moment per screen */
  --dur-hold-static: 1500ms;  /* reduced motion: how long a static end state is held */
  --ease-set: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-lean: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-clink: cubic-bezier(0.3, 1.4, 0.4, 1);
  --ease-draw: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-linear: linear;

  /* ---- layers, icons, layout ---- */
  --z-base: 0;
  --z-sticky: 100;
  --z-overlay: 900;
  --z-dialog: 1000;
  --z-toast: 1100;
  --icon-s: 1rem;
  --icon-m: 1.25rem;
  --icon-l: 1.5rem;
  --icon-xl: 2rem;
  --icon-stroke: 2;  /* stroke width in a 24-unit viewBox, round caps and joins */
  --tap-min: 44px;
  --tap-floor: 24px;
  --gutter: var(--space-4);
  --gutter-wide: var(--space-8);
  --board-gap: var(--space-2);
  --tv-safe: clamp(16px, 3vw, 64px);
  --content-max: 72rem;
  --focus-width: 3px;
  --focus-offset: 3px;
  --arabic-scale: 1.08;

  /* ---- tier: 1 on phones and laptops, 1.25 on a TV (see below) ---- */
  --tier-scale: 1;
}

html { font-size: calc(100% * var(--tier-scale)); }

/* TV tier: automatic from 1600 css px wide, or forced with data-tier="tv" (the host's TV-mode switch),
   or switched off with data-tier="desk". At 1920 px wide the root is 20 px, so 1rem = 20 px. */
@media (min-width: 1600px) { :root:not([data-tier="desk"]) { --tier-scale: 1.25; } }
:root[data-tier="tv"] { --tier-scale: 1.25; }

/* ---- Daylight (light) ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #FBF3E4;  /* Paper */
  --color-surface: #FFFAF0;  /* Cloth */
  --color-raised: #F0E3CC;  /* Sand */
  --color-border: #86705E;  /* Rule */
  --color-border-subtle: #DCCBB0;  /* Hairline */
  --color-text: #2A1F1A;  /* Ink */
  --color-text-2: #5C4A3E;  /* Ink 2 */
  --color-text-3: #6E5B4D;  /* Ink 3 */
  --color-brand: #F4AE3D;  /* Tea */
  --color-brand-press: #D98F1E;  /* Strong tea */
  --color-brand-text: #8A4F00;  /* Tea ink */
  --color-on-brand: #2A1F1A;  /* Ink */
  --color-focus: #2A1F1A;  /* Ink */
  --color-disabled: #8C7B69;  /* Dim */
  --color-team1: #A81F40;  /* Hibiscus ink */
  --color-on-team1: #FFFAF0;  /* Cloth */
  --color-team2: #0B6F78;  /* Lagoon ink */
  --color-on-team2: #FFFAF0;  /* Cloth */
  --color-success: #2E6B47;  /* Mint ink */
  --color-warning: #7A5200;  /* Butter ink */
  --color-danger: #A8401D;  /* Paprika ink */
  --color-tile-200: #FFFAF0;  /* Cream card */
  --color-tile-400: #F0CF8C;  /* Straw card */
  --color-tile-600: #F4AE3D;  /* Tea card */
  --color-on-tile: #2A1F1A;  /* Ink */
  --color-tile-edge: #2A1F1A;  /* Ink */
  --color-crow-body: #F4AE3D;  /* Tea */
  --color-crow-wing: #D98F1E;  /* Strong tea */
  --color-crow-bill: #94551E;  /* Ember */
  --color-crow-eye: #1C1512;  /* Espresso */
  --color-crow-glint: #F7EDDC;  /* Linen */
  --color-scrim: rgba(42, 31, 26, 0.62);
  --shadow-seat: 0 8px 0 rgba(42, 31, 26, 0.16);
  --shadow-tile: 0 5px 0 rgba(42, 31, 26, 0.20);
  --shadow-press: 0 2px 0 rgba(42, 31, 26, 0.20);
  --shadow-sheet: 0 12px 0 rgba(42, 31, 26, 0.18);
  --shadow-none: 0 0 0 0 transparent;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --color-bg: #FBF3E4;  /* Paper */
    --color-surface: #FFFAF0;  /* Cloth */
    --color-raised: #F0E3CC;  /* Sand */
    --color-border: #86705E;  /* Rule */
    --color-border-subtle: #DCCBB0;  /* Hairline */
    --color-text: #2A1F1A;  /* Ink */
    --color-text-2: #5C4A3E;  /* Ink 2 */
    --color-text-3: #6E5B4D;  /* Ink 3 */
    --color-brand: #F4AE3D;  /* Tea */
    --color-brand-press: #D98F1E;  /* Strong tea */
    --color-brand-text: #8A4F00;  /* Tea ink */
    --color-on-brand: #2A1F1A;  /* Ink */
    --color-focus: #2A1F1A;  /* Ink */
    --color-disabled: #8C7B69;  /* Dim */
    --color-team1: #A81F40;  /* Hibiscus ink */
    --color-on-team1: #FFFAF0;  /* Cloth */
    --color-team2: #0B6F78;  /* Lagoon ink */
    --color-on-team2: #FFFAF0;  /* Cloth */
    --color-success: #2E6B47;  /* Mint ink */
    --color-warning: #7A5200;  /* Butter ink */
    --color-danger: #A8401D;  /* Paprika ink */
    --color-tile-200: #FFFAF0;  /* Cream card */
    --color-tile-400: #F0CF8C;  /* Straw card */
    --color-tile-600: #F4AE3D;  /* Tea card */
    --color-on-tile: #2A1F1A;  /* Ink */
    --color-tile-edge: #2A1F1A;  /* Ink */
    --color-crow-body: #F4AE3D;  /* Tea */
    --color-crow-wing: #D98F1E;  /* Strong tea */
    --color-crow-bill: #94551E;  /* Ember */
    --color-crow-eye: #1C1512;  /* Espresso */
    --color-crow-glint: #F7EDDC;  /* Linen */
    --color-scrim: rgba(42, 31, 26, 0.62);
    --shadow-seat: 0 8px 0 rgba(42, 31, 26, 0.16);
    --shadow-tile: 0 5px 0 rgba(42, 31, 26, 0.20);
    --shadow-press: 0 2px 0 rgba(42, 31, 26, 0.20);
    --shadow-sheet: 0 12px 0 rgba(42, 31, 26, 0.18);
    --shadow-none: 0 0 0 0 transparent;
  }
}

/* ---- expression dial: starting values for the three directions; each direction may refine ---- */
:root[data-expression="showtime"] { --motion-scale: 1; --radius-tile: 10px; --shadow-tile: 0 5px 0 rgba(0, 0, 0, 0.35); }
:root[data-expression="table"] { --motion-scale: 0.85; --radius-tile: 14px; --shadow-tile: 0 5px 0 rgba(0, 0, 0, 0.35); }
:root[data-expression="broadsheet"] { --motion-scale: 0.6; --radius-tile: 4px; --shadow-tile: none; }

/* ---- reduced motion: every transition becomes instant; information still changes state. After the dial on purpose: the dial's
   :root[data-expression] rules are more specific than a bare :root, so they would otherwise keep the motion on. ---- */
@media (prefers-reduced-motion: reduce) { :root, :root[data-expression] { --motion-scale: 0; } }

/* ---- Arabic runs: size and line height (starting values, validate by rendering) ---- */
:lang(ar) { line-height: var(--leading-ar-body); letter-spacing: 0; }

/* ---- focus: one rule for the whole product ---- */
:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }



/* ==========================================================================
   I Dont Crow · Direction B "The Table" · direction.css
   --------------------------------------------------------------------------
   Concept: crowing needs company. A hospitable table of printed cards, place cards
   and a tray. The two seats flank the board; a tile is a printed card that is set
   down centre-table; reveal turns the card over; awards go to the seats.

   Rules this file keeps (brand-identity.md sections 6, 10, 11, 13, 14):
   - tokens only; logical properties (RTL by `dir="rtl"`); flat fills, hard shadows
   - only transform and opacity animate (plus stroke-dash on the drawn marks, and
     box-shadow on lifts: hard 0-blur shadows are the cheapest shadow there is)
   - every state has a shape and words, never hue alone
   - every duration is multiplied by --motion-scale (0.85 here, 0 when reduced)
   - the crow is only ever an <img> of 02-brand/logo/poses/*.svg, never inline art

   Contents
    1 direction tokens        2 reset, base, type         3 layout helpers
    4 icons, glyphs, tally    5 buttons                   6 forms
    7 chips, badges, pills    8 nav, header              9 footer
   10 hero, steps, stats     11 category card, meter     12 THE SEAT (scoreboard)
   13 board and tiles        14 question card and timer  15 reveal, awards, dock
   16 media frame, lightbox  17 alerts, toasts, dialogs  18 empty, skeleton, loader
   19 plans, QR, results     20 local theme scopes       21 RTL, TV, landscape, motion
   ========================================================================== */


/* ==========================================================================
   1. Direction tokens
   ========================================================================== */
:root {
  --dir-id: "b";
  --dir-name: "The Table";

  /* paper: the printed-card surface. The same cream in both themes; ink on it is
     the brand Daylight ink, so every colour pair inside a card is the computed one */
  --paper: var(--color-tile-200);
  --paper-edge: var(--color-tile-edge);
  --paper-rule: rgba(42, 31, 26, 0.18);
  --paper-sunk: #F0E3CC;
  --ink: #2A1F1A;
  --ink-2: #5C4A3E;
  --ink-3: #6E5B4D;
  --ink-rule: #86705E;
  --ink-hair: #DCCBB0;
  --ink-brand: #8A4F00;
  --ink-team1: #A81F40;
  --ink-team2: #0B6F78;
  --ink-success: #2E6B47;
  --ink-warning: #7A5200;
  --ink-danger: #A8401D;
  --ink-focus: #2A1F1A;

  /* night: the fixed dark roundel (timer disc, toasts, crow tab). Brand Evening values */
  --night-bg: #1C1512;
  --night-raised: #35281F;
  --night-text: #F7EDDC;
  --night-text-2: #D8C8B2;
  --night-brand: #F4AE3D;
  --night-danger: #FF8F6B;
  --night-success: #8ED6A8;
  --night-warning: #FFE08A;
  --night-team1: #F65F82;
  --night-team2: #4CCDD3;
  --night-track: rgba(247, 237, 220, 0.24);

  /* team fills: the bright rose and teal, used as flat fills in both themes */
  --team1-fill: #F65F82;
  --team2-fill: #4CCDD3;

  /* page-level focus colour, kept so a focus ring drawn OUTSIDE a paper card
     still contrasts with the page and not with the card */
  --focus-page: var(--color-focus);

  /* layout and sizing */
  --seat-w: clamp(10rem, 17vw, 15rem);
  --crow-h: 4.5rem;
  --crow-foot: calc(var(--crow-h) * 0.125);   /* empty space under the feet inside the pose SVG */
  --perch-h: calc(var(--crow-h) + var(--space-2));
  --header-h: 4rem;
  --board-cols: 3;
  --tile-h: clamp(2.75rem, 1.4rem + 2.4vw, 4.25rem);
  --tile-keyline: var(--border-3);
  --thumb-w: clamp(2.75rem, 1.4rem + 2vw, 4.5rem);
  --timer-size: clamp(7rem, 3rem + 9vw, 13rem);
  --ring-w: 8;            /* svg user units, viewBox 100 */
  --ring-w-low: 16;       /* doubled at 10 s */
  --qcard-max: 54rem;
  --perspective: 90rem;
  --check-size: 1.5rem;
  --toggle-w: 3.25rem;
  --toggle-h: 1.875rem;
  --toggle-travel: calc(var(--toggle-w) - var(--toggle-h));
  --grid-cell: 3rem;
  --lift: var(--space-1);
  --tilt: 0.5deg;
  --dir-sign: 1;
  --flip: 1;

  /* hard shadows (brand tokens give seat, tile, press, sheet; this is the lift) */
  --shadow-lift: 0 8px 0 rgba(0, 0, 0, 0.35);

  /* fonts: swapped to the Arabic pair under dir="rtl" */
  --font-head: var(--font-display);
  --font-body: var(--font-text);
}
:root[data-theme="light"] { --shadow-lift: 0 8px 0 rgba(42, 31, 26, 0.20); --focus-page: var(--color-focus); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --shadow-lift: 0 8px 0 rgba(42, 31, 26, 0.20); } }

[dir="rtl"] { --dir-sign: -1; --flip: -1; --font-head: var(--font-ar-display); --font-body: var(--font-ar-text); }
:lang(ar) { --font-head: var(--font-ar-display); --font-body: var(--font-ar-text); font-family: var(--font-ar-text); text-transform: none; }

/* TV tier: brand-tokens.css scales the root at >= 1600px or data-tier="tv".
   A .tv class on <html> does the same, and also drops the paper grain (none here). */
:root.tv { --tier-scale: 1.25; }

/* paper scope: inside a printed card every token resolves to the brand Daylight ink values */
.paper, .seat, .qcard__face, .award, .pack, .step, .dialog, .cat__head, .cat-card__face, .empty,
.hero__card, .qr-card, .share-card, .scorepad, .balance, .toast, .won-card, .winner-card, .strip, .card-paper {
  --color-text: var(--ink);
  --color-text-2: var(--ink-2);
  --color-text-3: var(--ink-3);
  --color-border: var(--ink-rule);
  --color-border-subtle: var(--ink-hair);
  --color-brand-text: var(--ink-brand);
  --color-focus: var(--ink-focus);
  --color-team1: var(--ink-team1);
  --color-team2: var(--ink-team2);
  --color-on-team1: #FFFAF0;
  --color-on-team2: #FFFAF0;
  --color-success: var(--ink-success);
  --color-warning: var(--ink-warning);
  --color-danger: var(--ink-danger);
  --color-surface: var(--paper-sunk);
  --color-raised: var(--paper-sunk);
  --color-disabled: #8C7B69;
  color: var(--ink);
}
.paper { background: var(--paper); }

/* night scope: a fixed dark surface in either theme */
.night, .timer, .toast--night {
  --color-text: var(--night-text);
  --color-text-2: var(--night-text-2);
  --color-brand: var(--night-brand);
  --color-brand-text: var(--night-brand);
  --color-focus: var(--night-text);
  --color-danger: var(--night-danger);
  --color-success: var(--night-success);
  --color-warning: var(--night-warning);
  --color-team1: var(--night-team1);
  --color-team2: var(--night-team2);
  color: var(--night-text);
}


/* ==========================================================================
   2. Reset, base, type
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[dir="rtl"] body { line-height: var(--leading-ar-body); }
img, video, canvas { display: block; max-inline-size: 100%; block-size: auto; }
svg { max-inline-size: 100%; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
p, h1, h2, h3, h4, h5, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--color-brand-text); text-underline-offset: 0.2em; text-decoration-thickness: var(--border-2); }
a:hover { text-decoration-thickness: var(--border-3); }
hr { border: 0; border-block-start: var(--border-2) dashed var(--color-border-subtle); margin-block: var(--space-6); }
[hidden] { display: none !important; }
:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
::selection { background: var(--color-brand); color: var(--color-on-brand); }

h1, h2, h3 { font-family: var(--font-head); font-weight: var(--weight-display); line-height: var(--leading-display); letter-spacing: var(--tracking-display); text-wrap: balance; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { line-height: var(--leading-ar-heading); letter-spacing: 0; }
h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-title); line-height: var(--leading-tight); }
h3 { font-size: var(--text-heading); line-height: var(--leading-tight); }
h4, h5 { font-family: var(--font-body); font-weight: var(--weight-strong); font-size: var(--text-m); line-height: var(--leading-snug); }

.t-display { font: var(--weight-display) var(--text-display) / var(--leading-display) var(--font-head); letter-spacing: var(--tracking-display); }
.t-title { font: var(--weight-display) var(--text-title) / var(--leading-tight) var(--font-head); letter-spacing: var(--tracking-display); }
.t-heading { font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); }
.t-lead { font-size: var(--text-lead); line-height: var(--leading-snug); color: var(--color-text-2); max-inline-size: 38rem; }
h1 + .t-lead, h2 + .t-lead { margin-block-start: var(--space-4); }
.t-label + h1, .t-label + h2 { margin-block-start: var(--space-2); }
.t-small { font-size: var(--text-s); color: var(--color-text-2); }
.t-fine { font-size: var(--text-xs); color: var(--color-text-3); }   /* 14px floor: legal, timestamps, never on the host screen */
.t-strong { font-weight: var(--weight-strong); }
.t-muted { color: var(--color-text-2); }
.t-label { font-size: var(--text-label); font-weight: var(--weight-strong); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--color-text-2); }
.t-center { text-align: center; }
.num { font-variant-numeric: lining-nums tabular-nums; direction: ltr; unicode-bidi: isolate; }
.brand-name { white-space: nowrap; }
.brand-name--display { font-family: var(--font-head); font-weight: var(--weight-display); }
bdi, [dir="auto"] { unicode-bidi: isolate; }


/* ==========================================================================
   3. Layout helpers
   ========================================================================== */
.container { inline-size: 100%; max-inline-size: var(--content-max); margin-inline: auto; padding-inline: var(--gutter); }
.container--wide { max-inline-size: none; padding-inline: var(--tv-safe); }
.container--narrow { max-inline-size: 40rem; }
.section { padding-block: var(--space-12); }
.section--tight { padding-block: var(--space-8); }
.stack > * + * { margin-block-start: var(--stack, var(--space-4)); }
.stack--s { --stack: var(--space-2); }
.stack--l { --stack: var(--space-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-3)); }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
.cluster--center { justify-content: center; }
.grid { display: grid; gap: var(--gap, var(--space-4)); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 16rem)), 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.fill { flex: 1 1 0; min-inline-size: 0; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: var(--space-4); inset-block-start: calc(var(--space-12) * -2); z-index: var(--z-toast); padding: var(--space-3) var(--space-5); background: var(--color-brand); color: var(--color-on-brand); border-radius: var(--radius-button); font-weight: var(--weight-strong); }
.skip-link:focus { inset-block-start: var(--space-3); }
.rule-dashed { border: 0; border-block-start: var(--border-2) dashed var(--color-border-subtle); }
.paper-grid {   /* the one pattern: the ruled 6x6 board, faint, static; never behind question text or media */
  background-image:
    linear-gradient(var(--color-border-subtle) var(--border-1), transparent var(--border-1)),
    linear-gradient(90deg, var(--color-border-subtle) var(--border-1), transparent var(--border-1));
  background-size: var(--grid-cell) var(--grid-cell);
}
.hide-sm { display: none; }
@media (max-width: 519px) { .hide-xs { display: none !important; } }
@media (min-width: 720px) { .hide-sm { display: revert; } .hide-lg { display: none !important; } }


/* ==========================================================================
   4. Icons, glyphs, tally
   ========================================================================== */
.icon {
  inline-size: var(--icon-m); block-size: var(--icon-m); flex: none;
  display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round;
}
.icon--s { inline-size: var(--icon-s); block-size: var(--icon-s); }
.icon--l { inline-size: var(--icon-l); block-size: var(--icon-l); }
.icon--xl { inline-size: var(--icon-xl); block-size: var(--icon-xl); }
.icon--fill { fill: currentColor; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* team glyph: Team 1 is a circle, Team 2 is a rounded square. They travel with the name, always */
.glyph { display: inline-block; flex: none; inline-size: 1em; block-size: 1em; background: var(--glyph-color, currentColor); vertical-align: -0.12em; }
.glyph--circle { border-radius: 50%; }
.glyph--square { border-radius: var(--radius-xs); }
.glyph--ring { background: transparent; box-shadow: inset 0 0 0 0.14em var(--glyph-color, currentColor); }
.glyph--1 { --glyph-color: var(--color-team1); }
.glyph--2 { --glyph-color: var(--color-team2); }

/* tally: one stroke for 200, two for 400, three for 600. Never more than three */
.tally { display: inline-flex; align-items: center; gap: 0.1em; font-size: var(--tally-size, 1em); block-size: 0.3em; }
.tally > i { display: block; inline-size: max(0.06em, 3px); block-size: 0.28em; border-radius: var(--radius-pill); background: currentColor; }
.tally > i:nth-child(1) { rotate: -2deg; }
.tally > i:nth-child(2) { rotate: 1.5deg; }
.tally > i:nth-child(3) { rotate: -1deg; }


/* ==========================================================================
   5. Buttons
   ========================================================================== */
.btn {
  --btn-bg: var(--color-raised);
  --btn-fg: var(--color-text);
  --btn-edge: var(--color-border);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-block-size: var(--tap-min); min-inline-size: var(--tap-min);
  padding: var(--space-2) var(--space-5);
  background: var(--btn-bg); color: var(--btn-fg);
  border: var(--border-2) solid var(--btn-edge); border-radius: var(--radius-button);
  font-family: var(--font-body); font-size: var(--text-body); font-weight: var(--weight-strong); line-height: var(--leading-tight);
  text-decoration: none; text-align: center; text-wrap: balance;
  box-shadow: var(--shadow-press);
  transition: transform var(--dur-1) var(--ease-set), box-shadow var(--dur-1) var(--ease-set);
}
.btn:hover, .btn.is-hover { transform: translateY(calc(var(--lift) * -0.5)); box-shadow: var(--shadow-tile); }
.btn:active, .btn.is-active { transform: translateY(2px); box-shadow: var(--shadow-none); }
.btn.is-focus { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.btn--primary { --btn-bg: var(--color-brand); --btn-fg: var(--color-on-brand); --btn-edge: var(--color-on-brand); }
.btn--primary:active, .btn--primary.is-active { --btn-bg: var(--color-brand-press); }
.btn--secondary { --btn-bg: var(--color-surface); --btn-fg: var(--color-text); --btn-edge: var(--color-border); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--color-text); --btn-edge: transparent; box-shadow: none; }
.btn--ghost:hover, .btn--ghost.is-hover { --btn-bg: var(--color-raised); box-shadow: none; transform: none; }
.btn--calm { --btn-bg: transparent; --btn-fg: var(--color-danger); --btn-edge: var(--color-danger); box-shadow: none; }   /* calm-danger: outline, icon and words, never a red flood */
.btn--calm:hover, .btn--calm.is-hover { --btn-bg: var(--color-raised); box-shadow: none; transform: none; }
.btn--lg { min-block-size: calc(var(--tap-min) + var(--space-3)); padding-inline: var(--space-8); font-size: var(--text-lead); }
.btn--sm { padding-inline: var(--space-4); font-size: var(--text-s); }
.btn--block { display: flex; inline-size: 100%; }
.btn[disabled], .btn[aria-disabled="true"], .btn.is-disabled {
  --btn-bg: var(--color-raised); --btn-fg: var(--color-disabled); --btn-edge: var(--color-border-subtle);
  box-shadow: var(--shadow-none); transform: none; cursor: not-allowed;
}
.btn__why { display: block; margin-block-start: var(--space-2); font-size: var(--text-s); color: var(--color-text-2); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label::after { content: "..."; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  inline-size: var(--tap-min); block-size: var(--tap-min);
  background: transparent; color: inherit; border: var(--border-2) solid transparent; border-radius: 50%;
  transition: transform var(--dur-1) var(--ease-set);
}
.icon-btn:hover, .icon-btn.is-hover { background: var(--color-raised); border-color: var(--color-border-subtle); }
.icon-btn:active { transform: translateY(2px); }
.icon-btn--solid { background: var(--color-raised); border-color: var(--color-border); box-shadow: var(--shadow-press); }
.icon-btn[aria-pressed="true"] { background: var(--color-brand); color: var(--color-on-brand); border-color: var(--color-on-brand); }
.icon-btn[disabled] { color: var(--color-disabled); cursor: not-allowed; }
.theme-toggle .i-moon { display: none; }
[data-theme="light"] .theme-toggle .i-sun { display: none; }
[data-theme="light"] .theme-toggle .i-moon { display: inline-block; }
.link-btn { background: none; border: 0; padding: var(--space-2) 0; color: var(--color-brand-text); font-weight: var(--weight-strong); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: var(--border-2); min-block-size: var(--tap-min); }

/* loader ring (the ring is the loading state; it is not a brand device) */
.spinner {
  display: inline-block; flex: none; inline-size: var(--icon-m); block-size: var(--icon-m);
  border: var(--border-3) solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  animation: ring-turn 900ms linear infinite;
}
@keyframes ring-turn { to { transform: rotate(360deg); } }


/* ==========================================================================
   6. Forms
   ========================================================================== */
.field { display: grid; gap: var(--space-2); align-content: start; }
.field__label { font-weight: var(--weight-strong); }
.field__hint { font-size: var(--text-s); color: var(--color-text-2); }
.field__error { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--color-danger); }
.field__error .icon { margin-block-start: 0.15em; }
.input, .textarea, .select select {
  inline-size: 100%; min-block-size: var(--tap-min);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface); color: var(--color-text);
  border: var(--border-2) solid var(--color-border); border-radius: var(--radius-input);
  font-size: var(--text-body); line-height: var(--leading-snug);
}
.textarea { min-block-size: 7rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--color-text-3); }
.input:hover, .textarea:hover, .select select:hover, .input.is-hover { border-color: var(--color-text-2); }
.input.is-focus { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.input[aria-invalid="true"], .select select[aria-invalid="true"] { border-color: var(--color-danger); border-inline-start-width: var(--space-2); }   /* wider start edge: a shape cue as well as a hue */
.input[disabled], .select select[disabled], .textarea[disabled] { background: var(--color-raised); color: var(--color-disabled); border-style: dashed; border-color: var(--color-border-subtle); cursor: not-allowed; }
.search { position: relative; display: block; }
.search .icon { position: absolute; inset-inline-start: var(--space-4); inset-block-start: 50%; translate: 0 -50%; color: var(--color-text-2); pointer-events: none; }
.search .input { padding-inline-start: calc(var(--space-4) + var(--icon-m) + var(--space-3)); border-radius: var(--radius-pill); }
.select { position: relative; display: block; }
.select select { appearance: none; -webkit-appearance: none; padding-inline-end: var(--space-10); }
.select .icon { position: absolute; inset-inline-end: var(--space-3); inset-block-start: 50%; translate: 0 -50%; pointer-events: none; color: var(--color-text-2); }

/* segmented control: radio group. Checked = filled + a check icon + the word */
.segmented { display: inline-flex; padding: var(--space-1); gap: var(--space-1); background: var(--color-surface); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-pill); }
.segmented__opt { position: relative; display: block; }
.segmented__opt input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented__opt > span { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: calc(var(--tap-min) - var(--space-2) - var(--border-2) * 2 + var(--space-2)); padding-inline: var(--space-4); border-radius: var(--radius-pill); font-weight: var(--weight-strong); color: var(--color-text-2); white-space: nowrap; }
.segmented__opt .icon--on { display: none; }
.segmented__opt input:checked + span { background: var(--color-brand); color: var(--color-on-brand); box-shadow: var(--shadow-press); }
.segmented__opt input:checked + span .icon--on { display: inline-block; }
.segmented__opt input:focus-visible + span { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.segmented__opt input:disabled + span { color: var(--color-disabled); cursor: not-allowed; }
.segmented__opt:hover input:not(:checked):not(:disabled) + span { background: var(--color-raised); }

/* checkbox and radio */
.check { display: flex; align-items: flex-start; gap: var(--space-3); min-block-size: var(--tap-min); padding-block: var(--space-2); cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; flex: none; inline-size: var(--check-size); block-size: var(--check-size); margin: 0; margin-block-start: 0.1em; background: var(--color-surface); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-xs); display: grid; place-items: center; cursor: pointer; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--color-brand); border-color: var(--color-on-brand); }
.check input:checked::after { content: ""; inline-size: 0.35em; block-size: 0.7em; margin-block-end: 0.12em; border: solid var(--color-on-brand); border-width: 0 var(--border-3) var(--border-3) 0; transform: rotate(45deg); }
.check input[type="radio"]:checked::after { inline-size: 0.5em; block-size: 0.5em; margin: 0; border: 0; border-radius: 50%; background: var(--color-on-brand); transform: none; }
.check input:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.check input[disabled] { border-style: dashed; border-color: var(--color-border-subtle); cursor: not-allowed; }
.check input[disabled] ~ .check__text { color: var(--color-disabled); }
.check__text { line-height: var(--leading-snug); }
.check__text small { display: block; color: var(--color-text-2); font-size: var(--text-s); margin-block-start: var(--space-1); }
.check input[aria-invalid="true"] { border-color: var(--color-danger); border-width: var(--border-3); }

/* toggle (switch): thumb position + the words On / Off, not just a colour */
.toggle { display: inline-flex; align-items: center; gap: var(--space-3); min-block-size: var(--tap-min); cursor: pointer; }
.toggle input { appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 0; inline-size: var(--toggle-w); block-size: var(--toggle-h); background: var(--color-surface); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-pill); cursor: pointer; }
.toggle input::before { content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: var(--space-1); inline-size: calc(var(--toggle-h) - var(--space-2) - var(--border-2) * 2 + var(--border-2)); aspect-ratio: 1; margin-block-start: calc(var(--toggle-h) * -0.5 + var(--border-2) + var(--border-1)); background: var(--color-text-2); border-radius: 50%; transition: transform var(--dur-2) var(--ease-set); }
.toggle input:checked { background: var(--color-brand); border-color: var(--color-on-brand); }
.toggle input:checked::before { background: var(--color-on-brand); transform: translateX(calc(var(--dir-sign) * (var(--toggle-travel) - var(--border-2) * 2 - var(--space-1) + var(--border-1)))); }
.toggle input:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.toggle input[disabled] { border-style: dashed; cursor: not-allowed; }
.toggle__text { font-weight: var(--weight-strong); }
.toggle__on { display: none; }
.toggle input:checked ~ .toggle__text .toggle__on { display: inline; }
.toggle input:checked ~ .toggle__text .toggle__off { display: none; }
.toggle small { display: block; font-weight: var(--weight-regular); color: var(--color-text-2); font-size: var(--text-s); }
.fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.fieldset legend { padding: 0; margin-block-end: var(--space-2); font-weight: var(--weight-strong); }


/* ==========================================================================
   7. Chips, badges, pills, team badges
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-block-size: var(--space-8); padding: var(--space-1) var(--space-3);
  background: var(--color-raised); color: var(--color-text);
  border: var(--border-1) solid var(--color-border-subtle); border-radius: var(--radius-pill);
  font-size: var(--text-s); font-weight: var(--weight-strong); line-height: var(--leading-tight); white-space: nowrap;
}
button.chip, a.chip, label.chip { min-block-size: var(--tap-min); padding-inline: var(--space-4); cursor: pointer; text-decoration: none; }
.chip[aria-pressed="true"], .chip.is-on { background: var(--color-brand); color: var(--color-on-brand); border-color: var(--color-on-brand); }
.chip--tier { background: var(--tile-bg, var(--color-tile-200)); color: var(--color-on-tile); border: var(--border-2) solid var(--color-tile-edge); }
.chip--200 { --tile-bg: var(--color-tile-200); }
.chip--400 { --tile-bg: var(--color-tile-400); }
.chip--600 { --tile-bg: var(--color-tile-600); }
.chip--tier .tally { font-size: var(--text-s); }

.badge { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); border: var(--border-2) solid var(--badge-c, var(--color-border)); border-radius: var(--radius-xs); color: var(--badge-c, var(--color-text)); font-size: var(--text-s); font-weight: var(--weight-strong); line-height: var(--leading-tight); }
.badge--success { --badge-c: var(--color-success); }
.badge--warn { --badge-c: var(--color-warning); }
.badge--danger { --badge-c: var(--color-danger); }
.badge--info { --badge-c: var(--color-brand-text); }
.badge--free { background: var(--color-brand); color: var(--color-on-brand); border-color: var(--color-on-brand); }

.team-badge { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-strong); }
.team-badge .glyph { font-size: 1.15em; }
.team-badge--1 { --glyph-color: var(--color-team1); }
.team-badge--2 { --glyph-color: var(--color-team2); }

.pill { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: var(--space-8); padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill); background: var(--color-text); color: var(--color-bg); font-size: var(--text-s); font-weight: var(--weight-strong); }
.pill--tea { background: var(--color-brand); color: var(--color-on-brand); }
.turn-pill { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: var(--space-8); padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill); background: var(--team, var(--color-brand)); color: var(--night-bg); font-size: var(--text-s); font-weight: var(--weight-strong); white-space: nowrap; }
.turn-pill--steal { background: transparent; color: var(--color-text); border: var(--border-2) dashed var(--team-ink, var(--color-text)); }


/* ==========================================================================
   8. Nav, header
   ========================================================================== */

.site-header { position: sticky; inset-block-start: 0; z-index: var(--z-sticky); background: var(--color-bg); border-block-end: var(--border-2) dashed var(--color-border-subtle); }
.site-header__inner { display: flex; align-items: center; gap: var(--space-3); min-block-size: var(--header-h); padding-inline: var(--tv-safe); }
.logo { display: inline-flex; align-items: center; flex: none; border-radius: var(--radius-s); }
.logo img { block-size: 2.25rem; inline-size: auto; }
.logo--stacked img { block-size: 4.5rem; }
.logo--daylight { display: none; }
[data-theme="light"] .logo--evening { display: none; }
[data-theme="light"] .logo--daylight { display: inline-flex; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .logo--evening { display: none; }
  :root:not([data-theme]) .logo--daylight { display: inline-flex; }
}
.nav { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: var(--space-4); }
.nav__link {
  display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-min); padding-inline: var(--space-3);
  border-radius: var(--radius-pill); color: var(--color-text-2); font-weight: var(--weight-strong); text-decoration: none; position: relative;
}
.nav__link:hover, .nav__link.is-hover { background: var(--color-raised); color: var(--color-text); }
.nav__link[aria-current="page"] { color: var(--color-text); background: var(--color-raised); }
.nav__link[aria-current="page"]::after { content: ""; position: absolute; inset-inline: var(--space-3); inset-block-end: var(--space-1); block-size: var(--border-3); border-radius: var(--radius-pill); background: var(--color-brand); }
.nav-tools { display: flex; align-items: center; gap: var(--space-2); margin-inline-start: auto; }
.nav-toggle { display: none; }
.nav .nav-cta, .nav [data-hide-wide] { display: none; }
button.nav__link { background: none; border: 0; cursor: pointer; font-family: inherit; font-size: inherit; text-align: start; }
.credit { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-min); padding-inline: var(--space-3); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-pill); font-weight: var(--weight-strong); background: var(--color-surface); white-space: nowrap; }
.credit .icon { color: var(--color-brand-text); }
.mode-switch .segmented__opt > span { padding-inline: var(--space-3); }
/* header fit (fixes-2): labels never wrap; the row compresses in steps so it stays one line from 960 up */
.nav__link, .nav-tools > *, .logo { white-space: nowrap; flex-shrink: 0; }
.nav { min-inline-size: 0; }
@media (min-width: 960px) and (max-width: 1799px) {
  .site-header__inner { gap: var(--space-2); }
  .nav { margin-inline-start: var(--space-2); }
  .nav__link { padding-inline: var(--space-2); }
  .nav__link > .icon { display: none; }
  .nav-tools .mode-switch .segmented__opt > span { padding-inline: var(--space-2); }
}
/* the Party/University switch and the University nav link do the same job: show one at a time so the row never wraps */
@media (min-width: 960px) and (max-width: 1439px) {
  .nav-tools .mode-switch { display: none; }
}
@media (min-width: 1440px) { .nav .nav__link--uni { display: none; } }
@media (min-width: 960px) and (max-width: 1099px) { .credit .credit__label, .credit > span:not(.num) { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu:not([open]) .menu__panel { display: none; }
/* RTL phones: nothing that is positioned off the end edge may widen the layout viewport (ripple, closed panels, skip link, toasts) */
html, body { overflow-x: clip; }
.menu__panel { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + var(--space-2)); z-index: var(--z-overlay); min-inline-size: 14rem; padding: var(--space-2); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-l); box-shadow: var(--shadow-sheet); }
.menu__panel a, .menu__panel button { display: flex; align-items: center; gap: var(--space-3); inline-size: 100%; min-block-size: var(--tap-min); padding-inline: var(--space-3); border: 0; background: none; border-radius: var(--radius-s); color: var(--ink); font-weight: var(--weight-strong); text-decoration: none; text-align: start; }
.menu__panel a:hover, .menu__panel button:hover { background: var(--paper-sunk); }

@media (max-width: 599px) { .logo img { block-size: 1.625rem; } .site-header__inner { gap: var(--space-2); } .nav-tools { gap: var(--space-1); } }
@media (max-width: 599px) {
  /* logged-in header: the credit pill, theme, menu and nav toggles cannot share a row with the lockup, so they drop to a second row */
  .site-header__inner:has(.credit) { flex-wrap: wrap; padding-block: var(--space-2); }
  .site-header__inner:has(.credit) .nav-tools { flex: 1 1 100%; justify-content: flex-end; margin-inline-start: 0; }
  .site-header__inner:has(.credit) .nav-tools .credit { margin-inline-end: auto; }
}
@media (max-width: 959px) {
  .nav-toggle { display: inline-grid; }
  .nav { position: absolute; inset-inline: 0; inset-block-start: 100%; display: none; flex-direction: column; align-items: stretch; margin: 0; padding: var(--space-3) var(--tv-safe) var(--space-5); background: var(--color-bg); border-block-end: var(--border-2) dashed var(--color-border-subtle); }
  .nav[data-open="true"] { display: flex; }
  .nav__link { border-radius: var(--radius-m); }
  .nav .nav-cta { display: inline-flex; align-self: flex-start; margin-block-start: var(--space-2); }
  .nav [data-hide-wide] { display: inline-flex; }
  .site-header__inner { position: relative; }
  .nav-tools .hide-md { display: none; }
}


/* ==========================================================================
   9. Footer
   ========================================================================== */
.site-footer { margin-block-start: var(--space-16); padding: var(--space-8) var(--tv-safe) var(--space-10); border-block-start: var(--border-2) dashed var(--color-border-subtle); color: var(--color-text-2); }
.site-footer__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--space-8); align-items: start; }
.site-footer h2 { font: var(--weight-strong) var(--text-s) / var(--leading-snug) var(--font-body); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--color-text); margin-block-end: var(--space-3); }
.site-footer li a { display: inline-flex; align-items: center; min-block-size: var(--tap-min); color: var(--color-text-2); }
.site-footer__note { margin-block-start: var(--space-6); padding-block-start: var(--space-4); border-block-start: var(--border-1) solid var(--color-border-subtle); font-size: var(--text-xs); color: var(--color-text-3); }
@media (max-width: 719px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__grid > :first-child { grid-column: 1 / -1; } }


/* ==========================================================================
   10. Hero, steps, stats
   ========================================================================== */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); padding-block: var(--space-6) var(--space-12); }
.hero__art { position: relative; border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sheet); background: var(--paper-sunk); }
.hero__art img { inline-size: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 40% 50%; }
.hero__card { position: relative; background: var(--paper); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-seat); padding: var(--space-8) var(--space-6); display: grid; gap: var(--space-4); align-content: start; }
.hero__card h1 { font-size: var(--text-display); color: var(--ink); }
.hero__card .t-lead { color: var(--ink-2); }
.hero__eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-strong); letter-spacing: var(--tracking-label); text-transform: uppercase; font-size: var(--text-s); color: var(--ink-brand); }
:lang(ar) .hero__eyebrow { letter-spacing: 0; text-transform: none; }
@media (min-width: 900px) {
  .hero { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0; align-items: center; padding-block-end: var(--space-16); }
  .hero__art { grid-column: 4 / -1; grid-row: 1; }
  .hero__art img { aspect-ratio: 4 / 3; }
  .hero__card { grid-column: 1 / 7; grid-row: 1; z-index: 1; margin-inline-end: calc(var(--space-12) * -1); padding: var(--space-10) var(--space-10) var(--space-8); }
}
@media (min-width: 900px) and (max-width: 1199px) { .hero__card { grid-column: 1 / 8; } .hero__art { grid-column: 5 / -1; } }

/* stats: facts only (verified from the repo): 2 teams, 6 categories, 36 tiles, 60 s + 30 s steal */
.stats { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.stat { display: inline-flex; align-items: baseline; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--paper-sunk); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-m); color: var(--ink); }
.stat b { font: var(--weight-display) var(--text-heading) / 1 var(--font-head); }
.stat span { font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--space-5); counter-reset: step; }
.step { position: relative; display: grid; gap: var(--space-3); align-content: start; padding: var(--space-6) var(--space-5) var(--space-5); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); }
@media (min-width: 720px) { .step:nth-child(odd) { rotate: calc(var(--tilt) * -1); } .step:nth-child(even) { rotate: var(--tilt); } }
.step__num { display: grid; place-items: center; inline-size: var(--space-12); block-size: var(--space-12); border-radius: 50%; background: var(--color-tile-600); color: var(--color-on-tile); border: var(--border-2) solid var(--paper-edge); font: var(--weight-display) var(--text-heading) / 1 var(--font-head); }
.step h3 { font-size: var(--text-heading); color: var(--ink); }
.step p { color: var(--ink-2); }
.step .icon { color: var(--ink-brand); }


/* ==========================================================================
   11. Category card (setup) and progress meter
   ========================================================================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: var(--space-4); }

/* Category picker, grouped: a Set heading (Party mode only — University has one set, so there is none),
   each holding its Groups, each holding its own .cat-grid of cards. */
.cat-set-section + .cat-set-section,
.cat-set-section + .cat-group-section { margin-block-start: var(--space-8); padding-block-start: var(--space-6); border-block-start: var(--border-1) dashed var(--color-border-subtle); }   /* --paper-edge is for a divider inside a paper card; this one sits on the page itself, like hr / .site-footer. The + .cat-group-section case: a Group whose own category has no Set sits straight in #category-cards with no wrapper of its own (buildGroupedCards in script.js), so without this it got 0 margin against the Set section before it -- every category has a Set in practice now, but a newly-added one could still land here before it's assigned one. */
.cat-set-heading { font: var(--weight-display) var(--text-l) / var(--leading-tight) var(--font-head); color: var(--color-text); margin-block-end: var(--space-4); }   /* --ink is always dark (for text on the paper cards); --color-text follows the page's own theme, which is what this heading sits on */
.cat-group-section + .cat-group-section { margin-block-start: var(--space-5); }
.cat-set-section .cat-group-section:first-of-type { margin-block-start: var(--space-1); }
.cat-group-heading { margin-block-end: var(--space-2); }
.cat-card { position: relative; display: block; cursor: pointer; }
.cat-card__input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
/* min-inline-size: 0 — .cat-card__face has no grid-template-columns, so it gets one implicit auto column; without this,
   a child wider than the card at its min-content size (the "Needs 1 phone" badge, un-wrapped, on a mini-game category)
   grows that column past the card's own border instead of shrinking to it, dragging the plate image out to match. */
.cat-card__face { position: relative; display: grid; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-3); min-inline-size: 0; background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); transition: transform var(--dur-2) var(--ease-set), box-shadow var(--dur-2) var(--ease-set); }
.cat-card:hover .cat-card__face, .cat-card.is-hover .cat-card__face { transform: translateY(calc(var(--lift) * -1)); box-shadow: var(--shadow-lift); }
.cat-card__input:focus-visible + .cat-card__face, .cat-card.is-focus .cat-card__face { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.cat-card__name { padding-inline: var(--space-2); font-weight: var(--weight-strong); font-size: var(--text-m); line-height: var(--leading-tight); color: var(--ink); overflow-wrap: break-word; hyphens: auto; min-inline-size: 0; }   /* a long single word (Programming) wraps inside the card instead of running over its edge; min-inline-size: 0 is the same grid-blowout fix as .cat-card__face/.cat-card__meta above -- a two-word name (Accounting Fundamentals) was still forcing the card wider by its longest word's min-content */
.cat-card__meta { padding-inline: var(--space-2); font-size: var(--text-s); color: var(--ink-2); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-inline-size: 0; }
.cat-card__check { position: absolute; inset-block-start: var(--space-3); inset-inline-end: var(--space-3); display: none; place-items: center; inline-size: var(--space-8); block-size: var(--space-8); border-radius: 50%; background: var(--color-brand); color: var(--color-on-brand); border: var(--border-2) solid var(--paper-edge); }
.cat-card__state { display: none; padding-inline: var(--space-2); font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-brand); }
.cat-card__why { display: none; padding-inline: var(--space-2); font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }
.cat-card__input:checked + .cat-card__face, .cat-card.is-selected .cat-card__face { border-color: var(--ink-brand); border-width: var(--border-3); background: var(--color-tile-600); transform: translateY(calc(var(--lift) * -1)); box-shadow: var(--shadow-lift); }
.cat-card__input:checked + .cat-card__face .cat-card__check, .cat-card.is-selected .cat-card__check { display: grid; }
.cat-card__input:checked + .cat-card__face .cat-card__state, .cat-card.is-selected .cat-card__state { display: block; color: var(--ink); }
.cat-card__input:checked + .cat-card__face .cat-card__meta, .cat-card.is-selected .cat-card__meta { color: var(--ink); }
.cat-card__input:disabled { cursor: not-allowed; }
.cat-card__input:disabled + .cat-card__face, .cat-card.is-disabled .cat-card__face { background: var(--paper-sunk); border-style: dashed; border-color: var(--ink-rule); box-shadow: var(--shadow-none); transform: none; }
.cat-card__input:disabled + .cat-card__face .cat-card__name, .cat-card.is-disabled .cat-card__name { color: var(--ink-2); }
.cat-card__input:disabled + .cat-card__face .plate, .cat-card.is-disabled .plate { opacity: 0.55; }
.cat-card__input:disabled + .cat-card__face .cat-card__why, .cat-card.is-disabled .cat-card__why { display: block; color: var(--ink-2); }
.cat-card__input:disabled + .cat-card__face .cat-card__meta, .cat-card.is-disabled .cat-card__meta { display: none; }

/* the plate: duotone category art set in a cream mat so the screen stays bright. Category art only, never question media */
.plate { display: block; padding: var(--space-1); background: var(--paper); border-radius: var(--radius-s); }
.plate img { inline-size: 100%; aspect-ratio: var(--art-ratio, 3 / 2); object-fit: cover; border-radius: var(--radius-xs); background: var(--night-bg); }
.plate--fallback { display: grid; place-items: center; aspect-ratio: var(--art-ratio, 3 / 2); background-color: var(--night-bg); background-image: linear-gradient(var(--night-track) var(--border-1), transparent var(--border-1)), linear-gradient(90deg, var(--night-track) var(--border-1), transparent var(--border-1)); background-size: var(--space-4) var(--space-4); color: var(--night-brand); font: var(--weight-display) var(--text-title) / 1 var(--font-head); border-radius: var(--radius-xs); }   /* image missing: the first letter on the ruled grid, never a broken image */

/* progress meter: six place settings, x of 6 */
.meter { display: grid; gap: var(--space-2); }
.meter__segs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); }
.meter__seg { display: grid; place-items: center; block-size: var(--space-8); border: var(--border-2) dashed var(--color-border); border-radius: var(--radius-xs); color: var(--color-text-3); font-size: var(--text-s); font-weight: var(--weight-strong); }
.meter__seg[data-on] { border-style: solid; border-color: var(--paper-edge); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-press); }
.meter__seg .icon { inline-size: var(--icon-s); block-size: var(--icon-s); }
.meter__seg:not([data-on]) .icon { display: none; }
.meter__seg[data-on] .num { display: none; }
.meter__text { display: flex; justify-content: space-between; gap: var(--space-3); font-weight: var(--weight-strong); }
.meter__text span:last-child { color: var(--color-text-2); font-weight: var(--weight-regular); }
.meter[data-full] .meter__seg[data-on] { background: var(--color-tile-600); }


/* ==========================================================================
   12. THE SEAT: the scoreboard in this direction's own form
   Two place cards flank the board. Seat 1 sits at the start edge, seat 2 at the end edge.
   The crow stands on the top edge of the active seat and cross-fades in place.
   ========================================================================== */
.table-layout {
  display: grid;
  grid-template-columns: var(--seat-w) minmax(0, 1fr) var(--seat-w);
  grid-template-areas: "s1 center s2";
  gap: var(--space-6);
  align-items: start;
  padding: var(--perch-h) var(--tv-safe) var(--space-6);
}
.table-layout > .seat--1 { grid-area: s1; }
.table-layout > .seat--2 { grid-area: s2; }
.table-layout > .table-center { grid-area: center; min-inline-size: 0; display: grid; gap: var(--space-5); }
.table-layout > .seat { position: sticky; inset-block-start: calc(var(--header-h) + var(--perch-h) + var(--space-4)); }

.seat {
  --team: var(--team1-fill);
  --team-ink: var(--ink-team1);
  position: relative; display: flex; flex-direction: column; align-self: start;
  background: var(--paper);
  border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-press);
  transition: transform var(--dur-2) var(--ease-lean), box-shadow var(--dur-2) var(--ease-lean);
}
.seat--2 { --team: var(--team2-fill); --team-ink: var(--ink-team2); }
.seat[data-active], .seat[data-winner] { transform: translateY(calc(var(--space-2) * -1)); box-shadow: var(--shadow-seat); border-color: var(--team-ink); }
.seat__band {
  display: flex; align-items: center; gap: var(--space-2); justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--team); color: var(--night-bg);
  border-block-end: var(--border-2) dashed var(--paper-edge);      /* the fold of the place card */
  border-start-start-radius: calc(var(--radius-xl) - var(--border-3)); border-start-end-radius: calc(var(--radius-xl) - var(--border-3));
  font-size: var(--text-s); font-weight: var(--weight-strong); letter-spacing: var(--tracking-label); text-transform: uppercase;
}
:lang(ar) .seat__band, [dir="rtl"] .seat__band { letter-spacing: 0; text-transform: none; }
.seat__band .glyph { --glyph-color: var(--night-bg); font-size: 1.1em; }
.seat__body { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-4) var(--space-4); text-align: center; color: var(--ink); }
.seat__name {
  position: relative; max-inline-size: 100%; padding-block-end: var(--space-2);
  font: var(--weight-display) var(--text-team) / var(--leading-tight) var(--font-head); letter-spacing: var(--tracking-display); color: var(--ink);
  overflow-wrap: anywhere; text-wrap: balance;
}
.seat__name::after {   /* the drawn underline: whose turn */
  content: ""; position: absolute; inset-inline: 8%; inset-block-end: 0; block-size: var(--border-3); border-radius: var(--radius-pill);
  background: var(--team-ink); transform: scaleX(0); transform-origin: left center; rotate: -0.6deg;
  transition: transform var(--dur-3) var(--ease-draw);
}
[dir="rtl"] .seat__name::after { transform-origin: right center; rotate: 0.6deg; }
.seat[data-active] .seat__name::after, .seat[data-winner] .seat__name::after { transform: scaleX(1); }
.seat__score { display: grid; gap: var(--space-1); font: var(--weight-display) var(--text-score) / var(--leading-numeral) var(--font-head); font-variant-numeric: lining-nums tabular-nums; direction: ltr; color: var(--ink); }
.seat__unit { font: var(--weight-strong) var(--text-s) / 1.2 var(--font-body); color: var(--ink-2); }
.seat .turn-pill { --team: var(--team); }
.seat:not([data-active]) .turn-pill--turn { visibility: hidden; }
.seat[data-winner]:not([data-active]) .turn-pill--turn { display: none; }
.seat__won { display: grid; gap: var(--space-2); inline-size: 100%; padding-block-start: var(--space-3); border-block-start: var(--border-2) dashed var(--ink-hair); }
.seat__won-title { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }
.won-row { display: flex; justify-content: center; gap: var(--space-2); }
.won-card { display: grid; justify-items: center; min-inline-size: 3rem; padding: var(--space-1) var(--space-2); background: var(--tile-bg, var(--color-tile-200)); color: var(--color-on-tile); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-xs); font: var(--weight-display) var(--text-s) / 1.1 var(--font-head); }
.won-card[data-value="200"] { --tile-bg: var(--color-tile-200); }
.won-card[data-value="400"] { --tile-bg: var(--color-tile-400); }
.won-card[data-value="600"] { --tile-bg: var(--color-tile-600); }
.won-card small { direction: ltr; unicode-bidi: isolate; font: var(--weight-strong) var(--text-xs) / 1.1 var(--font-body); }
.seat__won-count { display: none; }

/* the perch: a die-cut tab on the top edge of the seat. The crow is an <img> of the logo-folder pose.
   Evening: amber on the Espresso page. Daylight: the tab is the Espresso roundel the crow always stands on */
.seat__perch { position: absolute; inset-inline: 0; inset-block-end: 100%; z-index: 1; display: flex; justify-content: center; pointer-events: none; opacity: 0; transition: opacity var(--dur-2) var(--ease-lean); }
.seat[data-active] .seat__perch, .seat[data-winner] .seat__perch, .seat.is-clinking .seat__perch { opacity: 1; }
.perch__tab {
  position: relative; display: grid; place-items: end center; inline-size: calc(var(--crow-h) * 1.7); block-size: var(--perch-h);
  background: var(--color-crow-roundel); border: var(--border-3) solid var(--paper-edge); border-block-end: 0;
  border-start-start-radius: var(--radius-l); border-start-end-radius: var(--radius-l);
}
.perch__slot { grid-area: 1 / 1; display: grid; place-items: end center; opacity: 0; transition: opacity var(--dur-2) var(--ease-lean); }
.perch__slot img { block-size: var(--crow-h); inline-size: auto; margin-block-end: calc(var(--crow-foot) * -1); transform: scaleX(var(--flip)); }
.seat--2 .perch__slot--win img { transform: scaleX(calc(var(--flip) * -1)); }
.seat[data-active] .perch__slot--turn { opacity: 1; }
.seat[data-winner] .perch__slot--turn, .seat.is-clinking .perch__slot--turn { opacity: 0; }
.seat[data-winner] .perch__slot--win, .seat.is-clinking .perch__slot--win { opacity: 1; }
.seat.is-clinking .perch__slot--win { animation: crow-lift calc(var(--dur-flourish) * var(--motion-scale, 1)) var(--ease-clink) 1; }
@keyframes crow-lift { 0% { transform: translateY(0); } 35% { transform: translateY(-6%); } 100% { transform: translateY(0); } }
/* a static perch for cards that are not seats (hero card, welcome card): place a .perch-static inside a position:relative card */
.perch-static { position: absolute; inset-inline-start: var(--space-8); inset-block-end: 100%; display: grid; place-items: end center; inline-size: calc(var(--crow-h) * 1.7); block-size: var(--perch-h); background: var(--color-crow-roundel); border: var(--border-3) solid var(--paper-edge); border-block-end: 0; border-start-start-radius: var(--radius-l); border-start-end-radius: var(--radius-l); pointer-events: none; }
.perch-static img { block-size: var(--crow-h); inline-size: auto; margin-block-end: calc(var(--crow-foot) * -1); transform: scaleX(var(--flip)); }

/* clink ripple: a Tea ring from the awarded seat. One per screen */
.seat__ripple { position: absolute; inset-inline-start: 0; inset-block-start: 50%; inline-size: 100%; aspect-ratio: 1; translate: 0 -50%; border: var(--border-3) solid var(--night-brand); border-radius: 50%; opacity: 0; pointer-events: none; z-index: 2; }
.seat.is-clinking .seat__ripple { animation: clink calc(var(--dur-4) * 1.4) var(--ease-clink) 1; }
@keyframes clink { from { transform: scale(0.6); opacity: 0.6; } to { transform: scale(1.6); opacity: 0; } }
.seat__plus { position: absolute; inset-inline: 0; inset-block-start: calc(var(--space-12) * -1 - var(--perch-h)); text-align: center; pointer-events: none; opacity: 0; }

/* seats on a phone: two compact place cards above the board */
@media (max-width: 899px) {
  :root { --crow-h: 3.25rem; --seat-w: auto; }
  .table-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "s1 s2" "center center"; gap: var(--space-4) var(--space-3); padding-inline: var(--gutter); }
  .table-layout > .seat { position: relative; inset-block-start: auto; }
  .seat { border-radius: var(--radius-l); }
  .seat__band { padding-block: var(--space-1); border-start-start-radius: calc(var(--radius-l) - var(--border-3)); border-start-end-radius: calc(var(--radius-l) - var(--border-3)); }
  .seat__body { gap: var(--space-2); padding: var(--space-3) var(--space-2) var(--space-3); }
  .seat__name { font: var(--weight-strong) var(--text-s) / var(--leading-tight) var(--font-body); text-wrap: pretty; }
  .seat__score { font-size: var(--text-xl); }
  .seat .turn-pill { max-inline-size: 100%; padding-inline: var(--space-3); font-size: var(--text-xs); }
  .seat .turn-pill .icon { display: none; }
  .seat__unit { display: none; }
  .seat__won { display: none; }
  .seat__won-count { display: block; font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }
  .perch__tab, .perch-static { inline-size: calc(var(--crow-h) * 1.6); }
}


/* ==========================================================================
   13. The board and its tiles
   Each category is a tray holding six printed cards in two lanes: lane 1 (start edge)
   belongs to Team 1, lane 2 (end edge) to Team 2. Rows are 200, 400, 600.
   ========================================================================== */
.turn-line { display: block; min-block-size: var(--tap-min); font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); text-align: center; }
.turn-line .glyph { font-size: 0.8em; margin-inline-end: 0.25em; vertical-align: 0.02em; }
.board { display: grid; grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr)); gap: var(--space-4); }
.board[data-dim] { opacity: 0.45; pointer-events: none; }
.cat { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-2); background: var(--color-surface); border: var(--border-2) solid var(--color-border-subtle); border-radius: var(--radius-card); }
.cat__head { display: grid; grid-template-columns: var(--thumb-w) minmax(0, 1fr); align-items: center; gap: var(--space-3); padding: var(--space-2); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-m); box-shadow: var(--shadow-press); }
.cat__head .plate { --art-ratio: 4 / 3; padding: 0; background: transparent; }
.cat__head .plate img { border-radius: var(--radius-xs); }
.cat__name { font: var(--weight-strong) clamp(1rem, 0.5rem + 0.95vw, 1.4rem) / var(--leading-tight) var(--font-body); color: var(--ink); overflow-wrap: break-word; hyphens: manual; text-wrap: balance; }
@media (min-width: 1600px) { .cat__name { font-family: var(--font-head); font-weight: var(--weight-display); font-size: var(--text-category); } }   /* Fraunces only from 24 px up: the TV tier */
.cat__lanes { display: grid; grid-template-columns: 1fr 1fr; justify-items: center; align-items: center; gap: var(--board-gap); font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--color-text-2); }
.cat__lanes span { display: inline-flex; align-items: center; gap: var(--space-2); }
.cat__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--board-gap); padding-block-end: var(--space-1); }

.tile {
  --tile-bg: var(--color-tile-200);
  position: relative; display: grid; place-content: center; justify-items: center; gap: var(--space-1);
  min-block-size: var(--tile-h); min-inline-size: var(--tap-min); padding: var(--space-1);
  background: var(--tile-bg); color: var(--color-on-tile);
  border: var(--border-2) solid var(--color-tile-edge); border-radius: var(--radius-tile);
  /* hard shadow, then a printed keyline set in from the edge */
  box-shadow: var(--shadow-tile), inset 0 0 0 var(--tile-keyline) var(--tile-bg), inset 0 0 0 calc(var(--tile-keyline) + var(--border-1)) var(--paper-rule);
  font-family: var(--font-head); font-weight: var(--weight-display); font-size: var(--text-tile); line-height: var(--leading-numeral); letter-spacing: var(--tracking-display);
  font-variant-numeric: lining-nums tabular-nums; direction: ltr;
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease-set), box-shadow var(--dur-2) var(--ease-set);
}
.tile[data-value="400"] { --tile-bg: var(--color-tile-400); }
.tile[data-value="600"] { --tile-bg: var(--color-tile-600); }
.tile .tally { --tally-size: calc(var(--text-tile) * 0.5); }
.tile__glyph { position: absolute; inset-block-end: var(--space-1); inset-inline-end: var(--space-1); font-size: var(--text-xs); }
.tile__glyph.glyph--ring { --glyph-color: var(--ink-team1); }
.tile[data-lane="2"] .tile__glyph.glyph--ring { --glyph-color: var(--ink-team2); }
.tile:hover, .tile.is-hover { transform: translateY(calc(var(--lift) * -1)); box-shadow: var(--shadow-lift), inset 0 0 0 var(--tile-keyline) var(--tile-bg), inset 0 0 0 calc(var(--tile-keyline) + var(--border-1)) var(--paper-rule); }
.tile:active, .tile.is-active { transform: translateY(2px); box-shadow: var(--shadow-press), inset 0 0 0 var(--tile-keyline) var(--tile-bg), inset 0 0 0 calc(var(--tile-keyline) + var(--border-1)) var(--paper-rule); }
.tile:focus-visible, .tile.is-focus { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.tile[aria-current="true"], .tile.is-current { transform: translateY(calc(var(--lift) * -1)); outline: var(--border-3) solid var(--color-brand-text); outline-offset: var(--space-1); }

/* used: the card was picked up and set down at a seat, leaving a dashed slot with a strike, the numeral dimmed and the scorer's glyph */
.tile[data-state="used"] {
  background: transparent; color: var(--color-text-3); cursor: default; transform: none;
  border: var(--border-2) dashed var(--color-border); box-shadow: var(--shadow-none);
}
.tile[data-state="used"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), currentColor calc(50% - 1.5px), currentColor calc(50% + 1.5px), transparent calc(50% + 1.5px));
}
[dir="rtl"] .tile[data-state="used"]::after { transform: scaleX(-1); }
.tile[data-state="used"] .tile__glyph { --glyph-color: currentColor; }
.tile[data-state="used"] .tile__glyph.glyph--ring { background: currentColor; box-shadow: none; }
.tile[data-state="used"][data-scorer="1"] .tile__glyph { --glyph-color: var(--color-team1); background: var(--color-team1); border-radius: 50%; }
.tile[data-state="used"][data-scorer="2"] .tile__glyph { --glyph-color: var(--color-team2); background: var(--color-team2); border-radius: var(--radius-xs); }
.tile[data-state="used"]:not([data-scorer]) .tile__glyph { display: none; }
.tile[data-state="used"] .tally { opacity: 0.7; }

/* locked: the other team's lane while it is not their turn. Lies flat, no shadow, a solid thin outline, the numeral stays readable.
   Driven by data-turn on the board, so the page does not have to restyle 36 tiles each turn */
.tile[data-state="locked"],
.board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]),
.board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]) {
  background: var(--color-surface); color: var(--color-text-2); cursor: not-allowed; transform: translateY(var(--space-1));
  border: var(--border-2) solid var(--color-border-subtle); box-shadow: var(--shadow-none);
}
.board[data-turn] .tile[data-lane]:not([data-state="used"]):not([data-state="locked"]):hover { /* base hover stays; locked overrides below */ }
.tile[data-state="locked"]:hover, .tile[data-state="locked"]:active,
.board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]):hover, .board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]):active,
.board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]):hover, .board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]):active { transform: translateY(var(--space-1)); box-shadow: var(--shadow-none); }
.tile[data-state="locked"] .tile__glyph.glyph--ring, .board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]) .tile__glyph.glyph--ring, .board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]) .tile__glyph.glyph--ring { --glyph-color: currentColor; }

/* a board on tablet and phone: 3 then 2 category trays across */
@media (max-width: 899px) { :root { --board-cols: 3; --tile-h: 3rem; } .board { gap: var(--space-3); } }
@media (max-width: 599px) { :root { --board-cols: 2; } .cat__head { grid-template-columns: 1fr; justify-items: center; text-align: center; } .cat__head .plate { inline-size: 100%; } .cat__name { font-size: var(--text-s); } .tile { font-size: var(--text-l); } .tile .tally { --tally-size: var(--text-l); } }

/* ONE-SCREEN BOARD (fix 1): on a laptop or TV the table fills the window under the header (board.html sets --fit-top from the real
   header position). The title row, turn line and dock keep their height; the board takes the rest, two rows of trays at equal height,
   and each tray splits what it gets between its head, lane row and three tile rows. Tile numerals scale with the window height
   (>= 2rem equivalent at 1080p). Below the minimum height the page simply scrolls again. */
@media (min-width: 900px) and (min-height: 501px) {
  .table-layout--fit { min-block-size: max(36rem, calc(100dvh - var(--fit-top, var(--header-h)))); padding-block: var(--space-3) var(--space-4); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .table-layout--fit > .seat { align-self: start; margin-block-start: var(--perch-h); }
  .table-layout--fit > .table-center { position: relative; display: flex; flex-direction: column; gap: var(--space-3); min-block-size: 0; }
  .table-layout--fit .turn-line { min-block-size: 0; }
  .table-layout--fit .board { flex: 1 1 auto; grid-template-rows: repeat(2, minmax(min-content, 1fr)); gap: var(--space-3); }
  .table-layout--fit .cat { grid-template-rows: auto auto minmax(0, 1fr); gap: var(--space-1); padding: var(--space-2); min-block-size: 0; }
  .table-layout--fit .cat__head { padding: var(--space-1) var(--space-2); gap: var(--space-2); }
  .table-layout--fit .cat__name { font-size: clamp(1.125rem, 2.6vh, 1.6rem); }
  .table-layout--fit .cat__lanes { font-size: var(--text-xs); line-height: 1.1; }
  .table-layout--fit .cat__tiles { grid-template-rows: repeat(3, minmax(var(--tap-min), 1fr)); gap: var(--space-2) var(--space-2); padding-block-end: 0; min-block-size: 0; }
  .table-layout--fit .tile { min-block-size: var(--tap-min); font-size: clamp(1.5rem, 3.9vh, 2.6rem); padding: 0; }
  .table-layout--fit .tile .tally { position: absolute; inset-block-end: var(--space-1); inset-inline-start: 50%; translate: -50% 0; --tally-size: 1.1rem; }
  [dir="rtl"] .table-layout--fit .tile .tally { translate: 50% 0; }
  .table-layout--fit { --seat-w: clamp(10rem, 14.5vw, 15rem); }
  .table-layout--fit .dock { padding: var(--space-2) var(--space-8); gap: var(--space-1) var(--space-2); }
  .table-layout--fit .dock::before, .table-layout--fit .dock::after { inline-size: var(--space-4); }
  .table-layout--fit .dock::before { inset-inline-start: var(--space-2); } .table-layout--fit .dock::after { inset-inline-end: var(--space-2); }
  .table-layout--fit .dock .btn { padding-inline: var(--space-3); }
  .table-layout--fit .rule { gap: var(--space-1) var(--space-3); }
  [dir="rtl"] .table-layout--fit :is(.cat__name, .cat__lanes, .board-title, .board-count, .rule, .turn-line, .btn) { line-height: 1.2; }   /* Arabic leading is taller; keep the rows as short as the Latin ones so the board still fits */
  [dir="rtl"] .table-layout--fit .tile__num { line-height: 1; }
  .table-layout--fit .coach__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--space-5); list-style-position: inside; padding-inline-start: 0; }
  .table-layout--fit .coach { padding-block: var(--space-2); }
  .table-layout--fit .coach:not([hidden]) { position: absolute; inset-inline: 0; inset-block-start: 58%; translate: 0 -50%; z-index: 5; box-shadow: var(--shadow-seat); background: var(--color-raised); }   /* first-run tip floats over the top of the board, so it never pushes the 36 tiles off the screen */
}

/* the stage: board and question card share one cell. Opening a tile sets the card down over the dimmed board */
.stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); }
.stage > * { grid-area: 1 / 1; min-inline-size: 0; }
.stage__scrim { background: var(--color-scrim); border-radius: var(--radius-xl); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-lean); z-index: 1; }
.stage[data-mode="question"] .stage__scrim { opacity: 1; pointer-events: auto; }
.stage .qcard { display: none; z-index: 2; align-self: center; justify-self: center; margin-block: var(--space-8); }
.stage[data-mode="question"] .qcard { display: grid; animation: set-down var(--dur-3) var(--ease-set) both; }
.stage[data-mode="question"] .board { pointer-events: none; }
.stage__beat { z-index: 3; background: var(--ink); opacity: 0; pointer-events: none; border-radius: var(--radius-xl); transition: opacity var(--dur-2) var(--ease-lean); }
.stage[data-beat="on"] .stage__beat { opacity: 0.12; }
@keyframes set-down { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 899px) { .stage[data-mode="question"] .board, .stage[data-mode="question"] .stage__scrim { display: none; } }


/* ==========================================================================
   14. The question card and the timer
   The tile lifts and is set down centre-table. The card has two faces; reveal turns it over.
   ========================================================================== */
.qcard { position: relative; display: grid; inline-size: min(100%, var(--qcard-max)); margin-block-start: var(--space-5); perspective: var(--perspective); --team-ink: var(--ink-team1); }
.qcard[data-team="2"] { --team-ink: var(--ink-team2); }
.qcard__inner { position: relative; display: grid; transform-style: preserve-3d; transition: transform var(--dur-3) var(--ease-set); }
.qcard[data-face="back"] .qcard__inner { transform: rotateY(180deg); }
.qcard__face {
  grid-area: 1 / 1; position: relative; display: grid; align-content: start; gap: var(--space-5);
  padding: var(--space-8) var(--space-8) var(--space-6);
  background: var(--paper); color: var(--ink);
  border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sheet), inset 0 0 0 var(--space-2) var(--paper), inset 0 0 0 calc(var(--space-2) + var(--border-1)) var(--paper-rule);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  min-block-size: 22rem;
  transition: visibility 0s linear calc(var(--dur-3) / 2);
}
.qcard__face--back { transform: rotateY(180deg); visibility: hidden; align-content: center; justify-items: center; text-align: center; }
.qcard[data-face="back"] .qcard__face--front { visibility: hidden; }
.qcard[data-face="back"] .qcard__face--back { visibility: visible; }
.qcard[data-phase="steal"] .qcard__face--front { border-style: double; border-width: calc(var(--border-3) + var(--border-1)); border-color: var(--team-ink); }
.qcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-inline-end: calc(var(--timer-size) * 0.72); }
.qcard__meta .spacer { flex: 1; }
.qcard__text { font: var(--weight-strong) var(--text-question) / var(--leading-snug) var(--font-body); color: var(--ink); text-wrap: balance; max-inline-size: 36ch; }
[dir="rtl"] .qcard__text { line-height: var(--leading-ar-heading); }
.qcard__text--center { text-align: center; margin-inline: auto; }
.qcard__hint { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--paper-sunk); border: var(--border-2) dashed var(--ink-rule); border-radius: var(--radius-m); color: var(--ink-2); font-size: var(--text-s); }
.phase-badge { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-4); border: var(--border-2) solid var(--team-ink); border-radius: var(--radius-pill); color: var(--team-ink); background: var(--paper); font-weight: var(--weight-strong); font-size: var(--text-s); }
.qcard[data-phase="steal"] .phase-badge--main { display: none; }
.qcard:not([data-phase="steal"]) .phase-badge--steal { display: none; }
.qcard[data-face="back"] .timer { opacity: 0; pointer-events: none; }

/* timer: a thick ring on the card's corner. 60 s, then a 30 s steal. At 10 s the ring doubles and the numeral grows, with words */
.timer {
  position: absolute; z-index: 4; inset-block-start: calc(var(--timer-size) * -0.3); inset-inline-end: calc(var(--timer-size) * -0.09);
  display: grid; justify-items: center; gap: var(--space-2); inline-size: var(--timer-size);
  --ring: var(--night-brand);
  transition: opacity var(--dur-2) var(--ease-lean);
}
.timer__disc {
  position: relative; display: grid; place-items: center; inline-size: var(--timer-size); aspect-ratio: 1; border-radius: 50%;
  background: var(--night-bg); border: var(--border-3) solid var(--paper); box-shadow: var(--shadow-tile);
}
.timer__ring { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; transform: rotate(-90deg); overflow: visible; }
[dir="rtl"] .timer__ring { transform: scaleX(-1) rotate(-90deg); }
.timer__track, .timer__arc { fill: none; stroke-width: var(--ring-w); }
.timer__track { stroke: var(--night-track); }
.timer__arc { stroke: var(--ring); stroke-dasharray: 100; stroke-dashoffset: calc(100 * (1 - var(--p, 1))); transition: stroke-dashoffset calc(1000ms * var(--motion-scale, 1)) var(--ease-linear); }
.timer__num { position: relative; display: grid; place-items: center; font: var(--weight-strong) calc(var(--text-timer) * 0.62) / 1 var(--font-body); font-variant-numeric: lining-nums tabular-nums; direction: ltr; color: var(--night-text); }
.timer__icon { display: none; position: relative; inline-size: 38%; block-size: 38%; color: var(--night-text); }
.timer__tag { display: inline-grid; justify-items: center; text-align: center; inline-size: max-content; max-inline-size: calc(var(--timer-size) * 1.5); min-block-size: var(--space-8); padding: var(--space-1) var(--space-4); border-radius: var(--radius-l); background: var(--night-bg); color: var(--night-text); border: var(--border-2) solid var(--ring); font-size: var(--text-s); font-weight: var(--weight-strong); line-height: var(--leading-tight); box-shadow: var(--shadow-press); }
.timer__tag .glyph { --glyph-color: var(--ring); }
.timer__tag-low, .timer__tag-steal, .timer__tag-up, .timer__tag-pause { display: none; }
.timer[data-state="low"] { --ring: var(--night-danger); }
.timer[data-low] .timer__track, .timer[data-low] .timer__arc { stroke-width: var(--ring-w-low); }
.timer[data-low] .timer__num { font-size: calc(var(--text-timer) * 0.62 * 1.12); }
.timer[data-low] .timer__tag-main, .timer[data-state="steal"] .timer__tag-main, .timer[data-state="up"] .timer__tag-main, .timer[data-state="paused"] .timer__tag-main { display: none; }
.timer[data-low] .timer__tag-low { display: inline; }
.timer[data-state="steal"] .timer__tag-steal { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 var(--space-2); }
.timer[data-state="steal"][data-team="1"] { --ring: var(--night-team1); }
.timer[data-state="steal"][data-team="2"] { --ring: var(--night-team2); }
.timer[data-state="up"] { --ring: var(--night-text-2); --p: 0; }
.timer[data-state="up"] .timer__num { display: none; }
.timer[data-state="up"] .timer__icon { display: block; }
.timer[data-state="up"] .timer__tag-up { display: inline; }
.timer[data-state="paused"] .timer__tag-pause { display: inline; }
.timer[data-state="paused"] { --ring: var(--night-text-2); }
.timer__live { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* QUESTION CARD, LAPTOP AND TV (fix 2): the timer ring stands on the table beside the card, in its own column, so it can never sit over the headline
   or the picture. The ring is smaller (about 170 px at 1080p, still readable at 10 feet), the card is shorter, so the headline, picture, ring and the
   Reveal dock all fit one 1080p screen. After the reveal the ring stays, dimmed and frozen, so the card does not jump. */
@media (min-width: 900px) and (min-height: 501px) {
  :root { --timer-size: clamp(6.5rem, 4rem + 4vw, 8.5rem); --timer-col: calc(var(--timer-size) + var(--space-5)); }
  .qcard { grid-template-columns: minmax(0, 1fr) var(--timer-col); align-items: start; margin-block-start: 0; }
  .qcard__inner { grid-column: 1; grid-row: 1; }
  .timer { position: static; grid-column: 2; grid-row: 1; justify-self: end; margin-block-start: var(--space-2); }
  .qcard__meta { padding-inline-end: 0; }
  .qcard__face { padding: var(--space-6) var(--space-8) var(--space-5); gap: var(--space-4); min-block-size: 18rem; }
  .timer__num { font-size: calc(var(--timer-size) * 0.4); }
  .timer__tag { max-inline-size: calc(var(--timer-col) - var(--space-1)); padding-inline: var(--space-2); }
  .timer[data-low] .timer__num { font-size: calc(var(--timer-size) * 0.46); }
  .qcard[data-face="back"] .timer { opacity: 0.5; }
  .qcard[data-face="back"] .timer__tag { visibility: hidden; }
}

@media (max-width: 899px) {
  :root { --timer-size: 5.5rem; }
  .qcard__face { padding: var(--space-6) var(--space-4) var(--space-5); min-block-size: 16rem; }
  .qcard__meta { padding-inline-end: 0; margin-block-start: calc(var(--timer-size) * 0.5); }
  /* on a phone the timer leaves the corner and sits on the card's top edge, tag beside it, so nothing is covered */
  .timer { position: relative; inset: auto; justify-self: end; grid-auto-flow: column; align-items: end; gap: var(--space-2); inline-size: auto; margin-inline-end: var(--space-3); margin-block-end: calc(var(--timer-size) * -0.5); }
  .timer__tag { order: -1; margin-block-end: var(--space-2); }
  .timer__disc { flex: none; }
  .timer__live { position: absolute; }
}


/* ==========================================================================
   15. Reveal, awards, host dock
   ========================================================================== */
.answer { position: relative; display: inline-block; padding: var(--space-4) var(--space-8); font: var(--weight-display) var(--text-title) / var(--leading-tight) var(--font-head); color: var(--ink); text-wrap: balance; }
.answer__circle { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; fill: none; stroke: var(--ink-brand); stroke-width: 4; stroke-linecap: round; overflow: visible; pointer-events: none; }
.answer__circle path { vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--dur-3) var(--ease-draw) calc(var(--dur-3) * 1.2); }
.qcard[data-face="back"] .answer__circle path, .answer--drawn .answer__circle path { stroke-dashoffset: 0; }
[dir="rtl"] .answer__circle { transform: scaleX(-1); }
.answer__why { max-inline-size: 34rem; color: var(--ink-2); font-size: var(--text-lead); line-height: var(--leading-snug); }

.awards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); inline-size: min(100%, var(--qcard-max)); margin-inline: auto; }
.award {
  --team: var(--team1-fill); --team-ink: var(--ink-team1);
  display: grid; justify-items: center; align-content: start; gap: var(--space-1); padding: 0 var(--space-2) var(--space-3);
  background: var(--paper); color: var(--ink); text-align: center; cursor: pointer;
  border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-l) var(--radius-l) var(--radius-m) var(--radius-m);
  box-shadow: var(--shadow-tile);
  min-block-size: calc(var(--tap-min) * 2);
  transition: transform var(--dur-2) var(--ease-set), box-shadow var(--dur-2) var(--ease-set);
}
.award--2 { --team: var(--team2-fill); --team-ink: var(--ink-team2); }
.award--none { --team: var(--paper-sunk); --team-ink: var(--ink-2); }
.award__band { display: flex; align-items: center; justify-content: center; gap: var(--space-2); inline-size: calc(100% + var(--space-4)); margin-inline: calc(var(--space-2) * -1); padding: var(--space-1) var(--space-2); background: var(--team); color: var(--night-bg); border-block-end: var(--border-2) dashed var(--paper-edge); border-start-start-radius: var(--radius-m); border-start-end-radius: var(--radius-m); font-size: var(--text-s); font-weight: var(--weight-strong); }
.award--none .award__band { color: var(--ink); }
.award__band .glyph { --glyph-color: var(--night-bg); }
.award__name { margin-block-start: var(--space-2); font: var(--weight-strong) var(--text-m) / var(--leading-tight) var(--font-body); overflow-wrap: anywhere; }
.award__pts { font: var(--weight-display) var(--text-heading) / 1 var(--font-head); font-variant-numeric: lining-nums tabular-nums; direction: ltr; color: var(--team-ink); }
.award--none .award__pts { color: var(--ink-2); font-size: var(--text-m); }
.award:hover, .award.is-hover { transform: translateY(calc(var(--lift) * -1)); box-shadow: var(--shadow-lift); }
.award:active, .award.is-active { transform: translateY(2px); box-shadow: var(--shadow-press); }
.award:focus-visible { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.award[disabled], .award[aria-disabled="true"] { background: var(--paper-sunk); border-style: dashed; border-color: var(--ink-rule); box-shadow: none; transform: none; cursor: not-allowed; color: var(--ink-2); }
.award[disabled] .award__band, .award[aria-disabled="true"] .award__band { border-block-end-color: var(--ink-rule); }
.award[aria-pressed="true"] { border-width: var(--border-3); border-color: var(--team-ink); transform: translateY(calc(var(--lift) * -1)); }
@media (max-width: 599px) { .award__name { font-size: var(--text-s); } .award__band span:not(.glyph) { display: none; } }

/* the host dock: a serving tray along the foot of the table. Reveal at any time, undo, add time, flag */
.dock {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-12);
  background: var(--color-raised); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-seat);
}
.dock::before, .dock::after { content: ""; position: absolute; inset-block-start: 50%; translate: 0 -50%; inline-size: var(--space-6); block-size: var(--space-2); border-radius: var(--radius-pill); background: var(--color-bg); border: var(--border-2) solid var(--color-border); }   /* the tray handles */
.dock::before { inset-inline-start: var(--space-3); }
.dock::after { inset-inline-end: var(--space-3); }
.dock__group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); }
.dock__sep { inline-size: var(--border-2); block-size: var(--space-8); background: var(--color-border-subtle); border-radius: var(--radius-pill); }
@media (max-width: 719px) {
  .dock { padding-inline: var(--space-4); border-radius: var(--radius-l); }
  .dock::before, .dock::after { display: none; }
  .dock .btn { flex: 1 1 auto; }
  .dock__sep { display: none; }
}


/* ==========================================================================
   16. Media frame, lightbox
   ========================================================================== */
.media { position: relative; margin: 0; display: grid; gap: var(--space-2); inline-size: 100%; }
.media__frame { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-sunk); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-m); }
.media__frame img, .media__frame video { inline-size: 100%; block-size: 100%; object-fit: contain; }
.media__expand { position: absolute; inset-block-end: var(--space-2); inset-inline-end: var(--space-2); background: var(--paper); color: var(--ink); border: var(--border-2) solid var(--paper-edge); box-shadow: var(--shadow-press); }
.media figcaption { font-size: var(--text-s); color: var(--color-text-2); }
.media__state { display: none; position: absolute; inset: 0; place-items: center; align-content: center; gap: var(--space-2); padding: var(--space-4); text-align: center; background: var(--paper-sunk); color: var(--ink-2); font-weight: var(--weight-strong); }
.media[data-state="loading"] .media__state--loading, .media[data-state="error"] .media__state--error { display: grid; }
.media[data-state="error"] .media__state--error { color: var(--ink-danger); }
.media[data-state="loading"] .media__frame > img, .media[data-state="error"] .media__frame > img { visibility: hidden; }
.media[data-state="loading"] .media__expand, .media[data-state="error"] .media__expand { display: none; }

.lightbox { padding: 0; border: 0; background: transparent; color: var(--night-text); inline-size: 100%; max-inline-size: none; block-size: 100%; max-block-size: none; }
.lightbox[open] { display: grid; place-items: center; align-content: center; gap: var(--space-3); animation: lightbox-in var(--dur-3) var(--ease-set) both; }
.lightbox::backdrop { background: var(--color-scrim); }
.lightbox__img { max-inline-size: calc(100% - var(--space-8)); max-block-size: calc(100dvh - var(--space-24) - var(--space-8)); inline-size: auto; block-size: auto; object-fit: contain; border: var(--border-3) solid var(--paper); border-radius: var(--radius-m); background: var(--paper); box-shadow: var(--shadow-sheet); cursor: zoom-out; }
.lightbox__caption { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-2) var(--space-4); background: var(--night-bg); border-radius: var(--radius-pill); font-size: var(--text-s); }
.lightbox__close { position: absolute; inset-block-start: var(--space-4); inset-inline-end: var(--space-4); background: var(--night-bg); color: var(--night-text); border-color: var(--night-text-2); }
.lightbox--static { position: relative; inset: auto; display: grid; block-size: auto; padding-block: var(--space-6); background: var(--color-scrim); border-radius: var(--radius-xl); }
.lightbox--static .lightbox__close { position: absolute; }
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }


/* ==========================================================================
   17. Alerts, toasts, dialogs
   ========================================================================== */
.alert { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); background: var(--color-surface); color: var(--color-text); border: var(--border-2) solid var(--alert-c, var(--color-border)); border-inline-start-width: var(--space-2); border-radius: var(--radius-m); }
.alert > .icon { color: var(--alert-c); margin-block-start: 0.1em; inline-size: var(--icon-l); block-size: var(--icon-l); }
.alert__title { display: block; font-weight: var(--weight-strong); color: var(--alert-c, var(--color-text)); }
.alert__body { color: var(--color-text); }
.alert__body a, .alert__body .link-btn { color: var(--color-text); }
.alert--error { --alert-c: var(--color-danger); }
.alert--warn { --alert-c: var(--color-warning); }
.alert--success { --alert-c: var(--color-success); }
.alert--info { --alert-c: var(--color-brand-text); }
.alert__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-3); }

.toasts { position: fixed; inset-block-end: var(--space-6); inset-inline-end: var(--space-6); z-index: var(--z-toast); display: grid; gap: var(--space-3); inline-size: min(26rem, calc(100% - var(--space-8))); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--paper); color: var(--ink); border: var(--border-2) solid var(--paper-edge); border-inline-start-width: var(--space-2); border-inline-start-color: var(--alert-c, var(--paper-edge)); border-radius: var(--radius-m); box-shadow: var(--shadow-sheet); animation: set-down var(--dur-2) var(--ease-set) both; }
.toast > .icon { color: var(--alert-c); margin-block-start: 0.15em; }
.toast--success { --alert-c: var(--ink-success); }
.toast--error { --alert-c: var(--ink-danger); }
.toast--warn { --alert-c: var(--ink-warning); }
.toast__body { flex: 1; }
.toast__title { display: block; font-weight: var(--weight-strong); }
.toast--static { animation: none; box-shadow: var(--shadow-tile); }
@media (max-width: 599px) { .toasts { inset-inline: var(--space-4); inline-size: auto; inset-block-end: var(--space-4); } }

.dialog { padding: 0; inline-size: min(36rem, calc(100% - var(--space-8))); max-block-size: calc(100dvh - var(--space-8)); background: var(--paper); color: var(--ink); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet); overflow: auto; }
.dialog[open] { animation: set-down var(--dur-3) var(--ease-set) both; }
.dialog::backdrop { background: var(--color-scrim); }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-2); }
.dialog__head h2 { font-size: var(--text-heading); color: var(--ink); }
.dialog__body { display: grid; gap: var(--space-4); padding: var(--space-2) var(--space-6) var(--space-4); }
.dialog__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6) var(--space-6); border-block-start: var(--border-2) dashed var(--ink-hair); background: var(--paper); }
.dialog--static { position: relative; inset: auto; margin-inline: auto; display: block; }
.dialog--static[open] { animation: none; }


/* ==========================================================================
   18. Empty state, skeleton, loader
   ========================================================================== */
.empty { display: grid; justify-items: center; gap: var(--space-4); max-inline-size: 30rem; margin-inline: auto; padding: var(--space-6); text-align: center; background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-tile); }
.empty__art { inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-l); border: var(--border-2) solid var(--paper-edge); }
.empty h2 { font-size: var(--text-heading); color: var(--ink); }
.empty p { color: var(--ink-2); }   /* a set tray, never a bird, never an empty chair */

.skeleton { display: block; background: var(--color-raised); border-radius: var(--radius-s); min-block-size: 1em; }
.skeleton--text { block-size: 1rem; }
.skeleton--title { block-size: 2rem; inline-size: 60%; }
.skeleton--tile { block-size: var(--tile-h); border-radius: var(--radius-tile); border: var(--border-2) dashed var(--color-border-subtle); background: transparent; }
.loading-line { display: flex; align-items: center; gap: var(--space-3); font-weight: var(--weight-strong); }
.progress { appearance: none; -webkit-appearance: none; inline-size: 100%; block-size: var(--space-3); border: var(--border-2) solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--color-surface); }
.progress::-webkit-progress-value { background: var(--color-brand); border-radius: var(--radius-pill); }
.progress::-moz-progress-bar { background: var(--color-brand); border-radius: var(--radius-pill); }


/* ==========================================================================
   19. Plans, QR card, results, share card
   ========================================================================== */
.balance { display: grid; gap: var(--space-3); padding: var(--space-5); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); }
.balance__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: var(--space-2); border-block-end: var(--border-2) dashed var(--ink-hair); }
.balance__row:last-child { border-block-end: 0; }
.balance__row dt { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-2); font-weight: var(--weight-strong); }
.balance__row dd { font: var(--weight-display) var(--text-heading) / 1 var(--font-head); color: var(--ink); }
.balance__row dd.is-words { font: var(--weight-strong) var(--text-s) / 1.2 var(--font-body); color: var(--ink-success); }

.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-5); }
.pack { position: relative; display: grid; gap: var(--space-3); align-content: start; padding: var(--space-6) var(--space-5) var(--space-5); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); cursor: pointer; transition: transform var(--dur-2) var(--ease-set), box-shadow var(--dur-2) var(--ease-set); }
.pack input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.pack:hover { transform: translateY(calc(var(--lift) * -1)); box-shadow: var(--shadow-lift); }
.pack:has(input:focus-visible) { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.pack:has(input:checked), .pack.is-selected { border-width: var(--border-3); border-color: var(--ink-brand); background: var(--color-tile-600); }
/* contrast fix: ink-2 and ink-3 fall below 4.5:1 on the tea card, so the selected pack sets its small print in full ink */
.pack:has(input:checked), .pack.is-selected { --ink-2: var(--ink); --ink-3: var(--ink); --color-text-2: var(--ink); --color-text-3: var(--ink); }
.pack__check { position: absolute; inset-block-start: var(--space-3); inset-inline-end: var(--space-3); display: none; place-items: center; inline-size: var(--space-8); block-size: var(--space-8); border-radius: 50%; background: var(--ink); color: var(--paper); }
.pack:has(input:checked) .pack__check, .pack.is-selected .pack__check { display: grid; }
.pack__name { font: var(--weight-strong) var(--text-m) / var(--leading-tight) var(--font-body); color: var(--ink); }
.pack__price { font: var(--weight-display) var(--text-3xl) / 1 var(--font-head); color: var(--ink); font-variant-numeric: lining-nums; direction: ltr; text-align: start; }
.pack__per { color: var(--ink-2); font-size: var(--text-s); }
.pack__list { display: grid; gap: var(--space-2); color: var(--ink-2); font-size: var(--text-s); }
.pack__list li { display: flex; gap: var(--space-2); align-items: flex-start; }
.pack__list .icon { color: var(--ink-success); margin-block-start: 0.2em; }
.pack:has(input:checked) .pack__list, .pack:has(input:checked) .pack__per, .pack.is-selected .pack__list, .pack.is-selected .pack__per { color: var(--ink); }
.stamp { justify-self: start; display: inline-flex; align-items: center; padding: var(--space-1) var(--space-3); border: var(--border-2) dashed var(--ink-2); border-radius: var(--radius-xs); font-size: var(--text-xs); font-weight: var(--weight-strong); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-2); rotate: -1.5deg; }
:lang(ar) .stamp, [dir="rtl"] .stamp { letter-spacing: 0; text-transform: none; }

.qr-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-6); align-items: center; padding: var(--space-6); background: var(--paper); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-seat); }
.qr-card__code { inline-size: clamp(9rem, 20vw, 14rem); aspect-ratio: 1; padding: var(--space-2); background: #FFFAF0; border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-m); }
.qr-card__code img { inline-size: 100%; block-size: 100%; }
.qr-card__copy { display: grid; gap: var(--space-3); color: var(--ink); }
.qr-card__copy h2 { font-size: var(--text-heading); color: var(--ink); }
.qr-card__status { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-strong); color: var(--ink-2); }
@media (max-width: 599px) { .qr-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* promo strip: art on one side, a sentence and one action on the other (University is free, welcome, first game on us) */
.strip { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--space-5); align-items: center; padding: var(--space-3); padding-inline-end: var(--space-6); background: var(--paper); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-tile); color: var(--ink); }
.strip__art { inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-l); border: var(--border-2) solid var(--paper-edge); }
.strip__copy { display: grid; gap: var(--space-2); justify-items: start; }
.strip__copy h3 { color: var(--ink); }
.strip__copy p { color: var(--ink-2); }
@media (max-width: 599px) { .strip { grid-template-columns: 1fr; padding: var(--space-3); } }

/* results: the same seats, at full volume, and a notepaper score pad between them */
.scorepad {
  position: relative; display: grid; gap: var(--space-3); justify-items: center; text-align: center; padding: var(--space-8) var(--space-6) var(--space-8) var(--space-16);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--space-8) - var(--border-1)), var(--ink-hair) calc(var(--space-8) - var(--border-1)), var(--ink-hair) var(--space-8));
  border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet);
  color: var(--ink);
}
.scorepad::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: var(--space-12); inline-size: var(--border-2); background: var(--ink-team1); opacity: 0.5; }
.scorepad > * { position: relative; }
.scorepad .winner-note { background: var(--paper); padding-inline: var(--space-3); color: var(--ink-2); }
.scorepad__title { font: var(--weight-display) var(--text-title) / var(--leading-tight) var(--font-head); color: var(--ink); background: var(--paper); padding-inline: var(--space-4); }
.scorepad__line { display: flex; align-items: baseline; justify-content: center; gap: var(--space-4); background: var(--paper); padding-inline: var(--space-4); font: var(--weight-display) var(--text-3xl) / 1 var(--font-head); font-variant-numeric: lining-nums tabular-nums; direction: ltr; }
.scorepad__line .sep { font-size: var(--text-heading); color: var(--ink-3); }
.winner-line { font: var(--weight-display) var(--text-4xl) / var(--leading-display) var(--font-head); text-wrap: balance; letter-spacing: var(--tracking-display); }
.winner-note { color: var(--color-text-2); font-size: var(--text-lead); }
@media (max-width: 599px) {
  .scorepad { padding: var(--space-6) var(--space-4) var(--space-6) var(--space-10); min-inline-size: 0; max-inline-size: 100%; }
  .scorepad::before { inset-inline-start: var(--space-8); }
  .scorepad__line { font-size: var(--text-xl); gap: var(--space-2); padding-inline: var(--space-2); }
  .winner-line { font-size: var(--text-2xl); }
  .winner-note { font-size: var(--text-body); }
}
.table-layout--result .seat { --seat-score: var(--text-3xl); }
.table-layout--result .seat__score { font-size: var(--text-3xl); }

.share-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); justify-items: center; text-align: center; padding: var(--space-8) var(--space-6); background: var(--paper); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet); color: var(--ink); inline-size: min(100%, 30rem); overflow: hidden; }
.share-card__logo { block-size: 4.5rem; inline-size: auto; }
.share-card__score { display: flex; align-items: baseline; gap: var(--space-3); font: var(--weight-display) var(--text-4xl) / 1 var(--font-head); direction: ltr; }
.share-card__score .sep { font-size: var(--text-title); color: var(--ink-3); }
.share-card__teams { display: flex; justify-content: center; gap: var(--space-6); font-weight: var(--weight-strong); }
.share-card__art { inline-size: calc(100% + var(--space-12)); margin-inline: calc(var(--space-6) * -1); margin-block-end: calc(var(--space-8) * -1); aspect-ratio: 16 / 5; object-fit: cover; border-block-start: var(--border-3) solid var(--paper-edge); }


/* ==========================================================================
   20. Local theme scopes
   brand-tokens.css switches theme on :root only. The style guide shows both themes side by side,
   so this block repeats the brand token values on any element carrying data-theme (not :root).
   Values are copied from brand-tokens.css; if the tokens change, regenerate.
   ========================================================================== */
[data-theme="dark"]:not(:root) {
  color-scheme: dark;
  --color-bg: #1C1512; --color-surface: #281E19; --color-raised: #35281F; --color-border: #86705E; --color-border-subtle: #4A3A2F;
  --color-text: #F7EDDC; --color-text-2: #D8C8B2; --color-text-3: #B0A08A; --color-brand: #F4AE3D; --color-brand-press: #D98F1E; --color-brand-text: #F4AE3D;
  --color-on-brand: #1C1512; --color-focus: #F7EDDC; --color-disabled: #85745F; --color-team1: #F65F82; --color-on-team1: #1C1512; --color-team2: #4CCDD3; --color-on-team2: #1C1512;
  --color-success: #8ED6A8; --color-warning: #FFE08A; --color-danger: #FF8F6B;
  --color-tile-200: #FBF4E6; --color-tile-400: #F0CF8C; --color-tile-600: #F4AE3D; --color-on-tile: #1C1512; --color-tile-edge: #1C1512;
  --color-scrim: rgba(28, 21, 18, 0.78);
  --shadow-seat: 0 8px 0 rgba(0, 0, 0, 0.28); --shadow-tile: 0 5px 0 rgba(0, 0, 0, 0.35); --shadow-press: 0 2px 0 rgba(0, 0, 0, 0.35); --shadow-sheet: 0 12px 0 rgba(0, 0, 0, 0.30); --shadow-lift: 0 8px 0 rgba(0, 0, 0, 0.35);
  --focus-page: #F7EDDC;
  background: var(--color-bg); color: var(--color-text);
}
[data-theme="light"]:not(:root) {
  color-scheme: light;
  --color-bg: #FBF3E4; --color-surface: #FFFAF0; --color-raised: #F0E3CC; --color-border: #86705E; --color-border-subtle: #DCCBB0;
  --color-text: #2A1F1A; --color-text-2: #5C4A3E; --color-text-3: #6E5B4D; --color-brand: #F4AE3D; --color-brand-press: #D98F1E; --color-brand-text: #8A4F00;
  --color-on-brand: #2A1F1A; --color-focus: #2A1F1A; --color-disabled: #8C7B69; --color-team1: #A81F40; --color-on-team1: #FFFAF0; --color-team2: #0B6F78; --color-on-team2: #FFFAF0;
  --color-success: #2E6B47; --color-warning: #7A5200; --color-danger: #A8401D;
  --color-tile-200: #FFFAF0; --color-tile-400: #F0CF8C; --color-tile-600: #F4AE3D; --color-on-tile: #2A1F1A; --color-tile-edge: #2A1F1A;
  --color-scrim: rgba(42, 31, 26, 0.62);
  --shadow-seat: 0 8px 0 rgba(42, 31, 26, 0.16); --shadow-tile: 0 5px 0 rgba(42, 31, 26, 0.20); --shadow-press: 0 2px 0 rgba(42, 31, 26, 0.20); --shadow-sheet: 0 12px 0 rgba(42, 31, 26, 0.18); --shadow-lift: 0 8px 0 rgba(42, 31, 26, 0.20);
  --focus-page: #2A1F1A;
  background: var(--color-bg); color: var(--color-text);
}
/* the paper and night scopes re-read tokens, so re-assert them after a local theme (custom properties resolve per element) */
[data-theme]:not(:root) { --paper: var(--color-tile-200); --paper-edge: var(--color-tile-edge); }


/* ==========================================================================
   21. RTL, TV tier, landscape phone, reduced motion, forced colours
   ========================================================================== */
[dir="rtl"] .arrow-flip, [dir="rtl"] .icon.flip-rtl { transform: scaleX(-1); }

/* TV tier: root font-size is scaled by brand-tokens.css (1.25 from 1600px, or .tv / data-tier="tv").
   Everything here is in rem, so it follows. Only a few things need a nudge. */
:root.tv .site-header__inner, :root[data-tier="tv"] .site-header__inner { min-block-size: calc(var(--header-h) * 1.1); }
@media (min-width: 1600px) { .qcard { --qcard-max: 64rem; } }
:root.tv .qcard, :root[data-tier="tv"] .qcard { --qcard-max: 64rem; }
:root.tv :focus-visible, :root[data-tier="tv"] :focus-visible { outline-width: calc(var(--focus-width) * 1.34); }

/* landscape phone (844 x 390): seats stay flanked, narrow; six category trays across; every tile still 44px */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --seat-w: 7.25rem; --crow-h: 2.5rem; --header-h: 2.75rem; --board-cols: 6; --tile-h: var(--tap-min); --timer-size: 5rem; --thumb-w: var(--space-8); --perch-h: calc(var(--crow-h) + var(--space-1)); }
  .site-footer { display: none; }
  .table-layout { grid-template-columns: var(--seat-w) minmax(0, 1fr) var(--seat-w); grid-template-areas: "s1 center s2"; gap: var(--space-2); padding-inline: var(--space-3); padding-block-end: var(--space-2); }
  .table-layout > .seat { position: sticky; inset-block-start: calc(var(--header-h) + var(--perch-h) + var(--space-2)); }
  .seat { border-radius: var(--radius-m); }
  .seat__band { font-size: var(--text-xs); padding-block: var(--space-1); }
  .seat__body { gap: var(--space-1); padding: var(--space-2) var(--space-1); }
  .seat__name { font-size: var(--text-s); padding-block-end: var(--space-1); }
  .seat__score { font-size: var(--text-l); }
  .seat .turn-pill { font-size: var(--text-xs); padding-inline: var(--space-2); min-block-size: var(--space-6); }
  .board { gap: var(--space-1); }
  .cat { padding: var(--space-1); gap: var(--space-1); }
  .cat__head { grid-template-columns: 1fr; padding: var(--space-1); min-block-size: 3rem; box-shadow: none; }
  .cat__head .plate { display: none; }
  .cat__name { font-size: var(--text-xs); text-align: center; line-height: 1.15; }
  .cat__lanes { display: none; }
  .cat__tiles { gap: var(--space-1); }
  .tile { font-size: var(--text-s); box-shadow: var(--shadow-press); border-radius: var(--radius-xs); }
  .tile .tally { display: none; }
  .tile__glyph { display: none; }
  .turn-line { min-block-size: var(--space-8); font-size: var(--text-m); }
  .dock { padding-block: var(--space-1); }
  .qcard__face { min-block-size: 0; padding: var(--space-4) var(--space-6); gap: var(--space-2); }
  .qcard__text { font-size: var(--text-m); }
  .timer { inset-inline-end: var(--space-3); inset-block-start: calc(var(--timer-size) * -0.2); }
  .qcard__meta { margin-block-start: 0; padding-inline-end: calc(var(--timer-size) * 0.9); }
  .media__frame { aspect-ratio: 21 / 9; }
  .hero { padding-block: var(--space-4); }
}

/* LANDSCAPE PHONE BOARD (fix 1; board.html and question.html carry .table-layout--bar): the two seats become slim bars above the board with the count and the turn line
   between them; six trays across the full width (tiles about 58 x 44), the dock under the board. Fits 844 x 390 without scrolling.
   The tile lane glyph comes back (tiles are wide enough), the "Team 1/2" band text is dropped (name, colour and glyph carry it). */
@media (max-height: 500px) and (orientation: landscape) {
  .table-layout--bar { --crow-h: 1.75rem; --perch-h: calc(var(--crow-h) + var(--space-1)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(11rem, 1.4fr) minmax(0, 1fr); grid-template-areas: "s1 head s2" "s1 turn s2" "note note note" "board board board" "dock dock dock"; grid-template-rows: auto auto auto minmax(min-content, 1fr) auto; gap: var(--space-1) var(--space-2); align-items: stretch; block-size: calc(100dvh - var(--fit-top, var(--header-h))); padding: var(--perch-h) var(--space-3) var(--space-1); }
  .table-layout--bar > .table-center { display: contents; }
  .table-layout--bar > .seat { position: relative; inset-block-start: auto; grid-row: 1 / span 2; flex-direction: row; align-items: stretch; min-block-size: var(--tap-min); border-radius: var(--radius-m); }
  .table-layout--bar > .seat--1 { grid-area: 1 / 1 / span 2 / 2; } .table-layout--bar > .seat--2 { grid-area: 1 / 3 / span 2 / 4; }
  .table-layout--bar .seat__band { flex: none; padding: 0 var(--space-2); border-block-end: 0; border-inline-end: var(--border-2) dashed var(--paper-edge); border-start-start-radius: calc(var(--radius-m) - var(--border-3)); border-start-end-radius: 0; border-end-start-radius: calc(var(--radius-m) - var(--border-3)); }
  .table-layout--bar .seat__band > span:not(.glyph) { display: none; }
  .table-layout--bar .seat__body { flex: 1; min-inline-size: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "won score"; align-items: center; justify-items: start; column-gap: var(--space-2); row-gap: 0; padding: var(--space-1) var(--space-2); text-align: start; }
  .table-layout--bar .seat__name { grid-area: name; padding: 0 0 var(--space-1); max-inline-size: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: var(--weight-strong) var(--text-s) / 1.15 var(--font-body); }
  .table-layout--bar .seat__name::after { inset-inline: 0; }
  .table-layout--bar .seat__score { grid-area: score; font-size: var(--text-l); }
  .table-layout--bar .seat .turn-pill, .table-layout--bar .seat__won, .table-layout--bar .seat__unit { display: none; }
  .table-layout--bar .seat__won-count { grid-area: won; display: block; margin: 0; font-size: var(--text-xs); line-height: 1.1; color: var(--ink-2); }
  .table-layout--bar .board-head { grid-area: head; display: flex; justify-content: center; align-self: end; }
  .table-layout--bar .board-count { font-size: var(--text-xs); line-height: 1.1; }
  .table-layout--bar .turn-line { grid-area: turn; align-self: start; min-block-size: 0; font-size: var(--text-s); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* one line: there is no room for a second, and the seat already shows the full name */
  .table-layout--bar .state-note, .table-layout--bar .coach { grid-area: note; display: flex; padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
  .table-layout--bar .state-note[hidden], .table-layout--bar .coach[hidden] { display: none; }
  .table-layout--bar .coach__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--space-3); list-style-position: inside; padding-inline-start: 0; font-size: var(--text-xs); margin: 0; }
  .table-layout--bar .coach .alert__actions { margin-block-start: var(--space-1); }
  .table-layout--bar .state-note > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
  .table-layout--bar .state-note .alert__title, .table-layout--bar .state-note .alert__body { display: inline; }
  .table-layout--bar .board { grid-area: board; grid-template-rows: minmax(0, 1fr); gap: var(--space-1); }
  .table-layout--bar .cat { grid-template-rows: auto minmax(0, 1fr); }
  .table-layout--bar .cat__head { min-block-size: 2.25rem; }
  .table-layout--bar .cat__name { font-size: var(--text-s); }
  .table-layout--bar .cat__tiles { grid-template-rows: repeat(3, minmax(var(--tap-min), 1fr)); }
  .table-layout--bar .tile { font-size: var(--text-m); }
  .table-layout--bar .tile__glyph { display: block; font-size: 0.625rem; inset-block: 3px auto; inset-inline-end: 3px; }   /* top corner: at the bottom it sat on the numeral */
  .table-layout--bar .dock { grid-area: dock; padding: 0 var(--space-3); gap: var(--space-1) var(--space-2); }
  .table-layout--bar .dock::before, .table-layout--bar .dock::after { display: none; }
  .table-layout--bar .dock .btn { padding-inline: var(--space-3); }
  /* the dock stays one row, even under 720 px wide (iPhone SE, 667 px), where the base rule lets it wrap to two */
  .table-layout--bar .dock:not(#q-dock), .table-layout--bar .dock:not(#q-dock) .dock__group { flex-wrap: nowrap; }
  .table-layout--bar .dock .btn { flex: 0 0 auto; white-space: nowrap; }
  /* the question dock has five buttons and may wrap; "Pass to <long team name>" is cut short instead of crowding the others */
  #q-dock .dock__act { max-inline-size: 15rem; }
  #q-dock .dock__act > span { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
  /* a phone browser's own bars take 40 to 60 px of a 375 to 430 px landscape screen, so during play the site header steps aside
     and the table gets the whole height (the dock has Home). fitBoard() re-measures --fit-top on every screen change. */
  html[data-screen="question"] .site-header { display: none; }   /* the board keeps it (mockup design, at the end of this file) */
}
/* the narrowest landscape phones (iPhone SE, 667 px): a tray is about 100 px wide, so a 16 px category name wraps and the two-line
   head pushes the dock off a 320 px tall screen. One size down keeps "Food & Drink" on one line. */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 759px) {
  .table-layout--bar .cat__name { font-size: 0.8125rem; }
  .table-layout--bar .cat__head { min-block-size: 2rem; padding-inline: 2px; }
}
/* very short landscape screens (a phone browser's bars showing): tiles drop from 44 to 40 px tall so the dock stays on screen */
@media (max-height: 340px) and (orientation: landscape) {
  .table-layout--bar .cat__tiles { grid-template-rows: repeat(3, minmax(2.5rem, 1fr)); }
  .table-layout--bar .tile { min-block-size: 2.5rem; }
}

/* reduced motion: the media query sets --motion-scale to 0 (brand-tokens.css), so every token duration is instant.
   Fixed-length things are handled here. The reveal beat is stillness, not motion: it stays and is skippable. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation: none; border-inline-end-color: currentColor; border-block-end-color: transparent; }
  .seat.is-clinking { outline: var(--border-3) solid var(--paper-edge); outline-offset: var(--space-1); }
  .seat.is-clinking .perch__slot--win { animation: none; }
  .seat.is-clinking .seat__ripple { animation: none; }
  .answer__circle path { transition: none; stroke-dashoffset: 0; }
  .qcard__inner { transition: none; }
}

/* forced colours (Windows high contrast): keep borders, drop shadows, keep the shapes */
@media (forced-colors: active) {
  .tile, .seat, .award, .qcard__face, .cat-card__face, .pack, .btn, .chip, .step, .dialog { border-color: CanvasText; forced-color-adjust: none; background: Canvas; color: CanvasText; }
  .tile[data-state="used"] { border-style: dashed; }
  .timer__arc { stroke: Highlight; }
  .seat__name::after { background: Highlight; }
}

/* ==========================================================================
   22. Live-app additions (not in the mock)
   ========================================================================== */
/* Party / University switch as two real links (the mock uses radios; the live header navigates) */
.segmented__link {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-block-size: calc(var(--tap-min) - var(--space-2) - var(--border-2) * 2 + var(--space-2)); padding-inline: var(--space-3);
  border-radius: var(--radius-pill); font-weight: var(--weight-strong); color: var(--color-text-2); white-space: nowrap; text-decoration: none;
}
.segmented__link .icon--on { display: none; }
.segmented__link:hover { background: var(--color-raised); color: var(--color-text); }
.segmented__link[aria-current="page"] { background: var(--color-brand); color: var(--color-on-brand); box-shadow: var(--shadow-press); }
.segmented__link[aria-current="page"] .icon--on { display: inline-block; }
@media (min-width: 960px) and (max-width: 1799px) { .nav-tools .mode-switch .segmented__link { padding-inline: var(--space-2); } }

/* flashed messages under the header */
.flashes { display: grid; gap: var(--space-3); padding-block-start: var(--space-4); }

/* ==========================================================================
   23. Game screens, stage A: the play page shell, setup, preload, active-game choice
   Source: design-lab/04-ui/direction-b-table/setup.html (page <style>).
   <html data-screen="setup|preload|choice|board|question|gameover|fw-round"> is set by play.html and showScreen(); the rules that
   differ per screen key on it. The play page loads kc.css only (the legacy static/style.css is gone from it).
   ========================================================================== */
.hidden { display: none !important; }

/* ---- 23.1 shell ---- */
/* the base template puts flashed messages in <main>; the board has to fit one screen, so a flash from the page before is not shown over the table */
html:is([data-screen="board"], [data-screen="question"], [data-screen="gameover"], [data-screen="fw-round"]) .flashes { display: none; }

/* ---- 23.2 inputs on the paper team cards ---- */
.teamcard .input { background: #FFFDF8; color: var(--ink); border-color: var(--ink-rule); }
.teamcard .input:hover { border-color: var(--ink); }
.teamcard .input[aria-invalid="true"] { border-color: var(--ink-danger); }

/* ---- 23.3 setup ---- */
.setup { --aside-w: 23rem; }
.setup__head { margin-block-end: var(--space-6); max-inline-size: 44rem; }
.setup__layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside-w); gap: var(--space-8); align-items: start; }
.setup__main { display: grid; gap: var(--space-6); min-inline-size: 0; }
.setup__aside { position: sticky; inset-block-start: calc(var(--header-h) + var(--space-4)); min-inline-size: 0; }

/* step cards: printed cards on the table */
.step-card { background: var(--color-surface); border: var(--border-2) solid var(--color-border-subtle); border-radius: var(--radius-card); padding: var(--space-6); display: grid; gap: var(--space-4); }
.step-card__title { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-heading); }
.step-card__no { display: inline-grid; place-items: center; flex: none; inline-size: var(--space-10); block-size: var(--space-10); border-radius: 50%; background: var(--paper); color: var(--ink); border: var(--border-2) solid var(--paper-edge); box-shadow: var(--shadow-press); font-family: var(--font-head); font-size: var(--text-l); }
.step-card__note { color: var(--color-text-2); margin-block-start: calc(var(--space-2) * -1); }
.night-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: var(--space-6); align-items: start; }

/* team place cards */
.team-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.teamcard { background: var(--paper); color: var(--ink); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); overflow: hidden; }
.teamcard__band { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); font-weight: var(--weight-strong); font-size: var(--text-m); }
.teamcard--1 .teamcard__band { background: var(--color-team1); color: var(--color-on-team1); }
.teamcard--2 .teamcard__band { background: var(--color-team2); color: var(--color-on-team2, var(--color-on-team1)); }
.teamcard__band .glyph { font-size: 1.3em; }
.teamcard__body { padding: var(--space-4); }
.teamcard .field__label { color: var(--ink); }
.teamcard .field__hint { color: var(--ink-2); }
.teamcard .input::placeholder { color: var(--ink-3); }
.teamcard .field__error { color: var(--ink-danger); }

/* category progress, filters */
.cat-progress { display: flex; align-items: center; gap: var(--space-4); }
.cat-progress__count { font-weight: var(--weight-strong); white-space: nowrap; }
.cat-progress { flex-wrap: wrap; }
.cat-progress__random { margin-inline-start: auto; }
.cat-random-why { color: var(--color-text-2); margin-block: var(--space-2) 0; }
.mini-bar { flex: 1 1 auto; max-inline-size: 14rem; block-size: var(--space-2); background: var(--color-raised); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-pill); overflow: hidden; }
.mini-bar__fill { block-size: 100%; background: var(--color-brand); border-radius: var(--radius-pill); transition: width var(--dur-2) var(--ease-set); }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-4); align-items: end; }
.filters__count { color: var(--color-text-2); min-block-size: 1.5em; }
.cat-fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.cat-fieldset .cat-grid { --art-ratio: 5 / 3; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); align-items: stretch; }
.cat-fieldset .cat-card { display: flex; }
.cat-fieldset .cat-card__face { inline-size: 100%; align-content: start; }
.cat-card__meta .badge { white-space: nowrap; font-size: var(--text-xs); padding-block: 0; background: transparent; color: var(--ink-2); border-color: var(--ink-rule); }
.cat-card__meta .badge--info { color: var(--ink-brand); border-color: var(--ink-brand); }
.cat-card__input:checked + .cat-card__face .badge { color: var(--ink); border-color: var(--ink); }
.cat-card.has-problem .cat-card__face { border-color: var(--ink-danger); border-width: var(--border-3); border-style: dashed; }
.cat-card.has-problem .cat-card__why { display: flex; align-items: center; gap: var(--space-1); color: var(--ink); }
.cat-card.has-problem .cat-card__why .icon { color: var(--ink-danger); flex: none; }
.cat-card.has-problem .cat-card__state { display: none; }
.cat-card__input:disabled + .cat-card__face .cat-card__why:empty { display: none; }
.plate--fallback { text-transform: uppercase; }
.nomatch { padding: var(--space-6); border: var(--border-2) dashed var(--color-border); border-radius: var(--radius-card); display: grid; gap: var(--space-3); justify-items: start; }
.alert__actions { margin-block-start: var(--space-3); }

/* summary place card */
.summary { background: var(--paper); color: var(--ink); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-seat); padding: var(--space-5); display: grid; gap: var(--space-4); --color-text: var(--ink); --color-text-2: var(--ink-2); --color-border: var(--ink-rule); --color-brand-text: var(--ink-brand); }
.summary__title { font-size: var(--text-heading); }
.summary__recap { display: grid; gap: var(--space-2); margin: 0; }
.summary__recap > div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: var(--space-2); align-items: baseline; }
.summary__recap dt { color: var(--ink-2); font-size: var(--text-s); }
.summary__recap dd { margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-weight: var(--weight-strong); overflow-wrap: anywhere; }
.summary .team-badge .glyph { font-size: 1.1em; }
.summary .team-badge--1 { --glyph-color: var(--ink-team1); }
.summary .team-badge--2 { --glyph-color: var(--ink-team2); }
.summary .badge--free { background: var(--color-brand); color: var(--color-on-brand); border-color: var(--paper-edge); font-size: var(--text-xs); }
.summary .meter__seg { border-color: var(--ink-rule); color: var(--ink-3); }
.summary .meter__seg[data-on] { background: var(--color-tile-400); border-color: var(--paper-edge); color: var(--ink); }
.summary .meter[data-full] .meter__seg[data-on] { background: var(--color-tile-600); }
.summary .meter__text span:last-child { color: var(--ink-2); }
.picked { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.picked:empty { display: none; }
.picked li { display: inline-flex; align-items: center; gap: var(--space-1); padding-inline: var(--space-3) var(--space-1); min-block-size: var(--space-8); background: var(--paper-sunk); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-pill); font-size: var(--text-s); font-weight: var(--weight-strong); }
.picked button { display: inline-grid; place-items: center; inline-size: var(--tap-min); block-size: var(--tap-min); margin-block: calc((var(--tap-min) - var(--space-8)) / -2); padding: 0; background: none; border: 0; color: var(--ink); border-radius: 50%; cursor: pointer; }
.picked button:hover { background: var(--paper-rule); }
.picked button:focus-visible { outline: var(--focus-width) solid var(--ink-focus); outline-offset: calc(var(--focus-width) * -1); }
.picked .icon { inline-size: var(--icon-s); block-size: var(--icon-s); }
.balance-line { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border: var(--border-2) dashed var(--ink-rule); border-radius: var(--radius-m); }
.balance-line .icon { color: var(--ink-brand); flex: none; }
.balance-line p { font-size: var(--text-s); }
.summary .alert { background: #FFFDF8; color: var(--ink); --alert-c: var(--ink-warning); }
.summary .alert--error { --alert-c: var(--ink-danger); }
.summary .alert__body, .summary .alert__body a { color: var(--ink); }
.summary .btn--secondary { --btn-bg: var(--paper); --btn-fg: var(--ink); --btn-edge: var(--ink-rule); }
.summary .link-btn { color: var(--ink-brand); }
.todo { font-size: var(--text-s); }
.todo:focus { outline: none; }
.todo:focus-visible { outline: var(--focus-width) solid var(--ink-focus); outline-offset: var(--focus-offset); border-radius: var(--radius-xs); }
.todo__head { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-strong); }
.todo ul { margin: var(--space-2) 0 0; padding-inline-start: var(--space-5); display: grid; gap: var(--space-1); list-style: disc; }
.todo[data-ok] .todo__head { color: var(--ink-success); }
.startbar { display: grid; gap: var(--space-3); }
.startbar__row { display: grid; gap: var(--space-3); }
.startbar__count { display: none; }
.startbar .btn { inline-size: 100%; }
.btn.is-disabled { cursor: not-allowed; }
.summary .btn--primary.is-disabled, .summary .btn--primary[disabled] { --btn-bg: var(--paper-sunk); --btn-fg: var(--ink-2); --btn-edge: var(--ink-rule); box-shadow: none; border-style: dashed; }
.summary .btn--primary.is-busy, .summary .btn--primary.is-busy[disabled] { --btn-bg: var(--color-brand); --btn-fg: var(--color-on-brand); --btn-edge: var(--color-on-brand); border-style: solid; cursor: progress; }
.tv-tip { display: flex; gap: var(--space-3); padding-block-start: var(--space-4); border-block-start: var(--border-2) dashed var(--ink-rule); }
.tv-tip .icon { color: var(--ink-brand); flex: none; }
.tv-tip h3 { font-size: var(--text-m); margin-block-end: var(--space-1); }
.tv-tip p { font-size: var(--text-s); color: var(--ink-2); }
.tv-tip__steps { margin-block-start: var(--space-2); font-size: var(--text-s); }
.tv-tip__steps summary { cursor: pointer; min-block-size: var(--tap-min); display: flex; align-items: center; color: var(--ink-brand); font-weight: var(--weight-strong); text-decoration: underline; text-underline-offset: 0.2em; }
.tv-tip__steps summary:focus-visible { outline: var(--focus-width) solid var(--ink-focus); outline-offset: var(--focus-offset); border-radius: var(--radius-xs); }
.tv-tip__steps ol { margin: 0; padding-inline-start: var(--space-5); display: grid; gap: var(--space-1); list-style: decimal; }
kbd { font-family: var(--font-body); padding: 0 var(--space-2); border: var(--border-2) solid var(--ink-rule); border-radius: var(--radius-xs); background: var(--paper-sunk); }
.todo__short { display: none; }

/* narrower: one column; the Start button becomes a sticky bar with the count */
@media (max-width: 62rem) {
  .setup__layout { grid-template-columns: minmax(0, 1fr); }
  .setup__aside { position: static; }
  .summary { padding-block-end: calc(var(--tap-min) * 2 + var(--space-8)); }
  .startbar { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: var(--z-sticky); background: var(--paper); color: var(--ink); border-block-start: var(--border-3) solid var(--paper-edge); padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 0 rgba(0, 0, 0, 0.18); gap: var(--space-2); }
  .startbar__row { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .startbar__count { display: block; font-size: var(--text-s); line-height: 1.2; }
  .startbar__count b { font-family: var(--font-head); font-size: var(--text-xl); }
  .startbar__count span { display: block; color: var(--ink-2); }
  .startbar .btn--lg { padding-inline: var(--space-4); }
  .todo { font-size: var(--text-xs); }
  .todo ul { display: none; }
  .todo__short { display: inline; }
  .todo__long { display: none; }
  .startbar .alert { padding: var(--space-2) var(--space-3); font-size: var(--text-s); }
  .startbar .alert__actions { margin-block-start: var(--space-1); }
}
@media (max-width: 40rem) {
  .night-grid, .team-pair, .filters { grid-template-columns: minmax(0, 1fr); }
  .step-card { padding: var(--space-4); }
  .cat-fieldset .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
}
/* landscape phone: compact bar */
@media (max-height: 30rem) and (min-width: 40rem) and (max-width: 62rem) {
  .startbar { grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem); align-items: center; column-gap: var(--space-4); row-gap: var(--space-1); padding-block: var(--space-2); }
  .startbar > .alert, .startbar > .todo { grid-column: 1; }
  .startbar__row { grid-column: 2; grid-row: 1 / span 2; }
  .startbar .alert { padding-block: var(--space-1); }
  .summary { padding-block-end: calc(var(--tap-min) + var(--space-8)); }
}

/* ---- 23.4 preload and active-game choice: one calm card in the middle ---- */
.play-center { display: grid; place-items: center; min-block-size: calc(100dvh - var(--header-h)); padding: var(--space-6) var(--gutter); }
.wait-card { inline-size: 100%; max-inline-size: 34rem; display: grid; justify-items: center; gap: var(--space-4); padding: var(--space-8) var(--space-6); text-align: center; background: var(--color-surface); border: var(--border-2) solid var(--color-border-subtle); border-radius: var(--radius-card); box-shadow: var(--shadow-tile); }
.wait-card__title, .choice-card h1 { font-size: var(--text-title); }
.wait-card__count { display: grid; gap: var(--space-2); justify-items: center; inline-size: 100%; }
.wait-card__count .t-lead { margin: 0; }
.mini-bar--wide { inline-size: 100%; max-inline-size: none; block-size: var(--space-3); }
.spinner--l { inline-size: var(--space-10); block-size: var(--space-10); color: var(--color-brand-text); }
/* The group animation replaces the spinner when at least one of tonight's picked Groups has a clip
   (preloadAnim in static/script.js toggles both [hidden] states); two stacked <video>s cross-fade so the
   clip for one group dissolves into the next rather than cutting. */
.preload-anim { position: relative; inline-size: 12rem; aspect-ratio: 1 / 1; border-radius: var(--radius-card); overflow: hidden; background: var(--paper); box-shadow: var(--shadow-tile); }
.preload-anim__clip { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; opacity: 0; transition: opacity 0.7s ease; }
.preload-anim__clip.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .preload-anim__clip.is-active { transition: none; } }
.choice-card__name { overflow-wrap: anywhere; }
.choice-card__actions { justify-content: center; }
@media (max-width: 40rem) { .wait-card { padding: var(--space-6) var(--space-4); } .choice-card__actions .btn { inline-size: 100%; } }
.cat-grid > .alert { grid-column: 1 / -1; }

/* ==========================================================================
   24. Game board, stage B1: the one-screen table (seats, trays, dock, dialogs)
   Source: design-lab/04-ui/direction-b-table/board.html (page <style>). The seat, tray, tile, dock and .table-layout--fit/--bar
   rules are sections 12, 13 and 15 above; the markup is in templates/play.html (#board-container) and static/script.js (_buildCatCard).
   ========================================================================== */
.board-screen { padding: 0; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-5); }
.board-head .board-title { margin: 0; text-align: start; text-transform: none; letter-spacing: normal; min-inline-size: 0; overflow-wrap: anywhere; font: var(--weight-strong) var(--text-m) / var(--leading-tight) var(--font-body); color: var(--color-text); }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.board-count { margin: 0; display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-s); color: var(--color-text-2); }
.board-count b { font-family: var(--font-head); font-size: var(--text-l); color: var(--color-text); font-variant-numeric: tabular-nums lining-nums; }
.board-count .progress { inline-size: clamp(6rem, 14vw, 11rem); }
.rule { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font-size: var(--text-s); color: var(--color-text-2); }
.rule .item { display: inline-flex; align-items: center; gap: var(--space-2); }
.rule b { color: var(--color-text); overflow-wrap: anywhere; }
.cat__lanes .ln-name { display: none; }
.cat__lanes > span { min-inline-size: 0; max-inline-size: 100%; }
@media (min-width: 900px) {
  .cat__lanes .ln-n { display: none; }
  .cat__lanes .ln-name { display: block; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; font-weight: var(--weight-strong); font-size: var(--text-xs); white-space: nowrap; }
}
.dock .dock__sep { display: none; }
.rules-list { margin: 0; padding-inline-start: 1.5rem; list-style: decimal; display: grid; gap: var(--space-3); color: var(--ink); }
.rules-list bdi { font-weight: var(--weight-strong); }
/* the save chip: neutral while saving, success when saved, warning when the save did not go through (words and icon, not colour alone) */
#board-save-chip { --badge-c: var(--color-text-2); }
#board-save-chip.badge--success { --badge-c: var(--color-success); }
#board-save-chip.badge--warn { --badge-c: var(--color-warning); }
#board-save-chip[data-state="error"] { border-style: dashed; }
/* seats: a team name never pushes the card wider; the unit under the score stays small */
.seat__name bdi { display: inline; }
.seat__won-title .num { font-size: var(--text-m); color: var(--ink); }
.dock .btn[aria-disabled="true"] { cursor: not-allowed; }
/* a tile that cannot be picked (the other lane, or already played) does not lift under the pointer */
#board-grid .tile[aria-disabled="true"]:hover:not(:disabled), #board-grid .tile[aria-disabled="true"]:active:not(:disabled) { transform: translateY(var(--space-1)); }
#board-grid .tile[data-state="used"]:hover:not(:disabled), #board-grid .tile[data-state="used"]:active:not(:disabled) { transform: none; }

/* landscape phone: only what the bar layout needs (the count and the turn line stay, the title, legend and progress bar go) */
@media (max-height: 500px) and (orientation: landscape) {
  .board-head .board-title, .rule, .board-count .progress, .board-meta { display: none; }
  .board-head { gap: var(--space-1) var(--space-3); }
  .board-count b { font-size: var(--text-m); }
}
/* notes on the board sit in the empty corner under the second seat, so they never cover the dock */
@media (min-width: 900px) and (min-height: 501px) {
  #board-toasts { inset-inline-end: var(--tv-safe); inline-size: clamp(10rem, 14.5vw, 15rem); }
}
/* small screens: notes drop in under the header, so they never cover the dock or the tiles being picked */
@media (max-width: 899px), (max-height: 500px) and (orientation: landscape) {
  #board-toasts { inset-block-start: calc(var(--header-h) + var(--space-2)); inset-block-end: auto; }
}
/* a note on the board is only a note: it never takes a tap away from the tile or dock button under it */
#board-toasts .toast { pointer-events: none; }
/* landscape phone: the board dialogs have to fit 390 px of height without scrolling inside themselves */
@media (max-height: 500px) and (orientation: landscape) {
  #board-container .dialog__head { padding: var(--space-3) var(--space-5) 0; }
  #board-container .dialog__body { padding: var(--space-2) var(--space-5) var(--space-2); gap: var(--space-2); }
  #board-container .dialog__foot { padding: var(--space-2) var(--space-5) var(--space-3); }
  .rules-list { gap: var(--space-1); font-size: var(--text-s); line-height: 1.3; }
}


/* ==========================================================================
   25. Question screen, stage B2: the card on the shared table
   Source: design-lab/04-ui/direction-b-table/question.html (page style block) and DESIGN-NOTES.md sections 8 and 10.
   The component rules (the card, the ring, awards, dock, media frame, lightbox, dialogs) are sections 14 to 17 above; this section holds what the live
   page adds: the shared stage (#board-screen holds the two seats and two centre panels, #board-container and #question-container), the media players
   inside the card, the paused veil and the report dialog steps. Markup: templates/play.html. Behaviour: static/script.js (QUESTION SCREEN, TIMER).
   ========================================================================== */

/* ---- 25.1 the centre panel ---- */
.qpanel { --qcard-max: 68rem; align-content: start; }
.gamebar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.qpanel .turn-line { margin: 0; }
.qpanel .stage .qcard { margin-block: var(--space-4); }
.awards { order: 2; } .dock { order: 3; } .hostnote { order: 4; }
.awards[hidden] { display: none; }
.dock [hidden], .dock [hidden].btn { display: none; }
.hostnote { display: flex; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; margin: 0; }
.hostnote .icon { flex: none; }
/* the dock after the reveal: only Report and Back to the board stay (the awards are above) */
.qpanel[data-face="back"] .dock__act, .qpanel[data-face="back"] .dock__sep, .qpanel[data-face="back"] #q-pause-btn, .qpanel[data-face="back"] .hostnote { display: none; }
.qpanel[data-timer="off"] #q-pause-btn { display: none; }
/* tall media (a Wordle grid, a map) take the room the note would use */
.qpanel:is([data-kind="wordle"], [data-kind="streetview"]) .hostnote { display: none; }
.lbl-resume { display: none; }
#q-pause-btn[aria-pressed="true"] .lbl-pause { display: none; }
#q-pause-btn[aria-pressed="true"] .lbl-resume { display: inline; }
#q-pause-btn[disabled] { opacity: 0.55; }
.qcard[data-timer="off"] .timer { display: none; }
.qcard[data-timer="off"] { grid-template-columns: minmax(0, 1fr); }
.qcard[data-timer="off"] .qcard__meta { padding-inline-end: 0; margin-block-start: 0; }
.qpanel[data-timer="off"] .awards { inline-size: min(100%, var(--qcard-max)); }

/* the two seats during a question: the team on the clock is the active one; in a steal it wears the Steal pill */
.seat:not([data-stealing]) .turn-pill--steal { display: none; }
.seat[data-stealing] .turn-pill--turn { display: none; }
.seat[data-stealing] .turn-pill--steal { background: transparent; color: var(--ink); border-color: var(--ink); }
.seat:not([data-active]) .turn-pill--steal { visibility: hidden; }

/* ---- 25.2 the card's body: text, and media beside it (a picture, a clip, a video) or under it (a grid, a map, a QR code) ---- */
.qbody { display: grid; gap: var(--space-5); align-items: center; }
.qbody .media { display: grid; gap: var(--space-3); min-inline-size: 0; }
.qbody[data-kind="text"] .media { display: none; }
.qbody .qcard__text { max-inline-size: 28ch; margin: 0; }
.qbody[data-kind="text"] .qcard__text, .qbody[data-kind="wordle"] .qcard__text, .qbody[data-kind="qr"] .qcard__text, .qbody[data-kind="streetview"] .qcard__text { max-inline-size: 34ch; }
@media (min-width: 640px) {
  .qbody:is([data-kind="image"], [data-kind="audio"], [data-kind="video"]) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-8); }
  .qbody[data-kind="text"] .qcard__text { font-size: calc(var(--text-question) * 1.12); }
}
.qimg { inline-size: 100%; block-size: 100%; object-fit: contain; cursor: zoom-in; }
.media__frame.hidden { display: none !important; }

/* players: each sits on its own dark panel inside the paper card (audio, video, a YouTube clip, Wordle, Street View) */
#audio-area, #video-area, #yt-area, #wordle-area, #streetview-area {
  margin: 0; inline-size: 100%; min-inline-size: 0; padding: var(--space-4);
  background: var(--night-bg); color: var(--night-text); border: var(--border-2) solid var(--paper-edge); border-radius: var(--radius-m); text-align: center;
}
#video-area, #yt-area { padding: 0; overflow: hidden; }
.audio-player-shell { display: grid; gap: var(--space-3); justify-items: center; }
.audio-play-btn { min-block-size: var(--tap-min); min-inline-size: 9rem; }
.audio-progress-wrap { inline-size: 100%; display: grid; gap: var(--space-1); }
.audio-progress { inline-size: 100%; accent-color: var(--night-brand); background: none; cursor: pointer; }
.audio-time-row { display: flex; justify-content: space-between; direction: ltr; font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--night-text-2); }
.audio-preview-hint { margin: 0; color: var(--night-text-2); }
.streetview-note { padding: var(--space-6); text-align: center; }

/* video: a clip file, or a YouTube clip behind a cover and masks so the player's own title and controls never show */
.video-preview-shell { position: relative; inline-size: 100%; background: #000; overflow: hidden; }
.q-video { display: block; inline-size: 100%; max-inline-size: 100%; background: #000; }
.q-yt-frame { display: block; inline-size: 100%; max-inline-size: 100%; aspect-ratio: 16 / 9; background: #000; border: 0; }
.youtube-player-wrap { position: relative; inline-size: 100%; padding-block-start: 56.25%; overflow: hidden; background: #000; }
.youtube-player { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; z-index: 1; }
.youtube-interaction-blocker { position: absolute; inset: 0; z-index: 2; background: transparent; cursor: pointer; }
.youtube-interaction-blocker::after {   /* the play / pause flash */
  content: attr(data-icon); position: absolute; inset-block-start: 50%; inset-inline-start: 50%; translate: -50% -50%;
  inline-size: 4.5rem; block-size: 4.5rem; display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 2.2rem; opacity: 0; pointer-events: none;
}
.youtube-interaction-blocker.flash-icon::after { animation: yt-flash calc(0.55s * var(--motion-scale, 1)) ease-out forwards; }
@keyframes yt-flash { 0% { opacity: 0.92; scale: 0.75; } 100% { opacity: 0; scale: 1.5; } }
.youtube-cover { position: absolute; inset: 0; z-index: 3; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.youtube-cover.hidden { display: none; }
.youtube-cover-inner { display: none; }
.video-preview-shell.is-audio-only .youtube-cover { background: radial-gradient(circle at 50% 45%, rgba(244, 174, 61, 0.2), transparent 40%), var(--night-bg); }
.video-preview-shell.is-audio-only .youtube-cover::before {   /* a record: the clip is sound only */
  content: ""; inline-size: 6.5rem; block-size: 6.5rem; border-radius: 50%; border: var(--border-2) solid var(--night-track);
  background: radial-gradient(circle, rgba(244, 174, 61, 0.35) 0 0.5rem, transparent 0.55rem), repeating-radial-gradient(circle, var(--night-track) 0 1px, transparent 2px 0.75rem);
}
/* songs: no picture to hide, so no masks; the record keeps its shape at any box height, and the label says what a tap does */
.video-preview-shell.is-audio-only :is(.youtube-title-mask, .youtube-bottom-mask) { display: none; }
.video-preview-shell.is-audio-only .youtube-cover { gap: var(--space-2); cursor: pointer; }
.video-preview-shell.is-audio-only .youtube-cover::before { flex: none; block-size: min(6.5rem, 55%); inline-size: auto; aspect-ratio: 1; }
.video-preview-shell.is-audio-only .youtube-cover-inner { display: block; }
.video-preview-shell.is-audio-only .youtube-cover-label { color: #F7EDDC; font: 700 clamp(0.95rem, 2.4vw, 1.25rem) var(--font-text); }
.youtube-title-mask, .youtube-bottom-mask { position: absolute; inset-inline: 0; block-size: 62px; background: #000; z-index: 4; pointer-events: none; }
.youtube-title-mask { inset-block-start: 0; }
.youtube-bottom-mask { inset-block-end: 0; }
/* full screen: the whole shell goes full screen, so the cover, masks and click-blocker come with it */
.video-fs-btn { z-index: 5; }
.video-fs-btn[hidden], .video-preview-shell.is-audio-only .video-fs-btn { display: none; }
.video-preview-shell:fullscreen { display: grid; place-items: center; inline-size: 100vw; block-size: 100vh; }
.video-preview-shell:fullscreen .youtube-player-wrap { padding-block-start: 0; inline-size: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; }

/* Wordle: six rows of five, then the keys. Colour is not the only cue: a letter in the word but in the wrong place has a dashed edge. */
.wordle-area { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-2); }
#wordle-area { padding: var(--space-2); }
.wordle-board { display: flex; flex-direction: column; align-items: center; gap: clamp(3px, 0.6vh, 6px); }
.wordle-row { display: flex; gap: clamp(3px, 0.6vh, 6px); }
.wordle-tile {
  inline-size: clamp(1.75rem, 3.5vh, 3rem); block-size: clamp(1.75rem, 3.5vh, 3rem); display: grid; place-items: center;
  border: var(--border-2) solid var(--night-track); border-radius: var(--radius-xs); background: transparent; color: var(--night-text);
  font: var(--weight-display) clamp(1rem, 2.4vh, 1.6rem) / 1 var(--font-head); text-transform: uppercase;
  transition: background var(--dur-2) var(--ease-lean), border-color var(--dur-2) var(--ease-lean);
}
.wordle-tile.wordle-correct { background: var(--night-success); border-color: var(--night-success); color: var(--night-bg); }
.wordle-tile.wordle-present { background: var(--night-warning); border-color: var(--night-warning); border-style: dashed; color: var(--night-bg); }
.wordle-tile.wordle-absent { background: var(--night-raised); border-color: var(--night-raised); color: var(--night-text-2); }
.wordle-msg { min-block-size: 1.4em; margin: 0; font-weight: var(--weight-strong); color: var(--night-warning); }
.wordle-input-row { display: flex; justify-content: center; align-items: center; gap: var(--space-2); }
.wordle-input {
  inline-size: 9rem; min-block-size: var(--tap-min); padding: var(--space-1) var(--space-3); text-align: center; text-transform: uppercase; letter-spacing: 0.15em;
  background: var(--night-raised); color: var(--night-text); border: var(--border-2) solid var(--night-track); border-radius: var(--radius-s); font: inherit; font-size: var(--text-m);
}
.wordle-input:focus-visible { outline: var(--focus-width) solid var(--night-brand); outline-offset: var(--focus-offset); }
.wordle-keyboard { display: flex; flex-direction: column; align-items: center; gap: clamp(3px, 0.5vh, 5px); inline-size: 100%; }
.wordle-kb-row { display: flex; gap: clamp(3px, 0.5vh, 5px); }
.wordle-key {
  min-inline-size: clamp(1.75rem, 3vw, 2.4rem); min-block-size: clamp(2rem, 3.9vh, 2.5rem); padding-inline: var(--space-1);
  border: 0; border-radius: var(--radius-xs); background: var(--night-raised); color: var(--night-text); cursor: pointer;
  font: var(--weight-strong) clamp(0.75rem, 1.6vh, 0.95rem) / 1 var(--font-body);
}
.wordle-key:hover { background: var(--night-track); }
.wordle-key:focus-visible { outline: var(--focus-width) solid var(--night-brand); outline-offset: var(--focus-offset); }
.wordle-key-wide { min-inline-size: clamp(2.75rem, 5vw, 3.75rem); font-size: clamp(0.65rem, 1.3vh, 0.8rem); }
.wordle-key.wordle-correct { background: var(--night-success); color: var(--night-bg); }
.wordle-key.wordle-present { background: var(--night-warning); color: var(--night-bg); }
.wordle-key.wordle-absent { background: transparent; color: var(--night-text-2); box-shadow: inset 0 0 0 var(--border-1) var(--night-track); }
.wordle-area .btn { min-block-size: var(--tap-min); }
/* QR code card inside the question card (Silent Scan, Forbidden Words) */
/* Plant the Word: six identical tiles on the paper card. Selected, wrong and planted each have words and a shape
   (a thick edge, a dashed crossed-out tile, a tag), not a colour alone. Every tile has the same type and size. */
.qbody[data-kind="plant"] .qcard__text { max-inline-size: 34ch; }
.qpanel[data-kind="plant"] .hostnote { display: none; }
.pw-area { display: grid; gap: var(--space-3); inline-size: 100%; }
.pw-area.hidden, .pw-qr.hidden { display: none; }
.pw-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pw-lead { margin: 0; font-weight: var(--weight-strong); color: var(--ink-2); line-height: var(--leading-snug); }
.pw-lead:empty { display: none; }
.pw-hearts { display: flex; gap: var(--space-1); margin: 0; }
.pw-heart { inline-size: 1.75rem; block-size: 1.75rem; color: var(--ink-danger); fill: currentColor; stroke: currentColor;
  transition: opacity var(--dur-2) var(--ease-lean), transform var(--dur-2) var(--ease-lean); }
.pw-heart.is-lost { fill: none; opacity: 0.45; transform: scale(0.85); stroke-dasharray: 3 2; }
.pw-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.pw-tile {
  position: relative; display: grid; place-items: center; align-content: center; gap: var(--space-1);
  min-block-size: clamp(4rem, 11vh, 6.5rem); padding: var(--space-3); text-align: center; cursor: pointer;
  background: var(--paper-sunk); color: var(--ink); border: var(--border-2) solid var(--ink-rule); border-radius: var(--radius-m);
  font: var(--weight-display) clamp(1.05rem, 0.7rem + 1.2vw, 1.75rem) / var(--leading-tight) var(--font-head);
  transition: transform var(--dur-2) var(--ease-lean), border-color var(--dur-2) var(--ease-lean);
}
.pw-tile__text { overflow-wrap: anywhere; hyphens: auto; }
.pw-tile__tag { font: var(--weight-strong) var(--text-s) / 1 var(--font-body); min-block-size: 1em; }
.pw-tile__tag:empty { display: none; }
.pw-tile:hover:not([disabled]) { border-color: var(--ink); }
.pw-tile:focus-visible { outline: var(--focus-width) solid var(--ink-focus); outline-offset: var(--focus-offset); }
.pw-tile[aria-pressed="true"] { border-color: var(--ink-brand); border-width: var(--border-3); box-shadow: inset 0 0 0 var(--border-2) var(--ink-brand); transform: translateY(-2px); }
.pw-tile[aria-pressed="true"] .pw-tile__tag:empty { display: block; }
.pw-tile[aria-pressed="true"] .pw-tile__tag:empty::before { content: "Selected"; color: var(--ink-brand); }
.pw-tile[disabled] { cursor: default; }
.pw-tile.is-wrong { border-style: dashed; opacity: 0.6; }
.pw-tile.is-wrong .pw-tile__text { text-decoration: line-through; text-decoration-thickness: var(--border-2); }
.pw-tile.is-wrong .pw-tile__tag { color: var(--ink-danger); }
.pw-tile.is-plant { opacity: 1; border-width: var(--border-3); border-style: solid; }
.pw-tile.is-found { border-color: var(--ink-success); box-shadow: inset 0 0 0 var(--border-2) var(--ink-success); }
.pw-tile.is-found .pw-tile__tag { color: var(--ink-success); }
.pw-tile.is-missed { border-color: var(--ink-brand); box-shadow: inset 0 0 0 var(--border-2) var(--ink-brand); }
.pw-tile.is-missed .pw-tile__tag { color: var(--ink-brand); }
/* face down while the other team plants: a hatched back and a question mark, no words */
.pw-tile.is-down { cursor: default; color: var(--ink-2); border-style: dashed;
  background: repeating-linear-gradient(135deg, var(--paper-sunk) 0 10px, var(--paper) 10px 20px); }
.pw-tile.is-down .pw-tile__text { font-size: 1.6em; opacity: 0.7; }
/* the plant is in: all six turn over together, a beat apart (instant under reduced motion) */
.pw-tile.is-flip { animation: pw-flip calc(420ms * var(--motion-scale, 1)) var(--ease-lean) both;
  animation-delay: calc(var(--i, 0) * 70ms * var(--motion-scale, 1)); }
@keyframes pw-flip { from { transform: perspective(600px) rotateY(90deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
.pw-lead[data-low] { color: var(--ink-danger); }
.pw-msg { margin: 0; font-weight: var(--weight-strong); color: var(--ink); line-height: var(--leading-snug); flex: 1 1 14rem; }
.pw-head .btn { min-block-size: var(--tap-min); flex: none; }
.pw-head .btn[hidden] { display: none; }
.pw-msg:empty { display: none; }
/* the guessing team found the plant */
.pw-win { display: grid; justify-items: center; align-content: center; gap: var(--space-2); text-align: center; inline-size: 100%; padding-block: var(--space-2); }
.pw-win.hidden { display: none; }
.pw-win__icon { display: grid; place-items: center; inline-size: 3rem; block-size: 3rem; border-radius: 50%; background: var(--ink-success); color: var(--paper); }
.pw-win__icon .icon { inline-size: 1.75rem; block-size: 1.75rem; }
.pw-win__title { margin: 0; font: var(--weight-display) var(--text-title) / 1.05 var(--font-head); color: var(--ink); }
.pw-win__title:focus { outline: none; }
.pw-win__pts { margin: 0; font: var(--weight-display) var(--text-xl) / 1 var(--font-head); color: var(--ink-success); }
.pw-win__note { margin: 0; color: var(--ink-2); font-weight: var(--weight-strong); }
.pw-win .btn { margin-block-start: var(--space-2); }
@media (max-width: 599px) { .pw-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qbody .qr-card { box-shadow: none; padding: var(--space-4); gap: var(--space-5); }
.qbody .qr-card .ss-qr-img, .qbody .qr-card__code > div { inline-size: 100%; block-size: 100%; }
.qbody .qr-card .ss-qr-img svg, .qbody .qr-card .ss-qr-img img { inline-size: 100%; block-size: 100%; display: block; }
.qbody .qr-card__copy h3 { margin: 0; font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); color: var(--ink); }
.qbody .qr-card .ss-qr-hint, .qbody .qr-card .ss-qr-waiting { margin: 0; text-align: start; background: none; padding: 0; border: 0; color: var(--ink); }
.qbody .qr-card__status { color: var(--ink-2); }
.qbody .qr-card .ss-rules-reminder { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: 0; background: none; border: 0; color: var(--ink-2); }
.qr-card.ss-qr-area { display: grid; inline-size: 100%; }

/* ---- 25.3 the back of the card ---- */
.qcard__face--back { gap: var(--space-4); }
.qcard__face--back:focus { outline: none; }
.answerrow { display: grid; gap: var(--space-5); align-items: center; justify-items: center; }
@media (min-width: 640px) { .answerrow { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); text-align: start; } }
.answerpic { margin: 0; display: grid; gap: var(--space-2); justify-items: center; inline-size: min(100%, 14rem); }
.answerpic.hidden { display: none !important; }
.answerpic.hidden + .answerbox { grid-column: 1 / -1; }
.answerpic__btn { inline-size: 100%; border: var(--border-2) solid var(--paper-edge); cursor: zoom-in; font: inherit; color: inherit; }
.answerpic__btn img { --art-ratio: 4 / 3; object-fit: contain; background: var(--paper-sunk); }
.answerpic__btn:focus-visible { outline: var(--focus-width) solid var(--focus-page); outline-offset: var(--focus-offset); }
.answerbox { display: grid; gap: var(--space-3); justify-items: center; text-align: center; }
.answer__q { max-inline-size: 48ch; margin: 0; color: var(--ink-2); border-block-start: var(--border-1) dashed var(--ink-rule); padding-block-start: var(--space-3); }
.answer__q .t-label { margin-inline-end: var(--space-2); color: var(--ink-2); }
.answer__text { overflow-wrap: anywhere; }

/* ---- 25.4 paused: a calm veil over the card (the question is not readable while the clock is held) ---- */
.qcard__veil {
  position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 100%; z-index: 5; display: grid; place-content: center; justify-items: center; gap: var(--space-3);
  padding: var(--space-6); text-align: center; background: var(--paper); color: var(--ink);
  border: var(--border-3) dashed var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet);
}
.qcard__veil[hidden] { display: none; }
.qcard__veil .icon { color: var(--ink-brand); }
.qcard__veil-line { margin: 0; font: var(--weight-display) var(--text-title) / var(--leading-tight) var(--font-head); color: var(--ink); }
.qcard__veil .t-small { color: var(--ink-2); margin: 0; }
@media (min-width: 900px) and (min-height: 501px) {
  .qcard__veil { inline-size: calc(100% - var(--timer-col)); }
  .qcard[data-timer="off"] .qcard__veil { inline-size: 100%; }
  .qpanel .stage .qcard { margin-block: 0 var(--space-2); }
  .qpanel .awards { inline-size: calc(100% - var(--timer-col)); margin-inline: 0 auto; }
  .qpanel[data-timer="off"] .awards { inline-size: min(100%, var(--qcard-max)); margin-inline: auto; }
}

/* ---- 25.5 the report dialog and the lightbox ---- */
.dialog[data-step="form"] .dr-sent, .dialog[data-step="sent"] .dr-form { display: none; }
.dr-sent__line { display: flex; gap: var(--space-3); align-items: center; margin: 0; font-weight: var(--weight-strong); font-size: var(--text-lead); }
.dr-sent__line .icon { color: var(--ink-success); flex: none; }
.report-error[hidden] { display: none; }
.report-error { color: var(--ink); background: var(--paper-sunk); border-color: var(--ink-danger); margin: 0; }
.report-preview { margin: 0; }
.report-preview .t-label { margin-inline-end: var(--space-2); color: var(--ink-2); }
.dialog .dialog__body.dr-form .t-small, .dialog .dialog__body.dr-sent .t-small { color: var(--ink-2); }
dialog.lightbox { margin: 0; }
.lightbox__img { background: var(--paper); }

/* ---- 25.6 big screens ---- */
@media (min-width: 1600px) { .qpanel { --qcard-max: 74rem; } }

/* ---- 25.7 landscape phone (844 x 390): the seats are slim bars either side of the turn line, the card is full width with the ring beside it,
        the dock and the awards are one row each. Ported from the mock's question page. ---- */
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="question"] .table-layout--bar {
    --timer-size: 4.25rem; --timer-col: 6.25rem;   /* wide enough for the tag under the ring */
    grid-template-columns: minmax(0, 1fr) minmax(11rem, 1.4fr) minmax(0, 1fr);   /* a fixed 22rem centre left the seats too narrow for a name on a 667 px phone */
    grid-template-areas: "s1 turn s2" "stage stage stage" "awards awards awards" "dock dock dock";
    grid-template-rows: auto auto auto auto; block-size: auto; min-block-size: calc(100dvh - var(--fit-top, var(--header-h))); align-content: start;
  }
  html[data-screen="question"] .table-layout--bar > .seat--1 { grid-area: 1 / 1 / 2 / 2; }
  html[data-screen="question"] .table-layout--bar > .seat--2 { grid-area: 1 / 3 / 2 / 4; }
  .qpanel .gamebar, .qpanel .hostnote { display: none; }
  .qpanel .turn-line { font-size: var(--text-s); align-self: center; white-space: normal; overflow: visible; }   /* the question caption may wrap; only the board's turn line is one line */
  .table-layout--bar .stage { grid-area: stage; }
  .table-layout--bar .awards { grid-area: awards; inline-size: auto; margin: 0; gap: var(--space-2); }
  .table-layout--bar .qpanel .dock { padding-block: 0; }
  .table-layout--bar .stage .qcard { margin-block: 0; inline-size: 100%; grid-template-columns: minmax(0, 1fr) var(--timer-col); align-items: start; }
  .table-layout--bar .qcard[data-timer="off"] { grid-template-columns: minmax(0, 1fr); }
  .table-layout--bar .qcard__inner { grid-column: 1; grid-row: 1; }
  .table-layout--bar .qcard .timer { position: static; grid-column: 2; grid-row: 1; justify-self: end; margin: 0; grid-auto-flow: row; inline-size: var(--timer-col); gap: var(--space-1); align-items: center; justify-self: center; }   /* undo the max-width: 899px row layout, which an 844 px wide phone also matches */
  .table-layout--bar .qcard .timer__num { font-size: var(--text-l); }
  .table-layout--bar .qcard .timer__tag { font-size: var(--text-xs); min-block-size: 0; padding: 0 var(--space-2); max-inline-size: var(--timer-col); order: 0; margin-block-end: 0; text-wrap: balance; }
  .table-layout--bar .qcard__meta { padding-inline-end: 0; }
  .table-layout--bar .qcard__meta .chip, .table-layout--bar .qcard__meta .phase-badge { min-block-size: 2rem; padding-block: 0; }
  .table-layout--bar .qcard__face { padding: var(--space-1) var(--space-4) var(--space-2); gap: 0; }
  .table-layout--bar .qpanel .dock { gap: 0 var(--space-2); }
  .qbody:is([data-kind="image"], [data-kind="audio"], [data-kind="video"]) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-4); }
  .qbody .qcard__text { font-size: var(--text-m); }
  .table-layout--bar .qcard[data-face="front"] .qcard__face--back, .table-layout--bar .qcard[data-face="back"] .qcard__face--front { position: absolute; inset: 0; }   /* the card is only as tall as the face you can see */
  .table-layout--bar .qcard__face--back { gap: var(--space-1); }
  .table-layout--bar .answer { font-size: var(--text-l); padding: var(--space-1) var(--space-6); }
  .table-layout--bar .answerrow { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); }
  .table-layout--bar .answerpic { inline-size: 6rem; }
  .table-layout--bar .answerpic figcaption { display: none; }
  .table-layout--bar .media__frame { aspect-ratio: 21 / 9; }
  .table-layout--bar .qcard[data-face="back"] .timer { opacity: 0.5; }
  .table-layout--bar .qcard[data-face="back"] .timer__tag { visibility: hidden; }
  /* Plant the Word: three across and short, so the six tiles and the dock fit a sideways phone */
  .table-layout--bar .pw-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); }
  .table-layout--bar .pw-tile { min-block-size: 2.5rem; padding: 0.125rem var(--space-1); font-size: var(--text-m); line-height: 1.1; gap: 0; }
  .table-layout--bar .pw-tile__tag { font-size: var(--text-xs); }
  .table-layout--bar .pw-tile[aria-pressed="true"] .pw-tile__tag:empty { display: none; }   /* the thick border says Selected; the word took a line the screen does not have */
  .table-layout--bar .pw-area { gap: var(--space-1); }
  .table-layout--bar .pw-head { gap: var(--space-1) var(--space-2); flex-wrap: nowrap; }
  .table-layout--bar .pw-msg { font-size: var(--text-s); flex: 1 1 auto; min-inline-size: 0; }
  .table-layout--bar .pw-head .btn { min-block-size: 2.25rem; padding-block: 0; font-size: var(--text-s); }
  .table-layout--bar .pw-win { gap: var(--space-1); padding-block: 0; }
  .table-layout--bar .pw-win__icon { display: none; }   /* the green points say it; the icon cost the row Continue needs */
  .table-layout--bar .pw-win__title { font-size: var(--text-xl); }
  .table-layout--bar .pw-win__pts { font-size: var(--text-l); }
  .table-layout--bar .pw-win__note { font-size: var(--text-s); }
  .table-layout--bar .pw-win .btn { margin-block-start: 0; min-block-size: 2.5rem; }
  .table-layout--bar .qbody[data-kind="plant"] { gap: var(--space-1); }   /* the theme sits right on the tiles; the space went to the overflow */
  .table-layout--bar .pw-heart { inline-size: 1.25rem; block-size: 1.25rem; }
  /* Silent Scan: a 168 px code pushed the host dock below a 390 px screen; 7rem still scans easily from a phone at arm's length */
  .table-layout--bar .qbody .qr-card { padding: var(--space-2) var(--space-4); gap: var(--space-4); border-width: var(--border-2); }
  .table-layout--bar .qbody .qr-card__code { inline-size: 7rem; padding: var(--space-1); }
  .table-layout--bar .qbody .qr-card__copy { gap: var(--space-1); }
  .table-layout--bar .qbody .qr-card__copy h3 { font-size: var(--text-m); }
  .table-layout--bar .award { display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-min); padding: 0 var(--space-3) 0 0; text-align: start; overflow: hidden; }
  .table-layout--bar .award__band { inline-size: auto; margin: 0; align-self: stretch; padding-inline: var(--space-2); border-block-end: 0; border-inline-end: var(--border-2) dashed var(--paper-edge); border-radius: 0; }
  .table-layout--bar .award__band span:not(.glyph) { display: none; }
  .table-layout--bar .award__name { margin: 0; flex: 1; min-inline-size: 0; font-size: var(--text-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* one line, so a long team name cannot push the page into a scroll */
  .table-layout--bar .award__pts { font-size: var(--text-m); }
  .qcard__veil { inline-size: calc(100% - var(--timer-col)); padding: var(--space-2); gap: var(--space-1); }
  .qcard__veil .icon { display: none; }
  .qcard__veil-line { font-size: var(--text-m); }
  .qcard__veil .t-small { display: none; }
}


/* ==========================================================================
   26. Game over, stage C: the winner moment, the notepaper score, the recap, the share card
   Source: design-lab/04-ui/direction-b-table/results.html (page <style>) and DESIGN-NOTES.md sections 8 and 10.
   The seat, the won cards, .scorepad and .winner-line are sections 12 and 19 above; markup: templates/play.html (#gameover-container),
   behaviour: static/script.js (GAME OVER).
   ========================================================================== */
.gameover { display: grid; gap: var(--space-4); padding-block-end: var(--space-8); }
.gameover .table-center { gap: var(--space-5); align-content: start; }
.gameover .scorepad > .t-label, #go-winner:focus { outline: none; }   /* focused by script so a screen reader starts on the result; it is not a control */
.gameover .go-game { background: var(--paper); padding-inline: var(--space-3); }
.gameover .go-game { color: var(--ink-2); font-weight: var(--weight-strong); max-inline-size: 100%; overflow-wrap: anywhere; }
.pad-names { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-8); direction: ltr; font-weight: var(--weight-strong); background: var(--paper); padding-inline: var(--space-3); color: var(--ink-2); }
.pad-names .team-badge { font-size: var(--text-s); --glyph-color: var(--ink-team1); }
.pad-names .team-badge--2 { --glyph-color: var(--ink-team2); }
.pad-names bdi { overflow-wrap: anywhere; }
.saved { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: center; color: var(--color-text-2); font-size: var(--text-s); }
.saved .badge[data-state="saving"] { --badge-c: var(--color-text-2); }
.saved .badge.badge--success { --badge-c: var(--color-success); }
.saved .badge.badge--warn { --badge-c: var(--color-warning); }
.saved .badge[data-state="error"] { border-style: dashed; }
.gameover .actions { margin-block-start: var(--space-1); }
.gameover .alert--info { max-inline-size: 40rem; margin-inline: auto; }
.keepgoing { max-inline-size: 40rem; margin-inline: auto; }

/* the seats at full volume: the verdict pill and the trays each team took */
.seat__took { font-size: var(--text-s); color: var(--ink-2); line-height: var(--leading-snug); }
.seat__took b { color: var(--ink); }
.seat__verdict { display: inline-flex; gap: var(--space-1); align-items: center; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--ink); color: var(--paper); font-size: var(--text-s); font-weight: var(--weight-strong); white-space: nowrap; }
.seat__verdict[hidden] { display: none; }
@media (max-width: 899px) { .seat__verdict { max-inline-size: 100%; padding-inline: var(--space-2); font-size: var(--text-xs); } }
.seat__verdict .icon { inline-size: 1.1em; block-size: 1.1em; }
/* the crow stands only on a clear win: never next to the out-of-games card */
.gameover[data-credit="none"] .seat__perch { display: none; }

/* winner moment: the notepaper settles; the crow's pose and the seat ripple do the rest. No scale pop. */
.gameover[data-outcome="win"] .scorepad { animation: pad-set calc(var(--dur-3) * var(--motion-scale, 1)) var(--ease-lean) 1; }
@keyframes pad-set { from { transform: translateY(calc(var(--space-3) * -1)); opacity: 0.4; } to { transform: none; opacity: 1; } }
:root[data-motion="reduce"] .scorepad { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .scorepad { animation: none !important; } }

/* category by category */
.recap { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.recap__card { display: grid; gap: var(--space-2); padding: var(--space-3); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-tile); color: var(--ink); align-content: start; }
.recap__card[data-played="0"] { border-style: dashed; box-shadow: none; }
.recap__name { font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); color: var(--ink); overflow-wrap: anywhere; }
.recap__who { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-weight: var(--weight-strong); --glyph-color: var(--ink); }
.recap__who .glyph, .recap__nums .glyph { --glyph-color: var(--ink-team1); font-size: 1.1em; }
.recap__who .glyph--2, .recap__nums .glyph--2 { --glyph-color: var(--ink-team2); }
.recap__bar { display: flex; gap: var(--space-1); block-size: 0.9rem; }
.recap__seg { block-size: 100%; border-radius: var(--radius-pill); min-inline-size: 0.35rem; }
.recap__seg--1 { background: var(--ink-team1); }
.recap__seg--2 { background: var(--ink-team2); }
.recap__seg--none { flex: 1; background: transparent; border: var(--border-2) dashed var(--ink-rule); }
.recap__nums { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); font-weight: var(--weight-strong); }
.recap__nums .num { display: inline-flex; gap: var(--space-2); align-items: baseline; direction: ltr; }
.recap__nums .glyph { font-size: 0.9em; }
.recap__played { font-size: var(--text-s); color: var(--ink-2); }
.recap .plate { inline-size: 100%; }

/* the share card */
.share { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: center; }
.share__names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.share__card { display: grid; justify-items: center; }
.share-canvas { inline-size: min(100%, 30rem); aspect-ratio: 1; block-size: auto; border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet); background: var(--paper); }
@media (max-width: 960px) {
  .recap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
}
@media (max-width: 600px) {
  .recap { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .recap__card { grid-template-columns: 6.5rem minmax(0, 1fr); column-gap: var(--space-3); align-items: center; }
  .recap__card > .plate { grid-row: 1 / span 5; align-self: start; }
  .recap__card > :not(.plate) { grid-column: 2; }
  .share__names { grid-template-columns: minmax(0, 1fr); }
  .gameover .actions .btn { flex: 1 1 100%; justify-content: center; }
  .pad-names { gap: var(--space-4); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .recap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .share { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .table-layout--result .seat__score { font-size: var(--text-xl); }
  .table-layout--result .seat__name { font-size: var(--text-body); }
  .table-layout--result .seat__body { padding-inline: var(--space-2); }
  .seat__took, .seat__won-title, .seat__verdict { display: none; }
  .winner-line { font-size: var(--text-xl); }
  .winner-note { font-size: var(--text-s); }
  .scorepad__line { font-size: var(--text-xl); }
  .scorepad { padding-block: var(--space-4); }
  .seat__band { font-size: var(--text-xs); padding-inline: var(--space-2); }
}

/* ==========================================================================
   27. Forbidden Words round, stage C: the host screen (the QR card, the clock, the score, eight words)
   Markup: templates/play.html (#fw-round-container). Behaviour: static/script.js (FORBIDDEN WORDS, startFWRound).
   ========================================================================== */
.fw-round { display: grid; gap: var(--space-5); align-content: start; padding-block-end: var(--space-10); }
.fw-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-8); padding: var(--space-4) var(--space-5);
  background: var(--paper); color: var(--ink); border: var(--border-3) solid var(--paper-edge); border-radius: var(--radius-xl); box-shadow: var(--shadow-tile);
  --color-text: var(--ink); --color-text-2: var(--ink-2); --color-border: var(--ink-rule); --color-surface: var(--paper-sunk);
}
.fw-bar__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fw-bar .chip { background: var(--paper-sunk); color: var(--ink); border-color: var(--paper-edge); }
.fw-bar .chip--tier { background: transparent; }
.fw-bar__stats { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-8); }
.fw-stat { display: grid; justify-items: start; gap: 0; margin: 0; }
.fw-stat .t-label { color: var(--ink-2); }
.fw-stat__num { font: var(--weight-display) var(--text-heading) / var(--leading-numeral) var(--font-head); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.fw-timer { font-size: var(--text-3xl); min-inline-size: 2ch; }
.fw-timer.warning { color: var(--ink-danger); }
.fw-timer.warning::after { content: " Ten seconds"; font: var(--weight-strong) var(--text-s) / 1 var(--font-body); }   /* words as well as colour */
.fw-progress { font-size: var(--text-body); font-family: var(--font-body); font-weight: var(--weight-strong); }
.fw-timesup { margin: 0; }
.fw-layout { display: grid; grid-template-columns: minmax(16rem, 23rem) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.fw-qr { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: var(--space-4); padding: var(--space-5); position: sticky; inset-block-start: calc(var(--header-h) + var(--space-4)); }
.fw-qr .qr-card__code { inline-size: min(100%, 13rem); }
.fw-qr .qr-card__code img { inline-size: 100%; block-size: 100%; object-fit: contain; }
.fw-qr__title { font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); color: var(--ink); }
.fw-qr__hint { color: var(--ink-2); }
.fw-qr .qr-card__status { justify-content: center; }
.fw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); justify-items: center; font-size: var(--text-s); color: var(--ink); }
.fw-rules li { display: flex; align-items: center; gap: var(--space-2); }
.fw-rules .icon { color: var(--ink-warning); flex: none; }
.fw-rules:empty { display: none; }

/* eight words: a numbered card face down, the word and a tick once it is revealed */
.fw-words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.fw-word {
  position: relative; display: grid; place-items: center; min-block-size: clamp(5rem, 12vh, 8.5rem); padding: var(--space-3) var(--space-4); text-align: center;
  background: var(--paper-sunk); color: var(--ink-2); border: var(--border-3) dashed var(--paper-edge); border-radius: var(--radius-l);
}
.fw-word > * { grid-area: 1 / 1; }
.fw-word__no { font: var(--weight-display) var(--text-3xl) / 1 var(--font-head); color: var(--ink-3); }
.fw-word__tick { justify-self: start; align-self: start; color: var(--ink-success); opacity: 0; }
.fw-word__text { visibility: hidden; font: var(--weight-display) var(--text-xl) / var(--leading-tight) var(--font-head); color: var(--ink); overflow-wrap: anywhere; text-wrap: balance; }
.fw-word.revealed { background: var(--paper); color: var(--ink); border-style: solid; box-shadow: var(--shadow-tile); }
.fw-word.revealed .fw-word__no { opacity: 0; }
.fw-word.revealed .fw-word__tick { opacity: 1; }
.fw-word.revealed .fw-word__text { visibility: visible; }
.fw-word.pop-in { animation: fw-pop calc(var(--dur-3) * var(--motion-scale, 1)) var(--ease-clink, ease-out) 1; }
@keyframes fw-pop { from { transform: translateY(var(--space-2)); opacity: 0.4; } to { transform: none; opacity: 1; } }
.fw-award { display: grid; gap: var(--space-3); justify-items: center; }
.fw-award__prompt { margin: 0; font-weight: var(--weight-strong); }
.fw-award .awards { inline-size: min(100%, 44rem); }
.fw-award__done { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: var(--weight-strong); color: var(--color-success); }
.fw-actions { display: flex; justify-content: center; }
@media (max-width: 899px) {
  .fw-layout { grid-template-columns: minmax(0, 1fr); }
  .fw-qr { position: static; grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: start; }
  .fw-qr .qr-card__code { inline-size: 8rem; }
  .fw-qr .qr-card__status, .fw-rules { justify-content: start; justify-items: start; }
}
@media (max-width: 599px) {
  .fw-bar { padding: var(--space-3) var(--space-4); }
  .fw-qr { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .fw-word__text { font-size: var(--text-m); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .fw-round { gap: var(--space-3); }
  .fw-words { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
  .fw-word { min-block-size: 4rem; padding: var(--space-2); }
  .fw-word__no { font-size: var(--text-xl); }
  .fw-word__text { font-size: var(--text-m); }
  .fw-layout { grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); }
  .fw-qr { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--space-3); gap: var(--space-2); }
  .fw-qr .qr-card__code { inline-size: 7rem; }
  .fw-qr__hint { display: none; }
}

/* Silent Scan on a short landscape screen (browser bars showing): a smaller code and copy keep the host dock on screen.
   Kept at the end so it wins over the landscape question rules above. */
@media (max-height: 380px) and (orientation: landscape) {
  .table-layout--bar .qbody .qr-card { padding-block: var(--space-1); }
  .table-layout--bar .qbody .qr-card__code { inline-size: 4.75rem; }
  .table-layout--bar .qbody .qr-card__copy h3 { font-size: var(--text-s); }
  .table-layout--bar .qbody .qr-card :is(.qr-card__status, .ss-qr-waiting, .ss-rules-reminder) { font-size: var(--text-xs); }
}

/* ==========================================================================
   LANDSCAPE PHONE BOARD, MOCKUP DESIGN (screenshots/UI mockups/I Dont Crow Trivia Board.png)
   Header kept; the two seats are paper bars with the team crows; a "1 of 36" sticker straddles the header line; the turn is a
   hand-lettered brush banner under a crown with an arrow to the team that is up; trays have a paper head with an arrow and a
   sticker icon (static/brand/glyphs); flat tiles; a dock with two dividers. Everything shrinks with the height, so a phone
   browser's own bars never push the dock off screen.
   ========================================================================== */
.cat__arrow, .cat__glyph, .seat__mascot { display: none; }   /* only the landscape board shows these */

@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="board"] {
    --mk-ink: #2A1F1A; --mk-paper: #FBF3E6; --mk-t400: #F8CA69; --mk-t600: #F6A83E; --mk-navy: #13202B;
    --mk-tray: #2A201B; --mk-tray-edge: #3E3129; --mk-drop: 0 3px 0 rgba(0, 0, 0, 0.38);
  }
  html[data-screen="board"] .table-layout--bar {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(9rem, 0.78fr) minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    padding: var(--space-4) var(--space-3) var(--space-3);
  }

  /* ---- the seats: paper bars edged in the team colour, the crow on the left ---- */
  .table-layout--bar > .seat {
    flex-direction: row; align-items: center; align-self: center;
    min-block-size: 3.125rem; padding-inline-start: 5.5rem;
    background: var(--mk-paper, var(--paper)); border: 4px solid var(--team); border-radius: 16px;
    box-shadow: var(--mk-drop, var(--shadow-press)); transform: none;
  }
  .table-layout--bar > .seat[data-active] { border-width: 5px; transform: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--team) 45%, transparent), 0 0 18px 3px color-mix(in srgb, var(--team) 45%, transparent), var(--mk-drop, var(--shadow-press)); }
  .table-layout--bar > .seat .seat__perch, .table-layout--bar > .seat .seat__band { display: none; }
  .table-layout--bar .seat__mascot { display: block; position: absolute; z-index: 2; inset-inline-start: 2px; inset-block-end: 0; block-size: 3.3rem; inline-size: auto; pointer-events: none; border-end-start-radius: 11px; }   /* the site's own flat crow in the team colour (static/brand/mascots/*.svg), standing in the bar */
  .table-layout--bar > .seat .seat__body { padding: var(--space-1) var(--space-4) var(--space-1) var(--space-2); column-gap: var(--space-2); }
  .table-layout--bar > .seat .seat__name { font: 700 1rem / 1.15 var(--font-body); color: var(--mk-ink, var(--ink)); padding: 0; }
  .table-layout--bar > .seat .seat__name::after { display: none; }   /* the glow and the banner's arrow say whose turn it is */
  .table-layout--bar > .seat .seat__won-count { white-space: nowrap; font-size: 0.8125rem; color: color-mix(in srgb, var(--mk-ink, var(--ink)) 78%, transparent); }
  .table-layout--bar > .seat .seat__score { font-size: 2.35rem; color: var(--mk-ink, var(--ink)); }
  /* little scribbles beside the bars, in the team colour */
  .table-layout--bar > .seat::after {
    content: ""; position: absolute; inline-size: 1.4rem; block-size: 1.4rem; pointer-events: none; background: var(--team);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M4 14l6-3M5 21l8-1M14 6l2-4'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M4 14l6-3M5 21l8-1M14 6l2-4'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .table-layout--bar > .seat--1::after { inset-inline-start: calc(100% + 2px); inset-block-start: -0.6rem; }
  .table-layout--bar > .seat--2::after { inset-inline-end: -1.1rem; inset-block-end: -0.3rem; rotate: 160deg; }

  /* ---- "1 of 36 tiles played": a paper sticker straddling the header line ---- */
  html[data-screen="board"] .table-layout--bar .board-head {
    position: absolute; z-index: calc(var(--z-sticky) + 1); inset-block-start: -1.55rem; inset-inline-start: 50%; translate: -50% 0;
    display: block; pointer-events: none;
  }
  html[data-screen="board"] .table-layout--bar .board-head > :not(.board-count) { display: none; }
  html[data-screen="board"] .table-layout--bar .board-count {
    display: block; margin: 0; padding: 0.15rem 0.85rem 0.25rem; rotate: -3deg; white-space: nowrap;
    background: var(--mk-paper); color: var(--mk-ink); border-radius: 4px 9px 5px 11px / 9px 4px 11px 5px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
    font: 600 0.8125rem / 1.2 var(--font-body);
  }
  html[data-screen="board"] .table-layout--bar .board-count b { color: inherit; font: var(--weight-display) 1.45rem / 1 var(--font-head); vertical-align: -0.12em; margin-inline-end: 0.15em; }
  html[data-screen="board"] .table-layout--bar .board-count progress { display: none; }
  html[data-screen="board"] .table-layout--bar .board-head::after {   /* mustard ticks off the sticker's corner */
    content: ""; position: absolute; inset-inline-start: calc(100% + 0.2rem); inset-block-start: -0.2rem; inline-size: 1.3rem; block-size: 1.3rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F4A93B' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M4 12l7-5M6 20l8-2'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* ---- the turn: a hand-lettered brush banner under a crown, with an arrow to the team that is up ---- */
  html[data-screen="board"] .table-layout--bar .turn-line {
    --up: var(--team1-fill); position: relative; z-index: 0; grid-area: 1 / 2 / span 2 / 3; align-self: center; justify-self: center;
    max-inline-size: 100%; margin-block-start: 0.9rem; padding: 0.2rem 1.6rem 0.35rem; rotate: -4deg;
    font: 700 1.125rem / 1.15 "Kalam", var(--font-body); color: var(--mk-navy); text-align: center; white-space: nowrap; overflow: visible;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F4A93B' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M20 6l-8 4M18 15h-9'/%3E%3C/svg%3E") left center / 1.1rem no-repeat,
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F4A93B' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M4 9h9M6 18l8-4'/%3E%3C/svg%3E") right 85% / 1.1rem no-repeat;
  }
  html[data-screen="board"] .table-layout--bar:has(.seat--2[data-active]) .turn-line { --up: var(--team2-fill); }
  html[data-screen="board"] .table-layout--bar .turn-line > span:last-child { display: flex; justify-content: center; white-space: pre; }   /* only a long name is cut short; "you're up!" always shows */
  html[data-screen="board"] .table-layout--bar .turn-line bdi { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
  html[data-screen="board"] .table-layout--bar .turn-line #board-turn-text { flex: none; }
  html[data-screen="board"] .table-layout--bar .turn-line::before {   /* the brush stroke, in the colour of the team that is up */
    content: ""; position: absolute; z-index: -1; inset: 0 0.9rem; background: var(--up);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M7 9Q5 3 16 4L60 3 120 5 184 2Q196 3 195 11L198 19 194 24 197 30Q197 38 184 37L120 35 62 38 15 37Q3 37 5 29L2 22 6 17z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M7 9Q5 3 16 4L60 3 120 5 184 2Q196 3 195 11L198 19 194 24 197 30Q197 38 184 37L120 35 62 38 15 37Q3 37 5 29L2 22 6 17z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  }
  html[data-screen="board"] .table-layout--bar .turn-line > .glyph {   /* the crown */
    position: absolute; inset-block-end: calc(100% - 0.1rem); inset-inline-start: 50%; translate: -50% 0; rotate: 4deg;
    inline-size: 1.5rem; block-size: 1.15rem; margin: 0; border: 0; border-radius: 0; box-shadow: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 24' fill='none' stroke='%23F4A93B' stroke-width='2.6' stroke-linejoin='round'%3E%3Cpath d='M5 20 3 6l8 6 5-9 5 9 8-6-2 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  html[data-screen="board"] .table-layout--bar .turn-line::after {   /* the arrow to whoever is up */
    content: ""; position: absolute; inline-size: 2.4rem; block-size: 1.4rem; inset-block-start: -0.85rem; inset-inline-start: calc(100% - 0.6rem); background: var(--up);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 34' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 28C14 8 36 2 52 18M43 19l10 1-1-10'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 34' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 28C14 8 36 2 52 18M43 19l10 1-1-10'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  html[data-screen="board"] .table-layout--bar:has(.seat--1[data-active]) .turn-line::after { inset-inline-start: auto; inset-inline-end: calc(100% - 0.6rem); scale: -1 1; }

  /* ---- the trays ---- */
  html[data-screen="board"] .table-layout--bar .board { gap: 0.4rem; }
  html[data-screen="board"] .table-layout--bar .cat {
    grid-template-columns: minmax(0, 1fr);   /* a long word must not widen the tray past its column */
    gap: 0.4rem; padding: 0.4rem; background: var(--mk-tray); border: 2px solid var(--mk-tray-edge); border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 3px 0 rgba(0, 0, 0, 0.35);
  }
  html[data-screen="board"] .table-layout--bar .cat__head {
    display: flex; align-items: center; gap: 0.25rem; min-block-size: 2.2rem; padding: 0.2rem 0.25rem;
    background: var(--mk-paper); border: 0; border-radius: 9px; box-shadow: var(--mk-drop); text-align: start;
  }
  html[data-screen="board"] .table-layout--bar .cat__head .plate { display: none; }
  html[data-screen="board"] .table-layout--bar .cat__name {
    flex: 1; min-inline-size: 0; margin: 0; font: 700 0.75rem / 1.12 var(--font-body); color: var(--mk-ink); text-align: start; letter-spacing: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  }
  html[data-screen="board"] .table-layout--bar .cat__arrow {
    --arrow: var(--team1-fill); display: block; flex: none; inline-size: 0.7rem; block-size: 0.7rem; background: var(--arrow);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 10.5 16 9.5M11 4.5l5.5 5L11 15'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 10.5 16 9.5M11 4.5l5.5 5L11 15'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  html[data-screen="board"] .table-layout--bar .cat:nth-child(6n+2) .cat__arrow, html[data-screen="board"] .table-layout--bar .cat:nth-child(6n+4) .cat__arrow { --arrow: #F4A93B; }
  html[data-screen="board"] .table-layout--bar .cat:nth-child(6n+3) .cat__arrow { --arrow: var(--team2-fill); }
  html[data-screen="board"] .table-layout--bar .cat:nth-child(6n+5) .cat__arrow { --arrow: #9B7FD9; }
  html[data-screen="board"] .table-layout--bar .cat:nth-child(3n) .cat__arrow { display: none; }   /* as in the mockup: trays 3 and 6 have none, which leaves their names more room */
  html[data-screen="board"] .table-layout--bar .cat__glyph { display: block; flex: none; inline-size: 1.45rem; block-size: 1.45rem; }

  /* ---- the tiles: flat paper cards; both columns look the same (the turn banner says whose pick it is, and a pick
     from the wrong column is still refused by the board) ---- */
  html[data-screen="board"] .table-layout--bar .cat__tiles { grid-template-rows: repeat(3, minmax(1.6rem, 1fr)); gap: 0.4rem; padding: 0; }
  html[data-screen="board"] .table-layout--bar .tile,
  html[data-screen="board"] .table-layout--bar .board[data-turn] .tile[data-lane]:not([data-state="used"]) {
    min-block-size: 0; min-inline-size: 0; padding: 0; transform: none;
    background: var(--tile-bg); color: var(--mk-ink); border: 0; border-radius: 9px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.07);
    font: 600 1.05rem / 1 var(--font-body); letter-spacing: 0;
  }
  html[data-screen="board"] .table-layout--bar .tile[data-value="200"] { --tile-bg: var(--mk-paper); }
  html[data-screen="board"] .table-layout--bar .tile[data-value="400"] { --tile-bg: var(--mk-t400); }
  html[data-screen="board"] .table-layout--bar .tile[data-value="600"] { --tile-bg: var(--mk-t600); }
  html[data-screen="board"] .table-layout--bar .tile .tile__glyph, html[data-screen="board"] .table-layout--bar .tile .tally { display: none; }
  html[data-screen="board"] .table-layout--bar .board[data-turn] .tile[data-lane]:not([data-state="used"]):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
  html[data-screen="board"] .table-layout--bar .tile[data-state="used"] {
    background: #3A2F28; color: #8E7C6C; border: 2px dashed #6E5D50; box-shadow: none;
  }

  /* ---- the dock: Undo | Rules, End the night early | Home ---- */
  html[data-screen="board"] .table-layout--bar .dock {
    display: grid; grid-template-columns: 236fr 146fr 297fr 142fr; align-items: center; min-block-size: 2.85rem; padding: 0 var(--space-2);
    background: var(--mk-tray); border: 2px solid var(--mk-tray-edge); border-radius: 20px;
  }
  html[data-screen="board"] .table-layout--bar .dock .dock__group { display: contents; }
  html[data-screen="board"] .table-layout--bar .dock .dock__sep { display: none; }
  html[data-screen="board"] .table-layout--bar .dock::before, html[data-screen="board"] .table-layout--bar .dock::after {
    display: block; content: ""; position: absolute; inset-block: 28%; inset-inline: auto; translate: none;
    inline-size: 2px; block-size: auto; background: var(--mk-tray-edge); border: 0; border-radius: 2px;
  }
  html[data-screen="board"] .table-layout--bar .dock::before { inset-inline-start: 28.75%; }
  html[data-screen="board"] .table-layout--bar .dock::after { inset-inline-start: 82.7%; }
  html[data-screen="board"] .table-layout--bar .dock .btn { font-size: 0.875rem; }
  html[data-screen="board"] .table-layout--bar #dock-undo { grid-column: 1; justify-self: center; border-color: transparent; background: none; }
  html[data-screen="board"] .table-layout--bar #dock-rules { grid-column: 2; justify-self: center; }
  html[data-screen="board"] .table-layout--bar #dock-end { grid-column: 3; justify-self: end; margin-inline-end: 1.4rem; padding-inline: 1.4rem; }
  html[data-screen="board"] .table-layout--bar #dock-home { grid-column: 4; justify-self: center; }
}
/* the mockup board on a very short screen (a small phone with the browser bars showing): tighter gaps and a slimmer dock */
@media (max-height: 340px) and (orientation: landscape) {
  html[data-screen="board"] .table-layout--bar { padding-block: var(--space-3) var(--space-2); row-gap: var(--space-1); }
  html[data-screen="board"] .table-layout--bar > .seat { min-block-size: 2.75rem; }
  html[data-screen="board"] .table-layout--bar .seat__mascot { block-size: 2.9rem; }
  html[data-screen="board"] .table-layout--bar .cat { padding: 0.3rem; gap: 0.3rem; }
  html[data-screen="board"] .table-layout--bar .cat__head { min-block-size: 1.9rem; }
  html[data-screen="board"] .table-layout--bar .cat__tiles { gap: 0.3rem; }
  html[data-screen="board"] .table-layout--bar .dock { min-block-size: 2.4rem; }
  html[data-screen="board"] .table-layout--bar .dock .btn { min-block-size: 2.1rem; }
}
/* the mockup board on the narrowest landscape phones (iPhone SE, 667 px): each tray is about 100 px wide, so the head keeps
   only the name (no arrow or icon), the banner and seats tighten, and the header pill drops its label so the sticker is clear */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 759px) {
  html[data-screen="board"] .table-layout--bar .cat__arrow, html[data-screen="board"] .table-layout--bar .cat__glyph { display: none; }
  html[data-screen="board"] .table-layout--bar .cat__head { justify-content: center; }
  html[data-screen="board"] .table-layout--bar .cat__name { text-align: center; overflow-wrap: normal; }
  html[data-screen="board"] .table-layout--bar .turn-line { font-size: 1rem; padding-inline: 1.15rem; }
  html[data-screen="board"] .table-layout--bar .turn-line::before { inset-inline: 0.55rem; }
  html[data-screen="board"] .table-layout--bar > .seat { padding-inline-start: 4.6rem; }
  html[data-screen="board"] .table-layout--bar > .seat .seat__body { padding-inline: var(--space-1) var(--space-2); }
  html[data-screen="board"] .table-layout--bar > .seat .seat__won-count { min-inline-size: 0; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; }
  html[data-screen="board"] .table-layout--bar .seat__mascot { block-size: 2.9rem; }
  html[data-screen="board"] .table-layout--bar > .seat .seat__won-count { white-space: nowrap; font-size: 0.75rem; }
  html[data-screen="board"] .table-layout--bar > .seat .seat__score { font-size: 1.8rem; }
  html[data-screen="board"] .site-header .credit .credit__label { display: none; }
  html[data-screen="board"] .table-layout--bar .dock .btn { font-size: 0.8125rem; }
  html[data-screen="board"] .table-layout--bar #dock-end { margin-inline-end: 0.6rem; padding-inline: 0.9rem; }
}
/* landscape phone header: the games-left pill and the round buttons were as tall as the header (44 px) and sat on its dotted
   line; at 36 px they leave a gap above and below, as in the mockup */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header__inner { min-block-size: 3rem; }
  .site-header .credit { min-block-size: 2.25rem; padding-inline: var(--space-3); }
  .site-header .icon-btn { inline-size: 2.25rem; block-size: 2.25rem; min-inline-size: 2.25rem; min-block-size: 2.25rem; }
}
/* the "1 of 36" sticker and the turn banner sit fully under the header's dotted line (not across it, as in the mockup):
   the sticker is the first row between the seats, the crown and banner the second */
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="board"] .table-layout--bar { padding-block-start: var(--space-3); }
  html[data-screen="board"] .table-layout--bar .board-head {
    position: static; translate: none; z-index: auto; grid-area: head; justify-self: center; align-self: end;
  }
  html[data-screen="board"] .table-layout--bar .board-count { padding-block: 0.05rem 0.15rem; }
  html[data-screen="board"] .table-layout--bar .board-count b { font-size: 1.25rem; }
  html[data-screen="board"] .table-layout--bar .turn-line { grid-area: turn; align-self: start; margin-block-start: 1rem; }
}
@media (max-height: 340px) and (orientation: landscape) {
  html[data-screen="board"] .table-layout--bar { padding-block-start: var(--space-2); }
  html[data-screen="board"] .table-layout--bar .board-count { font-size: 0.75rem; }
  html[data-screen="board"] .table-layout--bar .board-count b { font-size: 1.1rem; }
  html[data-screen="board"] .table-layout--bar .turn-line { margin-block-start: 0.85rem; padding-block: 0.05rem 0.2rem; font-size: 0.95rem; }
  html[data-screen="board"] .table-layout--bar .turn-line > .glyph { inline-size: 1.25rem; block-size: 0.95rem; }
}
/* landscape seats: a long score shrinks, and the name and "tiles won" are cut short rather than run under the score */
@media (max-height: 500px) and (orientation: landscape) {
  .table-layout--bar > .seat .seat__name, .table-layout--bar > .seat .seat__won-count { min-inline-size: 0; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-layout--bar > .seat[data-score-len="4"] .seat__score, .table-layout--bar > .seat[data-score-len="5"] .seat__score { font-size: 1.9rem; }
  .table-layout--bar > .seat[data-score-len="6"] .seat__score, .table-layout--bar > .seat[data-score-len="7"] .seat__score { font-size: 1.6rem; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 759px) {
  html[data-screen="board"] .table-layout--bar > .seat[data-score-len="4"] .seat__score, html[data-screen="board"] .table-layout--bar > .seat[data-score-len="5"] .seat__score { font-size: 1.45rem; }
  html[data-screen="board"] .table-layout--bar > .seat[data-score-len="6"] .seat__score, html[data-screen="board"] .table-layout--bar > .seat[data-score-len="7"] .seat__score { font-size: 1.25rem; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 759px) {
  html[data-screen="board"] .table-layout--bar > .seat { padding-inline-start: 4.1rem; }
  html[data-screen="board"] .table-layout--bar .seat__mascot { block-size: 2.6rem; }
  html[data-screen="board"] .table-layout--bar > .seat .seat__won-count { font-size: 0.7rem; }
}
/* landscape question screen: no caption between the seats ("Six hundred points. Take a breath. ..."); the two seats share the
   whole row instead. The caption stays for screen readers (it also announces the steal and time's up). */
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="question"] .table-layout--bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "s1 s2" "stage stage" "awards awards" "dock dock";
    column-gap: 1.5rem;   /* room for the seats' scribbles between them */
  }
  html[data-screen="question"] .table-layout--bar > .seat--1 { grid-area: 1 / 1 / 2 / 2; }
  html[data-screen="question"] .table-layout--bar > .seat--2 { grid-area: 1 / 2 / 2 / 3; }
  html[data-screen="question"] .qpanel .turn-line {
    position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
/* landscape question screen: smaller seats, and the team that is not on the clock is dulled. The game moves data-active to the
   other team on a pass (the steal), so the dulling swaps with it. */
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="question"] .table-layout--bar > .seat { min-block-size: 2.6rem; padding-inline-start: 4.4rem; border-width: 3px; }
  html[data-screen="question"] .table-layout--bar > .seat[data-active] { border-width: 4px; }
  html[data-screen="question"] .table-layout--bar .seat__mascot { block-size: 2.75rem; }
  html[data-screen="question"] .table-layout--bar > .seat .seat__body { padding-block: 0.15rem; }
  html[data-screen="question"] .table-layout--bar > .seat .seat__name { font-size: 0.9rem; }
  html[data-screen="question"] .table-layout--bar > .seat .seat__won-count { font-size: 0.75rem; }
  html[data-screen="question"] .table-layout--bar > .seat .seat__score { font-size: 1.9rem; }
  html[data-screen="question"] .table-layout--bar > .seat[data-score-len="4"] .seat__score,
  html[data-screen="question"] .table-layout--bar > .seat[data-score-len="5"] .seat__score { font-size: 1.6rem; }
  html[data-screen="question"] .table-layout--bar > .seat:not([data-active]) { opacity: 0.45; filter: saturate(0.35); box-shadow: none; transition: opacity var(--dur-2) var(--ease-lean), filter var(--dur-2) var(--ease-lean); }
  html[data-screen="question"] .table-layout--bar > .seat:not([data-active])::after { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  /* once the answer is up, either team can be given the points: both seats come back to full colour */
  html[data-screen="question"] .table-layout--bar:has(.qcard[data-face="back"]) > .seat:not([data-active]) { opacity: 1; filter: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  /* landscape question screen: the table fills the screen, so the award cards and the dock always sit at the bottom;
     the card takes the space between the seats and them, centred */
  html[data-screen="question"] .table-layout--bar {
    block-size: calc(100dvh - var(--fit-top, 0px)); min-block-size: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto; align-content: stretch;
  }
  html[data-screen="question"] .table-layout--bar .stage { align-self: center; }
}
@media (max-height: 500px) and (orientation: landscape) {
  /* the question card fills the space between the seats and the dock; its content stays centred in it */
  html[data-screen="question"] .table-layout--bar .stage { align-self: stretch; min-block-size: 0; grid-template-rows: minmax(0, 1fr); }
  html[data-screen="question"] .table-layout--bar .stage .qcard { block-size: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  html[data-screen="question"] .table-layout--bar .stage .qcard .timer { align-self: start; }
  html[data-screen="question"] .table-layout--bar .qcard__inner { min-block-size: 0; }
  html[data-screen="question"] .table-layout--bar .qcard__face--front { grid-template-rows: auto minmax(0, 1fr); }
  html[data-screen="question"] .table-layout--bar .qcard__face--front .qbody { align-content: center; align-items: center; }
  html[data-screen="question"] .table-layout--bar .qcard__face--back { align-content: center; }
}
/* once the answer is revealed, the card drops its shadow (the keyline inside it stays) */
.qcard[data-face="back"] .qcard__face { box-shadow: inset 0 0 0 var(--space-2) var(--paper), inset 0 0 0 calc(var(--space-2) + var(--border-1)) var(--paper-rule); }
@media (max-height: 500px) and (orientation: landscape) {
  /* the question sits in the middle of the card, left to right as well as top to bottom */
  html[data-screen="question"] .table-layout--bar .qcard__face--front .qbody { justify-items: center; text-align: center; }
  html[data-screen="question"] .table-layout--bar .qcard__face--front .qcard__text { text-align: center; margin-inline: auto; }
}
/* the answer text is measured as one box so its hand-drawn oval can be fitted round it (_fitAnswerRing in static/script.js) */
.answer__text { display: inline-block; }
.qcard__face.is-tight .answer__q { display: none; }   /* set by _fitAnswerRing when a very long answer needs the room */

/* ==========================================================================
   ROTATE GATE: a phone held upright cannot play (play.html #rotate-gate; _syncRotateGate in static/script.js keeps the page
   behind it inert). Shown on the board, a question and a Forbidden Words round, in portrait up to 600 px wide.
   ========================================================================== */
.rotate-gate { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  html:is([data-screen="board"], [data-screen="question"], [data-screen="fw-round"]) .rotate-gate {
    position: fixed; inset: 0; z-index: calc(var(--z-sticky) + 1000); display: grid; place-items: center;
    padding: max(var(--space-6), env(safe-area-inset-top)) var(--space-5) max(var(--space-6), env(safe-area-inset-bottom));
    background: var(--color-bg); overscroll-behavior: contain; touch-action: none;
  }
  html:is([data-screen="board"], [data-screen="question"], [data-screen="fw-round"]) body { overflow: hidden; }
}
.rotate-gate:focus { outline: none; }
.rotate-gate__card { display: grid; justify-items: center; gap: var(--space-4); max-inline-size: 22rem; text-align: center; }
.rotate-gate__art { position: relative; inline-size: 8rem; block-size: 8rem; display: grid; place-items: center; color: var(--color-brand-text); }
.rotate-gate__phone {
  display: grid; place-items: center; inline-size: 3.6rem; block-size: 6rem;
  border: 4px solid var(--color-text); border-radius: 0.9rem; background: var(--color-surface);
  animation: kc-rotate-gate 2.4s var(--ease-lean, ease-in-out) infinite;
}
.rotate-gate__phone img { inline-size: 2.6rem; block-size: auto; }
.rotate-gate__arrow { position: absolute; inset-block-start: 0; inset-inline-end: 0; inline-size: 2.6rem; block-size: 2.6rem; }
.rotate-gate__title { font: var(--weight-display) var(--text-heading) / var(--leading-tight) var(--font-head); color: var(--color-text); }
.rotate-gate__text { color: var(--color-text-2); line-height: var(--leading-snug); }
.rotate-gate__hint { color: var(--color-text-3, var(--color-text-2)); font-size: var(--text-s); }
.rotate-gate__home { margin-block-start: var(--space-2); }
@keyframes kc-rotate-gate { 0%, 25% { rotate: 0deg; } 55%, 85% { rotate: 90deg; } 100% { rotate: 0deg; } }   /* clockwise, the way the arrow points */
@media (prefers-reduced-motion: reduce) { .rotate-gate__phone { animation: none; rotate: 90deg; } }
/* the crow inside the turning phone turns the other way, so it stays upright the whole time */
.rotate-gate__phone img { animation: kc-rotate-gate-crow 2.4s var(--ease-lean, ease-in-out) infinite; }
@keyframes kc-rotate-gate-crow { 0%, 25% { rotate: 0deg; } 55%, 85% { rotate: -90deg; } 100% { rotate: 0deg; } }
@media (prefers-reduced-motion: reduce) { .rotate-gate__phone img { animation: none; rotate: -90deg; } }
/* like a phone's auto-rotate: the phone turns with the crow on its screen (so the crow tips over), then the screen turns the
   crow upright; on the way back the phone turns first and the screen catches up. 4 s a loop. */
.rotate-gate__phone { animation: kc-rotate-gate-phone 4s var(--ease-lean, ease-in-out) infinite; }
.rotate-gate__phone img { animation: kc-rotate-gate-screen 4s var(--ease-lean, ease-in-out) infinite; }
@keyframes kc-rotate-gate-phone  { 0%, 20% { rotate: 0deg; } 42%, 80% { rotate: 90deg; } 96%, 100% { rotate: 0deg; } }
@keyframes kc-rotate-gate-screen { 0%, 50% { rotate: 0deg; } 62%, 80% { rotate: -90deg; } 82%, 96% { rotate: -90deg; } 100% { rotate: 0deg; } }
@media (prefers-reduced-motion: reduce) { .rotate-gate__phone { animation: none; rotate: 90deg; } .rotate-gate__phone img { animation: none; rotate: -90deg; } }
.rotate-gate__arrow { inset-inline-end: -1rem; inset-block-start: -0.25rem; }   /* a little further out from the phone */
/* the crows sit flush against the seat's inner edge (no paper showing between them and the border), and the blue crow's
   picture is wider so its whole back shows */
@media (max-height: 500px) and (orientation: landscape) {
  .table-layout--bar .seat__mascot { inset-inline-start: 0; }
  .table-layout--bar > .seat--2 .seat__mascot { aspect-ratio: 198 / 116; }
  .table-layout--bar > .seat--2 { padding-inline-start: 6.1rem; }
  html[data-screen="board"] .table-layout--bar > .seat--2 { padding-inline-start: 6.1rem; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 759px) {
  html[data-screen="board"] .table-layout--bar > .seat--2 { padding-inline-start: 4.9rem; }
}
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="question"] .table-layout--bar > .seat--2 { padding-inline-start: 5.1rem; }
}
/* landscape board: the column the team that is up can pick from stands up (paper cards with a shadow); the other team's column
   lies flat in brown with a dotted outline, its points still readable. Played tiles are empty slots (dashed, struck through). */
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="board"] .table-layout--bar .board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]),
  html[data-screen="board"] .table-layout--bar .board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]),
  html[data-screen="board"] .table-layout--bar .tile[data-state="locked"] {
    background: #33281F; color: #A8957F; border: 2px dotted #7A6656; box-shadow: none; transform: none; cursor: not-allowed;
  }
  html[data-screen="board"] .table-layout--bar .board[data-turn="1"] .tile[data-lane="2"]:not([data-state="used"]):active,
  html[data-screen="board"] .table-layout--bar .board[data-turn="2"] .tile[data-lane="1"]:not([data-state="used"]):active { transform: none; box-shadow: none; }
  html[data-screen="board"] .table-layout--bar .tile[data-state="used"] { background: transparent; color: #6E5D50; border: 2px dashed #5A4A3F; }
}
/* no arrows before the category names: the name and its icon only */
html[data-screen="board"] .table-layout--bar .cat__arrow { display: none; }
/* in a game the site header steps aside on a landscape phone (the dock has Home), so the board gets the whole screen */
@media (max-height: 500px) and (orientation: landscape) {
  html:is([data-screen="board"], [data-screen="question"]) .site-header { display: none; }
}

/* ── Legal pages (terms, privacy, refunds, contact): a calm reading column ── */
.legal { max-inline-size: 44rem; margin-inline: auto; }
.legal__updated { margin-block: var(--space-2) var(--space-8); }
.legal__body h2 { font-size: var(--text-heading); margin-block: var(--space-8) var(--space-3); }
.legal__body h2:first-child { margin-block-start: 0; }
.legal__body p, .legal__body li, .legal__body dd { color: var(--color-text-2); line-height: var(--leading-body, 1.65); }
.legal__body p { margin-block: 0 var(--space-3); }
.legal__body ul { margin-block: 0 var(--space-3); padding-inline-start: var(--space-6); }
.legal__body li + li { margin-block-start: var(--space-2); }
.legal__body a { color: var(--color-brand-text); text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.legal__back { display: inline-block; margin-block-start: var(--space-8); }
.legal__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-6); margin-block: 0 var(--space-6); }
.legal__facts dt { font-weight: var(--weight-strong); color: var(--color-text); }
.legal__facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 479px) { .legal__facts { grid-template-columns: minmax(0, 1fr); gap: 0; } .legal__facts dd { margin-block-end: var(--space-3); } }

/* ── Street View: a Start cover on the card, then the map full screen (play.html #sv-explore, script.js svStartExplore) ── */
.sv-cover { display: grid; justify-items: center; align-content: center; gap: var(--space-2); min-block-size: 9rem;
  padding: var(--space-5) var(--space-4); text-align: center; border: var(--border-2) dashed color-mix(in srgb, currentColor 35%, transparent);
  border-radius: var(--radius-card); background: color-mix(in srgb, currentColor 6%, transparent); color: var(--night-text); }
.sv-cover__icon { inline-size: 2.25rem; block-size: 2.25rem; opacity: .8; }
.sv-cover__title { margin: 0; font: var(--weight-strong) var(--text-m) / var(--leading-snug) var(--font-display, inherit); }
.sv-cover__note { margin: 0; max-inline-size: 34ch; color: var(--night-text-2); }
.sv-cover .btn { margin-block-start: var(--space-2); }
.sv-cover[data-state="done"] .sv-cover__icon { opacity: .5; }

.sv-explore[hidden] { display: none; }
.sv-explore { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-3); padding: max(var(--space-3), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right))
  max(var(--space-3), env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--night-bg) 88%, black); color: var(--night-text); overscroll-behavior: contain; }
html[data-sv="explore"] { overflow: hidden; }
/* everything behind the map steps out of sight while a team explores */
html[data-sv="explore"] :is(.site-header, .site-footer, #main > :not(#sv-explore):not(#rotate-gate)) { visibility: hidden; }
.sv-explore__bar { display: flex; align-items: center; gap: var(--space-4); min-inline-size: 0; position: relative; z-index: 2; }   /* above anything the panorama draws */
.sv-explore__who { flex: 1; min-inline-size: 0; margin: 0; font-weight: var(--weight-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-explore__who bdi { padding: .1em .55em; border-radius: 999px; background: var(--night-team1); color: #1C1512; }
.sv-explore[data-team="2"] .sv-explore__who bdi { background: var(--night-team2); }
.sv-explore__clock { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-1) var(--space-3);
  border-radius: 999px; background: var(--night-raised); font-size: var(--text-m); font-weight: var(--weight-strong); }
.sv-explore__clock .num { min-inline-size: 2ch; text-align: end; font-variant-numeric: tabular-nums; }
.sv-explore__unit { font-size: .8em; opacity: .75; }
.sv-explore[data-low="true"] .sv-explore__clock { background: var(--night-danger); color: #1C1512; }
@media (prefers-reduced-motion: no-preference) {
  .sv-explore[data-low="true"] .sv-explore__clock { animation: kc-sv-tick 1s ease-in-out infinite; }
}
@keyframes kc-sv-tick { 50% { scale: 1.06; } }
.sv-explore__frame { min-block-size: 0; border-radius: var(--radius-card); overflow: hidden; background: var(--night-raised);
  box-shadow: 0 0 0 var(--border-2) color-mix(in srgb, var(--night-text) 18%, transparent), 0 18px 60px rgba(0, 0, 0, .55); }
.sv-explore__pano, .sv-explore__pano > div { inline-size: 100%; block-size: 100%; }
/* Google's links stay visible (their terms) but cannot be followed: script.js _svGuardLinks also strips their addresses */
.sv-explore__pano a { pointer-events: none !important; cursor: default !important; }
/* a landscape phone: a slim bar, so the map gets the height */
@media (max-height: 500px) and (orientation: landscape) {
  .sv-explore { gap: var(--space-2); padding-block: max(var(--space-2), env(safe-area-inset-top)) max(var(--space-2), env(safe-area-inset-bottom)); }
  .sv-explore__clock { font-size: var(--text-s); padding-block: 2px; }
  .sv-explore__bar .btn { min-block-size: 36px; }
  /* one short row on the card: the words on the left, Start on the right */
  .sv-cover { min-block-size: 0; padding: var(--space-2) var(--space-4); gap: 0 var(--space-4); text-align: start;
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon title btn" "icon note btn"; justify-items: start; }
  .sv-cover__icon { grid-area: icon; align-self: center; inline-size: 1.75rem; block-size: 1.75rem; }
  .sv-cover__title { grid-area: title; font-size: var(--text-s); }
  .sv-cover__note { grid-area: note; max-inline-size: none; font-size: var(--text-xs); }
  .sv-cover .btn { grid-area: btn; align-self: center; margin: 0; min-block-size: 40px; }
}

/* ── Question dock labels: the long words on big screens, short ones on a landscape phone (play.html #q-dock) ── */
#q-dock .lbl-short { display: none; }
@media (max-height: 500px) and (orientation: landscape) {
  /* five buttons with full words need about 870 px: an 832 px phone (Galaxy S24 Ultra) wrapped them to two rows */
  #q-dock .lbl-long { display: none; }
  #q-dock .lbl-short { display: inline; }
  .table-layout--bar #q-dock, .table-layout--bar #q-dock .dock__group { flex-wrap: nowrap; }
}

/* ── Wordle that fits the screen: on a landscape screen the grid sits beside the keys, and the tiles are sized from the
      screen's height, so the grid, the keys and the host dock under them are all on screen at once. A 6-row grid with the
      keys under it was 400 px tall and pushed Reveal and Back to the board off a 720 to 768 px laptop (the page does not scroll).
      --wordle-reserve is the height everything but the grid takes: the header, seats, card top, question line and dock. ── */
@media (orientation: landscape) {
  /* The tile and key sizes are worked out where they are used (the tiles and keys), so cqi there is this box's width:
     the grid takes at most 40% of it, and the ten keys of the top row share what the grid leaves. With the clock ring beside
     the card, a laptop's box is about 560 px wide, and full-size keys spilled out of the card. */
  #wordle-area {
    container-type: inline-size;
    --wordle-reserve: 28rem;
    --wordle-tile: min(clamp(1.25rem, calc((100dvh - var(--wordle-reserve)) / 6.8), 3rem), calc(40cqi / 5.6));
    --wordle-key: clamp(1.25rem, calc((100cqi - 5 * var(--wordle-tile) - 100px) / 10), 2.4rem);
    display: grid; grid-template-columns: auto auto; grid-template-areas: "board msg" "board input" "board keys";
    grid-template-rows: 1fr auto auto; justify-content: center; align-items: center; gap: var(--space-2) var(--space-6);
  }
  #wordle-area .wordle-key { min-inline-size: var(--wordle-key); }
  #wordle-area .wordle-key-wide { min-inline-size: calc(var(--wordle-key) * 1.6); }
  #wordle-board { grid-area: board; }
  #wordle-msg { grid-area: msg; align-self: end; }
  #wordle-input-row { grid-area: input; }
  #wordle-keyboard { grid-area: keys; align-self: start; inline-size: auto; }
  #wordle-area .wordle-tile { inline-size: var(--wordle-tile); block-size: var(--wordle-tile); font-size: calc(var(--wordle-tile) * 0.55); }
}
/* landscape phone: the grid gets every pixel left between the seats and the dock; the typed-letters box goes (the on-screen
   keys have Enter and Del) and the question line goes too (the turn line above the card already says whose guess it is) */
@media (max-height: 500px) and (orientation: landscape) {
  #wordle-area { --wordle-reserve: 11rem; padding: var(--space-1) var(--space-3); gap: var(--space-1) var(--space-4); }
  #wordle-area .wordle-board, #wordle-area .wordle-row { gap: 3px; }
  #wordle-input-row { display: none; }
  .qbody[data-kind="wordle"] .qcard__text { display: none; }
  #wordle-area .wordle-key { min-block-size: clamp(1.75rem, calc(var(--wordle-tile) * 1.15), 2.25rem); }
  #wordle-area .wordle-msg { min-block-size: 1.2em; font-size: var(--text-s); }
}
/* a short laptop window (under 640 px of page): the typed-letters box goes too, the grid shows the letters */
@media (orientation: landscape) and (max-height: 640px) { #wordle-input-row { display: none; } }
/* a letter typed but not yet guessed: a brighter edge, no fill */
.wordle-tile.wordle-draft { border-color: var(--night-text-2); }

/* ── The question card's text never runs up under the badges. The body is centred in the card, and a question longer than
      the room used to spill out of the top as well as the bottom, over the category and points (most on a phone). "safe"
      keeps the start edge put; on a phone the badges also stay on one row (the category name is cut short instead). ── */
.qcard__face--front .qbody { align-content: safe center; }
@media (max-height: 500px) and (orientation: landscape) {
  html[data-screen="question"] .table-layout--bar .qcard__face--front .qbody { align-content: safe center; }
  .table-layout--bar .qcard__meta { flex-wrap: nowrap; min-inline-size: 0; }
  .table-layout--bar .qcard__meta > * { flex: none; }
  .table-layout--bar .qcard__meta #q-category { flex: 0 1 auto; min-inline-size: 0; overflow: hidden; }
  .table-layout--bar .qcard__meta #q-category > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-layout--bar .qcard__face--front .qcard__text { font-size: clamp(0.875rem, 4.4dvh, var(--text-m)); }
}
/* a laptop: the question bar's five buttons wrapped to two rows below about 1,500 px wide, so they get the short words too */
@media (orientation: landscape) and (max-width: 1500px) {
  #q-dock .lbl-long { display: none; }
  #q-dock .lbl-short { display: inline; }
}

/* ── Picture questions: the picture is the star. It takes most of the card's width and the screen's height, and the
      question sits in a narrower column beside it, a size smaller. The team cards get narrower while it is up (their scores
      are still there). --q-img-reserve is the height everything but the picture takes: header, turn line, badges and dock. ── */
@media (orientation: landscape) and (min-height: 501px) {
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout--fit { --seat-w: clamp(7.5rem, 10vw, 11rem); }
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout > .seat .seat__score { font-size: var(--text-l); }
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .qpanel { --qcard-max: 100%; }
  .qbody[data-kind="image"] { --q-img-reserve: 25.5rem; grid-template-columns: minmax(10rem, 0.62fr) minmax(0, 1.6fr); gap: var(--space-6); }
  .qbody[data-kind="image"] .qcard__text { font-size: clamp(1rem, 2.9dvh, 1.7rem); max-inline-size: 24ch; }
  .qbody[data-kind="image"] #q-image-frame { aspect-ratio: auto; block-size: clamp(14rem, calc(100dvh - var(--q-img-reserve)), 46rem); }
}
/* a landscape phone: the picture fills the card's height beside the text, and the score bars get a little slimmer */
@media (max-height: 500px) and (orientation: landscape) {
  .table-layout--bar .qbody[data-kind="image"] { block-size: 100%; min-block-size: 0; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); align-items: stretch; gap: var(--space-3); }
  .table-layout--bar .qbody[data-kind="image"] .qcard__text { align-self: safe center; }
  .table-layout--bar .qbody[data-kind="image"] .media { block-size: 100%; min-block-size: 0; grid-template-rows: minmax(0, 1fr); }
  .table-layout--bar .qbody[data-kind="image"] #q-image-frame { aspect-ratio: auto; block-size: 100%; min-block-size: 0; }
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout--bar > .seat { min-block-size: 2.2rem; }
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout--bar > .seat .seat__score { font-size: 1.4rem; }
}
/* the badges stay one row on a laptop too (the category name is cut short), and a text question on a short laptop
   (under 800 px of page) is a size smaller, so a long question no longer pushes the dock off the screen */
@media (orientation: landscape) and (min-height: 501px) {
  .qcard__meta { flex-wrap: nowrap; min-inline-size: 0; }
  .qcard__meta > * { flex: none; }
  .qcard__meta #q-category { flex: 0 1 auto; min-inline-size: 0; overflow: hidden; }
  .qcard__meta #q-category > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (orientation: landscape) and (min-height: 501px) and (max-height: 800px) {
  .qbody:is([data-kind="text"], [data-kind="qr"]) .qcard__text { font-size: clamp(1.2rem, 3.4dvh, 1.9rem); }
}

/* ── Forbidden Words host screen on one screen (play.html #fw-round-container). It used to scroll on every screen below a
      1080 px TV: on a sideways phone only four of the eight words and none of the QR code were in view. Now the page is the
      screen's height: a slim bar, the QR card sized from the height, the eight words in equal boxes (4 x 2) filling the
      rest, and End the round (or the awards) at the bottom. Phones held upright get the rotate gate on this screen. ── */
@media (orientation: landscape) {
  html[data-screen="fw-round"] #fw-round-container {
    block-size: calc(100dvh - var(--header-h)); min-block-size: 0; overflow: hidden;
    padding-block: var(--space-3); gap: var(--space-3);
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; align-content: stretch;
  }
  html[data-screen="fw-round"] .fw-bar { padding: var(--space-2) var(--space-5); gap: var(--space-2) var(--space-6); }
  html[data-screen="fw-round"] .fw-bar__stats { flex-wrap: nowrap; gap: var(--space-6); align-items: baseline; }
  html[data-screen="fw-round"] .fw-stat { grid-auto-flow: column; align-items: baseline; gap: var(--space-2); }
  html[data-screen="fw-round"] .fw-stat__num { font-size: var(--text-xl); }
  html[data-screen="fw-round"] .fw-timer { font-size: var(--text-2xl); }
  html[data-screen="fw-round"] .fw-layout { min-block-size: 0; align-items: stretch; grid-template-columns: minmax(12rem, 20rem) minmax(0, 1fr); gap: var(--space-4); }
  html[data-screen="fw-round"] .fw-qr { position: static; min-block-size: 0; overflow: hidden; align-content: center; padding: var(--space-3); gap: var(--space-2); }
  html[data-screen="fw-round"] .fw-qr .qr-card__code { inline-size: clamp(6rem, 30dvh, 15rem); }
  html[data-screen="fw-round"] .fw-words { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); min-block-size: 0; block-size: 100%; gap: var(--space-3); }
  html[data-screen="fw-round"] .fw-word { min-block-size: 0; overflow: hidden; }
  html[data-screen="fw-round"] .fw-word__text { font-size: clamp(1rem, 3.4dvh, 2.2rem); overflow-wrap: break-word; }
  html[data-screen="fw-round"] .fw-word__no { font-size: clamp(1.25rem, 5dvh, 3rem); }
  html[data-screen="fw-round"] .fw-actions .btn { min-block-size: var(--tap-min); }
}
/* a laptop under about 800 px of page: the long hint under the code goes (the title says what to do) */
@media (orientation: landscape) and (max-height: 800px) {
  html[data-screen="fw-round"] .fw-qr__hint { display: none; }
}
/* a sideways phone: the site header steps aside like on the question screen, and everything is a size smaller */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .site-header { display: none; }
  html[data-screen="fw-round"] #fw-round-container { block-size: 100dvh; padding: var(--space-2) var(--space-3); gap: var(--space-2); }
  html[data-screen="fw-round"] .fw-bar { padding: var(--space-1) var(--space-3); border-width: var(--border-2); }
  html[data-screen="fw-round"] .fw-bar .chip { min-block-size: 1.75rem; padding-block: 0; font-size: var(--text-xs); }
  html[data-screen="fw-round"] .fw-stat .t-label { font-size: var(--text-xs); }
  html[data-screen="fw-round"] .fw-stat__num { font-size: var(--text-m); }
  html[data-screen="fw-round"] .fw-timer { font-size: var(--text-xl); }
  html[data-screen="fw-round"] .fw-progress { font-size: var(--text-xs); }
  html[data-screen="fw-round"] .fw-layout { grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: var(--space-2); }
  html[data-screen="fw-round"] .fw-qr { padding: var(--space-2); gap: var(--space-1); }
  html[data-screen="fw-round"] .fw-qr__title { font-size: var(--text-s); }
  html[data-screen="fw-round"] .fw-rules { font-size: var(--text-xs); }
  html[data-screen="fw-round"] #fw-game-qr-status { font-size: var(--text-xs); }
  html[data-screen="fw-round"] .fw-words { gap: var(--space-2); }
  html[data-screen="fw-round"] .fw-word { padding: var(--space-1); border-width: var(--border-2); }
  html[data-screen="fw-round"] .fw-meter { display: none; }   /* the bar's "0 / 8 revealed" says the same */
  html[data-screen="fw-round"] .fw-actions .btn { min-block-size: 2.5rem; font-size: var(--text-s); }
  html[data-screen="fw-round"] .fw-award .award { min-block-size: 2.75rem; }
}
/* the round is a column, not fixed grid rows: hidden parts (the time's-up note, the awards before the end) drop out of a
   grid and shift every row, which squeezed End the round to nothing. In a column the words simply take what is left. */
@media (orientation: landscape) {
  html[data-screen="fw-round"] #fw-round-container { display: flex; flex-direction: column; }
  html[data-screen="fw-round"] #fw-round-container > * { flex: none; }
  html[data-screen="fw-round"] #fw-round-container > .fw-layout { flex: 1 1 0; min-block-size: 0; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-bar { flex-wrap: nowrap; }
  html[data-screen="fw-round"] .fw-bar__chips { flex-wrap: nowrap; min-inline-size: 0; overflow: hidden; }
  html[data-screen="fw-round"] .fw-bar__stats { gap: var(--space-4); }
  html[data-screen="fw-round"] .fw-award .awards { gap: var(--space-2); }
}
/* a sideways phone at time's up: the bar already shows 0 and the score, and the buttons name the teams, so the note and
   the prompt step aside, and the three award buttons are one slim row (the question screen's phone style), so the
   revealed words stay readable above them */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] #fw-timesup-banner, html[data-screen="fw-round"] .fw-award__prompt { display: none; }
  html[data-screen="fw-round"] #fw-award-area { gap: 0; }
  html[data-screen="fw-round"] #fw-award-area .awards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); inline-size: 100%; }
  html[data-screen="fw-round"] #fw-award-area .award { display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-min); padding: 0 var(--space-3) 0 0; text-align: start; overflow: hidden; }
  html[data-screen="fw-round"] #fw-award-area .award__band { inline-size: auto; margin: 0; align-self: stretch; padding-inline: var(--space-2); border-block-end: 0; border-inline-end: var(--border-2) dashed var(--paper-edge); border-radius: 0; }
  html[data-screen="fw-round"] #fw-award-area .award__band span:not(.glyph) { display: none; }
  html[data-screen="fw-round"] #fw-award-area .award__name { margin: 0; font-size: var(--text-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ── Nothing sliced: fixes from a clipping audit of every game screen at phone, laptop and TV sizes ── */

/* Forbidden Words host: the QR card cut its own code at the top and the rules at the bottom when the code was sized from
   the width. The code is now sized from the height that is left (--fw-qr-reserve: everything else in the column), and the
   card no longer clips, so the code, the title, the status and the rules are always whole. */
@media (orientation: landscape) {
  html[data-screen="fw-round"] .fw-qr { --fw-qr-reserve: 27rem; overflow: visible; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  html[data-screen="fw-round"] .fw-qr .qr-card__code { inline-size: auto; block-size: clamp(4.5rem, calc(100dvh - var(--fw-qr-reserve)), 15rem); aspect-ratio: 1; flex: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-qr { --fw-qr-reserve: 15rem; }
  /* the bar's chips: the category gives way (cut with an ellipsis), the points never do; the tier chip goes (the points say it) */
  html[data-screen="fw-round"] #fw-game-diff-badge { display: none; }
  html[data-screen="fw-round"] .fw-bar__chips > * { flex: none; }
  html[data-screen="fw-round"] #fw-game-cat-badge { flex: 0 1 auto; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 1.75rem; }
}

/* the question picture: the img box was taller than its frame, so the frame cut the bottom of the photo. It now fills the
   frame exactly (object-fit: contain keeps the whole photo inside) */
#q-image-frame .qimg { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; max-block-size: 100%; object-fit: contain; }

/* the host note under the dock ("the answer stays off the screen") is the first thing to go on a short laptop */
@media (orientation: landscape) and (max-height: 800px) { .qpanel .hostnote { display: none; } }

/* Silent Scan on a short laptop: the code is sized from the height, so Reveal and Back stay on screen */
@media (orientation: landscape) and (min-height: 501px) and (max-height: 800px) {
  .qbody .qr-card { padding: var(--space-3) var(--space-5); gap: var(--space-4); }
  .qbody .qr-card__code { inline-size: clamp(6rem, calc(100dvh - 30rem), 12rem); }
}

/* a short laptop (501 to 800 px of page): the board needed about 740 px, so the dock sat under the bottom edge. The tiles
   and tray heads get a little shorter (a mouse needs less than a thumb) and the dock is slimmer, so the whole board and
   its dock fit. The rule line (who picks which column) stays. */
@media (min-width: 900px) and (min-height: 501px) and (max-height: 800px) {
  .table-layout--fit { padding-block: var(--space-2); }
  .table-layout--fit > .table-center { gap: var(--space-2); }
  .table-layout--fit { min-block-size: calc(100dvh - var(--fit-top, var(--header-h))); }   /* the 36rem floor pushed the dock off a 600 px window */
  .table-layout--fit .board { gap: var(--space-2); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .table-layout--fit .cat { padding: var(--space-1) var(--space-2); }
  .table-layout--fit .cat__head { padding-block: 2px; min-block-size: 0; }
  .table-layout--fit .cat__name { font-size: clamp(1rem, 2.3vh, 1.35rem); }
  .table-layout--fit .cat__tiles { grid-template-rows: repeat(3, minmax(2.1rem, 1fr)); gap: var(--space-1) var(--space-2); }
  .table-layout--fit .tile { min-block-size: 2.1rem; font-size: clamp(1.25rem, 3.4vh, 2rem); }
  .table-layout--fit .dock { padding-block: var(--space-1); }
  /* after Reveal: the three award cards are one slim row (as on a phone), so Report and Back to the board stay on screen */
  .qpanel .awards .award { display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-min); padding: 0 var(--space-3) 0 0; text-align: start; overflow: hidden; }
  .qpanel .awards .award__band { inline-size: auto; margin: 0; align-self: stretch; padding-inline: var(--space-2); border-block-end: 0; border-inline-end: var(--border-2) dashed var(--paper-edge); border-radius: 0; }
  .qpanel .awards .award__band span:not(.glyph) { display: none; }
  .qpanel .awards .award__name { margin: 0; font-size: var(--text-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .qpanel .awards .award__pts { margin-inline-start: auto; font-size: var(--text-l); }
}
/* the narrower team cards on a picture question: "Tiles won" wraps instead of sticking out of the card */
.seat__won-title { flex-wrap: wrap; min-inline-size: 0; }
/* picture questions narrow the team cards: the three "won" cards (200 / 400 / 600) no longer fit, so the card shows the
   one-line "N tiles won" instead, as on a phone */
@media (orientation: landscape) and (min-height: 501px) {
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout > .seat .seat__won { display: none; }
  html[data-screen="question"]:has(#qbody[data-kind="image"]) .table-layout > .seat .seat__won-count { display: block; font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }
}
/* a very short laptop window (640 px of page or less): the site header steps aside during a game, as it does on a phone
   (the dock has Home), so the board, the question and their buttons fit. fitBoard() re-measures --fit-top on each screen. */
@media (orientation: landscape) and (min-height: 501px) and (max-height: 640px) {
  html:is([data-screen="board"], [data-screen="question"], [data-screen="fw-round"]) .site-header { display: none; }
  html[data-screen="fw-round"] #fw-round-container { block-size: 100dvh; }
}

/* ── The site's top bar is hidden for the whole game (board, questions, Forbidden Words, the result), on every screen.
      The dock has Home, and the game gets the full height. The setup screens before a game keep it.
      The height the bar used to take goes back to the board, the picture, the Wordle grid and the QR code. ── */
html:is([data-screen="board"], [data-screen="question"], [data-screen="fw-round"], [data-screen="gameover"]) .site-header { display: none; }
/* Bomb Squad: its own full screen (static/css/bomb.css), with no site bar or footer */
html:is([data-screen="bomb"], [data-screen="math"], [data-screen="lol"]) :is(.site-header, .site-footer) { display: none; }
.math-round.hidden { display: none; }
.bomb-round.hidden { display: none; }
@media (orientation: landscape) {
  html[data-screen="fw-round"] #fw-round-container { block-size: 100dvh; }
  html[data-screen="fw-round"] .fw-qr { --fw-qr-reserve: 23rem; }
  .qbody[data-kind="image"] { --q-img-reserve: 21.5rem; }
  #wordle-area { --wordle-reserve: 24rem; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-qr { --fw-qr-reserve: 15rem; }
  #wordle-area { --wordle-reserve: 11rem; }
}
/* Forbidden Words host, the QR card: the code takes whatever height the title, the status and the rules leave, so the
   card's content can never be taller than the card. On a sideways phone the content was taller: the code poked up into
   the top bar and the rules spilled out of the bottom. */
@media (orientation: landscape) {
  html[data-screen="fw-round"] .fw-qr { display: grid; grid-template-rows: minmax(0, 1fr) auto auto auto; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: stretch; overflow: hidden; }
  html[data-screen="fw-round"] .fw-qr .qr-card__code { block-size: 100%; max-block-size: 15rem; min-block-size: 0; inline-size: auto; max-inline-size: 100%; aspect-ratio: 1; align-self: center; }
  html[data-screen="fw-round"] .fw-qr .qr-card__copy { display: contents; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-layout { grid-template-columns: minmax(10rem, 13.5rem) minmax(0, 1fr); margin-block-start: var(--space-1); }
  html[data-screen="fw-round"] .fw-qr { padding: var(--space-2) var(--space-2) var(--space-3); row-gap: var(--space-1); }
  html[data-screen="fw-round"] .fw-qr .qr-card__code { padding: 3px; }
  html[data-screen="fw-round"] .fw-rules li { white-space: nowrap; }
}
/* the code's row grows up to 15rem and gives way first when the card is short; the code, title, status and rules stay
   together in the middle of the card (a 1fr row left a gap between the code and its title on a laptop) */
@media (orientation: landscape) {
  html[data-screen="fw-round"] .fw-qr { grid-template-rows: minmax(0, 15rem) auto auto auto; align-content: center; row-gap: var(--space-2); }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-qr { row-gap: var(--space-1); }
}
/* a revealed word is also capped by its box's width (13 % of it per letter-ish), so a long word like Weightlifting fits a
   narrow box on a tall screen instead of running past its edge */
@media (orientation: landscape) {
  html[data-screen="fw-round"] .fw-word { container-type: inline-size; }
  html[data-screen="fw-round"] .fw-word__text { font-size: min(clamp(1rem, 3.4dvh, 2.2rem), 12.5cqi); }
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="fw-round"] .fw-word__text { font-size: min(var(--text-m), 12.5cqi); }
}

/* Wordle steal: the seventh row belongs to the other team (their colour, dashed, so it is not colour alone), and the tiles
   shrink a little so seven rows fit where six did */
.wordle-row--steal { margin-block-start: 4px; }
.wordle-row--steal .wordle-tile:not(.wordle-correct):not(.wordle-present):not(.wordle-absent) { border-style: dashed; border-color: var(--night-team1); }
.wordle-row--steal[data-team="2"] .wordle-tile:not(.wordle-correct):not(.wordle-present):not(.wordle-absent) { border-color: var(--night-team2); }
@media (orientation: landscape) {
  #wordle-area[data-steal] { --wordle-tile: min(clamp(1.1rem, calc((100dvh - var(--wordle-reserve)) / 7.9), 3rem), calc(40cqi / 5.6)); }
}

/* Wordle on a sideways phone: the grid is sized from the room the card actually gives it, not guessed from the screen
   height (the guess ran 1 to 21 px past the card into the dock, more with the steal's seventh row). The panel fills the
   card's body, is a size container, and the tiles are its height split over the rows (6, or 7 during a steal). */
@media (orientation: landscape) and (max-height: 500px) {
  .table-layout--bar .qbody[data-kind="wordle"] { block-size: 100%; min-block-size: 0; grid-template-rows: minmax(0, 1fr); }
  .table-layout--bar .qbody[data-kind="wordle"] .media { block-size: 100%; min-block-size: 0; grid-template-rows: minmax(0, 1fr); }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area {
    --wordle-rows: 6;
    block-size: 100%; min-block-size: 0; container-type: size; overflow: hidden;
    --wordle-tile: min(calc((100cqb - var(--space-2) - (var(--wordle-rows) - 1) * 3px) / var(--wordle-rows)), calc(40cqi / 5.6), 2.5rem);
  }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area[data-steal] { --wordle-rows: 7.3; }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area .wordle-key { min-block-size: clamp(1.6rem, calc((100cqb - 1.6rem) / 3.6), 2.25rem); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area {
    padding: 2px var(--space-3);
    --wordle-tile: min(calc((100cqb - 4px - (var(--wordle-rows) - 1) * 2px) / var(--wordle-rows)), calc(40cqi / 5.6), 3rem);
  }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area[data-steal] { --wordle-rows: 7; }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area :is(.wordle-board, .wordle-row) { gap: 2px; }
  .table-layout--bar .qbody[data-kind="wordle"] #wordle-area .wordle-row--steal { margin-block-start: 0; }
  .table-layout--bar .qcard__face--front:has(.qbody[data-kind="wordle"]) { padding-block-end: var(--space-1); }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* Wordle on a sideways phone: while the grid is up, the score bars step aside so the tiles get their height (the turn
     badge on the card still says whose pick or steal it is). They come back with the answer, for the awards. */
  html[data-screen="question"] .table-layout--bar:has(.qcard[data-face="front"] .qbody[data-kind="wordle"]) { padding-block-start: var(--space-1); row-gap: var(--space-1); }
  html[data-screen="question"] .table-layout--bar:has(.qcard[data-face="front"] .qbody[data-kind="wordle"]) > :is(.seat, .turn-line) { display: none; }
}

/* ── Setup on a sideways phone: about 350 px of height, and the Start bar keeps 60 of it. The site's top bar scrolls away
      with the page instead of staying pinned, and each category card turns into one short row (art on the left, name and
      badge on the right), so two or three rows of cards are always in view while picking. ── */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-screen="setup"] .site-header { position: static; }
  .cat-fieldset .cat-grid { --art-ratio: 4 / 3; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: var(--space-2) var(--space-3); }
  .cat-fieldset .cat-card__face {
    grid-template-columns: 4.75rem minmax(0, 1fr); grid-auto-rows: min-content; align-content: center;
    column-gap: var(--space-2); row-gap: 0.125rem; padding: var(--space-1); min-block-size: 4.25rem;
  }
  .cat-fieldset .cat-card__face .plate { grid-column: 1; grid-row: 1 / span 4; align-self: center; padding: 0.125rem; }
  .cat-fieldset .cat-card__face > :not(.plate, .cat-card__check) { grid-column: 2; padding-inline: 0; }
  .cat-fieldset .cat-card__name {
    font-size: var(--text-s); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  }
  .cat-fieldset .cat-card__meta, .cat-fieldset .cat-card__state, .cat-fieldset .cat-card__why { font-size: var(--text-xs); }
  .cat-fieldset .cat-card__meta { min-inline-size: 0; }
  /* "Needs 1 phone" without its outline: the narrow column has room for the words, not the pill around them */
  .cat-fieldset .cat-card__meta .badge { max-inline-size: 100%; min-inline-size: 0; overflow: hidden; gap: 0.25rem; padding-inline: 0; border: 0; }
  .cat-fieldset .cat-card__meta .badge .icon { flex: none; }
  /* the tick sits on the art's corner, clear of the name */
  .cat-fieldset .cat-card__check { inset-block-start: 0.125rem; inset-inline-start: 0.125rem; inset-inline-end: auto; inline-size: var(--space-6); block-size: var(--space-6); }
}

/* the shortest sideways phones (browser bars showing, 340 px or less): the six tiles and the win panel one size down */
@media (orientation: landscape) and (max-height: 340px) {
  .table-layout--bar .pw-tile { min-block-size: 1.875rem; font-size: var(--text-s); }
  .table-layout--bar .pw-win { gap: 0.125rem; }
  .table-layout--bar .pw-tile.is-down .pw-tile__text { font-size: 1.2em; }
  .table-layout--bar .pw-head .btn { min-block-size: 2rem; }
  .table-layout--bar .pw-heart { inline-size: 1.1rem; block-size: 1.1rem; }
  .table-layout--bar .pw-win__title { font-size: var(--text-l); }
  .table-layout--bar .pw-win__pts { font-size: var(--text-m); }
  .table-layout--bar .pw-win .btn { min-block-size: 2.25rem; }
}

/* Street View on a phone: no double-tap zoom on the bar, and "We have an answer" is a full-size tap target that stays
   on screen (script.js _svGuardPage stops Safari's pinch from zooming the page while the map is open) */
.sv-explore__bar { touch-action: manipulation; }
.sv-explore #sv-done-btn { min-block-size: var(--tap-min); flex: none; }
@media (max-height: 500px) and (orientation: landscape) { .sv-explore #sv-done-btn { min-block-size: 40px; } }

/* ── The answer's picture is as big as a question's picture. With a picture on the back of the card, the label, the
      caption and the question line go (the room just saw the question), and the picture takes the wide column.
      The frame hugs the picture (no empty bands), and the answer never breaks inside a word. ── */
.qcard__face--back:has(#answer-pic:not(.hidden)) :is(#answer-label, .answer__q, .answerpic figcaption) { display: none; }
.qcard__face--back:has(#answer-pic:not(.hidden)) { --a-img-max: clamp(12rem, calc(100dvh - 25.5rem), 44rem); inline-size: 100%; }
.qcard__face--back:has(#answer-pic:not(.hidden)) .answerrow {
  inline-size: 100%; grid-template-columns: minmax(12rem, 0.75fr) minmax(0, 1.6fr); grid-template-areas: "box pic"; gap: var(--space-6);
}
.qcard__face--back:has(#answer-pic:not(.hidden)) .answerbox { grid-area: box; min-inline-size: 0; }
.qcard__face--back:has(#answer-pic:not(.hidden)) .answer { font-size: clamp(1.5rem, 3.2vw, 2.75rem); }
.qcard__face--back:has(#answer-pic:not(.hidden)) .answer__text { overflow-wrap: normal; word-break: normal; hyphens: none; }
.qcard__face--back:has(#answer-pic:not(.hidden)) .answerpic { grid-area: pic; inline-size: 100%; justify-items: center; }
.qcard__face--back:has(#answer-pic:not(.hidden)) .answerpic__btn {
  inline-size: auto; max-inline-size: 100%; padding: 0; background: #fff; border-radius: var(--radius-m); overflow: hidden; line-height: 0;
}
.qcard__face--back:has(#answer-pic:not(.hidden)) .answerpic__btn img {
  display: block; inline-size: auto; block-size: auto; max-inline-size: 100%; max-block-size: var(--a-img-max);
  aspect-ratio: auto; object-fit: contain; border-radius: 0;
}
/* on a laptop or TV the revealed picture gets the room a picture question gets: a wide card, slimmer team cards */
@media (orientation: landscape) and (min-height: 501px) {
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .table-layout--fit { --seat-w: clamp(7.5rem, 10vw, 11rem); }
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .table-layout > .seat .seat__score { font-size: var(--text-l); }
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .qpanel { --qcard-max: 100%; }
  .qcard__face--back:has(#answer-pic:not(.hidden)) .answerrow { grid-template-columns: minmax(14rem, 0.62fr) minmax(0, 1.6fr); }
}
/* narrow upright screens: the picture above the answer */
@media (max-width: 639px) and (orientation: portrait) {
  .qcard__face--back:has(#answer-pic:not(.hidden)) { --a-img-max: 50dvh; }
  .qcard__face--back:has(#answer-pic:not(.hidden)) .answerrow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pic" "box"; }
}
/* a sideways phone: the picture fills what the score bars, the awards and the dock leave */
@media (max-height: 500px) and (orientation: landscape) {
  .table-layout--bar .qcard__face--back:has(#answer-pic:not(.hidden)) { --a-img-max: max(6rem, calc(100dvh - 13rem)); }
  .table-layout--bar .qcard__face--back:has(#answer-pic:not(.hidden)) .answerrow { grid-template-columns: minmax(8rem, 0.8fr) minmax(0, 1.5fr); gap: var(--space-3); }
  .table-layout--bar .qcard__face--back:has(#answer-pic:not(.hidden)) .answerpic { inline-size: 100%; }
  .table-layout--bar .qcard__face--back:has(#answer-pic:not(.hidden)) .answer { font-size: var(--text-xl); }
}

/* Image credits (templates/image_credits.html) */
.credits { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3); }
.credits__item { display: flex; gap: var(--space-3); align-items: center; }
.credits__img { inline-size: 6rem; block-size: 4.5rem; object-fit: contain; background: #fff; border-radius: var(--radius-s); flex: none; }
.credits__item .t-small { overflow-wrap: anywhere; }
/* the same slim team cards while a revealed answer picture is up: one-line "N tiles won", names cut short */
@media (orientation: landscape) and (min-height: 501px) {
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .table-layout > .seat .seat__won { display: none; }
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .table-layout > .seat .seat__won-count { display: block; font-size: var(--text-s); font-weight: var(--weight-strong); color: var(--ink-2); }
  html[data-screen="question"]:has(.qcard[data-face="back"] #answer-pic:not(.hidden)) .table-layout > .seat .seat__name { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
