/* A playing surface, sized to the visible viewport. No controls in a scroll area. */
body{height:100dvh;display:flex;flex-direction:column;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
header{height:48px;min-height:48px;padding:0 18px}
.brand{gap:9px}.brand strong{font-size:20px}.brand small,.session,.keyboard-heading,.assignment-hint,.key-hints,#keyboard-status,footer>span:first-child{display:none}
.seal{font-size:22px}.brand i{font-size:16px}.header-right{gap:10px}.tuning{font-size:10px}#help{font-size:12px;padding:4px 10px}#help span{display:inline;font-size:10px}#help b{display:none}
main{width:100%;max-width:1600px;flex:1;min-height:0;margin:0 auto;padding:4px 18px;display:grid;grid-template-rows:minmax(0,1fr) 52px 216px 26px;gap:6px}
.instrument-section{margin:0;min-height:0;display:grid;grid-template-rows:18px minmax(0,1fr) 25px}
.stage-labels{padding:0 7%;font-size:9px;letter-spacing:1px}.stage-labels small{display:inline;margin-left:8px;font-size:9px}
#stage{height:100%;min-height:0}
.stage-footer{padding:0 3%;font-size:10px}.stage-footer>span>span{font-size:10px}
#labels{min-height:25px;padding:0;font-size:10px}
.controls{padding:4px 10px;gap:16px;display:flex;margin:0}
.techniques{gap:10px}.control-label{font-size:11px}.control-label small{display:none}.segmented{margin:0;padding:2px}.segmented button{min-height:38px;min-width:66px;padding:2px 10px}.segmented b{font-size:11px}.segmented span{font-size:9px;margin:0}
.controls .volume{width:150px;margin-left:auto}.controls label{font-size:10px}.controls .stop{min-height:38px;padding:4px 9px;font-size:10px}
.controls input{height:20px;margin:0}
.keyboard-section{margin:0;min-height:0}.hands-layout{height:100%;margin:0;grid-template-columns:minmax(280px,.8fr) minmax(350px,1.4fr);gap:16px}
.left-hand{padding-right:16px}.hand-title{font-size:12px;margin:0 0 5px;gap:8px;height:18px}.hand-title>span{font-size:8px}.hand-title>small{font-size:8px}
#bend-channels{gap:8px;height:calc(100% - 23px)}.bend-card{padding:7px;display:flex;flex-direction:column;justify-content:space-between}
.bend-heading{margin:0;gap:3px;flex-direction:row;align-items:center}.bend-heading strong{font-size:11px}.bend-heading small{display:none}.lane-readout{font-size:9px;min-height:12px}
.target-label{font-size:9px}.target-label select{min-height:30px;font-size:10px;margin:2px 0 4px;padding:2px}
.bend-buttons{gap:4px}.bend-buttons button{min-height:43px;padding:3px 1px;flex-direction:row;gap:5px;justify-content:center}.bend-buttons kbd{font-size:10px;min-width:18px;padding:2px}.bend-buttons button span{font-size:9px}.bend-buttons small{font-size:8px;margin:0}
.continuous-label{margin:3px 0 0;font-size:9px}.continuous-label>span{font-size:8px}.bend-card input{height:24px;margin:0}.bend-card .mini{font-size:8px}
#key-grid{height:calc(100% - 23px);gap:5px}.octave-row{flex:1;min-height:0;gap:7px}.octave-label{width:32px;font-size:11px}.octave-label small{display:none}.key-group{height:100%;gap:5px}.note-key{min-height:0;padding:2px;display:flex;align-items:center;justify-content:center;gap:7px}
.note-key .key-letter{font-size:12px;line-height:14px}.note-key .degree{font-size:17px;margin:0}.note-key .pitch{font-size:9px;display:inline;margin:0}.note-key .octave-dots{font-size:7px}.bend-tag{font-size:7px}
footer{margin:0;padding:0;flex-wrap:nowrap;border-top:1px solid var(--line);font-size:9px}footer button{min-height:24px;padding:0;font-size:9px;margin:0}footer button span{font-size:9px}#audio-state{width:auto;font-size:9px;margin-left:auto}
#start{min-width:200px;padding:8px 20px}.start-icon{display:none}#start strong{font-size:20px;margin:0}#start>span:not(.start-icon){font-size:12px}#load-status{margin-top:6px;font-size:9px}
@media(max-width:650px) and (orientation:portrait){
 header{height:44px;min-height:44px;padding:0 10px}.brand i{font-size:13px}.brand strong{font-size:18px}.seal{font-size:20px}.tuning{display:none}.header-right{gap:3px}#help{font-size:10px;padding:3px 6px}#help span{font-size:9px}.icon{width:32px;font-size:20px}
 main{padding:2px 8px;gap:4px;grid-template-rows:minmax(0,1fr) 48px 340px 24px}
 .stage-labels{font-size:8px;letter-spacing:0}.stage-labels small{display:none}.stage-footer>span>span{display:none}
 .controls{gap:7px;padding:3px 5px}.control-label{display:none}.segmented button{min-width:45px;padding:2px 5px}.controls .volume{width:70px;min-width:45px}.controls label{font-size:9px;gap:3px}.controls small{font-size:7px;letter-spacing:0}.controls .stop{flex-direction:column;gap:0;padding:2px 5px}.controls .stop span{font-size:9px;margin:0}.controls .stop kbd{display:none}
 .hands-layout{grid-template-columns:1fr;grid-template-rows:155px minmax(0,1fr);gap:6px}.left-hand{padding:0;border:0}.hand-title{height:15px;margin-bottom:3px;font-size:11px}.hand-title>span{font-size:8px}.hand-title>small{display:none}
 #bend-channels{height:calc(100% - 18px);gap:6px}.bend-card{padding:5px}.target-label{font-size:0}.target-label>span{display:none}.target-label select{margin:2px 0;min-height:28px;font-size:10px}.bend-buttons button{min-height:36px}.bend-buttons kbd{font-size:10px}.bend-buttons button span{font-size:9px}.continuous-label{margin:0;font-size:8px}.continuous-label>span{font-size:8px}.bend-card .mini{display:none}.bend-card input{height:24px}
 #key-grid{height:calc(100% - 18px);gap:4px}.octave-label{width:25px}.octave-row{gap:4px}.key-group{gap:4px}.note-key{gap:4px}.note-key .key-letter{font-size:9px}.note-key .degree{font-size:15px}.note-key .pitch{font-size:8px}.note-key{flex-wrap:wrap;align-content:center;column-gap:4px;row-gap:0}.note-key .pitch{width:100%;line-height:10px}
}
@media(max-height:500px) and (orientation:landscape){
 header{height:38px;min-height:38px}.brand strong{font-size:17px}.brand small,.seal{display:none}
 main{grid-template-columns:40% minmax(0,1fr);grid-template-rows:44px minmax(0,1fr) 24px;gap:5px;padding:3px 10px}
 .instrument-section{grid-column:1;grid-row:1/3}.controls{grid-column:2;grid-row:1;gap:6px;padding:2px 5px}.keyboard-section{grid-column:2;grid-row:2}footer{grid-column:1/-1;grid-row:3}
 .stage-labels{font-size:8px;letter-spacing:0}.stage-labels small,.stage-footer>span>span,.control-label{display:none}
 .hands-layout{grid-template-columns:minmax(140px,.8fr) minmax(190px,1.2fr);gap:6px}.left-hand{padding-right:5px}#bend-channels{grid-template-columns:1fr;gap:3px}.bend-card{padding:3px;display:grid;grid-template-columns:1fr 1fr;gap:2px;align-content:center}.bend-heading{grid-column:1/-1}.target-label{font-size:0;grid-column:1/-1}.target-label>span,.continuous-label,.bend-card .mini{display:none}.target-label select{min-height:23px;margin:0;font-size:9px}.bend-buttons{grid-column:1/-1}.bend-buttons button{min-height:28px;gap:2px}.bend-buttons small{display:none}.bend-card input{grid-column:1/-1;height:18px}.bend-buttons kbd{font-size:9px;padding:1px;min-width:13px}
 .controls .volume{width:65px;min-width:40px}.controls small{display:none}.segmented button{min-width:42px;padding:2px 5px;min-height:34px}.controls .stop{padding:2px 4px;min-height:34px}.controls .stop kbd{display:none}.controls .stop span{font-size:9px}
 .hand-title{font-size:10px;gap:4px}.hand-title>span{font-size:7px;letter-spacing:0}.hand-title>small{display:none}.octave-label{width:19px;font-size:9px}.octave-row{gap:3px}.key-group{gap:3px}.note-key{flex-direction:column;gap:1px}.note-key .key-letter{font-size:9px}.note-key .pitch{display:none}.note-key .degree{font-size:14px}.lane-readout{font-size:8px}
}
.now-playing{font-size:10px;color:var(--gold);white-space:nowrap}.now-playing small{font-size:9px;color:var(--muted)}#gesture-hint{margin-left:auto;margin-right:10px}
#help-dialog{padding:30px 24px 18px;max-width:540px}
#help-dialog .instructions{margin-top:14px}
#help-dialog article[hidden]{display:none}
#help-dialog article{min-height:165px;padding:14px 0;gap:12px}
#help-dialog h3{font-size:17px}
#help-dialog p{font-size:13px;line-height:1.6}
.tutorial-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11px}
.tutorial-nav button{padding:5px 10px;font-size:11px}.tutorial-nav button:disabled{opacity:.3;cursor:default}
.close-help{width:100%;min-height:42px}
@media(max-width:650px){#gesture-hint{display:none}.now-playing small{font-size:8px}#help-dialog{padding:28px 18px 16px}}
@media(max-height:500px){#help-dialog{padding:18px;max-width:620px}#help-dialog .instructions{margin-top:5px}#help-dialog article{min-height:0;padding:7px 0}#help-dialog h3{font-size:14px;margin:0 0 5px}#help-dialog p{font-size:11px;margin:3px 0;line-height:1.4}.close-help{margin-top:5px;min-height:34px;padding:5px}.tutorial-nav button{min-height:32px}}
header button{min-height:36px}
.note-key .key-letter{position:absolute;left:5px;top:3px;font-size:9px;line-height:10px;color:#92a595}
.note-key .degree{margin-left:6px}
@media(max-width:650px) and (orientation:portrait){.note-key{flex-direction:column;flex-wrap:nowrap;gap:1px}.note-key .degree{margin:0}.note-key .key-letter{left:3px;top:2px;font-size:8px}.note-key .pitch{width:auto}}
@media(max-height:500px) and (orientation:landscape){#gesture-hint{display:none}.stage-footer{gap:5px}#labels{font-size:9px;gap:4px}#labels span{display:none}.now-playing small{display:none}.note-key .degree{margin:0}}
/* Small viewport height stays fixed as mobile browser chrome hides on scroll. */
/* Touch-first layout: the instrument owns the first screen; pads are below. */
.touch-more,.back-to-strings{display:none}
@media (max-width:650px), (pointer:coarse) and (max-width:1100px), (max-width:950px) and (max-height:500px){
 body{height:auto;min-height:100svh}
 main{display:grid;flex:none;grid-template-columns:minmax(0,1fr);grid-template-rows:calc(100svh - 116px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) 54px auto 30px;gap:6px;padding:3px 8px 10px}
 header{height:44px;min-height:44px;padding:0 10px}
 .instrument-section{grid-column:1;grid-row:1;grid-template-rows:22px minmax(0,1fr) 32px}
 .stage-labels{font-size:10px;letter-spacing:0;align-items:center}
 .stage-labels small{display:none}
 #stage{height:100%;min-height:0;scroll-margin-top:8px}
 .stage-footer{padding:0 3%;gap:10px}
 #labels{min-height:32px;font-size:10px;gap:5px}
 #labels span{display:none}
 .touch-more{display:inline-flex;align-items:center;min-height:32px;gap:4px;font-size:10px;white-space:nowrap;text-decoration:none;margin-left:auto}
 .touch-more span{font-size:9px;color:var(--muted)}
 .now-playing{font-size:12px}.now-playing small{display:none}#gesture-hint{display:none}
 .controls{grid-column:1;grid-row:2;padding:4px 6px;gap:8px}
 .controls .techniques{grid-column:auto}.controls .control-label{display:none}
 .segmented button{min-height:42px;min-width:46px;padding:3px 6px}
 .controls .volume{min-width:40px;width:80px;margin-left:auto}.controls small{font-size:8px;letter-spacing:0}
 .controls .stop{min-height:42px;padding:3px 6px;flex-direction:column;gap:1px}
 .controls .stop kbd{display:none}.controls .stop span{font-size:9px;margin:0}
 .keyboard-section{grid-column:1;grid-row:3;margin-top:16px;padding:14px 0;border-top:1px solid var(--line);scroll-margin-top:10px}
 .keyboard-heading{display:flex;margin-bottom:12px;font-size:12px;gap:8px}.keyboard-heading>span{font-size:0}.keyboard-heading small{display:block;font-size:10px;letter-spacing:0;margin:0}
 .keyboard-heading>span:before{content:'音键与双按 · Notes & bends';font-size:12px}
 #keys-toggle{display:none}.back-to-strings{display:inline-flex;align-items:center;min-height:40px;text-decoration:none;font-size:10px}
 .hands-layout{height:auto;grid-template-columns:1fr;grid-template-rows:210px 285px;gap:16px}
 .left-hand{padding:0;border:0}.hand-title{height:20px;margin:0 0 6px;font-size:12px}.hand-title>span{font-size:9px}
 #bend-channels{height:184px;grid-template-columns:1fr 1fr;gap:8px}
 .bend-card{padding:8px;display:flex;flex-direction:column;justify-content:space-between;gap:0}
 .bend-heading{display:flex;align-items:center;flex-direction:row}.bend-heading strong{font-size:11px}.lane-readout{font-size:9px}
 .target-label{font-size:0}.target-label>span{display:none}.target-label select{min-height:38px;margin:3px 0;font-size:11px}
 .bend-buttons button{min-height:44px;gap:4px}.bend-buttons kbd{font-size:10px;padding:2px}.bend-buttons small{display:block;font-size:8px}.bend-buttons span{font-size:10px}
 .continuous-label{display:block;font-size:9px;margin:2px 0}.continuous-label>span{font-size:8px}.bend-card input{height:30px}.bend-card .mini{display:none}
 #key-grid{height:259px;gap:8px}.octave-row{gap:6px}.octave-label{width:28px;font-size:11px}.key-group{gap:5px}
 .note-key{flex-direction:column;gap:3px}.note-key .degree{font-size:20px;margin:0}.note-key .pitch{display:block;width:auto;font-size:10px;line-height:12px}.note-key .key-letter{font-size:9px;top:4px;left:4px}
 footer{grid-column:1;grid-row:4;min-height:30px}
}
@media (orientation:landscape) and (pointer:coarse) and (max-width:1100px), (orientation:landscape) and (max-width:950px) and (max-height:500px){
 header{height:38px;min-height:38px}
 main{grid-template-columns:minmax(0,1fr) 88px;grid-template-rows:calc(100svh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) auto 30px;gap:6px;padding:3px 8px 10px}
 .instrument-section{grid-column:1;grid-row:1;grid-template-rows:18px minmax(0,1fr) 30px}
 .stage-labels{font-size:9px}.stage-labels small{display:inline;font-size:8px}
 .controls{grid-column:2;grid-row:1;display:flex;flex-direction:column;justify-content:space-around;gap:5px;padding:6px 4px}
 .techniques{width:100%;display:block}.segmented{flex-direction:column;width:100%;padding:2px}.segmented button{width:100%;min-width:0;min-height:42px;padding:3px}
 .controls .volume{width:100%;margin:0}.controls label{font-size:9px;justify-content:center;gap:4px}.controls small{display:none}.controls input{height:28px}
 .controls .stop{width:100%;min-height:44px;gap:0}
 .keyboard-section{grid-column:1/-1;grid-row:2}
 .hands-layout{grid-template-columns:minmax(260px,.85fr) minmax(320px,1.15fr);grid-template-rows:285px;gap:18px}
 #bend-channels{height:259px}.bend-card{padding:10px}.target-label select{font-size:11px}.bend-buttons button{min-height:55px;flex-direction:column;gap:4px}.continuous-label>span{display:block}
 footer{grid-column:1/-1;grid-row:3}
}
