:root {
  color-scheme: dark;
  --bg: #151413;
  --panel: #201f1d;
  --inner: #1a1917;
  --rule: #3a3732;
  --ink: #f6eee2;
  --dim: #b7ac9e;
  --quiet: #a29583;
  --accent: #edb985;
  --green: #a6d2ad;
  --red: #f3aa9e;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
[hidden] { display: none !important; }
a, button, input, select { font: inherit; }
button, select, a, label:has(input[type=radio]), label[for=clip] { touch-action: manipulation; }
button, select, label:has(input[type=radio]), label[for=clip] { cursor: pointer; }
button:disabled { opacity: .58; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
button, .secondary { border: 1px solid var(--rule); background: var(--inner); color: var(--ink); border-radius: 7px; padding: 8px 12px; }
button:hover, .secondary:hover { border-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 72px; padding: 0 max(24px, calc((100vw - 1490px) / 2)); border-bottom: 1px solid #302e2a; background: #191816; }
.masthead, .environment { display: flex; align-items: center; gap: 13px; }
.masthead b { display: block; font-size: 15px; letter-spacing: .065em; }
.masthead div span, .index-mark, .monitor-meta, .section-no { font-family: Consolas, "SFMono-Regular", monospace; letter-spacing: .10em; }
.masthead div span { display: block; color: var(--quiet); font-size: 10px; }
.index-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #775b3d; color: var(--accent); border-radius: 7px; font-size: 13px; }
.environment { color: var(--dim); font-size: 12px; gap: 8px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.workspace { max-width: 1538px; padding: 32px 24px 44px; margin: 0 auto; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 25px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .14em; margin-bottom: 6px; }
.eyebrow span { color: var(--quiet); padding: 0 6px; }
h1 { font-size: clamp(25px, 3vw, 38px); line-height: 1.25; letter-spacing: -.025em; }
.page-description { color: var(--dim); max-width: 340px; font-size: 13px; }
.production { display: grid; grid-template-columns: minmax(230px, .79fr) minmax(360px, 1.75fr) minmax(244px, .85fr); gap: 14px; align-items: start; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 17px; }
.section-head { display: flex; align-items: center; gap: 9px; min-height: 31px; margin-bottom: 14px; }
.section-head h2 { font-size: 15px; white-space: nowrap; }
.section-no { color: var(--accent); font-size: 11px; padding-right: 9px; border-right: 1px solid var(--rule); }
.badge { margin-left: auto; padding: 3px 8px; border: 1px solid #4a443b; border-radius: 5px; color: var(--dim); white-space: nowrap; font-size: 11px; }
.badge.ok { border-color: #446452; color: var(--green); }
.badge.warn { border-color: #71553e; color: var(--accent); }
.badge.bad { border-color: #744c43; color: var(--red); }
.mode-switch { margin: 0 0 18px; padding: 3px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; border: 1px solid #36322e; background: var(--inner); border-radius: 8px; }
.mode-switch label { position: relative; text-align: center; }
.mode-switch input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.mode-switch span { display: block; color: var(--dim); padding: 8px 5px; border-radius: 5px; font-size: 13px; white-space: nowrap; }
.mode-switch input:checked + span { background: #413327; color: var(--accent); font-weight: 700; }
.mode-switch input:focus-visible + span, .file-drop:focus-within { outline: 2px solid var(--accent); }
.form-group { display: grid; gap: 7px; margin-bottom: 16px; }
.form-group > label:not(.file-drop) { font-size: 12px; font-weight: 650; }
select, input:not([type=radio],[type=checkbox],[type=file]) { width: 100%; min-width: 0; color: var(--ink); background: var(--inner); border: 1px solid var(--rule); border-radius: 7px; padding: 9px 10px; }
input::placeholder { color: #a39889; font-size: 12px; }
.hint, .empty { color: var(--dim); font-size: 12px; }
.optional { color: var(--quiet); font-size: 10px; padding-left: 6px; }
.file-drop { display: grid; gap: 3px; padding: 15px 12px; border: 1px dashed #786044; color: var(--accent); border-radius: 8px; background: #29231e; }
.file-drop:hover { border-color: var(--accent); }
.file-drop small { color: var(--dim); overflow-wrap: anywhere; }
#upload-fields:has(#clip:focus-visible) .file-drop { outline: 2px solid var(--accent); outline-offset: 3px; }
.voice-control { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.quiet { font-size: 12px; color: var(--accent); white-space: nowrap; }
.check-option { display: flex; gap: 8px; padding-bottom: 14px; font-size: 12px; }
.check-option small { display: block; color: var(--dim); font-size: 11px; }
input[type=checkbox] { margin: 3px 0 0; accent-color: var(--accent); align-self: start; }
.primary { display: block; width: 100%; min-height: 42px; background: var(--accent); color: #25180e; border-color: var(--accent); font-weight: 700; letter-spacing: .02em; }
.primary:hover { background: #ffd0a2; }
.submit-hint { text-align: center; margin-top: 7px; font-size: 11px; }
.monitor { position: relative; overflow: hidden; min-height: 420px; display: grid; place-items: center; padding: 17px 42px; border: 1px solid #40362e; border-radius: 9px; background: radial-gradient(ellipse at 50% 58%,#38291f,#181614 68%); }
.preview-window { position: relative; height: clamp(342px, 51vh, 490px); width: auto; max-width: 100%; aspect-ratio: 9/16; border: 1px solid #6f533a; border-radius: 11px; overflow: hidden; background: #18120e; box-shadow: 0 20px 37px #0b08076d; }
.preview-window img, .preview-window video { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-window video { object-fit: contain; background: #17110d; }
.frame-caption { position: absolute; left: 17px; right: 11px; top: 21%; display: grid; gap: 5px; color: #fff2de; text-shadow: 0 2px 15px #150b05; pointer-events: none; }
.frame-caption span { font: 10px Consolas, monospace; color: #ffd0a4; letter-spacing: .16em; }
.frame-caption b { font-size: 19px; }
.monitor-meta { position: absolute; display: flex; gap: 9px; left: 11px; top: 11px; color: #b9a38c; font-size: 9px; }
.bottom-meta { top: auto; bottom: 11px; justify-content: space-between; right: 11px; }
.preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 1px 0; }
.preview-footer h3 { font-size: 14px; overflow-wrap: anywhere; }
.preview-footer p { color: var(--dim); font-size: 12px; margin-top: 2px; }
.version-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.secondary { text-decoration: none; color: var(--accent); white-space: nowrap; font-size: 12px; }
.filmstrip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(74px, 1fr); gap: 4px; overflow-x: auto; margin-top: 11px; padding: 3px 0; }
.filmstrip button { padding: 5px; color: var(--dim); font-size: 11px; white-space: nowrap; background: #26211e; }
.filmstrip small { color: var(--accent); display: block; font-family: Consolas,monospace; }
.steps { padding: 0; margin: 0; list-style: none; }
.steps li { position: relative; display: grid; grid-template-columns: 27px 1fr; column-gap: 9px; min-height: 48px; }
.steps li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 1px; width: 1px; background: #4c4339; }
.step-icon { display: grid; place-items: center; width: 27px; height: 27px; color: var(--quiet); background: #26231f; border: 1px solid #4a4238; border-radius: 6px; font: 11px Consolas,monospace; }
.step-label { color: var(--ink); font-size: 13px; font-weight: 600; }
.step-detail { font-size: 11px; color: var(--quiet); margin-bottom: 8px; }
.steps li.running .step-icon, .steps li.warn .step-icon { border-color: #89613f; color: var(--accent); background: #3a2c20; }
.steps li.done .step-icon { color: var(--green); border-color: #425c49; background: #27312a; }
.steps li.bad .step-icon { color: var(--red); border-color: #754d43; }
.notice { color: var(--dim); background: var(--inner); border: 1px solid var(--rule); border-radius: 7px; padding: 9px 10px; font-size: 12px; overflow-wrap: anywhere; }
.notice.error { color: var(--red); border-color: #70493e; margin: 10px 0; }
.draft-message { margin-top: 8px; overflow-wrap: anywhere; }
.actions { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.actions button { text-align: left; font-size: 12px; }
.results { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 14px; margin-top: 14px; align-items: start; }
.empty { padding: 8px 0 15px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; margin-bottom: 6px; text-align: left; background: var(--inner); }
.history-item[aria-current=true] { border-color: #a57650; background: #33291f; }
.history-item strong { font-size: 12px; display: block; overflow-wrap: anywhere; }
.history-item small { color: var(--dim); display: block; font-size: 11px; }
.quality-list { list-style: none; margin: 10px 0 0; padding: 0; }
.quality-list li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--rule); }
.quality-list b { font-size: 12px; }
.quality-list small { display: block; color: var(--dim); font-size: 11px; }
.check-pass, .check-fail { font-size: 11px; color: var(--green); }
.check-fail { color: var(--red); }
.qa-content-title { font-size: 13px; margin-bottom: 2px; }
.story-rows { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; padding: 0; }
.story-rows li { border-radius: 5px; border: 1px solid var(--rule); color: var(--dim); font-size: 11px; padding: 4px 7px; }
.qa-panel details { border-top: 1px solid var(--rule); margin-top: 9px; padding-top: 8px; }
.qa-panel summary { color: var(--accent); cursor: pointer; font-size: 12px; }
.qa-panel details p { color: var(--dim); font-size: 12px; margin: 7px 0; }
.qa-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.edit-total { color: var(--accent); margin: 12px 0; font-size: 14px; }
.source-review { display: block; width: min(100%, 280px); max-height: 360px; margin: 12px 0; background: var(--inner); }
.edit-decisions { padding: 0; list-style: none; }
.edit-decisions li { padding: 12px 0; border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.edit-decisions b { font-size: 14px; font-variant-numeric: tabular-nums; }
.edit-decisions button { margin: 4px 8px 0 0; min-height: 36px; font-size: 12px; }

/* A single persistent status surface; stage animation follows real server state. */
:root { --dock-height: 0px; }
[tabindex="-1"], #video { scroll-margin-top: calc(var(--dock-height) + 28px); }
::selection { background: #805a37; color: #fff5e7; }
input { caret-color: var(--accent); }
* { scrollbar-color: #766551 var(--inner); scrollbar-width: thin; }
.task-dock { position: sticky; top: 8px; z-index: 20; display: flex; align-items: center; gap: 15px;
  margin: 16px 0; padding: 13px 17px 16px; border: 1px solid #6f533a; border-radius: 12px;
  background: #2b241e; color: var(--accent); overflow: hidden; }
.task-dock[data-tone="ok"] { border-color: #506b55; background: #232c25; color: var(--green); }
.task-dock[data-tone="bad"] { border-color: #88584b; background: #30221e; color: var(--red); }
.dock-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.dock-copy strong { font-size: 15px; }
.dock-copy > span { color: var(--dim); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dock-meta { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dock-actions button { min-height: 38px; font-size: 12px; }
#progress-jump { background: var(--accent); border-color: var(--accent); color: #25180e; font-weight: 650; }
.task-signal { display: flex; gap: 3px; align-items: center; height: 26px; flex: 0 0 22px; }
.task-signal i { width: 4px; height: 9px; border-radius: 1px; background: currentColor; }
.task-signal i:nth-child(2) { height: 23px; }
.task-signal i:nth-child(3) { height: 15px; }
.task-dock:not([data-busy="true"]) .task-signal i { height: 5px; }
.dock-meter { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #453526; }
.dock-meter span, .upload-meter span { display: block; height: 100%; background: var(--accent); transform-origin: left; transition: transform 180ms ease-out; }
.task-dock:not([data-upload="true"]) .dock-meter { display: none; }
.monitor.show-task { background: #1b1815; }
.show-task > .preview-window, .show-task > .monitor-meta { display: none; }
.task-stage { width: 100%; max-width: 430px; padding: 28px 0; text-align: center; }
.task-stage h3 { font-size: clamp(20px, 2.2vw, 27px); line-height: 1.4; margin: 24px 0 12px; text-wrap: balance; }
#stage-detail { color: var(--dim); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.stage-meta { color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 20px; font-size: 14px; }
#stage-hint { margin-top: 12px; }
.edit-motion { position: relative; width: min(100%, 248px); height: 88px; margin: 0 auto; padding: 12px 0; overflow: hidden; }
.motion-track { display: flex; gap: 6px; height: 34px; padding: 2px; }
.motion-track i { background: #60462f; border: 1px solid #a87b50; border-radius: 4px; flex: 1; }
.motion-track i:nth-child(2) { flex: 1.6; background: #93704c; }
.motion-track i:nth-child(3) { flex: .6; }
.audio-track { height: 19px; margin-top: 7px; gap: 3px; }
.audio-track i { border-color: #718467; background: #394c3a; }
.audio-track i:nth-child(2) { background: #4c604b; flex: .7; }
.motion-playhead { position: absolute; inset: 1px auto 1px 0; width: 2px; background: var(--accent); transform: translateX(123px); }
.motion-playhead::before { content: ''; position: absolute; top: 0; width: 10px; height: 7px; left: -4px;
  background: var(--accent); clip-path: polygon(0 0,100% 0,100% 45%,50% 100%,0 45%); }
.task-stage[data-busy="true"].on-screen .motion-playhead { animation: editing-playhead 2.6s linear infinite; }
.task-stage[data-phase="queue"].on-screen .motion-playhead { animation: none; transform: translateX(3px); }
.task-stage:not([data-busy="true"]) .edit-motion { opacity: .55; }
.task-stage[data-tone="bad"] h3 { color: var(--red); }
.upload-meter { overflow: hidden; height: 6px; background: #49392a; border-radius: 3px; margin-top: 22px; }
.steps li { padding: 7px 6px; margin: 0 -6px; border-radius: 7px; transition: background-color 180ms ease-out; }
.steps li:not(:last-child)::before { left: 19px; top: 34px; }
.steps li.running { background: #37291e; }
.steps li.running .step-label { color: var(--accent); }
.steps li.running .step-detail { color: #e4c19d; }
.steps li.done .step-icon { font-size: 0; }
.steps li.done .step-icon::after { content: ''; width: 9px; height: 5px; border: solid var(--green); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px,-1px); }
.steps li.unavailable .step-detail { color: var(--dim); }
.page-hidden .motion-playhead { animation-play-state: paused !important; }
@keyframes editing-playhead { from { transform: translateX(3px); } to { transform: translateX(244px); } }
@media (prefers-reduced-motion: reduce) {
  .task-stage[data-busy="true"].on-screen .motion-playhead { animation: none; transform: translateX(123px); }
  .dock-meter span, .upload-meter span, .steps li { transition: none; }
}
@media (max-width: 1110px) {
  .production { grid-template-columns: minmax(215px,.82fr) minmax(0,1.5fr) minmax(215px,.85fr); }
  .panel { padding: 14px; }
  .monitor { padding-inline: 23px; }
}
@media (max-width: 870px) {
  .production { grid-template-columns: minmax(210px,.8fr) minmax(0,1.25fr); }
  .process-panel { grid-column: 1/-1; }
  .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .steps li::before { display: none; }
}
@media (max-width: 575px) {
  .topbar { min-height: 61px; padding: 0 14px; }
  .masthead { gap: 8px; }
  .masthead b { font-size: 13px; }
  .environment { font-size: 10px; max-width: 130px; }
  .workspace { padding: 22px 12px 35px; }
  .page-title { display: block; margin-bottom: 17px; }
  .page-description { margin-top: 7px; }
  .production, .results { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .process-panel { grid-column: auto; }
  .monitor { padding: 18px 19px; min-height: 372px; }
  .preview-window { height: min(395px, 100vw); }
  .preview-footer { flex-wrap: wrap; }
  .filmstrip { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .task-dock { gap: 8px; padding: 11px 12px 13px; flex-wrap: wrap; top: 4px; }
  .task-signal { display: none; }
  .dock-copy { flex-basis: calc(100% - 110px); }
  .dock-copy strong { font-size: 14px; }
  .dock-meta { font-size: 11px; }
  .dock-actions { width: 100%; margin-top: 3px; }
  .dock-actions button { flex: 1; min-height: 36px; }
  .task-stage { padding: 22px 0; }
  .task-stage h3 { font-size: 22px; }
  .monitor.show-task { min-height: 335px; }
}
