:root {
  /* 墨刀式设计协作：浅灰蓝画布 · 纯白卡片 · 品牌蓝强调 · 字阶分明 */
  --bg: #f3f5f9;
  --bg-elevated: #eef1f6;
  --bg-card: #ffffff;
  --bg-hover: #e8ecf3;
  --border: #e2e6ef;
  --border-strong: #cdd4e0;
  --text: #1a1d26;
  --text-muted: #6b7385;
  --accent: #3b6ff5;
  --accent-2: #2a4fd4;
  --accent-soft: rgba(59, 111, 245, 0.10);
  --primary: var(--accent);
  --success: #0d9488;
  --danger: #e11d48;
  --warning: #d97706;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(26, 29, 38, 0.04), 0 4px 12px rgba(26, 29, 38, 0.03);
  --shadow-md: 0 8px 28px rgba(26, 29, 38, 0.08);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --modal-bg: #ffffff;
  --modal-border: #e2e6ef;
  --inset-bg: #f7f8fb;
  --scrollbar-thumb: #c5cbd8;
  --scrollbar-thumb-hover: #9aa3b5;
  --font-display: "Noto Serif SC", "Songti SC", "Outfit", "Noto Sans SC", serif;
  --font-sans: "Outfit", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --content-max: 1200px;
  --sidebar-w: 248px;
  --agent-w: 320px;
  --asset-rail-w: 0px;
  --topbar-h: 56px;
  --z-modal-base: 200;
  --z-modal-manage: 1000;
  --z-modal-style: 1050;
  --z-modal-extract: 1100;
  --z-modal-detail: 1150;
  --z-modal-lightbox: 1200;
  --z-modal-error: 1500;
  --z-modal-confirm: 1600;
  --z-toast: 1600;
  --z-preview-menu: 1550;
  --transition: 180ms cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
  font-family: var(--font-sans);
}

html[data-theme="dark"],
html[data-theme="air"] {
  --bg: #f3f5f9;
  --bg-elevated: #eef1f6;
  --bg-card: #ffffff;
  --bg-hover: #e8ecf3;
  --border: #e2e6ef;
  --border-strong: #cdd4e0;
  --text: #1a1d26;
  --text-muted: #6b7385;
  --accent: #3b6ff5;
  --accent-2: #2a4fd4;
  --accent-soft: rgba(59, 111, 245, 0.10);
  --primary: var(--accent);
  --success: #0d9488;
  --danger: #e11d48;
  --warning: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26, 29, 38, 0.04), 0 4px 12px rgba(26, 29, 38, 0.03);
  --shadow-md: 0 8px 28px rgba(26, 29, 38, 0.08);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --modal-bg: #ffffff;
  --modal-border: #e2e6ef;
  --inset-bg: #f7f8fb;
  --scrollbar-thumb: #c5cbd8;
  --scrollbar-thumb-hover: #9aa3b5;
  --content-max: 1200px;
  color-scheme: light;
}

/* 科技深空：SpaceX / NVIDIA 气质 */
html[data-theme="tech"] {
  --bg: #070b14;
  --bg-elevated: #0c1220;
  --bg-card: #101826;
  --bg-hover: #162033;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e8eef8;
  --text-muted: #8a9bb5;
  --accent: #60a5fa;
  --accent-2: #93c5fd;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --primary: #3b82f6;
  --success: #2dd4bf;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(7, 11, 20, 0.86);
  --modal-bg: #101826;
  --modal-border: rgba(148, 163, 184, 0.2);
  --inset-bg: #0a101c;
  --scrollbar-thumb: #334155;
  --scrollbar-thumb-hover: #475569;
  --content-max: 1200px;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(ellipse 90% 60% at 12% -10%, rgba(59, 111, 245, 0.07), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(13, 148, 136, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

.scrollbar-hidden {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-hidden::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.scrollbar-themed {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
.scrollbar-themed::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.scrollbar-themed::-webkit-scrollbar-track {
  background: transparent;
}
.scrollbar-themed::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}
.scrollbar-themed::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.app { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

.app-mode-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  vertical-align: middle;
}
body.is-desktop .app-mode-badge { display: none; }

/* 顶栏 */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--topbar-bg);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  flex-shrink: 0;
}
.brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0;
}
.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(200px, 28vw);
  object-fit: contain;
  object-position: left center;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--text);
}
.brand-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(145deg, #3b6ff5, #2a4fd4);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 0;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}

.view-tabs {
  display: flex; gap: 2px; flex: 1; justify-content: center;
  background: var(--inset-bg); padding: 3px; border-radius: 12px; max-width: 440px;
  border: 1px solid var(--border);
}
.view-tab {
  border: none; background: transparent; color: var(--text-muted);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 13px;
  font-weight: 500; border-bottom: none; margin-bottom: 0;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
  border-bottom-color: transparent;
}

.topbar-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; position: relative; }
.topbar-actions .btn.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.model-op-log-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  right: 12px;
  width: min(720px, calc(100vw - 24px));
  max-height: min(460px, calc(100vh - var(--topbar-h) - 20px));
  z-index: 950;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated, var(--inset-bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.model-op-log-panel.hidden { display: none; }
.model-op-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.model-op-log-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.model-op-log-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.model-op-log-tab:hover { color: var(--text); }
.model-op-log-tab.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.model-op-log-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.model-op-log-close {
  min-width: 32px;
  padding: 4px 8px;
  font-size: 16px;
  line-height: 1;
}
.model-op-log-body {
  overflow: auto;
  flex: 1;
  min-height: 120px;
}
.model-op-log-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.model-op-log-meta {
  padding: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.model-op-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.model-op-log-table th,
.model-op-log-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.model-op-log-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  z-index: 1;
}
.model-op-log-table td {
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-op-log-table tr.is-running td { background: rgba(79, 140, 255, 0.06); }
.model-op-log-table tr.is-failed td { background: rgba(255, 90, 90, 0.05); }
.model-op-log-status {
  max-width: 180px;
  white-space: normal;
}
.model-op-log-status-text { font-weight: 600; }
.model-op-log-status.is-success .model-op-log-status-text { color: var(--success); }
.model-op-log-status.is-failed .model-op-log-status-text { color: var(--danger); }
.model-op-log-status.is-cancelled .model-op-log-status-text { color: var(--text-muted); }
.model-op-log-status.is-running .model-op-log-status-text { color: var(--accent); }
.model-op-log-status-reason {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.btn.accent-outline {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* 布局 */
.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--bg);
  padding: 24px 16px;
  overflow-y: auto;
}

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted); margin-bottom: 10px; font-weight: 600;
}
.sidebar-section { margin-bottom: 20px; }

.project-list { list-style: none; margin-top: 8px; }
.project-list li {
  padding: 8px 10px; border-radius: 8px; font-size: 13px;
  color: var(--text-muted); border: 1px solid transparent;
}
.project-list .project-item {
  display: flex; align-items: center; gap: 6px;
}
.project-list .project-item-body {
  flex: 1; min-width: 0; cursor: pointer;
}
.project-list .project-item-body:hover { color: var(--text); }
.project-list .project-item-name {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-list li:hover { background: var(--bg-hover); color: var(--text); }
.project-list li.active {
  background: var(--accent-soft); border-color: rgba(59, 111, 245, 0.22); color: var(--accent-2);
}
.project-del-btn {
  flex-shrink: 0; width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1;
  cursor: pointer; opacity: 0;
}
.project-item:hover .project-del-btn,
.project-item.active .project-del-btn { opacity: 1; }
.project-del-btn:hover {
  background: rgba(239, 68, 68, 0.15); color: #ef4444;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  text-align: left; border: none; background: transparent; color: var(--text-muted);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.side-link:hover, .side-link.active { background: var(--bg-hover); color: var(--text); }

.sidebar-tools .section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 2px;
  border-left: none;
  margin-bottom: 10px;
}
.sidebar-tools .side-nav { gap: 4px; }
.sidebar-tools .side-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  padding: 9px 12px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.sidebar-tools .side-link:hover {
  background: var(--bg-hover);
  border-color: transparent;
  color: var(--text);
  box-shadow: none;
}
.sidebar-tools .side-link.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  box-shadow: none;
  font-weight: 600;
}

.pipeline-steps {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.pipeline-steps span {
  font-size: 11px; padding: 4px 8px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
}

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding-inline: 40px;
}
.workspace-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 12px 0 10px;
  box-sizing: border-box;
}
/* 作品名 + 阶段轨不参与面板滚动，始终钉在上方 */
.workspace > .workspace-header {
  flex-shrink: 0;
}
/* 软件设置等工具页：隐藏作品名、删除按钮、阶段轨 */
.workspace.is-tool-panel .workspace-header {
  display: none !important;
}
.workspace-header .project-name {
  flex: 0 1 auto;
  min-width: 120px;
  max-width: min(42%, 360px);
  width: auto;
}
.workspace-header .project-stage-rail {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 3px;
  box-shadow: none;
}
.workspace-header .project-stage-rail-item {
  padding: 6px 8px;
  gap: 6px;
}
.workspace-header .project-stage-rail-num {
  width: 22px;
  height: 22px;
  font-size: 11px;
}
.workspace-header .project-stage-rail-text {
  font-size: 12px;
}
.workspace-header #btnDeleteProject {
  flex-shrink: 0;
}
.project-name {
  flex: 1; min-width: 180px; background: transparent; border: 1px solid transparent;
  color: var(--text); padding: 8px 10px; border-radius: 12px; font-size: 20px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.01em;
}
.project-name:hover:not(:disabled),
.project-name:focus {
  background: #fff;
  border-color: var(--border);
  outline: none;
  box-shadow: var(--shadow);
}

.panel {
  display: none;
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}
.panel.visible {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.workspace-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.project-name {
  flex: 1; min-width: 180px;
}
.toolbar-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toolbar-check input { margin: 0; cursor: pointer; }
.toolbar-segment {
  padding: 4px 10px 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  align-items: center;
}
.toolbar-segment-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 4px;
  user-select: none;
}

.script-fold {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.script-fold-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.script-fold-title { font-weight: 500; color: var(--text); }
.script-fold-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.script-fold-summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--accent-2);
  transition: transform 0.15s;
}
.script-fold[open] .script-fold-summary::before { transform: rotate(90deg); }
.script-fold-summary::-webkit-details-marker { display: none; }
.script-fold[open] .script-fold-summary {
  border-bottom: 1px solid var(--border);
}
.script-chapter-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  max-height: 88px;
  overflow: auto;
}
.script-chapter-jumps.hidden { display: none; }
.script-chapter-jump {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
  flex-shrink: 0;
}
.script-chapter-jump:hover {
  border-color: var(--accent);
  color: var(--text);
}
.script-chapter-jump.is-active {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(239, 68, 68, 0.12));
  color: var(--text);
}
.script-editor-inline {
  width: 100%;
  min-height: min(42vh, 420px);
  height: min(42vh, 420px);
  max-height: min(70vh, 720px);
  resize: vertical;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 12px 16px;
  box-sizing: border-box;
  line-height: 1.65;
  font-size: 13px;
}

.main-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pipeline-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.06) 0%, transparent 100%);
  overflow-x: auto;
  flex-shrink: 0;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 72px;
  position: relative;
}
.pipeline-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: calc(50% + 14px);
  right: calc(-50% + 14px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.pipeline-step.done:not(:last-child)::after {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.6), rgba(34, 197, 94, 0.25));
}
.pipeline-step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 2px solid var(--border);
  position: relative;
  z-index: 1;
}
.pipeline-step-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  line-height: 1.3;
}
.pipeline-step.done .pipeline-step-dot {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
}
.pipeline-step.done .pipeline-step-label { color: #86efac; }
.pipeline-step.current .pipeline-step-dot {
  color: #93c5fd;
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.18);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}
.pipeline-step.current .pipeline-step-label {
  color: #93c5fd;
  font-weight: 600;
}

.chapter-board {
  flex-shrink: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(59, 111, 245, 0.06), transparent);
}
.chapter-board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.chapter-board-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0.02em;
}
.chapter-board-hint {
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 550;
}
.chapter-board-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(59, 111, 245, 0.22);
  background: rgba(59, 111, 245, 0.08);
  font-size: 12px;
  color: var(--text-muted);
}
.chapter-board-filter-bar.hidden {
  display: none;
}
.chapter-board-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chapter-board-scroll::-webkit-scrollbar {
  display: none;
}
.chapter-card {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 148px;
  max-width: 220px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.chapter-card:hover {
  border-color: rgba(59, 111, 245, 0.35);
  background: var(--bg-hover);
}
.chapter-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(59, 111, 245, 0.18);
}
.chapter-card-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid rgba(59, 111, 245, 0.18);
}
.chapter-card.active .chapter-card-num {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.chapter-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.chapter-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-card-meta {
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 500;
}
.chapter-card-summary {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-detail {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.04);
}
.chapter-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chapter-detail-titles { min-width: 0; }
.chapter-detail-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.chapter-detail-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.chapter-detail-summary {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.shot-revision-box {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}
.shot-revision-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.shot-revision-head .btn {
  flex-shrink: 0;
}
.shot-revision-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--warning);
}
.shot-revision-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}
.shot-revision-preview {
  margin-top: 4px;
  font-size: 11px;
  color: var(--warning);
  line-height: 1.4;
}

.storyboard-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.chapter-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chapter-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 4px;
  border-radius: 12px;
  background: linear-gradient(105deg, rgba(59, 111, 245, 0.08), rgba(13, 148, 136, 0.04));
  border: 1px solid rgba(59, 111, 245, 0.14);
  position: relative;
  overflow: hidden;
}
.chapter-section-num {
  flex-shrink: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: rgba(59, 111, 245, 0.28);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  min-width: 36px;
}
.chapter-section-info { min-width: 0; }
.chapter-section-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 4px;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}
.chapter-section-meta {
  font-size: 12px;
  color: var(--accent-2);
  margin-bottom: 2px;
}
.chapter-section-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.chapter-section-shots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.storyboard-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
}
.storyboard-empty p { margin: 0; font-size: 14px; }
.storyboard-empty-hint { font-size: 12px; opacity: 0.8; }

.script-editor {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 12px; border-radius: var(--radius); line-height: 1.6;
}

.storyboard-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 16px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  align-items: stretch;
}

