/* Doubt (ダウト) — the look, and where each value came from.
 *
 * WORLD  A Japanese home game on a winter evening: a kotatsu (keyaki-wood top over a quilted
 *        kakebuton) standing on tatami, under one warm lamp. ダウト is a family / school-trip game,
 *        so this is a living room, not a casino.
 * CARDS  The face is washi, sampled from the court art's own ground (assets/gen/raw/Jh.jpg ≈
 *        rgb(247,240,220)) → --washi #f6eedb; ink is sumi #1b1712 and shu (vermilion) #b8321f,
 *        the court art's line and robe-red, so the CSS number cards and the ukiyo-e courts print in
 *        ONE ink on ONE paper. A hairline frame (inset, 18% sumi) is printed on every face —
 *        composited courts should carry the same frame (see art.js / the build report).
 * SIGNAL shu #d23a22 means one thing: the doubt — the 「ダウト！」 button, the call, the LIE stamp.
 *        Truth is aizome indigo (#2f4f8f on paper). Neither colour is used for decoration.
 * ACCENT aizome indigo for the UI (primary buttons, focus) — chosen from the indigo seigaiha back,
 *        not from taste; the nearest neighbours' indigos (#2f6bb5, #1f3f96) sit on blue felt or
 *        dark chrome, ours sits on washi and keyaki, so the material, not the hue, sets us apart.
 * TYPE   Dela Gothic One (OFL, self-hosted subset) — a heavy Japanese gothic with manga-sign
 *        energy — for 「ダウト！」, the wordmark and the big rank; Zen Maru Gothic (OFL, subset) for
 *        the UI. Devanagari falls back to the system face (Nirmala UI / Noto Sans Devanagari).
 * SEATS  six traditional inks (shu, ai, matcha, yamabuki, fuji, momo) differing in lightness; a
 *        seat is always named in words as well.
 */
@font-face { font-family: 'Dela'; src: url('assets/fonts/dela.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'ZenMaru'; font-weight: 500; src: url('assets/fonts/zenmaru-500.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'ZenMaru'; font-weight: 700; src: url('assets/fonts/zenmaru-700.woff2') format('woff2'); font-display: swap; }

:root {
    --washi: #f7f0e0;          /* the finished faces' paper (lead's compose_cards.py) */
    --washi-2: #ece1c6;
    --sumi: #1b1712;
    --sumi-2: #3a3128;
    --shu: #d23a22;
    --shu-ink: #b8321f;
    --shu-deep: #8f2414;
    --ai: #2f4f8f;
    --ai-deep: #1c2c52;
    --ai-night: #121b33;
    --keyaki: #9a6538;
    --keyaki-dark: #5c3a1f;
    --lamp: #ffd99a;
    --tatami: #7a7443;
    --font-display: 'Dela', 'Hiragino Kaku Gothic StdN', 'Yu Gothic', sans-serif;
    --font-ui: 'ZenMaru', 'Nirmala UI', 'Noto Sans Devanagari', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', system-ui, sans-serif;
    --card-w: 80px;
    --header-h: 52px;
    --dk-card-red: #b2221e;    /* the court faces' printed index inks, so A–10 and J/Q/K match */
    --dk-card-black: #1a1c28;
    --dk-card-font: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #17120c; }
body { font-family: var(--font-ui); color: var(--washi); -webkit-tap-highlight-color: transparent; }
button { font-family: var(--font-ui); touch-action: manipulation; }
::selection { background: var(--shu); color: var(--washi); }
:focus-visible { outline: 3px solid #8fb0ec; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── The room: tatami under one lamp ───────────────────────────────────────────────────────── */
#game {
    position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none;
    background:
        radial-gradient(ellipse 70% 62% at 50% 56%, rgba(255, 214, 150, 0.20), rgba(255, 214, 150, 0) 70%),
        radial-gradient(ellipse 120% 100% at 50% 50%, rgba(10, 8, 5, 0) 40%, rgba(10, 8, 5, 0.78) 100%),
        /* the heri: dark cloth borders where the mats meet */
        linear-gradient(90deg, transparent calc(50% - 5px), #2c2a1c calc(50% - 5px), #3b3724 50%, #2c2a1c calc(50% + 5px), transparent calc(50% + 5px)) 0 0 / 50vw 100%,
        /* the rush weave */
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.09) 0 1px, rgba(255, 255, 255, 0.025) 1px 3px, rgba(0, 0, 0, 0) 3px 5px),
        linear-gradient(180deg, #5d5a33, #4b482a 60%, #3c3a22);
}
body:not(.in-game) #game { visibility: hidden; }

/* the quilt (kakebuton) skirting out from under the kotatsu top */
#futon {
    position: absolute; border-radius: 38px; pointer-events: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='16' viewBox='0 0 28 16'%3E%3Cpath d='M0 8 7 0h14l7 8-7 8H7z' fill='none' stroke='%23e9dfc4' stroke-opacity='.10' stroke-width='1'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 50% 45%, #2b3f6e 0%, #1d2c50 60%, #15203c 100%);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 3px rgba(233, 223, 196, 0.06), inset 0 -18px 40px rgba(0, 0, 0, 0.35);
}
#futon::after {   /* a persimmon border band sewn round the quilt */
    content: ''; position: absolute; inset: 7px; border-radius: 32px;
    border: 2px solid rgba(214, 120, 64, 0.45);
}
/* the kotatsu top: keyaki board, a darker lacquered rim, the lamp's pool in the middle */
#kotatsu {
    position: absolute; border-radius: 16px; pointer-events: none;
    background:
        radial-gradient(ellipse 60% 55% at 50% 48%, rgba(255, 225, 170, 0.22), rgba(255, 225, 170, 0) 70%),
        repeating-linear-gradient(92deg, rgba(60, 34, 14, 0.10) 0 2px, rgba(0, 0, 0, 0) 2px 9px, rgba(255, 230, 190, 0.05) 9px 11px, rgba(0, 0, 0, 0) 11px 23px),
        linear-gradient(180deg, #8b5a31, #7a4d29 55%, #6b4223);
    box-shadow:
        inset 0 0 0 7px #4d2f17, inset 0 0 0 8px rgba(255, 220, 170, 0.18), inset 0 10px 18px rgba(255, 225, 170, 0.10),
        0 18px 30px rgba(0, 0, 0, 0.5);
}
#game.short #kotatsu { box-shadow: inset 0 0 0 4px #4d2f17, inset 0 0 0 5px rgba(255, 220, 170, 0.16), 0 10px 18px rgba(0, 0, 0, 0.5); }

