:root {
  color-scheme: light;
  --paper: var(--nt-paper, #f5f2fb);
  --white: #fff;
  --ink: var(--nt-ink, #271b40);
  --muted: #625575;
  --line: #e7deef;
  --violet: #633cbc;
  --deep: var(--nt-plum, #2e1d52);
  --wash: #f0e9fb;
  --lime: var(--nt-lime, #def987);
  --green: #376621;
  --shadow: 0 5px 16px #2c16480c;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; background: var(--paper); color: var(--ink); min-width: 290px }
button, select { font: inherit }
button { cursor: pointer; color: inherit; touch-action: manipulation }
button:disabled, select:disabled { cursor: default; opacity: .63 }
a { color: inherit }
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible { outline: 3px solid #8653d9; outline-offset: 3px }
.stage button:focus-visible { outline-color: #e5ff9b }
::selection { color: var(--ink); background: #e0cbff }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden }
svg:not(.sprite) { flex-shrink: 0 }
button svg, .star-count svg, .journey svg, .stage-type svg, #feedback svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round
}
h1, h2, p { margin: 0 }
.topbar { background: #fdfbff; border-bottom: 1px solid var(--line) }
.top-inner { max-width: 1216px; margin: auto; display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; gap: 18px }
.brand { display: inline-flex; gap: 11px; align-items: center; text-decoration: none; font-size: 1.4rem; font-weight: 850; letter-spacing: -.025em; line-height: 1.07 }
.brand small { display: block; font-size: .60rem; color: var(--muted); letter-spacing: .14em; margin-top: 5px }
.top-tools { display: flex; gap: 12px; align-items: center }
.star-count { display: flex; align-items: center; gap: 5px; background: #fff3d4; color: #624818; border-radius: 12px; padding: 8px 11px; font-size: .93rem; white-space: nowrap; font-variant-numeric: tabular-nums }
.star-count svg { fill: #ffce57; stroke: #8b5d00; margin-right: 1px; width: 18px; height: 18px }
.connect, .listen, .primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; min-height: 44px; padding: 9px 14px; font-weight: 750 }
.connect { color: #542da4; background: #fff; border: 1px solid #ded0f4 }
.connect:hover { background: var(--wash) }
.connect.is-connected { color: #365921; background: #eefadf; border-color: #c9dfa9 }
.layout { max-width: 1216px; margin: 0 auto; padding: 28px 28px 0; display: grid; grid-template-columns: minmax(0, 1fr) 302px; gap: 24px; align-items: start }
.lesson-column { min-width: 0 }
.lesson-meta { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; color: #5a4b70; font-weight: 760; font-size: .92rem }
.mission-index { flex-shrink: 0 }
.progress { display: flex; align-items: stretch; height: 9px; gap: 5px; flex: 1; min-width: 0 }
.progress i { flex: 1; border-radius: 10px; background: #e2d9ed; transition: background .2s ease }
.progress i.filled { background: #7751c4 }
.step-count { font-variant-numeric: tabular-nums; white-space: nowrap }
.stage { isolation: isolate; position: relative; display: flex; align-items: center; min-height: 268px; overflow: hidden; color: #faf6ff; border-radius: 18px; background: #302052; box-shadow: var(--shadow) }
.stage::before { content: ""; z-index: -2; position: absolute; inset: 0; background: radial-gradient(ellipse at 93% 63%, #4f3289, transparent 70%) }
.orbit-art { position: absolute; right: 3%; top: 50%; width: min(45%, 345px); transform: translateY(-50%); pointer-events: none; z-index: -1 }
.orbit-art svg { width: 100%; display: block }
.stage-copy { padding: 28px 32px 32px; width: 70%; }
.stage-type { display: inline-flex; align-items: center; gap: 7px; background: #4a3476; color: #e8d9ff; border-radius: 8px; padding: 4px 8px; font-size: .78rem; font-weight: 720; margin-bottom: 13px }
.stage-type svg { width: 15px; height: 15px }
.stage h1 { font-size: clamp(2.0rem, 3.8vw, 3.4rem); line-height: 1.04; letter-spacing: -.038em; font-weight: 850; text-wrap: balance }
.stage h1:focus { outline: none }
.stage-copy > p:not(.stage-type) { margin-top: 10px; max-width: 36ch; color: #e8dcf8; line-height: 1.45; font-size: 1.04rem }
.stage-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px }
.primary { color: #262038; background: var(--lime); border: 1px solid #bdd866; box-shadow: 0 3px 0 #829946; transition: background .14s, transform .14s, box-shadow .14s }
.primary:hover { background: #e8ffa7 }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #829946 }
.listen { color: #f4ebff; background: #4d357a; border: 1px solid #8066a8 }
.listen:hover { background: #62468f }
.mascot { transform-origin: 218px 165px }
.stage.celebrate .mascot { animation: lift .68s cubic-bezier(.15,.85,.25,1) }
.stage.celebrate .orbit-note { animation: sparkle .68s cubic-bezier(.15,.85,.25,1) }
@keyframes lift { 25% { transform: translateY(-16px) rotate(-8deg) } 60% { transform: translateY(-8px) rotate(4deg) } }
@keyframes sparkle { 30% { opacity: .55; transform: translateY(-9px) } 75% { opacity: 1 } }
.instrument { background: #fff; border: 1px solid var(--line); border-radius: 17px; margin-top: 17px; padding: 19px 22px 15px }
.instrument-top { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 12px }
.instrument h2, .journey h2 { font-size: 1.22rem; letter-spacing: -.023em; line-height: 1.2; font-weight: 830 }
.instrument-top p, .journey-head p { color: var(--muted); margin-top: 3px; font-size: .91rem }
.hint { display: flex; align-items: center; gap: 7px; min-height: 38px; border-radius: 10px; padding: 4px 8px; color: #533788; font-size: .85rem; font-weight: 740; background: #f8f4fd; border: 0 }
.hint:hover { background: #efe5fb }
.switch { width: 28px; height: 16px; border-radius: 10px; background: #8b7b9b; position: relative }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .18s ease }
.hint[aria-pressed=true] .switch { background: #6b43b9 }
.hint[aria-pressed=true] .switch::after { transform: translateX(12px) }
.note-steps { display: flex; flex-wrap: wrap; min-height: 34px; gap: 5px; margin-bottom: 10px }
.note-steps:empty { display: none }
.note-steps span { min-width: 33px; text-align: center; background: #f3eff8; color: #625176; border: 1px solid #ede5f4; border-radius: 8px; padding: 5px 6px; font-size: .82rem; font-weight: 780; white-space: nowrap }
.note-steps span.current { color: #503089; background: #ebdcff; border-color: #ceafea }
.note-steps span.done { color: #355b20; background: #e8f6cd; border-color: #cfe7ab }
.rhythm { height: 8px; margin: 0 0 8px; background: #eee5f7; border-radius: 8px; position: relative }
.rhythm span { display: block; width: 16px; height: 8px; border-radius: 8px; position: absolute; background: #743fcd; left: calc(var(--beat, 0) * (100% - 16px)) }
.rhythm span.accent { background: #4b771b }
.piano { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); position: relative; gap: 3px; height: clamp(118px, 13.65vw, 177px); background: #30254a; padding: 5px 5px 6px; border-radius: 13px; user-select: none; touch-action: manipulation }
.key { position: relative; display: flex; flex-direction: column; justify-content: end; align-items: center; padding: 0 2px 9px; border-radius: 5px 5px 8px 8px; border: 0; box-shadow: inset 0 -5px 0 #dfd6ed; font-size: clamp(.72rem, 1.4vw, 1rem); line-height: 1.2; font-weight: 780; background: #fff; color: #46345f; min-width: 0 }
.key:hover { background: #f2eafb }
.key .pc-key { margin-top: 3px; font-size: .65rem; color: #6b5b80; font-weight: 720 }
.key.black { position: absolute; left: calc(5px + (100% - 10px) * var(--position)); transform: translateX(-50%); top: 5px; width: 7.6%; height: 56%; z-index: 1; padding-bottom: 8px; color: #fff; background: #2e2342; box-shadow: inset 0 -5px #1e162b, 1px 3px 4px #18121d55 }
.key.black:hover { background: #4e376d }
.key.black .pc-key { color: #d3c4e3 }
.key:focus-visible { z-index: 2; outline-offset: -3px }
.key.target { background: #ebddff; color: #4e2e81; box-shadow: inset 0 -5px 0 #c4a8f0 }
.key.target .note-label::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; margin: 0 auto 5px; background: #7a48ca }
.key.pressed, .key.demo { background: #e0f6a4; color: #284014; box-shadow: inset 0 -3px 0 #a6c668 }
.key.pressed .pc-key, .key.demo .pc-key { color: #36551a }
.key.black.pressed, .key.black.demo { color: #284014; background: #d7ed9f; box-shadow: inset 0 -3px 0 #8eaf55 }
.key.wrong { background: #ffeadb; box-shadow: inset 0 -4px 0 #f1cbb0; color: #602f22 }
.interaction { display: flex; align-items: center; justify-content: space-between; column-gap: 12px; margin-top: 11px; min-height: 26px; font-size: .83rem }
#feedback { display: inline-flex; align-items: center; color: var(--muted); gap: 7px }
#feedback svg { width: 17px; height: 17px }
#feedback[data-tone=good] { color: #355e21; font-weight: 700 }
#feedback[data-tone=again] { color: #83462c }
.pc-hint { display: flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--muted) }
kbd { border: 1px solid #e6deef; border-bottom-width: 2px; border-radius: 5px; background: #f8f4fc; padding: 0 5px; font: 700 .73rem/1.55 system-ui }
.pc-hint span { margin-left: 3px }
.sound-controls { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 12px }
.sound-controls button { border-radius: 10px; border: 1px solid #e6dcf2; background: #fff; padding: 7px 10px; font-weight: 720; min-height: 42px }
.sound-controls button[aria-pressed=true] { border-color: #ac90d5; background: #f0e5fd; color: #4b2a84 }
.journey { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 16px; margin-top: 35px }
.journey-head { display: flex; align-items: center; gap: 10px; padding: 2px 3px 14px }
.journey-badge { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 12px; color: #6438b4; background: #eee5fc }
.journey-badge svg { width: 22px; height: 22px }
.missions { position: relative; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px }
.missions::before { content: ""; position: absolute; width: 2px; background: #e8def2; top: 22px; bottom: 22px; left: 25px }
.mission { width: 100%; text-align: left; position: relative; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 58px; padding: 6px 8px; border: 1px solid transparent; background: transparent; border-radius: 11px }
.mission:hover { background: #f8f3fc }
.mission[aria-current=true] { border-color: #dfcdf8; background: #f2eafb }
.mission b { font-size: .93rem; display: block; line-height: 1.22 }
.mission small { color: var(--muted); display: block; font-size: .77rem; margin-top: 2px }
.mission-marker { background: #f1eaf9; color: #64498a; border-radius: 50%; display: grid; place-items: center; width: 34px; height: 34px; font-weight: 840; line-height: 1 }
.mission[aria-current=true] .mission-marker { background: #7046bf; color: #fff }
.mission.completed .mission-marker { background: #e7f6c9; color: #3b641e }
.mission-marker svg, .mission-end svg { width: 16px; height: 16px }
.mission-end { display: flex; color: #6944a4 }
.mission.completed .mission-end { color: #886014 }
.mission.completed .mission-end svg { fill: #ffde82 }
.jam-area { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #ded1ec }
.jam { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: #f4eefb; color: #5b3597; border: 1px solid #ebe0f7; border-radius: 10px; min-height: 43px; width: 100%; text-align: left; font-weight: 760 }
.jam:hover, .jam[aria-pressed=true] { background: #eadef9 }
.jam-arrow { margin-left: auto }
.journey-foot { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 12px 3px 1px; font-size: .79rem }
.journey-foot svg { width: 16px; height: 16px; color: #96722b; fill: #fff0c1 }
.footer { max-width: 1216px; margin: 0 auto; padding: 15px 28px 19px; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .82rem }
.footer button { background: transparent; border: 0; color: #5e389b; padding: 0; text-decoration: underline; text-underline-offset: 3px; min-height: 28px }
.footer span { align-self: center }
dialog { max-width: min(530px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); border: 1px solid #e1d5ed; border-radius: 17px; padding: 21px; color: var(--ink); background: #fff; box-shadow: 0 18px 70px #21143147; overflow: auto }
dialog::backdrop { background: #221634a0 }
#victory-close { position: absolute; inset: 12px 12px auto auto; z-index: 1; min-width: 44px; min-height: 44px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px }
.dialog-head h2 { font-size: 1.55rem; line-height: 1.13 }
.dialog-head p { color: var(--muted); margin-top: 4px }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; background: var(--wash); color: var(--deep); border: 0; border-radius: 10px }
.setup-list { padding-left: 1.35rem; margin: 14px 0 }
.setup-list li + li { margin-top: 5px }
.midi-status { margin-top: 9px; padding: 8px 10px; background: var(--wash); color: #4b3173; border-radius: 8px; font-size: .92rem }
.setup-fields { margin-top: 12px; display: grid; gap: 10px; grid-template-columns: 1fr 1fr }
.setup-fields label { min-width: 0; display: grid; align-content: start; gap: 4px; font-size: .83rem; font-weight: 730 }
select { width: 100%; padding: 7px 6px; color: var(--ink); border: 1px solid #ded0ef; border-radius: 7px; background: #fdfaff; min-height: 39px }
.midi-note { font-size: .9rem; margin: 12px 0; color: #5c3a97; font-weight: 730 }
details { color: var(--muted); font-size: .88rem }
details + details { margin-top: 6px }
summary { cursor: pointer; color: #5c3a97; text-decoration: underline; text-underline-offset: 3px }
details p { margin-top: 7px }
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 255px; gap: 16px }
  .stage-copy { width: 77%; padding-inline: 23px }
  .journey { padding: 12px }
  .orbit-art { right: 1%; width: 42% }
}
@media (max-width: 760px) {
  .layout { display: block; padding: 18px 16px 0 }
  .top-inner, .footer { padding-inline: 16px }
  .journey { margin-top: 17px; padding: 15px }
  .stage h1 { font-size: clamp(2.0rem, 6vw, 3.05rem) }
  .piano { height: clamp(127px, 27vw, 177px) }
  .orbit-art { width: 43% }
  .missions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px }
  .missions::before { display: none }
}
@media (max-width: 470px) {
  .top-inner { padding-block: 10px; gap: 7px }
  .brand { gap: 6px; font-size: 1.14rem }
  .brand img { width: 34px; height: 34px }
  .brand small { font-size: .51rem; letter-spacing: .08em }
  .top-tools { gap: 5px }
  .connect { font-size: .74rem; min-height: 38px; padding-inline: 6px; gap: 4px }
  .connect svg { width: 15px; height: 15px }
  .star-count { padding: 6px; gap: 3px; font-size: .79rem }
  .star-count > span { display: none }
  .star-count svg { width: 15px; height: 15px }
  .stage { min-height: 238px }
  .stage-copy { width: 100%; padding: 20px 14px 22px }
  .stage h1 { max-width: 78%; font-size: clamp(1.7rem, 7.4vw, 2.15rem) }
  .stage-copy > p:not(.stage-type) { width: 72%; min-width: min(190px, 100%); font-size: .94rem }
  .stage-type { margin-bottom: 9px }
  .orbit-art { width: 46%; right: -5%; top: 43%; opacity: .83 }
  .stage-actions { margin-top: 16px; gap: 6px }
  .stage-actions button { padding-inline: 9px; font-size: .89rem }
  .instrument { padding: 13px 10px 10px }
  .instrument-top { gap: 6px }
  .instrument-top p { font-size: .81rem }
  .hint { font-size: .78rem }
  .note-steps { gap: 3px }
  .note-steps span { min-width: 28px; padding-inline: 3px }
  .mission { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px; padding-inline: 3px }
  .mission-marker { width: 28px; height: 28px }
  .mission b { font-size: .82rem }
  .mission small { font-size: .73rem }
  .mission-end svg { width: 12px; height: 12px }
  .pc-hint { display: none }
  .footer { font-size: .76rem }
}
@media (max-width: 345px) {
  .setup-fields { grid-template-columns: 1fr }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important }
}

.route-switch { display: grid; grid-template-columns: 1.15fr 1fr; gap: 4px; background: #f0e9fa; padding: 4px; border-radius: 11px; margin: 0 0 10px }
.route-switch button, .score-tools button, .tempo-control select, #victory-stay {
  color: #563786; background: #f3edfa; border: 1px solid #e6daf1; border-radius: 8px; min-height: 36px; font-size: .82rem; font-weight: 750; padding: 4px 8px
}
.route-switch button { background: transparent; border-color: transparent; min-height: 36px }
.route-switch button[aria-pressed=true] { background: #fff; color: #42236e; box-shadow: 0 2px 6px #40206614 }
.score-tools button[aria-pressed=true] { background: #e7f5d1; color: #365521; border-color: #cee3ab }
.score-tools button:hover:not(:disabled), .route-switch button:hover { border-color: #c9b3e6 }
.fx-toggle { width: 42px; height: 42px; flex-shrink: 0 }
.fx-toggle[aria-pressed=false] { color: #6b5b79; background: #f2edf6 }
.score-ui { background: #fcfaff; border: 1px solid #e9e1f3; border-radius: 12px; margin-bottom: 12px; overflow: hidden }
.lesson-guide { background: #f5eefb; border-radius: 9px; padding: 8px 10px; margin-bottom: 10px }
.lesson-guide ol { padding-left: 1.25rem; margin-block: 6px }
.score-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 10px; align-items: center; padding: 8px 9px 5px }
.score-pages, .score-options { display: flex; gap: 5px; align-items: center }
.score-pages button { padding: 0; width: 35px; display: grid; place-items: center }
.score-pages button svg { width: 17px; height: 17px }
.score-pages .reverse { transform: rotate(180deg) }
.score-pages span { min-width: 90px; text-align: center; font-size: .83rem; color: #57446f; font-weight: 770 }
.tempo-control { display: flex; align-items: center; gap: 5px; color: #5b486e; font-size: .79rem; font-weight: 740 }
.tempo-control select { min-width: 63px; width: auto; padding: 4px; text-align: center }
.beat-leds { display: flex; gap: 4px; padding: 1px 9px 0 }
.beat-leds i { height: 4px; flex: 1; background: #e8dfef; border-radius: 4px }
.beat-leds i:first-child { flex: 1.22 }
.beat-leds i.pulse { background: #8a58d2 }
.beat-leds i.pulse:first-child { background: #6c459f }
.staff { padding-inline: 5px; color: #28213b }
.score-svg { display: block; width: 100%; max-height: 185px; min-height: 130px; overflow: visible }
.score-svg .staff-line { fill: none; stroke: #655b75; stroke-width: .8 }
.score-svg .bar-line, .score-svg .bar-final { stroke: #4b3b64; stroke-width: 1.35 }
.score-svg .bar-final { stroke-width: 3.5 }
.score-svg .clef { font-family: "Segoe UI Symbol", "Noto Music", "Bravura", serif; font-size: 64px; fill: currentColor }
.score-svg .meter { font: 800 24px/1 Georgia, serif; fill: currentColor }
.score-svg .bar-label { font: 700 11px/1 "Segoe UI", sans-serif; fill: #665177 }
.score-svg .score-note, .score-svg .score-rest { color: #332346 }
.score-svg .is-current { color: #6537b6 }
.score-svg .is-done { color: #557435 }
.score-svg .score-cursor { fill: #eadbfe }
.score-svg .score-rest, .score-svg .ledger, .score-svg .stem { fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round }
.score-svg .solid, .score-svg .flag, .score-svg .duration-dot { fill: currentColor }
.score-svg .hollow { fill: #fcfaff; stroke: currentColor; stroke-width: 2.2 }
.score-svg .accidental, .score-svg .key-sign { font: 25px/1 "Segoe UI Symbol", Georgia, serif; fill: currentColor }
.advanced-route .stage { min-height: 235px }
.advanced-route .stage-copy { padding-top: 21px; padding-bottom: 25px }
.score-svg .score-hidden circle { fill: #e9def7 }
.score-svg .score-hidden text { fill: #654789; font: 800 13px/1 "Segoe UI", sans-serif }
.piano-scroll { overflow-x: auto; scrollbar-color: #af91d8 #f0e9fa; padding-bottom: 1px }
.piano.advanced { grid-template-columns: repeat(15, minmax(0, 1fr)); min-width: 485px; gap: 2px }
.piano.advanced .key { font-size: .8rem }
.piano.advanced .key.black { width: 4.1% }
.piano.advanced .note-label small { font-size: .6rem; padding-left: 1px }
.victory { overflow: hidden; width: min(91vw, 460px); text-align: center; color: #f7efff; background: #37225a; border: 1px solid #7e5bad; border-radius: 24px; padding: 26px 26px 22px; box-shadow: 0 12px 70px #240e4d72 }
.victory::backdrop { background: #221138ac }
.victory[open] { animation: victory-in .32s cubic-bezier(.15,.83,.31,1) both }
.victory > :not(.confetti) { position: relative; z-index: 1 }
.victory-badge { width: 88px; height: 88px; border-radius: 28px; margin: 0 auto 13px; display: grid; place-items: center; background: #e1fb8d; color: #4c326b; box-shadow: 0 7px 0 #9fb656; transform: rotate(-8deg) }
.victory-badge svg { width: 55px; height: 55px; stroke: currentColor; stroke-width: 1.65; stroke-linejoin: round; fill: #ffc857 }
.victory[open] .victory-badge { animation: badge-pop .59s cubic-bezier(.22,.72,.24,1.14) both }
.victory h2 { font-size: clamp(1.7rem, 6vw, 2.6rem); font-weight: 850; line-height: 1.07; letter-spacing: -.025em }
.victory p { margin: 7px 0; color: #f2e7fb }
.victory-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; padding: 5px 0 }
.victory-stats span { background: #57407b; color: #fff; border-radius: 20px; padding: 4px 11px; font-size: .84rem; font-weight: 740 }
#victory-next { color: #e9d8fa; font-size: .88rem }
.victory-track { margin: 10px auto 16px; height: 5px; background: #6f5597; border-radius: 5px; overflow: hidden }
.victory-track span { display: block; height: 100%; width: 100%; background: #def987; transform-origin: left; animation: countdown var(--countdown, 3800ms) linear both }
.victory-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: 12px }
#victory-stay { min-height: 44px; border-color: #9c7bc7; background: #554075; color: #fff }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none }
.confetti i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 12px; border-radius: 2px; opacity: 0; background: var(--confetti); animation: fall 1.4s cubic-bezier(.19,.62,.48,1) var(--delay) both }
@keyframes victory-in { from { opacity: 0; transform: scale(.88) translateY(14px) } }
@keyframes badge-pop { from { transform: scale(.45) rotate(-30deg) } 60% { transform: scale(1.15) rotate(9deg) } }
@keyframes countdown { to { transform: scaleX(0) } }
@keyframes fall { 18% { opacity: 1 } to { opacity: 0; transform: translate(var(--drift), 270px) rotate(330deg) } }
@media (max-width: 470px) {
  .fx-toggle { width: 31px; height: 34px }
  .fx-toggle svg { width: 17px; height: 17px }
  .score-tools { padding-inline: 5px }
  .score-options { gap: 4px; flex-wrap: wrap }
  .score-tools button, .tempo-control select { min-height: 34px }
  .score-tools button { padding-inline: 5px }
  .score-svg { min-height: 0 }
  .piano.advanced { height: 130px }
  .advanced-route .stage[data-playing=true] { min-height: 190px }
  .advanced-route .stage[data-playing=true] .stage-copy { padding-top: 16px; padding-bottom: 17px }
  .advanced-route .stage[data-playing=true] .stage-copy > p:not(.stage-type) { font-size: .85rem }
}
@media (prefers-reduced-motion: reduce) {
  .victory[open], .victory[open] .victory-badge, .victory-track span, .confetti i { animation: none }
}

.instrument-switch { display: flex; flex-wrap: wrap; gap: 5px; background: #f0e9fa; margin-bottom: 12px; padding: 4px; border-radius: 12px; width: fit-content }
.instrument-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 37px; border: 1px solid transparent; background: transparent; padding: 4px 10px; border-radius: 8px; color: #563786; font-weight: 750; font-size: .85rem }
.instrument-switch button svg { width: 16px; height: 16px }
.instrument-switch button[aria-pressed=true] { background: white; box-shadow: 0 2px 6px #40206614 }
.instrument-switch button:hover { border-color: #cab4e5 }
.fm1-panel { color: #342249; background: #f8f3fb; padding: 10px; border: 1px solid #e8ddf0; border-radius: 12px }
.fm1-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px }
.fm1-bar h3 { margin: 0; font-size: 1.07rem; letter-spacing: -.025em; font-weight: 850 }
.fm1-status { color: #674989; font-weight: 700; font-size: .79rem }
.fm1-status.online { color: #305b24 }
.fm1-connect { min-height: 33px; border-radius: 8px; font-size: .78rem; padding: 4px 7px }
.fm1-connect svg { width: 15px; height: 15px }
.fm1-scroll { overflow-x: auto; scrollbar-color: #af91d8 #f0e9fa; padding-bottom: 2px }
.fm1-shell {
  color: #e7e2ee; background: #282632; min-width: 515px; border-radius: 12px;
  padding: 11px 12px 10px; border: 1px solid #4d4359; box-shadow: inset 0 -3px 0 #181521;
}
.fm1-top { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, .74fr) minmax(0, 1.5fr); align-items: stretch; gap: 11px; margin-bottom: 2px }
.fm1-left { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 5px }
.fm1-right { display: grid; align-content: space-between; gap: 7px }
.fm1-right-knobs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px }
.fm1-buttons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px }
.fm1-control, .fm1-static, .fm1-combo { color: #e9e4f2; font-family: system-ui, sans-serif; font-size: .56rem; font-weight: 770; white-space: nowrap; letter-spacing: .01em }
.fm1-control { background: transparent; border: 0; padding: 0; cursor: pointer }
.fm1-knob { display: grid; place-items: center; align-content: start; text-align: center; line-height: 1.18; gap: 3px; border-radius: 6px }
.fm1-knob::before { content: ""; width: 22px; height: 22px; border-radius: 50%; display: block; border: 1px solid #6b6179; background: linear-gradient(90deg, transparent 47%, #cfc8dd 47% 54%, transparent 54%) center 4px / 15px 7px no-repeat, linear-gradient(#5c556b, #393445); box-shadow: inset 0 -3px 0 #262132 }
.fm1-pad { background: #443c51; border-radius: 4px; min-height: 20px; padding: 2px 1px; display: grid; place-items: center; text-align: center; border: 1px solid #62566d }
.fm1-buttons .fm1-pad { font-size: clamp(.49rem, .69vw, .59rem); letter-spacing: 0 }
.fm1-buttons .fm1-pad:nth-child(11) { white-space: normal; line-height: 1 }
.fm1-static { opacity: .76 }
.fm1-control:hover { background-color: #5b456c }
.fm1-control:focus-visible, .fm1-key:focus-visible, .fm1-combo:focus-visible { outline: 2px solid #e2fbad; outline-offset: -2px }
.fm1-display {
  min-width: 0; display: grid; grid-template-rows: auto 1fr auto; align-items: center; padding: 7px; color: #ddffb2;
  background: #151d21; border-radius: 8px; border: 2px solid #655777; text-align: center;
}
.fm1-display span, .fm1-display small { font-size: .58rem; font-weight: 710; letter-spacing: .04em; color: #a7cfb1 }
.fm1-display strong { font-size: clamp(.8rem, 1.65vw, 1.14rem); line-height: 1.1; color: #e6ffc7; overflow-wrap: anywhere }
.fm1-display .fm1-next-note { color: #f0defe; border-top: 1px solid #536560; padding-top: 3px; margin-top: 4px; font-size: .64rem; letter-spacing: 0 }
.fm1-keyboard { position: relative; display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; padding-top: 21px; height: 113px }
.fm1-key:not(.fm1-black) { grid-row: 1 }
.fm1-key {
  display: grid; align-content: end; justify-items: center; gap: 5px; border: 0; border-radius: 6px;
  background: #eeebf1; color: #382944; padding: 0 0 7px; box-shadow: inset 0 -3px 0 #ccbfd6;
  font: 800 .66rem/1 system-ui; touch-action: manipulation; min-width: 0; user-select: none;
}
.fm1-key i { width: 3px; height: 10px; border-radius: 3px; background: #93919b }
.fm1-key.fm1-black { position: absolute; z-index: 1; left: var(--key-x); top: 21px; transform: translateX(-50%); width: 4%; height: 46%; color: #fff; background: #38313f; box-shadow: inset 0 -3px 0 #181621, 1px 3px 2px #15111b55; padding-bottom: 6px }
.fm1-key.fm1-black i { background: #a598ae }
.fm1-key:hover { box-shadow: inset 0 -3px #8f67bd }
.fm1-key.is-target { background: #d3b8f5; color: #392252 }
.fm1-key.is-playing { background: #d9ff8a; color: #243a1c }
.fm1-key.is-playing i { background: #477128 }
.key.chord-picked, .fm1-key.chord-picked { background: #d7ecb0; color: #233719; box-shadow: inset 0 -3px #8aa66b }
.fm1-key.chord-picked i { background: #477128 }
.lesson-action, .rhythm-help { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin: 0 0 9px }
.lesson-action { justify-content: space-between; padding: 8px; border: 1px solid #e8ddf0; border-radius: 9px; background: #f5eefb }
.lesson-action p { margin: 0; max-width: 46ch; font-size: .85rem }
.lesson-action .primary { min-height: 36px; font-size: .84rem; padding: 4px 8px }
.rhythm-help button { min-height: 34px; padding: 4px 8px; border: 1px solid #e6daf1; border-radius: 8px; background: #f3edfa; color: #563786; font-size: .82rem; font-weight: 750 }
.rhythm-help button[aria-pressed=true] { border-color: #cee3ab; background: #e7f5d1; color: #365521 }
.rhythm-guide { display: grid; gap: 5px; margin-bottom: 9px; color: #5b4478; font-size: .79rem; font-weight: 750 }
.rhythm-guide[data-phase=ready] { color: #3a5918 }
.instrument > .interaction { margin: 0 0 10px }

.language-picker { max-width: 154px; min-height: 34px; padding: 3px 23px 3px 8px; border: 1px solid #e6daf1; border-radius: 8px; font-size: .82rem; font-weight: 750; color: #563786; background: #fcfaff }
.coach-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px }
.coach-toolbar button { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; border: 1px solid #e6daf1; padding: 4px 8px; border-radius: 8px; background: #f3edfa; color: #563786; font-size: .82rem; font-weight: 750 }
.coach-toolbar button svg { width: 15px; height: 15px }
.coach-toolbar button[aria-pressed=true] { border-color: #cee3ab; background: #e7f5d1; color: #365521 }
.coach-note { padding: 8px 10px; margin: 3px 0 9px; border-radius: 9px; background: #e9f4d6; color: #354c25; font-size: .88rem; font-weight: 690 }
.footer-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px }
.journey-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; margin: 6px 0 10px }
.journey-actions .jam { min-height: 44px; font-size: .8rem; padding-inline: 5px; justify-content: center; gap: 4px }
.journey-actions .jam svg { width: 15px; height: 15px }
.journey .missions { max-height: clamp(165px, 42dvh, 360px); overflow: auto; scrollbar-width: thin; scroll-padding-block: 4px }
.journey .missions .mission b { overflow-wrap: anywhere }
#practice-progress { --inset: clamp(14px, 3vw, 27px); width: min(920px, calc(100vw - 32px)); max-width: none; padding: 0; max-height: min(740px, calc(100dvh - 28px)); overflow: hidden; border-radius: 24px; }
#practice-progress[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.practice-head { padding: clamp(13px, 3vh, 23px) var(--inset) 12px; }
.practice-head h2 { font-size: clamp(1.45rem, 3vw, 2.25rem); }
.practice-head .practice-kicker, .practice-kicker { color: var(--nt-muted); font-weight: 780; font-size: .72rem; letter-spacing: .075em; text-transform: uppercase; margin: 0 0 4px; }
.practice-head .icon-button { min-width: 44px; min-height: 44px; }
.practice-nav { display: flex; gap: 5px; margin: 0 var(--inset) 12px; padding: 4px; width: fit-content; max-width: calc(100% - var(--inset) * 2); background: var(--nt-paper); border: 1px solid var(--line); border-radius: 13px; }
.practice-nav button { min-height: 44px; border: 1px solid transparent; background: transparent; padding: 4px 15px; border-radius: 9px; color: var(--nt-muted); font-weight: 740; }
.practice-nav button[aria-pressed=true] { border-color: var(--line); background: white; color: var(--nt-ink); box-shadow: 0 1px 5px #271a4414; }
.practice-overview { min-height: 0; overflow: auto; padding: 0 var(--inset) 12px; }
.practice-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(6px, 2vw, 13px); }
.practice-metric { display: grid; gap: 4px; padding: clamp(9px, 2.3vw, 20px); border: 1px solid var(--line); border-radius: 15px; background: var(--nt-paper); color: var(--nt-muted); overflow-wrap: anywhere; }
.practice-metric:first-child { background: #f0f8d7; color: #455822; }
.practice-metric strong { font-variant-numeric: tabular-nums; color: var(--nt-ink); line-height: 1.06; font-size: clamp(1.35rem, 4vw, 2.45rem); }
.practice-metric > span:last-child { font-size: clamp(.72rem, 2.1vw, .95rem); font-weight: 670; }
.practice-metric-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #ffffffa9; }
.practice-metric-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.practice-meter { margin-top: 12px; color: var(--nt-muted); font-size: .87rem; }
.practice-meter progress { display: block; width: 100%; height: 7px; margin-top: 7px; accent-color: var(--nt-violet); border: none; appearance: none; }
.practice-meter progress::-webkit-progress-bar { background: var(--nt-lilac); border-radius: 10px; }
.practice-meter progress::-webkit-progress-value { background: var(--nt-violet); border-radius: 10px; }
.practice-meter progress::-moz-progress-bar { background: var(--nt-violet); border-radius: 10px; }
.practice-lessons { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; padding: 0 var(--inset) 10px; }
.practice-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .34fr); gap: 8px; margin-bottom: 8px; }
.practice-filters :is(input, select) { min-width: 0; min-height: 44px; width: 100%; padding: 8px 10px; font: 16px/1.2 var(--nt-font); color: var(--nt-ink); background: white; border: 1px solid var(--nt-line); border-radius: 10px; }
.practice-empty { grid-row: 2; padding-block: 10px; color: var(--nt-muted); }
.practice-list { grid-row: 3; min-height: 0; max-height: 48dvh; list-style: none; padding: 3px 4px 3px 3px; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 7px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.practice-list li { min-width: 0; }
.practice-lesson { width: 100%; height: 100%; min-height: 55px; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 7px; text-align: left; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--nt-paper); }
.practice-lesson:hover { border-color: var(--nt-violet); background: #f1e8fa; }
.practice-lesson-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: white; color: var(--nt-violet); }
.practice-lesson-copy { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; line-height: 1.2; }
.practice-lesson-copy strong { font-size: .89rem; }
.practice-lesson-copy > span { color: var(--nt-muted); font-size: .75rem; }
.practice-lesson-arrow { color: var(--nt-violet); font-size: 1.2rem; }
.practice-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px 19px; padding: 11px var(--inset) max(11px, env(safe-area-inset-bottom, 0px)); background: #faf7fe; border-top: 1px solid var(--line); }
.practice-bottom #practice-tip { font-size: .92rem; font-weight: 680; overflow-wrap: anywhere; }
.practice-bottom .primary { flex: 0 0 auto; min-height: 44px; }
@media (max-width: 570px) {
  #practice-progress { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 17px; }
  .practice-list { grid-template-columns: minmax(0, 1fr); }
  .practice-bottom { align-items: stretch; flex-direction: column; }
  .practice-nav { width: auto; }
  .practice-nav button { flex: 1; }
}
@media (max-height: 460px) {
  .practice-head { padding-block: 8px; }
  .practice-nav { margin-bottom: 6px; }
  .practice-metric-icon { display: none; }
  .practice-overview { padding-bottom: 6px; }
}
#install-dialog p { margin: 9px 0 }
.topbar { padding-top: env(safe-area-inset-top, 0px) }
.footer { padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)) }
@media (min-width: 601px) and (max-width: 900px) and (orientation: portrait) {
  .layout { grid-template-columns: minmax(0, 1fr) }
  .journey { margin-top: 0 }
  .missions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .missions::before { display: none }
}
@media (pointer: coarse) {
  .coach-toolbar button, .instrument-switch button, .score-tools button, .score-tools select, .language-picker { min-height: 44px }
  .language-picker { font-size: 16px }
  .key, .fm1-key { touch-action: pan-x }
}
@media (min-width: 690px) and (pointer: coarse) {
  .piano .key, .fm1-key { touch-action: none }
}
@media (max-width: 550px) {
  .top-inner { flex-wrap: wrap; row-gap: 5px }
  .top-tools { flex-wrap: wrap; justify-content: flex-end }
  .language-picker { max-width: 119px }
  .footer { flex-wrap: wrap }
  .footer-actions { justify-content: flex-start }
}
.fm1-combo { position: absolute; top: 3px; left: var(--key-x); transform: translateX(-50%); background: transparent; border: 0; border-radius: 3px; padding: 1px 2px; line-height: 15px }
.fm1-combo:is(button) { font-weight: 850; color: #ffd5a5 }
.fm1-focus { outline: 2px solid #ecfdac; color: #f0ffb3; background-color: #594474 !important }
.fm1-help { margin-top: 7px; min-height: 3em; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 9px }
.fm1-help p { font-size: .81rem; max-width: 64ch; margin: 0 }
.fm1-tools { display: inline-flex; align-items: center; gap: 8px; font-size: .73rem; font-weight: 700; color: #664989 }
.fm1-tools button { border: 1px solid #d5c3e7; color: #56378a; background: white; border-radius: 8px; min-height: 29px; font-size: inherit; font-weight: 740 }
@media (max-width: 550px) {
  .fm1-bar { align-items: start }
  .fm1-status { font-size: .74rem }
  .fm1-panel { padding: 7px }
  .instrument-switch button { padding-inline: 8px }
}