.shot-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: row;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  overflow: hidden;
}
.shot-card .thumb .shot-card-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  background: #0f131c;
  pointer-events: none;
}
.shot-thumb-media {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(160deg, #1e2433 0%, #0f131c 100%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}
.shot-thumb-media img,
.shot-thumb-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
}
.shot-thumb-play {
  position: absolute;
  inset: auto auto 8px 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}
.shot-thumb-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
}
.shot-list-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  flex-shrink: 0;
}
.shot-list-item-thumb {
  flex: 0 0 72px;
  width: 72px;
  min-width: 72px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f131c;
  align-self: flex-start;
}
.shot-list-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shot-list-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shot-list-item-index {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
}
.shot-list-item-video-tag {
  font-size: 10px;
  font-weight: 650;
  color: #93c5fd;
  background: rgba(59, 111, 245, 0.16);
  border-radius: 4px;
  padding: 1px 6px;
}
.shot-list-item-busy {
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
}
.shot-list-item-script {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shot-card:hover {
  border-color: rgba(59, 111, 245, 0.35);
  box-shadow: var(--shadow-md);
}
.shot-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 111, 245, 0.2), var(--shadow-md);
}
.shot-card .thumb {
  width: 200px;
  min-width: 200px;
  height: 112px;
  max-height: 112px;
  flex-shrink: 0;
  align-self: stretch;
  background: linear-gradient(160deg, #1e2433 0%, #0f131c 100%);
  border-radius: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.shot-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center center; }
.shot-card .meta {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.shot-index {
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.shot-script {
  font-size: 13px; color: var(--text); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.shot-notes-preview {
  font-size: 12px; color: var(--text-muted); line-height: 1.45; opacity: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 编辑视图 */
.edit-batch-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.edit-batch-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.edit-batch-steps .btn {
  white-space: nowrap;
}
.edit-batch-steps .btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.edit-batch-steps .btn.is-done {
  border-color: rgba(94, 184, 255, 0.35);
}
.edit-batch-infer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.edit-batch-infer-meta {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}
.edit-batch-progress {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.shot-detail-op-progress {
  margin-top: 10px;
  flex-shrink: 0;
}
.shot-detail-op-progress #shotDetailOpProgressLabel {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shot-detail-op-progress #shotDetailOpProgressPercent {
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
.edit-batch-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.edit-batch-progress-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#btnEditBatchCancel {
  padding: 2px 10px;
  font-size: 12px;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}
#btnEditBatchCancel:hover {
  background: rgba(248, 113, 113, 0.12);
}
.shot-detail-pipeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.shot-detail-pipeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.shot-detail-pipeline-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
#btnShotDetailPipelineCancel {
  padding: 2px 10px;
  font-size: 12px;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}
#btnShotDetailPipelineCancel:hover {
  background: rgba(248, 113, 113, 0.12);
}
#panelEdit.panel.visible {
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
}
.sb-detail-top {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(0, 1.4fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.sb-detail-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sb-detail-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.sb-detail-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.sb-detail-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sb-detail-top-center {
  min-width: 0;
  text-align: center;
}
.sb-detail-title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
}
.sb-detail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-detail-status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}
.sb-detail-status-badge[data-tone="warn"] {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}
.sb-detail-status-badge[data-tone="muted"] {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-muted);
}
.sb-detail-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-detail-top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.sb-detail-freeze-hint {
  font-size: 12px;
  color: var(--text-muted);
}
#panelEdit .edit-layout.sb-detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.sb-detail-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 12px 10px;
  gap: 10px;
}
.sb-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 4px;
}
.sb-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.sb-sidebar-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.sb-ep-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.sb-ep-group.is-collapsed .sb-ep-shots {
  display: none;
}
.sb-ep-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 6px 4px;
  cursor: pointer;
  text-align: left;
}
.sb-ep-toggle-caret {
  color: var(--text-muted);
  width: 12px;
}
.sb-ep-toggle-title {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
}
.sb-ep-toggle-count {
  font-size: 11px;
  color: var(--text-muted);
}
.sb-ep-shots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shot-list-item-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.shot-list-item-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.shot-list-item-status.tone-ok { color: #4ade80; }
.shot-list-item-status.tone-warn { color: #fbbf24; }
.shot-list-item-status.tone-muted { color: var(--text-muted); }
.shot-thumb-media.is-generating {
  flex-direction: column;
  gap: 6px;
  color: #93c5fd;
  font-size: 11px;
}
.sb-thumb-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(147, 197, 253, 0.25);
  border-top-color: #93c5fd;
  animation: sb-spin 0.8s linear infinite;
}
@keyframes sb-spin {
  to { transform: rotate(360deg); }
}
#panelEdit .edit-detail.sb-detail-main {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  gap: 0;
  background: var(--bg);
}
.sb-detail-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}
#panelEdit .edit-detail-upper {
  gap: 14px;
}
.sb-pack-section,
.sb-video-section,
.sb-section-fold,
.sb-settings-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.sb-pack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sb-pack-caption {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.sb-video-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  font-size: 12px;
}
.sb-video-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}
.sb-video-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 12px;
  align-items: stretch;
}
#panelEdit .preview-box {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.sb-gen-progress {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sb-gen-progress-title {
  font-size: 13px;
  font-weight: 700;
}
.sb-gen-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sb-gen-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-muted);
}
.sb-gen-step strong {
  display: block;
  font-size: 12px;
  color: var(--text);
}
.sb-gen-step em {
  font-style: normal;
  font-size: 11px;
}
.sb-gen-step-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-muted);
}
.sb-gen-step.is-done .sb-gen-step-mark {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}
.sb-gen-step.is-current .sb-gen-step-mark {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.sb-gen-progress-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #93c5fd;
  background: rgba(59, 111, 245, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
}
.sb-section-fold summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.sb-section-fold .script-editor {
  min-height: 120px;
  width: 100%;
  box-sizing: border-box;
}
.sb-settings-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.sb-settings-row--meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sb-setting label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sb-setting-value {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.sb-detail-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.sb-footer-status {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}
.sb-footer-status[data-tone="ok"] { color: #4ade80; }
.sb-footer-status[data-tone="warn"] { color: #fbbf24; }
.sb-footer-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sb-footer-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sb-footer-field-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}
.sb-footer-select {
  min-width: 92px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sb-footer-select--model {
  min-width: 168px;
  max-width: 220px;
}
.sb-footer-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 111, 245, 0.18);
}
.sb-footer-actions .media-gen-group {
  align-self: flex-end;
}
.shot-media-cell-progress-card {
  width: min(86%, 240px);
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.shot-media-cell-progress-card .shot-media-cell-progress-label {
  color: #0f172a;
  font-weight: 700;
}
.shot-media-cell-progress-card .shot-media-cell-progress-percent {
  color: #ea580c;
}
.shot-media-cell-progress-card .extract-progress-track {
  width: 100%;
  background: rgba(15, 23, 42, 0.08);
}
.shot-media-cell-progress-card .extract-progress-bar {
  background: linear-gradient(90deg, #f97316, #fb923c);
}
.shot-media-cell-progress-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}
@media (max-width: 1100px) {
  .sb-detail-top {
    grid-template-columns: 1fr;
  }
  .sb-video-workspace,
  .sb-settings-row {
    grid-template-columns: 1fr;
  }
  #panelEdit .edit-layout.sb-detail-layout {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  }
}
#panelEdit .edit-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.shot-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
}
.shot-list-hint {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1.4;
}
.shot-list {
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  padding-right: 4px;
  flex: 1;
}
#panelEdit .shot-list-wrap {
  height: 100%;
  max-height: 100%;
}
#panelEdit .edit-detail {
  align-self: stretch;
  width: 100%;
  max-height: 100%;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
  padding-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
#panelEdit .edit-detail-upper {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shot-list-item.active { border-color: var(--accent); background: var(--accent-soft); }
.shot-list-item.is-dragging {
  opacity: 0.45;
  border-style: dashed;
}
.shot-list-item.is-drop-target {
  border-color: #6ea8fe;
  background: rgba(110, 168, 254, 0.12);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.25);
}
.shot-card.is-dragging {
  opacity: 0.45;
  border-style: dashed;
}
.shot-card.is-drop-target {
  border-color: #6ea8fe;
  background: rgba(110, 168, 254, 0.08);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.25);
}
.shot-card[draggable="true"] { cursor: grab; }
.shot-card[draggable="true"]:active { cursor: grabbing; }
.shot-list-item[draggable="true"] { cursor: grab; }
.shot-list-item[draggable="true"]:active { cursor: grabbing; }
.shot-list-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.edit-detail { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
#panelEdit .edit-shot-script-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
#panelEdit .edit-shot-script-wrap .script-editor {
  min-height: 120px;
}
#panelEdit .edit-shot-script-wrap .script-editor.camera-content-editor,
#panelEdit .camera-content-editor {
  min-height: 140px;
  max-height: none;
  height: auto;
  overflow: hidden;
  field-sizing: content;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  resize: none;
}
.edit-shot-script-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.edit-shot-script-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.edit-shot-meta {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.edit-shot-script-extra {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px 8px;
  background: var(--bg-card);
}
.edit-shot-script-extra > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.edit-shot-script-extra[open] > summary {
  margin-bottom: 6px;
  color: var(--text);
}
.edit-shot-script-extra .script-editor {
  min-height: 72px;
}
.prompt-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}
.prompt-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
#panelEdit .prompt-panel:not(.hidden) {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}
.prompt-panel.hidden { display: none !important; }
.shot-assets-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent-2);
  padding: 0 2px;
  min-height: 18px;
}
.shot-assets-hint.is-empty {
  color: var(--text-muted);
}
.shot-asset-refs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.shot-asset-refs.is-empty {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--inset-bg);
}
.shot-asset-ref-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.shot-asset-ref-label {
  flex: 0 0 auto;
  min-width: 2em;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.shot-asset-ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.shot-asset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 8px 2px 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card, #fff);
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
}
.shot-asset-chip.is-missing {
  opacity: 0.72;
  border-style: dashed;
}
.shot-asset-chip-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--inset-bg);
  display: grid;
  place-items: center;
}
.shot-asset-chip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shot-asset-chip-placeholder {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
}
.shot-asset-chip-name {
  max-width: 7em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shot-asset-refs--card .shot-asset-ref-label {
  margin-top: 4px;
}
.shot-asset-refs--card .shot-asset-chip-thumb {
  width: 24px;
  height: 24px;
}
.shot-asset-refs--list {
  margin-top: 6px;
}
.shot-asset-refs--list .shot-asset-chip-name {
  display: none;
}
.shot-asset-refs--list .shot-asset-chip {
  padding: 1px;
  border-radius: 50%;
}
.shot-asset-refs--list .shot-asset-chip-thumb {
  width: 22px;
  height: 22px;
}
.shot-asset-refs--detail {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--inset-bg);
}
.shot-asset-refs--detail .shot-asset-chip {
  background: var(--bg-card, #fff);
}
.shot-asset-refs--detail .shot-asset-chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.shot-asset-refs--detail .shot-asset-chip {
  border-radius: 10px;
  padding: 3px 10px 3px 3px;
}
.shot-asset-refs--detail .shot-asset-chip-name {
  max-width: 10em;
  font-size: 12px;
}
.panel-prompt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-prompt-actions .btn.is-generating {
  opacity: 0.85;
  cursor: wait;
}
.panel-media-actions { margin-top: 0; }
.panel-media-actions .media-gen-group {
  position: relative;
  display: inline-block;
}
.gen-media-cancel {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  min-width: 22px;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  line-height: 20px;
  font-size: 15px;
  font-family: inherit;
  color: #fff;
  background: #ef4444;
  border: 2px solid var(--bg-card, #1a1a1f);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  appearance: none;
}
.gen-media-cancel:hover {
  background: #f87171;
  color: #fff;
}
.panel-media-actions .btn.is-generating {
  opacity: 0.85;
  cursor: wait;
}
.shot-card.is-busy .thumb {
  position: relative;
}
.shot-card.is-busy .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  border-radius: inherit;
}
.shot-busy-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
}
.shot-list-item.is-busy {
  border-color: var(--accent);
}
.prompt-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.prompt-tab {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 12px;
}
.prompt-tab.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.shot-action-timeline {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 220px; overflow-y: auto; padding: 2px 0;
}
.shot-action-timeline.empty { display: none; }
.action-beat-card {
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card);
  padding: 10px 12px; display: grid; gap: 4px;
}
.action-beat-time {
  font-size: 12px; font-weight: 600; color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.action-beat-action { font-size: 13px; color: var(--text); line-height: 1.45; }
.action-beat-meta { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.shot-beats-preview {
  font-size: 11px; color: var(--accent-2); line-height: 1.35; opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

.prompt-editor {
  flex: 1 1 auto;
  min-height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius);
  resize: vertical;
  line-height: 1.55;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.prompt-editor::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#panelEdit .prompt-editor {
  min-height: 140px;
}
.edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-box {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
#panelEdit .shot-detail-pipeline,
#panelEdit .edit-shot-script-wrap,
#panelEdit .prompt-tabs,
#panelEdit .edit-detail-upper .edit-batch-progress {
  flex-shrink: 0;
}
.preview-box img, .preview-box video { max-width: 100%; max-height: 280px; border-radius: 8px; }
.preview-placeholder { color: var(--text-muted); font-size: 13px; text-align: center; }
#panelEdit .preview-box {
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#panelEdit .preview-box img,
#panelEdit .preview-box video {
  max-height: none;
}
#panelEdit .shot-media-cell-body video.previewable-video {
  max-height: none;
  max-width: none;
}
.shot-media-preview {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  min-height: 0;
}
.shot-media-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}
.shot-media-cell.is-active .shot-media-cell-label {
  color: var(--accent-2);
}
.shot-media-cell.is-active .shot-media-cell-body .previewable-video-wrap,
.shot-media-cell.is-active .shot-media-cell-body .preview-placeholder {
  border-color: var(--accent);
}
.shot-media-cell-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.shot-media-cell-body {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  width: 100%;
  max-width: 100%;
  /* 以宽度为主：竖屏太窄时 WebKit 会收起原生进度条/全屏 */
  --video-preview-max-w: min(100%, 420px);
  --video-preview-ratio: 9 / 16;
  --video-preview-ar: 0.5625;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: unset;
  overflow: visible;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.shot-media-cell-body img,
.shot-media-cell-body video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
}
.shot-media-cell-body.has-media img {
  object-fit: cover;
  object-position: center center;
}
.shot-media-cell-body.has-media video,
.shot-media-cell-body.has-media .previewable-video-wrap video.previewable-video {
  object-fit: contain;
  object-position: center center;
  background: #000;
}
.shot-media-cell-body .previewable-video-wrap {
  position: relative;
  width: var(--video-preview-max-w);
  max-width: 100%;
  aspect-ratio: var(--video-preview-ratio);
  height: auto;
  max-height: min(72vh, 720px);
  flex: 0 0 auto;
  background: #0f1218;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.shot-media-cell-body:not(.has-media) .preview-placeholder {
  width: var(--video-preview-max-w);
  max-width: 100%;
  aspect-ratio: var(--video-preview-ratio);
  height: auto;
  max-height: min(72vh, 720px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f1218;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 13px;
  box-sizing: border-box;
}
.shot-media-cell-body .shot-media-del,
.previewable-video-wrap .shot-media-del {
  top: 8px;
  right: 8px;
}
.shot-media-preview-stage {
  position: relative;
  width: min(100%, 420px);
  max-width: 100%;
  --video-preview-max-w: min(100%, 420px);
  --video-preview-ratio: 9 / 16;
  --video-preview-ar: 0.5625;
}
.shot-media-preview-stage .shot-media-cell-body {
  width: 100%;
}
.shot-media-preview-stage .previewable-video-wrap,
.shot-media-preview-stage .preview-placeholder {
  width: 100%;
}
.shot-media-cell-progress {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 22px;
  border-radius: 12px;
  background: rgba(8, 10, 16, 0.58);
  box-sizing: border-box;
  pointer-events: none;
}
.shot-media-cell-progress.hidden {
  display: none;
}
.shot-prompt-progress {
  margin-top: 10px;
}
.shot-media-cell-progress-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 0;
  width: min(72%, 180px);
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}
.shot-media-cell-progress-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-weight: 550;
}
.shot-media-cell-progress-percent {
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
  flex-shrink: 0;
  font-weight: 650;
}
.shot-media-cell-progress .extract-progress-track {
  width: min(72%, 180px);
  height: 6px;
  background: rgba(255, 255, 255, 0.16);
}
.shot-media-cell-progress.is-active .shot-media-cell-progress-bar {
  position: relative;
}
.shot-media-cell-progress.is-active .shot-media-cell-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: extract-progress-shine 1.4s ease-in-out infinite;
}
.shot-media-cell-actions {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 4px 4px;
}
.shot-media-cell-actions .media-gen-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.shot-media-del {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shot-media-del:hover {
  background: rgba(239, 68, 68, 0.92);
}
@media (max-width: 900px) {
  .shot-media-preview {
    flex-direction: column;
  }
  .shot-media-cell {
    width: 100%;
    flex: 1 1 auto;
  }
  .shot-media-cell-body {
    --video-preview-max-w: min(100%, 360px);
  }
}

/* 音频视图 */
.audio-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
}
.audio-list { display: flex; flex-direction: column; gap: 10px; }
.audio-row {
  display: grid; grid-template-columns: 48px 1fr 160px 100px auto;
  gap: 10px; align-items: center; padding: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.audio-row textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px; border-radius: 8px; resize: vertical; min-height: 48px; font-size: 12px;
}
.audio-row select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px; border-radius: 8px;
}

