:root {
  color-scheme: light;
  --ink: #18233a;
  --muted: #667085;
  --paper: #f5f7f1;
  --panel: #fffefa;
  --line: #d9dfd7;
  --blue: #2677d9;
  --blue-dark: #17549e;
  --gold: #f5bd27;
  --gold-dark: #b77a06;
  --green: #31995a;
  --green-dark: #1f6b3d;
  --coral: #e7684d;
  --shadow: 0 15px 35px rgba(42, 61, 49, .12), 0 3px 8px rgba(42, 61, 49, .07);
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 900px; min-height: 100%; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--paper); }
button { color: inherit; font: inherit; }
button:focus-visible { outline: 4px solid rgba(38,119,217,.28); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.lesson { position: relative; width: min(1440px, 100vw); height: 100vh; min-height: 720px; margin: 0 auto; padding: 18px 34px 24px; display: grid; grid-template-rows: minmax(0, 1fr) 176px; gap: 16px; }
.mute-button { position: absolute; z-index: 60; top: 30px; right: 48px; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #d5ddd5; border-radius: 50%; background: rgba(255,255,255,.94); box-shadow: 0 4px 0 #cfd7cf; cursor: pointer; }
.mute-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mute-button .sound-off, .mute-button[aria-pressed="true"] .sound-on { display: none; }
.mute-button[aria-pressed="true"] .sound-off { display: block; }

.lab { position: relative; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 190px minmax(420px, 1fr) 190px; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: #eef5f0; box-shadow: var(--shadow); }
.lab-grid { position: absolute; inset: 0; opacity: .48; background-image: linear-gradient(rgba(47,117,88,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(47,117,88,.055) 1px, transparent 1px); background-size: 30px 30px; pointer-events: none; }
.brief-card, .evidence-card { position: relative; z-index: 2; min-width: 0; padding: 22px 16px; border: 1px solid rgba(202,213,204,.9); border-radius: 17px; background: rgba(255,254,250,.94); box-shadow: 0 7px 0 rgba(74,104,82,.08); }
.brief-card { display: flex; flex-direction: column; }
.brief-card > span, .evidence-card header span, .idea-card span, .dice-copy span { color: var(--green-dark); font-size: 10px; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }
.brief-card h1 { margin: 8px 0 10px; font-size: 30px; line-height: 1.02; letter-spacing: -.04em; }
.brief-card > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.level-track { display: flex; gap: 8px; margin-top: 22px; }
.level-track i { width: 28px; height: 7px; border-radius: 999px; background: #d5ddd7; }
.level-track i.current { background: var(--blue); }
.level-track i.complete { background: var(--green); }
.idea-card { margin-top: auto; padding: 16px; border-radius: 13px; background: #edf5ff; border: 1px solid #cfe0f4; }
.idea-card p { margin: 6px 0 0; font-size: 13px; font-weight: 750; line-height: 1.4; }

.experiment-stage { position: relative; z-index: 2; min-width: 0; overflow: hidden; border: 1px solid #cbd9d0; border-radius: 20px; background: radial-gradient(circle at 50% 30%, #fff 0 10%, #f6fbf7 42%, #e3eee7 100%); }
.experiment-stage::after { position: absolute; left: 15%; right: 15%; bottom: 8%; height: 28px; content: ""; border-radius: 50%; background: rgba(47,70,55,.12); filter: blur(13px); }
.machine-view, .dice-view { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; }
.machine { position: relative; width: 365px; height: 500px; transform: translateY(4px); }
.machine-cap { position: absolute; z-index: 5; left: 75px; top: 20px; width: 216px; height: 30px; border: 4px solid #68777d; border-radius: 13px; background: linear-gradient(90deg,#87969b,#eef3f1 35%,#7d8b90 65%,#dbe2df); }
.chamber { position: absolute; z-index: 3; left: 50px; top: 40px; width: 266px; height: 178px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; padding: 28px; border: 6px solid #789ba9; border-radius: 70px 70px 42px 42px; background: linear-gradient(145deg,rgba(255,255,255,.92),rgba(169,217,230,.26)); box-shadow: inset 17px 10px rgba(255,255,255,.48), 0 13px 25px rgba(48,80,77,.16); }
.chamber.shake .marble { animation: shake 420ms ease-out; }
.marble, .drop-ball { border-radius: 50%; box-shadow: inset -8px -9px 11px rgba(0,0,0,.18), inset 7px 7px 8px rgba(255,255,255,.62), 0 4px 5px rgba(30,50,50,.2); }
.marble { width: 54px; height: 54px; }
.marble.blue, .drop-ball.blue { background: var(--blue); }
.marble.gold, .drop-ball.gold { background: var(--gold); }
.funnel { position: absolute; z-index: 2; left: 133px; top: 207px; width: 100px; height: 70px; clip-path: polygon(0 0,100% 0,64% 100%,36% 100%); background: linear-gradient(90deg,#8aa7b0,#eef8f8 50%,#76939e); }
.track { position: absolute; left: 106px; top: 272px; width: 155px; height: 150px; border-left: 18px solid #a5c5cf; border-bottom: 18px solid #a5c5cf; border-radius: 0 0 0 44px; transform: skewY(-11deg); }
.track::after { position: absolute; left: 0; bottom: -18px; width: 160px; height: 18px; content: ""; border-radius: 999px; background: #dff1f4; }
.track i { position: absolute; width: 16px; height: 16px; border: 3px solid #6f868d; border-radius: 50%; background: #d8e3e3; }
.track i:nth-child(1) { left: -17px; top: 25px; }.track i:nth-child(2) { left: -17px; top: 92px; }.track i:nth-child(3) { left: 87px; bottom: -17px; }
.drop-ball { position: absolute; z-index: 8; left: 170px; top: 198px; width: 44px; height: 44px; opacity: 0; }
.drop-ball.running { animation: drop-route 850ms cubic-bezier(.38,.05,.28,1) forwards; }
.tray { position: absolute; z-index: 4; left: 118px; bottom: 9px; width: 150px; height: 58px; display: grid; place-items: center; border: 5px solid #799ba8; border-radius: 12px 12px 50% 50%; background: rgba(221,243,247,.74); color: #52636a; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.lever { position: absolute; z-index: 6; right: 0; top: 192px; width: 60px; height: 185px; border: 5px solid #174f93; border-radius: 23px; background: var(--blue); }
.lever i { position: absolute; left: 19px; bottom: 35px; width: 18px; height: 158px; transform: rotate(-22deg); transform-origin: 50% 100%; border: 3px solid #66777c; border-radius: 999px; background: linear-gradient(90deg,#98a5a8,#f2f4f3,#7b878a); transition: transform 180ms ease-out; }
.lever i::before { position: absolute; left: 50%; top: -23px; width: 48px; height: 48px; content: ""; transform: translateX(-50%); border: 5px solid #237c44; border-radius: 50%; background: var(--green); }
.machine.running .lever i { transform: rotate(25deg); }
.odds-stamp { position: absolute; z-index: 10; right: 24px; top: 24px; padding: 10px 14px; transform: rotate(2deg); border: 2px solid var(--ink); border-radius: 9px; background: #fff8d8; box-shadow: 3px 3px 0 var(--ink); }
.odds-stamp span { display: block; color: var(--gold-dark); font-size: 9px; font-weight: 950; text-transform: uppercase; }
.odds-stamp strong { font-size: 12px; }
.result-flash { position: absolute; z-index: 20; left: 50%; top: 48%; min-width: 230px; padding: 15px 22px; transform: translate(-50%,-50%); border: 3px solid var(--ink); border-radius: 14px; background: white; box-shadow: 7px 7px 0 var(--ink); font-size: 20px; font-weight: 950; text-align: center; }

.dice-view { align-content: center; gap: 32px; padding: 40px; }
.dice-copy { text-align: center; }.dice-copy strong { display: block; margin-top: 7px; font-size: 25px; }
.dice-pair { display: flex; align-items: center; gap: 17px; font-size: 29px; }
.die { width: 104px; height: 104px; display: grid; place-items: center; border: 4px solid var(--ink); border-radius: 22px; background: white; box-shadow: 0 9px 0 #cbd4cf; font-size: 68px; line-height: 1; }
.dice-view.running .die { animation: dice-wiggle 160ms linear 5; }
.sum-chip { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 39px; font-weight: 950; }
.ways-row { width: min(540px,100%); display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; font-weight: 850; }
.ways-row i { height: 2px; background: #aebbb4; }.ways-row strong { color: var(--green-dark); font-size: 11px; }

.evidence-card { display: flex; flex-direction: column; }
.evidence-card header { min-height: 53px; }.evidence-card header strong { display: block; margin-top: 5px; font-size: 20px; }
.color-chart { flex: 1; min-height: 280px; display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 20px; padding: 24px 4px 8px; }
.color-column { display: grid; grid-template-rows: 1fr auto auto; align-items: end; justify-items: center; gap: 5px; height: 100%; }
.bar-well { width: 54px; height: 100%; min-height: 180px; display: flex; align-items: end; overflow: hidden; border-radius: 12px 12px 5px 5px; background: #e8ece9; }
.bar-well i { width: 100%; height: 0; transition: height 430ms cubic-bezier(.2,.8,.2,1); }
.blue-column .bar-well i { background: var(--blue); }.gold-column .bar-well i { background: var(--gold); }
.color-column strong { font-size: 23px; }.color-column span { color: var(--muted); font-size: 11px; font-weight: 900; }
.evidence-card > p { min-height: 58px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }
.dice-chart { flex: 1; min-height: 330px; display: grid; grid-template-columns: repeat(11,1fr); align-items: end; gap: 3px; padding: 20px 0 8px; }
.sum-bar { height: 100%; display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 5px; }
.sum-bar i { width: 100%; min-height: 2px; border-radius: 4px 4px 1px 1px; background: var(--blue); transition: height 420ms ease-out; }.sum-bar:nth-child(6) i { background: var(--green); }
.sum-bar span { color: var(--muted); font-size: 9px; font-weight: 900; text-align: center; }

.level-intro, .finale { position: absolute; z-index: 40; left: 50%; top: 50%; width: 540px; min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 38px 52px; transform: translate(-50%,-50%); border: 1px solid #d7dfd8; border-radius: 22px; background: rgba(255,255,252,.98); box-shadow: 0 18px 0 rgba(47,91,60,.11), 0 34px 70px rgba(36,70,47,.2); text-align: center; }
.level-intro::before, .finale::before { position: absolute; inset: 10px; content: ""; border: 2px dashed #d0dbd2; border-radius: 15px; pointer-events: none; }
.level-intro > span, .finale > span { z-index: 1; color: var(--green-dark); font-size: 10px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.intro-number { z-index: 1; width: 70px; height: 70px; display: grid; place-items: center; margin: 11px 0; transform: rotate(-4deg); border: 3px solid var(--ink); border-radius: 17px; background: var(--gold); box-shadow: 5px 5px 0 var(--ink); font-size: 27px; font-weight: 1000; }
.level-intro h2, .finale h2 { z-index: 1; margin: 6px 0 10px; font-size: 40px; line-height: 1.02; letter-spacing: -.045em; }
.level-intro p, .finale p { z-index: 1; max-width: 420px; margin: 0 0 23px; color: var(--muted); font-size: 15px; line-height: 1.48; }
.level-intro button, .finale button, .primary-button { min-height: 52px; padding: 0 24px; border: 2px solid var(--green-dark); border-radius: 12px; color: white; background: var(--green); box-shadow: 0 6px 0 var(--green-dark); cursor: pointer; font-weight: 950; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.level-intro button, .finale button { z-index: 1; min-width: 220px; }.level-intro button:hover, .finale button:hover, .primary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--green-dark); }
.finale { width: 650px; min-height: 430px; background: #fffdf0; }.finale h2 { font-size: 43px; }.finale-orbit { z-index: 1; display: flex; gap: 11px; margin-bottom: 15px; }.finale-orbit i { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); box-shadow: inset -5px -5px rgba(0,0,0,.13); animation: orbit-bounce 700ms ease-in-out infinite alternate; }.finale-orbit i:nth-child(2),.finale-orbit i:nth-child(4) { background: var(--gold); animation-delay: 180ms; }

.decision-card { min-width: 0; display: grid; grid-template-columns: 300px minmax(0,1fr); align-items: center; gap: 20px; padding: 22px 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 6px 0 #e0e5df; }
.decision-card[hidden] { display: none; }.decision-copy span { color: var(--green-dark); font-size: 10px; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }.decision-copy h2 { margin: 6px 0 0; font-size: 25px; line-height: 1.12; letter-spacing: -.025em; }
.decision-content { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 11px; }
.choice-grid { width: 100%; display: grid; grid-template-columns: repeat(var(--choices,3),minmax(0,1fr)); gap: 11px; }
.choice-button { min-height: 104px; padding: 13px 14px; border: 2px solid #d2dad4; border-radius: 13px; background: #fbfcfa; cursor: pointer; text-align: left; transition: transform 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out; }.choice-button:hover { transform: translateY(-3px); border-color: var(--blue); box-shadow: 0 5px 0 #d5e3f1; }.choice-button strong { display: block; font-size: 17px; }.choice-button small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.3; }.choice-button .swatch { width: 29px; height: 29px; display: block; margin-bottom: 8px; border-radius: 50%; box-shadow: inset -4px -4px rgba(0,0,0,.14); }.swatch.blue { background: var(--blue); }.swatch.gold { background: var(--gold); }.swatch.pattern { border-radius: 7px; background: linear-gradient(90deg,var(--blue) 0 70%,var(--gold) 70%); }
.run-button { width: min(520px,100%); min-height: 104px; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px 30px; border: 3px solid var(--green-dark); border-radius: 16px; color: white; background: var(--green); box-shadow: 0 9px 0 var(--green-dark); cursor: pointer; }.run-button b { font-size: 30px; }.run-button span { font-size: 18px; font-weight: 950; }.run-button small { display: block; opacity: .8; font-size: 10px; text-transform: uppercase; }
.observe-message { display: flex; align-items: center; gap: 14px; color: var(--green-dark); font-size: 18px; font-weight: 950; }.observe-message i { width: 18px; height: 18px; border-radius: 50%; background: var(--green); animation: pulse 500ms ease-in-out infinite alternate; }
.result-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }.result-copy { display: flex; align-items: center; gap: 13px; }.result-copy > i { width: 54px; height: 54px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--gold); font-style: normal; font-size: 24px; font-weight: 950; }.result-copy strong { display: block; font-size: 19px; }.result-copy p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }.primary-button { flex: 0 0 auto; }

@keyframes shake { 0%,100%{transform:translate(0)} 25%{transform:translate(-5px,-7px)} 50%{transform:translate(6px,-3px)} 75%{transform:translate(-3px,4px)} }
@keyframes drop-route { 0%{opacity:1;transform:translate(0,0)} 25%{opacity:1;transform:translate(-50px,100px)} 55%{opacity:1;transform:translate(-50px,205px)} 82%{opacity:1;transform:translate(60px,235px)} 100%{opacity:0;transform:translate(60px,260px)} }
@keyframes dice-wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-5deg) translateY(-5px)} 75%{transform:rotate(5deg) translateY(3px)} }
@keyframes pulse { from{transform:scale(.7);opacity:.5} to{transform:scale(1.2);opacity:1} }
@keyframes orbit-bounce { from{transform:translateY(0)} to{transform:translateY(-10px)} }

@media (max-height: 780px) { .lesson { grid-template-rows: minmax(0,1fr) 158px; padding-top: 12px; }.lab { padding: 18px; }.machine { transform: scale(.86); }.decision-card { padding-top: 16px; padding-bottom: 16px; }.choice-button { min-height: 88px; }.level-intro { min-height: 350px; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
