/* Hilt — the look, from the game's own print (cover.png, cards/*.webp, chips/*.webp).
 *
 * Direction "THE PAVEMENT": the table is the cover's crazy-paved floor — orange grout on black,
 * lit dimly so the black cards with their bone numerals stay the brightest thing — ringed by the
 * cover's tile border (orange and magenta squares with bone quatrefoils) run round the oval, with
 * the cover's sunburst as rays from the prize toward every seat. The room around it is the cards'
 * own black.
 *   --ink      #0b0a0b  the cards' black (sampled off force_*.webp backgrounds)
 *   --bone     #ece6da  the numerals' off-white (sampled #e6e3de off force_10, a hair warmer)
 *   --magenta  #e8449a  the cover's magenta (sampled #e6489b) — the PRIMARY action, nothing else
 *   --orange   #f0902a  the cover's orange (sampled #f39432) — the PASSED stamp and the pavement grout
 *   light (bone) means "you may act here" and, at a battle's end, "this one won".
 * Type: Anton (condensed woodtype, like the force numerals) for names and numbers; Jost (the
 * geometric sans of the card captions) for UI. Both SIL OFL 1.1, latin subsets self-hosted from
 * Google Fonts (2026-11-21) in assets/fonts/.
 */
@font-face { font-family: 'Anton'; src: url('assets/fonts/Anton-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Jost'; src: url('assets/fonts/Jost-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
    --ink: #0b0a0b;
    --ink-2: #161214;
    --ink-3: #221c1e;
    --bone: #ece6da;
    --bone-2: rgba(236, 230, 218, 0.72);
    --bone-3: rgba(236, 230, 218, 0.42);
    --bone-line: rgba(236, 230, 218, 0.22);
    --magenta: #e8449a;
    --magenta-deep: #2c0f1f;
    --orange: #f0902a;
    --font-display: 'Anton', 'Arial Narrow', sans-serif;
    --font-ui: 'Jost', system-ui, sans-serif;
    --play-w: 60px;
    --frieze: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Crect width='24' height='24' fill='%23f0902a'/%3E%3Ccircle cx='12' cy='12' r='10' fill='%230b0a0b'/%3E%3Cg fill='%23ece6da'%3E%3Ccircle cx='12' cy='8.4' r='3.3'/%3E%3Ccircle cx='12' cy='15.6' r='3.3'/%3E%3Ccircle cx='8.4' cy='12' r='3.3'/%3E%3Ccircle cx='15.6' cy='12' r='3.3'/%3E%3C/g%3E%3Crect x='24' width='24' height='24' fill='%230b0a0b'/%3E%3Ccircle cx='36' cy='12' r='10.5' fill='%23e8449a'/%3E%3Cg fill='%230b0a0b'%3E%3Ccircle cx='36' cy='8.4' r='3.3'/%3E%3Ccircle cx='36' cy='15.6' r='3.3'/%3E%3Ccircle cx='32.4' cy='12' r='3.3'/%3E%3Ccircle cx='39.6' cy='12' r='3.3'/%3E%3C/g%3E%3C/svg%3E");
    /* core/back.js's question, in Hilt's colours */
    --dk-scrim: rgba(5, 4, 5, 0.72);
    --dk-dialog-top: #161214; --dk-dialog-bottom: #0b0a0b; --dk-dialog-line: rgba(236, 230, 218, 0.3);
    --dk-panel-text: #ece6da; --dk-panel-accent: #ece6da; --dk-accent: #e8449a;
    --dk-font-ui: 'Jost', system-ui, sans-serif; --dk-font-display: 'Anton', sans-serif;
    --dk-back-btn-bg: #e8449a; --dk-back-btn-ink: #0b0a0b; --dk-back-btn-line: transparent;
    --dk-back-alt-bg: transparent; --dk-back-alt-ink: #ece6da; --dk-back-alt-line: rgba(236, 230, 218, 0.4);
    --dk-back-focus: #ece6da;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--ink); }
body {
    font-family: var(--font-ui); color: var(--bone);
    -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
    touch-action: manipulation;
}
button { font-family: var(--font-ui); color: inherit; touch-action: manipulation; }
::selection { background: var(--magenta); color: var(--ink); }
:focus-visible { outline: 2px dashed var(--bone); outline-offset: 3px; }
#intro { display: none; }

/* ── The room ──────────────────────────────────────────────────────────────────────── */
#game {
    position: fixed; inset: 0; overflow: hidden; touch-action: none;
    background:
        radial-gradient(ellipse 70% 60% at 50% 52%, rgba(240, 144, 42, 0.06), transparent 70%),
        radial-gradient(ellipse at 50% 50%, #141011 0%, var(--ink) 75%);
}
#table { position: absolute; inset: 0; }

/* the pavement: crazy paving in orange grout (drawn once by game.js into --pave), under a lamp */
.cloth {
    position: absolute; border-radius: 50%;
    background:
        radial-gradient(ellipse at var(--lamp-x, 50%) var(--lamp-y, 46%), rgba(240, 144, 42, 0.16), rgba(11, 10, 11, 0.0) 38%, rgba(11, 10, 11, 0.72) 100%),
        var(--pave, none) center / 240px 240px,
        #120d0c;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), inset 0 0 60px rgba(0, 0, 0, 0.7);
}
.cloth-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.blade { fill: #2e2825; }
.blade-on { fill: #c9c2b5; }
.blade-win { fill: var(--bone); animation: blade-flare 1.1s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes blade-flare { from { fill: #6d665d; } }

/* ── Cards ─────────────────────────────────────────────────────────────────────────── */
.card {
    position: absolute; background-size: cover; background-position: center; background-color: var(--ink);
    border-radius: 6% / 3.8%;
    box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.34), 0 4px 10px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}
.card.back { box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.22), 0 2px 5px rgba(0, 0, 0, 0.55); }
.card.ghost { position: fixed; pointer-events: none; will-change: transform; box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.4), 0 10px 24px rgba(0, 0, 0, 0.7); }
.hand-card { pointer-events: auto; cursor: pointer; transition: filter 120ms ease, box-shadow 120ms ease; }
.hand-card.playable { box-shadow: 0 0 0 2px var(--bone), 0 6px 14px rgba(0, 0, 0, 0.7); }
.hand-card.playable:hover { filter: brightness(1.22); }
.hand-card.blocked { filter: brightness(0.42) saturate(0.6); }
.row-card.won { box-shadow: 0 0 0 2px var(--bone), 0 0 0 5px rgba(236, 230, 218, 0.18), 0 6px 16px rgba(0, 0, 0, 0.7); }
.row-card.dim, .winter-card.dim, .favor-card.dim { filter: brightness(0.45) saturate(0.5); }
.row-card.pickable { pointer-events: auto; cursor: pointer; box-shadow: 0 0 0 2px var(--bone), 0 0 0 6px rgba(236, 230, 218, 0.22); }
.row-card.pickable:hover { filter: brightness(1.2); }
/* played special cards answer a hover / long-press with their tooltip (force cards stay inert) */
.row-card[data-type="7"], .row-card[data-type="8"], .row-card[data-type="9"], .row-card[data-type="10"],
.row-card[data-type="11"], .row-card[data-type="12"], .winter-card, .favor-card { pointer-events: auto; cursor: help; }
.favor-card { z-index: 45; box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.5), 0 4px 10px rgba(0, 0, 0, 0.7); }
.winter-card { z-index: 20; }

/* the middle: the prize, the discard */
.prize-chip {
    position: absolute; border-radius: 50%; background-size: cover; z-index: 22;
    box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px rgba(236, 230, 218, 0.3), 0 8px 18px rgba(0, 0, 0, 0.7);
}
.prize-chip.lit { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--bone), 0 0 26px rgba(236, 230, 218, 0.35); }
.prize-chip.ghost-chip { position: fixed; z-index: 950; pointer-events: none; }
/* no chip yet: the socket it will sit in, sunk into the pavement, a rim quatrefoil engraved in it */
.prize-slot {
    position: absolute; border-radius: 50%; z-index: 22;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23ece6da' stroke-opacity='.22' stroke-width='.7'%3E%3Ccircle cx='12' cy='8.4' r='3.3'/%3E%3Ccircle cx='12' cy='15.6' r='3.3'/%3E%3Ccircle cx='8.4' cy='12' r='3.3'/%3E%3Ccircle cx='15.6' cy='12' r='3.3'/%3E%3C/g%3E%3C/svg%3E") center / 62% no-repeat,
        radial-gradient(circle at 50% 38%, #0b0a0b 0%, #120e0d 62%, #1c1614 100%);
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.85), inset 0 -1px 0 rgba(236, 230, 218, 0.12), 0 0 0 1px rgba(236, 230, 218, 0.1);
}
.prize-slot.choosing { animation: socket 1.8s ease-in-out infinite; }
@keyframes socket { 50% { box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.85), inset 0 -1px 0 rgba(236, 230, 218, 0.12), 0 0 0 1px rgba(236, 230, 218, 0.4); } }
.battle-label {
    position: absolute; transform: translate(-50%, -100%); z-index: 23; white-space: nowrap; pointer-events: none;
    padding: 3px 8px 2px; border-radius: 2px; background: rgba(11, 10, 11, 0.78);
    font: 500 12px/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone);
}
.discard { position: absolute; z-index: 21; border-radius: 6% / 3.8%; }
.discard.empty {
    /* no card yet: a card-shaped socket sunk into the pavement, like the prize socket — never a dashed
       outline, which reads as a place to drop something */
    background: radial-gradient(ellipse at 50% 38%, #0b0a0b 0%, #120e0d 64%, #1a1513 100%);
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.85), inset 0 -1px 0 rgba(236, 230, 218, 0.12), 0 0 0 1px rgba(236, 230, 218, 0.1);
}
.discard .pile-card { left: 0; top: 0; width: 100%; height: 100%; }

/* ── Plates (a seat's name, its live strength, its chips) ─────────────────────────── */
.plate {
    position: absolute; z-index: 40; display: flex; align-items: stretch; gap: 0;
    background: rgba(11, 10, 11, 0.94); border: 1px solid var(--bone-line); border-radius: 3px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); overflow: hidden;
    transition: border-color 200ms ease, opacity 200ms ease;
}
.plate .strength {
    flex: 0 0 auto; min-width: 1.6em; padding: 0 0.22em; display: flex; align-items: center; justify-content: center; gap: 0.06em;
    font: 400 44px/1 var(--font-display); color: var(--bone); background: var(--ink-3);
    font-variant-numeric: tabular-nums; position: relative; cursor: help;
}
/* the Favor's +1 is inside the number: a mark BESIDE the numeral (never over it or the name) says so */
.fav-plus {
    align-self: flex-start; margin-top: 0.16em; padding: 2px 3px 1px 2px; border-radius: 2px; cursor: help;
    display: inline-flex; align-items: center; gap: 2px;
    font: 600 11px/1 var(--font-ui); letter-spacing: 0.02em; color: var(--ink); background: var(--bone);
}
/* "incl. Favor": the Favor card itself, in miniature, beside the +1 (the numeral already counts it) */
.fav-mini { display: inline-block; width: 7px; height: 11px; border-radius: 1px; background: url('cards/fate_favor.webp') center / cover; box-shadow: 0 0 0 1px var(--ink); }
.plate.acting .fav-plus, .plate.won .fav-plus { background: var(--ink); color: var(--bone); }
.plate-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 2px 8px 3px; gap: 3px; }
.plate-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* line-height leaves Anton's caps (and their accents) room: a name is cut by an ellipsis, never at the top */
.plate-name { flex: 1 1 auto; min-width: 0; padding-top: 1px; font: 400 16px/1.25 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a long name first shrinks (game.js fitText), only then ellipsizes */
.plate-name.fit { font-size: 0.85em; letter-spacing: 0.03em; }
.mini-chip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background-size: cover; box-shadow: 0 0 0 1px var(--ink); }
.plate-count { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; font: 500 12px/1 var(--font-ui); color: var(--bone-2); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: help; }
/* the chip tray: flower, sun, wheel — an owned chip pictured, an empty slot an engraved ring */
.chip-tray { display: inline-flex; gap: 4px; --slot: 20px; }
.tray-slot {
    position: relative; flex: 0 0 auto; width: var(--slot); height: var(--slot); border-radius: 50%;
    background-size: cover; box-shadow: inset 0 0 0 1.5px rgba(236, 230, 218, 0.5), inset 0 2px 3px rgba(0, 0, 0, 0.8);
}
.tray-slot.owned { box-shadow: 0 0 0 1px var(--ink), 0 0 0 2px rgba(236, 230, 218, 0.28); }
.tray-slot.need:not(.owned) { box-shadow: inset 0 0 0 1.5px rgba(236, 230, 218, 0.5); outline: 1.5px dashed var(--bone); outline-offset: 1px; }
.tray-slot.need.owned { outline: 1.5px dashed var(--bone); outline-offset: 2px; }
.tray-n {
    position: absolute; right: -5px; bottom: -4px; min-width: 13px; padding: 1px 2px; border-radius: 6px; text-align: center;
    font: 600 11px/1 var(--font-ui); color: var(--ink); background: var(--bone); font-variant-numeric: tabular-nums;
}
/* one chip from winning: a dashed bone ring round the plate and a tag on its top edge */
.plate.near-win { outline: 2px dashed var(--bone); outline-offset: 2px; }
.near-tag {
    position: absolute; z-index: 49; transform: translate(-100%, -50%); white-space: nowrap; cursor: help;
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px 2px 7px; border-radius: 2px;
    font: 600 11px/1.1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--bone);
}
.near-dot { width: 11px; height: 11px; border-radius: 50%; background-size: cover; box-shadow: 0 0 0 1px var(--ink); }
/* the human's phone plate: "YOU" over the numeral over the tray */
.plate.plate-compact { flex-direction: column; }
.plate-you { flex: 0 0 auto; padding: 3px 2px 0; text-align: center; font: 400 11px/1.1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate.acting .plate-you { color: var(--bone); }
.plate.plate-compact .strength { flex: 1 1 auto; min-width: 0; padding: 0; }
.plate.plate-compact .plate-info { flex: 0 0 auto; align-items: center; padding: 3px 2px 4px; }
.plate.plate-compact .plate-top { display: none; }
.plate.plate-compact .chip-tray { --slot: 14px; gap: 3px; }
.count-card { display: inline-block; width: 8px; height: 12px; border-radius: 1.5px; background: url('cards/back.webp') center / cover; box-shadow: 0 0 0 1px var(--bone-3); }
.plate.acting { border-color: var(--bone); box-shadow: 0 0 0 1px var(--bone), 0 6px 18px rgba(0, 0, 0, 0.6); }
.plate.acting .strength { background: var(--bone); color: var(--ink); }
.plate.won { border-color: var(--bone); box-shadow: 0 0 0 2px var(--bone), 0 0 24px rgba(236, 230, 218, 0.25); }
.plate.won .strength { background: var(--bone); color: var(--ink); }
/* passed / out of the verdict: dimmed by VALUE, never by opacity — the plate stays opaque (the rim
   never shows through it) and its words keep 4.5:1 and more on the ink */
.plate.passed, .plate.dim { background: #0e0c0d; border-color: rgba(236, 230, 218, 0.14); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); }
.plate.passed .strength, .plate.dim .strength { color: #8f8a82; background: #171314; }
.plate.passed .plate-name, .plate.dim .plate-name, .plate.passed .plate-you, .plate.dim .plate-you { color: #a9a398; }
.plate.passed .plate-count, .plate.dim .plate-count { color: #9a958c; }
.plate.passed .tray-slot.owned, .plate.dim .tray-slot.owned { filter: brightness(0.7) saturate(0.7); }

/* the PASSED stamp lands on the seat's plate, across its top edge (a VOID on a ticket): never on the
   row, whose numerals must stay readable */
.stamp {
    position: absolute; z-index: 50; transform: translate(-100%, -45%) rotate(-6deg); transform-origin: 100% 50%; pointer-events: none; white-space: nowrap;
    font: 400 14px/1 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange);
    padding: 3px 7px 2px; border: 2px solid var(--orange); border-radius: 3px; background: rgba(11, 10, 11, 0.9);
    animation: stamp-in 240ms cubic-bezier(.16, 1, .3, 1) both;
}
.stamp.settled { animation: none; }
@keyframes stamp-in { from { transform: translate(-100%, -45%) rotate(-6deg) scale(1.6); opacity: 0; } }
/* a phone's own plate: the stamp lands on the numeral (moot once passed) */
.stamp.on-num { transform: translate(-50%, -50%) rotate(-8deg); transform-origin: 50% 50%; animation-name: stamp-in-num; }
.stamp.on-num.settled { animation: none; }
@keyframes stamp-in-num { from { transform: translate(-50%, -50%) rotate(-8deg) scale(1.6); opacity: 0; } }

/* ── The human's controls ──────────────────────────────────────────────────────────── */
#status-line {
    position: absolute; z-index: 70; transform: translate(-50%, -100%); pointer-events: none;
    display: flex; flex-direction: column; align-items: center; opacity: 0; transition: opacity 180ms ease;
}
/* the first-game hint rides as the status plate's second line */
#status-line .hint-plate { position: relative; z-index: auto; margin-top: 3px; pointer-events: auto; width: max-content; flex: 0 0 auto; }
#status-line.show { opacity: 1; }
#status-msg {
    display: block; padding: 5px 14px; border-radius: 3px; max-width: 100%; text-align: center; text-wrap: balance;
    font: 500 15px/1.2 var(--font-ui); color: var(--bone);
    background: rgba(11, 10, 11, 0.88); border: 1px solid var(--bone-line);
}
#status-line.alerting #status-msg { background: var(--magenta-deep); border-color: var(--magenta); }
#status-line.shake { animation: shake 320ms ease; }
@keyframes shake { 25% { margin-left: -6px; } 50% { margin-left: 6px; } 75% { margin-left: -3px; } }

#actions { position: absolute; z-index: 75; display: flex; flex-direction: column; gap: 8px; }
.act-btn {
    min-height: 44px; padding: 6px 12px; border-radius: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--ink-2); border: 1px solid var(--bone-3); color: var(--bone);
}
.act-btn .act-main { font: 400 18px/1.05 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; text-align: center; text-wrap: balance; }
.act-btn .act-sub { font: 400 11px/1.1 var(--font-ui); color: var(--bone-2); margin-top: 2px; text-align: center; }
.act-btn:hover { border-color: var(--bone); }
.act-btn.act-pass { background: var(--magenta); border-color: var(--magenta); color: var(--ink); }
.act-btn.act-pass .act-sub { color: var(--ink); opacity: 0.82; }
.act-btn.act-pass:hover { filter: brightness(1.08); }
/* the pass that ENDS the battle: a double rule, like the last ticket torn */
.act-btn.act-pass.ends { box-shadow: inset 0 0 0 2px var(--magenta), inset 0 0 0 4px var(--ink); }
.act-btn:focus-visible { outline: 2px dashed var(--bone); outline-offset: 3px; }

.hand-card:focus-visible, .row-card:focus-visible { outline: 2px dashed var(--bone); outline-offset: 3px; }
/* the printed fate captions are English: elsewhere a band in the print's own style replaces them */
.fate-cap {
    position: absolute; left: 4%; right: 4%; bottom: 2.5%; min-height: 15%; max-height: 30%; display: flex; align-items: center; justify-content: center;
    padding: 1px 2px; background: var(--ink); text-align: center; overflow: hidden;
    font: 500 11px/1.12 var(--font-ui); color: var(--bone); text-wrap: balance; pointer-events: none;
}
/* a small played card: its value in a woodtype tab over the print's (unreadable) corner numeral */
.row-num {
    position: absolute; left: 3%; top: 2%; min-width: 13px; padding: 2px 2px 1px; text-align: center; pointer-events: none;
    font: 400 11px/1 var(--font-display); color: var(--bone); background: var(--ink); border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.35);
}
.fate-cap b { font-weight: 600; color: var(--orange); text-transform: uppercase; margin-right: 0.25em; }