/* 素材视图 / 资源库 */
.assets-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.asset-card {
  aspect-ratio: 16/10; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; position: relative;
}
.asset-card img { width: 100%; height: 100%; object-fit: contain; background: #0a0d12; }
.asset-label {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px;
  background: rgba(0,0,0,0.6); font-size: 11px;
}

#panelAssets.panel.visible {
  display: block;
  flex: 1;
  min-height: 0;
  padding: 8px 0 48px;
  /* 整页统一滚动（阶段轨在 workspace 顶部固定不滚） */
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.asset-library {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  box-sizing: border-box;
  padding: 8px 16px 32px;
  /* 随内容增高，不在内部再开小滚动区 */
  overflow: visible;
  min-height: auto;
  height: auto;
}
.asset-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.asset-library-title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-family: var(--font-sans);
}
.asset-library-hint {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
}
.asset-library-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.asset-library-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.asset-library-tab:hover { color: var(--text); }
.asset-library-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.asset-library-toolbar {
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.asset-library-body {
  flex: none;
  min-height: 0;
  overflow: visible;
  padding: 4px 2px 12px;
}
/* 资源库列表：图片 + 姓名网格，描述在详情中 */
.library-section-label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.library-section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.library-type-section {
  margin-bottom: 28px;
}
.library-type-section:last-child {
  margin-bottom: 8px;
}
.library-section-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-elevated);
}
.library-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
.library-shot-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.library-shot-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  transform: translateY(-1px);
}
.library-shot-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.library-shot-preview {
  position: relative;
  display: block;
  width: 100%;
  min-width: 100%;
  flex: 0 0 auto;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #f4f5f7;
  box-sizing: border-box;
}
.library-shot-preview.is-generating {
  background: var(--inset-bg);
}
.library-shot-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  z-index: 0;
}
.library-shot-preview .preview-placeholder,
.library-shot-preview .asset-gen-preview,
.library-shot-preview .zizi-preview-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px;
  text-align: center;
  box-sizing: border-box;
  background: #f4f5f7;
}
.library-shot-preview.is-generating .zizi-preview-loading,
.library-shot-preview.is-generating .asset-gen-preview {
  background: color-mix(in srgb, var(--inset-bg) 94%, #fff);
}
.library-shot-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: max-content;
  height: max-content;
  max-width: none;
  max-height: none;
  justify-self: start;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  box-sizing: border-box;
}
.library-shot-select input {
  margin: 0;
  width: 14px;
  height: 14px;
  flex: none;
}
.library-shot-caption {
  padding: 8px 10px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-shot-actions {
  display: flex;
  gap: 4px;
  padding: 0 8px 8px;
}
.library-shot-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  font-size: 11px;
  padding: 4px 6px;
  white-space: nowrap;
  line-height: 1.2;
}

.asset-rail--retired,
.asset-rail[hidden] {
  display: none !important;
  width: 0 !important;
}

/* 文案工具 */
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tool-card {
  padding: 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); cursor: pointer; text-align: center;
}
.tool-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.copy-result {
  flex: 1; min-height: 200px; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 12px; border-radius: var(--radius);
}

/* 工作流 */
.workflow-page { padding: 16px 20px 24px; }
.workflow-intro h3 { font-size: 16px; margin-bottom: 6px; }
.workflow-stages {
  display: flex; flex-direction: column; gap: 12px; margin-top: 16px;
}
.wf-stage {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
}
.wf-stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wf-stage-num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: rgba(79, 140, 255, 0.15); color: #93c5fd;
  border: 1px solid rgba(79, 140, 255, 0.35);
}
.wf-stage-num.create { background: rgba(34, 197, 94, 0.12); color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.wf-stage-num.edit { background: rgba(168, 85, 247, 0.12); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.35); }
.wf-stage-num.novel { background: rgba(79, 140, 255, 0.15); color: #93c5fd; border-color: rgba(79, 140, 255, 0.35); }
.wf-stage-num.assets { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.wf-stage-clickable { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.wf-stage-clickable:hover { border-color: rgba(79, 140, 255, 0.45); background: var(--bg-hover); }
.wf-stage-actions { margin-top: 10px; }
.wf-guide-pulse {
  animation: wfGuidePulse 0.9s ease 3;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.55);
}
@keyframes wfGuidePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.wf-stage-title { font-size: 14px; font-weight: 600; }
.wf-stage-scope {
  font-size: 11px; color: var(--text-muted); margin-left: auto;
  padding: 2px 8px; border-radius: 999px; background: var(--bg-hover);
}
.wf-stage-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.wf-stage-io { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; }
.wf-stage-io span {
  padding: 2px 8px; border-radius: 6px;
  background: var(--bg-hover); color: var(--text-muted);
}
.wf-stage-io .in { border: 1px solid rgba(79, 140, 255, 0.25); }
.wf-stage-io .out { border: 1px solid rgba(34, 197, 94, 0.25); }


.workflow-canvas {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 24px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
}
.wf-node {
  padding: 10px 14px; border-radius: 8px; background: var(--bg-hover);
  border: 1px solid var(--border); font-size: 12px;
}
.wf-node.start { border-color: var(--success); }
.wf-node.end { border-color: var(--accent); }
.wf-arrow { color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 16px; line-height: 1.6; margin-top: 12px; }

/* 素材库 placeholder */
.material-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.material-tab {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 12px;
}
.material-tab.active { color: var(--text); border-color: var(--accent); }
.placeholder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.material-item {
  padding: 24px 12px; text-align: center; background: var(--bg-card);
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: 13px;
}

/* AI 配置 */
.settings-grid { display: grid; gap: 12px; }
.setting-card {
  padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.setting-card h4 { margin-bottom: 8px; font-size: 14px; }
.setting-card ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.setting-card li { font-size: 12px; color: var(--text-muted); }

/* AI 助手 */
.agent-panel {
  position: relative;
  width: var(--agent-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}
.agent-panel.collapsed {
  width: 0;
  min-width: 0;
  border-left-color: transparent;
  overflow: visible;
}
.agent-edge-toggle {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.agent-edge-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-2);
  color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 4px 14px rgba(0, 0, 0, 0.3);
}
.agent-edge-icon {
  font-size: 10px;
  line-height: 1;
}
.agent-content {
  flex: 1;
  min-height: 0;
  min-width: var(--agent-w);
  display: flex;
  flex-direction: column;
}
.agent-panel.collapsed .agent-content {
  visibility: hidden;
  pointer-events: none;
}
.agent-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.agent-header-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.agent-perm-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
  letter-spacing: 0.02em;
}
.agent-sessions {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 0;
  position: relative;
  z-index: 4;
}
.agent-new-chat-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.agent-new-chat-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-sessions-trigger {
  flex-shrink: 0;
  max-width: 42%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.agent-sessions-trigger:hover,
.agent-sessions.is-open .agent-sessions-trigger {
  background: var(--bg-hover);
  border-color: var(--accent-2);
  color: var(--text);
}
.agent-sessions-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.agent-sessions-trigger-caret {
  font-size: 10px;
  line-height: 1;
  opacity: 0.7;
  flex-shrink: 0;
}
.agent-session-dropdown {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(100% + 4px);
  z-index: 8;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}
.agent-sessions:hover .agent-session-dropdown,
.agent-sessions.is-open .agent-session-dropdown,
.agent-sessions:focus-within .agent-session-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.agent-session-dropdown .agent-session-list {
  max-height: min(240px, 42vh);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  padding: 4px 0;
}
.agent-new-chat-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-2);
}
.agent-new-chat-icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}
.agent-session-list {
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agent-session-group-label {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 6px 2px;
  flex-shrink: 0;
}
.agent-session-item {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}
.agent-session-item:hover {
  background: var(--bg-hover);
}
.agent-session-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.agent-session-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.agent-session-menu-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.agent-session-item:hover .agent-session-menu-btn,
.agent-session-item.is-active .agent-session-menu-btn {
  opacity: 1;
}
.agent-session-menu-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}
.agent-chat-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.agent-guide-rail {
  position: absolute;
  right: 2px;
  top: 8px;
  bottom: 8px;
  width: 14px;
  z-index: 3;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  transition: width 0.18s ease;
}
.agent-guide-rail.is-hidden {
  display: none;
}
.agent-guide-rail:hover,
.agent-guide-rail:focus-within {
  width: 148px;
}
.agent-guide-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-height: 100%;
  width: 100%;
  min-width: 14px;
}
.agent-guide-search-wrap {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  transition: max-height 0.18s ease, opacity 0.15s ease, padding 0.18s ease;
}
.agent-guide-rail:hover .agent-guide-search-wrap,
.agent-guide-rail:focus-within .agent-guide-search-wrap {
  max-height: 40px;
  opacity: 1;
  padding: 0 0 6px;
}
.agent-guide-search {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  outline: none;
}
.agent-guide-search:focus {
  border-color: var(--accent-2);
}
.agent-guide-list {
  pointer-events: auto;
  overflow-y: auto;
  max-height: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.agent-guide-rail:hover .agent-guide-list,
.agent-guide-rail:focus-within .agent-guide-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  padding: 4px 0;
  gap: 0;
  align-items: stretch;
}
.agent-guide-item {
  display: flex;
  align-items: center;
  gap: 0;
  width: 14px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease, width 0.18s ease, padding 0.18s ease, gap 0.18s ease;
}
.agent-guide-rail:hover .agent-guide-item,
.agent-guide-rail:focus-within .agent-guide-item {
  width: 100%;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  justify-content: flex-start;
}
.agent-guide-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.agent-guide-item.is-active {
  color: var(--accent-2);
}
.agent-guide-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}
.agent-guide-rail:hover .agent-guide-text,
.agent-guide-rail:focus-within .agent-guide-text {
  display: block;
}
.agent-guide-marker {
  flex-shrink: 0;
  width: 10px;
  height: 2px;
  background: rgba(148, 163, 184, 0.38);
  border-radius: 1px;
  transition: width 0.15s ease, height 0.15s ease, background 0.15s ease;
}
.agent-guide-item.is-active .agent-guide-marker {
  width: 12px;
  height: 3px;
  background: var(--accent-2);
}
.agent-guide-rail:hover .agent-guide-item.is-active .agent-guide-marker,
.agent-guide-rail:focus-within .agent-guide-item.is-active .agent-guide-marker {
  width: 14px;
}
.agent-guide-empty {
  display: none;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 10px;
  text-align: center;
}
.agent-guide-rail:hover .agent-guide-empty,
.agent-guide-rail:focus-within .agent-guide-empty {
  display: block;
}
.agent-exchange-highlight {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.agent-model-hint {
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
}
.agent-model-hint.warn { color: #e6a23c; }
.agent-model-tag {
  display: block; margin-top: 6px; font-size: 10px; color: var(--text-muted); opacity: 0.8;
}
.msg.bot.pending { opacity: 0.7; font-style: italic; }
.msg.bot.error { border: 1px solid rgba(230, 162, 60, 0.35); }
.badge {
  font-size: 10px; padding: 2px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.msg {
  padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; max-width: 95%;
}
.msg.bot { background: var(--bg-card); align-self: flex-start; }
.msg.user { background: var(--accent); color: #ffffff; align-self: flex-end; }
.agent-msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.agent-msg-user .msg-body { width: 100%; }
.agent-recall-btn {
  border: none;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.4;
}
.agent-recall-btn:hover {
  background: rgba(0, 0, 0, 0.28);
}

.agent-input {
  padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px;
}
.agent-input textarea {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 10px; border-radius: 8px; resize: vertical;
  min-height: 72px;
}
.agent-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.agent-input-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.quick-actions { padding: 0 12px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
  padding: 4px 10px; border-radius: 999px; font-size: 11px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.agent-apply-btn.accent {
  border-color: rgba(59, 111, 245, 0.4);
  color: var(--accent-2);
  background: var(--accent-soft);
}
.agent-apply-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}
.agent-apply-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 2px;
}
.agent-apply-btn:disabled { opacity: 0.55; cursor: wait; }

/* 类型标签按钮 */
.type-tag-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.type-tag-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.type-tag-btn:hover {
  border-color: var(--primary);
}

.type-tag-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* 按钮 */
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}
.btn:hover { background: var(--bg-hover); }
.btn.primary {
  border: 1px solid transparent;
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 111, 245, 0.28);
}
.btn.primary:hover {
  background: linear-gradient(145deg, #5b88f8, #3b6ff5);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(59, 111, 245, 0.34);
}
.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 111, 245, 0.22);
}
.btn.accent { border-color: transparent; color: #fff; background: linear-gradient(145deg, #4a7af7, #2f5bea); box-shadow: 0 4px 14px rgba(59, 111, 245, 0.28); }
.btn.accent:hover { background: linear-gradient(145deg, #5b88f8, #3b6ff5); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { color: var(--text); background: var(--inset-bg); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.btn.is-generating { white-space: nowrap; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1a1d26; color: #fff; border: none; padding: 12px 20px;
  border-radius: 12px; font-size: 13px; opacity: 0; transition: all 0.28s; z-index: var(--z-toast);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

.empty-workspace {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-muted); padding: 48px 24px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.empty-workspace-air {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-workspace-air > p:first-child {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
.empty-workspace .hint {
  max-width: 460px;
  text-align: center;
  line-height: 1.7;
  font-size: 16px;
}
body.is-web .workspace.is-empty-project .workspace-header {
  display: none !important;
}
body.is-web .workspace.is-empty-project #panelMain.panel.visible {
  justify-content: center;
}
body.is-web .empty-workspace {
  min-height: 420px;
}
.btn-create-outline {
  margin-top: 8px;
  border: 1px solid transparent;
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  color: #fff;
  padding: 12px 28px;
  border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 650;
  box-shadow: 0 4px 14px rgba(59, 111, 245, 0.28);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-create-outline:hover {
  background: linear-gradient(145deg, #5b88f8, #3b6ff5);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(59, 111, 245, 0.34);
}

/* 科技深空 · 英雄区（对标 SpaceX / NVIDIA 首页气质） */
.tech-hero {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px 72px;
  background: #05070d;
  color: #fff;
  overflow: hidden;
}
.tech-hero.hidden { display: none !important; }
.empty-workspace.is-tech-hero {
  padding: 0;
  width: 100%;
  align-self: stretch;
  min-height: min(100%, 720px);
  height: 100%;
}
.tech-hero-glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background: radial-gradient(ellipse 55% 50% at 50% 40%, rgba(37, 99, 235, 0.35) 0%, rgba(79, 70, 229, 0.12) 42%, transparent 72%);
  pointer-events: none;
}
.tech-hero-globe {
  position: absolute;
  width: min(72vw, 520px);
  height: min(72vw, 520px);
  opacity: 0.45;
  pointer-events: none;
  animation: tech-globe-spin 80s linear infinite;
}
@keyframes tech-globe-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.tech-hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.tech-hero-eyebrow {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: #8a9bb5;
}
.tech-hero-title {
  margin: 0;
  font-size: clamp(2.75rem, 7vw, 3.75rem); /* ~text-6xl */
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  background: linear-gradient(120deg, #60a5fa 0%, #a78bfa 48%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tech-hero-sub {
  margin: 0;
  max-width: 36rem;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #8a9bb5;
}
.tech-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 10px;
}
.tech-btn {
  appearance: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}
.tech-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.tech-btn-ghost {
  color: #e2e8f0;
  background: rgba(8, 12, 24, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12), 0 0 24px rgba(37, 99, 235, 0.28);
}
.tech-btn-ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(147, 197, 253, 0.75);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25), 0 0 32px rgba(59, 130, 246, 0.45);
}
.tech-btn-primary {
  color: #fff;
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.4);
}
.tech-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(79, 70, 229, 0.5);
}
.tech-hero-scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, 0.45);
  background: rgba(15, 23, 42, 0.35);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
  display: grid;
  place-items: center;
  animation: tech-scroll-pulse 2s ease-in-out infinite;
}
.tech-hero-scroll span {
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: rgba(191, 219, 254, 0.9);
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.9);
}
@keyframes tech-scroll-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
  50% { transform: translateX(-50%) scale(1.08); opacity: 1; }
}


