/* ============================================================
   DramaForge · 暗色电影质感 UI
   ============================================================ */
:root {
  --bg: #07080d;
  --bg-2: #0c0e16;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f6;
  --text-2: #9aa1b5;
  --text-3: #5d6478;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #fb7185;
  --grad: linear-gradient(120deg, #8b5cf6, #6366f1 45%, #22d3ee);
  --grad-soft: linear-gradient(120deg, rgba(139,92,246,.18), rgba(34,211,238,.12));
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(139, 92, 246, 0.4); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* ---------------- 背景氛围 ---------------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse 90% 60% at 50% -10%, #131527 0%, var(--bg) 60%); }
.orb { position: absolute; border-radius: 50%; filter: blur(110px); opacity: .35; animation: drift 26s ease-in-out infinite alternate; }
.orb-a { width: 560px; height: 560px; background: #4c1d95; top: -220px; left: -120px; }
.orb-b { width: 480px; height: 480px; background: #0e7490; bottom: -200px; right: -100px; animation-delay: -8s; }
.orb-c { width: 320px; height: 320px; background: #312e81; top: 40%; left: 55%; opacity: .25; animation-delay: -16s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(70px, 50px) scale(1.15); }
}
.grain {
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- 通用组件 ---------------- */
.icon { width: 18px; height: 18px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .18s ease; white-space: nowrap; user-select: none;
}
.btn:hover { background: rgba(255,255,255,.09); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .icon { width: 15px; height: 15px; }

.btn-primary {
  background: var(--grad); border: none; color: #fff; font-weight: 600;
  box-shadow: 0 4px 24px rgba(124, 92, 246, 0.4);
}
.btn-primary:hover { background: var(--grad); filter: brightness(1.12); box-shadow: 0 6px 32px rgba(124, 92, 246, 0.55); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); border-color: transparent; }

.btn-danger:hover { border-color: rgba(251,113,133,.5); color: var(--red); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

.card {
  /* 不用 backdrop-filter:几十张卡片同时模糊会拖垮 GPU,造成全页卡顿 */
  background: rgba(22, 24, 35, 0.55); border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  padding: 3px 10px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2);
}
.tag.violet { color: #c4b5fd; border-color: rgba(139,92,246,.35); background: rgba(139,92,246,.12); }
.tag.cyan { color: #67e8f9; border-color: rgba(34,211,238,.3); background: rgba(34,211,238,.1); }
.tag.green { color: #6ee7b7; border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.1); }
.tag.amber { color: #fcd34d; border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.1); }
.tag.red { color: #fda4af; border-color: rgba(251,113,133,.35); background: rgba(251,113,133,.1); }

input:not([type]), input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 10px 13px;
  background: rgba(0,0,0,.28); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 13.5px; line-height: 1.65;
  transition: border-color .15s, box-shadow .15s; resize: vertical;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: rgba(139,92,246,.6);
  box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}
textarea { min-height: 66px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239aa1b5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
select option { background: #14161f; }

label.field { display: block; }
label.field > span {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: .08em; margin-bottom: 6px; text-transform: uppercase;
}

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent-2);
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Toast ---------------- */
#toasts { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 13px; font-size: 13.5px; max-width: 380px;
  background: rgba(18, 20, 30, 0.92); border: 1px solid var(--border-strong);
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
  animation: toast-in .28s cubic-bezier(.21,1.02,.73,1);
}
.toast.success { border-color: rgba(52,211,153,.4); }
.toast.success .icon { color: var(--green); }
.toast.error { border-color: rgba(251,113,133,.4); }
.toast.error .icon { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } }
.toast.out { animation: toast-out .25s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* ============================================================
   首页
   ============================================================ */
.home { max-width: 1080px; margin: 0 auto; padding: 0 28px 80px; }

.home-nav { display: flex; align-items: center; justify-content: space-between; padding: 26px 0; }
.account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.account-actions .tag { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 4px 18px rgba(124,92,246,.45);
}
.logo small { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: .14em; }

.hero { text-align: center; padding: 64px 0 44px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: #c4b5fd; padding: 6px 16px; border-radius: 99px;
  border: 1px solid rgba(139,92,246,.35); background: rgba(139,92,246,.1);
  margin-bottom: 26px;
}
.hero-badge .icon { width: 13px; height: 13px; }
.hero h1 {
  font-size: clamp(34px, 5.2vw, 54px); font-weight: 800; line-height: 1.18; letter-spacing: -0.01em;
}
.hero h1 .grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 15.5px; margin-top: 16px; line-height: 1.8; }

.idea-box {
  max-width: 720px; margin: 40px auto 0; position: relative;
  border-radius: 20px; padding: 1.5px; background: linear-gradient(120deg, rgba(139,92,246,.55), rgba(99,102,241,.25), rgba(34,211,238,.45));
  box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 80px rgba(124,92,246,.12);
}
.idea-inner {
  display: flex; gap: 10px; align-items: center;
  background: #0d0f18; border-radius: 19px; padding: 10px 10px 10px 22px;
}
.idea-inner input {
  flex: 1; background: none; border: none; box-shadow: none; padding: 12px 0;
  font-size: 16px; color: var(--text);
}
.idea-inner input:focus { box-shadow: none; }
.idea-inner .btn-primary { padding: 13px 26px; font-size: 14.5px; border-radius: 14px; }

.examples { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 18px; }
.example-chip {
  font-size: 12.5px; color: var(--text-2); padding: 7px 15px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--panel); cursor: pointer;
  transition: all .16s;
}
.example-chip:hover { color: var(--text); border-color: rgba(139,92,246,.5); background: rgba(139,92,246,.1); transform: translateY(-1px); }

/* 上传剧本 / 会员资源库 入口 */
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.hero-actions .btn.active { color: var(--text); border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.14); }
.script-panel {
  max-width: 760px; margin: 12px auto 0; padding: 14px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--panel);
}
.script-panel textarea {
  width: 100%; min-height: 170px; resize: vertical; box-sizing: border-box;
  font-size: 13px; line-height: 1.7; color: var(--text);
  background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.script-panel textarea:focus { outline: none; border-color: rgba(139,92,246,.5); }
.script-panel-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.script-panel-foot .btn-sm { padding: 7px 13px; font-size: 12.5px; }
.script-panel .btn label, label.btn { cursor: pointer; }

/* 会员资源库弹窗 */
.lib-tabs { display: flex; gap: 8px; padding: 4px 20px 0; }
.lib-tab {
  font-size: 13px; color: var(--text-2); padding: 7px 14px; border-radius: 10px 10px 0 0;
  cursor: pointer; border: 1px solid transparent; border-bottom: none;
}
.lib-tab.active { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.lib-hint { font-size: 12px; color: var(--text-3); padding: 8px 20px 0; margin: 0; }
.lib-empty { text-align: center; color: var(--text-3); padding: 50px 20px; font-size: 13px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.lib-card {
  position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--panel); cursor: pointer; transition: all .15s;
}
.lib-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.lib-card-name { font-size: 12px; color: var(--text); padding: 7px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card:hover { border-color: rgba(139,92,246,.5); transform: translateY(-2px); }
.lib-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,92,246,.4); }
.lib-card .lib-check { position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; align-items: center; justify-content: center; }
.lib-card.sel .lib-check { display: flex; }
.lib-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; border: none;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.lib-card:hover .lib-del { opacity: 1; }

.flow-strip {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px;
  margin: 44px auto 0; padding: 16px 22px; max-width: 880px;
  border-radius: 14px; border: 1px dashed rgba(255,255,255,.1);
  color: var(--text-3); font-size: 12px;
}
.flow-strip b { color: var(--text-2); font-weight: 600; }
.flow-strip .sep { color: rgba(139,92,246,.7); margin: 0 2px; }

/* ---------------- 风格选择 ---------------- */
.style-section {
  max-width: 880px; margin: 38px auto 0; text-align: left;
  padding: 20px 22px 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(16px);
}
.style-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.style-section-head h3 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.style-section-head h3 .icon { color: var(--accent); width: 16px; height: 16px; }
.style-picked-name { font-size: 12.5px; color: #c4b5fd; font-weight: 600; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-chip {
  font-size: 12px; color: var(--text-2); padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--border); background: transparent; cursor: pointer; transition: all .15s;
  user-select: none;
}
.cat-chip:hover { color: var(--text); border-color: var(--border-strong); }
.cat-chip.active { color: #fff; background: var(--grad); border-color: transparent; font-weight: 600; }

.style-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px;
  max-height: 340px; overflow-y: auto; padding: 2px;
}
.style-card { cursor: pointer; user-select: none; }
.style-thumb {
  position: relative; aspect-ratio: 1; border-radius: 13px; overflow: hidden;
  border: 2px solid var(--border); transition: all .16s; background: var(--panel-2);
}
.style-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.style-card:hover .style-thumb { border-color: var(--border-strong); }
.style-card:hover .style-thumb img { transform: scale(1.06); }
.style-card.selected .style-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,.25), 0 6px 22px rgba(139,92,246,.3);
}
.auto-thumb {
  display: grid; place-items: center; font-size: 30px;
  background: var(--grad-soft);
}
.style-badge {
  position: absolute; top: 6px; left: 6px; font-size: 9.5px; font-weight: 800; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 6px; color: #fff;
  background: linear-gradient(120deg, #f43f5e, #fb923c); box-shadow: 0 2px 8px rgba(244,63,94,.4);
}
.style-check {
  position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--grad); display: none; place-items: center; color: #fff;
  box-shadow: 0 2px 10px rgba(124,92,246,.5);
}
.style-check .icon { width: 12px; height: 12px; }
.style-card.selected .style-check { display: grid; }
.style-name { font-size: 12px; font-weight: 650; margin-top: 7px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-sub { font-size: 10.5px; color: var(--text-3); text-align: center; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-wide { width: min(860px, calc(100vw - 40px)); }
.modal-wide .style-grid { max-height: 52vh; }

/* 画幅切换 */
.ratio-seg {
  display: inline-flex; gap: 3px; padding: 3px;
  border-radius: 11px; background: rgba(0,0,0,.3); border: 1px solid var(--border);
}
.ratio-opt {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: all .15s; user-select: none;
}
.ratio-opt .icon { width: 13px; height: 13px; }
.ratio-opt:hover { color: var(--text); }
.ratio-opt.active { color: #fff; background: var(--grad); box-shadow: 0 2px 10px rgba(124,92,246,.35); }
.ratio-opt.disabled { opacity: .45; cursor: not-allowed; }
.ratio-seg.sm .ratio-opt { padding: 5px 11px; font-size: 11.5px; }

/* 分步模式开关 */
.step-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 7px 13px; border-radius: 10px; cursor: pointer; user-select: none;
  border: 1px solid var(--border); background: var(--panel-2); transition: all .15s;
}
.step-toggle .icon { width: 12px; height: 12px; }
.step-toggle .st-state { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,.1); }
.step-toggle.on { color: #c4b5fd; border-color: rgba(139,92,246,.45); background: rgba(139,92,246,.1); }
.step-toggle.on .st-state { background: var(--grad); color: #fff; }

/* 镜头素材绑定行 */
.bind-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-3); margin-bottom: 12px;
}

/* 工作台当前风格卡 */
.style-current { display: flex; align-items: center; gap: 18px; padding: 16px 18px; margin-bottom: 16px; flex-wrap: wrap; }
.style-current .sc-thumb {
  width: 84px; height: 84px; border-radius: 14px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border-strong); font-size: 30px;
}
.style-current .sc-info { flex: 1; min-width: 220px; }
.style-current .sc-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.style-current .sc-title b { font-size: 15.5px; font-weight: 700; }
.style-current .sc-sub { font-size: 12px; color: var(--text-3); }
.style-current .sc-info p { font-size: 12.5px; color: var(--text-2); line-height: 1.65; margin-top: 7px; }
.style-current .ep-tags { margin-top: 9px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 52px 0 18px; }
.section-title.compact { margin: 18px 0 10px; }
.section-title h2 { font-size: 18px; font-weight: 700; }
.section-title .count { color: var(--text-3); font-size: 13px; margin-left: 10px; font-weight: 500; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.project-card {
  overflow: hidden; cursor: pointer; transition: all .2s ease; position: relative;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-cover {
  height: 150px; background: var(--grad-soft); position: relative;
  display: grid; place-items: center; overflow: hidden;
}
.project-cover img { width: 100%; height: 100%; object-fit: cover; }
.project-cover .placeholder { font-size: 38px; opacity: .5; }
.project-body { padding: 16px 18px 18px; }
.project-body h3 { font-size: 15px; font-weight: 650; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-body .idea { font-size: 12.5px; color: var(--text-2); line-height: 1.6; height: 40px; overflow: hidden; margin-bottom: 13px; }
.project-meta { display: flex; align-items: center; justify-content: space-between; }
.progress-track { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); margin-right: 12px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--grad); transition: width .4s ease; }
.project-meta .pct { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.project-del {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  border-radius: 9px; display: grid; place-items: center;
  background: rgba(0,0,0,.5); border: 1px solid var(--border); color: var(--text-2);
  opacity: 0; transition: all .15s; cursor: pointer; backdrop-filter: blur(8px);
}
.project-card:hover .project-del { opacity: 1; }
.project-del:hover { color: var(--red); border-color: rgba(251,113,133,.5); }
.project-del .icon { width: 14px; height: 14px; }
.empty-hint { color: var(--text-3); text-align: center; padding: 44px 0; font-size: 14px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ============================================================
   工作台
   ============================================================ */
.workspace { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 22px; border-bottom: 1px solid var(--border);
  background: rgba(10, 11, 18, 0.75); backdrop-filter: blur(20px); z-index: 10;
}
.topbar .title-wrap { flex: 1; min-width: 0; }
.topbar input.title-input {
  background: transparent; border: 1px solid transparent; font-size: 16px; font-weight: 700;
  padding: 6px 10px; border-radius: 9px; width: 100%; max-width: 420px;
}
.topbar input.title-input:hover { border-color: var(--border); }
.topbar .subtitle { font-size: 11.5px; color: var(--text-3); padding: 0 10px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 480px; }
.run-progress { display: flex; align-items: center; gap: 10px; margin-right: 4px; }
.run-progress .bar { width: 130px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.run-progress .fill { height: 100%; background: var(--grad); border-radius: 3px; transition: width .5s ease; }
.run-progress span { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.ws-main { flex: 1; display: flex; min-height: 0; }

/* 步骤导航 */
.stepper {
  width: 248px; flex-shrink: 0; overflow-y: auto;
  padding: 18px 14px; border-right: 1px solid var(--border);
  background: rgba(8, 9, 14, 0.55);
}
.step {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; cursor: pointer;
  transition: background .15s; margin-bottom: 2px;
  border: 1px solid transparent;
}
.step:hover { background: var(--panel-2); }
.step.active { background: rgba(139,92,246,.12); border-color: rgba(139,92,246,.3); }
.step-dot {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-3);
  transition: all .2s;
}
.step-dot .icon { width: 15px; height: 15px; }
.step.done .step-dot { background: rgba(52,211,153,.13); border-color: rgba(52,211,153,.4); color: var(--green); }
.step.running .step-dot { background: rgba(34,211,238,.12); border-color: rgba(34,211,238,.45); color: var(--accent-2); box-shadow: 0 0 16px rgba(34,211,238,.25); }
.step.error .step-dot { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.45); color: var(--red); }
.step.stale .step-dot { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.35); color: var(--amber); }
.step-info { min-width: 0; flex: 1; }
.step-info .name { font-size: 13.5px; font-weight: 600; }
.step-info .status { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.step.running .status { color: var(--accent-2); }
.step.error .status { color: var(--red); }
.step.stale .status { color: var(--amber); }
.step-num { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 内容区 */
.stage-panel { flex: 1; overflow-y: auto; padding: 26px 32px 100px; min-width: 0; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stage-head h2 { font-size: 21px; font-weight: 750; display: flex; align-items: center; gap: 11px; }
.stage-head h2 .icon { width: 21px; height: 21px; color: var(--accent); }
.stage-head .desc { color: var(--text-3); font-size: 12.5px; margin-top: 5px; }
.stage-actions { display: flex; gap: 9px; }

.empty-stage {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 70px 20px; text-align: center; color: var(--text-3);
  border: 1.5px dashed rgba(255,255,255,.1); border-radius: var(--radius);
}
.empty-stage .big-icon { width: 52px; height: 52px; opacity: .35; }
.empty-stage p { font-size: 14px; line-height: 1.7; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 13px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.block { padding: 20px; margin-bottom: 16px; }
.block-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.block-title h3 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 9px; }

/* 角色/场景卡片(紧凑) */
.entity-card { padding: 13px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.entity-del {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border-radius: 7px; display: grid; place-items: center;
  background: transparent; border: none; color: var(--text-3); cursor: pointer;
  opacity: 0; transition: all .15s;
}
.entity-card:hover .entity-del { opacity: 1; }
.entity-del:hover { color: var(--red); background: rgba(251,113,133,.1); }
.entity-del .icon { width: 12px; height: 12px; }
.entity-card textarea { font-size: 12px; padding: 8px 10px; min-height: 48px; }
.entity-card label.field > span { margin-bottom: 4px; }
.entity-head { display: flex; align-items: center; gap: 11px; }
.entity-avatar {
  width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
  background: var(--grad-soft); display: grid; place-items: center;
  border: 1px solid var(--border); font-size: 18px;
}
.entity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.entity-head input { font-size: 15px; font-weight: 650; background: transparent; border-color: transparent; padding: 4px 8px; }
.entity-head input:hover { border-color: var(--border); }

/* 分集 */
.episode-row {
  display: flex; gap: 15px; padding: 17px 19px; margin-bottom: 11px;
  cursor: pointer; transition: all .16s; align-items: flex-start;
}
.episode-row:hover { border-color: var(--border-strong); }
.episode-row.selected { border-color: rgba(139,92,246,.55); background: rgba(139,92,246,.07); box-shadow: 0 0 24px rgba(139,92,246,.1); }
.ep-no {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2);
}
.episode-row.selected .ep-no { background: var(--grad); color: #fff; border: none; }
.ep-body { flex: 1; min-width: 0; }
.ep-body h4 { font-size: 14.5px; font-weight: 650; margin-bottom: 5px; }
.ep-body p { font-size: 12.8px; color: var(--text-2); line-height: 1.65; }
.ep-tags { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }

/* 分镜 */
.shot-card { padding: 19px; margin-bottom: 15px; }
.shot-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.shot-no {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
  box-shadow: 0 4px 14px rgba(124,92,246,.35);
}
.shot-title { font-weight: 650; font-size: 14.5px; flex: 1; }
.duration-pill { display: flex; align-items: center; gap: 7px; }
.duration-pill input { width: 58px; text-align: center; padding: 6px; }
.dlg-row { display: grid; grid-template-columns: 120px 110px 1fr 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.dlg-del { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: transparent; border: none; color: var(--text-3); cursor: pointer; }
.dlg-del:hover { color: var(--red); }
.dlg-del .icon { width: 14px; height: 14px; }
.timeline {
  display: flex; gap: 5px; height: 38px; margin-bottom: 22px;
  border-radius: 11px; overflow: hidden;
}
.timeline .tl-seg {
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff;
  background: linear-gradient(120deg, rgba(139,92,246,.75), rgba(99,102,241,.65));
  border-radius: 9px; min-width: 50px; letter-spacing: .03em;
}
.timeline .tl-seg:nth-child(2n) { background: linear-gradient(120deg, rgba(34,211,238,.6), rgba(99,102,241,.6)); }

/* 参考图(紧凑) */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.ref-card { overflow: hidden; }
.ref-img { aspect-ratio: 4/3; background: rgba(0,0,0,.35); position: relative; display: grid; place-items: center; }
.ref-img img { width: 100%; height: 100%; object-fit: cover; }
.ref-img .placeholder { color: var(--text-3); font-size: 12px; }
.ref-img .regen-btn {
  position: absolute; top: 7px; right: 7px; opacity: 0; transition: opacity .15s;
  background: rgba(0,0,0,.6); backdrop-filter: blur(8px); padding: 4px 9px; font-size: 11px;
}
.ref-card:hover .regen-btn { opacity: 1; }
.ref-body { padding: 9px 11px 11px; }
.ref-body h4 { font-size: 12.5px; font-weight: 650; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ref-body textarea { font-size: 11px; min-height: 40px; color: var(--text-2); padding: 7px 9px; }

/* 视频生成 */
.video-shot { padding: 19px; margin-bottom: 15px; }
.video-status-row { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; flex-wrap: wrap; }
.video-frame {
  border-radius: 13px; overflow: hidden; background: #000;
  border: 1px solid var(--border); max-width: 560px;
}
.video-frame video { width: 100%; display: block; }
.gen-shimmer {
  height: 130px; border-radius: 13px; max-width: 560px;
  background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(139,92,246,.14) 50%, rgba(255,255,255,.04) 70%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
  display: grid; place-items: center; color: var(--text-3); font-size: 12.5px;
  border: 1px dashed rgba(139,92,246,.3);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* 成片 */
.final-stage { max-width: 860px; }
.final-player {
  border-radius: 18px; overflow: hidden; background: #000;
  border: 1px solid var(--border-strong); box-shadow: var(--shadow), 0 0 90px rgba(124,92,246,.14);
}
.final-player video { width: 100%; display: block; }
.final-stats { display: flex; gap: 14px; margin: 18px 0; flex-wrap: wrap; }
.stat-chip { padding: 13px 20px; text-align: center; flex: 1; min-width: 110px; }
.stat-chip b { display: block; font-size: 19px; font-weight: 750; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-chip span { font-size: 11px; color: var(--text-3); letter-spacing: .08em; }

/* 日志抽屉 */
.log-drawer {
  border-top: 1px solid var(--border); background: rgba(7, 8, 13, 0.9);
  backdrop-filter: blur(18px); flex-shrink: 0; z-index: 9;
  transition: height .25s ease; overflow: hidden;
}
.log-drawer.closed { height: 40px; }
.log-drawer.open { height: 230px; }
.log-head {
  display: flex; align-items: center; gap: 10px; padding: 0 18px; height: 40px;
  cursor: pointer; user-select: none; font-size: 12px; color: var(--text-2); font-weight: 600;
}
.log-head .icon { width: 14px; height: 14px; color: var(--accent-2); }
.log-head .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; animation: pulse 1.6s ease infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.log-body { height: calc(100% - 40px); overflow-y: auto; padding: 4px 18px 14px; font-family: var(--mono); font-size: 11.8px; line-height: 1.85; }
.log-line { display: flex; gap: 12px; }
.log-line .t { color: var(--text-3); flex-shrink: 0; }
.log-line.info .m { color: var(--text-2); }
.log-line.success .m { color: var(--green); }
.log-line.error .m { color: var(--red); }

/* ---------------- 设置弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(4, 5, 9, 0.7); backdrop-filter: blur(8px);
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: min(720px, calc(100vw - 40px)); max-height: 86vh; overflow-y: auto;
  background: #0e1019; border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow);
  animation: modal-in .25s cubic-bezier(.21,1.02,.73,1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #0e1019; z-index: 2;
}
.modal-head h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-head h2 .icon { color: var(--accent); }
.modal-body { padding: 22px 26px 28px; }
.provider-block { padding: 18px; margin-bottom: 15px; }
.provider-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.provider-head h3 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.provider-head h3 .icon { color: var(--accent-2); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.admin-user-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

/* 会员管理 */
.member-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--panel); margin-bottom: 8px; }
.member-main { flex: 1; min-width: 0; }
.member-name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--text); }
.member-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.member-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.member-acts .btn-sm { padding: 5px 10px; font-size: 12px; }

/* 登录弹窗 */
.login-modal { overflow: hidden; }
.login-brand { text-align: center; padding: 28px 20px 8px; background: linear-gradient(180deg, rgba(139,92,246,.16), transparent); }
.login-logo { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 16px; font-size: 30px;
  display: flex; align-items: center; justify-content: center; background: var(--grad, linear-gradient(135deg,#8b5cf6,#22d3ee)); }
.login-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: .5px; }
.login-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.login-tabs { display: flex; gap: 6px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.login-tab { flex: 1; text-align: center; padding: 8px; font-size: 13.5px; color: var(--text-2); border-radius: 8px; cursor: pointer; transition: all .15s; }
.login-tab.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.login-field input { width: 100%; box-sizing: border-box; }
.login-submit { width: 100%; justify-content: center; margin-top: 18px; font-size: 15px; padding: 11px; letter-spacing: 2px; }
.login-err { color: var(--red); font-size: 12px; margin-top: 10px; display: none; text-align: center; }
.login-admin { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.login-admin #admin-toggle { font-size: 12px; color: var(--text-3); cursor: pointer; }
.login-admin #admin-toggle:hover { color: var(--text-2); }
.login-admin input { width: 100%; box-sizing: border-box; }
.admin-code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 14px; margin-bottom: 10px;
}
.mono-code { font-family: var(--mono); letter-spacing: .08em; font-size: 14px; }
.muted-line { color: var(--text-3); font-size: 11.5px; line-height: 1.6; margin-top: 3px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.test-result { font-size: 12px; margin-top: 10px; padding: 9px 13px; border-radius: 9px; display: none; }
.test-result.ok { display: block; color: var(--green); background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.25); }
.test-result.fail { display: block; color: var(--red); background: rgba(251,113,133,.08); border: 1px solid rgba(251,113,133,.25); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 18px; border-radius: var(--radius); margin-bottom: 15px;
  background: rgba(251,191,36,.06); border: 1px solid rgba(251,191,36,.25);
}
.switch-row .sw-info b { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.switch-row .sw-info p { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }
.switch {
  position: relative; width: 46px; height: 26px; border-radius: 99px; flex-shrink: 0;
  background: rgba(255,255,255,.12); cursor: pointer; transition: background .2s;
  border: 1px solid var(--border);
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.switch.on { background: var(--grad); border-color: transparent; }
.switch.on::after { transform: translateX(20px); }

.mock-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 12.5px; color: #fcd34d;
  background: rgba(251,191,36,.08); border-bottom: 1px solid rgba(251,191,36,.2);
}
.mock-banner .icon { width: 14px; height: 14px; }
.mock-banner a { color: #fde68a; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- 分组步进器 ---------------- */
.step-group-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--text-3);
  padding: 14px 12px 8px; text-transform: uppercase;
}
.step-group-label .icon { width: 13px; height: 13px; color: var(--accent); }
.step-group-label.ep { border-top: 1px solid var(--border); margin-top: 10px; flex-wrap: wrap; }
.ep-select {
  flex: 1; min-width: 0; font-size: 11.5px; padding: 5px 24px 5px 9px; border-radius: 8px;
}

/* 分集制作行 */
.ep-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; flex-shrink: 0; }
.ep-side .duration-pill { display: flex; align-items: center; gap: 6px; }
.ep-side .duration-pill input { width: 60px; text-align: center; padding: 5px; }

/* ---------------- 媒体预览(大图 / 视频弹窗) ---------------- */
.media-mask {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  background: rgba(3, 4, 8, 0.88); backdrop-filter: blur(10px);
  animation: fade-in .18s ease;
}
.media-box {
  max-width: min(92vw, 1100px); max-height: 92vh; display: flex; flex-direction: column;
  animation: modal-in .22s cubic-bezier(.21,1.02,.73,1);
}
.media-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 4px 10px; color: var(--text-2); font-size: 13px; font-weight: 600;
}
.media-box img, .media-box video {
  max-width: min(92vw, 1100px); max-height: 82vh; object-fit: contain;
  border-radius: 14px; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 0 90px rgba(124,92,246,.15); background: #000;
}
.video-expired {
  max-width: min(92vw, 520px); padding: 28px 24px; text-align: center;
  color: var(--text-2); font-size: 14px; line-height: 1.7;
  border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel);
}
.version-badge {
  position: fixed; right: 12px; bottom: 8px; z-index: 50;
  font-size: 11px; color: var(--text-3); opacity: .55;
  pointer-events: none; user-select: none; letter-spacing: .3px;
}
.entity-avatar[data-preview-img], .ref-img[data-preview-img] { cursor: zoom-in; }

/* ---------------- 视频缩略图(紧凑) ---------------- */
.shots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.video-shot { padding: 13px; margin-bottom: 0; }
.video-shot .shot-no { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
.video-shot .shot-title { font-size: 12.5px; }
.video-thumb {
  position: relative; border-radius: 11px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: #000; aspect-ratio: 16/10; max-height: 170px;
}
.video-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.25); transition: background .15s;
}
.play-overlay .icon {
  width: 44px; height: 44px; color: #fff; padding: 13px; box-sizing: content-box;
  background: rgba(124,92,246,.85); border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); transition: transform .15s;
}
.video-thumb:hover .play-overlay { background: rgba(0,0,0,.1); }
.video-thumb:hover .play-overlay .icon { transform: scale(1.08); }

/* 成片展示(紧凑) */
.ep-result-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ep-result-player {
  position: relative; border-radius: 13px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border-strong); background: #000;
  width: 300px; aspect-ratio: 16/9; flex-shrink: 0;
  box-shadow: 0 10px 36px rgba(0,0,0,.45);
}
.ep-result-player.portrait { width: 180px; aspect-ratio: 9/16; }
.ep-result-player video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-result-info h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.ep-result-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.ep-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.ep-mini {
  position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: #000; aspect-ratio: 16/10;
  transition: all .15s;
}
.ep-mini:hover { border-color: rgba(139,92,246,.5); transform: translateY(-1px); }
.ep-mini video { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.ep-mini-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; color: #fff;
  padding: 14px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.ep-mini-label .icon { width: 10px; height: 10px; }
.ep-mini.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-style: dashed; background: transparent; cursor: default;
  color: var(--text-3); font-size: 12px; font-weight: 600;
}
.ep-mini.empty small { font-size: 10px; font-weight: 400; }

/* 收尾 */
.fade-in { animation: stage-in .3s ease; }
@keyframes stage-in { from { opacity: 0; transform: translateY(8px); } }

/* 镜头片段操作行 */
.clip-actions { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.clip-actions .btn { padding: 4px 9px; font-size: 11px; }