/* a screen reader's live line, and the skip link to the hand */
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link {
    position: fixed; left: 8px; top: 8px; z-index: 5100; padding: 12px 16px; border-radius: 3px;
    font: 500 15px/1 var(--font-ui); color: var(--ink); background: var(--bone); text-decoration: none;
    transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

#chooser {
    position: absolute; z-index: 80; padding: 12px 12px 10px; border-radius: 3px;
    background: rgba(11, 10, 11, 0.96); border: 1px solid var(--bone-3); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
}
.chooser-head { margin: 4px 0 4px; text-align: center; font: 400 15px/1 var(--font-display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--bone-2); }
.chooser-sub { margin: 0 auto 10px; max-width: 34ch; text-align: center; font: 400 14px/1.3 var(--font-ui); color: var(--bone); text-wrap: balance; }
.chooser-row { display: flex; gap: 8px; justify-content: center; }
.chip-btn {
    flex: 1 1 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; cursor: pointer;
    background: var(--ink-2); border: 1px solid var(--bone-line); border-radius: 3px;
}
.chip-btn:hover:not(:disabled) { border-color: var(--bone); }
.chip-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.chip-img { width: 58px; height: 58px; border-radius: 50%; background-size: cover; box-shadow: 0 0 0 2px var(--ink), 0 4px 10px rgba(0, 0, 0, 0.6); }
.chip-lbl { font: 400 15px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.chip-ct { font: 400 12px/1 var(--font-ui); color: var(--bone-2); font-variant-numeric: tabular-nums; }

/* ── Header ────────────────────────────────────────────────────────────────────────── */
#header-bar {
    position: fixed; left: 0; right: 0; top: 0; height: 64px; z-index: 300;
    display: flex; align-items: center; justify-content: space-between; padding: 0 max(8px, env(safe-area-inset-right)) 14px max(8px, env(safe-area-inset-left));
    background: var(--ink); border-bottom: 0;
}
#header-bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: var(--frieze) 0 0 / 28px 14px repeat-x; }
body:not(.in-game) #header-bar { display: none; }
.hb-left, .hb-right { display: flex; align-items: center; gap: 2px; position: relative; z-index: 2; }
.hb-mark { position: absolute; left: 50%; top: 25px; transform: translate(-50%, -50%); pointer-events: none; }
.hb-mark { display: flex; align-items: center; gap: 12px; }
.hb-house { width: 22px; height: 22px; opacity: 0.9; }   /* the publisher's mark, small and quiet; hidden on phones with .hb-mark */
@media (max-width: 760px) { .hb-house { display: none; } }
.hb-name { font: 400 28px/1 var(--font-display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--bone); padding-left: 0.22em; }
.hb-btn {
    width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 3px; cursor: pointer;
    background: transparent; color: var(--bone-2);
}
.hb-btn svg { pointer-events: none; }
.hb-btn:hover, .hb-btn.active { color: var(--bone); background: rgba(236, 230, 218, 0.08); }
.hb-btn.active { box-shadow: inset 0 -2px 0 var(--bone); }
#ai-indicator {
    position: relative; height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 8px; cursor: pointer;
    background: transparent; border: 1px solid var(--bone-line); border-radius: 3px; margin-right: 4px;
    font: 500 13px/1 var(--font-ui); color: var(--bone-2); white-space: nowrap;
}
.ai-lamp { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--bone-3); }
#ai-indicator.ai-onnx .ai-lamp { background: var(--bone); border-color: var(--bone); box-shadow: 0 0 8px rgba(236, 230, 218, 0.7); }
#ai-indicator.ai-ready .ai-lamp { border-color: var(--bone); }
#ai-indicator.ai-pending .ai-lamp { animation: lamp 1s ease-in-out infinite; }
@keyframes lamp { 50% { border-color: var(--bone); } }
.ai-detail {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 12px; z-index: 320; cursor: default;
    background: var(--ink-2); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    white-space: normal; text-align: left;
}
#ai-indicator:hover .ai-detail, #ai-indicator.tip-open .ai-detail { display: block; }
.ai-detail-head { font: 400 16px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone); margin-bottom: 8px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 10px; font: 400 13px/1.5 var(--font-ui); color: var(--bone-2); }
.ai-detail-row span:last-child { color: var(--bone); text-align: right; }
.ai-detail-why { margin-top: 8px; font: 400 12px/1.4 var(--font-ui); color: var(--bone-2); }

