/* 映序 · 创作工作台（V2 视觉）
   用底色深浅分层、少用边框；间距取 4 的倍数；字号 12/13/14/16/20；
   主题色只给主要操作；状态色只做小圆点与小标签。不使用内联样式（CSP）。 */
/* THEME TOKENS START（与 public/style.css 完全相同，测试会核对） */
/* 两套外观：夜间「墨色」与日间「青绿」。每个颜色写成 light-dark(日间, 夜间)，
   由 color-scheme 决定取哪一个：没有选择时跟随电脑设置，员工选择后由 data-theme 固定。 */
:root {
  color-scheme: dark light;
  --canvas: light-dark(#e5e8e1, #121110); --panel: light-dark(#f6f7f2, #1a1916); --raised: light-dark(#eceee7, #23211d); --hover: light-dark(#e1e5dc, #2c2a25);
  --line: light-dark(rgba(20,45,40,.08), rgba(238,228,208,.06)); --line2: light-dark(rgba(20,45,40,.14), rgba(238,228,208,.11)); --line-ink: light-dark(rgba(20,45,40,.24), rgba(238,228,208,.2));
  --t1: light-dark(#1c2422, #ece4d3); --t2: light-dark(#46514d, #b4aa97); --t3: light-dark(#66716d, #8d8575);
  --accent: light-dark(#2d6272, #c0503d); --accent-ink: light-dark(#f3f8f7, #fff4e8); --accent-soft: light-dark(rgba(45,98,114,.11), rgba(192,80,61,.16));
  --run: light-dark(#2b7a72, #5ba69f); --ok: light-dark(#3f7142, #80ad73); --warn: light-dark(#9a6a22, #d2a04c); --err: light-dark(#a5402f, #cf6450);
  --ok-bg: light-dark(rgba(63,113,66,.12), rgba(128,173,115,.12)); --warn-bg: light-dark(rgba(166,117,43,.12), rgba(210,160,76,.10)); --warn-ink: light-dark(#6f4c15, #e3c07e);
  --err-bg: light-dark(rgba(165,64,47,.09), rgba(207,100,80,.10)); --err-ink: light-dark(#8a3122, #e9998a); --info-bg: light-dark(rgba(43,122,114,.09), rgba(91,166,159,.09)); --info-ink: light-dark(#245c56, #9fd0ca);
  --tile: light-dark(#dde3db, #171612); --scroll: light-dark(#c3cbc2, #3a362f); --blot: light-dark(rgba(45,98,114,.14), rgba(238,228,208,.08)); --nav-on: light-dark(#1d4a57, #ece4d3);
  --toast: light-dark(#1f2a28, #2e2b25); --toast-ink: light-dark(#eef3f0, #ece4d3); --avatar: light-dark(#cfd8cf, #3a352d);
  --seal: light-dark(#a5402f, #b0352a); --seal-ink: #fff6ea; --veil: light-dark(rgba(240,243,238,.86), rgba(12,11,10,.74));
  --shadow-color: light-dark(rgba(20,45,40,.07), transparent); --float-shadow-color: light-dark(rgba(20,45,40,.18), rgba(0,0,0,.6)); --backdrop: light-dark(rgba(20,32,30,.3), rgba(5,4,3,.6));
  --badge: light-dark(#9a6a22, #d2a04c); --badge-ink: light-dark(#fffaf0, #1b1406);
  --serif: "Noto Serif SC", "Source Han Serif SC", "思源宋体", "SimSun", serif;
  --grain: url(/studio/assets/grain-dark.svg); --mountains: url(/studio/assets/mountains-mist.svg);
  --r-lg: 12px; --r: 8px; --r-sm: 6px;
}
:root[data-theme="ink"] { color-scheme: dark; }
:root[data-theme="qinglv"] { color-scheme: light; --grain: url(/studio/assets/grain-light.svg); --mountains: url(/studio/assets/mountains-qinglv.svg); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) { --grain: url(/studio/assets/grain-light.svg); --mountains: url(/studio/assets/mountains-qinglv.svg); } }
/* THEME TOKENS END */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--canvas); color: var(--t1);
  font: 13px/1.55 "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; background-image: var(--grain); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 600; } h2 { font-size: 16px; font-weight: 600; } h3 { font-size: 14px; font-weight: 600; }
small, .muted { color: var(--t3); } small { font-size: 12px; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::placeholder { color: var(--t3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- 按钮与表单 ---------- */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 0; border-radius: var(--r); background: var(--raised); color: var(--t1); font: inherit; text-decoration: none;
  white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; touch-action: manipulation; }
button:hover, .button:hover { background: var(--hover); }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary, button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover { background: var(--accent); filter: brightness(1.07); }
.danger { color: var(--err); }
.dark { background: var(--raised); }
.btn.ghost, button.ghost { background: transparent; color: var(--t2); }
.btn.ghost:hover, button.ghost:hover { background: var(--raised); color: var(--t1); }
.btn.sm, button.sm { min-height: 26px; height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 26px; }
.link { color: var(--accent); cursor: pointer; background: none; padding: 0; min-height: 0; }
.link:hover { background: none; text-decoration: underline; }
input, select, textarea { width: 100%; min-width: 0; font: inherit; color: var(--t1); background: var(--raised);
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 10px; outline: none; transition: border-color .15s, background .15s; }
input:hover, select:hover, textarea:hover { background: var(--hover); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--raised); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; line-height: 1.65; }
label { display: grid; gap: 6px; color: var(--t3); font-size: 12px; }
label input, label select, label textarea { color: var(--t1); font-size: 13px; }

/* ---------- 文字与布局工具 ---------- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.space-between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.grow { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--t3); line-height: 1.7; }
.label { font-size: 12px; color: var(--t3); letter-spacing: .04em; }
.eyebrow { font-size: 12px; letter-spacing: 3px; color: var(--t3); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { display: grid; place-content: center; gap: 10px; text-align: center; padding: 36px 16px; min-height: 150px; color: var(--t3); }
.empty strong { color: var(--t1); }
.error-note { color: var(--err-ink); font-size: 12px; }
.readonly-block { white-space: pre-wrap; word-break: break-word; background: var(--raised); border-radius: var(--r); padding: 10px 12px; color: var(--t2); max-height: 260px; overflow: auto; margin: 0; font: inherit; }

/* ---------- 标签、圆点、提示 ---------- */
.pill, .tag { display: inline-flex; align-items: center; gap: 4px; min-height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px;
  background: var(--raised); color: var(--t2); white-space: nowrap; }
.pill.good, .tag.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn, .tag.warn { color: var(--warn-ink); background: var(--warn-bg); }
.pill.error, .tag.err { color: var(--err-ink); background: var(--err-bg); }
.tag.run { color: var(--info-ink); background: var(--info-bg); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); }
.dot.run { background: var(--run); animation: pulse 1.4s infinite; }
.dot.hollow { border: 1.5px solid var(--t3); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); font-size: 13px; background: var(--raised); color: var(--t2); }
.notice .i { margin-top: 2px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }
.notice.info { background: var(--info-bg); color: var(--info-ink); }
.notice > span { flex: 1; min-width: 0; }
.notice button { flex: none; }
.kbd { display: inline-block; min-width: 20px; padding: 0 6px; height: 20px; line-height: 20px; border-radius: 4px; background: var(--hover); font-size: 12px; text-align: center; color: var(--t2); }
.prog { height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--run); transition: width .5s; }
.prog.p25 > i { width: 25%; } .prog.p60 > i { width: 60%; } .prog.p99 > i { width: 99%; }
progress.progress { width: 120px; height: 4px; appearance: none; border: 0; border-radius: 2px; overflow: hidden; background: var(--hover); color: var(--run); }
progress.progress::-webkit-progress-bar { background: var(--hover); }
progress.progress::-webkit-progress-value { background: var(--run); }
progress.progress::-moz-progress-bar { background: var(--run); }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 14px; padding: 32px 28px; display: grid; gap: 14px; justify-items: start;
  box-shadow: 0 30px 80px var(--float-shadow-color), 0 0 0 1px var(--line2); }
.login-card form { display: grid; gap: 12px; width: 100%; }
.login-card form button { width: 100%; height: 36px; }
.login-card .text-link { font-size: 12px; color: var(--t3); }
#login-message { color: var(--warn-ink); font-size: 12px; min-height: 18px; }

/* ---------- 外框 ---------- */
#app { display: grid; grid-template-rows: 52px minmax(0, 1fr); height: 100vh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0; min-width: 0; }
.brand { width: 64px; flex: none; display: flex; justify-content: center; align-items: center; }
/* 印章式标志 */
.brand-mark { width: 30px; height: 30px; border-radius: 3px; background: var(--seal); display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: var(--seal-ink); font-family: var(--serif); font-weight: 600; font-size: 17px; box-shadow: inset 0 0 0 2px var(--seal-ink), inset 0 0 0 3px var(--seal); }
.proj-btn { background: transparent; height: 32px; padding: 0 10px; font-size: 14px; font-weight: 600; min-width: 0; max-width: 40vw; }
.proj-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-btn:hover { background: var(--raised); }
.crumb { color: var(--t3); white-space: nowrap; }
.save-ind { font-size: 12px; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.server-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.server-dot.attention { background: var(--warn); }
.task-ind { position: relative; }
.task-ind .badge { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; border-radius: 8px; font-size: 11px; line-height: 16px;
  text-align: center; padding: 0 4px; background: var(--badge); color: var(--badge-ink); font-weight: 600; }
.task-ind .dot { position: absolute; bottom: 4px; right: 4px; }
.batch-btn { flex: none; }
.avatar { width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%; background: var(--avatar); color: var(--t1); font-family: var(--serif); font-weight: 600; flex: none; }
.body { display: grid; grid-template-columns: 64px minmax(0, 1fr); min-height: 0; }
.nav { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 12px; }
.nav button { width: 52px; height: 52px; min-height: 52px; padding: 0; border-radius: 10px; background: transparent; color: var(--t3);
  flex-direction: column; gap: 4px; font-size: 12px; }
.nav button svg.i { width: 20px; height: 20px; }
.nav button:hover { color: var(--t1); background: var(--panel); }
.nav button.active { color: var(--accent); background: var(--accent-soft); }
.main { min-height: 0; min-width: 0; overflow: hidden; padding: 0 12px 12px 0; }
.connection { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); z-index: 45; max-width: min(720px, 92vw);
  background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r); padding: 8px 14px; font-size: 12px; box-shadow: 0 8px 24px var(--float-shadow-color); backdrop-filter: blur(6px); }

/* ---------- 菜单、抽屉、提示、弹窗 ---------- */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: min(320px, 94vw); max-height: 70vh; overflow: auto; background: var(--raised);
  border-radius: var(--r); padding: 6px; box-shadow: 0 12px 40px var(--float-shadow-color), 0 0 0 1px var(--line2); }
.menu .mi { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; height: 34px; min-height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); background: transparent; color: var(--t1); text-align: left; text-decoration: none; }
.menu .mi:hover { background: var(--hover); }
.menu .mi .side { margin-left: auto; color: var(--t3); font-size: 12px; }
.menu .mi .spacer { width: 16px; flex: none; }
.menu .mi.danger { color: var(--err); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .mh { padding: 6px 10px 4px; font-size: 12px; color: var(--t3); }
.drawer { position: fixed; right: 12px; top: 56px; bottom: 12px; width: min(420px, calc(100vw - 24px)); background: var(--panel); border-radius: var(--r-lg); z-index: 40;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px var(--float-shadow-color), 0 0 0 1px var(--line2); }
.drawer .dh { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; font-weight: 600; font-size: 14px; }
.drawer .db { padding: 4px 16px 16px; overflow: auto; flex: 1; display: grid; gap: 10px; align-content: start; }
.drawer .job { background: var(--raised); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 6px; }
.drawer .job-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.drawer .pending-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); }
.drawer .pending-row:hover { background: var(--raised); }
.notice-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 80; max-width: min(560px, 92vw);
  background: var(--toast); color: var(--toast-ink); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px var(--float-shadow-color); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
dialog { background: var(--panel); color: var(--t1); border: 0; border-radius: 14px; padding: 0; width: min(640px, 94vw); max-height: 88vh;
  box-shadow: 0 30px 80px var(--float-shadow-color), 0 0 0 1px var(--line2); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; gap: 8px; padding: 18px 20px 6px; }
.dialog-heading h2 { flex: 1; min-width: 0; }
.dialog-heading button { width: 30px; min-height: 30px; height: 30px; padding: 0; background: transparent; color: var(--t2); }
#dialog-body { padding: 10px 20px 16px; overflow: auto; }
#dialog-actions { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#dialog-actions:empty { display: none; }
.dialog-form { display: grid; gap: 12px; }
.dialog-form textarea, #dialog textarea { min-height: 120px; }
.dialog-video { width: 100%; max-height: 60vh; background: #000; border-radius: var(--r); }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 8px 6px; border-top: 1px solid var(--line); }

/* ---------- 通用页面 ---------- */
.page { height: 100%; overflow: auto; background: var(--panel); border-radius: var(--r-lg); padding: 24px 28px; display: grid; gap: 20px; align-content: start; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-heading p { color: var(--t3); margin-top: 4px; }
.panel { background: var(--raised); border-radius: var(--r-lg); padding: 16px; min-width: 0; }
.panel .panel { background: var(--hover); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.label-with-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filter-tabs { display: inline-flex; flex-wrap: wrap; background: var(--raised); border-radius: var(--r); padding: 3px; gap: 2px; justify-self: start; }
.filter-tabs button { min-height: 26px; height: 26px; padding: 0 12px; border-radius: 6px; background: transparent; color: var(--t2); }
.filter-tabs button.active { background: var(--panel); color: var(--t1); box-shadow: 0 1px 2px var(--float-shadow-color); }
.project-list, .task-list { display: grid; gap: 8px; }
.project-row, .task-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--raised); border-radius: var(--r); padding: 12px 14px; flex-wrap: wrap; }
.project-row > div, .task-row > div:first-child { min-width: 0; flex: 1; }
.project-row p, .task-row p { color: var(--t3); font-size: 12px; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pipeline-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; }
.pipeline-step + .pipeline-step { border-top: 1px solid var(--line); }
.pipeline-step p { color: var(--t3); font-size: 12px; }
.coverage-issues { margin-top: 6px; display: grid; gap: 6px; }
.coverage-issues ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; color: var(--t2); }
.recovery-bar { width: 100%; height: 10px; }
.script-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.script-page details > summary { cursor: pointer; font-weight: 600; }
.script-page textarea { width: 100%; font-size: 14px; line-height: 1.8; resize: vertical; }
.script-layout { display: grid; grid-template-columns: 240px 1fr; gap: 12px; margin-top: 12px; align-items: start; }
.script-chapters { display: grid; gap: 4px; max-height: 70vh; overflow: auto; }
.script-chapter { display: grid; justify-items: start; text-align: left; gap: 2px; padding: 8px 10px; border-radius: 6px; }
.script-chapter.active { outline: 2px solid var(--accent, #56899d); }
.script-chapter small { color: var(--t2); }
.script-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.script-warnings { margin: 0; padding-left: 18px; font-size: 13px; color: var(--t2); }
.step-number { width: 26px; height: 26px; border-radius: 50%; background: var(--raised); color: var(--t3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.episode-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--raised); border-radius: var(--r-lg); padding: 14px 16px; }
.episode-row small { letter-spacing: 2px; }
.overview-clips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.overview-clips button { min-height: 26px; height: 26px; font-size: 12px; background: var(--hover); }
.overview-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset-card { background: var(--raised); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.asset-card img, .asset-card .asset-placeholder { display: block; width: 100%; height: 170px; object-fit: contain; background: var(--tile); }
.asset-placeholder { display: grid; place-items: center; color: var(--t3); font-size: 12px; background: var(--tile); min-height: 64px; }
.asset-card-info { padding: 12px; display: grid; gap: 8px; }
.asset-card-info .row { justify-content: space-between; }
.image-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.image-controls { display: grid; gap: 12px; }
.image-controls textarea { min-height: 140px; }
.image-result { min-height: 260px; display: grid; place-items: center; background: var(--tile); border-radius: var(--r); overflow: hidden; }
.image-result img, .stack > img { display: block; max-width: 100%; max-height: 440px; object-fit: contain; }
.image-history { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.history-card { justify-content: flex-start; text-align: left; gap: 10px; padding: 8px; min-height: 72px; background: var(--hover); white-space: normal; }
.history-card img, .history-card .asset-placeholder { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); flex: none; }
.history-card span { display: grid; gap: 2px; min-width: 0; }
.history-card small { font-size: 12px; }
.image-reference-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.image-reference-picker label { display: inline-flex; align-items: center; gap: 6px; color: var(--t2); background: var(--hover); padding: 4px 8px; border-radius: var(--r-sm); }
.export-link { justify-self: start; }
.ref-choice { width: auto; flex: none; }
.reference-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.reference-list img, .reference-list .asset-placeholder { width: 100%; height: 80px; object-fit: cover; border-radius: var(--r-sm); }

/* ---------- 制作台：左看结果，右改输入，底部成品轨道 ---------- */
.studio { display: grid; height: 100%; gap: 12px; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: minmax(0, 1fr) auto; }
.studio-empty { grid-column: 1 / -1; background: var(--panel); border-radius: var(--r-lg); display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 32px; }
.studio-empty .big { width: 48px; height: 48px; color: var(--t3); }
.out { background: var(--panel); border-radius: var(--r-lg); padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.out-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.out-head .title { font-size: 16px; font-weight: 600; }
.player-wrap { display: flex; justify-content: center; }
.player { position: relative; width: 100%; max-width: calc((100vh - 420px) * 16 / 9); min-width: min(100%, 320px); aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--tile); display: grid; place-items: center; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-empty { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 24px; color: var(--t3); }
.player-empty strong { color: var(--t2); font-weight: 500; }
.player .gen { position: absolute; inset: 0; z-index: 3; background: var(--veil); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.player .gen.solo { background: transparent; }
.elapsed { display: block; font-size: 12px; color: var(--t2); font-variant-numeric: tabular-nums; }
.player .gen .prog { width: 46%; }
.player .gen .pct { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.versions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vpill { min-height: 30px; height: 30px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--t2); }
.vpill.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
#versions:empty, #scene-notices:empty, #track-msg:empty { display: none; }
#scene-notices { gap: 8px; }
.source { background: var(--raised); border-radius: var(--r); padding: 12px 14px; color: var(--t2); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.source .label { display: block; margin-bottom: 4px; }
.inp { background: var(--panel); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.inp-body { flex: 1; overflow: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 18px; }
.sec-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sec-h .label { flex: 1; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.ref { width: 64px; position: relative; }
.ref .thumb { width: 64px; height: 80px; border-radius: var(--r); overflow: hidden; background: var(--tile); display: grid; place-items: center; }
.ref .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .thumb.missing { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); font-weight: 600; }
.ref .thumb .asset-placeholder { background: transparent; min-height: 0; }
.ref .nm { font-size: 12px; color: var(--t2); margin-top: 4px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref .rm { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; min-height: 20px; padding: 0; border-radius: 50%; background: var(--hover);
  color: var(--t2); display: none; z-index: 3; box-shadow: 0 2px 6px var(--float-shadow-color); }
.ref:hover .rm, .ref:focus-within .rm { display: inline-flex; }
.ref .rm svg.i { width: 12px; height: 12px; }
.ref-add { width: 64px; height: 80px; padding: 0; color: var(--t3); }
.ref-add:hover { color: var(--accent); }
.props { display: flex; flex-direction: column; }
.prop { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: start; padding: 4px 6px; border-radius: var(--r-sm); }
.prop:hover { background: var(--raised); }
.prop input, .prop textarea { background: transparent; border: 1px solid transparent; padding: 2px 6px; border-radius: 5px; font-size: 13px; }
.prop input { color: var(--t3); font-size: 12px; }
.prop textarea { min-height: 26px; resize: none; overflow: hidden; line-height: 1.5; }
.prop input:hover, .prop textarea:hover { background: var(--hover); }
.prop input:focus, .prop textarea:focus { background: var(--canvas); border-color: var(--accent); }
.prop textarea.bad { color: var(--err); }
.prop .ops { position: absolute; right: 4px; top: 4px; display: flex; gap: 2px; opacity: 0; background: var(--raised); border-radius: 6px; padding: 1px; }
.prop:hover .ops { opacity: 1; }
.prop:has(input:focus, textarea:focus) .ops { opacity: 0; pointer-events: none; }
.prop .ops:focus-within { opacity: 1; }
.prop .ops button { width: 22px; height: 22px; min-height: 22px; padding: 0; background: transparent; color: var(--t2); }
.prop .ops button:hover { color: var(--t1); background: var(--hover); }
.prop .ops svg.i { width: 13px; height: 13px; }
.dup-mark { font-size: 12px; color: var(--run); padding-left: 6px; }
.common-toggle { justify-content: flex-start; min-height: 28px; padding: 0 6px; background: transparent; color: var(--t3); font-size: 12px; }
.common-toggle:hover { color: var(--t1); background: var(--raised); }
.editor-ta { min-height: 200px; background: var(--raised); padding: 10px 12px; border-radius: var(--r); }
.inp-foot { padding: 12px 16px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.block-msg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn-ink); }
.cost { font-size: 12px; color: var(--t3); }
.cost b { color: var(--t1); font-weight: 600; }
.gen-btn { height: 36px; padding: 0 18px; font-size: 14px; }
.track { grid-column: 1 / -1; background: var(--panel); border-radius: var(--r-lg); padding: 10px 16px 12px; min-width: 0; }
.track-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.eps { display: flex; align-items: center; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.ep { position: relative; flex: none; display: inline-flex; }
.ep > button:first-child { height: 28px; min-height: 28px; min-width: 52px; padding: 0 10px; border-radius: 7px; background: transparent; color: var(--t2); font-size: 12px; }
.ep > button:first-child:hover { background: var(--raised); color: var(--t1); }
.ep.on > button:first-child { background: var(--hover); color: var(--t1); font-weight: 600; }
.ep .x { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; min-height: 16px; padding: 0; border-radius: 50%; background: var(--hover); color: var(--t2); display: none; }
.ep.on:hover .x, .ep .x:focus-visible { display: inline-flex; }
.ep .x svg.i { width: 10px; height: 10px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px; }
.shot { flex: 0 0 132px; position: relative; }
.shot > button:first-child { display: block; width: 132px; height: 74px; min-height: 74px; padding: 0; border-radius: var(--r); overflow: hidden; position: relative; background: var(--tile); }
.shot.blank > button:first-child { background: var(--raised); }
.shot > button:first-child video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.shot.on > button:first-child { box-shadow: 0 0 0 2px var(--accent); }
.shot .cap { position: absolute; left: 8px; bottom: 6px; font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.shot .corner { position: absolute; right: 6px; top: 6px; display: flex; align-items: center; gap: 4px; }
.shot .pct { font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.shot .del { position: absolute; left: 4px; top: 4px; z-index: 3; width: 22px; height: 22px; min-height: 22px; padding: 0; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; display: none; }
.shot:hover .del, .shot .del:focus-visible { display: inline-flex; }
.shot .del svg.i { width: 12px; height: 12px; }
.shot-add { flex: 0 0 74px; height: 74px; padding: 0; color: var(--t3); }
.shot-add:hover { color: var(--accent); }
.track-msg { margin-top: 6px; font-size: 12px; color: var(--warn-ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- 总览 ---------- */
.ov-list { display: grid; gap: 4px; }
.ov-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 12px; border-radius: var(--r); }
.ov-row:hover { background: var(--raised); }
.ov-meta { display: grid; gap: 2px; }
.ov-shots { display: flex; gap: 6px; align-items: center; overflow: hidden; min-width: 0; }
.ov-shot { flex: none; position: relative; width: 96px; height: 54px; min-height: 54px; padding: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--tile); }
.ov-shot.blank { background: var(--hover); }
.ov-shot video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ov-shot .cap { position: absolute; left: 6px; bottom: 4px; font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.ov-shot .corner { position: absolute; right: 5px; top: 5px; display: flex; }
.ov-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 资产库：分组画廊 + 右侧详情 ---------- */
.assets-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; height: 100%; }
.assets-layout.with-detail { grid-template-columns: minmax(0, 1fr) 380px; }
.asset-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.asset-search { width: 180px; }
.check { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 6px; color: var(--t2); font-size: 13px; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.gallery.people { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery-card { display: grid; gap: 6px; padding: 0; min-height: 0; background: transparent; text-align: left; white-space: normal; justify-content: stretch; }
.gallery-card:hover { background: transparent; }
.gallery-card .thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: var(--tile); transition: box-shadow .15s; }
.gallery.people .gallery-card .thumb { aspect-ratio: 3 / 4; }
.gallery-card:hover .thumb { box-shadow: 0 0 0 1px var(--line2); }
.gallery-card.on .thumb { box-shadow: 0 0 0 2px var(--accent); }
.gallery-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-card .thumb.missing { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.gallery-card .initial { font-size: 32px; font-weight: 600; color: var(--warn); }
.gallery-card .corner { position: absolute; right: 6px; top: 6px; }
.gallery-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gallery-name .ellipsis { flex: 1; }
.asset-detail { padding: 20px; gap: 14px; }
.asset-detail > button { justify-self: start; }
button.ghost.danger, .menu .mi.danger { color: var(--err); }
.ver-card { background: var(--raised); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 10px; }
.ver-picture { aspect-ratio: 4 / 3; border-radius: var(--r); overflow: hidden; background: var(--tile); display: grid; place-items: center; }
.ver-picture img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ver-picture.missing { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); font-size: 13px; }

/* ---------- 图片工作台：模式 | 编辑 | 结果 ---------- */
.wb-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 360px; gap: 12px; height: 100%; }
.wb-modes { padding: 16px 10px; gap: 4px; }
.wb-modes .label { padding: 0 8px 4px; }
.wb-modes .sep { height: 1px; background: var(--line); margin: 8px 4px; }
.wb-mode { width: 100%; justify-content: flex-start; gap: 10px; background: transparent; color: var(--t1); padding: 0 10px; height: 38px; text-decoration: none; text-align: left; }
a.wb-mode { display: flex; align-items: center; border-radius: var(--r); }
.wb-mode:hover { background: var(--raised); }
.wb-mode.active { background: var(--accent-soft); color: var(--accent); }
.wb-mode small { color: var(--t3); }
.wb-edit { padding: 20px 24px; gap: 16px; grid-template-rows: auto auto auto minmax(160px, 1fr) auto; }
.wb-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.wb-fields label:not(.grow) { width: 150px; }
.wb-refs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-final { grid-template-rows: auto minmax(0, 1fr); }
.wb-final textarea { height: 100%; min-height: 160px; }
.wb-result { padding: 20px; gap: 12px; }
.wb-result .image-result { min-height: 220px; max-height: 340px; }
.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.recent { aspect-ratio: 1; padding: 0; min-height: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--tile); }
.recent img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent.failed { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--warn) 50%, transparent); font-size: 12px; white-space: normal; }

/* ---------- 任务页 ---------- */
.tasks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; height: 100%; }
.tasks-layout #task-type { width: 140px; }
.task-card { background: var(--raised); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.task-card h3 { font-size: 13px; font-weight: 500; }
.task-card .prog { max-width: 320px; }
.task-side { padding: 20px; gap: 10px; }
.task-side .pending-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.legend { display: grid; gap: 8px; font-size: 12px; color: var(--t2); }
.legend p { display: flex; gap: 8px; align-items: center; }

/* ---------- 水墨意境：宋体标题、淡墨分隔、远山、纸面层次 ---------- */
.proj-btn, .out-head .title, .page h1, .dialog-heading h2, .login-card h1, .ov-meta h2, .asset-detail h1 { font-family: var(--serif); font-weight: 600; letter-spacing: .03em; }
.proj-btn { font-size: 17px; }
.out-head .title { font-size: 19px; }
.page h1 { font-size: 22px; }
.ov-meta h2 { font-size: 17px; }
.page, .out, .inp, .track { box-shadow: 0 1px 2px var(--shadow-color), 0 0 0 1px var(--shadow-color); }
.inp-foot { border-top: 0; background: linear-gradient(90deg, transparent, var(--line-ink) 18%, var(--line-ink) 82%, transparent) top / 100% 1px no-repeat; }
.menu .sep, .wb-modes .sep { background: linear-gradient(90deg, transparent, var(--line-ink), transparent); }
.nav button:hover { background: transparent; color: var(--t1); }
.nav button.active { background: radial-gradient(closest-side, var(--blot), var(--blot) 55%, transparent); color: var(--nav-on); }
.player:has(.player-empty) { background: var(--tile) var(--mountains) center bottom / 100% 70% no-repeat; }
.login { background: var(--canvas) var(--mountains) center bottom / 100% 46vh no-repeat; }
.shot.blank .cap, .ov-shot.blank .cap { color: var(--t2); text-shadow: none; }
.editor-ta { background: light-dark(#fbfcf8, var(--raised)); }
.theme-btn svg.i { width: 17px; height: 17px; }
.menu .mi.on { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { body, .page, .out, .inp, .track, .nav button { transition: background-color .25s, color .25s; } }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; height: auto; }
  .main { overflow: auto; }
  .out, .inp { overflow: visible; }
  .player { max-width: 100%; }
  .image-layout { grid-template-columns: minmax(0, 1fr); }
  .episode-row { grid-template-columns: minmax(0, 1fr); }
  .overview-actions { justify-content: flex-start; }
  .assets-layout.with-detail, .tasks-layout, .wb-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .wb-modes { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; align-items: center; }
  .wb-modes .label, .wb-modes .sep { display: none; }
  .ov-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ov-actions { justify-content: flex-start; }
  .page { height: auto; }
}
@media (max-width: 736px) {
  #app { grid-template-rows: auto minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; padding: 6px 8px; gap: 6px; }
  .brand { width: auto; }
  .crumb, .save-ind { display: none; }
  .proj-btn { max-width: 52vw; }
  .body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .nav { flex-direction: row; justify-content: space-around; padding: 4px 8px; }
  .nav button { width: auto; flex: 1; height: 48px; min-height: 48px; }
  .main { padding: 0 8px 8px; }
  .page { padding: 16px 14px; }
  .studio { gap: 8px; }
  .out { padding: 12px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .asset-card img, .asset-card .asset-placeholder { height: 130px; }
}
@media (max-width: 420px) {
  .batch-btn span { display: none; }
  .batch-btn { width: 36px; padding: 0; }
  .proj-btn { max-width: 44vw; font-size: 13px; }
  .nav button span { font-size: 11px; }
  .prop { grid-template-columns: minmax(0, 1fr); }
  .asset-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* N2 镜头时长核对：只提醒，不阻断 */
.shot-check { font-size: 12px; color: var(--t3); margin-left: auto; text-align: right; }
.shot-check.match { color: var(--ok); }
.shot-check.mismatch, .shot-check.partial { color: var(--warn-ink); }
.speech-check { margin-top: 8px; color: var(--warn-ink); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.speech-check ul { margin: 4px 0; padding-left: 20px; }
.speech-check[hidden] { display: none; }
/* N6 分集负责人与状态 */
.ep-meta { gap: 6px; }
.ep-meta .pill, .ov-owner .pill { font-size: 11px; padding: 0 6px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.ov-owner { justify-self: start; font-size: 12px; color: var(--t2); padding: 0; min-height: 0; background: transparent; }
.episode-status { display: flex; gap: 16px; border: 0; padding: 0; margin: 0; }
.episode-status legend { font-size: 12px; color: var(--t2); margin-bottom: 6px; }
.episode-status label { display: inline-flex; gap: 6px; align-items: center; }
.quota-chip { margin-left: 8px; font-size: 12px; color: var(--t3); } .quota-chip.warn { color: var(--warn-ink); }
/* N5 版本并排对比 */
#dialog:has(.cmp) { width: min(1120px, 96vw); max-width: 96vw; }
.cmp { display: grid; gap: 12px; }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp-side { display: grid; gap: 8px; align-content: start; }
.cmp-side label { display: grid; gap: 6px; font-size: 12px; color: var(--t2); }
.cmp-side video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); }
.cmp-side button { justify-self: start; }
.cmp-controls { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .cmp-grid { grid-template-columns: 1fr; } }
/* N1 换图影响 */
.ver-card.impact { background: var(--warn-bg); }
.impact-list { display: grid; gap: 4px; font-size: 12px; color: var(--t2); }
.impact-list label { display: flex; gap: 6px; align-items: center; }
.ver-card.prompt .readonly-block { max-height: 220px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
