/* 片场 · 视频生成站 — design tokens and components. 组件层沿用音坊（bd1d905）的 app.css，同一套暖纸和墨色，
   主色换成“放映厅蓝”；视频页面自己的样式在文件末尾。新样式只用这里的设计变量。 */
:root {
  --bg: oklch(98.2% 0.011 75);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(96.4% 0.016 75);
  --surface-3: oklch(93.5% 0.02 72);
  --ink: oklch(31% 0.03 40);
  --ink-soft: oklch(45% 0.03 40);
  --muted: oklch(53% 0.025 45);
  --line: oklch(90.5% 0.02 62);
  --line-strong: oklch(84% 0.03 60);
  --primary: oklch(47% 0.12 258);
  --primary-hover: oklch(42% 0.12 258);
  --primary-soft: oklch(95.5% 0.03 258);
  --primary-line: oklch(84% 0.06 258);
  --accent: oklch(80% 0.14 78);
  --accent-soft: oklch(96% 0.05 85);
  --success: oklch(52% 0.12 150);
  --success-soft: oklch(95.5% 0.04 150);
  --warning: oklch(53% 0.12 65);
  --warning-soft: oklch(96% 0.05 80);
  --danger: oklch(53% 0.17 27);
  --danger-soft: oklch(95.5% 0.03 27);
  --font: ui-rounded, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --text-xs: 12px; --text-sm: 14px; --text-md: 16px; --text-lg: 18px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 30px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --shadow-1: 0 1px 2px oklch(31% 0.03 40 / 0.06);
  --shadow-2: 0 10px 30px -18px oklch(31% 0.03 40 / 0.35);
  --shadow-pop: 0 18px 50px -20px oklch(31% 0.04 40 / 0.45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: 160ms;
  --stage: oklch(22% 0.015 260);   /* 镜头卡的放映区：深色底衬托画面 */
  /* 图标（mask 用，颜色跟随文字）：按钮上用 data-icon="dice | reset | download" */
  --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E");
  --icon-dice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Crect x='4' y='4' width='16' height='16' rx='3.5'/%3E%3Cg fill='black' stroke='none'%3E%3Ccircle cx='9' cy='9' r='1.7'/%3E%3Ccircle cx='12' cy='12' r='1.7'/%3E%3Ccircle cx='15' cy='15' r='1.7'/%3E%3C/g%3E%3C/svg%3E");
  --icon-reset: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 2.4-5.7L4 8.5M4 4v4.5h4.5'/%3E%3C/svg%3E");
  --icon-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10.5l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.7 var(--font); }
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.tiny { font-size: var(--text-xs); }
.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 12px; }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: oklch(98.2% 0.011 75 / 0.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand svg { width: 34px; height: 34px; }
.brand-name { font-size: var(--text-lg); font-weight: 800; letter-spacing: .02em; }
.brand-sub { font-size: var(--text-xs); color: var(--muted); display: block; line-height: 1.2; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: var(--text-sm); padding: 7px 14px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; text-decoration: none; }
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab[aria-current="page"] { background: var(--ink); color: var(--surface); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* GPU status pill */
.gpu-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--text-sm); padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; }
.gpu-pill:hover { border-color: var(--ink-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.dot.ok { background: var(--success); }
.dot.busy { background: var(--accent); animation: pulse 1.4s var(--ease) infinite; }
.dot.bad { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 20px 20px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--text-2xl); }
.page-head p { color: var(--ink-soft); font-size: var(--text-sm); }
.page-head .page-note { color: var(--muted); font-size: var(--text-xs); max-width: 360px; }
.studio { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 24px; align-items: start; }
.studio > * { min-width: 0; }   /* 长描述、长歌词不会把栏宽撑开 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel-body { padding: 20px; }
.panel h2 { font-size: var(--text-lg); }
/* The form scrolls inside itself when it is taller than the window, so「生成」never ends up out of reach. */
.sticky { position: sticky; top: 76px; max-height: calc(100dvh - 92px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-title h2 { font-size: var(--text-lg); }
.sub-title { margin: 14px 0 6px; }   /* 面板里的小标题 h3.small，如设置页“运行状态”里的「已用空间」 */

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--warning); background: var(--warning-soft); margin-bottom: 18px; }
.banner.info { border-color: var(--primary-line); background: var(--primary-soft); }
.banner strong { display: block; }
.banner .btn { margin-left: auto; flex-shrink: 0; }

/* ---------- form controls ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.label-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.help-toggle { position: relative; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer; padding: 0; }
.help-toggle::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; }   /* 点击区域放大到 30px，外观不变 */
.help-toggle[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.help-text { font-size: var(--text-sm); color: var(--ink-soft); background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; font: inherit; font-size: var(--text-md); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 10px 12px; transition: border-color var(--fast) var(--ease);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
/* 下拉框统一用自绘箭头（各浏览器外观一致）；data URI 里不能用变量，箭头颜色 #796860 就是 --muted */
select { appearance: none; padding-right: 36px; text-overflow: ellipsis; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23796860' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; }
select:disabled { background-color: var(--surface-2); }
.field-note { font-size: var(--text-xs); color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.field-count.full { color: var(--danger); font-weight: 600; }
.field-error { font-size: var(--text-sm); color: var(--danger); }
textarea.multiline { min-height: 180px; }
/* 开关字段：标签、「?」在左，开关在右，复用下面的 .switch */
.switch-field .label-row { min-height: 26px; }
/* 不生效的字段（active_when 不满足）：看得见、改不了，说明为什么 */
.field.is-inactive > .label-row > label, .field.is-inactive > .label-row > span:first-child { color: var(--muted); }
.inactive-note { display: flex; gap: 6px; align-items: flex-start; font-size: var(--text-xs); color: var(--ink-soft); background: var(--surface-2); border-radius: var(--r-sm); padding: 6px 10px; }
.inactive-note::before { content: ""; flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; background: currentColor;
  -webkit-mask: var(--icon-info) center / contain no-repeat; mask: var(--icon-info) center / contain no-repeat; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.segmented.fit { grid-auto-columns: auto; justify-content: start; }   /* 按钮宽度随文字，用于筛选 */
.segmented.fit button { padding: 6px 12px; }
.segmented button { border: 0; background: transparent; font: inherit; font-size: var(--text-sm); color: var(--ink-soft); padding: 8px 6px; border-radius: var(--r-sm); cursor: pointer; line-height: 1.3; }
.segmented button small { display: block; font-size: 11px; color: var(--muted); }
.segmented button:hover:not(:disabled):not([aria-pressed="true"]) { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-1); }
.segmented button:disabled { cursor: not-allowed; opacity: .6; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-row input[type="number"] { width: 92px; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-md); font: inherit; font-size: var(--text-sm); font-weight: 600; padding: 9px 16px; cursor: pointer; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); text-decoration: none; min-height: 40px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-soft); }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 6px 10px; min-height: 34px; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-big { width: 100%; font-size: var(--text-md); min-height: 48px; border-radius: var(--r-md); }
/* 次要的小操作（「恢复默认」「换一个示例」）：.btn .btn-secondary .btn-small，可加 data-icon */
.btn-small { min-height: 30px; padding: 4px 10px; gap: 6px; font-size: var(--text-xs); border-radius: var(--r-sm); }
/* 文字前的小图标：data-icon="dice | reset | download"，颜色跟随文字。图标本身是 :root 里的 --icon-* */
[data-icon]::before { content: ""; flex-shrink: 0; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
[data-icon="dice"] { --icon: var(--icon-dice); }
[data-icon="reset"] { --icon: var(--icon-reset); }
[data-icon="download"] { --icon: var(--icon-download); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); display: inline-grid; place-items: center; cursor: pointer; padding: 0; font: 700 15px/1 var(--font); }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

details.advanced { border-top: 1px dashed var(--line-strong); padding-top: 12px; margin-bottom: 16px; }
details.advanced summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--ink-soft); list-style: none; display: flex; align-items: center; gap: 6px; min-height: 30px; }
details.advanced summary::before { content: "▸"; transition: transform var(--fast) var(--ease); }
details.advanced[open] summary::before { transform: rotate(90deg); }
details.advanced .advanced-body { padding-top: 12px; }
.advanced-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fixed-note { font-size: var(--text-xs); color: var(--muted); }
.form-foot { position: sticky; bottom: 0; z-index: 1; margin: 0 -20px -20px; padding: 14px 20px 20px; display: grid; gap: 6px; background: linear-gradient(to bottom, oklch(100% 0 0 / 0), var(--surface) 14px); }
.form-foot > p { overflow-wrap: anywhere; }   /* 提示里可能带模型出错的原因（长网址、长路径），不能把表单撑出横向滚动条 */

/* ---------- jobs ---------- */
.job-list { display: grid; gap: 14px; }
.job { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-1); }
.job-head { display: flex; gap: 10px; align-items: flex-start; }
.job-title { font-weight: 700; font-size: var(--text-md); overflow-wrap: anywhere; }
.job-meta { font-size: var(--text-xs); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap; background: var(--surface-2); color: var(--ink-soft); }
.status.running { background: var(--accent-soft); color: var(--warning); }
.status.done { background: var(--success-soft); color: var(--success); }
.status.error { background: var(--danger-soft); color: var(--danger); }
.job-error { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: var(--text-sm); overflow-wrap: anywhere; }
.job-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.job-detail { margin-top: 10px; font-size: var(--text-sm); background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 4px; }
.job-lyrics { white-space: pre-wrap; overflow-wrap: anywhere; }   /* 详情里的歌词：保留原来的换行，长行自动折行 */
.progress-line { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.progress-line span { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 4px; animation: slide 1.6s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--ink-soft); background: var(--surface); overflow-wrap: anywhere; }
.empty svg { width: 56px; height: 56px; color: var(--primary-line); margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-lg); height: 140px; }
@keyframes shimmer { to { background-position: -200% 0; } }
/* 卡片上的许可证说明：下载按钮旁一句小字 */
.license-note { margin-top: 10px; font-size: var(--text-xs); line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- dialogs and the GPU panel ---------- */
dialog { border: 0; padding: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-pop); color: var(--ink); background: var(--surface); max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog::backdrop { background: oklch(25% 0.02 40 / 0.35); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.dialog-head h2 { font-size: var(--text-xl); }
.dialog-body { padding: 8px 20px 20px; display: grid; gap: 14px; overflow-wrap: anywhere; }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }
.state-line { font-size: var(--text-md); font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--muted); }
.steps li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; box-sizing: border-box; }
.steps li.done { color: var(--ink-soft); }
.steps li.done::before { background: var(--success); border-color: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }
.steps li.active { color: var(--ink); font-weight: 700; }
.steps li.active::before { border-color: var(--accent); border-right-color: transparent; animation: spin .9s linear infinite; }
.steps li.error { color: var(--danger); font-weight: 700; }
.steps li.error::before { background: var(--danger); border-color: var(--danger); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.fact { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.fact .label { font-size: var(--text-xs); color: var(--muted); }
.fact .value { font-size: var(--text-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.notice { font-size: var(--text-sm); padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-soft); overflow-wrap: anywhere; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warning-soft); color: var(--warning); }
.notice.info { background: var(--primary-soft); color: var(--ink-soft); }
.notice-title { display: block; color: var(--ink); font-weight: 700; margin-bottom: 2px; }
/* 模型状态列表：每个模型一行（名称、状态、显存峰值），准备中带进度条，出错时下面写原因 */
.model-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.model-row { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.model-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--text-sm); }
.model-name { font-weight: 700; }
.model-state { color: var(--ink-soft); }
.model-meta { margin-left: auto; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.model-row[data-state="preparing"] .dot { background: var(--accent); animation: pulse 1.4s var(--ease) infinite; }
.model-row[data-state="ready"] .dot { background: var(--success); }
.model-row[data-state="error"] { background: var(--danger-soft); }
.model-row[data-state="error"] .dot { background: var(--danger); }
.model-row[data-state="idle"] .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }   /* 用到时才准备、还没用到（音色设计）：空心圆点 */
.model-row .meter { height: 6px; }
.model-row .meter span { background: var(--accent); transition: width var(--fast) var(--ease); }
.model-row .progress-line { margin-top: 0; }
.model-error { font-size: var(--text-sm); color: var(--danger); overflow-wrap: anywhere; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-grid .wide { grid-column: 1 / -1; }
.fact .value { overflow-wrap: anywhere; }
.setup-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.setup-step:first-of-type { border-top: 0; }
.step-badge { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--ink-soft); }
.step-badge.ok { background: var(--success); color: #fff; }
.guide-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--text-sm); color: var(--ink-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.switch-row:first-of-type { border-top: 0; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; inset: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: var(--r-pill); transition: background var(--fast) var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--fast) var(--ease); box-shadow: var(--shadow-1); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.events li { font-size: var(--text-sm); display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.events li.error .msg { color: var(--danger); }
.meter { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); }

/* ---------- help ---------- */
.help { max-width: 820px; display: grid; gap: 16px; }
.help .panel-body { display: grid; gap: 10px; }
.help h2 { font-size: var(--text-lg); }
.help ul, .help ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.help table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
.help th, .help td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 60; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-pop); font-size: var(--text-sm); overflow-wrap: anywhere; animation: rise var(--fast) var(--ease); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); }
.login-card .brand { justify-content: center; margin-bottom: 18px; }
.login-card .brand svg { width: 48px; height: 48px; }