/* phone: the band is gone; its buttons float in the top corners */
body.phone #header-bar { height: 48px; background: transparent; pointer-events: none; padding: 2px max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left)); align-items: flex-start; }
body.phone #header-bar::after { display: none; }
body.phone .hb-left, body.phone .hb-right { pointer-events: auto; background: rgba(11, 10, 11, 0.82); border-radius: 3px; }
body.phone .hb-mark { display: none; }
body.phone .hb-right::before { content: 'Hilt'; font: 400 16px/44px var(--font-display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--bone); padding: 0 2px 0 10px; }
#tools-btn { display: none; }
body.phone #tools-btn { display: grid; }
body.phone #log-btn, body.phone #ai-eval-btn, body.phone #sound-btn { display: none; }
#tools-menu {
    position: fixed; z-index: 420; right: 4px; top: 50px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
    background: var(--ink-2); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
}
.tools-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 10px; border: 0; background: transparent; cursor: pointer; font: 500 14px/1 var(--font-ui); color: var(--bone-2); white-space: nowrap; }
.tools-item:hover { color: var(--bone); background: rgba(236, 230, 218, 0.07); }
.tools-item svg { pointer-events: none; }
body.phone #ai-indicator { padding: 0 10px; margin: 0; min-width: 44px; gap: 6px; justify-content: center; border-color: transparent; }
body.phone #ai-indicator .ai-text { display: none; }
.ai-short { display: none; font: 500 12px/1 var(--font-ui); letter-spacing: 0.08em; color: var(--bone-2); }
body.phone .ai-short { display: inline; }

