/* =====================================================================
   7-8 Strategic Card Game: premium tabletop visual system
   Walnut rim, deep emerald felt, warm gold, ivory cards.

   Composition: HUD / opponent seat / central trick stage / player seat.
   Motion animates transform and opacity only; layout never animates.
   ===================================================================== */

:root {
    --walnut-0: #0b0704;
    --walnut-1: #170e08;
    --walnut-2: #28180e;
    --walnut-3: #3c2615;
    --felt-1: #11533e;
    --felt-2: #0b3a2b;
    --felt-3: #062319;
    --gold: #d0aa5e;
    --gold-bright: #f1d99a;
    --gold-dim: #8d7439;
    --ivory: #fbf6ea;
    --ivory-2: #efe4cf;
    --ink: #1b1a20;
    --ruby: #b3261e;
    --ruby-soft: #e0685f;
    --text: #f1e8d6;
    /* Small caps labels sit directly on the felt, so they need real contrast:
       the old #9d8f78 measured about 2.8:1 on the table green. */
    --text-dim: #d8cbae;
    --text-mute: #c2b393;
    --line: rgba(208, 170, 94, .24);
    --line-strong: rgba(208, 170, 94, .48);
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    /* Stacked (narrow) seat layout: five cards across the felt. */
    --cw-base: clamp(44px, min(calc((100vw - 52px) / 5.5), 12.5vh), 92px);
    --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--sans);
    color: var(--text);
    background:
        radial-gradient(120% 90% at 50% -10%, #332013 0%, var(--walnut-2) 38%, var(--walnut-0) 100%);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; border-radius: 6px; }

/* ---------------------------------------------------------------- layout */
.game-container {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px clamp(8px, 2vw, 22px) clamp(8px, 1.4vh, 14px);
    max-width: 1560px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------- HUD */
.hud {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(10px, 2vw, 26px);
    padding: 4px 2px;
}

.hud-brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: inherit; text-decoration: none; }
.hud-brand:hover .brand-mark { box-shadow: inset 0 0 0 1px var(--gold-bright), 0 0 14px rgba(241,217,154,.22), 0 2px 10px rgba(0,0,0,.55); }
.brand-mark {
    display: flex; align-items: center; justify-content: center; white-space: nowrap; flex: none;
    width: 42px; height: 42px; border-radius: 50%;
    font: 700 15px/1 var(--serif);
    color: var(--gold-bright);
    background:
        radial-gradient(circle at 34% 26%, #4a351a, #1b1007 72%);
    box-shadow:
        inset 0 0 0 1px var(--gold-dim),
        inset 0 1px 0 rgba(255, 235, 190, .18),
        0 2px 10px rgba(0,0,0,.55);
}
.brand-mark i { font-style: normal; opacity: .55; padding: 0 1px; }
.brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-name {
    font: 600 14px/1 var(--serif);
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--gold-bright); white-space: nowrap;
}
.brand-name i { font-style: normal; color: var(--gold); }
.brand-sub {
    font-size: 8px; line-height: 1; letter-spacing: .28em; text-transform: uppercase;
    color: var(--text-mute); white-space: nowrap;
}

.score-board {
    display: flex; align-items: center;
    gap: clamp(6px, 1.4vw, 16px);
    padding: 4px clamp(8px, 1.6vw, 16px);
    border-radius: 999px;
    background: linear-gradient(180deg, #23160d, #150d07 68%);
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 190, .09),
        inset 0 0 0 1px var(--line),
        0 5px 16px rgba(0,0,0,.45);
}
.score-side { display: flex; align-items: baseline; gap: 7px; min-width: clamp(56px, 7vw, 92px); justify-content: center; }
.score-name { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-mute); white-space: nowrap; }
.score-num {
    font: 700 clamp(21px, 2vw, 27px)/1 var(--serif);
    color: var(--gold-bright); min-width: .7em; text-align: center;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.round-info {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 48px; padding: 1px 14px;
    border-inline: 1px solid rgba(208,170,94,.2);
}
.round-info small { font-size: 9px; line-height: 1; letter-spacing: .1em; text-transform: uppercase; color: var(--text-mute); }
.round-info b { font: 600 12px/1 var(--sans); letter-spacing: .1em; color: var(--text); font-variant-numeric: tabular-nums; }
.round-info em { font: 600 8.5px/1 var(--sans); letter-spacing: .06em; color: var(--text-mute); font-style: normal; white-space: nowrap; }

.hud-right { display: flex; justify-content: flex-end; align-items: center; gap: 7px; min-width: 0; }
.hud-divider { width: 1px; height: 20px; background: rgba(208,170,94,.2); margin: 0 2px; }

.trump-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 5px 4px 12px; border-radius: 999px;
    background: rgba(0,0,0,.28);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: box-shadow .25s;
}
.trump-label { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute); }
.trump-suit {
    display: grid; place-items: center; width: 27px; height: 27px;
    border-radius: 50%; font-size: 17px; line-height: 1;
    background: var(--ivory); color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(90,60,25,.35), 0 1px 4px rgba(0,0,0,.45);
}
.trump-suit:not(.hearts):not(.diamonds):not(.clubs):not(.spades) {
    background: transparent; box-shadow: none; color: var(--text-mute); font-size: 15px;
}
.trump-suit.hearts, .trump-suit.diamonds { color: var(--ruby); }
.trump-indicator.trump-hearts, .trump-indicator.trump-diamonds,
.trump-indicator.trump-clubs, .trump-indicator.trump-spades { box-shadow: inset 0 0 0 1px var(--gold); }

.difficulty-indicator {
    font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--gold); padding: 6px 10px; border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.24);
    white-space: nowrap;
}

.hud-btn {
    height: 32px; padding: 0 13px; border-radius: 999px; border: 0;
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
    background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px var(--line);
    transition: background .2s, box-shadow .2s, color .2s;
    white-space: nowrap;
}
.hud-btn:hover { background: rgba(208,170,94,.14); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-bright); }
.hud-icon { width: 32px; padding: 0; font-size: 15px; letter-spacing: 0; }

/* ---------------------------------------------------------------- table */
.game-board {
    position: relative;
    isolation: isolate;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: clamp(10px, 1.7vh, 18px) clamp(12px, 2.1vw, 30px);
    border-radius: clamp(22px, 2.8vw, 40px);
    background:
        radial-gradient(62% 56% at 50% 47%, rgba(35, 126, 94, .48) 0%, rgba(15, 74, 55, 0) 72%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 .1  0 0 0 0 0  0 0 0 .45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>"),
        linear-gradient(180deg, var(--felt-2), var(--felt-1) 45%, var(--felt-3));
    box-shadow:
        inset 0 0 0 1px rgba(255, 240, 205, .045),
        inset 0 0 110px 14px rgba(0,0,0,.55),
        0 0 0 clamp(5px, 0.9vw, 9px) var(--walnut-3),
        0 0 0 clamp(6px, 1vw, 10px) #6d4a27,
        0 0 0 clamp(7px, 1.1vw, 11px) #1a1008,
        0 22px 46px rgba(0,0,0,.65);
    margin: clamp(7px, 1.1vw, 13px);
}

/* stitched inner rail */
.game-board::before {
    content: "";
    position: absolute; inset: clamp(7px, 1vw, 11px);
    border-radius: calc(clamp(22px, 2.8vw, 40px) - 8px);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.13);
    pointer-events: none; z-index: 1;
}

/* trump suit watermark (or the 7·8 monogram while waiting to start) */
.game-board::after {
    content: "";
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    display: grid; place-items: center;
    font: 700 min(32vh, 34vw)/1 var(--serif);
    color: var(--gold);
    opacity: .05;
    border-radius: inherit;
}
.game-board[data-trump="hearts"]::after { content: "\2665\FE0E"; }
.game-board[data-trump="diamonds"]::after { content: "\2666\FE0E"; }
.game-board[data-trump="clubs"]::after { content: "\2663\FE0E"; }
.game-board[data-trump="spades"]::after { content: "\2660\FE0E"; }
.game-board.is-setup::after { content: "7 · 8"; font-size: min(28vh, 30vw); opacity: .04; }

/* Explicit rows keep the centre in the middle row even while the seats are hidden. */
.game-board > .computer-area { grid-row: 1; }
.game-board > .center-area { grid-row: 2; }
.game-board > .player-area { grid-row: 3; }

/* setup: the hero owns the felt */
.game-board.is-setup .seat { display: none; }
.game-board.is-setup .center-info { display: none; }
.game-board.is-setup .trick-stage { opacity: 0; visibility: hidden; }
.game-board.is-setup .deck { opacity: 0; visibility: hidden; }
.game-board.is-setup .center-area::before { opacity: 0; }
.game-board:not(.is-setup) .start-panel { display: none; }

/* ---------------------------------------------------------------- seats */
.seat { position: relative; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.computer-area { --cw-seat: calc(var(--cw-base) * .58); }
.player-area { --cw-seat: var(--cw-base); }
.face-up-cards { --cw-seat: calc(var(--cw-base) * .88); }
.computer-area .face-up-cards { --cw-seat: calc(var(--cw-base) * .74); }

.seat-bar {
    display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 20px);
    min-height: 28px; padding: 2px 12px; border-radius: 999px;
    transition: background .3s, box-shadow .3s;
}
.seat.is-turn .seat-bar {
    background: rgba(0,0,0,.22);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.24), 0 0 22px rgba(208,170,94,.1);
}
.seat-who { display: flex; align-items: center; gap: 8px; }
.seat-avatar {
    display: grid; place-items: center; flex: none;
    width: 25px; height: 25px; border-radius: 50%;
    font: 700 11px/1 var(--serif); color: var(--gold);
    background: radial-gradient(circle at 36% 30%, #362613, #170e07 74%);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.4);
    transition: color .25s, box-shadow .25s;
}
.seat.is-turn .seat-avatar { color: var(--gold-bright); box-shadow: inset 0 0 0 1px var(--gold-bright), 0 0 10px rgba(241,217,154,.3); }
/* Anne's face is a small chair, not a passport photo: the live avatar below
   draws her at a size where an eye or a brow is actually readable. */
.anne-portrait-wrap { position: relative; display: inline-flex; flex: none; align-items: center; }
.anne-avatar {
    position: relative;
    width: clamp(56px, 5.9vw, 82px); height: clamp(56px, 5.9vw, 82px);
    padding: 0; overflow: visible; border-radius: 50%;
    background: radial-gradient(circle at 38% 25%, #245f49, #0b2a21 76%);
    box-shadow: inset 0 0 0 2px rgba(208,170,94,.55), 0 6px 16px rgba(0,0,0,.45);
    transition: box-shadow .3s, transform .3s var(--ease);
}
.has-live-avatar { animation: anne-breathe 5.2s ease-in-out infinite; }
@keyframes anne-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-1px) scale(1.012); }
}
/* The old "online" dot sat on top of her chin at the new size. The face is the
   status now: her ring and expression say everything the dot used to. */
.anne-avatar::after { display: none; }
.seat.is-turn .anne-avatar { box-shadow: inset 0 0 0 2px var(--gold-bright), 0 0 20px rgba(241,217,154,.32); }
.anne-ident { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.anne-name-row { display: flex; align-items: center; gap: 8px; }
.anne-role-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.anne-role { font-size: 10px; line-height: 1.1; letter-spacing: .06em; color: var(--text-dim); white-space: nowrap; }
.anne-mood {
    padding: 2px 8px; border-radius: 999px; white-space: nowrap;
    font-size: 9.5px; line-height: 1.35; letter-spacing: .04em;
    color: var(--gold-bright); background: rgba(208,170,94,.1);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.22);
}
.anne-difficulty {
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
    font-size: 9px; line-height: 1; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold); box-shadow: inset 0 0 0 1px rgba(208,170,94,.28);
}
.rival-bar { position: relative; z-index: 14; gap: 14px; padding: 5px 14px 5px 8px; }
.rival-bar .seat-who { gap: 11px; }
.anne-reaction {
    /* Pinned to Anne's cheek, not to the bottom of her seat. The old bubble
       hung under her cards, a long way from the face that was supposed to be
       saying it; a host reads as present when the words come out of her mouth.
       It floats over her own name/tricks strip and is gone before the cards. */
    position: absolute; z-index: 60;
    left: calc(100% + 13px); top: 50%; right: auto;
    width: max-content; max-width: min(340px, calc(100vw - 140px));
    padding: 10px 14px 11px; border-radius: 6px 16px 16px 16px;
    font: 600 clamp(12.5px, 1.02vw, 14.5px)/1.42 var(--sans);
    letter-spacing: .002em; text-align: left; color: #241a10;
    background: linear-gradient(180deg, #fffdf6, #f6e8cd);
    box-shadow: 0 14px 30px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.7), 0 1px 0 rgba(0,0,0,.22);
    opacity: 0; pointer-events: none;
    transform: translate(-7px, -50%) scale(.9); transform-origin: 0 50%;
    transition: opacity .16s, transform .22s var(--ease);
}
.anne-reaction.is-visible { opacity: 1; transform: translate(0, -50%) scale(1); }
/* The line arrives a character at a time. The text is all in the DOM, only its
   opacity is staggered, so nothing reflows and a screen reader reads it whole. */
