/* WHO'S LYING? — styles
   Layout: a full-screen detective desk on polygraph chart paper. A strip-chart recorder tops every case;
   on wide screens the facts sit left and the suspects right, so a case fits a 16:9 frame without page scrolling. */

@font-face { font-family: "Big Shoulders Display"; font-weight: 700; font-style: normal; font-display: swap; src: url("../assets/fonts/big-shoulders-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 800; font-style: normal; font-display: swap; src: url("../assets/fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 900; font-style: normal; font-display: swap; src: url("../assets/fonts/big-shoulders-display-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url("../assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap; src: url("../assets/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url("../assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }

/* ---------- tokens: "Precinct" (light) ---------- */
:root {
  --paper: #e7eee5;
  --surface: #f7faf5;
  --grid: #d3e2d0;
  --grid-strong: #adc6a9;
  --ink: #142029;
  --pencil: #53636b;
  --needle: #c22438;
  --needle-ink: #ffffff;
  --tag: #ecdcae;
  --tag-ink: #382d12;
  --ok: #1b6844;
  --hint: #8f6200;
  --gold: #b5850f;
  --face: #fbfcf8;
  --scrim: rgba(20, 32, 41, 0.55);

  --display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Impact, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --s-1: 0.875rem;
  --s0: 1rem;
  --s1: 1.2rem;
  --s2: 1.6rem;
  --s3: 2.2rem;
  --r: 12px;
  --gut: max(14px, env(safe-area-inset-left, 0px));
  --gutr: max(14px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
/* "Night Shift" (dark) when the device is dark and no theme is chosen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1612; --surface: #16211b; --grid: #1b2922; --grid-strong: #2c4236;
    --ink: #e2ebe1; --pencil: #95a69b; --needle: #ff5c6c; --needle-ink: #1a0508;
    --tag: #3a3220; --tag-ink: #f2e5bd; --ok: #55c993; --hint: #e5b545; --gold: #e5b545;
    --face: #1e2b24; --scrim: rgba(0, 0, 0, 0.62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1612; --surface: #16211b; --grid: #1b2922; --grid-strong: #2c4236;
  --ink: #e2ebe1; --pencil: #95a69b; --needle: #ff5c6c; --needle-ink: #1a0508;
  --tag: #3a3220; --tag-ink: #f2e5bd; --ok: #55c993; --hint: #e5b545; --gold: #e5b545;
  --face: #1e2b24; --scrim: rgba(0, 0, 0, 0.62);
  color-scheme: dark;
}
/* desk themes chosen in the game (they win over the device setting) */
:root[data-skin="precinct"] {
  --paper: #e7eee5; --surface: #f7faf5; --grid: #d3e2d0; --grid-strong: #adc6a9;
  --ink: #142029; --pencil: #53636b; --needle: #c22438; --needle-ink: #ffffff;
  --tag: #ecdcae; --tag-ink: #382d12; --ok: #1b6844; --hint: #8f6200; --gold: #b5850f;
  --face: #fbfcf8; --scrim: rgba(20, 32, 41, 0.55);
  color-scheme: light;
}
:root[data-skin="night"] {
  --paper: #0e1612; --surface: #16211b; --grid: #1b2922; --grid-strong: #2c4236;
  --ink: #e2ebe1; --pencil: #95a69b; --needle: #ff5c6c; --needle-ink: #1a0508;
  --tag: #3a3220; --tag-ink: #f2e5bd; --ok: #55c993; --hint: #e5b545; --gold: #e5b545;
  --face: #1e2b24; --scrim: rgba(0, 0, 0, 0.62);
  color-scheme: dark;
}
:root[data-skin="sepia"] {
  --paper: #efe2c8; --surface: #f8eedb; --grid: #e3d2b0; --grid-strong: #cdb58a;
  --ink: #3b2a1a; --pencil: #6e5a44; --needle: #a2361f; --needle-ink: #ffffff;
  --tag: #e6cc92; --tag-ink: #3b2a1a; --ok: #3d6b2a; --hint: #8d6100; --gold: #a8740d;
  --face: #fbf5e8; --scrim: rgba(59, 42, 26, 0.55);
  color-scheme: light;
}
:root[data-skin="blueprint"] {
  --paper: #123a63; --surface: #17487a; --grid: #1a4d80; --grid-strong: #2d6aa6;
  --ink: #e8f1ff; --pencil: #a9c3e6; --needle: #ffd23f; --needle-ink: #10243d;
  --tag: #0e2f52; --tag-ink: #e8f1ff; --ok: #7ee0a8; --hint: #ffd23f; --gold: #ffd23f;
  --face: #1b4f84; --scrim: rgba(4, 16, 32, 0.66);
  color-scheme: dark;
}
:root[data-skin="neon"] {
  --paper: #140f24; --surface: #1d1633; --grid: #221a3c; --grid-strong: #3a2d63;
  --ink: #f1e9ff; --pencil: #b4a6d6; --needle: #ff2e88; --needle-ink: #1a0410;
  --tag: #2a1f4a; --tag-ink: #f1e9ff; --ok: #3cf0b0; --hint: #ffcf4a; --gold: #ffcf4a;
  --face: #251c42; --scrim: rgba(6, 3, 14, 0.7);
  color-scheme: dark;
}
:root[data-skin="gold"] {
  --paper: #1b1a17; --surface: #24221d; --grid: #29271f; --grid-strong: #4a4535;
  --ink: #f4ead2; --pencil: #bdb196; --needle: #e0b23c; --needle-ink: #1b1a17;
  --tag: #3a3324; --tag-ink: #f4ead2; --ok: #8fd18a; --hint: #e0b23c; --gold: #e0b23c;
  --face: #2c2a24; --scrim: rgba(0, 0, 0, 0.66);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html.game { font-size: clamp(14px, calc(0.45vw + 0.95vh + 4px), 18px); }
body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--s0);
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  -webkit-font-smoothing: antialiased;
}
html.game, html.game body { height: 100%; overflow: hidden; }
html.game body {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
html.game .share-text, html.game .field { -webkit-user-select: text; user-select: text; }
html.cg .web-only { display: none !important; }
img, svg, canvas { max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--needle); outline-offset: 2px; }
.muted { color: var(--pencil); }
.small { font-size: var(--s-1); }

/* ---------- shared pieces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.9rem; padding: 0.55rem 1.1rem;
  border-radius: var(--r); border: 2px solid var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: 0.02em; line-height: 1;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.danger { background: var(--needle); border-color: var(--needle); color: var(--needle-ink); }
.btn.wide { width: 100%; }
.btn.small { min-height: 2.3rem; padding: 0.3rem 0.8rem; font-size: 1.1rem; }
.btn.big { min-height: 3.4rem; font-size: 1.6rem; }
.btn .ad-ico { width: 1.15rem; height: 1.15rem; flex: none; }
.link-btn {
  background: none; border: 0; padding: 0.3rem 0.1rem; cursor: pointer;
  color: var(--pencil); text-decoration: underline; text-underline-offset: 3px; font-size: var(--s-1);
}
.icon-btn {
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center; flex: none;
  background: transparent; border: 0; border-radius: 50%; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--grid); }
.icon-btn svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; position: relative;
  min-height: 2.4rem; padding: 0.3rem 0.9rem; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 700; font-size: var(--s-1);
}
.chip-btn:hover { background: var(--grid); }
.dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--needle); }
.eyebrow { color: var(--pencil); font-size: var(--s-1); font-weight: 700; letter-spacing: 0.04em; }
.cell-g { background: var(--ok); }
.cell-y { background: var(--hint); }
.cell-r { background: var(--needle); }
.cell-n { background: transparent; }

/* stars: clipped squares so they share one shape everywhere */
.st, .star-ico {
  display: inline-block; width: 1.05rem; height: 1.05rem; flex: none;
  background: var(--grid-strong);
  clip-path: polygon(50% 2%, 62% 36%, 98% 36%, 69% 58%, 80% 94%, 50% 72%, 20% 94%, 31% 58%, 2% 36%, 38% 36%);
}
.st.on, .star-ico.on { background: var(--gold); }
.stars { display: inline-flex; gap: 0.12rem; align-items: center; }

/* reward chips: +20 coins, +45 XP */
.rewards { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rewards:empty { display: none; }
.rw {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 2px solid var(--ink); border-radius: 99px; padding: 0.15rem 0.65rem;
  font-weight: 700; font-size: var(--s-1); background: var(--surface); font-variant-numeric: tabular-nums;
}
.rw.coin { border-color: var(--gold); }
.rw.xp { border-color: var(--ok); }
.rw.mult { border-color: var(--needle); color: var(--needle); }
.rewards.big .rw { font-size: var(--s0); padding: 0.25rem 0.85rem; }
.coin-ico { width: 1.1em; height: 1.1em; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; flex: none; }

/* detective badge */
.badge-svg { display: block; }
.badge-svg .b-outer { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.badge-svg .b-ring { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.badge-svg .b-inner { stroke: var(--ink); stroke-width: 1.2; }
.badge-svg .b-num { font-family: var(--display); font-weight: 900; fill: var(--ink); }
.badge-bronze .b-outer { fill: #c98a4b; } .badge-bronze .b-inner { fill: #e3b07e; }
.badge-silver .b-outer { fill: #a9b4bd; } .badge-silver .b-inner { fill: #d9e0e6; }
.badge-gold .b-outer { fill: #d9a520; } .badge-gold .b-inner { fill: #f2d27a; }
.badge-svg .b-num { fill: #142029; }
.badge-svg .b-outer, .badge-svg .b-ring, .badge-svg .b-inner { stroke: #142029; }

/* ---------- app shell ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.hud { flex: none; background: var(--paper); border-bottom: 2px solid var(--ink); padding-top: env(safe-area-inset-top, 0px); position: relative; z-index: 5; }
.hud-in {
  display: flex; align-items: center; gap: 0.4rem; min-height: 3rem;
  padding: 0.2rem var(--gutr) 0.2rem var(--gut); max-width: 84rem; margin: 0 auto;
}
.brand {
  background: none; border: 0; padding: 0.2rem 0; cursor: pointer; white-space: nowrap; color: var(--ink);
  font-family: var(--display); font-weight: 900; font-size: 1.55rem; line-height: 1; letter-spacing: 0.01em;
}
.brand .q, .boot-title .q { color: var(--needle); }
.hud-back { margin-left: -0.5rem; }
.hud-title { min-width: 0; display: grid; line-height: 1.05; }
.hud-main { font-family: var(--display); font-weight: 900; font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub { color: var(--pencil); font-size: var(--s-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.coins {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  border: 2px solid var(--ink); border-radius: 99px; background: var(--surface); color: var(--ink);
  padding: 0.2rem 0.75rem 0.2rem 0.5rem; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 2.3rem;
}
.coins b { min-width: 2.2ch; text-align: right; }
.stage { flex: 1; min-height: 0; position: relative; }
.scr { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.scr:focus { outline: none; }

/* ---------- headquarters ---------- */
.hq-grid {
  display: grid; gap: 1rem; padding: 1rem var(--gutr) calc(1.2rem + env(safe-area-inset-bottom, 0px)) var(--gut);
  max-width: 84rem; margin: 0 auto;
}
.hq-col { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.player { display: flex; gap: 0.9rem; align-items: center; }
.player-badge { flex: none; width: 3.8rem; }
.player-badge svg { width: 100%; height: auto; }
.player-info { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.player-name { display: flex; align-items: center; gap: 0.45rem; font-family: var(--display); font-weight: 900; font-size: 1.6rem; line-height: 1; }
.player-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-avatar { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; }
.player-title { color: var(--pencil); font-weight: 700; }
.xpbar { height: 0.7rem; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; background: var(--surface); margin-top: 0.2rem; }
.xpbar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.6s ease; }
.xp-text { color: var(--pencil); font-size: var(--s-1); font-variant-numeric: tabular-nums; }

.career-card { position: relative; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.card-trace { display: block; width: 100%; height: 4.2rem; border-bottom: 2px solid var(--ink); }
.career-in { padding: 0.9rem 1rem 1rem; display: grid; gap: 0.65rem; justify-items: start; }
.career-name { margin: -0.4rem 0 0; font-family: var(--display); font-weight: 900; font-size: 2.5rem; line-height: 0.95; text-wrap: balance; }
.nodes { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.3rem; width: 100%; }
.node {
  display: grid; justify-items: center; gap: 0.15rem; padding: 0.3rem 0 0.25rem; border-radius: 4px;
  border: 2px solid var(--grid-strong); background: var(--paper); font-family: var(--display); font-weight: 900; font-size: 1rem; line-height: 1;
}
.node .stars .st { width: 0.5rem; height: 0.5rem; }
.node.done { border-color: var(--ink); }
.node.now { border-color: var(--needle); background: var(--surface); box-shadow: 0 0 0 2px var(--needle); }
.node.is-twist { border-style: dashed; }
.node.locked { color: var(--pencil); }
#btn-play { margin-top: 0.15rem; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.mode-tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: center; text-align: left;
  border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.75rem; cursor: pointer; min-height: 4.6rem;
}
.mode-tile:hover { background: var(--grid); }
.mode-ico { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); }
.mode-ico svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode-txt { display: grid; min-width: 0; line-height: 1.2; }
.mode-txt b { font-family: var(--display); font-weight: 900; font-size: 1.4rem; line-height: 1.05; }
.mode-txt span { color: var(--pencil); font-size: var(--s-1); }
.mode-flag { position: absolute; top: -0.6rem; right: 0.6rem; background: var(--needle); color: var(--needle-ink); font-weight: 700; font-size: 0.75rem; padding: 0.05rem 0.5rem; border-radius: 99px; }

.missions { border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.8rem 0.9rem; display: grid; gap: 0.6rem; }
.missions-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.missions-head h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.45rem; line-height: 1; }
.missions-head .muted { font-size: var(--s-1); font-variant-numeric: tabular-nums; }
.mission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.mission { display: grid; grid-template-columns: 1.3rem 1fr auto; gap: 0.6rem; align-items: center; }
.m-check { width: 1.3rem; height: 1.3rem; border: 2px solid var(--ink); border-radius: 50%; display: grid; place-items: center; }
.mission.done .m-check { background: var(--ok); border-color: var(--ok); }
.mission.done .m-check::after { content: ""; width: 0.35rem; height: 0.6rem; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.m-body { min-width: 0; display: grid; gap: 0.2rem; }
.m-text { font-size: var(--s-1); font-weight: 700; line-height: 1.25; }
.mission.claimed .m-text { color: var(--pencil); text-decoration: line-through; }
.m-bar { height: 0.35rem; border-radius: 99px; background: var(--grid); overflow: hidden; }
.m-bar span { display: block; height: 100%; background: var(--ok); }
.m-side { font-size: var(--s-1); font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 0.25rem; }
.chest { border-top: 2px dashed var(--grid-strong); padding-top: 0.55rem; display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; font-size: var(--s-1); }
.chest b { font-family: var(--display); font-size: 1.15rem; }
.hq-links { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* ---------- case screen ---------- */
.case-scr { display: flex; flex-direction: column; overflow: hidden; }
.case-top {
  flex: none; display: flex; gap: 0.75rem; align-items: center; width: 100%; max-width: 84rem; margin: 0 auto;
  padding: 0.5rem var(--gutr) 0.4rem var(--gut);
}
.recorder { position: relative; flex: 1; min-width: 0; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.trace { display: block; width: 100%; height: 3.1rem; }
.rec-labels {
  position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: 0.2rem 0.45rem; pointer-events: none;
  font-family: var(--display); font-weight: 800; font-size: 1rem; letter-spacing: 0.03em;
}
.rec-labels span { background: var(--surface); padding: 0 0.25rem; border-radius: 3px; }
.rec-time { font-variant-numeric: tabular-nums; }
.rec-time.urgent { color: var(--needle); }
.rec-time.frozen { color: var(--ok); }
.case-meta { flex: none; display: flex; gap: 0.6rem; align-items: center; }
.pips { display: flex; gap: 0.3rem; }
.pips span { width: 1.25rem; height: 1.25rem; border-radius: 4px; border: 2px solid var(--ink); }
.pips span.now { box-shadow: 0 0 0 3px var(--grid-strong); }
.stars-live .st { width: 1.3rem; height: 1.3rem; }
.lives { display: flex; gap: 0.3rem; align-items: center; }
.lives span { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--needle); }
.lives span.on { background: var(--needle); }
.combo {
  display: inline-flex; align-items: center; gap: 0.2rem; font-family: var(--display); font-weight: 900; font-size: 1.35rem;
  color: var(--needle); line-height: 1; white-space: nowrap;
}
.combo svg { width: 1.1rem; height: 1.1rem; fill: var(--needle); }
.replay-tag { font-size: var(--s-1); color: var(--pencil); border: 1px dashed var(--pencil); border-radius: 99px; padding: 0.05rem 0.6rem; white-space: nowrap; }

.case-grid {
  flex: 1; min-height: 0; position: relative; width: 100%; max-width: 84rem; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; align-content: start;
  padding: 0.35rem var(--gutr) 1rem var(--gut); overflow-y: auto; overscroll-behavior: contain;
}
.pane { display: grid; gap: 0.6rem; align-content: start; min-width: 0; }
.case-kicker { color: var(--pencil); font-size: var(--s-1); font-weight: 700; }
.case-title { margin: -0.35rem 0 0; font-family: var(--display); font-weight: 900; font-size: 2.15rem; line-height: 0.95; text-wrap: balance; }
.case-setup { font-size: var(--s1); line-height: 1.35; text-wrap: pretty; }
.sec { margin: 0.2rem 0 -0.15rem; font-family: var(--display); font-weight: 800; font-size: 1.25rem; line-height: 1.1; }
.twist { border: 3px solid var(--needle); border-radius: var(--r); padding: 0.55rem 0.75rem; background: var(--surface); display: grid; gap: 0.1rem; }
.twist strong { font-family: var(--display); font-weight: 900; font-size: 1.55rem; line-height: 1; color: var(--needle); }

.clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.clue {
  position: relative; display: block; width: 100%; text-align: left;
  background: var(--tag); color: var(--tag-ink);
  padding: 0.55rem 0.75rem 0.55rem 1.95rem; border: 0; border-radius: 0 var(--r) var(--r) 0;
  clip-path: polygon(0.95rem 0, 100% 0, 100% 100%, 0.95rem 100%, 0 50%);
  font-size: var(--s0); line-height: 1.38;
}
.clue::before {
  content: ""; position: absolute; left: 0.85rem; top: 50%; width: 0.55rem; height: 0.55rem; margin-top: -0.275rem;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--tag-ink);
}
button.clue { cursor: pointer; font: inherit; }
button.clue:hover { filter: brightness(0.96); }
.clue.is-picked { outline: 3px solid var(--needle); outline-offset: -3px; }
.clue.is-out { opacity: 0.45; text-decoration: line-through; }
.clue.is-wrong { outline: 3px dashed var(--pencil); outline-offset: -3px; opacity: 0.7; }
.clue.has-stamp { padding-right: 6.2rem; }
.clue.hl { outline: 3px solid var(--hint); outline-offset: -3px; }

.task { font-weight: 700; }
.suspects { display: grid; gap: 0.55rem; padding-bottom: 0.4rem; }
.suspect {
  position: relative; display: grid; grid-template-columns: 4.4rem minmax(0, 1fr); gap: 0.8rem; align-items: start;
  width: 100%; text-align: left; padding: 0.6rem; cursor: pointer; font: inherit;
  background: var(--surface); color: var(--ink); border: 2px solid var(--grid-strong); border-radius: var(--r);
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.suspect:hover { border-color: var(--ink); }
.suspect.is-picked { border-color: var(--needle); box-shadow: 0 0 0 2px var(--needle); }
.suspect.is-out { opacity: 0.45; }
.suspect.is-out .says { text-decoration: line-through; }
.suspect.is-wrong { border-style: dashed; opacity: 0.72; }
.suspect.is-answer { border-color: var(--needle); box-shadow: 0 0 0 2px var(--needle); }
.suspect.is-answer.ok-answer { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.suspect:disabled, .clue:disabled { cursor: default; }
.suspect.static { cursor: default; }
.suspect.static:hover { border-color: var(--grid-strong); }
.mug {
  width: 4.4rem; height: 5rem; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden;
  background-color: var(--face);
  background-image: repeating-linear-gradient(to bottom, transparent 0 0.75rem, var(--grid-strong) 0.75rem calc(0.75rem + 1px));
  display: grid; align-items: end;
}
.face { display: block; width: 100%; height: auto; }
.face .skin { fill: var(--face); stroke: var(--ink); stroke-width: 2; }
.face .cloth { fill: var(--grid-strong); }
.face .ln { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.face .ln.thin { stroke-width: 1.4; }
.face .ln.paper { stroke: var(--face); }
.face .hair, .face .ink { fill: var(--ink); }
.face .band { fill: var(--needle); }
.who { display: grid; gap: 0.15rem; min-width: 0; }
.who-top { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.who-name { font-family: var(--display); font-weight: 900; font-size: 1.45rem; line-height: 1; }
.who-role { color: var(--pencil); font-size: var(--s-1); line-height: 1.2; }
.who-key { margin-left: auto; color: var(--pencil); font-size: 0.75rem; border: 1px solid var(--grid-strong); border-radius: 3px; padding: 0 0.3rem; }
.says { display: block; margin-top: 0.15rem; font-size: var(--s0); line-height: 1.38; }
.says::before { content: "\201C"; }
.says::after { content: "\201D"; }
.your-pick { position: absolute; left: 0.6rem; bottom: -0.7rem; background: var(--pencil); color: var(--surface); font-size: 0.72rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 99px; }

.stamp {
  position: absolute; right: 0.6rem; top: 0.6rem; z-index: 2;
  font-family: var(--display); font-weight: 900; font-size: 1.7rem; line-height: 1; letter-spacing: 0.06em;
  color: var(--needle); border: 3px solid var(--needle); border-radius: 4px; padding: 0.2rem 0.45rem 0.1rem;
  transform: rotate(-9deg); background: var(--surface);
  animation: stamp 0.32s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.stamp.ok { color: var(--ok); border-color: var(--ok); }
.stamp.cleared { color: var(--pencil); border-color: var(--pencil); font-size: 1.3rem; }
.clue .stamp { background: var(--tag); font-size: 1.25rem; right: 0.55rem; top: 50%; animation-name: stampc; transform: translateY(-50%) rotate(-6deg); }
@keyframes stamp { from { transform: rotate(-9deg) scale(1.7); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
@keyframes stampc { from { transform: translateY(-50%) rotate(-6deg) scale(1.7); opacity: 0; } to { transform: translateY(-50%) rotate(-6deg) scale(1); opacity: 1; } }

/* action bar under the case */
.actionbar {
  flex: none; border-top: 2px solid var(--ink); background: var(--surface);
  padding: 0.45rem var(--gutr) calc(0.45rem + env(safe-area-inset-bottom, 0px)) var(--gut);
}
.tools, .confirm { max-width: 84rem; margin: 0 auto; display: flex; align-items: center; gap: 0.5rem; min-height: 2.9rem; }
.tool {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem; padding: 0.25rem 0.75rem 0.25rem 0.6rem;
  border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 700; font-size: var(--s-1);
}
.tool:hover { background: var(--grid); }
.tool:disabled { opacity: 0.45; cursor: default; }
.tool svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tool-n { min-width: 1.4rem; height: 1.4rem; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: 0.8rem; display: grid; place-items: center; padding: 0 0.3rem; }
.tool-n.ad { background: var(--needle); color: var(--needle-ink); }
.tool-note { color: var(--pencil); font-size: var(--s-1); margin-left: auto; text-align: right; line-height: 1.25; }
.confirm-q { flex: 1; min-width: 0; font-weight: 700; line-height: 1.25; }
.confirm .btn { min-height: 2.6rem; }
.confirm .btn.danger { min-width: 8.5rem; }

/* verdict: a card that slides over the case */
.verdict {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 78%;
  overflow-y: auto; background: var(--surface); border-top: 3px solid var(--ink);
  padding: 0.9rem var(--gutr) calc(0.9rem + env(safe-area-inset-bottom, 0px)) var(--gut);
  animation: rise 0.2s ease-out both;
}
@keyframes rise { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
.verdict-card { display: grid; gap: 0.6rem; max-width: 40rem; margin: 0 auto; }
.verdict-head { font-family: var(--display); font-weight: 900; font-size: 2.4rem; line-height: 0.95; }
.verdict-head.good { color: var(--ok); }
.verdict-head.bad { color: var(--needle); }
.verdict-stars { display: flex; gap: 0.35rem; }
.verdict-stars .st { width: 2.3rem; height: 2.3rem; }
.verdict-stars .st.on { animation: starpop 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both; }
.verdict-stars .st:nth-child(2) { animation-delay: 0.18s; }
.verdict-stars .st:nth-child(3) { animation-delay: 0.36s; }
@keyframes starpop { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.verdict-banner { background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 900; font-size: 1.3rem; padding: 0.3rem 0.7rem; border-radius: var(--r); justify-self: start; }
.why { line-height: 1.45; }
.twist-reveal { font-style: italic; color: var(--pencil); }
.verdict-actions { display: flex; gap: 0.5rem; position: sticky; bottom: 0; background: var(--surface); padding-top: 0.35rem; box-shadow: 0 -10px 12px -8px var(--surface); }
.verdict-actions .btn.ghost { flex: none; }

/* ---------- results ---------- */
.results-in {
  display: grid; gap: 1.2rem; padding: 1.2rem var(--gutr) calc(1.5rem + env(safe-area-inset-bottom, 0px)) var(--gut);
  max-width: 64rem; margin: 0 auto;
}
.res-main, .res-side { display: grid; gap: 0.9rem; align-content: start; min-width: 0; }
.res-title { margin: -0.4rem 0 0; font-family: var(--display); font-weight: 900; font-size: 3.4rem; line-height: 0.9; text-wrap: balance; }
#res-body { display: grid; gap: 0.7rem; justify-items: start; }
.res-grid { display: flex; gap: 0.45rem; }
.res-grid span { width: 2.8rem; height: 2.8rem; border-radius: 6px; border: 2px solid var(--ink); }
.res-big { font-family: var(--display); font-weight: 900; font-size: 6rem; line-height: 0.85; }
.res-line { font-size: var(--s1); }
.res-line strong { font-variant-numeric: tabular-nums; }
.share-box { display: grid; gap: 0.55rem; }
.share-alt { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.share-alt a, .share-alt button {
  flex: 1 1 0; min-width: 5.5rem; min-height: 2.6rem; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface);
  font-weight: 700; text-decoration: none; cursor: pointer; font-size: var(--s-1);
}
.share-text { width: 100%; min-height: 6.5rem; font: inherit; font-size: var(--s-1); padding: 0.6rem; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0; }
.stat-row div { display: grid; gap: 0.1rem; text-align: center; padding: 0.55rem 0.2rem; border-top: 2px solid var(--ink); }
.stat-row dt { order: 2; color: var(--pencil); font-size: 0.8rem; line-height: 1.2; }
.stat-row dd { order: 1; margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.res-progress { display: grid; gap: 0.5rem; }
.res-progress:empty { display: none; }
.rp-level { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); }
.rp-level .badge-svg { flex: none; }
.rp-body { display: grid; gap: 0.3rem; flex: 1; min-width: 0; }
.rp-top { display: flex; gap: 0.35rem; align-items: baseline; flex-wrap: wrap; }
.rp-top .muted { margin-left: auto; font-size: var(--s-1); font-variant-numeric: tabular-nums; }
.rp-mission {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.8rem;
  border: 2px dashed var(--grid-strong, var(--pencil)); border-radius: var(--r); font-size: var(--s-1); text-align: left; background: none; color: var(--ink);
}
.rp-mission.ready { border: 2px solid var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); font-weight: 700; cursor: pointer; justify-content: flex-start; font: inherit; font-size: var(--s-1); font-weight: 700; }
.rp-mission .coin-ico { width: 1.1rem; height: 1.1rem; flex: none; }
.new-best { display: inline-block; background: var(--needle); color: var(--needle-ink); font-weight: 700; font-size: var(--s-1); padding: 0.15rem 0.6rem; border-radius: 99px; }
.countdown-line { color: var(--pencil); font-variant-numeric: tabular-nums; }
.countdown-line strong { color: var(--ink); }
.review { border-top: 2px solid var(--ink); padding-top: 0.5rem; }
.review summary { cursor: pointer; font-family: var(--display); font-weight: 800; font-size: 1.25rem; padding: 0.2rem 0; }
.review-item { display: grid; gap: 0.2rem; padding: 0.7rem 0; border-bottom: 1px solid var(--grid-strong); }
.review-item h4 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.2rem; display: flex; gap: 0.45rem; align-items: center; }
.review-item h4 span { width: 1rem; height: 1rem; border-radius: 3px; border: 2px solid var(--ink); flex: none; }
.review-item .ans { font-weight: 700; }
.rank-card { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r); padding: 0.8rem 0.9rem; display: grid; gap: 0.45rem; }
.rank-head { font-size: var(--s1); line-height: 1.35; }
.rank-sub { color: var(--pencil); font-size: var(--s-1); }
.ad-slot { min-height: 0; }
/* side ads: tall ads left and right, game in the middle. ads.js adds html.rails on wide screens. */
.ad-rail { position: fixed; top: 0; bottom: 0; width: var(--rail); display: grid; place-items: center; z-index: 1; }
.ad-rail.left { left: 12px; } .ad-rail.right { right: 12px; }
html.rails .app { padding-inline: calc(var(--rail) + 24px); }
html.rails .verdict { left: calc(var(--rail) + 24px); right: calc(var(--rail) + 24px); }
.ad-demo-rail { width: 100%; height: 100%; display: grid; place-items: center; border: 2px dashed var(--pencil); border-radius: var(--r); color: var(--pencil); font-size: var(--s-1); text-align: center; }
@media (max-width: 1099px), (max-height: 659px) {
  .ad-rail { display: none !important; }
  html.rails .app { padding-inline: 0; }
  html.rails .verdict { left: 0; right: 0; }
}
.ad-demo-banner { border: 2px dashed var(--pencil); border-radius: var(--r); padding: 1.6rem 0.8rem; text-align: center; color: var(--pencil); font-size: var(--s-1); }

/* ---------- list screens: map, shop, achievements ---------- */
.list-in { padding: 1rem var(--gutr) calc(1.5rem + env(safe-area-inset-bottom, 0px)) var(--gut); max-width: 64rem; margin: 0 auto; display: grid; gap: 0.8rem; align-content: start; }
.page-h { margin: 0; font-family: var(--display); font-weight: 900; font-size: 2.6rem; line-height: 0.95; }
.chapters { display: grid; gap: 0.8rem; }
.chapter { border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.75rem 0.85rem; display: grid; gap: 0.55rem; }
.chapter.locked { border-style: dashed; border-color: var(--grid-strong); background: transparent; color: var(--pencil); }
.chapter-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.chapter-head h3 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.5rem; line-height: 1; }
.chapter-head .muted { margin-left: auto; font-size: var(--s-1); display: inline-flex; align-items: center; gap: 0.3rem; }
.chapter .nodes .node { cursor: pointer; }
.chapter .nodes .node:disabled { cursor: default; }
button.node { font: inherit; font-family: var(--display); font-weight: 900; color: inherit; }
button.node:not(:disabled):hover { background: var(--grid); }

.free-coins { display: flex; align-items: center; gap: 0.8rem; justify-content: space-between; border: 2px dashed var(--gold); border-radius: var(--r); padding: 0.6rem 0.8rem; background: var(--surface); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.6rem; }
.shop-card { border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.7rem; display: grid; gap: 0.35rem; align-content: start; }
.shop-card h4 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.3rem; line-height: 1.05; }
.shop-card p { color: var(--pencil); font-size: var(--s-1); }
.shop-card .own { font-size: var(--s-1); font-weight: 700; }
.shop-card .btn { margin-top: 0.2rem; }
.shop-card.current { box-shadow: 0 0 0 3px var(--needle); }
.swatch { display: flex; gap: 0.3rem; }
.swatch span { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--ink); }

.ach-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.55rem; }
.ach { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.65rem; align-items: center; border: 2px solid var(--grid-strong); border-radius: var(--r); background: var(--surface); padding: 0.55rem 0.7rem; }
.ach.done { border-color: var(--ink); }
.ach-ico { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--grid); }
.ach.done .ach-ico { background: var(--gold); }
.ach-ico .st { width: 1.3rem; height: 1.3rem; background: var(--pencil); }
.ach.done .ach-ico .st { background: var(--surface); }
.ach h4 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.2rem; line-height: 1.05; }
.ach p { font-size: var(--s-1); color: var(--pencil); line-height: 1.25; }
.ach .m-bar { margin-top: 0.25rem; }

/* ---------- dialogs ---------- */
dialog {
  width: min(31rem, calc(100% - 28px)); max-height: calc(100% - 28px);
  border: 2px solid var(--ink); border-radius: var(--r); padding: 0;
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: var(--scrim); }
.dlg { padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: 0.75rem; }
.dlg.center { text-align: center; justify-items: center; }
.dlg h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 2.1rem; line-height: 0.95; }
.dlg h3 { margin: 0.2rem 0 0; font-family: var(--display); font-weight: 800; font-size: 1.25rem; }
.dlg-close { justify-self: end; margin: -0.5rem -0.6rem -1.4rem 0; }
.dlg-row { display: grid; gap: 0.55rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.legend { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; gap: 0.2rem; align-items: center; }
.legend li .star-ico:last-of-type { margin-right: 0.5rem; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 700; padding: 0.35rem 0; border-bottom: 1px solid var(--grid-strong); cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 3rem; height: 1.7rem; border-radius: 99px; border: 2px solid var(--ink); background: var(--grid); position: relative; cursor: pointer; order: 2; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 0.12rem; left: 0.15rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--ink); transition: transform 0.15s ease; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(1.25rem); background: var(--surface); }
.switch input:disabled { opacity: 0.5; }
.danger-zone { display: grid; gap: 0.5rem; padding-top: 0.3rem; }
.reset-confirm { display: grid; gap: 0.5rem; border: 2px dashed var(--needle); border-radius: var(--r); padding: 0.6rem; }
.dist { display: grid; gap: 0.35rem; }
.dist-row { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.45rem; align-items: center; font-variant-numeric: tabular-nums; }
.dist-row b { font-family: var(--display); font-size: 1.1rem; }
.dist-bar { height: 1.45rem; background: var(--grid-strong); color: var(--ink); border-radius: 3px; display: flex; align-items: center; justify-content: flex-end; padding: 0 0.45rem; font-size: var(--s-1); font-weight: 700; min-width: 1.8rem; }
.dist-bar.today { background: var(--ink); color: var(--paper); }
.calendar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; width: 100%; }
.calendar li { border: 2px solid var(--grid-strong); border-radius: var(--r); padding: 0.35rem 0.1rem; display: grid; gap: 0.15rem; justify-items: center; font-size: 0.72rem; line-height: 1.1; }
.calendar li b { font-family: var(--display); font-size: 1rem; }
.calendar .coin-ico { width: 0.85rem; height: 0.85rem; vertical-align: -0.12rem; }
.calendar li.past { background: var(--grid); color: var(--pencil); }
.calendar li.today { border-color: var(--needle); box-shadow: 0 0 0 2px var(--needle); background: var(--surface); }
.rank-badge { width: 7rem; }
.rank-badge svg { width: 100%; height: auto; animation: badgein 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes badgein { from { transform: scale(0.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.reward-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; text-align: left; justify-self: stretch; }
.reward-list li { background: var(--paper); border-radius: var(--r); padding: 0.45rem 0.7rem; }
.reward-badge { font-size: 4.2rem; line-height: 1; }

/* ---------- tutorial coach ---------- */
.coach { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.coach-ring {
  position: fixed; border-radius: 10px; border: 3px solid var(--needle);
  box-shadow: 0 0 0 9999px rgba(10, 16, 20, 0.45); transition: all 0.3s ease; pointer-events: none;
  animation: ringpulse 1.6s ease-in-out infinite;
}
@keyframes ringpulse { 50% { border-color: var(--hint); } }
.coach-bubble {
  position: fixed; pointer-events: auto; width: min(22rem, calc(100% - 28px));
  background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 0.8rem 0.9rem; display: grid; gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: top 0.3s ease, left 0.3s ease;
}
.coach-bubble p { font-weight: 700; line-height: 1.35; }
.coach-row { display: flex; align-items: center; gap: 0.8rem; }
.coach-bubble .btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.coach-bubble .link-btn { color: var(--paper); opacity: 0.85; }
.coach.passthrough .coach-ring { box-shadow: 0 0 0 9999px rgba(10, 16, 20, 0.25); }

/* ---------- toasts, effects, boot ---------- */
.toasts {
  position: fixed; left: 50%; top: calc(3.4rem + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  z-index: 70; display: grid; gap: 0.4rem; justify-items: center; width: min(30rem, calc(100% - 28px)); pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--paper); padding: 0.55rem 0.9rem; border-radius: var(--r); font-weight: 700;
  display: flex; align-items: center; gap: 0.5rem; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  animation: toastin 0.25s ease-out both;
}
.toast.gold { background: var(--gold); color: #1b1a17; }
.toast.out { animation: toastout 0.3s ease-in both; }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateY(-10px); opacity: 0; } }
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
.fx-float {
  position: fixed; z-index: 85; pointer-events: none; transform: translate(-50%, -50%);
  font-family: var(--display); font-weight: 900; font-size: 1.6rem; color: var(--ok); white-space: nowrap;
  text-shadow: 0 0 3px var(--surface), 0 0 6px var(--surface);
  animation: floatup 1.25s ease-out forwards;
}
.fx-float.coin { color: var(--gold); }
.fx-float.bad { color: var(--needle); }
.fx-float.combo { color: var(--needle); font-size: 2rem; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.fx-shake { animation: shake 0.42s ease both; }
@keyframes shake { 15% { transform: translateX(-7px); } 35% { transform: translateX(6px); } 55% { transform: translateX(-4px); } 75% { transform: translateX(3px); } }
.fx-pop { animation: pop 0.35s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes pop { 40% { transform: scale(1.18); } }
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 1rem;
  background: var(--paper); transition: opacity 0.35s ease;
}
.boot-title { font-family: var(--display); font-weight: 900; font-size: 3.2rem; line-height: 1; }
.boot-bar { width: 12rem; height: 0.5rem; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; background: var(--needle); animation: bootbar 1s ease-in-out infinite alternate; }
@keyframes bootbar { to { transform: translateX(150%); } }
body:not(.booting) .boot { opacity: 0; pointer-events: none; }

/* ad placeholder (web demo) */
.ad-demo { position: fixed; inset: 0; z-index: 95; background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.ad-demo-box { width: min(26rem, 100%); background: var(--surface); border: 2px dashed var(--pencil); border-radius: var(--r); padding: 1.4rem; display: grid; gap: 0.6rem; text-align: center; }
.ad-demo-kind { font-family: var(--display); font-weight: 900; font-size: var(--s2); }
.ad-demo-name, .ad-demo-note { color: var(--pencil); font-size: var(--s-1); }
.ad-demo-row { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 0.3rem; }

/* ---------- web leaderboard ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.tab { background: var(--surface); border: 0; padding: 0.5rem 0.2rem; cursor: pointer; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.tab + .tab { border-left: 2px solid var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.board-note { color: var(--pencil); font-size: var(--s-1); }
.demo-note { border: 2px dashed var(--needle); border-radius: var(--r); padding: 0.45rem 0.6rem; font-size: var(--s-1); }
.board { list-style: none; margin: 0; padding: 0; display: grid; max-height: min(42vh, 420px); overflow-y: auto; border-top: 2px solid var(--ink); }
.board-row { display: grid; grid-template-columns: 2.4rem 1fr auto auto; gap: 0.6rem; align-items: center; padding: 0.45rem 0.2rem; border-bottom: 1px solid var(--grid-strong); font-variant-numeric: tabular-nums; }
.board-row.me { background: var(--tag); color: var(--tag-ink); }
.b-rank { font-family: var(--display); font-weight: 900; font-size: 1.2rem; text-align: center; }
.board-row:nth-child(-n+3) .b-rank { color: var(--needle); }
.board-row.me .b-rank { color: inherit; }
.b-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.b-name em { font-style: normal; font-weight: 400; font-size: var(--s-1); }
.b-badge { margin-right: 0.25rem; }
.b-score { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.b-time { color: var(--pencil); font-size: var(--s-1); min-width: 3.2em; text-align: right; }
.board-row.me .b-time { color: inherit; }
.board-empty { padding: 1rem 0.2rem; color: var(--pencil); }
.board-me { display: grid; gap: 0.45rem; }
.field-label { font-weight: 700; }
.field { width: 100%; min-height: 2.9rem; padding: 0.5rem 0.7rem; font: inherit; font-size: var(--s1); border: 2px solid var(--ink); border-radius: var(--r); background: var(--paper); color: var(--ink); }
.field-error { color: var(--needle); font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.badge-chip { border: 2px solid var(--ink); border-radius: 99px; padding: 0.1rem 0.6rem; font-size: var(--s-1); font-weight: 700; }

/* ---------- polish: tactile buttons, lifted cards ---------- */
.btn { border-radius: 10px; box-shadow: 0 3px 0 var(--lip, var(--ink)); transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease; }
.btn.primary { --lip: color-mix(in srgb, var(--ink) 55%, #000); }
.btn.danger { --lip: color-mix(in srgb, var(--needle) 55%, #000); }
.btn.small { box-shadow: 0 2px 0 var(--lip, var(--ink)); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--lip, var(--ink)); }
.btn:disabled { box-shadow: none; }
.career-card, .missions, .shop-card, .rank-card, .rp-level, .chapter:not(.locked) { box-shadow: 0 3px 0 var(--ink); }
.mode-tile, .league-card { box-shadow: 0 3px 0 var(--ink); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.mode-tile:hover, .league-card:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); background: var(--surface); }
.mode-tile:active, .league-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip-btn { box-shadow: 0 2px 0 var(--ink); }
.chip-btn:active { transform: translateY(2px); box-shadow: none; }
.chip-btn.on { background: var(--ink); color: var(--paper); }
dialog { border-radius: 16px; box-shadow: 0 5px 0 var(--ink), 0 24px 60px rgba(0, 0, 0, 0.35); }
dialog[open] { animation: dlgin 0.24s cubic-bezier(0.2, 1.25, 0.4, 1) both; }
@keyframes dlgin { from { transform: translateY(16px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.scr.hq:not([hidden]) .hq-col > * { animation: cardin 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.hq-col > *:nth-child(2) { animation-delay: 0.04s; }
.hq-col > *:nth-child(3) { animation-delay: 0.08s; }
.hq-col > *:nth-child(4) { animation-delay: 0.12s; }
.hq-col > *:nth-child(5) { animation-delay: 0.16s; }
.hq-col > *:nth-child(6) { animation-delay: 0.2s; }
@keyframes cardin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- HQ: streak chip ---------- */
.player { position: relative; }
.streak-chip {
  flex: none; align-self: center; display: inline-flex; align-items: center; gap: 0.25rem; cursor: pointer;
  border: 2px solid var(--grid-strong); border-radius: 99px; background: var(--surface); color: var(--pencil);
  padding: 0.3rem 0.7rem 0.3rem 0.5rem; font-family: var(--display); font-weight: 900; font-size: 1.45rem; line-height: 1;
  box-shadow: 0 2px 0 var(--grid-strong); font-variant-numeric: tabular-nums;
}
.streak-chip .flame { width: 1.25rem; height: 1.25rem; fill: var(--grid-strong); }
.streak-chip.lit { color: var(--needle); border-color: var(--needle); box-shadow: 0 2px 0 var(--needle); }
.streak-chip.lit .flame { fill: var(--needle); animation: flicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08, 0.95) rotate(-3deg); } 60% { transform: scale(0.96, 1.06) rotate(2deg); } }
.shield-pips { display: inline-flex; gap: 2px; margin-left: 0.2rem; }
.shield-pips:empty { display: none; }
.shield-pips .sp { width: 0.68rem; height: 0.8rem; background: var(--ok); clip-path: polygon(50% 0, 100% 16%, 92% 62%, 50% 100%, 8% 62%, 0 16%); }

/* ---------- HQ: banner ---------- */
.hq-banner {
  display: flex; align-items: center; gap: 0.65rem; border: 2px solid var(--ink); border-radius: var(--r);
  background: var(--tag); color: var(--tag-ink); padding: 0.55rem 0.4rem 0.55rem 0.8rem; box-shadow: 0 3px 0 var(--ink);
}
.hb-ico { font-size: 1.6rem; line-height: 1; }
.hb-txt { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.hb-txt b { font-family: var(--display); font-weight: 900; font-size: 1.2rem; }
.hb-txt span { font-size: var(--s-1); }
.hq-banner .icon-btn { width: 2.2rem; height: 2.2rem; color: inherit; }

/* ---------- HQ: today's Daily (hero) ---------- */
.today-card { position: relative; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); overflow: hidden; box-shadow: 0 4px 0 var(--ink); }
.today-card .card-trace { height: 4.4rem; }
.today-in { padding: 0.85rem 1rem 1rem; display: grid; gap: 0.55rem; }
.today-title { margin: -0.35rem 0 0; font-family: var(--display); font-weight: 900; font-size: 2.7rem; line-height: 0.95; text-wrap: balance; }
.today-sub { color: var(--pencil); }
.today-sub strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.today-meta { font-weight: 700; font-size: var(--s-1); background: var(--tag); color: var(--tag-ink); border-radius: 8px; padding: 0.4rem 0.65rem; line-height: 1.4; }
.res-grid.small { gap: 0.3rem; }
.res-grid.small span { width: 1.55rem; height: 1.55rem; border-radius: 5px; }

/* ---------- HQ: Case of the Week ---------- */
.week-card {
  border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.8rem 0.95rem 0.95rem;
  display: grid; gap: 0.55rem; box-shadow: 0 3px 0 var(--ink);
  background-image: linear-gradient(90deg, var(--tag) 0 0.45rem, transparent 0.45rem);
  padding-left: 1.25rem;
}
.week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.week-title { margin: -0.3rem 0 0; font-family: var(--display); font-weight: 900; font-size: 1.85rem; line-height: 1; text-wrap: balance; }
.week-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.week-slots li {
  display: grid; justify-items: center; gap: 0.12rem; padding: 0.35rem 0 0.28rem; border-radius: 9px;
  border: 2px solid var(--grid-strong); background: var(--paper); color: var(--pencil);
}
.week-slots li span { font-family: var(--display); font-weight: 900; font-size: 1.15rem; line-height: 1; height: 1.15rem; }
.week-slots li b { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.week-slots .got { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.week-slots .miss { border-style: dashed; color: var(--needle); }
.week-slots .now { border-color: var(--needle); color: var(--ink); box-shadow: 0 0 0 2px var(--needle); }
.week-slots .star { border-color: var(--gold); color: var(--gold); }
.week-slots .star.now { background: var(--gold); color: #1b1a17; box-shadow: 0 0 0 2px var(--gold); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 35%, transparent); } }
.week-sub { font-size: var(--s-1); line-height: 1.4; }

/* ---------- HQ: mode tiles ---------- */
.mode-tile.night .mode-ico { background: #3d3f9e; color: #fff; }
.mode-tile.rush .mode-ico { background: var(--gold); color: #1b1a17; }
.mode-tile.night.is-open { border-color: #6b6fe0; box-shadow: 0 3px 0 #6b6fe0; }
.mode-tile.night .mode-flag { background: #3d3f9e; color: #fff; }

/* ---------- HQ: weekly league ---------- */
.league-card {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.7rem 0.8rem;
}
.league-emblem {
  width: 3rem; height: 3rem; flex: none; display: grid; place-items: center; font-size: 1.5rem;
  border-radius: 50%; border: 2px solid var(--ink); background: var(--tier, var(--grid));
}
.league-emblem.t0 { --tier: #e9b98a; } .league-emblem.t1 { --tier: #dfe5ea; } .league-emblem.t2 { --tier: #f4d67f; }
.league-emblem.t3 { --tier: #a9e7eb; } .league-emblem.t4 { --tier: #bdd2ff; }
.league-txt { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.league-txt b { font-family: var(--display); font-weight: 900; font-size: 1.45rem; line-height: 1.05; }
.chev { width: 1.3rem; height: 1.3rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; color: var(--pencil); }

/* ---------- results: challenge + what's next ---------- */
.versus { border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.85rem; display: grid; gap: 0.7rem; box-shadow: 0 3px 0 var(--ink); }
.versus.won { border-color: var(--ok); box-shadow: 0 3px 0 var(--ok); }
.vs-head { font-family: var(--display); font-weight: 900; font-size: 1.75rem; line-height: 1; }
.versus.won .vs-head { color: var(--ok); }
.vs-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.5rem; align-items: center; width: 100%; }
.vs-side {
  display: grid; gap: 0.3rem; justify-items: center; text-align: center; padding: 0.55rem 0.3rem; border-radius: 10px;
  background: var(--paper); font-variant-numeric: tabular-nums; font-size: var(--s-1); font-weight: 700; min-width: 0;
}
.vs-side b { font-family: var(--display); font-size: 1.25rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-side.win { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); box-shadow: inset 0 0 0 2px var(--ok); }
.vs-x { font-family: var(--display); font-weight: 900; font-size: 1.35rem; color: var(--needle); }
.vs-side .res-grid, .file .res-grid { gap: 0.2rem; }
.vs-side .res-grid span, .file .res-grid span { width: 1.05rem; height: 1.05rem; border-width: 1.5px; border-radius: 3px; }
.res-extra { display: grid; gap: 0.5rem; }
.res-extra:empty { display: none; }
.next-card { display: flex; align-items: center; gap: 0.7rem; border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.6rem 0.7rem; box-shadow: 0 2px 0 var(--ink); }
.nc-ico { font-size: 1.45rem; width: 2.1rem; text-align: center; flex: none; font-family: var(--display); font-weight: 900; color: var(--gold); line-height: 1; }
.nc-txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; font-size: var(--s-1); }
.nc-txt b { font-family: var(--display); font-size: 1.15rem; font-weight: 800; line-height: 1.1; }

/* ---------- case files ---------- */
.files-keys { display: flex; gap: 0.65rem; align-items: center; background: var(--tag); color: var(--tag-ink); border-radius: var(--r); padding: 0.65rem 0.85rem; font-size: var(--s-1); line-height: 1.4; }
.key-ico { font-size: 1.5rem; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.file {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head acts" "status acts"; gap: 0.25rem 0.7rem; align-items: center;
  border: 2px solid var(--grid-strong); border-radius: var(--r); background: var(--surface); padding: 0.6rem 0.75rem;
}
.file.played, .file.open { border-color: var(--ink); }
.file.today { border-color: var(--needle); box-shadow: 0 3px 0 var(--needle); }
.file.missed { border-style: dashed; background: transparent; }
.file-head { grid-area: head; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.file-head b { font-family: var(--display); font-weight: 900; font-size: 1.3rem; line-height: 1; }
.file-status { grid-area: status; display: flex; gap: 0.5rem; align-items: center; font-size: var(--s-1); font-weight: 700; }
.file-acts { grid-area: acts; display: grid; gap: 0.15rem; justify-items: center; }

/* ---------- Case of the Week board ---------- */
.wk-setup { font-size: var(--s1); line-height: 1.35; }
.wk-status { border: 2px solid var(--ink); border-radius: var(--r); background: var(--surface); padding: 0.75rem 0.85rem; display: grid; gap: 0.55rem; box-shadow: 0 3px 0 var(--ink); }
.wk-verdict { display: grid; gap: 0.35rem; }
.wk-verdict b { font-family: var(--display); font-weight: 900; font-size: 1.8rem; line-height: 1; }
.wk-verdict.good b { color: var(--ok); }
.wk-verdict.bad b { color: var(--needle); }
.wk-clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.wk-clue { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; padding: 0.55rem 0.75rem; border-radius: 10px; line-height: 1.35; }
.wk-clue.open { background: var(--tag); color: var(--tag-ink); }
.wk-clue.locked { border: 2px dashed var(--grid-strong); color: var(--pencil); }
.wk-day { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 0.95rem; letter-spacing: 0.05em; min-width: 2.4rem; }
.wk-clue.open span:last-child { flex: 1; min-width: 12rem; }
.wk-why { flex: 1; min-width: 10rem; font-size: var(--s-1); }
.wk-acts { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.wk-suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 0.55rem; }
.wk-sus {
  position: relative; display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: 0.65rem; align-items: start; text-align: left;
  padding: 0.55rem; border: 2px solid var(--grid-strong); border-radius: var(--r); background: var(--surface); color: var(--ink);
  cursor: pointer; font: inherit; transition: opacity 0.15s ease, border-color 0.12s ease, transform 0.12s ease;
}
.wk-sus:hover:not(:disabled) { border-color: var(--ink); }
.wk-sus .mug { width: 3.6rem; height: 4.1rem; }
.wk-who { display: grid; gap: 0.1rem; min-width: 0; }
.wk-who b { font-family: var(--display); font-weight: 900; font-size: 1.3rem; line-height: 1; }
.wk-traits { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }
.wk-traits span { font-size: 0.75rem; font-weight: 700; border: 1.5px solid var(--grid-strong); border-radius: 99px; padding: 0 0.45rem; background: var(--paper); }
.wk-sus.crossed { opacity: 0.42; }
.wk-sus.crossed::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; background: var(--needle); transform: rotate(-7deg); border-radius: 2px; }
.wk-sus.culprit { border-color: var(--needle); box-shadow: 0 0 0 2px var(--needle); opacity: 1; }
.wk-sus.culprit::after { display: none; }
.wk-sus.wrong { border-style: dashed; }
.wk-sus:disabled { cursor: default; }
.accusing .wk-sus { border-color: var(--needle); }
.accusing .wk-sus:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--needle); }

/* ---------- progress backup ---------- */
.cloud-box { border: 2px dashed var(--grid-strong); border-radius: var(--r); padding: 0.7rem 0.8rem; display: grid; gap: 0.5rem; }
.cloud-h { font-family: var(--display); font-weight: 900; font-size: 1.2rem; }
.save-code { font-family: var(--display); font-weight: 900; letter-spacing: 0.08em; white-space: nowrap; }
.save-code.big { font-size: 1.9rem; background: var(--paper); border: 2px dashed var(--ink); border-radius: 10px; padding: 0.35rem 0.8rem; -webkit-user-select: all; user-select: all; }
.boot-note { color: var(--pencil); font-weight: 700; text-align: center; padding: 0 16px; }

/* ---------- notices, groups, board extras ---------- */
.notice-icon { font-size: 3.4rem; line-height: 1; font-family: var(--display); font-weight: 900; color: var(--gold); animation: badgein 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.notice-icon:empty { display: none; }
.notice-body { display: grid; gap: 0.5rem; justify-items: center; width: 100%; }
.notice-body:empty { display: none; }
.notice-body .reward-list { justify-self: stretch; }
.reward-list .coin-ico { vertical-align: -0.15rem; }
.shield-line { background: var(--paper); border-radius: 10px; padding: 0.6rem 0.8rem; text-align: left; line-height: 1.4; justify-self: stretch; }
.field-row { display: flex; gap: 0.5rem; }
.field-row .field { flex: 1; min-width: 0; }
.field.code { text-transform: uppercase; letter-spacing: 0.18em; font-family: var(--display); font-weight: 800; }
#dlg-board { width: min(34rem, calc(100% - 28px)); }
.seg { display: inline-flex; justify-self: start; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0.25rem 0.9rem; font-weight: 700; font-size: var(--s-1); cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.board-head { display: flex; align-items: center; gap: 0.7rem; }
.board-head > span:last-child { display: grid; line-height: 1.15; }
.board-head b { font-family: var(--display); font-weight: 900; font-size: 1.35rem; }
.board-head .league-emblem { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
.grp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.board-row.up { box-shadow: inset 4px 0 0 var(--ok); }
.board-row.down { box-shadow: inset 4px 0 0 var(--needle); }
.board-row.waiting { color: var(--pencil); }

/* ---------- wide screens: 16:9 desktop frames ---------- */
@media (min-width: 700px) and (min-aspect-ratio: 6/5) {
  .hq-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; padding-top: 1.1rem; }
  .case-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); grid-template-areas: "facts suspects";
    gap: 1.4rem; overflow: hidden; padding-bottom: 0.5rem;
  }
  .pane { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-right: 0.2rem; padding-bottom: 0.6rem; }
  .pane-facts { grid-area: facts; }
  .pane-suspects { grid-area: suspects; }
  .verdict {
    position: relative; left: auto; right: auto; bottom: auto; grid-area: facts; z-index: 3; align-self: start;
    max-height: 100%; border: 3px solid var(--ink); border-radius: var(--r);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); padding: 1rem 1.1rem 1.1rem;
    animation: slidein 0.22s ease-out both;
  }
  .verdict.over-suspects { grid-area: suspects; }
  @keyframes slidein { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .results-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; padding-top: 1.6rem; }
  .res-title { font-size: 4.2rem; }
}
/* short wide frames (e.g. 960x540, 800x450): tighten everything */
@media (min-width: 700px) and (min-aspect-ratio: 6/5) and (max-height: 620px) {
  .case-top { padding-top: 0.35rem; padding-bottom: 0.25rem; }
  .trace { height: 2.7rem; }
  .case-title { font-size: 1.9rem; }
  .case-setup { font-size: var(--s0); }
  .mug { width: 3.7rem; height: 4.2rem; }
  .suspect { grid-template-columns: 3.7rem minmax(0, 1fr); padding: 0.45rem 0.55rem; gap: 0.65rem; }
  .who-name { font-size: 1.3rem; }
  .suspects { gap: 0.45rem; }
  .clue { padding-top: 0.45rem; padding-bottom: 0.45rem; }
  .career-name { font-size: 2.1rem; }
  .card-trace, .today-card .card-trace { height: 3.2rem; }
  .today-title { font-size: 2.2rem; }
  .week-title { font-size: 1.55rem; }
  .hq-grid { gap: 0.8rem; padding-top: 0.8rem; }
  .hq-col { gap: 0.8rem; }
  .mode-tile { min-height: 4rem; padding: 0.55rem; }
  .verdict { padding: 0.75rem 0.9rem 0.8rem; }
  .verdict-card { gap: 0.45rem; }
  .verdict-head { font-size: 2rem; }
  .verdict-stars .st { width: 1.9rem; height: 1.9rem; }
  .why { line-height: 1.35; }
}
/* phones: a little more breathing room for thumbs */
@media (max-width: 699px), (max-aspect-ratio: 6/5) {
  .case-grid { padding-bottom: 1.4rem; }
  .verdict-actions .btn.ghost { min-width: 5rem; }
  .res-title { font-size: 3rem; }
}
@media (max-width: 380px) {
  .brand { font-size: 1.3rem; }
  .mode-txt b { font-size: 1.2rem; }
  .who-key { display: none; }
}
@media (hover: none) { .who-key { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- other pages (past cases, privacy, 404) ---------- */
html:not(.game) body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
.wrap { width: 100%; max-width: calc(36rem + 32px); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.bar { border-bottom: 2px solid var(--ink); background: var(--paper); }
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
html:not(.game) main { flex: 1; padding-block: 24px 40px; }
.screen { display: grid; gap: 20px; }
.page-title { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(2.75rem, 13vw, 4rem); line-height: 0.9; }
.lede { margin: 0; font-size: var(--s1); line-height: 1.4; max-width: 34ch; }
.days { display: grid; gap: 10px; }
.day { background: var(--surface); border: 2px solid var(--grid-strong); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.day:target { border-color: var(--needle); }
.day-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.day-head h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.7rem; line-height: 1; }
.day-date { color: var(--pencil); }
.chip { margin-left: auto; font-weight: 700; font-size: var(--s-1); border: 2px solid var(--ink); border-radius: 99px; padding: 1px 10px; }
.day-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.day details { flex: 1 1 100%; }
.day summary { cursor: pointer; color: var(--pencil); text-decoration: underline; text-underline-offset: 3px; width: max-content; }
.answers { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.answers li { border-left: 3px solid var(--grid-strong); padding-left: 10px; display: grid; gap: 2px; }
.answers b { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.empty { background: var(--surface); border: 2px dashed var(--grid-strong); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; }
.prose { display: grid; gap: 12px; max-width: 65ch; }
.prose h2 { margin: 12px 0 0; font-family: var(--display); font-weight: 800; font-size: var(--s2); line-height: 1; }
.prose ul, .prose ol { margin: 0; }
.prose h3 { margin: 4px 0 0; font-size: var(--s1); line-height: 1.25; }
.prose li + li { margin-top: 4px; }
.foot { padding-block: 18px calc(22px + env(safe-area-inset-bottom, 0px)); border-top: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--s-1); color: var(--pencil); }
.foot a { color: var(--pencil); }
.foot .spacer { flex: 1; }