/* ── Panels, sheets ────────────────────────────────────────────────────────────────── */
.side-panel, .hilt-sheet {
    position: fixed; z-index: 400; right: 8px; top: 72px; width: min(360px, calc(100vw - 16px)); max-height: calc(100vh - 82px);
    overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px 14px;
    background: var(--ink-2); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.8);
    scrollbar-color: var(--bone-3) transparent; scrollbar-width: thin;
}
.hilt-sheet::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--frieze) 0 50% / 12px 6px repeat-x; }
body.phone .side-panel, body.phone .hilt-sheet { top: 52px; max-height: calc(100vh - 58px); }
.hilt-sheet { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100vw - 16px));
    z-index: 1150; }   /* above the start screen (1000) and the game-over panel (1100): opened from both */
.panel-title, .hilt-sheet h2 { font: 400 20px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; margin: 4px 0 12px; color: var(--bone); }
.hilt-sheet p { font: 400 15px/1.5 var(--font-ui); color: var(--bone-2); margin: 0 0 10px; max-width: 68ch; }
.sheet-link { display: inline-block; margin-top: 4px; padding: 10px 0; color: var(--bone); font: 500 14px/1.2 var(--font-ui); text-underline-offset: 3px; }
.sheet-close { position: absolute; right: 6px; top: 10px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--bone-2); cursor: pointer; }
.sheet-close:hover { color: var(--bone); }
.panel-empty { font: 400 14px/1.4 var(--font-ui); color: var(--bone-2); }
.log-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font: 400 14px/1.35 var(--font-ui); color: var(--bone-2); }
.log-row.strong { color: var(--bone); font-weight: 500; }
.log-row.head { color: var(--bone-2); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.log-card { flex: 0 0 auto; width: 14px; height: 22px; border-radius: 2px; background-size: cover; box-shadow: 0 0 0 1px var(--bone-3); }
.log-chip { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; background-size: cover; }
.log-divider { height: 1px; margin: 8px 0; background: repeating-linear-gradient(90deg, var(--bone-3) 0 6px, transparent 6px 11px); }
.ai-entry { padding: 8px 0 10px; border-bottom: 1px solid var(--bone-line); }
.ai-head { font: 400 15px/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bone); }
.ai-ctx { font: 400 12px/1.4 var(--font-ui); color: var(--bone-2); margin: 2px 0 4px; }
.ai-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; font: 400 13px/1.5 var(--font-ui); color: var(--bone-2); font-variant-numeric: tabular-nums; }
.ai-row.chosen { color: var(--bone); font-weight: 600; }
.ai-mark { color: var(--bone); }
.panel-foot { margin-top: 12px; font: 400 12px/1.45 var(--font-ui); color: var(--bone-2); }

/* ── Plates over the table: the banner (picture left, words right) and the welcome ─── */
.banner {
    position: fixed; z-index: 600; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; pointer-events: none;
    background: rgba(11, 10, 11, 0.95); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
    animation: plate-in 280ms cubic-bezier(.2, .8, .3, 1) both;
}
.banner-pic { flex: 0 0 auto; width: 34px; height: 54px; border-radius: 3px; background-size: cover; box-shadow: 0 0 0 1px var(--bone-3); }
.banner-pic.is-chip { width: 46px; height: 46px; border-radius: 50%; }
.banner-text { font: 400 18px/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bone); }
.banner::before, .verdict-plate::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--frieze) 0 50% / 12px 6px repeat-x; border-radius: 3px 3px 0 0; }
.banner { padding-top: 14px; }
@keyframes plate-in { from { opacity: 0; translate: 0 8px; } }

/* the battle's verdict: the prize large on the left, who took it and why, the winning number right */
.verdict-plate {
    position: fixed; z-index: 600; pointer-events: none;
    display: flex; align-items: stretch; gap: 0; overflow: hidden;
    background: var(--ink); border: 1px solid var(--bone); border-radius: 3px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
    animation: plate-in 300ms cubic-bezier(.16, 1, .3, 1) both;
}
.vp-chip {
    flex: 0 0 auto; width: 76px; height: 76px; margin: 18px 0 12px 14px; align-self: center; border-radius: 50%; background-size: cover;
    box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--bone), 0 8px 18px rgba(0, 0, 0, 0.7);
}
.vp-words { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 18px 14px 12px; }
.vp-what { font: 400 22px/1.12 var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--bone); text-wrap: balance; }
.vp-why { font: 400 14px/1.3 var(--font-ui); color: var(--bone-2); }
.vp-num {
    flex: 0 0 auto; min-width: 1.5em; display: grid; place-items: center; padding: 6px 0.2em 0;
    font: 400 64px/1 var(--font-display); color: var(--ink); background: var(--bone); font-variant-numeric: tabular-nums;
}
.verdict-plate.no-winner { border-color: var(--bone-3); }
.verdict-plate.no-winner .vp-chip { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--bone-3); filter: saturate(0.7); }
body.phone .vp-chip { width: 46px; height: 46px; margin: 12px 0 8px 10px; }
body.phone .vp-words { padding: 11px 10px 7px; gap: 3px; }
body.phone .vp-what { font-size: 16px; }
body.phone .vp-why { font-size: 12px; }
body.phone .vp-num { font-size: 40px; }

#hilt-welcome { position: fixed; inset: 0; z-index: 1190; display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity 300ms ease; }
#hilt-welcome.show { opacity: 1; }
.welcome-plate {
    position: relative; display: flex; align-items: center; gap: 18px; max-width: min(520px, 100%); padding: 22px 26px 20px 20px;
    background: rgba(11, 10, 11, 0.96); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
    transform: translateY(10px); transition: transform 300ms ease;
}
#hilt-welcome.show .welcome-plate { transform: none; }
.welcome-plate::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--frieze) 0 50% / 16px 8px repeat-x; }
.welcome-pic { flex: 0 0 auto; width: 70px; height: 112px; border-radius: 4px; background-size: cover; box-shadow: 0 0 0 1px var(--bone-3); }
.welcome-title { font: 400 34px/1 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bone); margin-bottom: 8px; }
.welcome-line { font: 400 16px/1.4 var(--font-ui); color: var(--bone-2); }