#opp-layer, #centre-layer, #tag-layer, #hand-layer { position: absolute; inset: 0; pointer-events: none; }
#hand-layer { pointer-events: none; }
#fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 900; }

/* ── Cards: our box, core/cards' print ─────────────────────────────────────────────────────── */
.card {
    position: absolute; width: var(--card-w); height: calc(var(--card-w) * 1.42);
    border-radius: calc(var(--card-w) * 0.075);
    background-color: var(--washi);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23f)'/%3E%3C/svg%3E");
    box-shadow:
        inset 0 0 0 calc(var(--card-w) * 0.04) var(--washi),
        inset 0 0 0 calc(var(--card-w) * 0.04 + 1px) rgba(27, 23, 18, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 2px 5px rgba(0, 0, 0, 0.45);
    touch-action: none;
    overflow: hidden;
}
.card.dk-face .dk-rank { letter-spacing: -0.02em; }
.card.dk-face .dk-rank, .card.dk-face .dk-court-rank { font-weight: 700; }

/* a court with its ukiyo-e art: the picture is the face, the CSS index rides on top */
.card.dz-court { background: var(--dz-art) center / 100% 100% no-repeat; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); }
.card.dz-court > * { display: none; }
.card.dz-court .dk-centre { display: none; }
.card.dz-court.dz-noindex .dk-corner { display: none; }
.card.dz-court .dk-corner { background: rgba(246, 238, 219, 0.86); border-radius: 3px; padding: 1px 2px; }

/* the kitsune joker (drawn until joker.webp lands) */
.card.dz-joker { color: var(--shu-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card.dz-joker[style*='--dz-art'] { background-image: var(--dz-art); background-size: 100% 100%; }
.dz-jk-word { position: absolute; top: 7%; left: 8%; font: 800 calc(var(--card-w) * 0.13) / 1 var(--font-display); writing-mode: vertical-rl; letter-spacing: 0.04em; }
.dz-jk-b { top: auto; left: auto; bottom: 7%; right: 8%; transform: rotate(180deg); }
.dz-jk-kanji {
    width: 52%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
    background: var(--shu); color: var(--washi); font: calc(var(--card-w) * 0.34) / 1 var(--font-display);
    box-shadow: 0 0 0 calc(var(--card-w) * 0.02) var(--washi), 0 0 0 calc(var(--card-w) * 0.035) var(--shu);
}

/* the back: indigo seigaiha inside a washi margin, a shu seal in the middle */
.card.dz-back, .card.dk-back {
    background-color: var(--washi);
    background-image:
        var(--seal, radial-gradient(circle at 50% 50%, var(--shu) 0 calc(var(--card-w) * 0.085), var(--washi) calc(var(--card-w) * 0.085 + 0.5px) calc(var(--card-w) * 0.11), transparent calc(var(--card-w) * 0.11 + 0.5px))),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cdefs%3E%3Cg id='s'%3E%3Ccircle r='20' fill='%231c2c52'/%3E%3Cg fill='none' stroke='%23e9dfc4' stroke-opacity='.55' stroke-width='1.3'%3E%3Ccircle r='17.5'/%3E%3Ccircle r='13'/%3E%3Ccircle r='8.5'/%3E%3Ccircle r='4'/%3E%3C/g%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='0'/%3E%3Cuse href='%23s' x='40' y='0'/%3E%3Cuse href='%23s' x='20' y='10'/%3E%3Cuse href='%23s' x='0' y='20'/%3E%3Cuse href='%23s' x='40' y='20'/%3E%3Cuse href='%23s' x='20' y='30'/%3E%3C/svg%3E");
    background-size: auto, calc(var(--card-w) * 0.42) calc(var(--card-w) * 0.21);
    background-repeat: no-repeat, repeat;
    background-position: center, center;
    background-origin: padding-box, content-box;
    background-clip: padding-box, content-box;
    padding: calc(var(--card-w) * 0.07);
    border: none;
}
.card.dz-back[style*='--dz-art'] { background-image: var(--dz-art); background-size: 100% 100%; padding: 0; }

/* the human's hand */
.hand-card { pointer-events: none; transition: left 200ms cubic-bezier(.16, 1, .3, 1), top 200ms cubic-bezier(.16, 1, .3, 1); }
.hand-card.playable { pointer-events: auto; cursor: pointer; }
.hand-card.playable:hover:not(.selected) { filter: brightness(1.07); }
.hand-card.selected {
    box-shadow:
        inset 0 0 0 calc(var(--card-w) * 0.04) var(--washi),
        inset 0 0 0 calc(var(--card-w) * 0.04 + 1px) rgba(27, 23, 18, 0.18),
        0 0 0 3px var(--ai), 0 0 0 5px var(--washi), 0 10px 16px rgba(0, 0, 0, 0.5);
}
.hand-card:focus-visible { outline: 3px solid #8fb0ec; outline-offset: 1px; }
.opp-card, .pile-card { pointer-events: none; }
.opp-card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.pile-card { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); }
.pile-empty {
    position: absolute; border-radius: 8px; border: 2px dashed rgba(246, 238, 219, 0.22);
    background: rgba(0, 0, 0, 0.08);
}
.ghost { pointer-events: none; will-change: transform; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45); }
.staged { pointer-events: none; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55); animation: staged-in 200ms ease-out both; }
.staged.is-false { filter: saturate(0.85); }
.staged.is-false::after { content: ''; position: absolute; inset: 0; background: rgba(210, 58, 34, 0.14); }
@keyframes staged-in { from { transform: scale(0.96); } to { transform: none; } }