/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .studio, .settings-grid { grid-template-columns: 1fr; }
  .sticky { position: static; max-height: none; overflow: visible; }
  .form-foot { position: static; background: none; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .tabs { order: 3; width: 100%; margin: 0 -4px; }
  .tab { padding: 6px 11px; }
  .brand-sub { display: none; }
  main { padding: 16px 12px 48px; }
  .panel-body { padding: 16px; }
  .form-foot { margin: 0 -16px -16px; padding: 14px 16px 16px; }
  .events li { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 片场：视频页面自己的样式 ---------- */
.sim-badge { font-size: var(--text-xs); font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--warning); border: 1px solid oklch(85% 0.09 80); white-space: nowrap; }
.skeleton.tall { height: 360px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.tier-note { color: var(--ink-soft); background: var(--primary-soft); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 16px; }

/* 参数的控制类型：硬控制 / 模型条件 / 提示词偏好 */
.control-tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; line-height: 1.6; padding: 0 7px; border-radius: var(--r-pill); white-space: nowrap; cursor: help; }
.control-tag[data-control="hard"] { background: var(--surface-3); color: var(--ink-soft); }
.control-tag[data-control="condition"] { background: var(--primary-soft); color: var(--primary); }
.control-tag[data-control="prompt"] { background: var(--accent-soft); color: var(--warning); }

/* 首帧：拖放区、裁切预览、最近用过的图 */
.frame-area.is-busy { opacity: .55; pointer-events: none; }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 22px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.drop.is-over { border-color: var(--primary); background: var(--primary-soft); }
.drop-title { font-weight: 700; }
.frame-preview { position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--stage); line-height: 0; }
.frame-preview img { width: 100%; max-height: 340px; object-fit: contain; }
/* 裁切框外面的部分压暗：不会出现在视频里 */
.crop-box { position: absolute; box-shadow: 0 0 0 9999px oklch(15% 0.02 260 / .62); outline: 2px solid oklch(100% 0 0 / .9); outline-offset: -2px; border-radius: 2px; transition: all var(--fast) var(--ease); }
.crop-note { line-height: 1.6; }
.frame-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.recent-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.recent-frame { width: 52px; height: 52px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; cursor: pointer; background: var(--surface-3); }
.recent-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-frame:hover { border-color: var(--primary); }
.seed-row input { flex: 1; min-width: 0; }

