:root {
  color-scheme: light;
  --ink: #14243a;
  --muted: #667386;
  --paper: #f4f1e8;
  --panel: #fffdf7;
  --navy: #12283f;
  --cyan: #32d7d2;
  --cyan-dark: #087e84;
  --coral: #ff6b54;
  --yellow: #ffd447;
  --green: #4aaa68;
  --line: #d9ddd5;
  font-family: "Avenir Next", Avenir, "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 1100px; min-height: 100%; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--paper); }
button { color: inherit; font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
:focus-visible { outline: 4px solid rgba(50, 215, 210, .42); 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 { width: min(1360px, calc(100vw - 54px)); height: calc(100vh - 38px); min-height: 700px; margin: 19px auto; display: grid; grid-template-rows: minmax(0, 1fr) 196px; gap: 16px; }
.studio { position: relative; min-height: 0; overflow: hidden; border: 2px solid var(--ink); border-radius: 24px; background: var(--navy); box-shadow: 0 9px 0 rgba(20,36,58,.16); }
.studio::before { position: absolute; inset: 0; content: ""; opacity: .35; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.studio-lights { position: absolute; z-index: 2; left: 22px; top: 20px; display: flex; gap: 8px; }
.studio-lights i { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 12px rgba(255,107,84,.65); }
.studio-lights i:nth-child(2) { background: var(--yellow); box-shadow: 0 0 12px rgba(255,212,71,.65); }
.studio-lights i:nth-child(3) { background: var(--green); box-shadow: 0 0 12px rgba(74,170,104,.65); }
.mute { position: absolute; z-index: 20; right: 20px; top: 16px; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; color: white; background: rgba(255,255,255,.1); transition: transform 150ms ease-out, background 150ms ease-out; }
.mute:hover { transform: translateY(-2px); background: rgba(255,255,255,.17); }
.mute svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sound-off { display: none; }
.mute[aria-pressed="true"] .sound-on { display: none; }
.mute[aria-pressed="true"] .sound-off { display: block; }

.evidence-strip { position: absolute; z-index: 3; left: 50%; top: 14px; display: flex; gap: 10px; transform: translateX(-50%); }
.evidence-chip { min-width: 180px; padding: 7px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; color: white; background: rgba(255,255,255,.08); text-align: center; }
.evidence-chip span { display: block; color: #9eb0bf; font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.evidence-chip strong { display: block; margin-top: 1px; font-size: 18px; }
.evidence-chip small { color: #9eb0bf; font-size: 10px; }

.scope-wrap { position: absolute; z-index: 2; inset: 80px 24px 24px; overflow: hidden; border: 1px solid rgba(117,235,229,.45); border-radius: 18px; background: #081b2c; box-shadow: inset 0 0 45px rgba(0,0,0,.3); }
.scope-wrap::before { position: absolute; inset: 0; content: ""; opacity: .22; background-image: linear-gradient(rgba(83,200,200,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(83,200,200,.35) 1px, transparent 1px); background-size: 46px 46px; }
#waveCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scope-label { position: absolute; z-index: 3; left: 22px; top: 18px; color: var(--cyan); }
.scope-label span { display: block; font-size: 10px; font-weight: 950; letter-spacing: .12em; }
.scope-label b { display: block; margin-top: 3px; color: #9eb0bf; font-size: 11px; font-weight: 700; }
.wave-tags span { position: absolute; z-index: 3; padding: 5px 9px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; color: white; background: rgba(8,27,44,.82); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.height-tag { left: 20px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.spacing-tag { left: 50%; bottom: 18px; transform: translateX(-50%); }
.scope-wrap.is-highlighted { animation: scope-pulse 560ms ease-out 3; }
.speaker { position: absolute; z-index: 4; right: 28px; bottom: 22px; width: 100px; height: 130px; border: 3px solid #8da3b2; border-radius: 14px; background: #1b344a; box-shadow: 0 7px 0 #06121e; }
.speaker::before, .speaker::after { position: absolute; left: 50%; content: ""; transform: translateX(-50%); border: 3px solid #04111d; border-radius: 50%; background: #233e55; }
.speaker::before { top: 12px; width: 28px; height: 28px; }
.speaker::after { bottom: 11px; width: 58px; height: 58px; box-shadow: inset 0 0 0 9px #10283d; }
.speaker i { position: absolute; z-index: 2; left: 50%; bottom: 33px; width: 13px; height: 13px; transform: translateX(-50%); border-radius: 50%; background: var(--cyan); }
.speaker.is-playing::after { animation: speaker-pump 170ms ease-in-out infinite alternate; }

.mystery-card { position: absolute; z-index: 5; left: 42px; bottom: 42px; width: 190px; padding: 14px 16px; border: 2px solid var(--yellow); border-radius: 14px; color: white; background: rgba(18,40,63,.94); box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.mystery-card span { color: var(--yellow); font-size: 9px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.mystery-card strong { display: block; margin-top: 3px; font-size: 20px; }
.mystery-card p { margin: 4px 0 0; color: #b9c6d0; font-size: 11px; line-height: 1.3; }

.level-intro, .finale { position: absolute; z-index: 30; left: 50%; top: 50%; width: 520px; min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px 48px; transform: translate(-50%,-50%); border: 2px solid var(--ink); border-radius: 24px; background: rgba(255,253,247,.98); box-shadow: 0 13px 0 rgba(0,0,0,.22), 0 25px 60px rgba(0,0,0,.28); text-align: center; }
.intro-disc { width: 70px; height: 70px; display: grid; place-items: center; margin-bottom: 14px; border: 3px solid var(--ink); border-radius: 50%; color: var(--ink); background: var(--yellow); box-shadow: 5px 5px 0 var(--ink); font-size: 28px; font-weight: 1000; }
.level-intro > span, .finale > span { color: var(--cyan-dark); font-size: 10px; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
.level-intro h1, .finale h1 { margin: 7px 0 9px; font-size: 40px; line-height: 1.02; letter-spacing: -.035em; }
.level-intro p, .finale p { max-width: 410px; margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.level-intro button, .finale button { min-width: 240px; min-height: 54px; padding: 0 22px; border: 2px solid var(--ink); border-radius: 12px; color: white; background: var(--green); box-shadow: 0 6px 0 #276d3d; font-weight: 950; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.level-intro button:hover, .finale button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #276d3d; }
.finale { background: #fffaf0; }
.finale-rings { position: relative; width: 102px; height: 102px; margin-bottom: 8px; }
.finale-rings i { position: absolute; inset: 35px; border: 5px solid var(--coral); border-radius: 50%; }
.finale-rings i:nth-child(2) { inset: 20px; border-color: var(--yellow); }
.finale-rings i:nth-child(3) { inset: 4px; border-color: var(--cyan); }
.finale-rings { animation: finale-pop 600ms ease-out; }
.callout { position: absolute; z-index: 18; left: 50%; bottom: 40px; max-width: 75%; padding: 10px 18px; opacity: 0; transform: translate(-50%, 12px); border-radius: 999px; color: var(--ink); background: var(--yellow); font-size: 13px; font-weight: 950; transition: opacity 150ms ease-out, transform 150ms ease-out; pointer-events: none; }
.callout.show { opacity: 1; transform: translate(-50%, 0); }

.decision { min-height: 0; display: grid; grid-template-columns: minmax(320px, .7fr) minmax(0, 1.5fr); align-items: center; gap: 30px; padding: 22px 24px 22px 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 6px 0 #deded5; }
.decision-copy > span { display: block; margin-bottom: 6px; color: var(--cyan-dark); font-size: 10px; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }
.decision-copy h2 { max-width: 450px; margin: 0; font-size: 27px; line-height: 1.12; letter-spacing: -.02em; }
.decision-copy p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.decision-actions { min-width: 0; display: flex; align-items: stretch; justify-content: center; gap: 12px; }
.choice { min-height: 104px; flex: 1 1 0; padding: 13px 17px; border: 2px solid #cdd5d1; border-radius: 14px; background: white; text-align: left; transition: transform 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out; }
.choice:hover { transform: translateY(-3px); border-color: var(--cyan-dark); box-shadow: 0 5px 0 #d3e8e5; }
.choice b { width: 37px; height: 37px; display: grid; place-items: center; margin-bottom: 7px; border-radius: 9px; color: white; background: var(--navy); font-size: 20px; }
.choice strong { display: block; font-size: 15px; }
.choice small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.test-button { width: min(520px, 100%); min-height: 108px; display: grid; grid-template-columns: 68px 1fr; align-items: center; padding: 14px 28px; border: 3px solid var(--ink); border-radius: 15px; color: var(--ink); background: var(--yellow); box-shadow: 0 8px 0 #b8880d; text-align: left; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.test-button:hover { transform: translateY(-3px); box-shadow: 0 11px 0 #b8880d; }
.test-button b { width: 54px; height: 54px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: white; font-size: 25px; }
.test-button strong { display: block; font-size: 23px; }
.test-button small { display: block; margin-top: 3px; font-size: 11px; font-weight: 750; }
.observing { min-height: 100px; display: flex; align-items: center; gap: 16px; color: var(--cyan-dark); font-size: 20px; font-weight: 950; }
.observing i { width: 20px; height: 20px; border-radius: 50%; background: var(--cyan); animation: observe-beat 450ms ease-in-out infinite alternate; }
.feedback { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.feedback-copy { display: flex; align-items: center; gap: 14px; }
.feedback-mark { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); font-size: 24px; font-weight: 1000; }
.feedback strong { display: block; font-size: 18px; }
.feedback p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.primary { min-height: 58px; padding: 0 24px; border: 2px solid var(--ink); border-radius: 12px; color: white; background: var(--green); box-shadow: 0 5px 0 #276d3d; font-weight: 950; }
.choice.is-wrong { border-color: var(--coral); animation: shake 250ms ease-out; }

@keyframes speaker-pump { from { transform: translateX(-50%) scale(.92); } to { transform: translateX(-50%) scale(1.07); } }
@keyframes observe-beat { from { transform: scale(.65); opacity: .55; } to { transform: scale(1.12); opacity: 1; } }
@keyframes scope-pulse { 0%,100% { box-shadow: inset 0 0 45px rgba(0,0,0,.3); } 50% { box-shadow: inset 0 0 45px rgba(0,0,0,.3), 0 0 0 5px rgba(50,215,210,.5); } }
@keyframes finale-pop { from { transform: scale(.4) rotate(-18deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 35% { transform: translateX(-7px); } 70% { transform: translateX(7px); } }

@media (max-height: 780px) {
  .lesson { height: calc(100vh - 24px); min-height: 680px; margin: 12px auto; grid-template-rows: minmax(0, 1fr) 182px; gap: 12px; }
  .scope-wrap { inset: 70px 20px 20px; }
  .evidence-strip { top: 8px; }
  .mute { top: 9px; }
  .decision { padding-block: 16px; }
}

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