/* Table layout for card games: a play stage that fills the screen, DOM seat tags and speech bubbles over the canvas,
   a controls row, DOM playing cards for sheets and strips, and the shared widgets (suit picker, bid dial, chips, coach).
   Replaces the board pack's board.css. Games override tokens in styles/<game>.css; markup contract in docs/SCREENS.md. */

/* ---- card colour tokens (faces are drawn on canvas from the same values; keep them in sync with shared/cards/render.js) ---- */
:root {
  --card-face: #f6f1e6; --card-edge: rgb(0 0 0 / .18); --card-gold: #c9a24a;
  --card-black: #1b1b1f; --card-red: #b8232f; --card-blue: #1f5fbf; --card-green: #1f7a3a;
  --suit-S: var(--card-black); --suit-H: var(--card-red); --suit-D: var(--card-red); --suit-C: var(--card-black);
  --font-card: "Merriweather", Georgia, "Times New Roman", serif;
  --felt: #1f5a3a; --felt-2: #17452c; --rim: #5a3a22; --table-radius: 18px;
  --nil: #f72585; --pc: var(--accent);
}
:root[data-fourcolour="1"], :root[data-colorblind="1"] { --suit-D: var(--card-blue); --suit-C: var(--card-green); }
:root[data-contrast="1"] { --card-edge: rgb(0 0 0 / .45); --card-black: #000; --card-red: #9e0f1c; }

/* ---- play screen ---- */
.play { padding: 0; position: relative; height: 100dvh; min-height: 0; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.play .hud { position: relative; z-index: 3; display: flex; align-items: center; gap: var(--s-2); padding: max(8px, env(safe-area-inset-top)) 10px 6px; flex: 0 0 auto; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 4px 6px; }
.stage-canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: var(--table-radius); box-shadow: 0 0 0 1px rgb(255 255 255 / .06), 0 22px 60px rgb(0 0 0 / .55), 0 4px 14px rgb(0 0 0 / .4); }
.turn-hint { font-size: .85rem; color: var(--ink-2); text-align: center; flex: 1; }

/* seat tags: positioned by main.js with --x/--y in stage pixels (centre of the tag) */
.seat-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.seat-tag { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: auto; min-width: 56px; }
.seat-tag .avatar { position: relative; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--pc) 70%, #fff), var(--pc) 55%, color-mix(in oklab, var(--pc) 65%, #000)); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1rem; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .25), 0 2px 8px rgb(0 0 0 / .45); transition: box-shadow var(--t-base), transform var(--t-base); }
.seat-tag .name { font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-tag .score { min-width: 24px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; transition: transform var(--t-fast); }
.seat-tag .score[data-bump] { animation: pop .4s var(--ease-spring); }
.seat-tag .count { position: absolute; right: -8px; bottom: -4px; width: 18px; height: 24px; border-radius: 3px; background: var(--card-face); color: var(--card-black); border: 1px solid var(--card-edge); font-size: .66rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgb(0 0 0 / .4); }
.seat-tag .dots { display: none; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); gap: 3px; }
.seat-tag .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: think .9s infinite; }
.seat-tag .dots i:nth-child(2) { animation-delay: .15s; } .seat-tag .dots i:nth-child(3) { animation-delay: .3s; }
.seat-tag[data-thinking="true"] .dots { display: flex; }
.seat-tag[data-active="true"] .avatar { box-shadow: 0 0 0 2px var(--accent), 0 0 20px color-mix(in oklab, var(--accent) 55%, transparent), inset 0 -3px 0 rgb(0 0 0 / .25); transform: scale(1.06); }
.seat-tag[data-active="true"] .name { color: var(--ink); }
.seat-tag[data-crown="true"] .avatar::before { content: "♛"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); color: var(--accent); font-size: 1rem; text-shadow: 0 1px 2px rgb(0 0 0 / .6); }
.seat-tag[data-nil="true"] .avatar { box-shadow: 0 0 0 2px var(--nil), 0 0 14px color-mix(in oklab, var(--nil) 50%, transparent), inset 0 -3px 0 rgb(0 0 0 / .25); }
.seat-tag[data-nil="broken"] .avatar { box-shadow: 0 0 0 2px transparent; animation: shake-x .5s; }
.seat-tag[data-last="true"] .avatar { box-shadow: 0 0 0 3px var(--bad), 0 0 18px color-mix(in oklab, var(--bad) 55%, transparent); }
.seat-tag.me { flex-direction: row; gap: 8px; }
.seat-tag.me .avatar { width: 32px; height: 32px; font-size: .85rem; }
@keyframes think { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* speech bubble: text set by main.js; empty = hidden */
.bubble { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 5px 10px; border-radius: 12px; font-size: .78rem; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow-2); animation: bubble-in var(--t-base) var(--ease-spring); z-index: 4; }
.bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
.bubble:empty { display: none; }
.bubble[data-side="left"] { left: 0; transform: none; } .bubble[data-side="left"]::after { left: 16px; }
.bubble[data-side="right"] { left: auto; right: 0; transform: none; } .bubble[data-side="right"]::after { left: auto; right: 10px; }
.bubble[leaving] { opacity: 0; transition: opacity var(--t-base); }
/* seats near the top edge get the bubble under the avatar */
.bubble[data-below="true"] { bottom: auto; top: calc(100% + 8px); }
.bubble[data-below="true"]::after { top: auto; bottom: 100%; border-top: 0; border-bottom: 6px solid var(--ink); }
@keyframes bubble-in { from { opacity: 0; transform: translateX(-50%) scale(.8) translateY(6px); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

/* history strip (last trick / last plays) */
.strip { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 4px; height: 38px; padding: 4px 10px; border-radius: var(--r-pill); background: color-mix(in oklab, var(--bg) 70%, transparent); backdrop-filter: blur(6px); box-shadow: 0 0 0 1px rgb(255 255 255 / .08); }
.strip:empty { display: none; }
.strip .lbl { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; margin-right: 4px; }
.strip .pcard { --w: 20px; }
.strip .pcard[data-win="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

/* controls row under the stage */
.controls { position: relative; z-index: 3; flex: 0 0 auto; display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 56px; padding: 6px 10px max(10px, env(safe-area-inset-bottom)); }
.ctl { height: 44px; min-height: 44px; padding: 0 14px; font-weight: 800; letter-spacing: .04em; border-radius: var(--r-pill); gap: 6px; }
.ctl .icon { width: 18px; height: 18px; }
.ctl-main { min-width: 124px; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 8px 22px color-mix(in oklab, var(--accent) 45%, transparent), inset 0 -3px 0 rgb(0 0 0 / .22), inset 0 2px 0 rgb(255 255 255 / .35); animation: ctl-glow 1.6s ease-in-out infinite; }
.ctl-main:disabled { opacity: .4; animation: none; box-shadow: none; }
.ctl[data-off="true"] { visibility: hidden; pointer-events: none; animation: none; position: absolute; }
.ctl .kbd { font-size: .6rem; letter-spacing: .08em; color: var(--ink-2); font-weight: 700; margin-left: 2px; }
@keyframes ctl-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
:root[data-motion="reduced"] .ctl-main { animation: none; }

/* overlays on the stage (handover, paused) */
.overlay { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: color-mix(in oklab, var(--bg) 72%, transparent); backdrop-filter: blur(4px); animation: fade var(--t-base); text-align: center; padding: var(--gutter); }
.overlay h2 { font-family: var(--font-display); font-size: clamp(2rem, 9cqi, 3.2rem); letter-spacing: .02em; }
.overlay p { color: var(--ink-2); }
.overlay .stack { align-items: center; }
.sound-hint { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); font-size: .8rem; color: var(--ink-2); background: color-mix(in oklab, var(--surface) 80%, transparent); padding: 6px 12px; border-radius: var(--r-pill); pointer-events: none; z-index: 5; }

/* ---- DOM playing card (sheets, strips, pickers, how-to). Canvas draws the real table. ---- */
.pcard { --w: 44px; position: relative; display: inline-grid; flex: 0 0 auto; min-width: 0; min-height: 0; grid-template-rows: auto 1fr; width: var(--w); aspect-ratio: 5 / 7; padding: calc(var(--w) * .07) calc(var(--w) * .08); border-radius: calc(var(--w) * .1); background: var(--card-face); color: var(--suit-ink, var(--card-black)); font-family: var(--font-card); font-weight: 700; line-height: 1; box-shadow: 0 1px 2px rgb(0 0 0 / .45), inset 0 0 0 1px var(--card-edge); user-select: none; vertical-align: middle; }
.pcard[data-suit="S"] { --suit-ink: var(--suit-S); } .pcard[data-suit="H"] { --suit-ink: var(--suit-H); } .pcard[data-suit="D"] { --suit-ink: var(--suit-D); } .pcard[data-suit="C"] { --suit-ink: var(--suit-C); }
.pcard::before { content: attr(data-rank); font-size: calc(var(--w) * .34); letter-spacing: -.02em; justify-self: start; text-align: left; }
.pcard::after { place-self: center; font-size: calc(var(--w) * .5); font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif; }
.pcard[data-suit="S"]::after { content: "♠"; } .pcard[data-suit="H"]::after { content: "♥"; } .pcard[data-suit="D"]::after { content: "♦"; } .pcard[data-suit="C"]::after { content: "♣"; }
.pcard.back { background: var(--back-1, #2a2f6b); border: calc(var(--w) * .06) solid #fff; background-image: repeating-linear-gradient(45deg, transparent 0 4px, color-mix(in oklab, var(--back-2, #8fa3ff) 50%, transparent) 4px 5px), repeating-linear-gradient(-45deg, transparent 0 4px, color-mix(in oklab, var(--back-2, #8fa3ff) 50%, transparent) 4px 5px); }
.pcard.back::before, .pcard.back::after { content: none; }
.pcard.xs { --w: 22px; } .pcard.sm { --w: 34px; } .pcard.lg { --w: 64px; } .pcard.xl { --w: 88px; }
.pcard[data-selected="true"] { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--accent), 0 8px 18px rgb(0 0 0 / .45); }
.pcard[data-dim="true"] { filter: brightness(.65) saturate(.6); }
.pcard-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pcard-row.fan .pcard + .pcard { margin-left: calc(var(--w) * -.55); }

/* ---- suit picker (Crazy Eights wild) ---- */
.suit-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.suit-picker button { height: 76px; border-radius: var(--r-md); background: var(--surface-2); display: grid; place-items: center; font-size: 2.2rem; line-height: 1; transition: transform var(--t-fast), box-shadow var(--t-fast); font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif; }
.suit-picker button:active { transform: scale(.95); }
.suit-picker button[data-suit="S"] { color: var(--suit-S); } .suit-picker button[data-suit="H"] { color: var(--suit-H); } .suit-picker button[data-suit="D"] { color: var(--suit-D); } .suit-picker button[data-suit="C"] { color: var(--suit-C); }
.suit-picker button small { display: block; font-family: var(--font-ui); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-top: 4px; }
.suit-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--card-face); color: var(--suit-ink, var(--card-black)); font-size: 1.1rem; box-shadow: 0 0 0 2px var(--accent); animation: pulse 1.4s infinite; }
.suit-badge[data-suit="S"] { --suit-ink: var(--suit-S); } .suit-badge[data-suit="H"] { --suit-ink: var(--suit-H); } .suit-badge[data-suit="D"] { --suit-ink: var(--suit-D); } .suit-badge[data-suit="C"] { --suit-ink: var(--suit-C); }

/* ---- bid dial (Spades) ---- */
.bid-dial { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.bid-dial [role="radio"] { height: 46px; border-radius: var(--r-md); background: var(--surface-2); font-family: var(--font-display); font-size: 1.25rem; color: var(--ink-2); transition: transform var(--t-fast), background var(--t-fast); }
.bid-dial [role="radio"][aria-checked="true"] { background: var(--accent); color: var(--accent-ink); transform: scale(1.06); box-shadow: 0 0 16px color-mix(in oklab, var(--accent) 55%, transparent); }
.bid-dial [role="radio"][data-hint="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.bid-special { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-nil { color: var(--nil); box-shadow: inset 0 0 0 2px var(--nil); background: transparent; }
.btn-nil[aria-pressed="true"] { background: var(--nil); color: #fff; }
.bid-partner { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: .9rem; color: var(--ink-2); }
.bid-partner b { color: var(--ink); font-family: var(--font-display); font-size: 1.2rem; }

/* partnership panels (Spades) */
.panel-pair { position: absolute; top: 6px; left: 8px; right: 8px; max-width: 560px; margin-inline: auto; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; pointer-events: none; }
.panel { --pc: var(--accent); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px; background: color-mix(in oklab, var(--bg) 78%, transparent); box-shadow: 0 0 0 1px var(--pc), 0 0 14px color-mix(in oklab, var(--pc) 35%, transparent); backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.panel b { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .08em; color: var(--pc); }
.panel .tricks { font-size: .9rem; font-weight: 700; } .panel .tricks small { color: var(--ink-2); font-weight: 600; }
.panel .bags { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.panel .bags[data-warn="true"] { color: var(--warn); }
.panel[data-flash="true"] { animation: pop .5s var(--ease-spring); }

/* ---- chips, bets and the action rail (Blackjack) ---- */
.rail-actions { position: relative; z-index: 3; flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 10px max(12px, env(safe-area-inset-bottom)); background: var(--rail, var(--surface)); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgb(0 0 0 / .45), inset 0 2px 0 rgb(255 255 255 / .06); }
.rail-actions::before { content: ""; position: absolute; left: 14px; right: 14px; top: 6px; height: 0; border-top: 2px dashed rgb(255 255 255 / .10); }
.chip-tray { display: flex; gap: 8px; justify-content: center; align-items: center; }
.chip { --c: #e8e8e8; --ink-c: #222; position: relative; width: 46px; height: 46px; border-radius: 50%; color: var(--ink-c); font-family: var(--font-display); font-size: .9rem; font-weight: 700; display: grid; place-items: center; background: radial-gradient(circle, var(--c) 0 52%, transparent 53% 100%), repeating-conic-gradient(from 0deg, #fff 0 20deg, var(--c) 20deg 60deg); box-shadow: inset 0 0 0 2px rgb(0 0 0 / .25), 0 3px 0 color-mix(in oklab, var(--c) 60%, #000), 0 5px 10px rgb(0 0 0 / .45); transition: transform var(--t-fast); }
.chip::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px dashed rgb(255 255 255 / .55); }
.chip:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px rgb(0 0 0 / .25), 0 1px 0 color-mix(in oklab, var(--c) 60%, #000), 0 2px 6px rgb(0 0 0 / .45); }
.chip:disabled { opacity: .35; }
.chip[data-v="1"] { --c: #e6e6e6; --ink-c: #222; } .chip[data-v="5"] { --c: #c8322b; --ink-c: #fff; } .chip[data-v="25"] { --c: #1f7a3a; --ink-c: #fff; }
.chip[data-v="100"] { --c: #1b1b1f; --ink-c: #f2c14e; } .chip[data-v="500"] { --c: #6b2d8b; --ink-c: #fff; } .chip[data-v="1000"] { --c: #d4a545; --ink-c: #1b1208; }
.chip.sm { width: 34px; height: 34px; font-size: .7rem; } .chip.sm::after { inset: 6px; }
.bet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bet-circle { width: 66px; height: 66px; border-radius: 50%; border: 2px dashed color-mix(in oklab, var(--accent) 60%, transparent); display: grid; place-items: center; color: var(--accent); font-family: var(--font-display); font-size: 1rem; }
.bet-circle[data-active="true"] { border-style: solid; box-shadow: 0 0 16px color-mix(in oklab, var(--accent) 45%, transparent); }
.bank { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; font-variant-numeric: tabular-nums; }
.bank b { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); }
.bank small { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.actions .ctl { height: 54px; flex-direction: column; gap: 0; padding: 0 6px; font-size: .95rem; border-radius: var(--r-md); }
.actions .ctl small { font-size: .58rem; letter-spacing: .12em; color: var(--ink-2); font-weight: 700; }
.actions .ctl[data-hint="true"] { box-shadow: inset 0 0 0 2px var(--accent), 0 0 14px color-mix(in oklab, var(--accent) 40%, transparent); }
.actions .ctl:disabled { opacity: .35; }
.coach-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .78rem; font-weight: 900; background: var(--surface-2); color: var(--ink-2); animation: pop .4s var(--ease-spring); }
.coach-badge[data-ok="true"] { background: var(--ok); color: #06210f; } .coach-badge[data-ok="false"] { background: var(--bad); color: #fff; }
.coach-line { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); }
.coach-line b { color: var(--ink); }

/* ---- home hero (same structure as the board pack) ---- */
.table-home { justify-content: center; gap: var(--s-5); }
.title-wrap { text-align: center; }
.title { font-family: var(--font-display); font-size: clamp(2.4rem, 13cqi, 5rem); line-height: .95; letter-spacing: .02em; color: var(--accent); text-shadow: 0 2px 0 rgb(0 0 0 / .4), 0 0 26px color-mix(in oklab, var(--accent) 45%, transparent); }
.tagline { color: var(--ink-2); margin-top: 8px; }
.logo { display: flex; justify-content: center; margin-bottom: 10px; }
.logo .pcard-row.fan { --w: 54px; }
.logo .pcard { transform: rotate(calc(var(--i) * 9deg - 18deg)) translateY(calc(abs(var(--i) - 2) * 3px)); transform-origin: 50% 120%; }
.modes { display: grid; gap: 8px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface); border: 2px solid transparent; text-align: left; min-height: 56px; transition: border-color var(--t-fast), transform var(--t-fast); }
.mode b { font-size: 1.05rem; } .mode span { font-size: .82rem; color: var(--ink-2); }
.mode[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px color-mix(in oklab, var(--accent) 35%, transparent); }
.mode:active { transform: scale(.98); }
.seg-line { display: flex; gap: 6px; }
.seg-line [role="radio"] { flex: 1; height: 44px; border-radius: var(--r-pill); background: var(--surface-2); font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.seg-line [aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker-label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; padding-left: 4px; }
.home-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.cta { font-size: 1.15rem; height: 56px; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 0 24px color-mix(in oklab, var(--accent) 45%, transparent); }
.topbar { display: flex; align-items: center; gap: 6px; }
.best-line { display: flex; justify-content: center; gap: 18px; color: var(--ink-2); font-size: .9rem; }
.best-line b { color: var(--ink); }
.hud-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; white-space: nowrap; border-radius: var(--r-pill); background: color-mix(in oklab, var(--surface) 75%, transparent); backdrop-filter: blur(6px); font-weight: 700; font-size: .95rem; letter-spacing: .04em; }
.hud-pill small { font-weight: 600; color: var(--ink-2); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.hud-pill .sep { color: var(--ink-2); padding: 0 2px; }
/* seat setup rows on home */
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 8px; border-radius: var(--r-md); background: var(--surface); }
.seat-row .swatch { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--pc); display: grid; place-items: center; font-size: .75rem; font-weight: 800; color: #fff; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .25), 0 0 10px color-mix(in oklab, var(--pc) 40%, transparent); }
.seat-row .seat-name { flex: 1 1 110px; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .seat-name small { color: var(--ink-2); font-weight: 600; }
.seat-row .row { flex: 0 0 auto; gap: 6px; margin-left: auto; }
.seat-row .seg [role="radio"] { height: 32px; padding: 0 10px; font-size: .82rem; }
.seat-row[data-off="true"] { opacity: .45; }
.seat-row[data-partner="true"] { box-shadow: inset 3px 0 0 var(--accent); }
/* result and ledger */
.result-verdict { text-align: center; color: var(--ink-2); font-weight: 700; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: var(--s-2); }
.result-actions .btn-primary { grid-column: 1 / -1; }
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .95rem; }
.ledger th { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; padding: 6px 8px; text-align: right; }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td { padding: 8px; text-align: right; border-top: 1px solid var(--line); }
.ledger tr[data-me="true"] td { color: var(--accent); font-weight: 700; }
.ledger tfoot td { font-family: var(--font-display); font-size: 1.15rem; border-top: 2px solid var(--accent); }
.ledger td[data-moon="true"]::after { content: " ☾"; color: var(--accent); }
.set-group { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; margin: 6px 0 -6px; }
body:has(.play:not([hidden])) .toast-host { top: 108px; }
/* the home screen is its own container, so a container query cannot size it: cap its children instead */
@media (min-width: 640px) { .table-home > * { width: 100%; max-width: 560px; margin-inline: auto; } .table-home .modes { grid-template-columns: 1fr 1fr; } }

/* ---- desktop: wider table, controls stay under it, side panels optional ---- */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 150dvh) minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "hud hud hud" "left stage right" "left controls right"; }
  .play .hud { grid-area: hud; }
  .play .stage { grid-area: stage; padding: 10px 12px; }
  .play .controls, .play .rail-actions { grid-area: controls; }
  .play .rail-actions { border-radius: 22px; margin: 0 12px 12px; }
  .side { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
  .side-left { grid-area: left; align-items: flex-end; } .side-right { grid-area: right; align-items: flex-start; }
  .seat-tag .avatar { width: 48px; height: 48px; font-size: 1.15rem; }
  .seat-tag .name { font-size: .8rem; max-width: 120px; }
  .strip { height: 46px; } .strip .pcard { --w: 26px; }
  .ctl-main { height: 50px; font-size: 1.2rem; min-width: 150px; }
  .chip { width: 54px; height: 54px; font-size: 1rem; }
}
@media (max-width: 899px) { .side { display: none; } }
/* phones: bet circle + five chips fill the row; the bankroll moves to the HUD (.hud-bank) */
.hud-bank { display: none; }
@media (max-width: 480px) {
  .bet-row .bank { display: none; } .hud-bank { display: inline-flex; }
  .bet-row { gap: 6px; } .chip-tray { gap: 6px; flex: 1; justify-content: space-between; }
  .chip { width: 44px; height: 44px; font-size: .82rem; } .chip::after { inset: 8px; }
  .bet-circle { width: 54px; height: 54px; flex: 0 0 auto; }
}
/* card-back picker in settings: thumbnails of each allowed back */
.back-pick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.back-pick [role="radio"] { width: 32px; height: 45px; border-radius: 4px; background: var(--img) center / cover no-repeat; box-shadow: 0 0 0 1px var(--line), 0 2px 4px rgb(0 0 0 / .3); transition: transform var(--t-fast), box-shadow var(--t-fast); }
.back-pick [role="radio"][aria-checked="true"] { box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgb(0 0 0 / .4); transform: translateY(-2px); }

/* ---- phone landscape (short screens): slim HUD on top, table fills the height, controls in a column on the right ---- */
@media (orientation: landscape) and (max-height: 540px) {
  .play { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "hud hud" "stage controls"; }
  .play .hud { grid-area: hud; padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 2px max(10px, env(safe-area-inset-left)); min-height: 0; }
  .play .hud .btn-icon { width: 38px; height: 38px; min-height: 38px; }
  .play .hud-pill { height: 30px; }
  .play .stage { grid-area: stage; padding: 2px 4px max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .play .controls { grid-area: controls; flex-direction: column; justify-content: center; align-items: stretch; width: 128px; min-height: 0; padding: 4px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 4px; }
  .play .controls .ctl { width: 100%; justify-content: center; }
  .play .controls .ctl-main { min-width: 0; font-size: 1rem; }
  .play .controls .ctl[data-off="true"] { position: static; display: none; }
  .play .rail-actions { grid-area: controls; width: 232px; border-radius: 22px 0 0 22px; padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 10px; justify-content: center; overflow-y: auto; }
  .play .rail-actions .bet-row { flex-wrap: wrap; justify-content: center; }
  .play .rail-actions .chip-tray { flex-wrap: wrap; justify-content: center; }
  .play .rail-actions .chip { width: 40px; height: 40px; font-size: .78rem; }
  .play .rail-actions .actions { grid-template-columns: 1fr 1fr; }
  .play .rail-actions .actions .ctl { height: 42px; }
  .play .rail-actions { gap: 6px; }
  .play .rail-actions .bet-circle { width: 46px; height: 46px; font-size: .9rem; }
  .play .rail-actions .bank b { font-size: 1.25rem; }
  .play .rail-actions .ctl { height: 40px; min-height: 40px; }
  .play .rail-actions .row { gap: 6px; }
  .play .rail-actions .bank { display: flex; } .play .hud-bank { display: none; }
  .play .side { display: none; }
  .strip { top: 4px; }
}
/* sheets on short landscape screens: compact spacing so the whole sheet (e.g. the Spades bid dial and its confirm button) fits */
@media (orientation: landscape) and (max-height: 540px) {
  .sheet-panel { max-height: 96dvh; padding-top: 4px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .sheet-head { margin-bottom: 6px; } .sheet-body { gap: 8px; }
  .bid-dial [role="radio"] { height: 38px; } .bid-confirm { height: 46px; }
  .suit-picker button { height: 60px; }
}
