/* Layout: one-column phone app, Art Deco noir. Fixed top bar, scrolling stage, fixed tab bar. Evidence lives on cream paper. */
:root {
  --ink: #101b18;
  --panel: #182823;
  --panel-2: #20352e;
  --line: #2f4a41;
  --fg: #e9e1cf;
  --muted: #93a79e;
  --brass: #d1a94e;
  --brass-soft: rgba(209,169,78,.16);
  --oxblood: #9c3434;
  --paper: #ede2c8;
  --paper-ink: #2a2118;
  --logic: #86b8dc;
  --intuition: #bc9be0;
  --gossip: #e7a2b9;
  --ok: #8cc79a;
  --font-display: "Playfair Display", "Times New Roman", Georgia, serif;
  --font-body: "Lora", Georgia, "Times New Roman", serif;
  --font-mono: "PT Mono", ui-monospace, "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--fg);
  font: 16px/1.5 var(--font-body); -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(120% 60% at 50% -10%, rgba(209,169,78,.10), transparent 60%), repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0 2px, transparent 2px 22px);
  -webkit-user-select: none; user-select: none;
}
textarea, .share-box pre { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
button:focus-visible, textarea:focus-visible, a:focus-visible, input:focus-visible + i { outline: 2px solid var(--brass); outline-offset: 2px; }
.app { max-width: 460px; margin: 0 auto; min-height: 100%; padding-inline: 16px; position: relative; }
section { padding-block: 16px 72px; } /* the bottom toast must not cover the last line (independent run 29.10) */
.eyebrow { font: 12px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
.stack { display: grid; gap: 10px; margin-top: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 22px; border-radius: 4px;
  background: var(--brass); color: #1a140a; border: 0; font: 700 17px/1.1 var(--font-display); letter-spacing: .02em; text-align: center;
  box-shadow: 0 0 0 1px rgba(0,0,0,.3) inset, 0 6px 18px rgba(209,169,78,.18);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.icon-btn { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--fg); }
.icon-btn svg { width: 24px; height: 24px; color: var(--brass); }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px;
  font: 13px var(--font-mono); color: var(--fg); letter-spacing: .06em; flex-shrink: 0;
}
.lang-btn svg { width: 16px; height: 16px; color: var(--brass); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font: 14px var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }
.chip svg { width: 16px; height: 16px; color: var(--brass); }
.chip.btnlike { cursor: pointer; color: var(--brass); }

/* ---------- Home ---------- */
#s-home { display: grid; gap: 20px; text-align: center; padding-top: 12px; }
.title-top { display: flex; justify-content: space-between; align-items: center; }
.hero { position: relative; margin-inline: -16px; }
.hero svg { display: block; width: 100%; height: auto; }
.brand-wrap { margin-top: -54px; position: relative; }
.brand { font: 800 clamp(40px, 12vw, 56px)/1 var(--font-display); letter-spacing: -.01em; text-shadow: 0 4px 24px rgba(0,0,0,.8); }
.brand em { font-style: italic; font-weight: 500; color: var(--brass); }
.tagline { color: var(--muted); max-width: 32ch; margin: 10px auto 0; }
.case-card { background: var(--paper); color: var(--paper-ink); text-align: left; padding: 22px 20px 20px; border-radius: 2px; position: relative; box-shadow: 0 18px 40px rgba(0,0,0,.45); transform: rotate(-1deg); }
.case-stamp { position: absolute; right: 14px; top: 14px; font: 12px var(--font-mono); letter-spacing: .2em; color: var(--oxblood); border: 2px solid var(--oxblood); padding: 3px 8px; transform: rotate(6deg); opacity: .8; }
.case-card .eyebrow { color: #8a6a24; padding-right: 90px; }
.case-card h2 { font-size: 28px; margin-top: 6px; }
.case-card p { margin: 10px 0 0; font-size: 15px; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font: 13px var(--font-mono); color: #6b5a44; }
.home-stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.home-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; } /* 4 buttons, or 3 when the shop is hidden (monetization off) */
.home-nav .icon-btn { font-size: 12px; padding-inline: 2px; }
.rank-card { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; }
.rank-card .portrait { width: 48px; height: 48px; }
.rank-card span { display: grid; flex: 1; min-width: 0; }
.rank-card small { font: 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rank-card b { font: 700 18px var(--font-display); color: var(--brass); }
.rank-card .stars-n { flex: 0 0 auto; font: 16px var(--font-mono); color: var(--brass); }

/* ---------- Search counter ---------- */
.search-count { display: flex; align-items: center; gap: 10px; margin-block: 12px; color: var(--muted); font-size: 14px; }
.search-count b { color: var(--fg); font: 700 18px var(--font-mono); }
.search-count .dots { display: flex; gap: 5px; margin-left: auto; }
.search-count .dots i { width: 14px; height: 14px; border-radius: 99px; border: 1.5px solid var(--brass); }
.search-count .dots i.on { background: var(--brass); box-shadow: 0 0 10px rgba(209,169,78,.6); }

/* ---------- Mini-games ---------- */
#s-mini { display: grid; gap: 14px; padding-top: 24px; }
.mini-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mini-box { background: #0b1311; border: 1px solid var(--line); border-radius: 8px; padding: 18px 12px; min-height: 220px; display: grid; place-items: center; box-shadow: inset 0 0 40px rgba(0,0,0,.5); }
.mini-box.solved { border-color: var(--ok); box-shadow: inset 0 0 40px rgba(140,199,154,.15); }
.mini-result { animation: rise .3s ease-out; }
.tubes { display: flex; gap: 12px; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
.tube { width: 46px; height: 168px; display: flex; flex-direction: column; justify-content: flex-end; gap: 0; padding: 6px 5px 5px; background: rgba(233,228,212,.08); border: 2px solid #e9e4d4; border-top: 0; border-radius: 0 0 22px 22px; transition: transform .15s; position: relative; }
.tube::before { content: ""; position: absolute; top: -4px; left: -6px; right: -6px; height: 4px; background: #e9e4d4; border-radius: 2px; }
.tube i { display: block; height: 38px; transition: background .2s; }
.tube i:last-child { border-radius: 0 0 16px 16px; }
.tube.up { transform: translateY(-14px); }
.gears-wrap { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.gears { display: grid; grid-template-columns: repeat(3, var(--g)); gap: 4px; --g: min(76px, 21vw); }
.gear { width: var(--g); height: var(--g); padding: 0; background: #14211d; border: 1px solid var(--line); border-radius: 6px; }
.spring { width: 18px; height: 30px; flex-shrink: 0; border: 3px solid #6b5a44; border-radius: 4px; background: repeating-linear-gradient(0deg, #6b5a44 0 2px, transparent 2px 6px); }
.dial { width: 40px; height: 40px; flex-shrink: 0; }
.dial circle { fill: #efe6cf; stroke: #6b5a44; stroke-width: 3; }
.dial .hand { stroke: #1a140a; stroke-width: 2.5; stroke-linecap: round; fill: none; }
.gears-wrap.on .spring { border-color: var(--brass); background: repeating-linear-gradient(0deg, var(--brass) 0 2px, transparent 2px 6px); }
.gears-wrap.on .dial circle { stroke: var(--brass); }
.gears-wrap.on .dial .hand { transform-origin: 20px 20px; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.gear svg { width: 100%; height: 100%; display: block; }
.gear .belt path { stroke: #6b5a44; stroke-width: 10; stroke-linecap: round; fill: none; transition: stroke .3s; }
.gear circle { fill: #8a6a24; stroke: #d1a94e; stroke-width: 2; stroke-dasharray: 3 2; }
.gear circle.hub { fill: #d1a94e; stroke: none; }
.gear:active svg { transform: rotate(20deg); }
.gears-wrap.on .belt path { stroke: var(--brass); }
.strips { display: grid; gap: 8px; padding: 6px 0; width: 100%; touch-action: none; }
.strip {
  text-align: left; padding: 12px 16px; background: var(--paper); color: var(--paper-ink); font: italic 500 18px/1.3 var(--font-display); cursor: grab;
  transform: rotate(var(--r, 0deg)); transition: transform .18s, box-shadow .2s; touch-action: none;
  clip-path: polygon(0 8%, 4% 0, 12% 6%, 22% 0, 35% 7%, 48% 1%, 60% 6%, 73% 0, 86% 7%, 96% 1%, 100% 9%, 100% 92%, 95% 100%, 84% 94%, 70% 100%, 57% 93%, 44% 100%, 30% 94%, 18% 100%, 7% 94%, 0 100%);
  background-image: radial-gradient(120% 140% at 100% 50%, rgba(60,30,10,.35), transparent 30%);
}
.strip.dragging { transition: none; z-index: 2; position: relative; box-shadow: 0 10px 24px rgba(0,0,0,.5); cursor: grabbing; }
.strip.done { transform: rotate(0); }

/* ---------- Agency meta ---------- */
.agency-progress { display: grid; gap: 4px; text-align: left; background: var(--panel); border: 1px dashed var(--brass); border-radius: 6px; padding: 12px 14px; color: var(--fg); }
.agency-progress:empty { display: none; }
.agency-progress b { font-family: var(--font-display); }
.agency-progress span { font: 13px var(--font-mono); color: var(--muted); }
.agency-progress i { display: block; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--brass) var(--p), var(--line) var(--p)); }
.rooms { display: grid; gap: 8px; }
.room { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; opacity: .55; }
.room.done, .room.next { opacity: 1; }
.room.next { border-color: var(--brass); }
.room .num { font: 700 20px var(--font-display); color: var(--brass); width: 22px; text-align: center; }
.room .grow { flex: 1; min-width: 0; display: grid; }
.room b { font-family: var(--font-display); }
.room small { color: var(--muted); font-size: 13px; }
.room .lockp { font: 13px var(--font-mono); color: var(--muted); }
.outfits { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.outfit { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.outfit .portrait { width: 52px; height: 52px; }
.outfit b { font-size: 13px; }
.outfit small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.outfit.on { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
#agency-disguise .shop { margin-top: 10px; }
.trophies { display: flex; flex-wrap: wrap; gap: 8px; }
.trophy { display: grid; gap: 2px; width: calc(50% - 4px); padding: 10px 12px; background: var(--paper); color: var(--paper-ink); border-radius: 2px; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.trophy b { font: 700 20px var(--font-display); color: #8a6a24; }
.trophy small { font-size: 13px; line-height: 1.25; }
.trophy em { font-style: normal; color: #b0862a; font-size: 13px; }
.trophies .empty { width: 100%; }
.chapter-letter { margin-top: 14px; background: var(--paper); color: var(--paper-ink); padding: 20px 18px; font: italic 500 18px/1.5 var(--font-display); border-radius: 2px; transform: rotate(-.5deg); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.chapter-letter .tbc { margin: 14px 0 0; font: 13px var(--font-mono); color: #9c3434; letter-spacing: .1em; text-transform: uppercase; }
.shop-list { display: grid; gap: 10px; margin-top: 16px; }
.offer { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.offer .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.offer b { font-family: var(--font-display); font-size: 17px; }
.offer small { color: var(--muted); font-size: 13px; }
.offer.starter { border-color: var(--brass); background: linear-gradient(135deg, rgba(209,169,78,.14), var(--ink)); }
.offer.club { border-color: var(--intuition); }
.offer.kit { border-color: var(--brass); }
.offer-btns { display: grid; gap: 6px; justify-items: stretch; flex-shrink: 0; }
.offer .best { justify-self: start; font: 600 11px var(--font-mono); font-style: normal; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: var(--brass); padding: 2px 6px; border-radius: 3px; }
.restore-buys { margin-top: 12px; }

/* ---------- Intro ---------- */
#s-intro { display: grid; gap: 18px; padding-top: 28px; }
.narr { font-size: 17px; }
.narr p { margin: 0 0 12px; }
.narr .lead::first-letter { font: 700 52px/0.8 var(--font-display); float: left; margin: 6px 8px 0 0; color: var(--brass); }
.cast { display: flex; justify-content: center; gap: 8px; }
.cast .portrait { width: 64px; height: 64px; }

/* ---------- Search ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 12px; background: var(--ink); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.back { background: none; border: 0; color: var(--muted); font-size: 22px; padding: 0 6px 0 0; line-height: 1; flex-shrink: 0; }
.timer { font: 700 22px var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
.timer.low { color: var(--gossip); animation: blink 1s steps(2) infinite; }
.timer.off { color: var(--muted); }
@keyframes blink { 50% { opacity: .5 } }
.find-list { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 12px; }
.find { font-size: 13px; padding: 5px 10px; border-radius: 99px; border: 1px dashed var(--brass); color: var(--fg); background: var(--brass-soft); }
.find.done { border-style: solid; background: transparent; color: var(--muted); text-decoration: line-through; }
.scene-wrap { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 14px 30px rgba(0,0,0,.4); }
.scene { display: block; width: 100%; height: auto; touch-action: manipulation; }
.hot { cursor: pointer; }
.hot.inert { pointer-events: none; }
.hit { fill: transparent; }
.hot .ring { fill: none; stroke: var(--brass); stroke-width: 2.5; opacity: 0; }
.hot.found .ring { opacity: 1; }
.hot.pulse .ring { animation: pulse 1s ease-in-out 3; opacity: 1; }
.hot.shake { animation: shake .3s; transform-box: fill-box; transform-origin: center; }
@keyframes shake { 25% { transform: translateX(-3px) } 75% { transform: translateX(3px) } }
@keyframes pulse { 0%,100% { stroke-width: 2; opacity: .3 } 50% { stroke-width: 6; opacity: 1 } }
.tapfx { pointer-events: none; animation: tapfx .5s ease-out forwards; }
@keyframes tapfx { from { r: 4; opacity: .9 } to { r: 26; opacity: 0 } }
.rain { animation: rain .55s linear infinite; }
@keyframes rain { from { transform: translate(6px, -36px) } to { transform: translate(0, 0) } }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flick 1.1s ease-in-out infinite alternate; }
.flame.slow { animation-duration: 1.7s; }
@keyframes flick { 0% { transform: scale(1, 1) } 40% { transform: scale(.92, 1.12) } 100% { transform: scale(1.06, .9) } }
.glow { animation: glow 2.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .65 } to { opacity: 1 } }
.steam { animation: steam 2.6s ease-in-out infinite; }
.steam.b { animation-delay: 1.3s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(4px) } 40% { opacity: .7 } 100% { opacity: 0; transform: translateY(-8px) } }
.cat-body { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scaleY(1.07) } }
.tail { transform-box: fill-box; transform-origin: 0% 100%; animation: tail 4s ease-in-out infinite; }
@keyframes tail { 0%, 80%, 100% { transform: rotate(0) } 88% { transform: rotate(14deg) } }
.lit { animation: lit 5s steps(1) infinite; }
@keyframes lit { 0%, 70% { opacity: 1 } 72% { opacity: .35 } 76%, 100% { opacity: 1 } }
.scroll-slow { animation: scroll 14s linear infinite; }
.scroll-fast { animation: scroll 2.2s linear infinite; }
@keyframes scroll { from { transform: translateX(0) } to { transform: translateX(-360px) } }
.slosh { transform-box: fill-box; transform-origin: center; animation: slosh 1.8s ease-in-out infinite; }
@keyframes slosh { 50% { transform: rotate(6deg) } }
.bulb { animation: bulb 3s ease-in-out infinite; }
.bulb.b2 { animation-delay: 1.5s; }
@keyframes bulb { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }

/* ---------- Puzzle ---------- */
#s-puzzle { display: grid; gap: 16px; padding-top: 28px; }
.strips { display: grid; gap: 8px; padding: 18px 12px; background: #2a1a10; border-radius: 4px; box-shadow: inset 0 0 40px rgba(0,0,0,.6); }
.strip {
  text-align: left; padding: 12px 16px; background: var(--paper); color: var(--paper-ink); border: 0; font: italic 500 18px/1.3 var(--font-display);
  transform: rotate(var(--r, 0deg)); transition: transform .2s, box-shadow .2s;
  clip-path: polygon(0 8%, 4% 0, 12% 6%, 22% 0, 35% 7%, 48% 1%, 60% 6%, 73% 0, 86% 7%, 96% 1%, 100% 9%, 100% 92%, 95% 100%, 84% 94%, 70% 100%, 57% 93%, 44% 100%, 30% 94%, 18% 100%, 7% 94%, 0 100%);
  background-image: radial-gradient(120% 140% at 100% 50%, rgba(60,30,10,.35), transparent 30%);
}
.strip.nope, .bubble.nope { animation: shake .3s 2; } /* wrong order after enough moves (minigames.js); the same wrong objection again (game.js) */
.strip.picked { transform: rotate(0) scale(1.03); box-shadow: 0 0 0 3px var(--brass); }
.strip.done { transform: rotate(0); }

/* ---------- Findings ---------- */
#s-findings { display: grid; gap: 14px; padding-top: 28px; }
.finding { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--v); border-radius: 4px; padding: 12px 14px; }
.finding .who { font: 11px var(--font-mono); letter-spacing: .14em; color: var(--v); }
.finding h3 { font-size: 17px; margin: 2px 0 4px; }
.finding p { margin: 0; font-size: 15px; }

/* ---------- Hub ---------- */
.stage { padding-block: 14px calc(110px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.hintline { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.small-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; color: var(--brass); font-size: 14px; }
.suspects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suspect { display: grid; justify-items: center; gap: 8px; text-align: center; align-content: start; padding: 16px 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.suspect .name { font: 700 16px/1.2 var(--font-display); }
.suspect .role { font-size: 13px; color: var(--muted); line-height: 1.3; }
.suspect .prog { font: 12px var(--font-mono); color: var(--brass); }
.lie-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 99px; background: var(--oxblood); color: #fff; font: 700 11px var(--font-mono); }
.portrait { width: 84px; height: 84px; flex-shrink: 0; display: block; }
.notebook { display: grid; gap: 12px; }
.note { background: var(--paper); color: var(--paper-ink); padding: 14px 16px; border-radius: 2px; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.note:nth-child(odd) { transform: rotate(-.6deg); }
.note:nth-child(even) { transform: rotate(.5deg); }
.note .kind { font: 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: #8a6a24; }
.note h3 { font-size: 17px; margin: 2px 0 4px; }
.note p { margin: 0; font-size: 15px; }
.hot-note { box-shadow: 0 0 0 2px var(--oxblood), 0 6px 16px rgba(0,0,0,.35); }
.hot-note .kind { color: var(--oxblood); }
.empty { color: var(--muted); text-align: center; padding: 32px 12px; border: 1px dashed var(--line); border-radius: 6px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(16,27,24,.96); border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(8px); }
.tabbar-in { max-width: 428px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 4px; align-items: center; }
.tab { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; background: none; border: 0; min-width: 0; color: var(--muted); font-size: 11.5px; border-radius: 6px; position: relative; line-height: 1.2; }
.tab .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { color: var(--brass); }
.tab .badge { position: absolute; top: 2px; right: 22%; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--oxblood); color: #fff; font: 11px/16px var(--font-mono); }
.accuse-btn { min-height: 46px; padding: 10px 12px; font-size: 15px; background: var(--oxblood); color: #fff; box-shadow: none; }

/* ---------- Voices & toasts ---------- */
.voice-layer { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 20; padding-inline: 16px; pointer-events: none; }
.voice { pointer-events: auto; max-width: 428px; margin: 0 auto; display: block; width: 100%; text-align: left; background: #0b1311; border: 1px solid var(--line); border-left: 4px solid var(--v, var(--brass)); padding: 14px 16px; border-radius: 4px; box-shadow: 0 16px 40px rgba(0,0,0,.6); animation: rise .28s ease-out; }
.voice .who { font: 12px var(--font-mono); letter-spacing: .16em; color: var(--v, var(--brass)); }
.voice .what { margin-top: 4px; font-size: 16px; }
.voice .obj { font: 700 15px var(--font-display); color: var(--fg); }
.voice .more { margin-top: 8px; font: 12px var(--font-mono); color: var(--muted); text-align: right; }
.voice.pass { pointer-events: none; } /* search: taps reach the props under the bubble (game.js nextVoice) */
.voice.static { animation: none; --v: var(--intuition); }
@keyframes rise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
/* Bottom of the screen, under the voice bubbles: at the top it covered the screen titles. Taps go through it. */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); pointer-events: none; transform: translateX(-50%); z-index: 60; background: var(--brass); color: #1a140a; padding: 10px 16px; border-radius: 99px; font: 600 14px var(--font-body); box-shadow: 0 10px 24px rgba(0,0,0,.4); animation: rise .2s ease-out; max-width: calc(100% - 32px); text-align: center; }

/* ---------- Sheets ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(5,10,9,.72); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 460px; max-height: 88%; overflow: auto; background: var(--panel); border-top: 2px solid var(--brass); border-radius: 12px 12px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); animation: rise .25s ease-out; }
.sheet-head { display: flex; gap: 14px; align-items: center; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 22px; }
.sheet-head .role { color: var(--muted); font-size: 14px; }
.sheet-head .portrait { width: 72px; height: 72px; }
.close { background: none; border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 99px; color: var(--muted); font-size: 20px; line-height: 1; flex-shrink: 0; }
.log { display: grid; gap: 10px; margin: 16px 0; }
.sheet::after { content: ""; display: block; height: 48px; } /* room under the last line for a toast at the bottom ("Noted", clue names) */
.bubble { padding: 10px 14px; border-radius: 4px; font-size: 15px; }
.bubble.q { justify-self: end; max-width: 85%; background: var(--brass-soft); font-style: italic; }
.bubble.a { max-width: 92%; background: var(--panel-2); }
.bubble.reply { border-left: 3px solid var(--oxblood); }
.bubble.v { border-left: 3px solid var(--v); background: #0e1816; font-size: 14px; }
.bubble.v b { font: 11px var(--font-mono); letter-spacing: .14em; color: var(--v); display: block; }
.lie { display: inline; padding: 0 2px; margin: 0; background: rgba(156,52,52,.25); border: 0; border-bottom: 2px dashed var(--gossip); color: var(--fg); font: inherit; animation: liepulse 1.6s ease-in-out infinite; }
@keyframes liepulse { 50% { background: rgba(156,52,52,.5) } }
.phrase { display: inline; padding: 0 1px; margin: 0; background: none; border: 0; border-radius: 2px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.phrase:hover, .phrase:focus-visible { background: rgba(156,52,52,.25); }
.phrase:active { background: rgba(156,52,52,.45); }
.lie-done { color: var(--muted); text-decoration-color: var(--oxblood); text-decoration-thickness: 2px; }
.intro-line { color: var(--muted); font-style: italic; font-size: 15px; margin-top: 12px; }
.qs { display: grid; gap: 8px; }
.q-btn { text-align: left; padding: 12px 14px; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; font-size: 15px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.q-btn .lock { font: 11px var(--font-mono); color: var(--muted); flex-shrink: 0; letter-spacing: .06em; }
.q-btn[disabled] { opacity: .5; cursor: default; }
.q-btn.new { border-color: var(--brass); }
.present { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--oxblood); display: grid; gap: 10px; }
.present h3 { font-size: 18px; color: var(--gossip); }
.lang-list, .archive, .settings { display: grid; gap: 8px; margin-top: 16px; }
.lang-opt, .row-btn { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; text-align: left; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; font: 600 16px var(--font-body); text-decoration: none; }
.lang-opt small, .row-btn small { font: 12px var(--font-mono); color: var(--muted); letter-spacing: .06em; }
.lang-opt[aria-pressed="true"] { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.row-btn.danger { color: var(--gossip); }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex-shrink: 0; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 99px; background: var(--fg); transition: transform .2s; }
.toggle input:checked + i { background: var(--brass); }
.toggle input:checked + i::after { transform: translateX(18px); }
.version { text-align: center; color: var(--muted); font: 12px var(--font-mono); margin-top: 6px; }
.arch { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; }
.arch .num { font: 700 20px var(--font-display); color: var(--brass); width: 28px; text-align: center; flex-shrink: 0; }
.arch .grow { flex: 1; min-width: 0; display: grid; }
.arch b { font-family: var(--font-display); }
.arch small { color: var(--muted); font-size: 13px; }
.arch .st { font: 12px var(--font-mono); color: var(--muted); flex-shrink: 0; }
.arch .st.ok { color: var(--ok); } .arch .st.fail { color: var(--gossip); } .arch .st.new { color: var(--brass); }
.arch.locked { opacity: .45; }

/* ---------- Objection ---------- */
.objection { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(156,52,52,.55), rgba(5,10,9,.85)); animation: objbg 1.5s ease-out forwards; }
.obj-word { font: 800 italic clamp(44px, 14vw, 72px)/1 var(--font-display); color: #fff; text-shadow: 4px 4px 0 var(--oxblood), 0 0 30px rgba(0,0,0,.8); animation: objword .45s cubic-bezier(.2,1.8,.4,1); transform: rotate(-6deg); grid-area: 1 / 1; }
.obj-stamp { grid-area: 1 / 1; margin-top: 140px; font: 800 30px var(--font-display); letter-spacing: .1em; color: var(--oxblood); border: 4px solid var(--oxblood); padding: 6px 16px; background: var(--paper); transform: rotate(8deg); opacity: 0; animation: objstamp .3s .45s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes objbg { 0% { opacity: 0 } 10%, 80% { opacity: 1 } 100% { opacity: 0 } }
@keyframes objword { from { transform: rotate(-6deg) scale(3); opacity: 0 } to { transform: rotate(-6deg) scale(1); opacity: 1 } }
@keyframes objstamp { from { transform: rotate(8deg) scale(2.5); opacity: 0 } to { transform: rotate(8deg) scale(1); opacity: 1 } }
body:has(.objection) .app { animation: quake .4s .1s; }
@keyframes quake { 20% { transform: translate(-6px, 3px) } 40% { transform: translate(6px, -3px) } 60% { transform: translate(-4px, 2px) } 80% { transform: translate(3px, -1px) } }

/* ---------- Accuse ---------- */
#s-accuse { display: grid; gap: 16px; padding-top: 20px; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { display: grid; justify-items: center; gap: 6px; padding: 12px 8px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.pick[aria-pressed="true"] { border-color: var(--oxblood); box-shadow: 0 0 0 2px var(--oxblood) inset; }
.pick .portrait { width: 60px; height: 60px; }
.ev-list { display: grid; gap: 8px; }
.ev { text-align: left; padding: 12px 14px; background: var(--paper); color: var(--paper-ink); border: 2px solid transparent; border-radius: 2px; font-size: 14px; }
.ev b { font-family: var(--font-display); font-size: 15px; display: block; }
.ev[aria-pressed="true"] { border-color: var(--oxblood); box-shadow: 0 0 0 2px var(--oxblood); }
.prove-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.prove-head span { font: 13px var(--font-mono); color: var(--brass); }
.attempts { display: flex; gap: 6px; align-items: center; font: 13px var(--font-mono); color: var(--muted); }
.attempts i { width: 14px; height: 14px; border-radius: 99px; border: 1.5px solid var(--oxblood); display: inline-block; }
.attempts i.used { background: var(--oxblood); }
.verdict { padding: 14px 16px; border-radius: 4px; background: #2a1414; border: 1px solid var(--oxblood); font-size: 15px; }

/* ---------- Result ---------- */
#s-result { display: grid; gap: 20px; text-align: center; padding-top: 28px; }
.result-hero { display: grid; justify-items: center; gap: 14px; }
.result-hero .portrait { width: 110px; height: 110px; }
.stamp { justify-self: center; font: 800 28px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; padding: 10px 18px; border: 3px solid currentColor; transform: rotate(-4deg); color: var(--ok); animation: stamp .45s cubic-bezier(.2,1.6,.4,1); margin-top: -34px; background: var(--ink); }
.stamp.fail { color: var(--oxblood); }
@keyframes stamp { from { transform: rotate(-4deg) scale(2.2); opacity: 0 } to { transform: rotate(-4deg) scale(1); opacity: 1 } }
.stars { font-size: 34px; letter-spacing: 6px; color: var(--brass); }
.stars .off { color: var(--line); }
.reward-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.reward { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px; display: grid; gap: 2px; min-width: 96px; }
.reward b { font: 700 22px var(--font-display); color: var(--brass); font-variant-numeric: tabular-nums; }
.reward span { font: 11px var(--font-mono); letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.solution { text-align: left; background: var(--paper); color: var(--paper-ink); padding: 18px; border-radius: 2px; font-size: 15px; }
.solution h3 { font-size: 19px; margin-bottom: 8px; }
.solution p { margin: 0 0 8px; }
.share-box { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: grid; gap: 10px; }
.share-box pre { margin: 0; white-space: pre-wrap; font: 14px/1.5 var(--font-mono); color: var(--fg); }
.countdown { font: 14px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.countdown b { color: var(--fg); font-weight: 400; }
.feedback { text-align: left; display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.feedback h3 { font-size: 19px; }
.rate { display: flex; gap: 6px; }
.rate button { width: 44px; height: 44px; border-radius: 4px; border: 1px solid var(--line); background: var(--ink); font: 700 16px var(--font-display); color: var(--muted); }
.rate button[aria-pressed="true"] { background: var(--brass); color: #1a140a; border-color: var(--brass); }
.feedback label { font-size: 14px; color: var(--muted); }
.feedback textarea { width: 100%; min-height: 96px; resize: vertical; background: var(--ink); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; font: 15px/1.45 var(--font-body); }
.fb-status { font-size: 14px; color: var(--ok); min-height: 1.2em; }
.fb-status.bad { color: var(--gossip); }

/* ---------- Agency ---------- */
#s-agency { display: grid; gap: 16px; }
.office { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.shop { display: grid; gap: 8px; }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.shop-item b { display: block; font-family: var(--font-display); }
.shop-item span { font: 13px var(--font-mono); color: var(--brass); }

/* ---------- Ad stand-in ---------- */
.ad { position: fixed; inset: 0; z-index: 80; background: #000; display: grid; place-items: center; text-align: center; padding: 24px; }
.ad-box { display: grid; gap: 14px; max-width: 320px; }
.ad-box .eyebrow { color: var(--muted); }
.ad-box h3 { font-size: 22px; }
.ad-bar { height: 4px; background: #222; border-radius: 4px; overflow: hidden; }
.ad-bar i { display: block; height: 100%; background: var(--brass); width: 0; transition: width linear; }
.ad-box p { color: var(--muted); font-size: 14px; margin: 0; }

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

/* ---------- Father's token, offers, logic hint ---------- */
.token .hit { fill: transparent; }
.token-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.tk { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 99px; background: #3a3020; border: 1.5px dashed #8a6a24; color: #8a6a24; font: 700 9px Georgia, serif; flex-shrink: 0; }
.tk.on { background: #8a6a24; border: 1.5px solid var(--brass); color: #efe6c8; }
.tokens-n { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--brass); font-weight: 600; }
.token-card { display: grid; justify-items: center; gap: 10px; text-align: center; padding-top: 6px; }
.token-card svg { width: 84px; height: 84px; animation: stamp .5s cubic-bezier(.2,1.6,.4,1); }
.token-card p { margin: 0; color: var(--muted); }
.offer-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--brass); background: linear-gradient(135deg, rgba(209,169,78,.22), var(--panel)); color: var(--fg); text-align: left; }
.offer-banner b { font-family: var(--font-display); }
.gift-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 10px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 15px; }
.gift-line > span:first-child { flex: 1 1 150px; min-width: 0; }
.gift-line .btn { margin-left: auto; }
.notif-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--brass); background: var(--panel); text-align: left; }
.notif-ask > span { flex: 1 1 180px; }
.notif-ask .btns { display: flex; gap: 8px; margin-left: auto; }
.gift-line .done { font: 13px var(--font-mono); color: var(--brass); }
.offer-banner span { font: 13px var(--font-mono); color: var(--brass); }
.ev.hinted { box-shadow: 0 0 0 3px var(--logic); }
.ev.hit { box-shadow: 0 0 0 3px var(--ok, #6fbf8a); } /* the piece that hit home on the last try stays chosen */
.agency-progress.cta { border-style: solid; background: linear-gradient(135deg, rgba(209,169,78,.25), var(--panel)); animation: glow 1.4s ease-in-out infinite alternate; }
.snow { animation: snow 6s linear infinite; }
@keyframes snow { from { transform: translate(0, -26px) } to { transform: translate(-6px, 0) } }

/* Case 001: how a case goes, four steps on the intro (game.js renderIntro) */
.howto { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.howto ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: how; }
.howto li { display: flex; align-items: center; gap: 10px; counter-increment: how; }
.howto li span { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #0b1311; border: 1px solid var(--brass); font-size: 15px; }
#r-count .small-btn { margin-left: 6px; }
.clock-pend { transform-box: fill-box; transform-origin: 50% 0; animation: pend 2.4s ease-in-out infinite alternate; }
@keyframes pend { from { transform: rotate(-5deg) } to { transform: rotate(5deg) } }
/* Home, no keys left: unsolved archive cases (game.js renderHome) */
.arch-hint { display: block; width: 100%; margin-top: 8px; background: none; border: 0; color: var(--muted); font: 14px var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* Independent run 27.10: the close button of a long sheet (interrogation) stays on screen */
.sheet > .sheet-head { position: sticky; top: -18px; z-index: 3; margin: -18px -16px 0; padding: 18px 16px 10px; background: var(--panel); }
/* six flasks in one row instead of 5 + 1 */
.tubes.n6 { gap: 8px; flex-wrap: nowrap; }
.tubes.n6 .tube { width: 40px; }
/* EN "TODAY'S CASE · CASE NO. 13" ran under the CONFIDENTIAL stamp */
#home-case .eyebrow { padding-right: 120px; }
/* Result of an archive case: the streak counts only the case of the day (game.js renderResult) */
.arch-note { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
/* Shop: key and magnifier for an ad, first rows (game.js shopAdRows) */
.shop-list.ad-rows { margin-bottom: 10px; }
/* Home: today's case is done — status and the countdown to the next one (game.js renderHome) */
.case-done { margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(0,0,0,.25); font: 13px var(--font-mono); }
.case-done.ok b { color: #2f6b45; }
.case-done.fail b { color: var(--oxblood); }
/* Result: why this many stars (game.js renderResult) */
.star-why { list-style: none; margin: 6px auto 0; padding: 0; display: grid; gap: 2px; justify-content: center; font-size: 13px; color: var(--muted); }
.star-why li.ok::before { content: "✓ " / ""; color: #6fb38a; }
.star-why li.no::before { content: "✗ " / ""; color: var(--oxblood); }
/* Text for screen readers only (result ✓/✗) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Home: "Case No. 6" never splits (EN wrapped the number) */
.nowrap { white-space: nowrap; }
/* ✓/✗ have empty alt text (content "…" / ""): the screen reader reads only the words */
.star-why li.note { margin-top: 2px; font-style: italic; }
