:root {
  color-scheme: dark;
  --night: #07131d;
  --ink: #17242a;
  --paper: #f5e9cb;
  --paper-deep: #e2cea2;
  --teal: #0c6f70;
  --teal-bright: #24b6a8;
  --burgundy: #8d2e3b;
  --red: #c84b4b;
  --gold: #f0bd5a;
  --cream: #fff7df;
  --muted: #74674f;
  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: 650px; overflow: hidden; }
body { margin: 0; color: var(--cream); background: var(--night); }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #62e7d5; 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; }
.office { position: relative; height: 100%; min-height: 620px; overflow: hidden; isolation: isolate; border: 1px solid #31414a; border-radius: 25px; background: #0b1822 url("art/noir-office-01.webp") center / cover no-repeat; box-shadow: 0 9px 0 #03090e, 0 25px 60px rgba(0,0,0,.48); }
.world-shade { position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg,rgba(3,9,15,.2),rgba(3,12,19,.08) 30%,rgba(4,10,16,.36)), linear-gradient(0deg,rgba(3,10,15,.34),transparent 45%); }
.rain { position: absolute; z-index: -1; left: 0; top: 0; width: 30%; height: 57%; opacity: .23; transform: skewX(-9deg); background: repeating-linear-gradient(90deg,transparent 0 24px,rgba(144,217,238,.44) 25px 27px,transparent 28px 48px); animation: rain 1.5s linear infinite; }

