:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c2333;
  --ink-2: #55607a;
  --ink-3: #8b95ab;
  --line: #e3e7ef;
  --brand: #4457d6;
  --brand-soft: #eef1ff;
  --ok: #1f9e6f;
  --ok-soft: #e8f7f0;
  --warn: #c47b0a;
  --warn-soft: #fdf4e3;
  --danger: #d0483e;
  --danger-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 33, 61, .05), 0 8px 24px rgba(23, 33, 61, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

.hidden { display: none !important; }

button { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 15% 0%, #e8ecff 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 100%, #e6f6ef 0%, transparent 55%),
              var(--bg);
  padding: 24px;
}

.login-card {
  width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #4457d6, #7a5cf0);
  color: #fff; font-weight: 700; font-size: 20px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.brand h1 { font-size: 19px; margin: 0 0 2px; }
.brand p { margin: 0; color: var(--ink-3); font-size: 12px; }
.brand.small .brand-mark { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
.brand-text strong { display: block; font-size: 14px; }
.brand-text span { font-size: 12px; color: var(--ink-3); }

.login-card label { display: block; margin: 16px 0 0; font-size: 13px; color: var(--ink-2); }
.login-card input, label input, label select, label textarea { margin-top: 6px; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #b9c2f5;
  box-shadow: 0 0 0 3px rgba(68, 87, 214, .1);
}
textarea { resize: vertical; font-family: inherit; }

.hint { color: var(--ink-3); font-size: 12px; text-align: center; margin: 14px 0 0; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #f7f8fb; border-color: #cfd6e6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #384ac4; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0cfcc; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; margin-top: 20px; padding: 10px; }
.btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn b { font-weight: 600; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}

/* ---------- 布局 ---------- */
.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  height: 58px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 258px; flex: 0 0 auto;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 14px;
  gap: 10px;
}
.side-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.search { padding: 7px 10px; font-size: 12px; }

.project-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.project-item {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  background: #fafbfd;
}
.project-item:hover { border-color: #dbe2f0; }
.project-item.active { background: var(--brand-soft); border-color: #c8d1fb; }
.project-item .pi-name { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.project-item .pi-meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

.main { flex: 1; min-width: 0; overflow: auto; padding: 18px 22px 40px; }

.empty {
  max-width: 520px; margin: 14vh auto 0; text-align: center; color: var(--ink-2);
}
.empty h2 { font-size: 18px; margin-bottom: 8px; color: var(--ink); }

.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.project-head h2 { margin: 0; font-size: 20px; }
.project-head .meta { color: var(--ink-3); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }

/* 阶段导航：渐变缩略图 + 专属图标 + 真实产物图 + 完成进度条 */
.stages {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stage-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(23, 33, 61, .04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stage-tab:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stage-tab.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(68,87,214,.16), var(--shadow); }
.st-thumb {
  height: 62px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
}
.st-thumb::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 10px, transparent 10px 20px);
}
.st-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.st-thumb-mask { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,14,30,.05) 0%, rgba(10,14,30,.55) 100%); }
.st-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; }
.st-icon { width: 26px; height: 26px; opacity: .95; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.st-num { font-size: 22px; font-weight: 800; letter-spacing: -1px; opacity: .55; line-height: 1; }
.st-count { position: absolute; bottom: 7px; left: 9px; font-size: 10px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.34); color: #fff; }
.st-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.3); }
.st-bar i { display: block; height: 100%; background: #fff; transition: width .3s ease; }
.st-info { padding: 8px 10px 9px; }
.stage-tab .idx { font-size: 10px; color: var(--ink-3); letter-spacing: .3px; }
.stage-tab .nm { font-size: 13px; font-weight: 700; margin-top: 1px; }
.stage-tab .st { font-size: 10.5px; margin-top: 3px; color: var(--ink-3); }
.stage-tab.locked .st { color: var(--ok); }
.stage-tab.generating .st { color: var(--warn); }
.stage-tab.pending .st { color: var(--brand); }
.stage-tab.invalid .st { color: var(--danger); }
.stage-tab.locked .st-bar i { background: #b9f2d8; }

/* 面板 */
.stage-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .sub { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

label.inline { font-size: 12px; color: var(--ink-2); }
.field { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }

.note {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  background: #f7f8fb;
  border: 1px dashed var(--line);
  color: var(--ink-2);
}
.note.warn { background: var(--warn-soft); border-color: #f0dcb4; color: #8a5a05; }
.note.danger { background: var(--danger-soft); border-color: #f2c9c6; color: #a53229; }
.note.ok { background: var(--ok-soft); border-color: #c7ecda; color: #14734f; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; border: 1px solid var(--line); color: var(--ink-2); background: #fbfcfe;
}
.tag.ok { background: var(--ok-soft); border-color: #c7ecda; color: #14734f; }
.tag.warn { background: var(--warn-soft); border-color: #f0dcb4; color: #8a5a05; }
.tag.danger { background: var(--danger-soft); border-color: #f2c9c6; color: #a53229; }
.tag.brand { background: var(--brand-soft); border-color: #ccd4fb; color: #2f3fae; }

/* 表格 */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.shots { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
table.shots th {
  position: sticky; top: 0; z-index: 2;
  background: #f7f8fb; text-align: left; font-weight: 600; color: var(--ink-2);
  padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.shots td { padding: 6px 6px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
table.shots tr:hover td { background: #fbfcff; }
table.shots input, table.shots select, table.shots textarea {
  padding: 5px 7px; font-size: 12px; border-radius: 6px; border-color: #e7eaf2;
}
table.shots td.no { font-weight: 600; color: var(--ink-2); text-align: center; }
table.shots td.act { white-space: nowrap; }

/* ---------- 分镜脚本：一镜一页 ---------- */
.sb-pager {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(90deg, #f8f9ff, #fdfbf7);
}
.sb-dots { display: flex; gap: 5px; flex: 1 1 260px; flex-wrap: wrap; max-height: 70px; overflow-y: auto; }
.sb-dot {
  min-width: 28px; height: 28px; padding: 0 6px;
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.sb-dot:hover { border-color: var(--brand); color: var(--brand); }
.sb-dot.done { background: var(--ok-soft); border-color: #c7ecda; color: var(--ok); }
.sb-dot.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(68,87,214,.3); }
.sb-pos { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.sb-pos b { color: var(--brand); font-size: 14px; }

.sb-page {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background: linear-gradient(180deg, #fcfcff, #fff 120px);
  box-shadow: var(--shadow);
}
.sb-page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sb-no {
  flex: 0 0 auto; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: #fff;
  background: linear-gradient(135deg, #d1801a, #f2b64c);
  padding: 7px 12px; border-radius: 8px;
}
.sb-page-head h4 { margin: 0; font-size: 15.5px; font-weight: 700; }
.sb-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.sb-visual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.sb-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #f4f6fb;
}
.sb-frame-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.sb-ph::before {
  content: ''; position: absolute; inset: 12px;
  border: 1px solid rgba(255,255,255,.32); border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.sb-ph::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.09) 22px 23px),
              repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.09) 22px 23px);
}
.sb-ph svg { width: 30px; height: 30px; opacity: .85; z-index: 1; }
.sb-ph-no { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; opacity: .9; z-index: 1; }
.sb-ph-tx { font-size: 11px; opacity: .9; z-index: 1; }
.sb-cap {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  font-size: 10.5px; padding: 2px 9px; border-radius: 999px;
  background: rgba(12,18,38,.66); color: #fff;
}
.sb-cap b { opacity: .65; font-weight: 500; margin-left: 3px; }

/* 分镜脚本：本镜首尾帧操作条 + 生成中遮罩 */
.sb-visual-wrap { position: relative; margin-bottom: 12px; }
.sb-visual-wrap .sb-visual { margin-bottom: 0; }
.sb-frame-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(135deg, #fffaf2, #fff);
}
.sfb-t { flex: 1 1 190px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sfb-t b { font-size: 12.5px; }
.sfb-t span { font-size: 10.5px; color: var(--ink-3); }

.sb-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sb-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.sb-group h5 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sb-group h5::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: var(--brand); }
.sb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.sb-fld { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 9px; }
.sb-fld > span { display: block; margin-bottom: 4px; }
.sb-fld input, .sb-fld select, .sb-fld textarea {
  width: 100%; padding: 6px 8px; font-size: 12.5px; color: var(--ink);
  border: 1px solid #e3e7f1; border-radius: 7px; background: #fcfdff;
}
.sb-fld input:focus, .sb-fld select:focus, .sb-fld textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(68,87,214,.1);
}
.sb-fld textarea { resize: vertical; line-height: 1.55; }
.sb-static { padding: 6px 8px; font-size: 12.5px; color: var(--ink-2); background: #f7f8fb; border: 1px dashed var(--line); border-radius: 7px; }
.sb-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--ink-3);
}
.sb-tip { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); text-align: center; }

@media (max-width: 1180px) {
  .sb-form { grid-template-columns: 1fr; }
  .sb-visual { grid-template-columns: 1fr; }
}

/* 角色卡 */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.char-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px; background: #fff; }
.char-card h4 { margin: 0 0 2px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.char-card .role { font-size: 11px; color: var(--ink-3); }
.char-card dl { margin: 10px 0 0; display: grid; grid-template-columns: 62px 1fr; gap: 4px 8px; font-size: 12px; }
.char-card dt { color: var(--ink-3); }
.char-card dd { margin: 0; color: var(--ink-2); }

.sheet-preview { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet-preview img, .frame-img, .clip-video { width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #f7f8fb; display: block; }
.sheet-cell { position: relative; }

/* 帧 / 片段卡 */
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.shot-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.shot-card .sc-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.shot-card .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shot-card .cap { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }

/* 日志 */
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.log-item { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.log-item .t { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 11px; }

/* 抽屉 */
.drawer {
  position: fixed; top: 58px; right: 0; bottom: 0; width: 380px;
  background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(23,33,61,.07);
  display: flex; flex-direction: column; z-index: 40;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.job-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 12.5px; }
.job-item .jh { display: flex; justify-content: space-between; gap: 8px; }
.job-item .jp { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; }
.bar { height: 5px; border-radius: 999px; background: #eef1f6; margin-top: 7px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.bar.ok > i { background: var(--ok); }
.bar.err > i { background: var(--danger); }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(20, 26, 45, .38);
  display: grid; place-items: center; z-index: 60; padding: 24px;
}
.modal-card {
  background: #fff; border-radius: 14px; width: 520px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(20,26,45,.25);
}
.modal-card.wide { width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow: auto; }

.tabs { display: flex; gap: 6px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: transparent; padding: 8px 10px; cursor: pointer;
  font-size: 13px; color: var(--ink-2); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.provider { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.provider .pv-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.provider .pv-name { font-weight: 600; font-size: 13.5px; }
.provider .pv-meta { font-size: 11.5px; color: var(--ink-3); }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  background: #232b3f; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(20,26,45,.2); max-width: 620px;
}
.toast.err { background: #b23a31; }
.toast.ok { background: #167a56; }

.spin {
  width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .stages { grid-template-columns: repeat(3, 1fr); }
  .grid2, .row2 { grid-template-columns: 1fr; }
}

/* ==================== 三大模块外壳（左侧主菜单） ==================== */

.shell { flex: 1; display: flex; min-height: 0; }

.rail {
  width: 104px; flex: 0 0 auto;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 12px 8px;
  gap: 4px;
}
.rail-label {
  font-size: 10.5px; color: var(--ink-3);
  padding: 8px 10px 4px; letter-spacing: .08em;
}
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 10px 4px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background .15s, color .15s, border-color .15s;
}
.rail-item:hover { background: #f6f8fc; }
.rail-item.active { background: var(--brand-soft); color: var(--brand); border-color: #d8dffb; font-weight: 600; }
.rail-item .ri-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: #f1f4fa; color: var(--ink-2);
  font-size: 13px; font-weight: 600;
}
.rail-item.active .ri-ico { background: var(--brand); color: #fff; }
.rail-item .ri-txt { line-height: 1.2; }
.rail-item.mini { font-size: 11.5px; }
.rail-foot { margin-top: auto; }

.shell-body { flex: 1; min-width: 0; display: flex; min-height: 0; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.view.hidden { display: none !important; }

/* ==================== 创作面板（图片 / 视频） ==================== */

.studio {
  flex: 1;
  display: grid;
  grid-template-columns: 384px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 20px 20px;
  min-height: 0;
}

.studio-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: auto;
}
.sf-head h2 { margin: 0 0 4px; font-size: 17px; }
.sf-head p { margin: 0 0 14px; color: var(--ink-3); font-size: 12px; line-height: 1.6; }

.mode-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: #f5f7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
}
.mode-tab {
  flex: 1 1 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.mode-tab:hover { background: #fff; }
.mode-tab.active { background: #fff; color: var(--brand); font-weight: 600; border-color: #d8dffb; box-shadow: 0 1px 2px rgba(23,33,61,.06); }
.mode-tab.unsupported { color: var(--ink-3); }
.mode-tab .dot {
  position: absolute; top: 5px; right: 5px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--warn);
}

.field { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.field > b { color: var(--ink); font-weight: 600; }
.field textarea, .field input, .field select { margin-top: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field input[type="range"] { padding: 0; border: none; background: transparent; box-shadow: none; }

.adv { margin: 4px 0 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.adv summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.adv summary:hover { color: var(--brand); }

.ref-wrap { margin-bottom: 12px; }
.ref-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.ref-head > span:first-child { flex: 0 0 auto; white-space: nowrap; }
.hint-inline { font-size: 11px; color: var(--ink-3); line-height: 1.55; }
.ref-head .hint-inline { flex: 1 1 auto; text-align: right; }
.ref-slots { display: flex; gap: 10px; flex-wrap: wrap; }
.ref-slot {
  width: 104px; height: 104px;
  border-radius: 10px;
  border: 1px dashed #cfd6e6;
  background: #fafbfe;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  font-size: 11.5px; color: var(--ink-3);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding: 0;
}
.ref-slot:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.ref-slot .plus { font-size: 20px; line-height: 1; }
.ref-slot.filled { border-style: solid; border-color: var(--line); background: #0e1220; cursor: default; }
.ref-slot img { width: 100%; height: 100%; object-fit: cover; }
.ref-slot .ref-tag {
  position: absolute; left: 0; bottom: 0; right: 0;
  background: rgba(14,18,32,.62); color: #fff;
  font-size: 10.5px; padding: 2px 6px;
}
.ref-slot .ref-del {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(14,18,32,.7); color: #fff;
  cursor: pointer; line-height: 1; font-size: 13px;
}

.hint.left { text-align: left; margin: 10px 0 0; line-height: 1.6; }
.warn-text { color: var(--warn); }

/* ---------- 结果区 ---------- */

.studio-stage {
  min-width: 0;
  overflow: auto;
  padding-right: 2px;
}
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stage-head h3 { margin: 0; font-size: 16px; }
.stage-head .sub { color: var(--ink-3); font-size: 12px; margin-top: 3px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 14px;
}
.rcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.rc-media {
  background: #0e1220;
  aspect-ratio: 3 / 4;
  display: grid; place-items: center;
  overflow: hidden;
  position: relative;
}
.rc-media img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.rc-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* 参考图角标：缩在右下角，点开看大图，方便对照「原图 vs 结果」 */
.rc-ref {
  position: absolute; right: 8px; bottom: 8px; width: 62px; height: 62px;
  padding: 0; border: 2px solid rgba(255,255,255,.85); border-radius: 8px;
  overflow: hidden; cursor: zoom-in; background: #000;
  box-shadow: 0 4px 12px rgba(0,0,0,.45);
}
.rc-ref img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.rc-ref span {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; line-height: 14px;
  text-align: center; color: #fff; background: rgba(0,0,0,.55);
}
.rc-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #c8d1fb; font-size: 12.5px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(200,209,251,.25);
  border-top-color: #8ea0f5;
  animation: spin .8s linear infinite;
}
.rc-fail { padding: 14px; color: #ffd9d4; font-size: 11.5px; line-height: 1.6; display: flex; flex-direction: column; gap: 6px; }
.rc-fail b { color: #ff9c90; font-size: 12.5px; }
.rc-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 7px; }
.rc-prompt {
  font-size: 12.5px; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 10.5px; color: var(--ink-3); }
.rc-model { font-size: 10.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-actions .btn { text-decoration: none; }

.empty-result {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-3);
  display: flex; flex-direction: column; gap: 6px;
}
.empty-result b { color: var(--ink-2); font-size: 14px; }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(10,14,24,.86);
  display: grid; place-items: center;
  padding: 32px;
}
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.14); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.lb-close:hover { background: rgba(255,255,255,.26); }

/* ---------- 执行状态 ---------- */
.btn.is-busy,
button.is-busy {
  opacity: .72;
  cursor: progress;
  pointer-events: none;
}
.btn.is-busy .spin,
button.is-busy .spin {
  border-color: rgba(28, 35, 51, .22);
  border-top-color: var(--brand);
  margin-right: 6px;
  vertical-align: -2px;
}
.btn.primary.is-busy .spin,
.btn.danger.is-busy .spin {
  border-color: rgba(255, 255, 255, .38);
  border-top-color: #fff;
}

.global-busy {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  z-index: 200;
  display: flex; align-items: center; gap: 8px;
  background: #232b3f; color: #fff;
  padding: 8px 16px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(20, 26, 45, .28);
  animation: busyIn .16s ease-out;
}
.global-busy .spin { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.global-busy .tip { color: rgba(255, 255, 255, .58); font-size: 11.5px; }
@keyframes busyIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast.warn { background: #a5640a; }

@media (max-width: 1180px) {
  .studio { grid-template-columns: 1fr; overflow: auto; }
  .studio-form { overflow: visible; }
  .rail { width: 84px; }
  .rail-item .ri-txt { font-size: 11px; }
}


/* ==================== 多用户：账号 / 后台管理 ==================== */

.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font: inherit; color: var(--ink);
}
.user-chip:hover { border-color: #cfd6e6; background: #f7f8fb; }
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.user-chip .user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip .user-meta b { font-size: 12.5px; font-weight: 600; }
.user-chip .user-meta span { font-size: 10.5px; color: var(--ink-3); }

.admin-wrap { flex: 1; display: flex; min-height: 0; }
.admin-side {
  width: 210px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 10px;
}
.as-head { display: flex; flex-direction: column; gap: 2px; padding: 0 6px 8px; border-bottom: 1px solid var(--line); }
.as-head strong { font-size: 14px; }
.as-head span { font-size: 11.5px; color: var(--ink-3); }
.admin-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.an-item {
  text-align: left; padding: 9px 11px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.an-item:hover { background: #f6f8fc; }
.an-item.active { background: var(--brand-soft); color: var(--brand); border-color: #d8dffb; font-weight: 600; }
.as-foot {
  margin-top: auto; font-size: 11px; color: var(--ink-3); line-height: 1.55;
  padding: 10px 6px 0; border-top: 1px solid var(--line);
}

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.admin-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 24px 12px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.admin-head h2 { font-size: 16px; }
.admin-head p { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.admin-actions { display: flex; gap: 8px; }
.admin-body { flex: 1; overflow: auto; padding: 18px 24px 28px; }

.stat-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 11.5px; color: var(--ink-3); }

.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.user-row.off { opacity: .62; background: #fafbfd; }
.ur-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ur-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.ur-actions { display: flex; gap: 6px; flex-shrink: 0; }

.acct-info {
  display: flex; align-items: center; gap: 12px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.avatar.big {
  width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600;
}
.acct-title { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 8px; }

.project-item { position: relative; }
.project-item .pi-name { padding-right: 18px; }
.project-item .pi-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--ink-3);
  font-size: 15px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center; padding: 0;
  opacity: .5; transition: opacity .15s, background .15s, color .15s;
}
.project-item:hover .pi-del, .project-item.active .pi-del { opacity: 1; }
.project-item .pi-del:hover { background: var(--danger-soft); color: var(--danger); border-color: #f0cfcc; opacity: 1; }
.project-item .pi-del.is-busy { width: 20px; overflow: hidden; padding: 0; border-color: transparent; background: transparent; }
.project-item .pi-del.is-busy span:last-child { display: none; }

@media (max-width: 980px) {
  .admin-side { width: 150px; }
  .admin-body { padding: 14px; }
  .user-row { flex-direction: column; align-items: flex-start; }
}


/* ==================== 场景设定 / 场景设计图 ==================== */

.par-line {
  margin-top: 6px; font-size: 11.5px; color: var(--brand);
  background: var(--brand-soft); border: 1px solid #d8dffb; border-radius: 6px;
  padding: 3px 8px; display: inline-block;
}

.scene-list { display: flex; flex-direction: column; gap: 12px; }
.scene-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.scene-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.scene-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.scene-cell { font-size: 11.5px; color: var(--ink-2); max-width: 90px; }

@media (max-width: 980px) {
  .scene-grid { grid-template-columns: 1fr; }
}


/* ================= 故事创作：聊天打磨 ================= */
.story-wrap { display: flex; flex-direction: column; gap: 10px; }
.story-chat {
  flex: 0 0 auto; height: 42vh; min-height: 260px; max-height: 520px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.bubble { max-width: 78%; border-radius: 12px; padding: 9px 13px; font-size: 13px; }
.bubble.user { align-self: flex-end; background: var(--brand-soft); border: 1px solid #d8dfff; }
.bubble.ai  { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.bubble .who { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.bubble .txt { white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.bubble .draft-tag { margin-top: 6px; font-size: 11px; color: var(--ok); }
.story-draft {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; font-size: 12.5px;
}
.story-draft summary { cursor: pointer; color: var(--ink-2); }
.story-draft pre {
  white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
  font-size: 12px; color: var(--ink-2); margin: 8px 0 2px; line-height: 1.7;
}
.story-actions { margin: 0; }
.story-setup {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.story-input { display: flex; gap: 10px; align-items: flex-end; }
.story-input textarea { flex: 1; resize: vertical; min-height: 70px; }
.story-input .btn { height: 40px; }

/* 左右分栏：左边聊天打磨，右边创作结果 */
.story-split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 16px; align-items: stretch;
}
.story-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sp-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sp-head b { font-size: 13.5px; }
.sp-head .note { font-size: 11.5px; }
.sr-meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.story-left .story-chat {
  flex: 1 1 auto; height: auto; min-height: 320px; max-height: 56vh;
}
.sr-body {
  flex: 1 1 auto; min-height: 320px; max-height: 56vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.sr-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.85; color: var(--ink); }
.sr-empty {
  display: flex; flex-direction: column; gap: 6px; padding: 26px 10px;
  text-align: center; color: var(--ink-3); font-size: 12.5px;
}
.sr-empty b { font-size: 13.5px; color: var(--ink-2); }
.sr-extra {
  margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line);
  display: flex; flex-direction: column; gap: 7px;
}
.sr-line { display: flex; gap: 8px; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.sr-line b { flex: 0 0 62px; color: var(--ink-3); font-weight: 600; }
.sr-line span { flex: 1; word-break: break-word; }
.sr-fold { font-size: 12px; color: var(--ink-2); }
.sr-fold summary { cursor: pointer; color: var(--ink-3); }
.sr-fold pre {
  white-space: pre-wrap; word-break: break-word; font-size: 11.5px; line-height: 1.75;
  max-height: 220px; overflow: auto; margin: 6px 0 0; color: var(--ink-2);
}
.sr-actions { justify-content: flex-end; margin-top: 0; }

@media (max-width: 1120px) {
  .story-split { grid-template-columns: 1fr; }
  .story-left .story-chat, .sr-body { max-height: none; }
}

/* ================= 角色 / 场景：16:9 正反面翻转卡片 ================= */
.flip-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.flip-card { position: relative; aspect-ratio: 16 / 9; perspective: 1200px; }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .55s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.flip-back { transform: rotateY(180deg); }
.fc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; }
.fc-head .role { color: var(--ink-3); font-size: 11.5px; }
.fc-fields {
  flex: 1; overflow-y: auto; align-content: start;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; padding-right: 4px;
}
.fc-fields .field { font-size: 10.5px; margin-bottom: 2px; }
.fc-fields input, .fc-fields textarea { font-size: 11px; padding: 3px 6px; }
.flip-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.flip-back img {
  flex: 1; min-height: 0; width: 100%; object-fit: contain;
  background: var(--bg); border-radius: 6px;
}
.flip-back > .note { flex: 1; display: grid; place-items: center; }

/* ---------- 角色设计：顶部统一风格选择条 ---------- */
.char-style-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: linear-gradient(100deg, rgba(99,102,241,.10), rgba(56,189,248,.07));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.csb-t { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; min-width: 148px; }
.csb-t b { font-size: 13px; }
.csb-t .note { font-size: 10.5px; }
.csb-sel { flex: 0 0 260px; width: 260px; min-width: 0; height: 32px; padding: 4px 10px; font-size: 12.5px; }
.csb-hint { flex: 1 1 220px; min-width: 0; font-size: 11px; }

/* ---------- 角色设计：生成中遮罩（覆盖整卡，不参与 3D 翻转，拦截点击） ---------- */
.gen-overlay {
  position: absolute; inset: 0; z-index: 6; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  background: radial-gradient(circle at 50% 38%, rgba(28,36,68,.74), rgba(10,14,28,.92));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff; text-align: center; cursor: progress;
  animation: goFade .25s ease-out;
}
.go-ring {
  --p: 0;
  position: relative; width: 72px; height: 72px; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), rgba(255,255,255,.16) 0);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 24px rgba(0,0,0,.35);
  animation: goPulse 2.2s ease-in-out infinite;
}
.go-ring::before {
  content: ''; position: absolute; inset: 7px; border-radius: 50%;
  background: rgba(16,22,42,.95);
}
.go-ring::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.3);
  animation: goSpin 3.2s linear infinite;
}
.go-pct {
  position: relative; z-index: 1; font-size: 17px; font-weight: 700;
  letter-spacing: .5px; font-variant-numeric: tabular-nums;
}
.go-title { font-size: 14px; font-weight: 600; letter-spacing: .3px; }
.go-sub { font-size: 11.5px; color: rgba(255,255,255,.72); }
.go-tip { margin-top: 2px; font-size: 10.5px; color: rgba(255,255,255,.5); }
.go-bar {
  width: 62%; height: 6px; border-radius: 99px;
  background: rgba(255,255,255,.16); overflow: hidden;
}
.go-bar i {
  display: block; height: 100%; border-radius: 99px; position: relative;
  background: linear-gradient(90deg, var(--brand), #8b7bff);
  transition: width .4s ease;
}
.go-bar i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: goShine 1.4s linear infinite;
}
@keyframes goSpin  { to { transform: rotate(360deg); } }
@keyframes goPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes goShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes goFade  { from { opacity: 0; } to { opacity: 1; } }
.zoomable { cursor: zoom-in; }


/* ================= 分镜视频：首尾帧 → 视频 流水线 ================= */
.pipe-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow);
}
.pipe-card.running { border-color: var(--brand); }
.pipe-steps { display: flex; gap: 6px; margin: 8px 0 10px; }
.pipe-step {
  flex: 1; text-align: center; font-size: 11px; padding: 4px 2px; border-radius: 6px;
  background: var(--bg); color: var(--ink-3); border: 1px solid var(--line);
}
.pipe-step.done   { background: var(--ok-soft);   color: var(--ok);   border-color: #bfe8d5; }
.pipe-step.active { background: var(--warn-soft); color: var(--warn); border-color: #f0d9a8; }
.pipe-card .pair { margin-bottom: 8px; }
.pipe-card .clip-video { max-height: 170px; }

@media (max-width: 980px) {
  .flip-grid { grid-template-columns: 1fr; }
}

/* ---------------- 提示词助手：一键润色 / 按要求改写 ---------------- */
.pt-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.pt-btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 4px 11px; font-size: 11.5px; line-height: 1.5;
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 4px;
}
.pt-btn:hover:not(:disabled) { border-color: #c3cbf0; color: var(--brand); background: var(--brand-soft); }
.pt-btn:disabled { opacity: .55; cursor: not-allowed; }
.pt-btn[data-pt="polish"] { color: var(--brand); border-color: #d5dbf7; background: var(--brand-soft); }
.pt-btn[data-pt="undo"] { color: var(--ink-3); }
.pt-btn[hidden] { display: none; }
.pt-state { font-size: 11px; color: var(--ink-3); }
.pt-state.on { color: var(--brand); }

.rw-src {
  font-size: 11.5px; color: var(--ink-3); background: var(--bg); border: 1px dashed var(--line);
  border-radius: 8px; padding: 8px 10px; max-height: 78px; overflow: auto; line-height: 1.55;
}
.rw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.rw-chip {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; transition: all .15s;
}
.rw-chip:hover { border-color: #c3cbf0; color: var(--brand); background: var(--brand-soft); }
.rw-tip { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.6; }
.rw-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
