/* studio/studio.css — Cognita Studio. Uses the shared design tokens from css/shared.css. */
#view-studio { overflow: hidden; }
#studioRoot { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.st-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-muted { color: var(--text-muted, #8c8c86); font-size: var(--text-sm); }
.st-small { font-size: var(--text-xs); line-height: 1.5; }
.st-warn { display: flex; gap: 6px; align-items: flex-start; color: var(--warning); background: var(--warning-subtle); padding: 8px 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); margin: 8px 0; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: inherit; border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; text-decoration: none; }
.st-btn:hover:not(:disabled) { background: var(--bg-subtle); }
.st-btn:disabled, .st-icon:disabled { opacity: .45; cursor: not-allowed; }
.st-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.st-btn--ghost { border-color: transparent; background: transparent; }
.st-btn--danger { color: var(--danger); }
.st-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 0; background: transparent; color: inherit; border-radius: var(--radius-md); cursor: pointer; font-size: 18px; }
.st-icon:hover:not(:disabled) { background: var(--bg-subtle); }
.st-btn:focus-visible, .st-icon:focus-visible, .st-mode:focus-visible, .st-block:focus-visible, .st-scene-main:focus-visible, .st-tab:focus-visible, .st-mnav button:focus-visible, .st-card-main:focus-visible, .st-chip:focus-visible, .st-imgbtn:focus-visible,
.st-field input:focus-visible, .st-field select:focus-visible, .st-field textarea:focus-visible, .st-prompt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: var(--text-sm); cursor: pointer; text-decoration: underline; }
.st-link:disabled { opacity: .45; cursor: default; text-decoration: none; }

