/* Fugitive — the city at night, read from the dispatch map.
 *
 * Where each choice came from:
 *   --ribbon   the red FUGITIVE banner across the deck back (sampled ~#b5463d on the card,
 *              lifted to #d4513f so cream text and the teal room both carry it) — the Fugitive,
 *              his escape and the primary action. One meaning, no decoration.
 *   --lamp     the mustard street-lamp light of the hideout art (sampled #979057 / #bbc780 on
 *              card 00's lit windows, pushed to a lamp yellow #e8b947) — ONLY "you may act here".
 *   --police   the deck back's blue (#447490, sampled) deepened — the Marshal's pencil.
 *   --night / --block / --street   the teal of card 00's night sky (#0f3a35, #092b24) cooled
 *              toward blue for the map: flat blocks, darker streets, no felt.
 *   --paper    the cream card stock of the reference and Event cards (#f1efe7, sampled).
 *   fonts      Jost (shipped, assets/fonts) — the geometric thin caps of the FUGITIVE wordmark
 *              on the cover and the card back; Kalam (shipped) — the Marshal's pencil, matching
 *              the handwritten numbers printed on the notepad.
 */
@font-face { font-family: 'Jost'; src: url('assets/fonts/Jost-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Kalam'; src: url('assets/fonts/Kalam-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
    --night: #0b1d24;
    --street: #0e252d;
    --block: #133540;
    --block-2: #163c48;
    --avenue: #10303a;
    --ribbon: #d4513f;
    --ribbon-deep: #a83a2c;
    --ribbon-soft: rgba(212, 81, 63, 0.28);
    --ribbon-ink: #c04634;     /* the ribbon as a FILL under cream text: 4.8:1 with #fff8f2 (--ribbon gives 3.95) */
    --ribbon-ink-2: #b33d2c;   /* its hover/pressed step: darker, never lighter (5.5:1) */
    --lamp: #e8b947;
    --lamp-soft: rgba(232, 185, 71, 0.32);
    --police: #2f5f86;
    --police-ink: #234a6c;
    --found: #2f8a4a;          /* the notepad's green circle round a found Hideout (4.1:1 on --paper, a 3px stroke) */
    --paper: #f2eee4;
    --paper-2: #e6e0d1;
    --ink: #1b1b1d;
    --ink-2: #4a4a4c;
    --chalk: #e9e6dc;
    --chalk-2: #aebfc2;
    --font: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
    --pencil: 'Kalam', 'Segoe Print', cursive;
    --shadow: 0 3px 10px rgba(2, 10, 14, 0.55);
    --radius: 7px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
    background: var(--night);
    color: var(--chalk);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
button, select { font-family: var(--font); color: inherit; touch-action: manipulation; }
::selection { background: var(--lamp-soft); color: var(--chalk); }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
/* on cream paper the lamp ring vanishes (≈1.6:1): every paper surface rings its focus in ink (15:1) */
:where(.start-card, .ticket, .ticket-plate, .plate-note, .welcome-plate, .side-panel, #rules-popup, .hdr-menu, .tut-caption, #dk-back-ask .dk-back-panel, .fg-pp) :focus-visible {
    outline: 2px solid var(--ink); outline-offset: 3px;
}
.plate-note.manhunt :focus-visible { outline-color: var(--lamp); }   /* the Manhunt plate is ink */
.seg :focus-visible { outline-offset: -4px; outline-color: var(--lamp); }   /* inside the ink segment bar the ring sits within the button */
.seg .seg-btn:not(.on):focus-visible { outline-color: var(--ink); }

/* ── The room: a plotted city map ───────────────────────────────────────────────────── */
#game {
    position: fixed; inset: 0; z-index: 1; overflow: hidden; touch-action: none;
    background-color: var(--street);
    background-image:
        radial-gradient(ellipse at 50% 46%, rgba(232, 185, 71, 0.05), transparent 62%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='300' viewBox='0 0 360 300'%3E%3Cg fill='%23133540'%3E%3Crect x='8' y='8' width='92' height='58' rx='3'/%3E%3Crect x='112' y='8' width='54' height='58' rx='3'/%3E%3Crect x='178' y='8' width='106' height='26' rx='3'/%3E%3Crect x='178' y='42' width='50' height='24' rx='3'/%3E%3Crect x='236' y='42' width='48' height='24' rx='3'/%3E%3Crect x='296' y='8' width='56' height='58' rx='3'/%3E%3Crect x='8' y='80' width='56' height='92' rx='3'/%3E%3Crect x='76' y='80' width='90' height='40' rx='3'/%3E%3Crect x='76' y='128' width='90' height='44' rx='3'/%3E%3Crect x='178' y='80' width='174' height='42' rx='3'/%3E%3Crect x='178' y='130' width='82' height='42' rx='3'/%3E%3Crect x='8' y='186' width='120' height='50' rx='3'/%3E%3Crect x='140' y='186' width='60' height='106' rx='3'/%3E%3Crect x='212' y='186' width='68' height='50' rx='3'/%3E%3Crect x='8' y='248' width='120' height='44' rx='3'/%3E%3Crect x='212' y='248' width='140' height='44' rx='3'/%3E%3C/g%3E%3Cg fill='%23163c48'%3E%3Crect x='268' y='130' width='84' height='106' rx='3'/%3E%3C/g%3E%3Cg fill='%2311332f'%3E%3Crect x='292' y='186' width='60' height='50' rx='3'/%3E%3C/g%3E%3C/svg%3E");
    background-size: auto, 360px 300px;
}
body.manhunt #game { background-color: #071419; }
body.manhunt #game::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
    background: rgba(4, 10, 13, 0.45);
}
.region { position: absolute; }

/* ── Header: the dark kerb (desk/tablet) or a rail down the left (phone) ────────────── */
#header-bar {
    position: fixed; z-index: 300; left: 0; top: 0; right: 0; height: 56px;
    display: flex; align-items: center; gap: 8px; padding: 0 10px;
    background: #081519; border-bottom: 1px solid rgba(233, 230, 220, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
body:not(.in-game) #header-bar { display: none; }
.hdr-btn, #ai-indicator {
    min-width: 44px; height: 44px; border: 0; border-radius: 6px; background: transparent; color: var(--chalk);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.hdr-btn svg, #ai-indicator svg { pointer-events: none; }
.hdr-btn:hover { background: rgba(233, 230, 220, 0.07); }
.hdr-btn.active { background: rgba(233, 230, 220, 0.12); color: var(--lamp); }
.hdr-btn.off { color: var(--chalk-2); }
.hdr-title {
    position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
    font-weight: 300; font-size: 24px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--chalk);
    padding-left: 0.34em; white-space: nowrap;
}
.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
#more-btn { display: none; }
#hunch-btn[hidden] { display: none !important; }
#ai-indicator { gap: 8px; padding: 0 12px; position: relative; font: 500 13px var(--font); letter-spacing: 0.04em; border: 1px solid rgba(233, 230, 220, 0.14); border-radius: 22px; margin-right: 6px; }
.ai-lamp { width: 9px; height: 9px; border-radius: 50%; background: #5f6a6c; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.ai-heuristic .ai-lamp { background: var(--lamp); }
.ai-onnx .ai-lamp, .ai-ready .ai-lamp { background: #8fd0e0; }
.ai-search .ai-lamp { background: #c9a6e8; box-shadow: 0 0 6px rgba(201, 166, 232, .55); }
.ai-pending .ai-lamp { background: #5f6a6c; }
#ai-indicator-detail {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 270px; z-index: 400; text-align: left;
    background: var(--paper); color: var(--ink); border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
    font: 400 13px/1.4 var(--font); letter-spacing: 0; cursor: default; white-space: normal;
}
#ai-indicator:hover #ai-indicator-detail, #ai-indicator.tip-open #ai-indicator-detail { display: block; }
.ai-detail-head { font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; color: var(--ribbon-deep); margin-bottom: 6px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-bottom: 1px dotted rgba(27,27,29,.18); }
.ai-detail-row b { font-weight: 500; text-align: right; }
.ai-detail-why { margin-top: 8px; color: var(--ink-2); }

/* phone rail */
#header-bar.rail {
    right: auto; bottom: 0; width: 56px; height: auto; flex-direction: column; padding: 6px 0; gap: 4px;
    border-bottom: 0; border-right: 1px solid rgba(233, 230, 220, 0.08);
}
#header-bar.rail .hdr-title {
    position: static; transform: none; writing-mode: vertical-rl; rotate: 180deg; font-size: 15px; letter-spacing: 0.3em; padding: 0.3em 0 0; flex: 1;
    display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden;
}
#header-bar.rail .hdr-tools { margin: 0; flex-direction: column; }
#header-bar.rail .hdr-btn.tool { display: none; }
#header-bar.rail #more-btn { display: inline-flex; }
#header-bar.rail #ai-indicator { width: 44px; padding: 0; margin: 0; border-radius: 50%; }
#header-bar.rail #ai-indicator .ai-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#header-bar.rail #ai-indicator-detail { top: 0; left: calc(100% + 8px); right: auto; }
@media (max-width: 1000px) and (min-height: 481px) {
    .hdr-title { position: static; transform: none; font-size: 20px; letter-spacing: 0.28em; margin-left: 4px; }
}
@media (max-width: 760px) and (min-height: 481px) { .hdr-btn.tool { display: none; } #more-btn { display: inline-flex; } }

.hdr-menu {
    position: fixed; z-index: 2100; background: var(--paper);  /* above the start screen (2000): its language button opens this menu */ color: var(--ink); border-radius: 8px; padding: 6px;
    box-shadow: 0 10px 28px rgba(0,0,0,.5); min-width: 200px;
}
.hdr-menu-item {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px;
    background: transparent; color: var(--ink); font: 500 15px var(--font); cursor: pointer; text-align: left;
}
.hdr-menu-item:hover { background: var(--paper-2); }
.hdr-menu-item.on { color: var(--ribbon-deep); }
.mi-icon { display: inline-flex; width: 26px; justify-content: center; }
.flag { display: inline-block; width: 26px; height: 17px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.flag svg { width: 100%; height: 100%; display: block; }

/* ── Cards ──────────────────────────────────────────────────────────────────────────── */
.card {
    position: absolute; border-radius: var(--radius); background-color: var(--paper);
    background-size: cover; background-position: center; box-shadow: var(--shadow);
    touch-action: none;
}
.card.dim { filter: saturate(0.55) brightness(0.72); }
.card.playable { cursor: pointer; outline: 2px solid var(--lamp); outline-offset: 2px; }
.card.playable:hover { filter: brightness(1.12); }
.card.ghost { pointer-events: none; transform-origin: center center; box-shadow: 0 10px 24px rgba(0,0,0,.55); }

/* ── The far kerb ───────────────────────────────────────────────────────────────────── */
#strip { z-index: 5; }
.deck {
    position: absolute; border: 0; background: transparent; padding: 0; cursor: default; border-radius: var(--radius);
}
.deck .card { position: absolute; }
.deck.live { cursor: pointer; }
.deck.live .deck-top { outline: 2px solid var(--lamp); outline-offset: 2px; animation: lamp-breathe 2.4s ease-in-out infinite; }
.deck.live:hover .deck-top { filter: brightness(1.1); }
@keyframes lamp-breathe { 50% { outline-color: rgba(232, 185, 71, 0.45); } }
.deck-empty { border: 2px dashed rgba(233, 230, 220, 0.18); border-radius: var(--radius); }
.deck-count {
    position: absolute; top: -6px; right: -6px; z-index: 5; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    background: var(--paper); color: var(--ink); font: 600 12px/22px var(--font); text-align: center; font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.deck-range {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; text-align: center; white-space: nowrap;
    font: 500 12px/18px var(--font); letter-spacing: 0.08em; color: var(--chalk-2); font-variant-numeric: tabular-nums;
}
body.phone .deck-range { bottom: 3px; color: var(--paper); background: rgba(8, 21, 25, 0.72); border-radius: 0 0 var(--radius) var(--radius); font-size: 11px; line-height: 15px; }
.epile { position: absolute; border: 0; background: transparent; padding: 0; cursor: pointer; }
.epile .card.spent { filter: grayscale(1) brightness(0.5); }

.opp { position: absolute; left: 0; top: 0; }
.opp-plate {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 6px;
    background: rgba(8, 21, 25, 0.82); border: 1px solid rgba(233, 230, 220, 0.12);
}
.opp-role { font: 500 11px var(--font); letter-spacing: 0.2em; text-transform: uppercase; color: var(--chalk-2); }
.opp.is-fugitive .opp-role { color: #f0a79b; }
.opp.is-marshal .opp-role { color: #9cc3e0; }
.opp-name { font: 500 15px var(--font); color: var(--chalk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-plate.acting { border-color: var(--lamp); }
.opp-plate.acting .opp-role::after { content: ' ●'; color: var(--lamp); }
.opp-card { box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.opp-count { position: absolute; font: 500 12px var(--font); color: var(--chalk-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.scanner-tag {
    position: absolute; z-index: 70; padding: 3px 10px; border-radius: 4px; background: var(--ribbon-ink); color: #fff8f2;
    font: 500 12px/16px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.hunch-line {
    /* the AI Marshal thinking out loud: a slip of her notepad paper, her police-blue pencil */
    position: absolute; z-index: 70; padding: 2px 10px 1px; border-radius: 4px; background: var(--paper); color: var(--police-ink);
    font: 400 15px/20px var(--pencil); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); font-variant-numeric: tabular-nums;
}
.hunch-line b { font: 600 10px/20px var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); vertical-align: top; }
body.phone .hunch-line { font-size: 13px; line-height: 16px; padding: 1px 8px; white-space: normal; text-overflow: clip; }
body.phone .hunch-line b { font-size: 9px; line-height: 16px; }
@media (prefers-reduced-motion: no-preference) { .hunch-line.fresh { animation: hunch-in 260ms ease-out; } }
@keyframes hunch-in { from { opacity: 0; transform: translateY(-3px); } }
body.phone .scanner-tag { font-size: 11px; line-height: 14px; padding: 2px 8px; white-space: normal; text-overflow: clip; }
body.phone .opp-plate { padding: 4px 8px; }
body.phone .opp-name { font-size: 13px; }
body.phone .opp-role { font-size: 10px; letter-spacing: 0.14em; }
body.phone .opp-count { display: none; }

/* ── The avenue ─────────────────────────────────────────────────────────────────────── */
#route {
    z-index: 4; overflow-x: hidden; overflow-y: hidden; border-radius: 10px;
    background: var(--avenue);
    box-shadow: inset 0 0 0 1px rgba(233, 230, 220, 0.05), 0 8px 26px rgba(0, 0, 0, 0.35);
    scrollbar-width: thin; scrollbar-color: rgba(233,230,220,.25) transparent;
}
#route.scrolls { overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
#route::-webkit-scrollbar { height: 6px; }
#route::-webkit-scrollbar-thumb { background: rgba(233,230,220,.25); border-radius: 3px; }
#route-inner { position: relative; }
#route-inner::before {   /* the avenue's centre line */
    content: ''; position: absolute; left: 0; right: 0; top: var(--lane, 46%); height: 2px;
    background: repeating-linear-gradient(90deg, rgba(232, 185, 71, 0.22) 0 18px, transparent 18px 36px);
}
.steps {
    position: absolute; width: 14px; height: 18px; z-index: 2; opacity: 0.55;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 18'%3E%3Cg fill='%23e9e6dc'%3E%3Cellipse cx='4' cy='5' rx='2.6' ry='4'/%3E%3Cellipse cx='10' cy='13' rx='2.6' ry='4'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.slot-card { cursor: default; }
.slot-card.down { box-shadow: 0 4px 12px rgba(0,0,0,.6); }
.slot-card.mine-hidden, .sprint.mine-hidden { filter: saturate(0.7) brightness(0.86); }
.slot-card.mine-hidden::after, .sprint.mine-hidden::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: inset 0 0 0 2px rgba(233, 230, 220, 0.55); background: repeating-linear-gradient(135deg, rgba(11,29,36,.0) 0 9px, rgba(11,29,36,.22) 9px 11px);
}
.hid-tag {
    position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(8, 21, 25, 0.85); color: var(--chalk); z-index: 2;
}
.slot-card.pickable { cursor: pointer; outline: 3px solid var(--lamp); outline-offset: 3px; animation: lamp-breathe 1.6s ease-in-out infinite; }
.slot-card.pending { outline: 2px dashed rgba(232, 185, 71, 0.8); outline-offset: 3px; }
.slot-card.takeback, .sprint.takeback { cursor: pointer; }
.sprint { box-shadow: 0 2px 6px rgba(0,0,0,.55); }
.fresh-tag {
    position: absolute; right: -4px; top: -6px; padding: 0 5px; border-radius: 8px; background: var(--police); color: #fff;
    font: 600 11px/16px var(--font); z-index: 2;
}
.next-slot { position: absolute; border-radius: var(--radius); border: 2px dashed rgba(232, 185, 71, 0.55); }
.lamp {
    position: absolute; border-radius: 50%; pointer-events: none; z-index: 1;
    background: radial-gradient(circle, rgba(232, 185, 71, 0.28) 0%, rgba(232, 185, 71, 0.1) 40%, transparent 70%);
}
.slot-ev { cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.6); }
/* the Events under a placed hideout: one thumbnail (the latest) for the whole group, its finger box
   grown to 44px by an invisible margin; with more than one, a count. The tap opens the slot's
   ticket, which lists every Event in words */
.slot-ev.group::before { content: ''; position: absolute; inset: -10px -8px; }
.ev-count {
    position: absolute; right: -7px; bottom: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: var(--ink); color: var(--paper); font: 600 11px/18px var(--font); text-align: center; font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none;
}
.slot-ev.waiting { outline: 2px solid rgba(232, 185, 71, 0.7); outline-offset: 1px; }
.evidence {
    position: absolute; text-align: center; font: 500 11px/14px var(--font); color: var(--ink); white-space: nowrap;
    background: var(--paper); border-radius: 3px; padding: 0 3px; box-shadow: 0 1px 3px rgba(0,0,0,.4); overflow: hidden; text-overflow: ellipsis;
}
.flip { animation: flip-in 520ms cubic-bezier(.3, .7, .3, 1); }
@keyframes flip-in { 0% { transform: scaleX(1); } 45% { transform: scaleX(0.02); filter: brightness(1.6); } 100% { transform: scaleX(1); } }

/* ── The near edge: hand + turn ticket ──────────────────────────────────────────────── */
#hand { z-index: 6; }
.hand-card { transition: filter 0.12s; }
.hand-empty {
    position: absolute; inset: 6px; display: grid; place-items: center; color: var(--chalk-2); font: 400 14px var(--font); letter-spacing: 0.04em;
    border: 1px solid rgba(174, 191, 194, 0.22); border-radius: var(--radius); background: rgba(11, 29, 36, 0.55);
}
.ticket-plate {
    z-index: 7; background: var(--paper); color: var(--ink); border-radius: 8px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); overflow: hidden;
}
.ticket-plate::before {   /* the ticket's punched edge */
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
    background: radial-gradient(circle at 6px -2px, var(--night) 4px, transparent 4.5px) 0 0 / 12px 5px repeat-x;
}
.plate-head { display: flex; align-items: center; gap: 8px; }
.plate-role { font: 600 11px var(--font); letter-spacing: 0.22em; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; color: #fff; }
.plate-role.fugitive { background: var(--ribbon-ink); }
.plate-role.marshal { background: var(--police); }
.plate-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
#status-msg { font: 500 15px/1.3 var(--font); color: var(--ink); }
#status-msg.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.range { display: flex; flex-wrap: wrap; gap: 6px; }
.range span { font: 500 13px/22px var(--font); padding: 0 8px; border-radius: 11px; background: var(--paper-2); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.range.ok span:last-child { background: #cfe3c8; color: #1f4a1a; }
.range.short span:last-child { background: #f3d2cb; color: #7d2216; }
.guess-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gchip { font: 700 18px/30px var(--pencil); color: var(--police-ink); min-width: 32px; height: 30px; text-align: center; border: 2px solid var(--police); border-radius: 50%; padding: 0 4px; }
.gkind { font: 500 12px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.gempty { font: 400 13px var(--font); color: var(--ink-2); font-style: italic; }
.plate-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tbtn {
    min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 6px; border: 2px solid var(--ink); cursor: pointer;
    font: 600 14px var(--font); letter-spacing: 0.08em; text-transform: uppercase; background: transparent; color: var(--ink); white-space: nowrap;
}
.tbtn.primary { background: var(--ribbon-ink); border-color: var(--ribbon-ink); color: #fff8f2; box-shadow: 0 2px 6px rgba(120, 30, 20, 0.35); }
.tbtn.primary:hover:not(:disabled) { background: var(--ribbon-ink-2); border-color: var(--ribbon-ink-2); }
.tbtn.ghost:hover:not(:disabled) { background: rgba(27, 27, 29, 0.07); }
.tbtn:disabled { background: var(--paper-2); border-color: #b9b3a6; color: #77736b; box-shadow: none; cursor: not-allowed; }
body.phone .ticket-plate { padding: 8px 8px 6px; gap: 4px; }
body.phone #status-msg { font-size: 13px; }
body.phone .plate-head { display: none; }
body.phone .tbtn { padding: 0 10px; font-size: 12px; letter-spacing: 0.04em; flex: 1 1 auto; min-width: 0; }
body.phone .plate-actions { flex-wrap: nowrap; }   /* one row: the longer word takes the larger share, fitButtons() does the rest */
/* a long word on the 178px phone ticket (Notizblock, Abschicken, Zuruecknehmen ...): game.js fitButtons()
   steps each button down until its label fits: tighter tracking, then sentence case, then 11px,
   then two lines. The 44px height never moves. */
body.phone .tbtn.fit1 { letter-spacing: 0; padding: 0 6px; }
body.phone .tbtn.fit2 { text-transform: none; letter-spacing: 0; padding: 0 5px; font-size: 13px; }
body.phone .tbtn.fit3 { text-transform: none; letter-spacing: 0; padding: 0 4px; font-size: 11px; }
body.phone .tbtn.fit4 { text-transform: none; letter-spacing: 0; padding: 2px 4px; font-size: 11px; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; }
body.phone .range span { font-size: 12px; line-height: 20px; }

/* ── The Marshal's notepad ──────────────────────────────────────────────────────────── */
.pad { position: absolute; z-index: 8; display: flex; flex-direction: column; gap: 6px; }
.pad[hidden] { display: none; }
.pad-bar { display: flex; align-items: center; gap: 6px; height: 44px; }
.pad-paper {
    position: relative; border-radius: 4px; box-shadow: 0 8px 22px rgba(0,0,0,.5);
    background: url('assets/cards/notepad.jpg') center / 100% 100% no-repeat, var(--paper);
}
.pad.mode-sheet {
    background: var(--night); border-radius: 10px; padding: 6px; z-index: 600; box-shadow: 0 0 0 100vmax rgba(4, 10, 13, 0.55);
}
.pad.mode-sheet .pad-bar { height: 44px; }
/* the phone sheet is the same notepad turned on its side: notepad.jpg's spiral down the left
   edge, its page stack down the right, its squared paper (the printed numbers lifted out,
   assets/cards/notepad-paper.webp) in between — re-ruled 10 × 5 for a finger. */
.pad.mode-sheet .pad-paper {
    background:
        url('assets/cards/notepad-rings.webp') left top / 28px auto repeat-y,
        url('assets/cards/notepad-pages.webp') right top / 12px auto repeat-y,
        url('assets/cards/notepad-paper.webp') 0 0 / 220px auto repeat,
        #f6ecda;
}
.pad-sum { flex: 1; min-width: 0; font: 700 18px var(--pencil); color: var(--paper); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-sum .pad-count { font: 500 12px var(--font); letter-spacing: 0.06em; color: var(--chalk-2); margin-left: 6px; }
.pad-clear {
    flex: none; min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; border: 1px solid rgba(233,230,220,.3);
    background: transparent; color: var(--chalk); font: 500 13px var(--font); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.pad-clear:hover { background: rgba(233,230,220,.08); }
.pad.mode-sheet .pad-bar .tbtn { flex: none; }
.pad-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(233,230,220,.12); color: var(--chalk); display: grid; place-items: center; cursor: pointer; }
.pad-close svg { pointer-events: none; }
.cell {
    position: absolute; border: 0; background: transparent; cursor: pointer; border-radius: 50%;
    display: grid; place-items: center; color: #3a2a20;
}
.cell .num { font: 700 20px var(--pencil); color: #3a2a20; }
.cell::before, .cell::after { content: ''; position: absolute; pointer-events: none; }
.cell.can:hover { background: rgba(47, 95, 134, 0.10); }
/* The marks are drawn by hand (game.js padInk, pen.js from Joan): filled nib outlines, so they swell and
   taper like pencil. An X through a number that is not a Hideout (seen face up, in your hand, a single
   guess that missed; faint once a later Hideout could undo the miss), a green ring round a found Hideout,
   a dotted blue ring round each number of a series that missed, the blue ring of the guess in progress.
   With Notes on, the same three marks are the Marshal's own. */
.cell .mk { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mk .ink { fill: rgba(58, 42, 32, 0.84); }
.mk .faint { fill: rgba(58, 42, 32, 0.3); }
.mk .green { fill: var(--found); }
.mk .blue { fill: var(--police); }
.mk .dots { fill: none; stroke: var(--police); stroke-linecap: round; stroke-dasharray: 0.1 6; }
.cell.picked { background: rgba(47, 95, 134, 0.10); }
.pad-notes {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 8px; border-radius: 22px;
    font: 600 12px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk); cursor: pointer;
    border: 1.5px solid rgba(233, 230, 220, 0.35); background: rgba(8, 21, 25, 0.7); user-select: none; flex: none;
}
.pad-notes input { width: 18px; height: 18px; margin: 0; accent-color: var(--police); cursor: pointer; }
.pad-notes.on { background: var(--paper); color: var(--police-ink); border-color: var(--paper); }
.pad-notes:has(input:focus-visible) { outline: 2px solid var(--lamp); outline-offset: 2px; }
.pad.mode-image .pad-paper { cursor: default; }

/* ── Hints, plates, toasts ──────────────────────────────────────────────────────────── */
.hint {
    position: absolute; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px;
    background: var(--paper); color: var(--ink); border-radius: 6px; box-shadow: var(--shadow); pointer-events: none;
}
.hint[hidden] { display: none; }
.hint .card { position: relative; flex: none; }
.hint-text { font: 500 14px/1.3 var(--font); }
#plates { position: fixed; inset: 0; z-index: 800; pointer-events: none; display: grid; place-items: center; }
.plate-note {
    pointer-events: auto; display: flex; gap: 16px; align-items: center; max-width: min(560px, calc(100vw - 24px));
    padding: 16px 20px 16px 16px; border-radius: 10px; background: var(--paper); color: var(--ink);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); opacity: 0; transform: translateY(10px); transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.8,.3,1);
}
.plate-note.show { opacity: 1; transform: none; }
.plate-note .card { position: relative; flex: none; }
.note-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.note-text h3 { font: 500 22px/1.15 var(--font); letter-spacing: 0.04em; }
.note-text p { font: 400 15px/1.4 var(--font); color: var(--ink-2); }
.note-text .tbtn { align-self: flex-start; margin-top: 4px; }
.plate-note.event h3 { text-transform: uppercase; letter-spacing: 0.16em; font-weight: 400; }
.plate-note.hit h3 { color: var(--police-ink); }
.plate-note.miss h3 { color: var(--ribbon-deep); }
.plate-note.manhunt { background: var(--ink); color: var(--paper); }
.plate-note.manhunt h3 { color: var(--ribbon); text-transform: uppercase; letter-spacing: 0.2em; font-size: 26px; }
.plate-note.manhunt p { color: #d9d4c8; }
body.phone .plate-note { padding: 10px 12px 10px 10px; gap: 10px; }
body.phone .note-text h3 { font-size: 17px; }
body.phone .note-text p { font-size: 13px; }
#toast {
    position: fixed; z-index: 900; left: 50%; bottom: 18px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 10px 16px; border-radius: 6px; background: #081519; color: var(--chalk); font: 500 14px var(--font); max-width: calc(100vw - 32px);
    border: 1px solid rgba(233,230,220,.15); transition: opacity 160ms, transform 200ms;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.alert { border-color: var(--ribbon); }

/* ── Dialog tickets ─────────────────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; place-content: center; background: rgba(4, 10, 13, 0.62); }   /* place-content: a ticket taller than the screen scales about the SCREEN's centre */
.ticket {
    position: relative; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 16px); overflow: auto;
    background: var(--paper); color: var(--ink); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); transform-origin: center;
}
.ticket-top { display: flex; gap: 16px; align-items: flex-start; }
.ticket-top .card { position: relative; flex: none; }
.ticket-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ticket-text h2 { font: 400 22px/1.15 var(--font); letter-spacing: 0.12em; text-transform: uppercase; }
.ticket-text p { font: 400 15px/1.45 var(--font); color: var(--ink-2); }
.ticket-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.numgrid { display: grid; grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 4px; }
.num-btn {
    min-height: 44px; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
    font: 700 20px var(--pencil); color: #3a2a20;
}
.num-btn:hover { background: rgba(47, 95, 134, 0.12); }
.overlay.numbers .ticket { width: min(460px, calc(100vw - 16px));
    background-image: linear-gradient(rgba(120,140,150,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(120,140,150,.18) 1px, transparent 1px);
    background-size: 22px 22px; }
.deck-choice { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.deck-pick {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; border: 2px solid transparent;
    background: var(--paper-2); cursor: pointer; font: 500 13px var(--font); color: var(--ink); min-width: 80px;
}
.deck-pick .card { position: relative; }
.deck-pick:hover:not(:disabled) { border-color: var(--lamp); }
.deck-pick:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Welcome + end ──────────────────────────────────────────────────────────────────── */
#welcome { position: fixed; inset: 0; z-index: 1190; display: grid; place-items: center; background: rgba(4, 10, 13, 0.4); opacity: 0; transition: opacity 300ms; }
#welcome.show { opacity: 1; }
.welcome-plate {
    display: flex; gap: 18px; align-items: center; padding: 20px 26px 20px 20px; border-radius: 10px;
    background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.6); max-width: calc(100vw - 24px);
    transform: translateY(10px); transition: transform 380ms cubic-bezier(.2,.8,.3,1);
}
#welcome.show .welcome-plate { transform: none; }
.welcome-plate .card { position: relative; flex: none; }
.welcome-plate h2 { font: 300 30px var(--font); letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 6px; }
.welcome-plate p { font: 400 16px/1.4 var(--font); color: var(--ink-2); }
.welcome-first { color: var(--ink) !important; font-weight: 500 !important; margin-top: 4px; }
body.phone .welcome-plate h2 { font-size: 22px; }
.end-ticket { width: min(980px, calc(100vw - 24px)); align-items: center; text-align: center; }
.end-ticket h2 { font: 300 46px/1 var(--font); letter-spacing: 0.3em; text-transform: uppercase; padding-left: 0.3em; }
.end-ticket.escaped h2 { color: var(--ribbon); }
.end-ticket.caught h2 { color: var(--police); }
.end-sub { font: 400 16px/1.4 var(--font); color: var(--ink-2); max-width: 60ch; }
.end-route { display: flex; gap: 8px; justify-content: safe center; flex-wrap: nowrap; overflow-x: auto; padding: 10px; border-radius: 8px; background: var(--avenue); width: 100%; align-items: flex-start; }
.end-col { flex: none; }
.end-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.end-col .card { position: relative; }
.end-col.was-down .end-card { outline: 2px solid var(--ribbon); outline-offset: 2px; }
.end-tag { font: 500 10px var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-2); white-space: nowrap; }
.end-col.was-down .end-tag { color: #f0a79b; }
.end-sprints { display: flex; flex-direction: column; align-items: center; }
.end-sprints .card + .card { margin-top: var(--sp-tuck, -70%); }   /* game.js sets the tuck from the room a phone has */
.end-sprints .card { box-shadow: 0 2px 5px rgba(0,0,0,.5); }

/* ── Side panels, rules ─────────────────────────────────────────────────────────────── */
.side-panel {
    position: fixed; z-index: 1100; right: 10px; top: 64px; bottom: 10px; width: min(360px, calc(100vw - 20px));
    background: var(--paper); color: var(--ink); border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
#header-bar.rail ~ .side-panel, body.phone .side-panel { top: 8px; left: 64px; right: auto; width: min(380px, calc(100vw - 74px)); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 16px; border-bottom: 1px solid rgba(27,27,29,.12); }
.panel-head h3 { font: 500 14px var(--font); letter-spacing: 0.2em; text-transform: uppercase; }
.panel-close { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.panel-close svg { pointer-events: none; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 14px 14px; -webkit-overflow-scrolling: touch; user-select: text; }
.panel-foot { padding: 10px 14px; font: 400 12px/1.4 var(--font); color: var(--ink-2); border-top: 1px solid rgba(27,27,29,.12); }
.panel-empty { color: var(--ink-2); font-style: italic; padding: 10px 0; }
.log-block { padding: 8px 0; border-bottom: 1px dashed rgba(27,27,29,.22); }
.log-turn { font: 600 11px var(--font); letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 4px; }
.log-turn.fugitive { color: var(--ribbon-deep); }
.log-turn.marshal { color: var(--police); }
.log-line { font: 400 14px/1.45 var(--font); font-variant-numeric: tabular-nums; }
.log-line.private { color: var(--police-ink); }
.log-line.private::before { content: '◆ '; font-size: 9px; vertical-align: 2px; }
.log-line.k-guess { font-weight: 500; }
.ai-entry { padding: 8px 0; border-bottom: 1px dashed rgba(27,27,29,.22); }
.ai-head { font: 500 13px/1.35 var(--font); }
.ai-sub { font: 400 12px var(--font); color: var(--ink-2); margin: 2px 0 4px; }
.ai-row { display: grid; grid-template-columns: 12px 1fr 70px 40px; gap: 6px; align-items: center; font: 400 13px var(--font); font-variant-numeric: tabular-nums; padding: 1px 0; }
.ai-row.chosen { font-weight: 600; color: var(--ribbon-deep); }
.ai-bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.ai-bar i { display: block; height: 100%; background: var(--police); }
.ai-row.chosen .ai-bar i { background: var(--ribbon); }
.ai-val { text-align: right; }
/* the sheet's head (title + close) stands still; only the text scrolls */
#rules-popup {
    position: fixed; z-index: 1200; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 20px);
    display: flex; flex-direction: column; overflow: hidden; background: var(--paper); color: var(--ink); border-radius: 10px; padding: 0; box-shadow: 0 18px 50px rgba(0,0,0,.6); user-select: text;
}
#rules-popup h3 { flex: none; font: 300 24px var(--font); letter-spacing: 0.24em; text-transform: uppercase; margin: 0; padding: 20px 56px 12px 24px; border-bottom: 1px solid rgba(27,27,29,.1); }
#rules-popup .rules-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 24px 18px;
    scrollbar-width: thin; scrollbar-color: rgba(27,27,29,.3) transparent;
}
body.phone #rules-popup h3 { font-size: 19px; padding: 12px 56px 10px 18px; }
body.phone #rules-popup .rules-body { padding: 2px 18px 14px; }
#rules-popup h4 { font: 600 12px var(--font); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ribbon-deep); margin: 14px 0 4px; }
#rules-popup p { font: 400 15px/1.55 var(--font); color: #2e2e30; max-width: 65ch; }
.rules-credit { margin-top: 16px; font-size: 13px !important; color: var(--ink-2) !important; }
#rules-popup-close { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
#rules-popup-close svg { pointer-events: none; }

/* back.js's question, in the game's paper */
#dk-back-ask .dk-back-panel { background: var(--paper) !important; color: var(--ink) !important; font-family: var(--font) !important; border-radius: 10px !important; border: 0 !important; }
#dk-back-ask .dk-back-panel h2 { color: var(--ink) !important; font: 400 20px var(--font) !important; letter-spacing: 0.1em; text-transform: uppercase; }
#dk-back-ask .dk-back-panel p { color: var(--ink-2) !important; }
#dk-back-ask button { min-height: 44px; border-radius: 6px !important; font: 600 14px var(--font) !important; text-transform: uppercase; letter-spacing: 0.08em; }
#dk-back-ask .dk-back-stay { background: var(--ribbon-ink) !important; color: #fff8f2 !important; border: 2px solid var(--ribbon-ink) !important; }
#dk-back-ask .dk-back-leave { background: transparent !important; color: var(--ink) !important; border: 2px solid var(--ink) !important; }

/* ── Start screen: a dispatch ticket over the duotone poster ────────────────────────── */
#start-screen {
    position: fixed; inset: 0; z-index: 2000; overflow: hidden;
    background:
        linear-gradient(90deg, rgba(11, 29, 36, 0.2), rgba(11, 29, 36, 0.86) 58%),
        linear-gradient(rgba(19, 53, 64, 0.55), rgba(19, 53, 64, 0.55)),
        url('assets/cover.webp') left 12% top 8% / auto 150% no-repeat,
        var(--night);
    background-blend-mode: normal, color, normal, normal;
}
.start-card {
    position: absolute; left: 50%; top: 50%; transform-origin: center; width: 760px;
    background: var(--paper); color: var(--ink); border-radius: 12px; padding: 26px 30px 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.start-top { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; padding-right: 50px; }
.start-title { font: 300 52px/1 var(--font); letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink); }
.start-tag { font: 400 15px/1.35 var(--font); color: var(--ink-2); flex: 1; min-width: 220px; }
.start-cols { display: grid; grid-template-columns: 300px 1fr; gap: 28px; margin-top: 20px; }
.start-label { display: block; font: 600 11px var(--font); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; white-space: nowrap; }
.side-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side {
    position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; border-radius: 10px;
    border: 2px solid transparent; background: var(--paper-2); cursor: pointer; text-align: left;
}
.side-art { display: block; width: 100%; aspect-ratio: 375 / 300; border-radius: 6px; background-size: cover; background-position: center 12%; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.side-words { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.side-name { font: 500 17px var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); }
.side-note { font: 400 13px/1.3 var(--font); color: var(--ink-2); min-height: 2.6em; }
.side.on { border-color: var(--ink); background: #fff; }
.side.fugitive.on .side-name { color: var(--ribbon-deep); }
.side.marshal.on .side-name { color: var(--police); }
.side.on::after { content: ''; position: absolute; right: 12px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--ribbon); box-shadow: 0 0 0 3px #fff; }
.side.marshal.on::after { background: var(--police); }
.start-set { display: flex; flex-direction: column; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; background: var(--ink); border-radius: 8px; overflow: hidden; }
.seg-btn { min-height: 44px; border: 0; border-radius: 6px; background: var(--paper); font: 500 14px var(--font); color: var(--ink); cursor: pointer; white-space: nowrap; padding: 0 6px; }
.seg-btn.on { background: var(--ink); color: var(--paper); }
.start-note { font: 400 13px/1.35 var(--font); color: var(--ink-2); margin: 6px 0 14px; min-height: 2.7em; }
.start-select {
    width: 100%; min-height: 44px; border-radius: 8px; border: 2px solid var(--ink); background: #fff; padding: 0 12px;
    font: 500 15px var(--font); color: var(--ink); cursor: pointer;
}
.start-go { display: flex; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.start-btn {
    min-height: 52px; padding: 0 22px; border-radius: 8px; border: 2px solid var(--ink); background: transparent; color: var(--ink);
    font: 600 16px var(--font); letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
}
.start-btn.start-play { flex: 1; background: var(--ribbon-ink); border-color: var(--ribbon-ink); color: #fff8f2; box-shadow: 0 4px 12px rgba(120,30,20,.35); }
.start-btn.start-play:hover { background: var(--ribbon-ink-2); border-color: var(--ribbon-ink-2); }
.start-btn.continue {
    flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0;
    background: var(--ribbon-ink); border-color: var(--ribbon-ink); color: #fff8f2; box-shadow: 0 4px 12px rgba(120,30,20,.35);
}
.start-btn.continue:hover { background: var(--ribbon-ink-2); border-color: var(--ribbon-ink-2); }
.start-btn.continue .sb-sub { font: 400 12px var(--font); letter-spacing: 0.04em; text-transform: none; color: #fff8f2; }
/* with a saved chase, Continue holds the ribbon and New chase is one of the quiet buttons (one primary per ticket) */
.start-btn.start-play.new-chase { background: transparent; border-color: var(--ink); color: var(--ink); box-shadow: none; }
.start-btn.start-play.new-chase:hover { background: rgba(27,27,29,.06); border-color: var(--ink); }
/* pressed: the button gives a pixel, never a colour jump */
.start-btn:active, .tbtn:active:not(:disabled) { transform: translateY(1px); }
/* the side cards and level segments answer the pointer before they are chosen */
.side:not(.on):hover { border-color: rgba(27,27,29,.35); }
.seg-btn:not(.on):hover { background: var(--paper-2); }
@media (prefers-reduced-motion: reduce) { .start-btn:active, .tbtn:active:not(:disabled) { transform: none; } }
.start-btn.ghost:hover { background: rgba(27,27,29,.06); }
.start-credits { margin-top: 16px; font: 400 12px var(--font); color: var(--ink-2); letter-spacing: 0.04em; border-top: 1px solid rgba(27,27,29,.12); padding-top: 10px; }
.start-support { display: inline-block; margin-top: 4px; font: 500 13px var(--font); color: var(--ribbon-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(0,0,0,.25); }
.start-support:hover { text-decoration-color: currentColor; }
.start-support:focus-visible { outline: 2px solid var(--ribbon-deep); outline-offset: 2px; border-radius: 4px; }
@media (pointer: coarse) { .start-support { display: inline-flex; align-items: center; min-height: 44px; margin-top: 0; } }
.start-lang { position: absolute; right: 16px; top: 16px; width: 48px; height: 44px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.start-lang:hover { background: var(--paper-2); }
.start-lang .flag { width: 30px; height: 20px; }
@media (max-height: 520px), (max-width: 700px) {
    .start-card { width: 620px; padding: 14px 18px 10px; }
    .start-title { font-size: 34px; }
    .start-tag { font-size: 13px; }
    .start-cols { grid-template-columns: 230px 1fr; gap: 16px; margin-top: 10px; }
    .side { padding: 6px; gap: 2px; }
    .side-words { gap: 2px; }
    .side-art { aspect-ratio: 375 / 190; }
    .side-name { font-size: 14px; }
    .side-note { font-size: 11px; min-height: 0; }
    .start-note { margin: 4px 0 8px; font-size: 12px; min-height: 2.5em; }
    .start-label { margin-bottom: 4px; }
    .start-btn { min-height: 46px; font-size: 14px; padding: 0 14px; }
    .start-btn.continue { min-height: 44px; }
    .start-credits { margin-top: 8px; padding-top: 6px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .deck.live .deck-top, .slot-card.pickable { animation: none; }
    .flip { animation: none; }
    .plate-note, #welcome, .welcome-plate, #toast, .hand-card { transition: none; }
}

/* the number pad dialog: a close × in its corner; on a phone the grid runs 11 wide, title only */
.ticket-x { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.ticket-x svg { pointer-events: none; }
body.phone .overlay.numbers .ticket { width: min(560px, calc(100vw - 72px)); padding: 10px 12px; gap: 6px; }
body.phone .overlay.numbers .ticket-text p, body.phone .overlay.numbers .ticket-actions { display: none; }
body.phone .overlay.numbers .ticket-text h2 { font-size: 18px; }
body.phone .overlay.numbers .numgrid { grid-template-columns: repeat(11, 1fr); gap: 2px; }
body.phone .overlay.numbers .num-btn { font-size: 18px; }
body.phone #toast { bottom: auto; top: 8px; transform: translate(-50%, -20px); }
body.phone #toast.show { transform: translate(-50%, 0); }
body.phone .ticket { padding: 12px; gap: 10px; }
body.phone .ticket-text h2 { font-size: 18px; }
body.phone .ticket-text p { font-size: 14px; }

/* ── Finish-review pass ─────────────────────────────────────────────────────────────── */
/* small route cards carry their number as a legible chip (the printed one is ~7px there) */
.num-chip {
    position: absolute; left: 2px; top: 2px; z-index: 3; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: var(--paper); color: var(--ink); font: 600 13px/18px var(--font); text-align: center; font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
/* the Sighting / Road Block evidence: a small pinned paper tag, sized by its words */
.evidence { width: auto; padding: 0 6px; border-radius: 2px; transform: rotate(-2deg); }
.evidence::before { content: ''; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ribbon); box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.evidence { overflow: visible; }
body.phone .evidence { font-size: 11px; line-height: 14px; padding: 0 4px; letter-spacing: 0; }
/* the Manhunt: the city goes dark around the route; only the lamp is left */
body.manhunt #route { background: #081a20; box-shadow: inset 0 0 0 1px rgba(212, 81, 63, 0.35), 0 8px 26px rgba(0, 0, 0, 0.5); }
body.manhunt #route-inner::before { background: repeating-linear-gradient(90deg, rgba(212, 81, 63, 0.35) 0 18px, transparent 18px 36px); }
body.manhunt #strip, body.manhunt #hand { filter: brightness(0.6) saturate(0.7); }
body.manhunt .lamp { background: radial-gradient(circle, rgba(232, 185, 71, 0.4) 0%, rgba(232, 185, 71, 0.14) 40%, transparent 70%); }
/* the deck back's slanted ribbon, carried onto the two climaxes */
.end-ticket h2, .plate-note.manhunt h3 {
    display: inline-block; align-self: center; padding: 6px 22px 6px calc(22px + 0.3em); transform: rotate(-4deg) skewX(-6deg);
    background: var(--ribbon-ink); color: #fff8f2 !important; box-shadow: 0 4px 10px rgba(120, 30, 20, 0.35);
}
.end-ticket.caught h2 { background: var(--police); box-shadow: 0 4px 10px rgba(20, 40, 70, 0.35); }
.plate-note.manhunt h3 { align-self: flex-start; padding: 4px 16px; font-size: 24px; }
.end-ticket h2 { margin: 6px 0 4px; }
.plate-role { transform: skewX(-8deg); }

/* a long route: the strip never shrinks under its Sprint cards; a desk wraps it into rows */
.end-route { flex: none; }
.end-route.wrap { display: grid; justify-content: center; column-gap: 8px; row-gap: 12px; }
.end-ticket { max-height: none; overflow: visible; }      /* fitTicket scales it whole instead of clipping the buttons */
/* the shared "more games" strip (core/moreGames.js) sits under Menu / Play again in the ticket's ink */
.end-ticket .dk-more { flex: none; align-self: center; width: min(560px, 100%); margin: 2px auto 0; color: var(--ink); }
/* a short screen: the ticket keeps its height and the strip scrolls in below the buttons */
.end-ticket.end-scroll { max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(27,27,29,.3) transparent; }
.end-ticket.end-scroll > * { flex-shrink: 0; }
body.phone .end-ticket h2 { font-size: 24px; padding-top: 4px; padding-bottom: 4px; margin: 0; }
body.phone .end-ticket { gap: 6px; padding: 10px 12px; }
body.phone .end-sub { font-size: 13px; line-height: 1.3; }
body.phone .end-route { padding: 6px 8px; }
body.phone .end-tag { font-size: 8px; }
body.phone .end-ticket .tbtn { flex: none; padding: 0 18px; }
.end-tag { max-width: 100%; white-space: normal; text-align: center; line-height: 1.15; font-size: 9px; letter-spacing: 0.06em; }
/* the phone ticket: one compact column — status, the range chips, the buttons */
body.phone #status-msg { font-size: 12px; line-height: 1.25; }
body.phone .range span { font-size: 11px; line-height: 18px; padding: 0 6px; }
body.phone .plate-body { gap: 3px; }

#toast { transform: translate(-50%, -8px); z-index: 960; }      /* above the tutorial's veil and slip: a refusal is always seen */
#toast.show { transform: translate(-50%, 0); }

/* ── Tutorial ───────────────────────────────────────────────────────────────────────── */
/* The coach's line is a dispatch slip: cream paper, the Fugitive's slanted ribbon as its tag, the
   role card as its picture (hidden on the phone). The spotlight darkens the city and rings what
   the line points at in the lamp's mustard — "act here" keeps its one meaning. */
.tut-caption {
    position: fixed; z-index: 950; left: 50%; top: 64px; display: flex; gap: 14px; align-items: flex-start;
    width: max-content; max-width: min(540px, calc(100vw - 24px)); padding: 14px 16px 12px 14px;
    border-radius: 10px; background: var(--paper); color: var(--ink);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
    opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.8,.3,1);
}
.tut-caption.show { opacity: 1; transform: none; pointer-events: auto; }
.tut-card {
    flex: none; width: 54px; height: 76px; border-radius: 5px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
    background: url('assets/cards/role-fugitive.webp') center / cover no-repeat;
}
.tut-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tut-tag {
    align-self: flex-start; padding: 2px 8px; border-radius: 3px; background: var(--ribbon-ink); color: #fff8f2;
    font: 600 11px var(--font); letter-spacing: 0.22em; text-transform: uppercase; transform: skewX(-8deg);
}
.tut-text { font: 400 15px/1.45 var(--font); color: var(--ink); max-width: 56ch; }
.tut-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tut-actions:not(:has(.tbtn:not([style*="none"]))) { display: none; }
.tut-veil { position: fixed; inset: 0; z-index: 940; pointer-events: none; opacity: 0; transition: opacity 220ms ease; }
.tut-veil.on { opacity: 1; }
.tut-rings { position: fixed; inset: 0; z-index: 941; pointer-events: none; }
.tut-ring {
    position: absolute; border-radius: 10px; border: 2px solid var(--lamp);
    box-shadow: 0 0 0 3px rgba(232, 185, 71, 0.22), 0 0 18px rgba(232, 185, 71, 0.45); animation: tut-pulse 1.6s ease-in-out infinite;
}
@keyframes tut-pulse { 50% { box-shadow: 0 0 0 5px rgba(232, 185, 71, 0.10), 0 0 26px rgba(232, 185, 71, 0.6); } }
.end-tut { font: 500 16px/1.4 var(--pencil); color: var(--police-ink); max-width: 60ch; }      /* the coach signs off in pencil */
body.phone .tut-card { display: none; }
body.phone .tut-caption { padding: 6px 8px 6px 10px; gap: 8px; max-width: calc(100vw - 76px); }
body.phone .tut-main { gap: 4px; }
body.phone .tut-text { font-size: 12.5px; line-height: 1.3; }
body.phone .tut-tag { display: none; }
/* the phone slip is one band: the words left, Back / Continue right */
body.phone .tut-main { flex-direction: row; align-items: center; gap: 10px; }
body.phone .tut-text { flex: 1; min-width: 0; }
body.phone .tut-actions { flex: none; }
body.phone .tut-actions .tbtn { flex: none; padding: 0 16px; }
body.phone .end-tut { font-size: 12px; }
@media (prefers-reduced-motion: reduce) {
    .tut-caption, .tut-veil { transition: none; }
    .tut-ring { animation: none; }
}

/* ── The net download (the AI Fugitive's move waits for its net) ───────────────────────
 * A fuse on the turn ticket: a thin track of the ticket's paper-2, burning ribbon-red — the
 * Fugitive's colour, never the lamp (mustard means "you may act here", and here you may not).
 * Indeterminate (no size known yet, or the runtime starting): a short ember travels the track. */
.net-load { display: flex; align-items: center; gap: 8px; min-width: 0; }
.net-load-track { position: relative; flex: 1; min-width: 60px; height: 4px; border-radius: 2px; background: var(--paper-2); overflow: hidden; }
.net-load-fuse { position: absolute; inset: 0; background: var(--ribbon); transform-origin: left center; transform: scaleX(0.02); transition: transform 0.35s ease-out; }
.net-load.indeterminate .net-load-fuse { right: auto; width: 28%; transform: none; animation: net-ember 1.3s ease-in-out infinite; }
@keyframes net-ember { 0% { left: -28%; } 100% { left: 100%; } }
.net-load-text { flex: none; font: 500 12px/1.2 var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* phone: the ticket has no spare row (the Notepad button fills it) — the fuse runs along the
   ticket's punched top edge, full width; the words above already say what is loading */
body.phone .net-load { position: absolute; left: 10px; right: 10px; top: 7px; }
body.phone .net-load-track { height: 3px; }
body.phone .net-load-text { display: none; }
@media (prefers-reduced-motion: reduce) {
    .net-load-fuse { transition: none; }
    .net-load.indeterminate .net-load-fuse { animation: none; left: 0; width: 100%; opacity: 0.45; }
}

/* ── Japanese and Korean ─────────────────────────────────────────────────────────────────
 * Jost and Kalam have no CJK glyphs, so ja/ko put a matching CJK face BEHIND each: Latin, digits
 * and punctuation keep the game's own hands, the CJK glyphs come from
 *   ja  Zen Kaku Gothic New — a clean geometric gothic, Jost's kin; Klee One 600 — a pencil-drawn
 *       kana/kanji, the Marshal's notepad hand (Kalam's role)
 *   ko  Gothic A1 — the same geometric gothic role; Gaegu 700 — handwritten in pencil
 * vendor/fonts-ja|ko/fonts.css (CJK unicode-range slices only, SIL OFL) is linked by i18n.js only
 * when the game runs in that language. Wide caps tracking is a Latin gesture: CJK labels get their
 * letter-spacing back (uppercase means nothing to them). Japanese breaks per glyph under
 * line-break: strict; Korean keeps words whole (keep-all), overflow-wrap as the safety net. */
:root:lang(ja) {
    --font: 'Jost', 'Zen Kaku Gothic New', 'Yu Gothic', 'Hiragino Sans', system-ui, sans-serif;
    --pencil: 'Kalam', 'Klee One', 'Yu Gothic', cursive;
}
:root:lang(ko) {
    --font: 'Jost', 'Gothic A1', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
    --pencil: 'Kalam', 'Gaegu', 'Malgun Gothic', cursive;
}
:root:lang(ja) body { line-break: strict; }
:root:lang(ko) body { word-break: keep-all; overflow-wrap: break-word; }
:root:lang(ja) :is(.start-label, .plate-role, .tbtn, .gkind, .ticket-text h2, .start-btn, .seg-btn, .side-name),
:root:lang(ko) :is(.start-label, .plate-role, .tbtn, .gkind, .ticket-text h2, .start-btn, .seg-btn, .side-name) { letter-spacing: 0.02em; }
/* the published edition's own title, under the FUGITIVE wordmark (ja/ko only) */
.start-edition { font: 500 17px/1.2 var(--font); color: var(--ribbon-deep); letter-spacing: 0.06em; white-space: nowrap; }
/* the rules sheet's way on: the full how-to-play page of this language */
#rules-popup .rules-more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; color: var(--ribbon-deep);
    font: 600 14px var(--font); text-decoration: underline; text-underline-offset: 3px; }
#rules-popup .rules-more:hover { color: var(--ribbon); }

/* ── Menus on a short screen: seven languages fold into two columns (header.js popMenu) ── */
.hdr-menu { max-height: calc(100vh - 12px); overflow-y: auto; overscroll-behavior: contain; }
.hdr-menu.cols2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2px; }

/* a narrow upright window (a desk, or a tablet split): the header keeps one row inside the width */
@media (max-width: 480px) and (min-height: 481px) {
    #header-bar { gap: 4px; padding: 0 6px; }
    .hdr-title { font-size: 16px; letter-spacing: 0.2em; padding-left: 0.2em; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
    .hdr-tools { flex: none; }
    #ai-indicator { width: 44px; padding: 0; margin: 0; border-radius: 50%; }
    #ai-indicator .ai-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ── Start ticket on a phone on its side (start.js COMPACT_Q) ─────────────────────────
 * The whole ticket used to be scaled to fit, which shrank Play to 27px at 640×300. Now it keeps
 * scale 1 and splits: the wordmark row and the settings (scrolling inside, under a paper fade) on
 * the left, the launch column on the right — Continue, Play, Tutorial, Play together, Rules are
 * always in view and never under 44px. start.js fitCard() gives it the screen's height less 8px. */
.start-card.compact {
    display: grid; grid-template-columns: minmax(0, 1fr) 206px; column-gap: 14px;
    width: 760px; max-width: calc(100vw - 16px); padding: 8px 12px 10px 16px; border-radius: 10px;
}
.compact .start-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.compact .start-top { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; padding-right: 0; min-height: 44px; }
.compact .start-title { font-size: 28px; letter-spacing: 0.28em; flex: none; }
.compact .start-edition { font-size: 13px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.compact .start-lang { position: static; flex: none; margin-left: auto; width: 48px; height: 44px; }
.compact .start-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 6px 6px 0; margin-right: -6px;
    scrollbar-width: thin; scrollbar-color: rgba(27,27,29,.28) transparent;
}
/* more settings below (Events, the credits): the pane's foot fades out until it is scrolled to the end */
.compact .start-scroll.more-below {
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 40px), rgba(0,0,0,.12));
            mask-image: linear-gradient(180deg, #000 calc(100% - 40px), rgba(0,0,0,.12));
}
.compact .start-tag { font-size: 12.5px; line-height: 1.3; min-width: 0; margin: 0 0 8px; }
.compact .start-cols { grid-template-columns: 1fr; gap: 8px; margin-top: 0; }
.compact .start-label { margin-bottom: 3px; font-size: 10px; letter-spacing: 0.18em; }
.compact .side-pair { gap: 8px; }
.compact .side { flex-direction: row; align-items: center; gap: 8px; padding: 4px 26px 4px 4px; min-height: 52px; }
.compact .side-art { flex: none; width: 56px; aspect-ratio: 375 / 300; border-radius: 4px; }
.compact .side-words { gap: 1px; }
.compact .side-name { font-size: 14px; letter-spacing: 0.12em; }
.compact .side-note { font-size: 11.5px; line-height: 1.25; min-height: 0; }
.compact .side.on::after { right: 8px; top: 50%; margin-top: -6px; width: 12px; height: 12px; }
.compact .seg-btn { font-size: 13px; }
.compact .start-note { margin: 3px 0 8px; font-size: 12px; line-height: 1.3; min-height: 0; }
.compact .start-select { font-size: 14px; }
.compact .start-credits { margin-top: 4px; padding-top: 6px; font-size: 11px; }
.compact .start-support { font-size: 12.5px; }
.compact .start-go { display: flex; flex-direction: column; justify-content: center; gap: 6px; margin: 0; flex-wrap: nowrap; min-height: 0; }
.compact .start-btn { flex: none; width: 100%; min-height: 44px; padding: 2px 10px; font-size: 13px; letter-spacing: 0.08em; line-height: 1.1; white-space: normal; }
.compact .start-btn.start-play { min-height: 58px; font-size: 16px; letter-spacing: 0.14em; }
.compact .start-btn.continue { min-height: 58px; padding: 4px 12px; flex-basis: auto; }
.compact .start-btn.continue + .start-play { min-height: 44px; font-size: 13px; letter-spacing: 0.08em; }   /* with a saved chase, New chase steps back */
.compact .start-btn.continue .sb-sub { font-size: 11px; }

/* ── Rotate gate (rotate.js): an upright phone gets this, not a squeezed city ──────────
 * OPAQUE night map, the role card turning to lie along the avenue's mustard centre line. `[hidden]`
 * is restated, or `display: flex` beats the UA rule and the cover eats every tap. Above every
 * layer the game owns (menus 2100, back question, online dialogs). */
#rotate-cover {
    position: fixed; inset: 0; z-index: 5000;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    background-color: var(--street);
    background-image:
        radial-gradient(ellipse at 50% 42%, rgba(232, 185, 71, 0.10), transparent 62%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23133540'%3E%3Crect x='6' y='6' width='48' height='30' rx='3'/%3E%3Crect x='64' y='6' width='50' height='52' rx='3'/%3E%3Crect x='6' y='46' width='48' height='68' rx='3'/%3E%3Crect x='64' y='68' width='50' height='46' rx='3'/%3E%3C/g%3E%3C/svg%3E");
    background-size: auto, 120px 120px;
}
#rotate-cover[hidden] { display: none; }
html.rotate-locked, html.rotate-locked body { overflow: hidden; }
.rot-inner {
    max-width: 22rem; text-align: center; padding: 22px 22px 24px; border-radius: 10px;
    background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    word-break: keep-all; overflow-wrap: break-word;
}
#rotate-cover h2 { font: 400 20px/1.25 var(--font); letter-spacing: 0.12em; text-transform: uppercase; margin: 10px 0 8px; }
:root:lang(ja) #rotate-cover h2, :root:lang(ko) #rotate-cover h2 { letter-spacing: 0.02em; }
#rotate-cover p { font: 400 15px/1.5 var(--font); color: var(--ink-2); }
.rot-phone { width: 104px; height: 104px; display: block; margin: 0 auto; }
.rot-lane { stroke: var(--lamp); stroke-width: 3; stroke-dasharray: 9 7; opacity: 0.85; }
.rot-body { fill: var(--paper-2); stroke: var(--ink); stroke-width: 3; }
.rot-ribbon { fill: var(--ribbon-ink); }
.rot-arrow { fill: none; stroke: var(--police); stroke-width: 3.2; stroke-linecap: round; }
.rot-head { fill: var(--police); }
.rot-turn { transform-origin: 60px 50px; transform-box: view-box; animation: fg-rot-turn 3.2s cubic-bezier(.5, 0, .2, 1) infinite; }
@keyframes fg-rot-turn {
    0%, 28%   { transform: rotate(0deg); }
    52%, 86%  { transform: rotate(90deg); }
    100%      { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) { .rot-turn { animation: none; transform: rotate(90deg); } }