.anne-reaction .aa-char { opacity: 0; transition: opacity .18s linear; }
.anne-reaction .aa-char.is-in { opacity: 1; }
.anne-reaction::before {
    content: ""; position: absolute; left: -5px; top: 50%; width: 12px; height: 12px;
    margin-top: -6px; background: #fffdf6; border-radius: 2px; transform: rotate(45deg);
    box-shadow: -1px 1px 0 rgba(0,0,0,.06);
}
.computer-area.is-speaking .anne-avatar { animation: anne-pop .5s var(--ease); }
/* Her line covers the nameplate, so yield the name and trick meter while she
   talks. Otherwise a fragment ("...tricks") peeks out from behind the bubble. */
.anne-ident, .won-tricks { transition: opacity .22s var(--ease); }
.computer-area.is-speaking .anne-ident,
.computer-area.is-speaking .won-tricks,
.computer-area.is-speaking .thinking-indicator { opacity: 0; }
@keyframes anne-pop {
    0% { transform: translateY(0) scale(1) rotate(0); }
    35% { transform: translateY(-3px) scale(1.06) rotate(-2deg); }
    70% { transform: translateY(0) scale(1.02) rotate(1deg); }
    100% { transform: translateY(0) scale(1) rotate(0); }
}
.computer-area[data-mood="tease"] .anne-avatar { box-shadow: inset 0 0 0 2px #f1d99a, 0 0 22px rgba(241,217,154,.38); }
.computer-area[data-mood="happy"] .anne-avatar { box-shadow: inset 0 0 0 2px #a8e6bf, 0 0 20px rgba(127,224,168,.3); }
.computer-area[data-mood="impressed"] .anne-avatar { box-shadow: inset 0 0 0 2px #f6c98a, 0 0 24px rgba(246,201,138,.4); }
.computer-area[data-mood="thinking"] .anne-avatar { box-shadow: inset 0 0 0 2px rgba(208,170,94,.5), 0 0 18px rgba(208,170,94,.18); }
.computer-area[data-mood="sorry"] .anne-avatar { box-shadow: inset 0 0 0 2px #d9b9a3, 0 0 18px rgba(217,185,163,.24); }

.seat.is-turn .anne-ident { color: var(--gold-bright); }
.player-label {
    font: 600 10px/1 var(--serif); letter-spacing: .22em; text-transform: uppercase;
    color: var(--text-dim); transition: color .25s;
}
.seat.is-turn .player-label { color: var(--gold-bright); }

.won-tricks { display: flex; align-items: center; gap: 9px; }
.tricks-label { font-size: 10.5px; letter-spacing: .05em; color: var(--text-mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tricks-label .trick-count { font: 700 14px/1 var(--serif); color: var(--gold-bright); }
.tricks-label .trick-target { color: var(--text-dim); }
.tricks-word { letter-spacing: .05em; }
.meter { display: flex; gap: 3px; }
.meter i {
    width: 4px; height: 10px; border-radius: 2px;
    background: rgba(0,0,0,.34);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.18);
    transition: background .2s;
}
.meter i.won { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); box-shadow: 0 0 7px rgba(208,170,94,.35); }
.meter i.target { box-shadow: inset 0 0 0 1px var(--gold-bright); }
.meter i.target.won { box-shadow: 0 0 8px rgba(241,217,154,.8); }

.seat-cards { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2.4vw, 34px); min-width: 0; }
.computer-area .seat-cards { align-items: flex-end; }
.player-area .seat-cards { flex-direction: column; align-items: center; gap: clamp(3px, .8vh, 8px); }

.card-area { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.cards-label { flex: none; min-height: 1em; }
.cards-label {
    display: flex; align-items: baseline; gap: 5px;
    font-size: 10px; line-height: 1; letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-mute); white-space: nowrap;
}
.cards-label b { font: 700 10px/1 var(--sans); letter-spacing: .06em; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
/* One soft shadow keeps tiny felt labels crisp without outlining them. */
.cards-label, .tricks-label, .trick-caption, .score-name, .player-label,
.round-info small, .round-info em, .anne-role, .brand-sub {
    text-shadow: 0 1px 1px rgba(0, 0, 0, .38);
}
.cards-container { display: flex; justify-content: center; gap: clamp(3px, .55vw, 7px); min-height: calc(var(--cw-seat) * 1.4); }
.player-hand .cards-container { gap: clamp(3px, .62vw, 8px); }
.computer-hand .cards-container { gap: 0; min-height: calc(var(--cw-seat) * 1.4); }
.computer-hand .card + .card { margin-left: calc(var(--cw-seat) * -.34); }

.seat-divider {
    display: none; flex: none; width: 1px; height: calc(var(--cw-base) * 1.05);
    background: linear-gradient(180deg, transparent, rgba(208,170,94,.28), transparent);
}

.slot { position: relative; --cw: var(--cw-seat); width: var(--cw); height: calc(var(--cw) * 1.4); flex: none; }
.slot.has-under::before {
    content: ""; position: absolute; inset: 0; z-index: 0;
    transform: translate(calc(var(--cw) * .045), calc(var(--cw) * .07));
}

/* ---------------------------------------------------------------- centre */
.center-area {
    position: relative; z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center; align-items: center;
    min-height: 0;
    padding: clamp(2px, .6vh, 8px) 0 0;
    --cw-seat: calc(var(--cw-base) * 1.12);
    transition: none;
}

/* A quiet oval inlay frames the trick without competing with the cards. */
.center-area::before {
    content: "";
    position: absolute; left: 50%; top: 47%;
    width: min(80%, 980px); height: min(86%, 400px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(208, 170, 94, .13);
    background: radial-gradient(closest-side, rgba(0,0,0,.2), rgba(0,0,0,0) 74%);
    box-shadow: inset 0 0 34px rgba(0,0,0,.16), 0 0 0 5px rgba(208,170,94,.022);
    pointer-events: none; z-index: 0;
    transition: opacity .4s;
}
.deck {
    position: absolute; right: clamp(10px, 4vw, 64px); top: 44%;
    transform: translateY(-50%) rotate(7deg);
    width: clamp(40px, var(--cw-base) * .78, var(--cw-base)); height: calc(clamp(40px, var(--cw-base) * .78, var(--cw-base)) * 1.4);
    --cw: clamp(40px, var(--cw-base) * .78, var(--cw-base));
    transition: opacity .4s, visibility .4s;
    z-index: 0; opacity: .92;
}
.deck i { position: absolute; inset: 0; }
.deck i:nth-child(1) { transform: translate(0, 0); }
.deck i:nth-child(2) { transform: translate(3px, -3px); }
.deck i:nth-child(3) { transform: translate(6px, -6px); }
.deck i:nth-child(4) { transform: translate(2px, -1px); }
.deck i:nth-child(5) { transform: translate(5px, -4px); }
.deck i:nth-child(6) { transform: translate(1px, -2px); }
.deck i:nth-child(7) { transform: translate(4px, -5px); }
.deck i:nth-child(8) { transform: translate(2px, 1px); }
.game-board[data-phase="playing"] .deck,
.game-board[data-phase="round-over"] .deck { opacity: 0; visibility: hidden; }
.game-board.is-shuffling .deck {
    /* The shuffle happens in the middle of the table, at a size you cannot
       miss. Animating the little corner deck was invisible in practice. */
    left: 50%; right: auto; top: 53%;
    transform: translate(-50%, -50%) rotate(-2deg) scale(var(--deck-lift, 1.55));
    opacity: 1; visibility: visible; z-index: 12;
    filter: drop-shadow(0 26px 30px rgba(0,0,0,.55));
    transition: none;
}
.game-board.is-shuffling .start-panel { opacity: 0; visibility: hidden; }
.game-board.is-shuffling .deck i { will-change: transform; }
/* The animated riffle pack. Thirty card backs built for the shuffle beat: two
   packets of fifteen that cascade into one pile, then square up with a tap. */
.deck .shuffle-rig {
    position: absolute; inset: 0;
    transform-origin: 50% 88%;
    will-change: transform;
}
.deck .shuffle-card {
    position: absolute; inset: 0;
    will-change: transform;
    backface-visibility: hidden;
}
.game-board.is-shuffling .deck::before {
    content: "Shuffling";
    position: absolute; left: 50%; bottom: -46px; transform: translateX(-50%);
    font: 600 5.6px/1 var(--sans); letter-spacing: .3em; text-transform: uppercase;
    color: var(--text-dim, #cbb98f); white-space: nowrap; pointer-events: none;
}
.game-board.is-shuffling .deck::after {
    content: ""; position: absolute; inset: -6px; border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,240,200,.16);
    pointer-events: none;
}

/* start hero */
.start-panel {
    grid-row: 1; grid-column: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(8px, 1.2vh, 14px);
    width: 100%; max-width: 620px; padding: 12px 18px;
    text-align: center;
    animation: hero-in .6s var(--ease);
}

/* cover illustration: the namesake 7 and 8 resting on the felt */
.hero-fan {
    --hw: clamp(82px, 18vh, 140px);
    position: relative;
    width: calc(var(--hw) * 1.92);
    height: calc(var(--hw) * 1.5);
    margin-bottom: clamp(2px, .8vh, 8px);
    filter: drop-shadow(0 22px 26px rgba(0,0,0,.42));
    animation: fan-breathe 7s ease-in-out infinite;
}
@keyframes fan-breathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.hero-fan::after {
    content: ""; position: absolute; left: 50%; bottom: -7%;
    width: 86%; height: 12%; transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent 76%);
    z-index: 0;
}
.hero-card {
    --cw: var(--hw);
    position: absolute; top: 4%; left: 50%; z-index: 1;
    width: var(--cw); height: calc(var(--cw) * 1.4);
    margin-left: calc(var(--cw) * -.5);
    font-size: calc(var(--cw) * .2);
    transform-origin: 50% 94%;
    border-radius: calc(var(--cw) * .072);
}
.hero-card.left { transform: translateX(calc(var(--cw) * -.34)) rotate(-9deg); }
.hero-card.right { transform: translateX(calc(var(--cw) * .34)) rotate(7deg); z-index: 3; }
.hero-card .card-front {
    box-shadow:
        inset 0 0 0 1px rgba(90,60,25,.3),
        inset 0 0 0 calc(var(--cw) * .032) var(--ivory),
        inset 0 0 0 calc(var(--cw) * .038) rgba(140,110,60,.24),
        0 2px 3px rgba(0,0,0,.45),
        0 calc(var(--cw) * .09) calc(var(--cw) * .16) rgba(0,0,0,.46);
}
@keyframes hero-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.start-eyebrow {
    display: flex; align-items: center; gap: 12px;
    font-size: 9px; line-height: 1; letter-spacing: .32em; text-transform: uppercase;
    color: var(--gold-dim);
}
.start-eyebrow::before, .start-eyebrow::after {
    content: ""; width: clamp(18px, 5vw, 42px); height: 1px;
    background: linear-gradient(90deg, transparent, rgba(208,170,94,.55));
}
.start-eyebrow::after { transform: rotate(180deg); }
.start-title {
    font: 600 clamp(38px, 5.4vw, 62px)/1 var(--serif);
    letter-spacing: .01em; color: var(--ivory);
    text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.5);
}
.start-title span { color: var(--gold); font-size: .72em; vertical-align: .06em; padding: 0 .12em; }
.start-tagline { max-width: 41ch; font-size: clamp(13px, 1.5vh + 3px, 16px); line-height: 1.55; color: var(--text-dim); }
.start-chips { display: flex; align-items: center; gap: 6px; list-style: none; margin-top: 2px; }
.start-chips li {
    padding: 5px 11px; border-radius: 999px;
    font-size: 9px; letter-spacing: .17em; text-transform: uppercase; color: var(--text-dim);
    background: rgba(0,0,0,.18); box-shadow: inset 0 0 0 1px rgba(208,170,94,.16);
}
.start-actions { display: flex; align-items: center; gap: 16px; margin-top: clamp(4px, 1vh, 10px); }
.start-note { max-width: 42ch; margin-top: -2px; font-size: 10px; line-height: 1.5; color: var(--text-mute); }

/* First-run invitation: an offer, not a gate. Start game stays available. */
.tutorial-invite {
    display: flex; align-items: center; gap: 10px;
    max-width: 480px; margin-top: 2px; padding: 9px 12px 9px 10px;
    border-radius: 13px; text-align: left;
    background: rgba(0,0,0,.2);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.25);
}
.tutorial-invite-mark {
    display: grid; place-items: center; flex: none;
    width: 26px; height: 26px; border-radius: 50%;
    font: 700 14px/1 var(--serif); color: var(--gold-bright);
    background: radial-gradient(circle at 36% 30%, #3a2914, #160d06 74%);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.42);
}
.tutorial-invite p { flex: 1; min-width: 0; font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.tutorial-invite p strong { color: var(--text); font-weight: 600; }
.tutorial-invite-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.mini-btn {
    border: 0; padding: 7px 10px; border-radius: 999px;
    font: 600 9px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-dim); background: rgba(0,0,0,.24);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.24);
    transition: background .2s, color .2s, box-shadow .2s;
    white-space: nowrap;
}
.mini-btn:hover { color: var(--gold-bright); background: rgba(208,170,94,.14); box-shadow: inset 0 0 0 1px var(--gold); }
.mini-btn.primary { color: #1f1407; background: linear-gradient(180deg, #f4dfa4, var(--gold) 58%, #b38d3f); box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 2px 0 #6f551f; }
.mini-btn.primary:hover { color: #1f1407; filter: brightness(1.05); }
#start-game { padding: 14px 32px; font-size: 12px; letter-spacing: .16em; }
.text-btn {
    border: 0; background: none; padding: 6px 2px;
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold);
    text-underline-offset: 4px; text-decoration: underline; text-decoration-color: rgba(208,170,94,.4);
    transition: color .2s, text-decoration-color .2s;
}
.text-btn:hover { color: var(--gold-bright); text-decoration-color: currentColor; }

/* trick stage */
.trick-stage {
    grid-row: 1; grid-column: 1;
    align-self: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(6px, 1vh, 12px);
    min-height: 0; width: 100%;
    transition: opacity .35s, visibility .35s;
}
.trick-meta { display: flex; align-items: center; gap: 9px; min-height: 18px; }
.trick-caption { font-size: 10.5px; line-height: 1; letter-spacing: .16em; text-transform: uppercase; color: var(--text-mute); }
.lead-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.25);
    background: rgba(0,0,0,.15);
}
.lead-chip b { font-size: 12px; line-height: 1; color: var(--ivory); }

.current-trick { display: grid; place-items: center; min-height: 0; }
.trick-cards {
    position: relative; display: flex; align-items: center; justify-content: center;
    gap: calc(var(--cw-seat) * -.12);
    min-width: calc(var(--cw-seat) * 2.62);
    min-height: calc(var(--cw-seat) * 1.4 + 34px);
    padding: clamp(8px, 1.6vh, 18px) clamp(20px, 3.6vw, 46px);
    border-radius: 999px;
    background:
        radial-gradient(closest-side, rgba(0,0,0,.26), rgba(0,0,0,.05) 68%, transparent);
    box-shadow:
        inset 0 0 0 1px rgba(208,170,94,.17),
        inset 0 0 44px rgba(0,0,0,.3);
}
.trick-slot { position: relative; width: var(--cw-seat); height: calc(var(--cw-seat) * 1.4); flex: none; }
/* Empty placeholders show exactly where the two cards will land. */
.trick-slot::before {
    content: ""; position: absolute; inset: 0; z-index: 0;
    border-radius: calc(var(--cw-seat) * .072);
    border: 1px dashed rgba(230,198,132,.46);
    background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(255,244,215,.05));
    box-shadow: inset 0 0 18px rgba(0,0,0,.24), 0 0 0 1px rgba(0,0,0,.18);
    transition: opacity .25s;
}
.trick-slot:has(.card)::before { opacity: 0; }
/* An empty trick is a place, not a broken box: name the two seats so the felt
   reads as a table even before the first card lands. */
