/* The instrument owns the viewport. Menus only occupy space while open. */
html,body{height:100%;overflow:hidden;overscroll-behavior:none}
body>.app-header,body>.app-footer{display:none}
body .workspace,body[data-view] .workspace{display:block;position:fixed;inset:0;width:100%;height:var(--workspace-height,100dvh);max-width:none;margin:0;padding:0;overflow:hidden}
body[data-view] #instrument-view,#instrument-view.immersive{position:relative!important;inset:auto!important;top:0;width:100%!important;height:100%!important;min-height:0;padding:0;display:block;border-radius:0;background:radial-gradient(ellipse at 32% 28%,#ebf9f5,transparent 65%),#f7f9fb}
#instrument-view #stage-canvas{position:absolute;inset:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);width:auto!important;height:auto!important;min-height:0!important;margin:0!important;border-radius:0;background:none;overflow:hidden;touch-action:none;transition:left .28s cubic-bezier(.2,.8,.2,1),right .28s cubic-bezier(.2,.8,.2,1),bottom .28s cubic-bezier(.2,.8,.2,1)}
#pan-layer,.pan{pointer-events:none}
.pan-body,.handpan-note,.pan-handle{pointer-events:auto}
.handpan-note,.handpan-note.top,.handpan-note.bottom{min-width:0;min-height:0;-webkit-touch-callout:none}
.handpan-note .note-label{font-size:var(--label-font,16px);line-height:1.15;letter-spacing:0;white-space:nowrap;gap:0;max-width:none}
.handpan-note .note-number{font:inherit;line-height:inherit;opacity:1}
.pan-handle{top:var(--handle-top,0px);transform:translate(-50%,0);height:24px;padding:2px 7px;max-width:74%;font-size:11px;border-radius:8px}
.pan-handle .pan-index{width:17px;height:17px;font-size:10px}

/* A left drawer, anchored above the playing hands. */
#instrument-view .tool-dock.is-floating{position:absolute;top:max(12px,env(safe-area-inset-top))!important;left:max(12px,env(safe-area-inset-left));width:auto;height:auto;transform:none;z-index:50}
#wheel-dock .dock-toggle{width:auto;height:48px;min-width:96px;padding:5px 10px 5px 5px;border-radius:17px;flex-direction:row;gap:5px;box-shadow:0 5px 20px #45668110}
#wheel-dock .dock-toggle svg{width:35px;height:35px;flex:none}
#wheel-dock .dock-toggle span{font-size:12px}
#wheel-dock #lab-label{flex:none;white-space:nowrap;line-height:1.4;unicode-bidi:isolate}
#wheel-dock .dock-toggle .dock-arrow{font-size:23px;margin-left:2px;font-weight:400}
#wheel-dock.is-floating .dock-panel{top:0;left:0;transform:none;width:min(318px,calc(100vw - 24px));max-height:calc(var(--workspace-height,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0;height:auto;padding:16px 12px;grid-template-columns:90px minmax(0,1fr);gap:10px;overflow:auto;background:#ffffffef;border:1px solid #e2eaf0;border-radius:24px;box-shadow:0 12px 38px #42647f20;animation:wheel-drawer-in .24s cubic-bezier(.2,.8,.2,1)}
#wheel-dock .wheel-shell{width:90px;height:90px}
#wheel-dock .wheel-labels{padding-top:18px}
#wheel-dock .wheel-label{min-height:42px;font-size:14px;border-radius:11px}
#wheel-dock .dock-close{top:4px;right:5px;width:36px;height:36px;font-size:25px}
@keyframes wheel-drawer-in{from{opacity:0;transform:translateX(-20px) scale(.97)}to{opacity:1;transform:none}}

