/* =============================================================================
   MultiGame — visual system
   Three themes share one set of tokens, selected by html[data-theme] from the
   navbar picker. The bare :root holds "cool" (Cool Air — a crisp cool-grey ground,
   white cards, slate ink, teal/indigo accents). "felt" (data-theme="felt") is the
   original dark emerald table — ivory cards, gold accents — and is the shipped default.
   "warm" (data-theme="warm", Warm Tabletop) is a light parchment ground wearing felt's
   accent roles (amber primary, teal turn-state, purple specials).
   Every component rule reads tokens, so switching themes only swaps the :root
   values — almost no component CSS is theme-specific (the few exceptions are scoped
   to [data-theme="cool"]). Class names are hooks the markup and the Stimulus
   controllers rely on; only the look changes.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Self-hosted web fonts (no runtime request to Google's CDN).
   Fraunces (wordmark, headings, card digits) and Space Grotesk (scores, timers,
   products) ship as variable woff2 in app/assets/fonts; Propshaft digests the
   url()s below. Both are SIL Open Font License 1.1 (fonts.google.com/specimen/
   Fraunces and /Space+Grotesk). Only the "latin" and "latin-ext" subsets Google
   serves are kept — these families carry no Cyrillic, so Macedonian text falls
   back to the --font-display / --font-num fallbacks (Georgia / ui-monospace),
   exactly as it did when the fonts loaded from the CDN. latin is declared after
   latin-ext so it wins the few overlapping combining marks (matching Google).
   ----------------------------------------------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fraunces-latin-ext-53ea12c1.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fraunces-latin-397b623a.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/space-grotesk-latin-ext-8021ab76.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/space-grotesk-latin-3b2bde23.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root{
  /* ===== Cool Air — the light default ===== */
  /* the "felt" table, recast as a light cool panel */
  --felt-deep:#e7ecf4; --felt-mid:#f2f5fb; --felt-high:#fcfdff; --rim:#d8dfe9;
  /* the playing mat is an inset well — a touch cooler than the table it sits on */
  --well-top:#e2f2f2; --well-bot:#d3ebec; --well-rim:#a4d5d7; /* match-green play mat, two levels lighter */
  /* frosted-white surfaces (table, panels) */
  --surface:rgba(255,255,255,.78); --surface-2:#ffffff;
  --surface-edge:rgba(29,39,51,.13); --hair:rgba(29,39,51,.08);
  /* ink */
  --ink:#1d2733; --ink-dim:#566376; --ink-faint:#8795a6;
  /* crisp white cards */
  --card-top:#ffffff; --card-bot:#eef1f6; --card-ink:#1f2630; --card-edge:#cfd8e3;
  --card-shadow:rgba(30,45,70,.22);
  /* operator chips — a pale slate (Cool Air + Warm). Deliberately softened: the chip is lightened
     (+2 levels) and the glyph is a mid slate (+4 levels), so the × / = read ~3.3–4.2:1 on the pale
     chip — down from ~7:1, a quieter operator that still clears large-text AA (3:1). Warm sets its
     own warm glyph; Felt overrides both (a dark chip with a cream glyph). */
  --op-ink:#5a6d8b; --op-bg:linear-gradient(180deg,#e2e6ec,#c9ced6);
  /* accents — a three-tier system, each with one job (tuned for a light ground) */
  --gold:#2d6ae5; --gold-2:#2056cc; --gold-ink:#ffffff;   /* PRIMARY — royal blue (the acting / winning move) */
  --primary-rgb:45,106,229; --primary-lite-rgb:205,221,255;      /* the primary glows/shadows */
  --primary-hi:linear-gradient(180deg,#3f7bf0,#2358d8);          /* primary button :hover */
  --herald-head:linear-gradient(100deg,#2056cc,#9db8ff,#2d6ae5,#9db8ff,#2056cc); /* win-popup headline shimmer */
  --info:#0c8f93; --info-2:#0a757a; --info-ink:#ffffff;   /* INFO — whose turn, focus, live state */
  --special:#5566f2; --special-2:#3f4fd0;                 /* SPECIAL — final game, multiplier cards */
  --special-rgb:85,102,242;                               /* rgb(--special), for themed rgba() tints */
  /* semantic signals */
  --good:#10976a; --good-ink:#ffffff;
  --danger:#e0463d; --danger-ink:#ffffff;                 /* resign, errors, invalid */
  /* themed surfaces that were hardcoded before — now tokens so both themes own them */
  --app-bg: /* a light green — a lighter shade of the teal active-seat card */
    radial-gradient(125% 90% at 50% -12%, #f2faf6, transparent 55%),
    radial-gradient(140% 120% at 50% 118%, #cfe9e0, transparent 60%),
    linear-gradient(180deg,#e8f6f0,#d5ece4);
  --nav-bg:linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.6));
  --btn-hover-bg:#f4f7fc;
  --input-bg:#ffffff;
  --ghost-bg:rgba(29,39,51,.025);
  --recess:rgba(29,39,51,.03);    /* soft inset wells (seats, panels, cells) */
  --recess-2:rgba(29,39,51,.05);  /* deeper inset wells (lanes, code, bars) */
  /* the play-strips section wears the match-green (#0c8f93) instead of the slate recesses */
  --strip-bg:rgba(var(--grn-rgb),.12); --strip-rim:rgba(var(--grn-rgb),.3);
  --slot-bg:rgba(var(--grn-rgb),.09); --slot-line:rgba(var(--grn-rgb),.5);
  --cell-line:rgba(29,39,51,.28);
  --well-glow:rgba(var(--grn-rgb),.18); /* match-green glow pooled in the play mat (softened with the lighter mat) */
  --board-inset:inset 0 6px 16px rgba(30,45,70,.1), inset 0 1px 0 rgba(255,255,255,.9), inset 0 -2px 0 rgba(30,45,70,.06);
  --table-shadow:0 24px 50px -30px rgba(30,45,70,.4), inset 0 1px 0 rgba(255,255,255,.8);
  --flash-alert-ink:#9a2820; --flash-notice-ink:#0b5e3f;
  --danger-soft-ink:#c23a31;
  --warn-ink:#b5730c;
  --warm-ink:#2a56c2;             /* winning-score highlight text (cool) */
  --win-ink:#1f4091;              /* winner names */
  --prod-good:#0f8f63; --prod-bad:#d64236;
  /* celebration herald + floating popups, recast light */
  --herald-bg:linear-gradient(180deg, #ffffff, #eef2f8);
  --herald-scrim:radial-gradient(58% 48% at 50% 42%, rgba(29,39,51,.3), rgba(29,39,51,.12) 68%, transparent);
  --herald-modal-bg:radial-gradient(90% 80% at 50% 40%, #eef2f8, #dde4ee 78%);
  --herald-eq-bg:rgba(29,39,51,.06);
  --pill-bg:linear-gradient(180deg, #ffffff, #eef2f8);
  --pill-you-bg:linear-gradient(180deg, #ffffff, #e6f4f3);
  --pill-you-ink:#0a4f4a;
  --pop-bg:linear-gradient(180deg, #ffffff, #eef2f8);
  --pop-arrow:#eef2f8;
  --pop-btn-bg:rgba(29,39,51,.03);
  --scores-bg:var(--app-bg);      /* the scoreboard shows the body page background itself */
  --area-bg:var(--app-bg);        /* …and so does the playing area (not a white panel) */
  /* the "Your turn" pill's teal-green (--info), promoted to the primary surface */
  --grn-1:#15a3a7; --grn-2:#0c8f93; --grn-3:#0a757a; --grn-4:#075c60; --grn-rgb:12,143,147;
  --cardback-top:#21b9bd; --cardback-bot:var(--grn-2);     /* teal-green card backs, lightened two levels (top extends one step past --grn-1) */
  --cardback-weave:rgba(255,255,255,.1); --cardback-edge:rgba(255,255,255,.2);
  /* primary buttons: a "licked hard-candy" face — a deep jewel-green body under a
     bright, concentrated wet specular bloom at the top, lit from below by a
     translucent bounce, haloed by a sun-pop glow. Smooth (no weave), glossy. */
  --btn-primary:radial-gradient(62% 38% at 50% 1%, rgba(255,255,255,.85), rgba(255,255,255,.26) 22%, transparent 48%), radial-gradient(92% 60% at 50% 120%, rgba(80,220,205,.32), transparent 58%), linear-gradient(180deg, #0b8781, #09716c 44%, #075853 72%, #064340);
  --btn-primary-ink:#ffffff;
  --btn-primary-hi:radial-gradient(64% 40% at 50% 1%, rgba(255,255,255,.92), rgba(255,255,255,.3) 22%, transparent 50%), radial-gradient(92% 60% at 50% 120%, rgba(100,235,220,.4), transparent 58%), linear-gradient(180deg, #0f9d95, #0c847e 44%, #0a6a64 72%, #07524e);
  --btn-primary-shadow:inset 0 1.5px 0 rgba(255,255,255,.72), inset 0 -9px 18px -9px rgba(60,205,190,.4), inset 0 -1px 2px rgba(0,28,26,.5), 0 3px 7px -2px rgba(3,32,30,.45), 0 14px 30px -8px rgba(4,78,74,.6), 0 0 42px -5px rgba(11,150,140,.78);
  --btn-text-shadow:0 1px 2px rgba(1,30,28,.55);
  --pill-grad:linear-gradient(180deg, #0d938a, #065a53); --pill-glow:11,150,140;
  /* One deep teal shared by the light-theme "Draw a card" + "Declare win" buttons. */
  --deep-teal-1:#086a63; --deep-teal-2:#033934;
  /* Dark slate for the Cool Air multiplier cards — the operator chip's blue-grey slate
     (--op-bg), darkened several levels, so a multiplier reads as a heavier kin of the
     operators; distinct from the emerald treasures and the vivid blue primary. */
  --mult-1:#566178; --mult-2:#394253;
  /* Jewel-emerald for the Cool Air treasure cards — off the blue primary/--special
     (the old deep blue read like the primary) and clearly distinct from the violet
     multipliers, so the two special cards never blur together. */
  --treasure-1:#0b926f; --treasure-2:#05482f;
  --select-ring:var(--grn-2); --select-glow:var(--grn-rgb); /* selected hand-card highlight */
  --banner-rgb:23,182,173; /* round-ended banner bg/rim/glow — brighter teal */
  /* radii + motion */
  --r-lg:18px; --r-md:12px; --r-sm:9px;
  --ease:cubic-bezier(.2,.7,.3,1);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,system-ui,"Helvetica Neue",Arial,sans-serif;
  --font-display:'Fraunces',Georgia,'Times New Roman',serif;        /* wordmark, headings, card digits */
  --font-num:'Space Grotesk',ui-monospace,SFMono-Regular,Menlo,monospace; /* scores, timers, products */
  color-scheme:light;
}

:root[data-theme="felt"]{
  /* ===== Felt — the original dark emerald theme, preserved ===== */
  --felt-deep:#061c17; --felt-mid:#114a40; --felt-high:#1c6b5b; --rim:#2f8070;
  --well-top:#18544a; --well-bot:#0c2f28; --well-rim:#0e3f36; /* playmat lifted ~2 levels lighter */
  --surface:rgba(17,58,49,.5); --surface-2:rgba(24,72,62,.72); /* panels lifted to sit under the raised mat/cards */
  --surface-edge:rgba(150,220,202,.16); --hair:rgba(255,255,255,.07);
  --ink:#f1f8f5; --ink-dim:#aacdc2; --ink-faint:#86b3a7;
  --card-top:#F9F2DE; --card-bot:#EADCB9; --card-ink:#232733; --card-edge:#cdbc93;
  --card-shadow:rgba(4,24,19,.42); /* softened for the lighter table */
  --op-ink:#F4ECD6; --op-bg:linear-gradient(180deg,#2a3341,#131b28); /* darker op chip for the dark table */
  --gold:#F4B64A; --gold-2:#E09326; --gold-ink:#3a2906;
  --info:#2fd0c6; --info-2:#17a79e; --info-ink:#043430;
  --special:#8470f4; --special-2:#4a32b4; --special-rgb:132,112,244;
  --good:#3be0a6; --good-ink:#05341e;
  --danger:#ff5a52; --danger-ink:#3a0b08;
  --app-bg: /* ground lifted off near-black so the brighter mat/cards read as raised, not isolated */
    radial-gradient(125% 90% at 50% -12%, var(--felt-high), transparent 55%),
    radial-gradient(140% 120% at 50% 118%, #103c33, transparent 60%),
    linear-gradient(180deg,#114138,#082620);
  --nav-bg:linear-gradient(180deg, rgba(17,58,49,.74), rgba(13,48,40,.56));
  --btn-hover-bg:rgba(27,78,67,.9);
  --input-bg:rgba(8,33,27,.5);
  --ghost-bg:rgba(255,255,255,.05);
  --recess:rgba(0,0,0,.13);  /* slot wells softened to suit the lighter mat */
  --recess-2:rgba(0,0,0,.2);  /* strip (lane) recess, softened likewise */
  --cell-line:rgba(243,247,245,.22);
  --strip-bg:var(--recess-2); --strip-rim:var(--hair); --slot-bg:var(--recess); --slot-line:var(--cell-line);
  --well-glow:#114a3e; /* lifted with the well above */
  --board-inset:inset 0 8px 22px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.08), inset 0 -2px 0 rgba(0,0,0,.22); /* softer: lighter mat reads raised, not carved into black */
  --table-shadow:0 0 0 1px rgba(0,0,0,.25), 0 32px 60px -30px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.1), inset 0 -44px 80px -44px rgba(0,0,0,.32); /* softened inner vignette */
  --flash-alert-ink:#ffd7d2; --flash-notice-ink:#c8f4e2;
  --danger-soft-ink:#ffc2bd;
  --warn-ink:#ffd38a;
  --warm-ink:#ffe9c2;
  --win-ink:#ffe0a0;
  --prod-good:#8ff0c2; --prod-bad:#ff9a90;
  --herald-bg:linear-gradient(180deg, rgba(27,80,69,.97), rgba(15,55,46,.97));
  --herald-scrim:radial-gradient(58% 48% at 50% 42%, rgba(6,26,21,.74), rgba(6,20,16,.34) 68%, transparent);
  --herald-modal-bg:radial-gradient(90% 80% at 50% 40%, #134339, #0a2a22 78%);
  --herald-eq-bg:rgba(0,0,0,.2);
  --pill-bg:linear-gradient(180deg, rgba(27,80,69,.97), rgba(15,55,46,.97));
  --pill-you-bg:linear-gradient(180deg, rgba(19,78,70,.97), rgba(12,54,48,.97));
  --pill-you-ink:#eafffb;
  --pop-bg:linear-gradient(180deg, rgba(23,72,62,.98), rgba(13,48,41,.98));
  --pop-arrow:rgba(13,48,41,.98);
  --pop-btn-bg:rgba(255,255,255,.07);
  --primary-rgb:244,182,74; --primary-lite-rgb:255,241,205;
  --primary-hi:linear-gradient(180deg,#F8C85F,#E79B2A);
  --herald-head:linear-gradient(100deg,#E09326,#FFF4D0,#F4B64A,#FFF4D0,#E09326);
  --scores-bg:rgba(0,0,0,.18);
  --area-bg:var(--surface);
  --cardback-top:#1f6e60; --cardback-bot:#0d433a;
  --cardback-weave:rgba(243,234,211,.1); --cardback-edge:rgba(243,234,211,.3);
  --btn-primary:radial-gradient(62% 40% at 50% 0%, rgba(255,255,255,.5), transparent 55%), linear-gradient(180deg,#FFC65C,#E8982A);
  --btn-primary-ink:var(--gold-ink);
  --btn-primary-hi:radial-gradient(62% 40% at 50% 0%, rgba(255,255,255,.62), transparent 55%), linear-gradient(180deg,#FFD070,#EFA02E);
  --btn-primary-shadow:inset 0 1px 0 rgba(255,255,255,.5), 0 8px 20px -5px rgba(var(--primary-rgb),.72), 0 0 34px -6px rgba(244,182,74,.7);
  --pill-grad:linear-gradient(180deg, #FBC259, #E59829); --pill-glow:var(--primary-rgb);
  --select-ring:var(--gold); --select-glow:var(--primary-rgb);
  --banner-rgb:var(--primary-rgb); /* felt keeps its gold banner */
  --btn-text-shadow:none;
  color-scheme:dark;
}

:root[data-theme="warm"]{
  /* ===== Warm Tabletop — the ivory card stock extended to the whole table =====
     Option B from the lighter-palette mockup: a warm parchment ground wearing
     felt's accent ROLES — amber is the primary move, teal marks whose turn it is,
     purple is the special cards — so it reads as the felt game lit by a warm lamp,
     not the cool daylight of Cool Air. A light theme; it mirrors the token set felt
     overrides, so nothing leaks in from the cool base. */
  /* the .table "MultiGame" section matches the .your-area panel's --area-bg below it */
  --felt-deep:#f4eddd; --felt-mid:#fcf8ef; --felt-high:#fcf8ef; --rim:#e3d8bf;
  --well-top:#f9f1dc; --well-bot:#f4e8ce; --well-rim:#e5dbb9;
  --surface:rgba(252,248,238,.82); --surface-2:#fcf8ee;
  --surface-edge:rgba(44,40,32,.15); --hair:rgba(44,40,32,.09);
  --ink:#2c2820; --ink-dim:#6d6454; --ink-faint:#9b9078;
  --card-top:#fffdf7; --card-bot:#f1e7cf; --card-ink:#231f16; --card-edge:#d8c79c;
  --card-shadow:rgba(60,45,20,.22);
  /* op-bg: Warm owns a heavier (darker) chip than Cool Air's shared pale slate; op-ink is a light
     warm glyph. The × / = read soft on the chip (~1.9–2.4:1) — a deliberately faint operator. */
  --op-ink:#95876e; --op-bg:linear-gradient(180deg,#d0d6e0,#b8bec9);
  --gold:#c8882a; --gold-2:#a96e15; --gold-ink:#38280a;
  --info:#2b8e86; --info-2:#1f6f68; --info-ink:#ffffff;
  --special:#7d52bf; --special-2:#5e39a0; --special-rgb:125,82,191;
  /* Warm raspberry for the multiplier cards — distinct from the gold primary, the
     teal turn-state, and the bronze treasures. */
  --mult-1:#c14d7f; --mult-2:#8a2f56;
  /* Warm bronze/copper for the warm treasure cards — a warm 'precious metal' that fits
     the parchment ground, sitting deeper and redder than the gold primary buttons and
     clear of the raspberry multipliers (was a cool emerald that fought the warm palette). */
  --treasure-1:#b85e22; --treasure-2:#6f330e;
  --good:#2a8f5a; --good-ink:#ffffff;
  --danger:#d6453b; --danger-ink:#ffffff;
  --app-bg:
    radial-gradient(125% 90% at 50% -12%, #fdf9f0, transparent 55%),
    radial-gradient(140% 120% at 50% 118%, #efe5cd, transparent 60%),
    linear-gradient(180deg,#f8f2e5,#eee4cf);
  --nav-bg:linear-gradient(180deg, rgba(252,248,238,.85), rgba(252,248,238,.6));
  --btn-hover-bg:#f3ebd8;
  --input-bg:#fffdf7;
  --ghost-bg:rgba(44,40,32,.03);
  --recess:rgba(44,40,32,.03);
  --recess-2:rgba(44,40,32,.05);
  --cell-line:rgba(44,40,32,.22);
  /* playmat strips/slots/cells: their own (lighter) tints, so lightening the mat
     here doesn't drag the shared --recess/--hair panels with it */
  --strip-bg:rgba(44,40,32,.03); --strip-rim:rgba(44,40,32,.06); --slot-bg:rgba(44,40,32,.018); --slot-line:var(--cell-line);
  --well-glow:rgba(236,224,192,.5);
  --board-inset:inset 0 6px 16px rgba(60,45,20,.12), inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 0 rgba(60,45,20,.06);
  --table-shadow:0 24px 50px -30px rgba(60,45,20,.42), inset 0 1px 0 rgba(255,255,255,.75);
  --flash-alert-ink:#9a2820; --flash-notice-ink:#0b5e3f;
  --danger-soft-ink:#b23a2f;
  --warn-ink:#9a6b12;
  --warm-ink:#8a5e14;
  --win-ink:#7a5410;
  --prod-good:#1f8a58; --prod-bad:#cf4030;
  --herald-bg:linear-gradient(180deg, #fdfaf1, #f1e7cf);
  --herald-scrim:radial-gradient(58% 48% at 50% 42%, rgba(44,40,32,.3), rgba(44,40,32,.12) 68%, transparent);
  --herald-modal-bg:radial-gradient(90% 80% at 50% 40%, #f6efdd, #e7dabb 78%);
  --herald-eq-bg:rgba(44,40,32,.06);
  --pill-bg:linear-gradient(180deg, #fdfaf1, #f1e7cf);
  --pill-you-bg:linear-gradient(180deg, #fdfaf1, #e3efe7);
  --pill-you-ink:#13463f;
  --pop-bg:linear-gradient(180deg, #fdfaf1, #f1e7cf);
  --pop-arrow:#f1e7cf;
  --pop-btn-bg:rgba(44,40,32,.04);
  --primary-rgb:200,136,42; --primary-lite-rgb:240,214,156;
  --primary-hi:linear-gradient(180deg,#e2a74c,#c8882a);
  --herald-head:linear-gradient(100deg,#7a4e0c,#d6a954,#8f5e14,#d6a954,#7a4e0c);
  /* scores-bg inherits the base's var(--app-bg); area-bg (the play panel around the mat)
     is a touch lighter than the page so the playmat region reads brighter */
  --area-bg:linear-gradient(180deg,#fcf8ef,#f4eddd);
  --cardback-top:#c8882a; --cardback-bot:#7a4e0c;  /* warm amber card backs — matches the parchment/gold theme */
  --cardback-weave:rgba(255,255,255,.12); --cardback-edge:rgba(255,255,255,.22);
  --btn-primary:radial-gradient(62% 40% at 50% 0%, rgba(255,255,255,.5), transparent 55%), linear-gradient(180deg,#d89a3e,#bf7d1f);
  --btn-primary-ink:var(--gold-ink);
  --btn-primary-hi:radial-gradient(62% 40% at 50% 0%, rgba(255,255,255,.6), transparent 55%), linear-gradient(180deg,#e2a74c,#c8882a);
  --btn-primary-shadow:inset 0 1px 0 rgba(255,255,255,.55), 0 8px 20px -5px rgba(var(--primary-rgb),.6), 0 0 30px -8px rgba(200,136,42,.55);
  --pill-grad:linear-gradient(180deg, #e8ba6b, #d19a46); --pill-glow:var(--primary-rgb);
  --select-ring:var(--gold); --select-glow:var(--primary-rgb);
  --banner-rgb:var(--primary-rgb);
  --btn-text-shadow:none;
  color-scheme:light;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; min-height:100vh; color:var(--ink);
  font-family:var(--font); line-height:1.5; font-size:16px;
  background:var(--app-bg);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
/* faint woven-felt texture over the whole table */
body::before{
  content:""; position:fixed; inset:0; z-index:0; pointer-events:none; opacity:.55;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.03) 0 2px, transparent 2px 4px);
  mix-blend-mode:soft-light;
}

.wrap{ position:relative; z-index:1; max-width:1000px; margin:0 auto;
  padding:28px 16px 64px; display:flex; flex-direction:column; gap:18px; }
/* Game pages: the "MultiGame" .table board should sit ~16px below the navbar. The .wrap
   flex column puts gap:18px between its sections, but three invisible children ahead of
   the board were each counting as a section and stacking ~54px of phantom gap above it:
   the two turbo-cable-stream-source elements, and the #flash wrapper while it holds no
   message. Drop them out of flow so the navbar→board gap is purely the padding-top. */
.wrap:has(#table) turbo-cable-stream-source{ display:none; }
.wrap:has(#table) > #flash:not(:has(.flash)){ display:none; }
.wrap:has(#table){ padding-top:16px; }
/* On the landing the stacked groups (tagline+cards, nav cards, each form card) sit
   well apart — ~2rem beyond the default wrap gap. */
.wrap:has(.hero-lead){ gap:50px; }
/* …except the primary CTA, which sits a touch closer to the pitch: trim the 50px
   group gap above the Start card by m-2 (8px) → ~42px. */
.start-card{ margin-top:-8px; }

/* ---- global navbar (hidden during a game in progress) ---- */
.navbar{ position:relative; z-index:2; border-bottom:1px solid var(--hair);
  background:var(--nav-bg);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
.navbar-inner{ max-width:1000px; margin:0 auto; padding:13px 16px; display:flex; align-items:center;
  justify-content:space-between; gap:12px; }
.navbar .brand{ font-family:var(--font-display); font-weight:800; font-size:1.3rem; letter-spacing:-.01em;
  color:var(--ink); text-decoration:none; }
.navbar .brand:hover{ color:var(--gold); text-decoration:none; }
.nav-right{ display:flex; align-items:center; gap:10px; }
/* Colour-theme picker. A trigger button (a static palette icon) opens a popover
   menu listing the three palettes; the Stimulus controller flips html[data-theme]
   and persists the choice. See the .theme-picker / .theme-menu rules below. */
.nav-theme{ display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px;
  border-radius:999px; cursor:pointer; color:var(--ink); flex:0 0 auto;
  border:1px solid var(--surface-edge); background:var(--ghost-bg);
  transition:border-color .18s var(--ease), background .18s, color .18s, transform .12s var(--ease); }
.nav-theme:hover{ transform:translateY(-1px); color:var(--info); border-color:var(--info); }
.nav-theme .ico{ width:18px; height:18px; display:block; }
/* Language + Appearance triggers carry a text label instead of an icon, so the pill
   grows to fit the word (keeping .nav-theme's colour, border and hover). */
.nav-theme--text{ width:auto; height:auto; padding:8px 14px; border-radius:999px;
  font-family:var(--font); font-weight:700; font-size:.86rem; letter-spacing:-.01em; white-space:nowrap; }
/* The picker: a relatively-positioned wrapper holding the trigger + its popover. */
.theme-picker{ position:relative; display:inline-flex; }
.theme-menu{ position:absolute; top:calc(100% + 8px); right:0; z-index:40; min-width:190px;
  padding:6px; border-radius:var(--r-md); background:var(--pop-bg);
  border:1px solid var(--surface-edge); display:flex; flex-direction:column; gap:2px;
  box-shadow:0 18px 40px -16px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  opacity:0; visibility:hidden; transform:translateY(-6px) scale(.98); transform-origin:top right;
  transition:opacity .16s var(--ease), transform .16s var(--ease), visibility .16s; }
.theme-picker.open .theme-menu{ opacity:1; visibility:visible; transform:none; }
/* Language picker — same popover as the theme picker (reuses .theme-menu / .theme-opt).
   Its rows are links, so clear the default underline and keep the row's ink colour. */
.lang-picker{ position:relative; display:inline-flex; }
.lang-picker.open .theme-menu{ opacity:1; visibility:visible; transform:none; }
.lang-menu .theme-opt,
.lang-menu .theme-opt:hover{ color:var(--ink); text-decoration:none; }
.theme-opt{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; cursor:pointer;
  font-family:var(--font); font-weight:600; font-size:.9rem; color:var(--ink);
  background:transparent; border:1px solid transparent; border-radius:var(--r-sm); padding:9px 10px;
  transition:background .14s, border-color .14s; }
.theme-opt:hover{ background:var(--ghost-bg); border-color:var(--surface-edge); }
.theme-opt .theme-dot{ width:18px; height:18px; border-radius:6px; flex:0 0 auto;
  border:1px solid rgba(0,0,0,.18); box-shadow:inset 0 1px 0 rgba(255,255,255,.3); }
.theme-opt .theme-name{ flex:1 1 auto; white-space:nowrap; }
.theme-opt .theme-check{ width:16px; height:16px; flex:0 0 auto; opacity:0; color:var(--info); }
.theme-opt.is-current .theme-name{ font-weight:800; }
.theme-opt.is-current .theme-check{ opacity:1; }
/* each dot previews that palette — its ground on one half, its primary accent on the other */
.theme-dot.sw-felt{ background:linear-gradient(135deg,#0b2b24 0 50%,#18a06a 50% 100%); }
.theme-dot.sw-cool{ background:linear-gradient(135deg,#e7ecf4 0 50%,#2d6ae5 50% 100%); }
.theme-dot.sw-warm{ background:linear-gradient(135deg,#efe6d2 0 50%,#c8882a 50% 100%); }
a{ color:var(--gold); text-decoration:none; }
a:hover{ text-decoration:underline; }
h1,h2,h3{ font-family:var(--font-display); margin:0; font-weight:800; letter-spacing:-.01em; }
h1{ font-size:clamp(2.1rem,6vw,2.9rem); }
.muted{ color:var(--ink-dim); }
:focus-visible{ outline:2px solid var(--info); outline-offset:2px; border-radius:5px; }

/* ---- flash ---- */
/* The shared flash partial always renders its #flash wrapper (a Turbo target); when it
   carries no message, collapse it so it doesn't eat a column gap above the first card. */
#flash:not(:has(.flash)){ display:none; }
.flash{ border-radius:var(--r-md); padding:12px 16px; font-weight:600; border:1px solid transparent; }
.flash.alert{ background:rgba(255,90,82,.14); border-color:rgba(255,90,82,.6); color:var(--flash-alert-ink); }
.flash.notice{ background:rgba(55,209,154,.14); border-color:rgba(55,209,154,.5); color:var(--flash-notice-ink); }

/* ---- buttons & forms ---- */
.btn{ font-family:var(--font); font-weight:700; font-size:.92rem; letter-spacing:-.01em;
  border:1px solid var(--surface-edge); background:var(--surface-2); color:var(--ink);
  border-radius:var(--r-md); padding:11px 18px; cursor:pointer; text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; gap:.4em;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 2px 6px rgba(0,0,0,.25);
  transition:transform .12s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s, opacity .18s; }
.btn:hover:not(:disabled){ transform:translateY(-1px); background:var(--btn-hover-bg); border-color:rgba(150,220,202,.4); }
.btn:active:not(:disabled){ transform:translateY(0); }
.btn:disabled{ opacity:.38; cursor:not-allowed; box-shadow:none; }
.btn.go{ background:var(--btn-primary); color:var(--btn-primary-ink);
  border-color:transparent; font-weight:800; text-shadow:var(--btn-text-shadow);
  box-shadow:var(--btn-primary-shadow); }
.btn.go:hover:not(:disabled){ background:var(--btn-primary-hi); }
/* "Draw a card" (Cool Air): a plain deep-teal face (no candy shine) with one small
   glow on the RIGHT rim only — the top, bottom and left rims do not glow, and the
   all-round attention pulse is turned off. "Declare win" wears the same deep teal
   (below) but with a symmetric glow; this right-rim treatment and its pulse are the
   Draw button's alone. */
:root[data-theme="cool"] .btn.go.draw-btn{
  background:linear-gradient(180deg, var(--deep-teal-1), var(--deep-teal-2));
  box-shadow:0 1px 3px rgba(1,24,22,.42), 10px 0 22px -4px rgba(9,130,122,.75); }
:root[data-theme="cool"] .btn.go.draw-btn:hover:not(:disabled){
  background:linear-gradient(180deg, #0b7d75, #05443f);
  box-shadow:0 1px 3px rgba(1,24,22,.42), 13px 0 28px -3px rgba(10,145,136,.85); }
/* the pulsating "it's your move" shine is back — kept to the right rim only. */
:root[data-theme="cool"] .btn.go.draw-btn.draw-hint{ animation:draw-right-pulse 1.3s var(--ease) infinite; }
@keyframes draw-right-pulse{
  0%,100%{ box-shadow:0 1px 3px rgba(2,30,28,.38), 9px 0 18px -4px rgba(11,155,145,.6); }
  50%{     box-shadow:0 1px 3px rgba(2,30,28,.38), 18px 0 36px -2px rgba(11,170,158,.92); } }
/* "Declare win" / "Submit your win" (Cool Air): the same deep teal as "Draw a card",
   so the two action buttons match each other and the multiplier cards. A plain face
   with a soft symmetric teal glow; the declare-hint pulse (added when a win is armed)
   still plays on top. Other .btn.go CTAs keep the lighter --btn-primary teal. */
:root[data-theme="cool"] .btn.go[data-builder-target="declareBtn"]{
  background:linear-gradient(180deg, var(--deep-teal-1), var(--deep-teal-2));
  box-shadow:0 1px 3px rgba(1,24,22,.42), 0 6px 16px -7px rgba(7,110,103,.6), 0 0 18px -9px rgba(10,150,140,.5); }
:root[data-theme="cool"] .btn.go[data-builder-target="declareBtn"]:hover:not(:disabled){
  background:linear-gradient(180deg, #0b7d75, #05443f);
  box-shadow:0 1px 3px rgba(1,24,22,.42), 0 8px 20px -7px rgba(7,110,103,.7), 0 0 24px -7px rgba(10,150,140,.6); }
.btn.danger{ border-color:rgba(255,90,82,.6); color:var(--danger-soft-ink); background:rgba(255,90,82,.1); }
/* Draw button breathes when drawing is the move the player owes — the same
   radiating-glow rhythm the active seat (.opp.turn) uses, here in primary gold
   over the base .go shadow, with the label warming in step. A quick 1.3s pulse. */
.btn.go.draw-hint{ animation:draw-shine 1.3s var(--ease) infinite; }
@keyframes draw-shine{
  0%,100%{ box-shadow:inset 0 1px 0 rgba(255,255,255,.4), inset 0 0 0 1px rgba(var(--primary-rgb),.28),
             0 7px 18px -5px rgba(var(--primary-rgb),.55), 0 0 24px -10px rgba(var(--primary-rgb),.5);
           text-shadow:0 0 10px rgba(var(--primary-lite-rgb),0), 0 0 2px rgba(var(--primary-lite-rgb),0); }
  50%{     box-shadow:inset 0 1px 0 rgba(255,255,255,.4), inset 0 0 0 1px rgba(var(--primary-rgb),.55),
             0 7px 18px -5px rgba(var(--primary-rgb),.55), 0 0 40px -4px rgba(var(--primary-rgb),.95);
           text-shadow:0 0 10px rgba(var(--primary-lite-rgb),.95), 0 0 2px rgba(var(--primary-lite-rgb),.8); } }
/* Declare reuses the gold draw-shine when a valid win is arranged; Discard breathes a
   teal version once a card is armed to pass. The builder controller toggles these
   classes as the mat changes; both honour the global reduced-motion kill-switch. */
.btn.go.declare-hint{ animation:draw-shine 1.3s var(--ease) infinite; }
.btn.discard-hint{ animation:discard-shine 1.3s var(--ease) infinite; }
@keyframes discard-shine{
  0%,100%{ box-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 2px 6px rgba(0,0,0,.25),
             inset 0 0 0 1px rgba(47,208,198,.22), 0 0 22px -12px rgba(47,208,198,.45);
           text-shadow:0 0 8px rgba(190,255,247,0); }
  50%{     box-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 2px 6px rgba(0,0,0,.25),
             inset 0 0 0 1px rgba(47,208,198,.55), 0 0 30px -4px rgba(47,208,198,.9);
           text-shadow:0 0 8px rgba(190,255,247,.7); } }

input[type=text], select{ font-family:var(--font); font-size:.98rem; padding:11px 13px;
  border-radius:var(--r-sm); border:1px solid var(--surface-edge);
  background:var(--input-bg); color:var(--ink); width:100%;
  transition:border-color .15s, box-shadow .15s; }
input[type=text]::placeholder{ color:var(--ink-faint); }
input[type=text]:focus, select:focus{ outline:none; border-color:var(--info);
  box-shadow:0 0 0 3px rgba(47,208,198,.22); }
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ font-size:.82rem; font-weight:600; color:var(--ink-dim); }
.card-panel{ background:var(--surface); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border:1px solid var(--surface-edge); border-radius:var(--r-lg); padding:22px;
  display:flex; flex-direction:column; gap:16px;
  box-shadow:0 20px 44px -24px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05); }
.card-panel h2{ font-size:1.35rem; }
.row{ display:flex; gap:14px; flex-wrap:wrap; align-items:flex-end; }
.row .field{ flex:1 1 180px; }
.row .field:has(.btn){ flex:0 0 auto; }

/* ---- landing hero ---- */
.hero{ display:flex; flex-direction:column; gap:14px; align-items:flex-start; padding:12px 4px 2px; }
/* Only the landing hero centers (it alone has a .hero-lead); the how-to-play,
   high-scores and daily heroes stay left-aligned. The landing's "MultiGame" title
   lives in the navbar, so the hero body leads with the tagline + example cards. */
.hero:has(.hero-lead){ align-items:center; padding-bottom:0; }
.hero-lead{ display:flex; flex-direction:column; align-items:center; gap:12px; }
.hero-lead .tagline{ text-align:center; margin:0; }
.hero .tagline{ color:var(--ink-dim); max-width:62ch; font-size:1.04rem; }
.hero .tagline strong{ color:var(--ink); }
/* Standalone pages (how-to-play, high scores, daily — heroes without a .hero-lead):
   center the title, and let the intro paragraph run the full width instead of being
   confined to a narrow 62ch column. */
.hero:not(:has(.hero-lead)) h1{ align-self:stretch; text-align:center; }
.hero:not(:has(.hero-lead)) > .tagline{ max-width:none; }
.deck-preview{ display:flex; align-items:center; gap:9px; margin-top:4px; }
.deck-preview .card{ --cw:48px; }
/* The three "more ways to play" cards under the hero tagline: a centered row that
   wraps to a stack on narrow screens; each whole card is one link. */
/* The "more ways to play" cards: a centered row that wraps to a stack on narrow
   screens; each whole card is one link. Group spacing comes from the wrap gap. */
.nav-cards{ width:100%; display:flex; gap:12px; flex-wrap:wrap; justify-content:center; }
.nav-card{ flex:1 1 190px; max-width:252px; display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:6px; padding:16px 16px 18px; color:var(--ink); text-decoration:none;
  background:var(--surface); border:1px solid var(--surface-edge); border-radius:var(--r-md);
  box-shadow:0 14px 30px -22px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05);
  transition:transform .13s var(--ease), border-color .18s var(--ease), background .18s, box-shadow .18s; }
.nav-card:hover{ transform:translateY(-2px); text-decoration:none; border-color:rgba(150,220,202,.42);
  background:var(--btn-hover-bg); box-shadow:0 20px 36px -22px rgba(0,0,0,.82), inset 0 1px 0 rgba(255,255,255,.06); }
.nav-card .nc-icon{ font-size:1.5rem; line-height:1; }
.nav-card .nc-title{ font-family:var(--font-display); font-weight:700; font-size:1.04rem; color:var(--ink); }
.nav-card .nc-desc{ font-size:.82rem; color:var(--ink-dim); line-height:1.4; }

/* ---- the felt table ---- */
.table{ position:relative; border-radius:22px; padding:clamp(18px,3vw,28px); color:var(--ink);
  background:
    radial-gradient(120% 140% at 50% -20%, var(--felt-high), transparent 60%),
    linear-gradient(180deg, var(--felt-mid), var(--felt-deep));
  border:1px solid var(--rim);
  box-shadow:var(--table-shadow);
  display:flex; flex-direction:column; gap:20px; }
.table .bar{ display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; }
.table .bar h2{ font-size:1.55rem; }
.table .bar h2 a{ color:inherit; text-decoration:none; }
.table .bar h2 a:hover{ text-decoration:underline; text-decoration-color:var(--gold); text-underline-offset:3px; }
.code{ display:inline-flex; align-items:baseline; gap:.5em;
  font-family:var(--font); font-size:.82rem;
  background:var(--scores-bg); background-attachment:fixed; border:1px solid var(--surface-edge);
  padding:7px 14px; border-radius:999px; }
.code-label{ font-weight:600; color:var(--ink-dim); }
.code-value{ font-family:var(--font-num); font-weight:700; color:var(--ink); letter-spacing:.14em; }

.opponents{ display:flex; gap:clamp(12px,3vw,28px); flex-wrap:wrap; justify-content:center; }
.opp{ display:flex; flex-direction:column; align-items:center; gap:8px; min-width:120px;
  padding:14px 16px; border-radius:var(--r-md);
  background:var(--scores-bg); background-attachment:fixed; border:1px solid var(--hair);
  transition:border-color .2s, box-shadow .2s, background .2s; }
.opp.turn{ border-color:var(--info); /* active seat keeps the green fill + teal highlight */
  box-shadow:inset 0 0 0 1px rgba(47,208,198,.3), 0 0 28px -8px rgba(47,208,198,.6);
  animation:seat-pulse 1.5s var(--ease) infinite; }
/* The active seat gently breathes so whose turn it is reads at a glance (and a
   computer's turn is also surfaced by the "playing…" pill, #bot_wait). */
@keyframes seat-pulse{
  0%,100%{ box-shadow:inset 0 0 0 1px rgba(47,208,198,.28), 0 0 22px -10px rgba(47,208,198,.5); }
  50%{ box-shadow:inset 0 0 0 1px rgba(47,208,198,.5), 0 0 34px -6px rgba(47,208,198,.9); }
}
.opp .who{ font-family:var(--font); font-weight:700; font-size:.98rem; }
.opp .score{ color:var(--ink-dim); font-size:.82rem; }
.opp .score strong{ font-family:var(--font-num); color:var(--ink); }
.fan{ display:flex; }
.fan .mini-back{ width:24px; height:34px; margin-left:-14px; border-radius:5px;
  background:repeating-linear-gradient(45deg, var(--cardback-weave) 0 4px, transparent 4px 8px),
    linear-gradient(160deg,var(--cardback-top),var(--cardback-bot));
  border:1px solid var(--cardback-edge); box-shadow:0 2px 5px -2px rgba(0,0,0,.5); }
.fan .mini-back:first-child{ margin-left:0; }

.pile{ display:flex; flex-direction:column; align-items:center; gap:8px; }
.pile .lbl{ font-size:.72rem; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-faint); font-weight:700; }
.card.empty{ background:var(--recess); border:1.5px dashed var(--cell-line); box-shadow:none; }
/* A spent treasure sitting on the discard pile: dimmed, tagged, not takeable. */
.card.spent{ filter:saturate(.55) brightness(.8); }
.card.spent .spent-tag{ position:absolute; bottom:7px; left:50%; transform:translateX(-50%);
  font-size:.5rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase;
  background:rgba(0,0,0,.55); color:#ffdccb; padding:2px 7px; border-radius:999px;
  border:1px solid rgba(255,255,255,.14); }
/* ---- left rail: scoreboard + table log ---- */
.table-body{ display:grid; grid-template-columns:1fr; gap:20px; }
.table-main{ display:flex; flex-direction:column; gap:20px; min-width:0; }
@media (min-width:760px){
  .table-body{ grid-template-columns:1fr 2fr; align-items:start; gap:22px; } /* log left (~1/3), cards+scores right */
  .logbook{ grid-column:1; grid-row:1; align-self:stretch; } /* fill the row height (match the cards+scores column) */
  .table-main{ grid-column:2; grid-row:1; }
}
.scorebook, .logbook{ display:flex; flex-direction:column;
  background:var(--scores-bg); background-attachment:fixed; /* align the page bg through the panel */
  border:1px solid var(--hair); border-radius:var(--r-md); overflow:hidden; }
/* Dark Emerald only: lift the Scores, Table-log and seat cards ~2 levels off the
   dark table. Scoped to these three so the join-code pill (.code), which also reads
   --scores-bg, stays as it was. Background only — the active seat's teal highlight
   (.opp.turn border/shadow/pulse) is untouched. */
:root[data-theme="felt"] .scorebook,
:root[data-theme="felt"] .logbook,
:root[data-theme="felt"] .opp{ background:rgba(28,107,91,.5); }
.score-head{ display:flex; justify-content:space-between; align-items:baseline; gap:8px;
  font-family:var(--font); font-weight:800; font-size:.72rem; letter-spacing:.14em; text-transform:uppercase;
  color:var(--ink-dim); padding:12px 14px 8px; }
.score-head .muted{ font-weight:700; letter-spacing:.07em; font-size:.66rem; color:var(--ink-faint); }
.scorecard-wrap{ overflow-x:auto; padding:0 6px 8px; }
.score-note{ font-size:.74rem; line-height:1.45; color:var(--ink-faint); margin:0 14px 10px; }
.scorecard{ width:100%; border-collapse:collapse; font-family:var(--font-num); font-variant-numeric:tabular-nums; }
.scorecard th, .scorecard td{ padding:6px 8px; font-size:.82rem; text-align:right; white-space:nowrap; }
.scorecard thead th{ font-family:var(--font); color:var(--ink-dim); font-weight:700; border-bottom:1px solid var(--hair);
  vertical-align:bottom; }
.scorecard thead th .pn{ display:inline-block; max-width:7ch; overflow:hidden; text-overflow:ellipsis;
  vertical-align:bottom; }
.scorecard .g{ text-align:left; color:var(--ink-faint); font-weight:700; width:1%; }
.scorecard tbody td{ color:var(--ink); }
.scorecard tbody tr + tr th, .scorecard tbody tr + tr td{ border-top:1px solid var(--hair); }
.scorecard td.z{ color:var(--ink-faint); }       /* a game that player didn't score */
.scorecard td.pt{ color:var(--warm-ink); font-weight:700; } /* the player who won that game */
.scorecard tr.now th, .scorecard tr.now td{ color:var(--ink-faint); }
.scorecard tfoot th, .scorecard tfoot td{ border-top:1px solid var(--surface-edge);
  font-weight:800; padding-top:8px; color:var(--ink); }
.scorecard thead th.leader .pn, .scorecard tfoot td.leader{ color:var(--win-ink); }
.scorecard .turn-dot{ color:var(--info); font-size:.7em; }
/* "Won with" column: left-aligned prose that wraps, takes the leftover width */
.scorecard .combo{ text-align:left; white-space:normal; width:99%; padding-left:14px; }
.scorecard thead th.combo{ color:var(--ink-dim); }
.scorecard tbody td.combo{ color:var(--ink); font-size:.82rem; }
.scorecard tr.now td.combo{ color:var(--ink-faint); font-style:italic; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.log{ flex:1; overflow:auto; font-size:.8rem; color:var(--ink-dim);
  display:flex; flex-direction:column; gap:4px; padding:0 14px 12px; }
.log .score-head{ padding:12px 0 8px; }
.log > div{ opacity:.9; }

/* ---- centered status header + round-ended banner ---- */
.table-status{ display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center; }
.table-status.round-banner{ padding:14px 16px; color:var(--ink);
  background:linear-gradient(180deg, rgba(var(--banner-rgb),.16), rgba(var(--banner-rgb),.04));
  border:1px solid rgba(var(--banner-rgb),.55); border-radius:var(--r-md);
  box-shadow:0 0 26px -10px rgba(var(--banner-rgb),.5); }
.status-pill{ display:inline-flex; align-items:center; gap:.4em; font-family:var(--font); font-weight:800;
  font-size:.7rem; letter-spacing:.1em; text-transform:uppercase; border-radius:999px; padding:6px 14px;
  background:linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,.1) 48%, transparent 72%), var(--pill-grad); color:var(--gold-ink);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.65), 0 3px 18px -2px rgba(var(--pill-glow),.9), 0 0 12px rgba(var(--pill-glow),.4); }
/* The final game's double-points pill: a distinct purple so it reads as a special
   stake, with a soft glow and (motion allowed) a gentle pulse. */
.final-pill{ background:linear-gradient(165deg,var(--special),var(--special-2)); color:#fff;
  box-shadow:0 0 26px -5px rgba(132,112,244,.95); animation:final-pulse 1.8s var(--ease) infinite; }
@keyframes final-pulse{ 0%,100%{ box-shadow:0 0 24px -7px rgba(132,112,244,.85); }
  50%{ box-shadow:0 0 34px -3px rgba(132,112,244,1); } }
.rb-text{ font-size:.92rem; max-width:62ch; margin:2px auto 0; }
.rb-text strong{ color:var(--win-ink); }

/* ---- round-win celebration overlay (#round_herald) ---- */
/* A full-viewport, click-through announcement that pops when any player wins a
   round, holds for a few seconds, then fades — so a new round is never a silent
   swap of hands. Shown by toggling .show from the round-herald controller. */
.herald{ position:fixed; inset:0; z-index:60; display:grid; place-items:center; padding:24px;
  pointer-events:none; opacity:0; visibility:hidden;
  background:var(--herald-scrim);
  transition:opacity .45s var(--ease), visibility .45s; }
.herald.show{ opacity:1; visibility:visible; }
.herald-card{ position:relative; max-width:min(92vw,440px); text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:10px; padding:28px 30px 24px;
  border-radius:var(--r-lg); border:1px solid rgba(var(--primary-rgb),.6);
  background:var(--herald-bg);
  box-shadow:0 30px 70px -24px rgba(0,0,0,.85), 0 0 48px -10px rgba(var(--primary-rgb),.6),
    inset 0 1px 0 rgba(255,255,255,.08);
  animation:herald-pop .5s var(--ease) both; }
.herald-trophy{ font-size:3.3rem; line-height:1; filter:drop-shadow(0 6px 14px rgba(0,0,0,.5));
  animation:herald-bounce .65s var(--ease) both; }
.herald-head{ font-family:var(--font-display); font-weight:900; letter-spacing:-.01em; line-height:1.1;
  font-size:clamp(1.55rem,5.2vw,2.05rem);
  background:var(--herald-head);
  background-size:200% 100%; background-position:0 0;
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; color:transparent;
  text-shadow:0 0 26px rgba(var(--primary-rgb),.4); animation:herald-shine 2.4s linear infinite; }
/* Warm: a touch more vertical room around the round-win headline (my-2 = .5rem block). */
:root[data-theme="warm"] .herald-head{ margin-block:.5rem; }
.herald-eq{ font-family:var(--font-num); font-weight:700; font-size:1.02rem; color:var(--warm-ink);
  background:var(--herald-eq-bg); border:1px solid rgba(var(--primary-rgb),.42); border-radius:999px; padding:6px 16px; }
.herald-score{ font-family:var(--font-num); font-weight:700; font-size:1.7rem; color:var(--prod-good);
  text-shadow:0 0 22px rgba(55,209,154,.5); }
.herald-foot{ font-size:.86rem; color:var(--ink-dim); max-width:34ch; }
/* A computer's win is announced in warm amber (not the viewer-win blue) in Cool Air;
   felt already celebrates in gold, so it's left alone. */
/* background-IMAGE (not the shorthand) so the base rule's background-clip:text and
   background-size survive — otherwise the amber fills the box and the clipped title
   text disappears. */
:root[data-theme="cool"] .herald.botwin .herald-head{
  background-image:linear-gradient(100deg,#8f5e12,#ffe2a0,#d99a24,#ffe2a0,#8f5e12); }
:root[data-theme="cool"] .herald.botwin .herald-eq{ color:#a9731a; }
:root[data-theme="cool"] .herald.botwin .herald-score{ color:#a9731a; text-shadow:0 0 22px rgba(217,154,36,.45); }
/* …and the two PERSISTENT spots that outlive the fade-out overlay: the round-ended
   banner's winner name and that round's cell in the Scores panel. Both are blue
   (--win-ink / --warm-ink) for a human win on Cool Air; a computer win recolours them
   to the same warm amber so the overlay and the lasting record agree. Cool-Air-only —
   Warm and Felt already celebrate in gold, so a bot win needs no re-colour there. */
:root[data-theme="cool"] .round-banner.bot-won .rb-text strong{ color:#a9731a; }
:root[data-theme="cool"] .scorecard td.pt.bot{ color:#a9731a; }
@keyframes herald-pop{ from{ opacity:0; transform:translateY(16px) scale(.9); } to{ opacity:1; transform:none; } }
@keyframes herald-bounce{ 0%{ transform:scale(.3) rotate(-12deg); opacity:0; }
  60%{ transform:scale(1.18) rotate(5deg); } 100%{ transform:scale(1) rotate(0); opacity:1; } }
@keyframes herald-shine{ from{ background-position:200% 0; } to{ background-position:-200% 0; } }
/* Held variant: the viewer's own win or a computer's win waits for a click instead
   of fading. It becomes clickable (button or backdrop dismisses) and goes fully
   opaque in the table's own ground — the next round is already dealt underneath, so
   it stays hidden until the player clicks to reveal it (and start its clock). */
.herald.modal{ pointer-events:auto; cursor:pointer;
  background:var(--herald-modal-bg); }
.herald-continue{ margin-top:6px; font-family:var(--font); font-weight:800; font-size:.98rem;
  letter-spacing:-.01em; cursor:pointer; color:var(--btn-primary-ink); border:1px solid transparent;
  border-radius:var(--r-md); padding:12px 22px; text-shadow:var(--btn-text-shadow);
  background:var(--btn-primary);
  box-shadow:var(--btn-primary-shadow);
  transition:transform .12s var(--ease), box-shadow .18s var(--ease), background .18s; }
.herald-continue:hover{ transform:translateY(-1px); background:var(--btn-primary-hi); }
.herald-continue:active{ transform:translateY(0); }

/* ---- "computer is playing…" pill (#bot_wait) ---- */
/* A click-through pill that fades in and out while a discard is in flight to a bot
   seat, so the computer visibly takes its turn — and rests on "Your turn" otherwise.
   #your_area is a one-cell grid; the body and this pill share that cell, and the
   pill rests centered in the slot the action bar reserves below itself. Toggled by
   the controller. (--btn-w sizes the four turn buttons; see .controls-row.) */
#your_area{ display:grid; --btn-w:160px; }
#your_area_body{ grid-column:1; grid-row:1; }
.bot-wait{ grid-column:1; grid-row:1; align-self:end; justify-self:center; z-index:5;
  /* The pill rests centered in the gap just ABOVE the Resign row (which reserves it
     with margin-top). Its offset is measured from the padded bottom of the seat panel,
     so it must clear the panel's bottom padding (~22px) PLUS the Resign button beneath
     it — hence ~86px, which leaves a comfortable gap on both desktop and mobile.
     Resign lives outside the sticky .controls, so on short viewports the two stay
     anchored to the same body bottom and never cross. */
  margin-bottom:77px; margin-left:0;
  display:flex; align-items:center; gap:11px; pointer-events:none;
  padding:9px 18px; border-radius:999px;
  transform:translateY(8px); opacity:0; visibility:hidden;
  background:var(--pill-bg);
  border:1px solid var(--surface-edge); color:var(--ink);
  font-family:var(--font); font-weight:700; font-size:.9rem;
  box-shadow:0 14px 34px -16px rgba(0,0,0,.8), 0 0 26px -12px rgba(132,112,244,.65);
  transition:opacity .3s var(--ease), transform .3s var(--ease), visibility .3s; }
.bot-wait.show{ opacity:1; visibility:visible; transform:translateY(0); }
.bot-wait-dots{ display:inline-flex; gap:5px; }
.bot-wait-dots i{ width:7px; height:7px; border-radius:50%; background:#b7a7ff;
  animation:bot-dot 1s var(--ease) infinite; }
.bot-wait-dots i:nth-child(2){ animation-delay:.16s; }
.bot-wait-dots i:nth-child(3){ animation-delay:.32s; }
@keyframes bot-dot{ 0%,100%{ opacity:.3; transform:translateY(0); } 50%{ opacity:1; transform:translateY(-5px); } }
/* "Your turn" resting state: the same pill, recoloured teal — the INFO accent that
   marks whose move it is — with a steady glow and a steady teal dot in place of
   the bot's dots. */
.bot-wait.you{ color:var(--pill-you-ink); border-color:rgba(47,208,198,.55);
  background:var(--pill-you-bg);
  box-shadow:0 14px 34px -16px rgba(0,0,0,.8), 0 0 26px -10px rgba(47,208,198,.7); }
.bot-wait.you .bot-wait-text{ letter-spacing:.01em; }
.bot-wait-pulse{ width:9px; height:9px; border-radius:50%; background:var(--info); flex:0 0 auto; }

/* ---- cards (shared) ---- */
.card{ --cw:54px; width:var(--cw); height:calc(var(--cw)*1.42); border-radius:11px; position:relative;
  display:flex; align-items:center; justify-content:center; font-family:var(--font-num); font-weight:800;
  font-size:calc(var(--cw)*.52); line-height:1; user-select:none; flex:0 0 auto; }
/* The big digit is the signature mark — set it in the display serif (engraved-card feel). */
.card.num{ font-family:var(--font-display); font-weight:900;
  background:linear-gradient(165deg, var(--card-top), var(--card-bot)); color:var(--card-ink);
  border:1px solid var(--card-edge);
  box-shadow:0 4px 10px -3px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.65); }
.card.op{ width:calc(var(--cw)*.6); height:calc(var(--cw)*.6); border-radius:9px; align-self:center;
  background:var(--op-bg); color:var(--op-ink);
  font-size:calc(var(--cw)*.4); box-shadow:0 2px 6px -2px rgba(0,0,0,.5); }
.back{ background:repeating-linear-gradient(45deg, var(--cardback-weave) 0 7px, transparent 7px 14px),
    linear-gradient(160deg,var(--cardback-top),var(--cardback-bot)); border:1.5px solid var(--cardback-edge);
  box-shadow:0 4px 10px -3px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08); }
/* special cards: multipliers and treasures — never go on the mat */
.card.special{ color:#fff; font-family:var(--font); font-size:calc(var(--cw)*.36); font-weight:800; letter-spacing:-.02em; cursor:pointer;
  border:1px solid rgba(255,255,255,.2);
  box-shadow:0 4px 10px -3px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25);
  transition:transform .13s var(--ease), box-shadow .18s var(--ease); }
.rail .card.special:hover{ transform:translateY(-3px); }
.card.special.mult{ background:linear-gradient(165deg,#1fb9b2,#0d6f78); color:#f0fffd; }
/* Light themes: recolour the multiplier cards to each theme's --mult-* accent (Warm
   raspberry, Cool Air dark slate), distinct from the turn-state and the treasures. Felt
   keeps the brighter teal above, which reads better on the dark table. */
:root[data-theme="cool"] .card.special.mult,
:root[data-theme="warm"] .card.special.mult{ background:linear-gradient(165deg,var(--mult-1),var(--mult-2)); }
.card.special.treasure{ background:linear-gradient(165deg,var(--special),var(--special-2)); color:#fff; }
/* Light themes: recolour the treasure cards to each theme's --treasure-* accent (Cool Air
   jewel-emerald, Warm bronze), off the blue/gold primaries and distinct from the
   multipliers. Felt keeps the brighter indigo above — it reads better on the dark table. */
:root[data-theme="cool"] .card.special.treasure,
:root[data-theme="warm"] .card.special.treasure{ background:linear-gradient(165deg,var(--treasure-1),var(--treasure-2)); }
.card.special.selected{ outline:3px solid var(--select-ring); outline-offset:2px;
  box-shadow:0 12px 22px -6px rgba(var(--select-glow),.5); }
.redraw-notice{ display:flex; align-items:center; gap:14px; flex-wrap:wrap;
  /* the redraw is triggered by holding multiplier cards, so the notice wears the
     --special accent — themed (was a hardcoded felt purple that read off-palette on
     the two light themes). */
  background:rgba(var(--special-rgb),.14); border:1px solid rgba(var(--special-rgb),.5); border-radius:var(--r-md);
  padding:12px 16px; font-size:.92rem; color:var(--ink); }
.redraw-notice form{ margin:0; }

/* ---- your area / builder ---- */
.your-area{ background:var(--area-bg); background-attachment:fixed; backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border:1px solid var(--surface-edge); border-radius:var(--r-lg); padding:22px;
  display:flex; flex-direction:column; gap:16px;
  box-shadow:0 20px 44px -24px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05); }
.your-area h2{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; font-size:1.4rem; }
.your-area h2 strong{ font-family:var(--font-num); }
/* ---- your-area header: the discard + stock piles, centered above the mat ---- */
/* The negative bottom margin pulls the mat up toward the discard/stock piles, so the
   piles sit close above the playing strip instead of floating well apart from it. */
.area-head{ display:flex; align-items:center; justify-content:center; gap:16px 20px; flex-wrap:wrap; margin-bottom:-10px; }
.time-left{ display:inline-flex; align-items:center; gap:.45em; flex-wrap:wrap;
  font-family:var(--font); font-weight:700; }
.time-left .tl-label{ color:var(--ink-dim); font-weight:600; font-size:.95rem; }
.time-left .tl-value{ font-family:var(--font-num); font-size:1.45rem; font-weight:800; font-variant-numeric:tabular-nums; color:var(--ink); }
.time-left .tl-value.warn{ color:var(--warn-ink); text-shadow:0 0 16px rgba(255,170,90,.5); }
.area-piles{ display:flex; align-items:flex-start; gap:clamp(14px,4vw,26px); flex-wrap:wrap; }
.badge{ background:linear-gradient(180deg,var(--info),var(--info-2)); color:var(--info-ink);
  font-size:.7rem; font-weight:800; padding:4px 11px; border-radius:999px; text-transform:uppercase;
  letter-spacing:.06em; box-shadow:inset 0 1px 0 rgba(255,255,255,.35), 0 2px 14px -2px rgba(47,208,198,.85); }
/* The mat is a recessed well: darker + cooler than the table, with a deep inset
   shadow, so the ivory strips read as sitting down inside it rather than on a
   surface that echoes the felt. */
.board{ background:
    radial-gradient(130% 120% at 50% 118%, var(--well-glow), transparent 55%),
    linear-gradient(180deg, var(--well-top), var(--well-bot));
  border:1px solid var(--well-rim); border-radius:var(--r-lg); padding:16px; min-height:104px; color:var(--ink);
  display:flex; flex-direction:column; gap:12px; justify-content:center; margin-top:4px;
  box-shadow:var(--board-inset); }
.lane{ display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap; background:var(--strip-bg);
  border:1px solid var(--strip-rim); border-radius:var(--r-md); padding:12px; }
.num-group{ display:flex; gap:4px; padding:5px; border-radius:10px; background:var(--slot-bg); }
/* The prod/check status sits with the centred strip content (its old margin-left:auto
   floated it to the right edge, which would have cancelled the lane's justify-content). */
.lane-right{ display:flex; align-items:center; gap:12px; }
.check{ width:26px; height:26px; border-radius:8px; border:2px solid var(--surface-edge);
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:.9rem; }
.check.on{ background:var(--good); border-color:var(--good); color:var(--good-ink);
  box-shadow:0 0 16px -4px rgba(55,209,154,.7); }
.prod{ font-family:var(--font-num); font-weight:700; font-size:.95rem; color:var(--ink-dim); font-variant-numeric:tabular-nums; }
.prod.good{ color:var(--prod-good); } .prod.bad{ color:var(--prod-bad); }
.clear-strip{ font-size:.74rem; font-weight:600; border:1px solid var(--surface-edge);
  background:var(--ghost-bg); color:var(--ink); border-radius:8px; padding:5px 10px; cursor:pointer;
  transition:background .15s, border-color .15s; }
.clear-strip:hover:not(:disabled){ background:rgba(255,90,82,.14); border-color:rgba(255,90,82,.5); }
.clear-strip:disabled{ opacity:.35; cursor:default; }
/* Clear and the prod/check status (.lane-right) share a centered line below the
   strip: .lane-foot takes the full lane width (flex-basis:100%) so it always wraps
   onto its own line under the equation instead of trailing the end of it. */
.lane-foot{ flex-basis:100%; display:flex; align-items:center; justify-content:center; gap:12px; }
/* The × / = operators ON THE MAT run ~20% larger than the shared .card.op size
   (.6→.72, .4→.48 of --cw), matching the enlarged slots so the whole equation row
   scales together. Scoped to .lane, so the operator chips elsewhere are untouched. */
.lane .card.op{ width:calc(var(--cw)*.72); height:calc(var(--cw)*.72); font-size:calc(var(--cw)*.48); }
/* The placement slots (and the digit they hold) run ~20% larger than the hand cards,
   so the equation being built reads as the focal area of the mat. */
.cell{ --cw:55px; position:relative; width:var(--cw); height:calc(var(--cw)*1.42); border-radius:10px; margin:2px;
  display:flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:900;
  font-size:calc(var(--cw)*.52); color:var(--ink); cursor:pointer;
  border:1.5px dashed var(--slot-line); background:var(--slot-bg);
  transition:border-color .15s, background .15s; }
.cell:hover{ border-color:rgba(var(--primary-rgb),.6); }
.cell.filled{ background:linear-gradient(165deg, var(--card-top), var(--card-bot)); color:var(--card-ink);
  border:1px solid var(--card-edge); border-style:solid;
  box-shadow:0 3px 8px -3px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.6); }
.cell.drop{ border-color:var(--gold); border-style:solid; background:rgba(var(--primary-rgb),.12); }
.cell .dot{ width:6px; height:6px; border-radius:50%; background:var(--slot-line); }
/* ◀/▶ "move this card" popup: click a placed card to open it; the arrows shift the
   card one slot along the strip (swapping with whatever is there). It renders inside
   the cell and floats just above it, so a Turbo re-render can't orphan it. */
.cell.moving{ border-color:var(--info); z-index:3;
  box-shadow:0 0 0 2px rgba(47,208,198,.4), 0 3px 8px -3px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.6); }
.cell-move{ position:absolute; bottom:calc(100% + 7px); left:50%; transform:translateX(-50%);
  display:flex; gap:5px; padding:5px; border-radius:11px; z-index:6; cursor:default;
  background:var(--pop-bg);
  border:1px solid var(--info-2); box-shadow:0 12px 26px -10px rgba(0,0,0,.85); }
.cell-move::after{ content:""; position:absolute; top:100%; left:50%; transform:translateX(-50%);
  border:6px solid transparent; border-top-color:var(--pop-arrow); }
.cm-btn{ font-family:var(--font-num); font-weight:700; font-size:.98rem; line-height:1;
  width:30px; height:30px; border-radius:8px; cursor:pointer; color:var(--ink);
  border:1px solid var(--surface-edge); background:var(--pop-btn-bg);
  display:flex; align-items:center; justify-content:center;
  transition:background .14s, border-color .14s, transform .1s var(--ease); }
.cm-btn:hover:not(:disabled){ background:rgba(47,208,198,.2); border-color:var(--info); transform:translateY(-1px); }
.cm-btn:active:not(:disabled){ transform:translateY(0); }
.cm-btn:disabled{ opacity:.3; cursor:default; }
.rail{ display:flex; gap:7px; flex-wrap:wrap; min-height:80px; align-items:center; padding:4px 0; margin-top:8px; }
.rail .card{ margin:1px; }
.rail .card.num{ cursor:grab; transition:transform .13s var(--ease), box-shadow .18s var(--ease); }
.rail .card.num:hover{ transform:translateY(-4px);
  box-shadow:0 12px 20px -6px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.7); }
.rail .card.num.selected{ outline:3px solid var(--select-ring); outline-offset:2px;
  box-shadow:0 12px 22px -6px rgba(var(--select-glow),.55), inset 0 1px 0 rgba(255,255,255,.7); }
.rail .card.num.used{ opacity:.48; filter:saturate(.7); cursor:default; }
.rail .card.num.used:hover{ transform:none; box-shadow:0 4px 10px -3px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.65); }
/* Placing shine: once the player has drawn, the still-free hand cards cue that it's the
   player's move, in the same gold as the Draw button's "it's your move" glow — the digit
   cards to place, and the multiplier/treasure specials (the spare that scores on a
   declare). The FIRST render of the placing phase plays a one-shot single flash
   (.place-hint-intro) that settles into the steady hold defined here; every later render
   while placing is still the move carries just that steady hold (.place-hint), so
   placing cards one by one doesn't re-flash. The aura reach is at full width (the earlier
   50% reduction undone). Reduced-motion (the global * rule) drops the animation, leaving
   the steady hold at once. */
.rail .card.num.place-hint, .rail .card.special.place-hint{
  box-shadow:0 5px 12px -4px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.67),
    0 0 0 1px rgba(var(--primary-rgb),.48), 0 0 26px -5px rgba(var(--primary-rgb),.74); }
.rail .card.num.place-hint.place-hint-intro,
.rail .card.special.place-hint.place-hint-intro{ animation:card-shine-intro 1.2s var(--ease) forwards; }
@keyframes card-shine-intro{
  /* one flash (peak at 50%) then settle to the steady hold at 100% */
  0%  { box-shadow:0 4px 10px -3px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.65),
          0 0 0 1px rgba(var(--primary-rgb),.3), 0 0 18px -7px rgba(var(--primary-rgb),.55); }
  50% { box-shadow:0 7px 16px -5px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.7),
          0 0 0 1px rgba(var(--primary-rgb),.6), 0 0 34px -3px rgba(var(--primary-rgb),.95); }
  100%{ box-shadow:0 5px 12px -4px var(--card-shadow), inset 0 1px 0 rgba(255,255,255,.67),
          0 0 0 1px rgba(var(--primary-rgb),.48), 0 0 26px -5px rgba(var(--primary-rgb),.74); } }
.rail-sep{ flex:0 0 auto; align-self:center; width:2px; height:52px; margin:2px 12px; border-radius:2px;
  background:linear-gradient(180deg,transparent,var(--surface-edge),transparent); }
/* Deal / draw entrance: a fresh hand staggers in; a drawn card drops in from the
   stock. One-shot classes added by the builder controller; reduced-motion disables
   the animation (the global rule), so the cards simply appear. */
@keyframes card-deal{ from{ opacity:0; transform:translateY(16px) scale(.82) rotate(-5deg); } to{ opacity:1; transform:none; } }
.rail .card.dealt-in{ animation:card-deal .34s var(--ease) both; }
@keyframes card-draw{ 0%{ opacity:0; transform:translateY(-22px) scale(.68); }
  62%{ opacity:1; transform:translateY(3px) scale(1.1); } 100%{ transform:none; } }
.rail .card.drawn-in{ animation:card-draw .42s var(--ease) both; }
/* The "Discard now!" note sits inline, to the right of the clock. */
.timer-note{ font-size:.72rem; font-weight:700; color:var(--warn-ink); }
.timer-note:empty{ display:none; }
.hand-label{ font-family:var(--font); font-weight:700; margin:8px 0 2px; color:var(--ink); }
.hand-label .muted{ font-weight:400; color:var(--ink-dim); }
.controls{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:8px;
  padding-top:14px; border-top:1px solid var(--hair); }
/* The action bar is two rows: get-a-card actions on top, close-your-turn actions
   below. Each row is a full-width flex line, its buttons centered as a cluster. */
.controls-row{ flex-basis:100%; display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:center; }
/* The four turn-action buttons (Draw / Take discard / Declare / Discard) share one
   constant width — the widest label, "Take discard · ×4", measures ~155px, so
   --btn-w (160px) seats every one at the same size and the two rows line up evenly.
   Resign (sized to itself) joins the centered bottom-row cluster. */
.controls-row .btn:not(.danger){ min-width:var(--btn-w); white-space:nowrap; }
/* Resign sits on its own centered line below the bar (but outside .controls, so the
   short-viewport sticky rule never pins it). Its top margin reserves the gap the
   #bot_wait turn pill floats into (see .bot-wait), so the pill lands clearly between
   the Declare/Discard row and Resign, crowding neither. */
.controls-row-resign{ margin-top:76px; }
.controls-row-resign .resign-form{ margin:0; }
.hint-msg{ flex-basis:100%; font-size:.84rem; font-weight:600; color:var(--danger); }
.hint-msg:empty{ display:none; }
/* live "this win scores N" preview between the rail and the action bar */
.score-out{ font-family:var(--font-num); font-weight:700; font-size:.95rem; color:var(--warm-ink);
  background:linear-gradient(180deg, rgba(var(--primary-rgb),.16), rgba(var(--primary-rgb),.04));
  border:1px solid rgba(var(--primary-rgb),.42); border-radius:var(--r-md); padding:10px 14px; margin-top:10px;
  box-shadow:0 0 22px -12px rgba(var(--primary-rgb),.6); }
.score-out:empty{ display:none; }
/* md+: also center the dealt-hand rail, the score preview, the redraw notice and the
   hint under the strips. The action bar and the turn pill are already centered at
   every width (base rules above), so only these wider-screen niceties remain here. */
@media (min-width:760px){
  .rail{ justify-content:center; }
  .redraw-notice{ justify-content:center; }
  .score-out{ width:fit-content; max-width:100%; margin-inline:auto; text-align:center; }
  .hint-msg{ text-align:center; }
}
/* Short viewports (small laptops): the play panel is taller than the screen, so the
   action bar would fall below the fold and reaching Draw/Declare means scrolling the
   board out of view. Pin the bar to the bottom of the viewport so it stays in reach
   with the mat still visible above it. `.controls` only renders while playing; an
   opaque panel background keeps the buttons legible over the mat behind them. */
@media (max-height:720px){
  .controls{ position:sticky; bottom:0; z-index:6;
    background:var(--area-bg); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    box-shadow:0 -12px 22px -16px rgba(0,0,0,.6); }
}
.area-footer{ display:flex; justify-content:flex-end; margin-top:4px; }
.area-footer form{ margin:0; }
.area-footer .btn.danger{ font-size:.82rem; padding:9px 14px; }
.results{ display:flex; flex-direction:column; gap:10px; }
.win{ color:var(--win-ink); font-family:var(--font-display); font-weight:800; }
.results .win{ font-size:1.3rem; }

/* ---- public high-scores leaderboard ---- */
.leaderboard{ width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.leaderboard th, .leaderboard td{ padding:10px 12px; font-size:.92rem; text-align:left; }
.leaderboard thead th{ color:var(--ink-dim); font-weight:700; border-bottom:1px solid var(--surface-edge);
  text-transform:uppercase; letter-spacing:.08em; font-size:.72rem; }
.leaderboard tbody tr + tr td{ border-top:1px solid var(--hair); }
.leaderboard .rank{ font-family:var(--font-num); color:var(--ink-faint); font-weight:700; width:1%; white-space:nowrap; text-align:right; }
.leaderboard .who{ color:var(--ink); font-weight:600; width:99%;
  overflow-wrap:anywhere; }
.leaderboard .pts{ font-family:var(--font-num); text-align:right; white-space:nowrap; color:var(--warm-ink); }
.leaderboard .pts strong{ color:var(--win-ink); font-size:1.02rem; }
.leaderboard .when{ color:var(--ink-dim); white-space:nowrap; text-align:right; }
.leaderboard tbody tr.me td{ background:rgba(var(--primary-rgb),.1); }
.leaderboard tbody tr.me .who{ color:var(--warm-ink); }
/* daily result: how your best compares to the optimal */
.daily-result .win{ font-size:1.1rem; }
.par-bar{ height:13px; border-radius:999px; margin:10px 0 4px; overflow:hidden;
  background:var(--recess-2); border:1px solid var(--hair); }
.par-fill{ height:100%; border-radius:999px; min-width:3px;
  background:linear-gradient(90deg,var(--gold-2),var(--gold));
  box-shadow:0 0 14px -4px rgba(var(--primary-rgb),.8); transition:width .5s var(--ease); }
.leaderboard tbody tr:nth-child(1) .rank,
.leaderboard tbody tr:nth-child(2) .rank,
.leaderboard tbody tr:nth-child(3) .rank{ color:var(--gold); }

/* ---- how-to-play guide ---- */
.guide{ display:flex; flex-direction:column; gap:18px; }
.guide-sec{ gap:12px; }
.guide-sec h2{ font-size:1.3rem; }
.guide-sec > p{ color:var(--ink-dim); margin:0; }
.guide-sec > p strong{ color:var(--ink); }
.guide-sec .deck-preview{ margin:2px 0; }
.guide-list{ margin:0; padding-left:1.2em; display:flex; flex-direction:column; gap:9px;
  color:var(--ink-dim); }
.guide-list li strong{ color:var(--ink); }
.guide-sec code{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.88em;
  background:var(--recess-2); border:1px solid var(--hair); border-radius:6px; padding:1px 6px; color:var(--warm-ink); }
.chip-op{ display:inline-flex; align-items:center; justify-content:center; width:1.5em; height:1.5em;
  border-radius:6px; background:var(--op-bg); color:var(--op-ink);
  font-weight:800; font-size:.82em; vertical-align:middle; }
.chip{ display:inline-block; border-radius:999px; padding:1px 9px; font-weight:800; font-size:.82em;
  color:#fff; vertical-align:middle; }
.chip.mult{ background:linear-gradient(165deg,#1fb9b2,#0d6f78); color:#f0fffd; }
/* …and the matching multiplier swatch in the how-to-play guide, so its legend stays
   true to the recoloured cards (light themes only). */
:root[data-theme="cool"] .chip.mult,
:root[data-theme="warm"] .chip.mult{ background:linear-gradient(165deg,var(--mult-1),var(--mult-2)); }
.chip.treasure{ background:linear-gradient(165deg,var(--special),var(--special-2)); color:#fff; }
:root[data-theme="cool"] .chip.treasure,
:root[data-theme="warm"] .chip.treasure{ background:linear-gradient(165deg,var(--treasure-1),var(--treasure-2)); }

/* ---- motion / small screens ---- */
@media (prefers-reduced-motion:reduce){ *{ transition:none !important; animation:none !important; } }
@media (max-width:560px){
  .wrap{ padding:16px 12px 48px; }
  .card-panel, .your-area{ padding:16px; }
  .table{ padding:16px; }
  .row .field{ flex:1 1 100%; }
  .card{ --cw:48px; } .cell{ --cw:50px; }
}
/* Enlarge the whole interface on large screens. `zoom` scales layout and hit-areas
   (unlike `transform`). The content column is 1000px, so each step is gated at the
   width where its scaled size (1000px × zoom) still fits without horizontal scroll:
   a gentle 1.1× (→1100px) from 1120px so mid-size laptops get a modest enlargement
   instead of none, then the full 1.25× (→1250px) at ≥1280px. The 1.25 rule follows
   the 1.1 rule so it wins where both match. */
@media (min-width:1120px){ .wrap{ zoom:1.1; } }
@media (min-width:1280px){ .wrap{ zoom:1.25; } }

/* --- Site footer: internal links to the content + legal pages (for visitors and
   crawlers). Rendered on every page except the live game board (content_for
   :hide_footer). Reads theme tokens so it tracks all three palettes; it sits
   outside .wrap, so it is not zoom-scaled on large screens. */
.site-footer{ margin-top:72px; border-top:1px solid var(--surface-edge);
  background:var(--surface); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
.site-footer-inner{ max-width:1000px; margin:0 auto; padding:36px 16px 10px;
  display:flex; flex-wrap:wrap; gap:28px 48px; align-items:flex-start;
  justify-content:space-between; }
.foot-brand{ flex:1 1 220px; min-width:180px; }
.foot-wordmark{ font-family:var(--font-display); font-weight:800; font-size:1.2rem;
  letter-spacing:-.01em; color:var(--ink); text-decoration:none; }
.foot-wordmark:hover{ color:var(--gold); text-decoration:none; }
.foot-tagline{ color:var(--ink-dim); margin:6px 0 0; font-size:.9rem; }
.foot-cols{ display:flex; flex-wrap:wrap; gap:24px 48px; }
.foot-col .foot-h{ font-family:var(--font); font-size:.72rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.09em; color:var(--ink-faint); margin:0 0 10px; }
.foot-col ul{ list-style:none; margin:0; padding:0; display:grid; gap:9px; }
.foot-col a{ color:var(--ink-dim); font-size:.92rem; text-decoration:none; }
.foot-col a:hover{ color:var(--gold); text-decoration:none; }
.site-footer-bottom{ max-width:1000px; margin:0 auto; padding:14px 16px;
  border-top:1px solid var(--hair); }
.site-footer-bottom .muted{ font-size:.84rem; margin:0; text-align:center; }

/* --- Static / legal page helpers (about, contact, terms, privacy). */
.guide.legal .guide-sec h2{ font-size:1.02rem; margin:22px 0 7px; }
.guide.legal .guide-sec h2:first-child{ margin-top:0; }
.guide.legal .guide-sec > p{ color:var(--ink-dim); }
.guide.legal .guide-sec .guide-list{ color:var(--ink-dim); }
.page-nav{ display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; }
.contact-email{ font-size:1.18rem; font-weight:700; margin:4px 0; }

@media (max-width:560px){
  .site-footer-inner{ gap:24px; }
  .foot-cols{ gap:20px 36px; }
}
