/* Controls inherit the existing 2&4 rules in every skin. Only layout is added. */
:is(#backbeat,.instrument-button).instrument-button{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:0 1 auto;width:auto;min-width:44px;min-height:44px;padding:6px 11px;line-height:1.2;text-align:center;white-space:nowrap;box-sizing:border-box}
.instrument-button svg{display:block;flex:0 0 17px;width:17px;height:17px}
/* Both columns share title, controls and display rows at every width. */
html[data-web-features][data-skin] .rhythm-top{grid-template-columns:minmax(0,1fr) minmax(0,1fr);--instrument-rows:1;--instrument-cell-height:164px;--instrument-grid-gap:6px;--instrument-window-height:calc(var(--instrument-rows)*var(--instrument-cell-height) + (var(--instrument-rows) - 1)*var(--instrument-grid-gap))}
html[data-web-features] .rhythm-top:has(#beats .beat:nth-child(7)){--instrument-rows:2;--instrument-cell-height:104px}
html[data-web-features][data-skin] :is(.beat-panel,.subdivision-panel){display:grid;align-content:start;justify-items:center;row-gap:8px;padding:16px 20px 12px;min-width:0}
html[data-web-features] :is(.beat-panel,.subdivision-panel)>*{width:100%;max-width:288px;min-width:0}
.instrument-panel-heading{display:grid;grid-template-rows:24px 44px;gap:8px;min-height:76px;align-items:center;justify-content:stretch}
.instrument-panel-heading>.eyebrow{display:flex;align-items:center;justify-content:center;min-height:24px;margin:0;text-align:center;text-transform:uppercase}
.instrument-meter-actions{display:grid;grid-template-columns:repeat(3,minmax(44px,1fr));gap:6px;width:100%;min-width:0}
.instrument-meter-actions:has(#backbeat[hidden]){grid-template-columns:repeat(2,minmax(44px,1fr))}
html[data-web-features][data-skin] .instrument-meter-actions :is(.instrument-button,#backbeat){width:100%;min-width:44px;height:44px;min-height:44px;margin:0;padding:4px;line-height:1;font-size:.8125rem}
.instrument-meter{font-variant-numeric:tabular-nums}
.instrument-beat-window{display:flex;flex-direction:column;gap:8px;height:var(--instrument-window-height);min-height:0}
html[data-web-features] .instrument-beat-window #beats{width:100%;max-width:none;margin:0;min-height:0;height:100%;gap:var(--instrument-grid-gap);grid-template-rows:repeat(var(--instrument-rows),minmax(0,1fr))}
html[data-web-features] .instrument-beat-window .beat{min-height:0;height:100%}
html[data-web-features] .instrument-beat-window .meter-face{flex:1;min-height:0;height:auto}
html[data-web-features] .instrument-beat-window .beat-meta{flex:0 0 44px;height:44px;min-height:44px;padding:4px 1px}
html[data-web-features] .beat-actions{margin:0;min-height:24px;justify-content:center;align-self:start}
html[data-web-features] .beat-actions .beat-hint{text-align:center;font-size:.6875rem}
html[data-web-features] .subdivision-panel>.subdivision-mix{max-width:288px;margin:0}
.instrument-visual-settings{margin:16px 0;padding-top:16px;border-top:1px solid var(--line)}
.instrument-visual-settings h3{margin:0 0 10px;font:inherit;font-size:.8125rem;font-weight:700;line-height:1.4}
.web-credits-link{display:inline-flex;align-items:center;min-height:44px;color:var(--text);font-size:.8125rem;text-decoration:underline;text-underline-offset:3px}
.instrument-display-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
:is(#backbeat,.instrument-button).instrument-button.instrument-display-option{width:100%;min-width:0;white-space:normal;font-size:.8125rem}
.rhythm-top:has(.instrument-panel-heading) .subdivision-panel>h2{display:flex;align-items:center;justify-content:center;height:24px;min-height:24px;margin:0}
.instrument-dialog{box-sizing:border-box}
/* Keep transport next to tempo in every viewport and skin, including desktop. */
html[data-web-features][data-skin] .tempo-panel .transport{position:relative;inset:auto;transform:none;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;width:100%;max-width:490px;margin:12px auto 0;padding:0;border:0;background:transparent;z-index:auto}
#native-meter-dialog .rhythm-section{border:0;padding:0}
#native-meter-dialog .rhythm-section>.section-heading{display:none}
/* Main sections use the skin's panel colour; accents belong to the open state. */
html[data-web-features][data-skin] main>.settings-details{background:var(--surface);border-color:var(--line)}
html[data-web-features][data-skin] main>.settings-details>summary[data-i18n]{background:var(--surface);color:var(--text);box-shadow:none}
html[data-web-features][data-skin] main>.settings-details>summary[data-i18n]::marker{color:var(--muted)}
html[data-web-features][data-skin] main>.settings-details[open]>summary[data-i18n]{background:var(--surface);border-bottom-color:var(--line)}
html[data-web-features][data-skin] main>.settings-details[open]>summary[data-i18n]::marker{color:var(--coral)}
html[data-web-features][data-skin] main>.settings-details>summary[data-i18n]:focus-visible{outline:2px solid var(--text);outline-offset:2px}
/* Reset stays easy to find, as a quiet outlined action above the sections. */
html[data-web-features][data-skin] .reset-controls{gap:8px 12px;margin-top:12px}
html[data-web-features][data-skin] .reset-controls :is(#reset-all,#reset-undo){min-height:44px;background:transparent;color:var(--text);border:1px solid var(--line);border-radius:var(--web-control-radius,8px);padding:9px 12px;box-shadow:none}
html[data-web-features][data-skin] .reset-controls #reset-all{width:auto;max-width:100%;font-size:.8125rem;font-weight:600;line-height:1.35}
html[data-web-features][data-skin] .reset-controls #reset-all svg{flex-basis:16px;width:16px;height:16px}
html[data-web-features][data-skin] .reset-feedback{color:var(--muted)}
@media(hover:hover){
 html[data-web-features][data-skin] main>.settings-details>summary[data-i18n]:hover{background:var(--control-hover,var(--surface))}
 html[data-web-features][data-skin] .reset-controls :is(#reset-all,#reset-undo):hover{background:var(--control-hover,var(--surface));border-color:var(--muted)}
}
.instrument-button[hidden]{display:none!important}
@media(max-width:619px){
 :is(#backbeat,.instrument-button).instrument-button{padding-inline:8px}
 html[data-web-features][data-skin] .rhythm-top{--instrument-cell-height:144px}
 html[data-web-features][data-skin] .rhythm-top:has(#beats .beat:nth-child(5)){--instrument-rows:2;--instrument-cell-height:92px}
 html[data-web-features][data-skin] .rhythm-top:has(#beats .beat:nth-child(9)){--instrument-rows:3}
 html[data-web-features][data-skin] :is(.beat-panel,.subdivision-panel){padding:12px 8px 10px}
}
/* Sound additions stay inside the existing panels. */
#sound-dialog .native-sound-filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:end;gap:12px;margin:12px 0}
#sound-dialog .native-sound-category{display:grid;gap:6px;min-width:0}
#sound-dialog .native-sound-category>span{font-size:13px;color:var(--muted)}
#sound-dialog .native-sound-filters :is(select,input){box-sizing:border-box;width:100%;min-width:0;min-height:44px;font:inherit;font-size:16px;padding:10px;border:1px solid var(--line);background:var(--control);color:var(--text);border-radius:var(--web-control-radius,8px);box-shadow:none}
#sound-dialog .native-sound-audition-help{margin:10px 0 4px;font-size:13px;line-height:1.4;color:var(--muted)}
#sound-dialog .native-sound-audition-status{min-height:1.4em;margin:0 0 14px;font-size:13px;line-height:1.4;color:var(--text)}
#sound-dialog .native-sound-audition-status[data-state=error]{color:var(--coral)}
.sound-eq .native-eq-response{grid-column:1/-1;min-width:0;padding:8px 0 12px;margin:0 0 8px;border-bottom:1px solid var(--line)}
.sound-eq .native-eq-response-title{display:flex;justify-content:space-between;gap:12px;font-size:12px;font-weight:600;line-height:1.4;color:var(--muted)}
.sound-eq .native-eq-response svg{display:block;width:100%;height:auto;max-height:190px}
.native-eq-grid{stroke:var(--line);stroke-width:1;fill:none;opacity:.5}
.native-eq-zero{stroke:var(--muted);stroke-width:1;stroke-dasharray:4 3;fill:none}
.native-eq-line{stroke:var(--coral);stroke-width:2.5;fill:none}
.native-eq-area{fill:var(--coral);opacity:.1}
.native-eq-nodes{fill:var(--surface);stroke:var(--coral);stroke-width:2}
.native-eq-axis{fill:var(--muted);font:10px system-ui,sans-serif}
@media(max-width:480px){#sound-dialog .native-sound-filters{grid-template-columns:minmax(0,1fr)}}
@media(max-width:359px){
 html[data-web-features][data-skin] :is(.beat-panel,.subdivision-panel){padding-inline:4px}
 .instrument-meter-actions{gap:3px}
}
/* The central readout shares the iPhone tap gesture; no numeric input dragging. */
html[data-web-features] .native-tempo-tap-host{position:relative}
html[data-web-features] .native-tempo-tap-host>:not(.native-tempo-tap){pointer-events:none;user-select:none;-webkit-user-select:none}
html[data-web-features][data-skin] button.native-tempo-tap{appearance:none;position:absolute;inset:0;z-index:3;display:block;width:100%;height:100%;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:inherit;background:transparent;color:inherit;box-shadow:none;transform:none;filter:none;opacity:1;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
html[data-web-features][data-skin] button.native-tempo-tap:focus-visible{outline:2px solid currentColor;outline-offset:3px}
/* Stable transport nodes avoid label/font jumps during audio activation. */
html[data-web-features] .transport-symbol{display:inline-flex;align-items:center;justify-content:center;flex:none;width:20px}
html[data-web-features] .transport-symbol svg{display:block;width:16px;height:20px}
html[data-web-features] .transport-label{display:inline-block;line-height:inherit}
.poly-rate{display:flex;align-items:baseline;justify-content:flex-end;gap:4px;white-space:nowrap}
.native-poly-rate-value{font-variant-numeric:tabular-nums}
.native-poly-rate-unit{font:inherit;font-size:.7em}
/* The shared detent handles feel; ranges stay visually flat at contact. */
html[data-web-features] input[type=range]{-webkit-tap-highlight-color:transparent}
html[data-web-features] input[type=range]:focus{outline:none}
html[data-web-features] input[type=range]:focus-visible::-webkit-slider-thumb{outline:2px solid var(--text);outline-offset:3px}
html[data-web-features] input[type=range]:focus-visible::-moz-range-thumb{outline:2px solid var(--text);outline-offset:3px}
html[data-web-features][data-skin] :is(#tempo-range,#swing-range).is-adjusting::-webkit-slider-thumb{transform:none;box-shadow:none}
html[data-web-features][data-skin] :is(#tempo-range,#swing-range).is-adjusting::-moz-range-thumb{transform:none;box-shadow:none}
/* The original wordmark stays a link; only its pixel symbol toggles animation. */
html[data-web-features] .native-brand{position:relative}
html[data-web-features] .native-brand-link{display:block;width:100%}
html[data-web-features][data-skin] .native-brand-toggle{position:absolute;left:0;top:47%;bottom:0;width:21%;height:auto;min-height:0;padding:0;margin:0;background:transparent;border:0;border-radius:0;box-shadow:none;transform:none;filter:none;cursor:pointer}
html[data-web-features] .native-brand-toggle:focus-visible{outline:2px solid var(--text);outline-offset:2px}
/* Web editorial content is secondary to the instrument. No script or motion. */
html[data-web-features][data-skin] .web-guide{margin:24px 0 16px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);box-shadow:none}
html[data-web-features][data-skin] .web-guide>summary{padding:16px 18px;min-height:52px;box-sizing:border-box;cursor:pointer;font-size:1rem;font-weight:700;line-height:1.4;color:var(--text)}
html[data-web-features] .web-guide>summary::marker{color:var(--text)}
html[data-web-features] .web-guide>summary:focus-visible{outline:2px solid var(--text);outline-offset:3px;border-radius:8px}
html[data-web-features] .web-guide-content{padding:0 clamp(14px,3vw,24px) 18px;overflow-wrap:anywhere}
html[data-web-features] .web-guide-content .about-metronome{margin:0;padding-top:16px;border-top:1px solid var(--line)}
html[data-web-features] .web-guide-content .practice-guide{margin-bottom:0}

/* New musical editors use the web's flat controls and existing skin tokens. */
html[data-web-features]{--approach-main:var(--text);--approach-extra:var(--coral);--native-score-accent:var(--text)}
.instrument-dialog{width:min(660px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto}
.instrument-dialog [hidden],.web-clave-all[hidden],.native-note-hint[hidden]{display:none!important}
.instrument-panel-body{display:grid;gap:14px;min-width:0}
html[data-web-features][data-skin] .instrument-panel-body :is(button,select,input:not([type=range])){min-width:0;min-height:44px;box-sizing:border-box;border:1px solid var(--line);border-radius:var(--web-control-radius,8px);background:var(--control);color:var(--text);font:inherit;font-size:.875rem;box-shadow:none;padding:8px 10px}
html[data-web-features][data-skin] .instrument-panel-body button[aria-pressed=true]{background:var(--selected);color:var(--selected-ink);border-color:var(--selected)}
.instrument-panel-body :is(button,input,select):focus-visible{outline:2px solid var(--text);outline-offset:3px}
.web-subdivision-window{display:grid;grid-template-columns:minmax(0,1fr);position:relative;min-width:0;width:100%;max-width:288px;height:var(--instrument-window-height);margin:0}
.web-subdivision-window:has([data-clave-active=true]){max-width:none}
.web-subdivision-window:has([data-mode=quintuplet],[data-mode=sextuplet],[data-mode=septuplet]){max-width:none}
/* Figure dimensions are imported from native.css by build-shared-notation.mjs. */
html[data-web-features][data-skin] .web-subdivision-window>#subdivision-button{position:relative;grid-area:1/1;height:100%;min-height:0;width:100%;max-width:none;margin:0;padding:22px 8px 10px;box-shadow:none;transition:none}
html[data-web-features][data-skin] .instrument-subdivision-choose{display:block;min-height:44px;height:44px;max-width:288px;width:100%;margin:0;padding:5px 6px;border:1px solid var(--line);background:var(--control);color:var(--text);font:inherit;font-size:.8125rem;font-weight:600;box-shadow:none;border-radius:var(--web-control-radius);line-height:1.2}
.subdivision-panel .native-subdivision-picker{display:inline-flex;align-items:center;justify-content:center;min-height:24px;width:100%;margin:0;padding:0;background:transparent;border:0;color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit}
:is(.native-subdivision-picker,.native-note-choose,.native-note-select)::after{content:'⌄';display:inline-block;margin-left:5px;font:600 11px/1 sans-serif}
.native-note-hint{position:absolute;top:7px;right:8px;font:500 10px/1.3 sans-serif;color:var(--subdivision-ink,var(--muted));opacity:.8}
.native-note-overview{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.native-note-sound{display:flex;align-items:center;justify-content:center;gap:7px}
.native-note-sound-icon svg{display:block;width:22px;height:22px}
.native-note-tempo{grid-column:1/-1;text-align:center;font-size:.8125rem;color:var(--muted)}
.native-note-scroll{overflow:auto;min-width:0;background:var(--web-score-surface,var(--control));border:1px solid var(--line);border-radius:var(--web-control-radius,8px)}
html[data-web-features] #native-note-dialog .native-note-score{color:var(--web-score-ink,var(--text))}
.web-note-scroll-hint{margin:0;text-align:center;font-size:.75rem;line-height:1.4;color:var(--muted)}
.native-note-scroll::-webkit-scrollbar{height:6px}
.native-note-scroll::-webkit-scrollbar-thumb{background:var(--muted);border-radius:var(--web-control-radius,8px)}
.native-note-scroll::-webkit-scrollbar-track{background:var(--line)}
html[data-web-features] #native-note-dialog[data-dense=true]{width:min(880px,calc(100vw - 24px));max-width:calc(100vw - 24px)}
.native-note-figure{position:absolute;inset:0;pointer-events:none}
.native-note-figure svg{display:block;width:100%;height:100%}
.native-note-targets{position:absolute;inset:0}
/* These are transparent hit areas above the score, not filled selected buttons. */
html[data-web-features][data-skin] #native-note-dialog .native-note-targets button,
html[data-web-features][data-skin] #native-note-dialog .native-note-targets button:is([aria-pressed],:hover,:active,:focus-visible){position:absolute;top:0;bottom:0;min-width:0;min-height:44px;padding:0;background:transparent;color:var(--text);border:0;border-radius:0;box-shadow:none;transform:none;touch-action:pan-x}
.native-note-targets button:focus-visible{outline-offset:-3px}
/* Both views share the same audio-driven ink and intensity. The editor also
   uses the instrument's score surface so light-on-dark skins stay legible. */
:is(#subdivision-figure,.native-note-figure) :is([data-native-note],[data-note-slot]){transition:none}
:is(#subdivision-figure,.native-note-figure) [data-note-muted=true]{opacity:.5}
:is(#subdivision-figure,.native-note-figure).native-score-playing :is([data-native-note],[data-note-slot]){opacity:.4}
:is(#subdivision-figure,.native-note-figure).native-score-playing .native-note-active{opacity:1;color:var(--native-score-accent,var(--text))}
.native-note-help{margin:0;text-align:center;font-size:.8125rem;line-height:1.5;color:var(--muted)}
.native-note-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.native-note-actions button{display:flex;align-items:center;justify-content:center;gap:8px}
.native-note-play svg{width:14px;height:14px}
.approach-editor,.custom-performance{display:grid;gap:14px;min-width:0}
.approach-top{display:grid;grid-template-columns:minmax(0,1fr) 180px;gap:12px;align-items:center}
.approach-heading{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.approach-heading select{flex:1;width:100px}
.approach-heading>span{font-size:.8125rem}
.approach-sounds{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.approach-sound{display:grid;gap:6px;font-size:.8125rem;min-width:0}
.approach-sound select{width:100%;text-overflow:ellipsis}
.placement-tempo{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:6px;align-items:center;min-width:0}
.placement-tempo-value{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;font-size:.75rem}
.placement-tempo-value input{width:78px;text-align:center;padding:6px!important}
.placement-tempo-range{grid-column:1/-1;width:100%;margin:0;height:44px}
.approach-inspector{padding:12px;border:1px solid var(--line)}
.approach-inspector-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;justify-content:space-between}
.approach-inspector-head strong,.approach-inspector-head output{font-size:.875rem;font-variant-numeric:tabular-nums}
.approach-switches{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-block:10px}
.approach-range{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:10px;align-items:center}
.approach-range input{width:100%;min-width:0;margin:0}
.approach-range-labels{display:flex;justify-content:space-between;margin:5px 54px;font-size:.75rem;color:var(--muted)}
.approach-selection-state{margin:10px 0 0;font-size:.8125rem;color:var(--muted)}
.approach-controls{display:grid;gap:12px}
.approach-volume{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 8px;font-size:.8125rem}
.approach-volume input{grid-column:1/-1;grid-row:2;width:100%;margin:0;height:44px}
.approach-transport{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.custom-performance-top{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:.875rem}
.custom-performance-hint{font-size:.8125rem;line-height:1.5;color:var(--muted);margin:0}
.custom-performance-footer{display:grid;gap:12px}
.custom-grid{display:flex;flex-direction:column;min-width:0;min-height:220px;border:1px solid var(--line);border-radius:var(--web-control-radius,8px);background:var(--surface);color:var(--text);overflow:hidden}
.custom-grid-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 10px}
.custom-grid-tools label{display:flex;align-items:center;gap:8px;font-size:.8125rem}
.custom-grid-legend{display:flex;align-items:center;flex-wrap:wrap;gap:6px 18px;padding:4px 10px 6px;font-size:.8125rem;font-weight:600}
.custom-grid-legend>span::before{content:'';display:inline-block;width:10px;height:8px;margin-right:5px;background:var(--approach-main)}
.custom-grid-legend [data-lane=extra]::before{background:var(--approach-extra)}
.custom-grid-zoom{display:flex;align-items:center;gap:4px;margin-left:auto}
.custom-grid-zoom button{min-width:44px}
.custom-grid-scroll{display:flex;flex:1;overflow-x:auto;min-height:120px;padding:24px 20px 10px}
.custom-grid-scroll[data-zoomable=true]{touch-action:none;overscroll-behavior-x:contain}
.custom-grid-track{position:relative;flex:1;min-width:calc((var(--custom-beats,4) + .5)*52px);min-height:110px;background:linear-gradient(transparent calc(50% - .5px),var(--line) 50%,transparent calc(50% + .5px))}
.custom-grid-line{position:absolute;inset-block:0;border-left:1px dotted var(--line);pointer-events:none}
.custom-grid-line[data-beat=true]{border-left:1px solid var(--muted)}
.custom-grid-line small{position:absolute;top:-20px;left:0;transform:translateX(-50%);font-size:.6875rem;font-weight:700}
.custom-grid-snap-line{position:absolute;inset-block:0;border-left:2px solid var(--text);opacity:.65;pointer-events:none}
html[data-web-features][data-skin] .custom-grid-event{position:absolute;top:25%;transform:translate(-12px,-50%);width:44px;height:44px;min-height:44px;display:flex;align-items:center;padding:0 0 0 12px;border:0;border-radius:0;background:transparent;box-shadow:none;color:var(--approach-main);touch-action:none;user-select:none;-webkit-user-select:none}
html[data-web-features][data-skin] .custom-grid-event[data-lane=extra]{top:75%;color:var(--approach-extra)}
.custom-grid-block{width:26px;height:20px;flex:none;border:1.5px solid currentColor;border-radius:1px;pointer-events:none}
.custom-grid-event[aria-pressed=true] .custom-grid-block{background:currentColor}
.custom-grid-event[aria-pressed=false] .custom-grid-block{border-style:dashed;opacity:.65}
.custom-grid-event[data-selected=true] .custom-grid-block{outline:none;border-width:2px}
.custom-grid-event:is([data-snapped=true],.is-playing) .custom-grid-block{outline:none;border-width:2px}
/* The onset is the left edge of the block, not its centre. Keep the 44px
   touch target but expose that exact anchor against the timing grid. */
html[data-web-features][data-skin] .custom-grid-event{overflow:visible}
/* Active notes also match the generic pressed-button rule above. Override
   that rule at the same specificity so the invisible hit target stays clear. */
html[data-web-features][data-skin] .instrument-panel-body button.custom-grid-event,
html[data-web-features][data-skin] .instrument-panel-body button.custom-grid-event[aria-pressed=true]{background:transparent;border:0;border-radius:0;box-shadow:none;padding:0 0 0 12px;color:var(--approach-main)}
html[data-web-features][data-skin] .instrument-panel-body button.custom-grid-event[data-lane=extra]{color:var(--approach-extra)}
.custom-grid-event::before{content:'';position:absolute;left:12px;top:4px;bottom:4px;width:1px;background:currentColor;pointer-events:none}
.custom-grid-event .custom-grid-block{height:14px;width:20px;opacity:1;border-width:2px;outline:1px solid var(--surface);outline-offset:0}
.custom-grid-event[aria-pressed=true] .custom-grid-block{box-shadow:0 0 0 2px var(--text),0 0 5px color-mix(in srgb,currentColor 45%,transparent)}
.custom-grid-event[aria-pressed=false] .custom-grid-block{opacity:.4;box-shadow:none}
.custom-grid-event.is-playing .custom-grid-block{filter:brightness(1.25);box-shadow:0 0 0 2px var(--text),0 0 8px color-mix(in srgb,currentColor 65%,transparent)}
.custom-grid-event::before{box-shadow:-1px 0 0 var(--surface),1px 0 0 var(--surface);z-index:1}
.custom-grid-event[data-selected=true] .custom-grid-block{outline:1px solid var(--surface);outline-offset:0}
.custom-grid-event[data-selected=true]::before,.custom-grid-event[data-snapped=true]::before{width:2px}
.custom-grid-event[data-selected=true] .custom-grid-block,.custom-grid-event.is-playing .custom-grid-block{opacity:1}
.placement-preview [data-placement-role=beat]{color:var(--approach-main);fill:currentColor}
.placement-preview [data-placement-role=approach]{color:var(--approach-extra);fill:currentColor}
.native-clave-reference{margin-top:16px;padding-top:16px;border-top:1px solid var(--line)}
.native-clave-reference label{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;font-size:.875rem}
.native-clave-reference input{grid-column:1/-1;grid-row:2;width:100%;height:44px;margin:0}
.native-clave-reference p{font-size:.8125rem;color:var(--muted)}
#clave-dialog:has(.clave-editor:not([hidden])) .native-clave-reference{display:none}
html[data-web-features][data-skin] .web-clave-all{width:100%;min-height:44px;padding:6px;border:1px solid var(--line);background:var(--control);color:var(--text);border-radius:var(--web-control-radius,8px);box-shadow:none;font:inherit;font-size:.75rem}
html[data-web-features][data-skin] .web-clave-all[aria-pressed=true]{background:var(--selected);color:var(--selected-ink)}
.native-clave-save{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;margin:16px 0}
.native-clave-save label{display:grid;gap:6px;font-size:.875rem}
.native-clave-save input{min-width:0;width:100%}
.native-clave-save p{grid-column:1/-1;margin:0;font-size:.8125rem}
.native-clave-sound{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;margin:14px 0;font-size:.875rem}
.native-clave-sound select{min-width:0;width:100%}
.native-clave-record{display:grid;border:1px solid var(--line);background:var(--control);border-radius:var(--web-control-radius,8px);overflow:hidden;min-width:0}
.native-clave-record>.clave-option{width:100%;border:0}
.native-clave-record-actions{display:flex;gap:8px;padding:8px;border-top:1px solid var(--line)}
.native-clave-record-actions button{flex:1}
.native-clave-personal-badge{display:inline-block;font:600 .625rem/1.3 sans-serif;padding:2px 4px;margin-left:6px;border:1px solid currentColor;border-radius:2px}
.native-clave-library-status,.native-clave-trash{grid-column:1/-1}
.native-clave-trash summary{min-height:44px;padding:12px 0;font-size:.875rem}
.native-clave-restore-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0}
html[data-web-features][data-skin] #clave-dialog :is(.native-clave-save button,.native-clave-save input,.native-clave-sound select,.native-clave-library-action){min-height:44px;border:1px solid var(--line);background:var(--control);color:var(--text);border-radius:var(--web-control-radius,8px);padding:8px;font:inherit;font-size:.875rem;box-shadow:none}
.clave-edit-steps button[data-accent=true] span{background:none;display:grid;place-items:center;min-height:18px}
.clave-edit-steps button[data-accent=true] span::after{content:'>';font:800 20px/1 sans-serif}
.clave-accent-mark{fill:none;stroke:var(--text);stroke-width:1.4}
html[data-web-features][data-skin] .poly-panel .poly-voice{grid-template-columns:44px 52px minmax(0,1fr) 70px 44px}
html[data-web-features][data-skin] .native-poly-sound-button{width:44px;min-height:44px;padding:0 2px;color:var(--text);background:var(--control);border:1px solid var(--line);border-radius:var(--web-control-radius,8px);box-shadow:none;font:600 .6875rem/1.2 sans-serif}
.poly-dots[role=button]{cursor:pointer;touch-action:manipulation}
.native-poly-sound-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.native-poly-sound-options h3{grid-column:1/-1;margin:10px 0 0;font-size:.875rem;color:var(--muted)}
.native-poly-listen{width:100%}
.native-sound-row{position:relative;min-width:0}
html[data-web-features][data-skin] .native-sound-favorite{position:absolute;top:5px;right:5px;width:44px;height:44px;min-height:44px;border:0;background:transparent;color:var(--text);font-size:22px;border-radius:var(--web-control-radius,8px);box-shadow:none;padding:0}
.native-sound-row>[data-sound-choice]{width:100%;height:100%}
.native-sound-row .sound-check{right:auto;left:8px}
html[data-web-features][data-skin] .native-sound-row:has([data-sound-choice][aria-pressed=true]) .native-sound-favorite{color:var(--selected-ink)}
.native-sound-favorites-filter{min-height:44px;padding:8px 12px;border:1px solid var(--line);background:var(--control);color:var(--text);font:inherit;font-size:.875rem;border-radius:var(--web-control-radius,8px)}
.native-sound-favorites-filter[aria-pressed=true]{background:var(--selected);color:var(--selected-ink)}
@media(max-width:619px){
 .approach-top{grid-template-columns:minmax(0,1fr)}
 .approach-switches{grid-template-columns:repeat(2,minmax(0,1fr))}
 .instrument-dialog{padding:16px}
 html[data-web-features][data-skin] .instrument-panel-body :is(select,input:not([type=range])){font-size:16px}
 html[data-web-features][data-skin] .poly-panel .poly-voice{grid-template-columns:38px 46px minmax(0,1fr) 44px;gap:6px}
 .poly-voice .poly-rate{grid-column:3;grid-row:2;font-size:.6875rem;text-align:right;margin-top:-3px}
 .poly-voice .native-poly-sound-button{grid-column:4;grid-row:1}
 .native-clave-save{grid-template-columns:minmax(0,1fr)}
}

.native-sound-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.native-sound-favorite svg{display:block;width:22px;height:22px;margin:auto;fill:none;stroke:currentColor;stroke-width:1.5}
.native-sound-favorite[aria-pressed=true] svg{fill:currentColor}
/* Sound stars have their own target outside the sound-selection card. */
html[data-web-features][data-skin] #sound-dialog .native-sound-row{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px;align-items:center}
html[data-web-features][data-skin] #sound-dialog .native-sound-favorite{position:static;display:grid;place-items:center;border:1px solid var(--line);background:var(--control);color:var(--text);border-radius:var(--web-control-radius)}
html[data-web-features] .native-sound-row .sound-check{right:8px;left:auto}
@media(max-width:600px){
 html[data-web-features] #sound-options{grid-template-columns:minmax(0,1fr)}
 html[data-web-features][data-skin] #sound-options button[data-sound-choice]{display:grid;grid-template-columns:36px minmax(0,1fr);grid-template-rows:auto;align-items:center;justify-items:start;gap:12px;min-height:80px;padding:12px 28px 12px 14px;text-align:left}
 html[data-web-features] #sound-options .sound-symbol{width:36px;height:36px;margin:0}
 html[data-web-features] #sound-options .sound-option-copy{align-items:flex-start;text-align:left}
 html[data-web-features] #sound-options .sound-option-copy>span:empty{display:none}
}
/* Measure groups remain readable independently of their subdivision density. */
html[data-web-features] .clave-editor-grid{display:grid;gap:28px;margin-top:22px}
html[data-web-features] .clave-edit-bar{min-width:0;margin:0;border:1px solid var(--line);border-radius:10px;background:var(--surface);isolation:isolate}
html[data-web-features] .clave-edit-bar h4{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;margin:0;padding:12px 14px;border-radius:9px 9px 0 0;border-bottom:1px solid var(--line);background:var(--control);color:var(--text);font-size:17px;line-height:1.3;font-weight:750;letter-spacing:0;text-transform:none}
html[data-web-features] .native-clave-measure-meter{font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}
html[data-web-features] .clave-edit-bar .clave-edit-beats{padding:12px;gap:12px;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
html[data-web-features] .clave-edit-steps{grid-template-columns:repeat(var(--step-columns),minmax(44px,1fr));overflow-x:auto;padding-block:2px}

/* Custom timing coordinates. */
html[data-web-features] .approach-position{margin:8px 0;font-size:13px;line-height:1.5;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
html[data-web-features] .approach-percent{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px}
html[data-web-features] .approach-percent input{width:100px;min-width:0;min-height:44px;padding:6px;font:inherit;border:1px solid var(--line);border-radius:6px;background:var(--control);color:var(--text)}

/* The left edge is the exact onset shared by the block, cursor and timing grid. */
html[data-web-features][data-skin] .custom-grid-event .custom-grid-block{position:absolute;left:12px;top:50%;transform:translateY(-50%);margin:0}
html[data-web-features] .custom-grid-coordinates{display:block;grid-column:1/-1;min-height:40px;padding:8px 0;font-size:13px;line-height:1.5;font-variant-numeric:tabular-nums;color:var(--text);overflow-wrap:anywhere}

/* Attach the onset line to the rectangle itself so no independent cursor
   can drift into its centre through button layout or transforms. */
html[data-web-features][data-skin] .custom-grid-event::before{content:none}
html[data-web-features][data-skin] .custom-grid-event .custom-grid-block::before{content:'';position:absolute;left:-2px;top:-14px;bottom:-14px;width:2px;background:currentColor;box-shadow:-1px 0 var(--surface);pointer-events:none}

/* Custom MIDI onset: only the rectangle, no protruding cursor or halo. */
html[data-web-features][data-skin] .custom-grid-event::before,html[data-web-features][data-skin] .custom-grid-event::after,html[data-web-features][data-skin] .custom-grid-event .custom-grid-block::before,html[data-web-features][data-skin] .custom-grid-event .custom-grid-block::after{content:none;display:none}
html[data-web-features][data-skin] .custom-grid-event .custom-grid-block{outline:none;box-shadow:none;filter:none;border-radius:0}
html[data-web-features][data-skin] .custom-grid-event[data-selected=true] .custom-grid-block{outline:none;box-shadow:none;border-width:2px}
html[data-web-features][data-skin] .custom-grid-event.is-playing .custom-grid-block{outline:none;box-shadow:none;filter:brightness(1.2)}


html[data-web-features] { --native-led-normal:var(--coral);--native-led-accent:var(--ochre); }
html[data-web-features][data-skin=flat],html[data-web-features][data-skin=carlingue] { --native-led-normal:var(--text);--native-led-accent:var(--ochre); }
html[data-web-features][data-skin=miami] { --native-led-normal:var(--miami-aqua);--native-led-accent:var(--miami-pink); }
html[data-web-features][data-skin=spider] { --native-led-normal:var(--spider-blue);--native-led-accent:var(--spider-red); }
html[data-web-features][data-skin=saiyan] { --native-led-normal:var(--ki-blue);--native-led-accent:var(--ki-orange); }
html[data-web-features][data-skin=billie] { --native-led-normal:var(--acid);--native-led-accent:var(--text); }
html[data-web-features][data-skin=la] { --native-led-normal:var(--la-accent);--native-led-accent:var(--la-panel); }
html[data-web-features][data-skin=sable] { --native-led-normal:var(--sable-mint);--native-led-accent:var(--sable-orange); }
html[data-web-features][data-skin=terminal] { --native-led-normal:#55dc7c;--native-led-accent:var(--terminal-bright); }
html[data-web-features][data-skin=saiyan][data-theme=dark] { --native-led-normal:color-mix(in srgb,var(--ki-blue) 40%,#b8d5ff); }
/* Bright lamps need a dark resting face even on a light instrument. Use the
   skin's existing VU screen; Billie keeps a light face for its dark accent. */
html[data-web-features][data-theme=light]:is([data-skin=asmm-sable],[data-skin=sable],[data-skin=terminal],[data-skin=vice],[data-skin=billie]) { --native-led-off:var(--meter-screen); }
html[data-web-features][data-skin=billie][data-theme=light] { --native-led-off-accent:var(--control); }
html[data-web-features][data-theme=light]:is([data-skin=carlingue],[data-skin=saiyan]),
html[data-web-features][data-skin=spider][data-theme=dark] { --native-led-off-accent:var(--meter-screen); }
:is(html[data-web-features][data-meter-style=led] .beats,html[data-web-features] .native-meter-style-preview[data-preview-style=led]) .beat { --led-tone:var(--native-led-normal);--led-base:var(--native-led-off,var(--control,var(--surface))); }
:is(html[data-web-features][data-meter-style=led] .beats,html[data-web-features] .native-meter-style-preview[data-preview-style=led]) .beat.accent { --led-tone:var(--native-led-accent);--led-base:var(--native-led-off-accent,var(--native-led-off,var(--control,var(--surface)))); }
:is(html[data-web-features][data-skin][data-meter-style=led] .beats,html[data-web-features][data-skin] .native-meter-style-preview[data-preview-style=led]) .beat .meter-face { border:1px solid var(--line);border-radius:5px;background:color-mix(in srgb,var(--led-tone) 10%,var(--led-base));box-shadow:none; }
:is(html[data-web-features][data-skin][data-meter-style=led] .beats,html[data-web-features][data-skin] .native-meter-style-preview[data-preview-style=led]) .beat .meter-face::before,
:is(html[data-web-features][data-skin][data-meter-style=led] .beats,html[data-web-features][data-skin] .native-meter-style-preview[data-preview-style=led]) .beat .meter-face::after { content:none; }
:is(html[data-web-features][data-meter-style=led] .beats,html[data-web-features] .native-meter-style-preview[data-preview-style=led]) .beat .meter-face canvas { visibility:hidden; }
:is(html[data-web-features][data-skin][data-meter-style=led] .beats,html[data-web-features][data-skin] .native-meter-style-preview[data-preview-style=led]) .beat.active:not(.muted) .meter-face.native-lit { border-color:var(--led-tone);background:var(--led-tone); }
:is(html[data-web-features][data-skin][data-meter-style=led] .beats,html[data-web-features][data-skin] .native-meter-style-preview[data-preview-style=led]) .beat.muted .meter-face { background:var(--control,var(--surface));opacity:.35; }
/* In LED mode only the lamp lights up. A quiet, stable label below it
   prevents the old meter's active caption fill from merging with the LED. */
:is(html[data-web-features][data-skin][data-theme][data-meter-style=led] .beats,html[data-web-features][data-skin][data-theme] .native-meter-style-preview[data-preview-style=led]) .beat[data-state] .beat-meta {
  background:var(--control,var(--surface));color:var(--text);border-top:1px solid var(--line);border-bottom-color:transparent;box-shadow:none;
}
:is(html[data-web-features][data-skin][data-theme][data-meter-style=led] .beats,html[data-web-features][data-skin][data-theme] .native-meter-style-preview[data-preview-style=led]) .beat[data-state] .beat-caption { color:var(--muted); }
html[data-web-features] .native-meter-style { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px; }
html[data-web-features][data-skin] .native-meter-style>button { display:grid;gap:18px;justify-items:center;padding:20px 14px;min-height:148px;border:1px solid var(--line);border-radius:8px;background:var(--control,var(--surface));color:var(--text);box-shadow:none;font:inherit; }
html[data-web-features][data-skin] .native-meter-style>button[aria-pressed=true] { border:2px solid var(--text);padding:19px 13px; }
html[data-web-features] .native-meter-style-preview.pixel-beats { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;width:100%;height:92px;pointer-events:none; }
html[data-web-features][data-skin] .native-meter-style-preview.pixel-beats .beat { height:100%;min-height:0; }
html[data-web-features][data-skin] .native-meter-style-preview .beat-meta { min-height:20px;padding:3px 1px; }
html[data-web-features][data-skin] .native-meter-style-preview .beat-number { font-size:11px; }
html[data-web-features][data-skin] .native-meter-style-preview .beat-caption { display:none; }
html[data-web-features] .native-meter-style-legend { display:flex;justify-content:center;gap:24px;margin:22px 0;font-size:13px; }
html[data-web-features] .native-meter-style-legend span { display:flex;align-items:center;gap:8px; }
html[data-web-features] .native-meter-style-legend span::before { content:'';width:12px;height:12px;border-radius:3px;background:var(--native-led-normal); }
html[data-web-features] .native-meter-style-legend [data-kind=accent]::before { background:var(--native-led-accent); }
html[data-web-features] .native-meter-style-hint { font-size:13px;line-height:1.6;color:var(--muted); }

/* Terminal LED: phosphor stripes and a short extinction tail. The attack
   remains immediate and the native beat classes still own every flash. */
html[data-web-features][data-skin=terminal] :is(.native-meter-style-preview[data-preview-style=led],html[data-meter-style=led] .beats) .beat .meter-face {
  border-radius:2px;transition:background-color 100ms ease-out,box-shadow 100ms ease-out;
}
html[data-web-features][data-skin=terminal] :is(.native-meter-style-preview[data-preview-style=led],html[data-meter-style=led] .beats) .beat .meter-face::after {
  content:'';position:absolute;inset:0;background:repeating-linear-gradient(to bottom,transparent 0 2px,#00170645 2px 3px);box-shadow:inset 0 0 7px #00170680;pointer-events:none;
}
html[data-web-features][data-skin=terminal] :is(.native-meter-style-preview[data-preview-style=led],html[data-meter-style=led] .beats) .beat.active:not(.muted) .meter-face.native-lit {
  box-shadow:inset 0 0 12px color-mix(in srgb,var(--led-tone) 65%,white);transition:none;
}
@media(prefers-reduced-motion:reduce) {
  html[data-web-features][data-skin=terminal] :is(.native-meter-style-preview[data-preview-style=led],html[data-meter-style=led] .beats) .beat .meter-face { transition:none; }
}


/* Shared app/web notation sizing — generated from native.css. */
html[data-web-features][data-skin] .web-subdivision-window > #subdivision-button:not([data-clave-active=true]):not([data-groove-active=true]) { position:relative;container-type:size;display:block;padding:0; }
html[data-web-features][data-skin] .web-subdivision-window #subdivision-button:not([data-clave-active=true]):not([data-groove-active=true]) #subdivision-figure { position:absolute;left:50%;top:45%;width:min(88cqw,95.5733cqh);height:min(58.9286cqw,64cqh);
  max-width:none;min-height:0;aspect-ratio:112/75;transform:translate(-50%,-50%); }
html[data-web-features][data-skin] #subdivision-options [data-subdivision] { min-width:0;min-height:100px;padding:8px 4px; }
html[data-web-features][data-skin] #subdivision-options [data-subdivision] svg { height:54px;max-width:90px; }
html[data-web-features][data-skin] #subdivision-options [data-subdivision] span { font-size:12px;line-height:1.2; }
html[data-web-features] .native-note-score { position:relative;flex:1;width:100%;max-width:620px;aspect-ratio:112/75;margin:auto;color:var(--native-score-accent,var(--text)); }
