:root{font-family:ui-rounded,'SF Pro Rounded','Avenir Next','Nunito',system-ui,sans-serif;color:#344a48;background:#f6f1e6;font-synthesis:none;-webkit-tap-highlight-color:transparent}*{box-sizing:border-box}body{margin:0;overscroll-behavior:none;user-select:none;-webkit-user-select:none}button,select{font:inherit;color:inherit}button{cursor:pointer;border:0;touch-action:manipulation}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #e19735;outline-offset:4px}button:disabled{opacity:.5;cursor:wait}button:active{transform:translateY(2px)}[hidden]{display:none!important}.app{height:100vh;height:100dvh;min-height:530px;max-width:1500px;margin:auto;padding:12px max(18px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));display:flex;flex-direction:column;gap:12px}header{height:60px;flex-shrink:0;display:flex;align-items:center;gap:18px}.brand{display:flex;align-items:center;gap:12px}.brand-icon{font-family:Georgia,serif;font-size:43px;color:#be7458;transform:rotate(-10deg)}h1{font-family:Georgia,'Songti SC',serif;font-weight:500;font-size:28px;margin:0;letter-spacing:-.8px}.brand p{font-size:12px;letter-spacing:.2px;margin:3px 0 0;color:#7b8780}.header-actions{margin-left:auto;display:flex;gap:9px}.round{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;border:1px solid #dfdfd3;background:#fffdf8;font-size:23px}.round[aria-pressed=false]{color:#a7a99d;background:#ebe8df}.modes{display:flex;gap:5px;background:#eae7dd;border-radius:18px;padding:5px;width:min(570px,100%);margin:0 auto;flex-shrink:0}.modes button{flex:1;min-height:48px;border-radius:13px;background:transparent;display:flex;align-items:center;justify-content:center;gap:8px;font-size:15px;font-weight:650;white-space:nowrap}.modes b{font-size:24px;font-weight:500}.modes button[aria-pressed=true]{background:#4e7769;color:#fff;box-shadow:0 3px 8px #365a4820}.music-desk{width:min(1050px,100%);margin:0 auto;background:#fffcf5;border:1px solid #e4e4d7;border-radius:22px;padding:12px 22px 0;flex-shrink:0;box-shadow:0 7px 24px #59523805}.song-bar{display:flex;align-items:center;gap:12px}#choose{background:transparent;display:flex;align-items:center;text-align:left;gap:13px;min-height:54px;padding:0 5px}#song-icon{width:44px;height:44px;border-radius:14px;background:#f9e3a8;color:#a36b25;font-size:27px;display:grid;place-items:center}#choose small{display:block;font-size:11px;color:#849086;line-height:1.7}#song-name{font-weight:650;font-size:17px}.chevron{font-size:22px;margin-left:14px}.tag{font-size:10px;border-radius:6px;background:#eeeee6;color:#6c7e70;padding:5px 7px}.song-bar label{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:12px;color:#7e887e}.song-bar select{height:44px;max-width:115px;border:1px solid #dedfd2;border-radius:10px;background:#f7f7ef;padding:0 8px;color:#435e52}.lesson{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:64px;margin-top:3px}.message h2{font-size:22px;margin:0;font-weight:650;letter-spacing:-.4px}.message p{font-size:13px;margin:5px 0 0;color:#7c877c}.transport{display:flex;gap:8px}.primary,.secondary{height:48px;border-radius:14px;white-space:nowrap;padding:0 18px;font-size:15px;font-weight:650}.primary{background:#cc805d;color:white;min-width:105px;box-shadow:0 3px 0 #ad6545}.secondary{background:#edece2;font-size:25px;padding:0 15px}.score-line{display:flex;align-items:center;justify-content:space-between;gap:10px;height:49px}#notes{display:flex;gap:7px;align-items:center}.note-chip{width:34px;height:31px;border-radius:9px;background:#f1f0e7;color:#8b948a;font-size:12px;font-weight:650;display:grid;place-items:center}.note-chip.next{color:#375a4d;background:#dcecd1;outline:2px solid #bad4a8}.note-chip small{font-size:8px}.free-notes{letter-spacing:10px;font-family:Georgia,serif;font-size:22px;color:#c5bda9}#progress-label{font-size:11px;color:#8c9386;font-variant-numeric:tabular-nums}.progress-track{height:4px;background:#eeede5;margin:0 -6px;border-radius:6px 6px 0 0;overflow:hidden}#progress{height:100%;width:0;background:#82a984;transition:width .18s}.instrument{display:flex;flex-direction:column;flex:1;min-height:220px;background:linear-gradient(115deg,#6b4c3e,#8e6950 45%,#6a4d40);border-radius:22px 22px 16px 16px;padding:0 13px 0;box-shadow:0 8px 0 #513c33,0 16px 24px #4935281c;border:1px solid #765748}.piano-rail{height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 7px;color:#e6cfb5;font-size:9px;letter-spacing:1.5px}.rail-name{font-size:10px;letter-spacing:3px}#sound-state{letter-spacing:0;text-align:right;font-size:10px;min-width:85px}.keyboard{display:flex;flex:1;min-height:160px;background:#382d29;padding:0 2px 4px;border-top:4px solid #a95649;gap:0;border-radius:0 0 5px 5px;touch-action:none}.octave{position:relative;display:flex;flex:7;min-width:0;gap:2px}.octave+.octave{margin-left:2px;flex:8}.key{touch-action:none;padding:0;position:relative;border-radius:0 0 7px 7px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;-webkit-user-select:none;user-select:none}.white{height:100%;flex:1;min-width:0;background:linear-gradient(90deg,#eeeae1,#fffefa 12%,#fffdf5 83%,#e7e4dc);box-shadow:inset 0 -6px 0 #d6d1c5,inset 0 8px 10px #5c4b3220;z-index:1;color:#7c8178;padding-bottom:17px}.black{position:absolute;z-index:3;top:0;width:9%;height:61%;background:linear-gradient(90deg,#282d2e,#434b4a 35%,#303637 86%,#202727);box-shadow:3px 6px 4px #1d211e50,inset 0 -6px 0 #181f20,inset 1px 0 0 #6b716d;color:#bbc3b6;padding-bottom:14px}.key .letter{font-size:clamp(15px,1.7vw,23px);font-weight:650}.key .letter sub{font-size:9px;vertical-align:baseline;margin-left:2px;font-weight:400;opacity:.6}.key .solfege{font-size:10px;font-weight:500;margin-top:6px;opacity:.7}.black .letter{font-size:11px;font-weight:500}.dot{height:7px;width:7px;border-radius:50%;background:var(--note-color);margin-bottom:12px}.black .dot{width:5px;height:5px;margin-bottom:9px}.key.pressed,.key.sounding{transform:none;background:linear-gradient(90deg,#c4dec0,#e6efd9);box-shadow:inset 0 4px 9px #3b5d3320,inset 0 -2px 0 #b6c8a8;color:#325a46}.black.pressed,.black.sounding{background:linear-gradient(90deg,#457566,#72a486);color:#fff}.key.expected{background:linear-gradient(90deg,#f9d578,#ffe9a9 35%,#ffe3a0);box-shadow:inset 0 0 0 3px #e9b753,inset 0 -5px 0 #d1a44a;color:#765319}.black.expected{background:linear-gradient(90deg,#99731c,#d4a83d,#a57b26);color:#fff4c8;box-shadow:inset 0 0 0 3px #edce6d,2px 5px 4px #1d211e50}.key.expected::after{content:'↓';position:absolute;font-size:32px;font-weight:750;bottom:30%;color:#b67a1a;animation:point 1.4s ease-in-out infinite;pointer-events:none}.black.expected::after{bottom:32%;font-size:27px;color:#fff4bc}.key.lift::after{content:'↑'}.piano-foot{height:30px;display:flex;align-items:center;justify-content:space-between;padding:0 7px;color:#cfb79c;font-size:8px;letter-spacing:1.6px}.piano-foot #playing-note{font-size:12px;letter-spacing:0;color:#f6dfbd}footer{height:20px;font-size:10px;color:#9d9f91;text-align:center;margin-top:6px;display:flex;justify-content:center;align-items:center;gap:12px}footer button{background:none;color:#9c553e;text-decoration:underline;min-height:30px}dialog{border:1px solid #e5e1d3;border-radius:25px;padding:22px;background:#fffcf4;color:#3d5148;width:min(650px,90vw);max-height:85vh;box-shadow:0 15px 80px #10291c40;overflow:auto}dialog::backdrop{background:#243c395c;backdrop-filter:blur(5px)}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:16px}.dialog-heading h2{font-family:Georgia,'Songti SC',serif;font-size:25px;font-weight:500;margin:0}#song-list{display:grid;grid-template-columns:1fr 1fr;gap:10px}.song-option{text-align:left;background:#f2f1e6;border:2px solid transparent;border-radius:15px;min-height:94px;padding:12px;display:flex;gap:12px;align-items:center}.song-option.selected{border-color:#85a68a;background:#e8eddd}.song-option .symbol{font-size:28px;color:#ae7b40;width:30px;flex-shrink:0;text-align:center}.song-option strong{display:block;font-size:15px;line-height:1.4}.song-option small{display:block;font-size:11px;color:#7a8a78;margin-top:6px}.dialog-note{font-size:12px;color:#8a9486;line-height:1.7;margin:18px 0 0}.about-copy{user-select:text;-webkit-user-select:text;font-size:13px;line-height:1.8}.about-copy a{color:#3b7b63}.about-copy h3{margin:20px 0 8px}.about-copy li{margin:0 0 12px}.about-copy ul{padding-left:20px}#celebration{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:10}.spark{position:absolute;left:var(--x);top:30%;font-size:var(--size);color:var(--color);animation:float 1.6s ease-out forwards}@keyframes point{0%,100%{transform:translateY(-5px)}50%{transform:translateY(5px)}}@keyframes float{from{transform:translateY(0) rotate(0);opacity:1}to{transform:translateY(-170px) rotate(35deg);opacity:0}}
@media (orientation:portrait){.app{min-height:620px;gap:12px}.keyboard{flex-direction:column;gap:14px;padding:0 3px 5px;background:transparent;border:0}.octave,.octave+.octave{flex:1;margin-left:0;border-top:4px solid #a95649;min-height:140px}.instrument{min-height:330px}.black{width:9%;height:60%}.white{padding-bottom:11px}.piano-rail{height:32px}.key .letter{font-size:21px}.key .solfege{font-size:10px;margin-top:3px}.dot{margin-bottom:8px}.black .letter{font-size:13px}.message h2{font-size:21px}}
@media (max-width:600px){.app{padding:8px 10px 8px;gap:8px}header{gap:9px;height:48px}.brand{gap:5px}.brand-icon{font-size:31px}h1{font-size:23px}.brand p{display:none}.header-actions{gap:5px}.round{width:44px;height:44px}.modes button{font-size:12px;min-height:42px;gap:5px}.modes b{font-size:20px}.music-desk{padding:8px 12px 0;border-radius:16px}.song-bar{gap:6px}#choose{gap:7px;min-height:48px}#song-icon{width:31px;height:35px;font-size:23px}#song-name{font-size:13px;max-width:175px}.chevron{margin-left:2px}.tag{display:none}.song-bar label>span{display:none}.song-bar select{font-size:12px;max-width:80px;height:42px}.lesson{min-height:59px}.message h2{font-size:16px}.message p{font-size:11px;max-width:220px}.primary,.secondary{height:44px;padding:0 11px;min-width:0;font-size:12px}.secondary{font-size:22px}.transport{gap:5px}.score-line{height:39px}.note-chip{width:27px;height:26px;font-size:10px}#notes{gap:5px}.instrument{padding:0 7px;border-radius:15px;min-height:270px}.octave,.octave+.octave{min-height:112px}.piano-rail{height:28px;font-size:7px;letter-spacing:.7px}.rail-name{font-size:8px;letter-spacing:1.3px}#sound-state{font-size:8px;min-width:50px}.piano-foot{height:23px}.key .letter{font-size:17px}.black .letter{font-size:10px}.key .solfege{font-size:8px}.white{padding-bottom:10px}.black{padding-bottom:9px}.dot{width:5px;height:5px;margin-bottom:5px}.black .dot{display:none}.key.expected::after{font-size:23px;bottom:35%}.black.expected::after{font-size:20px;bottom:37%}#song-list{grid-template-columns:1fr}.song-option{min-height:70px}footer{font-size:9px;margin-top:5px;height:16px}.app{min-height:590px}}
@media (orientation:landscape) and (max-height:650px){.app{gap:7px;min-height:480px}header{height:48px}.modes button{min-height:40px}.music-desk{padding-top:5px}.lesson{min-height:53px}.score-line{height:36px}.instrument{min-height:170px}.keyboard{min-height:120px}.message h2{font-size:20px}.piano-rail{height:27px}.piano-foot{height:23px}.key .solfege{margin-top:3px}.white{padding-bottom:12px}.dot{margin-bottom:7px}footer{display:none}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}

/* Free play shows the instrument first; lessons appear only in lesson modes. */
.app{min-height:0}
body[data-play-mode="free"] .lesson{min-height:32px;margin:0;justify-content:center;text-align:center}
body[data-play-mode="free"] .lesson h2{font-size:16px;font-weight:500;color:#6c7e70}
body[data-play-mode="free"] #subhint,body[data-play-mode="free"] .transport{display:none}
@media(max-width:600px){body[data-play-mode="free"] .lesson h2{font-size:14px}}

body[data-play-mode="free"] .music-desk{padding:0;border:0;background:none;box-shadow:none}
body[data-play-mode="free"] .song-bar,body[data-play-mode="free"] .score-line,body[data-play-mode="free"] .progress-track{display:none}
.sound-status{display:flex;align-items:center;gap:8px;letter-spacing:0}
#sound-retry{min-height:44px;padding:0 12px;background:#fff4d8;color:#6c452b;border-radius:10px;font-size:12px}
.instrument:has(#sound-retry:not([hidden])) .piano-rail{height:48px}
@media(orientation:landscape) and (max-height:650px){
 .app{min-height:0;gap:6px;padding-top:6px;padding-bottom:10px}.instrument{min-height:0}.keyboard{min-height:0}
}
@media(orientation:landscape) and (max-height:500px){
 .app{display:grid;grid-template-columns:minmax(240px,.85fr) minmax(0,1fr);grid-template-rows:48px auto minmax(0,1fr);gap:6px 12px;padding:6px max(12px,env(safe-area-inset-right)) 10px max(12px,env(safe-area-inset-left))}
 header{height:48px;gap:10px;min-width:0}.brand{gap:4px}.brand-icon,.brand p{display:none}h1{font-size:21px}.header-actions{gap:5px}.round{width:44px;height:44px}
 .modes{width:100%;margin:0;align-self:center;padding:2px;border-radius:14px}.modes button{min-height:44px;font-size:12px;gap:5px}.modes b{font-size:20px}
 .music-desk{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:0 20px;padding:4px 12px 0;border-radius:14px}
 .song-bar{min-width:0;gap:8px}#choose{min-height:44px;gap:8px}#choose small,.tag{display:none}#song-icon{width:32px;height:32px;font-size:22px}#song-name{font-size:13px} .chevron{margin-left:0}.song-bar label>span{display:none}.song-bar select{height:44px;font-size:12px;max-width:83px}
 .lesson{min-height:44px;margin:0}.message h2{font-size:14px}.message p{font-size:10px;margin-top:2px;line-height:1.3;max-width:230px}.transport{gap:5px}.primary,.secondary{height:44px;padding:0 10px;font-size:12px;min-width:0}.secondary{font-size:22px}
 .score-line{height:25px;grid-column:1/-1}.note-chip{height:20px;width:27px;font-size:9px}.progress-track{grid-column:1/-1;height:3px}#notes{gap:4px}
 body[data-play-mode="free"] .music-desk{display:block}body[data-play-mode="free"] .lesson{min-height:24px}body[data-play-mode="free"] .lesson h2{font-size:13px}
 .instrument{grid-column:1/-1;min-height:0;box-shadow:0 5px 0 #513c33,0 8px 15px #4935281c;border-radius:15px;padding:0 8px}.keyboard{min-height:0}.piano-rail{height:22px}.piano-foot{height:20px}.white{padding-bottom:7px}.black{padding-bottom:7px}.dot{margin-bottom:6px}.key .letter{font-size:17px}.key .solfege{font-size:9px;margin-top:2px}.black .letter{font-size:10px}.key.expected::after{font-size:24px}.black.expected::after{font-size:22px}footer{display:none}
}

.modes button{min-height:44px}

/* Keep longer song titles inside the lesson strip and the expanded chooser. */
#choose{min-width:0;flex:1}#choose>span:nth-child(2){min-width:0}#song-name{display:block;overflow-wrap:anywhere}#song-icon,.chevron{flex-shrink:0}.song-option>span:last-child{min-width:0}.song-option strong{overflow-wrap:anywhere}
#songs .dialog-heading{position:sticky;top:-22px;background:#fffcf4;z-index:2;padding:10px 0}

/* One song desk, with a compact choice of listening or guided playing. */
.modes button{flex:1}.song-options{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0}
.song-mode{display:flex;gap:4px;padding:3px;background:#eceee3;border-radius:13px}.song-mode button{min-height:44px;padding:0 14px;border-radius:10px;background:transparent;font-size:13px;font-weight:650;white-space:nowrap}.song-mode button[aria-pressed=true]{background:#fffdf5;box-shadow:0 2px 5px #3c584515;color:#426c50}
#tempo-wrap{display:flex;align-items:center;gap:6px;font-size:11px;color:#7a8876}#tempo-wrap select{height:44px;border:1px solid #d9dfcb;border-radius:10px;background:#fffdf5;padding:0 7px;font-size:12px}
body[data-play-mode=free] .song-options{display:none}
@media(max-width:600px){.song-options{gap:5px}.song-mode{gap:1px}.song-mode button{padding:0 9px;font-size:12px}#tempo-wrap>span{display:none}#tempo-wrap select{max-width:78px;padding:0 4px}}
@media(orientation:portrait) and (max-height:700px){.app{gap:5px}.instrument{min-height:210px}.octave,.octave+.octave{min-height:80px}.music-desk{padding-top:4px}.lesson{min-height:48px}.score-line{height:28px}.keyboard{gap:8px}footer{display:none}}
@media(orientation:landscape) and (max-height:500px){.song-bar{grid-column:1;grid-row:1}.song-options{grid-column:2;grid-row:1;margin:0;gap:5px}.song-mode button{padding:0 8px;font-size:12px}#tempo-wrap>span{display:none}.lesson{grid-column:2;grid-row:2}.score-line{grid-column:1;grid-row:2}.progress-track{grid-row:3}}

@media(max-width:360px){.song-mode button{font-size:11px;padding:0 6px}#tempo-wrap select{font-size:11px;max-width:66px}}