/* The lower arrow remains accessible while the settings are folded away. */
.workspace-edge-controls{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;z-index:30;transition:opacity .16s}
.settings-toggle{height:44px;min-width:116px;padding:5px 14px;display:flex;align-items:center;justify-content:center;gap:9px;border-radius:16px;font-size:13px;font-weight:550;color:#476174;box-shadow:0 4px 18px #4566810d}
.settings-toggle>span:first-child{font-size:24px;line-height:1}
.edge-play{width:44px;height:44px;border-radius:16px;color:var(--accent-ink);font-size:18px}
#instrument-view.controls-open .workspace-edge-controls{opacity:0;pointer-events:none;visibility:hidden}

/* One settings panel serves normal and full-screen playback. */
#instrument-view #control-panel{position:absolute;z-index:40;left:10px;right:10px;bottom:max(10px,env(safe-area-inset-bottom));top:auto;width:auto;height:var(--sheet-height,48%);max-height:calc(100% - 76px);min-width:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 16px 24px;border-radius:26px;border:1px solid #ffffff;background:#fffffff0;box-shadow:0 14px 48px #4566811f;backdrop-filter:blur(28px);-webkit-backdrop-filter:blur(28px);transform:translateY(calc(100% + 30px));opacity:0;visibility:hidden;transition:transform .28s cubic-bezier(.2,.8,.2,1),opacity .2s,visibility 0s linear .28s;scrollbar-width:thin}
#instrument-view.controls-open #control-panel{transform:none;opacity:1;visibility:visible;transition-delay:0s}
.workspace-panel-heading{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:58px;margin:0 -16px 6px;padding:8px 14px 8px 20px;background:#ffffffed;backdrop-filter:blur(20px);border-bottom:1px solid #e5ebee}
.workspace-panel-heading>strong{flex:1;font-size:15px;font-weight:600;color:var(--accent-ink)}
.workspace-panel-heading .icon-button{width:42px;height:42px;border-radius:14px;font-size:25px}
#control-panel .canvas-heading{display:flex!important;background:none!important;padding:9px 3px 14px}
#control-panel .canvas-heading .eyebrow{display:none}
#control-panel .canvas-heading h2{font-size:17px;margin:0}
#control-panel .visualization-settings{margin:0 0 12px;padding:10px;border-radius:18px}
#control-panel .canvas-toolbar{display:flex!important;padding:0;gap:8px}
#control-panel .note-display-control{display:flex!important;margin:8px 0 0;padding:8px 0 0;justify-content:center}
#control-panel .canvas-toolbar .button{min-height:40px;font-size:13px}
#control-panel .canvas-toolbar>.button{margin:0}
#control-panel .rotation-controls .icon-button{height:46px;width:46px;padding:3px;touch-action:manipulation}
.rotation-controls .rotation-icon{display:block;width:38px;height:38px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.rotation-icon .rotation-pan{stroke-width:1.4;fill:#e5eef2}
.rotation-icon .rotation-notes{stroke-width:1.1;fill:#fff}
.rotation-icon .rotation-arrow{stroke-width:2.5;stroke:var(--accent-ink);transition:transform .18s ease;transform-origin:22px 25px}
@media(hover:hover){#rotate-left:hover .rotation-arrow{transform:rotate(-9deg)}#rotate-right:hover .rotation-arrow{transform:rotate(9deg)}}
.rotation-controls .icon-button:active{background:var(--accent-soft)}
@media(prefers-reduced-motion:reduce){.rotation-icon .rotation-arrow{transition:none}#rotate-left:hover .rotation-arrow,#rotate-right:hover .rotation-arrow{transform:none}}
#control-panel .fullscreen-controls{position:static;display:flex;flex-wrap:wrap;justify-content:flex-start;max-width:none;margin:0 0 14px;padding:0;gap:8px;background:none;border:0;box-shadow:none}
#control-panel .fullscreen-controls>span{flex:1 1 100%;max-width:none;font-size:13px}
#control-panel .fullscreen-controls>button{flex:1;min-height:44px}
#control-panel .tool-panel>.panel-heading{display:none}
#control-panel .stage-caption{display:none!important}
#control-panel .duo-card:not([hidden]){display:flex!important;margin:8px 0 14px}
#control-panel .app-footer{display:flex;padding:18px 0 0;flex-wrap:wrap;gap:8px;font-size:12px}
#control-panel .footer-credit{margin-left:0}
#instrument-view.controls-open #stage-canvas{bottom:calc(var(--sheet-height,48%) + 22px + env(safe-area-inset-bottom))}
#control-panel .panel-heading-tools{display:flex;gap:6px;align-items:center}
#control-panel #help-button{width:34px;height:34px;font-size:17px}

@media(min-aspect-ratio:1/1), (min-width:1100px){
 #instrument-view{--drawer-width:clamp(290px,38vw,420px)}
 .workspace-edge-controls{left:auto;right:max(14px,env(safe-area-inset-right));transform:none}
 #instrument-view #control-panel{top:max(10px,env(safe-area-inset-top));bottom:max(10px,env(safe-area-inset-bottom));left:auto;right:max(10px,env(safe-area-inset-right));height:auto;max-height:none;width:var(--drawer-width);transform:translateX(calc(100% + 30px))}
 #instrument-view.controls-open #control-panel{transform:none}
 #instrument-view.controls-open #stage-canvas{right:calc(var(--drawer-width) + 22px + env(safe-area-inset-right));bottom:env(safe-area-inset-bottom)}
 #instrument-view.dock-open:not(.controls-open) #stage-canvas{left:calc(330px + env(safe-area-inset-left))}
}
@media(max-height:400px) and (orientation:landscape){
 #wheel-dock.is-floating .dock-panel{padding:5px 12px;grid-template-columns:70px minmax(0,1fr);width:294px}
 #wheel-dock .wheel-shell{width:70px;height:70px}
 #wheel-dock .wheel-labels{padding-top:16px}
 #wheel-dock .wheel-label{min-height:38px;font-size:13px}
 #instrument-view.dock-open:not(.controls-open) #stage-canvas{left:306px}
 .workspace-panel-heading{min-height:50px;padding-top:4px;padding-bottom:4px}
 #control-panel .canvas-heading{padding-top:4px}
}
@media(prefers-reduced-motion:reduce){#instrument-view #stage-canvas,#instrument-view #control-panel{transition:none}#wheel-dock.is-floating .dock-panel{animation:none}}

/* Small breathing chevrons invite exploration without moving the cards. */
.section-chevron,#wheel-dock .dock-toggle .dock-arrow,.settings-toggle>span:first-child{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:10px;flex-shrink:0}
.settings-section:not([open])>summary .section-chevron,#dock-toggle[aria-expanded=false] .dock-arrow,#fullscreen-settings[aria-expanded=false]>span:first-child{animation:menu-chevron-hint 4.8s ease-in-out infinite}
.settings-section:nth-of-type(2n)>summary .section-chevron{animation-delay:.55s}
.settings-section:nth-of-type(3n)>summary .section-chevron{animation-delay:1.1s}
.settings-section>summary:hover .section-chevron,.settings-section>summary:focus-visible .section-chevron{animation:none;color:var(--accent-ink);background:var(--accent-soft)}
.settings-section>summary:focus-visible{outline:3px solid #4b96ef;outline-offset:3px}
@keyframes menu-chevron-hint{
 0%,65%,100%{color:#7b8999;background:transparent;box-shadow:0 0 0 0 transparent;translate:0 0}
 22%{color:var(--accent-ink);background:var(--accent-soft);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 7%,transparent);translate:0 2px}
 42%{color:var(--accent-ink);background:color-mix(in srgb,var(--accent-soft) 40%,transparent);box-shadow:0 0 0 0 transparent;translate:0 0}
}
.scale-fit-options{margin:14px 0;padding:12px;border:1px solid color-mix(in srgb,var(--accent) 20%,#e3ebef);border-radius:16px;background:color-mix(in srgb,var(--accent-soft) 55%,white)}
.scale-fit-options .check-row{align-items:flex-start;line-height:1.4}.scale-fit-options .check-row input{flex-shrink:0;margin-top:3px}
#scale-fit-detail{margin-top:12px;padding-top:10px;border-top:1px solid #dce9e7}
#scale-fit-summary{line-height:1.65;color:var(--ink)}
.primary-pan-setting{margin:0 0 16px;padding:14px;border:1px solid #c8e1f3;border-radius:16px;background:#edf7ff}
.primary-pan-setting .field-label{margin-top:0;color:#2178b5}.primary-pan-setting .small{margin-top:8px}
.playback-priority{margin:0 0 16px;padding:10px 12px;border-radius:12px;background:var(--accent-soft)}
.playback-priority .small{line-height:1.6;color:var(--accent-ink)}.playback-priority .text-button{font-size:.875rem;padding-bottom:0}
.pan-handle .pan-principal{flex-shrink:0;padding:3px 6px;border-radius:6px;background:#deeffb;color:#1d658e;font-size:.75rem;font-weight:600;line-height:1.3}
.pan.principal .pan-handle{border-color:#9bcae7}.pan.principal .pan-handle strong{min-width:0}
@media(prefers-reduced-motion:reduce){.settings-section:not([open])>summary .section-chevron,#dock-toggle[aria-expanded=false] .dock-arrow,#fullscreen-settings[aria-expanded=false]>span:first-child{animation:none;color:var(--accent-ink);background:var(--accent-soft)}}

/* One generous wheel, then six equally legible destinations. */
#wheel-dock.is-floating .dock-panel{width:min(370px,calc(100vw - 24px));grid-template-columns:minmax(0,1fr);justify-items:center;gap:12px;padding:22px 16px 16px;border-radius:30px;background:linear-gradient(145deg,#fffffffa,#f7fbfff5);box-shadow:0 18px 60px #34546d24,inset 0 1px 0 white}
#wheel-dock .wheel-shell{width:min(280px,100%);height:auto;aspect-ratio:1;flex-basis:auto;padding:7px;margin-top:5px;filter:drop-shadow(0 10px 12px #63768d16)}
#wheel-dock .wheel-labels{padding:0;width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
#wheel-dock.is-floating .wheel-label{min-height:58px;justify-content:center;flex-direction:column;gap:6px;text-align:center;padding:8px 4px;border:1px solid color-mix(in srgb,var(--tool-color) 10%,#e9eef4);border-radius:15px;background:color-mix(in srgb,var(--tool-color) 4%,white);font-size:14px;line-height:1.2;color:#53677c;transition:background .2s,transform .2s,box-shadow .2s}
#wheel-dock .wheel-label i{width:18px;height:4px;flex:none;border-radius:4px}
#wheel-dock .wheel-label[aria-pressed=true]{color:#263d51;background:color-mix(in srgb,var(--tool-color) 13%,white);border-color:color-mix(in srgb,var(--tool-color) 28%,white);box-shadow:0 3px 9px #4566810b}
#wheel-dock .wheel-label:hover{transform:none}
#wheel-dock .wheel-label.is-linked{transform:translateY(-2px);color:#263d51;background:color-mix(in srgb,var(--tool-color) 17%,white);box-shadow:0 5px 14px color-mix(in srgb,var(--tool-color) 18%,transparent)}
#wheel-dock .wheel-label.is-pulsing span{animation:wheel-word-tap .24s ease-out}
#wheel-dock .wheel-segment:not(.is-lifted){transform:none;filter:none}
#wheel-dock .wheel-segment.is-lifted{transform:translateY(-5px) scale(1.05);filter:drop-shadow(0 5px 4px #34546d38)}
@keyframes wheel-word-tap{0%{transform:scale(1)}45%{transform:scale(1.07)}100%{transform:scale(1)}}
#wheel-dock .dock-close{width:44px;height:44px;left:9px;right:auto;top:9px;border:1px solid #dce5ed;border-radius:16px;background:#f1f5f9e8;color:#466176;z-index:2;touch-action:manipulation;transition:background .18s,transform .18s}
#wheel-dock .dock-close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;pointer-events:none}
#wheel-dock .dock-close:hover{background:#fff}
#wheel-dock .dock-close:active{transform:scale(.94)}
#wheel-dock.is-open #tool-wheel{transform-origin:50% 50%;animation:tool-wheel-revolve .9s cubic-bezier(.15,.7,.2,1) both}
#wheel-dock.is-open .wheel-segment .sector{animation:tool-sector-arrive .75s ease-out both;animation-delay:calc(var(--wheel-order)*.055s)}
@keyframes tool-wheel-revolve{from{transform:rotate(-360deg) scale(.85);opacity:.45}to{transform:rotate(0) scale(1);opacity:1}}
@keyframes tool-sector-arrive{0%{filter:saturate(.4) brightness(1.35)}45%{filter:saturate(1.4) brightness(1.08)}100%{filter:saturate(1) brightness(1)}}
@media(max-height:580px){#wheel-dock .wheel-shell{width:clamp(90px,calc(var(--workspace-height,100dvh) - 210px),240px);margin:0;padding:2px}#wheel-dock.is-floating .dock-panel{gap:7px;padding:12px}#wheel-dock.is-floating .wheel-label{min-height:48px;padding:5px 3px}}
@media(prefers-reduced-motion:reduce){#wheel-dock.is-open #tool-wheel,#wheel-dock.is-open .wheel-segment .sector,#wheel-dock .wheel-label.is-pulsing span{animation:none}#wheel-dock .wheel-label,#wheel-dock .wheel-segment{transition:none}}
