/* Phone controls are laid out at their real touch size, never scaled down.
   The musical selection stays in normal flow instead of covering buttons. */
body:not([data-view=dance]):not([data-view=stage]) #dance-dock-caption{display:none}

@media(max-width:600px), (max-width:950px) and (max-height:500px){
 #instrument-view{--phone-nav-width:clamp(110px,calc((100vw - 92px)/2),140px);--phone-bottom:calc(24px + env(safe-area-inset-bottom))}
 body[data-view] #instrument-view #wheel-dock.is-floating{top:calc(12px + env(safe-area-inset-top))!important;left:12px!important}
 #instrument-view.artist-header-layout #artist-language-group{top:calc(12px + env(safe-area-inset-top));right:12px;gap:6px;align-items:center}
 #instrument-view #wheel-dock #dock-toggle,#instrument-view.artist-header-layout #artist-toggle{width:var(--phone-nav-width);min-width:0;height:60px;min-height:60px;padding:7px;gap:5px;border:1px solid #dde8e9;border-radius:21px;background:#fffffff5;box-shadow:0 5px 20px #45668110;flex-direction:row}
 #instrument-view #wheel-dock #dock-toggle svg,#instrument-view.artist-header-layout #artist-mini-wheel{width:44px;height:44px;flex:none}
 #instrument-view #wheel-dock #dock-toggle #lab-label,#instrument-view.artist-header-layout #artist-toggle .artist-hey-label{display:block!important;font-size:16px;font-weight:600;line-height:1.2}
 #instrument-view #wheel-dock #dock-toggle .dock-arrow,#instrument-view.artist-header-layout #artist-toggle .artist-phone-arrow{display:grid!important;place-items:center;width:22px;height:40px;font-size:28px;margin:0 0 0 auto;padding:0;flex:none}
 #instrument-view #artist-language-group .locale-trigger{width:56px;min-width:56px;height:60px;min-height:60px;padding:6px 3px;gap:3px;border-radius:19px;font-size:14px}
 #instrument-view #artist-language-group .locale-trigger svg{width:18px;height:18px}
 #instrument-view.artist-header-layout #wheel-dock.is-floating .dock-panel{top:76px;max-height:calc(var(--workspace-height,100dvh) - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 #instrument-view .wheel-label{font-size:15px;min-height:54px}
 #instrument-view.artist-header-layout #artist-panel{max-height:calc(var(--workspace-height,100dvh) - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}

 /* One shared footprint for every collapsed workspace. */
 #instrument-view.artist-header-layout #artist-transport-group{left:50%;right:auto;top:auto;bottom:var(--phone-bottom);transform:translateX(-50%);width:calc(100% - 24px);max-width:520px;max-height:none}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport){box-sizing:border-box;width:calc(100% - 24px);max-width:520px;height:auto;max-height:none;left:50%;right:auto;top:auto;bottom:var(--phone-bottom);transform:translateX(-50%);padding:10px;gap:8px 6px;border:1px solid #dae7ed;border-radius:25px;background:#fffffff5;box-shadow:0 8px 32px #385b7520;grid-template-columns:repeat(6,minmax(0,1fr));align-items:center;justify-items:stretch;overflow:visible}
 body[data-view] #instrument-view.artist-header-layout #artist-transport-group #music-floating{position:relative;inset:auto;transform:none;width:100%;max-width:100%;flex:none;display:grid;gap:8px 6px}
 body[data-view] #instrument-view:not(.recorder-open) #music-floating:not([hidden]),body[data-view] #instrument-view .inspire-floating-transport:not([hidden]),body:not([data-view=play]):not([data-view=inspire]) #instrument-view:not(.controls-open) .workspace-edge-controls{display:grid}
 #instrument-view.controls-open :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport){display:none!important}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) .slap-controls{display:contents}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) button,body[data-view] #instrument-view #dance-dock-mode{box-sizing:border-box;width:100%!important;min-width:0!important;max-width:none!important;height:48px;min-height:48px;padding:6px!important;margin:0;border-radius:15px;font-size:16px;line-height:1.25;flex:none!important}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) :is([data-slap-toggle],[data-volume-controls],.reset-handpan-button) svg{width:24px;height:24px}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) .reset-handpan-button span{display:none}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) :is(.tempo-chip,.inspire-tempo-button){display:flex;align-items:center;justify-content:center;gap:4px}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) :is(.tempo-chip,.inspire-tempo-button) b{font-size:23px}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) :is(.tempo-chip,.inspire-tempo-button) small{font-size:13px}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls) .transport-caption{position:static!important;inset:auto;width:100%!important;min-height:48px!important;height:auto!important;line-height:1.3;font-size:15px!important;white-space:normal;overflow-wrap:anywhere;overflow:hidden;padding:5px 7px!important;background:var(--accent-soft,#f0f5f8)!important;border-radius:14px;grid-area:caption}
 body[data-view] #instrument-view #music-floating{grid-template-areas:'play loop tempo tempo volume settings' 'rewind reset slap caption caption caption'}
 body[data-view] #instrument-view #music-floating [data-music-play]{grid-area:play;font-size:0;height:52px}
 body[data-view] #instrument-view #music-floating [data-music-play]::before{content:'▶';font-size:23px}
 body[data-view] #instrument-view #music-floating[data-playing=true] [data-music-play]::before{content:'Ⅱ'}
 #music-floating [data-touch-record],#music-floating [data-music-random]{grid-area:loop}
 body[data-view] #instrument-view #music-floating .loop-monogram{font-size:13px;line-height:12px}
 #music-floating [data-music-rewind]{grid-area:rewind}
 #music-floating [data-music-tempo]{grid-area:tempo}
 #music-floating [data-music-settings]{grid-area:settings}
 body[data-view] #instrument-view #music-floating [data-music-settings]{font-size:28px}
 :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) .reset-handpan-button{grid-area:reset}
 :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) [data-slap-toggle]{grid-area:slap}
 :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport) [data-volume-controls]{grid-area:volume}
 body[data-view] #instrument-view .workspace-edge-controls{grid-template-areas:'reset slap volume settings settings settings'}
 body[data-view=dance] #instrument-view .workspace-edge-controls{grid-template-areas:'play tempo tempo mode mode settings' 'reset slap volume caption caption caption'}
 body[data-view=stage] #instrument-view .workspace-edge-controls{grid-template-areas:'play tempo tempo settings settings settings' 'reset slap volume caption caption caption'}
 #dance-dock-play,#floating-play{grid-area:play}
 #dance-quick-tempo{grid-area:tempo}
 body:not([data-view=dance]):not([data-view=stage]) #instrument-view .workspace-edge-controls #dance-quick-tempo{display:none}
 #dance-dock-mode{grid-area:mode}
 #fullscreen-settings{grid-area:settings}
 body[data-view] #instrument-view #dance-dock-mode{font-size:14px;padding-inline:6px;min-width:0;max-width:100%;text-overflow:ellipsis}
 body[data-view=dance] #instrument-view .workspace-edge-controls #fullscreen-settings{font-size:0}
 body[data-view=dance] #instrument-view #dance-dock-play{font-size:23px}
 body[data-view] #instrument-view .workspace-edge-controls .settings-toggle>span:first-child{font-size:27px}
 body[data-view] #instrument-view .inspire-floating-transport{grid-template-areas:'play play random random tempo tempo' 'rewind reset slap volume settings settings'}
 #inspire-float-play{grid-area:play}#inspire-float-random{grid-area:random}#inspire-float-tempo{grid-area:tempo}#inspire-float-rewind{grid-area:rewind}#inspire-float-settings{grid-area:settings}
 body[data-view] #instrument-view #inspire-float-settings{display:flex;align-items:center;justify-content:center;gap:5px;font-size:14px}
 body[data-view] #instrument-view #inspire-float-tempo{flex-direction:row}
 #instrument-view #touch-recorder,#instrument-view #metro-mini{bottom:var(--phone-bottom);width:calc(100% - 24px);max-width:520px;box-sizing:border-box}
 #instrument-view #touch-recorder.is-minimized{padding:8px;gap:8px 2px;grid-template-columns:repeat(6,minmax(0,1fr))}
 #instrument-view #touch-recorder.is-minimized .recorder-heading,#instrument-view #touch-recorder.is-minimized .recorder-actions{display:contents}
 #instrument-view #touch-recorder.is-minimized button{width:100%!important;min-width:0!important;height:44px;min-height:44px;grid-row:1}
 #instrument-view #touch-recorder.is-minimized #recorder-back{grid-column:1}
 #instrument-view #touch-recorder.is-minimized #recorder-record{grid-column:2}
 #instrument-view #touch-recorder.is-minimized #recorder-play{grid-column:3}
 #instrument-view #touch-recorder.is-minimized #recorder-clear{grid-column:4}
 #instrument-view #touch-recorder.is-minimized #recorder-click{grid-column:5}
 #instrument-view #touch-recorder.is-minimized #recorder-minimize{grid-column:6}
 #instrument-view #touch-recorder.is-minimized .recorder-performance{grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:10px;align-items:center;padding:2px 3px 4px}
 #instrument-view #touch-recorder.is-minimized .recorder-readout{font-size:14px}
 #instrument-view #touch-recorder.is-minimized #recorder-progress{height:23px;margin:0}
 #instrument-view #touch-recorder.is-minimized .recorder-measure i{top:7px}
 #instrument-view #metro-mini button{min-width:44px;min-height:44px}
}
@media(max-width:359px){
 #instrument-view #wheel-dock #dock-toggle,#instrument-view.artist-header-layout #artist-toggle{padding:6px;gap:3px}
 #instrument-view #wheel-dock #dock-toggle svg,#instrument-view.artist-header-layout #artist-mini-wheel{width:40px;height:40px}
 #instrument-view #wheel-dock #dock-toggle #lab-label,#instrument-view.artist-header-layout #artist-toggle .artist-hey-label{font-size:15px}
 #instrument-view #wheel-dock #dock-toggle .dock-arrow,#instrument-view.artist-header-layout #artist-toggle .artist-phone-arrow{width:17px}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport){padding:8px;gap:6px 2px}
 body[data-view] #instrument-view.artist-header-layout #artist-transport-group #music-floating{gap:6px 2px}
 body[data-view] #instrument-view #dance-dock-mode{font-size:13px;padding-inline:3px}
}
@media(max-width:600px) and (orientation:portrait){
 #instrument-view #stage-canvas{top:calc(88px + env(safe-area-inset-top))!important}
 body[data-view] #instrument-view:not(.controls-open):not(.play-empty) #stage-canvas{bottom:env(safe-area-inset-bottom)!important;right:0!important;left:0!important}
 #instrument-view.artist-header-layout[data-sheet=full] #control-panel{top:calc(88px + env(safe-area-inset-top));max-height:calc(100% - 100px - env(safe-area-inset-top))}
 #instrument-view #instrument-tools{top:calc(88px + env(safe-area-inset-top))}
}
@media(orientation:landscape) and (max-width:950px) and (max-height:500px){
 #instrument-view{--phone-landscape-dock:clamp(296px,44vw,360px)}
 #instrument-view.artist-header-layout #artist-transport-group,body[data-view] #instrument-view :is(.workspace-edge-controls,.inspire-floating-transport){left:auto;right:12px;top:auto;bottom:var(--phone-bottom);width:var(--phone-landscape-dock);transform:none}
 body[data-view] #instrument-view :is(#music-floating,.workspace-edge-controls,.inspire-floating-transport),body[data-view] #instrument-view.artist-header-layout #artist-transport-group #music-floating{padding:8px;gap:6px 2px}
 body[data-view] #instrument-view:not(.controls-open):not(.play-empty) #stage-canvas{left:0!important;right:calc(var(--phone-landscape-dock) + 24px)!important;top:88px!important;bottom:24px!important}
 #instrument-view #touch-recorder{right:12px;transform:none;width:var(--phone-landscape-dock);max-height:calc(var(--workspace-height,100dvh) - 112px);overflow:auto}
 #instrument-view.artist-header-layout #wheel-dock.is-floating .dock-panel{width:min(580px,calc(100vw - 24px));grid-template-columns:minmax(120px,.8fr) minmax(0,1fr);padding:62px 12px 12px;gap:12px}
 #instrument-view #wheel-dock .wheel-shell{width:clamp(100px,calc(var(--workspace-height,100dvh) - 192px),180px);margin:0;padding:0}
 #instrument-view #wheel-labels{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #instrument-view #wheel-dock .wheel-label{min-height:44px;font-size:14px}
}

