/* Game Night stylesheet.
   Sections, in order:
     1. Theme            colour tokens; the light theme
     2. Base             elements, form controls, buttons, shared animations
     3. Screens          loading, home, lobby, dialogs, bug reports
     4. Game shell       top bar, layout, player chips, log, reactions, floating buttons, chat,
                         game-over banner, replays, scoreboard, celebrations, results card
     5. Shared pieces    player dots and avatars, playing cards, dice, timer bar, arena banners
     6. Games, A to Z    one section per static/games/*.js module (each keeps its own phone,
                         focus-mode and keyboard-open rules)
     7. Screen modes     phone layout, phone on its side, focus mode, on-screen keyboard
     8. Motion           press feedback; "Animations" off and prefers-reduced-motion
   Section 6 keeps only rules several games share: each game's own rules live in static/games/<game>.css, which
   needUI (app.js) loads with the game's script, so they come after everything here.
   Each game's classes start with its own prefix (.sc Safecracker, .crew Ship Captain & Crew, .lr Light Riders,
   .liar Liar's Dice, …), so two games' rules never land on the same element.
   Order matters where rules of equal specificity meet:
     - Shared pieces (section 5) come before the games, so a game can restyle them.
     - Press feedback (section 8) must come after the games, so a pressed card or tile shrinks even when
       a game's own state (.card-btn.ok, .rack-tile.sel) moves it. */

