:root {
  color-scheme: dark;
  --night: #101d31;
  --night-2: #182b43;
  --paper: #fff8df;
  --paper-2: #f5e7bf;
  --ink: #20304a;
  --muted: #657187;
  --teal: #1c837d;
  --teal-dark: #10544f;
  --gold: #f6bd3e;
  --orange: #e96937;
  --red: #b53d46;
  --blue: #3b82b9;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; min-width: 900px; min-height: 620px; overflow: hidden; }
body { margin: 0; color: var(--ink); background: var(--night); }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #65d8e0; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.lesson { height: 100%; padding: 14px; }
.bureau { position: relative; height: 100%; min-height: 590px; overflow: hidden; isolation: isolate; border: 1px solid #314762; border-radius: 25px; background: var(--night); box-shadow: 0 8px 0 #091322, 0 24px 55px rgba(0,0,0,.35); }
.world { position: absolute; z-index: -2; inset: 0; background: linear-gradient(rgba(10,20,34,.08),rgba(10,20,34,.32)), url("art/case-board-01.webp") center / cover no-repeat; }
.bureau::after { position: absolute; z-index: -1; inset: 0; content: ""; background: radial-gradient(circle at 66% 48%, transparent 5%, rgba(5,12,24,.16) 72%); pointer-events: none; }

.case-hud { position: absolute; z-index: 10; top: 18px; left: 20px; right: 20px; height: 68px; display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 18px; }
.case-file,.difficulty,.scoreboard,.rank-card { border: 1px solid rgba(255,255,255,.16); color: white; background: rgba(12,28,47,.88); box-shadow: 0 5px 0 rgba(0,0,0,.25); backdrop-filter: blur(9px); }
.case-file { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 11px 16px; border-radius: 14px; }
.case-file span,.difficulty span,.scoreboard span,.rank-card span { color: #b9cada; font-size: 10px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.case-file strong { margin-top: 3px; font-size: 17px; }
.difficulty { justify-self: center; width: min(340px,100%); display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 9px 14px; border-radius: 14px; }
.difficulty span b { color: white; font-size: 15px; }.difficulty strong { font-size: 12px; }
.difficulty > i { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 999px; background: #2d4257; }
.difficulty > i b { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--orange)); transition: width 240ms ease-out; }
.scoreboard { height: 68px; display: flex; align-items: stretch; padding: 7px; border-radius: 14px; }
.scoreboard > div { min-width: 66px; display: grid; place-content: center; padding: 0 10px; text-align: center; }
.scoreboard > div + div { border-left: 1px solid #40556a; }
.scoreboard strong { display: block; margin-top: 2px; color: white; font-size: 21px; line-height: 1; }.scoreboard strong i { color: var(--gold); font-style: normal; font-size: 15px; }

.detective-desk { position: absolute; z-index: 3; top: 102px; bottom: 22px; left: 22px; width: 222px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 20px; background: linear-gradient(rgba(13,31,51,.62),rgba(6,18,32,.9)); box-shadow: 0 8px 20px rgba(0,0,0,.26); }
.rank-card { position: absolute; z-index: 3; top: 12px; left: 12px; right: 12px; padding: 9px 12px; border-radius: 11px; text-align: center; }
.rank-card strong { display: block; margin-top: 2px; font-size: 13px; }
.mascot { position: absolute; z-index: 2; left: 19px; bottom: 102px; width: 185px; max-height: 68%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 10px 8px rgba(0,0,0,.42)); transform-origin: 50% 90%; transition: transform 180ms ease-out, filter 180ms ease-out; }
.speech { position: absolute; z-index: 4; left: 15px; right: 15px; bottom: 77px; min-height: 48px; display: grid; place-items: center; padding: 8px 13px; border: 2px solid #8a6230; border-radius: 14px; color: #4a341a; background: var(--paper); box-shadow: 0 5px 0 rgba(0,0,0,.25); font-size: 12px; font-weight: 900; text-align: center; }
.speech::after { position: absolute; top: -10px; left: 45%; width: 16px; height: 16px; content: ""; transform: rotate(45deg); border-left: 2px solid #8a6230; border-top: 2px solid #8a6230; background: var(--paper); }
.suspects { position: absolute; left: 15px; right: 15px; bottom: 10px; width: 192px; height: 57px; object-fit: contain; filter: drop-shadow(0 4px 3px rgba(0,0,0,.35)); }

.case-board { position: absolute; z-index: 3; top: 103px; right: 24px; bottom: 23px; left: 262px; display: grid; grid-template-rows: auto minmax(220px,1fr) 34px auto; align-content: start; padding: 23px 30px 24px; overflow: hidden; border: 1px solid #bca66e; border-radius: 5px 18px 18px 5px; background: linear-gradient(105deg,rgba(255,248,223,.98),rgba(246,229,185,.97)); box-shadow: 0 9px 0 rgba(49,34,17,.42), 0 18px 36px rgba(0,0,0,.28); }
.case-board::before { position: absolute; inset: 0; content: ""; opacity: .18; background-image: repeating-linear-gradient(0deg,transparent 0 31px,#9e8e67 32px); pointer-events: none; }
.pin { position: absolute; z-index: 4; top: 13px; width: 15px; height: 15px; border: 3px solid #7f2f35; border-radius: 50%; background: var(--red); box-shadow: 0 4px 3px rgba(0,0,0,.3); }.pin-left { left: 17px; }.pin-right { right: 17px; }
.case-heading { position: relative; z-index: 1; text-align: center; }
.case-heading span { color: #8a3d2d; font-size: 10px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.case-heading h1 { margin: 4px 0 4px; font-size: clamp(26px,3vw,40px); line-height: 1; letter-spacing: -.04em; }.case-heading p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.chart-stage { position: relative; z-index: 1; min-height: 220px; display: grid; place-items: center; padding: 12px 8px 6px; }
.evidence { position: relative; z-index: 1; min-height: 30px; display: grid; place-items: center; color: var(--teal-dark); font-size: 14px; font-weight: 900; text-align: center; }.evidence.is-error { color: #a62f38; }
.action-area { position: relative; z-index: 1; min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 11px; }

.chart-paper { width: min(690px,100%); height: 100%; min-height: 220px; padding: 10px 15px 8px; border: 1px solid #d7c89e; border-radius: 13px; background: rgba(255,255,255,.75); box-shadow: 0 5px 0 rgba(106,85,43,.12); }
.chart-paper svg { width: 100%; height: 100%; min-height: 205px; overflow: visible; }
.axis { stroke: #425067; stroke-width: 2.5; }.gridline { stroke: #cfd4d5; stroke-width: 1; stroke-dasharray: 4 5; }.axis-label { fill: #4d586a; font-size: 12px; font-weight: 800; }.value-label { fill: #24344d; font-size: 14px; font-weight: 1000; }.bar { transform-box: fill-box; transform-origin: bottom; transition: height 220ms ease-out, y 220ms ease-out, filter 160ms ease-out; }.bar.is-focus { filter: drop-shadow(0 0 6px #f6bd3e); stroke: #8a5320; stroke-width: 3; }
.pictograph { width: min(650px,100%); display: grid; gap: 8px; padding: 14px 18px; border: 1px solid #d7c89e; border-radius: 13px; background: rgba(255,255,255,.76); box-shadow: 0 5px 0 rgba(106,85,43,.12); }
.pic-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 13px; min-height: 48px; padding: 5px 8px; border-radius: 9px; }.pic-row.is-focus { background: #fff2bb; box-shadow: inset 0 0 0 2px #dc9c28; }.pic-label { font-weight: 900; }.pic-icons { display: flex; flex-wrap: wrap; gap: 6px; }.pic-icon { width: 33px; height: 33px; display: grid; place-items: center; border: 2px solid #7a4a2d; border-radius: 50% 50% 45% 45%; color: #61321e; background: #ee8d4a; box-shadow: 0 3px 0 #bb6334; font-size: 19px; font-style: normal; transition: transform 160ms ease-out; }.pic-value { min-width: 36px; color: var(--teal-dark); font-weight: 1000; }.pic-key { padding-top: 7px; border-top: 1px dashed #b8a77f; color: var(--muted); font-size: 12px; font-weight: 800; text-align: right; }
.pie-wrap { width: min(610px,100%); display: grid; grid-template-columns: 235px 1fr; align-items: center; gap: 28px; padding: 12px 24px; border: 1px solid #d7c89e; border-radius: 13px; background: rgba(255,255,255,.76); }.pie-wrap svg { width: 220px; height: 220px; filter: drop-shadow(0 5px 0 rgba(47,56,72,.15)); }.pie-legend { display: grid; gap: 12px; }.pie-legend span { display: flex; align-items: center; gap: 9px; font-weight: 900; }.pie-legend i { width: 17px; height: 17px; border-radius: 5px; }
.build-wrap { width: min(690px,100%); display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 15px; }.build-controls { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }.height-button { min-height: 44px; border: 2px solid #b7a77d; border-radius: 10px; background: white; box-shadow: 0 3px 0 #d7c9a5; font-weight: 1000; transition: transform 130ms ease-out, box-shadow 130ms ease-out, background 130ms ease-out; }.height-button:hover { transform: translateY(-2px); }.height-button:active,.height-button.is-selected { transform: translateY(2px); color: white; background: var(--teal); box-shadow: 0 1px 0 var(--teal-dark); }
.choice-grid { width: min(620px,100%); display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }.choice,.primary { min-height: 58px; border: 2px solid #9e926f; border-radius: 13px; background: white; box-shadow: 0 5px 0 #d2c49c; font-weight: 1000; transition: transform 140ms ease-out, box-shadow 140ms ease-out, border-color 140ms ease-out; }.choice { font-size: 24px; }.choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }.choice:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 7px 0 #b9d4cf; }.choice:active { transform: translateY(4px); box-shadow: 0 1px 0 #b9d4cf; }.primary { min-width: 220px; padding: 0 24px; border-color: var(--teal-dark); color: white; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); font-size: 16px; }.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--teal-dark); }.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }.primary.is-gold { border-color: #8f5b13; color: #3a2913; background: var(--gold); box-shadow: 0 6px 0 #a76b14; }.explain-grid .choice { padding: 7px 11px; font-size: 13px; }
.clue-burst { position: absolute; z-index: 20; left: 86px; top: 44%; width: 245px; opacity: 0; transform: translate(-50%,-50%) scale(.35) rotate(-10deg); pointer-events: none; filter: drop-shadow(0 8px 6px rgba(0,0,0,.4)); }
.toast { position: absolute; z-index: 30; left: 57%; bottom: 35px; max-width: 68%; padding: 10px 17px; opacity: 0; transform: translate(-50%,12px); border-radius: 999px; color: white; background: #14263c; box-shadow: 0 5px 0 rgba(0,0,0,.25); pointer-events: none; font-size: 13px; font-weight: 900; transition: opacity 150ms ease-out, transform 150ms ease-out; }.toast.is-showing { opacity: 1; transform: translate(-50%,0); }
.bureau.is-celebrating .clue-burst { animation: burst 760ms ease-out both; }.bureau.is-celebrating .mascot { animation: mascot-pop 650ms ease-out; }.bureau.is-miss .case-board { animation: gentle-shake 330ms ease-out; }.bureau.is-inspecting .pic-icon,.bureau.is-inspecting .bar.is-focus { animation: inspect-pop 420ms ease-out both; }
@keyframes burst { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.25) rotate(-10deg); } 40% { opacity: 1; } 75% { opacity: 1; transform: translate(-50%,-50%) scale(1.08) rotate(4deg); } 100% { opacity: 0; transform: translate(-50%,-58%) scale(1.2) rotate(8deg); } }
@keyframes mascot-pop { 35% { transform: translateY(-11px) rotate(3deg) scale(1.06); } 70% { transform: translateY(1px) rotate(-2deg); } }
@keyframes gentle-shake { 25% { transform: translateX(-5px) rotate(-.3deg); } 55% { transform: translateX(5px) rotate(.3deg); } 80% { transform: translateX(-2px); } }
@keyframes inspect-pop { 50% { transform: scale(1.16); } }
@media (max-height: 730px) { .case-hud { top: 11px; }.detective-desk,.case-board { top: 88px; bottom: 17px; }.case-board { padding-top: 18px; padding-bottom: 17px; }.chart-stage { min-height: 190px; }.chart-paper { min-height: 190px; }.chart-paper svg { min-height: 176px; }.mascot { bottom: 91px; max-height: 64%; }.speech { bottom: 68px; }.suspects { height: 52px; }.action-area { min-height: 66px; }.choice,.primary { min-height: 52px; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