/* ── The middle: the pile, its count, the rank ─────────────────────────────────────────────── */
.pile-count {
    position: absolute; z-index: 300; min-width: 28px; height: 28px; padding: 0 7px; transform: translate(-60%, -40%);
    border-radius: 14px; background: var(--sumi); color: var(--washi); display: grid; place-items: center;
    font: 700 14px/1 var(--font-ui); box-shadow: 0 0 0 2px var(--washi-2), 0 3px 6px rgba(0, 0, 0, 0.4);
}
#game.short .pile-count { min-width: 24px; height: 24px; font-size: 12px; }
.rank-wheel {
    position: absolute; border-radius: 50%;
    background: radial-gradient(circle, var(--washi) 0 38%, #e9dcbc 39% 60%, var(--washi) 61%);
    box-shadow: 0 0 0 2px var(--keyaki-dark), 0 4px 10px rgba(0, 0, 0, 0.45);
    color: var(--sumi);
}
.rank-wheel .rw-t {
    position: absolute; transform: translate(-50%, -50%); font: 700 calc(var(--card-w) * 0.13) / 1 var(--font-ui);
    color: rgba(27, 23, 18, 0.7);
}
#game.short .rank-wheel .rw-t { font-size: 10px; }
.rank-wheel .rw-t.on { color: var(--washi); background: var(--shu); border-radius: 50%; width: 1.9em; height: 1.9em; display: grid; place-items: center; font-weight: 700; }
.rank-wheel .rw-big {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%);
    font: calc(var(--card-w) * 0.42) / 1 var(--font-display); color: var(--sumi); letter-spacing: -0.04em;
}
.rank-wheel.bluff { background: var(--washi); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rank-wheel.bluff .rw-big { position: static; transform: none; }
.rank-wheel .rw-cap { font: 700 10px/1 var(--font-ui); text-transform: uppercase; letter-spacing: 0.06em; color: var(--sumi-2); }
.rank-wheel .rw-free { color: var(--ai); }
.claim-plate {
    position: absolute; transform: translateX(-50%); z-index: 310; display: none; align-items: center; gap: 8px; white-space: nowrap;
    padding: 0 10px; border-radius: 6px; background: rgba(27, 23, 18, 0.82); color: var(--washi);
    font: 700 13px/1 var(--font-ui); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.claim-plate.on { display: flex; }
.claim-plate.side { transform: none; flex-direction: column; align-items: flex-start; gap: 3px; height: auto !important; padding: 5px 7px; }
.claim-plate .cp-who { max-width: 9em; overflow: hidden; text-overflow: ellipsis; color: var(--washi); }
.claim-plate .cp-who::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-right: 6px; vertical-align: 1px; }
.claim-plate .cp-claim { font-family: var(--font-display); font-weight: 400; font-size: 15px; letter-spacing: 0.02em; color: #ffd6b0; }
#game.short .claim-plate { font-size: 11px; gap: 6px; padding: 0 7px; }
#game.short .claim-plate .cp-claim { font-size: 12px; }

/* ── Seat plates ───────────────────────────────────────────────────────────────────────────── */
.seat-tag {
    position: absolute; z-index: 400; display: flex; align-items: center; gap: 7px; white-space: nowrap; pointer-events: none;
    height: 44px; padding: 0 10px 0 9px; border-radius: 8px;
    background: linear-gradient(180deg, #f4ead2, #e8dbbb); color: var(--sumi);
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.35), 0 4px 10px rgba(0, 0, 0, 0.35);
    font: 700 14px/1 var(--font-ui);
    transition: box-shadow 200ms ease;
}
#game.short .seat-tag { height: 34px; padding: 0 7px; gap: 5px; font-size: 12px; }
.seat-tag .tg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px rgba(27, 23, 18, 0.25); flex: none; }
.seat-tag .tg-name { max-width: 7.5em; overflow: hidden; text-overflow: ellipsis; }
#game.short .seat-tag .tg-name { max-width: 6em; }
.seat-tag .tg-count {
    min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; display: grid; place-items: center;
    background: var(--sumi); color: var(--washi); font: 700 13px/1 var(--font-ui);
}
#game.short .seat-tag .tg-count { min-width: 22px; height: 22px; font-size: 12px; }
.seat-tag .tg-claim { font: 13px/1 var(--font-display); color: var(--sumi-2); padding: 4px 6px; border-radius: 4px; background: rgba(27, 23, 18, 0.08); }
.seat-tag .tg-pass { font-size: 12px; color: #5b4f40; font-style: italic; }
.seat-tag .tg-place { font: 13px/1 var(--font-display); color: var(--washi); background: var(--ai); padding: 4px 6px; border-radius: 4px; }
.seat-tag.on-turn { box-shadow: 0 0 0 3px var(--lamp), 0 0 0 4px rgba(27, 23, 18, 0.5), 0 6px 14px rgba(0, 0, 0, 0.4); }
.seat-tag.answering { box-shadow: 0 0 0 2px var(--washi), 0 0 0 4px rgba(143, 176, 236, 0.9), 0 6px 14px rgba(0, 0, 0, 0.4); }
.seat-tag.out { opacity: 0.85; background: linear-gradient(180deg, #e2d8c0, #d4c7a6); }
#my-tag { position: absolute; z-index: 450; }
#my-tag.above { z-index: 450; }

/* ── The action strip: the status line and the buttons, over the hand ──────────────────────── */
#status-line {
    position: absolute; z-index: 500; display: flex; align-items: center; justify-content: flex-end; pointer-events: none;
    transform: none; right: auto; bottom: auto; margin: 0;
}
#status-msg {
    max-width: 100%; padding: 8px 14px; border-radius: 8px; background: rgba(18, 13, 8, 0.78); color: var(--washi);
    font: 700 15px/1.25 var(--font-ui); opacity: 0; transition: opacity 160ms ease; text-align: right;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    white-space: normal; text-shadow: none; letter-spacing: 0;
}
#status-line.show #status-msg { opacity: 1; }
#status-msg.msg-alert { background: var(--shu-deep); }
#status-msg.msg-good { background: var(--ai-deep); }
#status-line.shake #status-msg { animation: shake 320ms ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
#game.short #status-msg { font-size: 12.5px; padding: 6px 10px; }

#action-bar { position: absolute; z-index: 520; display: flex; align-items: center; gap: 10px; pointer-events: none; }
#action-bar > * { pointer-events: auto; }
.act-btn {
    min-height: 48px; min-width: 48px; padding: 0 20px; border-radius: 10px; border: none; cursor: pointer;
    font: 700 16px/1 var(--font-ui); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
    color: var(--sumi); background: linear-gradient(180deg, #f6eedb, #e6d7b5);
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.3), 0 3px 6px rgba(80, 60, 30, 0.45), 0 8px 16px rgba(0, 0, 0, 0.3);
    transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}
.act-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.3), 0 1px 3px rgba(80, 60, 30, 0.45), 0 3px 6px rgba(0, 0, 0, 0.3); }
.act-btn.act-primary { color: var(--washi); background: linear-gradient(180deg, #3d62aa, var(--ai)); box-shadow: 0 0 0 1px rgba(15, 26, 51, 0.5), 0 3px 6px rgba(15, 26, 51, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3); }
.act-btn.act-primary .ab-claim { font: 17px/1 var(--font-display); font-weight: 400; color: #ffe2c4; }
.act-btn:disabled { cursor: default; color: #6f6556; background: #cfc2a3; box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.3); }
.act-btn.act-primary:disabled { color: #c9cfdc; background: #4c5a78; box-shadow: 0 0 0 1px #0f1a33; }
.act-btn.act-quiet { background: rgba(246, 238, 219, 0.9); }
.act-btn.act-claim.need { box-shadow: 0 0 0 2px var(--ai), 0 3px 0 #a8916a, 0 6px 12px rgba(0, 0, 0, 0.35); }
.act-btn.act-claim b { font: 17px/1 var(--font-display); font-weight: 400; color: var(--shu-ink); }
.ad-key {
    font: 700 11px/1 var(--font-ui); padding: 3px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.55;
}
@media (hover: none) { .ad-key { display: none; } }
/* 「ダウト！」 — the signature: a shu stamp you slam */
.act-doubt {
    position: relative; min-height: 56px; padding: 0 22px 0 24px; border: none; cursor: pointer; border-radius: 12px;
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--washi); background: linear-gradient(180deg, #e2492f, var(--shu) 55%, #b92f19);
    box-shadow: 0 0 0 2px var(--washi), 0 0 0 4px var(--shu-deep), 0 5px 8px 3px rgba(110, 27, 15, 0.7), 0 12px 22px rgba(0, 0, 0, 0.5);
    transform: rotate(-3deg);
    animation: doubt-in 260ms cubic-bezier(.2, 1.6, .4, 1) both;
    transition: transform 70ms ease, box-shadow 70ms ease;
}
.act-doubt .ad-jp { font: 30px/1 var(--font-display); letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(110, 27, 15, 0.6); }
.act-doubt:active { transform: rotate(-3deg) translateY(4px); box-shadow: 0 0 0 2px var(--washi), 0 0 0 4px var(--shu-deep), 0 1px 4px 3px rgba(110, 27, 15, 0.7), 0 4px 8px rgba(0, 0, 0, 0.5); }
.act-doubt:hover { filter: brightness(1.06); }
@keyframes doubt-in { from { transform: rotate(-3deg) scale(0.6); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
#game.short .act-doubt { min-height: 44px; padding: 0 14px 0 16px; }
#game.short .act-doubt .ad-jp { font-size: 22px; }
#game.short .act-btn { min-height: 44px; padding: 0 14px; font-size: 14px; }

/* the rank picker (Bluff, naming a rank) */
#rank-picker {
    position: fixed; z-index: 700; padding: 10px 12px 12px; border-radius: 12px;
    background: var(--washi); color: var(--sumi); box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.4), 0 14px 30px rgba(0, 0, 0, 0.55);
    max-width: calc(100vw - 12px);
}
#rank-picker .rp-h { font: 700 14px/1.2 var(--font-ui); margin-bottom: 8px; }
#rank-picker .rp-row { display: grid; grid-template-columns: repeat(13, 44px); gap: 4px; }
@media (max-width: 660px) { #rank-picker .rp-row { grid-template-columns: repeat(7, 44px); } }
.rp-chip {
    width: 44px; height: 44px; border-radius: 8px; border: none; cursor: pointer; background: #fff8e8; color: var(--sumi);
    font: 18px/1 var(--font-display); box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.3), 0 2px 0 #c7b58f;
}
.rp-chip.on, .rp-chip:hover { background: var(--ai); color: var(--washi); }

/* ── Moments: the call, the verdict, small words, banners ──────────────────────────────────── */
.callout {
    position: fixed; z-index: 960; transform: translate(-50%, -50%) rotate(-6deg); pointer-events: none;
    padding: 10px 20px 12px; border-radius: 10px; background: var(--shu); color: var(--washi);
    box-shadow: 0 0 0 3px var(--washi), 0 0 0 6px var(--shu-deep), 0 16px 30px rgba(0, 0, 0, 0.55);
    font: 38px/1 var(--font-display); letter-spacing: 0.02em; white-space: nowrap;
    animation: callout 1.5s cubic-bezier(.16, 1, .3, 1) both;
}
.callout::after {   /* manga speed lines */
    content: ''; position: absolute; inset: -26px -40px; z-index: -1; border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(246, 238, 219, 0.55) 0 2deg, transparent 2deg 14deg);
    -webkit-mask: radial-gradient(closest-side, transparent 55%, #000 62%, transparent 100%);
    mask: radial-gradient(closest-side, transparent 55%, #000 62%, transparent 100%);
}
@keyframes callout {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(2.1); }
    12% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(0.94); }
    20% { transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(1.04); }
}
#game.short ~ #fly-layer .callout, body .callout.small { font-size: 28px; }
.verdict {
    position: fixed; z-index: 970; transform: translate(-50%, -50%) rotate(-10deg); pointer-events: none;
    display: flex; flex-direction: column; align-items: center; padding: 10px 22px 12px; border-radius: 12px;
    border: 5px solid currentColor; background: rgba(246, 238, 219, 0.9);
    animation: stamp 420ms cubic-bezier(.2, 1.5, .4, 1) both;
}
.verdict .vd-jp { font: 52px/1 var(--font-display); letter-spacing: 0.04em; }
.verdict .vd-w { font: 700 16px/1 var(--font-ui); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 4px; }
.verdict.v-lie { color: var(--shu); }
.verdict.v-true { color: var(--ai); }
.verdict.away { animation: stamp-away 260ms ease-in forwards; }
@keyframes stamp { from { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(2.4); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg) scale(1); } }
@keyframes stamp-away { to { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(0.9); } }
.seat-word {
    position: fixed; z-index: 950; transform: translate(-50%, -100%); pointer-events: none;
    padding: 4px 9px; border-radius: 6px; background: var(--sumi); color: var(--washi); font: 700 13px/1 var(--font-ui);
    animation: word 900ms ease both;
}
.seat-word.ok { background: #e8dcbf; color: var(--sumi); }
@keyframes word { 0% { opacity: 0; transform: translate(-50%, -60%); } 20%, 75% { opacity: 1; transform: translate(-50%, -100%); } 100% { opacity: 0; transform: translate(-50%, -120%); } }
.banner {
    position: fixed; left: 50%; top: 46%; z-index: 940; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
    padding: 12px 22px; border-radius: 10px; background: rgba(18, 13, 8, 0.88); color: var(--washi);
    font: 700 18px/1.2 var(--font-ui); box-shadow: 0 0 0 1px rgba(246, 238, 219, 0.25), 0 14px 28px rgba(0, 0, 0, 0.5);
    animation: banner 1.4s cubic-bezier(.16, 1, .3, 1) both; max-width: calc(100vw - 24px);
}
.banner.out { background: var(--ai-deep); }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }

/* ── Welcome plate ─────────────────────────────────────────────────────────────────────────── */
#dz-welcome { position: fixed; inset: 0; z-index: 1190; display: grid; place-items: center; opacity: 0; transition: opacity 300ms ease; }
#dz-welcome.show { opacity: 1; }
#dz-welcome .wl-plate {
    max-width: min(520px, calc(100vw - 32px)); padding: 22px 30px 20px; border-radius: 14px; text-align: center;
    background: var(--washi); color: var(--sumi); transform: translateY(10px); transition: transform 300ms cubic-bezier(.16, 1, .3, 1);
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.4), 0 0 0 6px rgba(246, 238, 219, 0.2), 0 24px 48px rgba(0, 0, 0, 0.55);
}
#dz-welcome.show .wl-plate { transform: none; }
.wl-title { font: 26px/1.15 var(--font-display); }
.wl-line { font: 700 18px/1.3 var(--font-ui); margin-top: 8px; color: var(--ai); }
.wl-sub { font: 500 14px/1.4 var(--font-ui); margin-top: 8px; color: var(--sumi-2); }

/* ── Header: a strip of keyaki along the top ───────────────────────────────────────────────── */
#header-bar {
    position: fixed; left: 0; right: 0; top: 0; height: var(--header-h); z-index: 800;
    display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;
    background: linear-gradient(180deg, #6e4526, #5a381e); color: var(--washi);
    box-shadow: inset 0 -2px 0 #3d2511, 0 4px 12px rgba(0, 0, 0, 0.45);
}
body:not(.in-game) #header-bar { display: none; }
.hd-btn {
    min-width: 44px; height: 44px; border: none; border-radius: 8px; background: transparent; color: var(--washi);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; cursor: pointer;
    font: 700 14px/1 var(--font-ui);
}
.hd-btn svg { width: 22px; height: 22px; pointer-events: none; }
.hd-btn:hover, .hd-btn.active { background: rgba(246, 238, 219, 0.12); }
.hd-btn.active { box-shadow: inset 0 0 0 1px rgba(246, 238, 219, 0.4); }
#hd-title {
    position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: baseline; gap: 8px; pointer-events: none;
    white-space: nowrap;
}
.hd-name { font: 22px/1 var(--font-display); letter-spacing: 0.02em; }
.hd-kana { font: 13px/1 var(--font-display); color: #ffb79a; }
#hd-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
#ai-indicator {
    position: relative; height: 32px; padding: 0 10px; margin-right: 6px; border-radius: 16px; display: inline-flex; align-items: center; gap: 7px;
    background: rgba(18, 13, 8, 0.35); box-shadow: inset 0 0 0 1px rgba(246, 238, 219, 0.25); font: 700 12px/1 var(--font-ui);
    cursor: pointer; white-space: nowrap;
}
#ai-indicator::before { content: ''; position: absolute; inset: -6px -2px; }
.ai-lamp { width: 8px; height: 8px; border-radius: 50%; background: #8a8478; }
.ai-onnx .ai-lamp { background: #9be36d; box-shadow: 0 0 6px #9be36d; }
.ai-ready .ai-lamp { background: transparent; box-shadow: inset 0 0 0 2px #9be36d; }
.ai-heuristic .ai-lamp { background: var(--lamp); }
#ai-indicator-detail {
    position: absolute; top: calc(100% + 8px); right: 0; width: 260px; display: none; z-index: 850; white-space: normal;
    padding: 12px 14px; border-radius: 10px; background: var(--washi); color: var(--sumi); text-align: left;
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.35), 0 12px 28px rgba(0, 0, 0, 0.5); font: 500 13px/1.4 var(--font-ui);
}
#ai-indicator:hover #ai-indicator-detail, #ai-indicator.tip-open #ai-indicator-detail { display: block; }
@media (hover: none) { #ai-indicator:hover:not(.tip-open) #ai-indicator-detail { display: none; } }
.ai-detail-head { font: 700 14px/1.2 var(--font-ui); margin-bottom: 6px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 10px; }
.ai-detail-row b { text-align: right; }
.ai-detail-note { margin-top: 6px; color: var(--sumi-2); }
@media (max-height: 479px) {
    .hd-name { font-size: 18px; }
    .hd-kana { display: none; }
    .hd-lbl { display: none; }
    #ai-indicator { padding: 0 8px; }
    #ai-indicator .ai-word { display: none; }
}
@media (max-width: 760px) { .hd-lbl { display: none; } #ai-indicator .ai-word { display: none; } }
@media (max-width: 980px) { .hd-kana { display: none; } }

/* ── Side panels: the log, the AI's decisions ──────────────────────────────────────────────── */
.side-panel {
    position: fixed; right: 10px; top: calc(var(--header-h) + 8px); z-index: 820; width: min(340px, calc(100vw - 20px));
    max-height: calc(100vh - var(--header-h) - 18px); display: flex; flex-direction: column;
    border-radius: 12px; background: var(--washi); color: var(--sumi);
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.4), 0 16px 34px rgba(0, 0, 0, 0.55);
}
.sp-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 14px; border-bottom: 1px solid rgba(27, 23, 18, 0.15); font: 700 15px/1 var(--font-ui); }
.sp-x { width: 44px; height: 44px; border: none; background: none; font-size: 18px; cursor: pointer; color: var(--sumi); border-radius: 8px; }
.sp-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 12px; font: 500 13.5px/1.45 var(--font-ui); }
.lg { padding: 3px 0; }
.lg-q { color: #5b4f40; }
.lg-sys { color: #5b4f40; font-style: italic; }
.lg-div { border-top: 1px dashed rgba(27, 23, 18, 0.22); margin: 6px 0; }
.lg-name { font-weight: 700; color: var(--sumi); }
.lg-name::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-right: 5px; vertical-align: 1px; }
.lg-doubt { padding: 6px 8px; margin: 2px 0; border-radius: 8px; background: rgba(210, 58, 34, 0.08); }
.lg-cards { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.lg-card { display: inline-block; padding: 1px 4px; border-radius: 3px; background: #fffaf0; box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.25); font: 700 12px/1.3 var(--font-ui); color: var(--sumi); }
.lg-card.red { color: var(--shu-ink); }
.lg-card.jk { color: var(--shu-ink); }
.lg-v { font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.lg-v.t { color: var(--washi); background: var(--ai); }
.lg-v.l { color: var(--washi); background: var(--shu); }
.lg-v.h { color: #5b4f40; background: rgba(27, 23, 18, 0.08); }
.lg-out { font-weight: 700; color: var(--ai); }
.ai-row { padding: 6px 0; border-bottom: 1px solid rgba(27, 23, 18, 0.08); }
.ai-src { font-size: 11px; color: #5b4f40; margin-left: 4px; }
.ai-dt { color: var(--shu-ink); }
.sp-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(27, 23, 18, 0.15); color: #5b4f40; font-size: 12px; }

/* ── Game over: the result slip ────────────────────────────────────────────────────────────── */
#game-over-modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(12, 9, 6, 0.55); }
#game-over-modal.hidden { display: none; }
.go-panel {
    position: relative; width: 420px; padding: 26px 28px 22px; border-radius: 14px; text-align: center;
    background: var(--washi); color: var(--sumi); box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.4), 0 28px 60px rgba(0, 0, 0, 0.6);
}
#go-stamp {
    position: absolute; right: 18px; top: 14px; transform: rotate(8deg); padding: 6px 8px; border: 3px solid var(--shu); border-radius: 8px;
    color: var(--shu); font: 20px/1 var(--font-display); writing-mode: vertical-rl;
}
#go-title { font: 28px/1.15 var(--font-display); margin: 4px 40px 14px; }
#go-ranking { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.go-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 8px; background: rgba(27, 23, 18, 0.05); font: 700 15px/1 var(--font-ui); }
.go-row.first { background: rgba(47, 79, 143, 0.12); }
.go-row.me .go-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.go-place { width: 3em; text-align: left; font-family: var(--font-display); font-weight: 400; color: var(--ai); }
.go-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-name::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); margin-right: 8px; }
.go-left { color: #5b4f40; font-weight: 500; font-size: 13px; }
.go-btns { display: flex; gap: 10px; justify-content: center; }

/* ── Start screen: a washi sheet on the kotatsu ────────────────────────────────────────────── */
#start-screen {
    position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
    background:
        radial-gradient(ellipse 60% 70% at 50% 50%, rgba(255, 214, 150, 0.18), rgba(0, 0, 0, 0) 70%),
        radial-gradient(ellipse 110% 100% at 50% 50%, rgba(10, 8, 5, 0) 45%, rgba(10, 8, 5, 0.8) 100%),
        repeating-linear-gradient(92deg, rgba(60, 34, 14, 0.12) 0 2px, rgba(0, 0, 0, 0) 2px 9px, rgba(255, 230, 190, 0.05) 9px 11px, rgba(0, 0, 0, 0) 11px 23px),
        linear-gradient(180deg, #7d5030, #6b4223);
}
#start-screen::before {   /* cards strewn on the kotatsu, out of focus */
    content: ''; position: absolute; width: 140px; height: 199px; left: 8%; top: 12%; transform: rotate(-14deg);
    border-radius: 10px; opacity: 0.5; filter: blur(1px);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cdefs%3E%3Cg id='s'%3E%3Ccircle r='20' fill='%231c2c52'/%3E%3Cg fill='none' stroke='%23e9dfc4' stroke-opacity='.55' stroke-width='1.3'%3E%3Ccircle r='17.5'/%3E%3Ccircle r='13'/%3E%3Ccircle r='8.5'/%3E%3Ccircle r='4'/%3E%3C/g%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='0'/%3E%3Cuse href='%23s' x='40' y='0'/%3E%3Cuse href='%23s' x='20' y='10'/%3E%3Cuse href='%23s' x='0' y='20'/%3E%3Cuse href='%23s' x='40' y='20'/%3E%3Cuse href='%23s' x='20' y='30'/%3E%3C/svg%3E") center / 60px 30px content-box,
        var(--washi);
    padding: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
.start-card {
    position: relative; width: 760px; display: grid; grid-template-columns: 1fr 1.05fr; gap: 0; transform-origin: center;
    border-radius: 6px; background: var(--washi); color: var(--sumi);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23f)'/%3E%3C/svg%3E");
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.35), 0 30px 60px rgba(0, 0, 0, 0.6), 0 2px 0 rgba(255, 255, 255, 0.6) inset;
}
.st-leaf { position: relative; padding: 30px 26px 24px 32px; display: flex; flex-direction: column; gap: 14px; border-right: 1px solid rgba(27, 23, 18, 0.14); }
.st-mark { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.st-stamp {
    display: inline-block; padding: 10px 18px 12px; border-radius: 10px; transform: rotate(-4deg);
    background: var(--shu); color: var(--washi); font: 58px/1 var(--font-display); letter-spacing: 0.02em;
    box-shadow: 0 0 0 3px var(--washi), 0 0 0 6px var(--shu-deep), 0 6px 14px rgba(110, 27, 15, 0.35);
    transform-origin: left bottom;
}
.st-name { font: 22px/1 var(--font-display); color: var(--sumi); margin-left: 4px; letter-spacing: 0.02em; }
.st-tag { font: 500 15px/1.45 var(--font-ui); color: var(--sumi-2); max-width: 22em; }
.st-launch { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.st-btn {
    min-height: 48px; padding: 0 18px; border-radius: 10px; border: none; cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; font: 700 16px/1 var(--font-ui); white-space: nowrap;
}
.st-primary {
    min-height: 56px; font-size: 20px; color: var(--washi); background: linear-gradient(180deg, #3d62aa, var(--ai));
    box-shadow: 0 0 0 1px rgba(15, 26, 51, 0.5), 0 4px 8px rgba(15, 26, 51, 0.5), 0 10px 18px rgba(0, 0, 0, 0.3);
}
.st-primary:active { transform: translateY(2px); box-shadow: 0 0 0 1px rgba(15, 26, 51, 0.5), 0 2px 4px rgba(15, 26, 51, 0.5); }
.st-row2 { display: flex; gap: 8px; flex-wrap: wrap; }
.st-row2 .st-btn { flex: 1; }
.st-quiet { color: var(--sumi); background: rgba(27, 23, 18, 0.06); box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.3); }
.st-quiet:hover { background: rgba(27, 23, 18, 0.1); }
.st-link { min-height: 44px; border: none; background: none; cursor: pointer; color: var(--ai); font: 700 15px/1 var(--font-ui); text-decoration: underline; text-underline-offset: 3px; }
.st-set { padding: 26px 30px 24px 26px; display: flex; flex-direction: column; gap: 12px; }
.st-field { display: flex; flex-direction: column; gap: 6px; }
.st-label { font: 700 13px/1 var(--font-ui); color: var(--sumi-2); letter-spacing: 0.02em; }
.st-seg { display: flex; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.35); }
.st-seg-btn {
    flex: 1; min-height: 44px; border: none; background: transparent; color: var(--sumi); cursor: pointer;
    font: 700 16px/1 var(--font-ui); white-space: nowrap; padding: 0 6px;
}
.st-seg-btn + .st-seg-btn { box-shadow: inset 1px 0 0 rgba(27, 23, 18, 0.2); }
.st-seg-btn.ja { font: 17px/1 var(--font-display); font-weight: 400; }
.st-seg-btn.on { background: var(--ai); color: var(--washi); }
.st-seg-btn:disabled { color: #8c806c; cursor: default; }
.st-note { font: 500 13px/1.35 var(--font-ui); color: #5b4f40; }
.st-house-btn {
    margin-top: 2px; min-height: 48px; padding: 6px 14px; border: none; border-radius: 10px; cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: 3px; background: rgba(27, 23, 18, 0.06); box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.25); color: var(--sumi);
}
.st-house-l { font: 700 14px/1.1 var(--font-ui); }
.st-house-l::after { content: ' ›'; }
.st-house-s { font: 500 12.5px/1.25 var(--font-ui); color: #5b4f40; }
.st-house-sheet {
    position: absolute; inset: 0; z-index: 5; border-radius: 6px; padding: 22px 28px 20px; display: flex; flex-direction: column; gap: 12px;
    background: var(--washi); box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.25);
}
.st-house-h { font: 22px/1 var(--font-display); }
.st-house-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; align-content: start; }
.st-check {
    min-height: 44px; display: flex; align-items: center; gap: 10px; border: none; background: none; cursor: pointer; text-align: left;
    font: 700 14.5px/1.25 var(--font-ui); color: var(--sumi);
}
.st-box { width: 26px; height: 26px; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--sumi-2); display: grid; place-items: center; background: #fffaf0; }
.st-check.on .st-box { background: var(--ai); box-shadow: none; }
.st-check.on .st-box::after { content: ''; width: 12px; height: 7px; border-left: 3px solid var(--washi); border-bottom: 3px solid var(--washi); transform: rotate(-45deg) translate(1px, -1px); }
.st-off { opacity: 0.75; }
.st-house-done { margin-top: auto; align-self: flex-end; min-width: 140px; min-height: 48px; font-size: 17px; }
.st-lang { position: absolute; top: 10px; right: 10px; z-index: 6; }
.st-lang-btn { width: 52px; height: 44px; border: none; background: none; cursor: pointer; display: grid; place-items: center; border-radius: 8px; }
.st-flag { display: block; width: 32px; height: 21px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.35); }
.st-flag svg { width: 100%; height: 100%; display: block; }
.st-lang-picker {
    position: absolute; right: 0; top: 48px; width: 200px; padding: 6px; border-radius: 10px; background: #fffaf0;
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.35), 0 12px 26px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column;
}
.st-lang-opt { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: none; background: none; cursor: pointer; border-radius: 8px; font: 700 15px/1 var(--font-ui); color: var(--sumi); }
.st-lang-opt.on, .st-lang-opt:hover { background: rgba(47, 79, 143, 0.12); }
/* short landscape (phones): two leaves side by side, compacted — never stacked */
@media (max-height: 520px) {
    .start-card { width: 620px; }
    .st-leaf { padding: 14px 14px 12px 18px; gap: 8px; }
    .st-stamp { font-size: 38px; padding: 7px 12px 9px; }
    .st-name { font-size: 16px; }
    .st-tag { font-size: 12.5px; line-height: 1.3; }
    .st-launch { gap: 6px; }
    .st-primary { min-height: 48px; font-size: 18px; }
    .st-btn { min-height: 44px; font-size: 14px; padding: 0 10px; }
    .st-set { padding: 14px 16px 12px 14px; gap: 6px; }
    .st-field { gap: 3px; }
    .st-label { font-size: 12px; }
    .st-seg-btn { font-size: 14px; }
    .st-note { font-size: 11.5px; }
    .st-house-btn { min-height: 44px; padding: 4px 10px; }
    .st-house-sheet { padding: 12px 16px; gap: 6px; }
    .st-house-h { font-size: 17px; }
    .st-house-grid { gap: 2px 14px; }
    .st-check { font-size: 13px; }
    .st-link { min-height: 44px; font-size: 13px; }
    #start-screen::before { display: none; }
}

/* ── Play-together dialog (core/passplay.js) in our paper ──────────────────────────────────── */
.dz-pp { background: var(--washi) !important; color: var(--sumi) !important; font-family: var(--font-ui) !important; }

/* ── Phones held upright: turn me ──────────────────────────────────────────────────────────── */
#rotate-cover { display: none; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 600px) {
    #rotate-cover {
        display: flex; position: fixed; inset: 0; z-index: 3000; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
        background: #1c140c; color: var(--washi); font: 700 18px/1.3 var(--font-ui); text-align: center; padding: 24px;
    }
    #rotate-cover .rc-stamp { padding: 8px 14px; border-radius: 10px; background: var(--shu); font: 34px/1 var(--font-display); transform: rotate(-4deg); }
}