/* ── Game over ─────────────────────────────────────────────────────────────────────── */
#game-over { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 12px; background: rgba(5, 4, 5, 0.66); }
#game-over[hidden] { display: none; }
.over-panel {
    position: relative; width: min(460px, 100%); max-height: calc(100vh - 24px); overflow-y: auto; padding: 30px 26px 20px; text-align: center;
    background: var(--ink); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85);
    animation: plate-in 320ms cubic-bezier(.2, .8, .3, 1) both;
}
.over-panel::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--frieze) 0 50% / 24px 12px repeat-x; }
.over-title { font: 400 44px/1 var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--bone); margin: 8px 0 6px; }
.over-how { font: 400 15px/1.4 var(--font-ui); color: var(--bone-2); margin-bottom: 14px; }
/* the human's own place, under the winner's line — shared when tied ("=2"), never invented */
.over-you { font: 400 17px/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone); margin: -6px 0 14px; }
/* a seat with no chips: the tray's three empty rings, engraved as on the plates */
.empty-ring { background: none !important; box-shadow: inset 0 0 0 1.5px rgba(236, 230, 218, 0.45), inset 0 2px 3px rgba(0, 0, 0, 0.8) !important; }
/* the winner's set beside the human's own chips */
.over-sets { display: flex; gap: 10px; justify-content: center; margin: 2px 0 14px; }
.over-set { flex: 1 1 0; min-width: 0; padding: 8px 10px 10px; border: 1px solid var(--bone-line); border-radius: 3px; text-align: center; }
.over-set.set-winner { border-color: var(--bone); }
.over-set-label { font: 400 15px/1.25 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.over-set-chips { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; min-height: 28px; align-items: center; font: 400 13px/1 var(--font-ui); color: var(--bone-2); }
.set-chip { width: 28px; height: 28px; border-radius: 50%; background-size: cover; box-shadow: 0 0 0 1px var(--ink), 0 0 0 2px rgba(236, 230, 218, 0.28); }
.over-row.you .over-name { text-decoration: underline; text-decoration-color: var(--bone-3); text-underline-offset: 4px; }
.over-btns button:focus:not(:focus-visible) { outline: none; }
.over-list { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.over-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid transparent; border-radius: 3px; }
.over-row.winner { border-color: var(--bone); background: rgba(236, 230, 218, 0.06); }
.over-place { font: 400 16px/1 var(--font-display); color: var(--bone-2); }
.over-name { font: 400 18px/1 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.over-chips { display: inline-flex; gap: 3px; font: 400 12px/1 var(--font-ui); color: var(--bone-2); }
.over-chips .mini-chip { width: 18px; height: 18px; }
.over-meta { margin-top: 10px; font: 400 12px/1 var(--font-ui); color: var(--bone-2); letter-spacing: 0.1em; text-transform: uppercase; }
.over-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.over-btns button { min-height: 48px; padding: 0 22px; border-radius: 3px; cursor: pointer; font: 400 18px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }
.over-again { background: var(--magenta); color: var(--ink); border: 0; }
.over-menu { background: transparent; color: var(--bone); border: 1px solid var(--bone-3); }
.over-btns button:hover { filter: brightness(1.1); }

/* ── Start screen ──────────────────────────────────────────────────────────────────── */
#start-screen {
    position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(232, 68, 154, 0.07), transparent 55%),
        radial-gradient(ellipse at 75% 70%, rgba(240, 144, 42, 0.06), transparent 55%),
        var(--ink);
}
.start-card { display: flex; align-items: stretch; gap: 34px; width: 900px; transform-origin: center; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.start-art { flex: 0 0 auto; width: 388px; }
.start-art img { display: block; width: 100%; height: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8); }
.start-panel { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.start-mark { font: 400 118px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone); margin: 0 0 10px -4px; }
.start-tag { font: 400 17px/1.35 var(--font-ui); color: var(--bone-2); margin-bottom: 26px; max-width: 34ch; }
.start-row { margin-bottom: 18px; }
.start-label { font: 500 12px/1 var(--font-ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--bone-2); margin-bottom: 8px; }
.start-tiles { display: flex; gap: 8px; }
.start-tile {
    min-width: 54px; min-height: 54px; padding: 6px 10px; cursor: pointer; border-radius: 0;
    background: var(--ink); border: 1px solid var(--bone-3); color: var(--bone);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tiles-level .start-tile { flex: 1 1 0; }
.start-tile:hover { border-color: var(--bone); }
.start-tile.on { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.tile-num { font: 400 28px/1 var(--font-display); }
.tile-main { font: 400 17px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.tile-sub { font: 400 12px/1 var(--font-ui); opacity: 0.75; }
.start-doors { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 8px; }
.start-play {
    min-height: 64px; border: 0; border-radius: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--magenta); color: var(--ink); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}
.start-play:hover { filter: brightness(1.08); }
.start-play .play-main { font: 400 34px/1 var(--font-display); letter-spacing: 0.24em; text-transform: uppercase; padding-left: 0.24em; }
.start-play .play-sub { font: 500 13px/1 var(--font-ui); margin-top: 4px; }
.start-quiet {
    min-height: 44px; padding: 0 6px; border: 0; background: transparent; cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
    font: 500 15px/1 var(--font-ui); color: var(--bone-2); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--bone-3);
}
.start-quiet:hover { color: var(--bone); }
.start-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.start-foot .lang-wrap { margin-left: auto; }
.lang-wrap { position: relative; }
.lang-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.flag { display: block; width: 26px; height: 17px; box-shadow: 0 0 0 1px var(--bone-3); }
.flag svg { display: block; width: 100%; height: 100%; }
.lang-picker {
    position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 10; padding: 6px; display: flex; flex-direction: column; gap: 2px;
    background: var(--ink-2); border: 1px solid var(--bone-3); border-radius: 3px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
}
.lang-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px 0 8px; border: 0; background: transparent; cursor: pointer; font: 500 14px/1 var(--font-ui); color: var(--bone-2); white-space: nowrap; }
.lang-opt.on, .lang-opt:hover { color: var(--bone); background: rgba(236, 230, 218, 0.07); }
.start-credits { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; font: 400 14px/1.3 var(--font-ui); color: var(--bone-2); }
.credit-label { letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; color: rgba(236, 230, 218, 0.62); margin-right: 2px; }
.credit-name { color: var(--bone); font-weight: 500; }
/* the house: CMYK's mark beside the makers and the © line */
.start-house { margin-top: 14px; display: flex; align-items: center; gap: 14px; }
.start-house .start-credits { margin-top: 0; min-width: 0; }
.start-house-logo { flex: none; display: block; border-radius: 4px; opacity: 0.94; transition: opacity 0.15s, transform 0.15s; }
.start-house-logo:hover { opacity: 1; transform: rotate(-6deg); }
.start-house-logo:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.start-house-logo img { display: block; width: 44px; height: 44px; }
.start-copy { margin-top: 2px; font-size: 11.5px; letter-spacing: 0.04em; color: rgba(236, 230, 218, 0.62); }
.start-support { justify-content: flex-start; padding: 0; margin-top: 6px; font-size: 14px; color: var(--orange); text-decoration-color: rgba(240, 144, 42, 0.45); }
.start-support:hover { color: var(--bone); }

/* short screens: the same card re-arranged, not shrunk */
.start-card.compact { width: auto; gap: 18px; align-items: center; }
.start-card.compact .start-art { width: auto; height: min(calc(100vh - 20px), var(--art-h, 420px)); max-height: 420px; }
.start-card.compact .start-art img { height: 100%; width: auto; }
.start-card.compact .start-panel { width: 380px; }
.start-card.compact .start-mark { font-size: 44px; line-height: 1.04; padding-top: 2px; margin-bottom: 2px; }
.start-card.compact .start-tag { display: none; }
/* labels stand beside their tiles, not above them: the card fits 640x300 with no scaling */
.start-card.compact .start-row { margin-bottom: 6px; display: grid; grid-template-columns: 86px 1fr; align-items: center; column-gap: 8px; }
.start-card.compact .start-label { margin-bottom: 0; font-size: 11px; letter-spacing: 0.12em; line-height: 1.2; overflow-wrap: anywhere; }
.start-card.compact .start-tile { min-height: 44px; min-width: 48px; padding: 3px 8px; }
.start-card.compact .tile-num { font-size: 22px; }
.start-card.compact .tile-main { font-size: 14px; letter-spacing: 0.04em; }
.start-card.compact .tiles-level .start-tile { padding: 3px 4px; }
.start-card.compact .tile-sub { display: none; }
.start-card.compact .start-play { min-height: 46px; }
.start-card.compact .start-play .play-main { font-size: 24px; }
.start-card.compact .start-foot { margin-top: 0; }
.start-card.compact .start-house { margin-top: 2px; gap: 10px; }
.start-card.compact .start-house-logo img { width: 30px; height: 30px; }
.start-card.compact .start-copy { margin-top: 0; font-size: 11px; }
.start-card.compact .start-credits { margin-top: 2px; flex-direction: row; flex-wrap: wrap; column-gap: 12px; row-gap: 0; font-size: 11px; }
.start-card.compact .credit-label { font-size: 11px; letter-spacing: 0.06em; }
.start-card.compact .start-support { min-height: 32px; margin-top: 0; font-size: 12px; }
/* the shortest phones: the same card, tighter rhythm — every control stays 44px, nothing is scaled */
.start-card.compact.short .start-mark { font-size: 34px; line-height: 1; margin-bottom: 2px; }
.start-card.compact.short .start-row { margin-bottom: 4px; }
.start-card.compact.short .start-doors { margin-top: 2px; }
.start-card.compact.short .start-play { min-height: 44px; }
.start-card.compact.short .start-credits { line-height: 1.25; }