/* 创建新作品弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28);
  display: none; align-items: center; justify-content: center; z-index: var(--z-modal-base);
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
#assetManageModal { z-index: var(--z-modal-manage); }
#characterStyleModal { z-index: var(--z-modal-style); }
#extractModal { z-index: var(--z-modal-extract); }
#assetDetailModal { z-index: var(--z-modal-detail); }
#imageLightbox { z-index: var(--z-modal-lightbox); }
#errorModal {
  z-index: var(--z-modal-error);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
}
#errorModal.open {
  display: flex;
}

/* 错误弹窗 */
.error-dialog {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 12px;
  width: min(480px, calc(100vw - 48px));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: error-dialog-in 0.18s ease-out;
}
@keyframes error-dialog-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.error-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.error-dialog-header h3 { font-size: 16px; color: #f87171; }
.error-dialog-body {
  padding: 16px 18px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: 50vh;
  font-family: inherit;
}
.error-dialog-footer {
  padding: 12px 18px 16px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* 确认弹窗 */
#confirmModal {
  z-index: var(--z-modal-confirm);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
}
#confirmModal.open {
  display: flex;
}
#sliceReviewModal {
  z-index: var(--z-modal-confirm);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
}
#sliceReviewModal.open {
  display: flex;
}
#shotDetailModal {
  z-index: var(--z-modal-confirm);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
}
#shotDetailModal.open {
  display: flex;
}
.shot-detail-dialog {
  width: min(820px, 96vw);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
}
.shot-detail-modal-body {
  overflow: auto;
  max-height: min(68vh, 720px);
  padding-right: 4px;
}
.shot-detail-modal-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.shot-detail-modal-thumb {
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0d12;
  max-height: 220px;
}
.shot-detail-modal-thumb img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  display: block;
}
.shot-detail-modal-block {
  margin: 0 0 14px;
}
.shot-detail-modal-block h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.shot-detail-modal-block pre {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}
.slice-review-wait {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.confirm-dialog {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 12px;
  width: min(440px, calc(100vw - 48px));
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: error-dialog-in 0.18s ease-out;
}
.confirm-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.confirm-dialog-header h3 {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}
.confirm-dialog-body {
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.65;
  color: #c8cdd8;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: 50vh;
}
.confirm-dialog-footer {
  padding: 12px 18px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}
.confirm-dialog-footer .btn {
  min-width: 88px;
}

.slice-review-dialog {
  width: min(720px, calc(100vw - 48px));
  max-height: min(88vh, 820px);
}
.slice-review-body {
  white-space: normal;
  max-height: min(62vh, 560px);
  overflow: auto;
}
.slice-review-warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 13px;
  line-height: 1.5;
}
.slice-review-meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.slice-review-list {
  margin: 0 0 14px;
  padding-left: 1.2em;
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}
.slice-review-list li {
  margin-bottom: 6px;
}
.slice-review-section-title {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.slice-review-advice,
.slice-review-full {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.slice-review-editors {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.slice-review-editors label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.slice-review-editors textarea {
  min-height: 52px;
  resize: vertical;
  font-size: 13px;
}

/* 图片灯箱 */
.lightbox-overlay {
  background: rgba(0, 0, 0, 0.92);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox-overlay.open { cursor: zoom-out; }
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 2;
  font-size: 28px;
  color: white;
}
.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 96vw;
  max-height: 92vh;
  cursor: default;
}
.lightbox-inner img,
.lightbox-inner video {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.lightbox-inner img {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}
.lightbox-inner video {
  width: min(92vw, 1280px);
  background: #000;
  cursor: default;
}
.lightbox-inner img.zoomed {
  transform: scale(1.75);
  cursor: zoom-out;
}

.previewable-video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.previewable-video-wrap video.previewable-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}
.media-panel .previewable-video-wrap {
  min-height: 160px;
  max-height: 280px;
}
.media-panel .previewable-video-wrap video {
  max-height: 280px;
}
.lightbox-caption {
  color: #e2e8f0;
  font-size: 14px;
  text-align: center;
  max-width: 640px;
}
.lightbox-hint {
  color: #64748b;
  font-size: 12px;
}

.previewable-img {
  cursor: zoom-in;
}
.previewable-img:hover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.shot-card .thumb .previewable-img,
.asset-thumb .previewable-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.edit-detail .previewable-img,
.asset-card .previewable-img {
  max-width: 100%;
  border-radius: 8px;
}

.create-dialog {
  width: min(920px, 94vw); max-height: 90vh; overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column;
}

.create-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.create-header h2 { font-size: 18px; font-weight: 600; }
.modal-close {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}

.create-body { min-height: 420px; }

.create-form {
  padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
}
.create-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.create-prompt-type-block { margin-top: 2px; }
.create-type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
}
.create-type-tag {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--inset-bg);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.create-type-tag:hover {
  border-color: rgba(79, 140, 255, 0.45);
  color: var(--text);
}
.create-type-tag.active {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.14);
  color: #93c5fd;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.2);
}
.create-type-tags-loading,
.create-type-tags-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.create-inherit-block { margin-top: 4px; }
.create-inherit-master {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.create-inherit-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--inset-bg);
}
.create-inherit-detail.hidden { display: none; }

.form-block { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 13px; color: var(--text); }
.radio-row, .checkbox-row {
  display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-muted);
}
.radio-row label, .checkbox-row label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.form-select, .form-file {
  background: var(--inset-bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 8px; font-size: 13px;
}

.create-script {
  flex: 1; min-height: 180px; resize: vertical;
  background: var(--inset-bg); border: 1px solid var(--border); color: var(--text);
  padding: 12px; border-radius: 8px; line-height: 1.6; font-size: 14px;
}

.btn-create {
  align-self: flex-start; min-width: 140px; border: 1px solid var(--accent);
  background: var(--accent); color: #ffffff; padding: 12px 32px;
  border-radius: var(--radius); cursor: pointer; font-size: 15px; font-weight: 600;
}
.btn-create:hover { background: #333333; border-color: #333333; }
.btn-create:disabled { opacity: 0.6; cursor: not-allowed; }
.create-progress { margin-top: 4px; }
.create-error {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.06);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.create-form.is-busy .create-script,
.create-form.is-busy .form-select,
.create-form.is-busy .form-file,
.create-form.is-busy .create-type-tag {
  pointer-events: none;
  opacity: 0.72;
}

/* 软件设置 */
.settings-page { display: flex; flex-direction: column; gap: 0; height: 100%; }
.settings-tabs {
  display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); padding: 0 8px;
}
.settings-tab {
  border: none; background: transparent; color: var(--text-muted);
  padding: 12px 16px; cursor: pointer; font-size: 13px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-content { flex: 1; overflow-y: auto; padding: 16px 0; }
.setting-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.section-head h3 { font-size: 15px; font-weight: 600; }
.section-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.section-link { font-size: 12px; }
.section-link a { color: #6ea8fe; text-decoration: none; }
.form-row {
  display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start;
}
.row-label { font-size: 13px; color: var(--text-muted); padding-top: 8px; }
.setting-input {
  background: var(--inset-bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; width: 100%; max-width: 360px;
}
.setting-input.wide { max-width: 480px; }
.radio-row.inline, .radio-row.wrap { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-muted); }
.radio-row label, .platform-grid label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.platform-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px;
  font-size: 13px; color: var(--text-muted);
}
.engine-fields { padding-left: 132px; display: flex; flex-direction: column; gap: 12px; }
.comfyui-url-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.comfyui-url-row .setting-input { flex: 1; min-width: 200px; max-width: 360px; }
.comfyui-status { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.comfyui-status.ok { color: #22c55e; }
.comfyui-status.err { color: #f87171; white-space: pre-wrap; }
.btn-test {
  border: none; background: var(--accent);
  color: white; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.status-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(148, 163, 184, 0.15); color: var(--text-muted);
}
.status-badge.ok { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: 0.2s;
}
.switch span::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
.settings-actions { padding: 8px 0 24px; }

.prompt-settings-body { gap: 10px; }
.prompt-source-tabs {
  display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.prompt-source-tab {
  border: none; background: transparent; color: var(--text-muted);
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.prompt-source-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.prompt-field-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.prompt-global-input {
  width: 100%; min-height: 88px; resize: vertical;
  background: var(--inset-bg); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 8px; line-height: 1.5; font-size: 13px;
}

/* 右侧素材栏 */
.asset-rail {
  width: var(--asset-rail-w);
  border-left: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 6px;
  gap: 6px;
}
.asset-rail-btn {
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 12px 6px;
  border-radius: 8px;
  cursor: pointer;
  writing-mode: vertical-rl;
  letter-spacing: 0.14em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.asset-rail-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.asset-rail-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
  box-shadow: 0 0 10px var(--border);
}

.asset-dialog, .extract-dialog {
  background: #1e2129;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(720px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.asset-dialog-wide { width: min(1080px, 96vw); }
.extract-dialog { width: min(640px, 92vw); }

.asset-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.asset-dialog-header h2 { font-size: 16px; }

.asset-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--inset-bg);
}
.asset-toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.asset-toolbar-batch {
  width: 100%;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
}
.asset-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}
.asset-select-all-label input { cursor: pointer; }
.asset-select-count {
  font-size: 12px;
  color: #64748b;
  min-width: 72px;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.35);
}
.btn.danger:hover {
  background: rgba(180, 35, 24, 0.08);
  border-color: var(--danger);
}
.btn.accent-teal {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}
.btn.accent-teal:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.asset-reextract-progress {
  margin: 0 16px 10px;
  flex-shrink: 0;
}
.asset-batch-progress-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#btnAssetBatchCancel {
  padding: 2px 10px;
  font-size: 12px;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}
#btnAssetBatchCancel:hover {
  background: rgba(248, 113, 113, 0.12);
}
.asset-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
  min-height: 240px;
  max-height: calc(90vh - 180px);
  background: var(--bg-elevated);
}
.asset-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 48px 0; }

/* 百漫影视风格 — 角色/场景/物品卡片 */
.zizi-asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.zizi-asset-card.is-hidden { opacity: 0.55; }
.zizi-asset-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft), var(--shadow);
}

