/* RipperClue game — Colonial Gothic Noir (The Black Ledger). Tokens and components follow design-spec.md. */

/* Fonts are optional files copied in by `npm run fonts`. Without them the fallbacks below are used. */
@font-face { font-family: "Playfair Display"; font-weight: 600; font-display: swap; src: url("/fonts/playfair-display-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url("/fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/playfair-display-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-display: swap; src: url("/fonts/newsreader-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 500; font-display: swap; src: url("/fonts/newsreader-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/newsreader-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  /* dark surfaces */
  --canvas: #0d141e; --surface-1: #151c27; --surface-2: #19202b; --surface-3: #232a36; --surface-4: #2e3541;
  /* text and lines on dark */
  --text: #dce3f2; --text-secondary: #d5c3b5; --text-muted: #9d8e81; --outline: #9d8e81; --outline-subtle: #50453a;
  /* gold: the single accent */
  --gold: #f6bb7e; --gold-fill: #c9935a; --on-gold: #0d141e; --gold-border: rgba(201, 147, 90, .18);
  /* status */
  --success: #00df81; --success-container: #13332f; --danger: #ffb3b2; --danger-fill: #9e2a2b; --danger-container: #2b1e28;
  --patina: #aacdcb; --patina-fill: #4a6b69;
  /* parchment */
  --parchment: #eadeca; --parchment-light: #f4ead4; --ink: #0d141e; --ink-secondary: #2a313c; --ink-muted: #663e0b;
  --ink-link: #815522; --ink-success: #00522e; --ink-danger: #8c1423;
  /* type */
  --serif-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  /* space */
  --xs: 4px; --sm: 8px; --md: 14px; --lg: 20px; --xl: 32px; --margin: 16px;
  --hdr: 56px; --tabs: 64px; --card-pad: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--text); font: 400 1rem/1.5 var(--serif); overscroll-behavior: none; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
a { color: var(--gold); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#live { position: fixed; top: 0; left: 0; } /* after #app in the page; left in flow it adds 1 px of page scroll */
.sprite { position: absolute; width: 0; height: 0; }

/* ---- type ---- */
.display { font: 700 1.75rem/1.214 var(--serif-display); letter-spacing: -.01em; }
h1, .h1 { font: 600 1.625rem/1.23 var(--serif-display); }
h2, .h2 { font: 600 1.25rem/1.3 var(--serif-display); }
.narrative { font-size: 1.0625rem; line-height: 1.53; }
.body-sm { font-size: .875rem; line-height: 1.43; }
.label, .overline { font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.overline { color: var(--gold); }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.mono { font-family: var(--mono); }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; stroke-width: 2; }
.icon-fill { fill: currentColor; stroke: none; }

/* ---- app frame ---- */
#app { height: 100%; }
.screen { height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--canvas); position: relative; }
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--margin); display: flex; flex-direction: column; gap: 12px; }
.content > * { flex: none; }
.content.flush { padding: 0; gap: 0; overflow: hidden; }
.content.parch { background: var(--parchment); color: var(--ink); }
.pre { padding-top: max(var(--lg), env(safe-area-inset-top)); padding-bottom: max(var(--xl), env(safe-area-inset-bottom)); }
.spacer { flex: 1 !important; }