@media(max-width:600px), (max-width:950px) and (max-height:500px){
 #instrument-view>:is(#instrument-tools-toggle,#instrument-tools-anchor){top:calc(82px + env(safe-area-inset-top));right:18px}
 #instrument-view #instrument-tools{top:calc(134px + env(safe-area-inset-top));max-height:calc(100% - 152px)}
 /* A brief invitation uses the header's space, never the playing surface. */
 #instrument-view.artist-speaking #wheel-dock #dock-toggle,#instrument-view.artist-speaking.artist-header-layout #artist-toggle{width:48px;min-width:48px;height:60px;padding:5px;justify-content:center}
 #instrument-view.artist-speaking #wheel-dock #dock-toggle svg,#instrument-view.artist-speaking.artist-header-layout #artist-mini-wheel{width:36px;height:36px}
 #instrument-view.artist-speaking #wheel-dock #dock-toggle :is(#lab-label,.dock-arrow),#instrument-view.artist-speaking.artist-header-layout #artist-toggle :is(.artist-hey-label,.artist-phone-arrow){display:none!important}
 #instrument-view.artist-speaking #artist-language-group .locale-trigger{width:44px;min-width:44px;padding:3px;font-size:13px}
 #instrument-view.artist-speaking #artist-language-group .locale-trigger svg{width:15px;height:15px}
 #instrument-view>.artist-callout{padding:6px 8px;font-size:14px;line-height:18px}
}
@media(max-width:600px) and (orientation:portrait){
 /* The first settings level remains scrollable, leaving the handpan dominant. */
 body[data-view] #instrument-view.controls-open:not([data-sheet=full]):not([data-inspire-sheet=full]){--sheet-height:clamp(190px,30%,290px)}
 #instrument-view.controls-open #stage-canvas{top:calc(66px + env(safe-area-inset-top))!important}
 #instrument-view.controls-open #wheel-dock #dock-toggle,#instrument-view.controls-open.artist-header-layout #artist-toggle{width:100px;min-width:0;height:44px;min-height:44px;padding:4px;gap:3px;border-radius:16px}
 #instrument-view.controls-open #wheel-dock #dock-toggle svg,#instrument-view.controls-open.artist-header-layout #artist-mini-wheel{width:32px;height:32px}
 #instrument-view.controls-open #wheel-dock #dock-toggle #lab-label,#instrument-view.controls-open.artist-header-layout #artist-toggle .artist-hey-label{font-size:14px}
 #instrument-view.controls-open #wheel-dock #dock-toggle .dock-arrow,#instrument-view.controls-open.artist-header-layout #artist-toggle .artist-phone-arrow{width:18px;height:32px;font-size:24px}
 #instrument-view.controls-open #artist-language-group .locale-trigger{height:44px;min-height:44px}
 #instrument-view.controls-open>:is(#instrument-tools-toggle,#instrument-tools-anchor){top:calc(64px + env(safe-area-inset-top))}
 #instrument-view.controls-open #instrument-tools{top:calc(116px + env(safe-area-inset-top))}
}
#instrument-view.artist-header-layout:is([data-sheet=full],[data-inspire-sheet=full]) #control-panel{top:calc(116px + env(safe-area-inset-top));max-height:calc(100% - 126px - env(safe-area-inset-top))}