.zizi-card-select {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}
.zizi-card-select input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.zizi-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 8px;
  flex-wrap: wrap;
}
.zizi-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.zizi-card-index {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.zizi-card-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
  min-width: 120px;
  max-width: 100%;
  flex: 1;
}
.zizi-card-name.is-editable,
.zizi-card-desc.is-editable {
  cursor: text;
  outline: none;
  border-radius: 4px;
  transition: box-shadow 0.15s ease;
}
.zizi-card-name.is-editable:focus,
.zizi-card-desc.is-editable:focus {
  box-shadow: inset 0 0 0 1px var(--border);
}
.zizi-card-name.is-editable:empty::before,
.zizi-card-desc.is-editable:empty::before {
  content: attr(data-placeholder);
  color: #64748b;
  pointer-events: none;
}
.zizi-alias {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--inset-bg);
  border-radius: 4px;
}
.zizi-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.zizi-voice-select {
  background: var(--inset-bg);
  border: 1px solid #4a5060;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  min-width: 100px;
}
.zizi-btn-detail {
  border: 1px solid #4a5060;
  background: #353944;
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.zizi-btn-detail:hover { background: #404654; }

.zizi-card-body {
  display: grid;
  grid-template-columns: 1fr 200px 72px;
  gap: 12px;
  padding: 0 14px 14px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .zizi-card-body { grid-template-columns: 1fr; }
  .zizi-card-side { flex-direction: row !important; }
}

.zizi-card-info { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.zizi-card-desc {
  font-size: 13px;
  line-height: 1.65;
  color: #cbd5e1;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.zizi-card-keywords {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.zizi-card-keywords strong { color: #64748b; font-weight: 500; }

.zizi-media-tabs {
  display: flex;
  gap: 0;
  margin-top: 4px;
}
.zizi-media-tab {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  position: relative;
}
.zizi-media-tab.active {
  color: #e2e8f0;
}
.zizi-media-tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.zizi-card-preview {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #14171d;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.zizi-card-preview img.previewable-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0d12;
}
.zizi-preview-ph {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  padding: 12px;
}
.zizi-preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 160px;
  color: var(--accent);
  font-size: 13px;
}
.asset-image-progress {
  width: 100%;
  padding: 0 14px;
  box-sizing: border-box;
}
.asset-image-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.asset-image-progress-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-size: 12px;
}
.asset-image-progress-percent {
  font-variant-numeric: tabular-nums;
  color: #6ea8fe;
  flex-shrink: 0;
  font-size: 11px;
}
.asset-image-progress .extract-progress-track {
  height: 6px;
}
.asset-image-progress.is-active .asset-image-progress-bar {
  position: relative;
}
.asset-image-progress.is-active .asset-image-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: extract-progress-shine 1.4s ease-in-out infinite;
}
.media-panel-body .asset-image-progress {
  max-width: 280px;
  margin: 0 auto;
}
.zizi-preview-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: zizi-spin 0.8s linear infinite;
}
@keyframes zizi-spin {
  to { transform: rotate(360deg); }
}
.zizi-card-preview.is-generating {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(94, 184, 255, 0.15);
}
.zizi-card-preview.has-image {
  cursor: context-menu;
}

.asset-preview-menu {
  position: fixed;
  z-index: var(--z-preview-menu);
  min-width: 140px;
  background: #252a35;
  border: 1px solid #4a5060;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.asset-preview-menu.hidden { display: none; }
.asset-preview-menu button {
  border: none;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.asset-preview-menu button:hover { background: #353944; }
.asset-preview-menu button[data-menu="clear"] { color: #f87171; }
.asset-preview-menu button[data-menu="clear"]:hover { background: rgba(248, 113, 113, 0.12); }
.zizi-card-preview audio,
.zizi-card-preview video {
  width: 100%;
  max-height: 100%;
}

.zizi-card-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  justify-content: flex-start;
}
.zizi-side-btn {
  border: none;
  background: transparent;
  font-size: 13px;
  padding: 8px 4px;
  cursor: pointer;
  text-align: center;
  border-radius: 4px;
  white-space: nowrap;
}
.zizi-side-btn.gen { color: #4ade80; }
.zizi-side-btn.gen:hover { background: rgba(74, 222, 128, 0.1); }
.zizi-side-btn.gen:disabled { opacity: 0.5; }
.zizi-side-btn.reextract { color: #6ea8fe; }
.zizi-side-btn.reextract:hover { background: rgba(110, 168, 254, 0.1); }
.zizi-side-btn.reextract:disabled { opacity: 0.5; }
.zizi-side-btn.del { color: #f87171; }
.zizi-side-btn.del:hover { background: rgba(248, 113, 113, 0.1); }
.zizi-side-show {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 4px;
}
.zizi-side-show input { accent-color: var(--accent); cursor: pointer; }

/* 角色 / 场景 / 物品详情弹窗 */
.asset-detail-dialog {
  background: #1e2129;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.asset-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.asset-detail-header h2 { font-size: 17px; font-weight: 600; }
.asset-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.asset-detail-body--image-only {
  grid-template-columns: 1fr;
}
.asset-detail-dialog:has(.asset-detail-body--image-only) {
  width: min(760px, 96vw);
}
.asset-detail-body--image-only .asset-detail-left {
  border-right: none;
}
.asset-detail-body--image-only .asset-detail-right {
  display: none;
}
@media (max-width: 860px) {
  .asset-detail-body { grid-template-columns: 1fr; overflow-y: auto; }
}
.asset-detail-left {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.asset-detail-right {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #181b22;
}
.asset-detail-body--image-only .asset-detail-right {
  justify-content: center;
  align-items: stretch;
}
.detail-field-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.detail-field--compact .detail-input { text-align: center; }
.detail-desc-grid,
.detail-negative-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .detail-desc-grid,
  .detail-negative-grid,
  .detail-field-row {
    grid-template-columns: 1fr;
  }
}
.detail-voice-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 720px) {
  .detail-voice-block { grid-template-columns: 1fr; }
}
.detail-image-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: 0;
}
.detail-image-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.detail-image-hero-title {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}
.detail-image-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-image-hero-body {
  flex: 1;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px dashed #4a5060;
  border-radius: 12px;
  padding: 16px;
}
.detail-image-hero-body .media-thumb-wrap {
  width: min(100%, 320px);
  height: auto;
  aspect-ratio: 1;
  max-height: 360px;
}
.detail-image-hero-body .media-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0d12;
}
.detail-image-hero-body .asset-gen-preview {
  width: 100%;
  max-width: 320px;
}
.item-detail-only.hidden {
  display: none !important;
}
.detail-field { display: flex; flex-direction: column; gap: 6px; }
.detail-label { font-size: 13px; color: var(--text-muted); }
.detail-input, .detail-textarea {
  background: var(--bg-card);
  border: 1px solid #4a5060;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
}
.detail-input-readonly {
  color: var(--text-muted);
  background: #23262e;
  cursor: default;
}
.detail-textarea { resize: vertical; line-height: 1.6; min-height: 100px; }
.detail-textarea-sm { min-height: 56px; }
.detail-voice-row { display: flex; gap: 8px; align-items: center; }
.detail-voice-row .detail-input { flex: 1; }
.media-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.media-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.media-panel-title { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.media-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.media-panel-btn {
  border: 1px solid #4a5060;
  background: #353944;
  color: #e2e8f0;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.media-panel-btn:hover { background: #404654; }
.media-panel-btn.accent {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}
.media-panel-body {
  min-height: 100px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.media-panel-empty { font-size: 13px; color: #64748b; }
.media-thumb-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #4a5060;
  flex-shrink: 0;
}
.media-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.media-count-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.media-panel-body audio,
.media-panel-body video {
  max-width: 100%;
  max-height: 120px;
}
.asset-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--inset-bg);
  flex-wrap: wrap;
  gap: 12px;
}
.asset-detail-footer:has(#detailRefTabs.hidden) {
  justify-content: flex-end;
}
.detail-ref-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-ref-label { font-size: 13px; color: var(--text-muted); margin-right: 4px; }
.detail-ref-tab {
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.detail-ref-tab.active {
  background: #3b82f6;
  color: white;
}
.detail-close-btn {
  background: #4a5060;
  color: white;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.detail-close-btn:hover { background: #5a6270; }

.extract-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 70vh;
}
.extract-body,
.extract-input,
.extract-result {
  scrollbar-width: thin;
  scrollbar-color: #3a4458 transparent;
}
.extract-body::-webkit-scrollbar,
.extract-input::-webkit-scrollbar,
.extract-result::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.extract-body::-webkit-scrollbar-track,
.extract-input::-webkit-scrollbar-track,
.extract-result::-webkit-scrollbar-track {
  background: transparent;
}
.extract-body::-webkit-scrollbar-thumb,
.extract-input::-webkit-scrollbar-thumb,
.extract-result::-webkit-scrollbar-thumb {
  background: #3a4458;
  border-radius: 999px;
}
.extract-body::-webkit-scrollbar-thumb:hover,
.extract-input::-webkit-scrollbar-thumb:hover,
.extract-result::-webkit-scrollbar-thumb:hover {
  background: #4b5568;
}
.extract-input {
  min-height: 88px;
  resize: vertical;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.extract-result {
  min-height: 120px;
  resize: vertical;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.extract-progress {
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.extract-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.extract-progress-head #extractProgressLabel,
.extract-progress-head #assetReextractProgressLabel,
.extract-progress-head #s2ProgressLabel,
.extract-progress-head #novelWfProgressLabel,
.extract-progress-head #editBatchProgressLabel,
.extract-progress-head #shotDetailOpProgressLabel {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.extract-progress-head #extractProgressPercent,
.extract-progress-head #assetReextractProgressPercent,
.extract-progress-head #s2ProgressMeta,
.extract-progress-head #novelWfProgressPercent,
.extract-progress-head #editBatchProgressPercent,
.extract-progress-head #shotDetailOpProgressPercent {
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
  font-weight: 600;
  flex-shrink: 0;
}
.extract-progress-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.extract-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1f2937, #0b0d10);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.extract-progress.is-active .extract-progress-bar {
  position: relative;
}
.extract-progress.is-active .extract-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 100%
  );
  animation: extract-progress-shine 1.4s ease-in-out infinite;
}
@keyframes extract-progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.shot-meta-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
}
.shot-meta-sep {
  color: rgba(110, 168, 254, 0.45);
  font-size: 11px;
  line-height: 1;
  user-select: none;
}
.shot-scene-tag {
  display: inline-block;
  font-size: 10px;
  color: #6ea8fe;
  background: rgba(110, 168, 254, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 角色风格设置 */
.char-style-dialog {
  width: min(560px, 94vw);
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.char-style-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.char-style-header h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.char-style-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 420px;
}
.char-style-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.char-style-field { display: flex; flex-direction: column; gap: 8px; }
.char-style-label { font-size: 13px; color: var(--text); }
.char-style-textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
}
.char-style-textarea:focus {
  outline: none;
  border-color: var(--accent-2);
}
.char-style-ref-section { margin-top: 4px; }
.char-style-ref-title {
  display: block;
  font-size: 13px;
  color: #6ea8fe;
  margin-bottom: 10px;
}
.char-style-ref-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.char-style-ref-slot {
  aspect-ratio: 3 / 4;
  border: 1px dashed #4a5568;
  border-radius: 8px;
  background: #14171d;
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-style-ref-slot:hover { border-color: var(--accent-2); background: #1a2030; }
.char-style-ref-slot .ref-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.char-style-ref-slot .ref-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.char-style-ref-slot.has-image .ref-placeholder { display: none; }
.char-style-ref-slot.has-image .ref-preview { display: block !important; }
.char-style-ref-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.45;
}

/* 提示词模版 */
.ptpl-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 12px 16px;
}
.ptpl-top-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.ptpl-top-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ptpl-top-tab:hover { color: var(--text); }
.ptpl-top-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.ptpl-mode-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.ptpl-mode-panel.hidden { display: none; }
.ptpl-scope-hint {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(79, 140, 255, 0.08);
  border: 1px solid rgba(79, 140, 255, 0.18);
  border-radius: 8px;
}
.prompt-settings-subsection {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.prompt-settings-subsection:first-of-type {
  margin-top: 12px;
  padding-top: 0;
  border-top: none;
}
.prompt-settings-subtitle {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.prompt-settings-subsection .section-hint {
  margin: 0 0 12px;
}
#ptplModeTemplates {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.ptpl-prompt-settings {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}
.ptpl-prompt-settings .setting-section {
  margin-bottom: 20px;
}
.ptpl-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.ptpl-cat-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.ptpl-cat-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.prompt-settings-hint {
  margin: 0 0 10px;
  padding: 0 4px;
  font-size: 12px;
}
.ptpl-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.ptpl-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ptpl-sidebar-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.ptpl-sidebar-head h3 { font-size: 14px; margin-bottom: 8px; }
.ptpl-sidebar-actions { display: flex; gap: 8px; }
.btn.sm.danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}
.ptpl-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.ptpl-list-item {
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ptpl-list-item:hover { background: var(--bg-hover); }
.ptpl-list-item.active { background: var(--accent-soft); color: var(--text); }
.ptpl-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.ptpl-badge.official { background: rgba(79, 140, 255, 0.2); color: #93c5fd; }
.ptpl-badge.user { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.ptpl-badge.type { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }
.ptpl-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.ptpl-form-row label,
.ptpl-form-grid label,
.ptpl-content-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ptpl-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ptpl-vars { margin-top: 4px; }
.ptpl-vars-label { font-size: 12px; color: var(--text-muted); }
.ptpl-var-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ptpl-var-tag {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #2a3345;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
}
.ptpl-var-tag:hover { border-color: var(--accent-2); color: #e2e8f0; }
.ptpl-content {
  flex: 1;
  min-height: 200px;
  resize: vertical;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
}
.edit-prompt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.edit-prompt-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.mp-output-section {
  margin: 4px 0 18px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}
.mp-output-section .mp-models-head {
  margin-bottom: 10px;
}
.mp-output-section .mp-models-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.mp-output-hint {
  margin: 8px 0 0;
  font-size: 12px;
}

/* 模型供应商配置 */
.mp-panel-host {
  max-width: 920px;
}
.mp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mp-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mp-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.mp-title-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.mp-provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.mp-provider-card-wrap {
  position: relative;
  display: inline-flex;
}
.mp-provider-card-wrap.active .mp-provider-card {
  border-color: var(--accent);
  background: var(--bg-elevated, var(--bg-card));
}
.mp-provider-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 120px;
  padding: 10px 28px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, var(--bg-card));
  cursor: pointer;
  text-align: left;
}
.mp-provider-card.active {
  border-color: var(--accent);
  background: var(--bg-elevated, var(--bg-card));
}
.mp-provider-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.mp-provider-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}
.mp-provider-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mp-provider-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.mp-provider-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.mp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 18px;
}
.mp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-field-full {
  grid-column: 1 / -1;
}
.mp-label {
  font-size: 12px;
  color: var(--text-muted);
}
.mp-protocol-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mp-protocol-tab {
  border: 1px solid var(--border);
  background: var(--bg-elevated, var(--bg-card));
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.mp-protocol-tab.active {
  border-color: var(--accent);
  background: var(--bg-elevated, var(--bg-card));
  color: var(--text);
}
.mp-models-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.mp-novel-models {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.mp-novel-models > .hint {
  margin: 0 0 12px;
}
.mp-novel-step {
  margin-bottom: 14px;
}
.mp-novel-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}
.mp-novel-task-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(200px, 1.3fr);
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
}
.mp-novel-task-row span {
  font-size: 13px;
  color: var(--text-muted);
}
.novel-wf-step-models {
  margin: 4px 0 0;
  word-break: break-all;
}
.mp-models-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.mp-models-head h4 {
  margin: 0;
  font-size: 14px;
}
.mp-models-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.mp-manual-row,
.mp-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.mp-manual-row .setting-input,
.mp-search-row .setting-input {
  flex: 1;
}
.mp-model-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.mp-model-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, var(--bg-card));
}
.mp-model-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 12px;
  white-space: nowrap;
}
.mp-model-item:hover {
  border-color: var(--accent);
}
.mp-model-item.selected {
  border-color: var(--accent);
  color: var(--text);
}
.mp-model-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.mp-model-item input { accent-color: var(--accent); }
.mp-model-remove {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.mp-model-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}
.mp-model-list .mp-empty {
  width: 100%;
  padding: 16px 4px;
  margin: 0;
}
.mp-actions { margin-top: 18px; }

.ptpl-editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.image-model-entry {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.image-model-tab-page {
  padding: 8px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}
.image-model-tab-page h3 { font-size: 16px; }
.image-model-tab-summary { font-size: 14px; color: var(--text); }
.btn.lg { padding: 10px 24px; font-size: 14px; }

/* 图片模型管理（设置页内嵌） */
.image-model-inline {
  display: flex;
  flex-direction: column;
  max-width: 720px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.image-model-inline-head {
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.image-model-inline-head h3 { font-size: 16px; margin: 0; }
.image-model-inline .img-model-body {
  max-height: none;
  flex: none;
}
.img-model-tabs {
  display: flex;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: #12151c;
}
.img-model-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 12px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.img-model-tab:hover { color: var(--text); }
.img-model-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent-2);
}
.img-model-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
}
.img-model-panel .form-row { margin-bottom: 12px; }
.img-model-panel .setting-input.narrow { max-width: 160px; }
.img-model-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.img-model-footer .btn.primary { margin-left: auto; }
.plugin-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.25);
  border-radius: 8px;
  font-size: 12px;
  color: #93c5fd;
}
.plugin-title-row {
  margin-bottom: 14px;
}
.plugin-title-row h3 { font-size: 14px; margin-bottom: 6px; }
.plugin-register {
  font-size: 12px;
  color: var(--accent-2);
  text-decoration: none;
}
.plugin-register:hover { text-decoration: underline; }
.plugin-tip { margin-top: 8px; }
.secret-input-row {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.secret-input-row .setting-input { flex: 1; }
.btn-icon {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  width: 36px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-icon:hover { color: var(--text); border-color: var(--accent-2); }
.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .agent-panel { display: none; }
  .asset-rail { display: none; }
  .sidebar { width: 200px; }
}

/* 创作小说工作流 */
.novel-wf-page {
  padding: 8px 0 48px;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  box-sizing: border-box;
  overflow: auto;
}

/* 作品四阶段进度（小说为阶段一） */
.project-stage-rail {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  max-width: var(--content-max);
  margin: 8px auto 24px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}
.project-stage-rail-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-right: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  border-bottom: none;
  margin-bottom: 0;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}
.project-stage-rail-item:last-child { border-right: none; }
.project-stage-rail-item:hover:not(:disabled):not(.is-locked) {
  background: var(--inset-bg);
  color: var(--text);
}
.project-stage-rail-item.is-locked,
.project-stage-rail-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  color: var(--text-muted);
  background: transparent;
  filter: grayscale(0.35);
}
.project-stage-rail-item.is-locked:hover,
.project-stage-rail-item:disabled:hover {
  background: transparent;
  color: var(--text-muted);
}
.project-stage-rail-item.is-locked.is-current,
.project-stage-rail-item:disabled.is-current {
  opacity: 0.5;
}
.project-stage-rail-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 650;
  font-family: var(--font-sans);
  border: none;
  background: var(--inset-bg);
  color: var(--text-muted);
}
.project-stage-rail-text {
  font-size: 13px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-stage-rail-item.is-done .project-stage-rail-num {
  border-color: transparent;
  background: rgba(13, 148, 136, 0.12);
  color: var(--success);
}
.project-stage-rail-item.is-current {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(59, 111, 245, 0.16);
}
.project-stage-rail-item.is-current .project-stage-rail-num {
  border-color: transparent;
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  color: #fff;
}
.project-stage-rail-item.is-current .project-stage-rail-text {
  color: var(--accent-2);
  font-weight: 650;
}
.project-workspace {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  overflow: auto;
  box-sizing: border-box;
  padding: 0 0 48px;
}
.project-stage-panel {
  min-height: 0;
  width: 100%;
}
.project-stage-panel:not(.hidden) {
  display: block;
}
#projectStageNovel .novel-wf-page {
  height: auto;
  max-height: none;
  width: 100%;
  max-width: none;
  padding: 0 0 32px;
}
.novel-wf-intro h3 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  color: var(--text);
}
.novel-wf-intro .hint { margin: 0 0 24px; line-height: 1.6; font-size: 16px; }