.hdr { flex: none; height: calc(var(--hdr) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--margin) 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--outline-subtle); }
.hdr-text { min-width: 0; flex: 1; }
.hdr-title { font: 600 1.25rem/1.3 var(--serif-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.hdr-back { flex: none; width: 44px; height: 44px; margin-left: -10px; display: grid; place-items: center; background: none; border: 0; color: var(--gold); }
.clock { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 500 .875rem/1.29 var(--mono); font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.clock .icon { width: 16px; height: 16px; stroke-width: 2; }
.clock.is-paused { color: var(--gold); }

/* A sentence, so body type rather than an uppercase label (spec §2.2); one line at 360 px. */
.strip { flex: none; min-height: 28px; padding: 5px var(--margin); display: flex; align-items: center; gap: 8px; background: var(--surface-3); color: var(--text); font: 500 .875rem/1.3 var(--serif); }
.strip .icon { width: 16px; height: 16px; stroke-width: 2; }
.strip-paused { background: var(--gold-fill); color: var(--on-gold); }
.strip-sync .icon { color: var(--patina); }

.actionbar { flex: none; padding: 12px var(--margin); background: var(--canvas); border-top: 1px solid var(--outline-subtle); display: flex; flex-direction: column; gap: 6px; }
.actionbar.parch-bar { background: var(--parchment); border-top-color: rgba(102, 62, 11, .3); color: var(--ink-secondary); }
.actionbar .helper { text-align: center; }
.actionbar > .status { align-self: center; }

.tabbar { flex: none; height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface-2); border-top: 1px solid var(--outline-subtle); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 48px; background: none; border: 0; color: var(--text-muted); }
.tab.is-active { color: var(--gold); }
.tab.is-active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 2px; background: var(--gold); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 4px; border: 1px solid transparent; font: 500 .875rem/1.29 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; text-decoration: none; transition: background-color .15s; }
.btn-block { width: 100%; }
.btn-primary { min-height: 52px; background: var(--gold-fill); color: var(--on-gold); }
.btn-primary:active { background: #b07f4b; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35); }
.actionbar .btn-primary { min-height: 56px; }
.btn-secondary { background: var(--surface-1); border-color: var(--gold-fill); color: var(--gold); }
.btn-secondary:active { background: var(--surface-3); }
.btn-danger { background: var(--danger-fill); color: var(--parchment); }
.btn-text { min-height: 44px; padding: 8px 4px; background: none; border: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; background: var(--surface-2); border-color: var(--outline); color: var(--text); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--surface-3); border-color: transparent; color: var(--text-muted); cursor: not-allowed; box-shadow: none; text-decoration: none; }
.parch .btn-text, .parch-bar .btn-text { color: var(--ink-link); }
.btn-row { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; align-items: center; }

/* ---- cards ---- */
.card { background: var(--surface-1); border: 1px solid var(--gold-border); border-radius: 4px; padding: var(--card-pad); display: flex; flex-direction: column; gap: 12px; }
.card-emph { border-color: var(--gold-fill); }
.card-success { background: var(--success-container); border-color: transparent; border-left: 3px solid var(--success); }
/* A stop finished by revealing the answer: gold like the hints, outlined in green so it still reads as correct and done. */
.card-revealed { background: rgba(201, 147, 90, .16); border: 2px solid var(--success); }
.card-danger { background: var(--danger-container); border-color: transparent; border-left: 3px solid var(--danger); }
.card-dashed { background: transparent; border: 1px dashed var(--outline); }
.card-inset { background: var(--surface-2); }
.card-tight { padding: 12px 16px; gap: 6px; }

.status { display: inline-flex; align-items: center; gap: 6px; font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.status .icon { width: 16px; height: 16px; stroke-width: 2.25; }
.status-success { color: var(--success); }
.status-danger { color: var(--danger); }
.status-gold { color: var(--gold); }
.status-muted { color: var(--text-muted); }
.parch .status-success { color: var(--ink-success); }

.msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 4px; background: var(--surface-2); font-size: .9375rem; line-height: 1.4; }
.msg .icon { width: 20px; height: 20px; margin-top: 1px; }
.msg-danger { background: var(--danger-container); color: var(--danger); }
.msg-success { background: var(--success-container); color: var(--success); }
.msg-info .icon { color: var(--patina); }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field .label { color: var(--text-secondary); }
.helper { font-size: .875rem; line-height: 1.43; color: var(--text-muted); }
.input { width: 100%; height: 56px; padding: 0 14px; background: var(--canvas); border: 1px solid var(--outline); border-radius: 4px; font: 500 1rem/1.5 var(--mono); color: var(--text); }
.input::placeholder { color: var(--text-muted); opacity: .8; }
.input:focus { outline: none; border: 2px solid var(--gold); padding: 0 13px; }
.input.is-err { border: 2px solid var(--danger); padding: 0 13px; }
.input-upper { text-transform: uppercase; letter-spacing: .08em; }
.field-msg { display: flex; align-items: center; gap: 6px; font-size: .875rem; line-height: 1.43; min-height: 20px; }
.field-msg .icon { width: 16px; height: 16px; stroke-width: 2.25; }
.field-msg.is-ok { color: var(--success); }
.field-msg.is-err { color: var(--danger); }
.field-msg a, .field-msg .btn-text { min-height: 0; padding: 0; font: inherit; text-transform: none; letter-spacing: 0; }

.pin { position: relative; display: flex; gap: 10px; align-items: center; }
.pin-cells { display: flex; gap: 10px; }
.pin-cell { width: 56px; height: 56px; display: grid; place-items: center; background: var(--canvas); border: 1px solid var(--outline); border-radius: 4px; font: 600 1.25rem/1 var(--mono); }
.pin-cell.is-next { border: 2px solid var(--gold); }
.pin-input { position: absolute; left: 0; top: 0; width: 254px; height: 56px; opacity: 0; font-size: 1rem; }
.pin-input:focus-visible + .pin-cells { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.pin-toggle { margin-left: auto; }

.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 2px 0 0; border: 1px solid var(--outline); border-radius: 2px; background: var(--canvas); display: grid; place-items: center; }
.check input:checked { border-color: var(--gold); }
.check input:checked::after { content: ""; width: 12px; height: 7px; border-left: 2.5px solid var(--gold); border-bottom: 2.5px solid var(--gold); transform: rotate(-45deg) translate(1px, -1px); }
.check span { font-size: .9375rem; line-height: 1.45; color: var(--text-secondary); }

/* ---- shared pieces ---- */
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 4px; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--gold-fill); border-radius: 50%; color: var(--gold); }
.brand-name { font: 600 1.375rem/1.2 var(--serif-display); letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.brand-sub { color: var(--text-muted); text-align: center; }

/* A code is never broken across lines: when it and Copy don't fit side by side, Copy moves underneath. */
.code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border: 1px dashed var(--gold-fill); border-radius: 4px; background: var(--surface-2); }
.code-value { flex: 1 0 auto; font: 600 1.25rem/1.2 var(--mono); letter-spacing: .08em; color: var(--gold); white-space: nowrap; }
.code .btn { padding-inline: 12px; }
.code-value.small { font-size: 1rem; }

