:root {
  --bg1: #0b0a0d; --bg2: #2a2024; --accent: #e0b44c; --ink: #1a1416; --paper: #f3ead9;
  --blood: #b3261e;
  /* the bundled fonts have no Chinese: each stack falls back to the system's CJK fonts */
  --serif: 'Fraunces', Georgia, 'Times New Roman', 'Songti SC', 'Noto Serif CJK SC', 'Source Han Serif SC', serif;
  --type: 'Special Elite', 'Courier New', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', monospace;
  --hand: 'Caveat', 'Segoe Print', 'Kaiti SC', 'STKaiti', cursive;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* A game, not a document: nothing is selected by a long press or dragged out as a picture. Typing fields stay editable. */
#app, #modal-root, #toast { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
svg, img { -webkit-user-drag: none; }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
body {
  font-family: var(--serif);
  color: var(--paper);
  background: var(--bg1);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
.tool, .suspect, .sbox, .icon-btn, .btn, .case-card { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* The scene behind the page: three fixed layers as tall as the screen gets (100lvh), so the browser bar
   coming and going never resizes them. #sky is painted once per theme: the light from above, the
   ambience's still glows and the film grain, blended within the layer (blended with the page, the grain
   would redo the whole screen every frame). #fx holds the moving particles (fx.ts), #scenery the
   silhouettes and the vignette. */
#sky, #fx, #scenery { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 0; pointer-events: none; }
#sky {
  background-color: var(--bg1);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.07'/></svg>"),
    var(--glow, none),
    radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg1) 70%);
  background-size: 160px 160px, auto, auto;
  background-blend-mode: overlay, normal, normal;
}
body[data-ambience="steam"] #sky { --glow: radial-gradient(circle 100vh at 50% 10%, rgba(255,190,120,.12), rgba(255,190,120,0)); }
body[data-ambience="sand"] #sky { --glow: radial-gradient(circle 70vh at 22% 28%, rgba(255,220,150,.1), rgba(255,220,150,0)); }
body[data-ambience="neon"] #sky { --glow: radial-gradient(circle 45vw at 85% 20%, rgba(255,94,196,.12), rgba(255,94,196,0)); }
body[data-ambience="embers"] #sky { --glow: linear-gradient(to top, rgba(255,120,40,.12), rgba(255,120,40,0) 45%); }
#scenery { background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.55) 100%); }
#scenery svg { width: 100%; height: 100%; display: block; }
/* while a case is open nothing loops: no flickering flames, blinking lights, rippling water or pulsing pieces */
body.playing .flame, body.playing .blink, body.playing .ripple,
body.playing .token.picked, body.playing .token.bad, body.playing .scard.picked .suspect .face { animation: none; }
#app { position: relative; z-index: 2; min-height: 100vh; min-height: 100svh; }
html:not(.ready) #app { opacity: 0; }
#app { animation: appIn .5s ease both; }
@keyframes appIn { from { opacity: 0; } to { opacity: 1; } }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.34);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .12s, background .2s;
}
@media (hover: hover) { .icon-btn:hover { background: rgba(255,255,255,.1); } }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 12px 20px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--accent); color: var(--ink); font-family: var(--type); font-size: 15px; letter-spacing: .02em;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
@media (hover: hover) { .btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); } }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.big { padding: 15px 28px; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.danger { background: #f4d3cf; color: var(--blood); border-color: var(--blood); box-shadow: 3px 3px 0 var(--blood); }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.kicker { font-family: var(--type); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; opacity: .75; margin: 0 0 6px; }

/* ───────────── HOME ───────────── */
.home { max-width: 1120px; margin: 0 auto; padding: 18px 16px 60px; }
.hero { text-align: center; padding: 28px 0 18px; position: relative; }
.hero-tools { position: absolute; top: 4px; right: 0; display: flex; gap: 8px; }
@media (max-width: 640px) {
  .home { padding: 12px 12px 48px; }
  .hero { padding-top: 54px; }
  .hero-tools { top: 0; }
  .case-grid { grid-template-columns: 1fr; gap: 16px; }
}
.logo {
  font-family: var(--serif); font-weight: 900; font-size: clamp(54px, 13vw, 128px); line-height: .9; margin: 6px 0 10px;
  letter-spacing: -.035em; font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  text-shadow: 0 6px 30px rgba(0,0,0,.5);
  animation: logoIn .9s cubic-bezier(.2,.9,.2,1.2) both;
}
.logo span { display: inline-block; }
.logo-doku { color: var(--accent); font-style: italic; position: relative; }
.logo-doku::after {
  content: ''; position: absolute; left: 4%; right: -2%; bottom: .02em; height: .1em; background: var(--blood);
  border-radius: 40% 60% 50% 50%; transform: rotate(-2deg) scaleX(0); transform-origin: left;
  animation: underline .6s .6s cubic-bezier(.6,0,.2,1) forwards;
}
@keyframes logoIn { from { opacity: 0; transform: translateY(24px) scale(.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes underline { to { transform: rotate(-2deg) scaleX(1); } }
.tagline { font-size: clamp(15px, 2.4vw, 19px); opacity: .85; margin: 0 auto 18px; max-width: 34em; }
.tagline em { color: var(--accent); }
.progress-pill { display: inline-block; font-family: var(--type); font-size: 13px; padding: 7px 16px; border-radius: 999px; border: 1px dashed rgba(255,255,255,.35); background: rgba(0,0,0,.25); }
.progress-pill b { color: var(--accent); font-size: 16px; }
#install-slot { margin-top: 14px; min-height: 4px; }
.ios-hint { font-family: var(--type); font-size: 12px; opacity: .7; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.case-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.case-card {
  position: relative; text-align: left; cursor: pointer; border: 0; padding: 26px 16px 14px; border-radius: 4px 14px 14px 14px;
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    linear-gradient(140deg, var(--bg2), var(--bg1));
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3), box-shadow .2s;
  animation: rise .5s calc(var(--i) * .05s + .3s) backwards;
  margin-top: 12px;
}
@media (hover: hover) { .case-card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 18px 40px rgba(0,0,0,.55), inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); } }
.case-card:active { transform: scale(.98); }
.case-card .tab {
  position: absolute; top: -12px; left: 0; padding: 4px 14px 5px; border-radius: 6px 6px 0 0;
  background: var(--accent); color: #1a1416; font-family: var(--type); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.card-body { display: flex; gap: 14px; align-items: center; }
.mini { width: 84px; height: 84px; flex: none; display: grid; grid-template-columns: repeat(var(--n), 1fr); border: 2px solid rgba(0,0,0,.6); border-radius: 3px; overflow: hidden; transform: rotate(-3deg); box-shadow: 3px 4px 0 rgba(0,0,0,.35); }
.mini i { display: block; }
.mini i.o { box-shadow: inset 0 0 0 30px rgba(0,0,0,.18); }
.card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-title { font-weight: 800; font-size: 21px; line-height: 1.1; letter-spacing: -.01em; }
.card-loc { font-size: 13px; opacity: .75; font-style: italic; }
.card-meta { font-family: var(--type); font-size: 11px; opacity: .65; letter-spacing: .06em; margin-top: 4px; }
.card-status { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 10px; font-family: var(--type); font-size: 12px; min-height: 26px; }
.stamp-mini { color: #ff5a4f; border: 2px solid #ff5a4f; padding: 2px 10px; transform: rotate(-8deg); text-transform: uppercase; letter-spacing: .14em; font-size: 13px; border-radius: 3px; }
.case-card.is-solved .mini { filter: saturate(.6); }
.best, .clip, .new { opacity: .8; }
.clip { color: var(--accent); }
/* ── the case road: a winding map of numbered stops ── */
.hero-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
#pace-slot { display: contents; }
.pace-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--type); font-size: 13px; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: var(--paper); }
button.pace-pill { cursor: pointer; }
.pace-pill svg { width: 15px; height: 15px; }
.pace-pill.full, .pace-pill.paid { border-color: var(--accent); color: var(--accent); }
.pace-pill.paid { border-style: dashed; }
.pace-pill.brk { background: color-mix(in srgb, var(--accent) 22%, rgba(0,0,0,.45)); }
.road { margin-top: 30px; }
.road-head { text-align: center; margin-bottom: 6px; animation: rise .6s .15s both; }
.road-head .kicker { color: var(--accent); opacity: 1; margin-bottom: 4px; }
.road-hint { margin: 0; font-size: 14.5px; font-style: italic; opacity: .72; }
.map { position: relative; padding: 30px 0 10px; }
.road-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.road-path .bed { fill: none; stroke: rgba(255,255,255,.06); stroke-width: 20; stroke-linecap: round; stroke-linejoin: round; }
.road-path .line { fill: none; stroke: rgba(255,255,255,.3); stroke-width: 2.5; stroke-dasharray: 9 10; stroke-linecap: round; }
.home:not(.refresh) .road-path .line { animation: segIn .5s calc(var(--i) * .1s + .35s) both; }
.road-path .line.is-done { stroke: var(--accent); opacity: .9; }
/* the way on marches like ants, 2px a tick: each tick repaints the path, so ten a second rather than sixty */
.road-path .line.is-next { stroke: color-mix(in srgb, var(--accent) 55%, rgba(255,255,255,.35)); animation: march 1.8s steps(19) infinite; }
.home:not(.refresh) .road-path .line.is-next { animation: segIn .5s calc(var(--i) * .1s + .35s) both, march 1.8s steps(19) infinite; }
@keyframes segIn { from { opacity: 0; } }
@keyframes march { to { stroke-dashoffset: -38; } }
.stops { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); row-gap: 38px; }
.stop, .road-end { position: relative; display: flex; justify-content: center; align-items: flex-start; }
.stop-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 11px; width: 100%; padding: 6px 4px 8px; background: none; border: 0; cursor: pointer; text-align: center; color: var(--paper); }
.home:not(.refresh) .stop-btn { animation: rise .6s calc(var(--i) * .09s + .25s) backwards; }
.road-end .stop-btn { cursor: default; }
.here-flag { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: var(--type); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); animation: bob 2.4s ease-in-out infinite; }
.here-flag::after { content: ''; display: block; width: 0; height: 0; margin: 2px auto 0; border: 5px solid transparent; border-top-color: var(--accent); border-bottom: 0; }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.pin {
  position: relative; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 35% 28%, var(--bg2), var(--bg1) 78%);
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px #0b0a0d, 0 14px 30px rgba(0,0,0,.55);
  font-family: var(--serif); font-weight: 900; font-size: 31px; line-height: 1; color: var(--accent); letter-spacing: -.03em;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3);
}
.pin b { font-weight: inherit; }
.pin > svg { width: 28px; height: 28px; }
.pin .tick { font-style: normal; font-size: 34px; }
.prem-badge { position: absolute; top: -5px; right: -7px; width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1a1416; box-shadow: 0 0 0 3px #0b0a0d; }
.prem-badge svg { width: 14px; height: 14px; }
.stop.is-done .pin { background: var(--accent); color: #1a1416; }
.stop.is-locked .pin { background: radial-gradient(circle at 35% 28%, #2e2529, #17131a 78%); color: rgba(255,255,255,.5); box-shadow: 0 0 0 3px rgba(255,255,255,.16), 0 0 0 7px #0b0a0d, 0 12px 26px rgba(0,0,0,.5); }
.stop.is-locked .prem-badge { background: #3a3034; color: rgba(255,255,255,.55); }
/* the current stop's halo: a disc of its own behind the pin that swells and fades (transform and opacity),
   so nothing is repainted for it; the pin's dark ring hides its middle */
.stop.is-current .stop-btn::before { content: ''; position: absolute; top: -3px; left: calc(50% - 46px); width: 92px; height: 92px; border-radius: 50%; background: var(--accent); opacity: .7; pointer-events: none; animation: pin 2.4s ease-in-out infinite; }
@keyframes pin { 50% { transform: scale(1.28); opacity: 0; } }
@media (hover: hover) { .stop-btn:hover .pin { transform: translateY(-4px) scale(1.05); } }
.stop-btn:active .pin { transform: scale(.95); }
.road-end .pin { width: 62px; height: 62px; margin-top: 6px; background: transparent; box-shadow: none; border: 2px dashed rgba(255,255,255,.22); color: rgba(255,255,255,.55); }
.road-end .pin > svg { width: 40px; height: 40px; opacity: .8; }
.stop-text { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 66%; min-width: 112px; }
.stop-title { font-weight: 900; font-size: 19px; line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
.dots { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 100%; margin-top: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.dot.on { background: currentColor; box-shadow: 0 0 6px currentColor; }
.dots.many { gap: 4px; max-width: 130px; }
.dots.many .dot { width: 7px; height: 7px; border-width: 1.2px; }
.stop-status { display: inline-flex; align-items: center; gap: 5px; font-family: var(--type); font-size: 11px; opacity: .7; margin-top: 2px; }
.stop-status svg { width: 13px; height: 13px; flex: none; }
.stop.is-locked .stop-text { opacity: .62; }
.stop.is-premium .stop-status { color: var(--accent); opacity: .9; }
.road-end .stop-status { max-width: 150px; opacity: .55; line-height: 1.4; }
.stop-lock {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: 10px; cursor: pointer; text-align: left;
  border: 1px dashed rgba(255,255,255,.3); background: rgba(0,0,0,.32); color: var(--paper); font-family: var(--type); font-size: 12.5px; line-height: 1.4;
}
.stop-lock svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.stop-lock.premium { border-color: var(--accent); }
.stop-lock b { color: var(--paper); }
.case-card.is-shut { filter: saturate(.35) brightness(.72); }
@media (hover: hover) { .case-card.is-shut:hover { filter: saturate(.6) brightness(.85); } }
.case-card .lock { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.case-card .lock svg { width: 16px; height: 16px; }
.case-card .tab .diff-chip { color: inherit; background: rgba(0,0,0,.14); }
.refresh .case-card, .refresh .hero *, .refresh .road-head, .refresh .stop-hero, .refresh .tiers, .refresh .stop-nav { animation: none; }
@media (max-width: 640px) {
  .road { margin-top: 22px; }
  .map { padding-top: 26px; }
  .stops { row-gap: 30px; }
  .pin { width: 62px; height: 62px; font-size: 27px; }
  .stop.is-current .stop-btn::before { left: calc(50% - 40px); width: 80px; height: 80px; }
  .pin > svg { width: 24px; height: 24px; }
  .pin .tick { font-size: 30px; }
  .stop-title { font-size: 17px; }
  .stop-text { width: 72%; min-width: 100px; }
  .road-end .pin { width: 54px; height: 54px; }
  .road-end .pin > svg { width: 34px; height: 34px; }
}

/* ── one stop: its case files by difficulty ── */
.stop-screen { padding-bottom: 60px; }
.stop-page { max-width: 1120px; margin: 0 auto; padding: 8px 16px 0; }
.stop-hero { text-align: center; padding: 12px 0 18px; animation: rise .6s .05s both; }
.stop-hero .pin { margin: 0 auto 16px; width: 86px; height: 86px; font-size: 38px; }
.stop-hero .pin .tick { font-size: 40px; }
.stop-hero .kicker { color: var(--accent); opacity: 1; }
.stop-hero .prem, .stop-hero .here { display: inline-flex; align-items: center; gap: 4px; }
.stop-hero .prem svg { width: 12px; height: 12px; }
.stop-hero h1 { font-weight: 900; font-size: clamp(32px, 5.4vw, 48px); margin: 0 0 6px; letter-spacing: -.025em; line-height: 1; text-wrap: balance; }
.stop-hero .stop-blurb { margin: 0 auto 12px; max-width: 36em; font-size: 16.5px; font-style: italic; opacity: .82; text-wrap: pretty; }
.stop-progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 0 0 12px; font-family: var(--type); font-size: 12px; opacity: .85; }
.stop-progress .dots { margin: 0; }
.stop-hero .stop-lock { max-width: 480px; }
.tier-kicker { text-align: center; margin: 20px 0 10px; animation: rise .5s .15s both; }
.tiers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 18px; animation: rise .5s .15s both; }
.tier {
  flex: 1 1 150px; max-width: 250px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 14px 11px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, currentColor 30%, transparent); background: rgba(0,0,0,.3);
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.tier b { font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.tier small { font-family: var(--type); font-size: 11px; letter-spacing: .04em; color: var(--paper); opacity: .72; }
@media (hover: hover) { .tier:hover { transform: translateY(-2px); background: color-mix(in srgb, currentColor 10%, rgba(0,0,0,.32)); } }
.tier.is-on { background: color-mix(in srgb, currentColor 20%, rgba(0,0,0,.4)); border-color: currentColor; box-shadow: 0 10px 26px rgba(0,0,0,.4), inset 0 -3px 0 currentColor; }
.tier.is-on small { opacity: .9; }
.tier-cases { min-height: 80px; }
.tier-empty { font-family: var(--type); font-size: 13px; opacity: .6; text-align: center; grid-column: 1 / -1; }
.stop-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 40px; padding-top: 18px; border-top: 1px dashed rgba(255,255,255,.18); animation: rise .5s .3s both; }
.stop-link { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; border-radius: 999px; cursor: pointer; text-align: left; border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.28); color: var(--paper); transition: background .2s, transform .15s; }
.stop-link.next { flex-direction: row-reverse; text-align: right; padding: 8px 12px 8px 16px; }
.stop-link small { display: block; font-family: var(--type); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.stop-link b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.stop-link svg { width: 18px; height: 18px; flex: none; }
.stop-link.next svg { transform: scaleX(-1); }
@media (hover: hover) { .stop-link:hover { background: rgba(255,255,255,.08); transform: translateY(-1px); } }
.stop-link.is-locked { opacity: .6; }
.road-more { display: inline-flex; align-items: center; gap: 10px; font-family: var(--type); font-size: 12px; opacity: .6; text-align: right; }
.road-more svg { width: 34px; height: 34px; flex: none; }
@media (max-width: 640px) {
  .stop-page { padding: 4px 12px 0; }
  .stop-hero { padding-top: 6px; }
  .stop-hero .pin { width: 74px; height: 74px; font-size: 32px; margin-bottom: 12px; }
  .stop-hero .stop-blurb { font-size: 15px; }
  .tier { flex-basis: calc(50% - 4px); max-width: none; padding: 10px 10px 9px; }
  .tier b { font-size: 17px; }
  .stop-nav { flex-wrap: wrap; }
  .stop-link { flex: 1 1 100%; }
}

/* ── gates: locked stop, full game, break, sign-in ── */
.gate { text-align: center; }
.gate-icon { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--accent); }
.gate-icon svg { width: 30px; height: 30px; }
.gate p { line-height: 1.5; }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.gate-actions.col { flex-direction: column; align-items: center; }
.gate .link { color: var(--ink); font-family: var(--type); font-size: 13px; }
.code-box { font-family: var(--type); font-size: 13px; }
.code-box summary { cursor: pointer; text-decoration: underline; list-style: none; }
.code-box summary::-webkit-details-marker { display: none; }
.code-form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.code-form[hidden] { display: none; }
.code-form p { flex-basis: 100%; margin: 0; }
.code-form input, .set-row .code-form input {
  position: static; opacity: 1; pointer-events: auto; flex: 1 1 180px; min-width: 0; max-width: 300px; padding: 9px 12px; border-radius: 8px;
  border: 2px solid var(--ink); background: #fffaf0; color: var(--ink); font-family: var(--type); font-size: 15px; letter-spacing: .06em;
}
.set-row.static { cursor: default; }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-row.col .code-form { justify-content: flex-start; margin-top: 4px; }
.set-row .owned { color: var(--accent); display: grid; }
.set-row .owned svg { width: 24px; height: 24px; }

.foot { text-align: center; margin-top: 48px; font-family: var(--type); font-size: 12px; opacity: .6; }

/* ───────────── GAME ───────────── */
.game { padding-bottom: 40px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg1) 92%, transparent), color-mix(in srgb, var(--bg1) 0%, transparent));
}
.tb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-kicker { font-family: var(--type); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-name { font-weight: 800; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.diff-chip { padding: 1px 7px; border-radius: 4px; background: rgba(255,255,255,.12); }
.d-easy { color: #9be38f; } .d-medium { color: #ffd166; } .d-hard { color: #ff9b5c; } .d-expert { color: #ff6b8a; }
.timer { font-family: var(--type); font-size: 15px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.3); min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.no-timer .timer { visibility: hidden; }

.game-layout { display: grid; gap: 20px; padding: 6px 12px; max-width: 1180px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
  .game-layout { grid-template-columns: minmax(340px, .85fr) minmax(0, 1.15fr); align-items: start; }
  .evidence { order: -1; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; padding-right: 4px; }
}
.board-col { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }

.sheet {
  position: relative; background: var(--paper); color: var(--ink); padding: 14px 14px 16px; border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0,0,0,.08), 0 22px 50px rgba(0,0,0,.55); transform: rotate(-.35deg);
  background-image: linear-gradient(rgba(0,0,0,.025) 1px, transparent 1px);
  background-size: 100% 22px;
  animation: sheetIn .6s cubic-bezier(.2,.9,.3,1.15) both;
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) rotate(2deg) scale(.96); } to { opacity: 1; transform: rotate(-.35deg); } }
.tape { position: absolute; width: 90px; height: 24px; background: rgba(240, 228, 190, .78); border: 1px solid rgba(0,0,0,.08); box-shadow: 0 1px 3px rgba(0,0,0,.15); z-index: 4; }
.tape.t1 { top: -11px; left: 18px; transform: rotate(-6deg); }
.tape.t2 { top: -10px; right: 18px; transform: rotate(5deg); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 6px 26px; }
.loc { font-family: var(--type); font-size: 12px; letter-spacing: .06em; opacity: .75; }
.compass { width: 32px; height: 32px; color: var(--ink); }
.compass svg { width: 100%; height: 100%; }

.board-wrap {
  --gutter: 20px;
  --size: min(calc(100vw - 24px - 28px - var(--gutter)), 600px, max(250px, calc(100svh - 340px)));
  --cell: calc(var(--size) / var(--n));
  display: grid; grid-template-columns: var(--gutter) var(--size); grid-template-rows: var(--gutter) var(--size);
}
@media (min-width: 980px) { .board-wrap { --size: min(calc(57.5vw - 74px), 600px, calc(100vh - 290px)); } }
.col-labels, .row-labels { display: grid; font-family: var(--type); font-size: 11px; opacity: .55; text-align: center; }
.col-labels { grid-column: 2; grid-template-columns: repeat(var(--n), 1fr); align-items: end; padding-bottom: 3px; }
.row-labels { grid-row: 2; grid-template-rows: repeat(var(--n), 1fr); align-items: center; padding-right: 4px; }
.board {
  grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  width: var(--size); height: var(--size); border: 3px solid var(--ink); border-radius: 2px; position: relative;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px rgba(0,0,0,.25);
}

.cell {
  position: relative; background-color: var(--floor); cursor: pointer;
  background-image: radial-gradient(rgba(0,0,0,.05) 1px, transparent 1.2px);
  background-size: 8px 8px;
  transition: filter .5s ease, background-color .3s;
}
.cell::before { /* fine grid line */
  content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.16); pointer-events: none; z-index: 1;
}
.cell::after { /* room walls */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5; border: 0 solid var(--ink);
}
.cell.wt::after { border-top-width: 2px; } .cell.wb::after { border-bottom-width: 2px; }
.cell.wl::after { border-left-width: 2px; } .cell.wr::after { border-right-width: 2px; }
.cell.blocked { cursor: not-allowed; }
.cell:has(.token) { touch-action: none; cursor: grab; }
.cell.blocked .obj, .cell.blocked .blk { filter: saturate(.95); }
.cell.ref-obj .mat { border-color: var(--ink); opacity: 1; }

.blk { position: absolute; inset: 9%; border: 2px solid var(--ink); border-radius: 6px; z-index: 2; }
.blk.jt { top: -1px; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.blk.jb { bottom: -1px; border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.blk.jl { left: -1px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.blk.jr { right: -1px; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.blk-t { background: linear-gradient(135deg, #c48e5a, #a8703f); }
.blk-k { background: linear-gradient(135deg, #f1ede6, #d8d1c6); }
.blk-s { background: #6b4426; }
.blk-w { background: radial-gradient(circle at 30% 30%, #8fd3ea, #3d97c4); border-color: #1c4f6b; }
.blk-r {
  inset: 6%; border-width: 1.5px; border-style: dashed; border-color: rgba(0,0,0,.45);
  background: color-mix(in srgb, var(--accent) 20%, var(--paper)); /* the artwork supplies straw, wood, cloth or stone */
  opacity: .85;
}
/* seats and beds stand on a mat: the rug's dashed outline on a pale pad says "a person can be here" */
.mat {
  position: absolute; inset: 5%; z-index: 2; border-radius: 14%; border: 1.5px dashed rgba(0,0,0,.5);
  background: color-mix(in srgb, color-mix(in srgb, var(--accent) 55%, #b23a3a) 30%, #fff); /* the rug's colour, faded */
  background-image: radial-gradient(rgba(0,0,0,.1) 1px, transparent 1.3px); background-size: 6px 6px; opacity: .9;
}
/* everything else is an obstacle standing up off the floor: a soft shadow under it, the picture lifted */
.lift { position: absolute; inset: 34% 12% 6% 16%; z-index: 2; border-radius: 45%; background: rgba(30,20,12,.22); filter: blur(2px); }
.cell.blocked .obj:not(.obj-t, .obj-k, .obj-s, .obj-w) svg { filter: drop-shadow(1px 2.5px 0 rgba(42,29,21,.38)); }
/* block furniture: tables, counters and shelves stand proud, pools sink in */
.blk-t, .blk-k, .blk-s { box-shadow: 1px 3px 0 rgba(30,20,12,.3); }
.blk-w { box-shadow: inset 0 3px 5px rgba(0,0,0,.35); }
.obj { position: absolute; inset: 10%; z-index: 3; pointer-events: none; display: grid; place-items: center; }
/* furniture is painted on its square, never touched: a piece still falling into place over another square doesn't take that square's taps */
.blk, .mat, .lift { pointer-events: none; }
.obj svg { width: 100%; height: 100%; display: block; }
.obj-t, .obj-k, .obj-s, .obj-w, .obj-r { inset: 9%; }
.obj-c, .obj-b { inset: 16%; opacity: .95; }
.flame { transform-origin: 50% 90%; animation: flicker .25s infinite alternate; }
@keyframes flicker { from { transform: scaleY(1) skewX(0); } to { transform: scaleY(1.08) skewX(3deg); } }
.blink { animation: blink 1.6s infinite; }
@keyframes blink { 0%, 60% { opacity: 1; } 70%, 90% { opacity: .2; } }
.ripple { animation: ripple 3s ease-in-out infinite; }
@keyframes ripple { 50% { transform: translateX(4px); } }

/* room names (src/labels.ts): one line along the room's edge, never wrapping, shrunk only when the room has no run long enough.
   Every square a name runs over (--k: how far along) draws a copy clipped to itself, so each piece lies in its own square's layer */
.cell.label-h, .cell.label-v {
  --lf: min(clamp(7px, calc(var(--cell) * .16), 11px), calc((var(--cell) * var(--span) - 14px) / var(--ems))); /* the name's font size */
  --lab: calc(var(--lf) * 1.1 + 5px); /* the strip of the square it takes */
}
.room-label {
  position: absolute; bottom: 2px; left: calc(3px - var(--k) * var(--cell)); z-index: 6; pointer-events: none;
  width: max-content; max-width: calc(var(--cell) * var(--span) - 6px); white-space: nowrap; overflow: hidden;
  font-family: var(--type); font-size: var(--lf); line-height: 1.1; text-transform: uppercase; letter-spacing: .04em;
  background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink); padding: 1px 4px; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
  clip-path: inset(-4px calc(100% + 3px - (var(--k) + 1) * var(--cell)) -4px calc(var(--k) * var(--cell) - 3px));
}
/* on end, down the left wall of a narrow room, from the top; every character turned with the line (as on Android), so it keeps its width */
.cell.label-v .room-label {
  writing-mode: vertical-rl; text-orientation: sideways; top: calc(3px - var(--k) * var(--cell)); bottom: auto; left: 2px; padding: 4px 1px;
  width: auto; max-width: none; max-height: calc(var(--cell) * var(--span) - 6px);
  clip-path: inset(calc(var(--k) * var(--cell) - 3px) -4px calc(100% + 3px - (var(--k) + 1) * var(--cell)) -4px);
}
/* a person standing on a square the name runs over stands smaller, clear of it, so the name can always be read */
.cell.label-h .token { inset: 3% calc((3% + var(--lab)) / 2) var(--lab); }
.cell.label-v .token { inset: calc((3% + var(--lab)) / 2) 3% calc((3% + var(--lab)) / 2) var(--lab); }
.cell.label-v .token .tl { left: auto; right: -6%; }
.dyn { position: absolute; inset: 0; z-index: 7; pointer-events: none; }

/* states */
.cell.hl-room { filter: brightness(1.04); }
.cell.hl::before { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cell.shade .dyn { background: repeating-linear-gradient(-45deg, rgba(0,0,0,.09) 0 3px, transparent 3px 7px); }
.cell.sel { z-index: 8; }
.cell.sel .dyn { box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 0 0 4px var(--ink); border-radius: 2px; }
.cell.drop .dyn { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.cell.pressed .dyn { background: rgba(0,0,0,.08); }
/* hold to place: a ring fills up while the finger stays down (nothing shows for a quick tap) */
.cell.holding .dyn::before { content: ''; position: absolute; inset: 16%; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink); opacity: 0; animation: holdRing calc(var(--hold, 480ms) - 120ms) 120ms linear forwards; }
@keyframes holdRing { from { opacity: .95; transform: scale(.35); } to { opacity: .95; transform: scale(1); } }
.cell.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }
.cell.hinted .dyn { animation: hinted 1.5s ease; }
@keyframes hinted { 0% { background: color-mix(in srgb, var(--accent) 80%, transparent); } 100% { background: transparent; } }
/* furniture named in the selected suspect's statements */
.cell.ref-obj::before { background: color-mix(in srgb, var(--accent) 45%, transparent); }
/* hint: the square someone must be on, circled, with their letter in their colour (--hc, set on the board) */
.cell.hint-ring .dyn::after {
  content: attr(data-hint); position: absolute; inset: 10%; display: grid; place-items: center; border: 3px solid var(--blood); border-radius: 50%; box-shadow: 0 0 0 2px var(--paper);
  color: var(--hc, var(--blood)); font-family: var(--type); font-weight: 700; font-size: calc(var(--cell) * .34); line-height: 1; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper);
  animation: ringIn .35s cubic-bezier(.2,1.4,.4,1) both;
}
/* the squares that person's statements allow, tinted in their colour; the ones the hint rules out, hatched red;
   and what its reasons rest on (where someone else can still be, a row only one person can take), framed in dashes.
   They lie over the furniture (a chair's mat would hide them) and under the suspects and crosses. */
.cell.hint-area .dyn, .cell.hint-out .dyn { background-color: color-mix(in srgb, var(--hc, var(--accent)) 26%, transparent); }
.cell.hint-out .dyn { background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--blood) 60%, transparent) 0 2px, transparent 2px 7px); }
.cell.hint-cause .dyn { outline: 2px dashed color-mix(in srgb, var(--ink) 70%, transparent); outline-offset: -5px; }
/* rings around a suspect (the verdict on submit, a hint's misplaced suspect) belong to the token, so its letter stays on top;
   they reach out to 2% (4%) of the square: past the token's rim and the 7% it sits in from the edge */
.cell.check-ok .token::before { content: ''; position: absolute; inset: calc(-1 * var(--rim) - var(--cell) * .05); border: 3px solid #2e9e5b; border-radius: 50%; box-shadow: 0 0 0 2px var(--paper); animation: ringIn .35s cubic-bezier(.2,1.4,.4,1) both; }
.cell.check-bad .token::before { content: ''; position: absolute; inset: calc(-1 * var(--rim) - var(--cell) * .05); border: 3px solid var(--blood); border-radius: 50%; box-shadow: 0 0 0 2px var(--paper); animation: ringIn .35s cubic-bezier(.2,1.4,.4,1) both; }
.cell.check-ok .dyn, .cell.check-bad .dyn { z-index: 9; }
.cell.hint-wrong .token::before { content: ''; position: absolute; inset: calc(-1 * var(--rim) - var(--cell) * .03); border: 3px dashed var(--blood); border-radius: 50%; animation: ringIn .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes ringIn { from { transform: scale(1.6); opacity: 0; } }
body.modal-open { overflow: hidden; }

.token {
  --rim: max(2px, calc(var(--cell) * .055));
  position: absolute; inset: 7%; border-radius: 50%; border: var(--rim) solid var(--pc);
  background: #fff; box-shadow: 0 3px 6px rgba(0,0,0,.35); transition: transform .15s;
}
.token svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.token.pop { animation: pop .38s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { 0% { transform: scale(.2) translateY(-30%); opacity: 0; } 100% { transform: none; opacity: 1; } }
.token.victim { border-style: dashed; border-color: #f6f1e8; outline: 2px solid var(--ink); }
.token.bad { animation: bad 1s ease-in-out infinite; border-color: var(--blood); }
@keyframes bad { 50% { box-shadow: 0 0 0 4px rgba(179,38,30,.55); } }
.token.picked { transform: translateY(-6%) scale(1.08); box-shadow: 0 8px 14px rgba(0,0,0,.4), 0 0 0 3px var(--paper), 0 0 0 6px var(--pc); animation: pickPulse 1.2s ease-in-out infinite; z-index: 3; }
.token.hint-bad { animation: bad .5s 3; }
.xmark { position: absolute; inset: 22%; width: 56%; height: 56%; }
/* crosses cast by a placed suspect are drawn one after another along the row and column (--k: squares away from the suspect) */
.xmark path { fill: none; stroke: var(--blood); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .26s calc(var(--k, 0) * 55ms) ease-out both; opacity: .85; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.notes {
  position: absolute; inset: 4%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center;
  animation: noteSlap .3s cubic-bezier(.2,1.3,.4,1) both;
}
.notes .np { position: relative; display: block; width: 92%; aspect-ratio: 1; border-radius: 50%; border: max(2px, calc(var(--cell) * .04)) solid var(--pc); background: #fff; box-shadow: 0 0 0 1px var(--paper), 0 1px 2px rgba(0,0,0,.35); transition: transform .15s; }
.notes .np svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
/* the selected suspect's notes: a little bigger than the others, on top of their neighbours */
.notes .np.picked { transform: scale(1.25); z-index: 1; }
/* corners first, then the edges, the middle last */
.notes .np:nth-child(1) { grid-area: 1 / 1; } .notes .np:nth-child(2) { grid-area: 1 / 3; }
.notes .np:nth-child(3) { grid-area: 3 / 1; } .notes .np:nth-child(4) { grid-area: 3 / 3; }
.notes .np:nth-child(5) { grid-area: 1 / 2; } .notes .np:nth-child(6) { grid-area: 3 / 2; }
.notes .np:nth-child(7) { grid-area: 2 / 1; } .notes .np:nth-child(8) { grid-area: 2 / 3; }
.notes .np:nth-child(9) { grid-area: 2 / 2; }
/* a square a room name runs over keeps its notes clear of it: above it, or right of it when it stands on end */
.cell.label-h .notes { bottom: var(--lab); grid-template-rows: repeat(2, 1fr); }
.cell.label-h .notes .np:nth-child(3) { grid-area: 2 / 1; } .cell.label-h .notes .np:nth-child(4) { grid-area: 2 / 3; }
.cell.label-h .notes .np:nth-child(5) { grid-area: 1 / 2; } .cell.label-h .notes .np:nth-child(6) { grid-area: 2 / 2; }
.cell.label-v .notes { left: var(--lab); grid-template-columns: repeat(2, 1fr); }
.cell.label-v .notes .np { width: auto; height: 92%; }
.cell.label-v .notes .np:nth-child(2) { grid-area: 1 / 2; } .cell.label-v .notes .np:nth-child(3) { grid-area: 3 / 1; }
.cell.label-v .notes .np:nth-child(4) { grid-area: 3 / 2; } .cell.label-v .notes .np:nth-child(5) { grid-area: 2 / 1; }
.cell.label-v .notes .np:nth-child(6) { grid-area: 2 / 2; }
.cell.label-h .notes .np:nth-child(n+7), .cell.label-v .notes .np:nth-child(n+7) { display: none; }
@keyframes noteSlap { from { opacity: 0; transform: rotate(-6deg) scale(1.3); } to { opacity: 1; transform: none; } }
.token .tl { position: absolute; left: -6%; top: -6%; font-family: var(--type); font-weight: 700; font-size: clamp(8px, calc(var(--cell) * .2), 14px); line-height: 1; color: var(--pc); background: rgba(255,255,255,.96); padding: 2px 4px; border-radius: 6px; border: 1.5px solid var(--pc); box-shadow: 0 1px 2px rgba(0,0,0,.3); text-shadow: none; z-index: 1; }

/* toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: min(100%, 640px); flex-wrap: wrap; }
.btn.submit { padding: 9px 16px; font-size: 13px; }
.btn.submit { gap: 6px; }
.btn.submit svg { width: 16px; height: 16px; }
.btn.submit:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.modes, .actions { display: flex; gap: 6px; background: rgba(0,0,0,.3); padding: 5px; border-radius: 14px; border: 1px solid rgba(255,255,255,.08); }
.tool {
  display: flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; font-family: var(--type); font-size: 12.5px; transition: background .15s, transform .1s, color .15s;
}
.tool svg { width: 20px; height: 20px; }
@media (hover: hover) { .tool:hover { background: rgba(255,255,255,.08); } }
.tool:active { transform: scale(.93); }
.tool.on { background: var(--accent); color: var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.tool:disabled { opacity: .35; cursor: default; }
.solved-bar { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; font-family: var(--type); font-size: 13px; background: rgba(0,0,0,.35); padding: 8px 12px; border-radius: 14px; flex-wrap: wrap; }
.solved-bar .btn.ghost { color: var(--paper); border-color: var(--paper); box-shadow: 3px 3px 0 rgba(0,0,0,.5); }

/* suspects & evidence */
.evidence { display: flex; flex-direction: column; gap: 12px; width: min(100%, 720px); min-width: 0; margin: 0 auto; scrollbar-width: thin; }
.brief { background: rgba(0,0,0,.38); border: 1px solid rgba(255,255,255,.1); border-radius: var(--r); padding: 0 16px; }
.brief summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; font-size: 13px; font-family: var(--type); text-transform: uppercase; letter-spacing: .16em; color: var(--accent); }
.brief summary::-webkit-details-marker { display: none; }
.brief summary svg { width: 18px; height: 18px; transition: transform .25s; opacity: .8; }
.brief[open] summary svg { transform: rotate(180deg); }
.brief p { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
.brief .rule { margin: 0 0 14px; font-family: var(--type); font-size: 12.5px; opacity: .9; }
.brief .rule b { color: var(--accent); font-weight: 400; }
.ev-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 2px 0; font-family: var(--type); font-weight: 400; font-size: 13px; text-transform: uppercase; letter-spacing: .18em; color: var(--accent); }
.ev-title small { font-size: 10.5px; letter-spacing: .04em; text-transform: none; color: var(--paper); opacity: .6; text-align: right; }
.general { display: flex; flex-direction: column; gap: 8px; }
.general .sbox { border-left: 6px solid var(--accent); cursor: default; }
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 12px; }
.sbox { min-width: 0; overflow-wrap: break-word; }
.scard { display: flex; flex-direction: column; cursor: pointer; animation: rise .4s calc(var(--i, 0) * .04s) backwards; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.scard:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
/* desktop: a portrait card (face + name in one frame) with the statement box beneath */
.card-top { display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 3px 3px 0 rgba(0,0,0,.5); margin-bottom: 10px; transition: box-shadow .15s, border-color .15s; }
.suspect { display: block; padding: 8px 8px 0; cursor: pointer; }
.suspect .face {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 7px; overflow: hidden; border: 2px solid var(--pc); display: block;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 42%, #fff), color-mix(in srgb, var(--pc) 70%, #fff));
}
.suspect .face svg { width: 100%; height: 100%; display: block; }
.suspect .face .tick { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-style: normal; font-weight: 900; font-size: 30px; opacity: 0; transition: opacity .2s; }
.meta { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 4px 8px 7px; }
.sname { font-family: var(--hand); font-weight: 600; font-size: 21px; line-height: 1; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: baseline; gap: 6px; }
.letter { font-family: var(--type); font-weight: 700; font-size: 14px; color: var(--pc); filter: saturate(1.3) brightness(.78); }
.srole { font-family: var(--type); font-size: 10px; letter-spacing: .04em; opacity: .65; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard.is-victim .suspect .face { border-style: dashed; filter: saturate(.7); }
.scard.placed .suspect .face .tick { opacity: 1; }
.scard.placed .suspect .face { opacity: .7; }
/* the selected suspect stands out; the rest step back */
body.has-sel .scard:not(.picked) { opacity: .62; }
.scard.picked { opacity: 1; transform: translateY(-2px) scale(1.02); z-index: 2; position: relative; }
.scard.picked .suspect .face { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--pc); animation: pickPulse 1.2s ease-in-out infinite; }
@keyframes pickPulse { 50% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 7px var(--pc), 0 0 14px 4px color-mix(in srgb, var(--pc) 60%, transparent); } }
.scard.picked .sname .letter { background: var(--pc); color: #fff; padding: 1px 5px; border-radius: 5px; filter: none; }
.scard.picked .card-top, .scard.picked .sbox { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent), 4px 5px 0 rgba(0,0,0,.5); }
.scard.picked .sbox::before { border-color: var(--accent); }
[data-mode="note"] .scard.noted .suspect .face { box-shadow: 0 0 0 3px var(--ink) inset; }
.sbox {
  position: relative; flex: 1; padding: 10px; border-radius: 10px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(0,0,0,.5); transition: box-shadow .15s, border-color .15s;
}
.scard .sbox::before { /* speech-bubble notch pointing at the portrait */
  content: ''; position: absolute; top: -8px; left: 50%; width: 12px; height: 12px; background: var(--paper);
  border-left: 2px solid var(--ink); border-top: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg);
}
.sbox ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.sbox li { font-family: var(--type); font-size: 14px; line-height: 1.35; padding: 4px 8px 4px 20px; position: relative; border-radius: 6px; background: rgba(0,0,0,.045); transition: opacity .2s; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sbox li::before { content: '›'; position: absolute; left: 7px; color: var(--pc, var(--ink)); font-weight: 900; }
.term { white-space: normal; }
.oi { display: inline-grid; place-items: center; width: 20px; height: 20px; margin: -4px 3px -3px 0; vertical-align: middle; overflow: hidden; }
.oi svg { width: 100%; height: 100%; display: block; }
/* block-type furniture (tables, counters, shelves, rugs, pools) is only a decoration on its block colour */
.oi.blk-t, .oi.blk-k, .oi.blk-s, .oi.blk-w, .oi.blk-r { border-radius: 4px; border: 1.5px solid var(--ink); }
.oi.mat { position: static; inset: auto; border-radius: 5px; border: 1.5px dashed rgba(0,0,0,.5); background-size: 4px 4px; opacity: 1; }
.oi.mat svg { width: 80%; height: 80%; }
.oi.solid svg { filter: drop-shadow(.5px 1.5px 0 rgba(42,29,21,.4)); }
.rsw { display: inline-block; width: 14px; height: 14px; margin: -2px 4px -2px 0; vertical-align: middle; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.pl { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin: -2px 4px -2px 0; vertical-align: middle; border-radius: 5px; background: var(--pc); color: #fff; font-family: var(--type); font-weight: 700; font-size: 11px; line-height: 1; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
.sbox li.fixed { opacity: .75; font-style: italic; }
.dossier, .sname .short { display: none; }
@keyframes dossierIn { from { opacity: 0; transform: translateY(6px); } }
.ev-tip { font-family: var(--type); font-size: 11.5px; opacity: .55; text-align: center; margin: 2px 0 10px; }
.drag-ghost { position: fixed; left: 0; top: 0; width: 60px; height: 60px; border-radius: 10px; border: 3px solid var(--pc); overflow: hidden; background: #fff; z-index: 100; pointer-events: none; box-shadow: 0 14px 28px rgba(0,0,0,.5); }
.drag-ghost svg { width: 100%; height: 100%; display: block; }
body.dragging, body.dragging * { cursor: grabbing !important; }


/* board build-up: tiles pop in along the diagonal, furniture drops from above and lands, labels fall last */
.board.pre-build { opacity: 0; } /* waiting behind the case intro: it builds up once that closes */
.board.build { animation: softIn .3s both; }
.board.build .cell { animation: tilePop .5s calc(var(--d) * 40ms) cubic-bezier(.2,.9,.3,1.2) both; }
.board.build .cell::after { animation: softIn .35s calc(var(--d) * 40ms + 380ms) both; }
.board.build .blk, .board.build .mat, .board.build .lift, .board.build .obj { animation: blockFall .9s calc(var(--g) * 60ms + 450ms) both; }
.board.build .room-label { animation: labelFall .55s calc(var(--d) * 40ms + 1000ms) both; }
.board.build .dyn { animation: softIn .4s calc(var(--d) * 40ms + 1100ms) both; }
@keyframes softIn { from { opacity: 0; } }
@keyframes tilePop {
  0% { opacity: 0; transform: scale(.55) rotate(var(--tilt, 0deg)); }
  60% { opacity: 1; transform: scale(1.06) rotate(calc(var(--tilt, 0deg) * -.4)); }
  100% { opacity: 1; transform: none; }
}
@keyframes blockFall {
  0% { transform: translateY(-110vh) rotate(var(--tilt, 0deg)); filter: drop-shadow(0 40px 18px rgba(0,0,0,.35)); animation-timing-function: cubic-bezier(.5,0,.8,.45); }
  56% { transform: translateY(0) rotate(calc(var(--tilt, 0deg) * .3)); filter: drop-shadow(0 0 0 rgba(0,0,0,0)); animation-timing-function: cubic-bezier(.3,0,.2,1); }
  61% { transform: translateY(5%) scale(1.05, .93); }
  74% { transform: translateY(-4%) scale(.99, 1.02) rotate(calc(var(--tilt, 0deg) * -.15)); }
  86% { transform: translateY(1.5%) scale(1); }
  100% { transform: none; filter: none; }
}
@keyframes labelFall {
  0% { opacity: 0; transform: translateY(-40px) rotate(-4deg); animation-timing-function: cubic-bezier(.5,0,.8,.5); }
  55% { opacity: 1; transform: translateY(3px) rotate(1deg); }
  100% { transform: none; }
}

/* solved */
.is-solved .cell:not(.crime-room) { filter: grayscale(.85) brightness(.75) contrast(.9); }
.is-solved .cell.crime-room { filter: saturate(1.15); }
.token.killer { border-color: var(--blood); animation: killer 1.2s ease-in-out infinite; z-index: 3; }
@keyframes killer { 50% { box-shadow: 0 0 0 5px rgba(179,38,30,.6), 0 0 22px rgba(179,38,30,.8); transform: scale(1.06); } }
.token.dead svg { filter: grayscale(1); }
.stamp {
  position: absolute; left: 50%; top: 50%; z-index: 30; pointer-events: none; opacity: 0; visibility: hidden;
  font-family: var(--type); font-size: clamp(30px, 8vw, 58px); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
  color: var(--blood); border: 6px double var(--blood); border-radius: 8px; padding: 6px 22px;
  transform: translate(-50%, -50%) rotate(-14deg) scale(2.6);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='80'><filter id='n'><feTurbulence baseFrequency='.7' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.6 1.6'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='80'><filter id='n'><feTurbulence baseFrequency='.7' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.6 1.6'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* inked into the paper (multiply) only while it shows: a blend mode makes the sheet a layer of its own */
.stamp.show { visibility: visible; mix-blend-mode: multiply; animation: stampIn .32s cubic-bezier(.5,0,.75,0) forwards; }
.stamp.show.static { animation: none; opacity: .9; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
@keyframes stampIn { to { opacity: .92; transform: translate(-50%, -50%) rotate(-14deg) scale(1); } }
.sheet.shake-sheet { animation: sheetShake .5s; }
@keyframes sheetShake { 15% { transform: rotate(-.35deg) translateX(-8px); } 30% { transform: rotate(-.35deg) translateX(8px); } 45% { transform: rotate(-.35deg) translateX(-6px); } 60% { transform: rotate(-.35deg) translateX(5px); } 75% { transform: rotate(-.35deg) translateX(-2px); } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* modals */
#modal-root { position: relative; z-index: 60; }
/* the blur behind a dialog only where there is a mouse: on a phone it would redo the whole screen every frame */
.modal-back { position: fixed; inset: 0; background: rgba(5,3,6,.7); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .22s; overflow-y: auto; }
@media (hover: hover) and (pointer: fine) { .modal-back { background: rgba(5,3,6,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); } }
.modal-back.in { opacity: 1; }
.modal {
  position: relative; width: min(560px, 100%); max-height: calc(100svh - 32px); overflow: auto; border-radius: 6px; padding: 28px 24px 24px;
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transform: translateY(30px) rotate(1.5deg) scale(.96); transition: transform .32s cubic-bezier(.2,1.2,.3,1);
  background-image: linear-gradient(rgba(0,0,0,.03) 1px, transparent 1px); background-size: 100% 24px;
}
.modal-back.in .modal { transform: none; }
.modal-back.out { opacity: 0; }
/* the close button lies above the dialog's text (a faded kicker paints in its layer and would take its taps), and a tap a little past its circle still counts */
.modal .close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.1); color: var(--ink); width: 36px; height: 36px; backdrop-filter: none; transition: background .2s, border-color .2s, color .2s; }
.modal .close::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
.modal .close svg { width: 18px; height: 18px; transition: transform .12s; }
.modal .kicker { padding-right: 40px; }
.modal .intro .kicker, .modal .verdict .kicker { padding: 0 40px; }
.modal h2 { font-weight: 900; font-size: 32px; margin: 0 0 12px; letter-spacing: -.02em; line-height: 1.05; }
.modal h3 { font-family: var(--type); font-weight: 400; text-transform: uppercase; letter-spacing: .14em; font-size: 13px; margin: 20px 0 8px; }
.modal .small { font-size: 13px; line-height: 1.45; opacity: .8; }
.modal .muted { opacity: .5; }
.rules { padding-left: 20px; margin: 0; display: grid; gap: 10px; line-height: 1.45; }
.rules em { font-style: normal; background: linear-gradient(transparent 60%, color-mix(in srgb, var(--accent) 55%, transparent) 60%); }
.controls { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; font-size: 14px; line-height: 1.4; }
/* icon beside one flowing paragraph: the text is wrapped in .ctl, so its bold words don't become columns of their own */
.controls li { display: flex; gap: 10px; align-items: flex-start; }
.controls .ctl { flex: 1; min-width: 0; padding-top: 5px; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; margin: 0 0 6px; }
.gloss > div { display: flex; gap: 10px; align-items: flex-start; }
.gloss svg { flex: none; width: 66px; height: 66px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.gloss b { display: block; font-family: var(--type); font-size: 12.5px; letter-spacing: .02em; margin-bottom: 2px; }
.gloss p { margin: 0; font-size: 13px; line-height: 1.35; opacity: .85; }
.kbd { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 14px; }
.kbd svg { width: 18px; height: 18px; }

.intro { text-align: center; }
.intro h2 { font-size: 40px; }
.intro-victim { display: inline-flex; align-items: center; gap: 12px; text-align: left; padding: 8px 16px 8px 8px; border: 2px dashed var(--ink); border-radius: 999px; margin-bottom: 14px; }
.intro-victim svg { width: 52px; height: 52px; border-radius: 50%; display: block; }
.intro-victim b { display: block; font-size: 17px; }
.intro-victim span { font-family: var(--type); font-size: 11px; opacity: .7; }
.intro-text { font-size: 17px; line-height: 1.55; margin: 0 0 18px; text-wrap: pretty; }
.intro-suspects { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.intro-suspects span { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; box-shadow: 0 3px 8px rgba(0,0,0,.3); animation: pop .4s calc(var(--i) * .07s + .2s) cubic-bezier(.2,1.4,.4,1) both; }
.intro-suspects svg { width: 100%; height: 100%; display: block; }

.verdict { text-align: center; }
.v-face { width: 120px; height: 120px; margin: 4px auto 10px; border-radius: 50%; border: 5px solid var(--blood); position: relative; animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.v-face svg { width: 100%; height: 100%; border-radius: 50%; display: block; }
.cuffs { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%) rotate(-6deg); background: var(--blood); color: #fff; font-family: var(--type); text-transform: uppercase; letter-spacing: .2em; font-size: 13px; padding: 3px 12px; border-radius: 3px; }
.verdict h2 { margin: 12px 0 2px; }
.v-role { font-family: var(--type); font-size: 13px; opacity: .7; margin: 0 0 14px; }
.verdict blockquote { margin: 0 0 18px; font-size: 16.5px; line-height: 1.55; font-style: italic; padding: 12px 16px; border-left: 4px solid var(--blood); background: rgba(0,0,0,.04); text-align: left; text-wrap: pretty; }
.v-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.v-stats div { background: rgba(0,0,0,.05); border-radius: 10px; padding: 10px 4px; }
.v-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.v-stats span { font-family: var(--type); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.v-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(0,0,0,.15); cursor: pointer; position: relative; }
.set-row span { display: flex; flex-direction: column; }
.set-row small { font-size: 12.5px; opacity: .65; }
.set-row input { position: absolute; opacity: 0; pointer-events: none; }
.sw { width: 46px; height: 26px; border-radius: 999px; background: rgba(0,0,0,.2); position: relative; flex: none; transition: background .2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s cubic-bezier(.2,1.4,.4,1); }
.set-row input:checked + .sw { background: var(--ink); }
.set-row input:checked + .sw::after { transform: translateX(20px); background: var(--accent); }
.set-row input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.set-row.lang-row { cursor: default; flex-direction: column; align-items: stretch; gap: 8px; }
.set-row .langs { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
.langs button { border: 2px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font-family: var(--type); font-size: 13px; padding: 5px 12px; cursor: pointer; }
.langs button.on { background: var(--ink); color: var(--paper); }

/* toast: as wide as its text up to the max (left: 50% alone would hold it to half the screen, and a hint to a tall column);
   a tap puts it away, and on its way out it already lets taps through to what lies beneath */
#toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 80; transform: translate(-50%, 140%);
  width: max-content; max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.4;
  box-shadow: 0 14px 40px rgba(0,0,0,.5), 4px 4px 0 var(--ink); border: 2px solid var(--ink); text-align: center;
  opacity: 0; visibility: hidden; pointer-events: none; transition: transform .35s cubic-bezier(.2,1.3,.3,1), opacity .25s, visibility 0s .35s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; transition: transform .35s cubic-bezier(.2,1.3,.3,1), opacity .25s; }
#toast .link { color: var(--blood); font-weight: 700; }

/* ───────────── PHONE LAYOUT ───────────── */
@media (max-width: 979px) {
  :root { --bar: 62px; --bar-bottom: env(safe-area-inset-bottom, 0px); }
  .game { padding-bottom: calc(var(--bar) + var(--bar-bottom) + 20px); }
  .game-layout { gap: 14px; }
  .toolbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; width: auto; justify-content: center; gap: 8px;
    padding: 8px 10px calc(8px + var(--bar-bottom)); margin: 0;
    background: color-mix(in srgb, var(--bg1) 95%, transparent);
    border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -10px 30px rgba(0,0,0,.4);
  }
  .toolbar .solved-bar { background: transparent; padding: 4px 0; }
  .evidence { width: 100%; gap: 10px; }
  .brief p { font-size: 14.5px; }
  /* phones: a line-up of portraits to scroll through, and the chosen suspect's statements in one box below it */
  .suspects { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 8px 6px 6px; margin: -4px -6px 0; scrollbar-width: none; }
  .suspects::-webkit-scrollbar { display: none; }
  .scard { flex: 0 0 auto; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 5px; scroll-snap-align: center; padding: 4px 2px 0; border-radius: 12px; }
  .scard:focus-visible { outline-offset: 0; }
  .card-top { display: contents; }
  .suspect { padding: 0; }
  .suspect .face { width: 54px; border-radius: 12px; box-shadow: 0 3px 0 rgba(0,0,0,.45); }
  .suspect .face .tick { font-size: 24px; }
  .meta { align-items: center; min-height: 0; width: 100%; padding: 0; color: var(--paper); }
  .sname { font-size: 15px; gap: 3px; max-width: 100%; justify-content: center; line-height: 1.05; }
  .sname .full { display: none; }
  .sname .short { display: inline; overflow: hidden; text-overflow: ellipsis; }
  .letter { font-size: 11px; filter: none; }
  .srole { display: none; }
  .scard .sbox { display: none; }
  .scard.picked { transform: translateY(-3px) scale(1.04); }
  .scard.picked .sname .letter { padding: 0 4px; }
  .scard.placed { opacity: .82; }
  /* a notch under the portrait whose statements are shown below */
  .scard::after { content: ''; width: 0; height: 0; border: 7px solid transparent; border-top: 0; border-bottom-color: var(--paper); margin-top: -1px; opacity: 0; transition: opacity .2s; }
  .scard.viewed::after { opacity: 1; }
  .dossier { display: block; margin-top: -2px; }
  .dossier .sbox { border-left: 6px solid var(--pc); padding: 8px 10px; animation: dossierIn .25s ease; }
  .dossier .dname { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; font-family: var(--hand); font-weight: 600; font-size: 19px; line-height: 1; }
  .dossier .dname .letter { font-size: 13px; background: var(--pc); color: #fff; padding: 1px 5px; border-radius: 5px; filter: none; }
  .dossier .dname .srole { display: inline; font-family: var(--type); font-size: 10px; letter-spacing: .04em; opacity: .65; }
  .sbox ul { gap: 3px; }
  .sbox li { font-size: 12.5px; line-height: 1.3; padding: 3px 5px 3px 13px; background: rgba(0,0,0,.04); }
  .sbox li::before { left: 4px; }
  .oi { width: 17px; height: 17px; margin-right: 2px; }
  .rsw { width: 12px; height: 12px; margin-right: 3px; }
  .pl { min-width: 16px; height: 16px; font-size: 10px; margin-right: 3px; }
  .general .sbox { padding: 8px 10px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-left: 6px solid var(--accent); border-radius: 10px; box-shadow: 3px 3px 0 rgba(0,0,0,.5); }
  #toast { bottom: calc(var(--bar) + var(--bar-bottom) + 12px); }
}

/* Small phones */
@media (max-width: 480px) {
  .topbar { gap: 6px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .topbar .icon-btn svg { width: 20px; height: 20px; }
  .tb-kicker { font-size: 10px; letter-spacing: .08em; }
  .tb-name { font-size: 16px; white-space: normal; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .timer { font-size: 14px; padding: 5px 7px; min-width: 50px; }
  .game-layout { padding: 4px 8px; }
  .sheet { padding: 10px 10px 12px; }
  .sheet-head { margin-left: 22px; margin-bottom: 4px; }
  .loc { font-size: 11px; }
  .compass { width: 26px; height: 26px; }
  .board-wrap { --gutter: 16px; --size: min(calc(100vw - 16px - 20px - var(--gutter)), 600px, max(250px, calc(100svh - 330px))); }
  .tape { width: 70px; height: 20px; }
  .modes, .actions { gap: 3px; padding: 4px; border-radius: 12px; }
  .btn.submit { padding: 8px 10px; font-size: 12px; }
  .tool { height: 38px; min-width: 36px; padding: 0 6px; border-radius: 9px; }
  .tool svg { width: 19px; height: 19px; }
  .modes .tool span, .actions .tool span { display: none; }
  .pick-tip { font-size: 11.5px; top: 6px; }
  .modal-back { padding: 10px; align-items: end; }
  .modal { padding: 24px 16px 20px; max-height: calc(100svh - 20px); border-radius: 14px 14px 8px 8px; }
  .modal h2 { font-size: 27px; }
  .intro h2 { font-size: 31px; }
  .intro-text { font-size: 16px; }
  .verdict blockquote { font-size: 15px; }
  .v-stats { grid-template-columns: repeat(2, 1fr); }
  .v-actions .btn { width: 100%; }
  .intro .kicker { font-size: 10px; padding: 0 36px; }
  .intro h2 { font-size: 24px; margin-bottom: 8px; }
  .intro-victim { gap: 8px; padding: 5px 12px 5px 5px; margin-bottom: 10px; }
  .intro-victim svg { width: 38px; height: 38px; }
  .intro-victim b { font-size: 14.5px; }
  .intro-victim span { font-size: 10px; }
  .intro-text { font-size: 14.5px; line-height: 1.45; margin-bottom: 12px; }
  .intro-suspects { gap: 4px; margin-bottom: 14px; }
  .intro-suspects span { width: 36px; height: 36px; }
  .intro .btn.big { padding: 12px 20px; font-size: 15px; width: 100%; }
  .modal.intro-modal { padding: 18px 14px 16px; }
}

/* Phone in landscape: plan left, suspects right */
@media (max-width: 979px) and (min-width: 600px) and (max-height: 520px) {
  .game-layout { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 14px; }
  .board-wrap { --size: min(calc(100svh - 150px), calc(50vw - 60px)); }
}

/* ── press feedback: `.pressed` is set by the app while a finger or mouse button is down (see bindPressFeedback) ── */
.pace-pill, .stop-lock, .scard, .langs button, .set-row, .link, summary { transition: transform .22s cubic-bezier(.2,1.4,.4,1), background .15s, opacity .15s; }
.icon-btn.pressed { transform: scale(.9); background: rgba(255,255,255,.14); transition-duration: .06s; }
/* the close button keeps its size, and so its tap area: it fills with ink and its cross shrinks */
.modal .close.pressed, .modal .close:active { transform: none; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.modal .close.pressed svg { transform: scale(.8); transition-duration: .06s; }
.btn.pressed { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); transition-duration: .06s; }
.btn.danger.pressed { box-shadow: 1px 1px 0 var(--blood); }
.case-card.pressed { transform: scale(.97); filter: brightness(1.1); transition-duration: .08s; }
.case-card.is-shut.pressed { filter: saturate(.6) brightness(.9); }
.stop-btn.pressed .pin { transform: scale(.93); transition-duration: .08s; }
.stop-btn.pressed .stop-text { opacity: .8; }
.tier.pressed { transform: scale(.96); background: color-mix(in srgb, currentColor 18%, rgba(0,0,0,.35)); transition-duration: .08s; }
.stop-link.pressed { transform: scale(.97); background: rgba(255,255,255,.12); transition-duration: .08s; }
.pace-pill.pressed, .stop-lock.pressed { transform: scale(.95); background: rgba(255,255,255,.12); transition-duration: .08s; }
.tool.pressed { transform: scale(.88); background: rgba(255,255,255,.14); transition-duration: .06s; }
.tool.on.pressed { background: color-mix(in srgb, var(--accent) 80%, #fff); }
.scard.pressed { transform: scale(.96); transition-duration: .08s; }
.langs button.pressed, .set-row.pressed { background: rgba(0,0,0,.07); }
.langs button.on.pressed { background: color-mix(in srgb, var(--ink) 82%, #fff); }
.link.pressed, summary.pressed { opacity: .55; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