/* 顶部五步进度 */
.novel-wf-rail {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 28px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.novel-wf-rail-item {
  flex: 1 1 0;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
}
.novel-wf-rail-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--inset-bg);
  color: var(--text-muted);
}
.novel-wf-rail-text {
  font-size: 12px;
  white-space: nowrap;
}
.novel-wf-rail-line {
  flex: 0 0 18px;
  height: 1px;
  background: var(--border);
  margin-bottom: 18px;
}
.novel-wf-rail-item.is-done .novel-wf-rail-num {
  border-color: rgba(46, 180, 120, 0.55);
  background: rgba(46, 180, 120, 0.14);
  color: #2eb478;
}
.novel-wf-rail-item.is-done .novel-wf-rail-text { color: var(--text); }
.novel-wf-rail-item.is-current .novel-wf-rail-num {
  border-color: var(--accent, #ef4444);
  background: var(--accent-soft, rgba(239, 68, 68, 0.12));
  color: var(--accent, #ef4444);
}
.novel-wf-rail-item.is-current .novel-wf-rail-text {
  color: var(--text);
  font-weight: 600;
}
.novel-wf-rail-item.is-locked {
  opacity: 0.45;
  cursor: default;
}

/* 每步成组 */
.novel-wf-stage {
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.novel-wf-stage.is-current {
  border-color: rgba(29, 29, 31, 0.16);
  box-shadow: var(--shadow-md);
}
.novel-wf-stage.is-done {
  opacity: 0.88;
}
.novel-wf-stage.is-locked {
  opacity: 0.55;
}
.novel-wf-stage-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 16px;
  padding-bottom: 0;
  border-bottom: none;
}
.novel-wf-stage-label span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: none;
}
.novel-wf-stage-label strong {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-family: var(--font-sans);
}
.novel-wf-stage-label em {
  font-style: normal;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
}
.novel-wf-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.novel-wf-gate-hint {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
  color: var(--text-muted);
}
.novel-wf-finish-actions {
  margin-top: 12px;
}
.novel-wf-polish-module {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.novel-wf-polish-module + .novel-wf-polish-module {
  margin-top: 12px;
}
.novel-wf-polish-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 6px;
}
.novel-wf-polish-head strong {
  font-size: 14px;
  color: var(--text);
}
.novel-wf-highlight-diff {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.novel-wf-highlight-diff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
}
.novel-wf-highlight-diff-head strong {
  font-size: 13px;
  color: var(--text);
}
.novel-wf-highlight-diff-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.novel-wf-highlight-diff-tab {
  border: 1px solid var(--border);
  background: var(--bg-card, var(--bg));
  color: var(--text-muted);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.novel-wf-highlight-diff-tab.is-active {
  border-color: var(--accent, #ef4444);
  color: var(--accent, #ef4444);
  background: var(--accent-soft, rgba(239, 68, 68, 0.08));
}
.novel-wf-highlight-diff-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.novel-wf-highlight-diff-pane {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card, #fff);
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.novel-wf-highlight-diff-pane-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--bg-card, #fff) 92%, var(--border));
  border-bottom: 1px solid var(--border);
}
.novel-wf-highlight-diff-pane-label--orig {
  color: #9a3412;
}
.novel-wf-highlight-diff-pane-label--new {
  color: #166534;
}
.novel-wf-highlight-diff-text {
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.novel-wf-diff-del {
  background: rgba(239, 68, 68, 0.28);
  color: #7f1d1d;
  border-radius: 3px;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.novel-wf-diff-ins {
  background: rgba(34, 197, 94, 0.38);
  color: #14532d;
  border-radius: 3px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.novel-wf-highlight-diff-empty {
  margin: 0;
  padding: 18px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
@media (max-width: 900px) {
  .novel-wf-highlight-diff-pair {
    grid-template-columns: 1fr;
  }
}
.novel-wf-advanced {
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-muted);
}
.novel-wf-advanced > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
  list-style: none;
}
.novel-wf-advanced > summary::-webkit-details-marker { display: none; }
.novel-wf-advanced[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.novel-wf-advanced-body {
  border: 0;
  margin: 0;
  border-radius: 0 0 12px 12px;
}
.novel-wf-workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.novel-wf-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
}
.novel-wf-stage .novel-wf-form {
  background: var(--inset-bg);
}
.novel-wf-select-panel {
  margin: 12px 0 0;
}
.novel-wf-select-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  font-family: var(--font-sans);
}
.novel-wf-picker-hint {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.novel-wf-combos {
  margin-bottom: 14px;
}
.novel-wf-combos-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.novel-wf-combo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.novel-wf-combo {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.novel-wf-combo:hover {
  border-color: var(--accent);
}
.novel-wf-combo strong {
  font-size: 13px;
  color: var(--text);
}
.novel-wf-combo span,
.novel-wf-combo em {
  font-size: 12px;
  color: var(--text-muted);
  font-style: normal;
}
.novel-wf-pickers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.novel-wf-picker-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.novel-wf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.novel-wf-chip {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  max-width: 100%;
  text-align: left;
  line-height: 1.35;
}
.novel-wf-chip:hover {
  border-color: var(--accent);
}
.novel-wf-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(239, 68, 68, 0.12));
  color: var(--text);
}
.novel-wf-chip-empty {
  font-size: 12px;
  color: var(--text-muted);
}
.novel-wf-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 12px;
}
.novel-wf-form-grid--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.novel-wf-form-grid label,
.novel-wf-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.novel-wf-block { margin-bottom: 10px; }
/* 覆盖全局 .setting-input 的 max-width:360px，避免细纲/长文被裁成半宽 */
.novel-wf-form .setting-input,
.novel-wf-block .setting-input,
.novel-wf-outline-editor {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}
.novel-wf-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.novel-wf-title-pick {
  margin-top: 10px;
}
.novel-wf-title-chips {
  max-height: 280px;
  overflow: auto;
  padding: 2px 0;
}
.novel-wf-title-chip {
  border-radius: 8px;
  max-width: 100%;
  white-space: normal;
}
.novel-wf-live-slot:not(:empty) {
  margin-top: 4px;
}
.novel-wf-live {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.novel-wf-live-progress {
  margin-bottom: 0;
}
.novel-wf-live-head,
.novel-wf-live-output {
  display: none !important;
}
.novel-wf-task.is-locked {
  opacity: 0.55;
}
.novel-wf-arch-concepts {
  margin-bottom: 12px;
}
.novel-wf-arch-concept.active {
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.08);
}
.novel-wf-chapter-setup {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 4px;
}
.novel-wf-chapter-count-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  max-width: 220px;
}
.novel-wf-chapter-count-label input {
  max-width: 140px;
}
.novel-wf-chip.is-active {
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.1);
}
.novel-wf-outline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.novel-wf-outline-head .novel-wf-select-title {
  margin-bottom: 4px;
}
.novel-wf-outline-head .novel-wf-picker-hint {
  margin-bottom: 0;
}
.novel-wf-outline-head .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.novel-wf-outline-view {
  margin: 10px 0 4px;
}
.novel-wf-outline-scroll {
  max-height: min(62vh, 720px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.novel-wf-outline-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 16px;
}
.novel-wf-outline-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f7f9;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.novel-wf-outline-table thead th.col-words,
.novel-wf-outline-table td.col-words {
  padding-right: 20px;
  width: 108px;
}
.novel-wf-outline-table tbody tr {
  transition: background var(--transition);
}
.novel-wf-outline-table tbody tr:nth-child(even) {
  background: #fafbfc;
}
.novel-wf-outline-table tbody tr:hover {
  background: var(--accent-soft);
}
.novel-wf-outline-table tbody tr.is-twist {
  background: rgba(185, 28, 28, 0.04);
}
.novel-wf-outline-table tbody tr.is-twist:hover {
  background: rgba(185, 28, 28, 0.08);
}
.novel-wf-outline-table td {
  vertical-align: top;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}
.novel-wf-outline-table tr:last-child td {
  border-bottom: none;
}
.novel-wf-outline-table .col-no {
  width: 52px;
}
.novel-wf-outline-table .col-hook {
  width: 18%;
  min-width: 96px;
}
.novel-wf-outline-table .col-words {
  width: 108px;
}
.novel-wf-outline-table .col-plot {
  width: auto;
}
.novel-wf-outline-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--inset-bg);
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.novel-wf-outline-table tr.is-twist .novel-wf-outline-no {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}
.novel-wf-outline-cell {
  outline: none;
  min-height: 1.4em;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}
.novel-wf-outline-cell:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(11, 13, 16, 0.12);
}
.novel-wf-outline-hook {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--inset-bg);
  color: var(--accent-2);
  font-size: 12px;
  line-height: 1.35;
}
.novel-wf-outline-hook[contenteditable]:focus {
  display: block;
  border-radius: 6px;
  background: #fff;
}
.novel-wf-outline-words {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.novel-wf-outline-empty {
  margin: 12px 0 0;
  padding: 0 4px;
}
.novel-wf-outline-editor {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 420px;
  height: min(62vh, 720px);
  margin: 8px 0 4px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  resize: both;
  tab-size: 2;
  border-radius: 12px;
}
.novel-wf-outline-editor.hidden,
.novel-wf-outline-view.hidden,
.novel-wf-outline-empty.hidden {
  display: none !important;
}
.novel-wf-body-actions {
  flex-wrap: wrap;
  gap: 8px;
}
.novel-wf-body-stats {
  margin: 8px 0 4px;
}
.novel-wf-chip.is-written {
  box-shadow: inset 0 -2px 0 rgba(46, 180, 120, 0.55);
}
.novel-wf-chip.is-incomplete {
  box-shadow: inset 0 -2px 0 rgba(230, 80, 80, 0.75);
  border-color: rgba(230, 80, 80, 0.45);
}
.novel-wf-chip.is-key {
  border-color: rgba(220, 120, 80, 0.55);
  background: rgba(220, 120, 80, 0.1);
}
.novel-wf-arch-char-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.novel-wf-arch-char {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.novel-wf-arch-char strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text);
}
.novel-wf-arch-char p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.novel-wf-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
}
.novel-wf-step.is-locked {
  opacity: 0.65;
}
.novel-wf-step-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.novel-wf-step-head h4 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.novel-wf-step-head p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.novel-wf-step1-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}
.novel-wf-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft, rgba(239, 68, 68, 0.12));
  color: var(--accent, #ef4444);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.novel-wf-task-list { display: flex; flex-direction: column; gap: 8px; }
.novel-wf-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, var(--bg-card));
}
.novel-wf-task.is-done { border-color: var(--accent); }
.novel-wf-task-meta { display: flex; flex-direction: column; gap: 2px; }
.novel-wf-task-meta strong { font-size: 13px; color: var(--text); }
.novel-wf-model { font-size: 11px; color: var(--text-muted); }
.novel-wf-result-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated, var(--bg-card));
}
.novel-wf-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.novel-wf-result-head h4 { margin: 0; font-size: 14px; }
.novel-wf-output-select { max-width: 260px; }
.novel-wf-result {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
}
@media (max-width: 900px) {
  .novel-wf-form-grid { grid-template-columns: 1fr; }
}