/* The reserve position never participates in layout or input. If a note needs
   that space, dock the real wrench in the header without resizing the handpan. */
#instrument-tools-anchor{position:absolute;visibility:hidden;pointer-events:none;width:44px;height:44px}
#instrument-view #artist-language-group>#instrument-tools-toggle{position:static;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:0;transform:none}
/* The landscape canvas must also stay below the header that receives the key. */
@media(orientation:landscape) and (max-height:500px){
 #instrument-view #stage-canvas{top:calc(76px + env(safe-area-inset-top))!important}
}
@media(orientation:landscape) and (max-width:950px) and (max-height:500px){
 #instrument-view.controls-open #stage-canvas{top:calc(88px + env(safe-area-inset-top))!important}
 #instrument-view.artist-header-layout:not(.instrument-tools-inline) #control-panel{top:calc(134px + env(safe-area-inset-top));max-height:calc(100% - 144px - env(safe-area-inset-top))}
}
@media(max-width:600px), (max-width:950px) and (max-height:500px){
 #instrument-view.instrument-tools-inline.artist-header-layout #artist-toggle{width:44px;min-width:44px;padding:4px;justify-content:center}
 #instrument-view.instrument-tools-inline.artist-header-layout #artist-mini-wheel{width:34px;height:34px}
 #instrument-view.instrument-tools-inline.artist-header-layout #artist-toggle :is(.artist-hey-label,.artist-phone-arrow){display:none!important}
}
@media(min-width:360px) and (max-width:600px), (min-width:600px) and (max-width:950px) and (max-height:500px){
 #instrument-view.instrument-tools-inline #wheel-dock #dock-toggle,#instrument-view.instrument-tools-inline.artist-header-layout #artist-toggle{width:100px;min-width:100px;padding:4px;gap:3px}
 #instrument-view.instrument-tools-inline #wheel-dock #dock-toggle svg,#instrument-view.instrument-tools-inline.artist-header-layout #artist-mini-wheel{width:32px;height:32px}
 #instrument-view.instrument-tools-inline #wheel-dock #dock-toggle #lab-label,#instrument-view.instrument-tools-inline.artist-header-layout #artist-toggle .artist-hey-label{display:block!important;font-size:14px}
 #instrument-view.instrument-tools-inline #wheel-dock #dock-toggle .dock-arrow,#instrument-view.instrument-tools-inline.artist-header-layout #artist-toggle .artist-phone-arrow{display:grid!important;width:18px;height:32px;font-size:24px}
}

#instrument-view.hey-open #instrument-tools-toggle{visibility:hidden!important;pointer-events:none!important}
