@import url("identity.css");
@import url("icons.css");

/* Kinoe Studio: gallery shell / working controls. Approved identity: decisions #81–83. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--display); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; margin: 0; }
.s-muted { color: var(--ink-2); font-size: 12px; margin: 0; }
.s-particle-sampling { border: 1px solid var(--rule); border-radius: 6px; padding: 12px; margin: 0 0 16px; }
.s-particle-sampling p { margin: 0 0 10px; line-height: 1.5; }
.s-particle-sampling-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.s-particle-sampling-actions .s-btn { max-width: 100%; white-space: normal; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.studio-body { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }

/* Top bar */
.s-top { display: flex; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.mark { font-weight: 900; font-size: 18px; letter-spacing: -0.05em; color: var(--ink); text-decoration: none; }
.s-comp { font-size: 12px; color: var(--ink-2); }
.s-top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.local { display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }

.s-btn { background: var(--raise); border: 1px solid var(--rule); color: var(--ink); padding: 7px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.s-btn:hover { border-color: var(--ink); }
.s-btn.ghost { background: transparent; font-weight: 500; }
.s-icon { background: transparent; border: 1px solid var(--rule); color: var(--ink); width: 32px; height: 32px; cursor: pointer; display: inline-grid; place-items: center; }
.s-icon:hover { border-color: var(--ink); }
.primary { background: var(--signal); color: var(--paper); border: 1px solid var(--signal); padding: 9px 16px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.primary:hover { background: var(--ink); border-color: var(--ink); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Main area */
.s-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.s-view { position: relative; display: grid; place-items: center; padding: 16px; min-height: 0; overflow: hidden;
  background: repeating-conic-gradient(#151514 0 25%, #0f0f0e 0 50%) 0 0 / 20px 20px; }
.s-view canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; box-shadow: 0 0 0 1px var(--rule); }
.s-drop { position: absolute; inset: 16px; display: grid; place-content: center; text-align: center; gap: 6px; border: 1px dashed var(--ink-2); background: rgba(10, 10, 10, 0.9); }
.s-drop.over { border-color: var(--signal); border-style: solid; }
.s-drop-main { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.s-drop-sub { color: var(--ink-2); margin: 0 0 8px; }

/* Panel */
.s-panel { border-left: 1px solid var(--rule); display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--paper); }
.s-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.s-tabs button { background: transparent; border: 0; color: var(--ink-2); padding: 11px 0; cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent; }
.s-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }
.s-tabpanel { overflow-y: auto; padding: 14px; display: grid; gap: 16px; align-content: start; min-height: 0; }
.s-group { display: grid; gap: 10px; }
.s-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.s-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.s-field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.s-field input, .s-field select, .s-dialog input[type="number"], .s-dialog input[type="search"] {
  background: var(--plate); border: 1px solid var(--rule); color: var(--ink); padding: 6px 8px; font: 13px var(--mono); width: 100%; min-width: 0; border-radius: 0; }
input[type="color"] { height: 32px; padding: 2px; background: var(--plate); border: 1px solid var(--rule); width: 100%; }
.s-check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.s-check input { accent-color: var(--signal); }
.s-empty { color: var(--ink-2); margin: 0; }

.s-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.s-layer { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--rule); background: var(--plate); cursor: pointer; }
.s-layer[aria-selected="true"] { border-color: var(--ink); }
.s-layer .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.s-layer .kind { font: 10px var(--mono); color: var(--ink-2); text-transform: uppercase; }
.s-layer .acts { display: flex; gap: 2px; }
.s-layer .acts button, .s-fx-head button { background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer; padding: 2px 5px; font-size: 12px; }
.s-layer .acts button:hover, .s-fx-head button:hover { color: var(--ink); border-color: var(--rule); }
.s-layer.hidden-layer .name { opacity: 0.4; text-decoration: line-through; }

/* Effects */
.s-fx { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.s-fx-card { border: 1px solid var(--rule); background: var(--plate); }
.s-fx-card.off { opacity: 0.55; }
.s-fx-head { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.s-fx-head .t { font-weight: 700; flex: 1; }
.s-fx-head input { accent-color: var(--signal); }
.s-fx-body { padding: 8px 10px 10px; display: grid; gap: 10px; }
.s-param { display: grid; gap: 4px; }
.s-param-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.s-param-top output { color: var(--ink); font: 12px var(--mono); }
.s-param-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.s-param input[type="range"] { width: 100%; accent-color: var(--ink); }
.s-param select { background: var(--paper); border: 1px solid var(--rule); color: var(--ink); padding: 5px; font-size: 12px; }
.s-key, .s-mod { width: 24px; height: 24px; background: transparent; border: 1px solid var(--rule); color: var(--ink-2); cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.s-key.on { color: var(--signal); border-color: var(--signal); }
.s-key.has { color: var(--ink); }
.s-mod.on { color: var(--signal); border-color: var(--signal); }
.s-mod-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 6px; border: 1px dashed var(--rule); }
.s-mod-row label { display: grid; gap: 2px; font-size: 11px; color: var(--ink-2); }
.s-mod-row input, .s-mod-row select { background: var(--paper); border: 1px solid var(--rule); color: var(--ink); padding: 4px; font: 12px var(--mono); width: 100%; }

/* Output */
.seg { display: inline-flex; border: 1px solid var(--ink); justify-self: start; }
.seg label { position: relative; padding: 6px 16px; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.options { display: grid; gap: 10px; }
.progress { display: grid; gap: 6px; }
.bar { height: 2px; background: var(--rule); }
.bar span { display: block; height: 100%; width: 0; background: var(--ink); }
.error { margin: 0; border-left: 2px solid var(--signal); padding: 6px 0 6px 10px; }
.out img, .out video { max-width: 100%; display: block; background: repeating-conic-gradient(#1a1a19 0 25%, #121211 0 50%) 0 0 / 14px 14px; }
.stats { border-collapse: collapse; font-size: 12px; width: 100%; }
.stats th { text-align: left; font-weight: 400; color: var(--ink-2); padding: 3px 12px 3px 0; }
.stats td { padding: 3px 0; }
.fits { font: 12px var(--mono); display: grid; gap: 2px; }
.fits .bad { text-decoration: underline; text-decoration-color: var(--signal); }
.fit-steps { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); }

/* Timeline */
.s-timeline { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--rule); }
.s-time { font-size: 13px; min-width: 70px; }
.s-scrub { position: relative; height: 34px; display: grid; align-items: center; }
.s-scrub input { width: 100%; accent-color: var(--signal); position: relative; z-index: 1; }
.s-keys { position: absolute; left: 8px; right: 8px; top: 0; height: 10px; }
.s-keys button { position: absolute; top: 0; width: 10px; height: 10px; transform: translateX(-50%) rotate(45deg); background: var(--ink); border: 0; padding: 0; cursor: pointer; }
.s-loop input { width: 70px; background: var(--plate); border: 1px solid var(--rule); color: var(--ink); padding: 4px 6px; font: 13px var(--mono); }
.s-focus { font-size: 11px; color: var(--ink-2); min-width: 0; max-width: none; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }

/* Dialogs */
.s-dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); padding: 18px; max-width: min(560px, calc(100vw - 32px)); display: grid; gap: 12px; }
.s-dialog:not([open]) { display: none; }
.s-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.s-dialog h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.choices { display: grid; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 8px 10px; border: 1px solid var(--rule); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--plate); }
.choice input { accent-color: var(--signal); margin-top: 3px; }
.s-browser { max-width: min(980px, calc(100vw - 32px)); width: 100%; max-height: calc(100vh - 64px); grid-template-rows: auto 1fr; }
.s-dialog-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.s-browser-body { overflow-y: auto; display: grid; gap: 18px; padding-right: 4px; }
.s-browser-group h3 { margin: 0 0 8px; }
.s-browser-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.s-card { background: var(--plate); border: 1px solid var(--rule); padding: 6px; display: grid; gap: 4px; cursor: pointer; text-align: left; color: var(--ink); }
.s-card:hover { border-color: var(--ink); }
.s-card canvas { width: 100%; aspect-ratio: 16 / 10; display: block; background: #000; object-fit: contain; }
.s-card b { font-size: 13px; }
.s-card span { font-size: 11px; color: var(--ink-2); }

/* Help */
.s-hint { position: fixed; z-index: 30; max-width: 260px; background: var(--ink); color: var(--paper); font-size: 12px; padding: 6px 8px; pointer-events: none; }
.s-explainer, .s-tour { position: fixed; z-index: 25; right: 376px; bottom: 76px; width: min(320px, calc(100vw - 32px)); background: var(--raise); border: 1px solid var(--ink); padding: 14px; display: grid; gap: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.s-explainer h3, .s-tour h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.s-explainer p, .s-tour p { margin: 0; font-size: 13px; color: var(--ink-2); }
.s-explainer ul { margin: 0; padding-left: 18px; font-size: 13px; }
.s-tour .step { font: 11px var(--mono); color: var(--ink-2); }
.s-spot { outline: 2px solid var(--signal) !important; outline-offset: 3px; }

@media (max-width: 900px) {
  .studio-body { height: auto; }
  .s-main { grid-template-columns: 1fr; }
  .s-view { min-height: 50vh; }
  .s-panel { border-left: 0; border-top: 1px solid var(--rule); }
  .s-timeline { grid-template-columns: auto auto 1fr; }
  .s-loop, .s-focus { grid-column: span 3; }
  .s-explainer, .s-tour { right: 16px; bottom: 16px; }
}

/* Add-layer menu */
.s-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.s-menu { display: grid; border: 1px solid var(--ink); background: var(--raise); }
.s-menu button { display: grid; gap: 1px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); color: var(--ink); padding: 8px 10px; cursor: pointer; font-weight: 600; }
.s-menu button:last-child { border-bottom: 0; }
.s-menu button span { font-weight: 400; font-size: 12px; color: var(--ink-2); }
.s-menu button:hover, .s-menu button:focus-visible { background: var(--plate); }
.s-fx-card.source { border-color: var(--ink-2); }
.s-browser-group.looks .s-card { border-color: var(--ink-2); }
.s-more { border-top: 1px dashed var(--rule); padding-top: 6px; display: grid; gap: 10px; }
.s-more summary { cursor: pointer; font-size: 12px; color: var(--ink-2); list-style: none; }
.s-more summary::before { content: '+ '; }
.s-more[open] summary::before { content: '− '; }
.s-more[open] { gap: 10px; }

/* Sound */
.s-wave { width: 100%; height: 72px; display: block; background: var(--paper); border: 1px solid var(--rule); cursor: ew-resize; touch-action: none; }
.s-meters { display: grid; gap: 4px; }
.s-meters div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; font-size: 11px; color: var(--ink-2); }
.s-meters b { display: block; height: 6px; background: var(--rule); overflow: hidden; }
.s-meters i { display: block; height: 100%; width: 0; background: var(--signal); }
.s-mod-row.signal { grid-template-columns: 2fr 1fr; }
.s-mod-row optgroup { font-style: normal; }
.s-pads { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.s-pads li { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.s-param textarea { width: 100%; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); padding: 6px; font: 14px var(--sans, inherit); resize: vertical; }

/* Shuffle, locks, Looks */
.s-shuffle { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: end; }
.s-seed input { font-family: var(--mono); }
.s-lock { width: 22px; height: 22px; display: grid; place-items: center; background: transparent; border: 1px solid var(--rule); color: var(--ink-2); cursor: pointer; padding: 0; }
.s-lock svg { width: 11px; height: 11px; fill: currentColor; }
.s-lock.on { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.s-look-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.s-save-look { display: grid; gap: 6px; }
.s-palette-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.s-card-wrap { position: relative; }
.s-card-wrap .s-card-del { position: absolute; top: 4px; right: 4px; }
.s-batch { display: grid; gap: 6px; }
.s-batch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.s-batch li { display: flex; justify-content: space-between; gap: 8px; }
.s-batch a { color: var(--ink); }
.s-curve { display: grid; gap: 6px; width: 100%; }
.s-curve canvas { width: 100%; aspect-ratio: 1; border: 1px solid var(--rule); touch-action: none; cursor: crosshair; }
.s-curve-tabs { display: flex; gap: 4px; }
.s-curve-tabs button { flex: 1; background: transparent; border: 1px solid var(--rule); color: var(--ink-2); padding: 4px; font-size: 12px; cursor: pointer; }
.s-curve-tabs button[aria-selected="true"] { color: var(--paper); background: var(--ink); }
.s-param-row:has(.s-curve) { display: block; }
.s-paint { display: grid; gap: 6px; width: 100%; }
.s-param-row:has(.s-paint) { display: block; }
.s-view.painting canvas { cursor: crosshair; touch-action: none; outline: 2px solid var(--signal); }
.s-res select { background: var(--paper); border: 1px solid var(--rule); color: var(--ink); font: 12px var(--mono); padding: 2px 4px; }

/* Frames panel: order and timing of a frame-sequence layer */
.s-frames { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow-y: auto; }
.s-frames li { display: grid; grid-template-columns: 22px 44px 1fr auto; gap: 6px; align-items: center; padding: 3px; border: 1px solid var(--rule); font-size: 12px; }
.s-frames li canvas { width: 44px; height: 44px; background: repeating-conic-gradient(#222 0 25%, #2c2c2c 0 50%) 0 0 / 10px 10px; display: block; }
.s-frames li input { width: 64px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); padding: 2px 4px; font: 12px var(--mono); }
.s-frames li .acts { display: flex; gap: 2px; }
.s-frames li .acts button { background: transparent; border: 1px solid var(--rule); color: var(--ink-2); padding: 2px 5px; cursor: pointer; font-size: 11px; }
.s-frames .n { color: var(--ink-2); font: 11px var(--mono); text-align: right; }

/* Motion tracking */
#track-overlay { position: absolute; pointer-events: none; }
.s-view.picking canvas#view { cursor: crosshair; outline: 2px dashed var(--signal); }
.s-tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.s-tracks li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; border: 1px solid var(--rule); padding: 4px 6px; font-size: 12px; }
.s-tracks li .acts { display: flex; gap: 4px; }
.s-tracks li .acts button { background: transparent; border: 1px solid var(--rule); color: var(--ink-2); padding: 2px 6px; cursor: pointer; font-size: 11px; }
.s-tracks li .weak { color: #ff6b5a; }

/* Keeping work */
.s-save-status { font-size: 11px; max-width: 28ch; text-align: right; }
.s-recover { border: 1px solid var(--signal); padding: 10px; }
.s-recover p { margin: 0 0 8px; font-size: 12px; }
#choice-text { margin: 0; font-size: 13px; }
.s-choice-list { margin: 0; padding-left: 18px; font-size: 12px; display: grid; gap: 4px; max-height: 40vh; overflow: auto; }
#out-settings { display: grid; gap: 10px; }
body.exporting [inert] { opacity: 0.55; transition: opacity 0.2s; }
/* Keep structural backgrounds opaque: whole-surface opacity exposes scrolling
   Output text through the pinned preview and timeline while editing is locked. */
body.exporting :is(.s-view, .s-timeline)[inert] { opacity: 1; }
body.exporting :is(.s-view, .s-timeline)[inert] > * { opacity: 0.55; }
@media (max-width: 900px) {
  /* Locked editing chrome must not cover export progress or Cancel. Geometry
     stays in document flow and normal pinning returns when the job ends. */
  body.exporting .s-view[inert] { position: relative; }
  body.exporting .s-timeline[inert] { position: static; }
}

/* Beta UI: shared identity, stable control geometry, and visible output actions. */
body { font-family: var(--display); font-size: 14px; font-variant-numeric: tabular-nums; }
.label { font: 500 12px/1.35 var(--display); text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.s-muted { font-size: 12px; line-height: 1.5; }
.mark { font: 400 26px/1 "Anton", sans-serif; letter-spacing: 0.015em; }
.s-top { gap: 8px 14px; padding: 10px 16px; background: #121619; }
.s-top > .label { padding-left: 12px; border-left: 1px solid var(--rule); color: var(--ink); }
.s-top-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.s-save-status { max-width: 24ch; font-size: 11px; }
.s-top .local { font-size: 11px; }
.dot { box-shadow: none; }

.s-btn, .s-icon, .primary { min-height: 32px; border-radius: 4px; }
.s-btn { padding: 7px 11px; font-size: 13px; border-color: #4a535c; background: transparent; }
.s-icon { width: 32px; height: 32px; }
.s-btn:hover, .s-icon:hover { background: var(--raise); }
.s-btn.ghost { border-color: var(--rule); }
.primary { background: var(--studio-signal); border-color: var(--studio-signal); color: var(--on-accent, #10151a); font-size: 13px; }
.primary:hover { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--studio-signal); outline-offset: 3px; }

.s-main { grid-template-columns: minmax(0, 1fr) clamp(360px, 29vw, 410px); }
.s-view { background: #080a0c; padding: 18px; }
.s-view canvas#view {
  background: repeating-conic-gradient(#151a1f 0 25%, #101418 0 50%) 0 0 / 18px 18px;
  box-shadow: 0 0 0 1px #39424c;
}
/* Do not set track-overlay positioning, dimensions, transform or pointer events.
 * The controller owns its alignment with the rendered canvas. */
/* Reserve the 36px composition bar and a 20px gap above the empty drop area. */
.s-drop { inset: 56px 20px 20px; background: #0e1318f5; border-color: #606d7a; gap: 10px; }
.s-view:has(> .s-drop:not([hidden])) > .s-comparison { display: none; }
.s-drop-main { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; }
.s-drop-sub { font-size: 13px; }

.s-panel { background: #15191d; }
.s-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.s-tabs button { min-width: 0; padding: 13px 3px 11px; white-space: nowrap; font-size: 13px; font-weight: 500; }
.s-tabs button[aria-selected="true"] { border-bottom-color: var(--studio-signal); background: #1b2229; }
.s-tabpanel { padding: 18px; gap: 20px; }
.s-group { gap: 12px; }
.s-group > h2.label { font-size: 14px; font-weight: 650; color: var(--ink); }
.s-field { font-size: 12px; gap: 6px; }
.s-field input, .s-field select, .s-dialog input[type="number"], .s-dialog input[type="search"] {
  font-size: 13px; padding: 8px; border-radius: 3px; background: #10151a; border-color: #46515b;
}
.s-field select, .s-dialog input[type="search"] { font-family: var(--display); }
input[type="color"] { border-radius: 3px; }
.s-check { font-size: 13px; line-height: 1.45; }

.s-layer { padding: 9px; border-radius: 3px; border-color: var(--rule); }
.s-layer[aria-selected="true"] { background: #252f3a; border-color: var(--studio-signal); }
.s-layer .name { font-size: 13px; font-weight: 550; }
.s-layer .kind { font-family: var(--display); text-transform: none; font-size: 11px; }
.s-layer .acts button, .s-fx-head button { min-width: 24px; min-height: 26px; border-radius: 3px; }
#fx-layer { padding: 0 0 13px; border-bottom: 1px solid var(--rule); color: var(--ink); font-size: 13px; }
.s-fx { gap: 14px; }
.s-fx-card { background: #191f25; border-color: #46515c; border-radius: 3px; overflow: hidden; }
.s-fx-head { gap: 7px; padding: 10px 11px; background: #1d252d; }
.s-fx-head .t { font-size: 15px; font-weight: 650; min-width: 0; }
.s-fx-head input { width: 15px; height: 15px; }
.s-fx-body { padding: 12px; gap: 14px; }
.s-param { gap: 6px; }
.s-param-top { font-size: 13px; color: var(--ink); }
.s-param-top output { font-size: 11px; color: #e6ebf1; padding-left: 6px; }
.s-param-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.s-param-row:has(> input[type="range"]) { grid-template-columns: minmax(0, 1fr) repeat(3, 26px); }
/* Numeric ID selectors have a key and lock, but no modulation action. Let their
   existing button sizes determine the two action columns, including touch sizes. */
.s-param-row:has(> input[type="number"]) { grid-template-columns: minmax(0, 1fr) auto auto; }
.s-param-row > :only-child { grid-column: 1 / -1; }
.s-param input[type="range"] { min-width: 0; margin: 0; accent-color: var(--studio-signal); }
.s-key, .s-mod, .s-lock { width: 26px; height: 26px; min-width: 26px; border-radius: 3px; }
.s-key.on, .s-mod.on { color: var(--studio-signal); border-color: var(--studio-signal); background: #10171f; }
.s-lock.on { color: var(--on-accent, #10151a); background: var(--studio-signal); border-color: var(--studio-signal); }
.s-mod-row { padding: 9px; gap: 7px; border-style: solid; border-radius: 3px; background: #10171d; }
.s-mod-row label { font-size: 11px; }
.s-mod-row input, .s-mod-row select { min-width: 0; padding: 5px; border-radius: 2px; }
.s-more { border-top-style: solid; padding-top: 10px; }
.s-more summary { font-size: 12px; padding: 3px 0; }
.s-shuffle { grid-template-columns: minmax(110px, auto) minmax(0, 1fr) 32px auto; align-items: end; gap: 7px; }
.s-seed { min-width: 0; }
.s-seed input { min-width: 0; width: 100%; }
.s-look-actions { gap: 7px; }

.s-timeline { padding: 10px 16px; background: #151b21; gap: 11px; }
.s-time { font-size: 12px; min-width: 74px; }
.s-scrub input { accent-color: var(--studio-signal); }
.s-loop { font-size: 12px; }
.s-loop input { font-size: 12px; border-radius: 3px; padding: 6px; }
.s-res select { border-radius: 3px; padding: 5px; }
.s-focus { font-size: 11px; }

.seg { width: 100%; display: grid; grid-template-columns: 1fr 1fr; border-color: #4a5662; border-radius: 4px; padding: 3px; background: #0f151b; }
.seg label { text-align: center; padding: 8px 12px; border-radius: 2px; }
.seg label + label { border-left: 0; }
.seg label:has(input:checked) { background: var(--studio-signal); color: var(--on-accent, #10151a); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
#out-settings { gap: 14px; }
#out-summary { border-top: 1px solid var(--rule); padding-top: 14px; color: var(--ink); font-size: 12px; line-height: 1.7; }
#tab-output > .s-group > .actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
#convert { min-height: 38px; }
.progress { gap: 9px; }
.bar { height: 4px; border-radius: 2px; overflow: hidden; }
.bar span { background: var(--studio-signal); }
#progress-label { font-size: 12px; }
.error { border-left-color: #f1aa9b; background: #2b1c1a; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.stats { font-size: 12px; }
.stats th, .stats td { padding-top: 5px; padding-bottom: 5px; }
.fits { font-size: 11px; line-height: 1.6; }
.out img, .out video { border: 1px solid var(--rule); }
#download { display: block; min-height: 38px; }

.s-dialog { background: #151b21; border-color: #6a7888; border-radius: 5px; padding: 20px; }
.s-dialog h2 { font-size: 21px; font-weight: 650; }
.s-dialog::backdrop { background: #030609cf; }
.s-dialog-head { grid-template-columns: auto minmax(0, 1fr) auto; }
.s-browser { max-width: min(1080px, calc(100vw - 48px)); }
.s-browser-body { gap: 22px; }
.s-browser-group h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.s-browser-grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.s-card { padding: 0; border-radius: 3px; overflow: hidden; background: #11171d; gap: 7px; border-color: #46515d; }
.s-card b, .s-card span { padding-left: 9px; padding-right: 9px; }
.s-card b { font-size: 14px; font-weight: 600; }
.s-card span { font-size: 11px; padding-bottom: 10px; line-height: 1.5; }
.s-card canvas { aspect-ratio: 4 / 3; background: #080b0e; }
.s-card:hover, .s-card:focus-visible { border-color: var(--studio-signal); }
.s-explainer, .s-tour { border-radius: 4px; border-color: #6e7d8c; right: calc(clamp(360px, 29vw, 410px) + 16px); bottom: 90px; }
.s-explainer h3, .s-tour h3 { font-size: 17px; font-weight: 600; }
.s-hint { border-radius: 3px; font-size: 12px; }
.s-frames li { border-radius: 3px; padding: 6px; gap: 7px; }
.s-frames li .acts button { min-width: 24px; min-height: 26px; border-radius: 2px; }
.s-frames li input { min-height: 29px; border-radius: 2px; }
.s-tracks li { border-radius: 3px; padding: 8px; gap: 8px; }
.s-tracks li .acts { flex-wrap: wrap; justify-content: flex-end; }
.s-tracks li .acts button { border-radius: 2px; min-height: 27px; }
.s-tracks li .weak { color: #f3b29f; }
.s-recover { border-color: #d0b68a; border-radius: 3px; padding: 12px; background: #28241d; }

/* Preserve native [hidden], exporting/inert, dialog, tracking and painting states.
 * Do not add transitions to rendering surfaces or move the track overlay. */
@media (max-width: 1100px) {
  .s-top .local { display: none; }
  .s-top-right { gap: 6px; }
  .s-comp { font-size: 11px; }
  .s-save-status { max-width: 18ch; }
}
@media (max-width: 900px) {
  .s-main { grid-template-columns: minmax(0, 1fr); }
  .s-top { align-items: flex-start; }
  .s-top-right { width: 100%; margin-left: 0; justify-content: flex-start; }
  .s-panel { border-left: 0; }
  .s-tabpanel { padding: 16px; }
  .s-explainer, .s-tour { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* Workspace context and honest, live selection. */
.s-panel { grid-template-rows: auto auto minmax(0, 1fr); }
.s-context { padding: 15px 18px 14px; display: grid; gap: 4px; border-bottom: 1px solid var(--rule); background: #151a1f; min-width: 0; }
.s-context > span { color: var(--ink-2); font-size: 11px; }
.s-context > strong { font: 600 17px/1.3 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-context #context-detail { font-size: 11px; }
.s-view { padding: 44px 18px 62px; }
.s-viewbar { position: absolute; top: 0; left: 0; right: 0; min-height: 36px; padding: 10px 18px 6px; display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 11px; }
.s-view-title { color: var(--ink); font-weight: 500; }
.s-viewbar .s-comp { font-size: 11px; }
.s-layer-strip { position: absolute; left: 0; bottom: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; height: 52px; overflow-x: auto; background: #12171c; border-top: 1px solid var(--rule); }
.s-layer-chip { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; min-height: 30px; max-width: 250px; padding: 5px 9px; background: transparent; border: 1px solid #45515e; border-radius: 3px; cursor: pointer; font: 500 12px var(--display); }
.s-layer-chip > span:last-child { max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.s-layer-chip[aria-pressed="true"] { border-color: var(--studio-signal); background: #27313c; }
.s-chip-kind { font-size: 10px; font-weight: 400; color: var(--ink-2); }
.s-stack-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.s-stack-heading h2 { font-size: 14px; font-weight: 650; color: var(--ink); }
.s-stack-heading .s-btn { font-size: 12px; max-width: 70%; }
#fx-wrap { min-width: 0; }
.s-fx-family { display: none; }
.s-fx-head { flex-wrap: nowrap; gap: 3px; }
.s-fx-head .t { margin: 0 5px; font-size: 14px; }
.s-shuffle { margin-top: 16px; padding: 13px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.s-look-actions { margin-top: 12px; }
.s-timeline { grid-template-columns: auto auto minmax(90px, 1fr) auto auto; }
.s-focus { grid-column: 1 / -1; min-height: 0; }
.s-focus:empty { display: none; }
.s-explainer, .s-tour { left: 16px; right: auto; bottom: 78px; width: min(300px, calc(100vw - 32px)); }
/* Settings scroll independently; summary, Export and Cancel stay outside the inert block. */
#tab-output { display: flex; flex-direction: column; padding: 0; gap: 0; overflow: hidden; }
.s-output-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: grid; align-content: start; gap: 18px; }
.s-output-footer { flex-shrink: 0; padding: 13px 18px 15px; border-top: 1px solid #4b5661; background: #1c252e; display: grid; gap: 10px; }
.s-output-footer #out-summary { margin: 0; padding: 0; border: 0; font: 500 12px/1.65 var(--display); }
.s-output-footer .actions { display: flex; gap: 9px; }
.s-output-footer #convert { flex: 1; }
.s-output-footer .error { max-height: 120px; overflow: auto; }
.s-output-note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.s-canvas-details { padding: 11px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.s-canvas-details > summary { cursor: pointer; font-size: 13px; font-weight: 550; }
.s-canvas-details > .s-group { padding-top: 15px; }
.s-canvas-details h2 { display: none; }
/* Browser catalogue: one family index and an inexpensive still preview per effect. */
.s-browser { max-width: min(1140px, calc(100vw - 40px)); height: min(760px, calc(100vh - 40px)); max-height: calc(100vh - 40px); grid-template-rows: auto auto minmax(0, 1fr); padding: 20px; }
.s-browser-meta { display: flex; justify-content: space-between; gap: 12px; padding: 0 0 12px; border-bottom: 1px solid var(--rule); font-size: 11px; color: var(--ink-2); }
.s-browser-meta p { margin: 0; color: var(--ink); }
.s-browser-layout { display: grid; grid-template-columns: 155px minmax(0, 1fr); min-height: 0; gap: 16px; }
#browser-families { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 12px; border-right: 1px solid var(--rule); }
.s-family-link { text-align: left; padding: 9px 7px; border: 1px solid transparent; background: transparent; color: var(--ink-2); border-radius: 3px; font-size: 12px; cursor: pointer; }
.s-family-link:hover, .s-family-link[aria-pressed="true"] { color: var(--ink); background: #26313c; border-color: #4d6074; }
.s-browser-results { min-height: 0; min-width: 0; position: relative; display: grid; grid-template-rows: minmax(0, 1fr); }
.s-browser-body { min-height: 0; padding-right: 9px; }
.s-browser-group { scroll-margin-top: 5px; }
#browser-empty { padding: 28px 18px; position: absolute; top: 0; left: 0; right: 0; font-size: 14px; line-height: 1.6; }
/* Actual local image previews; no default mode or fitting choice is selected. */
.s-import-dialog { width: min(760px, calc(100vw - 32px)); max-width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.s-import-previews { list-style: none; margin: 2px 0; padding: 0 0 7px; display: flex; gap: 10px; overflow-x: auto; }
.s-import-previews li { width: 128px; min-width: 128px; border: 1px solid #44525f; background: #0b1015; border-radius: 3px; overflow: hidden; }
.s-import-previews canvas { width: 128px; height: 144px; display: block; background: repeating-conic-gradient(#151b21 0 25%, #10151a 0 50%) 0 0 / 12px 12px; }
.s-import-previews span { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px; }
.s-import-prompt { font-size: 15px; font-weight: 600; margin: 8px 0 0; }
.s-import-dialog > .choices { grid-template-columns: 1fr 1fr; }
.choice { border-radius: 3px; padding: 12px; line-height: 1.5; }
.choice input { margin-top: 4px; }
.s-import-timing { border-top: 1px solid var(--rule); padding-top: 14px; }
.s-import-timing > .s-field { max-width: 180px; margin-bottom: 15px; }
.s-import-dialog > .actions { justify-content: flex-end; padding-top: 8px; }

/* Quiet working surfaces: one inspector, open effect groups, soft interactive shapes.
   Geometry and existing IDs/locks remain unchanged. Source pixels are never rounded. */
.s-top { background: var(--bg); border-bottom: 0; padding: 12px 18px; gap: 10px 14px; }
.mark { font: 400 var(--mark-size)/1 var(--poster); letter-spacing: 0.015em; }
.s-top > .label { border-left: 0; padding-left: 0; color: var(--muted); font-size: 12px; }
.s-top .local { color: var(--muted); }
.s-top-right { gap: 7px; }
.s-btn, .s-icon { background: transparent; border: 1px solid transparent; border-radius: var(--radius-control); }
.s-btn.ghost { border-color: transparent; }
.s-btn:hover, .s-icon:hover { background: var(--surface-2); border-color: transparent; }
.s-top #add-media { background: var(--surface-2); }
.s-top #add-media:hover { background: var(--surface-hover); }
.primary { border: 1px solid transparent; border-radius: var(--radius-control); font-weight: 600; }
.primary:hover { border-color: transparent; }
.s-panel { margin: 4px 10px 10px 0; border: 0; border-radius: var(--radius-panel); background: var(--surface); overflow: hidden; }
.s-context { background: transparent; border-bottom: 0; padding: 17px 18px 13px; gap: 4px; }
.s-context > strong { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.s-context #context-kicker { font-size: 11px; }
.s-context #context-detail { font-size: 11px; color: var(--muted); }
.s-tabs { height: 38px; min-height: 38px; margin: 0 12px 9px; padding: 3px; border: 0; border-radius: 10px; background: var(--surface-2); }
.s-tabs button { border: 0; padding: 6px 3px; border-radius: 7px; font-size: 12px; font-weight: 500; }
.s-tabs button[aria-selected="true"] { background: var(--selection); border: 0; color: var(--ink); }
.s-tabpanel { padding-top: 13px; gap: 22px; }
.s-view { background: var(--bg); padding-top: 40px; padding-bottom: 58px; }
.s-view canvas#view { box-shadow: none; border-radius: 0; }
.s-viewbar { padding-top: 9px; color: var(--muted); }
.s-view-title { color: var(--muted); font-weight: 400; }
.s-layer-strip { height: 48px; padding: 8px 14px; border: 0; background: var(--bg); }
.s-layer-chip { border: 1px solid transparent; border-radius: var(--radius-control); padding: 6px 10px; background: transparent; }
.s-layer-chip:hover { background: var(--surface); }
.s-layer-chip[aria-pressed="true"] { border-color: transparent; background: var(--surface-2); color: var(--ink); }
.s-layer-chip[aria-pressed="true"]::before { content: ''; width: 4px; height: 4px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.s-chip-kind { color: var(--muted); }
.s-layers { gap: 3px; }
.s-layer { border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; padding: 9px; }
.s-layer:hover { background: var(--surface-2); }
.s-layer[aria-selected="true"] { border-color: transparent; background: var(--selection); }
.s-layer[aria-selected="true"] .name { color: var(--ink); font-weight: 600; }
.s-layer .acts button, .s-fx-head button { border-color: transparent; border-radius: 6px; color: var(--muted); }
.s-layer .acts button:hover, .s-fx-head button:hover { border-color: transparent; background: var(--surface-hover); color: var(--ink); }
.s-stack-heading { margin: 10px 0 13px; }
.s-stack-heading h2 { font-size: 13px; font-weight: 550; }
#fx-layer { margin: 0; padding-bottom: 4px; border: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.s-fx { gap: 14px; }
.s-fx-card { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.s-fx-card + .s-fx-card { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.s-fx-head { padding: 8px 0; border: 0; background: transparent; gap: 4px; }
.s-fx-head .t { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.s-fx-head input { margin-left: 0; margin-right: 3px; }
.s-fx-body { padding: 8px 0 4px; gap: 15px; }
.s-fx-body[hidden] { display: none; }
.s-fx-head .s-fx-disclosure { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; margin-left: 0; padding: 4px 2px; text-align: left; color: var(--ink); font-family: inherit; overflow-wrap: anywhere; }
.s-fx-chevron { flex-shrink: 0; width: 10px; color: var(--muted); font-size: 12px; }
.s-param { gap: 7px; }
.s-param-top { font-size: 12px; color: var(--ink); }
.s-param-top output { font-size: 11px; color: var(--ink); }
.s-key, .s-mod, .s-lock { border-color: transparent; border-radius: 6px; background: transparent; color: var(--muted); }
.s-key:hover, .s-mod:hover, .s-lock:hover { border-color: transparent; background: var(--surface-hover); color: var(--ink); }
.s-key.on, .s-key.has, .s-mod.on { border-color: transparent; background: var(--selection); color: var(--accent); }
.s-lock.on { border-color: transparent; background: var(--selection); color: var(--accent); }
.s-mod-row { border: 0; padding: 11px; gap: 8px; border-radius: 10px; background: var(--surface-2); }
.s-more { border: 0; padding-top: 6px; }
.s-more summary { font-size: 12px; color: var(--muted); }
.s-shuffle { border: 0; margin-top: 14px; padding: 12px 0 5px; }
.s-look-actions { margin-top: 10px; }
.s-field input, .s-field select, .s-dialog input[type="number"], .s-dialog input[type="search"], .s-param select, .s-mod-row input, .s-mod-row select {
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-control); font-family: var(--ui); }
.s-field input:hover, .s-field select:hover, .s-param select:hover { background: var(--surface-hover); }
.s-field input:focus-visible, .s-field select:focus-visible { border-color: transparent; }
input[type="color"] { border-color: transparent; border-radius: var(--radius-control); background: var(--surface-2); }
.s-param textarea { background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-control); padding: 10px; font: 13px/1.5 var(--ui); }
.s-timeline { margin: 0 10px 10px; padding: 10px 12px; background: var(--surface); border: 0; border-radius: var(--radius-panel); }
.s-loop input, .s-res select { background: var(--surface-2); border-color: transparent; border-radius: 7px; font-family: var(--ui); }
.s-output-scroll { padding-top: 9px; }
.s-output-footer { border-top: 0; padding-top: 16px; background: var(--surface); }
.s-output-footer #out-summary { color: var(--ink); font-size: 12px; line-height: 1.65; }
.s-output-footer #convert { min-height: 38px; border-radius: var(--radius-control); }
.s-export-ready { display: grid; gap: 7px; padding-bottom: 14px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.s-export-ready[hidden] { display: none; }
.s-export-ready strong { font: 650 15px/1.35 var(--display); }
.s-export-ready > .s-muted { font: 12px/1.4 var(--display); }
.s-export-ready #download { text-align: center; }
.s-export-filename { color: var(--muted); font: 11px/1.35 var(--display); overflow-wrap: anywhere; }
.s-loop-edit { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.s-loop-edit > summary { cursor: pointer; font-weight: 600; }
.s-loop-edit > p { margin: 10px 0; }
#loop-edit-controls { border: 0; padding: 12px 0 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
#loop-edit-controls[hidden], .s-loop-preview[hidden] { display: none; }
#loop-edit-controls p { margin: 0; }
.s-loop-preview, .s-loop-suggestions { display: grid; gap: 10px; min-width: 0; }
.s-loop-suggestions button { white-space: normal; text-align: left; }
.s-loop-preview > img { display: block; max-width: 100%; max-height: 256px; margin: auto; }
.s-loop-endpoints { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.s-loop-endpoints figure { margin: 0; min-width: 0; }
.s-loop-endpoints canvas { display: block; width: 100%; height: auto; max-height: 128px; object-fit: contain; }
.s-loop-endpoints figcaption { font-size: 11px; color: var(--muted); margin-top: 5px; }
.s-loop-preview > img, .s-loop-endpoints canvas { background: repeating-conic-gradient(#222 0 25%, #151515 0 50%) 0 0 / 12px 12px; }
.s-output-note { font-size: 11px; line-height: 1.6; }
.seg { border: 0; border-radius: 10px; background: var(--surface-2); padding: 3px; }
.seg label { border-radius: 7px; font-size: 12px; }
.seg label:has(input:checked) { background: var(--selection); color: var(--ink); }
.s-canvas-details { border: 0; padding: 9px 0; }
.s-canvas-details > summary { font-size: 12px; color: var(--muted); font-weight: 500; }
.s-canvas-details > .s-group { padding-top: 14px; }
.out img, .out video { border: 0; border-radius: var(--radius-thumb); }
.s-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-dialog); padding: 24px; box-shadow: 0 24px 90px #0008; }
.s-dialog::backdrop { background: #050609b8; }
.s-dialog h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.s-dialog-head { gap: 16px; }
.s-dialog-head .s-icon { border: 0; background: transparent; }
.s-browser { padding: 22px; }
.s-browser-meta { border: 0; padding-bottom: 10px; font-size: 11px; }
.s-browser-meta > span { color: var(--muted); }
#browser-families { border: 0; padding-right: 9px; gap: 3px; }
.s-family-link { border: 0; border-radius: var(--radius-control); font-size: 12px; padding: 9px; }
.s-family-link:hover, .s-family-link[aria-pressed="true"] { border-color: transparent; background: var(--surface-2); }
.s-browser-group h3 { font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 12px; }
.s-browser-grid { gap: 15px 12px; }
.s-card { border: 0; border-radius: 10px; background: transparent; padding: 5px; gap: 7px; }
.s-card:hover, .s-card:focus-visible { background: var(--surface-2); border-color: transparent; }
.s-card canvas { border-radius: var(--radius-thumb); background: #090a0b; }
.s-card b { font-size: 13px; font-weight: 550; padding-left: 3px; padding-right: 3px; }
.s-card span { font-size: 11px; line-height: 1.5; padding: 0 3px 6px; }
.s-browser-group.looks .s-card { border-color: transparent; }
.s-card-del { background: var(--surface-2); border-radius: 6px; }
.s-import-previews { gap: 12px; padding-bottom: 4px; }
.s-import-previews li { border: 0; border-radius: var(--radius-thumb); background: transparent; }
.s-import-previews canvas { border-radius: var(--radius-thumb); }
.s-import-previews span { padding: 8px 2px; color: var(--muted); }
.s-import-prompt { font-size: 14px; font-weight: 550; }
.choice { border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); padding: 13px; }
.choice:has(input:checked) { border-color: transparent; background: var(--selection); }
.choice b { font-weight: 550; }
.s-import-timing { border: 0; padding-top: 12px; }
.s-frames { gap: 4px; }
.s-frames li { border: 0; border-radius: var(--radius-control); background: transparent; padding: 7px; }
.s-frames li:hover { background: var(--surface-2); }
.s-frames li canvas { border-radius: 6px; }
.s-frames li input, .s-frames li .acts button { background: var(--surface-2); border-color: transparent; border-radius: 6px; }

/* Stable source labels and a read-only large frame view. */
.s-frames li { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto auto; }
.s-frame-open { grid-row: 1 / 3; grid-column: 1; padding: 0; border: 0; background: transparent; border-radius: 6px; cursor: zoom-in; }
.s-frame-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.s-frame-info { grid-row: 1; grid-column: 2 / -1; display: grid; gap: 2px; min-width: 0; }
.s-frames .n { color: var(--ink); font: 600 13px var(--display); text-align: left; overflow-wrap: anywhere; }
.s-frame-position { color: var(--muted); font: 11px var(--mono); }
.s-frame-delay { grid-row: 2; grid-column: 2; white-space: nowrap; }
.s-frames li input { width: 54px; }
.s-frames li .acts { grid-row: 2; grid-column: 3; }
.s-frame-preview { width: min(1100px, calc(100vw - 32px)); max-width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 24px); padding: 16px; }
.s-frame-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.s-frame-preview-head h2 { min-width: 0; overflow-wrap: anywhere; }
.s-frame-preview-head button { flex-shrink: 0; min-width: 44px; min-height: 44px; }
.s-frame-preview #frame-preview-detail { margin: 0; }
.s-frame-preview-stage { display: grid; place-items: center; min-height: 0; overflow: hidden; border-radius: 6px; background: repeating-conic-gradient(#222 0 25%, #2c2c2c 0 50%) 0 0 / 18px 18px; }
.s-frame-preview canvas { display: block; width: min(100%, calc((100dvh - 12rem) * var(--frame-aspect))); height: auto; }
@media (max-width: 600px) {
  .s-frames li { grid-template-columns: 44px minmax(0, 1fr); }
  .s-frame-open { grid-row: 1 / 4; }
  .s-frames li .acts { grid-row: 3; grid-column: 2; flex-wrap: wrap; }
  .s-frames li .acts button { min-width: 44px; min-height: 44px; }
  .s-frame-preview { width: calc(100vw - 16px); max-width: calc(100vw - 16px); padding: 12px; }
}
.s-tracks li { border: 0; border-radius: var(--radius-control); background: var(--surface-2); }
.s-tracks li .acts button { border: 0; border-radius: 6px; }
.s-explainer, .s-tour { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: 0 14px 50px #0005; padding: 17px; }
.s-explainer h3, .s-tour h3 { font-weight: 600; font-size: 16px; }
/* First-use help belongs to the scrolling inspector, clear of art and layer chips. */
.s-tabpanel > .s-explainer { position: static; inset: auto; z-index: auto; width: 100%; min-width: 0; box-shadow: none; }
.s-card .s-preview-note { color: var(--ink); font-size: 10px; padding-bottom: 0; }
.s-hint { border-radius: 7px; padding: 7px 9px; }
.s-menu { border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.s-menu button { border-bottom-color: var(--line-soft); padding: 10px 12px; }
.s-recover { border-color: var(--line); border-radius: 10px; background: var(--surface-2); }
.error { border-radius: 9px; border-left-width: 0; background: #362421; }
@media (max-width: 900px) { .s-panel { margin: 0 10px 10px; } .s-timeline { margin-bottom: 10px; } }
@media (max-width: 1100px) { .s-main { grid-template-columns: minmax(0, 1fr) 350px; } .s-context { padding: 12px 16px; } .s-tabpanel { padding: 16px; } .s-output-scroll, .s-output-footer { padding-left: 16px; padding-right: 16px; } .s-explainer, .s-tour { width: 270px; } }
@media (max-width: 900px) { .s-main { grid-template-columns: minmax(0, 1fr); } .s-view { min-height: 60vh; } .s-panel { min-height: 520px; } .s-timeline { grid-template-columns: auto auto minmax(100px, 1fr); } .s-res, .s-loop, .s-focus { grid-column: auto; } .s-browser-layout { grid-template-columns: 120px minmax(0, 1fr); gap: 10px; } .s-browser-meta > span { display: none; } .s-explainer, .s-tour { left: 16px; bottom: 16px; } }
@media (max-width: 600px) { .s-dialog-head { grid-template-columns: minmax(0, 1fr) auto; } .s-dialog-head input { grid-row: 2; grid-column: 1 / -1; } .s-browser-layout { grid-template-columns: minmax(0, 1fr); } #browser-families { display: none; } .s-import-dialog > .choices { grid-template-columns: 1fr; } .s-top-right .s-btn { font-size: 12px; padding-left: 8px; padding-right: 8px; } .s-context strong { font-size: 16px; } }

/* Layer frame inspection. Decoded media/effect rendering remain unchanged. */
.s-layer .s-layer-select { min-width: 0; border: 0; padding: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.s-layer-frames { min-width: 0; list-style: none; }
.s-layer-frames .s-group { padding: 12px 8px; margin: 0 0 8px; border: 1px solid var(--line); border-radius: var(--radius-control); }
.s-layer-frames h2 { overflow-wrap: anywhere; }
.s-frame-nav { display: flex; align-items: center; gap: 6px; margin: 10px 0; }
.s-frame-nav span { flex: 1; min-width: 0; text-align: center; font-size: 11px; }
.s-frame-nav button { flex-shrink: 0; min-height: 36px; padding: 5px 7px; }
.s-source-frame { display: grid; place-items: center; background: repeating-conic-gradient(#222 0 25%, #2c2c2c 0 50%) 0 0 / 14px 14px; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.s-source-frame canvas { display: block; max-width: 100%; max-height: 220px; width: auto; height: auto; }
.s-video-frames { list-style: none; margin: 8px 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; }
.s-video-frames button { display: grid; gap: 4px; padding: 3px; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 5px; cursor: pointer; font: 10px var(--mono); }
.s-video-frames canvas { width: 56px; height: 44px; object-fit: contain; }
.s-video-frames button[aria-pressed="true"], .s-frames li.is-current { outline: 1px solid var(--accent); outline-offset: -1px; background: var(--selection); }
#video-frame-scrub { width: 100%; }

/* Phone launch candidate: preserve desktop layout and renderer semantics. */
@media (max-width: 600px) and (pointer: coarse) {
  .s-top-right { flex-wrap: wrap; }
  .s-btn, .s-icon, .s-tabs button, .s-frame-nav button, .s-layer-chip,
  .s-layer .acts button, .s-fx-head button, #download, #export-share {
    min-height: 44px; min-width: 44px;
  }
  .s-tabs { height: auto; min-height: 50px; }
  .s-layer { grid-template-columns: auto minmax(0, 1fr); }
  .s-layer .acts { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
  .s-layer .s-layer-select { min-height: 44px; }
  .s-fx-head { flex-wrap: wrap; }
  .s-field input, .s-field select, .s-dialog input[type="number"], .s-dialog input[type="search"] { font-size: 16px; min-height: 44px; }
  .s-view { min-height: clamp(220px, 42dvh, 380px); }
  .s-frame-nav { flex-wrap: wrap; }
  .s-timeline { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) and (pointer: coarse) {
  .s-frames li input, #preview-res, #loop-len { min-height: 44px; font-size: 16px; }
  #scrub { min-height: 44px; }
  .s-check { min-height: 44px; }
}
@media (max-width: 600px) and (pointer: coarse) {
  .s-res, .s-loop, .s-focus { grid-column: 1 / -1; }
}

/* Workspace cues use the existing outline icon language and art-derived accent. */
.s-tabs button { display: flex; align-items: center; justify-content: center; gap: 5px; }
.s-tab-icon { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.s-tabs button[aria-selected="true"] .s-tab-icon { color: var(--accent); }

/* Readable, touch-friendly catalogue. Preview pixels never contain the effect name. */
.s-browser { max-height: calc(100dvh - 32px); }
.s-browser-body { align-content: start; overscroll-behavior: contain; }
.s-browser-grid { align-items: start; }
.s-card { width: 100%; min-width: 0; border: 1px solid var(--line); padding: 8px; gap: 8px; touch-action: manipulation; }
.s-card b { font-size: 15px; line-height: 1.35; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.s-card span { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.s-card .s-preview-note { font-size: 12px; color: var(--ink-2); }
.s-card[data-applied="true"] { border-color: var(--ink-2); background: var(--surface-2); }
.s-card .s-card-applied { color: var(--ink); font-weight: 600; }
.s-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#browser-close, .s-card-del, .s-family-link { min-width: 44px; min-height: 44px; }
.s-card-wrap .s-card b { padding-right: 34px; }
#browser-search { font-size: 16px; min-height: 44px; }
@media (max-width: 600px) {
  .s-browser { width: calc(100vw - 16px); max-width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 12px; box-sizing: border-box; }
  .s-browser .s-dialog-head { gap: 8px; }
  .s-browser .s-dialog-head h2 { font-size: 20px; }
  .s-browser-meta { font-size: 13px; padding: 8px 0; }
  .s-browser-body { padding-right: 2px; gap: 20px; }
  .s-browser-group h3 { font-size: 14px; color: var(--ink-2); }
  .s-browser-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; }
  .s-card { padding: 7px; }
}
@media (max-width: 359px) {
  .s-browser-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Comparison and on/off keys use the existing dark Studio identity. */
.s-view { padding-top: 128px; }
.s-comparison { position: absolute; top: 38px; left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; z-index: 2; font: 12px/1.35 var(--ui); }
.s-comparison > span { flex: 1; min-width: 80px; overflow-wrap: anywhere; color: var(--muted); }
.s-comparison > div { display: flex; gap: 4px; }
.s-comparison button { min-width: 72px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.s-comparison button[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.s-comparison button:disabled { opacity: .45; cursor: default; }
.s-comparison p { width: 100%; margin: 0; color: var(--muted); font-size: 11px; }
.s-enabled-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.s-enabled-row label { min-width: 66px; min-height: 44px; padding: 0 8px; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.s-enabled-row .s-key { width: 44px; height: 44px; min-width: 44px; }
.s-enabled-row .s-muted { flex: 1; min-width: 100px; font-size: 11px; }
.s-enabled-history { display: flex; flex-wrap: wrap; gap: 6px; }
.s-enabled-history button { min-height: 44px; }
.s-strobe-warning { padding:12px; border:1px solid var(--line); border-radius:10px; }
.s-strobe-warning p { margin:0 0 10px; }
.s-strobe-warning .s-check { display:flex; align-items:center; gap:8px; min-height:44px; }
.s-strobe-warning button { min-height:44px; }

/* Isolated post-launch test: effect coverage is separate from frame selection. */
.s-rails { --rail-cue: var(--accent, #f2f3f1); padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius-control, 8px); margin: 12px 0 20px; min-width: 0; display: grid; gap: 8px; }
.s-rails > * { min-width: 0; }
.s-rails .s-row-head, .s-rail-controls, .s-rail-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.s-rails .s-row-head .label { margin-right: auto; }
.s-rails .s-btn { min-height: 32px; padding: 4px 9px; font-size: 12px; white-space: normal; display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-control, 8px); }
.s-rail-ico { flex: none; width: 14px; height: 14px; }
.s-rail-restart { color: var(--ink); }
.s-rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.s-rail-list.is-long { max-height: min(56vh, 520px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-gutter: stable; }
.s-rail-row { border: 1px solid var(--rule); background: var(--surface, transparent); padding: 8px; border-radius: var(--radius-control, 8px); min-width: 0; display: grid; gap: 6px; }
.s-rail-row.is-active { border-color: color-mix(in srgb, var(--rail-cue) 14%, var(--rule)); background: var(--selection, var(--surface-2)); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--rail-cue) 45%, transparent); }
.s-rail-head { justify-content: space-between; }
.s-rail-name { flex: 1 1 auto; min-width: 0; text-align: left; justify-content: flex-start; font-weight: 600; border-color: transparent; padding-left: 2px; overflow: hidden; }
.s-rail-name:hover { border-color: var(--rule); }
.s-rail-order { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.s-rail-order > .s-btn { min-height: 30px; padding: 3px 7px; font-size: 11px; }
.s-effect-drag-handle { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 28px; padding: 3px 6px; border: 1px solid var(--rule); border-radius: var(--radius-control, 6px); color: var(--ink-2); background: transparent; font: 11px var(--ui); white-space: nowrap; cursor: grab; user-select: none; }
.s-effect-drag-handle:active { cursor: grabbing; }
.s-rail-row.is-drop-before { box-shadow: inset 0 2px 0 var(--accent, currentColor); }
.s-rail-row.is-drop-after { box-shadow: inset 0 -2px 0 var(--accent, currentColor); }
.s-rail-row.is-dragging { opacity: .48; }
.s-rail-row.is-active .s-rail-name { color: var(--ink); }
.s-rail-scope { display: inline-flex; align-items: center; gap: 5px; font: 500 11px var(--mono); letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.s-rail-row:not(.is-selected-scope) .s-rail-scope { color: var(--ink-2); }
.s-rail-tags { flex: 1 0 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.s-rail-tag { display: inline-flex; align-items: center; gap: 4px; font: 11px var(--mono); color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; }
.s-rail-flag { color: var(--ink); border-style: dashed; }
.s-rail-shown { color: var(--ink); border-color: var(--ink-2); }
.s-rail-controls .s-btn { flex: 0 1 auto; }
.s-rail-policy { display: flex; gap: 6px; align-items: flex-start; font-size: 11px; line-height: 1.4; }
.s-rail-policy .s-rail-ico { margin-top: 2px; }
.s-rail-row.is-bypassed .s-rail-coverage { opacity: .4; }
.s-rail-coverage { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 3px; }
.s-rail-coverage span { flex: 1 0 18px; min-width: 0; background: var(--surface-2, #22252a); color: var(--ink-2); text-align: center; font: 10px var(--mono); border-radius: 3px; padding: 3px 2px; white-space: nowrap; }
.s-rail-coverage .is-covered { background: color-mix(in srgb, var(--rail-cue) 11%, var(--surface-2, #22252a)); color: var(--ink); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--rail-cue) 50%, transparent); }
.s-rail-coverage .is-covered::before { content: "\2713\00a0"; }
/* Many frames: a compact map. Labels stay in the page for assistive tech and tooltips; covered cells are filled, others hollow and dashed. */
.s-rail-coverage.is-dense { flex-wrap: wrap; overflow: visible; }
.s-rail-coverage.is-dense span { flex: 0 0 9px; height: 12px; padding: 0; font-size: 0; line-height: 0; overflow: hidden; border: 1px dashed var(--ink-2); background: transparent; box-shadow: none; }
.s-rail-coverage.is-dense .is-covered { border: 1px solid color-mix(in srgb, var(--rail-cue) 65%, var(--ink-2)); background: color-mix(in srgb, var(--rail-cue) 40%, var(--surface-2, #22252a)); }
.s-rail-coverage.is-dense .is-covered::before { content: none; }
.s-rail-count { margin-bottom: -2px; }
.s-rail-frames { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.s-rail-frames > div { flex: 0 0 94px; }
.s-rail-frame { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 122px; padding: 8px 4px; border: 1px solid var(--rule); background: var(--surface-2, #22252a); border-radius: var(--radius-control, 8px); font-size: 11px; cursor: pointer; }
.s-rail-frame.is-covered { border-color: color-mix(in srgb, var(--rail-cue) 30%, var(--rule)); background: color-mix(in srgb, var(--rail-cue) 8%, var(--surface-2, #22252a)); }
.s-rail-frame.is-selected { outline: 2px solid var(--ink); outline-offset: -4px; }
.s-rail-frame input { width: 22px; height: 22px; accent-color: var(--signal); }
.s-rail-frame small { color: var(--ink-2); }
.s-rail-frame .s-rail-covered-tag { color: var(--ink); font-family: var(--mono); }
.s-rail-frame + button { width: 100%; margin-top: 4px; justify-content: center; }
@media (max-width: 600px) { .s-rails { padding: 8px; } .s-rail-row { padding: 6px; } .s-rails .s-btn { min-height: 40px; } .s-rail-controls > .s-btn { flex: 1 1 auto; justify-content: center; } .s-rail-list.is-long { max-height: min(62vh, 560px); } }
/* Timeline keyframe button and menu; header Export. Same tokens as the rest of the Studio. */
.s-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.s-playhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.s-add-key { white-space: nowrap; background: var(--surface-2, var(--raise)); }
.s-add-key[data-empty="true"] { color: var(--muted, var(--ink-2)); }
.s-add-key:disabled { opacity: .45; cursor: not-allowed; }
.s-key-menu { position: fixed; z-index: 40; min-width: 240px; max-width: min(360px, calc(100vw - 16px)); max-height: min(420px, 60vh); overflow: auto; box-shadow: 0 12px 32px rgb(0 0 0 / .45); }
.s-key-menu button:disabled { opacity: .5; cursor: not-allowed; }
.s-top .s-export-open { padding-left: 16px; padding-right: 16px; }
@media (max-width: 600px) { .s-add-key { min-height: 40px; padding-left: 8px; padding-right: 8px; } .s-top .s-export-open { min-height: 36px; } }
/* Clip sections: joins on the timeline and the Clip group in Layers. */
.s-cuts { position: absolute; left: 8px; right: 8px; bottom: 0; height: 8px; pointer-events: none; }
.s-cuts button { position: absolute; bottom: 0; width: 2px; min-width: 2px; height: 8px; transform: translateX(-1px); background: var(--ink-2, var(--muted)); border: 0; padding: 0; cursor: pointer; pointer-events: auto; }
.s-cuts button.has-transition { transform: translateX(-50%); min-width: 4px; background: color-mix(in srgb, var(--signal) 55%, transparent); border-radius: 2px; }
.s-clip { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft, var(--rule)); }
.s-clip .s-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.s-clip-history, .s-clip-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.s-clip [hidden] { display: none; }
.s-clip button:disabled, .s-clip select:disabled, .s-clip input:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 600px) { .s-clip-actions .s-btn { flex: 1 1 auto; min-height: 40px; } }

/* ---------------------------------------------------------------------------------------------
   Workspace redesign, first slice. One outline icon set, an honest scope banner, a stack header
   that stays reachable, and Save project versus Export spelled out. Only presentation changes:
   ids, events, state and the renderer are untouched. Source pixels are never styled. */
:root { --target: 44px; --stack-offset: 150px; }
/* Icon masks: <i class="s-ico s-i-NAME"> in markup, or an automatic ::before on script-built controls. */
.s-ico, .s-icn::before { content: ""; display: inline-block; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.s-i-play { --ico: var(--i-play); } .s-i-pause { --ico: var(--i-pause); } .s-i-split { --ico: var(--i-split); } .s-i-key { --ico: var(--i-key); }
.s-i-up { --ico: var(--i-up); } .s-i-down { --ico: var(--i-down); } .s-i-next { --ico: var(--i-next); } .s-i-prev { --ico: var(--i-prev); }
.s-i-close { --ico: var(--i-close); } .s-i-copy { --ico: var(--i-copy); } .s-i-settings { --ico: var(--i-settings); } .s-i-check { --ico: var(--i-check); }
.s-i-record { --ico: var(--i-record); } .s-i-eye { --ico: var(--i-eye); } .s-i-frames { --ico: var(--i-frames); } .s-i-wave { --ico: var(--i-wave); }
.s-i-open { --ico: var(--i-open); } .s-i-save { --ico: var(--i-save); } .s-i-export { --ico: var(--i-export); } .s-i-plus { --ico: var(--i-plus); }
.s-i-share { --ico: var(--i-share); } .s-i-enter { --ico: var(--i-enter); } .s-i-layer { --ico: var(--i-layer); } .s-i-composition { --ico: var(--i-composition); }
/* Controls built by script get their icon from what they do, so no glyph characters live in the page. */
.s-layer .acts button, .s-fx-head > button:not(.s-fx-disclosure), .s-param-row .s-key, .s-param-row .s-mod, .s-enabled-row .s-key,
.s-frames li .acts [data-frame-act], .s-card-del, #play, #seed-go, #add-key, #rec-btn, .s-i-close.s-icon { display: inline-flex; align-items: center; justify-content: center; }
.s-layer .acts button::before, .s-fx-head > button:not(.s-fx-disclosure)::before, .s-param-row .s-key::before, .s-param-row .s-mod::before, .s-enabled-row .s-key::before,
.s-frames li .acts [data-frame-act="left"]::before, .s-frames li .acts [data-frame-act="right"]::before, .s-frames li .acts [data-frame-act="remove"]::before,
.s-card-del::before, #play::before, #seed-go::before, #add-key::before, #rec-btn::before, .s-i-close::before, .s-fx-chevron::before, .s-card-applied::before, #context-kicker::before {
  content: ""; display: inline-block; width: 15px; height: 15px; flex: none; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
[data-act="up"] { --ico: var(--i-up); } [data-act="down"] { --ico: var(--i-down); } [data-act="dupe"] { --ico: var(--i-copy); } [data-act="remove"] { --ico: var(--i-close); }
[data-act="frames"] { --ico: var(--i-frames); } [data-act="eye"] { --ico: var(--i-eye); } .hidden-layer [data-act="eye"] { --ico: var(--i-eyeOff); }
[data-act="key"], [data-act="enabled-key"] { --ico: var(--i-key); } [data-act="key"].on::before, [data-act="enabled-key"].on::before { -webkit-mask-image: var(--i-keyOn); mask-image: var(--i-keyOn); background: currentColor; }
[data-act="mod"] { --ico: var(--i-wave); }
[data-frame-act="left"] { --ico: var(--i-prev); } [data-frame-act="right"] { --ico: var(--i-next); } [data-frame-act="remove"] { --ico: var(--i-close); }
.s-card-del { --ico: var(--i-close); } #play { --ico: var(--i-play); } #play[aria-label="Pause"] { --ico: var(--i-pause); }
#seed-go { --ico: var(--i-enter); } #add-key { --ico: var(--i-key); gap: 7px; } #rec-btn { --ico: var(--i-record); gap: 7px; }
.s-fx-chevron { --ico: var(--i-down); display: inline-grid; } .s-fx-disclosure[aria-expanded="false"] .s-fx-chevron { --ico: var(--i-next); }
.s-fx-chevron::before { width: 12px; height: 12px; }
.s-card-applied::before { --ico: var(--i-check); width: 13px; height: 13px; }
#context-kicker[data-scope="layer"] { --ico: var(--i-layer); } #context-kicker[data-scope="composition"] { --ico: var(--i-composition); } #context-kicker[data-scope="none"]::before { content: none; }
.s-act { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.s-ext { font: 500 10px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }

/* Header: the next action is the filled one. Empty workspace asks for media; a loaded one asks for Export. */
body[data-workspace="empty"] #add-media { background: var(--accent); color: var(--on-accent); }
body[data-workspace="empty"] #add-media:hover { background: var(--ink); }
body[data-workspace="empty"] #export-open { background: var(--surface-2); color: var(--ink); }
body[data-workspace="empty"] #export-open:hover { background: var(--surface-hover); }
#save-status:empty { display: none; }
.s-drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.s-drop-actions .s-btn, .s-drop-actions .primary { min-height: 40px; padding: 8px 16px; }
.s-drop-note { font-size: 12px; margin: 4px 0 0; }

/* Scope banner: says whether edits apply to one layer or the whole composition, in words and an icon. */
.s-context { border-left: 2px solid transparent; }
.s-context:has(#context-kicker[data-scope="layer"]) { border-left-color: var(--accent); }
#context-kicker { display: inline-flex; align-items: center; gap: 6px; }
#context-kicker[data-scope="layer"]::before { color: var(--accent); }
.s-context > span { color: var(--ink-2); }

/* Effects: the header names the target and stays in reach; the newest effect carries a text tag. */
#tab-effects { padding-top: 0; }
.s-stack-bar { position: sticky; top: 0; z-index: 3; margin: 0 -18px 8px; padding: 14px 18px 10px; background: var(--surface); border-bottom: 1px solid var(--line-soft); display: grid; gap: 6px; }
.s-stack-bar .s-stack-heading { margin: 0; }
.s-stack-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.s-stack-title h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink); }
.s-stack-count { flex: none; font: 500 11px/1.3 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.s-stack-bar .s-add-effect { flex: none; max-width: none; background: var(--surface-2); }
.s-stack-bar #fx-layer { font-size: 11px; line-height: 1.45; }
.s-stack-added { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink); }
.s-stack-added:empty { display: none; }
.s-link { background: none; border: 0; padding: 0 2px; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.s-link:hover { color: var(--accent); }
.s-fx-card { scroll-margin-top: var(--stack-offset); scroll-margin-bottom: 24px; }
.s-fx-card.is-new { margin-left: -10px; padding-left: 10px; box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 var(--radius-control) var(--radius-control) 0; }
.s-fx-new { flex: none; font: 600 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: 4px; padding: 3px 6px; margin-right: 2px; }
.s-card-applied { display: inline-flex; align-items: center; gap: 5px; }
/* A covered frame is marked with a check drawn in CSS, so colour is never the only cue. */
.s-rail-coverage .is-covered::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 3px; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat; }
.s-rail-coverage.is-dense .is-covered::before { content: none; }

/* Output: what Export makes, and what Save project makes, side by side in words. */
.s-output-intro { display: grid; gap: 5px; padding: 2px 0 14px; border-bottom: 1px solid var(--line-soft); }
.s-output-intro p { margin: 0; font-size: 13px; line-height: 1.5; }
.s-output-intro .s-muted { font-size: 12px; }
.s-output-intro .mono { color: var(--ink); }
.s-export-ready { border-radius: var(--radius-control); background: var(--surface-2); padding: 12px; margin-bottom: 6px; border-bottom: 0; }
.s-export-ready .s-act { min-height: 40px; }
.s-export-ready #export-save-note { font-size: 11px; line-height: 1.5; }
.s-tl-export { display: none; }

/* Mobile: one anchored preview above a scrolling inspector, one transport below it. */
@media (max-width: 900px) {
  :root { --preview-h: 42dvh; --stack-offset: 0px; } /* html scroll-padding below already clears the sticky preview */
  .studio-body { display: block; height: auto; }
  .s-main { display: block; }
  .s-top { padding: 10px 12px 8px; gap: 6px 10px; align-items: center; }
  .s-top-right { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) var(--target); gap: 6px; align-items: stretch; }
  .s-top-right .s-act { flex-direction: column; gap: 3px; min-height: 52px; padding: 6px 2px; font-size: 11px; font-weight: 600; white-space: normal; text-align: center; }
  .s-top-right .s-ext, .s-top .s-long { display: none; }
  .s-top-right #settings-btn { min-width: var(--target); min-height: 52px; }
  .s-top-right #save-status { grid-column: 1 / -1; order: 9; max-width: none; text-align: left; font-size: 12px; }
  .s-top-right .local { display: none; }
  .s-view { position: sticky; top: 0; z-index: 6; height: var(--preview-h); min-height: 0; padding: 48px 8px 52px; border-bottom: 1px solid var(--line-soft); }
  .s-viewbar { height: 44px; min-height: 0; padding: 0 8px; }
  .s-view-title { display: none; }
  .s-comparison { top: 0; left: auto; right: 8px; height: 44px; flex-wrap: nowrap; gap: 6px; }
  .s-comparison button { min-width: 64px; min-height: var(--target); padding: 6px 10px; }
  #compare-scope, #compare-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .s-drop { inset: 48px 8px 8px; }
  .s-layer-strip { height: 52px; }
  .s-layer-chip { min-height: var(--target); }
  .s-panel { margin: 0; border-radius: 0; min-height: 0; overflow: visible; }
  .s-tabpanel, #tab-output { overflow: visible; }
  #tab-output { padding: 0; }
  .s-output-scroll { overflow: visible; }
  .s-output-footer { position: static; }
  .s-tabs { position: static; height: auto; min-height: 50px; }
  .s-tabs button { min-height: var(--target); }
  .s-stack-bar { position: static; margin: 0 -16px 8px; padding: 12px 16px 8px; }
  .s-timeline { position: sticky; bottom: 0; z-index: 6; margin: 0; border-radius: 14px 14px 0 0; border-top: 1px solid var(--line); gap: 6px 8px; padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    grid-template-columns: auto auto minmax(40px, 1fr) auto; grid-template-areas: "play time scrub scrub" "split key key export" "res res loop loop" "focus focus focus focus"; align-items: center; }
  .s-timeline .s-playhead { display: contents; }
  .s-timeline #play { grid-area: play; min-width: var(--target); min-height: var(--target); }
  .s-timeline #time { grid-area: time; min-width: 0; }
  .s-timeline .s-scrub { grid-area: scrub; }
  .s-timeline #split-clip { grid-area: split; min-height: var(--target); min-width: var(--target); }
  .s-timeline #add-key { grid-area: key; min-height: var(--target); }
  .s-timeline .s-tl-export { display: inline-flex; grid-area: export; justify-self: end; min-height: var(--target); }
  .s-timeline .s-res { grid-area: res; display: flex; align-items: center; gap: 6px; }
  .s-timeline .s-loop { grid-area: loop; display: flex; align-items: center; gap: 6px; }
  .s-timeline .s-focus { grid-area: focus; max-width: none; }
  .s-timeline .s-res select, .s-timeline .s-loop input { min-height: var(--target); }
  .s-timeline .s-res select { width: 72px; padding-left: 6px; padding-right: 2px; }
  .s-timeline .s-loop input { width: 72px; }
    .s-explainer, .s-tour { bottom: 120px; }
}
@media (max-width: 900px) {
  .s-timeline .s-playhead #split-clip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.s-save-status { max-width: 34ch; }
/* The helper line under the stack title stays for assistive technology; the live note says the same in context. */
.s-stack-bar #fx-layer { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.s-stack-bar { gap: 4px; }
.s-export-status { margin: 0; padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-2); font-size: 12px; line-height: 1.5; }
.s-export-status[hidden] { display: none; }
/* Sticky preview and transport must not cover what scrolls into view: anchors, focus and Show-it. */
@media (max-width: 900px) {
  :root { --transport-h: 176px; }
  html { scroll-padding-top: calc(var(--preview-h) + 8px); scroll-padding-bottom: calc(var(--transport-h) + 8px); }
}
/* Touch: every control inside an effect meets 44px on phones. */
@media (max-width: 900px) {
  .s-key, .s-mod, .s-lock { min-width: var(--target); min-height: var(--target); width: var(--target); height: var(--target); }
  .s-param-row:has(> input[type="range"]) { grid-template-columns: minmax(0, 1fr) repeat(3, var(--target)); gap: 2px; }
  .s-param-row > input[type="number"] { min-height: var(--target); font-size: 16px; }
  .s-link { display: inline-flex; align-items: center; min-height: var(--target); padding: 0 8px; }
  .s-stack-added { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
}

/* Review correction: editing needs more room than the first slice's 42dvh preview.
   Collapsing is local presentation only; no canvas or layer state is removed. */
.s-preview-toggle { display: none; }
@media (max-width: 900px) {
  :root { --preview-h: clamp(200px, 28dvh, 240px); }
  .s-preview-toggle { display: inline-flex; min-height: 44px; align-items: center; padding: 6px 10px; }
  .s-viewbar { z-index: 3; right: auto; }
  .s-viewbar .s-comp { position: absolute; top: 46px; left: 8px; white-space: nowrap; font-size: 10px; }
  .s-view { padding-top: 66px; }
  body[data-workspace="empty"] .s-view { height: max(300px, var(--preview-h)); position: relative; }
  body[data-workspace="empty"] .s-preview-toggle { display: none; }
  body.preview-collapsed[data-workspace="loaded"] { --preview-h: 44px; }
  body.preview-collapsed[data-workspace="loaded"] .s-view { padding: 0; }
  body.preview-collapsed[data-workspace="loaded"] .s-view > canvas,
  body.preview-collapsed[data-workspace="loaded"] .s-layer-strip,
  body.preview-collapsed[data-workspace="loaded"] .s-comp { visibility: hidden; pointer-events: none; }
  body.preview-collapsed[data-workspace="loaded"] .s-layer-strip { display: none; }
  /* Text entry can scroll the preview away. Keep actions stable through blur/tap. */
  body:is(:has(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus, textarea:focus), .text-entry-held) .s-view { position: relative; }
  html:is(:has(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus, textarea:focus), :has(body.text-entry-held)) { scroll-padding-top: 8px; }
}
/* Grid items must shrink at 320px instead of widening the visual viewport. */
.s-stack-bar > * { min-width: 0; }
.s-stack-title { flex: 1; }
@media (max-width: 900px) {
  /* Four touch actions must not squeeze the effect name into single letters. */
  .s-fx-head { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)) auto; }
  .s-fx-head .s-fx-disclosure { grid-column: 1 / 5; grid-row: 1; }
  .s-fx-head .s-fx-new { grid-column: 5; grid-row: 1; }
  .s-fx-head > [data-act="up"] { grid-column: 1; grid-row: 2; }
  .s-fx-head > [data-act="down"] { grid-column: 2; grid-row: 2; }
  .s-fx-head > [data-act="dupe"] { grid-column: 3; grid-row: 2; }
  .s-fx-head > [data-act="remove"] { grid-column: 4; grid-row: 2; }
}
@media (max-width: 900px) {
  .s-top .s-long { display: inline; }
  .s-top-right .s-act { min-height: 60px; }
  body.preview-collapsed[data-workspace="loaded"] .s-comparison { display: none; }
}

/* Playback belongs with the artwork, using the original controls and event contracts. */
.s-preview-playback { position: absolute; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: 44px auto minmax(60px, 1fr); gap: 10px; align-items: center; height: 56px; padding: 6px 14px; background: var(--surface); }
.s-preview-playback #play { min-width: 44px; min-height: 44px; border: 0; }
.s-preview-playback .s-scrub { min-width: 0; height: 44px; }
.s-view { padding-bottom: 116px; }
.s-layer-strip { bottom: 56px; }
.s-timeline { grid-template-columns: minmax(0, 1fr) auto auto; }
@media (max-width: 900px) {
  :root { --preview-h: clamp(240px, 32dvh, 270px); --transport-h: 117px; }
  .s-view { padding-bottom: 108px; }
  .s-timeline { grid-template-columns: auto minmax(40px, 1fr) auto; grid-template-areas: "split key export" "res loop loop" "focus focus focus"; }
  .s-preview-playback { padding: 6px 8px; gap: 8px; }
  :root:has(body.preview-collapsed[data-workspace="loaded"]), body.preview-collapsed[data-workspace="loaded"] { --preview-h: 100px; }
  body.preview-collapsed[data-workspace="loaded"] .s-view { padding-bottom: 56px; }
}

@media (max-width: 900px) {
  .s-timeline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "actions actions" "res loop" "focus focus"; }
  .s-timeline .s-playhead { display: flex; grid-area: actions; gap: 8px; min-width: 0; }
  .s-timeline #split-clip { flex: 0 0 44px; padding: 4px; }
  .s-timeline #add-key { flex: 1; min-width: 0; white-space: normal; font-size: 12px; padding: 4px; }
  .s-timeline .s-tl-export { flex: none; font-size: 13px; padding: 8px; }
  .s-timeline .s-res, .s-timeline .s-loop { min-width: 0; font-size: 12px; }
}

/* Review follow-up: budget for the artwork itself, not just the outer preview.
   Header/metadata + layer chips + playback currently reserve 174px. */
@media (max-width: 900px) and (min-height: 601px) {
  :root { --preview-h: clamp(320px, 42dvh, 360px); }
}
/* A short landscape viewport cannot stack preview, editor and two action rows.
   Keep the preview beside the scrolling inspector and use one action row. */
@media (min-width: 600px) and (max-width: 900px) and (max-height: 600px) {
  :root { --preview-h: calc(100dvh - 85px); --transport-h: 85px; }
  .s-main { display: grid; grid-template-columns: minmax(280px, 42%) minmax(0, 1fr); align-items: start; }
  .s-view { align-self: start; }
  .s-panel { min-width: 0; }
  .s-timeline { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "actions res loop" "focus focus focus"; }
  .s-timeline .s-playhead { min-width: 0; }
  html { scroll-padding-top: 8px; }
}
/* Short landscape uses a contained inspector, so the header cannot push playback
   beneath the action bar and keyboard scrolling stays within the editing column. */
@media (min-width: 600px) and (max-width: 900px) and (max-height: 600px) {
  .studio-body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; overflow: hidden; }
  .s-top { flex-wrap: nowrap; padding: 4px 8px; gap: 8px; }
  .s-top > .label { display: none; }
  .s-top-right { width: auto; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)) 44px; }
  .s-top-right .s-act, .s-top-right #settings-btn { min-height: 44px; flex-direction: row; font-size: 11px; padding: 4px; }
  .s-top-right .s-act .s-ico { display: none; }
  .s-top-right #save-status:empty { display: none; }
  .s-main { min-height: 0; }
  .s-view { position: relative; height: 100%; padding-top: 44px; padding-bottom: 100px; }
  .s-viewbar .s-comp { display: none; }
  .s-layer-strip { height: 44px; padding: 0 8px; }
  .s-panel { height: 100%; overflow: hidden; }
  .s-tabpanel, #tab-output { overflow-y: auto; }
  .s-output-scroll { overflow-y: auto; }
  .s-timeline { position: relative; padding: 4px 8px; }
  .s-context { padding: 6px 12px; }
  .s-context #context-detail { display: none; }
  html { scroll-padding: 0; }
  .s-tabpanel, .s-output-scroll { scroll-padding: 8px; }
}

.s-hint { max-width: min(260px, calc(100vw - 16px)); }
@media (min-width: 600px) and (max-width: 900px) and (max-height: 600px) {
  .studio-body { position: fixed; inset: 0; width: 100%; }
  .s-view { padding-bottom: 88px; }
  .s-preview-playback { height: 44px; padding: 0 8px; }
  .s-layer-strip { bottom: 44px; }
  .s-timeline { row-gap: 0; }
}
@media (min-width: 600px) and (max-width: 900px) and (max-height: 600px) {
  body.preview-collapsed .s-main { grid-template-columns: 240px minmax(0, 1fr); }
  body.preview-collapsed .s-view { height: 100px; }
}
/* Very narrow zoom/reflow: keep only playback pinned; the artwork and editing
   actions participate in ordinary document scrolling instead of squeezing it out. */
@media (max-width: 279px) {
  html { scroll-padding: 96px 8px 8px; }
  .studio-body { padding-top: 88px; }
  .s-top-right { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s-top-right #settings-btn { grid-column: 1 / -1; }
  .s-view { position: relative; height: 360px; padding-top: 110px; padding-bottom: 52px; }
  .s-viewbar { right: 0; }
  .s-viewbar .s-comp { top: 88px; max-width: calc(100vw - 16px); overflow: hidden; }
  .s-comparison { top: 44px; left: 8px; right: 8px; }
  .s-preview-playback { position: fixed; top: 0; bottom: auto; height: 88px; z-index: 7; grid-template-columns: 44px minmax(0, 1fr); gap: 0 8px; padding: 0 8px; }
  .s-preview-playback .s-scrub { grid-column: 1 / -1; }
  .s-layer-strip { bottom: 0; }
  .s-panel { display: block; }
  .s-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; }
  .s-timeline { position: static; grid-template-columns: minmax(0, 1fr); grid-template-areas: "actions" "res" "loop" "focus"; }
  .s-timeline .s-playhead { flex-wrap: wrap; }
  .s-timeline .s-tl-export { width: 100%; }
  .s-row2, .s-row3 { grid-template-columns: minmax(0, 1fr); }
  .s-fx-head { grid-template-columns: repeat(2, minmax(44px, 1fr)); }
  .s-fx-head .s-fx-disclosure { grid-column: 1 / -1; }
  .s-fx-head .s-fx-new, .s-fx-head > [data-act] { grid-column: auto; grid-row: auto; }
  .s-fx-body, .s-tabpanel { padding-left: 8px; padding-right: 8px; }
  .s-stack-bar { margin: 0; padding: 8px 0; grid-template-columns: minmax(0, 1fr); }
  .s-stack-title, #add-effect, .s-stack-added { grid-column: 1 / -1; }
  .s-key-menu { min-width: 0; }
  .s-dialog { max-width: calc(100vw - 16px); padding: 12px; max-height: calc(100dvh - 16px); overflow: auto; }
  .s-dialog[open]:not(.s-browser) { display: block; }
  .s-dialog[open]:not(.s-browser) > * + * { margin-top: 12px; }
  .s-dialog button { white-space: normal; overflow-wrap: anywhere; }
  .s-browser .s-dialog-head { grid-template-columns: minmax(0, 1fr); }
  .s-browser .s-dialog-head input { grid-row: auto; }
  .s-browser-grid { grid-template-columns: minmax(0, 1fr); }
  .s-enabled-row { flex-wrap: wrap; }
  .s-field, .s-rail-head, .s-rail-controls { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 279px) {
  html:is(:has(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus, textarea:focus), :has(body.text-entry-held)) { scroll-padding-top: 96px; }
}

/* Ordinary effect editing comes first; frame coverage remains one clear action away. */
.s-rails-disclosure { min-width: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.s-rails-disclosure > summary { min-height: 44px; box-sizing: border-box; padding: 12px 10px; font-size: 14px; line-height: 20px; cursor: pointer; }
.s-rails-disclosure > summary:hover { background: var(--surface-2); }
.s-rails-disclosure > summary::marker { color: var(--muted); }
#rails-state { margin-left: 8px; color: var(--muted); font: 11px var(--mono); }
.s-rails-disclosure .s-rails { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 900px) { .s-rails-disclosure .s-btn { min-height: 44px; min-width: 44px; } }

/* Output owns job actions; editing controls return with the editing tabs. */
.output-mode .s-timeline, .output-mode #keys, .output-mode #cuts { display: none; }
body.exporting .s-output-footer { position: sticky; bottom: 0; z-index: 25; border-top: 1px solid var(--line); }
body.exporting #out-summary { display: none; }
body.exporting #return-edit { display: none; }
.s-result-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.s-result-actions > *, #export-actions > * { min-width: 0; }
.s-output-footer #return-edit { margin-top: 0; }

/* Export dimensions reserve layout before GIF/video metadata arrives. */
.out img, .out video { height: auto; }

/* One transient catalogue still; no animated hover playback, even with reduced motion. */
.s-browser-layout { grid-template-columns: 130px minmax(0, 1fr) 300px; }
.s-effect-audition { min-width: 0; align-self: start; display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-thumb); background: var(--surface-2); }
.s-effect-audition p { margin: 0; font-size: 12px; line-height: 1.5; }
.s-effect-audition strong { font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.s-effect-audition canvas { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: contain; background: #090a0b; border-radius: 6px; }
.s-card[data-previewing="true"] { border-color: var(--studio-signal); }
@media (max-width: 900px) {
  .s-browser-layout { grid-template-columns: 110px minmax(0, 1fr) 240px; }
}
@media (max-width: 700px) {
  .s-browser-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #browser-families { display: none; }
  .s-effect-audition { grid-row: 1; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; padding: 10px; }
  .s-effect-audition canvas { grid-column: 1; grid-row: 1 / 5; align-self: center; }
  .s-effect-audition > :not(canvas) { grid-column: 2; }
  .s-effect-audition strong { font-size: 14px; }
  #browser-preview-help { display: none; }
}

/* Particle controls retain native fields and keep advanced depth grouped. */
.s-particle-actions{display:flex;flex-wrap:wrap;gap:6px}.s-particle-group{border-top:1px solid var(--line,#333);padding-top:10px;margin-top:12px}.s-particle-group h4,.s-particle-group summary{font-size:12px;font-weight:600;margin:0 0 10px}.s-particle-group summary{cursor:pointer;padding:8px 0}.s-particle-value-reset{font-size:11px;padding:4px 6px;flex:0 0 auto}.s-particle-group .s-param-row>input[type=range],.s-particle-group .s-param-row>select{min-width:0;flex:1}.s-particle-group[hidden],.s-particle-group .s-param[hidden]{display:none!important}