.trick-slot::after {
    content: ""; position: absolute; inset: 0; z-index: 0;
    display: grid; place-items: center; pointer-events: none;
    font: 500 10.5px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
    color: rgba(240, 226, 200, .55);
    transition: opacity .25s;
}
.trick-slot.slot-computer::after { content: "Anne"; }
.trick-slot.slot-player::after { content: "You"; }
.trick-slot:has(.card)::after { opacity: 0; }
.trick-slot.slot-computer { transform: translateY(-5px); }
.trick-slot.slot-player { transform: translateY(5px); }

.center-info {
    grid-row: 2;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    position: relative; width: 100%; min-height: 0;
    padding-bottom: clamp(0px, .6vh, 5px);
}
.game-status { display: flex; align-items: center; gap: 8px; min-height: 20px; text-align: center; }
.game-status::before {
    content: ""; flex: none; width: 5px; height: 5px; border-radius: 50%;
    background: var(--gold); opacity: .65;
}
.game-status span {
    font: italic 500 clamp(13px, 1.5vh + 4px, 16px)/1.25 var(--serif);
    color: var(--gold-bright); text-shadow: 0 1px 2px rgba(0,0,0,.65);
}
.game-status.is-muted { display: none; }

/* First-round coach: a quiet note in the status slot, with a dismiss action. */
.live-coach {
    display: flex; align-items: flex-start; gap: 8px;
    width: min(92vw, 560px); padding: 8px 9px;
    border-radius: 12px; text-align: left;
    background: linear-gradient(180deg, rgba(57, 39, 19, .96), rgba(26, 16, 8, .96));
    box-shadow:
        inset 0 1px 0 rgba(255, 236, 193, .09),
        inset 0 0 0 1px rgba(208, 170, 94, .42),
        0 8px 20px rgba(0, 0, 0, .4);
    animation: coach-in .24s var(--ease);
}
.live-coach-mark {
    flex: none; margin-top: 1px; padding: 3px 6px; border-radius: 999px;
    font: 600 7px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
    color: var(--gold-bright); background: rgba(208, 170, 94, .12);
    box-shadow: inset 0 0 0 1px rgba(208, 170, 94, .3);
}
.live-coach-copy { flex: 1; min-width: 0; font-size: 11.5px; line-height: 1.4; color: var(--text-dim); }
.live-coach-copy strong { color: var(--gold-bright); font-weight: 600; }
.live-coach-close {
    flex: none; border: 0; background: none; padding: 2px 3px;
    font: 600 8px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-mute);
}
.live-coach-close:hover { color: var(--gold-bright); }
.center-info.is-coached .game-status { display: none; }
@keyframes coach-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
/* Between rounds the felt becomes the result screen; the empty trick tray has
   done its job, so the summary and the next-round action take the centre. */