.case-hud { position: absolute; z-index: 12; left: 22px; right: 22px; top: 18px; height: 67px; display: grid; grid-template-columns: 215px 1fr auto auto; align-items: center; gap: 15px; }
.agency-card,.case-track,.difficulty,.scoreboard { border: 1px solid rgba(240,189,90,.25); background: rgba(6,20,29,.9); box-shadow: 0 5px 0 rgba(0,0,0,.3); backdrop-filter: blur(12px); }
.agency-card { height: 67px; display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 8px; border-radius: 15px; }
.agency-card img { width: 49px; height: 49px; object-fit: contain; transform: rotate(-12deg); filter: drop-shadow(0 4px 3px rgba(0,0,0,.3)); }
.agency-card span,.difficulty span,.scoreboard span { display: block; color: #9cb2b9; font-size: 10px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.agency-card strong { display: block; margin-top: 3px; font-size: 16px; }
.case-track { justify-self: center; display: flex; align-items: center; padding: 9px 12px; border-radius: 999px; }
.case-track i { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid #63747a; border-radius: 50%; color: #9babb0; font-style: normal; font-size: 9px; font-weight: 1000; }
.case-track i.is-current { border-color: var(--gold); color: #142127; background: var(--gold); box-shadow: 0 0 0 5px rgba(240,189,90,.13); }
.case-track i.is-solved { border-color: var(--teal-bright); color: #06211e; background: var(--teal-bright); }
.case-track b { width: 8px; height: 2px; background: #485a60; }
.difficulty { width: 190px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 13px; border-radius: 14px; }
.difficulty span b { color: var(--gold); font-size: 14px; }.difficulty strong { color: #d9e3e4; font-size: 11px; }
.difficulty > i { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 9px; background: #304249; }
.difficulty > i b { display: block; height: 100%; width: 18%; border-radius: inherit; background: linear-gradient(90deg,var(--teal-bright),var(--gold),var(--red)); transition: width 220ms ease-out; }
.scoreboard { height: 67px; display: flex; align-items: stretch; padding: 6px; border-radius: 14px; }
.scoreboard > div { min-width: 61px; display: grid; place-content: center; padding: 0 9px; text-align: center; }
.scoreboard > div + div { border-left: 1px solid #304149; }.scoreboard strong { display: block; margin-top: 2px; color: var(--gold); font-size: 20px; line-height: 1; }.scoreboard strong b { font: inherit; }

.case-desk { position: absolute; z-index: 3; left: 22px; right: 22px; top: 102px; bottom: 22px; display: grid; grid-template-columns: 245px minmax(620px,1fr); gap: 18px; }
.detective-zone { position: relative; overflow: hidden; border: 1px solid rgba(240,189,90,.22); border-radius: 20px; background: linear-gradient(180deg,rgba(8,24,34,.55),rgba(5,16,23,.88)); box-shadow: 0 8px 0 rgba(0,0,0,.28); }
.speech { position: relative; z-index: 3; margin: 18px 15px 0; padding: 12px 13px; border: 2px solid #9a7c43; border-radius: 14px; color: #243138; background: var(--paper); box-shadow: 0 5px 0 rgba(0,0,0,.22); font-family: Georgia,serif; font-size: 13px; font-weight: 700; line-height: 1.25; text-align: center; }
.speech::after { position: absolute; left: 50%; bottom: -10px; width: 17px; height: 17px; content: ""; transform: translateX(-50%) rotate(45deg); border-right: 2px solid #9a7c43; border-bottom: 2px solid #9a7c43; background: var(--paper); }
.mascot { position: absolute; z-index: 2; left: -19px; bottom: 5px; width: 275px; height: 76%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 12px 12px rgba(0,0,0,.46)); transform-origin: 52% 85%; transition: transform 170ms ease-out, filter 170ms ease-out; }
.folder-prop { position: absolute; z-index: 1; left: 41px; bottom: -38px; width: 180px; transform: rotate(-4deg); opacity: .9; filter: drop-shadow(0 8px 5px rgba(0,0,0,.4)); }
.office.is-thinking .mascot { transform: rotate(-2deg) translateY(-4px); }.office.is-cheering .mascot { transform: translateY(-15px) rotate(3deg) scale(1.045); filter: drop-shadow(0 0 17px rgba(240,189,90,.54)); }.office.is-miss .mascot { animation: mascot-wince 280ms ease-out; }

.case-file { position: relative; display: grid; grid-template-rows: auto minmax(210px,1fr) auto auto; min-height: 0; padding: 23px 29px 25px; overflow: hidden; border: 1px solid #c3a86b; border-radius: 18px 18px 23px 18px; color: var(--ink); background: linear-gradient(rgba(255,247,223,.97),rgba(238,220,179,.98)), repeating-linear-gradient(0deg,transparent 0 26px,rgba(100,78,43,.06) 27px 28px); box-shadow: 0 8px 0 #7a5f32, 0 21px 45px rgba(0,0,0,.36); }
.case-file::before { position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; content: ""; background: rgba(184,76,63,.28); }
.case-heading { display: flex; justify-content: space-between; gap: 20px; padding-left: 12px; }
.case-heading span { color: var(--burgundy); font-size: 10px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.case-heading h1 { margin: 5px 0 4px; font-family: Georgia,"Times New Roman",serif; font-size: clamp(27px,3vw,41px); line-height: 1; letter-spacing: -.035em; }.case-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.stamp { align-self: start; min-width: 82px; margin: 4px 3px 0 0; padding: 7px 9px; transform: rotate(5deg); border: 3px solid var(--burgundy); border-radius: 8px; color: var(--burgundy); font-size: 17px; font-weight: 1000; letter-spacing: .1em; text-align: center; opacity: .82; }
.stamp.is-solved { color: var(--teal); border-color: var(--teal); transform: rotate(-5deg) scale(1.08); }

.evidence-stage { min-height: 0; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 13px 8px 8px; }
.number-suspect { position: relative; width: 168px; height: 168px; flex: 0 0 auto; display: grid; place-items: center; border: 3px solid #18343b; border-radius: 50%; color: var(--cream); background: radial-gradient(circle at 35% 30%,#217f80,var(--teal) 49%,#063d42 100%); box-shadow: inset 0 0 0 9px rgba(255,255,255,.08),0 8px 0 #173f42,0 15px 23px rgba(35,32,20,.22); font-family: Georgia,serif; font-size: 76px; font-weight: 900; text-shadow: 0 4px rgba(0,0,0,.24); }
.number-suspect::after { position: absolute; inset: -13px; content: ""; border: 3px dashed rgba(141,46,59,.45); border-radius: 50%; animation: rotate 16s linear infinite; }
.factor-board { min-width: 330px; display: grid; gap: 10px; }
.factor-pair { min-height: 54px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 13px; padding: 8px 16px; border: 2px solid #a99160; border-radius: 13px; background: rgba(255,255,255,.45); box-shadow: 0 4px 0 rgba(90,66,31,.12); text-align: center; font-size: 24px; font-weight: 1000; }
.factor-pair span { color: var(--burgundy); font-size: 16px; }.factor-pair.is-new { animation: evidence-pop 330ms cubic-bezier(.2,.9,.3,1.3); border-color: var(--teal); background: #d8eee2; }
.fingerprint { width: 225px; padding: 17px 19px; border: 2px dashed #977d4a; border-radius: 20px; background: rgba(255,255,255,.3); text-align: center; }.fingerprint b { display: block; font-family: Georgia,serif; font-size: 34px; }.fingerprint span { color: var(--muted); font-size: 12px; font-weight: 800; }
.sieve-wrap { width: min(720px,100%); }.sieve-note { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.number-grid { display: grid; grid-template-columns: repeat(10,1fr); gap: 7px; }
.grid-number { position: relative; min-height: 43px; display: grid; place-items: center; border: 2px solid #a89162; border-radius: 9px; color: #2b3537; background: rgba(255,255,255,.62); box-shadow: 0 3px 0 rgba(76,58,32,.14); font-weight: 1000; transition: transform 160ms ease-out,opacity 180ms ease-out,background 180ms ease-out; }
.grid-number.is-crossed { opacity: .35; transform: scale(.88); background: #cdbf9e; text-decoration: line-through 3px var(--burgundy); }.grid-number.is-prime { border-color: var(--teal); color: #064843; background: #bce7da; box-shadow: 0 3px 0 #72aa9c; }.grid-number.is-focus { box-shadow: 0 0 0 4px rgba(200,75,75,.22),0 3px 0 #8c6b39; }
.practice-card { min-width: 430px; display: flex; align-items: center; justify-content: center; gap: 22px; }.practice-copy { max-width: 280px; }.practice-copy span { color: var(--burgundy); font-size: 11px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }.practice-copy strong { display: block; margin-top: 7px; font-family: Georgia,serif; font-size: 27px; line-height: 1.05; }

.deduction { min-height: 29px; display: grid; place-items: center; color: #15584e; font-size: 14px; font-weight: 900; text-align: center; }.deduction.is-error { color: var(--burgundy); }
.action-area { min-height: 78px; display: flex; align-items: center; justify-content: center; gap: 11px; }
.choice-row { width: min(650px,100%); display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; }
.choice,.primary { min-height: 58px; border: 2px solid #8c7548; border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.7); box-shadow: 0 5px 0 #b7a274; font-weight: 1000; transition: transform 130ms ease-out,box-shadow 130ms ease-out,border-color 130ms ease-out; }
.choice { padding: 8px 12px; font-size: 18px; }.choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }.choice:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 7px 0 #9bb9a6; }.choice:active { transform: translateY(4px); box-shadow: 0 1px 0 #9bb9a6; }
.primary { min-width: 230px; padding: 0 23px; border-color: #063f42; color: white; background: var(--teal); box-shadow: 0 6px 0 #063f42; font-size: 15px; }.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #063f42; }.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #063f42; }.primary.is-red { border-color: #67202a; background: var(--burgundy); box-shadow: 0 6px 0 #67202a; }
.flash { position: absolute; z-index: 30; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle at 68% 55%,rgba(255,232,167,.58),transparent 40%); }.office.is-flashing .flash { animation: flash 420ms ease-out; }
.confetti { position: absolute; z-index: 31; left: 72%; top: 54%; pointer-events: none; }.confetti i { position: absolute; width: 12px; height: 18px; opacity: 0; border-radius: 3px; background: var(--gold); }.confetti i:nth-child(even){background:var(--teal-bright)}.confetti i:nth-child(3n){background:var(--red)}.office.is-cheering .confetti i { animation: confetti 680ms ease-out both; }.confetti i:nth-child(1){--x:-120px;--y:-100px}.confetti i:nth-child(2){--x:95px;--y:-120px;animation-delay:50ms}.confetti i:nth-child(3){--x:150px;--y:-25px;animation-delay:90ms}.confetti i:nth-child(4){--x:-155px;--y:15px;animation-delay:120ms}.confetti i:nth-child(5){--x:60px;--y:105px;animation-delay:160ms}.confetti i:nth-child(6){--x:-65px;--y:110px;animation-delay:190ms}.confetti i:nth-child(7){--x:10px;--y:-145px;animation-delay:220ms}.confetti i:nth-child(8){--x:-105px;--y:-40px;animation-delay:250ms}
.toast { position: absolute; z-index: 50; left: 60%; bottom: 35px; max-width: 64%; padding: 10px 17px; opacity: 0; transform: translate(-50%,12px); border: 1px solid #61737a; border-radius: 999px; color: white; background: #07151e; box-shadow: 0 6px 15px rgba(0,0,0,.35); 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); }

@keyframes rain { to { background-position: 48px 30px; } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes evidence-pop { from { opacity: 0; transform: scale(.65) rotate(-3deg); } }
@keyframes mascot-wince { 35% { transform: translateX(-7px) rotate(-3deg); } 70% { transform: translateX(5px) rotate(2deg); } }
@keyframes flash { 35% { opacity: 1; } }
@keyframes confetti { 0% { opacity: 0; transform: translate(0,0) rotate(0) scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x),var(--y)) rotate(260deg) scale(1); } }
@media (max-height: 740px) { .case-hud { top: 12px; }.case-desk { top: 89px; bottom: 16px; }.case-file { padding-top: 17px; padding-bottom: 17px; }.number-suspect { width: 135px; height: 135px; font-size: 61px; }.action-area { min-height: 66px; }.choice,.primary { min-height: 52px; }.mascot { height: 72%; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
