@scope (#metronome-slot) {
.metronome-window{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#112943;background:#f6f8fc;font-synthesis:none}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:linear-gradient(125deg,#f8faff,#edf1f8)}button,input,select{font:inherit;color:inherit}button{cursor:pointer;background:#fff;border:1px solid #c6cfdd;border-radius:6px;min-height:30px;padding:4px 10px}button:hover{background:#e9eff7}button:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid #387bd5;outline-offset:3px}button:disabled{opacity:.5;cursor:default}input,select{background:#fff;border:1px solid #c4cedb;border-radius:5px;min-height:31px}input[type=checkbox]{accent-color:#087dff;width:32px;height:20px;min-height:20px}input[type=range]{accent-color:#137cfa;min-height:24px;width:100%;border:0}header button{border:0;background:none;font-size:21px;padding:0 7px}.host-top{height:116px;display:flex;justify-content:space-between;align-items:center;padding:22px 32px;border-bottom:1px solid #e0e6ee}.host-brand{font-size:12px;letter-spacing:.2em;font-weight:700}.host-tabs{display:flex;gap:8px;align-items:center;font-size:11px}.host-tabs span{padding:10px 16px;border:1px solid #d0d8e5;border-radius:5px}.host-tabs .selected{background:#112943;color:white}.host-main{padding:105px 32px 30px;max-width:900px}.host-main h1{font-size:30px;margin:10px 0}.eyebrow{text-transform:uppercase;letter-spacing:.15em;font-size:11px;font-weight:700;color:#667991}.host-main p{max-width:580px;line-height:1.6;color:#63748b}.host-controls{display:flex;gap:10px;flex-wrap:wrap;margin:24px 0}.host-controls span{padding:10px;border:1px solid #d6deea;background:#fff;border-radius:5px;font-size:12px}.host-timeline{margin:30px 24px;border:1px solid #c5d3e6;border-radius:7px;overflow:hidden;background:white}.measure-label{padding:15px 25px;font-size:12px;font-weight:700;letter-spacing:.09em}.blocks{height:70px;background:repeating-linear-gradient(90deg,transparent 0 27px,#ffffff88 27px 28px),linear-gradient(90deg,#ffad19 0 25%,#10b3ae 25% 37%,#f4f1e8 37%)}.staff{height:130px;background:repeating-linear-gradient(0deg,transparent 0 13px,#c2cbd7 13px 14px);margin:36px 30px;position:relative}.staff span{font-family:serif;font-size:45px;position:absolute;left:35px;top:25px}.host-note{font-size:11px;color:#718097;padding:0 32px 24px}.metronome-window{position:fixed;background:#f7f8fa;border:1px solid #939daf;border-radius:13px;box-shadow:0 6px 22px #1e365414;z-index:10;overflow:hidden;display:flex;flex-direction:column;isolation:isolate}.metronome-window[hidden],.reopen[hidden]{display:none}.metronome-window header{display:flex;align-items:center;justify-content:space-between;flex:0 0 36px;padding:0 10px 0 16px;touch-action:none;cursor:move;user-select:none;color:#151c25}.metronome-window header strong{font-size:14px}.metronome-window header nav{display:flex}.metro-body{display:grid;grid-template-columns:42% 58%;flex:1;min-height:0;padding:0 12px 16px 8px;overflow:auto}.instrument-wrap{position:relative;display:flex;flex-direction:column;align-items:center;min-width:0;min-height:0}.instrument{display:block;width:100%;height:calc(100% - 14px);min-height:220px;max-height:100%;overflow:visible}.scale text{font-size:5.8px;stroke:none}.tempo-term{font-size:4.7px}.extension-label{font-size:8px;color:#657388;white-space:nowrap}.instrument [data-weight],.instrument [data-dial]{touch-action:none;cursor:ns-resize;outline-offset:2px}.instrument [data-dial]{cursor:grab}.instrument [data-dial-minus],.instrument [data-dial-plus]{cursor:pointer}.metro-controls{padding:8px 0 0 6px;display:flex;flex-direction:column;gap:12px;min-width:0}.tempo-row{display:flex;gap:6px;align-items:center;margin-bottom:4px}.tempo-row>button{border-radius:50%;width:30px;height:30px;padding:0;font-size:21px;flex:none}.tempo-row>.play{width:36px;height:36px;font-size:18px}.primary{background:#102c49;color:#fff;border-color:#183a5e}.primary:hover{background:#244b72}.tempo-input{display:flex;align-items:center;flex:1;min-width:0;gap:2px}.tempo-input input{font-size:27px;font-weight:750;width:67px;background:none;border:0;padding:0;appearance:textfield}.tempo-input input::-webkit-inner-spin-button{appearance:none}.tempo-input span{font-size:12px;font-weight:600}.control-row{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:11px}.control-row select{width:76px;padding:3px 6px}.beat-unit{font-size:9px;color:#6b788b;text-align:right;margin-top:-9px}.subdivision{font-size:11px;display:grid;gap:5px}.subdivision select{width:100%;font-size:11px;padding:3px 5px}.volume{gap:7px}.volume button{border:0;background:none;padding:0;font-size:15px;width:25px;flex:none}.volume input{min-width:0}.volume output{font-size:11px;min-width:30px}.transport-row{display:flex;gap:5px}.transport-row button{font-size:10px;padding:3px 7px;min-height:27px}.status{font-size:10px;min-height:24px;color:#526b83;line-height:1.4}.source-note{font-size:9px;color:#6c7c91;line-height:1.4;margin-top:auto}.source-note a{color:#526b83}.beat-dots{display:flex;gap:8px;height:8px}.beat-dots i{width:6px;height:6px;border-radius:50%;background:#d1d9e4}.beat-dots i.active{background:#0b9f9b}.resize-handle{position:absolute;bottom:0;right:0;border:0;background:none;color:#a0adbc;cursor:nwse-resize;touch-action:none;padding:1px 3px;min-height:15px;font-size:15px}.minimized{height:36px!important}.minimized .metro-body,.minimized .resize-handle{display:none}.compact .tempo-term{display:none}.compact .metro-controls{gap:9px}.compact .tempo-input input{font-size:23px;width:53px}.compact .tempo-row{gap:3px}.compact .tempo-input span{font-size:9px}.compact .tempo-row>button{width:25px;height:25px;font-size:18px}.compact .tempo-row>.play{width:29px;height:29px;font-size:14px}.compact .control-row{font-size:10px;flex-wrap:wrap}.compact .control-row select{width:65px}.compact .transport-row{flex-wrap:wrap}.compact .source-note{font-size:8px}.short .metro-controls{gap:6px}.short .source-note{display:none}.reopen{position:static;font-size:11px;white-space:nowrap;box-shadow:none}.host-actions{position:fixed;bottom:12px;left:18px;font-size:11px;z-index:1}.host-actions a{color:#526b83;margin-right:15px}@media(max-width:600px){.host-top{padding:16px;height:90px}.host-tabs{display:none}.host-main{padding:45px 20px 15px}.host-main h1{font-size:25px}.host-main p{font-size:13px}.host-timeline{margin:20px 10px}.metro-body{padding-right:8px}.instrument{min-height:220px}.host-actions{position:static;margin:20px}.metronome-window header strong{font-size:12px}}

/* Dense marks remain in the model; compact faceplate shows selected labels. */
.metronome-window:not(.large) .scale-mark text{font-size:7.5px}
.metronome-window:not(.large) .scale-mark:not(.major):not(:nth-child(4n)):not(:first-child):not(:last-child) text{display:none}
.metronome-window:not(.large) .tempo-term{display:none}
.metro-controls{gap:9px}.source-note{margin-top:2px}.status{min-height:16px}
input[role=switch]{appearance:none;border:0;border-radius:20px;background:#bbc5d3;position:relative;cursor:pointer;width:34px;height:20px;flex:none}
input[role=switch]:checked{background:#087dff}input[role=switch]::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:white;box-shadow:0 1px 2px #0002;transition:transform .12s}
input[role=switch]:checked::after{transform:translateX(14px)}

.compact .volume{flex-wrap:nowrap}.compact .tempo-row>button{width:30px;height:30px}.compact .tempo-row>.play{width:34px;height:34px}.large .scale text{font-size:4.7px}

/* Phase 2: normal-flow reopen slot; instrument remains above it in z-order. */
.host-navigation{align-self:flex-start;padding-top:18px;display:flex;flex-direction:column;align-items:flex-start;gap:8px}
[data-metronome-reopen]{min-height:30px}
.metro-controls .control-row:not(.volume){font-size:12px;line-height:1.35}
.metro-controls .subdivision{font-size:12px;line-height:1.35}
.metro-controls .control-row select,.metro-controls .subdivision select{font-size:12px}
.transport-row button{font-size:11px;line-height:1.35;min-height:27px}
.compact .metro-controls .control-row:not(.volume),.compact .metro-controls .subdivision{font-size:11px}
.compact .metro-controls .control-row select,.compact .metro-controls .subdivision select{font-size:11px}
@media(max-width:600px){.host-top{height:auto;min-height:124px;align-items:flex-start;gap:10px;flex-wrap:wrap}.host-navigation{padding-top:0;margin-left:auto}.host-tabs{display:flex;gap:6px}.host-tabs span{padding:7px 10px}.host-brand{font-size:10px}.reopen{font-size:10px}}

/* Phase 3: unobtrusive perimeter targets, with corners taking priority. */
.metronome-window{touch-action:none}
.resize-zone{position:absolute;z-index:3;background:transparent!important;border:0;border-radius:0;padding:0;min-height:0;touch-action:none;color:#a0adbc}
.resize-n,.resize-s{left:14px;right:14px;height:6px;cursor:ns-resize}
.resize-n{top:0}.resize-s{bottom:0}
.resize-w,.resize-e{top:14px;bottom:14px;width:6px;cursor:ew-resize}
.resize-w{left:0}.resize-e{right:0}
.resize-nw,.resize-ne,.resize-sw,.resize-se{width:13px;height:13px;z-index:4}
.resize-nw{top:0;left:0;cursor:nwse-resize}.resize-ne{top:0;right:0;cursor:nesw-resize}
.resize-sw{bottom:0;left:0;cursor:nesw-resize}.resize-se{bottom:0;right:0;cursor:nwse-resize;font-size:15px;line-height:13px}
.minimized .resize-zone{display:none}
/* Phase 4B: label text remains accessible; layout whitespace is neutral. */
.control-row>label,.subdivision>label{width:fit-content;justify-self:start;flex:0 0 auto}
.tempo-input>label{font-size:12px;font-weight:600}
.compact .tempo-input>label{font-size:9px}

/* New rows retain existing sizes; short windows scroll instead of compressing. */
.metronome-window .metro-controls{flex-shrink:0;padding-bottom:8px}
.metronome-window .metro-controls> *{flex-shrink:0}
.metronome-window .link-row{margin-top:auto;padding-top:14px;border-top:1px solid #d7dde5;min-height:42px}
.metronome-window .link-status{font-size:10px;color:#657388;line-height:1.4}
.metronome-window select:disabled{background:#e7ebf0;color:#74808d;cursor:not-allowed;opacity:1}
/* Scroll the controls, not the casing gesture surface. */
.metronome-window .metro-body{overflow:hidden}
.metronome-window .metro-controls{overflow-y:auto;overflow-x:hidden;min-height:0}

}
#metronome-slot{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#112943}
#metronome-slot .metronome-window{position:fixed}
#metronome-reopen{z-index:11}
#metronome-reopen [hidden]{display:none!important}
#link-error{position:absolute;left:32px;top:110px;max-width:500px;color:#9b3026;font-size:12px;pointer-events:none}
body>header.metro-wide>:not(.score-toolbar):not(input){max-width:var(--metro-text-width)}
body>header.metro-stack .eyebrow{margin-top:var(--metro-stack-space)}
/* Keep timeline state colors visible beneath the existing active-group indication. */
#score .subdivision-overlay{fill:none;pointer-events:none;stroke:#8054B8;stroke-width:1.5}

/* Isolate the component title bar from Phase 7 global header sizing. */
#metronome-slot .metronome-window>header{width:auto;max-width:none;margin:0;position:relative;align-self:stretch;padding:0 10px 0 16px;}

@scope (#metronome-slot){
.tempo-row{flex-wrap:wrap}.tempo-input{flex:1 0 10ch;min-width:10ch;gap:6px}.tempo-input input,.compact .tempo-input input{width:6.7ch;min-width:6.7ch;flex:none}.tempo-input>label{flex:none;white-space:nowrap}.status{overflow-wrap:anywhere}
}
#bpm{width:9ch;min-width:9ch;}

@scope (#metronome-slot){
.compact .tempo-input{min-width:0;gap:3px}.compact .tempo-input input{width:6ch;min-width:6ch}.metro-controls{container-type:inline-size}@container (max-width:250px){.tempo-input{flex-basis:100%}}
}