/* portrait tablets: the print above, the choices under it */
.start-card.stacked { flex-direction: column; align-items: center; width: min(560px, calc(100vw - 32px)); gap: 22px; }
.start-card.stacked .start-art { width: min(300px, 30vh); }
.start-card.stacked .start-panel { width: 100%; }
.start-card.stacked .start-mark { font-size: 92px; text-align: center; margin-left: 0; }
.start-card.stacked .start-tag { text-align: center; margin: 0 auto 22px; }

/* ── Portrait phone ────────────────────────────────────────────────────────────────── */
#rotate-cover { display: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 600px) {
    #rotate-cover {
        display: grid; place-items: center; position: fixed; inset: 0; z-index: 5000; padding: 24px; text-align: center;
        background: var(--ink); color: var(--bone); font: 400 22px/1.3 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
    }
}

/* ── Phone table: type steps down, nothing else changes shape ──────────────────────── */
body.phone .plate .strength { font-size: 26px; }
.plate.plate-human .strength { font-size: 52px; }
body.phone .plate.plate-human .strength { font-size: 34px; }
/* a phone plate (36px): the numeral beside two lines — the name with the hand count, then the tray */
body.phone .plate-name { font-size: 13px; line-height: 1.15; padding-top: 0; letter-spacing: 0.05em; }
body.phone .plate-info { padding: 1px 5px 2px 5px; gap: 2px; }
body.phone .plate-top { gap: 4px; }
body.phone .mini-chip { width: 11px; height: 11px; }
body.phone .chip-tray { --slot: 13px; gap: 3px; }
body.phone .plate .strength { min-width: 1.15em; padding: 0 0.1em; }
body.phone .count-card { width: 8px; height: 12px; }
body.phone .tray-n { min-width: 12px; right: -5px; bottom: -4px; padding: 1px 1px 0; }
body.phone .near-tag { font-size: 11px; padding: 1px 4px 1px 5px; }
body.phone .near-dot { width: 10px; height: 10px; }
body.phone .fav-plus { padding: 1px 2px 0; margin-top: 0.12em; }
body.phone .plate-count { font-size: 11px; gap: 2px; }
body.phone #status-msg { font-size: 13px; line-height: 1.15; padding: 3px 10px; }
body.phone .stamp { font-size: 11px; padding: 2px 5px 1px; border-width: 1.5px; letter-spacing: 0.1em; }
body.phone .act-btn .act-main { font-size: 15px; letter-spacing: 0.08em; }
body.phone .act-btn .act-sub { display: none; }
body.phone .chip-img { width: 40px; height: 40px; }
body.phone #chooser { padding: 8px 8px 6px; }
body.phone .chooser-head { margin: 2px 0 2px; font-size: 13px; }
body.phone .chooser-sub { font-size: 12px; margin-bottom: 6px; }
body.phone .chip-btn { padding: 4px; gap: 2px; }
body.phone .banner-text { font-size: 14px; }
body.phone .banner-pic { width: 26px; height: 42px; }
body.phone .banner-pic.is-chip { width: 34px; height: 34px; }
body.phone .battle-label { font-size: 11px; letter-spacing: 0.1em; padding: 2px 6px 1px; }
body.phone .welcome-title { font-size: 26px; }
body.phone .welcome-pic { width: 50px; height: 80px; }
body.phone .over-title { font-size: 30px; }
@media (max-height: 460px) {
    .over-panel { width: min(640px, 100%); display: grid; grid-template-columns: 1fr 1.1fr; column-gap: 18px; align-items: center; text-align: left; padding: 22px 16px 14px; }
    .over-panel > .over-title, .over-panel > .over-how, .over-panel > .over-sets, .over-panel > .over-meta, .over-panel > .over-btns { grid-column: 1; }
    .over-panel > .over-list { grid-column: 2; grid-row: 1 / span 5; }
    .over-sets { margin: 0 0 4px; gap: 6px; }
    .over-set { padding: 4px 6px 6px; }
    .over-set-label { font-size: 13px; margin-bottom: 3px; }
    .set-chip { width: 20px; height: 20px; }
    .over-set-chips { min-height: 20px; gap: 3px; }
    .over-title { font-size: 30px; margin: 4px 0; }
    .over-how { margin-bottom: 6px; }
    .over-you { margin: -2px 0 6px; font-size: 15px; }
    .over-btns { justify-content: flex-start; flex-wrap: wrap; margin-top: 8px; }
    .over-btns button { padding: 0 14px; font-size: 16px; }
    .over-row { padding: 3px 8px; }
}
body.phone .over-panel { padding: 22px 16px 14px; }
body.phone .over-row { padding: 3px 8px; }
body.phone .over-btns { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
    .ray, .plate, .hand-card, #status-line, #hilt-welcome, .welcome-plate { transition: none; }
    .stamp, .banner, .over-panel, .ray.ray-win, #ai-indicator.ai-pending .ai-lamp { animation: none; }
}

/* ── Tutorial ──────────────────────────────────────────────────────────────────────────
 * The lesson is a Hilt plate: the cards' black, bone type, the cover's tile frieze along its top.
 * The spotlight dims the table round what a line talks about — a dashed bone ring for "look here",
 * a solid, breathing ring for "act here". Next is bone (light = act); magenta stays the game's one
 * primary action (Pass on the table, Play a game at the end). */
.tut-veil { position: fixed; left: 0; top: 0; z-index: 250; pointer-events: none; opacity: 0; transition: opacity 220ms ease; }
.tut-veil.on { opacity: 1; }
.tut-dim { fill: rgba(5, 4, 5, 0.64); }
.tut-ring { fill: none; stroke: var(--bone); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.85; }
.tut-veil.act .tut-ring { stroke-width: 2.5; stroke-dasharray: none; opacity: 1; animation: tut-breathe 1.6s ease-in-out infinite; }
.tut-veil.pulse .tut-ring { animation: tut-flash 0.5s ease-out 2; }
@keyframes tut-breathe { 50% { stroke-opacity: 0.45; } }
@keyframes tut-flash { 50% { stroke: var(--magenta); stroke-width: 4; } }

