/* Resolve the host iframe handoff first; env() alone is zero inside iOS iframes. */
html{--gen-safe-t:var(--sat,env(safe-area-inset-top,0px));--gen-safe-r:var(--sar,env(safe-area-inset-right,0px));--gen-safe-b:var(--sab,env(safe-area-inset-bottom,0px));--gen-safe-l:var(--sal,env(safe-area-inset-left,0px))}
html:is(.phone,.tablet).pxl-cine{--fs-t:calc(12px + var(--gen-safe-t));--fs-r:calc(12px + var(--gen-safe-r));--fs-b:calc(12px + var(--gen-safe-b));--fs-l:calc(12px + var(--gen-safe-l))}
/* GEN transport / Looks / cinema: one intentional compact grid, no data-model changes. */
html:not(.phone) body #dock.dock {
  display:grid!important;grid-template-columns:32px repeat(4,minmax(0,1fr)) 28px!important;
  align-items:center!important;gap:6px 8px!important;padding:8px!important;height:auto!important;
  container-type:inline-size;border-color:rgb(255 255 255/.12)!important;border-radius:2px!important;
}
html:not(.phone) body #dock > :is(.dk-h,.dsep){display:none!important}
html:not(.phone) body #dock > *{order:0!important;min-width:0}
html:not(.phone) body #dock > #playBtn.play{grid-column:1!important;width:32px!important;height:32px!important;margin:0!important}
html:not(.phone) body #dock > #tempoBtn{grid-column:2!important;height:32px!important;width:auto!important;margin:0!important;justify-content:center}
html:not(.phone) body #dock > .stepper{grid-column:3 / 6!important;justify-self:start;height:32px!important;margin:0!important}
html:not(.phone) body #dock > .wm-up{grid-column:6!important;grid-row:1!important;margin:0!important;padding:0!important;width:28px!important;height:32px!important;font-size:0!important;justify-content:center;gap:0!important}
html:not(.phone) body #dock > #qualitySel{grid-column:1 / 4!important;grid-row:2!important}
html:not(.phone) body #dock > #aaSel{grid-column:4 / 7!important;grid-row:2!important}
html:not(.phone) body #dock .sel-pill{display:flex!important;position:relative!important;flex-wrap:nowrap!important;width:100%!important;box-sizing:border-box!important;height:32px!important;min-width:0!important;max-width:100%;padding:0 8px!important;gap:6px!important;border-radius:2px!important}
html:not(.phone) body #dock .sel-pill .k{font:400 11px/1 "DM Sans",sans-serif!important;letter-spacing:0!important;text-transform:none!important;color:rgb(233 235 240/.65)!important}
html:not(.phone) body #dock .sel-pill .v{font:400 11px/1 "DM Mono",monospace!important;letter-spacing:0!important}
html:not(.phone) body #dock .sel-pill svg{position:static!important;flex:none!important;width:10px!important;height:10px!important;margin-left:auto!important}
html.has-song:not(.phone) body #dock > .mk-add:not([hidden]){grid-column:1/-1;justify-self:start}
/* Keep the phone transport / overflow sheet wiring, including Song, unchanged. */
html:not(.phone) .sp-bar.sp-v3{container-type:inline-size;border-radius:2px!important;border-color:rgb(255 255 255/.12)!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-v3-top{min-height:34px!important;padding:2px 10px!important}
html body .sp-v3-right .sp-save{height:28px;padding:0 9px;border:1px solid rgb(255 255 255/.24);border-radius:2px;background:transparent;color:#e9ebf0;font:500 12px "DM Sans",sans-serif;cursor:pointer}
html body .sp-v3-right .sp-save:disabled{opacity:.4;cursor:default}
html body .sp-v3-right .sp-save:hover:not(:disabled){background:rgb(255 255 255/.06)}
html:not(.phone) body .sp-bar.sp-v3 .sp-v3-body{display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px 10px!important;padding:8px 10px!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-v3-name{grid-column:1/-1;display:flex!important;gap:2px 8px!important;min-height:28px!important;width:100%!important;min-width:0!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-v3-name .sp-hname{min-height:28px!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-v3-name .sp-hname b{font-size:14px!important;line-height:1.25!important}
html body .sp-stat{font-size:11px;color:rgb(233 235 240/.68)}
html body .sp-revrow{min-height:28px;gap:8px;flex-basis:auto!important}
html body .sp-revert{height:28px}
html body .sp-ago{font-size:11px;color:rgb(233 235 240/.55)}
html:not(.phone) body .sp-bar.sp-v3 .sp-v2-list{display:flex!important;flex-wrap:wrap!important;gap:4px!important;width:100%;min-width:0!important}
html:not(.phone) body .sp-bar.sp-v3 :is(.sp-v2-chip,.sp-v2-add){height:28px!important;min-height:28px!important;max-width:100%!important;border-radius:2px!important;min-width:0!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-v2-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html:not(.phone) body .sp-bar.sp-v3 .sp-v2-chip.on{border-color:var(--accent)!important;background:var(--accent-12)!important;color:#e9ebf0!important}
html:not(.phone) body .sp-bar.sp-v3 .sp-faderow{justify-content:flex-end;align-self:end}
html body .sp-faderow .sp-v2-fade{height:28px!important;border-color:rgb(255 255 255/.12)!important}
html body .sp-faderow .sp-v2-fade button{min-width:28px!important;height:28px!important}
@container (max-width:460px){html:not(.phone) body .sp-bar.sp-v3 .sp-v3-body{grid-template-columns:minmax(0,1fr)}html:not(.phone) body .sp-bar.sp-v3 .sp-faderow{justify-content:flex-end}}
/* Visible 32px controls keep 40px hit regions on touch. Never enlarge the chrome. */
@media (pointer:coarse){html:not(.phone) #dock :is(#playBtn,#tempoBtn,.stepper button,.sel-pill),.sp-save,.sp-v2-chip,.sp-v2-add,.sp-revert,.sp-v2-fade button{position:relative}html:not(.phone) #dock :is(#playBtn,#tempoBtn,.stepper button,.sel-pill)::after,.sp-save::after,.sp-v2-chip::after,.sp-v2-add::after,.sp-revert::after,.sp-v2-fade button::after{content:"";position:absolute;inset:-4px 0}}
/* Cinema: transport, view and Content Scale belong together, clear of display/browser safe areas. */
html.pxl-cine:not(.cine-ui) body #canvasWrap.canvas-wrap.fs-on{--gen-bottom:calc(12px + var(--gen-safe-b));--gen-left:calc(12px + var(--gen-safe-l))}
html.pxl-cine:not(.cine-ui) body #canvasWrap.canvas-wrap.fs-on .fs21-play{left:var(--gen-left)!important;bottom:var(--gen-bottom)!important;top:auto!important;width:32px!important;height:32px!important;min-width:0!important;min-height:0!important}
html.pxl-cine:not(.cine-ui) body #canvasWrap.canvas-wrap.fs-on #pvSeg{left:calc(var(--gen-left) + 42px)!important;bottom:var(--gen-bottom)!important;top:auto!important;width:32px!important;height:32px!important;min-width:0!important;min-height:0!important}
html.pxl-cine body #canvasWrap.canvas-wrap.fs-on #stageBar.stage-bar{left:calc(calc(12px + var(--gen-safe-l)) + 84px)!important;right:auto!important;top:auto!important;transform:none!important;width:max-content!important;height:32px!important;min-height:32px!important;max-width:calc(100% - 108px - var(--gen-safe-r))!important;display:flex!important;align-items:center!important;gap:6px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
html.pxl-cine:not(.cine-ui) body #canvasWrap.canvas-wrap.fs-on #stageBar.stage-bar{bottom:var(--gen-bottom)!important}
html.pxl-cine body #canvasWrap.canvas-wrap.fs-on #stageBar :is(.sbx-trig,.sb-chip){height:32px!important;min-height:32px!important;padding:0 9px!important;border:1px solid rgb(255 255 255/.25)!important;border-radius:2px!important;background:rgb(10 10 12/.6)!important;font:500 12px "DM Sans",sans-serif!important;letter-spacing:0!important;text-transform:none!important;color:#e9ebf0!important}
html.pxl-cine body #canvasWrap.canvas-wrap.fs-on #stageBar .sbx-scale-cur{font:inherit!important;text-transform:none!important}
.sbx-scale-note{margin:0;padding:4px 12px 10px;color:rgb(233 235 240/.65);font:400 12px/1.45 "DM Sans",sans-serif;white-space:normal}
html body .sbx-scale-menu{width:min(280px,calc(100vw - 24px - var(--gen-safe-l) - var(--gen-safe-r)))!important;min-width:0!important;overflow:auto!important;overscroll-behavior:contain;border-radius:2px!important}
html body .sbx-scale-menu .sbx-opt{min-height:44px!important}
html body :is(.sp-save,.sbx-scale-trig,.sbx-scale-menu .sbx-opt):focus-visible{outline:1px solid var(--accent);outline-offset:2px}

@container (max-width:300px){html:not(.phone) body #dock>#tempoBtn{grid-column:2/4!important}html:not(.phone) body #dock>.stepper{grid-column:4/7!important}html:not(.phone) body #dock>.wm-up{display:none!important}html:not(.phone) body #dock>#qualitySel{grid-column:1/-1!important}html:not(.phone) body #dock>#aaSel{grid-column:1/-1!important;grid-row:3!important}}

html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-scale:not([hidden]){display:flex!important}
html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-scale-trig{min-width:64px!important;gap:6px!important;position:relative}
html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-scale-trig svg{width:10px!important;height:10px!important;flex:none}
html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-scale-trig::after{content:"";position:absolute;inset:-4px 0}
html body .sp-v2-chip,html body .sp-v2-add{font-family:"DM Sans",sans-serif!important;font-size:12px!important}
html body .sp-v2-chip i{font:400 11px "DM Mono",monospace!important}
html body .sp-v3-right .sp-v2-count{color:rgb(233 235 240/.6)!important}
html body .sp-pop .sp-btn-accent{background:transparent!important;color:var(--accent)!important;border:1px solid var(--accent)!important;border-radius:2px!important}

html.pxl-cine.cine-ui:not(.phone) body #canvasWrap.fs-on{--gen-left:calc(var(--cine-lw,288px) + 24px);--gen-bottom:calc(var(--cine-lmh,140px) + 20px)}
html.pxl-cine.cine-ui.phone body #canvasWrap.fs-on{--gen-left:calc(12px + var(--gen-safe-l));--gen-bottom:calc(12px + var(--gen-safe-b))}
html.pxl-cine.cine-ui body #canvasWrap.fs-on .fs21-play{left:var(--gen-left)!important;bottom:var(--gen-bottom)!important;top:auto!important;width:32px!important;height:32px!important;min-width:0!important;min-height:0!important}
html.pxl-cine.cine-ui body #canvasWrap.fs-on #pvSeg{left:calc(var(--gen-left) + 42px)!important;bottom:var(--gen-bottom)!important;top:auto!important;width:32px!important;height:32px!important;min-width:0!important;min-height:0!important}
html.pxl-cine.cine-ui body #canvasWrap.fs-on #stageBar.stage-bar{left:calc(var(--gen-left) + 84px)!important;bottom:var(--gen-bottom)!important}

html body .sp-bar .sp-infopop{position:absolute!important;margin:0!important;box-sizing:border-box!important;top:auto!important;bottom:calc(100% + 6px)!important;left:8px!important;right:8px!important;width:auto!important;max-width:none!important;max-height:min(280px,50vh)!important;overflow:auto!important;border-radius:2px!important}
@media(max-width:500px){html.pxl-cine body #canvasWrap.fs-on .hud.tl{max-width:calc(100% - 170px)!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}html.pxl-cine body #canvasWrap.fs-on .hud.tr{left:12px!important;right:auto!important;top:40px!important;max-width:110px!important}}

html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-rs-btn{width:32px!important;min-width:32px!important;padding:0!important;display:grid!important;place-items:center!important}
html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-rs-btn span{display:none!important}
html.pxl-cine body #canvasWrap.fs-on #stageBar .sbx-rs-btn svg{width:14px!important;height:14px!important}
/* Overlay controls use the existing tablet split-panel pattern instead of two rails squeezing the center to zero. */
@media(max-width:950px){
html.pxl-cine.cine-ui:not(.phone) body #layersPanel,html.pxl-cine.cine-ui:not(.phone) body #inspector:not([hidden]){top:64%!important;bottom:8px!important;width:calc(50% - 12px)!important}
html.pxl-cine.cine-ui:not(.phone) body .sp-bar.sp-v3{left:8px!important;right:8px!important;width:auto!important;top:auto!important;bottom:calc(36% + 8px)!important;max-height:30vh!important;overflow:auto!important}
html.pxl-cine.cine-ui:not(.phone) body #canvasWrap.fs-on{--gen-left:calc(12px + var(--gen-safe-l));--gen-bottom:calc(36vh + var(--cine-lmh,140px) + 20px)}
}

/* The old compact stage-list rules hide <b> names; Content Scale needs the option names, not just faint hints. */
html body .sbx-scale-menu .sbx-opt>span{display:flex!important;flex-direction:column!important;gap:3px!important;min-width:0;white-space:normal!important}
html body .sbx-scale-menu .sbx-opt>span>b{display:block!important;font:500 13px/1.3 "DM Sans",sans-serif!important;letter-spacing:0!important;text-transform:none!important;color:#e9ebf0!important}
html body .sbx-scale-menu .sbx-opt>span>small{display:block!important;font:400 11px/1.35 "DM Sans",sans-serif!important;letter-spacing:0!important;text-transform:none!important;color:rgb(233 235 240/.65)!important}
html body .sbx-scale-menu .sbx-grp{font:400 10px/1.4 "DM Mono",monospace!important;letter-spacing:.02em!important;text-transform:none!important;color:rgb(233 235 240/.65)!important}

html.pxl-cine body>.sbx-menu,html.pxl-cine body>.sbx-rs-panel,html.pxl-cine body>.sbx-ss-panel{z-index:2147483500!important}

html:not(.phone) body #dock .stepper input{font:400 12px/1 "DM Mono",monospace!important}
html:not(.phone) body #dock #tempoBtn span{font:500 11px/1 "DM Sans",sans-serif!important;letter-spacing:.02em!important}

html.pxl-cine body>.sbx-menu,html.pxl-cine body>.sbx-rs-panel{max-width:calc(100vw - 16px - var(--gen-safe-l) - var(--gen-safe-r))!important;box-sizing:border-box!important}

/* A visible real-clock timeline for every loop, not only uploaded songs. */
html body #dock.dock>.scrub{display:grid!important;grid-template-columns:minmax(40px,1fr) auto!important;align-items:center!important;gap:8px!important;width:100%!important;min-width:0!important;grid-column:1/-1!important;grid-row:2!important;order:0!important}
html:not(.phone) body #dock>:is(#qualitySel,#aaSel){grid-row:3!important}
html.has-song:not(.phone) body #dock>.wm-up{grid-row:1!important}
html body .scrub .scrub-meta{display:flex!important;align-items:center!important;gap:5px!important;width:auto!important;margin:0!important;white-space:nowrap!important;flex:none!important}
html body .scrub .scrub-meta .tc{display:inline!important;min-width:0!important;font:400 11px/1.2 "DM Mono",monospace!important;letter-spacing:0!important}
html body .scrub #tcEnd::before{content:"/ "!important}
html body .timeline-kind{font:400 10px/1 "DM Sans",sans-serif;color:rgb(233 235 240/.6)}
html body .scrub #timeline{position:relative;display:block!important;height:28px!important;min-width:40px!important;width:100%!important;touch-action:none;cursor:ew-resize;outline-offset:1px}
html body .scrub #timeline::before,html body .scrub #timeline #playfill{top:12px!important;height:3px!important;border-radius:0!important}
html body .scrub #timeline::before{background:rgb(255 255 255/.22)!important}
html body .scrub #timeline #playfill{background:var(--accent)!important;opacity:1!important;pointer-events:none}
html body .scrub #timeline #playhead{top:6px!important;height:16px!important;width:4px!important;margin-left:-2px!important;background:#e9ebf0!important;box-shadow:0 0 6px rgb(255 255 255/.3);pointer-events:none}
html body .scrub #timeline::after{content:"";position:absolute;inset:-6px 0!important}
html body .scrub #timeline:focus-visible{outline:1px solid var(--accent)}
html.phone body #dock.dock>.scrub{flex:1!important;width:auto!important;grid-template-columns:minmax(40px,1fr) auto!important;gap:6px!important}
html.phone body .scrub .scrub-meta .tc{font-size:11px!important}
html.pxl-cine body #canvasWrap.fs-on>.cinema-scrub{display:grid!important;grid-template-columns:minmax(40px,1fr) auto!important;align-items:center;gap:8px;position:absolute!important;z-index:60;left:var(--gen-left,12px)!important;bottom:calc(var(--gen-bottom,12px) + 40px)!important;top:auto!important;width:min(560px,calc(100% - var(--gen-left,12px) - 12px - var(--gen-safe-r)))!important;min-width:0!important;box-sizing:border-box;padding:0 8px;background:rgb(10 10 12/.78);border:1px solid rgb(255 255 255/.14);border-radius:2px;opacity:1!important;pointer-events:auto!important}
html.pxl-cine.cine-ui:not(.phone) body #canvasWrap.fs-on>.cinema-scrub{width:min(560px,calc(100% - var(--gen-left,12px) - var(--cine-rw,288px) - 24px))!important}
@media(max-width:950px){html.pxl-cine.cine-ui:not(.phone) body #canvasWrap.fs-on>.cinema-scrub{width:calc(100% - var(--gen-left,12px) - 12px - var(--gen-safe-r))!important}}
html.pxl-cine body #canvasWrap.fs21-hide>.cinema-scrub{opacity:0!important;pointer-events:none!important}
@container(max-width:300px){html:not(.phone) body #dock>#aaSel{grid-row:4!important}}

/* Dock placement writes an inline top; cinema must anchor the manager naturally to the bottom, not stretch between both. */
html.pxl-cine.cine-ui:not(.phone) body .sp-bar.sp-v3{top:auto!important;height:auto!important}

/* Reserve elapsed digits so crossing 9.9 → 10.0 never moves the track underneath a finger. */
html body .scrub .scrub-meta #tc{min-width:var(--timeline-time-ch,5ch)!important;text-align:right!important}