/* ======================================================================== 1. Theme */
:root {
  --bg: #16131f; --panel: #221d30; --panel2: #2c2540; --text: #f3eefc; --muted: #a79fbd;
  --accent: #ffb703; --accent2: #8ecae6; --danger: #ef476f; --ok: #06d6a0; --radius: 14px;
  --line: #3d3456; --field: #120f1a; --glow: #2d2147; --bar: #0006;
  /* board finishes, all gradients (no images): a wooden board, card-table felt, a slate tile */
  --wood: repeating-linear-gradient(92deg, #0000 0 7px, #5a330f14 7px 9px, #0000 9px 19px, #ffffff0a 19px 20px),
    repeating-linear-gradient(88deg, #0000 0 31px, #4a2a0a1c 31px 34px), linear-gradient(160deg, #e2b26f, #c68a45 55%, #a86f32);
  --felt: radial-gradient(circle at 50% 35%, #2a8a6a, #0e3b2e 75%);
  --slate: linear-gradient(160deg, #3a4256, #262c3b);
  /* the room a board has: below the top bar and player chips, above the phone dock (measured by app.js;
     the fallback is the old guess). Boards take what they need for their own controls off it. */
  --room: var(--stage-h, calc(var(--app-h, 100vh) - 150px));
  /* scales: spacing, radii, type, depth. Shell rules use these; games may too */
  --s1: 4px; --s2: 6px; --s3: 8px; --s4: 12px; --s5: 16px; --s6: 24px;
  --r-xs: 4px; --r-sm: 8px; --r-md: 10px; --r-lg: 18px; --r-pill: 999px;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 24px;
  --sh-1: 0 2px 8px #0007; --sh-2: 0 6px 24px #0008; --sh-3: 0 20px 60px #000c;
  /* a faint wash over the surface below: white on the dark theme, black on the light one */
  --tint-1: #ffffff08; --tint-2: #ffffff0f; --edge: #ffffff0d;
}
/* tints of the theme colours, so a highlight follows the theme instead of a hard-coded #ffb7031a. A var() inside a custom
   property is worked out where it is declared, so they're declared again wherever the colours change (body, the dark game
   table inside the light theme) */
body, body.light #arena, body.light #sideGame, body.light .replay-bar {
  --accent-a10: color-mix(in srgb, var(--accent) 10%, transparent); --accent-a20: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-a40: color-mix(in srgb, var(--accent) 40%, transparent);
  --accent2-a10: color-mix(in srgb, var(--accent2) 10%, transparent); --accent2-a40: color-mix(in srgb, var(--accent2) 40%, transparent);
  --ok-a20: color-mix(in srgb, var(--ok) 20%, transparent); --danger-a20: color-mix(in srgb, var(--danger) 20%, transparent);
}
/* ⚙️ Light theme: home, lobby, side panels and dialogs go light; the game table keeps its dark felt,
   since every board, card and canvas is drawn for it. */
body.light {
  --bg: #f4f1fa; --panel: #ffffff; --panel2: #ebe5f6; --text: #1f1a2e; --muted: #5f5775;
  --accent: #f0a500; --accent2: #1a6f99; --danger: #d6305a; --ok: #067a5c; --line: #d3cbe4; --field: #faf8fd; --glow: #e6dcfb;
  --bar: #ffffffb0; --tint-1: #2d21470a; --tint-2: #2d214712; --edge: var(--line);
  --sh-1: 0 2px 8px #2d21471f; --sh-2: 0 4px 16px #2d214724; --sh-3: 0 16px 48px #2d214740;
  color-scheme: light;
}
body.light #arena, body.light #sideGame, body.light .replay-bar {
  --bg: #16131f; --panel: #221d30; --panel2: #2c2540; --text: #f3eefc; --muted: #a79fbd;
  --accent: #ffb703; --accent2: #8ecae6; --danger: #ef476f; --ok: #06d6a0; --line: #3d3456; --field: #120f1a;
  --tint-1: #ffffff08; --tint-2: #ffffff0f; --edge: #ffffff0d; --sh-1: 0 2px 8px #0007; --sh-2: 0 6px 24px #0008; --sh-3: 0 20px 60px #000c;
  color: var(--text); color-scheme: dark;
}
body.light #arena { background: radial-gradient(circle at 30% 0, #2d2147, #16131f 70%); border-radius: var(--radius); padding: var(--s3); }
body.light .room-code b { color: #a86f00; }
body.light .toast, body.light .report-pre { color: #fff; }
body.light .logo { background-image: linear-gradient(90deg, #e09a00, #e0457b, #1f7fae, #e09a00); }

/* ======================================================================== 2. Base */
* { box-sizing: border-box; }
/* the display face (static/fonts, OFL): the logo, callouts, big numbers; body text stays the system font */
@font-face { font-family: 'Baloo 2'; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/baloo2-800-latin.woff2) format('woff2'); }
:root { --font-display: 'Baloo 2', system-ui, -apple-system, "Segoe UI", sans-serif; }
body { margin: 0; background: var(--bg) radial-gradient(circle at 20% 0, var(--glow) 0, transparent 60%); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; min-height: 100dvh; }
/* the slowly drifting ambient background */
body::before { content: ''; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 15% 20%, #6d3bd133 0, transparent 32%), radial-gradient(circle at 85% 30%, var(--accent-a10) 0, transparent 30%),
    radial-gradient(circle at 50% 90%, #1d9bd122 0, transparent 35%);
  animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(4%, -3%) rotate(6deg) scale(1.08); } }
[hidden] { display: none !important; }
h1, h3 { margin: .2em 0 .5em; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* form controls */
button, select, input { font: inherit; color: inherit; }
select, input { background: var(--field); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 10px; width: 100%; }
label { display: block; margin: 8px 0; color: var(--muted); font-size: var(--fs-sm); }
label input, label select { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: var(--fs-md); }
label.check input { width: auto; margin: 0; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }
/* segmented choice: radio buttons drawn as one row of options */
.seg { display: flex; gap: 6px; }
.seg-opt { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); cursor: pointer; }
.seg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-a10); }
.seg-opt input { width: auto; margin: 0; }

/* buttons */
button { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 14px; cursor: pointer;
  transition: transform .12s, filter .15s, box-shadow .2s, background-color .2s; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):hover { filter: brightness(1.12); }
button.primary { background: linear-gradient(180deg, #ffc93c, #ffb703 55%, #f49d00); color: #1b1300; border: 0; font-weight: 700;
  box-shadow: 0 3px 12px var(--accent-a40), inset 0 1px 0 #fff6; }
button.danger { background: linear-gradient(180deg, #ff5d82, #ef476f 55%, #d93259); border: 0; color: #fff; font-weight: 700;
  box-shadow: 0 3px 12px #ef476f40, inset 0 1px 0 #fff4; }
button.danger.on { outline: 3px solid #fff; animation: pulse 1s infinite; }
button.big { width: 100%; padding: 13px; font-size: 17px; }
.ghost-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; }
.icon-btn { background: none; border: 0; font-size: var(--fs-lg); padding: 4px 6px; min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; }
.icon-btn svg { display: block; }

/* layout helpers */
.row { display: flex; gap: 8px; margin: 8px 0; }
.row > * { flex: 1; }
.solo-row > button { flex: 1; }
.panel { background: linear-gradient(180deg, var(--tint-1), transparent 60px), var(--panel); border-radius: var(--radius); padding: 14px;
  margin-bottom: 12px; box-shadow: var(--sh-2); border: 1px solid var(--edge); }
.narrow { width: 100%; max-width: 420px; }
.wide { max-width: 560px; }
.hint { color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.hint.left { text-align: left; }
.rules { padding-left: 18px; margin: 6px 0; font-size: var(--fs-sm); }
.howto { color: var(--text); font-size: var(--fs-sm); line-height: 1.5; }
/* a preview line of text (Unmask, Moon Shot); only on <p>, since Moon Shot's square and Yacht's score box also carry .preview and
   picked up its margin, which made rows 12px taller every turn (#18) */
p.preview { color: var(--accent2); font-style: italic; min-height: 1.4em; margin: 6px 0; }

/* a pressed button waiting on the server, and one the server turned down */
button.busy { position: relative; color: transparent !important; pointer-events: none; }
button.busy::after { content: ''; position: absolute; inset: 0; margin: auto; width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) var(--muted) var(--muted) transparent; animation: spin .7s linear infinite; }
button.primary.busy::after { border-color: #1b1300 #1b1300 #1b1300 transparent; }
button.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* animations used across the app */
@keyframes pulse { 50% { opacity: .6; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bannerIn { from { transform: translateY(-14px) scale(.97); opacity: 0; } }
@keyframes sheen { to { background-position: 300% 0; } }
@keyframes markIn { from { transform: scale(.3) rotate(-25deg); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================================================================== 3. Screens */
.screen.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.screen:not([hidden]) { animation: screenIn .3s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } }

/* loading */
.loading-card { text-align: center; max-width: 360px; }
.spinner { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid var(--panel2); border-top-color: var(--accent); animation: spin .9s linear infinite; }

/* home */
.logo { font-size: 44px; text-align: center; letter-spacing: 0; font-weight: 800; font-family: var(--font-display);
  background: linear-gradient(90deg, #ffd166, #ff8fab, #8ecae6, #ffd166); background-size: 300% 100%; -webkit-background-clip: text;
  background-clip: text; color: transparent; animation: sheen 8s linear infinite; }
.logo.small { font-size: var(--fs-lg); }
.tag { text-align: center; color: var(--muted); margin-top: 0; }
.or { text-align: center; color: var(--muted); margin: 14px 0 4px; font-size: var(--fs-sm); }
.solo { margin-top: 10px; }
.code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 700; }

/* lobby: room code, players, settings */
.room-code { text-align: center; font-size: var(--fs-lg); }
.room-code b { font-size: 40px; letter-spacing: .18em; color: var(--accent); display: block; font-family: var(--font-display); font-weight: 800; line-height: 1.1; }
#shareBtn { display: block; margin: 0 auto 8px; }
.plist { list-style: none; padding: 0; margin: 0 0 8px; }
.plist { display: grid; gap: var(--s1); }
.plist li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--tint-1); }
.plist .watch-btn { font-size: var(--fs-sm); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
/* a setting the host changed from the game's default gets a dot; ↺ Defaults puts them all back */
.settings label.changed::before { content: "• "; color: var(--accent); font-weight: 700; }
.settings-head { display: flex; align-items: center; gap: 8px; }
.settings-head h3 { flex: 1; }
#defaultsBtn { font-size: var(--fs-sm); }
#botRow { flex-wrap: wrap; }
#fillBtn { flex: 1 1 100%; order: -1; }
/* Start when the table doesn't fit the game: still tappable (the server says why), but it looks off */
#startBtn.blocked { filter: saturate(.35); opacity: .8; }
/* a gentle pulse on the one thing to do next (fill the table, the ❓ for a new game) */
.nudge { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 4px var(--accent-a40), 0 0 16px var(--accent-a40); } }
body.calm .nudge { animation: none; box-shadow: 0 0 0 2px #ffb70388; }
@media (prefers-reduced-motion: reduce) { .nudge { animation: none; box-shadow: 0 0 0 2px #ffb70388; } }
.join-in { display: block; margin: 8px auto 0; padding: 10px 22px; font-size: 16px; }

/* lobby: game picker */
.picker-cat { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 6px; }
.picker-cat:first-child { margin-top: 0; }
.picker-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.picker-tools input { flex: 1; min-width: 0; margin: 0; }
.chip-btn { flex: none; border-radius: var(--r-pill); padding: var(--s2) var(--s4); font-size: var(--fs-sm); background: var(--panel2); border: 1px solid var(--line); color: inherit; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-a10); color: var(--accent); }
.game-chosen .fav-btn { margin-left: auto; font-size: 22px; line-height: 1; }
.game-chosen .fav-btn.on { color: var(--accent); }
/* 🙈 hidden games: hide/unhide beside the ★ in the lobby, dimmed tiles with a 👁️ corner, the picker's hidden row */
.game-chosen .hide-btn { font-size: 18px; line-height: 1; opacity: .75; }
.game-chosen .hide-btn.on { opacity: 1; }
.game-tile.is-hidden:not(.on) { opacity: .55; }
.game-tile .tile-unhide { position: absolute; bottom: 3px; right: 4px; font-size: var(--fs-xs); line-height: 1; cursor: pointer; }
.picker-hidden { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0 2px; }
.picker-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; --tint: var(--accent); }
/* each tile takes its game's category tint (data-cat on the tile), so favourites and flat sorts keep it too */
.game-tile[data-cat="party"] { --tint: #ef476f; } .game-tile[data-cat="action"] { --tint: #ffb703; } .game-tile[data-cat="strategy"] { --tint: #06d6a0; }
.game-tile[data-cat="classic"] { --tint: #8ecae6; } .game-tile[data-cat="cards"] { --tint: #cc5de8; } .game-tile[data-cat="dice"] { --tint: #ff8fab; }
.game-tile[data-cat="words"] { --tint: #4dabf7; }
/* #191: every tile the same size: equal grid columns (fitPicker), a fixed icon box, a two-line name box and a one-line players box */
.game-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 10px 6px 8px; position: relative; min-width: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 13%, var(--panel2)), var(--panel2) 70%); border-color: color-mix(in srgb, var(--tint) 30%, var(--line));
  transition: transform .15s, box-shadow .2s; }
.game-tile .gicon { --gi: 48px; font-size: 26px; width: var(--gi); height: var(--gi); flex: none; display: grid; place-items: center; border-radius: 50%; line-height: 1; position: relative;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tint) 34%, #0000), color-mix(in srgb, var(--tint) 12%, #0000) 72%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 35%, #0000); filter: drop-shadow(0 3px 4px #0007); }
.game-tile b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; hyphens: auto;
  width: 100%; line-height: 1.2; height: 2.4em; flex: none; text-align: center; }
.game-tile small { color: var(--muted); font-size: var(--fs-xs); display: block; max-width: 100%; height: 1.3em; line-height: 1.3; flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* #189: the kind of game at a glance. Card games sit on a little playing card (♠ ♥ corners), dice games on a die,
   word games on a letter tile; the icon box keeps its height so tiles stay the same size */
.game-tile[data-cat="cards"] .gicon { width: calc(var(--gi) * .74); border-radius: 5px; font-size: calc(var(--gi) * .44); transform: rotate(-4deg);
  background: linear-gradient(160deg, #fff, #ece6f5); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 70%, #fff), 0 0 0 1px #0004; }
.game-tile[data-cat="cards"] .gicon::before, .game-tile[data-cat="cards"] .gicon::after { position: absolute; font: 700 calc(var(--gi) * .2)/1 system-ui, sans-serif; }
.game-tile[data-cat="cards"] .gicon::before { content: '♠'; top: 2px; left: 3px; color: #222; }
.game-tile[data-cat="cards"] .gicon::after { content: '♥'; bottom: 2px; right: 3px; color: #e03131; transform: rotate(180deg); }
.game-tile[data-cat="dice"] .gicon { width: calc(var(--gi) * .92); height: calc(var(--gi) * .92); margin: calc(var(--gi) * .04) 0; border-radius: 22%;
  font-size: calc(var(--gi) * .46); background: linear-gradient(150deg, #fff, #f1e3e8); transform: rotate(6deg);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 75%, #fff), inset -2px -3px 0 #0001, 0 0 0 1px #0004; }
.game-tile[data-cat="dice"] .gicon::before, .game-tile[data-cat="dice"] .gicon::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #333; }
.game-tile[data-cat="dice"] .gicon::before { top: 4px; left: 4px; }
.game-tile[data-cat="dice"] .gicon::after { bottom: 4px; right: 4px; }
.game-tile[data-cat="words"] .gicon { width: calc(var(--gi) * .9); height: calc(var(--gi) * .9); margin: calc(var(--gi) * .05) 0; border-radius: 6px;
  font-size: calc(var(--gi) * .46); background: linear-gradient(170deg, #f8ecd2, #e4cc9f); box-shadow: inset 0 -3px 0 #0002, 0 0 0 1px #0004; }
.game-tile[data-cat="words"] .gicon::after { content: 'A'; position: absolute; bottom: 2px; right: 3px; font: 700 calc(var(--gi) * .18)/1 system-ui, sans-serif; color: #5c4a2a; }
.kind-chip[aria-pressed="true"] { border-color: #cc5de8; background: color-mix(in srgb, #cc5de8 18%, var(--panel2)); color: inherit; }
.game-tile.on { border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 22%, var(--panel2)), var(--accent-a10));
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 1px var(--accent), 0 0 18px var(--accent-a40); }  /* a 1px border plus shadows: the picked tile keeps its size (#191) */
.game-tile:disabled { opacity: .35; }
.game-tile.on:disabled { opacity: 1; }
.game-tile .wishes { position: absolute; top: 3px; right: 4px; font-size: var(--fs-xs); font-weight: 700; }
.game-tile.wished { outline: 2px dashed var(--accent2); outline-offset: -4px; }
.game-tile.nofit:not(.on) { opacity: .5; }
.game-tile.nofit small { color: var(--danger); }
.game-tile:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 16px #0006; }
.game-tile.on .gicon { animation: hop .5s ease-out; }
@keyframes hop { 40% { transform: translateY(-6px) scale(1.15); } }
/* phones: compact tiles, four across; the player count only shows when it's the reason a game is dimmed */
@media (max-width: 600px) {
  .picker-group { gap: 6px; }
  .game-tile { padding: 7px 3px 6px; gap: 1px; border-radius: var(--r-md); }
  .game-tile .gicon { --gi: 40px; font-size: 22px; }
  .game-tile b { font-size: var(--fs-xs); }
  .game-tile b.long { font-size: 10.5px; letter-spacing: -.2px; }
  .game-tile:not(.nofit) small { display: none; }
  /* why a game doesn't fit sits as a pill over the icon's foot, so dimmed tiles stay the same height */
  .game-tile small { font-size: 10px; position: absolute; top: 31px; left: 50%; transform: translateX(-50%); height: auto; max-width: calc(100% - 6px);
    padding: 0 5px; border-radius: var(--r-pill); background: var(--panel); border: 1px solid color-mix(in srgb, var(--danger) 60%, var(--line)); }
  /* Start stays at the bottom of the screen however long the lobby is; the ⚙️ 💬 buttons sit above it */
  #lobby #startBtn { position: sticky; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 6px 24px #000a, 0 3px 12px var(--accent-a40); }
  body[data-screen="lobby"] .fabs { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
.game-chosen { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 20px; scroll-margin-top: 12px; }
.game-chosen .gicon { font-size: 30px; filter: drop-shadow(0 3px 4px #0007); }
/* once the host picks a game the picker folds away; 🔄 Change game opens it again */
#pickerTools.folded, #pickerBar.folded, #gamePicker.folded { display: none; }
#lobby .game-chosen.folded { border-top: 0; margin-top: 4px; padding-top: 0; }
.change-game { font-size: 14px; white-space: nowrap; }
/* #98: sort chips, category jump chips, family sub-headers */
/* display: contents, so the jump row can stick to the scrolling panel itself, not this small box */
.picker-bar { display: contents; }
.picker-sorts { margin-bottom: 6px; }
.picker-jump { margin-bottom: 8px; }
.picker-sorts, .picker-jump { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.picker-sorts::-webkit-scrollbar, .picker-jump::-webkit-scrollbar { display: none; }
.picker-sorts .chip-btn { padding: 6px 10px; font-size: var(--fs-xs); white-space: nowrap; }
.picker-jump { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 4px 0; box-shadow: 0 6px 8px -6px #0008; }
.picker-jump .chip-btn { font-size: var(--fs-lg); padding: 4px 0; min-width: 40px; min-height: 36px; flex: 1; }
.picker-cat[data-cat] { scroll-margin-top: 56px; }
.picker-sub { text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); margin: 8px 0 4px 2px; opacity: .85; }
.picker-sub::before { content: '· '; }
/* the picker in a dialog: home screen and game over */
#modal.sheet .modal-card { width: min(100%, 560px); height: calc(100dvh - 32px); }
#modal.sheet #modalText { display: none; }
.picker-sheet .picker-tools { margin-bottom: 8px; }
.picker-sheet input[type="search"] { width: 100%; margin: 0; }
/* home screen: the chosen game as a button that opens the picker */
.solo-pick { display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; flex: 2 !important; padding: 6px 10px; }
.solo-pick .gicon { font-size: 22px; flex: none; }
.solo-pick b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
.solo-pick small { flex: none; color: var(--muted); font-size: var(--fs-xs); }

/* first time a game opens on this device: a short card with the gist and the way to the rules */
.tip-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--sh-2); }
.tip-card .tip-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: var(--fs-xl); border-radius: 50%; line-height: 1;
  background: radial-gradient(circle at 50% 35%, var(--accent-a40), var(--accent-a10) 72%); box-shadow: inset 0 0 0 1px var(--accent-a40); filter: drop-shadow(0 2px 3px #0007); }
.tip-card.compact .tip-icon { width: 36px; height: 36px; font-size: 20px; }
.tip-card .tip-head { flex: 1 1 220px; min-width: 0; }
.tip-card .tip-head b { display: block; font-size: var(--fs-md); }
.tip-card p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.tip-card ul { margin: 4px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.tip-card .tip-btns { display: flex; gap: 6px; margin-left: auto; }
.tip-card .tip-btns button { padding: var(--s2) var(--s4); font-size: var(--fs-sm); }
.tip-card.compact { padding: 6px 10px; }
.tip-card.compact p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.turn .help-hint { font-weight: 400; opacity: .75; font-size: .9em; }
.game-chosen + #gameDesc { margin-top: 4px; }

/* dialogs */
/* the floating cards (dialogs, drawers and sheets, the ⋯ menu, the reaction bar) share one surface: a faint top light over the panel, a line and the deepest shadow */
.modal-card, .drawer, .game-menu, .dock-react { background: linear-gradient(180deg, var(--tint-2), transparent 90px), var(--panel); border: 1px solid var(--line); box-shadow: var(--sh-3); }
.modal { position: fixed; inset: 0; z-index: 50; background: #0009; display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(3px); }
.modal-card { border-radius: var(--radius); padding: 18px; width: min(100%, 420px);
  animation: pop .15s ease-out; }
.modal-card h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: var(--fs-lg); }
.modal-card p { margin: 0 0 12px; font-size: 16px; }
.modal-card .row { margin-top: 14px; flex: none; }
/* long dialogs (help with rules + settings + badges) scroll inside the card; the buttons always stay on screen (#84) */
.modal-card { position: relative; display: flex; flex-direction: column; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.modal-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-right: -6px; padding-right: 6px; }
.modal-x { position: absolute; top: 6px; right: 6px; z-index: 1; font-size: 16px; color: var(--muted); }
#modalTitle, #modalText { padding-right: 28px; }
.modal-card .rules { font-size: 14px; line-height: 1.5; }
.invite { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.invite-qr { display: block; width: min(240px, 70vw); height: auto; border-radius: var(--r-md); }
.invite input { width: 100%; text-align: center; }
.profile { display: flex; flex-direction: column; gap: 12px; } .profile input { width: 100%; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; padding: 0; border: 3px solid transparent; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px #0008; }
.swatch:disabled { opacity: .2; }

/* bug reports & suggestions */
.report-link { display: block; margin: 14px auto 0; font-size: var(--fs-sm); }
.report textarea { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 10px; font: inherit; resize: vertical; margin: 8px 0; }
.report-pre { max-height: 180px; overflow: auto; font-size: var(--fs-xs); background: #0008; padding: 8px; border-radius: var(--r-sm); white-space: pre-wrap; }
#reportBtn { margin-top: 12px; }

/* ======================================================================== 4. Game shell */
/* top bar: one line however long the turn text is */
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--bar); position: sticky; top: 0; z-index: 6; backdrop-filter: blur(10px) saturate(1.3);
  border-bottom: 1px solid var(--edge); box-shadow: var(--sh-1);
  padding-top: max(6px, env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.turn { flex: 1; text-align: center; font-weight: 800; font-family: var(--font-display); font-size: 17px; }
/* your turn: pulses a few times to catch the eye, then stays lit */
.turn.mine { color: var(--accent); animation: pulse 1.4s 3; }
/* the turn text sits in a pill: lit gold on my turn */
.topbar .turn { padding: 2px var(--s4); border-radius: var(--r-pill); }
.topbar .turn.mine { background: var(--accent-a10); box-shadow: inset 0 0 0 1px var(--accent-a40); }
/* the ⋯ menu: bigger board, full screen, chat, settings, leave */
/* the top bar is its own stacking layer (z 6), so an open menu must lift it above the game-over banner (28) and pause cover (27) (#204) */
.topbar:has(.game-menu:not([hidden])) { z-index: 36; }
.game-menu { position: absolute; top: calc(100% + 4px); right: max(8px, env(safe-area-inset-right)); z-index: 32; min-width: 210px; padding: 6px;
  border-radius: var(--radius); display: grid; gap: 2px;
  animation: pop .15s ease-out; }
.game-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; text-align: left;
  background: none; border: 0; border-radius: var(--r-md); font-size: var(--fs-md); }
.game-menu button:hover, .game-menu button:focus-visible { background: var(--panel2); filter: none; }
.game-menu button > :first-child { width: 22px; display: grid; place-items: center; flex: none; }
.game-menu .ico svg { display: block; }
.game-menu .menu-danger { color: var(--danger); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }
.timer { font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.timer.urgent { color: var(--danger); font-weight: 700; }
.topbar .turn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; }
.topbar > * { flex-shrink: 0; }
#menuBtn { position: relative; }
#menuBtn.unread::after { content: ''; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
#focusBtn[aria-pressed="true"] { color: var(--accent); }
#focusBtn[aria-pressed="true"]::after { content: '✓'; margin-left: auto; }

/* the board beside a side column; one column on phones (section 7) */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 12px 16px; max-width: 1300px; margin: 0 auto; }

/* player chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { background: var(--panel); border-radius: var(--r-pill); padding: var(--s1) var(--s4) var(--s1) var(--s1); display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); border: 2px solid transparent; }
.chip b { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.me { background: var(--panel2); }
.chip .avatar { box-shadow: 0 0 0 2px var(--pc, #0004); }
.chip.turn-now { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-a40); animation: glow 1.6s ease-in-out infinite; }
.chip.turn-now .avatar { box-shadow: 0 0 0 2px var(--pc, #0004), 0 0 0 4px var(--accent-a40); }
@keyframes glow { 50% { box-shadow: 0 0 2px var(--accent-a20); } }
.chip.out { opacity: .5; text-decoration: line-through; }
.chip .meta { color: var(--muted); }

/* game log: folds into a one-line ticker */
.log { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.entry { padding: 6px 8px; border-radius: var(--r-sm); background: var(--tint-1); }
.entry.question { background: #8ecae61a; }
.entry.private { background: #06d6a022; border: 1px dashed var(--ok); }
.entry.power { background: #cc5de822; }
.entry.big { background: var(--accent-a20); font-weight: 700; }
.entry.moment { background: linear-gradient(90deg, var(--accent-a20), #ffb70311); font-weight: 700; }
.entry.badge { background: linear-gradient(90deg, #ffd16633, #06d6a022); font-weight: 700; }
.badge-shelf { font-size: 16px; letter-spacing: 1px; white-space: normal; } .badge-shelf span { cursor: help; }
.badge-list li { opacity: .65; } .badge-list li.got { opacity: 1; font-weight: 700; } .badge-list li.got::after { content: ' ✓'; color: var(--ok); }
.entry button { display: block; margin-top: 5px; padding: 4px 10px; font-size: var(--fs-xs); }
.log-toggle { width: 100%; display: flex; gap: 8px; align-items: center; text-align: left; background: var(--tint-1); border: 0; padding: 8px 10px; margin-bottom: 8px; }
.log-toggle #logLast { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--muted); }
.log-toggle .chev { transition: transform .2s; } .log-toggle.open .chev { transform: rotate(180deg); }

/* reactions: a bar of emoji that float up the screen */
.react-bar { display: flex; justify-content: space-between; margin-bottom: 10px; }
.react-bar button { background: none; border: 0; font-size: 22px; padding: 2px; min-width: 40px; min-height: 40px; transition: transform .1s; }
.react-bar button:active { transform: scale(1.4); }
#floaters { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.floater { position: absolute; bottom: -60px; font-size: 40px; text-align: center; animation: rise 2.6s ease-out forwards; }
.floater small { display: block; font-size: var(--fs-xs); color: #fff; background: #0008; border-radius: var(--r-sm); padding: 0 4px; }
@keyframes rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-75vh) scale(1.2); opacity: 0; } }

/* notices */
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 40; text-align: center; padding: 8px 16px;
  background: var(--danger); color: #fff; font-weight: 700; animation: pulse 1.4s infinite; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #000d; padding: 10px 16px; border-radius: var(--r-md);
  z-index: 35; max-width: 90vw; animation: pop .2s ease-out; }
.toast-btn { margin-left: var(--s3); padding: var(--s1) var(--s4); background: var(--accent); color: #1b1300; border: 0; font-weight: 700; }

/* floating buttons, chat, preferences */
.fabs { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; z-index: 25; }
.fabs button { width: 52px; height: 52px; border-radius: 50%; font-size: 22px; padding: 0; position: relative; box-shadow: var(--sh-1); }
.badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: var(--fs-xs); font-weight: 700;
  border-radius: var(--r-pill); padding: 1px 6px; }
.chat-bubble { position: fixed; right: 76px; bottom: 80px; max-width: min(70vw, 300px); background: var(--panel2); border: 1px solid #5a4a86;
  padding: 8px 12px; border-radius: var(--radius) 14px 2px 14px; z-index: 25; box-shadow: var(--sh-1); cursor: pointer; font-size: 14px; }
.drawer { position: fixed; right: 12px; bottom: 80px; width: min(92vw, 360px); max-height: 70vh; display: flex; flex-direction: column;
  border-radius: var(--radius); z-index: 30; padding: var(--s4); }
.drawer header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.drawer header b { flex: 1; }
.drawer-x { min-width: 36px; min-height: 36px; font-size: 16px; color: var(--muted); }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 120px; font-size: 14px; }
.msg { background: var(--tint-1); border-radius: var(--r-md); padding: 6px 10px; align-self: flex-start; max-width: 85%; word-wrap: break-word; }
.msg b { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
.msg b .avatar { display: inline-block; flex: none; width: 18px; height: 18px; box-shadow: 0 0 0 1px var(--line); }
.msg.mine { align-self: flex-end; background: var(--accent-a20); }
.msg.ghost { border: 1px dashed var(--muted); opacity: .85; }
.quick-chat { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; }
.quick-chat button { flex: none; padding: var(--s2) var(--s4); font-size: var(--fs-sm); border-radius: var(--r-pill); }
#chatForm { margin-bottom: 0; }
#chatForm input { flex: 3; }
#prefsList label.check { padding: 6px 0; }

/* the phone dock under the game: reactions, the latest log line (opens the log sheet), chat */
.dock { display: none; }
.dock-btn { position: relative; width: 48px; height: 44px; padding: 0; font-size: 22px; border-radius: var(--r-md); background: var(--panel2); flex: none; }
.dock-log { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--r-md); text-align: left; background: var(--tint-1); }
.dock-log #dockLast { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--muted); }
.dock-react { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); display: flex; justify-content: space-between; padding: 4px;
  border-radius: var(--r-pill); animation: pop .15s ease-out; }
.dock-react button { background: none; border: 0; font-size: var(--fs-xl); min-width: 40px; min-height: 40px; padding: 0; }

/* game-over banner: scores, replay options and the next-game vote; folded, only the result line shows */
/* it floats centred over the game, out of the page flow, so the board keeps its size */
/* ⏸ paused (#119): the game stands still under a soft cover */
.paused-cover { position: fixed; inset: 0; z-index: 27; display: grid; place-items: center; background: #0b0816b3; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.paused-cover > div { text-align: center; padding: 22px 28px; border-radius: var(--r-lg, 16px); background: var(--panel); box-shadow: var(--sh-3, 0 10px 30px #0008); }
.paused-cover b { font: 800 30px/1.1 var(--font-display, sans-serif); }
.paused-cover p { color: var(--muted); margin: 6px 0 14px; }
.paused-cover button { font-size: 18px; padding: 10px 26px; }
#overBanner { position: fixed; z-index: 28; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 480px);
  max-height: calc(100dvh - 32px); overflow-y: auto; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--accent-a20), #ef476f33), var(--panel); box-shadow: 0 0 0 100vmax #0007, 0 12px 40px #000c;
  display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; font-size: 17px; font-weight: 700; flex-direction: column; }
#overBanner > div { flex: 1; min-width: 200px; }
#overBanner:not([hidden]) { animation: overIn .4s cubic-bezier(.2, 1.4, .4, 1); }
#overBanner.won { background: linear-gradient(100deg, var(--accent-a40), #06d6a033, var(--accent-a40)), var(--panel); background-size: 200% 100%; animation: overIn .4s cubic-bezier(.2, 1.4, .4, 1), sheen 5s linear infinite; }
@keyframes overIn { from { transform: translate(-50%, -50%) scale(.9); opacity: 0; } }
/* the podium: avatars of the top three, the winner up a step with a crown */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; padding: 2px 0 4px; font-weight: 400; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; font-size: var(--fs-sm); }
.pod b { max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pc); }
.pod small { color: var(--muted); font-family: var(--font-display); font-weight: 800; font-size: var(--fs-sm); }
.pod-face { position: relative; padding: 4px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--pc) 35%, #0000), #0000 70%); }
.pod .avatar { display: block; width: 44px; height: 44px; box-shadow: 0 0 0 3px var(--pc), 0 6px 16px #000a; }
.pod-1 .avatar { width: 64px; height: 64px; }
.pod-1 .pod-face { margin-bottom: 10px; animation: podUp .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.pod-crown { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 22px; animation: crownIn .5s .35s cubic-bezier(.2, 1.6, .4, 1) both; filter: drop-shadow(0 2px 3px #0008); }
@keyframes podUp { from { transform: translateY(16px) scale(.8); opacity: 0; } }
@keyframes crownIn { from { transform: translate(-50%, -14px) scale(0); opacity: 0; } }
#overBanner.folded .podium { display: none; }
/* folded: a slim bar at the top, no dimming, so the board can be looked over */
#overBanner.folded { top: calc(var(--bar-h, 52px) + 8px); transform: translateX(-50%); box-shadow: var(--sh-2); animation: none; }
.over-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.over-head #overText { flex: 1; }
.over-head .icon-btn { font-size: var(--fs-lg); color: var(--muted); }
#overBanner.folded > :not(.over-head) { display: none; }
#overBanner.folded { padding-block: 8px; overflow: visible; }
.over-mini { display: flex; gap: 6px; }
.over-mini:empty { display: none; }
#overBanner.folded #overText { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.over-mini .mini-act { width: 40px; height: 40px; padding: 0; font-size: 20px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--field); color: inherit; }
.over-mini .mini-act.primary { background: var(--accent); border-color: transparent; }
.over-mini .mini-act.on { outline: 2px solid var(--ok); }
.over-scores { font-size: 14px; font-weight: 400; color: var(--muted); }
.over-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.over-actions button { flex: 1; min-width: 120px; }
#readyBtn.on { background: var(--ok); color: #002; border: 0; }
/* #93: scores as a table; the next game as tiles under the buttons, in a fold */
.over-scores { display: grid; gap: 4px; font-weight: 400; font-size: 14px; }
.over-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: ot; }
.over-table li { display: flex; gap: 8px; align-items: baseline; padding: 3px 8px; border-radius: var(--r-sm); counter-increment: ot; }
.over-table li::before { content: counter(ot) '.'; color: var(--muted); min-width: 1.6em; font-size: var(--fs-sm); }
.over-table li.me { background: var(--accent-a10); }
.over-table .ot-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.over-table b { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.over-note { color: var(--muted); font-size: var(--fs-sm); line-height: 1.35; }
.over-next { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 400; }
.over-goal { color: var(--text); font-weight: 700; padding: var(--s1) 0; }
.over-next summary { cursor: pointer; font-size: var(--fs-md); font-weight: 700; min-height: 36px; display: flex; align-items: center; }
.next-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 8px; }
.next-tile { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 8px; text-align: left; position: relative; font-size: 14px; }
.next-tile .gicon { font-size: var(--fs-xl); flex: none; }
.next-tile .nt-text { display: flex; flex-direction: column; min-width: 0; }
.next-tile .nt-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-tile small { color: var(--muted); font-size: var(--fs-xs); }
.next-tile.on { border: 2px solid var(--accent); background: var(--accent-a20); }
.nt-votes { position: absolute; top: -6px; right: -4px; display: flex; }
.nt-votes .avatar { width: 20px; height: 20px; margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.next-more { width: 100%; }

/* replays: a bar of controls, and (#60) a heading in the bar plus a dashed frame with a REPLAY tag round the board */
.replay-bar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(94vw, 520px); z-index: 26;
  background: #0a0812ee; border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; }
.replay-caption { font-size: var(--fs-sm); color: var(--muted); min-height: 2.6em; }
.replay-title { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; line-height: 1.35; }
.replay-title b { color: var(--accent2); font-size: var(--fs-sm); }
body.replaying #arena { position: relative; outline: 2px dashed #8ecae6aa; outline-offset: 4px; border-radius: var(--radius); }
body.replaying #arena::before { content: '▶ REPLAY'; position: absolute; top: -12px; left: 12px; z-index: 4; padding: 1px 8px;
  border-radius: var(--r-pill); background: #8ecae6; color: #0b2230; font-size: var(--fs-xs); font-weight: 900; letter-spacing: .08em; }
body.replaying .layout { padding-bottom: 190px; }  /* the bar covers the bottom of the page */
.replay-bar input { width: 100%; padding: 0; }
.replay-bar .row { margin: 6px 0; }
@media (max-width: 600px) { .replay-bar { left: 10px; right: 10px; width: auto; transform: none; } }

/* scoreboard */
.scores { width: 100%; border-collapse: collapse; font-size: 14px; }
.scores th, .scores td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.scores th:first-child, .scores td:first-child { text-align: left; font-weight: 700; }
.scores td.pts { position: relative; font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.scores .pts-bar { position: absolute; left: 6px; right: 6px; bottom: 1px; height: 3px; border-radius: 2px; opacity: .8; width: calc(var(--w, 0%) - 12px); min-width: 4px; }
.history { padding-left: 20px; margin: 0 0 8px; font-size: 14px; }
.history li { margin-bottom: 6px; }

/* celebrations: a gold glow when your turn starts, confetti when you win */
.turn-glow { position: fixed; inset: 0; pointer-events: none; z-index: 19; box-shadow: inset 0 0 70px 10px #ffb703aa; opacity: 0; }
.turn-glow.on { animation: turnGlow 1.3s ease-out; }
@keyframes turnGlow { 15% { opacity: 1; } to { opacity: 0; } }
.confetti { position: absolute; top: -4vh; width: 9px; height: 14px; border-radius: 2px; animation: confetti var(--t) cubic-bezier(.25, .6, .5, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* shared results card between rounds (standingsCard in app.js) */
.st-card { width: 100%; max-width: 420px; margin: 8px auto; padding: 10px 12px; border-radius: var(--radius); background: var(--panel);
  box-shadow: var(--sh-2); animation: bannerIn .3s ease-out; text-align: left; }
.st-title { margin: 0 0 6px; font-size: var(--fs-md); text-align: center; }
.st-row { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto auto 2.2em; gap: 8px; align-items: center; padding: 4px 2px;
  border-bottom: 1px solid var(--line); font-size: var(--fs-md); }
.st-row:last-of-type { border-bottom: 0; }
.st-row.me { background: var(--tint-2); border-radius: var(--r-sm); }
.st-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.st-gain { font-weight: 800; font-family: var(--font-display); color: var(--muted); text-align: right; }
.st-gain.up { color: var(--ok); animation: pop .4s ease-out; } .st-gain.down { color: var(--danger); }
.st-total { text-align: right; min-width: 3ch; font-family: var(--font-display); font-weight: 800; }
.st-move { font-size: var(--fs-xs); font-weight: 800; } .st-move.up { color: var(--ok); } .st-move.down { color: var(--danger); }
.st-note { margin: 6px 0 0; text-align: center; }
/* Lucky Letters keeps a steady board (#61): its card floats over the wheel instead of pushing the page */
.st-float { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(92%, 380px); margin: 0; z-index: 3;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(4px); }
.st-float.st-card { animation: none; }

/* ======================================================================== 5. Shared pieces */
/* player dots and seats; games' player dots turn into their colour's shape (colour is never the only cue) */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pmark { flex: none; width: 1.1em; text-align: center; font-size: 14px; line-height: 1; text-shadow: 0 0 1px #0008; }
.mini-disc { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.dot.shaped, .mini-disc.shaped { width: auto; height: auto; min-width: 1em; background: none !important; box-shadow: none; border: 0;
  font-size: var(--fs-sm); line-height: 1; text-align: center; text-shadow: 0 0 1px #0008; }
.seat-row { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 3px 0; }
/* Kit.scoreboard: a standings row per player, avatar ringed in their colour; the player on turn gets a gold edge, the leader a crown */
.kit-sb { gap: var(--s3); padding: var(--s1) var(--s3) var(--s1) var(--s1); margin-bottom: 3px; border-radius: var(--r-pill); background: var(--tint-1);
  border: 1px solid transparent; transition: border-color .2s, background-color .2s; }
.kit-sb .avatar { width: 26px; height: 26px; box-shadow: 0 0 0 2px var(--pc); }
.kit-sb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-sb-note { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); white-space: nowrap; }
.kit-sb-score { font-family: var(--font-display); font-size: var(--fs-md); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.kit-sb-score.lead::before { content: '👑 '; font-size: .8em; }
.kit-sb.turn { border-color: var(--accent); background: var(--accent-a10); }
.kit-sb.me .kit-sb-name::after { content: ' (you)'; color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }

/* player avatars: a face from the Unmask generator, picked by name */
.avatar { flex: none; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px #0004; }
.avatar svg { display: block; width: 100%; height: 100%; }
.avatar-emoji { display: inline-grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff6, transparent 60%), var(--ac, #888);
  font-size: 13px; line-height: 1; }
.pod .avatar-emoji { font-size: 26px; }
.pod-1 .avatar-emoji { font-size: 38px; }
.plist .avatar-emoji { font-size: 20px; }
.kit-sb .avatar-emoji, .ct-who .avatar-emoji { font-size: 15px; }
/* #144 the icon picker in 🏆 My record */
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin: 6px 0 10px; }
.icon-pick button { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: 22px; overflow: hidden; border: 2px solid transparent; background: var(--panel2); }
.icon-pick button svg { width: 100%; height: 100%; display: block; }
.icon-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-a40); }
.icon-pick .auto { font-size: 11px; font-weight: 700; }
.plist .avatar { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--pc, #0004); }
.chip.out .avatar { filter: grayscale(1); opacity: .6; }

/* ✨ level looks (static/profile.js UNLOCKS): a frame ring behind the avatar and a small Lv pip */
.av-frame { position: relative; display: inline-grid; flex: none; border-radius: 50%; --fr: transparent; }
.av-frame::before { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: var(--fr); }
.av-frame > .avatar { position: relative; }
.av-frame[class*="fr-"] > .avatar, .chip .av-frame[class*="fr-"] > .avatar { box-shadow: 0 0 0 1px #0008; }
.fr-bronze { --fr: conic-gradient(#a0612b, #e6a56b, #8a4f1f, #d99257, #a0612b); }
.fr-silver { --fr: conic-gradient(#8d96a3, #f1f4f8, #7c8592, #dde2e8, #8d96a3); }
.fr-gold { --fr: conic-gradient(#b8860b, #ffe08a, #a87400, #ffd34d, #b8860b); }
.fr-frost { --fr: conic-gradient(#5ec8f2, #e8fbff, #7aa8ff, #c9f3ff, #5ec8f2); }
.fr-frost::before { box-shadow: 0 0 6px #8ee3ff99; }
.fr-ember { --fr: conic-gradient(#ff3d00, #ffb703, #ff6b00, #ffd166, #ff3d00); }
.fr-ember::before { box-shadow: 0 0 6px #ff6b0099; animation: frSpin 3s linear infinite, frEmber 1.4s ease-in-out infinite alternate; }
.fr-rainbow { --fr: conic-gradient(#ef476f, #ffb703, #06d6a0, #4dabf7, #cc5de8, #ef476f); }
.fr-rainbow::before { animation: frSpin 4s linear infinite; }
.fr-crown { --fr: conic-gradient(#ffd34d, #7b2ff7, #ffd34d, #7b2ff7, #ffd34d); }
.fr-crown::after { content: '👑'; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 10px; line-height: 1; }
.fr-legend { --fr: conic-gradient(#ffd34d, #ef476f, #fff, #4dabf7, #ffd34d); }
.fr-legend::before { inset: -4px; box-shadow: 0 0 8px #ffd34daa; animation: frSpin 2.5s linear infinite; }
@keyframes frSpin { to { transform: rotate(1turn); } }
@keyframes frEmber { to { box-shadow: 0 0 11px #ffb703cc; } }
.lv-pip { position: absolute; right: -6px; bottom: -5px; min-width: 14px; height: 13px; padding: 0 3px; border-radius: var(--r-pill);
  background: var(--accent); color: #1a1300; font: 800 9px/13px var(--font-display); text-align: center; box-shadow: 0 0 0 1.5px var(--panel); }
.plist .lv-pip, .pod .lv-pip { font-size: 11px; height: 16px; line-height: 16px; min-width: 18px; }
.pod .av-frame::before { inset: -4px; }
.pod .fr-crown::after { font-size: 16px; top: -14px; }
.look-title { color: var(--accent); font-size: var(--fs-xs); white-space: nowrap; }

/* ✨ the XP card on the results screen */
.xp-card { position: relative; margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--tint-2); border: 1px solid var(--line); text-align: left; }
.xp-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.xp-lvl { font: 800 var(--fs-lg) var(--font-display); color: var(--accent); }
.xp-gain { font-weight: 700; color: var(--ok); font-size: var(--fs-sm); }
.xp-bar { position: relative; height: 10px; border-radius: var(--r-pill); background: var(--field); overflow: hidden; margin: 4px 0 2px; box-shadow: inset 0 0 0 1px var(--line); }
.xp-bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffd166); }
.xp-bar.flash { animation: xpFlash .6s ease-out; }
@keyframes xpFlash { 0% { box-shadow: 0 0 0 0 #ffd166, inset 0 0 0 1px var(--line); filter: brightness(2); } 100% { box-shadow: 0 0 0 8px #ffd16600, inset 0 0 0 1px var(--line); } }
.xp-sub { color: var(--muted); font-size: var(--fs-xs); }
.xp-lines { list-style: none; margin: var(--s2) 0 0; padding: 0; font-size: var(--fs-sm); }
/* many rewards (#222): two compact columns, and the list scrolls rather than pushing the buttons off the screen */
.xp-lines:has(li:nth-child(5)) { display: grid; grid-template-columns: 1fr 1fr; gap: 2px var(--s4); font-size: var(--fs-xs); max-height: 30vh; overflow-y: auto; overscroll-behavior: contain; }
.xp-lines li > span { min-width: 0; overflow-wrap: anywhere; }
.xp-lines li { display: flex; justify-content: space-between; gap: var(--s3); opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.xp-lines li.in { opacity: 1; transform: none; }
.xp-lines li b { color: var(--ok); }
.xp-up { margin-top: var(--s2); font: 800 var(--fs-md) var(--font-display); color: var(--accent); animation: xpPop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes xpPop { from { transform: scale(.6); opacity: 0; } }
.xp-series { margin-top: var(--s2); color: var(--muted); font-size: var(--fs-xs); }
.xp-fx { position: absolute; left: 0; top: -40px; pointer-events: none; }
body.calm .xp-lines li, body.calm .xp-up { opacity: 1; transform: none; }

/* ✨ the level bar: 🏆 My record's header and the home screen line */
.lvl-head, .lvl-line { display: flex; align-items: center; gap: var(--s4); text-align: left; }
.lvl-badge { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; font: 800 var(--fs-md) var(--font-display);
  color: #1a1300; background: radial-gradient(circle at 35% 30%, #fff8, transparent 60%), var(--accent); box-shadow: 0 0 0 3px var(--accent-a40); }
.lvl-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lvl-txt small { color: var(--muted); font-size: var(--fs-xs); }
.lvl-line .lvl-badge { width: 36px; height: 36px; font-size: var(--fs-sm); }
.home-level { display: block; width: 100%; margin: var(--s3) 0 0; padding: var(--s2) var(--s4); background: var(--tint-1); border: 1px solid var(--line); border-radius: var(--r-md); color: inherit; font: inherit; }
.home-level:empty { display: none; }
.unlock-track { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s3) 0 var(--s1); scrollbar-width: thin; }
.ut-item { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 76px; max-width: 96px; padding: var(--s2);
  border-radius: var(--r-md); background: var(--panel2); border: 1px dashed var(--line); text-align: center; font-size: var(--fs-xs); }
.ut-item i { font-style: normal; font-size: 18px; filter: grayscale(.6); }
.ut-item b { font-weight: 600; line-height: 1.15; }
.ut-item small { color: var(--muted); }
.ut-item.got { border-style: solid; border-color: var(--accent); }
.look-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.look-pick label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); color: var(--muted); }
.pack-head { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s2); }
.icon-pick.locked button { filter: grayscale(1); opacity: .35; }

/* tags naming who did what (Night Heist, Fib Finder), and a chosen option (Odd One Out, Fib Finder, Scribble Relay) */
.reveal-row { display: flex; flex-wrap: wrap; gap: 6px; }
.reveal-tag { border: 2px solid; border-radius: var(--r-pill); padding: 3px 10px; }
.oo-vote, .fb-opt { background-image: linear-gradient(180deg, #ffffff0c, #0000 55%); box-shadow: 0 3px 10px #0005; }
.oo-vote.on, .fb-opt.on, .rl-heart.on { border: 2px solid var(--accent); background: var(--accent-a20); }

/* a timer bar (Doodle Dash, Lucky Letters, Grid Hunt, Word Ladder, Trivia Rush) */
.dd-bar { height: 8px; background: var(--panel); border-radius: var(--r-pill); overflow: hidden; width: min(100%, 520px); margin: 10px auto 6px; }
.dd-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .2s linear; }
.dd-bar.last span { background: var(--danger); }
/* the clock shimmers as it runs down, and pulses in its last seconds */
.dd-bar { box-shadow: inset 0 1px 2px #0006; }
.dd-bar span { position: relative; border-radius: inherit; box-shadow: 0 0 8px var(--accent-a40); }
.dd-bar.last span { animation: pulse .8s ease-in-out infinite; box-shadow: 0 0 10px var(--danger-a20); }
/* picture dice (Dice.art): the drawing fills the die face */
.die-art { width: 78%; height: 78%; display: block; filter: drop-shadow(0 1px 0 #fff8); }

/* the green card table, playing cards and a hand of them (Last Card, Hearts, Hold'em, Cribbage, Speed, Twenty-One, Rummy) */
.table { background: radial-gradient(circle at 50% 35%, #2a8a6a, #0e3b2e 75%); border-radius: var(--radius); padding: 14px; box-shadow: inset 0 0 40px #0008; }
.pc { --cw: 54px; position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  flex: none; width: var(--cw); height: calc(var(--cw) * 1.4); container-type: inline-size; overflow: hidden;
  border-radius: calc(var(--cw) * .1); padding: 0; border: 0; font-weight: 800; font-size: calc(var(--cw) * .36); line-height: 1;
  background: linear-gradient(165deg, #fffefa 0%, #f8f3e8 55%, #ebe3d0 100%);
  box-shadow: inset 0 0 0 1px #00000026, inset 0 1px 0 #fff, 0 1px 1px #0005, 0 3px 8px #0006; }
/* suit colour, and the second colour of the court figures' trim */
.pc.red { color: #c8102e; --acc: #2f5aa8; } .pc.black { color: #17181f; --acc: #c8102e; }
.pc.big-card { --cw: 72px; }
.pc.small { --cw: 30px; }
.pc.tiny { --cw: 22px; }
.pc.empty { background: #ffffff10; box-shadow: inset 0 0 0 2px #ffffff22; }
.pc.starter { box-shadow: 0 0 0 2px #ffd166, 0 2px 6px #0008; margin-left: 6px; }
.pc.toss { animation: toss .4s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes toss { from { transform: translate(-40px, 60px) rotate(-25deg) scale(.8); opacity: 0; } }
.hand { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.card-btn { padding: 0; border: 0; background: none; transition: transform .15s; }
.card-btn.ok { transform: translateY(-8px); }
/* #91: the ring sits inside the card and dimmed cards stay opaque, so overlapped corner indices stay readable */
.card-btn.ok .pc { outline: 3px solid var(--accent); outline-offset: -3px; box-shadow: 0 4px 10px #000a; }
.card-btn:disabled { opacity: 1; filter: brightness(.7) saturate(.6); }
/* a fanned hand: cards overlap and tilt, and scroll sideways when there are many */
.hand.fan { flex-wrap: nowrap; gap: 0; overflow-x: auto; overflow-y: hidden; justify-content: safe center;
  padding: 16px 22px 10px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.hand.fan .card-btn { flex: none; margin-left: -16px; scroll-snap-align: center; transform-origin: 50% 130%;
  transform: rotate(var(--rot, 0deg)) translateY(var(--drop, 0px)); }
.hand.fan .card-btn:first-child { margin-left: 0; }
.card-btn.dealt .pc { animation: dealIn .4s var(--deal, 0s) both cubic-bezier(.2, 1.1, .4, 1); }
@keyframes dealIn { from { opacity: 0; transform: translate(-40px, -90px) rotate(-30deg) scale(.6); } }
.hand.fan .card-btn.ok { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--drop, 0px) - 12px)); }
.hand.fan .card-btn:focus-visible, .hand.fan .card-btn.ok:hover { z-index: 2; }

/* dice with pips (Yacht, Farkle, Liar's Dice, Qork, Ship Captain & Crew, Shut the Box) */
/* a row of dice */
.ya-dice { display: flex; justify-content: center; gap: clamp(6px, 2vw, 12px); margin: 8px 0 12px; }
/* padding is sized from the die itself: a % would be measured against the whole dice row and squeeze the pips to nothing (#44) */
.ya-die { --die: clamp(50px, 15vw, 70px); width: var(--die); height: var(--die); padding: calc(var(--die) * .14); border-radius: 18%; background: linear-gradient(145deg, #fff, #e6e0f0);
  border: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 6%;
  box-shadow: 0 4px 0 #b9b0cc, 0 8px 16px #0008; transition: transform .15s, box-shadow .15s; }
.ya-die span { border-radius: 50%; min-width: 0; min-height: 0; }
.ya-die span.on { background: radial-gradient(circle at 35% 35%, #555, #111); }
.ya-die:disabled { opacity: 1; cursor: default; }
.ya-die.blank span.on { opacity: .25; }
.ya-die.held { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--accent), 0 4px 0 #b9b0cc, 0 12px 18px #0009; }
.ya-die.roll { animation: yaroll .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes yaroll { 0% { transform: rotate(-200deg) scale(.6); } 100% { transform: none; } }

/* the shared kit (static/kit.js): card corners and court cards, dice that tumble, chip stacks,
   floating score text, big callouts */
/* playing cards (static/kit.js Cards): one SVG face per card that scales with --cw. `.full` has corner
   indices, real pip layouts and drawn court figures; narrow cards (≤ 52px: solitaire columns on a phone,
   .small, .tiny) switch to `.cmp`, a big rank and suit that stay readable when cards overlap */
.pc:not(.back) > b, .pc:not(.back) > i { display: none; }
.pc .face { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: currentColor; }
.pc .face .ix { font-family: var(--font-display); font-weight: 800; font-size: 50px; text-anchor: middle; letter-spacing: -3px; }
.pc .face .ix.big { font-size: 106px; text-anchor: start; letter-spacing: -6px; }
.pc .face .ix.big.ten { font-size: 90px; letter-spacing: -12px; }
.pc .face .ix.jk { font-size: 40px; letter-spacing: 6px; }
.pc .face .frame { fill: #fffaf0; stroke: #9c7414; stroke-width: 2.5; }
.pc .face .cmp { display: none; }
@container (max-width: 52px) { .pc .face .full { display: none; } .pc .face .cmp { display: inline; } }
.pc.court { background: linear-gradient(165deg, #fffdf4, #f4ead2); }
/* backs: a lattice over a two-tone gradient with a centre medallion; the colour is a setting (body[data-back]) */
.pc.back { --bk1: #3157d8; --bk2: #13226a; --bkr: #fbf7ee; --bke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='%23ffffff' fill-opacity='.5'/%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23ffffff' stroke-opacity='.75' stroke-width='4'/%3E%3Cpath d='M50 20l8.5 19.5 21 2-16 14 5 21-18.5-11-18.5 11 5-21-16-14 21-2z' fill='%23ffffff' fill-opacity='.8'/%3E%3C/svg%3E"); color: #fff;
  background: var(--bke) center / 58% auto no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M0 10L10 0L20 10L10 20Z' fill='none' stroke='white' stroke-opacity='.2' stroke-width='1.3'/%3E%3Ccircle cx='10' cy='10' r='1.7' fill='white' fill-opacity='.28'/%3E%3C/svg%3E") center / calc(var(--cw) * .3) auto, linear-gradient(160deg, var(--bk1), var(--bk2));
  box-shadow: inset 0 0 0 calc(var(--cw) * .055) var(--bkr), inset 0 0 0 calc(var(--cw) * .08) var(--bk2), 0 1px 1px #0005, 0 3px 8px #0006; }
body[data-back="red"] .pc.back { --bk1: #d6384c; --bk2: #6b0d1b; }
body[data-back="green"] .pc.back { --bk1: #1e9c6b; --bk2: #0a4632; }
body[data-back="night"] .pc.back { --bk1: #34343f; --bk2: #0c0c12; --bkr: #e8b847; --bke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='%230c0c12' fill-opacity='.5'/%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23e8b847' stroke-opacity='.75' stroke-width='4'/%3E%3Cpath d='M50 20l8.5 19.5 21 2-16 14 5 21-18.5-11-18.5 11 5-21-16-14 21-2z' fill='%23e8b847' fill-opacity='.8'/%3E%3C/svg%3E"); }
body[data-back="sunset"] .pc.back { --bk1: #ff8a3d; --bk2: #8f1d5c; --bkr: #fff4e0; }
body[data-back="galaxy"] .pc.back { --bk1: #3b2a8f; --bk2: #070417; --bkr: #c9b8ff;
  background: var(--bke) center / 58% auto no-repeat, radial-gradient(1.5px 1.5px at 20% 30%, #fff, #0000), radial-gradient(1px 1px at 70% 20%, #fff, #0000),
    radial-gradient(1.5px 1.5px at 40% 80%, #fff, #0000), radial-gradient(1px 1px at 85% 65%, #fff, #0000), radial-gradient(circle at 30% 30%, #7b4dff88, #0000 60%),
    linear-gradient(160deg, var(--bk1), var(--bk2)); }
body[data-back="royal"] .pc.back { --bk1: #5a1a8a; --bk2: #1e0636; --bkr: #e8b847; --bke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='%231e0636' fill-opacity='.55'/%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23e8b847' stroke-width='4'/%3E%3Cpath d='M26 64l-4-28 16 14 12-22 12 22 16-14-4 28z' fill='%23e8b847'/%3E%3C/svg%3E"); }
.pc.back > b, .pc.back > small { position: relative; }
.pc.back small { font-size: max(10px, calc(var(--cw) * .22)); background: #000a; padding: 1px 5px; border-radius: var(--r-pill); }
body.lowgfx .pc:not(.back):not(.empty) { background: #fbf8ef; box-shadow: inset 0 0 0 1px #0003, 0 1px 3px #0006; }
.pc.flip-in { animation: flipIn .45s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes flipIn { 0% { transform: rotateY(90deg) scale(1.05); } 100% { transform: none; } }
.kit-ghost { transition: none !important; }

/* dice: a tumble with a bounce, each die landing a beat after the last (--i), spinning its own way (--spin) */
.ya-die.roll { animation: diceTumble .55s calc(var(--i, 0) * 40ms) both cubic-bezier(.25, 1.35, .45, 1); }
@keyframes diceTumble { 0% { transform: translateY(-30px) rotate(var(--spin, -200deg)) scale(.55); opacity: .4; box-shadow: 0 30px 0 #b9b0cc00, 0 36px 26px #000a; }
  60% { transform: translateY(3px) rotate(8deg) scale(1.04); opacity: 1; box-shadow: 0 2px 0 #b9b0cc, 0 4px 10px #0008; } 100% { transform: none; } }
.ya-die.small { --die: clamp(26px, 8vw, 34px); box-shadow: 0 2px 0 #b9b0cc, 0 4px 8px #0008; }
.ya-die.tiny { --die: 18px; padding: 2px; gap: 1px; border-radius: var(--r-xs); box-shadow: 0 1px 0 #b9b0cc; display: inline-grid; }
.ya-die.wild-face, .ya-die.hot { box-shadow: 0 0 0 3px var(--ok), 0 4px 0 #b9b0cc, 0 8px 16px #0008; }
/* casino chips: a stack per amount with the number under it (Hold'em, Blackjack) */
.chip-stack { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; vertical-align: middle; }
.chip-stack b { font-size: var(--fs-xs); color: #ffd166; text-shadow: 0 1px 2px #000; }
.chip-col { display: flex; flex-direction: column-reverse; align-items: center; }
.cchip { display: block; width: 22px; height: 7px; border-radius: 50%; margin-top: -3px; border: 1px solid #0006;
  background: var(--c); box-shadow: inset 0 0 0 2px #fff8, 0 1px 1px #0008; }
.chip-col .cchip:first-child { margin-top: 0; }
.cchip.white { --c: #eee; } .cchip.red { --c: #d62828; } .cchip.green { --c: #1b8a3d; } .cchip.black { --c: #222; }
.cchip.purple { --c: #7b2cbf; } .cchip.gold { --c: #e0a400; }
.chip-stack.big .cchip { width: 30px; height: 9px; margin-top: -4px; }

/* "+38" rising from where it was scored, and a big word across the screen */
.fly-text { position: fixed; z-index: 45; transform: translate(-50%, -50%); font-weight: 800; font-family: var(--font-display); font-size: var(--fs-xl); pointer-events: none;
  text-shadow: 0 2px 6px #000c; animation: flyUp 1.2s ease-out forwards; white-space: nowrap; }
.fly-text.good { color: #06d6a0; } .fly-text.bad { color: #ef476f; } .fly-text.gold { color: #ffd166; } .fly-text.info { color: #fff; }
.fly-text.still { animation: fadeOut 1.2s ease-in forwards; }
@keyframes flyUp { 0% { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -260%) scale(1); opacity: 0; } }
@keyframes fadeOut { 70% { opacity: 1; } 100% { opacity: 0; } }
.kit-callout { position: fixed; z-index: 46; left: 50%; top: 38%; transform: translate(-50%, -50%); pointer-events: none;
  width: max-content; max-width: 92vw; text-align: center; line-height: 1.1; overflow-wrap: anywhere;
  font-size: clamp(28px, 9vw, 64px); font-weight: 800; font-family: var(--font-display); letter-spacing: .02em; color: #fff;
  text-shadow: 0 0 20px var(--cc, #ffb703), 0 0 50px var(--cc, #ffb703), 0 4px 0 #0008; animation: calloutIn 1.5s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.kit-callout.gold { --cc: #ffb703; } .kit-callout.good { --cc: #06d6a0; } .kit-callout.bad { --cc: #ef476f; } .kit-callout.cool { --cc: #4dabf7; }
.kit-callout.still { animation: fadeOut 1.5s ease-in forwards; }
@keyframes calloutIn { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-6deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.12) rotate(1deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1.04); opacity: 0; } }
/* a rubber stamp slammed onto a spot: FARKLE, SKIP, FLINCH! */
.kit-stamp { position: fixed; z-index: 45; transform: translate(-50%, -50%) rotate(-8deg); pointer-events: none; white-space: nowrap;
  font-size: clamp(20px, 6vw, 34px); font-weight: 800; font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; padding: 2px 12px;
  color: var(--sc, #ef476f); border: 4px solid currentColor; border-radius: var(--r-sm); background: #0009;
  animation: stampIn 1.1s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.kit-stamp.good { --sc: #06d6a0; } .kit-stamp.gold { --sc: #ffd166; } .kit-stamp.cool { --sc: #4dabf7; }
.kit-stamp.still { animation: fadeOut 1.1s ease-in forwards; }
@keyframes stampIn { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(2.4); opacity: 0; } 15% { transform: translate(-50%, -50%) rotate(-8deg) scale(.92); opacity: 1; }
  24% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* arena banners and score rows for the real-time games (Light Riders, Paint Blast, Sumo Saucers, Hover Rally) */
.lr-banner { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-size: clamp(24px, 8vw, 44px); font-weight: 800; font-family: var(--font-display); color: #fff;
  text-shadow: 0 0 18px #8ecae6, 0 0 40px #1f6fff; pointer-events: none; letter-spacing: .06em; }
.lr-banner.small { font-size: 22px; top: 18%; }
.lr-row.out { opacity: .5; }
.lr-row .grow { flex: 1; }
.shake { animation: jolt .35s; }
@keyframes jolt { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-4px, 1px); } 80% { transform: translate(3px, 0); } }

/* the 🃏 card table (static/cardtable.js): Cheat, President, Spades and the other games on games/cardbase.py.
   Seats on an oval (--x/--y from -1 to 1) as in Hearts, the trick or the piles in the middle, my hand below */
.card-btn.picked { transform: translateY(-16px); }
.hand.fan .card-btn.picked { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--drop, 0px) - 20px)); }
.card-btn.picked .pc { box-shadow: 0 0 0 3px #ffd166, 0 0 14px #ffd166aa; }
/* ======================================================================== 6. Games, A to Z */

/* backgammon */
.bg { max-width: 640px; margin: 0 auto; }
.bg-die.ya-die { --die: 28px; }
/* billiards */
.bl { margin: 0 auto; user-select: none; -webkit-user-select: none; }
/* the table takes the whole width (#35), so there is no side column: the game info (status, each player's balls),
   the emoji bar and the log sit in a strip under the shot controls. The table is sized to leave room for that strip. */
#game .layout:has(.bl) { grid-template-columns: minmax(0, 1fr); max-width: 1900px; }
#game .layout:has(.bl) > aside { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
#game .layout:has(.bl) #sideGame { flex: 3 1 420px; min-width: 0; }
#game .layout:has(.bl) .log-panel { flex: 1 1 300px; min-width: 0; margin: 0; }
body.focus #blHint { display: none; }  /* ❓ has the same how-to; the table gets the room */
/* focus mode on a wide screen (.bl-fill, set by billiards.js): the table takes the whole height. The game info turns into a
   glass card over the top of the table that clicks pass through, and when there is no room under the table (.bl-over)
   the shot controls float over its bottom edge. Both fade while the cue is aimed or the balls roll (.bl-busy). */
.bl { position: relative; }
/* the slim bar sits on the rail; the cue ball's tip dot shows the spin */
body.focus #game .layout:has(.bl-fill) .bl-keys, body.focus #game .layout:has(.bl-fill) .log-panel { display: none !important; }
/* bingo: Bingo Bash. The ball machine canvas + called ball up top, 1-4 cards (2 columns from 2 cards), a sticky BINGO! bar;
   splats are SVG blobs in the player's colour (--ink); claimed lines are an SVG over each card's grid */
.bgo-machine { width: 100%; aspect-ratio: 1; }
.bgo-machine canvas { display: block; }
.bgo-rail { display: flex; gap: 6px; min-height: 34px; overflow: hidden; }
.bgo-pace { height: 6px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.bgo-pace span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3a86ff, #ef476f, #aab4c3, #06d6a0, #ffb703); transition: width .4s; }

.bgo-card { container-type: inline-size; position: relative; background: linear-gradient(160deg, #fffdf7, #f3ecdc); border-radius: 12px; padding: 5px;
  box-shadow: 0 6px 16px #0006, inset 0 0 0 2px #fff; color: #1b1630; transition: box-shadow .4s; }
.bgo-card.hot { box-shadow: 0 0 0 3px #ff9f1c, 0 0 22px #ff6b00aa, 0 6px 16px #0006; animation: bgo-heat 1.2s ease-in-out infinite alternate; }
@keyframes bgo-heat { to { box-shadow: 0 0 0 3px #ffd166, 0 0 34px #ff3d00cc, 0 6px 16px #0006; } }
.bgo-card.gold { background: linear-gradient(140deg, #fff3c4, #ffd166 45%, #f4a300); animation: bgo-flip .9s ease-out; }
@keyframes bgo-flip { 0% { transform: perspective(600px) rotateY(0); } 50% { transform: perspective(600px) rotateY(90deg) scale(1.05); } 100% { transform: none; } }
.bgo-card.deal-in { animation: bgo-deal .55s cubic-bezier(.2, 1.3, .4, 1) calc(var(--i) * .09s) both; }
@keyframes bgo-deal { from { transform: translate(40px, -80px) rotate(18deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.bgo-card.spin .bgo-cell span { animation: bgo-reel .5s ease-out calc((var(--c, 0)) * 1s); }
@keyframes bgo-reel { 0% { transform: translateY(-120%); filter: blur(3px); opacity: 0; } 70% { transform: translateY(12%); filter: none; opacity: 1; } 100% { transform: none; } }
.bgo-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-bottom: 3px; position: relative; }
.bgo-head b { color: #fff; text-align: center; border-radius: 6px; font-family: var(--font-display); font-size: max(13px, 9cqi); line-height: 1.25; text-shadow: 0 2px 0 #0003; }
.dealing .bgo-card { padding-top: 30px; }
.dealing .bgo-head { margin-top: 0; }
.bgo-grid { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.bgo-cell { position: relative; aspect-ratio: 1; padding: 0; min-height: 0; border-radius: 7px; border: 0; background: #fff; color: #1b1630;
  box-shadow: inset 0 0 0 1px #0002; display: grid; place-items: center; overflow: visible; font: 800 max(12px, 7.5cqi)/1 var(--font-display); }
.bgo-cell > span { position: relative; z-index: 2; display: grid; place-items: center; }
.bgo-cell.free { background: radial-gradient(circle, #fff6d6, #ffd166); color: #b5179e; }
.bgo-cell.free small { font-size: .42em; letter-spacing: .05em; }
.bgo-cell.d .bgo-star { display: none; }
.bgo-cell.called { animation: bgo-callme 1s ease-in-out infinite alternate; }
@keyframes bgo-callme { from { box-shadow: inset 0 0 0 2px #3a86ff; } to { box-shadow: inset 0 0 0 3px #3a86ff, 0 0 12px #3a86ffaa; background: #e8f1ff; } }
.bgo-cell.near::before { content: ""; position: absolute; inset: -2px; border-radius: 8px; z-index: 0; padding: 2px;
  background: conic-gradient(from var(--a, 0deg), #ffd166, #ef476f, #3a86ff, #06d6a0, #ffd166);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: bgo-shimmer 1.6s linear infinite; }
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes bgo-shimmer { to { --a: 360deg; } }
.bgo-cell > svg { position: absolute; inset: -6%; width: 112%; height: 112%; z-index: 1; fill: var(--ink); opacity: .78; transform: rotate(var(--rot)); pointer-events: none; }
.bgo-cell.d > span { color: #fff; text-shadow: 0 1px 2px #0008; }
.bgo-cell.pop > svg { animation: bgo-splat .38s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes bgo-splat { 0% { transform: rotate(var(--rot)) scale(2.2, .4); opacity: 0; } 50% { transform: rotate(var(--rot)) scale(.85, 1.2); opacity: .9; } 100% { transform: rotate(var(--rot)) scale(1); } }
.bgo-cell.nope { animation: bgo-nope .3s; }
@keyframes bgo-nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes bgo-letter { from { transform: translateY(-60%) scale(2.4) rotate(-20deg); opacity: 0; } }
.bgo-btn { font: 800 26px/1 var(--font-display); padding: 10px 26px; border-radius: 999px; border: 0; color: #fff; letter-spacing: .02em;
  background: linear-gradient(180deg, #ff4d8d, #b5179e); box-shadow: 0 5px 0 #6a0f5c, 0 8px 16px #0006; transition: transform .1s; }
.bgo-btn span:nth-child(1) { color: #9cc3ff; } .bgo-btn span:nth-child(2) { color: #ffc2d1; } .bgo-btn span:nth-child(3) { color: #fff; }
.bgo-btn span:nth-child(4) { color: #a6f4d6; } .bgo-btn span:nth-child(5) { color: #ffe08a; }
.bgo-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #6a0f5c, 0 3px 8px #0006; }
.bgo-btn:disabled { filter: grayscale(.7); opacity: .6; }
.bgo-btn.hot { animation: bgo-hot .6s ease-in-out infinite alternate; }
@keyframes bgo-hot { from { transform: scale(1); box-shadow: 0 5px 0 #6a0f5c, 0 0 0 0 #ffd16600; } to { transform: scale(1.08); box-shadow: 0 5px 0 #6a0f5c, 0 0 0 8px #ffd16655, 0 0 30px #ff4d8d; } }
.bgo-free { background: #ffd166; color: #3d2a00; font-weight: 800; padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.bgo-free.pop { animation: bgo-letter .5s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes bgo-shake { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }

.bgo-board { display: flex; flex-direction: column; gap: 2px; font-size: 10px; }
.bgo-brow { display: grid; grid-template-columns: 18px repeat(15, 1fr); gap: 2px; }
.bgo-brow b { color: #fff; text-align: center; border-radius: 4px; font-family: var(--font-display); }
.bgo-brow span { text-align: center; border-radius: 4px; padding: 2px 0; background: var(--panel2); color: var(--muted); opacity: .55; transition: background .3s; }
.bgo-brow span.on { background: var(--accent2); color: #10202b; opacity: 1; font-weight: 800; }
.bgo-brow span.gold { background: #ffd166; color: #3d2a00; }
.bgo-brow span.last { outline: 2px solid #fff; animation: bgo-letter .5s cubic-bezier(.2, 1.8, .4, 1); }
@media (max-width: 420px) { .bgo-card { padding: 3px; border-radius: 9px; }
  .bgo-grid, .bgo-head { gap: 2px; }
  .bgo-btn { font-size: 22px; padding: 9px 22px; } }
body.calm .bgo *, body.calm .bgo { animation: none !important; }
body.lowgfx .bgo-card.hot, body.lowgfx .bgo-btn.hot { animation: none; }
body.lowgfx .bgo-cell.near::before { animation: none; }
/* bingo round 2: the style banner, target outlines, sleepers, power-up tray, locks, mini cards (5–8), ladder, round-over */
.bgo-cell.tgt { box-shadow: inset 0 0 0 2px #ffb703; background: #fff8e6; }
.bgo-cell.tgt.d { box-shadow: inset 0 0 0 2px #ffb70380; }
.bgo-btn { position: relative; }
.bgo-btn em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 22px; border-radius: 999px; }
.bgo-btn em:empty { display: none; }
.bgo-btn.frozen { background: linear-gradient(180deg, #bfe6ff, #3a86ff); box-shadow: 0 5px 0 #1d4f9a; }
.bgo-btn.frozen em { background: #3a86ffcc; color: #fff; }
.bgo-btn.locked em { background: #000a; color: #fff; }
/* 5–8 cards: smaller cards in more columns, no swap label */
.bgo-cards.mini .bgo-card { padding: 3px; border-radius: 8px; } .bgo-cards.mini .bgo-grid, .bgo-cards.mini .bgo-head { gap: 2px; }
.bgo-cards.mini .bgo-head b { font-size: max(10px, 8cqi); } .bgo-cards.mini .bgo-cell { border-radius: 4px; font-size: max(10px, 7cqi); }
.dealing .bgo-cards.mini .bgo-card { padding-top: 24px; }
.bgo-over-cards .bgo-card { width: min(200px, 44vw); }
.bgo-card.won { animation: bgo-heat 1s ease-in-out infinite alternate; }
/* bingotools + bingoscan: the 🔵 Bingo tools screen (paper-cards helper, caller) and its card scanner; cards reuse .bgo-* */
.bingo-tools-btn { margin-top: 6px; width: 100%; }
#bingoTools { padding: 12px 16px 40px; max-width: 760px; margin: 0 auto; }
.bgt-card .bgo-cell, .bgt-ed input { cursor: default; }
/* the scan and check screens change height as you work: grow downwards, never jump */
.bgt-overlay.win .bgo-card { width: min(100%, 300px); }
/* the caller */
.bgt-board .bgo-brow { grid-template-columns: 24px repeat(15, 1fr); } .bgt-board .bgo-brow span { padding: 5px 0; }
#bingoTools.bgt-projector .bgt-board .bgo-brow span { padding: 1vh 0; }
/* the batch scanner's pages */
/* 🎫 many cards: books → pages → small cards */
.bgt-bookhead > button.ghost-btn { padding: 4px 10px; min-height: 0; flex: none; }
@media (max-width: 420px) { #bingoTools { padding: 10px 10px 40px; } }
/* cannon hills */
/* chess & checkers (2D boards) */
.chessboard { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 560px, var(--room)); margin: 8px auto;
  border: 0; border-radius: 8px; padding: 8px; background: linear-gradient(#3a220c88, #3a220c88), var(--wood); box-shadow: inset 0 1px 0 #ffffff30, 0 12px 30px #0009; }
.csq { aspect-ratio: 1; border: 0; border-radius: 0; padding: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.csq.light { background: #f0d9b5; } .csq.dark { background: #b58863; }
.checkers .csq.light { background: #e8d3b0; } .checkers .csq.dark { background: #6b4a2b; }
.csq.last { box-shadow: inset 0 0 0 100px #ffeb3b55; }
.csq.sel { box-shadow: inset 0 0 0 4px #2b8a3e; }
.csq.check { box-shadow: inset 0 0 0 100px #ef476f99; }
.csq.target::after { content: ''; width: 28%; height: 28%; border-radius: 50%; background: #2b8a3e99; position: absolute; }
.csq.capture { box-shadow: inset 0 0 0 4px #2b8a3eaa; }
.csq.via { box-shadow: inset 0 0 0 3px #2b8a3e55; }
.csq.movable { cursor: pointer; }
.csq:disabled { opacity: 1; }
.piece { font-size: clamp(26px, 9vw, 54px); line-height: 1; font-family: "DejaVu Sans", "Segoe UI Symbol", serif; }
.piece.w { color: #fff; text-shadow: 0 0 2px #000, 0 0 1px #000, 0 1px 2px #000; }
.piece.b { color: #111; text-shadow: 0 0 2px #fff6; }
.coord { position: absolute; font-size: 10px; font-weight: 700; color: #0008; }
.coord.rank { top: 2px; left: 3px; } .coord.file { bottom: 1px; right: 3px; }
.taken { font-size: 18px; margin: 6px 0; }
.checker { width: 78%; height: 78%; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: clamp(14px, 4vw, 26px); box-shadow: inset 0 -4px 0 #0005, 0 2px 4px #0008; --step: 128.2%; }
.checker.d { background: radial-gradient(circle at 40% 35%, #555, #1b1b1b 65%); color: #ffd166; border: 2px solid #555;
  box-shadow: inset 0 0 0 4px #ffffff10, inset 0 -4px 0 #0007, 0 3px 6px #000a; }
.checker.l { background: radial-gradient(circle at 40% 35%, #fffaf0, #e6d6b8 70%); color: #b5452a; border: 2px solid #c9b48f;
  box-shadow: inset 0 0 0 4px #0000000d, inset 0 -4px 0 #0003, 0 3px 6px #0008; }
/* checkers: ridged discs, and a crown for a king (the ♛ stays in the text for screen readers) */
.checker { background-image: repeating-radial-gradient(circle, #0000 0 6%, #0000001a 6% 7.5%), var(--disc-face) !important; }
.checker.d { --disc-face: radial-gradient(circle at 40% 35%, #555, #1b1b1b 65%); }
.checker.l { --disc-face: radial-gradient(circle at 40% 35%, #fffaf0, #e6d6b8 70%); }
.checker.king { color: transparent; }
.checker.king::after { content: ''; width: 62%; height: 62%; background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M3 18 2 7l5.5 4.5L12 4l4.5 7.5L22 7l-1 11Z%22 fill=%22%23ffd166%22 stroke=%22%237a4b00%22 stroke-width=%221.2%22 stroke-linejoin=%22round%22/%3E%3Crect x=%223%22 y=%2218.5%22 width=%2218%22 height=%222.5%22 rx=%221%22 fill=%22%23e0a400%22/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 1px 1px #0008); }
.checkers.chessboard { background: var(--wood); box-shadow: inset 0 0 0 2px #00000030, 0 12px 30px #0009; }
.csq .piece { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 3px 2px #0006); transition: transform .15s, filter .15s; }
/* round H: a grain on the squares and a soft vignette on the board; the piece you picked up lifts off its square */
.csq.light { background: linear-gradient(135deg, #f4e0c0, #ecd4ad); } .csq.dark { background: linear-gradient(135deg, #bb8f6a, #ad815c); }
.checkers .csq.light { background: linear-gradient(135deg, #ecd8b6, #e2cba5); } .checkers .csq.dark { background: linear-gradient(135deg, #6f4e2e, #624325); }
.chessboard { position: relative; }
.chessboard::after { content: ''; position: absolute; inset: 8px; pointer-events: none; box-shadow: inset 0 0 28px #00000040, inset 0 0 0 1px #00000030; }
.csq.sel .piece { transform: translateY(-6%) scale(1.08); filter: drop-shadow(0 8px 5px #0009); z-index: 2; }
.csq.sel .checker { transform: translateY(-6%) scale(1.06); box-shadow: inset 0 -4px 0 #0005, 0 8px 10px #000a; }
/* hold'em: the winning five lit up, a hand-strength meter */
.pc.best { box-shadow: 0 0 0 3px #ffd166, 0 0 16px #ffd166aa; transform: translateY(-4px); }
/* last card: a stamp on an action card as it lands; a growing penalty */
#lcTop { position: relative; }
.penalty { font-size: calc(1em * var(--sz, 1)); animation: pulse .8s infinite alternate; }
/* blackjack: bets as chip stacks */
.to-stake .chip-stack { margin-right: 8px; }
/* farkle: a bust greys the dice; the points on the line ghost ahead on the score bar */
.fk-aside .ya-die.small { --die: 26px; padding: 4px; box-shadow: 0 2px 0 #b9b0cc, 0 3px 6px #0007; }
.fk-aside .ya-die.in { animation: fkAside .35s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes fkAside { from { transform: translateY(-40px) scale(1.6); opacity: 0; } }
.fk-dice.bust .ya-die { filter: grayscale(1) brightness(.7); transition: filter .4s .2s; }
/* rivals' cups across the top: a leather cup in the player's colour band, dice left as pips */
.liar-rung .ya-die.tiny { --die: 16px; padding: 2px; gap: 1px; border-radius: 4px; box-shadow: none; }
/* fib finder: answers turn over one by one */
.fb-res.flip-in { animation: flipIn .5s cubic-bezier(.3, 1.3, .5, 1); }
/* odd one out: the verdict waits for the votes, then the odd one is spotlit */
/* wordsmith: a new word's tiles snap down one by one; the bounty letter flashes when it changes */
#wsBounty.flash { animation: wsFlash 1s; }
@keyframes wsFlash { 0%, 50% { color: #fff; text-shadow: 0 0 12px #ffd166; } }
/* grid hunt: a found word ripples along its tiles; the last ten seconds pulse; shared words get struck out */
#ghGrid.hurry { animation: pulse .5s infinite alternate; }
/* unmask: the face everyone was after, under a spotlight */
.card.unmasked { z-index: 3; animation: umReveal 1s both cubic-bezier(.3, 1.4, .5, 1); box-shadow: 0 0 0 4px #ffd166, 0 0 40px #ffd166aa; }
@keyframes umReveal { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-3deg); } 100% { transform: scale(1.12); } }
/* oware: a store swells as captured seeds land in it */
@keyframes owBump { 40% { transform: scale(1.18); box-shadow: 0 0 24px #ffd166; } }
/* chess pieces: an original SVG set (the glyph stays in the text for screen readers and is hidden) */
.piece.pK, .piece.pQ, .piece.pR, .piece.pB, .piece.pN, .piece.pP { color: transparent !important; text-shadow: none !important;
  background: center 55% / 86% no-repeat; }
.csq .piece.pK, .csq .piece.pQ, .csq .piece.pR, .csq .piece.pB, .csq .piece.pN, .csq .piece.pP { filter: drop-shadow(0 2px 1.5px #0007); }
.piece.w.pP { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Ccircle cx=%2222.5%22 cy=%2213%22 r=%225%22/%3E%3Cpath d=%22M17 31Q18.5 20 22.5 17.5Q26.5 20 28 31Z%22/%3E%3C/svg%3E"); }
.piece.w.pR { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Crect x=%2215%22 y=%2216%22 width=%2215%22 height=%2215%22/%3E%3Cpath d=%22M12 8.5h4v3h3.5v-3h6v3H29v-3h4v8.5H12Z%22/%3E%3C/svg%3E"); }
.piece.w.pB { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Ccircle cx=%2222.5%22 cy=%228.5%22 r=%222.6%22/%3E%3Cpath d=%22M16 31Q13.5 21 22.5 11Q31.5 21 29 31Z%22/%3E%3Cpath class=%22d%22 d=%22M25 16.5 21 22%22/%3E%3C/svg%3E"); }
.piece.w.pN { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M30.5 31V20.5Q30.5 10 21.5 8L20 4.5 17.5 9 11.5 16.5 12.5 21 17.5 19.5 20.5 18.5Q17.5 24 16 31Z%22/%3E%3Ccircle class=%22e%22 cx=%2219%22 cy=%2212.5%22 r=%221.3%22/%3E%3C/svg%3E"); }
.piece.w.pQ { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M15 31 11 13.5 16.5 23 17 11 21 22 22.5 9 24 22 28 11 28.5 23 34 13.5 30 31Z%22/%3E%3Ccircle cx=%2211%22 cy=%2212.5%22 r=%221.9%22/%3E%3Ccircle cx=%2217%22 cy=%2210%22 r=%221.9%22/%3E%3Ccircle cx=%2222.5%22 cy=%228%22 r=%221.9%22/%3E%3Ccircle cx=%2228%22 cy=%2210%22 r=%221.9%22/%3E%3Ccircle cx=%2234%22 cy=%2212.5%22 r=%221.9%22/%3E%3C/svg%3E"); }
.piece.w.pK { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%23fbf8f1%3Bstroke:%232a2420%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%232a2420%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%232a2420%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M15 31Q12 21 17 17.5H28Q33 21 30 31Z%22/%3E%3Crect x=%2216%22 y=%2215%22 width=%2213%22 height=%223.2%22 rx=%221%22/%3E%3Crect x=%2221.4%22 y=%224%22 width=%222.2%22 height=%2211%22/%3E%3Crect x=%2218.3%22 y=%227%22 width=%228.4%22 height=%222.2%22/%3E%3C/svg%3E"); }
.piece.b.pP { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Ccircle cx=%2222.5%22 cy=%2213%22 r=%225%22/%3E%3Cpath d=%22M17 31Q18.5 20 22.5 17.5Q26.5 20 28 31Z%22/%3E%3C/svg%3E"); }
.piece.b.pR { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Crect x=%2215%22 y=%2216%22 width=%2215%22 height=%2215%22/%3E%3Cpath d=%22M12 8.5h4v3h3.5v-3h6v3H29v-3h4v8.5H12Z%22/%3E%3C/svg%3E"); }
.piece.b.pB { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Ccircle cx=%2222.5%22 cy=%228.5%22 r=%222.6%22/%3E%3Cpath d=%22M16 31Q13.5 21 22.5 11Q31.5 21 29 31Z%22/%3E%3Cpath class=%22d%22 d=%22M25 16.5 21 22%22/%3E%3C/svg%3E"); }
.piece.b.pN { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M30.5 31V20.5Q30.5 10 21.5 8L20 4.5 17.5 9 11.5 16.5 12.5 21 17.5 19.5 20.5 18.5Q17.5 24 16 31Z%22/%3E%3Ccircle class=%22e%22 cx=%2219%22 cy=%2212.5%22 r=%221.3%22/%3E%3C/svg%3E"); }
.piece.b.pQ { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M15 31 11 13.5 16.5 23 17 11 21 22 22.5 9 24 22 28 11 28.5 23 34 13.5 30 31Z%22/%3E%3Ccircle cx=%2211%22 cy=%2212.5%22 r=%221.9%22/%3E%3Ccircle cx=%2217%22 cy=%2210%22 r=%221.9%22/%3E%3Ccircle cx=%2222.5%22 cy=%228%22 r=%221.9%22/%3E%3Ccircle cx=%2228%22 cy=%2210%22 r=%221.9%22/%3E%3Ccircle cx=%2234%22 cy=%2212.5%22 r=%221.9%22/%3E%3C/svg%3E"); }
.piece.b.pK { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cstyle%3E%2A%7Bfill:%2326211f%3Bstroke:%230d0b0a%3Bstroke-width:1.4%3Bstroke-linejoin:round%7D.d%7Bfill:none%3Bstroke:%23e9e2d4%3Bstroke-width:1.6%3Bstroke-linecap:round%7D.e%7Bfill:%23e9e2d4%3Bstroke:none%7D%3C/style%3E%3Crect x=%2210%22 y=%2235%22 width=%2225%22 height=%225%22 rx=%221.5%22/%3E%3Crect x=%2213%22 y=%2231%22 width=%2219%22 height=%224.5%22 rx=%221%22/%3E%3Cpath d=%22M15 31Q12 21 17 17.5H28Q33 21 30 31Z%22/%3E%3Crect x=%2216%22 y=%2215%22 width=%2213%22 height=%223.2%22 rx=%221%22/%3E%3Crect x=%2221.4%22 y=%224%22 width=%222.2%22 height=%2211%22/%3E%3Crect x=%2218.3%22 y=%227%22 width=%228.4%22 height=%222.2%22/%3E%3C/svg%3E"); }
.csq .piece.taken { animation: takenOff .6s ease-in forwards; pointer-events: none; }
@keyframes takenOff { 0% { opacity: 1; transform: none; } 40% { opacity: 1; transform: scale(1.1) rotate(-8deg); } 100% { opacity: 0; transform: translateY(30%) scale(.4) rotate(25deg); } }
.csq .checker { position: relative; }
/* a moved piece slides from its origin square */
.slide { z-index: 3; animation: slide .32s cubic-bezier(.3, .8, .4, 1); }
@keyframes slide { from { transform: translate(calc(var(--dx) * var(--step, 100%)), calc(var(--dy) * var(--step, 100%))) scale(1.08); } }
/* chess premoves: queued during the rival's turn */
.csq.premove { box-shadow: inset 0 0 0 4px #8ecae6cc; background-image: linear-gradient(#8ecae63a, #8ecae63a); }
/* desktop: the controls sit in the side column, so the board can use the whole height (#69), and its pieces grow with it */
@media (min-width: 861px) {
  .chessboard { width: min(100%, 1400px, var(--room)); container-type: inline-size; }
  .piece { font-size: clamp(26px, 9.5cqw, 90px); }
}

/* chess 3D */
.chess3d { position: relative; width: min(100%, 600px, calc(var(--room) + 10px)); aspect-ratio: 1; margin: 8px auto; border-radius: var(--radius);
  overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #3a2d5c, #120e1c 75%); box-shadow: inset 0 0 0 1px #ffffff12, 0 10px 30px #0008; }
.chess3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* desktop: the board can use the whole height (#69), like the 2D board */
@media (min-width: 861px) { .chess3d { width: min(100%, 1400px, calc(var(--room) + 10px)); } }

/* cribbage */
.cb { max-width: 640px; margin: 0 auto; }
/* a wooden pegging board: one hole per point, a groove every five */
.cb-hand .card-btn { position: relative; }
/* phones: the six dealt cards share one row instead of wrapping onto two */
@media (max-width: 860px) { .cb-hand .pc.big-card { --cw: min(72px, calc((100vw - 40px) / 6)); } }
/* dice derby: six lanes of turf, the finish post on the right, and job tags on the dice */
.dby-dice .ya-die[data-job] { position: relative; }
.dby-dice .ya-die[data-job]::after { content: attr(data-job); position: absolute; top: -12px; right: -10px; padding: 1px 6px; border-radius: 10px;
  font-size: 13px; font-weight: 900; color: #fff; background: #06d6a0; }
.dby-dice .ya-die.dby-job1::after { background: #3a86ff; }
.dby-dice .ya-die.dby-job2::after { background: var(--danger); }
/* doodle dash */
.dd { max-width: 560px; margin: 0 auto; }
@keyframes dddraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* the reveal card: a note pinned over the bottom of the drawing */
.dd-stand.st-card { box-shadow: none; margin: 6px 0 0; padding: 6px 4px; background: transparent; }
.dd-stand .st-row { font-size: 13px; padding: 2px; }
body.kb-open .dd-paper { width: min(100%, calc(var(--room) - 130px), 520px); min-width: 140px; }

/* farkle (dice reuse the .ya-die look) */
.fk { max-width: 560px; margin: 0 auto; }
/* six dice in one row even on a phone, so the row doesn't wrap and grow when all six are rolled (#18) */
.fk-dice .ya-die { --die: clamp(40px, 12.5vw, 70px); }
/* on a phone the longer labels ("🎲 Set aside scoring dice") take two lines: keep room for two so the row doesn't grow and shrink (#18) */
#fkHint { min-height: 18px; }
/* fib finder */
body.kb-open .fb-fact { font-size: 16px; padding: 10px; }

/* freecell and solitaire (klondike): both drawn by static/patience.js. --cw (the card width) is set from the
   board's width so eight columns fit a phone; cards in a column are placed by layout() with top offsets */
.pt, .pt-ghost, .pt .pc, .pt-ghost .pc, .pc.pt-fly { --cw: var(--ptw, 60px); }
.pt { --gap: 6px; width: min(100%, 760px); margin: 0 auto; padding: 8px 6px 4px; border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 20%, #2b8a66, #0f4433 70%, #0b3528); box-shadow: inset 0 0 50px #0009; user-select: none; -webkit-user-select: none; }
.pt-head { display: flex; align-items: baseline; gap: 10px; color: #e7fff4; font-weight: 700; font-size: 14px; padding: 0 2px; }
.pt-clock { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; margin-left: auto; }
.pt-info { color: #bfe9d6; font-weight: 600; font-size: 12px; }
.pt .dd-bar { margin: 4px auto 8px; height: 6px; background: #0006; }
.pt-top, .pt-tab { display: grid; gap: var(--gap); justify-content: center; }
.pt-top { margin-bottom: calc(var(--gap) * 2); }
.pt-tab { align-items: stretch; }
.pt-slot { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .1);
  box-shadow: inset 0 0 0 2px #ffffff26; background: #00000022; touch-action: none; }
.pt-col { height: auto; min-height: calc(var(--cw) * 1.4); box-shadow: none; background: none; }
.pt-col.empty::before { content: ''; position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: inherit;
  box-shadow: inset 0 0 0 2px #ffffff26; background: #00000022; }
.pt-k { position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4); display: grid; place-items: center;
  font: 800 calc(var(--cw) * .45) var(--font-display); color: #ffffff30; }
.pt-slot .pc { position: absolute; left: 0; top: 0; cursor: grab; touch-action: none; transition: box-shadow .15s, filter .15s; }
.pt-slot .pc.down { cursor: default; }
.pt-mark { position: absolute; inset: 22%; width: 56%; height: 56%; fill: #ffffff24; }
.pt-found { background: #00000033; }
.pt-found .pc.pt-under { cursor: default; }
.pt-found.full .pc { box-shadow: 0 0 0 2px #ffd166, 0 0 14px #ffd16688; }
/* picked up (tap), legal targets, a hint, and where a dragged card would land */
.pt-slot .pc.pt-sel { box-shadow: 0 0 0 3px var(--accent), 0 6px 14px #000a; filter: brightness(1.04); }
.pt-slot.pt-target::after { content: ''; position: absolute; left: -3px; right: -3px; top: -3px; bottom: -3px; border-radius: calc(var(--cw) * .13);
  box-shadow: 0 0 0 2px #fff8, 0 0 12px #ffffff55; pointer-events: none; z-index: 60; }
.pt-col.pt-target::after { height: calc(var(--cw) * 1.4 + 6px); top: auto; bottom: -3px; }
.pt-col.pt-target:not(.empty)::after { display: none; }
.pt-col.pt-target:not(.empty) .pc:last-child { box-shadow: 0 0 0 3px #fffb, 0 0 14px #ffffff88; }
.pt-slot .pc.pt-hint, .pt-slot.pt-hint { animation: ptHint 1s ease-in-out infinite alternate; }
@keyframes ptHint { to { box-shadow: 0 0 0 3px #ffd166, 0 0 18px #ffd166cc; } }
.pt-over.pt-yes > .pc:last-child, .pt-over.pt-yes:not(:has(.pc)) { box-shadow: 0 0 0 3px #7CFFB2, 0 0 16px #7CFFB2aa; }
.pt-over.pt-no > .pc:last-child { box-shadow: 0 0 0 3px #ff6b6b99; }
.pt-slot .pc.pt-lifted { visibility: hidden; }
.pt-ghost { position: fixed; z-index: 70; width: var(--cw); pointer-events: none; filter: drop-shadow(0 10px 14px #000a); }
.pt-ghost .pc { position: absolute; }
.pt-fly { position: fixed; z-index: 80; pointer-events: none; }
.pt-tools { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.pt-tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 6px 10px; font-size: 18px; line-height: 1.1;
  background: #00000040; color: #fff; border: 1px solid #ffffff2a; border-radius: 12px; }
.pt-tools button small { font-size: 11px; font-weight: 700; opacity: .85; }
.pt-tools button:disabled { opacity: .35; }
.pt-tools button.pt-glow { background: var(--accent); color: #1b1300; animation: ptHint .8s ease-in-out infinite alternate; }
.pt-note { min-height: 18px; margin: 8px 0 2px; text-align: center; color: #d8f5e8; font-size: 13px; font-weight: 600; }
.pt-racer { flex-wrap: wrap; }
.pt-prog { position: relative; flex-basis: 100%; height: 12px; margin: 2px 0 4px 18px; border-radius: 99px; background: #ffffff14; overflow: hidden; }
.pt-prog i { display: block; height: 100%; border-radius: inherit; transition: width .4s; }
.pt-prog b { position: absolute; right: 6px; top: -1px; font-size: 10px; }
body.calm .pt-slot .pc.pt-hint, body.calm .pt-slot.pt-hint, body.calm .pt-tools button.pt-glow { animation: none; box-shadow: 0 0 0 3px #ffd166; }
@media (max-width: 420px) { .pt { padding: 6px 3px 4px; border-radius: 10px; } .pt-tools button { min-width: 56px; padding: 5px 6px; } }

/* garden: a soft green plot with cream letter tiles, and the ring of letters under it */
.gd { width: 100%; max-width: 620px; margin: 0 auto; padding: 8px 6px 4px; }
.gd .pt-head, .gd .dd-bar { width: min(100%, 520px); margin-left: auto; margin-right: auto; color: var(--text); }
.gd .pt-info { color: var(--muted); }
.gd .pt-tools { margin-top: 10px; }
/* go */
.stone.b { background: radial-gradient(circle at 35% 30%, #666, #000 60%); box-shadow: 1px 2px 3px #0008; }
.stone.w { background: radial-gradient(circle at 35% 30%, #fff, #ccc 70%); box-shadow: 1px 2px 3px #0006; }
.stone.last::after { content: ''; position: absolute; inset: 32%; border-radius: 50%; border: 2px solid #ef476f; }
.stone.drop { animation: stoneIn .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes stoneIn { from { transform: scale(1.5); opacity: 0; filter: blur(1px); } }
.stone.b { background: radial-gradient(circle at 35% 30%, #777, #222 45%, #000 70%); box-shadow: inset -2px -3px 4px #ffffff14, 1px 2px 3px #0008; }
.stone.w { background: radial-gradient(circle at 35% 30%, #fff, #f2eee4 45%, #c9c4b8 80%); box-shadow: inset -2px -3px 4px #00000018, 1px 2px 3px #0006; }
/* grid hunt */
.gh { width: min(100%, 460px, calc(var(--room) - 80px)); min-width: min(100%, 300px); margin: 0 auto; }
/* a traced word: without animation the tiles still end up highlighted */
/* hearts */
.hh { width: min(100%, 640px); margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
/* the round table: seats on an oval round the edge (--x/--y from -1 to 1), the trick in the middle */
.hh-note { min-height: 1.4em; text-align: center; font-size: 13px; color: var(--muted); }
.hh-hand { padding-top: 8px; }
.hh-hand .pc { --cw: 44px; }
.hh-hand .card-btn.got .pc { box-shadow: 0 0 0 2px #ffd166, 0 0 12px #ffd166aa; }

/* hedgerow */
/* night heist */
.heist { max-width: 640px; margin: 0 auto; }
.vault { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 14px; border-radius: var(--radius);
  background: radial-gradient(circle at 12% 18%, #fff 0 1px, #0000 1.6px), radial-gradient(circle at 78% 14%, #fffc 0 1px, #0000 1.6px), radial-gradient(circle at 60% 32%, #fff9 0 .8px, #0000 1.3px),
    radial-gradient(circle at 30% 70%, #fff8 0 .8px, #0000 1.3px), radial-gradient(circle at 88% 64%, #fffa 0 1px, #0000 1.5px), radial-gradient(circle at 46% 86%, #fff7 0 .8px, #0000 1.3px),
    radial-gradient(circle, #3d2f66, #1a1430); margin-bottom: 12px; transition: box-shadow .5s; }
.vault.fullmoon { outline: 2px solid #cfe7ff55; }
.vault[data-heat="1"] { box-shadow: 0 0 18px #ffb70344; } .vault[data-heat="2"] { box-shadow: 0 0 28px #ffb70377; }
.vault[data-heat="3"] { box-shadow: 0 0 40px #ff7b00aa; animation: pulse 1.4s infinite alternate; }
.vault .pot { font-size: 46px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.vault.alarm, .vault.caught { animation: hAlarm .25s 6 alternate; }
.vault.caught { --alarm: #4dabf7; }
@keyframes hAlarm { to { background: radial-gradient(circle, var(--alarm, #ef476f), #1a1430); } }
.coins { position: relative; height: 26px; width: 120px; margin: 4px auto 0; }
.coins i { position: absolute;
  width: 18px; height: 6px; border-radius: 50%; background: linear-gradient(#ffe08a, #d4a017); box-shadow: 0 1px 0 #8a6200; }
/* 🔦 last thief standing: heat pips, public tails, the informant's picker */
/* a rival: hole cards, a nameplate under them, then their last action and the chips they have out */
.he-seat.folded .he-cards, .he-seat.folded .he-plate, .he-myinfo.folded .he-plate { opacity: .5; filter: grayscale(.7); }
.he-cards { display: flex; gap: 4px; justify-content: center; margin: 2px 0; }
/* casino chips seen from the side: striped edges, each chip a hair off the one under it, the amount on a dark pill */
@keyframes heNext { from { transform: scaleX(1); } to { transform: scaleX(0); } }
#heRaise { font-weight: 800; padding: 11px; }
/* kindred: a 4×4 board of SVG pieces, the piece in hand, and the pool of pieces left to hand over */
/* word ladder */
.ld { width: min(100%, 420px); margin: 0 auto; }
@keyframes ld-pop { from { transform: scale(.7); } to { transform: scale(1); } }  /* also Trivia Rush's fastest answer */

/* one lantern per trader (lantern.js paintString): their colour, lit once they've bid, dark once the 🏮 is used */
/* last card (cards and hands are in section 5) */
.penalty { background: var(--danger); color: #fff; border-radius: 8px; padding: 2px 8px; font-weight: 800; text-align: center; animation: pulse 1s infinite; }
#lcDeclare.on { animation: pulse .7s infinite; }

/* liar's dice (dice reuse the .ya-die look) */
.liar-bid .ya-die { --die: 48px; }
.liar-mine .ya-die { --die: clamp(40px, 12vw, 56px); }
.ya-die.wild { box-shadow: 0 0 0 3px #ffd166, 0 4px 0 #b9b0cc; }
.liar-faces .ya-die { --die: clamp(36px, 11vw, 48px); }
.liar-dice .ya-die { --die: 28px; }
.liar-dice .ya-die.dim { opacity: .35; }
.liar-dice .ya-die.match { box-shadow: 0 0 0 2px var(--accent); }
.seat-row.out { opacity: .45; }
@keyframes lr-flash { from { background: #ffd16655; } to { background: var(--panel); } }  /* also Ship, Captain & Crew */

/* lucky letters */
.lucky { max-width: 680px; margin: 0 auto; --lk-th: clamp(30px, 8.5vw, 46px); }
/* phones: the wheel gives up height so the board and the spin / letter controls fit under it */
#lkSvg { position: absolute; inset: 6%; display: flex; justify-content: center; }
/* room for three lines of tiles, so a new phrase doesn't move what's below (#61) */
#lkScores tr.now td { background: #ffb7031a; }
/* fixed-height status and action area, so buttons and letter keys appearing don't shift the page */
#lkStatus { min-height: 2.6em; }
/* the letter clock (#63) */
.lk-clock .dd-bar { margin: 0 0 2px; width: 100%; }
/* a phone on its side (#64): the wheel sits beside the phrase board */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 600px) { .lucky { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 10px; align-items: start;
    --lk-th: clamp(22px, 3.2vw, 38px); } }
/* #97: perks between boards, the ⚡ turbo button */
/* mia: the call on the table, a leather cup that lifts off your dice, and the ladder of values */
.mia { width: min(100%, 520px); margin: 0 auto; text-align: center; }
/* midnight: a little clock whose hand creeps to 12 as the score climbs; the 1 and 4 slots */
.md { width: min(100%, 480px); margin: 0 auto; text-align: center; }
.md-kept .ya-die.md-six { box-shadow: 0 0 0 2px #ffd166, 0 2px 0 #b9b0cc; }
/* the route bends up at the end of each row */
.rocket { font-size: 9px; font-weight: 800; color: #111; border-radius: 6px; padding: 0 3px; line-height: 14px; }
.rocket.active { outline: 2px solid #fff; }
.moon-panel .dice .ya-die { --die: clamp(40px, 11vw, 56px); }
.rocket.shielded { box-shadow: 0 0 0 3px #8ecae6aa, 0 0 12px #8ecae6; }
.rocket.shielded::after { content: attr(data-shields); position: absolute; top: -10px; right: -10px; font-size: 10px; }
.rocket { position: relative; }
/* phones (#6): rockets become coloured dots (names stay in the tooltip) so six fit in one square */
@media (max-width: 560px) { .rocket { font-size: 0; width: 9px; height: 9px; padding: 0; border-radius: 50%; line-height: 0; }
  .rocket.active { outline-width: 1.5px; }
  .moon-panel .dice .ya-die { --die: 40px; } }
/* nine men's morris */
.mm { width: min(100%, 520px, calc(var(--room) - 40px)); min-width: min(100%, 280px); margin: 0 auto; }
#mmWarn.on { border-color: var(--danger); color: var(--danger); }
/* odd one out */
body.kb-open .oo-card { padding: 8px; margin-bottom: 6px; }
body.kb-open .oo-card b { font-size: 24px; }

/* oware */
#owHint { min-height: 2.8em; }  /* paint blast */
.pb { max-width: 640px; margin: 0 auto; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
body.focus .pb { max-width: 900px; }
/* prism pop: a square gem board on a canvas, a clock bar and score above it, rival minis in the side panel */
@keyframes pzFever { to { filter: brightness(1.08) saturate(1.15); } }
/* camera buttons: a column on the right edge of the 3D view */
.pp-done .st-card { margin-top: 10px; }
/* a golf scorecard: par row, birdie circles, bogey squares, to-par column */
body.focus .pp { max-width: 900px; }
/* qork (dice reuse the .ya-die look) */
.qk { display: flex; flex-direction: column; align-items: center; gap: 6px; user-select: none; -webkit-user-select: none; }
/* lap splits */
#raDaily:not(:empty) { margin-top: 12px; }
body.focus .ra { max-width: 900px; }
/* scribble relay */
.rl { max-width: 560px; margin: 0 auto; }
/* at the reveal a drawing draws itself again, stroke by stroke (each path normalised to length 1) */
body.kb-open .rl-art { width: min(100%, calc(var(--room) - 140px)); }

/* battle tray, buttons, side panel */
.rw-side .ya-dice { margin: 2px 0; gap: 5px; }
.rw-side .ya-die { --die: 34px; }
.ya-die.rw-red { background: linear-gradient(145deg, #ff7a6e, #c2322a); box-shadow: 0 3px 0 #7d1d18, 0 6px 12px #0008; }
.ya-die.rw-red span.on { background: #fff; }
/* forts, storms, flags, held islands, marching troops */
.ya-die.rw-fortdie { position: relative; box-shadow: 0 0 0 2px #e3d6b8, 0 3px 0 #b9b0cc; }
.ya-die.rw-fortdie::after { content: attr(data-plus); position: absolute; right: -8px; top: -8px; font: 800 10px/1 inherit; padding: 2px 3px;
  border-radius: 6px; background: #e3d6b8; color: #3a2f22; }
/* reversi */
.rv { width: min(100%, 560px, calc(var(--room) - 40px)); min-width: min(100%, 280px); margin: 0 auto; }
/* reversi, deeper: discs with a two-tone rim that really turn over (showing the old colour first), a wood frame, a hover ghost */
#rvHint { min-height: 1.4em; }  /* empties out between turns (#18) */

/* light riders (banners and score rows in section 5) */
.lr { position: relative; margin: 0 auto; overscroll-behavior: none; user-select: none; -webkit-user-select: none; touch-action: none; }
/* the arena takes the whole room; scores, boost and (mouse only) arrows float on top of it */
.lr-banner { z-index: 2; }
/* jokers; after Hearts, whose .hh-hand card size Rummy's hand also uses */
.pc.joker { color: #7b2cbf; }
/* your own hand order (#59): sort buttons, and drag a card to move it */
.ru-sort .seg-opt { flex: none; padding: 5px 10px; font-size: 13px; }
.ru-sort .seg-opt.on { border-color: var(--accent); background: #ffb7031a; }
.ru-hand .card-btn { touch-action: none; }  /* a drag moves the card, not the page */
.ru-hand .card-btn.idle { cursor: grab; }
.ru-hand .card-btn.lifted { opacity: .25; }
.ru-hand .card-btn.drop-before { box-shadow: -5px 0 0 -1px var(--accent); }
/* safecracker */
.sc { width: min(100%, 520px); margin: 0 auto; }
/* sea battle */
/* 💥 aiming a torpedo: the three squares it would hit */
#sbTorp.on { box-shadow: 0 0 0 3px var(--accent); }
@keyframes splash { from { transform: scale(1.5); box-shadow: 0 0 0 6px #fff8; } }
/* ships as hulls: a grey deck with a centre stripe, the bow rounded and the stern square */
#sbSonar.on { background: #8ecae6; color: #002; }

/* ship, captain & crew (dice reuse the .ya-die look; .crew, .crew-slots and .crew-actions override Safecracker's) */
.crew { width: min(100%, 460px); margin: 0 auto; text-align: center; }
.crew-slot .ya-die { --die: clamp(40px, 12vw, 52px); }
/* empty before the first roll: keep the dice's row (#18) */
.crew-free .ya-die.dim { filter: saturate(.4) brightness(.8); }
.crew-free .ya-die.cargo { box-shadow: 0 0 0 2px #ffd166, 0 4px 0 #b9b0cc; }
/* shut the box (dice reuse the .ya-die look) */
.sb { width: min(100%, 560px); margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sb-row.now .seat-row span.grow { text-decoration: underline; text-decoration-color: var(--accent); }
/* speed */
.sp { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; }
/* each centre pile is a real stack: a few card edges peek out underneath the top card */
.sp-pile .pc.big-card { box-shadow: 1px 1px 0 #ddd, 2px 2px 0 #bbb, 3px 3px 0 #ddd, 4px 4px 0 #999, 6px 8px 14px #0008; }
.sp-hand .card-btn.chosen { transform: translateY(-16px); }
.sp-hand .card-btn.chosen .pc { box-shadow: 0 0 0 3px #fff, 0 6px 14px #000a; }
.sp-hand .card-btn { touch-action: none; }  /* a drag moves the card, not the page */
.sp-hand .card-btn.lifted { visibility: hidden; }
@media (max-width: 420px) { .sp-hand .pc.big-card { --cw: 58px; } }

/* spire siege */
@keyframes spCall { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.15); } 70% { opacity: 1; transform: translateY(-10px); } 100% { opacity: 0; transform: translateY(-40px); } }
.rival { background: #ffffff08; border-radius: 10px; padding: 6px; text-align: center; font-size: 12px; font-weight: 700; }
.rival canvas { width: 60px; height: 90px; background: #0b0918; border-radius: 4px; image-rendering: pixelated; }
.rival small { display: block; color: var(--muted); font-weight: 400; }
.rival.down { opacity: .45; } .rival.me { outline: 1px solid var(--accent); }
/* the incoming-junk meter (left edge of the well) */
@keyframes spJunk { to { box-shadow: 0 0 18px #ff2d55; filter: brightness(1.4); } }
/* dice squares: your grid with a hand result per row (right) and column (bottom) */
.dsq-cell .ya-die.small { --die: min(42px, 100%); }
/* out of the flow, so a canvas sized for a wider screen can't hold the stage open past the app (#75) */
.sm-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.sm-bar button { min-width: 130px; padding: 14px; font-size: 17px; }
body.focus .sm { max-width: 900px; }
/* tic-tac-toe */
.ttt-cell.win .ttt-ink path { filter: drop-shadow(0 0 5px #ffd166); }
.ttt.big { gap: 6px; } .ttt-ink { width: 78%; height: 78%; overflow: visible; filter: drop-shadow(0 0 8px currentColor); }
.ttt-ink path { fill: none; stroke: currentColor; stroke-width: 11; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0;
  animation: inkDraw .28s ease-out both; }
@keyframes inkDraw { from { stroke-dashoffset: 100; } }
.ttt-ink.still path { animation: none; }
.ttt-strike { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ttt-strike path { stroke: #fff; stroke-width: 9px; stroke-linecap: round; fill: none; stroke-dasharray: 100;
  filter: drop-shadow(0 0 3px var(--accent)); animation: inkDraw .45s .1s ease-out both; vector-effect: non-scaling-stroke; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* sudoku */
.sd { --sdw: min(100%, 520px, max(260px, calc(var(--room) - 175px))); --ink: #1d2742; --pen: #2457c5; --paper: #fbf7ec;
  width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 6px 4px; user-select: none; -webkit-user-select: none; }
.sd .pt-head, .sd .dd-bar { width: var(--sdw); margin-left: auto; margin-right: auto; }
.sd .pt-tools { margin-top: 10px; }
.sd .pt-head { color: var(--text); }
@media (max-width: 420px) { .sd { padding: 4px 2px; } }
body.focus .sd { --sdw: min(100%, 640px, max(260px, calc(var(--room) - 175px))); }

/* ✂️ a 50:50 takes two answers away; at the reveal each answer fills with the share of the table that chose it */
/* twenty-one */
.to { width: min(100%, 640px); margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
/* a full-size card: the dealer's row doesn't grow on the deal */
#toNote { min-height: 1.4em; margin: 4px 0 8px; }
/* ultimate tic-tac-toe */
.ut-cell .ttt-ink { width: 80%; height: 80%; filter: drop-shadow(0 0 3px currentColor); }
.ut-cell .ttt-ink path { stroke-width: 13; }
.ut-won .ttt-ink { width: 82%; height: 82%; } .ut-won .ttt-ink path { stroke-width: 9; }
/* a board that would win the whole game: a corner flag in the colour of who'd win with it */
#utHint { min-height: 1.4em; }  /* empties out between turns (#18) */

/* unmask */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--card, 92px), 100%), 1fr)); gap: 10px; perspective: 800px;
  touch-action: pan-x pan-y; }  /* one finger scrolls; two fingers pinch the faces bigger or smaller */
.card .nm i.g { font-style: normal; font-weight: 900; margin-right: 2px; }
.card .nm i.g.woman { color: #d6336c; } .card .nm i.g.man { color: #1c7ed6; }
.card { position: relative; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #fff; color: #222;
  transition: transform .35s, filter .35s, opacity .35s; transform-style: preserve-3d; box-shadow: 0 3px 10px #0006; }
.card svg { display: block; width: 100%; aspect-ratio: 1; }
.card .nm { display: block; padding: 3px 0 5px; font-weight: 700; font-size: 13px; background: #fff; }
.card.down { transform: rotateX(55deg) scale(.92); filter: grayscale(1) brightness(.45); opacity: .55; }
.card.mine { outline: 3px solid var(--ok); }
.card[data-badge]::after { content: attr(data-badge); position: absolute; top: 4px; left: 4px; right: 4px; background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 4px; }
.board.accusing .card:not(.down) { animation: wobble .6s infinite alternate; cursor: crosshair; }
.board.accusing .card:not(.down):hover { outline: 3px solid var(--danger); }
@keyframes wobble { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
.identity .mini { width: 72px; border-radius: 10px; overflow: hidden; flex: none; }
.identity .mini svg { display: block; width: 100%; }
/* phones: your face and the question picker stay short, so Ask sits right under the fitted board */
@media (max-width: 860px) { .identity .mini { width: 44px; border-radius: 8px; }
  #askPanel { padding: 10px 12px; }
  #askPanel h3 { display: none; }
  #askPanel .preview { margin: 4px 0; min-height: 0; }
  #askPanel .check { margin: 6px 0; } }
.cards { display: grid; gap: 8px; margin-top: 10px; }
.pcard .txt { flex: 1; font-size: 12px; color: var(--muted); }
/* word bomb: the seats in a ring round the bomb; the holder's typing shows under their seat */
.wb { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
/* phones: smaller seats; while the keyboard is up the table shrinks so the entry stays on screen */
body.kb-open .wb-table { width: min(100%, 300px, calc(100vh - 200px)); }
body.kb-open .wb-alpha, body.kb-open .wb-head { display: none; }

/* whisker run: the maze fills the room above the arrow pad; scores float over it */
.wk { --padH: 0px; position: relative; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none; touch-action: none; }
/* word search */
.wf .pt-head, .wf .dd-bar { width: var(--wfw); margin-left: auto; margin-right: auto; color: var(--text); }
.wf .pt-tools { margin-top: 10px; }
@keyframes wfHint { to { background: #ffd8b0; } }
body.focus .wf { --wfw: min(100%, 680px, max(260px, calc(var(--room) - 190px))); }

/* this turn's tiles: not yet played */
.rack { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 48px; margin: 8px 0; }
/* desktop: the board can use the whole height (#69), and its letters grow with it */
/* yacht (the dice are in section 5) */
.ya-top .ya-dice { margin: 0; }
/* a felt dice tray with a wooden rim; a held die gets a little HELD tag */
.ya-tray { margin: 4px auto 8px; padding: 12px 10px 16px; border-radius: 16px; width: fit-content; max-width: 100%; min-width: min(100%, 280px); box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 40%, #2f7d5f, #12402f 80%);
  box-shadow: inset 0 0 0 5px #6b4423, inset 0 0 0 7px #8f5f35, inset 0 6px 18px #000a, 0 4px 12px #0007; }
.ya-tray .ya-die { position: relative; }
.ya-tray > .ya-dice { margin: 0; }
.ya-tray .ya-die.held::after { content: 'HELD'; position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%);
  font-size: 9px; font-weight: 900; letter-spacing: .08em; color: #ffd166; }
.ya-best { margin: 4px 0; padding-left: 1.6em; font-weight: 700; }
.ya-best small { font-weight: 400; opacity: .6; margin-left: 6px; }
.ya-best li.now { color: #ffd166; }
/* ======================================================================== 7. Screen modes */
/* phones: one column, the log folds, player chips scroll sideways */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr);  /* minmax: a long log line can't widen the page */ padding: 8px 10px; gap: 10px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex: none; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .fabs { bottom: max(10px, env(safe-area-inset-bottom)); right: 10px; } .fabs button { width: 46px; height: 46px; font-size: 20px; }
  .topbar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  /* in a game the dock replaces the floating buttons and the log panel */
  body[data-screen="game"] #fabs { display: none; }
  #game .dock { display: flex; gap: 8px; align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
    padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: var(--bar); backdrop-filter: blur(8px); border-top: 1px solid #ffffff10; }
  body.light #game .dock { border-top-color: var(--line); }
  #game .layout { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  #game .log-panel { display: none; }
  /* the log as a sheet over the dock */
  body.log-open #game .log-panel { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    max-height: min(70vh, 520px); border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(66px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px #000a; animation: sheetUp .2s ease-out; }
  body.log-open #game .log-panel .log { max-height: none; flex: 1; min-height: 0; }
  body.log-open #game .log-panel .log-toggle .chev { transform: none; }
  /* chat and settings: bottom sheets */
  .drawer { left: 0; right: 0; bottom: 0; width: auto; max-height: 75vh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); animation: sheetUp .2s ease-out; }
  /* sheets in a game open under the dock, so its buttons still switch between them */
  body[data-screen="game"] .drawer { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .chat-bubble { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  body[data-screen="game"] .toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
  #overBanner { padding: 12px; font-size: 16px; }
  .over-actions button { min-width: 0; padding: 9px 8px; }
  .over-actions .primary { flex-basis: 100%; padding-block: 12px; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
/* small phones: the room code shrinks to the game's icon */
@media (max-width: 400px) { .topbar .gc-code { display: none; } .topbar .gc-icon { font-size: 20px; } }
/* the game's name sits under the room code (#92) */
#gameCode { display: flex; flex-direction: column; line-height: 1.05; max-width: 30vw; min-width: 0; flex-shrink: 1; }
#gameCode .gc-top { white-space: nowrap; }
#gameCode .gc-name { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); -webkit-text-fill-color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }

@media (min-width: 861px) { /* large screens: the game spans the whole window and the side panel is a slim column at the right edge, so the
     board gets the room (the old 1300px cap and 340px panel left ~900px for the game however big the screen) */
  #game .layout { max-width: none; grid-template-columns: minmax(0, 1fr) clamp(260px, 18vw, 300px); gap: 12px; }
  #game .layout > aside .react-bar button { flex: 1 1 0; min-width: 0; }
  /* seven reactions fit the slimmer column */
  #game .layout > aside { position: sticky; top: 64px; max-height: calc(var(--app-h, 100vh) - 76px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; } }
/* a phone on its side (#64): the side panel sits beside the game instead of below it, so the controls are on screen without scrolling */
@media (orientation: landscape) and (max-height: 540px) and (min-width: 600px) {
  #game .layout { grid-template-columns: minmax(0, 1fr) minmax(250px, 36%); align-items: start; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  /* height is what's short: no dock and no chips row (the top bar names whose turn it is); the log and
     reactions go back to the side column, chat is in the ⋯ menu */
  #game .dock, #players { display: none !important; }
  #game .log-panel { display: block; }
  #game .layout > aside { position: sticky; top: var(--bar-h, 52px); max-height: calc(var(--app-h, 100vh) - var(--bar-h, 52px) - 10px); overflow-y: auto; }
  body[data-screen="game"] .toast { bottom: calc(14px + env(safe-area-inset-bottom)); }
  .topbar { padding-block: 2px; }
  /* card hands overlap into one row instead of wrapping onto a second */
  .hh-hand, .ru-hand { flex-wrap: nowrap; justify-content: safe center; gap: 0; }
  .hh-hand > * + *, .ru-hand > * + * { margin-left: -10px; }
  .hh-hand > *:hover, .ru-hand > *:focus-visible { z-index: 1; }
}

/* focus mode (topbar ▣ button): the board takes the whole screen; Leave/End game stays so nobody is stuck (#10) */
body.focus #players, body.focus .log-panel, body.focus #fabs, body.focus #chatBubble, body.focus #game .dock { display: none; }
body.focus #game .layout { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
body.focus .topbar { padding-block: 4px; }
body.focus .layout { padding-top: 6px; }

/* typing on a phone: hide everything around the game so the board and the input fit above the keyboard */
body:has(#game:not([hidden])) { overscroll-behavior-y: contain; }
body.kb-open #players, body.kb-open .layout > aside, body.kb-open #fabs, body.kb-open #chatBubble, body.kb-open #game .dock { display: none; }
body.replaying #game .dock { display: none; }
body.kb-open .topbar { padding-block: 4px; }
body.kb-open .layout { padding-top: 4px; padding-bottom: 8px; }
body.kb-open .dd-head, body.kb-open .oo-round, body.kb-open .fb-head { display: none; }

/* ======================================================================== 8. Motion */
/* press feedback: buttons shrink a little while pressed. A game's own stylesheet (static/games/*.css) loads after this
   file, so source order no longer puts this last: the :not(x-none) adds one element's worth of specificity, (0,2,1), which
   beats a game's two-class state (.rack-tile.sel) as the old order did, and still loses to a three-class one */
:where(.primary, .danger, .game-tile, .fabs button, .row > button, .over-actions button, .h-choice, .lk-key, .rack-tile,
  .ship-btn, .quick-chat button, .seg-opt, .card-btn):not(:disabled):active:not(x-none) { transform: scale(.95); }

/* "Animations" off in my settings, or the system's reduced motion */
body.calm::before, body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* effects that only exist to animate away must not linger when animation is off */
@media (prefers-reduced-motion: reduce) { .csq .piece.taken { display: none; } }
@media (prefers-reduced-motion: reduce) { .xp-lines li, .xp-up { opacity: 1; transform: none; } .av-frame::before { animation: none; } }
body.calm .csq .piece.taken { display: none; }
/* 🎨 Graphics: Low (or Auto on a weak device): no blurred glass, no logo sheen; games read gfxLevel() for the rest */
body.lowgfx .logo { animation: none; }
/* unmask: a flipped face turns over to show a card back; the latest answer as a speech bubble; the shrinking line-up */
.card::before { content: '🎭'; position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font-size: calc(var(--card, 92px) * .4);
  background: repeating-linear-gradient(45deg, #3b2a6b 0 8px, #2c1f52 8px 16px); border-radius: inherit; opacity: 0; transition: opacity .2s .12s; pointer-events: none; }
.card.down { transform: rotateX(180deg) scale(.9); filter: none; opacity: .5; }
.card.down::before { opacity: 1; transform: rotateX(180deg); }
.card.turning { transition: transform .45s cubic-bezier(.3, 1.5, .5, 1), opacity .45s; }
/* chess: the last move as an arrow, the king in check pulses, material as a tug of war */
.csq.check { animation: chCheck 1s ease-in-out infinite alternate; }
@keyframes chCheck { from { box-shadow: inset 0 0 0 100px #ef476f66; } to { box-shadow: inset 0 0 0 100px #ef476fcc, inset 0 0 18px 6px #fff8; } }
/* word ladder: real side rails, the new letter flips over, a peeked rung shows the letter to change */
@keyframes ldPeek { to { box-shadow: 0 0 12px #ffd166; } }

/* night heist: a night sky behind the vault, a guard's torch sweeping it (faster as the loot grows), red strobes on the alarm */
.vault { position: relative; overflow: hidden; isolation: isolate; }
.vault[data-heat="2"] .beam { animation-duration: 4s; } .vault[data-heat="3"] .beam { animation-duration: 2.4s; }
/* three slow pulses (well under three flashes a second), not a strobe, for photosensitive players */
#hTip { margin-top: 8px; }

/* checkers: a forced capture lights the pieces that must jump; a new king's crown drops on */
.csq.must .checker { box-shadow: 0 0 0 3px #ef476f, 0 0 14px #ef476f; animation: ckMust .8s ease-in-out infinite alternate; }
@keyframes ckMust { to { box-shadow: 0 0 0 3px #ffd166, 0 0 20px #ffd166; } }
.checker.king.crowned::after { animation: ckCrown .55s var(--cd, 0s) both cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ckCrown { from { transform: translateY(-160%) scale(1.8) rotate(-20deg); opacity: 0; } }

/* a phone held sideways: the shot controls stand in a column beside the table, which gets the full height */
@media (orientation: landscape) and (max-height: 520px) { .bl { display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 8px; align-items: start; } }
/* phone keyboard open while chatting (#61): the sheet rides on top of the keyboard */
body.chat-typing .drawer { bottom: var(--kb, 0px) !important; max-height: calc(var(--app-h, 100vh) - 12px); padding-bottom: 10px !important; }
#overBanner.folded .over-head { cursor: pointer; }
/* last card: rivals' seats with fans of card backs; a twin you can jump in with */
.card-btn.twin { animation: lcTwin .8s ease-in-out infinite alternate; }
.card-btn.twin .pc { box-shadow: 0 0 0 2px #ffd166, 0 0 14px #ffd166aa; }
@keyframes lcTwin { to { transform: rotate(var(--rot, 0deg)) translateY(calc(var(--drop, 0px) - 8px)); } }
body.calm .card-btn.twin { animation: none; }
/* liar's dice: dice on show, and a bump on each raise */
.liar-mine .ya-die.onshow { box-shadow: 0 0 0 2px #ffd166, 0 2px 4px #0008; }
/* backgammon: the doubling cube on the bar */
@keyframes bgCube { 0% { transform: translateX(-50%) rotateY(0) scale(1.4); } 100% { transform: translateX(-50%) rotateY(360deg) scale(1); } }
/* checkers: a material bar, and a refused tap shakes the piece */
.checker.nope { animation: ckNope .35s; }
@keyframes ckNope { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
body.calm .checker.nope { animation: none; }
/* chess: a wooden frame round the 2D board, a gold flash on promotion, the hill in King of the Hill */
.chessboard:not(.checkers) { border: 10px solid #6b4423; border-radius: var(--r-sm); box-shadow: inset 0 0 0 2px #3a2410, 0 10px 26px #0009, 0 0 0 2px #a0703f; }
.csq.promoted { animation: chPromo 1.2s ease-out; }
@keyframes chPromo { 0%, 30% { box-shadow: inset 0 0 0 4px #ffd166, inset 0 0 24px #ffd166; } 100% { box-shadow: none; } }
.csq.hill::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, #ffd16644, transparent 70%); pointer-events: none; }
body.calm .csq.promoted { animation: none; }
/* tic-tac-toe: the grid drawn in pen, and a ghost of your mark under the pointer */
.ttt-ink.ghost { opacity: .22; position: absolute; }
/* hover rally: a place gained or lost flashes */
#raPlace { position: relative; }
#raPlace.up::after, #raPlace.down::after { content: attr(data-move); position: absolute; left: 100%; top: 50%; margin-left: 4px; font-weight: 900;
  animation: raMove 1.1s ease-out forwards; }
#raPlace.up::after { color: #51cf66; } #raPlace.down::after { color: #ff6b6b; }
@keyframes raMove { 0% { opacity: 0; transform: translateY(-50%) scale(1.6); } 20% { opacity: 1; transform: translateY(-50%); } 100% { opacity: 0; transform: translateY(-120%); } }
/* 🏆 My record (static/profile.js): ladder stars and "new" tags on game tiles, and the record dialog */
.game-tile .tile-stars { position: absolute; top: 3px; left: 5px; font-size: 10px; letter-spacing: -1px; color: var(--accent); }
.game-tile .tile-new { position: absolute; top: 4px; left: 5px; font-size: 9px; font-weight: 700; text-transform: uppercase;
  color: var(--accent2); letter-spacing: .5px; }
.record { text-align: left; }
.record h4 { margin: 14px 0 6px; }
.rec-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.rec-stat b { display: block; font-size: 20px; }
.rec-stat small { color: var(--muted); font-size: var(--fs-xs); }
.rec-miles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: var(--fs-xs); }
.rec-miles span { padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--muted); opacity: .45; filter: grayscale(1); }
.rec-miles span.got { opacity: 1; filter: none; border-color: var(--accent); }
.rec-badges { display: flex; flex-wrap: wrap; gap: 6px; font-size: 20px; }
.rec-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.rec-table th { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); text-align: right; }
.rec-table td { padding: 3px 4px; border-top: 1px solid var(--panel2); text-align: right; }
.rec-table td:first-child, .rec-table th:first-child { text-align: left; }
.rec-table .rec-stars { color: var(--accent); letter-spacing: -1px; white-space: nowrap; }
.rec-fresh { display: flex; flex-wrap: wrap; gap: 5px; }
.rec-fresh .chip-btn, .rec-fresh span { font-size: var(--fs-xs); }
#lobbyRecordBtn { display: block; margin: 8px auto 0; }
#overBanner:not(.folded) #overFold { font-size: 14px; white-space: nowrap; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 10px; }

/* a game's screen while its script is still loading (app.js needUI) */
.ui-loading { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; min-height: 40vh;
  font-size: 1.15rem; color: var(--muted, #9aa); animation: ui-loading-in .3s .25s both; }
@keyframes ui-loading-in { from { opacity: 0; } }
/* #174: shown on the flat fallback of a 3D game: try the 3D view again */
.gl3-retry { position: absolute; top: 44px; right: 8px; z-index: 5; font-size: 13px; padding: 6px 12px; border-radius: var(--r-pill);
  background: #000a; color: #fff; border: 1px solid #fff4; backdrop-filter: blur(4px); }

.ct-capture-preview { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Tabletop surfaces on the home screen, lobby and home game picker. */
:is(#home, #lobby, body[data-screen="home"] #modal.sheet) {
  --panel: #152c25;
  --panel2: #203a30;
  --field: #10251e;
  --text: #f7f0df;
  --muted: #c4cbbd;
  --line: #53685a;
  --table-accent: #e8bf78;
  --table-focus: #a3e5cb;
  color: var(--text);
}
body.light :is(#home, #lobby, body[data-screen="home"] #modal.sheet) {
  --panel: #fff9ed;
  --panel2: #f0e7d5;
  --field: #fffdf5;
  --text: #183329;
  --muted: #4a5b51;
  --line: #a39882;
  --table-accent: #735019;
  --table-focus: #11634b;
}
:is(#home, #lobby) { background: radial-gradient(ellipse at 50% 0, #284a3b, #12241e 75%); }
body.light :is(#home, #lobby) { background: radial-gradient(ellipse at 50% 0, #fff5df, #e3dbc8 75%); }
#home .logo { font-size: clamp(2rem, 9vw, 3rem); color: var(--table-accent); background: none; animation: none; }
.home-art {
  height: clamp(92px, 24vw, 144px);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: url('/tabletop-home.webp') center / cover no-repeat, radial-gradient(ellipse at center, #355848, #183429);
}
#lobby .room-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel2);
}
#lobby .room-code { text-align: left; color: var(--muted); font-size: var(--fs-sm); }
#lobby .room-code b { color: var(--table-accent); font-size: clamp(1.5rem, 6vw, 2rem); }
#lobby #shareBtn { margin: 0; }
#lobby .game-chosen, #lobby .game-chosen.folded, #lobby .settings, #lobby .plist li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel2);
}
#lobby .game-chosen { flex-wrap: wrap; }
#lobby .game-chosen:empty, #lobby .settings:empty { display: none; }
#lobby .picker-tools, body[data-screen="home"] .picker-sheet .picker-tools { flex-wrap: wrap; }
:is(#lobby, body[data-screen="home"] .picker-sheet) .picker-tools input { flex-basis: 8rem; }
:is(#lobby, body[data-screen="home"] .picker-sheet) .game-tile {
  background: linear-gradient(155deg, color-mix(in srgb, var(--tint) 15%, var(--panel2)), var(--panel2) 70%);
}
:is(#lobby, body[data-screen="home"] .picker-sheet) .game-tile.on {
  border-color: var(--table-accent);
  box-shadow: inset 0 0 0 1px var(--table-accent);
}
:is(#home, #lobby, body[data-screen="home"] #modal.sheet) :is(button, input, select):focus-visible {
  outline: 2px solid var(--table-focus);
  outline-offset: 2px;
}
:is(#lobby, body[data-screen="home"] .picker-sheet) .game-tile:focus-visible { outline-offset: -4px; }
body.lowgfx :is(#lobby, body[data-screen="home"] .picker-sheet) .game-tile .gicon { filter: none; }
