/* 6 nimmt! — a county-fair show ring printed like a comic.
 *
 * Where every value came from (sampled from assets/cards/*.webp, Franz Vohwinkel's art):
 *   --bull      #503b75  the bull heads' violet (104.webp, the head's shadow side); the room and
 *                        the ring are this hue, darkened for the room, lifted for the ring
 *   --sky       #88b8e2  the 5's ground          --lime  #c4dc2a  the 10's ground (lifted)
 *   --red       #e0392e  the 11's ground (#ca2a21, lifted for a violet surface)
 *   --sun       #fae30c  the 55's ground         --ink   #1e1233  the art's outline ink (#1f1c21),
 *                                                                  leaned into the violet
 *   --stock     #fbf8f1  the cards' white stock — the light end of the palette belongs to cards,
 *                        tags and the scorecard, never to the table
 *   the four row rosettes wear the deck's four grounds; lime is the one action colour ("your
 *   move", Play, a choosable row); red means one thing: taking bull heads.
 *   type      Lilita One — the chunky, ink-heavy comic numerals of the cards; Nunito for every
 *             word you read (rounded, open at 11px on a phone). Both self-hosted (SIL OFL).
 *   halftone  the room is a printed comic page: a dot screen and a slow sunburst behind the ring.
 */

@font-face { font-family: 'Lilita One'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('assets/fonts/LilitaOne-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lilita One'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('assets/fonts/LilitaOne-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500 900; font-display: swap;
    src: url('assets/fonts/Nunito-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500 900; font-display: swap;
    src: url('assets/fonts/Nunito-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --ink: #1e1233;
    --ink-2: #3a2a58;
    --room-0: #170c2b;
    --room-1: #2a1850;
    --room-2: #3b2368;
    --bull: #503b75;
    --ring: #4a2c84;
    --ring-2: #5b3c9c;
    --lane: rgba(20, 8, 42, 0.34);
    --stock: #fbf8f1;
    --stock-2: #efe8f6;
    --stock-line: #d9cfe6;
    --sky: #88b8e2;
    --lime: #c4dc2a;
    --lime-deep: #8aa50c;
    --red: #e0392e;
    --red-deep: #b0241b;
    --sun: #fae30c;
    --violet-text: #5a3f8f;     /* violet ink on stock: 7.2:1 */
    --font-display: 'Lilita One', 'Nunito', system-ui, sans-serif;
    --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --wr: 70px; --hw: 86px; --wb: 30px; --tag: 26px;

    /* the shared back-button question (core/back.js) and pass & play read these */
    --dk-scrim: rgba(18, 8, 34, 0.66);
    --dk-scrim-solid: #170c2b;
    --dk-font-ui: var(--font-ui);
    --dk-font-display: var(--font-display);
    --dk-dialog-top: var(--stock);
    --dk-dialog-bottom: var(--stock-2);
    --dk-dialog-line: var(--ink);
    --dk-panel-text: var(--ink);
    --dk-panel-accent: var(--ink);
    --dk-accent: var(--lime);
    --dk-accent-ink: var(--ink);
    --dk-back-btn-bg: var(--lime);
    --dk-back-btn-ink: var(--ink);
    --dk-back-btn-line: var(--ink);
    --dk-back-alt-bg: transparent;
    --dk-back-alt-ink: var(--ink);
    --dk-back-alt-line: var(--ink);
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
    background: var(--room-1);
    color: var(--stock);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}
::selection { background: var(--lime); color: var(--ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

/* ── The room: a printed comic page, lit over the ring ─────────────────────── */
#game {
    position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none;
    background:
        radial-gradient(ellipse 70% 60% at 50% 48%, rgba(132, 92, 214, 0.34), transparent 70%),
        repeating-conic-gradient(from 3deg at 50% 50%, rgba(255, 255, 255, 0.032) 0deg 7deg, transparent 7deg 15deg),
        radial-gradient(circle, rgba(255, 255, 255, 0.075) 1.1px, transparent 1.6px) 0 0 / 9px 9px,
        linear-gradient(180deg, var(--room-2), var(--room-1) 55%, var(--room-0));
}
#game::after {   /* the half-light in the corners */
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(10, 4, 24, 0.55));
}

/* ── The show ring: an ink-outlined board with a white rail ────────────────── */
#board {
    position: absolute; z-index: 1;
    border-radius: 22px;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1.5px) 0 0 / 7px 7px,
        radial-gradient(ellipse at 50% 30%, var(--ring-2), var(--ring) 70%);
    border: 4px solid #f2ecdf;
    box-shadow: 0 0 0 3px var(--ink), 0 22px 44px rgba(8, 2, 20, 0.6), inset 0 3px 0 rgba(255, 255, 255, 0.08);
}
.phone #board { border-width: 3px; border-radius: 14px; }

.lane {
    position: absolute; z-index: 2; border-radius: 12px;
    background: var(--lane);
    box-shadow: inset 0 2px 6px rgba(8, 2, 20, 0.35);
    transition: box-shadow 0.18s, background-color 0.18s;
}
.phone .lane { border-radius: 8px; }
.slot {
    position: absolute; z-index: 3; border-radius: 7% / 4.5%;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    pointer-events: none;
}
.slot.next { border: 2px solid var(--lime); background: rgba(196, 220, 42, 0.14); }
.slot.gate {
    border: 2px solid var(--ink);
    background: repeating-linear-gradient(-45deg, var(--red) 0 9px, #f4c21b 9px 18px);
    opacity: 0.42;
    display: grid; place-items: center; align-content: center; gap: 2px;
    transition: opacity 0.2s, box-shadow 0.2s;
}
.gate-six {
    font: 400 calc(var(--wr) * 0.5)/1 var(--font-display); color: #fff;
    -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
}
.slot.gate .bull { width: 42%; fill: #fff; stroke: var(--ink); stroke-width: 1.6px; paint-order: stroke; }
/* a row holding five: its gate is open and lit — the next card into it takes the row */
.lane.full { box-shadow: inset 0 2px 6px rgba(8, 2, 20, 0.35), 0 0 0 2px rgba(224, 57, 46, 0.65); }
.slot.gate.open { opacity: 1; box-shadow: 0 0 0 3px var(--red), 0 0 18px rgba(224, 57, 46, 0.65); }
.lane.sweeping { background: rgba(224, 57, 46, 0.3); }
.lane.choosable { cursor: pointer; box-shadow: 0 0 0 3px var(--lime), 0 0 22px rgba(196, 220, 42, 0.35); z-index: 25; background: rgba(196, 220, 42, 0.08); }
@media (hover: hover) { .lane.choosable:hover { background: rgba(196, 220, 42, 0.2); } }
.lane.pv-here { box-shadow: inset 0 2px 6px rgba(8, 2, 20, 0.35), 0 0 0 2px var(--lime); }
.lane.pv-take { box-shadow: 0 0 0 3px var(--red), 0 0 20px rgba(224, 57, 46, 0.5); }
.lane.pv-low { box-shadow: inset 0 2px 6px rgba(8, 2, 20, 0.35), 0 0 0 2px rgba(250, 227, 12, 0.7); }

.take-chip {
    position: absolute; display: flex; width: max-content; height: 32px; padding: 0 12px; align-items: center; justify-content: center; gap: 5px;
    background: var(--red); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
    font: 800 14px/1 var(--font-ui); box-shadow: 0 6px 14px rgba(8, 2, 20, 0.5); white-space: nowrap;
    animation: chip-in 0.3s cubic-bezier(.16, 1, .3, 1) both;
}
.take-chip b { font: 400 17px/1 var(--font-display); }
.take-chip .bull { width: 16px; height: 16px; fill: #fff; }
@keyframes chip-in { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Rosettes: each pen's prize ribbon, the row's bull heads in its heart */
.rosette { position: absolute; z-index: 4; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(8, 2, 20, 0.5)); }
.rosette-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ros-petals circle, .ros-ring { stroke: var(--ink); stroke-width: 3; }
.ros-tail { fill: #f2ecdf; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.ros-face { fill: var(--stock); stroke: var(--ink); stroke-width: 3; }
.ros-num {
    position: absolute; left: 0; right: 0; top: 37.3%; transform: translateY(-50%);
    text-align: center; color: var(--ink);
    font: 400 calc(var(--wr) * 0.34)/1 var(--font-display);
    font-variant-numeric: tabular-nums;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    position: absolute; z-index: 10;
    border-radius: 7% / 4.5%;
    background-color: var(--stock);
    background-size: cover; background-position: center;
    box-shadow: 0 0 0 1px rgba(30, 18, 51, 0.55), 0 2px 1px rgba(30, 18, 51, 0.25), 0 7px 14px rgba(10, 4, 24, 0.42);
    touch-action: none;
}
.card.back { background-color: #f4f6fb; }
.row-card { pointer-events: none; }
.row-card.at-gate { box-shadow: 0 0 0 3px var(--red), 0 8px 18px rgba(10, 4, 24, 0.5); }
.hand-card { cursor: default; transition: filter 0.12s, box-shadow 0.12s; }
.hand-card.playable { cursor: pointer; }
@media (hover: hover) {
    .hand-card.playable:hover {
        filter: brightness(1.06);
        box-shadow: 0 0 0 3px var(--lime), 0 10px 20px rgba(10, 4, 24, 0.55);
        z-index: 70 !important;
    }
}
.hand-card.playable:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--lime), 0 0 0 6px var(--ink); z-index: 70 !important; }
.fan-card, .pile-card { pointer-events: none; box-shadow: 0 0 0 1px rgba(30, 18, 51, 0.5), 0 2px 4px rgba(10, 4, 24, 0.35); }
.pick-card { pointer-events: none; transform: rotate(7deg); box-shadow: 0 0 0 2px var(--ink), 0 5px 10px rgba(10, 4, 24, 0.45); }
.pile-empty {
    position: absolute; z-index: 4; border-radius: 7% / 4.5%;
    border: 2px dashed rgba(90, 63, 143, 0.35);
}
.pile-count {
    position: absolute; display: grid; place-items: center;
    background: var(--ink); color: #fff; border-radius: 999px;
    font: 800 10.5px/1 var(--font-ui); font-variant-numeric: tabular-nums;
}
.card.deck { position: fixed; box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 #e8e2f2, 6px 6px 0 #d9d1e8, 0 14px 24px rgba(10, 4, 24, 0.5); }

/* ── Ear tags: every seat's plate ──────────────────────────────────────────── */
.plate {
    position: absolute; z-index: 3;
    display: flex; align-items: flex-start; gap: 6px;
    padding: 0 7px 0 calc(var(--tag) * 0.85);
    background:
        radial-gradient(circle, rgba(80, 59, 117, 0.08) 1px, transparent 1.4px) 0 0 / 6px 6px,
        linear-gradient(var(--stock) 0 var(--tag), var(--stock-2) var(--tag));
    border: 2.5px solid var(--ink);
    /* a livestock ear tag lying on its side: the round head holds the punched hole */
    border-radius: 34px 14px 14px 34px / 50% 14px 14px 50%;
    color: var(--ink);
    box-shadow: 0 8px 16px rgba(8, 2, 20, 0.45);
    transition: box-shadow 0.2s;
}
.plate::after {   /* the rule between the tag line and the pen below it */
    content: ''; position: absolute; left: calc(var(--tag) * 0.7); right: 0; top: calc(var(--tag) - 2px); height: 2px; background: var(--stock-line);
}
.plate.acting { box-shadow: 0 0 0 3px var(--lime), 0 8px 16px rgba(8, 2, 20, 0.45); }
.tag-hole {
    position: absolute; left: calc(var(--tag) * 0.24); top: 50%; transform: translateY(-50%);
    width: 12px; height: 12px;
    border-radius: 50%; background: var(--seat); border: 2px solid var(--ink);
    box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px var(--stock);
}
.tag-name {
    flex: 1 1 auto; min-width: 0; height: calc(var(--tag) - 2px);
    line-height: calc(var(--tag) - 2px);
    font: 800 14px/calc(var(--tag) - 2px) var(--font-ui);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-total {
    flex: none; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px;
    height: calc(var(--tag) - 7px); padding: 0 7px 0 5px;
    background: var(--bull); color: #fff; border-radius: 999px;
}
.tag-total .bull { width: 14px; height: 14px; fill: #fff; }
.tag-total b { font: 400 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.tag-total.hot { background: var(--red); }
.phone .plate { border-radius: 20px 9px 9px 20px / 50% 9px 9px 50%; border-width: 2px; padding: 0 4px 0 calc(var(--tag) * 0.8); gap: 3px; }
.phone .tag-hole { width: 8px; height: 8px; border-width: 1.5px; left: calc(var(--tag) * 0.22); box-shadow: 0 0 0 2px var(--stock); }
.phone .tag-name { font-size: 11px; }
.phone .tag-total { margin-top: 2px; padding: 0 5px 0 3px; gap: 2px; }
.phone .tag-total .bull { width: 10px; height: 10px; }
.phone .tag-total b { font-size: 11.5px; }

/* ── The line-up: picks turned over, low to high ───────────────────────────── */
.tray {
    position: absolute; z-index: 50; border-radius: 18px;
    background: rgba(23, 12, 43, 0.82);
    border: 2.5px solid var(--ink);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.07), 0 12px 26px rgba(8, 2, 20, 0.5);
}
.tray-card { transition: box-shadow 0.15s, filter 0.15s; }
.tray-card.active { box-shadow: 0 0 0 3px var(--sun), 0 0 0 6px var(--ink), 0 12px 22px rgba(10, 4, 24, 0.6); }
.tray-card.low { box-shadow: 0 0 0 3px var(--red), 0 0 0 6px var(--ink), 0 0 24px rgba(224, 57, 46, 0.6); }
.tray-name {
    position: absolute; display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 0 6px; border-radius: 999px;
    background: var(--stock); color: var(--ink); border: 2px solid var(--ink);
    font: 800 12px/1 var(--font-ui);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.tray-name::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--seat); }
.phone .tray-name { font-size: 10px; border-width: 1.5px; padding: 0 3px; }

/* ── Flights ───────────────────────────────────────────────────────────────── */
.ghost { position: fixed; z-index: 1000; pointer-events: none; transform-origin: center center; will-change: transform; }
.ghost-face { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.bull-pop {
    position: fixed; z-index: 1001; pointer-events: none;
    display: flex; align-items: center; gap: 4px; padding: 5px 12px 5px 10px;
    background: var(--red); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
    box-shadow: 0 8px 18px rgba(8, 2, 20, 0.5);
    transform: translate(-50%, -100%);
    animation: pop-up 1.5s cubic-bezier(.2, .8, .3, 1) forwards;
}
.bull-pop.down { transform: translate(-50%, 0); animation-name: pop-down; }
.bull-pop b { font: 400 22px/1 var(--font-display); }
.bull-pop .bull { width: 20px; height: 20px; fill: #fff; }
@keyframes pop-up {
    0% { opacity: 0; transform: translate(-50%, -60%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -100%) scale(1.1); }
    25% { transform: translate(-50%, -100%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -150%); }
}
@keyframes pop-down {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    25% { transform: translate(-50%, 0) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, 40%); }
}

/* ── Status line: beside the hand ──────────────────────────────────────────── */
#status-line {
    position: fixed; z-index: 200; left: 50%; top: 70%;
    transform: translate(-50%, -50%);
    pointer-events: none; max-width: 92vw;
    padding: 6px 16px; border-radius: 999px;
    background: rgba(23, 12, 43, 0.9); color: var(--stock);
    border: 2px solid rgba(255, 255, 255, 0.14);
    font: 700 15px/1.2 var(--font-ui);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity 0.2s;
}
#status-line.show { opacity: 1; }
#status-line.turn { border-color: var(--lime); color: #fff; }
#status-line.alert { background: var(--red); border-color: var(--ink); color: #fff; }
body:not(.in-game) #status-line { display: none; }
body.phone #status-line { font-size: 12px; padding: 3px 10px; border-width: 1.5px; }

/* ── Header: an ink bar; on a phone, a dock beside the hand ────────────────── */
#header-bar {
    position: fixed; z-index: 300; left: 0; right: 0; top: 0; height: 52px;
    display: flex; align-items: center; gap: 4px; padding: 0 8px 0 4px;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.5px) 0 0 / 6px 6px,
        var(--ink);
    border-bottom: 3px solid #120a20;
    box-shadow: 0 6px 16px rgba(8, 2, 20, 0.45);
    color: #efe6ff;
}
body:not(.in-game) #header-bar { display: none; }
.hdr-title {
    display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0;
    font: 400 26px/1 var(--font-display); color: #fff; white-space: nowrap;
}
.wm-six {
    display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; flex: none;
    background: var(--sun); color: var(--ink); border: 3px solid var(--ink); border-radius: 50%;
    box-shadow: 0 0 0 2px var(--sun); line-height: 1;
    font-size: 0.82em;
}
.hdr-tools { display: flex; align-items: center; gap: 2px; }
.hdr-btn {
    flex: none; width: 44px; height: 44px; display: grid; place-items: center;
    background: transparent; border: 0; border-radius: 12px; cursor: pointer; touch-action: manipulation;
    color: #efe6ff; transition: background-color 0.15s, color 0.15s;
}
.hdr-btn svg { pointer-events: none; }
@media (hover: hover) { .hdr-btn:hover { background: rgba(255, 255, 255, 0.09); } }
.hdr-btn.active { background: var(--lime); color: var(--ink); }
.hdr-btn.off { color: #a493c4; }
#more-btn { display: none; }

#ai-indicator {
    position: relative; flex: none; height: 44px; display: inline-flex; align-items: center; gap: 7px;
    padding: 0 12px; margin-right: 4px; cursor: pointer; touch-action: manipulation;
    background: transparent; border: 0; color: #efe6ff;
    font: 800 13px/1 var(--font-ui); white-space: nowrap;
}
#ai-indicator::before {
    content: ''; position: absolute; inset: 7px 0; border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.05); z-index: -1;
}
.ai-lamp { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #b9aad6; background: transparent; flex: none; }
.ai-onnx .ai-lamp, .ai-search .ai-lamp { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 8px var(--lime); }
.ai-ready .ai-lamp { border-color: var(--lime); }
.ai-pending .ai-lamp { border-style: dotted; animation: lamp-wait 1.4s ease-in-out infinite; }
@keyframes lamp-wait { 50% { opacity: 0.35; } }
#ai-indicator-detail {
    display: none; position: absolute; right: 0; top: calc(100% + 6px); width: 270px; z-index: 320;
    padding: 12px 14px; border-radius: 14px; text-align: left;
    background: var(--stock); color: var(--ink); border: 2.5px solid var(--ink);
    box-shadow: 0 14px 30px rgba(8, 2, 20, 0.55);
    font: 600 13px/1.4 var(--font-ui); white-space: normal; cursor: default;
}
#ai-indicator.tip-open #ai-indicator-detail { display: block; }
@media (hover: hover) { #ai-indicator:hover #ai-indicator-detail { display: block; } }
.ai-detail-head { font: 400 17px/1.2 var(--font-display); margin-bottom: 6px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid var(--stock-line); }
.ai-detail-row span { color: var(--violet-text); }
.ai-detail-row b { font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.ai-detail-why { margin-top: 8px; color: var(--violet-text); font-size: 12.5px; }

/* phone dock */
#header-bar.dock {
    right: auto; padding: 0 2px 1px; gap: 0; border-radius: 14px; border: 2px solid #120a20;
    background: rgba(30, 18, 51, 0.94);
    flex-wrap: wrap; align-content: center; justify-content: space-between;
}
#header-bar.dock .hdr-title { order: -1; flex: 1 0 100%; height: 17px; justify-content: center; }
#header-bar.dock .hdr-tools { flex: 1 1 auto; justify-content: flex-end; }
#header-bar.dock .hdr-tools .tool { display: none; }
#header-bar.dock #more-btn { display: grid; }
#header-bar.dock .hdr-title { font-size: 14px; gap: 3px; overflow: hidden; }
#header-bar.dock .wm-six { border-width: 1.5px; box-shadow: none; width: 1.3em; height: 1.3em; }
#header-bar.dock #ai-indicator { padding: 0; width: 44px; justify-content: center; margin: 0; gap: 0; }
#header-bar.dock #ai-indicator .ai-text { display: none; }
#header-bar.dock #ai-indicator-detail { top: auto; bottom: calc(100% + 6px); right: -60px; width: 240px; }

.hdr-menu {
    position: fixed; z-index: 400; min-width: 200px; padding: 6px;
    background: var(--stock); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 14px;
    box-shadow: 0 14px 30px rgba(8, 2, 20, 0.55);
    display: flex; flex-direction: column; gap: 2px;
}
.hdr-menu-item {
    display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
    background: transparent; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
    font: 700 15px/1.1 var(--font-ui); color: var(--ink); touch-action: manipulation;
}
.hdr-menu-item:hover, .hdr-menu-item:focus-visible { background: var(--stock-2); }
.hdr-menu-item.on { background: var(--lime); }
.mi-icon { display: grid; place-items: center; width: 24px; flex: none; }
.flag { display: inline-block; width: 26px; height: 17px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1.5px var(--ink); }
.flag svg { display: block; width: 100%; height: 100%; }

/* tool panels: the log and the AI's reasoning */
.side-panel {
    position: fixed; z-index: 350; right: 10px; width: min(370px, 94vw);
    max-height: calc(100vh - 80px); display: flex; flex-direction: column;
    background: var(--stock); color: var(--ink);
    border: 3px solid var(--ink); border-radius: 16px;
    box-shadow: 0 18px 40px rgba(8, 2, 20, 0.6);
}
body.phone .side-panel { top: 6px !important; bottom: 6px; right: 6px; max-height: none; width: min(360px, 62vw); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 4px 14px; border-bottom: 2px solid var(--stock-line); }
.panel-head h3 { font: 400 20px/1.2 var(--font-display); }
.panel-close { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; cursor: pointer; color: var(--ink); }
.panel-close:hover { background: var(--stock-2); }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 14px 12px; font: 600 13.5px/1.45 var(--font-ui); }
.panel-foot { padding: 8px 14px 12px; border-top: 2px solid var(--stock-line); font: 600 12px/1.4 var(--font-ui); color: var(--violet-text); }
.panel-empty { color: var(--violet-text); padding: 6px 0; }
.log-divider { height: 0; border-top: 2px dashed var(--stock-line); margin: 7px 0; }
.log-round { font: 400 16px/1.3 var(--font-display); color: var(--violet-text); }
.log-line { padding: 2px 0; }
.log-line.hit { color: var(--red-deep); font-weight: 800; }
.log-dim { color: var(--violet-text); }
.log-sum b { font-variant-numeric: tabular-nums; }
.log-name { font-weight: 800; white-space: nowrap; }
.log-name::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--seat); margin-right: 4px; border: 1.5px solid var(--ink); vertical-align: 0; }
.log-card {
    display: inline-block; min-width: 26px; padding: 0 5px; text-align: center;
    border: 1.5px solid var(--ink); border-radius: 5px; background: #fff;
    font: 400 13px/18px var(--font-display); font-variant-numeric: tabular-nums;
}
.log-card[data-b="2"] { background: #cfe3f5; }
.log-card[data-b="3"] { background: #e6f2a6; }
.log-card[data-b="5"] { background: #f7c3bf; }
.log-card[data-b="7"] { background: #fdf3a0; }
.ai-entry { padding: 8px 0; border-bottom: 2px dashed var(--stock-line); }
.ai-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.ai-chose { font-weight: 800; }
.ai-meta { color: var(--violet-text); font-size: 12px; margin-left: auto; }
.ai-sum { color: var(--violet-text); font-size: 12.5px; margin: 2px 0; }
.ai-row { display: grid; grid-template-columns: 14px auto 1fr auto; gap: 6px; align-items: baseline; padding: 1px 0; font-size: 13px; }
.ai-row.chosen { font-weight: 800; }
.ai-mark { color: var(--lime-deep); display: inline-grid; place-items: center; }
.ai-note { color: var(--violet-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-val { font-variant-numeric: tabular-nums; }

#rules-popup {
    position: fixed; z-index: 1400; right: 10px; width: min(460px, 94vw); max-height: calc(100vh - 80px);
    overflow-y: auto; padding: 16px 20px 18px;
    background: var(--stock); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px;
    box-shadow: 0 18px 40px rgba(8, 2, 20, 0.6);
}
body:not(.in-game) #rules-popup { left: 50%; right: auto; transform: translateX(-50%); top: 16px !important; max-height: calc(100vh - 32px); }
#rules-popup h3 { font: 400 24px/1.15 var(--font-display); margin: 0 44px 8px 0; }
.rules-body p { font: 600 14.5px/1.5 var(--font-ui); margin-top: 8px; }
.rules-body b { font-weight: 900; }
#rules-popup-close { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
#rules-popup-close:hover { background: var(--stock-2); }

/* ── Dialogs: card-stock sheets with an ink edge ───────────────────────────── */
.overlay {
    position: fixed; inset: 0; z-index: 1300;
    display: grid; place-items: center; padding: 8px;
    background: rgba(18, 8, 34, 0.66);
}
.overlay.hidden { display: none; }
.panel {
    position: relative; width: min(560px, 96vw); max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 20px 24px 22px; border-radius: 22px;
    background: var(--stock); color: var(--ink);
    border: 3px solid var(--ink);
    box-shadow: 0 24px 60px rgba(8, 2, 20, 0.65);
    font-family: var(--font-ui);
}
.panel h2 { font: 400 30px/1.1 var(--font-display); color: var(--ink); }
.panel-dim { color: var(--violet-text); }

.primary-btn, .secondary-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 0 26px; border-radius: 16px; cursor: pointer; touch-action: manipulation;
    border: 3px solid var(--ink);
    font: 400 22px/1 var(--font-display); letter-spacing: 0.3px;
    transition: filter 0.12s, transform 0.12s;
}
.primary-btn { background: linear-gradient(180deg, #d6ea4a, var(--lime) 55%, #b2cb1c); color: var(--ink); box-shadow: 0 8px 16px rgba(8, 2, 20, 0.25); }
.secondary-btn, .primary-btn.alt { background: linear-gradient(180deg, #fff, var(--stock) 60%, var(--stock-2)); color: var(--ink); box-shadow: 0 4px 10px rgba(8, 2, 20, 0.12); }
@media (hover: hover) { .primary-btn:hover, .secondary-btn:hover { filter: brightness(1.05); } }
.primary-btn:active, .secondary-btn:active { transform: translateY(2px); }
.primary-btn:disabled { background: #d5d0cc; color: #6d6577; cursor: default; }
.primary-btn:focus-visible, .secondary-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* the scorecard */
.scorecard { width: min(640px, 96vw); display: flex; flex-direction: column; overflow: hidden; }
.scorecard .sc-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
.scorecard .sc-head, .scorecard .sc-btns { flex: none; }
.sc-head { text-align: center; margin-bottom: 10px; }
.sc-sub { margin-top: 4px; color: var(--violet-text); font: 700 14px/1.3 var(--font-ui); }
.sc-wrap { overflow-x: auto; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; }
.sc-table { width: 100%; border-collapse: collapse; font: 700 15px/1.2 var(--font-ui); font-variant-numeric: tabular-nums; }
.sc-table th { font: 800 12px/1 var(--font-ui); color: var(--violet-text); padding: 8px 6px; border-bottom: 2.5px solid var(--ink); text-align: center; background: var(--stock-2); }
.sc-table th.sc-name { text-align: left; }
.sc-table th.sc-tot .bull { width: 16px; height: 16px; fill: var(--bull); vertical-align: -3px; }
.sc-table td { padding: 7px 6px; border-bottom: 1px solid var(--stock-line); text-align: center; }
.sc-table tr:last-child td { border-bottom: 0; }
.sc-table td.sc-name { text-align: left; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-name i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--seat); border: 2px solid var(--ink); margin-right: 7px; vertical-align: -1px; }
.sc-place { width: 40px; color: var(--violet-text); }
.sc-r.zero { color: #9a8db3; }
.sc-r.last, .sc-r.now { background: rgba(196, 220, 42, 0.18); }
.sc-tot { font: 400 20px/1 var(--font-display); color: var(--ink); width: 64px; }
.sc-tot.hot { color: var(--red-deep); }
.sc-table tr.win td { background: rgba(196, 220, 42, 0.28); }
.sc-table tr.me .sc-name span { text-decoration: underline 2px var(--lime-deep); text-underline-offset: 3px; }
.ros-mini { position: relative; display: inline-block; width: 30px; height: 36px; vertical-align: middle; --wr: 70px; }
.ros-mini .ros-num { font-size: 15px; }
.sc-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.sc-table thead th { position: sticky; top: 0; z-index: 1; }
@media (max-height: 480px) {
    .scorecard { padding: 10px 14px 10px; border-radius: 16px; }
    .scorecard h2 { font-size: 22px; }
    .sc-head { margin-bottom: 6px; }
    .sc-sub { font-size: 12px; margin-top: 2px; }
    .sc-table td { padding: 3px 6px; }
    .sc-table th { padding: 5px 6px; }
    .sc-tot { font-size: 17px; }
    .ros-mini { width: 22px; height: 26px; }
    .ros-mini .ros-num { font-size: 11px; }
    .sc-btns { margin-top: 8px; gap: 8px; }
    .sc-btns .primary-btn, .sc-btns .secondary-btn { min-height: 44px; font-size: 18px; padding: 0 18px; }
}

/* welcome plate */
#nm-welcome { position: fixed; inset: 0; z-index: 1190; display: grid; place-items: center; pointer-events: all; }
.nm-welcome-plate {
    padding: 20px 34px 22px; text-align: center; max-width: 92vw;
    background: var(--stock); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px;
    box-shadow: 0 24px 60px rgba(8, 2, 20, 0.6);
    opacity: 0; transform: translateY(10px) scale(0.97);
    transition: opacity 0.3s ease, transform 0.45s cubic-bezier(.16, 1, .3, 1);
}
#nm-welcome.show .nm-welcome-plate { opacity: 1; transform: none; }
.nm-welcome-title { font: 400 32px/1.1 var(--font-display); }
.nm-welcome-line { margin-top: 6px; font: 700 16px/1.35 var(--font-ui); color: var(--violet-text); }
body.phone .nm-welcome-title { font-size: 24px; }
body.phone .nm-welcome-line { font-size: 13px; }

/* ── Pass & Play (core/passplay.js) in this game's card stock ──────────────── */
.pp-overlay { z-index: 1402; }
.pp-overlay.pp-conceal { background: var(--room-0); }
.pp-panel { width: min(440px, 94vw); text-align: left; }
.pp-panel h2 { text-align: center; font-size: 26px; margin-bottom: 8px; }
.pp-lead { text-align: center; color: var(--violet-text); font-weight: 700; margin-bottom: 6px; }
.pp-chairs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px; }
.pp-chair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pp-disc { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bull); color: #fff; border: 2px solid var(--ink); font: 800 12px/1 var(--font-ui); }
.pp-name, .pp-ai-label {
    flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px;
    background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 10px;
    font: 700 15px var(--font-ui);
}
.pp-ai-label { display: flex; align-items: center; border-style: dashed; color: var(--violet-text); background: var(--stock-2); }
.pp-name::placeholder { color: #8f81aa; }
.pp-icon-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; background: transparent; color: var(--ink); border: 2px solid transparent; border-radius: 10px; cursor: pointer; touch-action: manipulation; }
.pp-icon-btn:disabled { opacity: 0.3; cursor: default; }
@media (hover: hover) { .pp-icon-btn:hover:not(:disabled) { border-color: var(--ink); background: var(--stock-2); } }
.pp-kind { flex: none; display: flex; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; gap: 2px; background: #fff; }
.pp-kind-opt { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px; background: transparent; color: var(--violet-text); border: 0; border-radius: 999px; font: 800 12.5px var(--font-ui); cursor: pointer; touch-action: manipulation; }
.pp-kind-opt.on { background: var(--lime); color: var(--ink); }
.pp-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; background: transparent; color: var(--ink); border: 2px dashed var(--ink); border-radius: 10px; font: 800 14px var(--font-ui); cursor: pointer; touch-action: manipulation; }
.pp-add:disabled { display: none; }
.pp-note { margin: 8px 0 0; font-size: 13px; text-align: center; color: var(--violet-text); font-weight: 700; }
.pp-note.pp-warn { color: var(--red-deep); }
.pp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.pp-label { font: 800 14px var(--font-ui); }
.pp-levelrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pp-levelrow[hidden] { display: none; }
.pp-levels { display: flex; gap: 4px; }
.pp-level { min-height: 44px; min-width: 44px; padding: 2px 12px; border-radius: 999px; cursor: pointer; background: #fff; color: var(--ink); border: 2px solid var(--ink); font: 800 13px var(--font-ui); touch-action: manipulation; }
.pp-level.on { background: var(--lime); }
.pp-modes { display: flex; flex-direction: column; gap: 10px; }
.pp-mode { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 10px 14px; text-align: left; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; cursor: pointer; }
.pp-mode-title { font: 800 17px var(--font-ui); }
.pp-mode-sub { font: 600 13px/1.35 var(--font-ui); color: var(--violet-text); }
.pp-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pp-actions .primary-btn:disabled { opacity: 0.55; }
.pp-pass { text-align: center; width: min(380px, 92vw); }
.pp-pass-icon { color: var(--violet-text); display: grid; place-items: center; margin-bottom: 4px; }
.pp-pass-line { font: 700 15px var(--font-ui); }
.pp-panel h2.pp-pass-name { font-size: 38px; margin: 2px 0 12px; overflow-wrap: anywhere; }
@media (max-height: 460px) and (min-width: 600px) {
    .pp-panel:not(.pp-pass) { width: min(620px, 96vw); padding: 10px 18px 12px; }
    .pp-panel h2 { font-size: 20px; margin-bottom: 4px; }
    .pp-chairs { grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 4px; }
    .pp-kind-opt { min-height: 40px; padding: 0 7px; }
    .pp-kind-opt svg { display: none; }
    .pp-actions { flex-direction: row-reverse; margin-top: 8px; }
    .pp-actions .primary-btn, .pp-actions .secondary-btn { flex: 1 1 0; min-height: 44px; font-size: 18px; }
    .pp-note { margin-top: 2px; font-size: 11.5px; }
    .pp-levelrow { margin-top: 4px; }
}

/* the shared "back to the menu?" question */
#dk-back-ask .dk-back-panel { border-width: 3px !important; box-shadow: 0 24px 60px rgba(8, 2, 20, 0.65) !important; }
#dk-back-ask h2 { font-weight: 400 !important; }

/* ── Start screen: the fair poster and the entry slip ──────────────────────── */
#start-screen {
    position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; overflow: hidden;
    background:
        radial-gradient(ellipse 60% 70% at 30% 50%, rgba(140, 98, 222, 0.42), transparent 70%),
        radial-gradient(circle, rgba(255, 255, 255, 0.075) 1.1px, transparent 1.6px) 0 0 / 9px 9px,
        linear-gradient(160deg, var(--room-2), var(--room-1) 60%, var(--room-0));
    font-family: var(--font-ui);
}
.start-stage {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    display: flex; align-items: center; gap: 30px;
    width: 960px; height: 560px; flex: none;
    transform-origin: center center;
}
.start-poster { position: relative; width: 450px; height: 100%; flex: none; }
.poster-burst {
    position: absolute; left: 50%; top: 47%; width: 600px; height: 600px; transform: translate(-50%, -50%);
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(250, 227, 12, 0.2) 0deg 9deg, transparent 9deg 18deg);
    -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%);
    mask: radial-gradient(circle, #000 18%, transparent 68%);
    animation: burst 120s linear infinite;
}
@keyframes burst { to { transform: translate(-50%, -50%) rotate(360deg); } }
.poster-fan { position: absolute; left: 50%; top: 40%; width: 0; height: 0; }
.pf-card {
    position: absolute; width: 132px; height: 205px; left: -66px; top: -102px;
    border-radius: 7% / 4.5%; transform-origin: 50% 120%;
    box-shadow: 0 0 0 2px var(--ink), 0 14px 26px rgba(8, 2, 20, 0.55);
    background: var(--stock);
}
.pf-0 { transform: translateX(-150px) translateY(34px) rotate(-22deg); }
.pf-1 { transform: translateX(-78px) translateY(10px) rotate(-11deg); }
.pf-3 { transform: translateX(78px) translateY(10px) rotate(11deg); }
.pf-4 { transform: translateX(150px) translateY(34px) rotate(22deg); }
.pf-2 { width: 168px; height: 261px; left: -84px; top: -150px; z-index: 2; transform: rotate(-3deg); box-shadow: 0 0 0 3px var(--ink), 0 0 0 9px var(--sun), 0 0 0 12px var(--ink), 0 22px 40px rgba(8, 2, 20, 0.6); }
.start-title {
    position: absolute; left: 0; right: 0; bottom: 64px; z-index: 3;
    display: flex; align-items: center; justify-content: center; gap: 14px;
    font: 400 96px/1 var(--font-display); color: #fff;
    -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
    text-shadow: 0 8px 0 rgba(8, 2, 20, 0.35);
}
.start-title .wm-six { -webkit-text-stroke: 0; font-size: 0.66em; border-width: 5px; box-shadow: 0 0 0 4px var(--sun), 0 0 0 8px var(--ink); }
.start-tag {
    position: absolute; left: 0; right: 0; bottom: 22px; z-index: 3; text-align: center;
    font: 800 19px/1.2 var(--font-ui); color: var(--lime); letter-spacing: 0.3px;
}
.start-card {
    position: relative; width: 500px; flex: none;
    padding: 22px 24px 18px;
    background: var(--stock); color: var(--ink);
    border: 3.5px solid var(--ink); border-radius: 26px;
    box-shadow: 0 26px 60px rgba(8, 2, 20, 0.6);
}
.start-head h2 { font: 400 30px/1 var(--font-display); margin: 2px 56px 14px 0; }
.start-field { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: center; gap: 12px; padding: 7px 0; border-top: 2px dashed var(--stock-line); }
.start-label { font: 800 15px/1.2 var(--font-ui); color: var(--violet-text); white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.step-btn {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
    background: #fff; border: 2.5px solid var(--ink); color: var(--ink);
    font: 400 26px/1 var(--font-display); touch-action: manipulation;
}
.step-btn:disabled { background: var(--stock-2); color: #a99cc0; border-color: #a99cc0; cursor: default; }
@media (hover: hover) { .step-btn:hover:not(:disabled) { background: var(--lime); } }
.step-val { min-width: 2.2ch; text-align: center; font: 400 28px/1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.len-sub .step-val { min-width: 4.6ch; font-size: 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--stock-2); border: 2.5px solid var(--ink); border-radius: 26px; width: max-content; max-width: 100%; }
.pill {
    min-height: 44px; padding: 0 13px; border: 0; border-radius: 999px; cursor: pointer; background: transparent;
    font: 800 14.5px/1 var(--font-ui); color: var(--violet-text); white-space: nowrap; touch-action: manipulation;
}
.pill.on { background: var(--lime); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
@media (hover: hover) { .pill:not(.on):hover { color: var(--ink); background: #fff; } }
.len-row { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.len-note { min-height: 44px; display: flex; align-items: center; font: 700 13.5px/1.3 var(--font-ui); color: var(--violet-text); padding-left: 4px; }
.start-launch { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.start-launch .primary-btn, .start-launch .secondary-btn { width: 100%; min-height: 60px; font-size: 28px; }
.start-continue { flex-direction: column; gap: 3px; }
.cont-sub { font: 700 13px/1 var(--font-ui); }
.start-minor { display: flex; justify-content: center; gap: 8px; }
.start-link {
    min-height: 44px; padding: 0 14px; background: transparent; border: 0; border-radius: 10px; cursor: pointer;
    font: 800 15px/1 var(--font-ui); color: var(--violet-text); text-decoration: underline 2px; text-underline-offset: 4px;
    touch-action: manipulation;
}
.start-link:hover { color: var(--ink); background: var(--stock-2); }
a.start-link { display: inline-flex; align-items: center; }
.start-credits { margin-top: 10px; text-align: center; font: 600 12px/1.4 var(--font-ui); color: var(--violet-text); }
.start-credits b { font-weight: 800; color: var(--ink); }
.start-lang { position: absolute; right: 14px; top: 12px; }
.start-lang-btn { width: 48px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.start-lang-btn .flag { width: 32px; height: 21px; }
.start-lang-picker {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 170px; padding: 6px;
    background: var(--stock); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 14px 30px rgba(8, 2, 20, 0.45);
    display: flex; flex-direction: column; gap: 2px;
}
.start-lang-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; background: transparent; border: 0; border-radius: 10px; cursor: pointer; font: 700 15px var(--font-ui); color: var(--ink); text-align: left; }
.start-lang-opt.on { background: var(--lime); }
.start-lang-opt:hover { background: var(--stock-2); }

/* portrait tablets: the poster above the slip */
@media (orientation: portrait) and (min-height: 700px) {
    .start-stage { flex-direction: column; width: 560px; height: 980px; gap: 0; }
    .start-poster { width: 520px; height: 420px; }
    .start-card { width: 520px; }
}
/* short landscape (phones): a smaller poster beside a tighter slip */
@media (max-height: 520px) and (orientation: landscape) {
    .start-stage { width: 700px; height: 330px; gap: 14px; }
    .start-poster { width: 250px; }
    .poster-burst { width: 340px; height: 340px; }
    .poster-fan { top: 36%; }
    .pf-card { width: 70px; height: 109px; left: -35px; top: -54px; }
    .pf-0 { transform: translateX(-80px) translateY(18px) rotate(-22deg); }
    .pf-1 { transform: translateX(-42px) translateY(5px) rotate(-11deg); }
    .pf-3 { transform: translateX(42px) translateY(5px) rotate(11deg); }
    .pf-4 { transform: translateX(80px) translateY(18px) rotate(22deg); }
    .pf-2 { width: 90px; height: 140px; left: -45px; top: -80px; box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px var(--sun), 0 0 0 8px var(--ink), 0 12px 24px rgba(8, 2, 20, 0.6); }
    .start-title { font-size: 50px; bottom: 34px; gap: 8px; -webkit-text-stroke-width: 5px; }
    .start-title .wm-six { border-width: 3px; box-shadow: 0 0 0 3px var(--sun), 0 0 0 5px var(--ink); }
    .start-tag { font-size: 12.5px; bottom: 10px; }
    .start-card { width: 436px; padding: 10px 16px 8px; border-radius: 18px; }
    .start-head { display: none; }
    .start-field { grid-template-columns: 90px 1fr; padding: 3px 0; gap: 8px; }
    .start-field:first-of-type { border-top: 0; }
    .start-label { font-size: 13px; }
    .len-row { flex-direction: row; align-items: center; gap: 6px; }
    .len-note { display: none; }
    .len-sub .step-val { font-size: 16px; min-width: 4.4ch; }
    .pill { padding: 0 8px; font-size: 13px; min-height: 44px; }
    .start-launch { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
    .start-launch .primary-btn, .start-launch .secondary-btn { flex: 1 1 0; min-height: 48px; font-size: 22px; width: auto; }
    .start-minor { flex: 1 0 100%; }
    .start-link { min-height: 44px; font-size: 13.5px; }
    .start-credits { margin-top: 0; font-size: 10.5px; }
    .start-lang { right: 6px; top: 4px; }
}

/* ── Phones held upright ───────────────────────────────────────────────────── */
#nm-rotate { display: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 559px) {
    body.in-game #nm-rotate {
        display: grid; place-items: center; position: fixed; inset: 0; z-index: 5000;
        background: var(--room-1); color: var(--lime);
    }
}

@media (prefers-reduced-motion: reduce) {
    .poster-burst, .ai-pending .ai-lamp, .take-chip { animation: none; }
    .bull-pop { animation-duration: 0.9s; }
    .hand-card, .lane, .plate, .tray-card, .nm-welcome-plate, #status-line { transition: none; }
}

/* ── Online scorecard: the "Next round" vote ─────────────────────────────── */
.sc-btns .sc-wait { font: 800 13px/1.3 var(--font-ui); color: var(--violet-text); align-self: center; }
.sc-note { margin-top: 8px; text-align: center; font: 700 12.5px/1.35 var(--font-ui); color: var(--violet-text); }

/* ── #intro: the page's crawlable text, below the fold ─────────────────────────
   margin-top is load-order insurance: #header-bar, #game and #start-screen are all fixed, so
   this is the only content in normal flow — without the offset it would paint for the frame or
   two before game.js mounts the start screen over it. Never display:none (see index.html). */
#intro {
    margin: 100vh auto 0; max-width: 720px; padding: 18px 22px 16px; text-align: center;
    color: var(--ink); background: var(--stock); border: 3px solid var(--ink); border-radius: 22px;
    font: 600 14px/1.55 var(--font-ui);
}
#intro h1 { font: 400 30px/1.1 var(--font-display); margin-bottom: 4px; }
#intro .intro-tagline { color: var(--violet-text); font: 800 12px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
#intro h2 { font: 400 19px/1.2 var(--font-display); margin: 14px 0 4px; }
#intro p { margin-bottom: 8px; }
#intro a { color: var(--violet-text); font-weight: 800; text-decoration: underline; }
#intro a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
#intro .intro-links { margin-top: 12px; font-size: 13.5px; }
#intro .intro-credit { margin-top: 12px; font-size: 12px; color: var(--violet-text); }
