/* House design of the books ("poster", Trailhead palette): Anton headings,
   Figtree text, Roboto Condensed map labels; forest ink, brick, mustard and
   dusty blue on warm paper. */
@font-face { font-family: 'Anton'; font-weight: 400; font-display: swap; src: url('./fonts/anton-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 400; font-display: swap; src: url('./fonts/figtree-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 400; font-style: italic; font-display: swap; src: url('./fonts/figtree-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-display: swap; src: url('./fonts/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-display: swap; src: url('./fonts/figtree-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 800; font-display: swap; src: url('./fonts/figtree-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Condensed'; font-weight: 600; font-display: swap; src: url('./fonts/roboto-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Condensed'; font-weight: 700; font-display: swap; src: url('./fonts/roboto-condensed-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto Condensed'; font-weight: 800; font-display: swap; src: url('./fonts/roboto-condensed-latin-800-normal.woff2') format('woff2'); }

:root {
  --paper: #fbf7ee;
  --soft: #efe7d4;
  --ink: #1f3d33;
  --ink-soft: #5a6860;
  --brick: #c4513b;
  --brick-text: #ad4734;
  --mustard: #e2a634;
  --blue: #4f7f9c;
  --card: #ffffff;
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --display: 'Anton', 'Oswald', Impact, sans-serif;
  --body: 'Figtree', 'Segoe UI', system-ui, Arial, sans-serif;
  --label: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  --shadow: 0 1px 2px rgba(31, 61, 51, .12), 0 4px 14px rgba(31, 61, 51, .10);
  --radius: 14px;
  color-scheme: light;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.4; font-size: 16px; }
/* In a content-sized iframe the viewport is the content: no minimum, or the frame could never shrink. */
html.embedded body { min-height: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brick); outline-offset: 2px; }
strong, b { font-weight: 800; }
kbd { font: 700 .78em/1 var(--label); padding: .18em .38em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--ink); }
svg { flex: none; }
.noscript { padding: 24px; text-align: center; }

/* Book markup inside clue text: coordinate tags and letter chips. */
.co { display: inline-block; font: 700 .92em/1.12 var(--label); letter-spacing: .02em; padding: 0 .22em; margin: 0 .04em; border: 1px solid color-mix(in srgb, var(--ink) 40%, transparent); border-radius: .2em; background: color-mix(in srgb, var(--ink) 4%, #fff); white-space: nowrap; }
.nw { white-space: nowrap; }
.ichip { display: inline-block; width: 1.35em; height: 1.35em; vertical-align: -.32em; margin: 0 .05em; }
.ichip svg { width: 100%; height: 100%; display: block; }
.ix { width: .9em; height: .9em; vertical-align: -.1em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 44px; padding: .55em 1.15em; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; font-weight: 700; font-size: 15px; letter-spacing: .01em; transition: background .15s, transform .1s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: var(--soft); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn.primary:disabled { opacity: 1; background: var(--soft); border-color: var(--soft); color: var(--ink-soft); box-shadow: none; }
.btn.primary { background: var(--brick); border-color: var(--brick); color: #fff; box-shadow: 0 2px 0 color-mix(in srgb, var(--brick) 60%, #000); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brick) 88%, #000); }
.btn.primary.ready { animation: nudge 1.6s ease-in-out 2; }
.btn.small { min-height: 36px; padding: .35em .85em; font-size: 14px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: var(--soft); }
.btn.link { border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; padding-inline: .5em; box-shadow: none; }
.btn.link:hover:not(:disabled) { background: none; color: var(--brick-text); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; padding: 0; }
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn:disabled { opacity: .35; }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-btn svg, .top-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar { background: var(--ink); color: var(--paper); }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; min-width: 0; }
.brand .logo { display: block; height: 34px; width: auto; }
.book-title { font: 400 18px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--mustard); padding-left: 14px; border-left: 1.5px solid color-mix(in srgb, var(--paper) 30%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.top-btn { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--paper) 45%, transparent); background: transparent; color: var(--paper); font-weight: 700; font-size: 14px; }
.top-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--paper) 12%, transparent); border-color: var(--paper); }
.top-btn.icon-only { padding: 0; width: 40px; justify-content: center; }
.top-btn .count { font: 800 12px/1 var(--body); background: var(--mustard); color: var(--ink); border-radius: 999px; padding: 4px 7px; }
.top-btn .count:empty { display: none; }
.top-btn:focus-visible { outline-color: var(--mustard); }
.ribbon { background: var(--mustard); color: var(--ink); text-align: center; font: 800 12px/1.2 var(--body); letter-spacing: .22em; text-transform: uppercase; padding: 8px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- desk layout ---------- */
.desk { max-width: 1320px; margin: 0 auto; padding: 26px 24px 40px; display: grid; gap: 22px 40px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "brief" "head" "scene" "file"; }
.briefing-card { grid-area: brief; }
.case-head { grid-area: head; }
.scene { grid-area: scene; min-width: 0; }
.file { grid-area: file; min-width: 0; }
@media (min-width: 1080px) {
  .desk { grid-template-columns: minmax(360px, 5fr) minmax(0, 6fr); grid-template-rows: auto auto 1fr; grid-template-areas: "brief brief" "head scene" "file scene"; }
  .scene { position: sticky; top: 12px; align-self: start; }
  /* Never let the sticky column hide its own tools: scroll inside it when a map cannot shrink further. */
  html:not(.embedded) .scene { max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 6px; margin: 0 -6px; scrollbar-width: thin; }
  html:not(.embedded) .board { width: min(100%, max(var(--board-min, 0px), calc((100vh - var(--scene-chrome, 330px)) * var(--aspect, 1)))); }
}

/* ---------- first-visit briefing ---------- */
.briefing-card { display: grid; gap: 14px 28px; grid-template-columns: 1fr; background: #fff; border-radius: var(--radius); border: 1.5px solid var(--ink); border-left: 8px solid var(--mustard); padding: 18px 22px; box-shadow: var(--shadow); }
.briefing-card h2 { font: 400 26px/1.05 var(--display); text-transform: uppercase; letter-spacing: .02em; margin: 2px 0 10px; }
.briefing-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: law; }
.briefing-card li { counter-increment: law; position: relative; padding-left: 40px; font-size: 14.5px; line-height: 1.4; }
.briefing-card li::before { content: counter(law); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--mustard); display: grid; place-items: center; font: 400 16px/1 var(--display); }
.briefing-card li b:first-child { display: block; font-weight: 800; margin-bottom: 2px; }
.briefing-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font: 800 12px/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- case head ---------- */
.case-head { display: flex; gap: 20px; align-items: center; padding-bottom: 16px; border-bottom: 3px solid var(--ink); }
.case-no { flex: none; width: 84px; height: 84px; border-radius: 50%; background: var(--brick); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-6deg); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6.5px var(--ink); }
.case-no span { font: 800 11px/1 var(--body); letter-spacing: .22em; text-transform: uppercase; margin-left: .22em; }
.case-no b { font: 400 38px/1 var(--display); font-weight: 400; margin-top: 2px; }
.case-titles { min-width: 0; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; border: 1.8px solid var(--brick); }
.pips i.on { background: var(--brick); }
.dot { opacity: .6; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; letter-spacing: .08em; color: var(--ink); }
.timer:empty { display: none; }
.case-head h1 { font: 400 clamp(30px, 4.2vw, 46px)/1.02 var(--display); text-transform: uppercase; letter-spacing: .01em; margin: 6px 0 6px; overflow-wrap: anywhere; }
.intro { margin: 0; font-style: italic; color: var(--ink-soft); font-size: 16px; max-width: 60ch; }