.medallion { flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 50%; border: 2px solid var(--gold-fill); background: var(--surface-3); color: var(--gold); font: 600 1rem/1 var(--serif-display); box-shadow: inset 0 0 8px rgba(0, 0, 0, .6); }
.medallion img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.6) contrast(1.05); }
.m-40 { width: 40px; height: 40px; }
.m-48 { width: 48px; height: 48px; font-size: 1.125rem; }
.m-56 { width: 56px; height: 56px; font-size: 1.375rem; }
.m-96 { width: 96px; height: 96px; font-size: 2.25rem; }
.medallion.is-plain { border-color: var(--outline); color: var(--text-muted); font-family: var(--mono); font-size: .875rem; }
.medallion.is-done { border-color: var(--success); color: var(--success); }

.bar { width: 100%; height: 4px; border-radius: 2px; overflow: hidden; }
.bar-track { fill: var(--surface-4); }
.bar-fill { fill: var(--gold); }
.bar.is-done .bar-fill { fill: var(--success); }

.seat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--gold-border); border-radius: 4px; background: var(--surface-1); }
.seat.is-empty { background: transparent; border: 1px dashed var(--outline); color: var(--text-muted); }
.seat-name { font: 600 1.125rem/1.3 var(--serif-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 2px 10px; }

.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.steps .medallion { margin-top: 2px; }
.list-dot li { position: relative; padding-left: 18px; }
.list-dot li + li { margin-top: 8px; }
.list-dot li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-fill); }
.parch .list-dot li::before { background: var(--ink-muted); }
.card-success .list-dot li::before { background: var(--success); }