.tut-cap {
    position: fixed; z-index: 1200; left: 50%; top: 80px;
    width: min(430px, calc(100vw - 16px)); padding: 16px 16px 12px;
    background: rgba(11, 10, 11, 0.97); border: 1px solid var(--bone-line); border-radius: 3px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.78);
    transition: left 240ms cubic-bezier(.3, .7, .35, 1), top 240ms cubic-bezier(.3, .7, .35, 1), opacity 180ms ease;
}
.tut-cap::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--frieze) 0 50% / 12px 6px repeat-x; border-radius: 3px 3px 0 0; }
.tut-cap.away { opacity: 0; pointer-events: none; }
.tut-cap.shake { animation: shake 320ms ease; }
.tut-head { display: flex; align-items: center; gap: 10px; margin: 0 -8px 6px 0; min-height: 28px; }
.tut-tag { font: 400 13px/1 var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--bone-2); }
.tut-count { font: 500 11px/1 var(--font-ui); letter-spacing: 0.08em; color: var(--bone-3); font-variant-numeric: tabular-nums; }
.tut-exit { margin-left: auto; width: 44px; height: 44px; margin-top: -10px; margin-bottom: -10px; display: grid; place-items: center; border: 0; background: transparent; color: var(--bone-2); cursor: pointer; border-radius: 3px; }
.tut-exit:hover { color: var(--bone); background: rgba(236, 230, 218, 0.07); }
.tut-text { font: 400 16px/1.45 var(--font-ui); color: var(--bone); text-wrap: pretty; }
.tut-nag { display: none; margin-top: 8px; padding: 5px 10px; border-radius: 3px; font: 500 14px/1.25 var(--font-ui); color: var(--bone); background: var(--magenta-deep); border: 1px solid var(--magenta); }
.tut-cap.nagging .tut-nag { display: block; }
.tut-btns { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tut-btns button { min-height: 44px; padding: 0 16px; border-radius: 3px; cursor: pointer; font: 400 16px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }
.tut-back { background: transparent; color: var(--bone-2); border: 1px solid var(--bone-3); }
.tut-back:hover:not(:disabled) { color: var(--bone); border-color: var(--bone); }
.tut-back:disabled { opacity: 0.3; cursor: default; }
.tut-alt { margin-left: auto; background: transparent; color: var(--bone); border: 1px solid var(--bone-3); }
.tut-next { margin-left: auto; background: var(--bone); color: var(--ink); border: 1px solid var(--bone); }
.tut-alt:not([hidden]) + .tut-next { margin-left: 0; }
.tut-next:hover { filter: brightness(1.08); }
.tut-next.primary { background: var(--magenta); border-color: var(--magenta); color: var(--ink); }
.tut-hint { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font: 500 13px/1.2 var(--font-ui); color: var(--bone-2); text-align: right; }
.tut-hint::before { content: ''; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--bone); box-shadow: 0 0 8px rgba(236, 230, 218, 0.7); animation: tut-dot 1.6s ease-in-out infinite; }
@keyframes tut-dot { 50% { opacity: 0.35; } }
.tut-cap [hidden] { display: none !important; }

/* phones: a lower, wider plate — the line on the left, the buttons stacked on the right */
body.phone .tut-cap { width: min(470px, calc(100vw - 16px)); padding: 10px 10px 8px 12px; display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: center; }
body.phone .tut-cap::before { height: 4px; background-size: 8px 4px; }
body.phone .tut-head { grid-column: 1 / -1; margin: 0 -6px 2px 0; min-height: 22px; }
body.phone .tut-tag { font-size: 11px; }
body.phone .tut-exit { width: 40px; height: 40px; margin-top: -9px; margin-bottom: -9px; }
body.phone .tut-text { font-size: 13px; line-height: 1.32; }
body.phone .tut-nag { grid-column: 1; font-size: 12px; margin-top: 4px; padding: 3px 8px; }
body.phone .tut-btns { grid-column: 2; grid-row: 2 / span 2; flex-direction: column-reverse; align-items: stretch; gap: 6px; margin-top: 0; }
body.phone .tut-btns button { min-height: 40px; padding: 0 12px; font-size: 14px; }
body.phone .tut-next, body.phone .tut-alt, body.phone .tut-hint { margin-left: 0; }
body.phone .tut-hint { max-width: 112px; font-size: 11px; text-align: left; }
/* the narrow column (beside the middle): one stack, buttons in a row under the line */
.tut-cap.narrow { padding: 12px 12px 10px; }
.tut-cap.narrow .tut-text { font-size: 14px; line-height: 1.38; }
body.phone .tut-cap.narrow { display: block; padding: 8px 8px 6px 10px; }
body.phone .tut-cap.narrow .tut-text { font-size: 12px; line-height: 1.3; }
body.phone .tut-cap.narrow .tut-btns { flex-direction: row; align-items: center; margin-top: 6px; gap: 6px; }
body.phone .tut-cap.narrow .tut-next, body.phone .tut-cap.narrow .tut-alt, body.phone .tut-cap.narrow .tut-hint { margin-left: auto; }
body.phone .tut-cap.narrow .tut-alt:not([hidden]) + .tut-next { margin-left: 0; }
body.phone .tut-cap.narrow .tut-btns button { padding: 0 10px; }

@media (prefers-reduced-motion: reduce) {
    .tut-cap, .tut-veil { transition: none; }
    .tut-veil.act .tut-ring, .tut-veil.pulse .tut-ring, .tut-cap.shake, .tut-hint::before { animation: none; }
}

