/* Shared desktop geometry. Palette switches never change layout. */
:root { --panel-bg:var(--bc-surface); --input-bg:var(--bc-surface); --accent:var(--bc-primary); --cc-border:var(--bc-border); --cc-muted:var(--bc-muted); --surface:var(--bc-surface); --border:var(--bc-border); --text:var(--bc-text); --text-muted:var(--bc-muted); }
:root[data-theme="dark"] { --bc-canvas:#171717; --bc-surface:#202020; --bc-sidebar:#191919; --bc-text:#ededed; --bc-muted:#aaa; --bc-border:#363636; --bc-hover:#292929; --bc-selected:#333; --bc-primary:#ededed; --bc-primary-text:#202020; --bc-ring:#aaa; --bc-success:#83b395; --bc-warning:#c7a371; --bc-error:#dc9090; color-scheme:dark; }
:root[data-theme] { --light-bg:var(--bc-canvas); --light-surface:var(--bc-surface); --light-surface-soft:var(--bc-sidebar); --light-text:var(--bc-text); --light-text-soft:var(--bc-muted); --light-border:var(--bc-border); --light-accent:var(--bc-primary); --light-accent-soft:var(--bc-hover); --light-accent-border:var(--bc-border); }
html body { background:var(--bc-canvas); color:var(--bc-text); font-family:var(--bc-font); font-size:13px; line-height:20px; }
html body :is(button,input,select,textarea) { font-family:var(--bc-font); }
html body :is(h1,h2,h3,h4,strong,label) { color:var(--bc-text); letter-spacing:normal; }
html body h1 { font-size:18px; line-height:26px; }
html body h2 { font-size:14px; line-height:22px; }
html body h3 { font-size:13px; line-height:20px; }
html body :is(.card,.standalone-card,.cc-panel,.account-panel,.config-card,.script-block,.video-gen-box,.branch-frame-workspace,.viral-production-card,.viral-directions-card,.viral-analysis-card,.libtv-material-card,.registry-card,.demand-card) { background:var(--bc-surface)!important; color:var(--bc-text); border:1px solid var(--bc-border)!important; border-radius:8px; box-shadow:none!important; }
html body :is(.tip,.opt-label,.status,.empty,.cc-hint,.cc-empty,.standalone-hero p,.context-panel p,.tc-status,.product-branch-tab small) { color:var(--bc-muted); }
html body :is(.card-header,.standalone-section-head,.script-block-head,.replica-trim-head,.cc-divider,.config-function-tabs,.settings-sections) { border-color:var(--bc-border)!important; }
html body :is(.btn-primary,.cc-primary,.primary)[data-bc-ui=button] { background:var(--bc-primary)!important; color:var(--bc-primary-text)!important; border-color:var(--bc-primary)!important; box-shadow:none; }
html body [data-bc-ui=button]:not([data-variant=default]) { background:var(--bc-surface)!important; color:var(--bc-text)!important; border-color:var(--bc-border)!important; }
html body :is(input,select,textarea)[data-bc-ui] { background:var(--bc-surface)!important; color:var(--bc-text)!important; border-color:var(--bc-border)!important; box-shadow:none!important; }
html body [data-bc-ui=input],html body [data-bc-ui=select] { height:32px; min-height:32px; font-size:13px; line-height:20px; border-radius:6px; padding:0 10px; }
html body [data-bc-ui=textarea] { font-size:13px; line-height:20px; border-radius:6px; padding:8px 10px; resize:vertical; }
html body :is(button,input,select,textarea,a):focus-visible { outline:2px solid var(--bc-ring); outline-offset:2px; }
html body :is(.opt-btn,.config-function-tab,.settings-section-btn) { background:var(--bc-surface); color:var(--bc-muted); border-color:var(--bc-border); border-radius:6px; }
html body :is(.opt-btn.active,.config-function-tab.active,.settings-section-btn.active) { background:var(--bc-selected)!important; color:var(--bc-text)!important; border-color:var(--bc-border)!important; box-shadow:none!important; }
html body :is(.tc-status.done,.cc-status.success) { color:var(--bc-success)!important; background:transparent!important; }
html body :is(.tc-status.error,.status.error) { color:var(--bc-error)!important; background:transparent!important; }
html body .tc-status.running { color:var(--bc-warning)!important; background:transparent!important; }
html body [hidden] { display:none!important; }
/* Native options inherit the same neutral palette as every closed select. */
html body select, html body select :is(option,optgroup) { color-scheme:light; background:var(--bc-surface)!important; color:var(--bc-text)!important; }
html body select { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; padding-block:0!important; }
html[data-theme=dark] body select, html[data-theme=dark] body select :is(option,optgroup) { color-scheme:dark; }
@supports (appearance:base-select) {
  html body select:not([multiple]):not([size]), html body select:not([multiple]):not([size])::picker(select) { appearance:base-select; }
  html body select:not([multiple]):not([size]) { display:inline-flex!important; align-items:center; }
  html body select::picker(select) { background:var(--bc-surface); color:var(--bc-text); border:1px solid var(--bc-border); border-radius:6px; box-shadow:0 6px 18px #0002; padding:4px; max-height:320px; }
  html body select option { padding:6px 10px; border-radius:4px; min-height:30px; white-space:normal; }
  html body select option:is(:hover,:focus,:checked) { background:var(--bc-selected)!important; color:var(--bc-text)!important; }
  html body select option:disabled { color:var(--bc-muted)!important; opacity:.55; }
  html body select::picker-icon { color:var(--bc-muted); }
}
html body .hidden { display:none!important; }
/* Demand intake, history and delivery keep their original controls and records. */
html body .dq-view { max-width:none; padding:14px; color:var(--bc-text)!important; }
html body .dq-head { margin-bottom:12px; gap:12px; }
html body .dq-head p, html body #demandSquare>.dq-head:has([data-new]) h2 { display:none; }
html body .dq-status:empty { display:none; }
html body :is(.dq-scroll,.dq-filters,.dq-library,.dq-media-dialog,.dq-text-dialog,.dq-product-delivery,.dq-product-input,.dq-product-requirements,.dq-cell,.dq-artifact) { border-color:var(--bc-border)!important; border-radius:8px; background:var(--bc-surface)!important; color:var(--bc-text)!important; }
html body .dq-table :is(th,td) { border-color:var(--bc-border)!important; padding:8px 12px; }
html body .dq-table th { background:var(--bc-sidebar)!important; color:var(--bc-muted)!important; }
html body :is(.dq-meta,.dq-table small,.dq-empty,.dq-source span,.dq-drop-empty,.dq-drop-empty small) { color:var(--bc-muted)!important; }
html body :is(.dq-drop,.dq-thumb,.dq-video,.dq-process pre,.dq-table details pre,.dq-text-surface) { border-color:var(--bc-border)!important; background:var(--bc-canvas)!important; color:var(--bc-text)!important; }
html body .dq-drop { aspect-ratio:9/16; }
html body .dq-drop:hover { border-color:var(--bc-muted)!important; background:var(--bc-hover)!important; }
html body .dq-product-nav [aria-selected=true], html body .dq-version-tabs [aria-selected=true] { background:var(--bc-selected)!important; color:var(--bc-text)!important; border-color:var(--bc-border)!important; }
html body .dq-badge { background:var(--bc-canvas)!important; border-color:var(--bc-border)!important; color:var(--bc-muted)!important; }
html body :is(.dq-delivered,.dq-received) { color:var(--bc-success)!important; }
html body :is(.dq-working,.dq-partial) { color:var(--bc-warning)!important; }
html body :is(.dq-actions,.dq-footer,.dq-pagination) { gap:8px; }
html body .admin-table th { background:var(--bc-sidebar)!important; color:var(--bc-muted)!important; border-color:var(--bc-border)!important; }
html body .admin-table td { border-color:var(--bc-border)!important; }
  html body #productBranchRail { box-shadow:none!important; }
@media (min-width:769px) {
  html { zoom:1!important; }
  html,html body { height:auto!important; min-height:100%; overflow:visible!important; }
  html body .app-layout { display:flex; align-items:stretch; min-height:100dvh; height:auto; overflow:visible; }
  html body .workspace-sidebar { width:548px; flex:0 0 548px; display:grid; grid-template-columns:208px 340px; position:sticky; top:0; align-self:flex-start; height:100dvh!important; min-height:0; overflow:hidden; background:var(--bc-sidebar)!important; border-right:1px solid var(--bc-border); box-shadow:none; }
  html body .tool-rail { display:flex; flex-direction:column; gap:0; padding:0 8px 12px; position:static; height:auto; min-height:100dvh; overflow:visible; background:var(--bc-sidebar)!important; border-right:1px solid var(--bc-border); }
  .desktop-brand { display:flex; align-items:center; gap:10px; height:64px; flex:0 0 64px; padding:0 8px; }
  .desktop-brand .bc-brand-mark { width:28px; height:28px; flex:0 0 28px; border-radius:6px; background:var(--bc-primary); color:var(--bc-primary-text); font-size:11px; font-weight:600; }
  .desktop-brand strong,.desktop-brand small { display:block; font-size:12px; line-height:18px; }
  .desktop-brand small { color:var(--bc-muted); font-size:11px; }
  html body .tool-mode-btn:not(.theme-toggle) { height:32px; min-height:32px; padding:0 12px; margin:2px 0; width:100%; display:flex; flex-direction:row; justify-content:flex-start; gap:8px; font-size:13px; line-height:20px; border:0; border-radius:6px; background:transparent!important; color:var(--bc-muted)!important; box-shadow:none!important; }
  html body .tool-mode-btn.active { background:var(--bc-selected)!important; color:var(--bc-text)!important; font-weight:500; }
  html body .tool-mode-btn svg { width:16px; height:16px; }
  html body .tool-mode-btn span { font-size:13px; line-height:20px; }
  html body .tool-rail-spacer { min-height:16px; flex:1; }
  html body .theme-toggle-top { margin:8px 0 0; width:32px; height:32px; min-height:32px; align-self:flex-end; border:1px solid var(--bc-border); background:var(--bc-surface); color:var(--bc-muted); }
  html body .ts-user { margin-top:12px; padding:10px 8px 0; border-color:var(--bc-border); font-size:12px; }
  html body .ts-user-name { color:var(--bc-text); }
  html body .ts-logout { color:var(--bc-muted); }
  html body .workspace-sidebar .task-sidebar { width:auto; padding:12px; position:relative; height:100dvh!important; min-height:0; overflow:hidden; background:var(--bc-sidebar)!important; border:0; }
  html body .context-head { min-height:28px; margin:0 0 10px; padding:0 36px 0 0; border:0; }
  html body .context-head h2 { margin:0; font-size:13px; line-height:28px; }
  html body :is(.context-kicker,.tool-context-copy,.product-branch-kicker) { display:none; }
  .desktop-task-collapse { position:absolute; right:12px; top:12px; height:28px; width:28px; border:1px solid var(--bc-border); border-radius:6px; background:var(--bc-surface); color:var(--bc-muted); padding:5px; }
  .desktop-task-collapse svg { width:16px; height:16px; }
  html body .context-panel { height:auto; min-height:0; flex:1; gap:0; overflow:hidden; }
  html body .ts-new { height:32px; min-height:32px; margin:0 0 8px; width:100%; border:1px solid var(--bc-border); border-radius:6px; }
  html body .task-name-search { margin:0 0 8px; width:100%; }
  html body .ts-list { display:flex; flex-direction:column; height:auto; max-height:none; min-height:0; flex:1; gap:4px; overflow:auto; margin:0; }
  html body .task-card { flex:none; min-height:42px; height:42px; padding:5px 7px; margin:0; display:grid; grid-template-columns:minmax(70px,1fr) minmax(74px,104px) 66px; gap:4px; background:var(--bc-surface)!important; color:var(--bc-text); border:1px solid var(--bc-border)!important; border-radius:6px; box-shadow:none!important; }
  html body .task-card.active { background:var(--bc-selected)!important; border-left:3px solid var(--bc-text)!important; padding-left:5px; }
  html body .task-card .tc-head { display:contents; }
  html body .task-card .tc-name { font-size:12px; line-height:20px; font-weight:500; color:var(--bc-text); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  html body .task-card .tc-status { width:auto; min-width:0; padding:0; gap:4px; font-size:10px; line-height:16px; border:0!important; background:transparent!important; }
  html body .task-card .tc-status span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  html body .task-card .tc-status svg { width:12px; height:12px; flex:0 0 12px; }
  html body .task-card .tc-actions { position:static; display:flex; gap:0; }
  html body .task-card .tc-actions button { height:26px; width:22px; min-width:22px; color:var(--bc-muted); }
  html body .archive-entry { height:32px; margin:8px 0 0; padding:0 10px; font-size:12px; }
  html body .workspace-sidebar.nav-collapsed { width:396px; flex-basis:396px; grid-template-columns:56px 340px; }
  html body .nav-collapsed .desktop-brand { padding:0 6px; }
  html body .nav-collapsed :is(.desktop-brand>span,.tool-mode-btn>span,.ts-user) { display:none; }
  html body .nav-collapsed .tool-mode-btn:not(.theme-toggle) { padding:0; justify-content:center; }
  html body .workspace-sidebar.tasks-collapsed { width:256px; flex-basis:256px; grid-template-columns:208px 48px; }
  html body .workspace-sidebar.nav-collapsed.tasks-collapsed { width:104px; flex-basis:104px; grid-template-columns:56px 48px; }
  html body .tasks-collapsed .task-sidebar>:not(.desktop-task-collapse) { display:none!important; }
  html body .tasks-collapsed .desktop-task-collapse { right:10px; }
  html body .main { flex:1; min-width:0; width:auto; padding:14px; height:auto; min-height:0; overflow:visible; background:var(--bc-canvas)!important; }
  html body .container { max-width:none; width:100%; padding:0; margin:0; }
  html body .standalone-workspace { height:auto!important; min-height:0; max-height:none; overflow:visible; margin:0; border:0; background:transparent; box-shadow:none; }
  html body :is(.standalone-hero,.demand-hero) { background:transparent!important; border:0; padding:0 0 12px; box-shadow:none; }
  html body .standalone-hero h1 { font-size:18px; line-height:26px; }
  html body :is(.standalone-hero p,.standalone-kicker,.branch-frame-workspace-title>p,.upload-player-hint) { display:none; }
  html body :is(.standalone-body,.cc-layout,.cc-panel,.standalone-card,.edit-history-scroll,.analyze-result,.segments,.video-list,.standalone-result,.libtv-result-list,.viral-fission-input-grid,.viral-directions-grid) { height:auto; max-height:none; min-height:0; overflow:visible; }
  html body :is(.cc-layout,.standalone-grid) { gap:12px; }
  html body .cc-layout { grid-template-columns:minmax(210px,.9fr) minmax(210px,1fr) minmax(220px,1.15fr); }
  html body .cc-panel { padding:12px; }
  html body #ccResults video { height:auto; max-height:260px; }
  html body .viral-fission-workspace.is-business-mode .viral-fission-input-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body .viral-fission-workspace.is-business-mode .viral-directions-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body :is(.product-branch-rail,.standalone-hero,.branch-frame-workspace-head,.script-action-bar) { position:static!important; top:auto; }
  #tabs { display:none!important; }
  .replica-stage-bar { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
  #replicaStageTabs { display:flex; gap:2px; padding:3px; border-radius:6px; background:var(--bc-hover); }
  #replicaStageTabs button { height:28px; padding:0 10px; border:0; border-radius:4px; font-size:13px; line-height:20px; font-weight:500; background:transparent; color:var(--bc-muted); white-space:nowrap; }
  #replicaStageTabs button[aria-selected=true] { background:var(--bc-surface); color:var(--bc-text); }
  #replicaStageTabs button:disabled { opacity:.4; cursor:not-allowed; }
  html body #uploadArea h1 { display:none; }
  html body #replica-source { display:grid; grid-template-columns:minmax(230px,.8fr) minmax(0,1.2fr); gap:12px; align-items:start; }
  html body #replica-source>.tab-split:first-of-type { grid-column:2; }
  html body #replica-source>.tab-split:last-of-type { grid-column:1/-1; display:grid; grid-template-columns:minmax(230px,.8fr) minmax(0,1.2fr); gap:12px; margin-top:0!important; }
  html body #replica-source>.tab-split { display:grid; grid-template-columns:1fr; gap:12px; }
  html body #replica-source:not(.source-confirmed)>#uploadArea { grid-column:1/-1; }
  html body #replica-source .card { padding:12px; min-width:0; }
  html body .drop-zone { padding:12px; margin:0; border:1px dashed var(--bc-border); border-radius:8px; background:var(--bc-surface)!important; min-height:0; }
  html body .upload-empty-state { padding:30px 12px; }
  html body .upload-empty-state p { font-size:12px; color:var(--bc-muted); }
  html body .upload-player video { display:block; height:auto; max-height:180px; width:100%; object-fit:contain; background:#171717; }
  html body .analysis-request-controls { margin-top:8px; gap:6px; }
  html body .upload-player-footer { display:flex; flex-wrap:wrap; gap:8px; padding:8px 0 0; }
  html body .upload-player-actions { margin:0; gap:6px; }
  html body .filename { font-size:12px; overflow-wrap:anywhere; }
  html body .replica-trim-panel { margin-top:12px; padding:10px; background:var(--bc-canvas); border-color:var(--bc-border); }
  html body .replica-trim-grid { grid-template-columns:auto minmax(40px,1fr) 64px; gap:6px; }
  html body .replica-trim-head { flex-wrap:wrap; gap:4px; }
  html body .replica-trim-actions { gap:6px; }
  html body .replica-trim-note { font-size:11px; }
  html body .btn-row { margin:8px 0 0; gap:8px; }
  html body #status { min-width:0; }
  html body #status:not(.error):not(:has(button)) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  html body .transcript-card-head { display:flex; flex-wrap:wrap; gap:6px; }
  html body .transcript-actions { display:flex; flex-wrap:wrap; gap:6px; }
  html body .transcript-actions button { font-size:12px; }
  html body .segments { margin:8px 0; padding:0; }
  html body #tab-analyze textarea { flex:none!important; min-height:80px; max-height:none; overflow-y:hidden; }
  .transcript-raw-details { border:1px solid var(--bc-border); border-radius:8px; background:var(--bc-surface); }
  .transcript-raw-details summary { cursor:pointer; padding:10px 12px; font-size:13px; font-weight:500; }
  html body .transcript-raw-details .card { border:0!important; padding-top:0!important; }
  html body .transcript-raw-details .card-header h2 { display:none; }
  html body .product-branch-rail { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:0 0 10px; margin:0 0 12px; border:0; border-bottom:1px solid var(--bc-border); border-radius:0; background:transparent!important; box-shadow:none; }
  html body .product-branch-head { order:2; margin-left:auto; }
  html body .product-branch-tabs { gap:6px; padding:0; display:flex; flex-wrap:wrap; overflow:visible; }
  html body .product-branch-tab { padding:4px 8px; font-size:12px; color:var(--bc-muted); background:var(--bc-surface)!important; box-shadow:none; }
  html body .product-branch-item { border:1px solid var(--bc-border); background:var(--bc-surface)!important; border-radius:6px; }
  html body .product-branch-item.active { border-color:var(--bc-text)!important; box-shadow:none; }
  html body .product-branch-tab.active { color:var(--bc-text)!important; background:var(--bc-selected)!important; }
  html body .product-branch-actions { border-color:var(--bc-border); }
  html body .product-branch-action { color:var(--bc-muted); }
  html body .branch-frame-workspace { padding:0; margin:0; background:transparent!important; border:0!important; }
  html body .branch-frame-workspace-head { display:none; }
  html body .frame-edit-layout { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
  html body .frame-edit-layout>.card { padding:12px; min-width:0; }
  html body .frame-wrap { background:var(--bc-canvas); border-color:var(--bc-border); min-height:120px; }
  html body .frame-show { width:100%; height:auto; max-height:220px; object-fit:contain; }
  html body .frame-edit-layout #frameOverrideDrop { flex:none; height:220px; min-height:0; justify-content:center; }
  html body .frame-edit-layout #frameOverrideDrop:has(img:not(.hidden)) { height:auto; }
  html body .frame-edit-layout #framePreview,html body .frame-edit-layout .image-history-card>img { height:auto; max-height:220px; aspect-ratio:auto; object-fit:contain; background:var(--bc-canvas); }
  html body .frame-edit-layout .edit-result-placeholder { height:220px; min-height:0; aspect-ratio:auto; padding:12px; }
  html body #editAttemptStatus:has(#editStatus:empty) { display:none; }
  html body .frame-edit-layout>.card>.card-header { height:auto; min-height:22px; margin-bottom:10px; }
  html body #prodRefSlots .img-slot { height:64px; min-height:64px; aspect-ratio:auto; }
  html body :is(#prodRefSlots,.dq-view) .slot-placeholder .slot-text { font-size:10px; }
  html body :is(#prodRefSlots,.dq-view) .slot-placeholder .slot-icon { font-size:16px; }
  html body .image-mention-help { display:none; }
  html body .frame-product-card>.tip { margin:6px 0; font-size:11px; line-height:16px; }
  html body :is(.frame-product-card>.tip,.frame-wrap>.tip) { display:none; }
  html body .seg-opt .opt-btn { border:1px solid var(--bc-border)!important; box-shadow:none!important; font-size:12px; }
  html body .frame-generate-settings { margin-top:10px; padding-top:10px; }
  html body .frame-generate-settings h3 { margin:0 0 8px; }
  html body .img-option-row { gap:6px; margin:0 0 6px; }
  html body .frame-edit-layout .frame-actions button:not(.hidden) { height:28px; min-height:28px; padding:0 8px; font-size:12px; }
  html body .cc-header>div>span { display:none; }
  html body .img-slot { background:var(--bc-canvas)!important; color:var(--bc-muted); border-color:var(--bc-border)!important; border-radius:6px; }
  html body :is(.img-slot img,.edit-history-image) { object-fit:contain; }
  html body #replica-script>.card { margin:0!important; padding:12px; }
  html body .script-grid-v2 { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; }
  html body .script-left { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); align-content:start; gap:10px; }
  html body .script-frame-block { grid-column:1; grid-row:1; }
  html body .script-note-block { grid-column:2/5; grid-row:1; }
  html body .script-product-block { grid-column:1/-1; grid-row:2; }
  html body .script-voice-block { grid-column:1/-1; grid-row:3; }
  html body .script-left .img-slot { height:80px; min-height:80px; aspect-ratio:auto; }
  html body .script-left .script-product-block .img-slot { height:64px; min-height:64px; }
  html body .script-left .img-slot .slot-icon { font-size:16px; }
  html body .script-left .img-slot .slot-text { font-size:10px; }
  html body .slot-text::after { display:none; }
  html body .script-left .script-frame-block h3 { white-space:nowrap; font-size:12px; }
  html body .script-right { display:flex; flex-direction:column; gap:8px; }
  html body .script-right textarea { flex:none; min-height:80px; height:auto; }
  html body .script-right h3 { margin:0; }
  html body #scriptText { min-height:100px; }
  html body :is(.script-note-block>.tip,.script-right>.tip,.script-action-kicker,.script-action-title) { display:none; }
  html body .script-action-panel { padding:10px; margin:0; border:1px solid var(--bc-border)!important; background:var(--bc-canvas)!important; box-shadow:none; }
  html body .script-action-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
  html body .script-action-controls .btn-primary { height:32px; min-height:32px; }
  html body .script-action-status { padding:0; margin:8px 0 0; min-height:0; border:0; background:transparent; }
  html body .script-action-status:empty { display:none; }
  html body .script-block { padding:10px; }
  html body .script-action-bar { padding:10px; background:var(--bc-canvas)!important; border-color:var(--bc-border); }
  html body #replica-video .video-gen-box { margin:0!important; padding:12px; }
  html body .video-gen-opts { display:flex; flex-wrap:wrap; gap:8px; }
  html body .video-item { background:var(--bc-surface)!important; border-color:var(--bc-border); }
  html body .video-item video { height:auto; max-height:400px; width:100%; object-fit:contain; }
  html body :is(.analyze-result,.standalone-result,.script-input) { background:var(--bc-surface)!important; color:var(--bc-text)!important; border-color:var(--bc-border)!important; }
  /* Tool workspaces size to their content inside the two desktop sidebars. */
  html body .transcript-tool-grid { grid-template-columns:minmax(0,.9fr) minmax(0,1.25fr); }
  html body .libtv-tool-grid { grid-template-columns:minmax(0,1.35fr) minmax(0,.65fr); }
  html body .libtv-material-sections { grid-template-columns:repeat(3,minmax(0,1fr)); }
  html body .libtv-material-card { min-width:0; }
  html body .libtv-material-list { grid-template-columns:repeat(auto-fill,minmax(min(150px,100%),1fr)); }
  html body .standalone-card { padding:12px; overflow:visible; }
  html body .standalone-card h2 { margin-bottom:8px; }
  html body .standalone-drop { flex:none; min-height:120px; padding:16px; background:var(--bc-surface)!important; border:1px dashed var(--bc-border); color:var(--bc-muted); border-radius:6px; }
  html body .standalone-drop :is(video,img) { flex:none; height:auto; min-height:0; max-height:280px; width:100%; object-fit:contain; }
  html body .standalone-workspace textarea { flex:none; min-height:80px; max-height:none; overflow-y:hidden; }
  html body .standalone-quick-edit { flex:none; max-height:none; overflow:visible; }
  html body .analyze-tool-grid { grid-template-rows:auto auto; }
  html body .analyze-prompt-card .standalone-field { flex:none; }
  html body .image-tool-grid .generic-image-grid { flex:none; min-height:0; max-height:none; overflow:visible; }
  html body .image-tool-grid .generic-image-grid:empty { display:none; }
  html body .generic-image-grid>.standalone-ref-slot:not(:has(img)):not([data-index]) { aspect-ratio:auto; min-height:32px; padding:6px; border:0; }
  html body .standalone-hero { display:none; }
  html body .tasks-collapsed~.main .standalone-hero { display:block; }
  html body .standalone-status { min-height:0; margin-top:8px; color:var(--bc-muted); }
  html body .standalone-status:empty { display:none; }
  html body .standalone-result-image { background:var(--bc-canvas)!important; border-color:var(--bc-border); color:var(--bc-muted); }
  html body .segment-video-card .standalone-drop { min-height:140px; }
  html body .segment-video-card .standalone-drop video { height:auto; min-height:0; max-height:320px; }
  html body .segment-video-card:not(:has(video)) :is(.segment-playhead-row,.segment-timeline,.segment-frame-cut-row) { display:none; }
  html body #characterCreationView { padding:0; }
  html body .cc-header { min-height:20px; margin-bottom:8px; justify-content:flex-end; }
  html body .cc-header h2 { display:none; }
  html body .cc-panel { gap:8px; }
  html body .cc-panel button:not(.cc-primary) { background:var(--bc-surface); color:var(--bc-text); border-color:var(--bc-border); }
  html body .viral-method-panel { padding:8px 12px; }
  html body :is(.viral-method-panel-head,.viral-method-index,.viral-method-option em,.viral-method-option>span>span,.viral-method-note,.viral-mvp-note,.viral-selection-note) { display:none; }
  html body .viral-method-options { margin:0; gap:8px; border:0; }
  html body .viral-method-option { padding:8px 12px; min-height:32px; border:1px solid var(--bc-border); border-radius:6px; background:var(--bc-surface)!important; }
  html body .viral-method-option:has(input:checked) { background:var(--bc-selected)!important; box-shadow:none; border-color:var(--bc-text); }
  html body .viral-fission-input-grid .standalone-card { min-height:0; }
  html body .viral-product-grid>.standalone-ref-slot:not(:has(img)) { aspect-ratio:auto; min-height:32px; border:0; }
  html body .viral-empty { padding:12px; border-color:var(--bc-border); border-radius:6px; color:var(--bc-muted); }
  html body .viral-method-summary { display:none; }
  html body .viral-method-option .viral-method-index { display:none; }
  html body .viral-fission-workspace.is-business-mode :is(.viral-business-flow,.viral-fission-input-grid) { background:var(--bc-canvas)!important; border-color:var(--bc-border)!important; box-shadow:none!important; }
  html body .registry-page { --rg-bg:var(--bc-surface); --rg-edge:var(--bc-border); --rg-muted:var(--bc-muted); --rg-accent:var(--bc-text); padding:0; }
  html body .registry-page h1 { font-size:18px; line-height:26px; margin-bottom:8px; }
  html body .registry-page>p { display:none; }
  html body .registry-page h2 { font-size:14px; }
  html body .rg-layout { grid-template-columns:minmax(0,1fr); gap:12px; margin-top:12px; }
  html body .rg-tree { display:flex; flex-direction:row; flex-wrap:wrap; gap:6px; padding:8px; background:var(--bc-surface); border-color:var(--bc-border); }
  html body .registry-page button[data-bc-ui=button] { min-height:32px; height:32px; padding:0 10px; }
  html body .rg-tree button { width:auto; margin:0; }
  html body .rg-tree button[aria-current=true] { background:var(--bc-selected)!important; color:var(--bc-text); }
  html body .rg-table-wrap { max-width:100%; }
  html body .rg-table :is(td,th) { padding:4px 10px; white-space:nowrap; background:var(--bc-surface); border-color:var(--bc-border); }
  html body .rg-table th { background:var(--bc-sidebar); }
  html body .rg-table td small { margin-top:2px; font-size:11px; line-height:16px; white-space:nowrap; overflow-wrap:normal; }
  html body .rg-table td button { white-space:nowrap; }
  html body .rg-toolbar { margin:10px 0; gap:8px; }
  html body .rg-status:empty { display:none; }
  html body .usage-overview { padding:10px; margin-bottom:12px; }
  html body .usage-overview .usage-empty { padding:22px!important; }
  /* Task source is shared. The three production steps belong to a product. */
  #replicaTaskBar,.desktop-product-head { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
  #replicaTaskBar h2 { flex:1; margin:0; font-size:16px; }
  .desktop-product-head h3 { flex:1; margin:0; }
  #replicaProductChoices { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; }
  .desktop-product-choice { display:flex; flex-direction:column; align-items:flex-start; gap:12px; padding:18px; background:var(--bc-surface); color:var(--bc-text); border:1px solid var(--bc-border); border-radius:8px; cursor:pointer; }
  .desktop-product-choice:hover { border-color:var(--bc-text); }
  .desktop-product-choice span { color:var(--bc-muted); font-size:12px; }
  #replicaProductWorkspace { border-top:1px solid var(--bc-border); padding-top:12px; }
  html body #replica-source { grid-template-columns:minmax(200px,.65fr) minmax(0,1.35fr); align-items:start; }
  html body #replica-source>#replicaTranscriptGroup { grid-column:2; display:grid; grid-template-columns:minmax(0,1fr); }
  html body #replica-source>#replicaAnalysisGroup { grid-template-columns:minmax(230px,.8fr) minmax(0,1.2fr); align-items:stretch; }
  html body #replicaQuickEditCard .segments { min-height:80px; }
  html body #replicaFinalTranscriptCard textarea { min-height:150px; }
  html body #replicaFinalTranscriptCard>.tip { font-size:11px; line-height:18px; }
  .desktop-analysis-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:12px 0; }
  .desktop-analysis-fields label { display:flex; flex-direction:column; gap:5px; min-width:0; color:var(--bc-muted); font-size:12px; }
  .desktop-analysis-fields label:first-child { grid-column:1/-1; }
  .desktop-analysis-fields select { width:100%; }
  html body #replicaAnalysisGroup>.right { display:flex; flex-direction:column; }
  html body #replicaAnalysisGroup #analyzeResult { flex:1 1 0!important; width:100%; min-height:180px; height:100%!important; overflow:auto; resize:vertical; }
  .desktop-text-tools { display:flex; justify-content:flex-end; margin:4px 0 6px; flex:none; }
  .desktop-text-tools:has(+textarea.hidden),.desktop-text-tools:has(+textarea[hidden]),.desktop-text-tools:has(+textarea[style*="display: none"]) { display:none; }
  .desktop-panel-dialog { width:min(880px,calc(100vw - 48px)); height:min(640px,calc(100dvh - 48px)); max-width:100%; max-height:calc(100dvh - 48px); padding:20px; border:1px solid var(--bc-border); border-radius:10px; background:var(--bc-canvas); color:var(--bc-text); }
  .desktop-panel-dialog::backdrop { background:#0008; }
  .desktop-panel-dialog>button { display:block; margin:0 0 12px auto; }
  .desktop-panel-dialog .segments { max-height:none; overflow:visible; }
  html body .text-editor-dialog { width:min(880px,calc(100vw - 48px)); height:min(640px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px); background:var(--bc-surface); }
  html body .text-editor-head { flex:none; background:var(--bc-surface); border-color:var(--bc-border); }
  html body #textEditorOverlay textarea { flex:1 1 0; height:0!important; min-height:0!important; overflow:auto!important; resize:none; }
  html body #textEditorOverlay { z-index:11000; }
  html body .transcript-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body .transcript-actions button { width:100%; min-width:0; }
  /* Portrait windows preserve the whole source image via contain. */
  html body .upload-player video,html body .standalone-drop video,html body .standalone-drop img { display:block; width:min(100%,240px); height:auto!important; min-height:0!important; max-height:none!important; aspect-ratio:9/16; object-fit:contain; margin-inline:auto; }
  html body .upload-empty-state { width:min(100%,220px); aspect-ratio:9/16; display:grid; place-content:center; margin:auto; padding:16px; }
  html body .standalone-drop:not(.has-media) { width:min(100%,200px); aspect-ratio:9/16; min-height:0!important; height:auto; margin-inline:auto; }
  html body .frame-edit-layout #frameOverrideDrop { height:auto; min-height:0; }
  html body .frame-edit-layout #framePreview,html body .frame-edit-layout .image-history-card>img,html body .frame-edit-layout .edit-result-placeholder { width:100%; height:auto; max-height:none; min-height:0; aspect-ratio:9/16; object-fit:contain; }
  html body :is(#prodRefSlots .img-slot,.script-left .img-slot,.script-left .script-product-block .img-slot,.standalone-ref-slot,.image-history-card img) { height:auto!important; min-height:0!important; max-height:none; aspect-ratio:9/16!important; object-fit:contain; }
  html body :is(.video-item video,.libtv-video-card video,#ccResults video,.segment-source-video) { width:min(100%,320px); height:auto!important; max-height:none!important; min-height:0; aspect-ratio:9/16; object-fit:contain; margin-inline:auto; }
  html body .image-history-card { min-width:0; }
  html body :is(.generic-image-grid,.viral-product-grid)>.standalone-ref-slot:not(:has(img)):not([data-index]) { display:none; }
  html body .standalone-result-image:not(:has(img)) { flex:none; width:min(100%,220px); aspect-ratio:9/16; height:auto; min-height:0; margin-inline:auto; justify-content:center; }
  html body :is(.cc-role-assets img,#ccProductPreview img,.cc-note-item img,.cc-catalog-card img,.cc-catalog-card .cc-thumb-placeholder,.frame-tool-locked img,.ref-preview,.image-mention-item img) { height:auto; max-height:none; aspect-ratio:9/16; object-fit:contain; }
  html body :is(.artifact-card img,.artifact-card video,.artifact-video-panel video,.replica-video-panel video) { width:min(100%,280px); height:auto; min-height:0; max-height:none; aspect-ratio:9/16; object-fit:contain; }
  html body :is(.libtv-material-preview,.libtv-mention-thumb) { height:auto; aspect-ratio:9/16; }
  html body :is(.libtv-material-preview,.libtv-mention-thumb) :is(img,video) { object-fit:contain; }
  html body .image-tool-grid .generic-image-grid { grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); }
  html body #ccResults { flex:none; width:100%; }
  html body #ccResults>.cc-empty { width:min(100%,220px); aspect-ratio:9/16; height:auto; align-self:start; }
  html body .frame-tool-locked.empty { width:min(100%,150px); aspect-ratio:9/16; min-height:0; margin-inline:auto; }
  html body .workspace-sidebar.overview-mode { width:208px; flex-basis:208px; grid-template-columns:208px; }
  html body .workspace-sidebar.overview-mode.nav-collapsed { width:56px; flex-basis:56px; grid-template-columns:56px; }
  html body .overview-mode .task-sidebar { display:none; }
  #desktopOverview h1 { margin:0 0 16px; }
  .overview-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
  #overviewSearch { flex:1; min-width:180px; }
  #overviewCount { margin:12px 0; color:var(--bc-muted); }
  #overviewError:empty { display:none; }
  .overview-table-wrap { overflow:auto; border:1px solid var(--bc-border); border-radius:8px; background:var(--bc-surface); }
  .overview-task-link { text-align:left; border:0; padding:0; background:transparent; color:var(--bc-text); cursor:pointer; }
  .overview-task-link:hover { text-decoration:underline; }
  #overviewRows td { white-space:nowrap; }
  /* One pinned navigation: each product owns its expanding three-step group. */
  html body #replicaTaskBar { position:sticky; top:0; z-index:40; min-height:48px; margin:-14px -14px 14px; padding:6px 14px; background:var(--bc-canvas); border-bottom:1px solid var(--bc-border); gap:10px; }
  html body #replicaTaskBar #btnBackToSource { flex:none; height:32px; border-color:transparent!important; background:transparent!important; }
  html body #replicaTaskBar #btnBackToSource[aria-current=page] { background:var(--bc-selected)!important; color:var(--bc-text)!important; }
  html body #btnOpenProducts,html body #btnChooseProduct,html body #replicaProductWorkspace>.replica-stage-bar { display:none!important; }
  html body #replicaTaskBar #productBranchRailMount { flex:1; min-width:0; }
  html body #replicaTaskBar .product-branch-rail { flex-wrap:nowrap; gap:8px; padding:0; margin:0; border:0; min-width:0; }
  html body #replicaTaskBar .product-branch-tabs { flex:1; min-width:0; flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; padding:2px 0; scrollbar-width:thin; }
  html body #replicaTaskBar .product-branch-head { flex:none; margin:0; }
  html body #replicaTaskBar .product-branch-item { align-items:center; }
  html body #replicaTaskBar .product-branch-tab { height:30px; max-width:138px; white-space:nowrap; }
  html body #replicaTaskBar .product-branch-name { overflow:hidden; text-overflow:ellipsis; }
  html body #replicaTaskBar .product-branch-action { padding:4px; width:24px; min-width:24px; height:28px; }
  html body #replicaTaskBar .product-branch-tab small:empty { display:none; }
  html body #replicaTaskBar .product-branch-actions { opacity:0; transition:opacity 120ms; }
  html body #replicaTaskBar .product-branch-item:is(:hover,:focus-within) .product-branch-actions { opacity:1; }
  .replica-product-steps { width:222px; max-width:0; opacity:0; overflow:hidden; transition:max-width 240ms ease,opacity 180ms ease; }
  .steps-expanded>.replica-product-steps { max-width:222px; opacity:1; }
  .replica-product-steps-inner { display:flex; width:222px; align-items:center; padding:0 4px; gap:2px; }
  html body .replica-product-steps button { flex:none; font-size:12px; line-height:20px; height:26px; padding:0 8px; border:0; border-radius:4px; background:transparent; color:var(--bc-muted); white-space:nowrap; }
  html body .replica-product-steps button[aria-current=step] { background:var(--bc-selected); color:var(--bc-text); }
  html body #replicaProductWorkspace { border:0; padding:0; }
  html body #replica-source { scroll-margin-top:60px; }
  html body #replicaAnalysisHint { margin:6px 0 0; }
  @media(prefers-reduced-motion:reduce) { .replica-product-steps { transition:none; } }
  #desktopOverview :is(th,td):nth-child(3) { text-align:left; }
  /* Product buttons and their subordinate steps have distinct visual weights. */
  html body #replicaTaskBar { gap:12px; margin-bottom:10px; }
  html body #replicaTaskBar .product-branch-tabs { gap:8px; scrollbar-width:none; }
  html body #replicaTaskBar .product-branch-tabs::-webkit-scrollbar { display:none; }
  html body #replicaTaskBar .product-branch-item { flex:none; gap:0; border:0!important; background:transparent!important; box-shadow:none; }
  html body #replicaTaskBar .product-branch-tab { flex:none; width:104px; min-width:104px; height:32px; padding:0 10px; border:1px solid var(--bc-border); border-radius:6px; justify-content:center; cursor:pointer; transition:background 160ms,transform 160ms,border-color 160ms; }
  html body #replicaTaskBar .product-branch-name { cursor:pointer; user-select:none; font-weight:500; }
  html body #replicaTaskBar .product-branch-tab:hover { background:var(--bc-hover)!important; border-color:var(--bc-muted); transform:translateY(-1px); }
  html body #replicaTaskBar .product-branch-tab.active { background:var(--bc-primary)!important; color:var(--bc-primary-text)!important; border-color:var(--bc-primary); }
  html body #replicaTaskBar .product-branch-name-input { box-sizing:border-box; flex:none; width:var(--branch-name-width,104px)!important; min-width:var(--branch-name-width,104px)!important; max-width:var(--branch-name-width,104px)!important; height:32px; min-height:32px; padding:0 10px; margin:0; font-size:12px; border-radius:6px; }
  html body #replicaTaskBar .product-branch-actions { display:none; border:0; margin:0; padding:0; opacity:1; }
  html body #replicaTaskBar .steps-expanded .product-branch-actions { display:flex; }
  html body #replicaTaskBar .replica-product-steps-inner { padding-left:8px; }
  html body #replicaTaskBar .replica-product-steps button { border-radius:0; height:30px; background:transparent; border-bottom:2px solid transparent; padding:0 7px; }
  html body #replicaTaskBar .replica-product-steps button:hover { color:var(--bc-text); background:var(--bc-hover); }
  html body #replicaTaskBar .replica-product-steps button[aria-current=step] { background:transparent; border-bottom-color:var(--bc-text); font-weight:600; }
  /* Bound portrait previews by desktop height instead of growing with wide columns. */
  html body .frame-edit-layout { --frame-preview-width:min(100%,calc((100dvh - 245px)*9/16)); align-items:start; }
  html body .frame-edit-layout>.card { padding:10px; height:auto; }
  html body .frame-edit-layout>.card>.card-header { height:26px; min-height:26px; margin-bottom:8px; }
  html body .frame-edit-layout #frameOverrideDrop { width:var(--frame-preview-width); margin:0 auto; padding:0; border:0; background:transparent; }
  html body .frame-edit-layout #framePreview { display:block; width:100%!important; margin:0; border-radius:6px; }
  html body .frame-edit-layout :is(.edit-result-placeholder,.image-history-card>img) { width:var(--frame-preview-width)!important; margin:0 auto; padding:0; border-radius:6px; }
  html body .frame-edit-layout .frame-actions { position:static; width:100%; display:flex; flex-wrap:wrap; justify-content:center; gap:6px; padding:0; margin:10px 0 0; background:transparent; }
  html body #editHistoryHint { display:block; text-align:center; font-size:12px; color:var(--bc-muted); margin-top:10px; }
  html body #editHistoryEmpty.hidden~#editHistoryHint { display:none; }
  html body #prodRefSlots { grid-template-columns:repeat(3,minmax(0,1fr)); width:min(100%,calc(clamp(76px,11dvh,108px)*27/16 + 16px)); margin:0 auto; gap:8px; }
  html body .frame-product-card .product-edit-prompt { margin-top:10px; padding-top:10px; }
  html body .frame-generate-settings { margin-top:8px; padding-top:8px; }
  html body .frame-generate-settings .img-option-row { margin-bottom:5px; }
  html body .frame-generate-settings .img-opts { margin-top:6px; gap:4px; }
  html body .frame-edit-layout .image-history-actions { margin-top:10px; }
  html body .frame-edit-layout .image-history-actions>:is(a,button) { min-height:28px; height:28px; }
  /* Keep the result beside its inputs, using the former empty right column. */
  html body .script-grid-v2 { align-items:start; margin-top:8px; gap:12px; }
  html body .script-left { gap:8px; }
  html body .script-block { padding:8px; }
  html body .script-left .img-slots { width:100%; gap:6px; align-items:start; }
  html body .script-left .img-slot { width:min(100%,calc(clamp(88px,14dvh,126px)*9/16)); justify-self:center; margin-inline:auto; }
  html body .script-left .script-block h3 { margin:0 0 6px; }
  html body #replica-script #scriptPrompt { min-height:80px; }
  html body #replica-script .script-right { gap:6px; }
  html body #replica-script .script-right>.card-header { margin:6px 0 0!important; min-height:28px; flex:none; }
  html body #replica-script #scriptResult { min-height:160px; }
  html body #replica-script .script-action-panel { padding:8px; }
  html body .script-action-controls { gap:6px; }
  html body #tab-analyze .img-slot { overflow:visible; }
  html body #tab-analyze .img-slots:has(.slot-delete) .img-slot { margin-bottom:24px; }
  html body #tab-analyze .slot-delete { top:calc(100% + 3px); right:0; width:20px; height:20px; min-height:20px; padding:2px; border:0; border-radius:4px; box-shadow:none; background:transparent!important; color:var(--bc-muted)!important; }
  html body #tab-analyze .slot-delete:hover { background:var(--bc-hover)!important; color:var(--bc-error)!important; }
  /* Short independent tools use available columns before adding page height. */
  html body .analyze-tool-grid .analyze-video-card { grid-column:1; grid-row:1; }
  html body .analyze-tool-grid .analyze-prompt-card { grid-column:2; grid-row:1; }
  html body .analyze-tool-grid .analyze-transcript-card { grid-column:1; grid-row:2; }
  html body .analyze-tool-grid .analyze-result-card { grid-column:2; grid-row:2; }
  html body .analyze-tool-grid :is(#analyzeToolTranscript,#analyzeToolResult) { min-height:140px; }
  html body .standalone-workspace .standalone-controls { gap:8px; margin-top:8px; }
  html body .standalone-workspace .standalone-field { min-width:0; }
  html body .analyze-prompt-card .standalone-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body .analyze-prompt-card .standalone-controls>.standalone-field:first-child { grid-column:1/-1; }
  html body .analyze-prompt-card .standalone-controls>button { align-self:end; }
  html body .segment-tool-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); padding:0; align-items:start; }
  html body .segment-tool-grid .segment-video-card { grid-column:1; grid-row:1/3; }
  html body .segment-tool-grid .segment-config-card { grid-column:2; grid-row:1; }
  html body .segment-tool-grid .segment-result-card { grid-column:2; grid-row:2; }
  html body .standalone-drop:not(.has-media) { width:min(100%,180px); }
  html body .standalone-drop :is(video,img) { width:min(100%,180px); }
  html body .frame-image-tool-grid { grid-template-columns:repeat(3,minmax(0,1fr)); align-items:start; }
  html body .frame-image-tool-grid>.standalone-card { padding:10px; }
  html body .frame-image-tool-grid>.standalone-card:first-child { display:grid; grid-template-columns:1fr; gap:8px; }
  html body .frame-image-tool-grid .frame-tool-timeline { display:flex; flex-wrap:wrap; gap:6px; }
  html body #frameToolDrop { width:min(100%,140px); }
  html body #frameToolDrop video { width:100%; }
  html body #frameToolLockedPreview { width:min(100%,88px); min-height:0; margin:auto; }
  html body #frameToolLockedPreview img { width:100%; }
  html body .frame-tool-editor { gap:8px; }
  html body #frameToolImageDrop { width:min(100%,120px); padding:10px; }
  html body .frame-tool-editor .standalone-option-row { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  html body .frame-tool-editor .standalone-actions { gap:6px; flex-wrap:wrap; }
  html body .frame-tool-editor .generic-image-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body .frame-image-tool-grid .standalone-result-image { width:100%; padding:0; }
  html body #characterCreationView .cc-layout { align-items:start; }
  html body #characterCreationView .cc-panel { height:auto!important; }
  html body #characterCreationView :is(textarea,.cc-brief-wrap) { flex:none!important; }
  html body #characterCreationView .cc-writing { gap:6px; }
  @media(prefers-reduced-motion:reduce) { html body #replicaTaskBar .product-branch-tab { transition:none; transform:none; } }
  /* Sidebar toggles are explicit; changing sidebar width does not size the media. */
  html body .desktop-nav-collapse { flex:none; height:28px; margin:0 4px 8px; border:1px solid var(--bc-border); border-radius:5px; background:var(--bc-surface); color:var(--bc-muted); font-size:12px; cursor:pointer; }
  html body .nav-collapsed .desktop-nav-collapse { margin-inline:0; font-size:10px; }
  html body .desktop-brand>.bc-brand-mark { display:flex; align-items:center; justify-content:center; }
  html body .nav-collapsed .desktop-brand>.bc-brand-mark { display:flex; }
  html body .desktop-task-collapse { width:78px; padding:0 5px; font-size:11px; }
  html body .context-head { padding-right:84px; }
  html body .tasks-collapsed .desktop-task-collapse { width:28px; height:84px; padding:6px 3px; writing-mode:vertical-rl; letter-spacing:2px; }
  html body #tab-analyze { --desktop-work-height:calc(100dvh - 73px); --desktop-thumb-width:clamp(54px,calc((100vw - 810px)/9),82px); }
  html body .frame-edit-layout { --frame-preview-width:min(calc((100vw - 666px)/3),calc((100dvh - 235px)*9/16)); min-height:var(--desktop-work-height); align-items:stretch; }
  html body .frame-edit-layout>.card { display:flex; flex-direction:column; min-height:var(--desktop-work-height); }
  html body .frame-edit-layout .frame-actions { margin-top:auto; padding-top:10px; min-height:72px; align-content:end; }
  html body .frame-edit-layout .product-edit-prompt { flex:1; display:flex; flex-direction:column; }
  html body .frame-edit-layout #editPrompt { flex:1 1 0!important; min-height:max(80px,var(--desktop-text-height,80px)); }
  html body .frame-edit-layout #editHistoryHint { margin-top:auto; padding-top:10px; min-height:62px; display:flex; align-items:end; justify-content:center; }
  html body .frame-edit-layout #editHistoryEmpty.hidden~#editHistoryHint { display:none; }
  html body .frame-edit-layout .image-history-actions { min-height:62px; align-content:end; }
  html body .desktop-slot-strip { display:flex; align-items:start; min-width:0; gap:6px; }
  html body #tab-analyze :is(#prodRefSlots,#productSlots) { display:flex; flex:1; flex-wrap:nowrap; justify-content:flex-start; width:0; min-width:0; max-width:100%; margin:0; gap:8px; overflow-x:auto; overflow-y:hidden; padding:1px 1px 28px; scrollbar-width:thin; }
  html body #tab-analyze #prodRefSlots .img-slot { flex:0 0 calc((100% - 16px)/3); width:calc((100% - 16px)/3); min-width:0; margin:0!important; }
  html body #tab-analyze #productSlots .img-slot { flex:0 0 min(calc((100% - 32px)/5),var(--script-slot-width)); width:min(calc((100% - 32px)/5),var(--script-slot-width)); min-width:0; margin:0!important; }
  html body #tab-analyze .desktop-slot-hidden { display:none!important; }
  html body .desktop-slot-add { flex:0 0 24px; width:24px; height:26px; padding:0; border:1px solid var(--bc-border); border-radius:5px; background:var(--bc-surface); color:var(--bc-muted); font-size:18px; cursor:pointer; }
  html body .desktop-slot-add:hover { color:var(--bc-text); background:var(--bc-hover); }
  html body .desktop-slot-add:disabled { opacity:.35; cursor:default; }
  html body #replica-script>.card { min-height:var(--desktop-work-height); display:flex; flex-direction:column; }
  html body #replica-script .script-grid-v2 { flex:1; align-items:stretch; }
  html body #replica-script .script-left { --script-slot-width:clamp(76px,calc((100dvh - 450px)*9/32),170px); grid-template-rows:auto auto minmax(140px,1fr); }
  html body #replica-script .script-left .img-slot { width:min(100%,var(--script-slot-width)); max-width:100%; margin-bottom:24px; }
  html body #replica-script .script-left .script-frame-block .img-slot { margin-inline:0; justify-self:start; }
  html body #replica-script .script-note-block .img-slots { display:flex; justify-content:space-between; gap:8px; }
  html body #replica-script .script-note-block .img-slot { flex:0 1 var(--script-slot-width); margin-inline:0; }
  html body #replica-script #productSlots { padding-inline:0; justify-content:space-between; }
  html body #replica-script .script-voice-block { min-height:0; }
  html body #replica-script #scriptText { flex:1 1 0!important; min-height:max(100px,var(--desktop-text-height,100px)); }
  html body #replica-script #scriptResult { flex:1 1 0!important; min-height:max(160px,var(--desktop-text-height,160px)); }
  html body #replica-script .desktop-script-output { flex:1; min-height:0; gap:6px; }
  html body #replica-script .desktop-script-output>.card-header { margin:0!important; min-height:28px; flex:none; }
  /* Shared source and analysis use exactly the same column tracks. */
  html body #replica-source { grid-template-columns:minmax(240px,.8fr) minmax(0,1.2fr); align-items:stretch; }
  html body #replica-source>#replicaAnalysisGroup { grid-template-columns:subgrid; }
  html body #uploadArea.desktop-upload-card { display:flex; flex-direction:column; min-width:0; margin:0; padding:12px; border:1px solid var(--bc-border); border-radius:8px; background:var(--bc-surface); }
  html body #uploadArea.desktop-upload-card #dropZone { border:0; padding:0; margin:0 auto; width:fit-content; max-width:100%; background:transparent; box-shadow:none; }
  html body #uploadArea.desktop-upload-card:has(#uploadPlayer.hidden) #dropZone { border:1px dashed var(--bc-border); border-radius:6px; }
  html body #uploadArea .upload-player-footer { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; }
  html body #uploadArea .upload-player-footer .filename { display:none; }
  html body #uploadArea .upload-player-actions { justify-content:center; flex-wrap:nowrap; }
  html body #uploadArea .upload-player-actions button { white-space:nowrap; height:28px; padding:0 10px; }
  html body #uploadArea:has(#uploadPlayer.hidden) :is(#btnDlAudio,#btnReplaceVideo) { display:none; }
  html body #uploadArea>.btn-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:8px; padding-top:0; margin:8px 0 0; }
  html body #uploadArea>.btn-row:not(:has(#status:not(:empty))) { display:none; }
  html body #uploadArea #sourceVideoPreview { height:clamp(240px,calc((100dvh - 120px)*.48),430px)!important; width:auto; max-width:100%; }
  html body #uploadArea #status { flex:0 1 100%; text-align:center; overflow-wrap:anywhere; }
  html body #replica-source.source-confirmed { min-height:var(--desktop-work-height); grid-template-rows:auto minmax(0,1fr); }
  html body #replicaTranscriptGroup { grid-template-rows:minmax(220px,1.3fr) minmax(180px,1fr); }
  html body #replicaQuickEditCard { display:flex; flex-direction:column; }
  html body #replicaQuickEditCard .segments { flex:1; margin-bottom:0; }
  html body #replicaFinalTranscriptCard { display:flex; flex-direction:column; }
  html body #replicaFinalTranscriptCard .transcript-card-head { display:flex; flex-wrap:nowrap; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
  html body #replicaFinalTranscriptCard .transcript-card-head h2 { white-space:nowrap; flex:none; }
  html body #replicaFinalTranscriptCard .transcript-language-row { width:auto; min-width:0; }
  html body #replicaFinalTranscriptCard .asr-language-control { flex-direction:row; flex-wrap:nowrap; gap:6px; min-width:0; }
  html body #replicaFinalTranscriptCard #asrLanguage { min-width:0; width:112px; }
  html body #replicaFinalTranscriptCard .transcript-actions { display:grid; grid-template-columns:1.3fr .85fr 1.1fr 1fr; gap:5px; margin:0 0 8px; }
  html:root[data-theme] body #replicaFinalTranscriptCard .transcript-actions button { padding:0 4px; height:28px; font-size:11px; white-space:nowrap; background:var(--bc-surface)!important; color:var(--bc-text)!important; border:1px solid var(--bc-border)!important; box-shadow:none; }
  html body #replicaFinalTranscriptCard #analyzeText { flex:1 1 0!important; min-height:max(80px,var(--desktop-text-height,80px)); margin:0; }
  html body #analyzeLegend { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
  html body #analyzeLegend>span { display:inline-flex; align-items:center; }
  html body #analyzeLegend .speaker-tag { display:inline-flex; align-items:center; justify-content:center; gap:4px; height:26px; padding:0 10px; margin:0; line-height:24px; border:1px solid var(--bc-border); border-radius:5px; box-sizing:border-box; }
  html body #replicaAnalysisGroup>.left { display:flex; flex-direction:column; }
  html body .desktop-field-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  html body .desktop-field-heading>.desktop-text-tools { margin:0 0 0 auto; }
  html body #replicaAnalysisGroup #analyzePrompt { flex:1 1 0!important; min-height:max(120px,var(--desktop-text-height,120px)); }
  html body .desktop-analysis-fields { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:8px 0; }
  html body .desktop-analysis-fields label { display:grid; grid-template-columns:60px minmax(0,1fr); align-items:center; gap:8px; }
  html body .desktop-analysis-fields label:first-child { grid-column:1/-1; }
  html body .standalone-field:has(>select) { display:grid; grid-template-columns:max-content minmax(0,1fr); align-items:center; gap:8px; }
  html body .standalone-field:has(>select)>label { flex:none; margin:0; }
  html body .standalone-field>select { flex:1; min-width:0; }
  html body .standalone-workspace :is(.standalone-option-row,.segment-settings-grid,.standalone-controls:has(>.standalone-field>select)) { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr)); gap:8px; }
  html body .standalone-field>[id$=SamplingHint] { grid-column:1/-1; }
  html body #characterCreationView .cc-video-settings { grid-template-columns:minmax(0,1fr); gap:6px; }
  html body #characterCreationView .cc-video-settings>label { display:grid; grid-template-columns:56px minmax(0,1fr); align-items:center; gap:8px; }
  html body #characterCreationView .cc-footnote { display:none; }
  html body .segment-result-card>.standalone-section-head { flex-wrap:wrap; gap:8px; }
  html body .segment-result-card>.standalone-section-head h2 { flex:none; }
  html body .segment-settings-grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; align-items:center; }
  html body .segment-settings-grid>.standalone-field:has(#segmentToolModel) { grid-column:1/-1; grid-row:1; grid-template-columns:max-content minmax(0,1fr) max-content minmax(100px,.4fr); }
  html body .segment-config-footer { display:flex; flex-wrap:wrap; gap:8px; }
  html body #replica-script .script-action-controls { grid-template-columns:minmax(0,1fr); }
  html body #replica-script .script-action-field { display:grid; grid-template-columns:65px minmax(0,1fr); gap:8px; align-items:center; }
  html body #replica-script .script-action-field label { margin:0; }
  html body :is(#analyzeStatus,#status,#vgGenStatus,[id$=SamplingHint]):empty { display:none; }
  html body .desktop-nav-collapse { box-sizing:border-box; min-width:0; padding:0 4px; white-space:nowrap; line-height:26px; overflow:hidden; }
  html body .nav-collapsed .desktop-nav-collapse { width:100%; padding:0; }
  /* Paint the paste affordance inside its target, including scrollable strips. */
  html body .material-paste-target.paste-ready { outline:2px solid var(--bc-muted); outline-offset:-2px; box-shadow:inset 0 0 0 3px var(--bc-hover); }
  /* Stable image-tool tracks: adding references scrolls only the material row. */
  html body :is(#imageToolView,#frameImageToolView)>.standalone-hero { display:none; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid) { --image-strip-height:clamp(220px,30dvh,320px); min-height:calc(100dvh - 28px); align-items:stretch; }
  html body :is(#imageToolView,#frameImageToolView) .image-tool-grid { grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); }
  html body :is(#imageToolView,#frameImageToolView) .frame-image-tool-grid { grid-template-columns:minmax(220px,.65fr) minmax(0,1.55fr) minmax(240px,.85fr); }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid)>.standalone-card { display:flex; flex-direction:column; min-width:0; min-height:calc(100dvh - 28px); padding:12px; gap:10px; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid) h2 { margin:0; }
  html body :is(#imageToolView,#frameImageToolView) .frame-tool-editor { display:flex; flex-direction:column; flex:1; min-width:0; gap:10px; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip { display:flex; flex:none; height:var(--image-strip-height); min-width:0; gap:8px; overflow-x:auto; overflow-y:hidden; padding:2px 2px 20px; scrollbar-width:thin; align-items:start; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip .generic-image-grid { display:contents; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip :is(.standalone-ref-slot,.desktop-image-add,#frameToolLockedPreview) { box-sizing:border-box; flex:0 0 auto; width:auto!important; height:calc(var(--image-strip-height) - 24px)!important; aspect-ratio:9/16; min-height:0!important; margin:0!important; padding:0!important; border:1px dashed var(--bc-border); border-radius:6px; background:var(--bc-surface); }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip .standalone-ref-slot:not(:has(img)) { display:none; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip .standalone-ref-slot img { width:100%; height:100%; object-fit:contain; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-strip .desktop-image-add { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:8px; cursor:pointer; color:var(--bc-muted); }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-add>span { font-size:24px; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-add>strong { font-size:12px; font-weight:500; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-add:hover { background:var(--bc-hover); color:var(--bc-text); }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-tool-editor)>.standalone-field:has(textarea),html body :is(#imageToolView,#frameImageToolView) .image-tool-grid .image-tool-prompt { flex:1; display:flex; flex-direction:column; gap:8px; margin:0; }
  html body :is(#imageToolView,#frameImageToolView) :is(#imageToolPrompt,#frameToolPrompt) { flex:1 1 0!important; height:160px; min-height:max(160px,var(--desktop-text-height,160px)); margin:0; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-tool-editor) .standalone-option-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px 12px; margin:0; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-tool-editor) .standalone-option-row>.standalone-field { display:grid; grid-template-columns:52px minmax(0,1fr); align-items:center; gap:6px; }
  html body :is(#imageToolView,#frameImageToolView) .standalone-option-row>.standalone-field>label { white-space:nowrap; margin:0; }
  html body :is(#imageToolView,#frameImageToolView) select.desktop-native-options { display:none!important; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options { display:flex; min-width:0; border:1px solid var(--bc-border); border-radius:5px; overflow:hidden; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button { flex:1; min-width:0; height:30px; padding:0 4px; border:0; border-right:1px solid var(--bc-border); background:var(--bc-surface); color:var(--bc-text); font:inherit; font-size:12px; white-space:nowrap; cursor:pointer; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button:last-child { border-right:0; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button:hover { background:var(--bc-hover); }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button[aria-pressed=true] { background:var(--bc-selected); font-weight:600; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button:focus-visible { outline:2px solid var(--bc-text); outline-offset:-3px; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-image-options button:disabled { opacity:.45; cursor:default; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-tool-editor) .standalone-actions { margin:0; gap:8px; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid) .standalone-result-image:not(:has(img)) { width:min(100%,calc((100dvh - 106px)*9/16)); margin:0 auto; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolDrop { width:min(100%,calc((100dvh - 360px)*9/16)); margin:0 auto; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolLockedPreview { position:relative; display:flex; align-items:center; justify-content:center; overflow:hidden; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolLockedPreview img { width:100%; height:100%; object-fit:contain; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolLockedPreview>div { position:absolute; bottom:6px; left:6px; right:6px; padding:4px; background:var(--bc-surface); font-size:11px; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolLockedPreview .tip { display:none; }
  html body :is(#imageToolView,#frameImageToolView) .frame-tool-timeline { margin-top:auto; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolDrop.has-media { display:block; padding:0; aspect-ratio:9/16; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolDrop.has-media>:is(strong,span) { display:none; }
  html body :is(#imageToolView,#frameImageToolView) #frameToolDrop video { width:100%; height:auto!important; margin:0; }
}

/* Runtime-stable desktop stages: pending text and completed metadata own space
   from the first paint; full text stays in the editors. */
@media (min-width:769px) {
  html body #tab-analyze { --desktop-work-height:max(760px,calc(100dvh - 73px)); }
  html body #replica-source:not(.source-confirmed) #uploadArea { min-height:var(--desktop-work-height); }
  html body #replica-source:not(.source-confirmed) #sourceVideoPreview { height:max(260px,calc(100dvh - 370px))!important; }
  html body #replica-source.source-empty .upload-empty-state { width:auto; height:min(660px,calc(100dvh - 190px)); }
  html body #replica-source:not(.source-confirmed) #replicaTrimPanel { margin-top:auto; }
  html body #tab-analyze :is(#analyzeStatus,#scriptStatus,#vgGenStatus,#editStatus) {
    display:block!important; box-sizing:border-box; min-height:40px; height:40px; max-height:40px;
    line-height:20px; margin:6px 0 0; overflow:auto; overflow-wrap:anywhere;
  }
  html body .frame-edit-layout { --frame-preview-width:min(100%,calc((var(--desktop-work-height) - 332px)*9/16)); height:var(--desktop-work-height); min-height:0; }
  html body .frame-edit-layout>.card { height:100%; min-height:0; }
  html body .frame-edit-layout>.card>.card-header { height:32px; min-height:32px; flex:none; }
  html body .frame-edit-layout :is(#frameOverrideDrop,.edit-result-placeholder,.image-history-card>img) { width:var(--frame-preview-width)!important; flex:none; aspect-ratio:9/16; }
  html body .frame-edit-layout #frameOverrideDrop { height:auto; }
  html body .frame-edit-layout .edit-result-placeholder { display:grid; place-items:center; color:var(--bc-muted); }
  html body .frame-edit-layout #editHistoryHint { display:none!important; }
  html body .frame-edit-layout #editedBox { overflow:visible; min-height:0; flex:none; }
  html body .frame-edit-layout #editHistoryGrid { display:block; }
  html body .frame-edit-layout .image-history-actions { min-height:36px; height:36px; align-content:center; margin-top:8px; }
  html body .frame-edit-layout .edit-result-details { min-height:110px; margin:8px 0 0; font-size:12px; line-height:20px; }
  html body .frame-edit-layout .edit-result-details>div { margin:0; min-height:20px; }
  html body .frame-edit-layout #editAttemptStatus { flex:1; min-width:0; margin:0; padding:0; display:flex; align-items:center; }
  html body .frame-edit-layout #editPrompt { min-height:60px!important; height:0!important; overflow:auto; }
  html body .frame-edit-layout .frame-actions { min-height:44px; }
  html body #replica-script>.card { height:var(--desktop-work-height); min-height:800px; position:relative; }
  html body #replica-script .script-grid-v2 { --script-top-height:clamp(290px,calc(var(--desktop-work-height)*.38),360px); min-height:0; }
  html body #replica-script .script-left { min-height:0; grid-template-rows:var(--script-top-height) minmax(0,1fr) 140px; gap:8px; }
  html body #replica-script .script-right { display:grid; grid-template-rows:auto minmax(180px,1fr); min-height:0; gap:8px; }
  html body #replica-script .desktop-script-inputs { min-height:0; display:flex; flex-direction:column; gap:6px; }
  html body #replica-script .desktop-script-inputs>h3 { flex:none; margin:0; }
  html body #replica-script .desktop-script-inputs>.tip { display:none; }
  html body #replica-script #scriptPrompt { flex:none!important; min-height:80px!important; height:80px!important; }
  html body #replica-script #demandNotes { flex:none!important; min-height:64px!important; height:64px!important; }
  html body #replica-script .desktop-script-heading { min-height:32px; padding-right:380px; }
  html body #replica-script .desktop-demand-actions { position:absolute; top:12px; right:12px; display:flex; gap:8px; height:32px; align-items:center; }
  html body #replica-script .desktop-demand-actions .dq-task-link { margin:0; }
  html body #replica-script .desktop-demand-actions .hidden { display:inline-flex!important; visibility:hidden; pointer-events:none; }
  html body #replica-script .script-action-panel { flex:none; margin:0; }
  html body #replica-script .script-left .script-block { min-height:0; }
  html body #replica-script .script-left .img-slot { max-height:calc(var(--script-top-height) - 66px); width:min(100%,calc((var(--script-top-height) - 66px)*9/16)); }
  html body #replica-script .script-note-block .img-slot { flex:0 1 calc((var(--script-top-height) - 66px)*9/16); }
  html body #replica-script .script-product-block { display:flex; flex-direction:column; }
  html body #replica-script .script-product-block .desktop-slot-strip { min-height:0; flex:1; }
  html body #replica-script #productSlots { height:100%; align-items:start; }
  html body #replica-script #productSlots .img-slot { flex-basis:calc((100% - 32px)/5); width:calc((100% - 32px)/5); max-height:calc(100% - 28px); }
  html body #replica-script :is(#scriptText,#scriptResult) { flex:1 1 0!important; min-height:0!important; height:0!important; }
  html body #replica-script textarea { overflow:auto!important; resize:none; }
  html body #replica-script .desktop-script-output { display:flex; flex-direction:column; min-height:0; }
  html body #replica-video #vgGenStatus { display:block!important; }
  html body #replica-video #sessionCostLine { display:block!important; min-height:20px; line-height:20px; }
  html body .standalone-workspace :is(.standalone-status,.standalone-result-status) { min-height:40px; height:40px; line-height:20px; overflow:auto; }
}

/* Shared media controls and bounded desktop tool workspaces. */
@media (min-width:769px) {
  html body .tool-rail .tool-mode-btn:not(.theme-toggle) { transition:background-color var(--bc-motion,120ms) var(--bc-ease,ease),color var(--bc-motion,120ms) var(--bc-ease,ease); }
  html body .tool-rail .tool-mode-btn:not(.theme-toggle):hover { background:var(--bc-hover)!important; color:var(--bc-text)!important; }
  html body #tab-analyze .img-slots:has(.slot-delete) .img-slot { margin-bottom:0; }
  html body #tab-analyze .slot-delete,
  html body .standalone-ref-slot>button:not(.image-reference-preview),
  html body .cc-note-media>button { position:absolute; top:auto!important; bottom:6px!important; right:6px!important; width:26px!important; height:26px!important; min-height:26px!important; padding:3px!important; border:1px solid var(--bc-border)!important; border-radius:5px; background:var(--bc-surface)!important; color:var(--bc-muted)!important; z-index:3; }
  html body :is(.slot-delete,.standalone-ref-slot>button:not(.image-reference-preview),.cc-note-media>button):hover { color:var(--bc-error)!important; background:var(--bc-hover)!important; }
  html body .standalone-ref-slot,html body .libtv-material-preview { position:relative; }
  html body .libtv-material-preview [data-libtv-action=remove] { position:absolute; bottom:6px; right:6px; width:26px; height:26px; padding:3px; border:1px solid var(--bc-border); border-radius:5px; background:var(--bc-surface); color:var(--bc-muted); }
  html body .dq-drop .dq-slot-actions { bottom:6px; right:6px; }
  html body #replica-script .script-left { grid-template-rows:var(--script-top-height) minmax(0,1fr) 195px; }
  html body #replica-script .script-product-block .desktop-slot-strip { flex:none; height:100%; }
  html body #replica-script #productSlots .img-slot { max-height:100%; }
  html body #replica-script .desktop-script-run { display:flex; align-items:center; gap:10px; margin-top:6px; min-height:40px; }
  html body #replica-script .desktop-script-run #scriptStatus { flex:1; min-width:0; margin:0; display:flex!important; align-items:center; gap:4px; }
  html body #replica-script .desktop-script-run #btnGenScript { flex:none; margin:0; }
  html body .frame-product-card .desktop-slot-strip { margin-bottom:0; padding-bottom:2px; }

  html body :is(#imageToolView,#frameImageToolView) { --tool-height:max(740px,calc(100dvh - 28px)); --tool-media-height:calc(var(--tool-height) - 194px); }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid) { flex:none; height:var(--tool-height); min-height:0; grid-template-rows:minmax(0,1fr); --image-strip-height:clamp(210px,26dvh,270px); }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-grid,.frame-image-tool-grid)>.standalone-card { height:100%; min-height:0; position:relative; }
  html body #frameImageToolView .frame-image-tool-grid { grid-template-columns:minmax(0,1fr) minmax(0,1.16fr) minmax(0,1fr); }
  html body #imageToolView .image-tool-grid { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); }
  html body :is(#imageToolView,#frameImageToolView) .frame-tool-editor { min-height:0; }
  html body :is(#imageToolView,#frameImageToolView) :is(.image-tool-prompt,.standalone-field:has(textarea)) { min-height:0; }
  html body :is(#imageToolPrompt,#frameToolPrompt) { height:0!important; min-height:80px!important; flex:1 1 0!important; resize:none; overflow:auto!important; }
  html body :is(#imageToolView,#frameImageToolView) .standalone-option-row { flex:none; }
  html body #imageToolView .standalone-option-row { grid-template-columns:1fr 1fr; }
  html body #imageToolView .standalone-option-row>.standalone-field:has(#imageToolModel) { grid-column:1/-1; }
  html body #imageToolView .standalone-option-row>.standalone-field:has(#imageToolQuality) { grid-column:1/-1; }
  html body #frameImageToolView .frame-tool-editor .standalone-option-row { grid-template-columns:1fr; }
  html body #frameImageToolView .frame-tool-editor .standalone-option-row>.standalone-field { grid-template-columns:60px minmax(0,1fr); }
  html body :is(#imageToolView,#frameImageToolView) .standalone-option-row>.standalone-field { grid-template-columns:60px minmax(0,1fr); }
  html body :is(#imageToolModel,#frameToolModel) { width:100%; min-width:0; text-overflow:ellipsis; }
  html body :is(#imageToolView,#frameImageToolView) .standalone-status { display:block!important; flex:none; margin:0; }
  html body #frameImageToolView #frameToolDrop { flex:none; width:min(100%,calc(var(--tool-media-height)*9/16)); height:auto!important; min-height:0!important; aspect-ratio:9/16; padding:0; display:flex; align-items:center; justify-content:center; }
  html body #frameImageToolView #frameToolDrop video { width:100%!important; height:100%!important; max-height:none!important; aspect-ratio:9/16; object-fit:contain; }
  html body #frameImageToolView .frame-tool-timeline { flex:none; }
  html body :is(#imageToolView,#frameImageToolView) .desktop-tool-result { display:flex!important; flex-direction:column; flex:1; width:100%!important; min-height:0!important; height:auto!important; aspect-ratio:auto!important; padding:0!important; border:0!important; margin:0!important; background:transparent!important; overflow:visible; }
  html body .desktop-result-tabs { position:absolute; top:9px; right:12px; display:flex; gap:4px; max-width:65%; overflow-x:auto; height:32px; scrollbar-width:thin; }
  html body .desktop-result-tabs button { flex:none; min-width:28px; height:28px; padding:0 6px; }
  html body .desktop-result-tabs [aria-pressed=true] { background:var(--bc-primary)!important; color:var(--bc-primary-text)!important; }
  html body .desktop-tool-image { flex:1; min-height:0; display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; }
  html body .desktop-tool-media,html body .desktop-tool-empty { flex:none; width:min(100%,calc(var(--tool-media-height)*9/16)); aspect-ratio:9/16; padding:0; margin:0 auto; border:1px solid var(--bc-border); border-radius:6px; background:var(--bc-canvas); overflow:hidden; display:flex; align-items:center; justify-content:center; }
  html body .desktop-tool-media img { width:100%; height:100%; object-fit:contain; }
  html body #imageToolView { --tool-media-height:calc(var(--tool-height) - 150px); }
  html body .desktop-tool-footer { width:100%; min-height:76px; margin-top:auto; }
  html body .desktop-tool-footer .image-history-actions { display:flex; align-items:center; justify-content:center; gap:8px; }
  html body .desktop-tool-footer .image-history-actions :is(a,button) { box-sizing:border-box; flex:0 1 140px; height:32px!important; min-height:32px!important; padding:0 10px!important; display:inline-flex; align-items:center; justify-content:center; background:var(--bc-surface)!important; color:var(--bc-text)!important; border:1px solid var(--bc-border)!important; border-radius:6px; text-decoration:none; font:inherit; white-space:nowrap; }
  html body .desktop-tool-meta { margin-top:8px; height:40px; line-height:20px; overflow:auto; color:var(--bc-muted); font-size:11px; text-align:center; overflow-wrap:anywhere; }

  html body #characterCreationView { height:max(740px,calc(100dvh - 28px))!important; padding:0; }
  html body #characterCreationView .cc-layout { display:grid; min-height:0; height:0; flex:1; align-items:stretch; }
  html body #characterCreationView .cc-panel { align-self:stretch; height:100%; min-height:0; padding:12px; gap:8px; }
  html body #characterCreationView .cc-header { display:none; }
  html body #characterCreationView .cc-assets>.cc-section-head>a { color:var(--bc-muted); font-size:11px; white-space:nowrap; }
  html body #characterCreationView .cc-panel textarea { min-height:0!important; height:0!important; overflow:auto!important; resize:none; scrollbar-width:thin; }
  html body #characterCreationView .cc-panel textarea::-webkit-scrollbar { display:block; width:6px; }
  html body #characterCreationView #ccTranscript { flex:0 0 100px!important; }
  html body #characterCreationView .cc-brief-wrap { flex:0 0 140px!important; min-height:0; display:flex; }
  html body #characterCreationView #ccBrief { height:100%!important; flex:1!important; }
  html body #characterCreationView #ccScriptText { flex:1 1 0!important; }
  html body #characterCreationView #ccReferences { max-height:40px; overflow:auto; flex:none; }
  html body #characterCreationView #ccResults { height:0; min-height:0; flex:1; overflow:hidden; }
  html body #characterCreationView #ccResults video { width:min(100%,calc((100dvh - 350px)*9/16)); height:100%!important; max-height:100%!important; aspect-ratio:9/16; object-fit:contain; }
  html body #characterCreationView #ccResults>.cc-empty { width:min(100%,calc((100dvh - 350px)*9/16)); height:100%; align-self:stretch; }
  html body #characterCreationView .cc-video-settings { display:flex; flex-direction:column; flex:none; gap:6px; }
  html body #characterCreationView .cc-video-settings label { display:grid; grid-template-columns:62px minmax(0,1fr); align-items:center; }
  html body #characterCreationView .cc-video-settings select { margin:0; }
  html body #characterCreationView #ccProductPreview { display:flex; flex:none; min-height:0; height:clamp(110px,18dvh,190px); overflow-x:auto; }
  html body #characterCreationView #ccProductPreview:empty { display:none; }
  html body #characterCreationView #ccProductPreview img { flex:none; height:100%; width:auto; aspect-ratio:9/16; object-fit:contain; }
  html body #characterCreationView #ccNotes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); min-height:0; gap:8px; }
  html body #characterCreationView .cc-note-media,html body #characterCreationView .cc-note-add { position:relative; width:min(100%,101.25px); aspect-ratio:9/16; min-height:0; margin-inline:auto; border:1px dashed var(--bc-border); border-radius:6px; overflow:hidden; }
  html body #characterCreationView .cc-note-media img { width:100%; height:100%; object-fit:contain; }
  html body #characterCreationView .cc-note-add { display:flex; flex-direction:column; justify-content:center; gap:8px; background:var(--bc-surface); }
  html body #characterCreationView #ccUpload,html body #characterCreationView .cc-footnote { display:none; }
  html body #characterCreationView #ccStatus { height:40px; min-height:40px; white-space:normal; overflow:auto; }
  html body .viral-fission-input-grid .standalone-drop:not(.has-media) { width:115px; }
  html body .viral-fission-scroll .viral-empty { padding:8px; min-height:0; line-height:20px; }
  html body .viral-directions-grid>.viral-empty { grid-column:1/-1; }
  html body .viral-analysis-view:has(>.viral-empty) { min-height:0; }
  html body .viral-fission-scroll>.viral-result-card { padding:8px; margin-top:8px; }
  html body .viral-method-options .viral-method-index { display:none!important; }
  html body .viral-method-options .viral-method-option { grid-template-columns:minmax(0,1fr); padding:4px 8px; min-height:32px; }
}
@media (prefers-reduced-motion:reduce) { html body .tool-rail .tool-mode-btn { transition:none; } }

/* Shared overlays and desktop analysis workspaces. */
@media (min-width:769px) {
  html body #modal { padding:24px; overflow:hidden; }
  html body #modal img { width:auto!important; height:auto!important; max-width:min(1100px,calc(100vw - 48px))!important; max-height:calc(100dvh - 48px)!important; aspect-ratio:auto!important; object-fit:contain!important; flex:none; }
  html body #confirmMsg { color:var(--bc-text)!important; }
  html body #replicaTaskBar .product-branch-tabs { padding:4px; margin:-2px -4px; }
  html body #replicaTaskBar .product-branch-tab:hover { transform:none; box-shadow:inset 0 0 0 1px var(--bc-border); }
  html body :is(.slot-delete,.standalone-ref-slot>button:not(.image-reference-preview),.cc-note-media>button) { display:flex!important; align-items:center!important; justify-content:center!important; padding:0!important; line-height:1; }
  html body .slot-delete svg { display:block; width:14px!important; height:14px!important; margin:0!important; flex:none; }
  html body .frame-edit-layout { --frame-preview-width:min(100%,calc((var(--desktop-work-height) - 238px)*9/16)); }
  html body .frame-edit-layout #editAttemptStatus #editStatus { height:auto!important; min-height:0!important; max-height:none!important; margin:0!important; overflow:visible!important; line-height:18px; font-size:12px; }
  html body .frame-edit-layout .image-generate-bar { flex-wrap:wrap; }
  html body .frame-edit-layout #editAttemptStatus { flex:1 1 180px; min-width:min(180px,100%); }
  html body .frame-edit-layout .edit-history-card>.card-header { height:auto; min-height:32px; }
  html body .frame-edit-layout #editedBox,html body .frame-edit-layout #editHistoryGrid { flex:1; display:flex; min-height:0; }
  html body .frame-edit-layout .image-history-card { flex:1; display:flex; flex-direction:column; }
  html body .frame-edit-layout .edit-result-details { margin-top:auto; padding-top:8px; flex:none; }
  html body #frameToolResult .desktop-tool-media img { width:100%!important; height:100%!important; object-fit:cover; border-radius:inherit; }
  html body #frameToolResult .desktop-tool-media { padding:0!important; border:0; overflow:hidden; }
  html body :is(#characterCreationView #ccPicker,#vfProductPicker) { position:fixed; inset:0; transform:none; margin:auto; width:min(880px,calc(100vw - 48px)); height:min(680px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px); padding:20px; overflow:hidden; }
  html body :is(#characterCreationView #ccPicker,#vfProductPicker)[open] { display:flex; flex-direction:column; gap:10px; }
  html body :is(#ccPicker,#vfProductPicker) :is(form,.cc-search,.cc-picker-pages,#ccPickerStatus) { flex:none; margin:0; }
  html body :is(#ccPicker #ccPickerItems,#vfProductPicker .cc-catalog) { flex:1; min-height:0; overflow:auto; align-content:start; grid-template-columns:repeat(3,minmax(0,1fr)); }
  html body :is(#ccPicker,#vfProductPicker) .cc-catalog-card img,html body :is(#ccPicker,#vfProductPicker) .cc-thumb-placeholder { width:100%; height:150px; max-height:150px; aspect-ratio:auto; object-fit:contain; }
  html body #characterCreationView #ccNotes { border:0!important; box-shadow:none!important; outline:0!important; background:transparent!important; padding:0; }
  html body #characterCreationView .cc-note-item>input { display:none; }
  html body #characterCreationView .cc-note-media,html body #characterCreationView .cc-note-add { width:100%; max-height:180px; max-width:101.25px; margin:0 auto; box-sizing:border-box; }
  html body #characterCreationView .cc-note-media>button { top:auto!important; }
  html body :is(#analyzeToolView,#segmentAnalyzeToolView) { --analysis-height:max(740px,calc(100dvh - 28px)); height:var(--analysis-height)!important; min-height:0; flex:none; }
  html body #transcriptToolView { --analysis-height:max(740px,calc(100dvh - 28px)); height:var(--analysis-height)!important; min-height:0; overflow:hidden; }
  html body #transcriptToolView .transcript-tool-grid { height:100%; flex:none; grid-template-columns:minmax(0,.85fr) minmax(0,1.25fr); grid-template-rows:minmax(0,1.2fr) minmax(0,.8fr); }
  html body :is(#transcriptToolView,#analyzeToolView,#segmentAnalyzeToolView) .standalone-card { min-width:0; min-height:0; padding:12px; }
  html body :is(#analyzeToolView,#segmentAnalyzeToolView) textarea { min-height:0!important; height:0!important; overflow:auto!important; resize:none; flex:1 1 0!important; }
  html body :is(#analyzeToolView,#segmentAnalyzeToolView) .standalone-drop.has-media { flex:1 1 0; height:0; width:100%; min-height:0; display:flex; flex-direction:column; justify-content:center; padding:0; border:0; gap:8px; }
  html body :is(#analyzeToolView,#segmentAnalyzeToolView) .standalone-drop.has-media video { flex:none; width:auto!important; height:calc(100% - 40px)!important; max-width:100%!important; max-height:calc(100% - 40px)!important; min-height:0!important; aspect-ratio:9/16; object-fit:contain; margin:0 auto; border-radius:6px; }
  html body #transcriptToolView .standalone-card { overflow:hidden; }
  html body #transcriptToolView .transcript-media-card .standalone-drop { width:100%; height:0; flex:1 1 0; min-height:0; }
  html body #transcriptToolView .transcript-media-card .standalone-drop.has-media { display:flex; flex-direction:column; align-items:center; justify-content:center; }
  html body #transcriptToolView .transcript-media-card .standalone-drop video { flex:1 1 auto; width:auto; height:calc(100% - 32px); max-height:calc(100% - 32px); aspect-ratio:9/16; }
  html body #transcriptToolView .transcript-structured-card .omni-structured { flex:1 1 0; min-height:0; overflow:auto; align-content:start; }
  html body #transcriptToolView .transcript-editor-card textarea { min-height:0!important; height:0!important; flex:1 1 0!important; resize:none; overflow:auto!important; }
  html body :is(#transcriptToolView,#analyzeToolView,#segmentAnalyzeToolView) .standalone-media-name { display:none; }
  html body :is(#transcriptToolView,#analyzeToolView,#segmentAnalyzeToolView) [data-replace-tool-video] { flex:none; align-self:center; }
  html body #transcriptToolView .standalone-speaker-tools { flex:none; }
  html body #transcriptToolView #transcriptToolSegmentList { display:flex; flex-direction:column; flex:1 1 0; min-height:0; overflow:auto; }
  html body #transcriptToolView .standalone-segment-row { flex:none; grid-template-columns:92px minmax(0,1fr); }
  html body #transcriptToolView #transcriptToolResult { flex:1 1 0!important; margin:0; }
  html body #transcriptToolView .standalone-actions { flex:none; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
  html body #transcriptToolView .standalone-actions>button { width:100%; }
  html body #transcriptToolView .transcript-editor-card .standalone-actions { display:flex; justify-content:flex-end; }
  html body #transcriptToolView #transcriptToolSplitHint:empty { display:none; }
  html body #analyzeToolView .analyze-tool-grid { flex:none; height:100%; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:minmax(0,1.15fr) minmax(0,1fr); }
  html body #analyzeToolView #analyzeToolCustomWrap { flex:1; min-height:0; display:flex; flex-direction:column; }
  html body #analyzeToolView .standalone-controls,html body #analyzeToolView .standalone-actions { flex:none; }
  html body #segmentAnalyzeToolView .segment-tool-grid { height:100%; grid-template-columns:minmax(0,.85fr) minmax(0,1.8fr); grid-template-rows:auto minmax(0,1fr); align-items:stretch; }
  html body #segmentAnalyzeToolView .segment-video-card { display:flex; flex-direction:column; min-height:0; }
  html body #segmentAnalyzeToolView :is(.segment-playhead-row,.segment-timeline,.segment-frame-cut-row,.segment-summary,.standalone-actions) { flex:none; }
  html body #segmentAnalyzeToolView .segment-playhead-row { flex-wrap:wrap; gap:6px; }
  html body #segmentAnalyzeToolView .segment-playhead-row input { flex:1; min-width:60px; }
  html body #segmentAnalyzeToolView .segment-frame-cut-hint { display:none; }
  html body #segmentAnalyzeToolView .segment-frame-cut-row { justify-content:space-between; background:transparent; padding:0; border:0; }
  html body #segmentAnalyzeToolView .segment-settings-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body #segmentAnalyzeToolView #segmentToolCustomPrompt { height:100px!important; flex:none!important; }
  html body #segmentAnalyzeToolView .segment-result-card { display:flex; flex-direction:column; overflow:hidden; }
  html body #segmentAnalyzeToolView .segment-result-list { flex:1; min-height:0; overflow:auto; container-type:size; }
  html body #segmentAnalyzeToolView .segment-result-head { color:var(--bc-text); background:var(--bc-selected); }
  html body #segmentAnalyzeToolView .segment-result-body { grid-template-columns:minmax(0,.8fr) minmax(0,.85fr) minmax(0,1.35fr); height:max(380px,calc(100cqh - 62px)); padding:10px; }
  html body #segmentAnalyzeToolView .segment-artifact-panel { display:flex; flex-direction:column; min-height:0; min-width:0; background:var(--bc-canvas); color:var(--bc-text); border-color:var(--bc-border); }
  html body #segmentAnalyzeToolView .segment-artifact-panel :is(label,.segment-artifact-title,.segment-artifact-meta) { color:var(--bc-muted); }
  html body #segmentAnalyzeToolView .segment-source-video { width:100%; max-height:min(260px,calc(100cqh - 250px))!important; height:min(260px,calc(100cqh - 250px))!important; min-height:0; flex:none; }
  html body #segmentAnalyzeToolView .segment-inline-actions { display:flex; flex-wrap:wrap; flex:none; }
  html body #segmentAnalyzeToolView .segment-artifact-title { flex:none; }
  html body #segmentAnalyzeToolView .segment-artifact-meta { flex:none; max-height:54px; overflow:auto; }
  html body #segmentAnalyzeToolView .segment-result-item { border:1px solid var(--bc-border); border-radius:6px; overflow:hidden; }
  html body #segmentAnalyzeToolView .segment-block { background:var(--bc-canvas)!important; color:var(--bc-text)!important; border-color:var(--bc-border); }
  html body #segmentAnalyzeToolView .segment-block.selected { background:var(--bc-selected)!important; box-shadow:inset 0 0 0 2px var(--bc-muted); }
  html body #segmentAnalyzeToolView :is(.segment-block small,.segment-timecode,.segment-result-head strong) { color:var(--bc-text); }
  html body #segmentAnalyzeToolView .segment-cut-handle::after { background:var(--bc-muted); }
  html body #segmentAnalyzeToolView .segment-cut-handle.active { background:var(--bc-surface); box-shadow:0 0 0 2px var(--bc-muted); }
  html body #desktopOverview table { table-layout:fixed; width:100%; min-width:1120px; }
  html body #desktopOverview :is(th,td) { padding:8px 12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  html body #desktopOverview th { height:36px; }
  html body #desktopOverview td { height:40px; }
  html body #desktopOverview .overview-sort { border:0; padding:0; background:transparent; color:inherit; text-align:inherit; width:auto; display:inline-flex; justify-content:flex-start; gap:6px; }
  html body #desktopOverview th:nth-child(3) .overview-sort { justify-content:flex-start; gap:6px; }
  html body #desktopOverview .overview-sort span { display:inline-block; min-width:12px; }
  html body .overview-pagination { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:12px; }
  html body .overview-pagination :is(select,input) { width:72px; }
  html body #overviewSearch { flex:0 1 360px; }
  html body #desktopOverview .overview-table-wrap { position:relative; }
  html body #overviewEmpty { position:absolute; top:76px; left:24px; right:24px; text-align:center; color:var(--bc-muted); }
}

/* Asset editing and artifact inspection share bounded desktop surfaces. */
@media (min-width:769px) {
  html body #characterCreationView .cc-assets { display:grid; grid-template-rows:minmax(250px,1.1fr) minmax(180px,1fr) minmax(180px,1fr); gap:14px; }
  html body #characterCreationView .cc-asset-section { display:flex; flex-direction:column; gap:8px; min-height:0; min-width:0; }
  html body #characterCreationView .cc-asset-section>.cc-section-head { margin:0; padding:0; border:0; }
  html body #characterCreationView .cc-asset-section h3 { flex:1; white-space:nowrap; }
  html body #characterCreationView .cc-role-card { flex:1; min-height:0; display:flex; flex-direction:column; gap:8px; padding:10px; border:1px solid var(--bc-border); border-radius:8px; }
  html body #ccRoleTabs { display:flex; align-items:center; gap:6px; flex:1; }
  html body #characterCreationView #ccRoleTab.hidden { display:none!important; }
  html body #ccRoleTabs button { width:28px; height:28px; min-height:28px; padding:0; }
  html body #ccRoleTabs [aria-selected=true] { background:var(--bc-primary)!important; color:var(--bc-primary-text)!important; }
  html body #characterCreationView #ccRoles { display:flex; flex-direction:column; flex:1; gap:8px; min-height:0; }
  html body #ccRoles>label { display:flex; align-items:center; flex:none; gap:8px; white-space:nowrap; }
  html body #ccRoles>label input { flex:1; width:0; }
  html body #characterCreationView .cc-role-assets { flex:1; min-height:0; margin:0; }
  html body #characterCreationView .cc-role-assets button { min-height:0; overflow:hidden; }
  html body #characterCreationView .cc-role-assets img { width:56px; height:100%; max-height:130px; object-fit:contain; }
  html body #ccRoles>audio { flex:none; height:30px; margin:0; }
  html body #ccProductStage { position:relative; display:flex; flex:1; min-height:0; border:1px dashed var(--bc-border); border-radius:8px; overflow:hidden; }
  html body #ccProductStage:not(.has-product) #ccChooseProduct { flex:1; display:grid; place-items:center; text-align:center; width:100%; height:100%; border:0; background:transparent; }
  html body #ccProductStage:hover { border-color:var(--bc-muted); }
  html body #ccProductStage.has-product { border-style:solid; }
  html body #characterCreationView #ccProductPreview { display:flex; flex:1; height:100%; min-height:0; gap:8px; overflow-x:auto; overflow-y:hidden; padding:6px; align-items:stretch; }
  html body #characterCreationView #ccProductPreview:empty { display:none; }
  html body #characterCreationView #ccProductPreview :is(img,.cc-thumb-placeholder) { flex:none; width:auto; height:100%; max-height:none; aspect-ratio:9/16; object-fit:contain; border-radius:5px; }
  html body .cc-product-loading { align-self:center; margin:auto; color:var(--bc-muted); }
  html body #characterCreationView #ccNotes { display:flex; flex-direction:row; flex:1; height:0; min-height:0; overflow-x:auto; overflow-y:hidden; gap:8px; align-items:stretch; }
  html body #characterCreationView #ccNotes>:is(.cc-note-item,.cc-note-add) { flex:1 0 calc((100% - 16px)/3); width:auto; max-width:none; height:100%; max-height:none; min-height:0; margin:0; }
  html body #characterCreationView #ccNotes .cc-note-media { flex:1; width:100%; height:100%; min-height:0; max-height:none; }
  html body #characterCreationView #ccNotes img { width:100%; height:100%; max-height:none; aspect-ratio:9/16; object-fit:contain; }
  html body .usage-model-item b { color:var(--bc-text)!important; font-weight:700; }
  html body .usage-drawer { inset:0 0 0 auto; height:100dvh!important; max-height:100dvh; width:min(1540px,calc(100vw - 24px)); overflow:hidden; }
  html body .usage-drawer :is(.usage-drawer-head,.usage-drawer-tabs,.artifact-toolbar,.artifact-summary,.usage-ledger-summary,.usage-drawer-filters) { flex:none; }
  html body .usage-drawer :is(.usage-drawer-view,.artifact-task-list) { flex:1; min-height:0; overflow:hidden; }
  html body .usage-drawer .artifact-page { flex:1 1 0; min-height:0; overflow:auto; padding-bottom:24px; overscroll-behavior:contain; }
  html body .usage-drawer-close { display:inline-flex; justify-content:center; align-items:center; flex:0 0 34px; width:34px; height:34px; min-height:34px; padding:0!important; line-height:1; font-size:24px; }
  html body .usage-drawer :is(.artifact-generation-tabs,.artifact-prompt-details>summary) { background:var(--bc-surface); border-color:var(--bc-border); color:var(--bc-text); }
  html body .usage-drawer .artifact-generation-tabs button.active { background:var(--bc-primary); color:var(--bc-primary-text); border-color:var(--bc-primary); }
  html body .usage-drawer :is(.artifact-text-title,.artifact-source-group h5) { color:var(--bc-text); font-weight:700; }
}

/* Replica-style slots: only individual media slots arm hover paste. */
html[data-visual="next"] body #imageToolView .desktop-upload-slot {box-sizing:border-box;flex:0 0 auto;width:auto;height:calc(var(--image-strip-height) - 24px);aspect-ratio:9/16;min-height:0;padding:0;transition:none}
html[data-visual="next"] body #imageToolView #imageToolDrop {display:none!important}
html[data-visual="next"] body #imageToolView #imageToolSlotsAdd {margin:0;align-self:flex-start}
html[data-visual="next"] body #imageToolView .desktop-upload-slot .slot-text::after {display:none}

html[data-visual="next"] body #imageToolView .desktop-image-strip {overflow:hidden}
html[data-visual="next"] body #imageToolView #imageToolRefGrid {display:flex;margin:0;flex:1;width:0;min-width:0;height:100%;align-items:flex-start;gap:8px;overflow-x:auto;overflow-y:hidden;padding:0 0 18px}
html[data-visual="next"] body #imageToolView #imageToolRefGrid :is(.standalone-ref-slot,.desktop-upload-slot) {flex:0 0 calc((100% - 32px)/5);width:calc((100% - 32px)/5)!important;height:auto!important;aspect-ratio:9/16;min-height:0;max-height:100%;border-width:2px}

html[data-visual="next"] body #imageToolRefGrid [data-remove-image] {top:4px;right:4px;bottom:auto}

/* Overview keeps a full page of standard-height rows; row navigation is keyboard accessible. */
html body #desktopOverview :is(th,td) {box-sizing:border-box;}
html body #desktopOverview .overview-task-row {cursor:pointer;}
html body #desktopOverview .overview-task-row td {transition:background-color 120ms ease;}
html body #desktopOverview .overview-task-row:is(:hover,:focus-visible) td {background:var(--bc-hover,#f2f2f2);}
html body #desktopOverview .overview-task-row:focus-visible {outline:2px solid var(--bc-muted);outline-offset:-2px;}
html body .overview-date-range {display:flex;align-items:center;gap:8px;white-space:nowrap;}
html body .overview-date-range input {height:32px;width:150px;box-sizing:border-box;color-scheme:light dark;}
html body #overviewPageSize {width:110px;}
html body #overviewCount {margin:0;}
@media(prefers-reduced-motion:reduce){html body #desktopOverview .overview-task-row td,html body .dq-drop.img-slot {transition:none;}}

html body #transcriptToolView .standalone-speaker-row {display:flex;align-items:center;gap:8px;flex:none}
html body #transcriptToolView .standalone-speaker-row .standalone-speaker-tools {margin:0;min-height:32px}

html body #transcriptToolView .standalone-speaker-row {margin-bottom:10px;flex-wrap:wrap}
html body .rg-dialog {background:var(--bc-surface);color:var(--bc-text);border-color:var(--bc-border);--rg-muted:var(--bc-muted);--rg-edge:var(--bc-border)}
html body .rg-dialog :is(h2,h3,label,small) {color:var(--bc-text)}
html body .rg-dialog :is(.rg-hint,p) {color:var(--bc-muted)}
html body .rg-dialog :is(input,select,textarea) {background:var(--bc-surface);color:var(--bc-text);border-color:var(--bc-border)}
html body .rg-dialog :is(.rg-route-editor,.rg-discovery-list label,.rg-pool-row) {border-color:var(--bc-border)}
html body #tab-config-prompt .template-sidebar {gap:8px 16px;padding-bottom:10px}
html body #tab-config-prompt .template-choice {flex-direction:row;align-items:center;width:auto;gap:8px}
html body #tab-config-prompt .template-choice :is(input,select) {width:220px;height:32px}
html body #tab-config-prompt .template-section-head {flex:none;margin-bottom:8px}
html body #tab-config-prompt .template-section textarea {height:0!important;flex:1 1 0!important;min-height:160px!important;max-height:none!important}
html body #tab-config-prompt .template-editor {gap:12px}
html body #tab-config-prompt .prompt-template-layout {margin-top:12px}
html body #desktopOverview th:nth-child(3) .overview-sort {flex-direction:row}

@media(min-width:1101px) {
  html body #tab-config-prompt .template-editor {grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr) auto}
  html body #tab-config-prompt .template-footer {grid-column:1/-1}
}
/* High-fidelity fission: task pages share original controls and state. */
html body #viralFissionToolView.vf-tabbed { container-type:inline-size; }
html body #viralFissionToolView .vf-page-tabs { flex-wrap:wrap; }
html body #viralFissionToolView :is(#viralFissionProductDrop,#viralFissionVideoDrop) { aspect-ratio:auto!important; }
html body #viralFissionToolView #viralFissionProductDrop { height:120px!important; min-height:120px!important; flex:none; }
html body #viralFissionToolView #viralFissionProductGrid { height:auto!important; max-height:none!important; overflow:visible!important; }
html body #viralFissionToolView .vf-product-details>.standalone-field:first-of-type { flex:none; }
html body #viralFissionToolView .vf-tool-row>.standalone-field { flex:0 1 auto; flex-direction:row!important; justify-content:flex-start; text-align:left; }
html body #viralFissionToolView .vf-tool-row label { margin:0; }
html body #viralFissionToolView .viral-analysis-view { align-content:start; }
html body #viralFissionToolView .viral-summary { color:var(--bc-text); background:var(--bc-canvas); border-color:var(--bc-border); }
html body #viralFissionToolView .viral-directions-grid { display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
html body #viralFissionToolView .vf-video-comparison { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
html body #viralFissionToolView .vf-video-comparison video { width:100%; height:clamp(240px,calc(100dvh - 580px),620px); max-height:none; object-fit:contain; background:var(--bc-canvas); }
html body #viralFissionToolView .vf-video-source { padding-top:0; }
html body #viralFissionToolView .vf-video-output .viral-video-card { display:flex; flex-direction:column; border:0; padding:0; }
html body #viralFissionToolView .vf-video-output .viral-video-meta { display:flex; flex-direction:row; align-items:center; gap:12px; }
html body #viralFissionToolView .vf-run-page.vf-run-script textarea { height:clamp(180px,calc(100dvh - 520px),650px)!important; }
html body #viralFissionToolView .viral-material-list { flex-wrap:nowrap!important; overflow-x:auto; padding:4px; }
html body #viralFissionToolView .viral-material-item { min-height:0!important; flex:0 0 80px; }
html body #viralFissionToolView .vf-frame-results .viral-confirmed-frame img { height:320px; width:100%; object-fit:contain; }
html body #viralFissionToolView #viralFissionStatus { margin:0; min-height:0; height:auto; padding:8px 0 0; font-size:12px; flex:none; overflow-wrap:anywhere; }
html body #viralFissionToolView #viralFissionStatus.error { color:var(--bc-error,#b33e3e); }
html body #viralFissionToolView #viralFissionProductionCard>.viral-directions-head { justify-content:flex-end; margin:0 0 8px; }
html body #viralFissionToolView #viralFissionProductionCard>.viral-directions-head>div { display:none; }
html body #viralFissionToolView .vf-frame-results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; align-items:start; }
html body #viralFissionToolView .vf-frame-results .viral-frame-history { display:block; }
html body #viralFissionToolView .vf-frame-results .viral-frame-card img { width:100%; height:320px; object-fit:contain; }
html body #viralFissionToolView .vf-run-frame textarea[data-vf-field=firstFramePrompt] { height:clamp(160px,calc(100dvh - 680px),440px)!important; }
html body #viralFissionToolView .viral-image-studio-grid { grid-template-columns:minmax(260px,.85fr) minmax(300px,1fr) minmax(400px,1.2fr)!important; }
html body #viralFissionToolView .viral-image-materials>.viral-confirmed-frame.empty { min-height:150px; height:150px; }
html body #viralFissionToolView .viral-source-frame img { height:150px; object-fit:contain; }
html body #viralFissionToolView .vf-run-refinement .viral-refinement-result { height:clamp(160px,calc(100dvh - 670px),560px)!important; }
html body #viralFissionToolView.vf-tabbed [hidden] { display:none!important; }
html body #viralFissionToolView.vf-tabbed .viral-fission-scroll { overflow:visible; padding:0; gap:12px; }
html body #viralFissionToolView.vf-tabbed .standalone-hero { display:none; }
html body #viralFissionToolView .vf-page-tabs { display:flex; align-items:center; gap:4px; padding:4px; min-height:36px; border:1px solid var(--bc-border); border-radius:8px; background:var(--bc-surface); }
html body #viralFissionToolView .vf-page-tabs button { height:28px; padding:0 12px; border:0; border-radius:6px; background:transparent; color:var(--bc-muted); font:inherit; cursor:pointer; }
html body #viralFissionToolView .vf-page-tabs button[aria-selected=true],
html body #viralFissionToolView .vf-result-pages button[aria-pressed=true] { background:var(--bc-selected); color:var(--bc-text); }
html body #viralFissionToolView .vf-page-tabs button:hover { background:var(--bc-hover); }
html body #viralFissionToolView .vf-page-tabs button:focus-visible { outline:2px solid var(--bc-focus,#737373); outline-offset:2px; }
html body #viralFissionToolView .vf-page { min-width:0; }
html body #viralFissionToolView :is(.vf-page-source,.vf-page-product) { display:grid; grid-template-columns:minmax(300px,.8fr) minmax(0,1.4fr); gap:16px; min-height:calc(100dvh - 130px); }
html body #viralFissionToolView .vf-page>.standalone-card { margin:0; padding:16px; min-width:0; }
html body #viralFissionToolView :is(.vf-page-source,.vf-page-product)>.standalone-card { display:flex; flex-direction:column; gap:12px; }
html body #viralFissionToolView #viralFissionVideoDrop { width:100%; flex:1 1 0; min-height:0; height:0; margin:0; display:flex; flex-direction:column; gap:8px; }
html body #viralFissionToolView #viralFissionVideoDrop video { flex:1 1 0; min-height:0!important; width:100%; height:0!important; max-height:100%!important; object-fit:contain; aspect-ratio:auto; }
html body #viralFissionToolView #viralFissionTranscript { flex:1 1 0; height:0!important; min-height:0!important; resize:vertical; }
html body #viralFissionToolView .vf-product-details .standalone-field:last-child { flex:1; display:flex; flex-direction:column; }
html body #viralFissionToolView #viralFissionProductBrief { flex:1; height:auto!important; min-height:300px; }
html body #viralFissionToolView #viralFissionProductDrop { width:100%; min-height:120px; }
html body #viralFissionToolView #viralFissionProductGrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
html body #viralFissionToolView #viralFissionProductGrid .standalone-ref-slot { aspect-ratio:9/16; height:auto; }
html body #viralFissionToolView .vf-tool-row { display:flex; align-items:center; gap:12px; margin-bottom:16px; }
html body #viralFissionToolView .vf-tool-row>.standalone-field { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
html body #viralFissionToolView .vf-tool-row select { width:auto; min-width:150px; }
html body #viralFissionToolView .vf-result-pages { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
html body #viralFissionToolView .viral-directions-grid { display:block; }
html body #viralFissionToolView .viral-direction-card { min-height:calc(100dvh - 290px); padding:16px; }
html body #viralFissionToolView .viral-analysis-view { min-height:0; }
html body #viralFissionToolView .viral-run-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
html body #viralFissionToolView .viral-run-tab { padding:6px 12px; min-height:32px; flex:0 1 auto; background:var(--bc-surface); border-color:var(--bc-border); }
html body #viralFissionToolView .viral-run-tab.active { background:var(--bc-selected); }
html body #viralFissionToolView .viral-run-tab span { display:none; }
html body #viralFissionToolView .viral-run-shell { display:flex; flex-direction:column; gap:12px; }
html body #viralFissionToolView .vf-run-refinement { display:grid; grid-template-columns:minmax(260px,.7fr) minmax(0,1.5fr); gap:16px; }
html body #viralFissionToolView .viral-run-overview { display:flex; flex-direction:column; justify-content:space-between; }
html body #viralFissionToolView .vf-run-page :is(.viral-run-panel,.viral-refinement-card,.viral-dialogue-card,.viral-run-overview) { background:var(--bc-surface); color:var(--bc-text); border-color:var(--bc-border); border-radius:8px; padding:16px; }
html body #viralFissionToolView .vf-run-page :is(h3,h4,label,strong) { color:var(--bc-text); }
html body #viralFissionToolView .vf-run-page textarea { height:clamp(200px,calc(100dvh - 450px),700px)!important; min-height:120px!important; }
html body #viralFissionToolView .vf-run-refinement textarea[data-vf-field=refinementInstruction] { height:100px!important; min-height:80px!important; }
html body #viralFissionToolView .vf-run-refinement .viral-refinement-result { height:clamp(160px,calc(100dvh - 670px),560px)!important; }
html body #viralFissionToolView .viral-image-studio-grid { display:grid; grid-template-columns:minmax(260px,1fr) minmax(300px,1.25fr) minmax(240px,.8fr); gap:16px; }
html body #viralFissionToolView .viral-material-list { display:flex; flex-wrap:wrap; gap:8px; }
html body #viralFissionToolView .viral-material-item { display:flex; flex-direction:column; width:80px; padding:4px; position:relative; }
html body #viralFissionToolView .viral-material-item img { width:70px; height:100px; object-fit:contain; }
html body #viralFissionToolView .viral-material-caption { display:none; }
html body #viralFissionToolView .viral-material-item button { position:absolute; top:4px; right:4px; }
html body #viralFissionToolView .viral-material-item .tip { font-size:11px; }
html body #viralFissionToolView .viral-reference-frame img { height:180px; object-fit:contain; }
html body #viralFissionToolView .viral-confirmed-frame img { max-height:calc(100dvh - 350px); object-fit:contain; }
html body #viralFissionToolView .viral-run-model-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
html body #viralFissionToolView .vf-run-video .viral-run-model-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
@container (max-width: 1100px) {
  html body #viralFissionToolView .viral-image-studio-grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  html body #viralFissionToolView .vf-frame-results { grid-column:1/-1; }
  html body #viralFissionToolView .viral-directions-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Keep the source step within the measured viewport; content errors remain below its upload. */
html body #viralFissionToolView .vf-page-source { height:var(--vf-source-height,calc(100dvh - 100px)); min-height:460px; }
html body #viralFissionToolView .vf-page-source>.standalone-card { min-height:0; }
html body #viralFissionToolView .vf-page-source .standalone-media-name { display:none; }
html body #viralFissionToolView .vf-page-source [data-replace-tool-video] { flex:none; align-self:center; }
html body #viralFissionToolView .vf-transcript-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
html body #viralFissionToolView .vf-transcript-head h2 { margin:0; }
html body #viralFissionToolView .viral-soul-grid { grid-template-columns:repeat(4,minmax(0,1fr)); grid-auto-rows:1fr; gap:12px; }
html body #viralFissionToolView .viral-kv { padding:12px; min-width:0; }
html body #viralFissionToolView .viral-tag-groups { grid-template-columns:repeat(5,minmax(0,1fr)); grid-auto-rows:1fr; gap:12px; }
html body #viralFissionToolView .viral-tag-group { display:flex; flex-direction:column; padding:12px; }
html body #viralFissionToolView .viral-tag-group .viral-chip-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(28px,1fr)); gap:6px; flex:1; }
html body #viralFissionToolView .viral-tag-group :is(.viral-chip,.viral-tag-slot) { display:flex; align-items:center; min-height:28px; min-width:0; white-space:normal; overflow-wrap:anywhere; }
html body #viralFissionToolView .viral-factor-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
html body #viralFissionToolView .vf-risk-section .viral-chip-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
html body #viralFissionToolView .vf-risk-section .viral-chip { padding:12px; border-radius:6px; line-height:1.7; white-space:normal; }
@container (max-width: 1000px) {
  html body #viralFissionToolView .viral-soul-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html body #viralFissionToolView .viral-tag-groups { grid-template-columns:repeat(3,minmax(0,1fr)); }
}

/* Product references use replica slots; writing keeps both dependent editors together. */
html body #viralFissionToolView .vf-page-product { display:flex; flex-direction:column; gap:16px; min-height:0; }
html body #viralFissionToolView #viralFissionProductDrop[hidden] { display:none!important; }
html body #viralFissionToolView .vf-product-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
html body #viralFissionToolView .vf-product-head h2 { margin:0; }
html body #viralFissionToolView #viralFissionProductGrid { display:flex; justify-content:space-between; gap:12px; padding-bottom:28px; }
html body #viralFissionToolView #viralFissionProductGrid .img-slot { flex:0 1 calc((100% - 48px)/5); width:calc((100% - 48px)/5); max-width:calc(clamp(160px,25dvh,270px)*9/16); height:auto; min-height:0; aspect-ratio:9/16; overflow:visible; }
html body #viralFissionToolView #viralFissionProductGrid .slot-delete { position:absolute; right:0; bottom:-28px; top:auto; }

/* Portrait media owns its frame, including the not-yet-generated state. */
html body #viralFissionToolView .viral-image-studio { --vf-portrait-height:clamp(224px,calc(100dvh - 710px),360px); }
html body #viralFissionToolView .viral-image-studio-grid { grid-template-columns:minmax(180px,.8fr) minmax(280px,1.2fr) minmax(300px,1.25fr)!important; align-items:start; }
html body #viralFissionToolView .vf-frame-results { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
html body #viralFissionToolView .viral-image-studio .viral-frame-card,
html body #viralFissionToolView .viral-image-studio .viral-confirmed-frame { width:min(100%,calc(var(--vf-portrait-height)*9/16)); max-width:none; min-height:0; padding:0; margin-inline:auto; }
html body #viralFissionToolView .viral-image-studio [data-vf-preview] { display:block; width:100%; padding:0; }
html body #viralFissionToolView .viral-image-studio .viral-frame-card img,
html body #viralFissionToolView .viral-image-studio .viral-confirmed-frame img { display:block; width:100%; height:auto; max-height:none; aspect-ratio:9/16; object-fit:contain; background:var(--bc-canvas); }
html body #viralFissionToolView .viral-image-materials>.viral-confirmed-frame.empty,
html body #viralFissionToolView .viral-confirmed-frame-empty,
html body #viralFissionToolView .viral-frame-history>.viral-material-empty { box-sizing:border-box; width:min(100%,calc(var(--vf-portrait-height)*9/16)); height:auto; min-height:0; aspect-ratio:9/16; padding:12px; margin-inline:auto; display:flex; flex-direction:column; justify-content:center; }
html body #viralFissionToolView .viral-confirmed-frame.empty { height:auto; }
html body #viralFissionToolView .viral-material-item img { width:56.25px!important; height:100px!important; aspect-ratio:9/16; object-fit:contain; align-self:center; }
html body #viralFissionToolView .vf-run-frame textarea[data-vf-field=firstFramePrompt] { height:clamp(160px,calc(100dvh - 880px),320px)!important; }
html body #viralFissionToolView .viral-image-studio .viral-frame-card footer button { width:28px; flex:none; padding:0; }
html body #viralFissionToolView .viral-image-studio .viral-frame-card footer { flex-wrap:nowrap; }
html body #viralFissionToolView #viralFissionVideoDrop video { flex:0 1 auto; align-self:center; width:min(100%,calc((var(--vf-source-height,calc(100dvh - 100px)) - 155px)*9/16)); height:auto!important; max-height:none!important; aspect-ratio:9/16; object-fit:contain; }
html body #viralFissionToolView .viral-image-studio-grid>.viral-material-groups { grid-column:1/-1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:0; }
html body #viralFissionToolView .viral-image-materials { padding:12px; }
html body #viralFissionToolView .vf-frame-results>.viral-run-field { padding:12px; margin:0; gap:0; border:1px solid var(--bc-border); border-radius:8px; }
html body #viralFissionToolView .vf-frame-results .viral-confirmed-panel { padding:12px; }
html body #viralFissionToolView .vf-frame-results .viral-frame-history { margin:0; }
html body #viralFissionToolView .viral-image-materials>h4,
html body #viralFissionToolView .vf-frame-results .viral-confirmed-panel>h4,
html body #viralFissionToolView .vf-frame-heading { height:64px; margin:0; box-sizing:border-box; }
html body #viralFissionToolView .vf-frame-heading .vf-result-pages { margin:6px 0 0; }
html body #viralFissionToolView .viral-source-frame footer { flex-wrap:wrap; }
html body #viralFissionToolView .vf-video-comparison { --vf-video-height:clamp(240px,calc(100dvh - 590px),700px); grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
html body #viralFissionToolView .vf-video-comparison video,
html body #viralFissionToolView .vf-video-comparison .viral-material-empty,
html body #viralFissionToolView .vf-video-comparison .viral-empty { display:block; box-sizing:border-box; width:min(100%,calc(var(--vf-video-height)*9/16)); height:auto; min-height:0; max-height:none; aspect-ratio:9/16; object-fit:contain; margin-inline:auto; background:var(--bc-canvas); }
html body #viralFissionToolView .vf-video-comparison .viral-material-empty,
html body #viralFissionToolView .vf-video-comparison .viral-empty { display:flex; align-items:center; justify-content:center; padding:16px; }
html body #viralFissionToolView .vf-video-comparison h4 { text-align:center; }
html body #viralFissionToolView .vf-video-comparison .viral-video-card { width:100%; }
@container (max-width:1100px) {
  html body #viralFissionToolView .viral-image-studio-grid { grid-template-columns:minmax(180px,.8fr) minmax(280px,1.2fr)!important; }
  html body #viralFissionToolView .vf-frame-results { grid-column:1/-1; }
}
html body #viralFissionToolView .vf-product-details { flex:1; }
html body #viralFissionToolView .vf-product-details>h2 { display:none; }
html body #viralFissionToolView #viralFissionProductBrief { min-height:140px; height:clamp(140px,calc(100dvh - 535px),640px)!important; }
html body #viralFissionToolView .vf-run-page.vf-run-script { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; align-items:stretch; }
html body #viralFissionToolView .vf-run-script>.viral-dialogue-card { margin:0; }
html body #viralFissionToolView .vf-run-script>:is(.viral-dialogue-card,.viral-run-panel) { display:flex; flex-direction:column; gap:12px; min-width:0; }
html body #viralFissionToolView .vf-run-script .viral-run-field:has(textarea) { flex:1; display:flex; flex-direction:column; }
html body #viralFissionToolView .vf-run-page.vf-run-script textarea { flex:1; min-height:180px; height:clamp(180px,calc(100dvh - 560px),650px)!important; }
html body #vfProductPicker form { display:flex; justify-content:space-between; align-items:center; margin:0; flex:none; }
html body #vfProductPicker :is(.cc-search,.cc-picker-pages,.vf-picker-status) { flex:none; margin:0; }
html body #vfProductPicker { background:var(--bc-surface); color:var(--bc-text); border-color:var(--bc-border); }
html body #vfProductPicker .cc-catalog-card { border-color:var(--bc-border); }

html body #viralFissionToolView .vf-page-product { height:var(--vf-product-height,calc(100dvh - 100px)); min-height:560px; }
html body #viralFissionToolView .vf-product-details { min-height:0; }
html body #viralFissionToolView #viralFissionProductBrief { height:0!important; min-height:100px; resize:vertical; }
html body #viralFissionToolView .vf-run-page.vf-run-script { grid-template-rows:auto minmax(200px,1fr) auto; }
html body #viralFissionToolView .vf-run-script>:is(.viral-dialogue-card,.viral-run-panel) { display:grid; grid-row:span 3; grid-template-rows:subgrid; border:1px solid var(--bc-border); border-radius:8px; padding:16px; }
html body #viralFissionToolView .vf-writing-tools { display:flex; flex-direction:column; gap:12px; }
html body #viralFissionToolView .vf-writing-tools h3 { margin:0; }
html body #viralFissionToolView .vf-writing-tools .viral-run-field { display:flex; flex-direction:row; gap:8px; align-items:center; margin:0; }
html body #viralFissionToolView .vf-writing-tools .viral-run-field label { white-space:nowrap; margin:0; }
html body #viralFissionToolView .vf-writing-tools .viral-run-field select { flex:1; min-width:0; }
html body #viralFissionToolView .vf-run-script .viral-run-field:has(textarea) { margin:0; }
html body #viralFissionToolView .vf-run-script .viral-confirm-row { margin:0; align-self:end; }

html body #viralFissionToolView .vf-writing-tools select { min-width:0; width:100%; }
html body #viralFissionToolView .vf-run-page.vf-run-script textarea { min-height:180px!important; }

html body #viralFissionToolView .vf-run-page.vf-run-script { min-height:calc(100dvh - 250px); }
html body #viralFissionToolView .vf-product-materials {display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:12px;}
html body #viralFissionToolView .vf-product-materials section:first-child {grid-column:span 5;}
html body #viralFissionToolView .vf-product-materials section:last-child {grid-column:span 3;}
html body #viralFissionToolView .vf-product-materials section {min-width:0;}
html body #viralFissionToolView .vf-product-materials h3 {margin:0 0 12px;}
html body #viralFissionToolView #viralFissionProductGrid,html body #viralFissionToolView #viralFissionNoteGrid {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;justify-content:initial;padding-bottom:28px;}
html body #viralFissionToolView #viralFissionNoteGrid {grid-template-columns:repeat(3,minmax(0,1fr));}
html body #viralFissionToolView .vf-product-materials .img-slot {width:100%!important;max-width:none!important;aspect-ratio:9/16;height:auto;min-height:0;overflow:visible;}
html body #viralFissionToolView #viralFissionNoteGrid .slot-delete {right:0;top:auto;bottom:-28px;}
html body #viralFissionToolView .vf-direction-instruction {display:flex;flex-direction:column;gap:8px;margin:0 0 12px;position:relative;}
html body #viralFissionToolView .vf-direction-instruction textarea {min-height:80px;resize:vertical;}
html body #viralFissionToolView .viral-direction-card {min-height:calc(100dvh - 450px);}
html body .vf-mention-menu {position:absolute;z-index:80;display:flex;flex-wrap:wrap;gap:6px;padding:8px;border:1px solid var(--bc-border);background:var(--bc-surface);border-radius:8px;max-width:600px;box-shadow:0 4px 16px #0002;}
html body .vf-mention-menu img {width:24px;height:40px;object-fit:contain;}
html body #viralFissionToolView .vf-run-page.vf-run-script {grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch;}
html body #viralFissionToolView .vf-run-script .viral-run-field:has(textarea) {margin:0;gap:8px;}
html body #viralFissionToolView .vf-run-page.vf-run-script textarea {height:clamp(180px,calc(100dvh - 475px),1000px)!important;min-height:180px!important;}
html body #viralFissionToolView .vf-run-script .vf-writing-tools {display:flex;flex-direction:column;gap:8px;min-height:92px;justify-content:start;}
html body #viralFissionToolView .vf-writing-tools :is(h3,.viral-dialogue-head) {margin:0;}
html body #viralFissionToolView .vf-plan-actions {display:flex;gap:8px;}
html body #viralFissionToolView .vf-run-script .viral-run-actions {display:flex;margin:0;}
html body #viralFissionToolView .vf-run-script .viral-confirm-row {display:flex;flex-wrap:wrap;gap:8px;}
html body #viralFissionToolView .vf-run-script .viral-confirm-row button {flex:none;}
html body #viralFissionToolView .viral-image-studio-grid {grid-template-columns:minmax(0,1fr) minmax(280px,1.4fr) minmax(0,2fr)!important;gap:12px;}
html body #viralFissionToolView .vf-frame-results {grid-column:auto!important;}
html body #viralFissionToolView .viral-image-studio {--vf-portrait-height:clamp(180px,calc(100dvh - 710px),540px);}
html body #viralFissionToolView .viral-image-materials>h4,html body #viralFissionToolView .vf-frame-heading,html body #viralFissionToolView .vf-frame-results .viral-confirmed-panel>h4 {height:44px;}
html body #viralFissionToolView .vf-run-frame textarea[data-vf-field=firstFramePrompt] {height:clamp(120px,calc(100dvh - 850px),470px)!important;min-height:120px!important;}
html body #viralFissionToolView .viral-image-studio-grid>.viral-material-groups {grid-template-columns:5fr 2fr 3fr;}
html body #viralFissionToolView .viral-material-group {padding:8px;}
html body #viralFissionToolView .viral-material-item img {width:42px!important;height:74.66px!important;}
html body #viralFissionToolView .viral-material-item {padding:4px;}
html body #viralFissionToolView .viral-material-caption {display:none;}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid {display:grid;grid-template-columns:1.5fr .8fr .8fr .8fr auto;gap:12px;align-items:end;}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid>button {margin-bottom:0;white-space:nowrap;}
html body #viralFissionToolView .viral-video-panel>.viral-state-note:not(.is-error,.is-running,.is-success) {display:none;}
html body #viralFissionToolView .vf-video-comparison {--vf-video-height:clamp(240px,calc(100dvh - 500px),1000px);}
html body #viralFissionToolView .viral-video-meta {display:flex;flex-wrap:wrap;justify-content:center;align-items:center;text-align:center;gap:8px;margin:10px auto 0;}
html body #viralFissionToolView .viral-video-meta>* {flex:none;}
/* Fission content is displayed as cards; editing stays in an explicit modal. */
html body #viralFissionToolView #viralFissionAnalysisHeading {display:none;}
html body #viralFissionToolView .vf-content-card {position:relative;min-width:0;padding:16px;border:1px solid var(--bc-border);border-radius:8px;background:var(--bc-surface);}
html body #viralFissionToolView .vf-content-card h4 {margin:0 40px 12px 0;color:var(--bc-text);font-size:14px;line-height:22px;font-weight:600;}
html body #viralFissionToolView .vf-corner-edit {position:absolute;right:10px;top:10px;width:32px;height:32px;padding:0;display:grid;place-items:center;}
html body #viralFissionToolView .vf-card-copy {white-space:pre-wrap;overflow-wrap:anywhere;color:var(--bc-text);font-size:13px;line-height:1.7;font-weight:400;}
html body #viralFissionToolView .viral-soul-grid:has(.vf-content-card) {grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:1fr;min-height:clamp(360px,calc(100dvh - 390px),900px);}
html body #viralFissionToolView #viralFissionAnalysisView>.vf-content-card {padding:12px 52px 12px 16px;margin-bottom:12px;display:flex;gap:16px;align-items:baseline;}
html body #viralFissionToolView #viralFissionAnalysisView>.vf-content-card h4 {margin:0;white-space:nowrap;}
html body #viralFissionToolView .vf-trust-fields {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:12px;}
html body #viralFissionToolView .vf-evidence-chain {display:flex;flex-direction:column;gap:12px;}
html body #viralFissionToolView .vf-evidence-record {border-left:3px solid var(--bc-border);}
html body #viralFissionToolView .vf-evidence-record dl {margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 24px;}
html body #viralFissionToolView .vf-evidence-record dl>div {display:flex;gap:12px;min-width:0;}
html body #viralFissionToolView .vf-evidence-record dt {flex:none;color:var(--bc-muted);font-weight:500;}
html body #viralFissionToolView .vf-evidence-record dd {margin:0;white-space:pre-wrap;overflow-wrap:anywhere;}
html body #viralFissionToolView .viral-tag-groups {grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;}
html body #viralFissionToolView .viral-tag-group.vf-content-card {padding:12px;min-height:124px;}
html body #viralFissionToolView .viral-tag-group h4 {margin-bottom:12px;}
html body #viralFissionToolView .vf-display-tag {display:flex;align-items:center;justify-content:center;text-align:center;min-height:28px;padding:2px 6px;border-radius:6px;background:var(--bc-hover);color:var(--bc-text);overflow-wrap:anywhere;}
html body #viralFissionToolView .vf-display-tag.is-empty {color:var(--bc-muted);background:transparent;border:1px dashed var(--bc-border);}
html body #viralFissionToolView textarea.vf-display-source {display:none!important;}
html body #viralFissionToolView .vf-source-display {flex:1;}
html body #viralFissionToolView .vf-source-display.is-empty .vf-card-copy {color:var(--bc-muted);}
html body #viralFissionToolView .vf-run-script .vf-source-display {min-height:clamp(240px,calc(100dvh - 435px),1000px);}
html body #viralFissionToolView .vf-transcript-card .vf-source-display {min-height:260px;}
html body #viralFissionToolView .vf-direction-instruction .vf-source-display {min-height:100px;}
html body #viralFissionToolView :is(.desktop-text-tools:has(button[aria-label^="放大编辑"]),[data-vf-action^="expand-"]) {display:none!important;}
html body #viralFissionToolView .vf-editor-caption {display:none!important;}
html body #viralFissionToolView .viral-field-heading:has(.vf-editor-caption) {display:none!important;}
html body #viralFissionToolView .standalone-field>label:has(~textarea.vf-display-source) {display:none;}
html body .vf-modal-fields:not(.is-structured)>label>span {display:none;}
html body dialog.vf-content-dialog {margin:auto;width:min(880px,calc(100vw - 48px));max-height:calc(100dvh - 48px);padding:20px;border:1px solid var(--bc-border);border-radius:8px;color:var(--bc-text);background:var(--bc-surface);}
html body dialog.vf-content-dialog::backdrop {background:#0006;}
html body .vf-content-dialog header,html body .vf-content-dialog footer {display:flex;align-items:center;justify-content:space-between;gap:12px;}
html body .vf-content-dialog h2 {font-size:18px;font-weight:600;margin:0;}
html body .vf-content-dialog footer {justify-content:flex-end;margin-top:16px;}
html body .vf-modal-fields {display:grid;gap:16px;margin-top:20px;}
html body .vf-modal-fields label {position:relative;display:flex;flex-direction:column;gap:8px;}
html body .vf-modal-fields label>span {font-size:14px;font-weight:600;color:var(--bc-text);}
html body .vf-modal-fields textarea,html body .vf-modal-fields input {width:100%;background:var(--bc-canvas);color:var(--bc-text);border:1px solid var(--bc-border);border-radius:6px;padding:12px;font:inherit;font-size:13px;font-weight:400;line-height:1.7;}
html body .vf-modal-fields textarea {resize:vertical;min-height:100px;}
html body .vf-modal-fields:has(input) {grid-template-columns:repeat(2,minmax(0,1fr));}
html body .vf-modal-fields.is-structured {grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;}
html body .vf-modal-fields.is-structured>label:last-child:nth-child(odd) {grid-column:1/-1;}
html body #viralFissionToolView .vf-trust-fields .vf-card-copy {white-space:normal;}
html body #viralFissionToolView .vf-run-script .vf-source-display>h4,html body #viralFissionToolView .vf-transcript-card .vf-source-display>h4 {display:none;}
html body #viralFissionToolView .vf-run-script .vf-source-display>.vf-card-copy,html body #viralFissionToolView .vf-transcript-card .vf-source-display>.vf-card-copy {padding-top:32px;}
html body .vf-modal-error {color:var(--bc-error,#b33e3e);}

/* Fission: clear chapter navigation and stable, independently scrollable production regions. */
html body #viralFissionToolView .vf-result-pages {padding:4px;background:var(--bc-hover);border:1px solid var(--bc-border);border-radius:8px;gap:6px;}
html body #viralFissionToolView .vf-result-pages button {border:1px solid var(--bc-border)!important;background:var(--bc-surface)!important;color:var(--bc-text)!important;padding:4px 12px!important;min-height:32px;}
html body #viralFissionToolView .vf-result-pages button[aria-pressed=true] {background:var(--bc-text)!important;color:var(--bc-surface)!important;border-color:var(--bc-text)!important;font-weight:600;}
html body #viralFissionToolView .vf-result-pages button:focus-visible {outline:2px solid var(--bc-muted);outline-offset:2px;}
html body #viralFissionToolView .vf-soul-summary {margin-top:12px;}
html body #viralFissionToolView .vf-soul-summary .vf-content-card {display:flex;align-items:baseline;gap:16px;padding:12px 52px 12px 16px;}
html body #viralFissionToolView .vf-soul-summary h4 {margin:0;white-space:nowrap;}
html body #viralFissionToolView .vf-evidence-record dt,html body #viralFissionToolView .viral-direction-meta b {display:inline-flex;align-items:center;align-self:flex-start;min-height:22px;padding:1px 8px;border:1px solid var(--bc-border);border-radius:4px;background:var(--bc-hover);color:var(--bc-text);font-size:12px;line-height:20px;font-weight:600;white-space:nowrap;}
html body #viralFissionToolView .vf-evidence-record dd {flex:1;min-width:0;}
html body #viralFissionToolView .viral-direction-meta b {margin:0 8px 4px 0;}
html body #viralFissionToolView .vf-direction-instruction textarea {height:100px;min-height:100px;display:block;padding:12px;}
html body #viralFissionToolView .vf-run-page.vf-run-script {height:var(--vf-work-height,calc(100dvh - 250px));min-height:520px;grid-template-rows:minmax(0,1fr);}
html body #viralFissionToolView .vf-run-script>:is(.viral-dialogue-card,.viral-run-panel) {grid-row:auto;display:flex;flex-direction:column;min-height:0;gap:12px;}
html body #viralFissionToolView .vf-run-script .viral-run-field:has(textarea) {flex:1;display:flex;flex-direction:column;min-height:0;}
html body #viralFissionToolView .vf-run-script .vf-source-display {min-height:0;display:flex;flex-direction:column;overflow:auto;}
html body #viralFissionToolView .vf-run-script .vf-source-display>.vf-card-copy {min-height:0;overflow:auto;flex:1;padding-top:32px;scrollbar-gutter:stable;}
html body #viralFissionToolView .vf-run-script .vf-writing-tools {flex:none;min-height:112px;}
html body #viralFissionToolView .vf-run-script .viral-confirm-row {flex:none;align-self:stretch;}
html body #viralFissionToolView .vf-run-frame {height:var(--vf-work-height,calc(100dvh - 250px));min-height:520px;}
html body #viralFissionToolView .vf-run-frame>.viral-image-studio {height:100%;padding:0;border:0;background:transparent;display:flex;flex-direction:column;min-height:0;}
html body #viralFissionToolView .viral-image-studio>h3 {display:none;}
html body #viralFissionToolView .viral-image-studio-grid {flex:1;min-height:0;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr)!important;align-items:stretch;}
html body #viralFissionToolView .vf-frame-editor,html body #viralFissionToolView .vf-frame-results {min-height:0;min-width:0;padding:16px;border:1px solid var(--bc-border);border-radius:8px;background:var(--bc-surface);}
html body #viralFissionToolView .vf-frame-editor {display:flex;flex-direction:column;gap:12px;}
html body #viralFissionToolView .vf-frame-material-strip {height:220px;min-height:180px;flex:none;display:flex;gap:12px;overflow:auto;}
html body #viralFissionToolView .vf-frame-material-strip .viral-image-materials {flex:0 0 112px;min-width:0;}
html body #viralFissionToolView .vf-frame-material-strip .viral-image-materials>h4 {height:auto;margin:0 0 8px;font-size:14px;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-groups {display:flex;margin:0;gap:12px;min-width:0;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-group {flex:0 0 auto;min-width:144px;padding:0;border:0;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-list {flex-wrap:nowrap;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item {width:76px;flex:none;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item img {width:68px!important;height:121px!important;}
html body #viralFissionToolView .vf-frame-material-strip .viral-reference-frame img {height:144px;width:81px;aspect-ratio:9/16;}
html body #viralFissionToolView .vf-frame-editor .viral-image-generator {display:flex;flex-direction:column;flex:1;min-height:0;gap:10px;}
html body #viralFissionToolView .viral-image-generator>h4 {display:none;}
html body #viralFissionToolView .viral-image-generator>.viral-run-field:has(textarea) {display:flex;flex-direction:column;flex:1;min-height:0;margin:0;}
html body #viralFissionToolView .viral-image-generator .vf-source-display {min-height:0;display:flex;flex-direction:column;}
html body #viralFissionToolView .viral-image-generator .vf-card-copy {overflow:auto;min-height:0;flex:1;scrollbar-gutter:stable;}
html body #viralFissionToolView .viral-image-generator .vf-source-display h4 {display:none;}
html body #viralFissionToolView .viral-image-generator .vf-card-copy {padding-top:32px;}
html body #viralFissionToolView .viral-image-generator :is(.viral-run-actions,.viral-run-model-grid) {margin:0;flex:none;}
html body #viralFissionToolView .vf-frame-results {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;overflow:auto;--vf-portrait-height:clamp(200px,calc(var(--vf-work-height,800px) - 160px),720px);}
html body #viralFissionToolView .vf-frame-results>.viral-run-field,html body #viralFissionToolView .vf-frame-results>.viral-confirmed-panel {min-width:0;margin:0;}
html body #viralFissionToolView .vf-frame-results .viral-frame-card,html body #viralFissionToolView .vf-frame-results .viral-confirmed-frame {width:100%;max-width:calc(var(--vf-portrait-height)*9/16);}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid {grid-template-columns:minmax(260px,1.5fr) minmax(145px,.8fr) minmax(145px,.8fr) minmax(145px,.8fr) auto;align-items:center;}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid>.viral-run-field {display:flex;align-items:center;gap:8px;margin:0;min-width:0;}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid label {white-space:nowrap;margin:0;flex:none;}
html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid select {min-width:0;flex:1;}

html body #viralFissionToolView .vf-run-script>:is(.viral-dialogue-card,.viral-run-panel) {display:grid;grid-template-rows:100px minmax(0,1fr) 64px;gap:12px;}
html body #viralFissionToolView .vf-run-script .vf-writing-tools {min-height:0;}
html body #viralFissionToolView .vf-run-script .viral-confirm-row {grid-row:3;align-self:start;}
html body #viralFissionToolView .vf-frame-heading,html body #viralFissionToolView .vf-frame-results .viral-confirmed-panel>h4 {height:76px;margin:0;display:flex;flex-direction:column;justify-content:start;gap:6px;}
html body #viralFissionToolView .vf-frame-heading .vf-result-pages {margin:0;width:fit-content;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-group .viral-empty {max-width:160px;white-space:normal;}
html body #viralFissionToolView .viral-image-generator .viral-run-model-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;}
html body #viralFissionToolView .viral-image-generator .viral-run-model-grid .viral-run-field {display:flex;align-items:center;gap:8px;margin:0;}
html body #viralFissionToolView .viral-image-generator .viral-run-model-grid label {white-space:nowrap;margin:0;}
html body #viralFissionToolView .viral-image-generator .viral-run-model-grid select {flex:1;min-width:0;}

html body #viralFissionToolView .vf-inline-label {display:inline-block;margin:0 8px 4px 0;padding:0 6px;border:1px solid var(--bc-border);border-radius:4px;background:var(--bc-hover);font-weight:600;color:var(--bc-text);line-height:22px;}
html body #viralFissionToolView .vf-page-tabs>button {border:1px solid var(--bc-border)!important;background:var(--bc-surface);}
html body #viralFissionToolView .vf-page-tabs>button[aria-selected=true] {background:var(--bc-text)!important;color:var(--bc-surface)!important;border-color:var(--bc-text)!important;}
@media (max-width:1500px) {
  html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
  html body #viralFissionToolView .viral-video-panel>.viral-run-model-grid>button {grid-column:2;}
  html body #viralFissionToolView .viral-image-generator .viral-run-model-grid {grid-template-columns:minmax(0,1fr);}
  html body #viralFissionToolView .vf-run-script .viral-confirm-row {overflow:auto;}
}
/* Fission workspace: measure the available content area, with three aligned frame columns. */
html body #viralFissionToolView #viralFissionAnalysisView>.viral-section:has(.viral-soul-grid),
html body #viralFissionToolView #viralFissionAnalysisView>.viral-section:has(.viral-tag-groups) {height:var(--vf-analysis-height);min-height:0;display:flex;flex-direction:column;margin:0;gap:12px;}
html body #viralFissionToolView #viralFissionAnalysisView .viral-section>h3:first-child {display:none;}
html body #viralFissionToolView .viral-soul-grid:has(.vf-content-card) {flex:1;min-height:0;grid-template-rows:repeat(2,minmax(0,1fr));}
html body #viralFissionToolView .viral-soul-grid .vf-content-card {min-height:0;display:flex;flex-direction:column;}
html body #viralFissionToolView .viral-soul-grid .vf-card-copy {min-height:0;overflow:auto;flex:1;}
html body #viralFissionToolView .vf-soul-summary {margin:0;flex:none;}
html body #viralFissionToolView .viral-tag-groups {flex:1;min-height:0;grid-template-rows:repeat(4,minmax(0,1fr));}
html body #viralFissionToolView .viral-tag-group.vf-content-card {min-height:0;display:flex;flex-direction:column;justify-content:space-between;}
html body #viralFissionToolView .viral-tag-group h4 {margin-bottom:8px;}
html body #viralFissionToolView .vf-external-edit {display:flex;justify-content:flex-end;flex:none;height:32px;margin-bottom:6px;}
html body #viralFissionToolView .vf-external-edit .vf-corner-edit {position:static;}
html body #viralFissionToolView .vf-run-script>:is(.viral-dialogue-card,.viral-run-panel) {display:flex;flex-direction:column;gap:8px;padding:16px;}
html body #viralFissionToolView .vf-run-script .vf-writing-tools {display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;min-height:0;}
html body #viralFissionToolView .vf-writing-tools h3 {margin:0;}
html body #viralFissionToolView .vf-writing-tools .viral-run-model-grid {flex:1;min-width:180px;margin:0;}
html body #viralFissionToolView .vf-writing-tools .viral-run-actions {margin:0;}
html body #viralFissionToolView .vf-run-script .vf-source-display>.vf-card-copy,
html body #viralFissionToolView .viral-image-generator .vf-card-copy {padding-top:0;}
html body #viralFissionToolView .vf-run-script .viral-confirm-row {margin:0;gap:8px;}
html body #viralFissionToolView .vf-inline-label {margin-bottom:0;}
html body #viralFissionToolView .viral-image-studio-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px;}
html body #viralFissionToolView .viral-image-studio-grid>.viral-image-materials {display:flex;flex-direction:column;min-height:0;min-width:0;padding:16px;border:1px solid var(--bc-border);border-radius:8px;background:var(--bc-surface);}
html body #viralFissionToolView .viral-image-materials>h4 {margin:0 0 12px;font-size:14px;}
html body #viralFissionToolView .viral-image-materials>.viral-source-frame {display:flex;flex-direction:column;flex:1;min-height:0;max-width:100%;width:100%;margin:0;}
html body #viralFissionToolView .viral-source-frame>button {min-height:0;flex:1;display:flex;justify-content:center;background:var(--bc-canvas);}
html body #viralFissionToolView .viral-source-frame img,html body #viralFissionToolView .viral-source-frame>video {width:100%!important;height:100%!important;min-height:0;object-fit:contain;aspect-ratio:9/16;flex:1;}
html body #viralFissionToolView .viral-source-frame footer {flex:none;margin-top:12px;}
html body #viralFissionToolView .vf-frame-editor {padding:12px;gap:12px;}
html body #viralFissionToolView .vf-frame-material-strip {height:210px;min-height:0;flex:none;display:flex;flex-direction:column;gap:6px;overflow:visible;}
html body #viralFissionToolView .vf-material-tabs,html body #viralFissionToolView .vf-frame-result-tabs {display:flex;gap:6px;flex:none;}
html body #viralFissionToolView :is(.vf-material-tabs,.vf-frame-result-tabs) button[aria-pressed=true] {background:var(--bc-text);color:var(--bc-surface);}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-groups {display:block;min-height:0;flex:1;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-group {min-width:0;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-list {display:flex;gap:8px;overflow-x:auto;flex-wrap:nowrap;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item {width:90px;flex:none;position:relative;display:flex;flex-direction:column;gap:2px;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item img {width:72px!important;height:128px!important;object-fit:contain;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-caption {display:none;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item>button {position:absolute;right:2px;bottom:20px;padding:4px;}
html body #viralFissionToolView .viral-image-generator .viral-material-head small {display:none;}
html body #viralFissionToolView .viral-image-generator .viral-run-model-grid {grid-template-columns:1fr;}
html body #viralFissionToolView .vf-frame-results {display:flex!important;flex-direction:column;gap:8px;overflow:visible;--vf-portrait-height:calc(var(--vf-work-height,800px) - 180px);}
html body #viralFissionToolView .vf-frame-results>.viral-run-field,html body #viralFissionToolView .vf-frame-results>.viral-confirmed-panel {flex:1;min-height:0;display:flex;flex-direction:column;}
html body #viralFissionToolView .vf-frame-heading,html body #viralFissionToolView .vf-frame-results .viral-confirmed-panel>h4 {height:auto;flex:none;margin:0 0 8px;}
html body #viralFissionToolView .vf-frame-results :is(.viral-frame-history,.viral-frame-card,.viral-confirmed-frame) {flex:1;min-height:0;display:flex;flex-direction:column;margin:0 auto;width:100%;max-width:100%;}
html body #viralFissionToolView .vf-frame-results :is(.viral-frame-card,.viral-confirmed-frame)>button[data-vf-preview] {flex:1;min-height:0;display:flex;justify-content:center;}
html body #viralFissionToolView .vf-frame-results img {height:100%!important;width:100%!important;min-height:0;object-fit:contain;aspect-ratio:9/16;}
html body #viralFissionToolView [hidden] {display:none!important;}
html body #viralFissionToolView .vf-frame-material-strip {height:250px;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item {width:calc((100% - 16px)/3);min-width:100px;}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-item img {width:100%!important;height:164px!important;}
html body #viralFissionToolView .vf-frame-upload-slot {width:calc((100% - 16px)/3);min-width:100px;height:180px;flex:none;background:var(--bc-canvas);border:1px dashed var(--bc-border);border-radius:6px;color:var(--bc-muted);}
html body #viralFissionToolView .vf-frame-material-strip .viral-material-group {background:transparent;}
html body #viralFissionToolView .vf-run-frame textarea.vf-frame-prompt-input {display:block!important;height:0!important;min-height:100px!important;flex:1;width:100%;resize:none;}
html body #viralFissionToolView .viral-image-generator {padding:0;border:0;background:transparent;}
html body #viralFissionToolView .viral-image-generator>.viral-material-head {min-height:32px;}
html body #viralFissionToolView .viral-image-generator>.viral-material-head strong {display:block!important;font-size:14px;}
html body #viralFissionToolView .viral-image-materials>h4 {height:32px;}
html body #viralFissionToolView .vf-frame-results>.viral-run-field {padding:0;border:0;}
html body #viralFissionToolView .vf-frame-heading {flex-direction:row;align-items:center;justify-content:space-between;min-height:32px;}
html body #viralFissionToolView .vf-frame-results .viral-frame-card {border:0;padding:0;}
html body #viralFissionToolView .vf-corner-edit.vf-outside-edit {position:static;flex:none;}
html body #viralFissionToolView .vf-frame-material-strip {height:270px;}
html body #viralFissionToolView .vf-frame-result-tabs {min-height:44px;align-items:flex-start;}
html body #viralFissionToolView .vf-frame-result-tabs>.vf-result-pages {margin:0;padding:0;border:0;background:transparent;}
html body #viralFissionToolView .vf-frame-results {align-items:stretch;}
html body #viralFissionToolView .vf-frame-result-tabs {width:100%;}
html body #viralFissionToolView .vf-frame-result-tabs>[data-vf-result=confirmed] {margin-left:auto!important;flex:none;}
html body #viralFissionToolView .vf-frame-results>.viral-run-field,html body #viralFissionToolView .vf-frame-results>.viral-confirmed-panel {width:100%;}
html body #viralFissionToolView .vf-frame-results>.viral-confirmed-panel {padding:0;border:0;background:transparent;}
html body #viralFissionToolView .vf-frame-results .viral-confirmed-frame {padding:0;border:0;background:transparent;gap:0;}
html body #viralFissionToolView .vf-frame-results :is(.viral-frame-card,.viral-confirmed-frame)>button[data-vf-preview] {padding:0;border:0;overflow:hidden;}
html body #viralFissionToolView .vf-frame-results img {max-height:none!important;}
html body #viralFissionToolView .vf-frame-results :is(.viral-frame-card footer,.viral-confirmed-frame-meta) {box-sizing:border-box;height:40px;min-height:40px;flex:none;margin:0;padding:4px 0;}
html body #viralFissionToolView .vf-frame-results :is(.viral-frame-card,.viral-confirmed-frame)>button:not([data-vf-preview]) {height:32px;min-height:32px;flex:none;margin:0;}
html body #viralFissionToolView .viral-image-generator>.viral-run-actions {display:flex;align-items:center;gap:12px;min-width:0;flex:none;}
html body #viralFissionToolView .viral-image-generator>.viral-run-actions>button {flex:0 1 48%;min-width:0;}
html body #viralFissionToolView .viral-image-generator>.viral-run-actions:has(.vf-processing)>span {display:none;}
html body #viralFissionToolView .viral-image-generator>.viral-run-actions>.vf-processing {flex:1;min-width:0;margin:0;padding:0;border:0;background:transparent;align-items:flex-start;line-height:18px;font-size:12px;white-space:normal;overflow-wrap:anywhere;}
html body #viralFissionToolView .viral-image-generator>.viral-run-actions>.vf-processing [data-vf-processing-text] {min-width:0;white-space:normal;overflow-wrap:anywhere;}
html body #viralFissionToolView .vf-plan-editor .vf-card-copy {line-height:28px;}
html body #viralFissionToolView .vf-plan-editor .vf-inline-label {margin-top:3px;margin-bottom:3px;vertical-align:baseline;}
html body #viralFissionToolView .vf-upload-status {font-size:12px;line-height:18px;color:var(--bc-muted);min-width:0;overflow-wrap:anywhere;}
html body #viralFissionToolView .viral-material-head>.vf-upload-status {flex:1;text-align:right;max-height:36px;overflow:hidden;}
html body #viralFissionToolView .viral-material-group[aria-busy=true] .vf-upload-status {color:var(--bc-text);}
html body #viralFissionToolView .viral-image-generator>.viral-material-head strong {flex:1;}
html body #viralFissionToolView .viral-source-frame footer {min-height:56px;align-items:flex-end;}
html body #viralFissionToolView .vf-writing-tools .viral-run-model-grid {display:grid;grid-template-columns:minmax(0,1fr);min-width:200px;}
html body #viralFissionToolView .vf-writing-tools .viral-run-model-grid .viral-run-field {min-width:0;margin:0;}
html body #viralFissionToolView .vf-writing-tools .viral-run-model-grid select {min-width:0;width:100%;}
html body #viralFissionToolView #viralFissionAnalysisView>.vf-factors-section {min-height:var(--vf-analysis-height);display:flex;flex-direction:column;gap:12px;}
html body #viralFissionToolView .vf-factors-section>.vf-evidence-chain {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:1;}
html body #viralFissionToolView .vf-risk-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
html body #viralFissionToolView .vf-factors-section>h3 {margin:0;}
/* Fission writing: dedicated model/action row with a stable readable selector. */
html body #viralFissionToolView .vf-script-editor .vf-writing-tools {display:grid;grid-template-columns:minmax(180px,1fr) auto;grid-template-areas:"title edit" "model generate";align-items:center;gap:10px 12px;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > h3 {grid-area:title;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > .vf-outside-edit {grid-area:edit;justify-self:end;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > .viral-run-field {grid-area:model;display:block;min-width:0;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > .viral-run-field > label {display:none;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools select {width:100%;min-width:0;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > .viral-run-actions {grid-area:generate;}
html body #viralFissionToolView .vf-script-editor .vf-writing-tools > .viral-run-actions > span:empty {display:none;}
html body #viralFissionToolView .vf-run-tab-item {display:flex;align-items:stretch;min-width:0;gap:4px;}
html body #viralFissionToolView .vf-run-tab-item .viral-run-tab {flex:1;min-width:0;}
html body #viralFissionToolView .vf-run-delete {align-self:center;width:32px;height:32px;padding:6px;border:1px solid var(--border);}
html body #viralFissionToolView .vf-run-delete svg {width:16px;height:16px;}
html body #viralFissionToolView .vf-run-tab-item > input[data-vf-rename] {min-width:0;height:40px;padding:0 12px;font:inherit;box-sizing:border-box;}

/* A single stage editor retains space for long administrator prompts. */
html body #tab-config-prompt .template-editor {display:flex;flex-direction:column;gap:12px;min-height:0}
html body #tab-config-prompt .template-section[hidden] {display:none!important}
html body #tab-config-prompt .template-section:not([hidden]) {flex:1;min-height:0;display:flex;flex-direction:column}
html body #tab-config-prompt .template-section textarea {flex:1;min-height:180px;resize:none}
html body #tab-config-prompt #cfgPromptStage {flex:1;max-width:520px}
html body #tab-config-prompt .prompt-stage-toolbar {display:flex;align-items:center;justify-content:flex-start;gap:12px;margin:0;padding-bottom:12px;border-bottom:1px solid var(--border,#e5e5e5)}
html body #tab-config-prompt .prompt-stage-toolbar label {font-size:14px;font-weight:600;white-space:nowrap}
html body #tab-config-prompt .template-section-head label {font-size:14px;font-weight:600;color:var(--bc-text)}
@media(min-width:1101px){html body #tab-config-prompt {height:calc(100dvh - 28px)}}
#viralFissionToolView .vf-video-readiness {display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:8px 12px;border:1px solid var(--border,#e5e5e5);border-radius:6px}
#viralFissionToolView .vf-processing {display:flex;align-items:center;gap:8px;flex:none;padding:8px 10px;border:1px solid var(--border,#e5e5e5);border-radius:6px;background:var(--surface,#fafafa);font-size:12px;line-height:18px}
#viralFissionToolView .vf-processing-spinner {width:14px;height:14px;flex:none;border:2px solid #ddd;border-top-color:#666;border-radius:50%;animation:vf-processing-spin 1s linear infinite}
@keyframes vf-processing-spin {to {transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#viralFissionToolView .vf-processing-spinner {animation:none}}

html body #viralFissionToolView button:disabled {pointer-events:auto;}

html body #viralFissionToolView #viralFissionStatus.vf-processing {padding:8px 10px;min-height:36px;height:auto;overflow:visible;flex-wrap:wrap;line-height:18px;}
html body #viralFissionToolView .vf-video-comparison .vf-video-wait {flex-direction:column;gap:12px;text-align:center;overflow-wrap:anywhere;}
html body #viralFissionToolView .vf-video-wait {font-size:13px;line-height:20px;} html body #viralFissionToolView .vf-video-wait strong {font-size:14px;line-height:22px;}