/* 改一处再试 */
.edit-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--r-md); background: var(--primary-soft); border: 1px solid var(--primary-line); }
.edit-banner > div { flex: 1; }
.edit-banner.warn { background: var(--warning-soft); border-color: oklch(85% 0.09 80); }

/* 报价 */
.quote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: var(--text-sm); color: var(--ink-soft); }
.quote strong { color: var(--ink); font-size: var(--text-md); font-variant-numeric: tabular-nums; }
.quote-main { font-variant-numeric: tabular-nums; }
.quote-sub { flex-basis: 100%; font-size: var(--text-xs); color: var(--muted); }
.quote.over strong, .quote.over .quote-sub:last-child { color: var(--danger); }
.estimate { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-soft); }

/* 镜头卡：深色放映区是这一页唯一的重色块 */
.shot-list { display: grid; gap: 16px; }
.shot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 14px; display: grid; gap: 12px; min-width: 0; }
.shot-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shot-number { flex-shrink: 0; font-size: var(--text-xs); font-weight: 800; letter-spacing: .04em; color: var(--surface); background: var(--ink); padding: 2px 9px; border-radius: var(--r-sm); }
.shot-title { flex: 1; min-width: 0; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage { position: relative; height: clamp(220px, 34vw, 420px); background: var(--stage); border-radius: var(--r-md); overflow: hidden; display: grid; place-items: center; }
.stage video, .stage img { max-width: 100%; max-height: 100%; display: block; }
.stage img { opacity: .45; filter: saturate(.7); }
.stage[data-state="error"] img, .stage[data-state="cancelled"] img { opacity: .25; }
.stage-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 16px; color: oklch(97% 0.01 260); text-align: center; font-size: var(--text-sm); }
.stage-overlay strong { font-size: var(--text-lg); }
.stage-progress { width: min(260px, 70%); height: 4px; border-radius: 4px; background: oklch(100% 0 0 / .2); overflow: hidden; margin-top: 4px; }
.stage-progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .6s var(--ease); }
.stage-progress.indeterminate span { width: 40%; animation: slide 1.6s var(--ease) infinite; }
.take-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.take-chip { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--text-sm); font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); cursor: pointer; }
.take-chip:hover { border-color: var(--ink-soft); }
.take-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.take-chip .chip-kind { font-weight: 400; font-size: var(--text-xs); opacity: .8; }
.take-chip .dot { width: 7px; height: 7px; }
.take-chip[data-state="done"] .dot { background: var(--success); }
.take-chip[data-state="running"] .dot, .take-chip[data-state="submitting"] .dot { background: var(--accent); animation: pulse 1.4s var(--ease) infinite; }
.take-chip[data-state="queued"] .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.take-chip[data-state="error"] .dot { background: var(--danger); }
.chosen-mark { font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--ink); }
.take-info { display: grid; gap: 6px; font-size: var(--text-sm); }
.take-facts { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.take-change { color: var(--primary); font-weight: 600; }
.take-info .job-error { margin-top: 0; }
.prompt-detail summary { cursor: pointer; color: var(--muted); font-size: var(--text-xs); }
.prompt-detail p { margin-top: 4px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.license-note { margin-top: 0; }
.take-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }
.take-actions .status { padding: 5px 10px; }
.empty-title { font-weight: 700; font-size: var(--text-lg); color: var(--ink); margin-bottom: 4px; }

/* 运维面板 */
.ops-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; margin-top: 4px; }
.spend-chart { min-height: 120px; }
.chart { width: 100%; height: auto; display: block; font-family: var(--font); }
.chart .bar { fill: var(--primary); }
.chart .bar.over { fill: var(--danger); }
.chart .bar-value { font-size: 11px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .cap-line { stroke: var(--warning); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .cap-label { font-size: 11px; fill: var(--warning); }

@media (max-width: 720px) {
  .ops-grid { grid-template-columns: 1fr; }
  .stage { height: clamp(200px, 60vw, 320px); }
  .shot { padding: 12px; }
  .shot-head .tiny { display: none; }
}
