/* Controls inherit the active paper/ink palette from the existing workspace. */
.studio-pane, .studio-pane fieldset, .studio-pane details, .studio-params { min-width:0; }
.studio-pane { font:inherit; margin-block:.45rem; }
.studio-pane details, details.studio-still { border:1px solid currentColor; padding:.45rem .55rem; margin-block:.45rem; }
.studio-pane summary, .studio-actions summary { cursor:pointer; font-weight:650; padding:.2rem 0; }
.studio-pane label:not(.studio-check) { display:grid; gap:.25rem; margin-block:.5rem; }
.studio-pane :is(select,input:not([type=checkbox]),fieldset) { box-sizing:border-box; width:100%; max-width:100%; min-width:0; }
.studio-pane fieldset { border:0; margin:0; padding:0; }
.studio-pane .studio-solid-keys, .studio-pane .studio-params > fieldset { border:1px solid currentColor; padding:.5rem; margin-block:.5rem; }
.studio-solid-keys legend, .studio-params > fieldset legend { font-weight:650; }
.studio-pane .studio-solid-keys output { display:block; float:none; margin-block:0 .4rem; }
.studio-pane input[type=range] { accent-color:currentColor; }
.studio-pane output { font-variant-numeric:tabular-nums; float:right; }
.studio-pane .studio-check,.studio-targets .studio-check { display:flex; gap:.45rem; align-items:center; padding:.2rem 0; }
.studio-check input[type=checkbox] { width:1rem; height:1rem; flex:none; margin:0; }
.studio-targets { max-height:12rem; overflow:auto; }
.studio-actions { display:flex; gap:.35rem; flex-wrap:wrap; margin-block:.4rem; align-items:start; }
.studio-actions details { max-width:100%; }
#studioTimelineTools { align-items:center; }
#studioTimelineTools > button { box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center; min-height:32px; margin:0; padding:.28rem .5rem; border:1px solid var(--line-strong); }
#selectTimelineClips[aria-expanded=true] { border-color:var(--ink); }
#timelineClipSelection { flex:1 0 100%; box-sizing:border-box; border:1px solid var(--line-strong); padding:.4rem; }
#timelineClipSelection[hidden] { display:none; }
@media(max-width:750px) {
  #studioTimelineTools { display:grid; grid-template-columns:auto auto minmax(0,1fr) minmax(0,1fr); gap:3px; align-items:stretch; }
  #studioTimelineTools > button { min-width:0; padding-inline:3px; white-space:normal; font-size:11px; }
  #timelineClipSelection { grid-column:1/-1; }
}
.studio-actions button,.studio-pane button { margin: .12rem; }
.studio-pane .studio-families { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.15rem .5rem; }
.studio-families .studio-check:first-of-type { grid-column:1/-1; }
.studio-families .studio-check { cursor:pointer; }
.studio-pane .studio-scope { display:flex; gap:0; flex-wrap:wrap; }
.studio-scope legend { padding:0; margin-bottom:.25rem; }
.studio-pane .studio-scope label:not(.studio-check) { display:block; position:relative; flex:1; margin:0; }
.studio-scope input[type=radio] { position:absolute; opacity:0; width:1px; height:1px; }
.studio-scope label span { display:grid; place-items:center; min-height:36px; padding:.25rem; text-align:center; border:1px solid var(--line,currentColor); cursor:pointer; }
.studio-scope label + label span { border-inline-start:0; }
.studio-scope input:checked + span { background:var(--ink,#111); color:var(--bg,#fff); }
.studio-scope input:focus-visible + span { outline:2px solid currentColor; outline-offset:-4px; }
.studio-generator-note { line-height:1.4; margin:.55rem 0; }
.studio-generator-note:empty { display:none; }
.anim-transport .anim-mute-control { white-space:nowrap; }
.touch-studio .anim-transport .anim-mute-control { grid-row:2; grid-column:1/-1; justify-self:start; }
@media(pointer:coarse){.studio-scope label span{min-height:44px;}}
.studio-fade { position:absolute; top:0; width:11px; height:11px; background:#fff; border:2px solid #111; border-radius:50%; cursor:ew-resize; z-index:3; }
.studio-fade.fadeIn { left:clamp(5px,var(--fade-in,0%),calc(100% - 16px)); }
.studio-fade.fadeOut { right:clamp(5px,var(--fade-out,0%),calc(100% - 16px)); }
.studio-selection [data-transform] { pointer-events:all; fill:var(--bg); stroke:var(--ink); stroke-width:2; vector-effect:non-scaling-stroke; cursor:nwse-resize; touch-action:none; }
.studio-selection [data-transform=scaleX] { cursor:ew-resize; }
.studio-selection [data-transform=scaleY] { cursor:ns-resize; }
.studio-generator-system { display:grid; gap:.4rem; margin:.5rem 0; padding:.45rem .55rem; }
.touch-studio .touch-section .anim-timeline-box .anim-timeline-tools { flex-wrap:nowrap; }
#animCanvas.studio-pick-center { cursor:crosshair; touch-action:none; }
.studio-selection [data-transform=rotate] { cursor:grab; }
.studio-transform-border { fill:none; stroke:var(--ink); stroke-width:1; vector-effect:non-scaling-stroke; }
#timelineFrame { max-width:5.3rem; }
#timelineSurface.timeline-can-scrub :is(.anim-track-bar,.anim-segment-body,.anim-track-segment) { cursor:ew-resize; }
#timelineSurface .anim-track-bar, #timelineScale { touch-action:none; }
.anim-timeline-box .anim-section-head { flex-wrap:wrap; justify-content:flex-start; align-items:center; container-type:inline-size; }
.anim-timeline-box .anim-section-head .anim-timeline-tools {
  display:flex; flex-flow:row nowrap; align-items:center; justify-content:flex-start; gap:4px; max-width:100%; min-width:0;
  --control-height:32px; --time-box-width:78px;
}
.anim-timeline-tools > * { flex:none; white-space:nowrap; }
.anim-timeline-box .anim-timeline-tools :is(#addTrack,#clearTracks,#timelineUnit,#previewModes button),.anim-timeline-duration .duration-box {
  box-sizing:border-box; height:var(--control-height); min-height:var(--control-height); margin:0;
}
.anim-timeline-box .anim-timeline-tools #timelineUnit { box-sizing:border-box; width:6.1em; min-width:0; max-width:6.1em; padding:0 2px 0 5px; line-height:1.2; }
.anim-timeline-box .anim-timeline-duration { display:flex; position:relative; align-items:center; flex-flow:row nowrap; gap:4px; color:var(--ink); }
#timelineDurationLabel { margin-inline:3px; font-size:11px; white-space:nowrap; }
.anim-timeline-box .anim-timeline-duration .duration-box {
  display:flex; flex:none; width:var(--time-box-width); align-items:center; justify-content:center; gap:2px; padding-inline:3px;
  border:1px solid var(--line-strong); background:var(--bg); color:var(--ink); font:600 13px/1 Arial,sans-serif;
}
.duration-box:focus-within { outline:2px solid currentColor; outline-offset:1px; }
.anim-timeline-box .duration-box :is(#filmDuration,#filmDurationFrames) {
  box-sizing:content-box; width:7ch; min-width:0; max-width:none; height:auto; min-height:0; padding:0; margin:0;
  appearance:textfield; border:0; outline:0; box-shadow:none; background:transparent; color:inherit; font:inherit; font-variant-numeric:tabular-nums; text-align:right;
}
.anim-timeline-box .duration-box #filmDurationFrames { width:4ch; }
.duration-box input::-webkit-inner-spin-button,.duration-box input::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.anim-timeline-box .anim-timeline-tools #previewModes { display:inline-flex; flex:none; flex-wrap:nowrap; align-items:center; gap:0; }
@container (max-width:760px) {
  .anim-timeline-box .anim-timeline-tools { padding-top:15px; }
  #timelineDurationLabel { position:absolute; left:0; bottom:calc(100% + 2px); margin:0; font-size:10px; line-height:1.1; }
}
@container (max-width:580px) {
  .anim-timeline-box .anim-section-head .anim-timeline-tools { --time-box-width:61px; gap:3px; }
  .anim-timeline-box .anim-timeline-duration { gap:2px; }
  .anim-timeline-box .anim-timeline-duration .duration-box { font-size:12px; padding-inline:1px; }
  .anim-timeline-box .anim-timeline-tools :is(#addTrack,#clearTracks,#timelineUnit,#previewModes button) { font-size:11px; padding-inline:4px; min-width:0; letter-spacing:0; }
}
@container (max-width:460px) {
  .anim-timeline-box .anim-section-head .anim-timeline-tools { width:100%; --time-box-width:57px; --control-height:31px; gap:2px; text-size-adjust:100%; -webkit-text-size-adjust:100%; }
  .anim-timeline-box .anim-timeline-duration .duration-box { font-size:11px; }
  .anim-timeline-box .anim-timeline-tools :is(#addTrack,#clearTracks,#timelineUnit,#previewModes button) { font-size:10px; padding-inline:2px; }
}
@container (max-width:390px) {
  .anim-timeline-box .anim-timeline-tools :is(#addTrack,#clearTracks) { position:relative; font-size:0; width:27px; padding:0; }
  #addTrack::before,#clearTracks::before { font:600 17px/1 Arial,sans-serif; }
  #addTrack::before { content:'+'; }
  #clearTracks::before { content:'×'; }
  .anim-timeline-box .anim-timeline-tools #timelineUnit { width:5.6em; }
}
@container (max-width:345px) {
  .anim-timeline-box .anim-timeline-tools #previewModes button { width:30px; font-size:0; padding:0; }
  #previewModes button::before { font:600 11px/1 Arial,sans-serif; }
  #previewModes [data-preview-mode=preview]::before { content:'HQ'; }
  #previewModes [data-preview-mode=draft]::before { content:'LQ'; }
}
#timelineSurface { position:relative; isolation:isolate; }
.timeline-track-label { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:stretch; gap:2px; min-width:0; }
.timeline-track-label .anim-track-name { width:100%; min-width:0; }
.anim-shell .timeline-clip-toggle { width:30px; min-width:0; height:100%; min-height:26px; padding:0 1px; font-size:10px; letter-spacing:0; border:1px solid var(--line-strong); }
.anim-shell .timeline-clip-toggle[aria-pressed=true] { background:var(--ink); color:var(--bg); }
.timeline-clip-off .anim-track-segment,.anim-transition-bridge.timeline-clip-off { opacity:.48; border-style:dashed; }
.audio-track .anim-track-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
#animRuler.anim-track { padding:0; margin:0 0 3px; min-height:24px; cursor:default; }
#timelineScale,.timeline-head-rail { grid-column:2; position:relative; margin-inline:1px; min-width:0; }
#timelineScale { height:24px; cursor:ew-resize; touch-action:none; }
#timelineScale span { position:absolute; top:0; white-space:nowrap; transform:translateX(-50%); pointer-events:none; }
#timelineScale span:first-child { transform:none; }
#timelineScale span:last-child { transform:translateX(-100%); }
#timelineSurface .timeline-head-grid { position:absolute; inset:0; pointer-events:none; z-index:5; min-height:0; }
#timelineHead { position:absolute; top:17px; bottom:0; width:1px; left:var(--timeline-position,0%); background:#fff; box-shadow:1px 0 #111; }
#timelineHead::before { content:''; position:absolute; left:-4px; top:-3px; border-top:6px solid var(--ink); border-inline:4.5px solid transparent; }
.anim-track-segment .studio-key { position:absolute; bottom:-1px; transform:translateX(-50%); font-size:13px; min-width:14px; min-height:15px; line-height:1; padding:0; margin:0; border:0; z-index:4; cursor:ew-resize; touch-action:none; }
.anim-track-segment .studio-key[aria-pressed=true] { z-index:6; outline:2px solid var(--ink); outline-offset:1px; background:var(--bg); color:var(--ink); }
@media(pointer:coarse){.anim-track-segment .studio-key{min-width:20px;min-height:21px;}}

.studio-hit-map { width:100%; height:12px; opacity:.9; pointer-events:none; }
#animCanvas { touch-action:none; }
#editorObjectHandles {fill:none;stroke:var(--ink,#111);}
#editorObjectHandles>* {vector-effect:non-scaling-stroke;stroke-width:1.5;}
#editorObjectHandles>rect:not([data-editor-transform]) {fill:none;stroke-dasharray:5 3;}
#editorObjectHandles [data-editor-transform] {pointer-events:all;touch-action:none;fill:var(--bg,#fff);cursor:nwse-resize;}
#editorObjectHandles [data-editor-transform="rotate"] {cursor:grab;}
#boardSvg:has(#editorObjectHandles [data-editor-transform]) .placed .selection-decoration {display:none;}
.anim-scene-actions:not([hidden]) {display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin:0 0 .65rem;font-size:.8rem;}
.anim-scene-actions button {border:1px solid var(--line-strong);background:var(--bg);color:var(--ink);padding:.35rem .65rem;font-weight:700;}
.anim-scene-actions button:disabled {opacity:.45;}
.studio-selection { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.studio-selection polygon { fill:none; stroke:#626262; stroke-width:1.5; stroke-dasharray:5 3; vector-effect:non-scaling-stroke; }
.studio-legacy-auto > summary { cursor:pointer; margin:.55rem 0; }
@media(max-width:640px){ .studio-pane input,.studio-pane select { font-size:16px; } .studio-pane summary,.studio-actions button { min-height:32px; } }