/* crawlable intro (for search; visually hidden) */
#intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .hand-card, .seat-tag, #status-msg, #dz-welcome, #dz-welcome .wl-plate { transition: none; }
    .act-doubt, .callout, .verdict, .seat-word, .banner, .staged, #status-line.shake #status-msg { animation-duration: 1ms; }
    .callout { animation: none; opacity: 1; }
}

/* ── The Gemini room and logo (art.js ROOM flags) ──────────────────────────────────────────── */
body.has-bg #start-screen { background: radial-gradient(ellipse 110% 100% at 50% 50%, rgba(10, 8, 5, 0) 55%, rgba(10, 8, 5, 0.6) 100%), var(--dz-bg) center / cover no-repeat; }
body.has-bg #start-screen::before { display: none; }
body.has-bg #game { background: linear-gradient(rgba(14, 10, 6, 0.42), rgba(14, 10, 6, 0.42)), var(--dz-bg) center / cover no-repeat; }
.st-logo { display: none; }
body.has-logo .st-logo { display: block; width: 100%; max-width: 300px; aspect-ratio: 2 / 1; background: var(--dz-logo) left center / contain no-repeat; }
body.has-logo .st-stamp { display: none; }
@media (max-height: 520px) { body.has-logo .st-logo { max-width: 200px; } }