/* Home */
.st-home { flex: 1; overflow-y: auto; padding: var(--space-6, 24px) var(--space-5, 20px) 80px; }
.st-home-inner { max-width: 880px; margin: 0 auto; }
.st-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 1.4rem + 2vw, 2.7rem); letter-spacing: -0.02em; margin: 24px 0 6px; }
.st-sub { color: var(--text-secondary, #6f6f6a); margin: 0 0 24px; max-width: 56ch; line-height: 1.55; }
.st-compose { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 14px; background: var(--bg-elevated); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.st-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.st-mode { display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; min-height: 36px; border-radius: var(--radius-full); border: 1px solid var(--border); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); cursor: pointer; }
.st-mode.is-on { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent-hover); }
.st-mode:disabled { opacity: .5; cursor: not-allowed; }
.st-soon { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; color: var(--text-muted, #8c8c86); }
.st-prompt, .st-source { width: 100%; border: 0; resize: vertical; font: inherit; font-size: var(--text-md); background: transparent; color: inherit; padding: 6px 2px; line-height: 1.5; box-sizing: border-box; }
.st-prompt { outline: none; min-height: 84px; }
.st-source { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; font-size: var(--text-sm); }
.st-lbl { font-size: var(--text-sm); color: var(--text-secondary, #6f6f6a); }
.st-compose-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.st-more summary { gap: 6px; list-style: none; cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary, #6f6f6a); min-height: 38px; display: flex; align-items: center; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.st-grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-secondary, #6f6f6a); }
.st-compose select, .st-field select, .st-field input:not([type=range]):not([type=color]), .st-field textarea, .st-ask textarea { font: inherit; font-size: var(--text-sm); padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: inherit; min-height: 38px; box-sizing: border-box; width: 100%; }
.st-note { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-md); background: var(--bg-subtle); font-size: var(--text-sm); margin: 4px 0; }
.st-note p { margin: 2px 0 0; } .st-note span { color: var(--text-muted, #8c8c86); font-size: var(--text-xs); }
.st-note--err { background: var(--danger-subtle); color: var(--danger); }
.st-note i { font-size: 20px; flex: none; }
.st-imgrow { display: flex; flex-wrap: wrap; gap: 8px; }
.st-pimg { position: relative; width: 72px; height: 72px; } .st-pimg img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.st-pimg button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-elevated); cursor: pointer; display: grid; place-items: center; }
.st-add { width: 72px; height: 72px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; cursor: pointer; color: var(--text-secondary, #6f6f6a); }
.st-add--sm { width: 56px; height: 56px; }
.st-h { font-size: var(--text-md); font-weight: var(--weight-semibold); margin: 36px 0 12px; display: flex; gap: 10px; align-items: baseline; }
.st-empty { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px; text-align: center; color: var(--text-secondary, #6f6f6a); } .st-empty i { font-size: 28px; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.st-card { position: relative; } .st-card-main { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; width: 100%; cursor: pointer; }
.st-thumb { display: grid; place-items: center; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; max-height: 220px; } .st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-card-t { font-weight: var(--weight-medium); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-badge { align-self: flex-start; font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full); background: var(--bg-subtle); color: var(--text-secondary, #6f6f6a); }
.st-card-act { position: absolute; top: 4px; right: 4px; display: flex; opacity: 0; } .st-card:hover .st-card-act, .st-card:focus-within .st-card-act { opacity: 1; }
.st-card-act .st-icon { background: var(--bg-elevated); width: 32px; height: 32px; margin-left: 4px; box-shadow: var(--shadow-sm); }
@media (hover: none) { .st-card-act { opacity: 1; } }
.st-steps { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 14px; }
.st-steps li { display: flex; align-items: center; gap: 12px; color: var(--text-muted, #8c8c86); } .st-steps li.is-now { color: inherit; font-weight: var(--weight-medium); } .st-steps li.is-done { color: var(--success); }
.st-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: 12px; }
.is-now .st-dot { border-right-color: transparent; animation: stspin .9s linear infinite; }
@keyframes stspin { to { transform: rotate(360deg); } }

/* Editor shell */
.st-app { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-base, var(--bg-elevated)); }
.st-top { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.st-name { flex: 1; min-width: 0; font: inherit; font-weight: var(--weight-semibold); border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: var(--radius-sm); color: inherit; }
.st-name:hover { border-color: var(--border); } .st-name:focus-visible { outline: 2px solid var(--accent); border-color: transparent; }
.st-status { font-size: var(--text-xs); color: var(--text-muted, #8c8c86); white-space: nowrap; } .st-status.is-err { color: var(--danger); }
.st-banner { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); font-size: var(--text-sm); } .st-banner span { flex: 1; } .st-banner .st-icon { width: 32px; height: 32px; }
.st-ed { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr) clamp(220px, 34vh, 340px); grid-template-areas: "left center right" "tl tl tl"; }
.st-left { grid-area: left; } .st-center { grid-area: center; } .st-right { grid-area: right; } .st-tl { grid-area: tl; }
.st-left, .st-right { overflow-y: auto; background: var(--bg-elevated); min-height: 0; } .st-left { border-right: 1px solid var(--border); display: flex; flex-direction: column; } .st-right { border-left: 1px solid var(--border); padding-bottom: 24px; }
.st-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0e0e0d; color: #eee; }
.st-tl { border-top: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--bg-elevated); }
.st-mnav { display: none; }
/* Preview */
.st-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.st-frame { position: relative; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.12); } .st-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; } #stOver { touch-action: none; }
.st-ctl { display: flex; align-items: center; gap: 2px; padding: 4px 8px; flex-wrap: wrap; justify-content: center; border-top: 1px solid rgba(255,255,255,.1); } .st-ctl .st-icon { color: #eee; } .st-ctl .st-icon:hover:not(:disabled) { background: rgba(255,255,255,.12); } .st-ctl .st-icon.is-on { background: rgba(255,255,255,.2); }
.st-tc { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 0 8px; } .st-meter canvas { display: block; background: rgba(255,255,255,.1); border-radius: 2px; }
.st-mini { font: inherit; font-size: var(--text-xs); min-height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: inherit; padding: 0 6px; } .st-ctl .st-mini { background: #222; color: #eee; border-color: #444; }
/* Tabs and library */
.st-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-elevated); } .st-tabs--lib { flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.st-tab { flex: 1 1 auto; min-height: 40px; border: 0; background: transparent; font: inherit; font-size: var(--text-xs); color: var(--text-secondary, #6f6f6a); cursor: pointer; padding: 4px 8px; border-bottom: 2px solid transparent; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; } .st-tab i { font-size: 18px; }
.st-tab.is-on { color: inherit; border-bottom-color: var(--accent); font-weight: var(--weight-medium); } .st-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#stLibBody, .st-lib-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.st-lib-filter, .st-inline { display: flex; gap: 6px; align-items: center; } .st-wrap { flex-wrap: wrap; } .st-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.st-grid-s { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; } .st-grid-s--tr { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); } .st-grid-s--emoji { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.st-card-s, .st-preset, .st-preset-s, .st-sticker, .st-emoji, .st-tr, .st-filter, .st-bg, .st-fsw { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); color: inherit; font: inherit; font-size: var(--text-xs); padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; text-align: center; }
.st-card-s:hover, .st-preset:hover, .st-sticker:hover, .st-tr:hover, .st-filter:hover, .st-emoji:hover, .st-bg:hover { border-color: var(--accent); } .st-card-s:focus-visible, .st-preset:focus-visible, .st-sticker:focus-visible, .st-tr:focus-visible, .st-filter:focus-visible, .st-emoji:focus-visible, .st-bg:focus-visible { outline: 2px solid var(--accent); }
.st-emoji { font-size: 22px; padding: 2px; } .st-card-s img, .st-asset-th img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 4px; }
.st-row-item { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-md); } .st-asset-th { width: 52px; flex: none; display: grid; place-items: center; } .st-asset-t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; } .st-asset-act { display: flex; } .st-asset-act .st-icon { width: 32px; height: 32px; }
.st-list { display: flex; flex-direction: column; gap: 6px; } .st-imports { display: flex; flex-direction: column; gap: 4px; } .st-imp { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-xs); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--bg-subtle); } .st-imp.is-error { color: var(--danger); }
.st-tag { font-size: 10px; letter-spacing: .04em; padding: 1px 6px; border-radius: var(--radius-full); border: 1px solid var(--border-strong); margin-left: 6px; vertical-align: middle; } .st-tag--local { color: var(--success, #2f7d4f); } .st-tag--svc { color: var(--warning); }
.st-warn-t { color: var(--warning); } .st-log { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); } .st-cues { display: flex; flex-direction: column; gap: 4px; } .st-cue-tm { font-variant-numeric: tabular-nums; color: var(--text-muted, #8c8c86); font-size: var(--text-xs); }
/* Inspector */
.st-insp-h { padding: 12px 14px 6px; display: flex; flex-direction: column; gap: 2px; } .st-sec { border-top: 1px solid var(--border); } .st-sec > summary { cursor: pointer; padding: 10px 14px; min-height: 40px; font-weight: var(--weight-medium); font-size: var(--text-sm); list-style: none; display: flex; align-items: center; } .st-sec > summary::before { content: "\25B8"; margin-right: 8px; font-size: 10px; transition: transform .15s; } .st-sec[open] > summary::before { transform: rotate(90deg); } .st-sec > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-sec-b { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; } .st-sec-b--flat { padding-top: 8px; } .st-h5 { margin: 8px 0 0; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #8c8c86); font-weight: var(--weight-medium); }
.st-ctl-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 52px 28px; align-items: center; gap: 6px; font-size: var(--text-xs); } .st-ctl-row--c { grid-template-columns: 92px 1fr; } .st-ctl-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary, #6f6f6a); } .st-ctl-row input[type=range] { width: 100%; min-height: 28px; accent-color: var(--accent); } .st-ctl-row input[type=color], .st-field input[type=color] { width: 40px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: none; }
.st-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-secondary, #6f6f6a); } .st-field input:not([type=range]):not([type=color]):not([type=checkbox]), .st-field select, .st-field textarea { font: inherit; font-size: var(--text-sm); padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: inherit; width: 100%; box-sizing: border-box; } .st-field textarea { resize: vertical; }
.st-check { display: flex; gap: 8px; align-items: center; font-size: var(--text-sm); min-height: 34px; } .st-check input { width: 18px; height: 18px; accent-color: var(--accent); } .st-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .st-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; } .st-row4 input { min-width: 0; padding: 6px; border: 1px solid var(--border-strong); border-radius: 4px; font: inherit; background: var(--bg-elevated); color: inherit; }
.st-kf { width: 26px; height: 26px; border: 0; background: transparent; color: var(--text-muted, #8c8c86); border-radius: 4px; cursor: pointer; display: grid; place-items: center; } .st-kf.is-has { color: var(--accent); } .st-kf.is-on { color: var(--accent); background: var(--accent-subtle); } .st-kf.is-on i::before { content: "\e1ea"; } .st-kf:focus-visible { outline: 2px solid var(--accent); }
.st-kfrow { display: grid; grid-template-columns: 90px 1fr 32px; align-items: center; gap: 6px; font-size: var(--text-xs); } .st-kflane { position: relative; height: 18px; background: var(--bg-subtle); border-radius: 9px; } .st-kfd { position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: var(--accent); border: 0; padding: 0; cursor: pointer; border-radius: 2px; }
/* Timeline */
.st-tl-tools { display: flex; align-items: center; gap: 2px; padding: 3px 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; } .st-tl-tools .st-icon { width: 34px; height: 34px; } .st-tl-tools .is-on, .st-icon.is-on { background: var(--accent-subtle); color: var(--accent-hover); } #tlZoom { width: 90px; accent-color: var(--accent); }
.st-tl-body { flex: 1; min-height: 0; display: flex; } .st-tl-heads { width: 148px; flex: none; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; } .st-tl-corner { height: 30px; flex: none; border-bottom: 1px solid var(--border); } .st-tl-headlist { overflow: hidden; position: relative; }
.st-th { position: relative; display: flex; align-items: center; gap: 4px; padding: 0 4px; border-bottom: 1px solid var(--border); box-sizing: border-box; } .st-th.is-lock { opacity: .7; } .st-th-ico { color: var(--text-muted, #8c8c86); } .st-th-name { flex: 1; min-width: 0; font: inherit; font-size: var(--text-xs); border: 0; background: transparent; color: inherit; } .st-th-btns { display: flex; } .st-th-btns button { width: 22px; height: 22px; border: 0; background: transparent; color: inherit; cursor: pointer; border-radius: 4px; font-size: 13px; padding: 0; } .st-th-btns .is-on { color: var(--accent); } .st-th-btns button:focus-visible, .st-th-name:focus-visible { outline: 2px solid var(--accent); }
.st-tl-wrap { flex: 1; min-width: 0; position: relative; overflow: hidden; } #tlCv { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; } #tlCv:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
/* Dialogs */
.st-modal { position: fixed; inset: 0; background: var(--bg-overlay, rgba(0,0,0,.5)); display: grid; place-items: center; padding: 16px; z-index: 200; } .st-modal[hidden] { display: none; }
.st-dialog { background: var(--bg-elevated); color: inherit; border-radius: var(--radius-lg); padding: 20px; width: min(560px, 100%); max-height: 100%; overflow-y: auto; box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.3)); display: flex; flex-direction: column; gap: 12px; }
.st-dialog h3 { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); } .st-dialog p { margin: 0; line-height: 1.5; } .st-dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; } .st-grid--ex { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } .st-check--wide { grid-column: 1 / -1; flex-direction: row !important; }
.st-report { display: grid; grid-template-columns: 70px 1fr; gap: 4px 10px; margin: 0; font-size: var(--text-sm); } .st-report dt { color: var(--text-muted, #8c8c86); } .st-report dd { margin: 0; } .st-result { width: 100%; max-height: 52vh; background: #000; border-radius: var(--radius-md); }
.st-bar { height: 10px; border-radius: 5px; background: var(--bg-subtle); overflow: hidden; } .st-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.st-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; } .st-keys h4 { margin: 0 0 6px; font-size: var(--text-sm); } .st-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: var(--text-xs); } .st-keys dd { margin: 0; } kbd { font-family: ui-monospace, Menlo, monospace; font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg-subtle); white-space: nowrap; }
.st-blank-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .st-blank-row select { font: inherit; font-size: var(--text-sm); min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: inherit; padding: 0 8px; max-width: 100%; }
.st-clips { display: flex; flex-direction: column; gap: 6px; } .st-clip { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-md); } .st-clip.is-err { border-color: var(--danger); } .st-clip-th { width: 54px; height: 40px; background: var(--bg-subtle); display: grid; place-items: center; border-radius: 4px; overflow: hidden; } .st-clip-th img { width: 100%; height: 100%; object-fit: cover; } .st-clip-t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--text-sm); overflow: hidden; } .st-add--wide { width: auto; height: 44px; flex-direction: row; padding: 0 14px; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Phones and narrow windows: one pane at a time, bottom tool bar */
@media (max-width: 900px) {
  .st-ed { display: block; position: relative; } .st-ed > * { position: absolute; inset: 0 0 0 0; } .st-ed[data-pane="tools"] > :not(.st-left), .st-ed[data-pane="edit"] > :not(.st-right) { display: none; }
  .st-ed[data-pane="preview"] > .st-left, .st-ed[data-pane="preview"] > .st-right { display: none; } .st-ed[data-pane="preview"] > .st-center { bottom: 46%; } .st-ed[data-pane="preview"] > .st-tl { top: 54%; }
  .st-mnav { display: flex; border-top: 1px solid var(--border); background: var(--bg-elevated); padding-bottom: env(safe-area-inset-bottom); } .st-mnav button { flex: 1; min-height: 52px; border: 0; background: transparent; color: var(--text-secondary, #6f6f6a); font: inherit; font-size: var(--text-xs); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; } .st-mnav button i { font-size: 22px; } .st-mnav button.is-on { color: var(--accent-hover); font-weight: var(--weight-medium); }
  .st-hide-m, .st-top .st-btn span { display: none; } .st-tl-heads { width: 96px; } .st-th-name { display: none; } .st-status { display: none; } .st-ctl-row { grid-template-columns: 80px minmax(0, 1fr) 46px 28px; } .st-left, .st-right { border: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Track height handle: a thin bar on the bottom edge of every track name. Wider on touch screens. */
.st-th-rz { position: absolute; left: 0; right: 0; bottom: -3px; height: 7px; cursor: row-resize; touch-action: none; z-index: 2; border-radius: 3px; }
.st-th-rz:hover, .st-th-rz:focus-visible { background: var(--accent); opacity: .55; outline: none; }
@media (pointer: coarse) { .st-th-rz { height: 18px; bottom: -9px; } }

/* Laptop fit (the Studio sits beside the app sidebar, so it often has only about 1100px) */
.st-tabs--lib { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.st-tabs--lib .st-tab { flex: 0 0 auto; min-width: 62px; }
.st-ed { grid-template-rows: minmax(0, 1fr) clamp(190px, 30vh, 320px); }
@media (min-width: 901px) and (max-width: 1280px) { .st-ed { grid-template-columns: 250px minmax(0, 1fr) 290px; } }
.st-tl-heads { width: 168px; }
.st-th { flex-wrap: wrap; align-content: center; row-gap: 0; padding: 0 6px; }
.st-th-name { flex: 1 1 60px; min-width: 0; }
.st-th-btns { flex: 1 1 100%; flex-wrap: wrap; }
.st-ctl-row { grid-template-columns: 78px minmax(70px, 1fr) 44px 26px; }
@media (pointer: coarse) { .st-th-btns button { width: 30px; height: 30px; } .st-tab { min-height: 48px; } .st-tl-tools .st-icon { width: 40px; height: 40px; } }
@media (max-width: 900px) { .st-tl-heads { width: 112px; } .st-th-btns { gap: 0; } .st-ctl-row { grid-template-columns: 78px minmax(0, 1fr) 44px 26px; } }
.st-lib-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .st-lib-filter input[type=search] { flex: 1 1 120px; min-width: 0; }
.st-lib-act { flex-wrap: wrap; }

/* ═════════ UI/UX and touch fixes ═════════ */
/* Touch: no double-tap zoom delay on controls, no grey tap flash. On phones, fields at 16px or more stop iOS from zooming the whole page in when a field is tapped. */
#studioRoot button, #studioRoot summary, #studioRoot select, #studioRoot [role=tab], .st-menu button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  #studioRoot select, #studioRoot textarea, #studioRoot input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]) { font-size: 16px; }
  #studioRoot .st-mini { min-height: 40px; }
}

/* Timeline toolbar: one row that scrolls sideways instead of wrapping into three rows that eat the timeline */
.st-tl-toolwrap { position: relative; flex: none; border-bottom: 1px solid var(--border); }
.st-tl-toolwrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 22px; pointer-events: none; background: linear-gradient(to right, transparent, var(--bg-elevated)); }
.st-tl-tools { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; border-bottom: 0; padding: 3px 26px 3px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.st-tl-tools::-webkit-scrollbar { display: none; }
.st-tl-tools > * { flex: none; }
#tlZoom { width: 110px; min-height: 34px; touch-action: none; }
.st-addtrack { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border: 1px solid var(--accent); border-radius: var(--radius-md); background: var(--accent-subtle); color: var(--accent-hover); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; cursor: pointer; }
.st-addtrack:hover, .st-addtrack[aria-expanded="true"] { background: var(--accent); color: #fff; }
.st-addtrack i { font-size: 16px; }
@media (pointer: coarse) { .st-addtrack { height: 40px; } }

/* Track headers: icon + hide/mute + lock + a "more" menu on phones and tablets. The old two-row button grid overlapped the resize bar, so Move and Delete could not be tapped. */
.st-th-more { display: none; }
.st-th-btns .st-th-more i, .st-th-btns button i { pointer-events: none; }
@media (max-width: 900px), (pointer: coarse) {
  .st-tl-heads { width: 128px; }
  .st-th { flex-wrap: nowrap; padding: 0 4px; gap: 0; }
  .st-th-name { display: none; }
  .st-th-ico { flex: none; width: 16px; font-size: 14px; text-align: center; }
  .st-th-btns { flex: 1 1 auto; flex-wrap: nowrap; justify-content: space-between; gap: 0; }
  .st-th-btns .st-th-x { display: none; }
  .st-th-btns .st-th-more { display: inline-grid; place-items: center; }
  .st-th-btns button { width: 34px; height: 40px; font-size: 17px; display: inline-grid; place-items: center; }
}
@media (pointer: coarse) { .st-th-rz { height: 14px; bottom: -7px; } }

/* Popup menus (Add track, track options, Add effect, speed...) */
.st-menu { position: fixed; z-index: 10001; min-width: 210px; max-width: min(330px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--bg-elevated); color: var(--text-primary, inherit); border: 1px solid var(--border-strong); border-radius: var(--radius-lg, 12px); box-shadow: var(--shadow-lg, 0 14px 34px rgba(0,0,0,.3)); padding: 6px; }
.st-menu-title { padding: 6px 10px 4px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #8c8c86); }
.st-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--radius-md, 8px); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.st-menu-item i { font-size: 18px; width: 18px; flex: none; text-align: center; }
.st-menu-gap { display: inline-block; }
.st-menu-l { flex: 1; min-width: 0; }
.st-menu-h { color: var(--text-muted, #8c8c86); font-size: var(--text-xs); text-align: right; }
.st-menu-item:hover:not(:disabled), .st-menu-item:focus-visible { background: var(--bg-subtle); outline: none; }
.st-menu-item:active:not(:disabled) { background: var(--accent-subtle); }
.st-menu-item.is-on { color: var(--accent-hover); }
.st-menu-item.is-danger { color: var(--danger); }
.st-menu-item:disabled { opacity: .4; cursor: not-allowed; }
.st-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
@media (pointer: coarse) { .st-menu-item { min-height: 48px; } }

/* Preview speed is now a small button that opens a menu */
.st-ctl .st-rate { min-width: 52px; padding: 0 10px; cursor: pointer; font-variant-numeric: tabular-nums; }

/* Empty project prompt */
.st-start { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center; color: #eee; background: rgba(14,14,13,.72); }
.st-start[hidden] { display: none; }
.st-start > i { font-size: 28px; opacity: .85; }
.st-start strong { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.st-start > span { font-size: var(--text-xs); color: #c9c9c4; max-width: 30ch; line-height: 1.4; }
.st-start-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.st-start .st-btn { min-height: 40px; }
.st-start .st-btn:not(.st-btn--primary) { background: #222; color: #eee; border-color: #555; }
@media (max-height: 760px) { .st-start > span { display: none; } }

/* Toasts must never sit on top of a button you are about to tap. They ignore touches, and on phones they float above the bottom bar. */
.toast { pointer-events: none; }
@media (max-width: 900px) { body:has(#view-studio:not([hidden]) .st-mnav) .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }

/* Library tabs scroll sideways: fade the right edge so it is clear there is more to swipe to */
.st-tabs--lib { padding-right: 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); scroll-behavior: smooth; }

/* Phone layout: preview and timeline share the screen evenly, and the playback bar is tighter */
@media (max-width: 900px) {
  .st-ed[data-pane="preview"] > .st-center { bottom: 50%; }
  .st-ed[data-pane="preview"] > .st-tl { top: 50%; }
  .st-ctl { gap: 0; padding: 2px 4px; }
  .st-tc { padding: 0 4px; }
  .st-meter { display: none; }
}
/* A phone on its side: preview on the left, timeline on the right */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .st-ed[data-pane="preview"] > .st-center { bottom: 0; right: 50%; }
  .st-ed[data-pane="preview"] > .st-tl { top: 0; left: 50%; border-top: 0; border-left: 1px solid var(--border); }
}

/* Track headers are positioned with translateY by the timeline code, so they must not also stack in normal flow.
   Before this, every header was pushed down by the height of all the headers above it and drifted away from its lane. */
.st-tl-headlist { flex: 1; min-height: 0; }
.st-th { position: absolute; left: 0; right: 0; top: 0; }
