:root {
  color-scheme: light;
  --ink: #15333a;
  --muted: #63777a;
  --cream: #fffdf7;
  --mint: #dff6f2;
  --teal: #168f99;
  --teal-dark: #08646f;
  --cyan: #4ac6dc;
  --coral: #f06d58;
  --coral-dark: #b94439;
  --gold: #e7ae45;
  --blue: #2476c9;
  --energy: 12%;
  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: 1080px; min-height: 700px; overflow: hidden; }
body { margin: 0; color: var(--ink); background: #cceeed; }
button { color: inherit; font: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #075fbd; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.lesson { position: relative; width: 100%; height: 100%; padding: 18px; overflow: hidden; }
.world { position: absolute; inset: -20px; background: linear-gradient(rgba(226,249,246,.76), rgba(240,251,247,.84)), url("./assets/forge-world-01.webp") center / cover no-repeat; filter: saturate(.82) blur(2px); transform: scale(1.03); }
.game-shell { position: relative; width: min(1240px, calc(100% - 16px)); height: min(850px, calc(100% - 8px)); margin: 0 auto; display: grid; grid-template-rows: 68px minmax(0,1fr) 190px; overflow: hidden; border: 1px solid rgba(255,255,255,.82); border-radius: 30px; background: rgba(249,255,252,.72); box-shadow: 0 24px 80px rgba(25,72,74,.18), inset 0 1px rgba(255,255,255,.9); backdrop-filter: blur(14px); }

.hud { z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 22px 0 26px; border-bottom: 1px solid rgba(21,51,58,.08); background: rgba(255,255,255,.58); }
.mission-mark { display: flex; align-items: center; gap: 11px; }
.mission-dot { width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--coral-dark); }
.mission-mark div { display: grid; gap: 1px; }
.mission-mark small, .practice-stats small { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.mission-mark strong { font-size: 15px; }
.practice-stats { display: flex; align-items: center; gap: 8px; margin-left: auto; margin-right: 12px; }
.practice-stats > span { min-width: 70px; display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 10px; padding: 8px 12px; border-radius: 13px; background: rgba(255,255,255,.78); }
.practice-stats b { grid-row: 1 / span 2; grid-column: 2; color: var(--teal-dark); font-size: 20px; }
.practice-stats .difficulty { width: 220px; grid-template-columns: 1fr auto; }
.difficulty i { height: 6px; overflow: hidden; border-radius: 99px; background: #d6e6e2; }
.difficulty em { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--coral)); transition: width 450ms ease-out; }
.mute-button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: white; box-shadow: 0 3px 0 #c8d9d5; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.mute-button:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #c8d9d5; }
.mute-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #c8d9d5; }
.mute-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sound-off { display: none; }
.mute-button[aria-pressed="true"] .sound-on { display: none; }
.mute-button[aria-pressed="true"] .sound-off { display: block; }

.playfield { position: relative; min-height: 0; overflow: hidden; isolation: isolate; }
.playfield::before { position: absolute; inset: 4% 6% 3%; z-index: -1; content: ""; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.92), rgba(255,255,255,.38) 55%, transparent 74%); }
.sticker-art, .sticker-prop { overflow: hidden; padding: 7px; border: 1px solid rgba(31,83,78,.1); border-radius: 26px; background: #fffdf7; box-shadow: 0 10px 26px rgba(35,70,68,.15); }
.sticker-art img, .sticker-prop img { display: block; width: 100%; border-radius: 19px; }
.thermal-prop { position: absolute; left: 36px; bottom: 16px; width: 185px; opacity: .92; transform: rotate(-3deg); }
.mascot { position: absolute; z-index: 8; right: 30px; bottom: 12px; width: 210px; pointer-events: none; transform-origin: 50% 80%; }
.speech { position: absolute; z-index: 2; right: 10px; top: -18px; max-width: 165px; padding: 9px 13px; border: 2px solid #bfdad5; border-radius: 16px 16px 5px 16px; background: rgba(255,255,255,.94); box-shadow: 0 5px 0 rgba(77,124,116,.12); font-size: 12px; font-weight: 850; line-height: 1.25; text-align: center; }
.mascot.is-happy { animation: mascot-hop 600ms cubic-bezier(.2,.85,.25,1.25); }
.mascot.is-oops { animation: mascot-wobble 420ms ease-out; }

.chamber-rig { position: absolute; left: 50%; top: 50%; width: min(650px, 55%); transform: translate(-50%,-50%); }
.energy-gauge { width: 78%; margin: 0 auto 12px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; color: #567276; font-size: 9px; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.energy-track { position: relative; height: 9px; border-radius: 99px; background: #d2e1de; box-shadow: inset 0 2px 3px rgba(16,67,69,.13); }
.energy-track i { display: block; width: var(--energy); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), #f4cf66, var(--coral)); transition: width 800ms cubic-bezier(.2,.8,.2,1); }
.energy-track b { position: absolute; left: var(--energy); top: 50%; width: 18px; height: 18px; transform: translate(-50%,-50%); border: 3px solid white; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--coral-dark); transition: left 800ms cubic-bezier(.2,.8,.2,1); }
.chamber { position: relative; height: 350px; overflow: hidden; border: 13px solid #d69f47; border-radius: 48px 48px 34px 34px; outline: 4px solid #8b6330; outline-offset: -10px; background: #e7f8ff; box-shadow: inset 0 0 0 4px rgba(255,255,255,.85), 0 10px 0 #9e7138, 0 24px 40px rgba(24,63,67,.16); }
.chamber::before, .chamber::after { position: absolute; z-index: 4; top: 50%; width: 26px; height: 108px; content: ""; transform: translateY(-50%); border: 4px solid #855f31; background: #e6b458; }
.chamber::before { left: -10px; border-radius: 0 18px 18px 0; }.chamber::after { right: -10px; border-radius: 18px 0 0 18px; }
#particleCanvas { display: block; width: 100%; height: 100%; }
.chamber-glint { position: absolute; left: 38px; top: 28px; width: 30%; height: 14%; transform: skewX(-22deg); border-top: 8px solid rgba(255,255,255,.62); border-radius: 50%; pointer-events: none; }
.readout { width: 72%; min-height: 52px; margin: -3px auto 0; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 9px 20px; border: 3px solid #8b6330; border-radius: 0 0 16px 16px; color: white; background: #176d76; box-shadow: 0 7px 0 #0c4b54; }
.readout span { font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .76; }
.readout strong { grid-row: 1 / span 2; grid-column: 2; font-size: 17px; }
.readout small { font-size: 11px; font-weight: 750; }
.heat-burst { position: absolute; left: 50%; bottom: -20px; display: flex; gap: 20px; transform: translateX(-50%); opacity: 0; }
.heat-burst i { width: 16px; height: 130px; border-radius: 99px; background: linear-gradient(0deg, var(--coral), #ffd66b 40%, transparent); }
.frost-burst { position: absolute; right: 30px; top: 28px; opacity: 0; color: #25a9d0; font-size: 90px; line-height: 1; }
.chamber.is-heating .heat-burst { animation: heat-rise 950ms ease-out; }
.chamber.is-cooling .frost-burst { animation: frost-pop 950ms ease-out; }
.chamber.is-focus { box-shadow: inset 0 0 0 4px white, 0 0 0 7px #f5cf62, 0 11px 0 #9e7138, 0 26px 40px rgba(24,63,67,.16); }
.chamber.is-demo canvas { filter: saturate(1.35) drop-shadow(0 0 4px white); }

.comparison { position: absolute; left: 50%; top: 50%; width: min(750px, 64%); height: 390px; display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; transform: translate(-50%,-50%); }
.comparison article { min-width: 0; display: grid; grid-template-rows: 1fr auto auto; padding: 10px 10px 13px; border-radius: 28px; background: rgba(255,255,255,.82); box-shadow: 0 8px 0 rgba(96,130,123,.15); text-align: center; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.comparison article.is-focus { transform: translateY(-6px); box-shadow: 0 14px 0 rgba(96,130,123,.13), 0 0 0 5px #f3c858; }
.comparison canvas { width: 100%; height: 100%; min-height: 270px; border: 8px solid #d6a44f; border-radius: 22px; background: #e8f8ff; box-shadow: inset 0 0 0 3px #8f6935; }
.comparison strong { margin-top: 7px; font-size: 19px; }.comparison span { color: var(--muted); font-size: 11px; font-weight: 800; }

.control-deck { z-index: 15; min-height: 0; display: grid; grid-template-columns: minmax(300px,.8fr) minmax(0,1.7fr); align-items: center; gap: 34px; padding: 22px 28px; border-top: 1px solid rgba(21,51,58,.08); background: rgba(255,255,255,.9); }
.challenge-copy span { color: var(--teal-dark); font-size: 10px; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.challenge-copy h1 { max-width: 420px; margin: 5px 0 6px; font-size: clamp(23px,2vw,29px); line-height: 1.08; letter-spacing: -.035em; }
.challenge-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.action-area { min-width: 0; display: flex; align-items: center; justify-content: center; }
.choice-grid { width: 100%; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.choice { min-height: 104px; display: grid; grid-template-columns: 47px 1fr; align-items: center; gap: 11px; padding: 12px 14px; border: 2px solid #d3e1de; border-radius: 18px; background: #fbfefd; box-shadow: 0 4px 0 #d7e4e1; 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: #64b6be; box-shadow: 0 7px 0 #d7e4e1; }.choice:active { transform: translateY(2px); box-shadow: 0 2px 0 #d7e4e1; }
.choice-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--teal); box-shadow: inset 0 -4px rgba(0,0,0,.12); font-size: 23px; font-weight: 950; }
.choice[data-value="gas"] .choice-icon, .choice[data-value="add"] .choice-icon, .choice[data-value="faster-freer"] .choice-icon { background: var(--coral); }
.choice[data-value="liquid"] .choice-icon, .choice[data-value="none"] .choice-icon { background: var(--cyan); }
.choice strong { display: block; font-size: 15px; line-height: 1.1; }.choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.primary, .lever-button { min-width: 220px; min-height: 58px; padding: 0 24px; border: 2px solid var(--teal-dark); border-radius: 16px; color: white; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); font-weight: 950; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.primary:hover, .lever-button:hover { transform: translateY(-3px); box-shadow: 0 9px 0 var(--teal-dark); }.primary:active, .lever-button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.lever-button { width: min(500px,100%); min-height: 92px; display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 16px; padding: 12px 24px; border-color: var(--coral-dark); background: var(--coral); box-shadow: 0 7px 0 var(--coral-dark); text-align: left; }
.lever-button.cool { border-color: var(--teal-dark); background: var(--blue); box-shadow: 0 7px 0 #155391; }
.lever-button b { width: 56px; height: 56px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; font-size: 25px; }.lever-button strong { display: block; font-size: 21px; }.lever-button small { display: block; margin-top: 3px; opacity: .86; font-size: 11px; }
.feedback-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.feedback-copy { display: flex; align-items: center; gap: 14px; }.feedback-badge { width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; border-radius: 17px; color: white; background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); font-size: 25px; font-weight: 950; }.feedback-row.is-wrong .feedback-badge { background: var(--coral); box-shadow-color: var(--coral-dark); }.feedback-copy strong { display: block; font-size: 17px; }.feedback-copy p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.mission-card { position: absolute; z-index: 50; left: 50%; top: 51%; width: 510px; min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 54px 38px; transform: translate(-50%,-50%); border: 1px solid rgba(31,83,78,.15); border-radius: 30px; background: rgba(255,255,255,.97); box-shadow: 0 18px 0 rgba(77,122,112,.12), 0 38px 80px rgba(34,83,78,.18); text-align: center; }
.mission-card img { width: 150px; height: 150px; object-fit: contain; margin-bottom: 5px; mix-blend-mode: multiply; }
.mission-card span { color: var(--teal-dark); font-size: 10px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.mission-card h1 { margin: 8px 0 10px; font-size: 38px; line-height: 1.02; letter-spacing: -.045em; }
.mission-card p { max-width: 350px; margin: 0 0 23px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.mission-card.is-practice img { width: 165px; height: 165px; }.mission-card.is-practice h1 { font-size: 42px; }

.toast { position: absolute; z-index: 30; left: 50%; bottom: 22px; max-width: 70%; padding: 10px 17px; opacity: 0; transform: translate(-50%,12px); border-radius: 999px; color: white; background: var(--ink); box-shadow: 0 5px 0 rgba(21,51,58,.2); pointer-events: none; font-size: 12px; font-weight: 900; transition: opacity 160ms ease-out, transform 160ms ease-out; }.toast.is-showing { opacity: 1; transform: translate(-50%,0); }
.sparkles { position: absolute; inset: 15% 25%; z-index: 18; opacity: 0; pointer-events: none; }.sparkles i { position: absolute; width: 14px; height: 14px; border-radius: 4px; background: var(--gold); transform: rotate(45deg); }.sparkles i:nth-child(1){left:8%;top:30%}.sparkles i:nth-child(2){left:26%;top:4%;background:var(--coral)}.sparkles i:nth-child(3){left:48%;top:18%;background:var(--cyan)}.sparkles i:nth-child(4){right:24%;top:3%}.sparkles i:nth-child(5){right:5%;top:42%;background:var(--coral)}.sparkles i:nth-child(6){left:48%;bottom:2%;background:var(--cyan)}.sparkles.is-bursting { animation: sparkle-burst 720ms ease-out; }
.game-shell.is-shaking { animation: gentle-shake 360ms ease-out; }

@keyframes heat-rise { 0%{opacity:0;transform:translate(-50%,50px)}35%{opacity:1}100%{opacity:0;transform:translate(-50%,-260px)} }
@keyframes frost-pop { 0%{opacity:0;transform:scale(.2) rotate(-15deg)}45%{opacity:1}100%{opacity:0;transform:scale(2.1) rotate(28deg)} }
@keyframes mascot-hop { 0%,100%{transform:translateY(0) rotate(0)}45%{transform:translateY(-18px) rotate(5deg)} }
@keyframes mascot-wobble { 0%,100%{transform:rotate(0)}30%{transform:rotate(-6deg)}65%{transform:rotate(6deg)} }
@keyframes gentle-shake { 0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}55%{transform:translateX(4px)}75%{transform:translateX(-2px)} }
@keyframes sparkle-burst { 0%{opacity:0;transform:scale(.5)}35%{opacity:1}100%{opacity:0;transform:scale(1.5)} }

@media (max-height: 790px) {
  .lesson { padding: 10px; }.game-shell { grid-template-rows: 60px minmax(0,1fr) 174px; }.chamber { height: 300px; }.comparison { height: 330px; }.comparison canvas { min-height: 220px; }.mission-card { min-height: 410px; }.mission-card img { width: 125px; height: 125px; }.mascot { width: 175px; }.thermal-prop { width: 155px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