/* ── Fate-card tooltip (hover / long-press) ─────────────────────────────────────────────── */
#card-tip {
    position: fixed; z-index: 2000; max-width: 260px; pointer-events: none;
    padding: 8px 12px 9px; border: 1px solid var(--bone-line); border-radius: 3px;
    background: rgba(11, 10, 11, 0.94); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    opacity: 0; transform: translateY(3px); transition: opacity 140ms ease, transform 140ms ease;
}
#card-tip.show { opacity: 1; transform: none; }
#card-tip .tip-name { font: 400 15px/1.1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 4px; }
#card-tip .tip-text { font: 400 14px/1.35 var(--font-ui); color: var(--bone); }
body.phone #card-tip { max-width: 220px; padding: 6px 10px 7px; }
body.phone #card-tip .tip-text { font-size: 12.5px; }
.card { -webkit-touch-callout: none; }
@media (prefers-reduced-motion: reduce) { #card-tip { transition: none; } }

/* ── Animated rules (rulesPage.js) ─────────────────────────────────────────────────────
   The rules as a book of the cover's own making: the cards' black, a band of the tile frieze
   across its head, Anton for headings and numerals, and every worked example played out on a
   patch of the table's crazy pavement so the card art reads exactly as it does in play.
   Fate-card names wear the orange they wear in the card tooltip. Above the start screen (1000),
   the game over (1100), the welcome (1190) and the tutorial caption (1200): opened from all. */
#hilt-rules {
    position: fixed; inset: 0; z-index: 1300;
    display: flex; align-items: center; justify-content: center;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: rgba(5, 4, 5, 0.8);
    animation: hr-in 240ms cubic-bezier(.16, 1, .3, 1);
}
@keyframes hr-in { from { opacity: 0; } }
#hilt-rules ::selection { background: rgba(232, 68, 154, 0.38); color: var(--bone); }
.hr-sheet {
    position: relative; width: min(1080px, 100%); height: 100%; max-height: 920px;
    display: flex; flex-direction: column; overflow: hidden;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(240, 144, 42, 0.05), transparent 70%), var(--ink);
    color: var(--bone); border: 1px solid var(--bone-line); border-radius: 3px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85);
    font-family: var(--font-ui);
}
.hr-sheet::before { content: ''; flex: none; height: 12px; background: var(--frieze) 0 50% / 24px 12px repeat-x; }
.hr-bar { flex: none; display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 8px; border-bottom: 1px solid var(--bone-line); }
.hr-btn {
    font: inherit; color: var(--bone-2); background: transparent; border: 0; border-radius: 3px;
    min-height: 44px; padding: 0 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
    transition: color 140ms, background-color 140ms;
}
.hr-btn svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.hr-btn:focus-visible { outline: 2px solid var(--bone); outline-offset: -2px; }
.hr-btn:disabled { opacity: 0.28; cursor: default; }
@media (hover: hover) { .hr-btn:hover:not(:disabled) { color: var(--bone); background: rgba(236, 230, 218, 0.06); } }
.hr-btn:active:not(:disabled) { background: rgba(236, 230, 218, 0.1); }
.hr-icon { width: 44px; padding: 0; justify-content: center; }
.hr-toc-btn { flex: 1; min-width: 0; justify-content: flex-start; color: var(--bone); }
.hr-now { font: 400 20px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }
.hr-pos { flex: none; font: 500 13px/1 var(--font-ui); color: var(--bone-2); font-variant-numeric: tabular-nums; }
.hr-toc {
    position: absolute; z-index: 2; top: 66px; left: 8px; width: min(320px, calc(100% - 16px)); max-height: calc(100% - 76px);
    overflow: auto; padding: 6px; background: var(--ink-2); border: 1px solid var(--bone-3); border-radius: 3px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8); scrollbar-color: var(--bone-3) transparent; scrollbar-width: thin;
}
.hr-toc[hidden] { display: none; }
.hr-toc button {
    display: block; width: 100%; min-height: 40px; padding: 8px 12px; text-align: left; cursor: pointer;
    font: 400 16px/1.1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--bone-2); background: transparent; border: 0; border-radius: 2px;
}
.hr-toc button.hr-sub { padding-left: 30px; font: 500 14px/1.1 var(--font-ui); letter-spacing: 0.02em; text-transform: none; color: var(--orange); opacity: 0.85; }
@media (hover: hover) { .hr-toc button:hover { color: var(--bone); background: rgba(236, 230, 218, 0.06); } }
.hr-toc button:focus-visible { outline: 2px solid var(--bone); outline-offset: -2px; }
.hr-toc button[aria-current="true"] { color: var(--bone); background: rgba(236, 230, 218, 0.1); opacity: 1; }
.hr-body {
    position: relative;   /* the chapters' offsetTop is measured from here (rulesPage.js go/paint) */
    flex: 1; overflow-y: auto; overscroll-behavior: contain; outline: none;
    padding: 8px clamp(14px, 3.2vw, 40px) 36px;
    scrollbar-color: var(--bone-3) transparent; scrollbar-width: thin;
}
.hr-title { margin: clamp(14px, 3vh, 30px) 0 4px; font: 400 clamp(34px, 5.4vw, 64px)/0.95 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone); text-wrap: balance; }
.hr-ch {
    display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); align-items: center;
    padding: clamp(18px, 3.4vh, 34px) 0;
    background: repeating-linear-gradient(90deg, var(--bone-line) 0 6px, transparent 6px 11px) 0 100% / 100% 1px no-repeat;
}
.hr-ch:last-child { background: none; }
.hr-ch.hr-plain { grid-template-columns: minmax(0, 1fr); padding-bottom: 6px; background: none; }
.hr-ch.hr-plain .hr-text { max-width: 68ch; }
.hr-fig {
    margin: 0; aspect-ratio: 440 / 260; border-radius: 3px; overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(240, 144, 42, 0.08), rgba(11, 10, 11, 0.42) 50%, rgba(11, 10, 11, 0.82) 100%),
        linear-gradient(rgba(11, 10, 11, 0.38), rgba(11, 10, 11, 0.38)),
        var(--pave, none) center / 240px 240px,
        #120d0c;
    box-shadow: inset 0 0 0 1px var(--bone-line), inset 0 0 50px rgba(0, 0, 0, 0.6), 0 12px 28px rgba(0, 0, 0, 0.55);
}
.hr-svg { display: block; width: 100%; height: 100%; }
.hr-card, .hr-chip, .hr-pop, .hr-stampg { transform-box: fill-box; transform-origin: center; }
.hr-frame { fill: none; stroke: rgba(236, 230, 218, 0.3); stroke-width: 0.8; }
.hr-shade { fill: var(--ink); }
.hr-ring { fill: none; stroke: var(--bone); stroke-width: 2.2; }
.hr-slot { fill: none; stroke: var(--bone-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.hr-mark { fill: var(--bone); }
.hr-t { font: 500 13px var(--font-ui); fill: var(--bone); }
.hr-name { font: 400 15px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.hr-str { font: 400 34px var(--font-display); font-variant-numeric: tabular-nums; }
.hr-tag { font: 400 18px var(--font-display); }
.hr-lab { font: 500 12.5px var(--font-ui); letter-spacing: 0.03em; fill: var(--bone-2); }
.hr-mid { font: 400 17px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.hr-win { font: 400 21px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }
.hr-dim { font: 400 16px var(--font-ui); fill: var(--bone-2); }
.hr-stamp { fill: rgba(11, 10, 11, 0.6); stroke: var(--orange); stroke-width: 2; }
.hr-stamp-t { font: 400 15px var(--font-display); letter-spacing: 0.16em; text-transform: uppercase; fill: var(--orange); }
.hr-text { font: 400 16px/1.6 var(--font-ui); color: var(--bone-2); max-width: 62ch; }
.hr-text h2 { margin: 0 0 0.5em; font: 400 clamp(24px, 2.8vw, 32px)/1.05 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bone); text-wrap: balance; }
.hr-ch-sub .hr-text h2 { color: var(--orange); }
.hr-text p { margin: 0 0 0.7em; }
.hr-text ul, .hr-text ol { margin: 0 0 0.7em; padding-left: 1.3em; }
.hr-text li { margin: 0.3em 0; }
.hr-text li::marker { color: var(--orange); }
.hr-text b { font-weight: 500; color: var(--bone); }

/* portrait: the figure above its words */
@media (max-width: 760px) and (min-height: 501px), (max-width: 1000px) and (orientation: portrait) and (min-height: 501px) {
    .hr-sheet { max-height: 1240px; }
    .hr-ch { grid-template-columns: minmax(0, 1fr); }
    .hr-fig { max-width: 640px; }
    .hr-now { font-size: 18px; }
}
/* a phone held sideways: figure and words side by side, everything smaller */
@media (max-height: 500px) {
    #hilt-rules { padding: 4px max(4px, env(safe-area-inset-right)) 4px max(4px, env(safe-area-inset-left)); }
    .hr-sheet { max-height: none; }
    .hr-sheet::before { height: 6px; background-size: 12px 6px; }
    .hr-bar { padding: 0 4px; }
    .hr-now { font-size: 17px; }
    .hr-title { font-size: 28px; margin-top: 10px; }
    .hr-ch { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr); padding: 12px 0; gap: 14px; align-items: start; }
    .hr-fig { position: sticky; top: 4px; }   /* the example stays in view while its words scroll past */
    .hr-text { font-size: 13.5px; line-height: 1.5; }
    .hr-text h2 { font-size: 20px; }
    .hr-toc { top: 52px; max-height: calc(100% - 58px); }
    .hr-toc button { min-height: 36px; padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) { #hilt-rules { animation: none; } }

/* ── The leader's sword (game.js drawSword) ────────────────────────────────────────────
   The cover's woodcut ink round a blood-vermilion blade: the one red on the table, so it never
   reads as the bone turn ray, the magenta action or the orange stamp. */
.lead-sword {
    position: absolute; left: 0; top: 0; z-index: 58; transform-origin: 0 50%; cursor: help;
    opacity: 0; transition: opacity 220ms ease; pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
}
.lead-sword.show { opacity: 1; pointer-events: auto; }
.lead-sword svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lead-sword .sw-halo { fill: var(--bone); stroke: var(--bone); }
.lead-sword .sw-blade, .lead-sword .sw-guard, .lead-sword .sw-pommel { fill: #dc3022; }
.lead-sword .sw-grip { fill: #3a1310; }
.lead-sword .sw-fuller { stroke: #f1c9b8; fill: #f1c9b8; }
.lead-sword .sw-hatch { stroke: #0b0a0b; }
.lead-sword.verdict { filter: drop-shadow(0 0 6px rgba(196, 40, 28, 0.55)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }

/* a played card turning over in flight (game.js fly, flipTo) */
.ghost-flip { position: fixed; pointer-events: none; will-change: transform; }
.flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.flip-inner .flip-face { left: 0; top: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    box-shadow: 0 0 0 1px rgba(236, 230, 218, 0.4), 0 10px 24px rgba(0, 0, 0, 0.7); }
.flip-inner .flip-back { transform: rotateY(180deg); }

/* the first-game hint: a small Hilt plate, dismissed by its own button or the first move */
.hint-plate {
    position: fixed; z-index: 640; display: flex; align-items: center; gap: 6px; max-width: min(340px, calc(100vw - 8px));
    padding: 9px 4px 7px 12px; background: rgba(11, 10, 11, 0.97); border: 1px solid var(--bone-3); border-radius: 3px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8); animation: plate-in 280ms cubic-bezier(.2, .8, .3, 1) both;
}
.hint-plate::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--frieze) 0 50% / 8px 4px repeat-x; border-radius: 3px 3px 0 0; }
.hint-text { font: 400 14px/1.3 var(--font-ui); color: var(--bone); }
.hint-close { flex: 0 0 auto; width: 44px; height: 44px; margin: -8px 0; display: grid; place-items: center; border: 0; border-radius: 3px; background: transparent; color: var(--bone-2); cursor: pointer; }
.hint-close:hover { color: var(--bone); background: rgba(236, 230, 218, 0.08); }
body.phone .hint-text { font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
    .lead-sword, .plate { transition: none; }
    .hint-plate { animation: none; }
}
