:root {
  color-scheme: light;
  --ink: #173f46;
  --muted: #56777a;
  --teal: #0b8f91;
  --teal-dark: #086568;
  --mint: #dff5e9;
  --coral: #ed765f;
  --coral-dark: #b94b3d;
  --gold: #f4bc43;
  --cream: #fffdf4;
  --line: #c9ded7;
  font-family: "Avenir Next", "Nunito Sans", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 1100px; min-height: 100%; margin: 0; }
body { min-height: 100vh; overflow: hidden; color: var(--ink); background: #a8d8cb; }
button { font: inherit; }
button:focus-visible { outline: 4px solid rgba(11,143,145,.35); outline-offset: 4px; }
[hidden] { display: none !important; }

.lesson-shell { position: relative; min-height: 100vh; overflow: hidden; isolation: isolate; }
.world-art { position: absolute; z-index: -3; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.world-wash { position: absolute; z-index: -2; inset: 0; background: linear-gradient(180deg, rgba(239,255,248,.34), rgba(16,78,73,.1)); }
.game-layout { width: min(1320px, calc(100% - 44px)); min-height: 100vh; margin: 0 auto; display: grid; grid-template-columns: 210px minmax(720px, 880px) 180px; align-items: center; justify-content: center; gap: 22px; }

.game-card { position: relative; min-height: 710px; padding: 27px 34px 24px; border: 1px solid rgba(27,83,78,.16); border-radius: 34px; background: rgba(255,253,244,.94); box-shadow: 0 16px 0 rgba(32,92,84,.11), 0 34px 80px rgba(25,70,66,.25), inset 0 1px rgba(255,255,255,.9); backdrop-filter: blur(18px); }
.mission-row { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--teal); font-size: 11px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; color: var(--ink); font-size: clamp(23px, 2vw, 30px); line-height: 1.08; letter-spacing: -.035em; }
.nest-track { display: flex; gap: 8px; }
.nest-track i { width: 13px; height: 13px; border: 2px solid rgba(11,101,104,.26); border-radius: 50%; background: rgba(255,255,255,.74); box-shadow: inset 0 1px rgba(255,255,255,.8); }
.nest-track i.is-done { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 4px rgba(244,188,67,.16); }
.nest-track i.is-current { border-color: var(--teal); background: var(--teal); transform: scale(1.2); }

.practice-stats { display: flex; align-items: stretch; gap: 8px; }
.practice-stats > span { min-width: 64px; display: grid; place-items: center; padding: 7px 10px; border: 1px solid rgba(18,91,87,.1); border-radius: 15px; background: #fff; box-shadow: 0 4px 12px rgba(31,83,76,.08); }
.practice-stats b { font-size: 17px; line-height: 1; }
.practice-stats small { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.practice-stats .level-meter { position: relative; min-width: 120px; overflow: hidden; align-content: center; }
.level-meter i { position: absolute; inset: 0 auto 0 0; width: 20%; background: rgba(11,143,145,.12); transition: width 180ms ease-out; }
.level-meter small { position: relative; }

.prompt-wrap { margin: 14px 0 10px; text-align: center; }
.prompt { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.microcopy { margin: 5px 0 0; color: var(--muted); font-size: 13px; font-weight: 650; }

.staff-stage { position: relative; height: 345px; overflow: hidden; border: 1px solid rgba(26,91,83,.14); border-radius: 26px; background: linear-gradient(180deg, rgba(228,249,238,.82), rgba(255,251,232,.88)); box-shadow: inset 0 2px 8px rgba(27,95,83,.07), 0 10px 28px rgba(42,92,82,.08); }
.staff { position: absolute; inset: 22px 22px 22px 18px; width: calc(100% - 40px); height: calc(100% - 44px); overflow: visible; }
.staff-lines line { stroke: #285c5d; stroke-width: 5; stroke-linecap: round; opacity: .88; }
.clef { fill: #1a5558; font-family: "Times New Roman", serif; font-size: 178px; }
.note { transition: transform 190ms cubic-bezier(.2,.75,.2,1.12); transform-origin: center; }
.note-head { fill: var(--coral); stroke: #713d39; stroke-width: 4; filter: drop-shadow(0 6px 4px rgba(68,70,49,.16)); }
.note-head.is-half { fill: #fff9e8; stroke-width: 7; }
.note-stem { stroke: #713d39; stroke-width: 7; stroke-linecap: round; }
.note-shine { fill: none; stroke: rgba(255,255,255,.66); stroke-width: 4; stroke-linecap: round; }
.revealed-letter { fill: #713d39; font-size: 20px; font-weight: 950; opacity: 0; transition: opacity 150ms ease-out; }
.note.is-singing { animation: noteSing 560ms cubic-bezier(.2,.84,.2,1.18); }
.note.is-singing .revealed-letter { opacity: 1; }
.guide-labels text { fill: #236f70; font-size: 15px; font-weight: 950; opacity: .66; }
.guide-labels circle { fill: #fffdf4; stroke: #75aaa3; stroke-width: 2; }
.glow-ring { position: absolute; left: 50%; top: 54%; width: 175px; height: 175px; border-radius: 50%; background: radial-gradient(circle, rgba(244,188,67,.2), transparent 68%); transform: translate(-50%,-50%); pointer-events: none; }

.bird-hop { position: absolute; right: 20px; bottom: 16px; width: 128px; transform: translateY(var(--hop, 0px)); transition: transform 480ms cubic-bezier(.2,.82,.24,1.15); pointer-events: none; }
.sticker-art, .sticker-prop { overflow: hidden; padding: 7px; border: 1px solid rgba(22,76,72,.12); border-radius: 27px; background: #fff; box-shadow: 0 12px 28px rgba(29,75,68,.18); }
.sticker-art img, .sticker-prop img { display: block; width: 100%; border-radius: 20px; }
.bird-hop.is-hopping { animation: chorusHop 640ms ease-out; }
.song-burst i { position: absolute; left: 53%; top: 50%; color: var(--gold); font-size: 28px; font-style: normal; opacity: 0; pointer-events: none; }
.song-burst.is-showing i { animation: songFloat 820ms ease-out forwards; }
.song-burst i:nth-child(2) { --x: 70px; --y: -105px; color: var(--coral); animation-delay: 70ms; }
.song-burst i:nth-child(3) { --x: -80px; --y: -125px; color: var(--teal); animation-delay: 130ms; }
.song-burst i:nth-child(4) { --x: 118px; --y: -64px; animation-delay: 190ms; }
.song-burst i:nth-child(5) { --x: -125px; --y: -70px; color: var(--coral); animation-delay: 240ms; }

.guide { min-height: 48px; margin: 10px auto 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 9px 15px; border: 1px solid rgba(11,143,145,.16); border-radius: 15px; color: var(--teal-dark); background: var(--mint); text-align: center; }
.guide b { font-size: 13px; }.guide span { color: var(--muted); font-size: 12px; }
.action-dock { min-height: 86px; margin-top: 13px; display: flex; align-items: center; justify-content: center; }
.piano-keys { width: min(620px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.piano-key, .primary, .secondary, .explain-choice, .rhythm-pad { min-height: 64px; border-radius: 17px; cursor: pointer; transition: transform 140ms ease-out, box-shadow 140ms ease-out, border-color 140ms ease-out; }
.piano-key { position: relative; color: var(--ink); border: 2px solid #c9dcd6; background: linear-gradient(#fff, #f8f5e9); box-shadow: 0 7px 0 #bccfc9, 0 13px 22px rgba(30,77,70,.1); font-size: 25px; font-weight: 950; }
.piano-key::before { content: "♪"; position: absolute; left: 13px; top: 8px; color: rgba(11,143,145,.24); font-size: 13px; }
.piano-key:hover { border-color: #69aaa1; transform: translateY(-2px); box-shadow: 0 9px 0 #b7cec7, 0 16px 25px rgba(30,77,70,.12); }
.piano-key:active { transform: translateY(5px); box-shadow: 0 2px 0 #b7cec7; }
.piano-key.is-picked { border-color: var(--coral); background: #fff0e8; }
.primary, .secondary { min-width: 240px; padding: 14px 25px; font-weight: 900; }
.primary { color: #fff; border: 1px solid #087779; background: linear-gradient(#16aaa7, var(--teal)); box-shadow: 0 7px 0 var(--teal-dark), 0 14px 24px rgba(11,143,145,.18); }
.primary:hover { transform: translateY(-2px); box-shadow: 0 9px 0 var(--teal-dark), 0 17px 27px rgba(11,143,145,.2); }
.primary:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--teal-dark); }
.secondary { color: var(--teal-dark); border: 2px solid #9ec8c0; background: #fff; box-shadow: 0 5px 0 #cee1dc; }
.explain-grid { width: min(650px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.explain-choice { padding: 12px 18px; color: var(--ink); border: 2px solid #c9dcd6; background: #fff; box-shadow: 0 5px 0 #c4d6d0; font-size: 14px; font-weight: 850; line-height: 1.25; }
.explain-choice:hover { transform: translateY(-2px); border-color: #69aaa1; }
.feedback { min-height: 21px; margin: 2px 0 0; color: var(--coral-dark); font-size: 13px; font-weight: 850; text-align: center; }
.game-card.is-miss { animation: gentleShake 340ms ease-out; }

.rhythm-lane { position: absolute; z-index: 5; left: 210px; right: 105px; bottom: 16px; height: 78px; padding: 12px 18px; border: 1px solid rgba(18,91,87,.14); border-radius: 18px; background: rgba(255,253,244,.95); box-shadow: 0 8px 20px rgba(34,82,75,.11); }
.rhythm-notes { height: 100%; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; gap: 7px; }
.rhythm-symbol { height: 45px; display: grid; place-items: center; border-radius: 12px; color: var(--teal-dark); background: #e8f6ed; font-family: Georgia, serif; font-size: 32px; font-weight: 900; }
.rhythm-symbol.half { grid-column: span 2; background: #fff0d2; }
.rhythm-symbol.is-hit { color: #fff; background: var(--coral); transform: scale(.94); }
.beat-pulse { position: absolute; z-index: 4; left: 18px; top: 6px; width: 9px; height: 66px; border-radius: 99px; background: var(--gold); box-shadow: 0 0 15px rgba(244,188,67,.55); opacity: 0; }
.rhythm-lane.is-running .beat-pulse { opacity: 1; animation: beatTravel var(--rhythm-duration, 2080ms) linear forwards; }
.rhythm-pad { width: min(460px, 100%); min-height: 76px; color: #fff; border: 2px solid #b8483b; background: linear-gradient(#f18a70, var(--coral)); box-shadow: 0 8px 0 var(--coral-dark), 0 16px 30px rgba(185,75,61,.2); font-size: 18px; font-weight: 950; }
.rhythm-pad:active { transform: translateY(6px) scale(.99); box-shadow: 0 2px 0 var(--coral-dark); }

.mascot { position: relative; align-self: end; margin-bottom: 46px; width: 205px; pointer-events: none; transform-origin: 50% 100%; }
.mascot .speech { position: absolute; z-index: 2; left: 75px; top: -56px; width: 154px; padding: 11px 13px; border: 1px solid rgba(22,76,72,.12); border-radius: 18px 18px 18px 5px; background: rgba(255,255,255,.96); box-shadow: 0 9px 24px rgba(24,68,63,.14); color: var(--teal-dark); font-size: 13px; font-weight: 900; line-height: 1.25; }
.mascot.is-happy { animation: mascotPop 580ms cubic-bezier(.2,.85,.25,1.2); }
.mascot.is-miss { animation: mascotNudge 360ms ease-out; }
.nest-reward { align-self: start; margin-top: 120px; width: 176px; transform: rotate(2deg); }
.nest-reward p { margin: 10px 0 0; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: 0 8px 20px rgba(25,69,64,.12); text-align: center; }
.nest-reward b, .nest-reward span { display: block; }.nest-reward b { font-size: 13px; }.nest-reward span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.toast { position: absolute; z-index: 40; left: 50%; top: 24px; max-width: 440px; padding: 11px 18px; border-radius: 999px; color: #fff; background: #173f46; box-shadow: 0 14px 34px rgba(15,54,54,.23); font-size: 13px; font-weight: 900; opacity: 0; pointer-events: none; transform: translate(-50%,-12px) scale(.96); transition: opacity 170ms ease-out, transform 170ms ease-out; }
.toast.is-showing { opacity: 1; transform: translate(-50%,0) scale(1); }
.celebration { position: absolute; z-index: 35; inset: 0; overflow: hidden; pointer-events: none; }
.celebration i { position: absolute; left: 50%; top: 54%; color: var(--gold); font-style: normal; font-size: 28px; opacity: 0; }
.celebration.is-showing i { animation: confetti 880ms cubic-bezier(.16,.72,.24,1) forwards; }
.celebration i:nth-child(1){--x:-360px;--y:-280px}.celebration i:nth-child(2){--x:-285px;--y:-330px;color:var(--coral)}.celebration i:nth-child(3){--x:-210px;--y:-250px;color:var(--teal)}.celebration i:nth-child(4){--x:-120px;--y:-350px}.celebration i:nth-child(5){--x:-35px;--y:-290px;color:var(--coral)}.celebration i:nth-child(6){--x:70px;--y:-350px;color:var(--teal)}.celebration i:nth-child(7){--x:155px;--y:-270px}.celebration i:nth-child(8){--x:245px;--y:-330px;color:var(--coral)}.celebration i:nth-child(9){--x:330px;--y:-250px;color:var(--teal)}.celebration i:nth-child(10){--x:395px;--y:-320px}

@keyframes noteSing { 0%,100%{transform:scale(1) rotate(0)}35%{transform:scale(1.18) rotate(-6deg)}65%{transform:scale(1.08) rotate(5deg)} }
@keyframes chorusHop { 0%,100%{transform:translateY(var(--hop,0)) rotate(0)}42%{transform:translateY(calc(var(--hop,0px) - 22px)) rotate(-3deg)} }
@keyframes songFloat { 0%{opacity:0;transform:translate(0,0) scale(.4)}35%{opacity:1}100%{opacity:0;transform:translate(var(--x,-20px),var(--y,-110px)) scale(1.3) rotate(12deg)} }
@keyframes mascotPop { 0%,100%{transform:translateY(0) rotate(0)}35%{transform:translateY(-18px) rotate(-3deg)}65%{transform:translateY(0) rotate(2deg)} }
@keyframes mascotNudge { 0%,100%{transform:translateX(0)}30%{transform:translateX(-6px) rotate(-2deg)}70%{transform:translateX(5px) rotate(2deg)} }
@keyframes gentleShake { 0%,100%{transform:translateX(0)}25%{transform:translateX(-7px) rotate(-.2deg)}65%{transform:translateX(6px) rotate(.2deg)} }
@keyframes confetti { 0%{opacity:0;transform:translate(0,0) scale(.3) rotate(0)}25%{opacity:1}100%{opacity:0;transform:translate(var(--x),var(--y)) scale(1.2) rotate(220deg)} }
@keyframes beatTravel { from{left:18px}to{left:calc(100% - 27px)} }

@media (max-height: 820px) {
  .game-card { min-height: 650px; padding-top: 20px; padding-bottom: 18px; }
  .staff-stage { height: 300px; }.staff { inset-top: 10px; }.game-layout { transform: scale(.94); transform-origin: center; }
}

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