/* ---------- scene ---------- */
.scene-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid var(--ink); }
.tab { margin: 0; font: 800 12.5px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 9px 15px 8px; white-space: nowrap; }
.scene-controls { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px; background: #fff; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: 34px; padding: 0 12px; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.box { position: relative; background: #fff; border-radius: 12px; padding: 12px 16px 12px; border: 1.5px solid var(--ink); }
.box-k { display: block; margin: 0 0 4px; font: 800 11.5px/1.2 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--brick-text); }
.forensics { margin-bottom: 12px; }
.dispatch { border: 1.5px dashed var(--blue); font-style: italic; margin-top: 18px; }
.dispatch .box-k { color: var(--blue); font-style: normal; }
.dispatch p { margin: 0; }

.board-viewport { overflow: auto; overscroll-behavior-x: contain; border-radius: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.board { position: relative; width: 100%; min-width: var(--board-min, 0); aspect-ratio: var(--aspect, 1); margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board.zoomed { width: var(--board-large) !important; min-width: var(--board-large); }
.art { position: absolute; inset: 0; pointer-events: none; }
.art svg { display: block; width: 100%; height: 100%; }
.band { position: absolute; pointer-events: none; background: color-mix(in srgb, var(--mustard) 26%, transparent); opacity: 0; transition: opacity .12s; }
.band.on { opacity: 1; }
.band.clash { background: color-mix(in srgb, var(--brick) 22%, transparent); }
.cell { position: absolute; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 3px; outline-offset: -3px; }
.cell::after { content: ''; position: absolute; inset: 1px; border-radius: 4px; pointer-events: none; }
.cell:hover::after { box-shadow: inset 0 0 0 2.5px color-mix(in srgb, var(--ink) 55%, transparent); }
.cell:focus-visible { outline: 3px solid var(--brick); z-index: 2; }
.cell.blocked { cursor: not-allowed; }
.board.tool-cross .cell.blocked, .board.tool-erase .cell.blocked, .board.tool-note .cell.blocked { cursor: pointer; }
.cell.murder-room { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--mustard) 38%, transparent) 0 6px, transparent 6px 12px); }