/* ---- gazette (parchment broadsheet) ---- */
.gazette { display: flex; flex-direction: column; gap: 14px; padding-top: env(safe-area-inset-top); }
.gz-issue { display: flex; justify-content: space-between; gap: 12px; font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.gz-mast { padding: 10px 0; border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); text-align: center; font: 700 1.75rem/1.214 var(--serif-display); letter-spacing: -.01em; outline: none; }
.gz-date { text-align: center; font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.gz-head { font: 700 1.625rem/1.2 var(--serif-display); }
.gz-deck { font: italic 400 1.0625rem/1.45 var(--serif-display); color: var(--ink-secondary); }
.gz-fig { border: 1px solid var(--ink-muted); padding: 4px; background: var(--parchment-light); }
.gz-fig img { width: 100%; height: auto; aspect-ratio: 16 / 7; object-fit: cover; } /* a banner, so the first screen shows the picture and the opening lines */
.gz-fig figcaption { padding: 6px 4px 2px; text-align: center; font: italic 400 .875rem/1.4 var(--serif); color: var(--ink-muted); }
.gz-body p + p { margin-top: 12px; }
.dropcap > p:first-child::first-letter { float: left; margin: 4px 8px 0 0; font: 700 3.25rem/.82 var(--serif-display); color: var(--gold); }
.parch .dropcap > p:first-child::first-letter { color: var(--ink-danger); }
.gz-notice { padding: 12px 14px; border: 1px solid var(--ink-muted); background: var(--parchment-light); display: flex; flex-direction: column; gap: 4px; }
.gz-notice .label { color: var(--ink-muted); }
.gz-ack { font: italic 400 .875rem/1.45 var(--serif); color: var(--ink-muted); text-align: center; }

/* ---- stop screens ---- */
.dest-addr { display: flex; gap: 6px; align-items: flex-start; color: var(--text-secondary); font-size: .9375rem; }
.dest-addr .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--gold); }
/* Distance reads as a status label (C15), the same size and case as "Arrival confirmed". */
.dist { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--patina); }
.dist .icon { width: 16px; height: 16px; stroke-width: 2; }
.dist .btn-text { margin-left: 4px; }
.answer-row { display: flex; gap: 8px; }
.answer-row .input { flex: 1; min-width: 0; }
.answer-row .btn { min-height: 56px; flex: none; }
.chapter p + p { margin-top: 12px; }
/* Who the player met at a stop: the same small tiles as the evidence locker, at the top of the green card. */
.met-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.met-grid li { display: flex; }
.met-tile { width: 100%; min-width: 0; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 1px solid rgba(0, 223, 129, .25); border-radius: 4px; background: rgba(0, 0, 0, .15); color: inherit; font: inherit; }
button.met-tile { cursor: pointer; }
button.met-tile:hover { border-color: rgba(0, 223, 129, .6); }
.met-name { width: 100%; font-size: .8125rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.met-role { width: 100%; font-size: .6875rem; line-height: 1.25; color: var(--text-secondary); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* ---- evidence ---- */
/* Characters: small tiles, three across a phone (more on wider screens). The short role wraps to at most two lines. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.tile { min-width: 0; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--surface-1); border: 1px solid var(--gold-border); border-radius: 4px; color: var(--text); text-align: center; }
.tile.is-locked { background: transparent; border: 1px dashed var(--outline-subtle); color: var(--text-muted); }
.tile.is-selected { border: 2px solid var(--gold); padding: 5px 3px 7px; }
.tile-no { flex: none; font: 500 .75rem/1.33 var(--mono); color: var(--text-muted); }
.tile-name { width: 100%; font-size: .8125rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The short role under the name: 11 px, at most two lines. */
.tile-sub { width: 100%; font-size: .6875rem; line-height: 1.25; color: var(--text-secondary); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.tile-role { font: 500 .75rem/1.2 var(--mono); letter-spacing: .02em; text-transform: uppercase; color: var(--gold); }

.cover { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--parchment); color: var(--ink); }
.cover-hdr { flex: none; display: flex; align-items: center; gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid rgba(102, 62, 11, .3); }
.cover-hdr .btn-text { color: var(--ink-link); }
.cover .content { background: var(--parchment); }
.dossier-head { display: flex; gap: 14px; align-items: center; }
.parch .overline, .cover .overline { color: var(--ink-muted); }
.parch .medallion, .cover .medallion { background: var(--parchment-light); border-color: var(--ink-muted); color: var(--ink-muted); box-shadow: none; }
.parch .muted, .cover .muted { color: var(--ink-muted); }
.cover .btn-secondary { background: var(--parchment-light); border-color: var(--ink-muted); color: var(--ink-secondary); }
.cover hr, .parch hr { width: 100%; border: 0; border-top: 1px solid rgba(102, 62, 11, .35); margin: 0; }

/* ---- map ---- */
.map-wrap { position: relative; flex: 1 !important; min-height: 0; background: var(--canvas); overflow: hidden; touch-action: none; }
.map-svg { width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-water { fill: #070e19; }
.map-street { fill: none; stroke: var(--surface-4); stroke-linecap: round; stroke-linejoin: round; }
.map-street.is-main { stroke: #3d4553; }
.map-label { fill: var(--text-muted); font-family: var(--mono); text-anchor: middle; paint-order: stroke; stroke: var(--canvas); stroke-linejoin: round; }
.map-grid { stroke: var(--surface-1); fill: none; }
.map-fence { fill: rgba(74, 107, 105, .3); stroke: var(--patina); }
.map-fence.is-inside { animation: pulse 1.6s ease-in-out infinite; }
.map-acc { fill: rgba(170, 205, 203, .2); stroke: none; }
.map-me { fill: var(--text); stroke: var(--patina); }
.mk-solved circle { fill: var(--canvas); stroke: var(--success); }
.mk-solved path { fill: none; stroke: var(--success); stroke-linecap: round; stroke-linejoin: round; }
.mk-active circle { fill: var(--gold-fill); stroke: var(--canvas); }
.mk-active text { fill: var(--on-gold); }
.mk-locked circle { fill: var(--canvas); stroke: var(--outline); }
.mk-locked text { fill: var(--text-muted); }
.mk text { font-family: var(--mono); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.mk-name { fill: var(--gold); font-family: var(--mono); font-weight: 500; text-anchor: middle; paint-order: stroke; stroke: var(--canvas); stroke-linejoin: round; }
.map-scale line { stroke: var(--text-muted); }
.map-scale text { fill: var(--text-muted); font-family: var(--mono); }
.map-ctrl { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.map-attr { position: absolute; left: 8px; top: 8px; padding: 2px 6px; background: var(--canvas); color: var(--text-muted); border-radius: 2px; font: 500 .75rem/1.33 var(--mono); }
.map-note { position: absolute; left: 12px; right: 68px; top: 36px; }
.objective { flex: none; margin: 0; border-radius: 0; border-width: 1px 0 0; border-color: var(--outline-subtle); }
@keyframes pulse { 50% { opacity: .45; } }

/* ---- inquest and results ---- */
.slot-body { display: flex; gap: 12px; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-clock { font: 600 2rem/1.125 var(--mono); font-variant-numeric: tabular-nums; color: var(--gold); }
.seal-art { width: 160px; height: 160px; margin: 0 auto; filter: drop-shadow(0 0 22px rgba(201, 147, 90, .35)); }

/* ---- team ---- */
.drow { display: flex; gap: 12px; align-items: flex-start; }
.drow-name { font: 600 1.125rem/1.3 var(--serif-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drow.is-dnf { opacity: .7; }

/* ---- overlays ---- */
.scrim { position: absolute; inset: 0; z-index: 40; background: rgba(7, 14, 25, .72); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 88%; overflow-y: auto; padding: 10px var(--margin) calc(var(--lg) + env(safe-area-inset-bottom)); background: var(--surface-3); border-radius: 8px 8px 0 0; box-shadow: 0 -8px 24px -4px rgba(12, 19, 31, .85); display: flex; flex-direction: column; gap: 14px; animation: rise .22s ease-out; }
.sheet::before { content: ""; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--outline-subtle); }
.sheet h2 { outline: none; }
.sheet .card { background: var(--surface-2); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.toast { position: absolute; left: var(--margin); right: var(--margin); bottom: calc(var(--tabs) + 16px + env(safe-area-inset-bottom)); z-index: 50; padding: 12px 14px; border-radius: 4px; background: var(--surface-4); color: var(--text); text-align: center; font-size: .9375rem; box-shadow: 0 8px 24px -4px rgba(12, 19, 31, .85); }
.full-msg { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: var(--xl) var(--margin); text-align: center; }
.full-msg .icon { width: 40px; height: 40px; color: var(--gold); }
.skeleton { border-radius: 4px; background: var(--surface-4); min-height: 20px; }
.skeleton.tall { min-height: 140px; }

/* ---- admin (functional, no period ornament) ---- */
.admin { max-width: 1040px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.admin > * { min-width: 0; } /* lets a wide table scroll inside its .table-wrap instead of widening the page */
.admin td:first-child { white-space: nowrap; } /* case codes and stop names stay whole */
@media (max-width: 599px) { .admin-nav h1 { flex-basis: 100%; } } /* title on its own line above the buttons */
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.admin th, .admin td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--outline-subtle); vertical-align: top; }
.admin th { font: 500 .75rem/1.33 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.admin .table-wrap { overflow-x: auto; }
.admin .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.admin .input { height: 48px; }
.admin select.input { appearance: auto; }
.admin .link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; font-family: var(--mono); }

@media (max-width: 400px) {
  :root { --card-pad: 14px; }
  .two-col { grid-template-columns: 1fr; } /* names wrap to three lines side by side at 360 px */
  .btn { letter-spacing: .02em; } /* keeps "Deliver verdict and seal warrant" and most next steps on one line */
  .btn-wrap { padding-inline: 12px; }
}
@media (max-width: 359px) {
  :root { --margin: 12px; }
  .pin-cell { width: 48px; height: 48px; }
}
@media (min-width: 561px) {
  body { background: #070e19; }
  .screen { border-left: 1px solid var(--outline-subtle); border-right: 1px solid var(--outline-subtle); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- late additions ---- */
.parch-bar .helper { color: var(--ink-secondary); }
.parch .helper, .cover .helper { color: var(--ink-muted); }
.cover .card, .parch .card { background: var(--parchment-light); border-color: rgba(102, 62, 11, .35); }
.cover .status-gold { color: var(--ink-link); }
.cover .btn-primary[disabled] { background: #d6c9b1; color: var(--ink-muted); }
.section-label { margin-top: 8px; display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.section-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-fill); }
.block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.footnote { text-align: center; color: var(--text-muted); font-size: .875rem; }

/* ---- fixes from screen review ---- */
[data-focus] { outline: none; } /* headings take focus for screen readers only; no visible ring */
.card.row { flex-direction: row; align-items: center; }
.btn-text[disabled] { background: none; color: var(--text-muted); opacity: .55; }
.cover .secondary, .parch .secondary { color: var(--ink-secondary); }
.cover .btn-text { color: var(--ink-link); }
.cover .btn-text[disabled] { color: var(--ink-muted); }
.cover .list-dot li::before { background: var(--ink-muted); }

/* ---- feedback round 1: stop description, numbered solved markers, one shared next step ---- */

/* C01: the next-step button may wrap to a second line when the stop name is long. */
.btn-wrap { white-space: normal; text-align: center; height: auto; min-height: 56px; padding-top: 10px; padding-bottom: 10px; }
.btn-wrap > span { display: inline; text-wrap: balance; }

/* C28: tick badge on a solved marker, beside its number. */
.mk-solved text { fill: var(--success); }
.mk-badge circle { fill: var(--success); stroke: var(--canvas); }
.mk-badge path { fill: none; stroke: var(--canvas); stroke-linecap: round; stroke-linejoin: round; }
.mk-name.is-solved { fill: var(--success); }

/* The docked next-step bar on the Map and Evidence tabs sits above the tab bar, like the Case tab's. */
.map-wrap + .actionbar { border-top: 1px solid var(--outline-subtle); }

/* ---- feedback round 2: stop record, tappable pins, Evidence segments ---- */

/* Segmented control at the top of the Evidence tab (Suspects / Stops). */
.segs { display: flex; gap: 0; border: 1px solid var(--outline-subtle); border-radius: 4px; overflow: hidden; }
.seg { flex: 1; min-height: 44px; background: var(--surface-1); border: 0; color: var(--text-secondary);
  font: 500 .875rem/1.29 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.seg + .seg { border-left: 1px solid var(--outline-subtle); }
.seg.is-active { background: var(--surface-3); color: var(--gold); }

/* The stops list: one row per stop, always reachable (feedback 8.1). */
.stoplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stoprow { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 64px;
  padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--gold-border); border-radius: 4px; color: var(--text); }
.stoprow .stop-no { color: var(--gold); flex: none; }
.stoprow .status { margin-top: 4px; }
.stoprow.is-locked { color: var(--text-muted); }
.block { display: block; }
.btn-row-plain { width: 100%; text-align: left; background: none; border: 0; color: inherit; }

/* Feedback 6: a transparent 44 px target over every pin. */
.mk-hit { fill: transparent; cursor: pointer; }
.mk-hit:focus-visible { outline: none; stroke: var(--gold); stroke-width: 2px; }

/* C21: the next dossier is marked, but not named. */
.tile.is-next { border-color: var(--gold-fill); }
.tile.is-next .tile-name { color: var(--gold); }

/* ---- Story Pack pictures (design spec §2.8) -------------------------------------------------
   Space is reserved by aspect-ratio before the file arrives, so nothing jumps while loading. */
.fig { margin: 0; border: 1px solid var(--gold-border); background: var(--surface-2); }
.fig img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; filter: sepia(.35) contrast(1.04); }
.fig figcaption { padding: 6px 10px; font: 400 .875rem/1.4 var(--serif); color: var(--text-muted); }
.parch .fig, .cover .fig { border-color: var(--ink-muted); background: var(--parchment-light); }
.parch .fig figcaption, .cover .fig figcaption { color: var(--ink-muted); }
/* A card whose picture runs to its edges. */
.card-figure > .fig:first-child { margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 0; border-left: 0; border-right: 0; border-top: 0; }

.thumb { flex: none; display: block; overflow: hidden; border: 1px solid var(--gold-border); border-radius: 4px; background: var(--surface-2); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; filter: sepia(.35) contrast(1.04); }
.t-48 { width: 48px; height: 48px; }
.t-64 { width: 64px; height: 64px; }

.dest-compact { flex-direction: row; align-items: flex-start; gap: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .fig img, .thumb img { transition: opacity .2s ease-out; }
}

/* ---- Case flow, review of 15 November: stop card, puzzle, solved card, pager ---- */

/* C26 stop card: one box for the place, the way there and, once there, what to do. */
.rule { width: 100%; height: 0; margin: 2px 0; border: 0; border-top: 1px solid var(--outline-subtle); }
.stop-card.is-here .fig img { aspect-ratio: 16 / 6; }
.fold { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin: -8px 0; padding: 0; background: none; border: 0; color: var(--text-muted); text-align: left; }
.fold .icon { transition: transform .2s; }
.fold[aria-expanded="true"] .icon { transform: rotate(90deg); }

/* The puzzle is the one thing to do on arrival, so it is the one gold-washed card on the screen. */
.puzzle { border: 1.5px solid var(--gold-fill); background: linear-gradient(rgba(246, 187, 126, .07), rgba(246, 187, 126, .07)), var(--surface-1); gap: 14px; }
.puzzle-head { display: flex; align-items: center; gap: 12px; }
.puzzle-seal { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gold-fill); color: var(--on-gold); }
.puzzle-seal .icon { width: 22px; height: 22px; }
.puzzle .narrative { color: var(--text); }
.puzzle .input { min-height: 52px; font-family: var(--mono); font-size: 1.125rem; letter-spacing: .06em; }
.puzzle .input::placeholder { font-size: .9375rem; letter-spacing: .02em; }
.puzzle-foot { padding-top: 6px; border-top: 1px solid var(--gold-border); color: var(--text-secondary); }

/* Pager under the header: each side names the page it opens. */
.pager { flex: none; display: flex; border-bottom: 1px solid var(--outline-subtle); background: var(--surface-1); }
.pager-btn { flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 0 var(--margin); background: none; border: 0;
  font: 500 .9375rem/1.2 var(--serif); color: var(--gold); }
.pager-btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager-next { justify-content: flex-end; text-align: right; }
.pager-prev + .pager-next { border-left: 1px solid var(--outline-subtle); }
@media (prefers-reduced-motion: reduce) { .fold .icon { transition: none; } }

/* ---- review of 16 November ---- */

/* The puzzle glows once as it scrolls into view on arrival. */
@keyframes puzzle-in { from { box-shadow: 0 0 0 0 rgba(246, 187, 126, .55); } to { box-shadow: 0 0 0 14px rgba(246, 187, 126, 0); } }
.puzzle { animation: puzzle-in 1.2s ease-out .15s 2; }
@media (prefers-reduced-motion: reduce) { .puzzle { animation: none; } }

/* Character tiles: equal height in a row; an accusation takes the number's place, not an extra line. */
.tiles > li { display: flex; }
.tiles .tile { width: 100%; }
.tile-no.tile-role { font: 500 .75rem/1.33 var(--serif); letter-spacing: 0; text-transform: none; color: var(--gold); white-space: nowrap; }

/* Results: your time and the team's in one card. */
.time-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 20px; }
.time-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.time-col + .time-col { border-left: 1px solid var(--outline-subtle); padding-left: 20px; }
.time-cols .big-clock { font-size: 1.625rem; }
.link-stack { display: flex; flex-direction: column; align-items: center; gap: 0; }

/* Scrolled-to sections keep a little room above them. */
[data-reveal] { scroll-margin-top: 16px; }

/* Results: "Your investigation". Stops solved without a reveal, hints and reveals, then one marker per stop in the
   colours of the solved and revealed cards, with a gold dot where a hint was used. Facts, not points (STP-13). */
.inv { gap: 16px; }
.inv-stats { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.inv-big { font: 600 1.75rem/1.1 var(--mono); color: var(--text); }
.inv-big span { font-size: .875rem; font-weight: 500; color: var(--text-secondary); }
.stop-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(22px, 1fr)); gap: 2px; }
.sr { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sr-dot { position: relative; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.sr-dot .icon { width: 13px; height: 13px; }
.sr-solved .sr-dot { background: var(--success-container); border: 1.5px solid var(--success); color: var(--success); }
.sr-revealed .sr-dot { background: rgba(201, 147, 90, .25); border: 1.5px solid var(--success); color: var(--gold); }
.sr-hint .sr-dot::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); border: 1.5px solid var(--surface-1); }
.sr-n { font: 500 .625rem/1 var(--mono); color: var(--text-muted); }
.inv-key { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.inv-key > span { display: inline-flex; align-items: center; gap: 5px; }
.inv-key .icon { width: 14px; height: 14px; }
.k-solved .icon { color: var(--success); }
.k-revealed .icon { color: var(--gold); }
.k-hint i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