.game-board.is-round-end .trick-stage { opacity: 0; visibility: hidden; }
.game-board.is-round-end .center-info { grid-row: 1 / -1; justify-content: center; gap: 12px; }
.game-status.is-your-turn::before { opacity: 1; background: var(--gold-bright); animation: turn-pulse 1.9s ease-out infinite; }
.game-status.is-your-turn span { color: #fff4da; }
@keyframes turn-pulse {
    0% { box-shadow: 0 0 0 0 rgba(241,217,154,.42); }
    70% { box-shadow: 0 0 0 8px rgba(241,217,154,0); }
    100% { box-shadow: 0 0 0 0 rgba(241,217,154,0); }
}

/* End-of-round result card: the scored tricks, targets and points, centred on
   the cleared felt with the next-round action directly beneath it. */
.round-summary {
    display: flex; flex-direction: column; align-items: stretch;
    width: min(88vw, 360px); padding: 13px 18px 9px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(45,28,15,.96), rgba(20,12,7,.96));
    box-shadow:
        inset 0 1px 0 rgba(255,236,193,.09),
        inset 0 0 0 1px rgba(208,170,94,.34),
        0 18px 42px rgba(0,0,0,.5);
    animation: rise .32s var(--ease);
}
.round-summary-title {
    padding-bottom: 9px; border-bottom: 1px solid rgba(208,170,94,.18);
    font-size: 9px; line-height: 1; letter-spacing: .22em; text-align: center;
    text-transform: uppercase; color: var(--gold-dim);
}
.round-pill {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 34px;
    align-items: baseline; gap: 10px; padding: 7px 2px 5px;
}
.round-pill + .round-pill { border-top: 1px solid rgba(208,170,94,.1); }
.round-pill b {
    font: 600 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-dim);
}
.round-tricks {
    font: 700 16px/1 var(--serif); color: var(--ivory);
    font-variant-numeric: tabular-nums; text-align: right;
}
.round-tricks i { font-style: normal; font-size: 10px; letter-spacing: .04em; color: var(--text-mute); }
.round-pill em { font-style: normal; font: 700 12px/1 var(--sans); color: var(--text-mute); text-align: right; }
.round-pill.scored b, .round-pill.scored em, .round-pill.scored .round-tricks { color: var(--gold-bright); }
.game-board.is-round-end #new-round { padding: 12px 30px; font-size: 12px; letter-spacing: .16em; }
.game-controls { display: flex; gap: 10px; min-height: 0; }
.toast {
    position: absolute; left: 50%; bottom: calc(100% + 8px);
    transform: translate(-50%, 6px); opacity: 0; pointer-events: none;
    max-width: min(84vw, 420px); padding: 8px 16px; border-radius: 12px;
    font-size: 12px; line-height: 1.35; text-align: center;
    background: #2b100c; color: #ffdad4;
    box-shadow: inset 0 0 0 1px var(--ruby-soft), 0 8px 22px rgba(0,0,0,.55);
    transition: opacity .2s, transform .2s; z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.thinking-indicator { display: flex; gap: 3px; align-items: center; margin-left: 2px; }
.thinking-indicator span { width: 4px; height: 4px; border-radius: 50%; background: var(--gold-bright); animation: think 1s infinite ease-in-out; }
.thinking-indicator span:nth-child(2) { animation-delay: .15s; }
.thinking-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------------------------------------------------------------- buttons */
.control-btn, .coin-btn, .settings-action-btn, .difficulty-btn, .clear-log-btn {
    padding: 10px 22px; border-radius: 999px; border: 0; text-decoration: none; text-align: center;
    font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text);
    background: rgba(0,0,0,.28);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.38);
    transition: background .2s, box-shadow .2s, transform .12s, color .2s;
}
.control-btn:hover, .coin-btn:hover:not(:disabled), .settings-action-btn:hover,
.difficulty-btn:hover, .clear-log-btn:hover {
    background: rgba(208,170,94,.15); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-bright);
}
.control-btn:active, .coin-btn:active:not(:disabled) { transform: translateY(1px); }
.control-btn.primary, .difficulty-btn.active {
    color: #1f1407;
    background: linear-gradient(180deg, #f4dfa4, var(--gold) 58%, #b38d3f);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.65),
        inset 0 -1px 0 rgba(90,60,10,.35),
        0 2px 0 #6f551f,
        0 7px 18px rgba(0,0,0,.42);
    text-shadow: 0 1px 0 rgba(255,245,205,.45);
}
.control-btn.primary:hover { filter: brightness(1.05); color: #1f1407; background: linear-gradient(180deg, #f7e6b3, var(--gold) 58%, #b38d3f); box-shadow: inset 0 0 0 1px var(--gold-bright), 0 2px 0 #6f551f, 0 8px 20px rgba(0,0,0,.45); }
.control-btn.primary:active { transform: translateY(1px); }
.coin-btn { min-height: 40px; padding-inline: 28px; }
.coin-btn:disabled { opacity: .45; cursor: default; }
.select-trump-btn { box-shadow: inset 0 0 0 1px var(--gold); }

/* ---------------------------------------------------------------- CARDS */
.card {
    --cw: var(--cw-seat, var(--cw-base));
    position: relative; flex: none;
    width: var(--cw); height: calc(var(--cw) * 1.4);
    perspective: 900px;
    font-size: calc(var(--cw) * .2);
    z-index: 1;
    outline-offset: 4px;
}
.slot > .card, .trick-slot > .card { position: absolute; inset: 0; }
.card.flying { z-index: 40; pointer-events: none; }
.card.flying .card-lift { transition: none; }
.card-lift, .card-flip { position: absolute; inset: 0; transform-style: preserve-3d; }
.card-lift { transition: transform .18s var(--ease); }
.card-flip { transition: none; }
.card[data-face="back"] .card-flip { transform: rotateY(180deg); }

.card-face {
    position: absolute; inset: 0; overflow: hidden;
    border-radius: calc(var(--cw) * .072);
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* Some WebKit builds paint the rear face even when backface-visibility is set.
   Keep the intended face above its mirror image so the card is still readable. */
.card[data-face="front"] .card-front,
.card[data-face="back"] .card-back { z-index: 1; }
.card-front {
    background:
        radial-gradient(120% 90% at 20% 0%, rgba(255,255,255,.8), transparent 55%),
        linear-gradient(165deg, var(--ivory), var(--ivory-2));
    box-shadow:
        inset 0 0 0 1px rgba(90,60,25,.3),
        inset 0 0 0 calc(var(--cw) * .032) var(--ivory),
        inset 0 0 0 calc(var(--cw) * .038) rgba(140,110,60,.24),
        0 1px 2px rgba(0,0,0,.5),
        0 calc(var(--cw) * .06) calc(var(--cw) * .12) rgba(0,0,0,.36);
    color: var(--ink);
    font-family: var(--serif);
}
.card-front.red { color: var(--ruby); }
.card-front::after { content: ""; position: absolute; inset: 0; background: rgba(8,12,10,0); transition: background .2s; border-radius: inherit; pointer-events: none; }

.idx { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .95; width: 22%; }
.idx b { font-size: 1.24em; font-weight: 700; letter-spacing: -.04em; }
.idx i { font-style: normal; font-size: 1em; margin-top: .05em; font-family: var(--sans); }
.idx.tl { top: 5%; left: 5%; }
.idx.br { bottom: 5%; right: 5%; transform: rotate(180deg); }
.center { position: absolute; inset: 9% 17%; }
.pip { position: absolute; transform: translate(-50%, -50%); font-size: 1.12em; line-height: 1; font-family: var(--sans); }
.pip.flip { transform: translate(-50%, -50%) rotate(180deg); }
.ace { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.2em; line-height: 1; font-family: var(--sans); }
.court {
    position: absolute; inset: 4% 2%; display: grid; place-items: center; align-content: center; gap: 1.5%;
    border-radius: calc(var(--cw) * .05);
    background:
        radial-gradient(80% 60% at 50% 18%, rgba(255,255,255,.5), transparent 70%),
        linear-gradient(160deg, rgba(208,170,94,.26), rgba(208,170,94,.07));
    box-shadow:
        inset 0 0 0 1px rgba(138,113,55,.55),
        inset 0 0 0 calc(var(--cw) * .035) rgba(251,246,234,.65),
        inset 0 0 0 calc(var(--cw) * .042) rgba(138,113,55,.28);
}
.court-letter { font-size: 2.6em; font-weight: 700; line-height: 1; }
.court-suit { font-size: 1.3em; line-height: 1; font-family: var(--sans); opacity: .85; }

/* engraved card back, also used for the deck and the card peeking from under a face-up card */
.card-back, .slot.has-under::before, .deck i, .deck .shuffle-card {
    border-radius: calc(var(--cw) * .072);
    background:
        radial-gradient(closest-side at 50% 50%, rgba(7,40,31,.96) 0 30%, transparent 32%),
        repeating-linear-gradient(45deg, rgba(208,170,94,.28) 0 1px, transparent 1px calc(var(--cw) * .085)),
        repeating-linear-gradient(-45deg, rgba(208,170,94,.28) 0 1px, transparent 1px calc(var(--cw) * .085)),
        linear-gradient(160deg, #10533f, #07281f);
    box-shadow:
        inset 0 0 0 calc(var(--cw) * .04) var(--ivory),
        inset 0 0 0 calc(var(--cw) * .055) #0b3a2c,
        inset 0 0 0 calc(var(--cw) * .07) var(--gold),
        0 1px 2px rgba(0,0,0,.55),
        0 calc(var(--cw) * .05) calc(var(--cw) * .1) rgba(0,0,0,.4);
}
.card-back { transform: rotateY(180deg); }
.card-back::before, .deck .shuffle-card::before {
    content: ""; position: absolute; inset: 17%;
    border: 1px solid rgba(208,170,94,.42);
    border-radius: calc(var(--cw) * .03);
    transform: rotate(45deg) scale(.72);
}
.card-back::after, .deck .shuffle-card::after {
    content: "7\00B7 8"; position: absolute; inset: 0; display: grid; place-items: center;
    font: 700 calc(var(--cw) * .18)/1 var(--serif); color: var(--gold-bright); letter-spacing: .02em;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* states (cards on the player's side) */
.card.mine { cursor: default; }
.card.playable { cursor: pointer; }
.card.playable .card-front {
    box-shadow:
        inset 0 0 0 1px rgba(90,60,25,.3),
        inset 0 0 0 calc(var(--cw) * .032) var(--ivory),
        inset 0 0 0 calc(var(--cw) * .038) rgba(140,110,60,.24),
        inset 0 -3px 0 var(--gold),
        0 1px 2px rgba(0,0,0,.5),
        0 calc(var(--cw) * .06) calc(var(--cw) * .12) rgba(0,0,0,.36);
}
.card.invalid .card-front::after { background: rgba(7,14,11,.5); }
.card.invalid { cursor: not-allowed; }
@media (hover: hover) {
    .card.playable:hover .card-lift { transform: translateY(calc(var(--cw) * -.2)); }
    .card.playable:hover .card-front {
        box-shadow:
            inset 0 0 0 1px rgba(90,60,25,.3),
            inset 0 0 0 calc(var(--cw) * .032) var(--ivory),
            inset 0 -3px 0 var(--gold-bright),
            0 calc(var(--cw) * .18) calc(var(--cw) * .24) rgba(0,0,0,.5);
    }
}
.card.selected .card-lift { transform: translateY(calc(var(--cw) * -.32)) scale(1.04); }
.card.selected .card-front { box-shadow: 0 0 0 2px var(--gold-bright), 0 calc(var(--cw) * .28) calc(var(--cw) * .3) rgba(0,0,0,.55); }
.card.mine:focus-visible { outline: 3px solid var(--gold-bright); }
.card.in-trick .card-lift { transform: rotate(var(--rot, 0deg)); transition: none; }
.card.winning .card-front { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 24px rgba(241,217,154,.7), 0 6px 14px rgba(0,0,0,.5); }
/* The coach names a card in the note; the same card gets a quiet gold edge. */
.card.coach-pick .card-front {
    box-shadow:
        inset 0 0 0 1px rgba(90,60,25,.3),
        inset 0 0 0 calc(var(--cw) * .032) var(--ivory),
        0 0 0 2px var(--gold-bright),
        0 0 22px rgba(241,217,154,.42),
        0 calc(var(--cw) * .06) calc(var(--cw) * .12) rgba(0,0,0,.4);
}
.card.coach-pick .card-lift { transform: translateY(calc(var(--cw) * -.1)); }
.highlight-winner .seat-avatar { color: var(--gold-bright); box-shadow: inset 0 0 0 1px var(--gold-bright), 0 0 14px rgba(241,217,154,.35); }
.highlight-winner .player-label { color: var(--gold-bright); }

/* ---------------------------------------------------------------- modals */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: none; align-items: center; justify-content: center; padding: 16px;
    background: rgba(4, 3, 2, .72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.modal-content {
    position: relative; width: min(94vw, 430px); max-height: 92dvh; overflow: auto;
    padding: 22px 24px 24px; border-radius: 20px;
    background:
        radial-gradient(120% 70% at 50% 0%, rgba(76, 47, 24, .55), transparent 62%),
        linear-gradient(180deg, #2c1b0e, #170e07);
    box-shadow:
        inset 0 1px 0 rgba(255, 236, 193, .1),
        inset 0 0 0 1px rgba(208,170,94,.42),
        0 0 0 4px rgba(0,0,0,.32),
        0 28px 70px rgba(0,0,0,.7);
    animation: rise .28s var(--ease);
    scrollbar-color: var(--gold-dim) transparent;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(208,170,94,.16);
}
.modal-kicker {
    font-size: 8px; line-height: 1; letter-spacing: .26em; text-transform: uppercase;
    color: var(--gold-dim); margin-bottom: 5px;
}
.modal-header h3 {
    font: 600 20px/1.1 var(--serif); letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-bright);
}
.close-modal {
    flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0;
    font: 400 20px/1 var(--sans); padding-bottom: 2px;
    color: var(--text-dim); background: rgba(0,0,0,.3);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.3);
    transition: background .2s, color .2s;
}
.close-modal:hover { background: rgba(208,170,94,.18); color: var(--gold-bright); }
.large-modal { width: min(94vw, 660px); }

/* trump sheet: the hand stays visible behind it */
.trump-modal {
    background: rgba(3, 14, 10, .45); pointer-events: none; align-items: center;
    /* The hand behind the sheet is the information the choice depends on. */
    backdrop-filter: none; -webkit-backdrop-filter: none;
}
.trump-modal .modal-content { pointer-events: auto; text-align: center; width: min(94vw, 470px); }
.trump-hint { font-size: 13px; line-height: 1.55; color: var(--text-dim); margin: 0 auto 16px; max-width: 40ch; }
.trump-hint strong { color: var(--gold-bright); font-weight: 600; }
.trump-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.trump-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 13px 4px 10px; border: 0; border-radius: 13px;
    background: linear-gradient(165deg, var(--ivory), var(--ivory-2));
    color: var(--ink);
    box-shadow:
        inset 0 0 0 1px rgba(90,60,25,.32),
        inset 0 1px 0 rgba(255,255,255,.7),
        0 3px 0 #a89572,
        0 9px 16px rgba(0,0,0,.36);
    transition: transform .15s var(--ease), box-shadow .15s;
}
.trump-btn.hearts, .trump-btn.diamonds { color: var(--ruby); }
.trump-btn:hover, .trump-btn:focus-visible {
    transform: translateY(-4px);
    box-shadow: inset 0 0 0 2px var(--gold), 0 7px 0 #a89572, 0 15px 22px rgba(0,0,0,.4);
}
.trump-btn:active { transform: translateY(0); }
.trump-btn .suit-symbol { font-size: 30px; line-height: 1; font-family: var(--sans); }
.suit-name { font: 600 10px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.suit-count { font-size: 9px; color: #6d604a; }
.trump-footnote { margin-top: 14px; font-size: 10px; letter-spacing: .04em; color: var(--text-mute); }

/* Live coach inside the real trump sheet */
.trump-coach {
    margin: 0 0 12px; padding: 8px 10px; border-radius: 11px; text-align: left;
    background: rgba(0, 0, 0, .22);
    box-shadow: inset 0 0 0 1px rgba(208, 170, 94, .3);
    animation: coach-in .2s var(--ease);
}
.trump-coach-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.trump-coach-head > span {
    font: 600 7px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
    color: var(--gold);
}
.trump-coach-off {
    border: 0; background: none; padding: 2px;
    font: 600 8px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-mute);
}
.trump-coach-off:hover { color: var(--gold-bright); }
.trump-coach p { font-size: 11.5px; line-height: 1.45; color: var(--text-dim); }
.trump-coach strong { color: var(--gold-bright); font-weight: 600; }
.trump-btn { position: relative; }
.trump-btn.is-coach-pick { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.suit-coach {
    margin-top: 1px; font: 700 7px/1 var(--sans); letter-spacing: .1em;
    text-transform: uppercase; color: #7a5f21;
}

/* ---------------------------------------------------------------- tutorial */
.tutorial-modal { z-index: 110; }
.tutorial-content { width: min(94vw, 560px); padding: 16px 22px 22px; }
.tutorial-topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tutorial-progress { display: flex; align-items: center; gap: 5px; }
.tutorial-progress i {
    width: 18px; height: 3px; border-radius: 999px;
    background: rgba(208,170,94,.2);
    transition: background .25s, width .25s;
}
.tutorial-progress i.is-done { background: var(--gold-dim); }
.tutorial-progress i.is-active { width: 28px; background: var(--gold-bright); }
.tutorial-step-label {
    font-size: 8px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--text-mute);
}
.tutorial-topbar .close-modal { margin-left: auto; width: 30px; height: 30px; font-size: 18px; }
.tutorial-guide {
    display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; padding: 8px 10px;
    border-radius: 12px; background: rgba(0,0,0,.2);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.16);
}
.tutorial-guide-avatar {
    flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; padding: 1px;
    background: linear-gradient(160deg, rgba(241,217,154,.7), #0d4533);
}
.tutorial-guide b { display: block; margin-bottom: 2px; font: 600 10px/1 var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.tutorial-guide b span { margin-left: 5px; font: 500 8px/1 var(--sans); letter-spacing: .1em; color: var(--text-mute); }
.tutorial-guide p { font-size: 11.5px; line-height: 1.4; color: var(--text-dim); }
.tutorial-body { --tcw: clamp(46px, 11vw, 74px); text-align: left; }
.tut-kicker {
    font-size: 8px; line-height: 1; letter-spacing: .26em; text-transform: uppercase;
    color: var(--gold-dim); margin: 10px 0 5px;
}
.tut-title {
    font: 600 clamp(21px, 4.4vw, 27px)/1.1 var(--serif);
    letter-spacing: .02em; color: var(--ivory); margin-bottom: 7px;
}
.tut-copy { font-size: 13px; line-height: 1.55; color: var(--text-dim); max-width: 52ch; }
.tut-copy strong { color: var(--gold-bright); font-weight: 600; }

.tut-hand { display: flex; justify-content: center; gap: clamp(4px, 1.4vw, 8px); margin: 16px 0 14px; }
.tut-card {
    --cw: var(--tcw);
    position: relative; flex: none;
    width: var(--tcw); height: calc(var(--tcw) * 1.4);
    border-radius: calc(var(--tcw) * .075);
    font-size: calc(var(--tcw) * .2);
    font-family: var(--serif);
    filter: drop-shadow(0 calc(var(--tcw) * .09) calc(var(--tcw) * .12) rgba(0,0,0,.34));
}
.tut-fallback {
    position: absolute; inset: 0; display: grid; place-items: center;
    font: 700 calc(var(--tcw) * .34)/1 var(--serif); color: var(--ink);
}
.tut-card-btn { padding: 0; border: 0; background: none; cursor: pointer; transition: transform .15s var(--ease), filter .15s; }
.tut-card-btn:hover, .tut-card-btn:focus-visible { transform: translateY(-6px); filter: drop-shadow(0 calc(var(--tcw) * .18) calc(var(--tcw) * .18) rgba(0,0,0,.4)); }
.tut-card-btn:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
.tut-card-btn:disabled { opacity: .42; cursor: default; transform: none; }
.tut-card.is-played { animation: tut-drop .32s var(--ease); }
@keyframes tut-drop { from { opacity: 0; transform: translateY(-18px) scale(.94); } to { opacity: 1; transform: none; } }

.tut-suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tut-suit {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 4px 8px; border: 0; border-radius: 12px;
    background: linear-gradient(165deg, var(--ivory), var(--ivory-2));
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(90,60,25,.3), 0 3px 0 #a89572, 0 8px 14px rgba(0,0,0,.3);
    transition: transform .15s var(--ease), box-shadow .15s;
}
.tut-suit:hover, .tut-suit:focus-visible { transform: translateY(-3px); box-shadow: inset 0 0 0 2px var(--gold), 0 5px 0 #a89572, 0 12px 18px rgba(0,0,0,.35); }
.tut-suit.is-best { box-shadow: inset 0 0 0 2px var(--gold-bright), 0 3px 0 #a89572, 0 10px 20px rgba(241,217,154,.18); }
.tut-suit-symbol { font-size: clamp(22px, 5vw, 28px); line-height: 1; font-family: var(--sans); }
.tut-suit-symbol.red { color: var(--ruby); }
.tut-suit-name { font: 600 9px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.tut-suit-count { font-size: 8px; line-height: 1; color: #6d604a; }

.tut-feedback {
    margin-top: 12px; padding: 9px 11px; border-radius: 10px;
    font-size: 12px; line-height: 1.5; color: var(--text-dim);
    background: rgba(0,0,0,.2); box-shadow: inset 0 0 0 1px rgba(208,170,94,.14);
    animation: tut-note .2s var(--ease);
}
.tut-feedback strong { color: var(--gold-bright); font-weight: 600; }
.tut-feedback.is-right { color: #dcebdc; background: rgba(30,82,60,.34); box-shadow: inset 0 0 0 1px rgba(120,190,150,.4); }
.tut-feedback.is-right strong { color: #d8f2df; }
.tut-feedback.is-wrong { color: #ffe1db; background: rgba(80,24,18,.4); box-shadow: inset 0 0 0 1px rgba(224,104,95,.5); }
.tut-feedback.is-wrong strong { color: #ffd2ca; }
@keyframes tut-note { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tut-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.tut-actions .control-btn { padding: 11px 20px; font-size: 10px; }
.tut-skip { color: var(--text-mute); }
.tut-footnote { margin-top: 10px; font-size: 10px; line-height: 1.45; color: var(--text-mute); }

.tut-targets { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 16px 0 14px; }
.tut-target {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 12px 8px 10px; border-radius: 14px; text-align: center;
    background: rgba(0,0,0,.2); box-shadow: inset 0 0 0 1px rgba(208,170,94,.16);
}
.tut-target span { font-size: 8px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute); }
.tut-target b { font: 700 clamp(30px, 7vw, 38px)/1 var(--serif); color: var(--ivory); font-variant-numeric: tabular-nums; }
.tut-target em { font-style: normal; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-mute); }
.tut-target.is-you { background: linear-gradient(180deg, rgba(63,45,22,.65), rgba(30,19,10,.6)); box-shadow: inset 0 0 0 1px rgba(208,170,94,.42); }
.tut-target.is-you b { color: var(--gold-bright); }
.tut-vs { font: italic 12px/1 var(--serif); color: var(--text-mute); }
.tut-quiz { display: flex; justify-content: center; gap: 8px; }
.tut-quiz-btn {
    min-width: 110px; padding: 10px 14px; border: 0; border-radius: 10px;
    font: 600 10px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
    color: var(--text); background: rgba(0,0,0,.24);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.28);
    transition: background .2s, box-shadow .2s, color .2s;
}
.tut-quiz-btn:hover { background: rgba(208,170,94,.14); color: var(--gold-bright); }
.tut-quiz-btn.is-right { color: #1f1407; background: linear-gradient(180deg, #f4dfa4, var(--gold) 58%, #b38d3f); box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 2px 0 #6f551f; }
.tut-quiz-btn.is-wrong { color: #ffd2ca; box-shadow: inset 0 0 0 1px var(--ruby-soft); background: rgba(80,24,18,.35); }
.tut-quiz-btn.is-dim { opacity: .55; }

.tut-trick {
    display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 22px);
    margin: 14px 0 10px; padding: 14px 10px; border-radius: 16px;
    background: radial-gradient(closest-side, rgba(0,0,0,.26), rgba(0,0,0,.06));
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.17);
}
.tut-trick-slot {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    min-width: calc(var(--tcw, 62px) * 1.15);
}
.tut-slot-who { font-size: 7.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute); }
.tut-empty {
    display: grid; place-items: center;
    width: var(--tcw, 62px); height: calc(var(--tcw, 62px) * 1.4);
    border-radius: calc(var(--tcw, 62px) * .075);
    border: 1px dashed rgba(208,170,94,.3);
    font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute);
    background: rgba(0,0,0,.12);
}
.tut-trick-slot.has-card .tut-empty { display: none; }
.tut-trick-arrow { font-size: 15px; color: var(--gold-dim); }
.tut-hand-play { margin-top: 6px; }

.tut-recap { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 15px 0 4px; }
.tut-recap li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 11px; background: rgba(0,0,0,.18); }
.tut-recap li > span {
    display: grid; place-items: center; flex: none; width: 21px; height: 21px; border-radius: 50%;
    font: 700 10px/1 var(--serif); color: var(--gold-bright);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.45);
}
.tut-recap p { font-size: 12px; line-height: 1.5; color: var(--text-dim); }
.tut-recap strong { color: var(--text); font-weight: 600; }

/* coin */
.coin-toss-modal { text-align: center; width: min(94vw, 430px); overflow: hidden; }
.coin-toss-info { color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.coin-container { position: relative; perspective: 1100px; perspective-origin: 50% 36%; height: 218px; display: grid; place-items: center; margin: 6px 0 2px; }
.coin-halo {
    position: absolute; width: 230px; height: 230px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(208,170,94,.22), transparent 68%);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.1);
    pointer-events: none;
}
.coin-shadow {
    position: absolute; left: 50%; bottom: 24px; width: 122px; height: 24px;
    transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0,0,0,.62), rgba(0,0,0,.18) 60%, transparent 78%);
    filter: blur(2px); pointer-events: none;
}
.coin-rig { position: relative; width: 118px; height: 118px; transform-style: preserve-3d; z-index: 2; }
.coin { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.coin-edge {
    position: absolute; inset: -3px; border-radius: 50%; transform: translateZ(-2px);
    background:
        repeating-conic-gradient(from 0deg, rgba(255,245,205,.5) 0 2deg, transparent 2deg 6deg),
        conic-gradient(from 0deg, #8d6a2d, #e8cc83 16%, #8a651f 32%, #f0d798 48%, #7f5c1f 66%, #e3c47a 84%, #8d6a2d);
    box-shadow: 0 4px 0 #6f4f18, 0 7px 0 #4b3512, 0 12px 18px rgba(0,0,0,.48);
}
.coin-face {
    position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    color: #4d3610; text-shadow: 0 1px 0 rgba(255,247,214,.75), 0 -1px 0 rgba(83,58,16,.35);
    background:
        radial-gradient(circle at 34% 26%, rgba(255,251,222,.96), rgba(255,250,220,0) 34%),
        radial-gradient(circle at 62% 78%, rgba(112,78,23,.34), transparent 58%),
        conic-gradient(from 22deg, #b88f3d, #f6dfa1 12%, #b98f3c 28%, #e8c97d 48%, #9d7528 68%, #f3db99 88%, #b88f3d);
    box-shadow:
        inset 0 0 0 3px #8f6b22,
        inset 0 0 0 6px #f4dea2,
        inset 0 0 0 8px #a57d2e,
        inset 0 0 24px rgba(92,62,13,.35),
        0 9px 18px rgba(0,0,0,.45);
    transform: translateZ(5px);
}
.coin-face.tails { transform: rotateX(180deg) translateZ(5px); }
.coin-face::before {
    content: ""; position: absolute; inset: 10%; border-radius: 50%;
    border: 1px solid rgba(100,69,18,.5);
    box-shadow: inset 0 0 0 3px rgba(255,242,198,.28), inset 0 0 0 7px rgba(108,76,21,.16);
}
.coin-face::after {
    content: ""; position: absolute; left: 14%; top: 8%; width: 40%; height: 30%;
    border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,240,.6), transparent);
    transform: rotate(-28deg); pointer-events: none;
}
.coin-rim { position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(96,66,17,.35); }
.coin-ornament {
    position: absolute; inset: 20%; border-radius: 50%;
    background:
        radial-gradient(circle at 50% 0, rgba(109,76,21,.6) 0 1.5px, transparent 2px),
        radial-gradient(circle at 50% 100%, rgba(109,76,21,.6) 0 1.5px, transparent 2px),
        radial-gradient(circle at 0 50%, rgba(109,76,21,.6) 0 1.5px, transparent 2px),
        radial-gradient(circle at 100% 50%, rgba(109,76,21,.6) 0 1.5px, transparent 2px);
    opacity: .8;
}
.coin-letter { position: relative; z-index: 1; font: 700 46px/.9 var(--serif); letter-spacing: -.04em; }
.coin-word { position: relative; z-index: 1; font: 600 7.5px/1 var(--sans); letter-spacing: .28em; text-transform: uppercase; opacity: .72; }
.coin.result-heads { transform: rotateX(0deg); }
.coin.result-tails { transform: rotateX(180deg); }
.coin-choice p { font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px; }
.coin-buttons { display: flex; justify-content: center; gap: 10px; }
.coin-result { margin-top: 2px; min-height: 42px; font-size: 13px; line-height: 1.5; color: var(--text); }
.coin-line { font: 700 22px/1.1 var(--serif); letter-spacing: .16em; color: var(--gold-bright); margin-bottom: 4px; }
.coin-result.lose .coin-line { color: var(--text); }
.coin-icon { display: none; }

/* game over */
.gameover-modal { text-align: center; width: min(94vw, 520px); overflow-x: hidden; overflow-y: auto; }
.gameover-modal .modal-header { justify-content: center; text-align: center; }
.gameover-modal .modal-header > div { width: 100%; }
.result-felt {
    position: absolute; left: 50%; top: 40px; width: 390px; height: 390px; z-index: 0;
    transform: translateX(-50%); border-radius: 50%; pointer-events: none;
    background:
        radial-gradient(closest-side, rgba(20,94,70,.5), rgba(10,48,37,.2) 62%, transparent 74%),
        repeating-radial-gradient(closest-side, rgba(208,170,94,.1) 0 1px, transparent 1px 30px);
    opacity: .9;
}
.gameover-modal > *:not(.result-felt) { position: relative; z-index: 1; }
.winner-text {
    font: 700 clamp(28px, 5vw, 40px)/1.1 var(--serif);
    letter-spacing: .03em; color: var(--gold-bright);
    margin: 4px 0 4px; text-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.winner-text.lose { color: var(--text); }
.match-context { margin-bottom: 12px; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute); }
.final-line { display: flex; align-items: baseline; justify-content: center; gap: 11px; margin-bottom: 16px; }
.final-line span { font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-mute); }
.final-line b { font: 700 38px/1 var(--serif); color: var(--gold-bright); }
.final-line i { color: var(--text-mute); font-style: normal; }
.anne-result {
    display: flex; align-items: center; gap: 12px; text-align: left;
    margin: 0 auto 18px; padding: 10px 14px; max-width: 370px;
    border-radius: 14px; background: rgba(0,0,0,.24);
    box-shadow: inset 0 0 0 1px rgba(208,170,94,.18);
}
.anne-result-avatar {
    flex: none; width: 58px; height: 58px; padding: 2px; border-radius: 50%;
    background: linear-gradient(160deg, rgba(241,217,154,.65), rgba(13,69,51,.9));
}
.anne-result b { display: block; margin-bottom: 3px; font: 600 10px/1 var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.anne-result p { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); }
.game-over-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.result-home { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* rules / settings / log */
.rules-content { font-size: 13.5px; line-height: 1.6; color: var(--text); }
.rules-content h4 {
    display: flex; align-items: center; gap: 10px;
    font: 600 11px/1.2 var(--serif); letter-spacing: .2em; text-transform: uppercase;
    color: var(--gold); margin: 20px 0 7px;
}
.rules-content h4::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(208,170,94,.25), transparent); }
.rules-content h4:first-child { margin-top: 2px; }
.rules-content p { margin-bottom: 4px; }
.rules-content ul { padding-left: 19px; margin: 4px 0; }
.rules-content li { margin: 3px 0; }
.rules-content li::marker { color: var(--gold-dim); }
.rules-content strong { color: var(--gold-bright); font-weight: 600; }
.creator-attribution { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(208,170,94,.15); text-align: center; color: var(--text-mute); font-size: 11px; }
.creator-link { color: var(--gold); }
.settings-section { margin-bottom: 20px; }
.settings-section:last-child { margin-bottom: 4px; }
.settings-section h4 { font: 600 11px/1.2 var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.settings-note, .difficulty-description p { font-size: 11.5px; line-height: 1.45; color: var(--text-mute); margin-top: 6px; }
.difficulty-options, .target-options, .motion-options { display: flex; gap: 7px; margin-top: 9px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.24); box-shadow: inset 0 0 0 1px rgba(208,170,94,.14); }
.difficulty-btn, .target-btn, .motion-btn { flex: 1; padding: 9px 6px; background: transparent; box-shadow: none; border-radius: 999px; }
.difficulty-btn:hover, .target-btn:hover, .motion-btn:hover { background: rgba(208,170,94,.12); box-shadow: none; }
.difficulty-btn.active, .target-btn.active, .motion-btn.active { box-shadow: 0 2px 0 #6f551f, 0 5px 14px rgba(0,0,0,.35); }
.target-note { min-height: 16px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 38px; padding: 3px 0; }
.setting-label { font-size: 12.5px; line-height: 1.35; color: var(--text); }
.setting-label small { display: block; margin-top: 2px; font-size: 10px; color: var(--text-mute); line-height: 1.3; }
.switch-btn {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    min-width: 78px; height: 30px; padding: 3px 10px 3px 4px; border: 0; border-radius: 999px;
    font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute);
    background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px rgba(208,170,94,.2);
    transition: color .2s, background .2s, box-shadow .2s;
}
.switch-btn i {
    width: 22px; height: 22px; border-radius: 50%; background: #4b3720;
    box-shadow: inset 0 0 0 1px rgba(241,217,154,.22), 0 2px 5px rgba(0,0,0,.4);
    transition: background .2s, transform .2s;
}
.switch-btn.is-on { color: #1f1407; background: linear-gradient(180deg, #f7e6b3, var(--gold) 58%, #b38d3f); box-shadow: inset 0 0 0 1px var(--gold-bright); }
.switch-btn.is-on i { background: #fff6d7; transform: translateX(1px); }
.switch-btn:disabled { opacity: .5; cursor: default; }
.volume-row { display: grid; grid-template-columns: 1fr minmax(95px, 1.2fr) 42px; align-items: center; gap: 10px; padding: 4px 0 7px; }
.volume-row input { width: 100%; accent-color: var(--gold); height: 20px; cursor: pointer; }
.volume-row input:disabled { opacity: .45; cursor: default; }
.volume-row output { font-size: 10px; color: var(--gold); text-align: right; font-variant-numeric: tabular-nums; }
.settings-modal { width: min(94vw, 520px); }
.confirm-modal { text-align: center; width: min(92vw, 390px); }
.confirm-modal h3 { font: 700 24px/1.15 var(--serif); color: var(--gold-bright); margin: 2px 0 8px; }
.confirm-copy { font-size: 13px; line-height: 1.55; color: var(--text-dim); margin-bottom: 18px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mute-btn { position: relative; }
.mute-btn.is-muted { color: var(--text-mute); opacity: .7; }
.mute-btn.is-muted::after { content: "/"; position: absolute; margin-left: 1px; color: var(--ruby-soft); font-size: 15px; }
.settings-actions { display: flex; flex-direction: column; gap: 6px; }
.settings-action-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; border-radius: 10px; text-align: left;
    text-transform: none; letter-spacing: .01em; font-size: 13px; font-weight: 500;
    background: rgba(0,0,0,.2); box-shadow: inset 0 0 0 1px rgba(208,170,94,.16);
}
.settings-action-btn:hover { background: rgba(208,170,94,.1); box-shadow: inset 0 0 0 1px rgba(208,170,94,.4); }
.action-chevron { color: var(--gold-dim); font-size: 19px; line-height: 1; }
.log-modal { width: min(94vw, 480px); }
.log-content { max-height: 50dvh; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.log-message { font-size: 12.5px; line-height: 1.4; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.22); color: var(--text); }
.log-message.trick-won { box-shadow: inset 3px 0 0 var(--gold); }
.log-message.trick-lost { box-shadow: inset 3px 0 0 var(--ruby-soft); }
.log-message.trump-selection { color: var(--gold-bright); }
.log-message.computer-action { color: var(--text-dim); }
.log-footer { margin-top: 12px; display: flex; justify-content: flex-end; }
.help-btn { display: none !important; }

/* effects */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.spark { position: absolute; top: 0; width: 7px; height: 12px; border-radius: 1px; opacity: 0; will-change: transform; }

/* ---------------------------------------------------------------- responsive */
/* Wide screens: five table cards and five hand cards sit side by side,
   each group labelled, which keeps all fifteen cards readable at once. */
@media (min-width: 820px) and (min-height: 560px) {
    :root { --cw-base: clamp(50px, min(calc((100vw - 92px) / 12.4), 13.2vh), 112px); }
    .player-area .seat-cards { flex-direction: row; align-items: flex-end; gap: clamp(14px, 2.4vw, 40px); }
    .seat-divider { display: block; }
    .player-area .seat-bar { margin-top: 1px; }
    .start-title { letter-spacing: .005em; }
}

@media (min-width: 820px) and (max-height: 700px) {
    .brand-sub { display: none; }
    .seat-bar { min-height: 25px; }
    .cards-label { font-size: 9.5px; }
    .start-chips { display: none; }
    .hero-fan { --hw: clamp(58px, 13vh, 96px); }
}

@media (max-width: 1100px) {
    .difficulty-indicator { display: none; }
}

/* Portrait tablets and phones stack the HUD; landscape keeps one compact row. */
@media (max-width: 860px) and (min-height: 561px) {
    .hud { grid-template-columns: auto minmax(0, 1fr); row-gap: 7px; column-gap: 10px; }
    .hud-brand { grid-column: 1; grid-row: 1; }
    .score-board { grid-column: 2; grid-row: 1; justify-self: end; }
    .hud-right { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: 6px; }
    .hud-divider { margin-left: auto; }
    .score-side { min-width: 58px; }
}

@media (max-width: 860px) {
    .brand-sub { display: none; }
    .game-board.is-shuffling .deck { --deck-lift: 1.45; }
    .game-board { margin: 6px; padding: 9px 8px; }
    .game-container { gap: 3px; }
}

@media (max-width: 800px) {
    .computer-area .seat-cards { flex-direction: column; gap: 4px; }
    .seat-divider { display: none; }
}

@media (max-width: 640px) {
    .game-container { padding: 4px 6px 7px; }
    .game-board { border-radius: 22px; margin: 5px; padding: 8px 5px; }
    .hud { gap: 6px; }
    .brand-mark { width: 36px; height: 36px; font-size: 13px; }
    .brand-name { font-size: 12px; letter-spacing: .14em; }
    .score-board { gap: 4px; padding: 3px 8px; }
    .score-name { font-size: 9px; letter-spacing: .12em; }
    .score-num { font-size: 21px; }
    .round-info { min-width: 42px; padding: 1px 9px; }
    .seat-bar { gap: 8px; padding: 2px 6px; min-height: 26px; }
    .seat-avatar:not(.anne-avatar) { width: 22px; height: 22px; font-size: 11px; }
    .anne-avatar { width: 44px; height: 44px; }
    .anne-role { display: none; }
    .anne-difficulty { display: none; }
    .player-label { font-size: 10px; letter-spacing: .14em; }
    .tricks-label { font-size: 10px; }
    .meter i { width: 3px; height: 8px; }
    .meter { gap: 2px; }
    .cards-label { font-size: 10px; letter-spacing: .1em; }
    .cards-label b { font-size: 10px; }
    .seat-cards { gap: 5px; }
    .trick-cards { padding: 7px 18px; min-width: calc(var(--cw-seat) * 2.2); }
    .game-status span { font-size: 13px; }
    .start-title { font-size: clamp(34px, 11vw, 44px); }
    .start-tagline { font-size: 13px; }
    .start-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 7px 14px; }
    #start-game { flex-basis: 100%; }
    .start-note { font-size: 9.5px; }
    .live-coach { width: min(94vw, 440px); padding: 7px 8px; gap: 7px; }
    .live-coach-copy { font-size: 11px; line-height: 1.35; }
    .live-coach-mark { font-size: 6.5px; padding: 3px 5px; }
    .trump-coach { padding: 7px 9px; margin-bottom: 9px; }
    .trump-coach p { font-size: 10.5px; line-height: 1.4; }
    .start-panel { gap: 10px; padding: 8px 10px; }
    .tutorial-invite { flex-wrap: wrap; gap: 7px 9px; padding: 8px 10px; }
    .tutorial-invite p { flex-basis: calc(100% - 40px); }
    .tutorial-invite-actions { width: 100%; justify-content: flex-end; }
    .tutorial-content { padding: 13px 14px 16px; }
    .tut-suits { grid-template-columns: repeat(2, 1fr); }
    .tut-actions { flex-wrap: wrap; gap: 9px; }
    .hero-fan { --hw: clamp(64px, 15vh, 104px); }
    .round-summary { width: min(90vw, 340px); padding: 12px 14px 8px; }
    .round-pill b { font-size: 9px; }
    .round-tricks { font-size: 15px; }
    .close-modal { width: 38px; height: 38px; font-size: 22px; }
    .coin-btn { min-height: 44px; }
    .control-btn { padding: 10px 18px; }
    .modal-content { padding: 18px 18px 20px; }
    .modal-header h3 { font-size: 18px; }
    .trump-options { gap: 6px; }
    .trump-btn { padding: 10px 3px 8px; }
    .trump-btn .suit-symbol { font-size: 25px; }
    .suit-name { font-size: 9px; letter-spacing: .06em; }
    .coin-container { height: 170px; margin: 4px 0; }
    .coin-rig { width: 100px; height: 100px; }
    .coin-letter { font-size: 40px; }
    .coin-halo { width: 190px; height: 190px; }
    .coin-shadow { width: 104px; bottom: 18px; }
}

@media (max-width: 520px) {
    .brand-name { display: none; }
    .hud-brand { gap: 0; }
    .hud-right { justify-content: space-between; }
    .hud-divider { display: none; }
    .hud-btn { height: 30px; padding: 0 11px; font-size: 9px; }
    .hud-rules { display: none; }
    .score-side { min-width: 50px; gap: 5px; }
    .score-name { font-size: 9px; }
    .trump-label { display: none; }
    .trump-indicator { padding: 3px 4px 3px 8px; gap: 5px; }
    .trump-suit { width: 24px; height: 24px; font-size: 15px; }
    .start-chips li { padding: 4px 8px; font-size: 8px; }
    .start-eyebrow { font-size: 8px; letter-spacing: .22em; }
    .round-pill { gap: 6px; }
    .round-pill b { font-size: 9px; letter-spacing: .08em; }
}

@media (max-width: 380px) {
    .score-side { min-width: 42px; }
    .score-name { display: none; }
    .round-info { min-width: 36px; padding: 1px 7px; }
    .seat-avatar:not(.anne-avatar) { display: none; }
    .anne-avatar { width: 42px; height: 42px; }
    .tricks-word { display: none; }
    .start-chips { display: none; }
}

/* Short landscape phones and laptops: compress the chrome, keep a row of cards. */
@media (max-height: 560px) and (orientation: landscape) {
    :root { --cw-base: clamp(38px, min(calc((100vw - 60px) / 11.8), 9.6vh), 68px); }
    .hero-fan { display: none; }
    .game-board.is-round-end .center-info { gap: 8px; }
    .round-summary { padding: 9px 14px 6px; }
    .round-pill { padding: 4px 2px 3px; }
    .game-container { padding: 3px 8px 5px; gap: 2px; }
    .hud { padding: 2px 0; }
    .brand-mark { width: 32px; height: 32px; font-size: 12px; }
    .brand-text, .brand-sub { display: none; }
    .score-num { font-size: 20px; }
    .hud-btn { height: 28px; }
    .difficulty-indicator { display: none; }
    .game-board { margin: 4px; padding: 6px 10px; border-radius: 20px; }
    .game-board::before { display: none; }
    .seat { gap: 3px; }
    .seat-bar { min-height: 21px; padding: 0 8px; gap: 8px; }
    .seat-avatar:not(.anne-avatar) { width: 19px; height: 19px; font-size: 10.5px; }
    .anne-avatar { width: 34px; height: 34px; }
    .player-label { font-size: 9px; }
    .tricks-label { font-size: 9px; }
    .tricks-word { display: none; }
    .meter i { width: 3px; height: 6px; }
    .cards-label { font-size: 9px; letter-spacing: .1em; }
    .player-area .seat-cards { flex-direction: row; align-items: flex-end; gap: 14px; }
    .computer-area .seat-cards { flex-direction: row; gap: 14px; }
    .seat-divider { display: block; height: calc(var(--cw-base) * .9); }
    .computer-hand .cards-container { min-height: calc(var(--cw-seat) * 1.4); }
    .game-board.is-shuffling .deck { --deck-lift: 1.4; }
    .trick-cards { padding: 4px 16px; min-height: calc(var(--cw-seat) * 1.4 + 10px); }
    .trick-meta { min-height: 12px; }
    .trick-caption { font-size: 8px; }
    .center-info { gap: 2px; }
    .game-status { min-height: 14px; }
    .game-status span { font-size: 12px; }
    .live-coach { padding: 5px 8px; gap: 6px; }
    .live-coach-copy { font-size: 10.5px; line-height: 1.3; }
    .live-coach-mark { display: none; }
    .trump-coach { margin-bottom: 7px; padding: 6px 8px; }
    .trump-coach p { font-size: 10px; line-height: 1.35; }
    .control-btn { padding: 7px 16px; font-size: 10px; }
    #start-game { padding: 9px 22px; font-size: 11px; }
    .start-title { font-size: clamp(28px, 6vw, 42px); }
    .start-tagline { display: none; }
    .start-chips { display: none; }
    .start-note { display: none; }
    .start-panel { gap: 7px; }
    .start-actions { margin-top: 0; }
    .modal-content { max-height: 94dvh; padding: 16px 20px; }
    .coin-container { height: 160px; margin: 0; }
    .coin-rig { width: 94px; height: 94px; }
    .coin-edge { inset: -2px; }
    .coin-letter { font-size: 37px; }
    .coin-word { font-size: 6.5px; }
    .coin-halo { width: 180px; height: 180px; }
    .coin-shadow { width: 98px; bottom: 16px; }
    .modal-header { margin-bottom: 10px; padding-bottom: 8px; }
    .modal-kicker { display: none; }
    .trump-hint { margin-bottom: 10px; }
    .trump-footnote { display: none; }
    .tutorial-invite { display: none !important; }
    .tutorial-content { max-height: 96dvh; padding: 10px 14px 13px; }
    .tutorial-topbar { margin-bottom: 0; }
    .tut-kicker { margin-top: 6px; }
    .tut-title { font-size: 19px; margin-bottom: 4px; }
    .tut-copy { font-size: 11.5px; line-height: 1.45; }
    .tut-hand { margin: 8px 0; }
    .tutorial-body { --tcw: clamp(36px, 8vh, 48px); }
    .tut-suits { gap: 5px; }
    .tut-suit { padding: 7px 3px 6px; }
    .tut-suit-symbol { font-size: 20px; }
    .tut-feedback { margin-top: 7px; padding: 6px 8px; font-size: 10.5px; line-height: 1.4; }
    .tut-actions { margin-top: 8px; }
    .tut-targets { margin: 8px 0; }
    .tut-target { padding: 7px 6px 6px; }
    .tut-trick { margin: 7px 0 4px; padding: 7px 8px; }
    .tut-recap { margin: 8px 0 2px; gap: 5px; }
    .tut-recap li { padding: 6px 8px; }
    .tut-footnote { display: none; }
}

/* Short screens cannot fit the trick caption, tray and status stacked; drop the
   caption rather than letting the status collide with the card tray. */
@media (max-height: 680px) {
    .trick-meta { display: none; }
    .center-info { gap: 4px; padding-bottom: 0; }
}

/* Very small phones: the centre tray matches the hand size instead of
   overflowing its row. */
@media (max-width: 400px) and (max-height: 700px) {
    .center-area { --cw-seat: calc(var(--cw-base) * 1.02); }
    .trick-cards { min-height: calc(var(--cw-seat) * 1.4 + 12px); padding: 6px 14px; }
}

/* Keep the setup panel and round result compact enough for 320×568. */
@media (max-width: 380px) and (max-height: 700px) {
    .start-note { display: none; }
    .round-summary { padding: 8px 12px 5px; }
    .round-summary-title { padding-bottom: 6px; font-size: 8px; letter-spacing: .16em; }
    .round-pill { padding: 5px 2px 4px; gap: 8px; }
    .game-board.is-round-end .center-info { gap: 4px; }
    .game-board.is-round-end #new-round { padding: 8px 22px; font-size: 11px; }
}

/* Motion is an explicit in-app choice. A system reduced-motion flag must not
   silently turn the table into a still image; only the Calm setting does that
   (and it still keeps the card sounds). */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
}

/* ==================================================================
   Readability and composition pass
   The table uses a lot of micro-labels. They were sized for a poster, not
   for a laptop or a phone; raise the floor, warm the dim ink and keep the
   hierarchy so nothing looks cramped.
   ================================================================== */
:root {
    --text-dim: #ded0b7;
    --text-mute: #c1b197;
}

.brand-sub { font-size: 9.5px; letter-spacing: .2em; }
.brand-name { font-size: 14px; }
.score-name { font-size: 10.5px; letter-spacing: .14em; }
.round-info small, .round-info em { font-size: 9.5px; }
.round-info b { font-size: 17px; }
.trump-label { font-size: 10px; letter-spacing: .12em; }
.difficulty-indicator span { font-size: 10px; }
.hud-btn { font-size: 11px; letter-spacing: .08em; }
.hud-icon { font-size: 15px; }
.player-label { font-size: 12px; letter-spacing: .16em; }
.anne-role { font-size: 10.5px; }
.anne-mood { font-size: 10px; }
.anne-difficulty { font-size: 9.5px; }
.tricks-label { font-size: 11px; letter-spacing: .03em; }
.tricks-label .trick-count { font-size: 16px; }
.cards-label { font-size: 10.5px; letter-spacing: .1em; }
.cards-label b { font-size: 10.5px; }
.trick-caption { font-size: 11px; letter-spacing: .16em; }
.lead-chip { font-size: 10px; }
.game-status span { font-size: 14px; }
.modal-kicker { font-size: 9.5px; letter-spacing: .18em; }
.modal-header h3 { font-size: 20px; }
.setting-label { font-size: 12.5px; }
.settings-note { font-size: 11.5px; line-height: 1.5; }
.suit-name { font-size: 10px; }
.coin-word { font-size: 9px; }
.match-context { font-size: 10px; }
.final-line span { font-size: 10px; }
.result-actions .control-btn, .result-actions .settings-action-btn { font-size: 10.5px; }
.gameover-modal { scrollbar-width: thin; }

/* The result card should never show a scrollbar for two pixels of padding. */
@media (max-height: 900px) {
    .gameover-modal { padding-bottom: 18px; }
    .gameover-modal .result-actions { margin-top: 2px; }
    .anne-result { margin-bottom: 14px; }
}

/* Mobile header: one row, no second-line orphan buttons. */
@media (max-width: 860px) {
    /* Keep the three-column grid on a phone: the score chip belongs in the
       middle of the screen, not in the middle of whatever space is left over
       between the brand and the buttons. */
    .hud {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 6px; padding: 2px 0;
    }
    .hud-brand { min-width: 0; }
    .score-board { justify-self: center; min-width: 0; }
    .hud-right { justify-self: end; margin-left: 0; gap: 5px; }
    .hud-right .hud-divider { display: none; }
    .difficulty-indicator { display: none; }
    .score-side { min-width: 0; flex: 0 1 auto; gap: 5px; }
    .round-info { min-width: 40px; }
}

@media (max-width: 700px) {
    .hud-rules { display: none; }
    .brand-text { display: none; }
    .brand-mark { width: 36px; height: 36px; }
    .hud-btn { height: 32px; padding: 0 10px; font-size: 10px; }
    .hud-icon { padding: 0 8px; }
    .score-name { font-size: 10px; }
    .score-num { font-size: 22px; }
}

@media (max-width: 520px) {
    .mute-btn { display: none; }
    #restart-game { font-size: 9.5px; padding: 0 9px; }
    .hud { gap: 5px; }
    .score-board { padding: 3px 7px; gap: 5px; }
    .round-info { min-width: 34px; padding: 1px 7px; }
    .score-num { font-size: 20px; }
    .brand-mark { width: 32px; height: 32px; font-size: 12px; }
    .trump-indicator { padding: 3px 3px 3px 7px; }
    .trump-suit { width: 22px; height: 22px; font-size: 14px; }
    .anne-avatar { width: 44px; height: 44px; }
    .anne-role { display: none; }
    .anne-mood { font-size: 9.5px; }
    .anne-reaction { font-size: 12.5px; padding: 9px 13px 10px; border-radius: 13px; }
    .player-label { font-size: 11px; }
    .tricks-label { font-size: 10px; }
    .cards-label { font-size: 9.5px; }
    .cards-label b { font-size: 9.5px; }
    .trick-caption { font-size: 10px; }
}

@media (max-width: 380px) {
    .anne-avatar { width: 42px; height: 42px; }
    .hud-btn { height: 30px; padding: 0 8px; }
    #restart-game { font-size: 9px; padding: 0 7px; }
    .score-side { gap: 3px; }
}

@media (max-height: 560px) and (orientation: landscape) {
    .anne-avatar { width: 34px; height: 34px; }
    .anne-role { display: none; }
    .anne-mood { display: none; }
    .anne-reaction { font-size: 12px; padding: 7px 12px; max-width: min(300px, calc(100vw - 120px)); }
    .hud-btn { height: 28px; }
    .brand-sub { display: none; }
}

/* Final composition details */

/* Readable, unobtrusive scrollbars in tall panels. */
.modal-content::-webkit-scrollbar { width: 7px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(208,170,94,.32); border-radius: 999px; }
.modal-content::-webkit-scrollbar-thumb:hover { background: rgba(208,170,94,.5); }

/* Action copy should read as a choice, not a caption. */
.game-over-actions .control-btn { font-size: 12px; letter-spacing: .1em; padding: 12px 20px; }
.result-actions .control-btn, .result-actions .settings-action-btn { font-size: 11.5px; }
.setting-label small {
    display: block; margin-top: 2px; font-size: 10px; letter-spacing: 0;
    text-transform: none; color: var(--text-mute);
}
.sound-test { min-height: 32px; padding: 7px 13px; font-size: 10px; }

/* A warm pool of light in the middle of the felt, so the table reads as a
   room rather than a flat green rectangle. */
.game-board {
    background:
        radial-gradient(58% 48% at 50% 44%, rgba(255, 226, 167, .07) 0%, rgba(255, 226, 167, 0) 66%),
        radial-gradient(62% 56% at 50% 47%, rgba(35, 126, 94, .48) 0%, rgba(15, 74, 55, 0) 72%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 .1  0 0 0 0 0  0 0 0 .45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>"),
        linear-gradient(180deg, var(--felt-2), var(--felt-1) 45%, var(--felt-3));
}

/* 320px phones: keep both scores legible; the round number lives in the
   status line and round summary. */
@media (max-width: 380px) {
    .round-info { display: none; }
    .score-board { justify-content: space-between; flex: 1 1 auto; padding: 3px 10px; }
    .score-side { min-width: 0; }
    .score-num { font-size: 19px; }
    .brand-mark { width: 30px; height: 30px; }
    .hud { gap: 4px; }
}

@media (max-width: 520px) {
    .game-over-actions { gap: 8px; }
    .game-over-actions .control-btn { font-size: 11px; padding: 11px 14px; }
    .winner-text { font-size: clamp(26px, 8vw, 34px); }
}

/* Short landscape: keep the line beside her face, just narrower. */
@media (orientation: landscape) and (max-height: 560px) and (min-width: 780px) {
    .anne-reaction { max-width: 34vw; }
}

/* Anne's line inside the trump sheet keeps the choice personal. */
.trump-anne-line {
    display: flex; align-items: center; gap: 10px;
    margin: 2px 0 12px; padding: 8px 12px 8px 8px;
    text-align: left; border-radius: 14px;
    background: linear-gradient(180deg, #fffdf6, #f2e4c9);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 8px 18px rgba(0,0,0,.28);
}
.trump-anne-line p {
    margin: 0; font-size: 12.5px; line-height: 1.4; color: #2b2015;
}
.trump-anne-line b { color: #7a3f16; letter-spacing: .02em; }

/* A suit you hold none of is still legal, but it should never look inviting. */
.trump-btn.is-empty { opacity: .6; }
.trump-btn.is-empty .suit-count { color: #ffb4a8; }
.trump-btn.is-empty:hover { opacity: .85; }

/* ---------------------------------------------------------------- legibility
   The table is played at arm's length: small caps over emerald felt were the
   hardest thing in the whole interface to read. These overrides keep the same
   visual language but raise contrast and put a floor under the label sizes.
   They come last on purpose so they settle every earlier tune-up. */
:root {
    --text-mute: #c6b79b;
    --text-dim: #e0d3ba;
}
.cards-label { font-size: 12px; font-weight: 500; letter-spacing: .06em; color: var(--text-dim); }
.cards-label b { font-size: 12px; color: var(--gold-bright); }
.tricks-label { font-size: 12.5px; font-weight: 500; letter-spacing: .02em; color: var(--text-dim); }
.tricks-label .trick-count { font-size: 18px; color: var(--gold-bright); }
.score-name { font-size: 11px; letter-spacing: .12em; color: var(--text-dim); }
.round-info small { font-size: 10px; letter-spacing: .1em; color: var(--text-dim); }
.round-info em { font-size: 9.5px; color: var(--text-dim); }
.trump-label { font-size: 10.5px; letter-spacing: .1em; color: var(--text-dim); }
.difficulty-indicator { font-size: 11.5px; font-weight: 500; color: var(--text-dim); }
.brand-sub { font-size: 10px; letter-spacing: .12em; color: var(--text-dim); }
.anne-role { font-size: 11.5px; color: var(--text-dim); }
.anne-mood { font-size: 11px; }
.anne-difficulty { font-size: 10.5px; }
.trick-caption { font-size: 12.5px; font-weight: 500; letter-spacing: .1em; color: var(--text-dim); }
.game-status span { font-size: 17px; }
.anne-reaction { font-size: 14.5px; }
@media (max-width: 640px) {
    .cards-label, .cards-label b { font-size: 11px; letter-spacing: .04em; }
    .tricks-label { font-size: 11px; }
    .tricks-label .trick-count { font-size: 15px; }
    .round-info small { font-size: 9px; }
    .anne-role { font-size: 10.5px; }
    .trick-caption { font-size: 11px; }
    .game-status span { font-size: 15px; }
}

/* ==================================================================
   Legibility pass 2
   The first pass raised the floor for the labels it knew about. This one
   catches the rest and stops the small print shrinking again on a phone:
   a small screen is a reason to keep the type, not to shrink it.
   ================================================================== */
.score-name { font-size: 10.5px; }
.round-info small, .round-info em { font-size: 10px; }
.trump-label { font-size: 10.5px; }
.difficulty-indicator span { font-size: 10.5px; }
.anne-role { font-size: 11px; }
.anne-mood { font-size: 10.5px; }
.anne-difficulty { font-size: 10.5px; }
.cards-label, .cards-label b { font-size: 11px; }
.tricks-label { font-size: 11px; }
.trick-caption { font-size: 11px; }
.lead-chip { font-size: 10.5px; }
.suit-name { font-size: 11px; }
.coin-word { font-size: 10.5px; }
.modal-kicker { font-size: 10.5px; }
.match-context { font-size: 11px; }
.final-line span { font-size: 11px; }
.result-actions .control-btn, .result-actions .settings-action-btn { font-size: 11.5px; }
.start-note { font-size: 11px; line-height: 1.5; }
.tutorial-invite p { font-size: 12px; }
.live-coach-copy { font-size: 12px; }
.game-status span { font-size: 14.5px; }

@media (max-width: 700px) {
    .hud-btn { font-size: 11px; }
    #restart-game { font-size: 11px; }
    .score-name { font-size: 10.5px; }
    .round-info small, .round-info em { font-size: 10px; }
    .anne-mood { font-size: 10.5px; }
    .cards-label, .cards-label b { font-size: 11px; }
    .tricks-label { font-size: 11px; }
    .trick-caption { font-size: 11px; }
}

@media (max-width: 380px) {
    .hud-btn { font-size: 10.5px; }
    #restart-game { font-size: 10.5px; }
    .cards-label, .cards-label b { font-size: 10.5px; }
    .tricks-label { font-size: 10.5px; }
}

@media (max-height: 560px) and (orientation: landscape) {
    .player-label { font-size: 11px; }
    .tricks-label { font-size: 10.5px; }
    .cards-label, .cards-label b { font-size: 10.5px; }
    .trick-caption { font-size: 10.5px; }
}

/* Anne's face-up row is the only place the player has to read her cards, so on
   a phone it grows instead of shrinking. */
@media (max-width: 700px) {
    .computer-area .face-up-cards { --cw-seat: calc(var(--cw-base) * .84); }
    .computer-area .face-up-cards .cards-label { font-size: 10.5px; }
}

/* ==================================================================
   Legibility pass 3
   Pass 1 raised the poster-sized labels, pass 2 caught the rest and
   stopped the phone shrinking them again - but both left the HUD's
   small caps sitting at 10-10.5px, which is still below the size this
   table is read at (arm's length, small caps over emerald felt).
   This pass puts a real floor under every label that carries meaning:
   11px minimum, 11.5px for the ones a player scans mid-trick. It comes
   last on purpose, so it settles every earlier tune-up.
   ================================================================== */
.brand-sub { font-size: 11px; }
.score-name { font-size: 11px; }
.round-info small, .round-info em { font-size: 11px; }
.trump-label { font-size: 11px; }
.difficulty-indicator { font-size: 11.5px; }
.difficulty-indicator span { font-size: 11px; }
.anne-role { font-size: 11.5px; }
.anne-mood { font-size: 11px; }
.anne-difficulty { font-size: 11px; }
.seat-avatar { font-size: 11.5px; }
.cards-label, .cards-label b { font-size: 11.5px; }
.tricks-label { font-size: 11.5px; }
.trick-caption { font-size: 11.5px; }
.lead-chip { font-size: 11px; }
.suit-name { font-size: 11.5px; }
.suit-count { font-size: 11px; }
.coin-word { font-size: 11px; }
.modal-kicker { font-size: 11px; }
.match-context { font-size: 11.5px; }
.final-line span { font-size: 11.5px; }
.start-note { font-size: 11.5px; }
/* The corner suit mark is the thing people actually read on a small card. */
.idx i { font-size: 1.1em; }

/* A phone keeps the same floor instead of stepping back down: a small screen
   is a reason to keep the type, not to shrink it. */
@media (max-width: 700px) {
    .score-name, .round-info small, .round-info em { font-size: 11px; }
    .anne-mood, .anne-difficulty { font-size: 11px; }
    .cards-label, .cards-label b, .tricks-label, .trick-caption { font-size: 11px; }
    .hud-btn, #restart-game { font-size: 11px; }
    .computer-area .face-up-cards .cards-label { font-size: 11px; }
}

@media (max-width: 380px) {
    .hud-btn, #restart-game { font-size: 11px; }
    .cards-label, .cards-label b, .tricks-label, .trick-caption { font-size: 11px; }
}

@media (max-height: 560px) and (orientation: landscape) {
    .player-label { font-size: 11.5px; }
    .tricks-label, .cards-label, .cards-label b, .trick-caption { font-size: 11px; }
}