/* ── The online room (mpDialog.js): a washi slip like the result slip ──────────────────────── */
.mp-back { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; background: rgba(12, 9, 6, 0.6); padding: 10px; }
.mp-panel {
    width: min(420px, 100%); max-height: calc(100vh - 20px); overflow-y: auto; padding: 20px 22px 18px; border-radius: 14px;
    background: var(--washi); color: var(--sumi); display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 0 0 1px rgba(27, 23, 18, 0.4), 0 28px 60px rgba(0, 0, 0, 0.6); font: 500 15px/1.35 var(--font-ui);
}
.mp-h { font: 24px/1.1 var(--font-display); }
.mp-label { display: flex; flex-direction: column; gap: 4px; font: 700 13px/1.2 var(--font-ui); color: var(--sumi-2); }
.mp-name, .mp-codein {
    min-height: 44px; padding: 0 12px; border-radius: 8px; border: none; font: 700 17px/1 var(--font-ui); color: var(--sumi);
    background: #fffaf0; box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.35);
}
.mp-codein { font: 22px/1 var(--font-display); letter-spacing: 0.3em; text-transform: uppercase; }
.mp-code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-code { font: 30px/1 var(--font-display); letter-spacing: 0.18em; color: var(--shu-ink); }
.mp-seats { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mp-seats li { min-height: 36px; display: flex; align-items: center; padding: 0 10px; border-radius: 8px; background: rgba(27, 23, 18, 0.06); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-seats li.mp-ai { color: #6f6556; font-style: italic; font-weight: 500; }
.mp-note { color: #5b4f40; font-size: 13.5px; }
.mp-err { color: var(--shu-deep); font-weight: 700; min-height: 1em; }
.mp-row { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
/* the waiting room: the host's remove button on a person's chair */
.mp-seats li { gap: 6px; }
.mp-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mp-kick {
    flex: none; width: 44px; height: 44px; margin: -4px -10px -4px 0; border: none; border-radius: 8px; background: transparent;
    color: var(--shu-deep); font: 700 22px/1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.mp-kick:hover, .mp-kick:focus-visible { background: rgba(178, 34, 30, 0.12); }
.mp-kick:disabled { opacity: 0.4; }
/* the lobby: one washi row per open table */
.mp-tables { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.mp-table {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; text-align: left; min-height: 52px;
    padding: 8px 12px; border: none; border-radius: 10px; background: #fffaf0; color: var(--sumi); cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(27, 23, 18, 0.25); font: 500 14px/1.3 var(--font-ui); touch-action: manipulation;
}
.mp-table:hover:not(:disabled), .mp-table:focus-visible { box-shadow: inset 0 0 0 2px var(--shu-ink); }
.mp-table:disabled { opacity: 0.55; cursor: default; }
.mp-table-host { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-table-seats { font-weight: 700; color: var(--shu-ink); white-space: nowrap; }
.mp-table-opts { grid-column: 1 / -1; color: #5b4f40; font-size: 13px; }
.mp-none { padding: 10px 0; }
@media (max-height: 520px) { .mp-panel { padding: 12px 16px; gap: 6px; } .mp-h { font-size: 18px; } .mp-code { font-size: 24px; } .mp-lobby-hint { display: none; } .mp-tables { max-height: none; overflow: visible; } .mp-table { min-height: 44px; padding: 6px 10px; } }

/* ── Tutorial (tutorial.js): Kon the fox on a washi slip, the table veiled around what he means ── */
.tut-veil { position: fixed; inset: 0; z-index: 1500; pointer-events: none; opacity: 0; transition: opacity .28s ease; }
.tut-veil.show { opacity: 1; }
.tut-slip {
    position: fixed; z-index: 1600; display: flex; gap: 12px; align-items: flex-end;
    width: min(540px, calc(100vw - 16px)); padding: 12px 14px 12px 10px; border-radius: 12px;
    background: var(--washi); color: var(--sumi); font: 500 15px/1.4 var(--font-ui);
    box-shadow: 0 0 0 1px rgba(27, 23, 18, .45), 0 18px 40px rgba(0, 0, 0, .55);
    opacity: 0; transform: translateY(8px); transition: opacity .24s ease, transform .24s cubic-bezier(.16, 1, .3, 1);
    pointer-events: none;
}
.tut-slip.show { opacity: 1; transform: none; pointer-events: auto; }
.tut-slip.nag { box-shadow: 0 0 0 3px var(--shu-ink, #b2221e), 0 18px 40px rgba(0, 0, 0, .55); }
.tut-fig { flex: 0 0 auto; width: 86px; align-self: center; }
.tut-fig svg, .tut-fig img { display: block; width: 100%; height: auto; }
.tut-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tut-tag { font: 12px/1 var(--font-display); letter-spacing: .06em; color: var(--shu-ink, #b2221e); }
.tut-text { margin: 0; }
.tut-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tut-btn {
    min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 8px; border: none; cursor: pointer;
    font: 700 14px/1 var(--font-ui); color: var(--sumi); background: rgba(27, 23, 18, .08);
}
.tut-btn.tut-next { background: var(--sumi); color: var(--washi); }
.tut-btn.tut-leave { margin-right: auto; background: none; text-decoration: underline; text-underline-offset: 3px; }
.tut-btn:focus-visible { outline: 3px solid var(--shu-ink, #b2221e); outline-offset: 2px; }
@media (max-height: 520px) {
    .tut-slip { width: min(620px, calc(100vw - 16px)); padding: 6px 10px 6px 6px; gap: 8px; font-size: 13px; line-height: 1.3; }
    .tut-fig { width: 54px; }
    .tut-row { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .tut-slip, .tut-veil { transition: none; } }

/* start card: the leaf reads left-aligned (deckades.css centres the start card); the stamp's
   tilt and shadow need room above the name; "Rules" is a text link, not a third launch button */
.st-leaf { text-align: left; }
.st-mark { gap: 14px; }
.st-row2 .st-btn.st-rules {
    flex: 1 1 100%; min-height: 44px; background: none; box-shadow: none; color: var(--ai);
    font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
}
.st-row2 .st-btn.st-rules:hover { background: none; color: var(--sumi); }
@media (max-height: 520px) { .st-mark { gap: 12px; } .st-row2 .st-btn.st-rules { flex: 0 0 auto; padding: 0 8px; } }
.st-stamp { margin-bottom: 10px; }

/* an opponent's fan: only the top back shows the shu seal (the hidden rings leaked as crescents) */
.card.opp-card.under { --seal: linear-gradient(transparent, transparent); }
@media (max-height: 520px) { .st-mark { gap: 14px; } .st-note { display: none; } }