/* —— 主题切换控件 —— */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.theme-switch-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.theme-switch-btn:hover { color: var(--text); }
.theme-switch-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 640px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-card:hover { border-color: var(--accent-2); }
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}
.theme-card-preview {
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  grid-template-columns: 28% 1fr;
}
.theme-card-preview .tp-side { background: #f5f5f5; }
.theme-card-preview .tp-main {
  background: #fafafa;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-card-preview .tp-bar {
  height: 8px;
  border-radius: 4px;
  background: #ffffff;
  width: 70%;
  border: 1px solid #ededed;
}
.theme-card-preview .tp-chip {
  height: 16px;
  width: 42%;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid #ededed;
}
.theme-card[data-theme-pick="air"] .tp-side { background: #f5f5f5; }
.theme-card[data-theme-pick="air"] .tp-main {
  background: #f3f5f9;
}
.theme-card[data-theme-pick="air"] .tp-bar {
  background: #ffffff;
  border: 1px solid #e2e6ef;
}
.theme-card[data-theme-pick="air"] .tp-chip {
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  border: 1px solid transparent;
}
.theme-card strong { font-size: 14px; color: var(--text); }
.theme-card span { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

html[data-theme="air"] .error-dialog,
html[data-theme="air"] .confirm-dialog {
  box-shadow: 0 24px 64px rgba(18, 21, 28, 0.16);
}
html[data-theme="air"] .error-dialog-header,
html[data-theme="air"] .confirm-dialog-header,
html[data-theme="air"] .error-dialog-footer,
html[data-theme="air"] .confirm-dialog-footer {
  border-color: var(--border);
}
html[data-theme="air"] .script-editor,
html[data-theme="air"] .setting-input,
html[data-theme="air"] textarea.setting-input {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="air"] .sidebar,
html[data-theme="air"] .asset-rail,
html[data-theme="air"] .agent-panel {
  background: var(--bg-elevated);
  border-color: var(--border);
}
html[data-theme="air"] .workspace {
  background: transparent;
}
html[data-theme="air"] .btn.primary {
  color: #fff;
}
html[data-theme="air"] .view-tab.active {
  color: var(--text);
  background: #fff;
}
html[data-theme="air"] .settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
html[data-theme="air"] .shot-card,
html[data-theme="air"] .chapter-card,
html[data-theme="air"] .novel-wf-stage,
html[data-theme="air"] .novel-wf-polish-module {
  box-shadow: var(--shadow);
}

/* —— 阶段三：小说转分镜引导 —— */
.s2-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
}
.s2-guide {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.s2-guide-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.s2-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  font-family: var(--font-display);
}
.s2-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.s2-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}
.s2-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  min-width: 0;
}
.s2-step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-hover);
}
.s2-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.s2-step-text strong {
  font-size: 13px;
  color: var(--text);
}
.s2-step-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}
.s2-step.current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.s2-step.current .s2-step-num {
  background: var(--accent);
  color: #fff;
}
.s2-step.done {
  border-color: rgba(34, 197, 94, 0.35);
}
.s2-step.done .s2-step-num {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}
.s2-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.s2-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.s2-progress-head #s2ProgressLabel {
  color: var(--text);
  font-weight: 560;
}
.slice-review-more {
  margin-top: 12px;
}
.slice-review-more > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .s2-steps { grid-template-columns: 1fr 1fr; }
  .s2-guide-top { flex-direction: column; }
}


/* ==== Linear / Apple visual pass ==== */
.modal-overlay {
  background: rgba(29, 29, 31, 0.28);
  backdrop-filter: blur(10px);
}
.error-dialog,
.confirm-dialog,
.asset-detail-dialog,
.char-style-dialog,
.extract-dialog,
.slice-review-dialog {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text);
  border-radius: 16px;
}
.script-editor,
.setting-input,
textarea.setting-input,
input[type="text"],
input[type="password"],
input[type="number"],
select {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  border-radius: 10px;
}
.workspace-header .project-name,
#projectName.project-name {
  background: transparent;
  border-color: transparent;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
.sidebar {
  background: rgba(255, 255, 255, 0.72) !important;
  border-right-color: rgba(26, 29, 38, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.agent-panel {
  background: var(--bg-card);
  border-color: var(--border);
}
.workspace,
.panel,
.layout {
  background: var(--bg);
}
.theme-switch { display: none !important; }
.theme-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
  gap: 12px;
}
.theme-card[data-theme-pick="dark"] { display: none; }
.theme-card-preview--tech {
  background: #070b14;
}
.theme-card-preview--tech .tp-side { background: #0c1220; }
.theme-card-preview--tech .tp-main {
  background:
    radial-gradient(ellipse 80% 70% at 50% 30%, rgba(37, 99, 235, 0.45), transparent 70%),
    #070b14;
}
.theme-card-preview--tech .tp-bar,
.theme-card-preview--tech .tp-chip {
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  border-color: transparent;
}

html[data-theme="tech"] .topbar {
  background: var(--topbar-bg) !important;
  border-bottom-color: rgba(148, 163, 184, 0.12);
}
html[data-theme="tech"] .brand strong { color: #e8eef8; }
html[data-theme="tech"] .brand small { color: #8a9bb5; }
html[data-theme="tech"] .view-tabs {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(148, 163, 184, 0.18);
}
html[data-theme="tech"] .view-tab.active {
  background: #162033 !important;
  color: #e8eef8 !important;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25), 0 0 20px rgba(37, 99, 235, 0.2);
}
html[data-theme="tech"] .sidebar {
  background: var(--bg-elevated) !important;
  border-right-color: rgba(148, 163, 184, 0.12);
}
html[data-theme="tech"] .btn.primary,
html[data-theme="tech"] #btnNewProject.btn.accent {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
html[data-theme="tech"] .btn.primary:hover,
html[data-theme="tech"] #btnNewProject.btn.accent:hover {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.45);
}
html[data-theme="tech"] .project-stage-rail-item.is-current .project-stage-rail-num {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
}
html[data-theme="tech"] .novel-wf-stage,
html[data-theme="tech"] .novel-wf-step,
html[data-theme="tech"] .novel-wf-select-panel,
html[data-theme="tech"] .s2-guide,
html[data-theme="tech"] .library-shot-card,
html[data-theme="tech"] .project-stage-rail,
html[data-theme="tech"] .zizi-asset-card {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
html[data-theme="tech"] .toast {
  background: #101826;
  border: 1px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 0 24px rgba(37, 99, 235, 0.25);
}
html[data-theme="tech"] .workspace,
html[data-theme="tech"] .panel,
html[data-theme="tech"] .layout,
html[data-theme="tech"] .app {
  background: var(--bg);
}
html[data-theme="tech"] .error-dialog,
html[data-theme="tech"] .confirm-dialog {
  background: var(--modal-bg);
  border-color: var(--modal-border);
  color: var(--text);
}
@media (max-width: 720px) {
  .theme-picker { grid-template-columns: 1fr; }
}


.s2-title,
.asset-library-title,
.novel-wf-intro h3,
.novel-wf-select-title,
.novel-wf-stage-label strong {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.s2-guide {
  border-radius: var(--radius);
  padding: 24px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.prompt-tab.active,
.asset-library-tab.active {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}
.zizi-card-name,
.zizi-card-role,
.zizi-meta-label {
  color: var(--text) !important;
}
.zizi-card-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
}

.zizi-asset-card,
.shot-card,
.chapter-card,
.shot-list-item,
.library-shot-card,
.novel-wf-stage,
.novel-wf-polish-module,
.novel-wf-step,
.novel-wf-select-panel,
.s2-guide,
.project-stage-rail,
.novel-wf-live,
.novel-wf-result-wrap,
.novel-wf-advanced {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.library-shot-card:hover,
.novel-wf-step:hover,
.shot-card:hover {
  box-shadow: var(--shadow-md);
}
.shot-card.selected,
.shot-list-item.selected,
.chapter-card.active,
.zizi-asset-card.is-selected {
  border-color: rgba(59, 111, 245, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 111, 245, 0.12), var(--shadow-md);
}
.extract-progress-bar,
.shot-media-cell-progress-bar {
  background: linear-gradient(90deg, #4a7af7, #2f5bea);
  border-radius: 99px;
}

.topbar {
  background: var(--topbar-bg) !important;
  border-bottom: 1px solid rgba(26, 29, 38, 0.06);
}
html[data-theme="air"] .btn.primary,
html[data-theme="dark"] .btn.primary {
  color: #fff;
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 111, 245, 0.28);
}
html[data-theme="air"] .btn.primary:hover,
html[data-theme="dark"] .btn.primary:hover {
  background: linear-gradient(145deg, #5b88f8, #3b6ff5);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(59, 111, 245, 0.34);
}
html[data-theme="air"] .view-tab.active,
html[data-theme="dark"] .view-tab.active {
  color: var(--text) !important;
  background: var(--bg-card) !important;
  border-bottom-color: transparent;
  box-shadow: var(--shadow);
}
html[data-theme="air"] .workspace,
html[data-theme="dark"] .workspace {
  background: var(--bg);
}
html[data-theme="air"] .sidebar,
html[data-theme="dark"] .sidebar {
  background: rgba(255, 255, 255, 0.78) !important;
  border-right-color: rgba(26, 29, 38, 0.06);
}

.panel {
  padding: 8px 0 32px;
}
#panelAssets.panel.visible {
  padding: 8px 0 32px;
}
.workspace-toolbar,
.storyboard-area > .toolbar,
.asset-library-toolbar {
  background: transparent;
}
.novel-wf-page,
.project-workspace,
.ptpl-page,
.workflow-page {
  background: transparent;
}
.ptpl-page,
.workflow-page {
  max-width: var(--content-max);
  margin-inline: auto;
  width: 100%;
  box-sizing: border-box;
  padding: 24px 0 48px;
}

#btnNewProject.btn.accent {
  background: linear-gradient(145deg, #4a7af7, #2f5bea);
  color: #fff;
  border-color: transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(59, 111, 245, 0.28);
}
#btnNewProject.btn.accent:hover {
  background: linear-gradient(145deg, #5b88f8, #3b6ff5);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(59, 111, 245, 0.34);
}
.project-list li {
  border-radius: 12px;
  margin-top: 4px;
}
.project-list li.active {
  background: var(--accent-soft);
  border-color: rgba(59, 111, 245, 0.22);
  box-shadow: none;
  color: var(--accent-2);
}
.side-link {
  border-radius: 10px;
}
.side-link.active {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.camera-content-editor {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.novel-wf-stage {
  padding: 22px 24px;
  margin-bottom: 16px;
}
.novel-wf-gate-hint {
  font-size: 16px;
  line-height: 1.6;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.toast {
  background: #1a1d26;
}

@media (max-width: 900px) {
  .workspace {
    padding-inline: 20px;
  }
  .panel,
  #panelAssets.panel.visible {
    padding: 8px 0 28px;
  }
  .workspace-header {
    padding-inline: 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  .workspace-header .project-name {
    max-width: none;
    flex: 1 1 auto;
  }
  .workspace-header .project-stage-rail {
    flex: 1 1 100%;
    order: 3;
  }
}

/* ==== 科技深空 · 对比度与控件细化 ==== */
html[data-theme="tech"] .btn {
  background: #121a2a;
  color: #e8eef8;
  border-color: rgba(148, 163, 184, 0.28);
}
html[data-theme="tech"] .btn:hover {
  background: #1a2438;
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
}
html[data-theme="tech"] .btn.ghost {
  background: transparent;
  border-color: transparent;
  color: #8a9bb5;
}
html[data-theme="tech"] .btn.ghost:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #e8eef8;
}
html[data-theme="tech"] .btn.primary,
html[data-theme="tech"] #btnNewProject.btn.accent {
  color: #fff !important;
  background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
  border-color: transparent !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
html[data-theme="tech"] .btn.primary:hover,
html[data-theme="tech"] #btnNewProject.btn.accent:hover {
  background: linear-gradient(135deg, #3b82f6, #6366f1) !important;
  color: #fff !important;
}
html[data-theme="tech"] .btn.accent {
  background: rgba(15, 23, 42, 0.8);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.18);
}
html[data-theme="tech"] .btn.accent:hover {
  background: rgba(30, 58, 138, 0.35);
  color: #fff;
}
html[data-theme="tech"] .btn.danger {
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}
html[data-theme="tech"] .btn.accent-teal {
  background: linear-gradient(135deg, #0d9488, #2563eb);
  border-color: transparent;
  color: #fff;
}

html[data-theme="tech"] .project-list li {
  color: #8a9bb5;
  border-color: transparent;
}
html[data-theme="tech"] .project-list li:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #e8eef8;
}
html[data-theme="tech"] .project-list li.active {
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2), 0 0 20px rgba(37, 99, 235, 0.15);
  color: #e8eef8 !important;
}
html[data-theme="tech"] .project-list li.active .project-item-name,
html[data-theme="tech"] .project-list li.active small {
  color: #e8eef8;
}
html[data-theme="tech"] .project-list li.active small {
  color: #93c5fd;
  opacity: 0.9;
}
html[data-theme="tech"] .side-link.active {
  background: rgba(37, 99, 235, 0.16);
  color: #e8eef8;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.3);
}

html[data-theme="tech"] .script-editor,
html[data-theme="tech"] .setting-input,
html[data-theme="tech"] textarea.setting-input,
html[data-theme="tech"] input[type="text"],
html[data-theme="tech"] input[type="password"],
html[data-theme="tech"] input[type="number"],
html[data-theme="tech"] select,
html[data-theme="tech"] .novel-wf-outline-editor,
html[data-theme="tech"] .novel-wf-live-output,
html[data-theme="tech"] .camera-content-editor {
  background: #0a1220 !important;
  color: #e8eef8 !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.06);
}
html[data-theme="tech"] .setting-input:focus,
html[data-theme="tech"] textarea.setting-input:focus,
html[data-theme="tech"] input:focus,
html[data-theme="tech"] select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
html[data-theme="tech"] .setting-input::placeholder,
html[data-theme="tech"] textarea::placeholder {
  color: #64748b;
}

html[data-theme="tech"] .novel-wf-chip,
html[data-theme="tech"] .novel-wf-combo {
  background: #121a2a;
  color: #e8eef8;
  border-color: rgba(148, 163, 184, 0.25);
}
html[data-theme="tech"] .novel-wf-chip:hover,
html[data-theme="tech"] .novel-wf-combo:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.12);
}
html[data-theme="tech"] .novel-wf-chip.active,
html[data-theme="tech"] .novel-wf-chip.is-active,
html[data-theme="tech"] .novel-wf-combo.active {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(96, 165, 250, 0.55);
  color: #fff;
}
html[data-theme="tech"] .novel-wf-chip.is-written {
  box-shadow: inset 0 -2px 0 rgba(45, 212, 191, 0.65);
}
html[data-theme="tech"] .novel-wf-chip.is-key {
  border-color: rgba(251, 146, 60, 0.55);
  background: rgba(251, 146, 60, 0.12);
}
html[data-theme="tech"] .novel-wf-form,
html[data-theme="tech"] .novel-wf-stage .novel-wf-form {
  background: rgba(10, 16, 28, 0.65);
}
html[data-theme="tech"] .novel-wf-outline-scroll,
html[data-theme="tech"] .novel-wf-outline-table thead th {
  background: #0c1422;
  color: #8a9bb5;
  border-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="tech"] .novel-wf-outline-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.45);
}
html[data-theme="tech"] .novel-wf-outline-table td {
  border-bottom-color: rgba(148, 163, 184, 0.1);
  color: #e8eef8;
}
html[data-theme="tech"] .novel-wf-outline-cell:focus {
  background: #121a2a;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}
html[data-theme="tech"] .novel-wf-outline-no {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}
html[data-theme="tech"] .novel-wf-outline-hook {
  background: rgba(99, 102, 241, 0.16);
  color: #c4b5fd;
}

html[data-theme="tech"] .library-shot-card,
html[data-theme="tech"] .library-shot-preview {
  background: #0c1422;
}
html[data-theme="tech"] .library-shot-select {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.3);
}
html[data-theme="tech"] .project-name:hover:not(:disabled),
html[data-theme="tech"] .project-name:focus {
  background: #121a2a;
  border-color: rgba(96, 165, 250, 0.4);
  color: #e8eef8;
}
html[data-theme="tech"] .agent-panel {
  background: var(--bg-elevated);
  border-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="tech"] .theme-card {
  background: #101826;
  color: #e8eef8;
}
html[data-theme="tech"] .theme-card.active {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25), 0 0 24px rgba(37, 99, 235, 0.2);
}
html[data-theme="tech"] .settings-tab.active {
  color: #93c5fd;
  border-bottom-color: #60a5fa;
}
html[data-theme="tech"] .modal-overlay {
  background: rgba(2, 6, 23, 0.72);
}
html[data-theme="tech"] .error-dialog,
html[data-theme="tech"] .confirm-dialog,
html[data-theme="tech"] .asset-detail-dialog {
  background: #101826 !important;
  color: #e8eef8;
  border-color: rgba(148, 163, 184, 0.22);
}
html[data-theme="tech"] .sidebar {
  background: var(--bg-elevated) !important;
  border-right-color: rgba(148, 163, 184, 0.12);
}
html[data-theme="tech"] .hint,
html[data-theme="tech"] .novel-wf-picker-hint,
html[data-theme="tech"] .novel-wf-stage-label em {
  color: #8a9bb5;
}
html[data-theme="tech"] .section-title {
  color: #64748b;
}
html[data-theme="tech"] .toast {
  background: #101826;
  border: 1px solid rgba(96, 165, 250, 0.35);
}

/* 对比高亮：深色底上用浅色字 + 更亮底色 */
html[data-theme="tech"] .novel-wf-diff-del,
html[data-theme="tech"] .novel-wf-opening-diff .novel-wf-diff-del {
  background: rgba(248, 113, 113, 0.38);
  color: #fecaca !important;
  text-decoration-color: rgba(254, 202, 202, 0.85);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}
html[data-theme="tech"] .novel-wf-diff-ins,
html[data-theme="tech"] .novel-wf-opening-diff .novel-wf-diff-ins {
  background: rgba(52, 211, 153, 0.32);
  color: #bbf7d0 !important;
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35);
}
html[data-theme="tech"] .novel-wf-highlight-diff-pane,
html[data-theme="tech"] .novel-wf-opening-diff-pane {
  background: #0a1220;
  border-color: rgba(148, 163, 184, 0.2);
}
html[data-theme="tech"] .novel-wf-highlight-diff-pane-label--orig {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.35);
}
html[data-theme="tech"] .novel-wf-highlight-diff-pane-label--new {
  color: #86efac;
  background: rgba(20, 83, 45, 0.4);
}
html[data-theme="tech"] .novel-wf-highlight-diff-text {
  color: #e8eef8;
}