.token { position: absolute; inset: 14%; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--on); border: max(2px, calc(var(--cell, 60px) * .045)) solid var(--ink); font: 800 calc(var(--cell, 60px) * .4)/1 var(--label); box-shadow: 0 2px 0 rgba(0, 0, 0, .28), 0 0 0 max(1.5px, calc(var(--cell, 60px) * .03)) #fff; z-index: 1; }
.token::before { content: ''; position: absolute; inset: 12%; border-radius: 50%; border-top: max(1.5px, calc(var(--cell, 60px) * .045)) solid rgba(255, 255, 255, .45); transform: rotate(-35deg); }
.token.pop { animation: pop .22s ease-out; }
.token.clash { box-shadow: 0 0 0 max(3px, calc(var(--cell, 60px) * .06)) var(--brick), 0 2px 0 rgba(0, 0, 0, .28); animation: shake .35s; }
.token.guilty { box-shadow: 0 0 0 max(3px, calc(var(--cell, 60px) * .05)) var(--paper), 0 0 0 max(6px, calc(var(--cell, 60px) * .1)) var(--brick); }
.ghost-token { position: absolute; inset: 18%; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--ink); background: color-mix(in srgb, var(--c) 45%, transparent); color: var(--ink); font: 800 calc(var(--cell, 60px) * .36)/1 var(--label); opacity: .75; pointer-events: none; }
.marks { position: absolute; inset: 5%; display: grid; grid-template-columns: repeat(var(--mc, 3), 1fr); grid-auto-rows: 1fr; align-items: center; justify-items: center; pointer-events: none; }
.m { font: 800 max(9px, calc(var(--cell, 60px) * .21))/1 var(--label); color: var(--ink); text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; padding: .08em .16em; border-radius: .3em; }
.m.sel { background: var(--c); color: var(--on); text-shadow: none; }
.m.x { color: var(--brick-text); text-decoration: line-through 2px; opacity: .85; }
.m.x.sel { background: none; color: var(--brick-text); text-shadow: 0 0 2px #fff, 0 0 2px #fff; outline: 1.5px solid var(--brick); }
.xmark { position: absolute; inset: 22%; pointer-events: none; }
.xmark::before, .xmark::after { content: ''; position: absolute; left: 50%; top: -6%; width: max(2px, calc(var(--cell, 60px) * .055)); height: 112%; margin-left: calc(max(2px, calc(var(--cell, 60px) * .055)) / -2); border-radius: 2px; background: color-mix(in srgb, var(--ink) 78%, transparent); box-shadow: 0 0 0 1px rgba(255, 255, 255, .7); transform: rotate(45deg); }
.xmark::after { transform: rotate(-45deg); }
.xmark.auto { inset: 30%; }
.xmark.auto::before, .xmark.auto::after { background: color-mix(in srgb, var(--ink) 38%, transparent); box-shadow: none; width: max(1.5px, calc(var(--cell, 60px) * .035)); }
.unknown { position: absolute; inset: 22%; border-radius: 50%; border: 2.5px dashed var(--ink); display: grid; place-items: center; font: 800 calc(var(--cell, 60px) * .34)/1 var(--label); background: rgba(255, 255, 255, .75); pointer-events: none; }
.flag { position: absolute; top: 0; right: 0; width: 34%; height: 34%; background: linear-gradient(225deg, var(--mustard) 50%, transparent 50%); border-top-right-radius: 3px; pointer-events: none; }
.board.notebook .cell.blocked::before { content: none; }
.readout { min-height: 1.4em; margin: 8px 2px 0; font-size: 13.5px; color: var(--ink-soft); }
.readout b { color: var(--ink); }

/* ---------- dock ---------- */
.dock { position: sticky; bottom: 0; z-index: 6; margin-top: 10px; padding-bottom: env(safe-area-inset-bottom); }
.dock-in { background: #fff; border: 1.5px solid var(--ink); border-radius: 18px; padding: 10px 12px 10px; box-shadow: 0 -6px 22px rgba(31, 61, 51, .14); display: grid; gap: 8px; }
.dock-person { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; }
.dock-person .chip { width: 36px; height: 36px; font-size: 17px; }
.dock-person .who { min-width: 0; flex: 1; }
.dock-person .who-name { font-weight: 800; font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dock-person .where { font: 700 11.5px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.dock-person .lines { margin: 2px 0 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.35; }
.dock-person .lines li { display: inline; }
.dock-person .lines li + li::before { content: ' · '; color: var(--ink-soft); }
.dock-person .lines li.used { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.dock-person .lines li.failing { color: var(--brick-text); font-weight: 600; }
.dock-people { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.dock-people::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: var(--on); border: 2.5px solid var(--ink); font: 800 18px/1 var(--label); padding: 0; }
button.chip { transition: transform .12s, box-shadow .12s; }
button.chip:hover { transform: translateY(-1px); }
button.chip[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px var(--ink); transform: scale(1.06); }
.chip .done { position: absolute; right: -5px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.chip .done svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.chip.clash { box-shadow: 0 0 0 3px var(--brick); }
.tools { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tools button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 6px 2px 5px; border-radius: 12px; border: 1.5px solid transparent; background: var(--paper); font: 700 12px/1.1 var(--body); color: var(--ink); }
.tools button:hover { border-color: var(--line); }
.tools button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tools svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tools svg .fill { fill: currentColor; stroke: none; }
.tools svg .accent { stroke: var(--brick); }
.tools button[aria-pressed="true"] svg .accent { stroke: var(--mustard); }
.tools kbd { position: absolute; top: 4px; right: 5px; font-size: 9.5px; padding: 1px 3px; border-width: 1px; opacity: .55; background: transparent; color: inherit; border-color: currentColor; }
@media (hover: none) { .tools kbd { display: none; } }
.tool-help { margin: 0; font-size: 13px; color: var(--ink-soft); min-height: 1.35em; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.history { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.status { margin: 0; font-size: 14px; font-weight: 600; min-height: 1.4em; }
.status:empty { display: none; }
.status.bad { color: var(--brick-text); }
.status.good { color: #2f6f4f; }
.tip { background: color-mix(in srgb, var(--mustard) 18%, #fff); border: 1.5px solid var(--mustard); border-radius: 12px; padding: 8px 12px; font-size: 14.5px; }
.tip .box-k { color: var(--ink); }
.tip p { margin: 0; }
.field-note { display: grid; gap: 6px; background: var(--paper); border-radius: 12px; padding: 10px; border: 1.5px solid var(--mustard); }
.field-note label { font: 800 11.5px/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; }
.field-note textarea { width: 100%; resize: vertical; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font-size: 16px; }
.field-note .row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- verdict & case closed ---------- */
.verdict { margin-top: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); animation: rise .3s ease-out; }
.verdict-head { background: var(--ink); color: var(--paper); font: 800 12px/1 var(--body); letter-spacing: .2em; text-transform: uppercase; padding: 9px 16px; }
.verdict-body { padding: 14px 16px 16px; }
.verdict h3, .closed h3 { font: 400 28px/1.05 var(--display); text-transform: uppercase; margin: 0 0 6px; letter-spacing: .01em; }
.verdict p { margin: 0 0 12px; color: var(--ink-soft); }
.suspects { display: flex; flex-wrap: wrap; gap: 8px; }
.suspects button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 16px 4px 5px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; font-weight: 800; font-size: 15px; }
.suspects button:hover { background: var(--soft); }
.suspects button.wrong { opacity: .45; text-decoration: line-through; }
.suspects .chip { width: 36px; height: 36px; font-size: 16px; border-width: 2px; }
.verdict-status { margin: 12px 0 0 !important; color: var(--brick-text) !important; font-weight: 700; }
.verdict-status:empty { display: none; }
.closed { position: relative; margin-top: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 22px 20px 20px; box-shadow: var(--shadow); overflow: hidden; animation: rise .3s ease-out; }
.closed:focus { outline: none; }
.stamp { position: absolute; right: 14px; top: 14px; font: 800 15px/1 var(--body); letter-spacing: .2em; text-transform: uppercase; color: var(--brick); border: 3px double var(--brick); border-radius: 6px; padding: 7px 10px 6px; transform: rotate(8deg); animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) .1s both; background: rgba(255, 255, 255, .8); }
.closed h3 { padding-right: 150px; font-size: 32px; }
.closing { font-style: italic; color: var(--ink-soft); margin: 4px 0 16px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.stats div { background: var(--paper); border-radius: 10px; padding: 8px 12px; }
.stats dt { font: 800 10.5px/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.stats dd { margin: 3px 0 0; font: 400 22px/1 var(--display); letter-spacing: .03em; }
.closed-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- statements (pinned cards) ---------- */
.file-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; font: 800 12.5px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; }
.file-head span { font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--ink-soft); font-size: 13px; }
.cards { display: grid; gap: 22px 14px; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); padding-top: 8px; }
.pc { position: relative; background: #fff; border-radius: 14px; padding: 12px 12px 12px; box-shadow: var(--shadow); transform: rotate(var(--rot, 0deg)); transition: transform .18s, box-shadow .18s; display: flex; flex-direction: column; gap: 8px; }
.pc:nth-child(even) { margin-top: 8px; }
.pc:hover { transform: rotate(0deg) translateY(-2px); }
.pc.selected { transform: rotate(0deg) translateY(-3px); box-shadow: 0 0 0 3px var(--ink), 0 10px 24px rgba(31, 61, 51, .2); }
.pc.victim { background: #f5f4f1; box-shadow: none; border: 1.5px dashed var(--brick); }
.pc.victim.selected { box-shadow: 0 0 0 3px var(--ink); }
.pin { position: absolute; z-index: 2; top: -8px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--brick) 30%, color-mix(in srgb, var(--brick) 60%, #000) 100%); box-shadow: 1px 2px 2px rgba(0, 0, 0, .35); }
.pick { display: grid; grid-template-columns: 1fr; gap: 8px; text-align: left; padding: 0; border: 0; background: none; border-radius: 10px; }
.photo { position: relative; display: block; }
.photo svg { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.photo .loc { position: absolute; right: 6px; bottom: 6px; font: 800 12px/1 var(--label); letter-spacing: .04em; background: var(--ink); color: #fff; border-radius: 6px; padding: 4px 6px; }
.nameline { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16.5px; line-height: 1.15; }
.nameline .chip { width: 30px; height: 30px; font-size: 14.5px; border-width: 2px; }
.role { font: 800 11px/1 var(--body); letter-spacing: .2em; text-transform: uppercase; color: var(--brick-text); margin-top: -2px; }
.stmts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.38; }
.stmt { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; border-radius: 8px; padding: 2px 4px 2px 0; }
.stmt input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 1px 0 0; border-radius: 50%; border: 1.8px solid var(--ink); background: var(--soft); display: grid; place-items: center; cursor: pointer; }
.stmt input::after { content: ''; width: 8px; height: 4.5px; border: solid #fff; border-width: 0 0 2.2px 2.2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.stmt input:checked { background: var(--ink); }
.stmt input:checked::after { opacity: 1; }
.stmt input:focus-visible { outline: 3px solid var(--brick); outline-offset: 2px; }
.stmt.used .txt { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.stmt.failing { background: color-mix(in srgb, var(--brick) 10%, transparent); box-shadow: -4px 0 0 var(--brick); padding-left: 4px; }
.stmt.failing .txt::after { content: 'Doesn’t hold'; display: inline-block; margin-left: 6px; font: 800 10px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: #fff; background: var(--brick); border-radius: 4px; padding: 3px 5px 2px; vertical-align: 1px; text-decoration: none; }
.forensics .stmts { font-size: 15px; }

/* legend (book markup) */
.legend { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 18px; font: 600 13px/1.15 var(--body); }
.legend-strip { display: contents; }
.lgs-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 12px 6px 8px; border: 1.5px solid var(--ink); border-radius: 14px; background: #fff; }
.lgs-group.lgs-cannot { border-left-width: 5px; }
.lgs-h { display: inline-flex; align-items: center; gap: 5px; font: 700 12px/1 var(--label); letter-spacing: .06em; text-transform: uppercase; }
.lgs-glyph { width: 18px; height: 18px; }
.lgs-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lgs-ic svg { height: 28px; width: auto; display: block; }

.foot { max-width: 1320px; margin: 0 auto; padding: 18px 24px 30px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); border-top: 1.5px solid var(--line); }

/* ---------- dialogs ---------- */
dialog.sheet { width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; border: 2px solid var(--ink); border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: rise .22s ease-out; }
dialog.sheet.wide { width: min(760px, calc(100vw - 24px)); }
dialog.sheet.narrow { width: min(460px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 38, 32, .55); backdrop-filter: blur(2px); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 22px; background: var(--ink); color: var(--paper); }
.sheet-head h2 { margin: 0; font: 400 26px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--paper) 45%, transparent); background: none; color: var(--paper); font-size: 24px; line-height: 1; }
.close:hover { background: color-mix(in srgb, var(--paper) 14%, transparent); }
.close:focus-visible { outline-color: var(--mustard); }
.case-list, .help, .settings { overflow: auto; padding: 16px 22px 22px; overscroll-behavior: contain; }
.chapter { margin: 0 0 18px; }
.chapter-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.chapter-head h3 { margin: 0; font: 400 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.chapter-head p { margin: 0; font-size: 13px; color: var(--ink-soft); flex-basis: 100%; }
.case-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; text-align: left; padding: 8px 12px 8px 8px; margin: 0 0 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; }
.case-row:hover { border-color: var(--ink); }
.case-row.current { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.case-row .num { width: 46px; height: 46px; border-radius: 50%; background: var(--brick); color: #fff; display: grid; place-items: center; font: 400 22px/1 var(--display); }
.case-row.solved .num { background: var(--ink); }
.case-row .t { font-weight: 800; font-size: 15.5px; line-height: 1.2; display: block; }
.case-row .meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font: 700 11.5px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.case-row .state { font: 800 11.5px/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; text-align: right; color: var(--ink-soft); white-space: nowrap; }
.case-row .state.done { color: #2f6f4f; }
.case-row .state.going { color: var(--brick-text); }
.help { font-size: 15px; line-height: 1.5; }
.help h3 { font: 400 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; margin: 22px 0 8px; }
.help .lead { margin-top: 0; font-size: 16px; }
.help .goal { background: #fff; border-left: 5px solid var(--brick); padding: 10px 14px; border-radius: 0 10px 10px 0; }
.laws { padding: 0; list-style: none; counter-reset: law; display: grid; gap: 10px; }
.laws li { counter-increment: law; position: relative; padding: 10px 14px 10px 54px; background: #fff; border-radius: 12px; border: 1.5px solid var(--line); }
.laws li::before { content: counter(law); position: absolute; left: 12px; top: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--mustard); display: grid; place-items: center; font: 400 17px/1 var(--display); }
.laws b:first-child { display: block; }
.tool-list, .keys { padding-left: 20px; display: grid; gap: 6px; }
.terms { display: grid; gap: 8px; margin: 0; }
.terms div { background: #fff; border-radius: 10px; padding: 8px 12px; border: 1.5px solid var(--line); }
.terms dt { font-weight: 800; }
.terms dd { margin: 2px 0 0; }
.settings { display: grid; gap: 10px; }
.switch { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 14px; color: var(--ink-soft); }
.switch b { display: block; color: var(--ink); font-size: 15px; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--soft); border: 1.5px solid var(--ink); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); transition: transform .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- responsive ---------- */
@media (max-width: 1079px) {
  .desk { padding-top: 18px; }
}
@media (max-width: 720px) {
  .topbar-in { padding: 8px 12px; gap: 8px; }
  .brand .logo { height: 26px; }
  .book-title { display: none; }
  .top-btn { padding: 0 11px; }
  .top-btn .label { display: none; }
  #open-cases .label { display: inline; }
  .ribbon { font-size: 10.5px; letter-spacing: .16em; padding: 6px 10px; }
  .desk { padding: 14px 12px 28px; gap: 16px; }
  .case-head { gap: 14px; padding-bottom: 12px; }
  .case-no { width: 60px; height: 60px; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
  .case-no span { font-size: 9px; }
  .case-no b { font-size: 27px; }
  .intro { font-size: 14.5px; }
  .kicker { font-size: 11px; letter-spacing: .12em; }
  .scene-head { align-items: center; }
  .tab { padding: 8px 11px 7px; font-size: 11px; }
  .seg button { padding: 0 9px; font-size: 12.5px; }
  .dock { margin-inline: -6px; }
  .dock-in { padding: 8px 8px 8px; border-radius: 16px; gap: 6px; }
  .tools { gap: 3px; }
  .dock-person { min-height: 0; }
  .dock-person > .chip, .tool-help { display: none; }
  .dock-person .who-name { font-size: 14px; }
  .dock-person .lines { font-size: 13.5px; }
  .dock-people { padding: 3px 2px 4px; }
  .dock-people .chip { width: 36px; height: 36px; font-size: 16px; }
  .actions { flex-wrap: nowrap; gap: 4px; }
  .history { flex-wrap: nowrap; gap: 2px; }
  .history .icon-btn { width: 36px; height: 36px; }
  .history .btn.small { padding: .3em .5em; font-size: 13px; min-height: 36px; }
  #check { min-height: 38px; padding: 0 12px; font-size: 13.5px; white-space: nowrap; }
  .status { font-size: 13px; }
  .tools button { min-height: 50px; font-size: 10.5px; border-radius: 10px; }
  .tools svg { width: 20px; height: 20px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .briefing-card { padding: 14px 16px; }
  .briefing-card li { font-size: 13.5px; }
  .pc { transform: none; flex-direction: row; flex-wrap: wrap; align-items: flex-start; padding: 10px; gap: 6px 12px; }
  .pc:nth-child(even) { margin-top: 0; }
  .pc .pin { display: none; }
  .pick { grid-template-columns: 64px minmax(0, 1fr); align-items: center; width: 100%; gap: 12px; }
  .photo .loc { right: -4px; bottom: -4px; font-size: 11px; padding: 3px 4px; }
  .stmts { width: 100%; padding-left: 2px; }
  .closed h3 { padding-right: 0; padding-top: 34px; font-size: 26px; }
  .stats dd { font-size: 19px; }
  dialog.sheet { max-height: 92vh; border-radius: 18px; }
  .case-list, .help, .settings { padding: 14px 14px 18px; }
}
@media (max-width: 380px) {
  .scene-head { flex-wrap: wrap; }
  .scene-controls { margin-left: auto; }
  .history .btn.small { white-space: nowrap; padding-inline: .4em; }
  #check { padding: 0 10px; }
  .seg button { padding: 0 7px; font-size: 12px; }
  .tools button span { font-size: 9.5px; }
  .history .btn.small { padding: .35em .6em; }
}

@media (min-width: 1080px) {
  .dock { position: static; }
  .dock-person { display: none; }
  .dock-in { box-shadow: var(--shadow); }
}

@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } to { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -3px; } 75% { translate: 3px; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes stamp { from { transform: rotate(8deg) scale(2.2); opacity: 0; } to { transform: rotate(8deg) scale(1); opacity: 1; } }
@keyframes nudge { 0%, 100% { box-shadow: 0 2px 0 color-mix(in srgb, var(--brick) 60%, #000); } 50% { box-shadow: 0 2px 0 color-mix(in srgb, var(--brick) 60%, #000), 0 0 0 6px color-mix(in srgb, var(--brick) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