/* ==== 墨刀式全局视觉收口 ==== */
.app {
  background:
    radial-gradient(ellipse 90% 55% at 8% -8%, rgba(59, 111, 245, 0.06), transparent 52%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(13, 148, 136, 0.04), transparent 48%),
    var(--bg);
}
html[data-theme="air"] .workspace,
html[data-theme="dark"] .workspace {
  background: transparent;
}
.btn.danger {
  border-color: rgba(225, 29, 72, 0.35);
  color: var(--danger);
  background: rgba(225, 29, 72, 0.06);
}
.btn.danger:hover {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.5);
}
.shot-asset-ref-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.shot-asset-chip {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px 2px 2px;
}
.shot-asset-chip-name {
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
}
.zizi-card-name {
  font-family: var(--font-display) !important;
}
.section-title {
  letter-spacing: 0.12em;
  font-weight: 650;
}
.settings-tab.active,
.prompt-tab.active,
.asset-library-tab.active {
  color: var(--accent-2);
  border-color: var(--accent);
}

/* 网页版：分镜详情与全站 air 画布/卡片对齐，不再套桌面 100vh 嵌套壳 */
html[data-theme="air"] .sb-detail-status-badge,
html[data-theme="dark"] .sb-detail-status-badge {
  background: rgba(13, 148, 136, 0.12);
  color: var(--success);
}
html[data-theme="air"] .sb-detail-status-badge[data-tone="warn"],
html[data-theme="dark"] .sb-detail-status-badge[data-tone="warn"] {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}
html[data-theme="air"] .shot-list-item-status.tone-ok,
html[data-theme="dark"] .shot-list-item-status.tone-ok,
html[data-theme="air"] .sb-footer-status[data-tone="ok"],
html[data-theme="dark"] .sb-footer-status[data-tone="ok"] {
  color: var(--success);
}
html[data-theme="air"] .shot-list-item-status.tone-warn,
html[data-theme="dark"] .shot-list-item-status.tone-warn,
html[data-theme="air"] .sb-footer-status[data-tone="warn"],
html[data-theme="dark"] .sb-footer-status[data-tone="warn"] {
  color: var(--warning);
}
html[data-theme="air"] .sb-gen-step.is-done .sb-gen-step-mark,
html[data-theme="dark"] .sb-gen-step.is-done .sb-gen-step-mark {
  background: rgba(13, 148, 136, 0.16);
  color: var(--success);
}
html[data-theme="air"] .sb-gen-progress-note,
html[data-theme="dark"] .sb-gen-progress-note {
  color: var(--accent-2);
  background: var(--accent-soft);
}
html[data-theme="air"] .sb-video-banner,
html[data-theme="dark"] .sb-video-banner {
  background: rgba(13, 148, 136, 0.1);
  color: var(--success);
}
html[data-theme="air"] .sb-video-banner-dot,
html[data-theme="dark"] .sb-video-banner-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}
html[data-theme="air"] .shot-thumb-media.is-generating,
html[data-theme="dark"] .shot-thumb-media.is-generating {
  color: var(--accent-2);
}
html[data-theme="air"] .sb-thumb-spinner,
html[data-theme="dark"] .sb-thumb-spinner {
  border-color: rgba(59, 111, 245, 0.22);
  border-top-color: var(--accent);
}

body.is-web {
  overflow: hidden;
  height: 100%;
  --sidebar-w: 248px;
}
body.is-web .app {
  height: 100vh;
  overflow: hidden;
}
body.is-web .topbar {
  flex-shrink: 0;
}
body.is-web .topbar-actions .btn {
  white-space: nowrap;
}
body.is-web .sb-detail-freeze-hint {
  display: none;
}
body.is-web .brand {
  min-width: 200px;
}
body.is-web .layout {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
body.is-web .sidebar {
  height: auto;
  overflow-y: auto;
  width: var(--sidebar-w);
  flex-shrink: 0;
}
body.is-web .project-list .project-item-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}
body.is-web .agent-panel:not(.collapsed) {
  height: auto;
  overflow: hidden;
}
body.is-web .workspace {
  overflow: hidden;
  padding: 0 16px 12px;
  min-width: 0;
  min-height: 0;
  flex: 1;
}
body.is-web .workspace-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 0;
  background: transparent;
}
body.is-web .workspace-header .project-name {
  flex: 0 1 380px;
  max-width: min(42%, 420px);
  width: auto;
  min-width: 140px;
  font-size: 18px;
}
body.is-web .workspace-header .project-stage-rail {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  overflow: hidden;
}
body.is-web .workspace-header .project-stage-rail-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
body.is-web .panel.visible {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  box-sizing: border-box;
}

/* 分镜详情：铺满剩余视口，对标成片工作台 */
body.is-web .workspace.is-edit-view {
  padding: 0 12px 12px;
}
body.is-web .workspace.is-edit-view .workspace-header {
  padding: 8px 0;
}
body.is-web #panelEdit.panel.visible {
  max-width: none;
  width: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 8px;
  background: transparent;
  padding: 0;
}
body.is-web .sb-detail-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
body.is-web .sb-detail-tabs {
  display: inline-flex;
}
body.is-web .sb-detail-top-center {
  text-align: left;
  min-width: 0;
}
body.is-web .sb-detail-title-row {
  justify-content: flex-start;
}
body.is-web .sb-detail-title {
  font-family: var(--font-sans);
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.is-web #panelEdit .edit-layout,
body.is-web #panelEdit .edit-layout.sb-detail-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
body.is-web .sb-detail-sidebar,
body.is-web #panelEdit .shot-list-wrap {
  position: static;
  height: 100%;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-card);
  padding: 12px 10px;
}
body.is-web #panelEdit .shot-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
body.is-web .sb-detail-sidebar .shot-list-item {
  box-shadow: none;
  border-radius: var(--radius-sm);
}
body.is-web #panelEdit .edit-detail,
body.is-web #panelEdit .edit-detail.sb-detail-main {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  gap: 0;
}
body.is-web .sb-detail-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
}
body.is-web #panelEdit .edit-detail-upper,
body.is-web #panelEdit .edit-shot-script-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.is-web .sb-pack-section {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  padding: 8px 10px;
}
body.is-web .sb-pack-caption {
  display: none;
}
body.is-web .shot-asset-refs--detail {
  margin: 0;
  padding: 6px 8px;
}
body.is-web .shot-asset-ref-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
}
body.is-web .sb-video-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: none;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
body.is-web .sb-video-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
}
body.is-web .sb-prompt-rail {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.is-web .sb-gen-progress {
  flex-shrink: 0;
  background: var(--inset-bg);
  border-radius: var(--radius-sm);
  box-shadow: none;
  max-width: none;
  padding: 10px 12px;
}
body.is-web .sb-section-fold,
body.is-web .sb-settings-row {
  border-radius: var(--radius-sm);
  box-shadow: none;
  padding: 10px 12px;
}
body.is-web .sb-section-fold--camera {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.is-web .sb-section-fold--camera[open] {
  overflow: visible;
}
body.is-web .sb-section-fold--camera .camera-content-editor {
  flex: 0 0 auto;
  min-height: 140px;
  max-height: none;
  height: auto;
  overflow: hidden;
}
body.is-web .sb-section-fold summary {
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: -0.01em;
}
body.is-web #panelEdit .preview-box {
  flex: 0 0 auto;
  flex-shrink: 0;
  align-self: stretch;
  height: auto;
  width: auto;
  aspect-ratio: var(--video-preview-ratio, 9 / 16);
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}
body.is-web #panelEdit .shot-media-preview,
body.is-web #panelEdit .shot-media-cell,
body.is-web #panelEdit .shot-media-preview-stage,
body.is-web #panelEdit .shot-media-cell-body {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
}
body.is-web #panelEdit .shot-media-cell {
  width: auto;
  flex: 1 1 auto;
}
body.is-web #panelEdit .shot-media-preview-stage {
  width: 100%;
  --video-preview-max-w: 100%;
}
body.is-web #panelEdit .shot-media-cell-body {
  --video-preview-max-w: 100%;
}
body.is-web #panelEdit .shot-media-cell-body .previewable-video-wrap,
body.is-web #panelEdit .shot-media-cell-body:not(.has-media) .preview-placeholder {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: unset;
}
body.is-web #panelEdit .preview-box img,
body.is-web #panelEdit .preview-box video,
body.is-web #panelEdit .shot-media-cell-body video.previewable-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  object-fit: contain;
}
body.is-web .sb-detail-footer {
  position: static;
  z-index: 1;
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: none;
  background: var(--bg-card);
  padding: 10px 14px;
  flex-wrap: wrap;
}
body.is-web #panelEdit .camera-content-editor {
  background: var(--inset-bg);
  line-height: 1.7;
  font-size: 13px;
  overflow: hidden;
}

@media (max-width: 1280px) {
  body.is-web #panelEdit .edit-layout,
  body.is-web #panelEdit .edit-layout.sb-detail-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}
@media (max-width: 1100px) {
  body.is-web #panelEdit .edit-layout,
  body.is-web #panelEdit .edit-layout.sb-detail-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }
  body.is-web .sb-video-workspace {
    flex-direction: column;
  }
  body.is-web .sb-detail-scroll,
  body.is-web #panelEdit .edit-detail-upper,
  body.is-web #panelEdit .edit-shot-script-wrap,
  body.is-web .sb-video-section,
  body.is-web .sb-video-workspace {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  body.is-web .sb-detail-sidebar,
  body.is-web #panelEdit .shot-list-wrap {
    max-height: 280px;
  }
  body.is-web #panelEdit .preview-box {
    width: min(100%, calc(70vh * var(--video-preview-ar, 0.5625)));
    height: auto;
    min-height: 0;
    aspect-ratio: var(--video-preview-ratio, 9 / 16);
    max-height: 70vh;
    align-self: flex-start;
  }
}
