/* ============================================================
   峰影 · 漫剧画布 —— 视觉基调
   深色工作台：画布要退到背景里，节点是唯一的主角。
   ============================================================ */

:root {
  --bg:          #0b0d12;
  --bg-2:        #101319;
  --panel:       #151922;
  --panel-2:     #1a1f2a;
  --line:        #232936;
  --line-soft:   #1b202b;
  --ink:         #e8ecf4;
  --ink-2:       #9aa4b8;
  --ink-3:       #626d82;
  --accent:      #6d8cff;
  --accent-2:    #8f6dff;
  --ok:          #35c98a;
  --warn:        #ffb648;
  --bad:         #ff5f6d;
  --hot:         #ff7a59;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 15px;

  --shadow-1: 0 2px 8px rgba(0,0,0,.35);
  --shadow-2: 0 12px 40px rgba(0,0,0,.55);
  --glow:     0 0 0 1px rgba(109,140,255,.55), 0 8px 28px rgba(109,140,255,.18);

  --topbar-h: 52px;
  --dock-h:   200px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2a3141; border-radius: 6px; border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3a4358; background-clip: content-box; }

/* ══════════════════════════════ 顶栏 ══════════════════════════════ */

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  flex-wrap: nowrap; white-space: nowrap;
  background: linear-gradient(180deg, #12161e 0%, #0e121a 100%);
  border-bottom: 1px solid var(--line);
  z-index: 60;
  user-select: none;
}

.brand { display: flex; align-items: baseline; gap: 7px; padding-right: 4px; flex: none; white-space: nowrap; }
.logo {
  font-size: 17px; color: var(--accent);
  text-shadow: 0 0 14px rgba(109,140,255,.7);
  line-height: 1;
}
.brand-name { font-size: 13.5px; font-weight: 650; letter-spacing: .3px; white-space: nowrap; }
.brand-sub {
  font-size: 10px; color: var(--ink-3); letter-spacing: .8px;
  text-transform: uppercase; white-space: nowrap;
}

.tb-sep { width: 1px; height: 20px; background: var(--line); flex: none; }
.tb-spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); color: var(--ink);
  font-size: 12.5px; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .1s;
}
.btn:hover  { background: var(--panel-2); border-color: #2e3648; }
.btn:active { transform: translateY(1px); }
.btn.ghost  { background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,.045); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 3px 14px rgba(109,140,255,.3);
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.node-add {
  height: 28px; padding: 0 9px; font-size: 12px;
  color: var(--ink-2);
}
.node-add:hover { color: var(--ink); }

.caret { font-size: 9px; color: var(--ink-3); margin-left: 2px; }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); flex: none;
}
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.run-state {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-2);
  padding: 0 10px; height: 26px;
  border-radius: 13px; background: rgba(255,255,255,.03);
  max-width: 320px;
}
.run-state .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); flex: none;
}
.run-state.busy .pulse {
  background: var(--hot);
  animation: pulse 1.1s ease-in-out infinite;
}
.run-state.busy { color: var(--hot); background: rgba(255,122,89,.08); }
@keyframes pulse {
  0%,100% { opacity: 1;  transform: scale(1); }
  50%     { opacity: .35; transform: scale(1.35); }
}
#run-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zoom-box {
  display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; background: var(--panel);
}
.zbtn {
  width: 28px; height: 28px; border: 0; background: transparent;
  color: var(--ink-2); font-size: 14px; line-height: 1;
  display: grid; place-items: center;
}
.zbtn:hover { background: rgba(255,255,255,.06); color: var(--ink); }
/* 流水线模式没有撤销栈，按钮要灰掉——能点但没反应最坑人 */
.zbtn:disabled { opacity: .3; cursor: not-allowed; }
.zbtn:disabled:hover { background: transparent; color: var(--ink-2); }
.zbtn.zval { width: 50px; font-size: 11.5px; font-family: var(--mono); }

/* ══════════════════════════════ 画布 ══════════════════════════════ */

#viewport {
  position: fixed; inset: var(--topbar-h) 0 0 0;
  overflow: hidden; cursor: default;
  background: radial-gradient(1200px 700px at 50% 30%, #0f131b 0%, var(--bg) 70%);
}
#viewport.panning { cursor: grabbing; }
/* 拖文件进画布时给个明确的接收提示，不然用户不知道松手会不会生效 */
#viewport.drop-hot { box-shadow: inset 0 0 0 2px var(--accent); }
#viewport.drop-hot::after {
  content: '松手放到画布上';
  position: absolute; left: 50%; top: 22px; transform: translateX(-50%);
  padding: 6px 16px; border-radius: 999px; z-index: 60;
  background: var(--accent); color: #fff; font-size: 12px;
  pointer-events: none;
}

#grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.032) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 26px 26px, 26px 26px, 130px 130px, 130px 130px;
  background-position: 0 0;
  opacity: 1;
}

#world {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  /* will-change 交给 canvas.js 在缩放期间动态开关。
     常开着等于把整块画布钉死在一张纹理上，放大就是拉位图，图必糊。 */
}
#wires {
  position: absolute; top: 0; left: 0;
  overflow: visible; pointer-events: none;
  width: 1px; height: 1px;
}
#nodes { position: absolute; top: 0; left: 0; }

/* ---- 连线 ---- */
.wire {
  fill: none;
  stroke: #2f3a52;
  stroke-width: 1.6;
  transition: stroke .15s;
}
.wire.live {
  stroke: url(#grad-live);
  /* 节拍也拉稀了：原来 5 5 满屏跑，现在一个周期 20，速度不变 */
  stroke-dasharray: 7 13;
  animation: flow 2.1s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -40; } }
.wire.hot { stroke: var(--accent); stroke-width: 2.2; }
/* 连线上流动的光点：数据从源节点往目标流。
   dasharray 加起来 19，位移取 -38 正好两轮，接缝看不出来。 */
.wire-flow {
  fill: none;
  stroke: #6ec6ff;
  stroke-width: 1.9;
  stroke-linecap: round;
  /* 光点间距从 18 拉到 40。一个分镜组能连出几十条线，原来每 18px
     就有一个光点，满屏都在跑，眼睛落不到节点上。位移取 -80 正好两个
     周期，接缝看不出来；时长同步放大，流速和原来一样。 */
  stroke-dasharray: 4 36;
  opacity: .9;
  pointer-events: none;
  animation: wireflow 2.9s linear infinite;
}
.wire-flow.live { stroke: #b6f0ff; animation-duration: 1.6s; }
@keyframes wireflow { to { stroke-dashoffset: -80; } }

/* 收掉全部连线：分镜组一出就是几十个节点、几十条线压在画布上，
   想看清节点本身只能靠放大。左下角给一个一键收线的口子。 */
body.wires-off #wires { display: none; }

#wire-toggle {
  /* 挂在画布容器里，absolute 的 16px 就是画布内边距：自由模式下
     #viewport 左边有 214px 让给节点库抽屉，这一下正好落在抽屉右侧。 */
  position: absolute; left: 16px; bottom: 54px; z-index: 40;
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(18,24,36,.9);
  color: var(--ink-2); font-size: 17px; line-height: 1; cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color .15s, border-color .15s, opacity .15s;
}
#wire-toggle:hover { color: var(--accent); border-color: var(--accent); }
#wire-toggle.off { opacity: .45; }

/* ══════════════════════════════ 节点 ══════════════════════════════ */

.node {
  position: absolute;
  width: 300px;
  background: linear-gradient(180deg, #1a1f29 0%, #151a23 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  transition: box-shadow .16s, border-color .16s;
  overflow: hidden;
}
.node:hover { border-color: #313a4d; box-shadow: var(--shadow-2); }
.node.sel { border-color: rgba(109,140,255,.6); box-shadow: var(--glow); }
.node.dragging { transition: none; z-index: 999; }

.node-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  cursor: grab;
  user-select: none;
}
.node.dragging .node-head { cursor: grabbing; }
.node-head:active { cursor: grabbing; }

.node-icon {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px; flex: none;
  background: rgba(109,140,255,.14); color: var(--accent);
}
.node-icon.c-character { background: rgba(53,201,138,.14); color: var(--ok); }
.node-icon.c-shots     { background: rgba(255,182,72,.14); color: var(--warn); }
.node-icon.c-image     { background: rgba(143,109,255,.14); color: var(--accent-2); }
.node-icon.c-video     { background: rgba(255,122,89,.14); color: var(--hot); }
.node-icon.c-output    { background: rgba(53,201,138,.14); color: var(--ok); }

.node-title {
  font-size: 12.5px; font-weight: 600; letter-spacing: .2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.node-tag {
  font-size: 10px; color: var(--ink-3);
  font-family: var(--mono);
  flex: none;
}
.node-body { padding: 10px 11px 11px; max-height: 440px; overflow: hidden; }

.node-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 11px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0,0,0,.16);
}

.node-state {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--ink-3);
  font-family: var(--mono);
}
.node-state::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: none;
}
.node-state.s-done    { color: var(--ok); }
.node-state.s-running { color: var(--hot); }
.node-state.s-failed  { color: var(--bad); }

/* ---- 端口 ---- */
.port {
  position: absolute; width: 11px; height: 11px;
  border-radius: 50%; background: #2b3346;
  border: 2px solid #3d4761;
  top: 50%; transform: translateY(-50%);
  cursor: crosshair; z-index: 5;
  transition: background .14s, border-color .14s, transform .12s;
}
.port:hover { background: var(--accent); border-color: #a9bcff; transform: translateY(-50%) scale(1.28); }
.port.in  { left: -6px; }
.port.out { right: -6px; background: var(--accent); border-color: #8ea6ff; }

/* ---- 节点内部元素 ---- */
.n-textarea {
  width: 100%; min-height: 120px; max-height: 300px;
  resize: vertical;
  background: #0d1117; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 9px; font-size: 12px; line-height: 1.65;
  outline: none;
}
.n-textarea:focus { border-color: rgba(109,140,255,.55); }

.n-meta {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 11px; color: var(--ink-3);
  margin-bottom: 8px;
}
.n-meta b { color: var(--ink-2); font-weight: 500; font-family: var(--mono); }

.n-thumb {
  width: 100%; aspect-ratio: 9/16; max-height: 260px;
  object-fit: cover; border-radius: var(--r-sm);
  background: #0a0d12; display: block;
}
.n-thumb.wide { aspect-ratio: 16/9; }
.n-thumb-empty {
  width: 100%; aspect-ratio: 9/16; max-height: 260px;
  border: 1px dashed #2b3346; border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-3); font-size: 11px;
  background: repeating-linear-gradient(45deg, #0c1017, #0c1017 6px, #0e1219 6px, #0e1219 12px);
}

.n-avatars { display: flex; flex-wrap: wrap; gap: 7px; }
.n-avatar {
  width: 56px; text-align: center;
}
.n-avatar img {
  width: 56px; height: 56px; border-radius: 9px;
  object-fit: cover; background: #0a0d12;
  border: 1px solid var(--line);
  display: block;
}
.n-avatar .ph {
  width: 56px; height: 56px; border-radius: 9px;
  border: 1px dashed #2b3346; display: grid; place-items: center;
  color: var(--ink-3); font-size: 16px;
}
.n-avatar span {
  display: block; font-size: 10.5px; color: var(--ink-2);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.n-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.n-table th {
  text-align: left; color: var(--ink-3); font-weight: 500;
  padding: 4px 6px; border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
}
.n-table td {
  padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.028);
  color: var(--ink-2); vertical-align: middle;
}
.n-table tr:hover td { background: rgba(109,140,255,.055); }
.n-table td.id { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.n-table .pill {
  display: inline-block; padding: 1px 6px; border-radius: 9px;
  font-size: 10px; background: rgba(255,255,255,.06); color: var(--ink-2);
}
.pill.ok  { background: rgba(53,201,138,.16); color: var(--ok); }
.pill.run { background: rgba(255,122,89,.16); color: var(--hot); }
.pill.bad { background: rgba(255,95,109,.16); color: var(--bad); }
.pill.none{ background: rgba(255,255,255,.05); color: var(--ink-3); }

.n-scroll { max-height: 300px; overflow: auto; margin: -4px -6px; padding: 4px 6px; }

.n-progress {
  height: 3px; border-radius: 2px; background: #1e2534; overflow: hidden;
  margin-top: 8px;
}
.n-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}

.n-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══════════════════════════════ 空态 ══════════════════════════════ */

#empty-state {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  pointer-events: none;
}
#empty-state.show { display: flex; }
#empty-state > * { pointer-events: auto; }
.es-icon {
  font-size: 44px; color: #232b3c;
  text-shadow: 0 0 40px rgba(109,140,255,.2);
}
.es-title { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.es-desc  { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }

/* ── 自由画布：空白引导 ────────────────────────────────────────────
   容器本身不吃事件（pointer-events:none），只有按钮排可以点，
   这样空白处照样能拖拽平移、双击建节点。 */
#canvas-guide {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 30px; pointer-events: none; z-index: 4;
}
#canvas-guide.on { display: flex; }

.cg-tip {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--ink-3); letter-spacing: .02em;
  user-select: none;
}
.cg-ico { font-size: 15px; color: var(--accent); opacity: .75; }

.cg-row {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px; pointer-events: auto;
}
.cg-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 22px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--ink);
  font-family: inherit; font-size: 13.5px;
  transition: border-color .16s, background .16s, transform .12s, box-shadow .16s;
}
.cg-btn i { font-style: normal; font-size: 16px; line-height: 1; }
.cg-btn:hover {
  border-color: rgba(109,140,255,.65);
  background: var(--panel-2);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,.34);
}
.cg-btn:active { transform: translateY(0); }

/* ── 节点三段式：结果区 / 输入区 / 控制条 ───────────────────────────
   参数全部收进浮层，节点本体永远只有这三块，不会因为选项多而变胖。 */

.fb-result { padding: 10px; }
.fb-result:empty { display: none; }

.fb-zero {
  display: flex; flex-direction: column;
  align-items: center; padding: 16px 10px 10px;
}
.fb-zero-ico {
  font-size: 26px; line-height: 1; color: #2d3547;
  margin-bottom: 10px; user-select: none;
}
.fb-zero-txt {
  font-size: 11.5px; color: var(--ink-3);
  text-align: center; line-height: 1.55; margin-bottom: 2px;
}

.fb-out {
  max-height: 220px; overflow: auto;
  padding: 9px 10px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line-soft);
  font-size: 12px; line-height: 1.7; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}

.fb-input {
  position: relative;
  border-top: 1px solid var(--line-soft);
  padding: 9px 30px 8px 10px;
}
.fb-ta {
  display: block; width: 100%;
  border: 0; outline: 0; background: transparent; resize: none;
  color: var(--ink); font-family: inherit;
  font-size: 12.5px; line-height: 1.65;
  min-height: 40px; max-height: 100px; overflow-y: auto;
}
.fb-ta::placeholder { color: var(--ink-3); }
.node.free.tall .fb-ta { min-height: 120px; max-height: 120px; }

.fb-expand {
  position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-3); font-size: 13px; line-height: 1; cursor: pointer;
}
.fb-expand:hover { background: rgba(255,255,255,.07); color: var(--ink); }

.fb-bar {
  display: flex; align-items: center; gap: 6px;
  /* 普通节点（图片/视频/配音）这条就守着不换行：
     模型 chip 本来就有 max-width 收着，一 wrap 反而把「免费」顶到第二行。 */
  flex-wrap: nowrap;
  padding: 7px 8px;
  border-top: 1px solid var(--line-soft);
}
/* 分镜组那条工具条有七八个按钮，以前挤在一行里，
   「批量出图」被压成四个字竖排，看着像坏了 —— 让它整条换行，
   且每个 chip 一律不缩、不折行。 */
.fb-bar-g { flex-wrap: wrap; row-gap: 6px; }
.fb-bar-g > .fb-chip { flex: 0 0 auto; max-width: none; white-space: nowrap; }
/* 普通节点的 chip 也不能在自己肚子里折行 —— 「16:9 · 2K」被拆成
   两行比挤一点更难看。宽度靠 .fb-chip 的 max-width 和 span 的省略号收。 */
.fb-bar > .fb-chip { white-space: nowrap; overflow: hidden; }
.fb-gap { flex: 1 1 auto; }

.fb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 58%; padding: 5px 9px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11px; line-height: 1.2;
  transition: border-color .14s, color .14s, background .14s;
}
.fb-chip:hover { border-color: rgba(109,140,255,.55); color: var(--ink); background: rgba(109,140,255,.06); }
.fb-chip i { font-style: normal; font-size: 11px; opacity: .8; }
.fb-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-chip em { font-style: normal; font-size: 9px; opacity: .55; margin-left: 1px; }

.fb-cost { font-size: 11px; color: var(--ink-3); white-space: nowrap; user-select: none; }
/* 生成按钮里的价钱小字：免费的低调，要花钱的挑出来 */
.fb-chip .fb-p { font-style: normal; font-size: 10px; margin-left: 4px;
  opacity: .6; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.fb-chip .fb-p.paid { color: #e0a13c; opacity: .95; }

.fb-send {
  flex: 0 0 auto; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--ink); color: #0b0d12;
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .14s, transform .1s;
}
.fb-send:hover { background: #fff; }
.fb-send:active { transform: scale(.94); }
.fb-send:disabled { opacity: .45; cursor: default; }

/* 脚本生成器的主按钮。
   这条链路不自动跑，按钮就得是个带字的真按钮 ——
   一个 ↑ 图标说明不了「点我才开始跑」，用户会一直坐等。 */
.fb-send-run {
  flex: 0 0 auto; height: 26px; padding: 0 12px;
  border: 0; border-radius: 7px; cursor: pointer;
  background: linear-gradient(180deg, #4f8dff, #2f6fe0);
  color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: filter .14s, transform .1s;
}
.fb-send-run:hover { filter: brightness(1.1); }
.fb-send-run:active { transform: scale(.96); }
.fb-send-run:disabled { opacity: .5; cursor: default; filter: none; }

/* 跑起来之后按钮换成停止。
   出图二十秒、出视频十几分钟，中途发现提示词写错只能干等最难受。
   红色是要让人一眼看出「这是刹车，不是加速」。 */
.fb-send-stop {
  flex: 0 0 auto; height: 26px; padding: 0 11px;
  border: 1px solid rgba(255, 90, 90, .55); border-radius: 7px; cursor: pointer;
  background: rgba(255, 76, 76, .16); color: #ff7a7a;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: background .14s, transform .1s;
}
.fb-send-stop:hover { background: rgba(255, 76, 76, .3); color: #ff9a9a; }
.fb-send-stop:active { transform: scale(.96); }

/* ── 浮层：模型列表 / 设置面板 ───────────────────────────────────── */
.fb-pop {
  position: fixed; left: 0; top: 0;
  display: none; z-index: 880;
  min-width: 210px; max-width: 300px;
  padding: 5px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(22,25,33,.985);
  box-shadow: 0 16px 44px rgba(0,0,0,.62);
}
.fb-pop.on { display: block; }

.fb-pop-h { font-size: 10.5px; color: var(--ink-3); padding: 8px 9px; }

.fb-pop-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 9px; cursor: pointer;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-family: inherit; font-size: 12px;
  text-align: left; transition: background .12s, color .12s;
}
.fb-pop-item:hover { background: rgba(255,255,255,.06); color: var(--ink); }
.fb-pop-item.sel { background: rgba(109,140,255,.15); color: var(--ink); }
.fb-pop-item[disabled] { opacity: .38; cursor: default; }
.fb-pop-item[disabled]:hover { background: transparent; color: var(--ink-2); }
.fb-pop-item i { font-style: normal; font-size: 13px; width: 15px; text-align: center; flex: 0 0 auto; }
.fb-pop-item span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-pop-item em {
  flex: 0 0 auto; font-style: normal;
  font-size: 10px; color: var(--ink-3);
  padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,.06);
}
.fb-pop-item em.off { background: rgba(255,95,109,.14); color: var(--bad); }

.fb-set-g { padding: 7px 6px; }
.fb-set-g + .fb-set-g { border-top: 1px solid var(--line-soft); }
.fb-set-l { font-size: 10.5px; color: var(--ink-3); margin-bottom: 7px; }
.fb-seg { display: flex; flex-wrap: wrap; gap: 5px; }
.fb-seg button {
  padding: 6px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11px;
  transition: border-color .12s, color .12s, background .12s;
}
.fb-seg button:hover { border-color: rgba(109,140,255,.5); color: var(--ink); }
.fb-seg button.sel {
  border-color: var(--accent); color: var(--ink);
  background: rgba(109,140,255,.14);
}

/* ── 选中节点上方的浮动工具条 ────────────────────────────────────── */
.node-tools {
  position: fixed; left: 0; top: 0;
  display: none; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 11px;
  background: rgba(22,25,33,.97);
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  z-index: 860;
}
.node-tools.on { display: flex; }
.node-tools button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 10px; border-radius: 7px;
  color: var(--ink-2); font-family: inherit; font-size: 11.5px;
  white-space: nowrap; transition: background .14s, color .14s;
}
.node-tools button:hover { background: rgba(255,255,255,.07); color: var(--ink); }
.node-tools button.danger:hover { background: rgba(255,95,109,.15); color: var(--bad); }

/* ── 节点空态模板 ─────────────────────────────────────────────────── */
.fb-try {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.fb-try-h {
  font-size: 10.5px; color: var(--ink-3);
  margin-bottom: 6px; user-select: none;
}
.fb-try-i {
  display: block; width: 100%; text-align: left; cursor: pointer;
  margin-bottom: 5px; padding: 6px 9px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11.5px; line-height: 1.4;
  transition: border-color .14s, color .14s, background .14s;
}
.fb-try-i:hover {
  border-color: rgba(109,140,255,.5);
  background: rgba(109,140,255,.07);
  color: var(--ink);
}
.fb-try-i:last-child { margin-bottom: 0; }

.hint {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 11px; color: #3d4658;
  pointer-events: none; user-select: none;
}

/* ══════════════════════════════ 属性面板 ══════════════════════════════ */

.inspector {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0;
  width: 340px; background: var(--bg-2);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  z-index: 50; display: flex; flex-direction: column;
}
.inspector.open { transform: translateX(0); }

.insp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600;
}
.insp-body { flex: 1; overflow: auto; padding: 13px; }
.insp-empty { color: var(--ink-3); font-size: 12px; text-align: center; padding: 30px 0; }

.xbtn {
  width: 24px; height: 24px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3); font-size: 17px;
  line-height: 1; display: grid; place-items: center;
}
.xbtn:hover { background: rgba(255,255,255,.07); color: var(--ink); }

.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 11px; color: var(--ink-3);
  margin-bottom: 5px; letter-spacing: .3px;
}
.field input[type=text],
.field input[type=number],
.field textarea,
.field select {
  width: 100%; background: #0d1117; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 7px 9px; font-size: 12px; outline: none;
}
.field textarea { min-height: 78px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(109,140,255,.55);
}
.field .row { display: flex; gap: 7px; }
.field .row > * { flex: 1; }

.switch {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 12px; color: var(--ink-2);
}
.switch input { width: 34px; height: 18px; appearance: none;
  background: #232b3a; border-radius: 9px; position: relative;
  cursor: pointer; outline: none; transition: background .16s; flex: none; }
.switch input:checked { background: var(--accent); }
.switch input::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; top: 2px; left: 2px;
  transition: transform .16s;
}
.switch input:checked::after { transform: translateX(16px); }

/* ══════════════════════════════ 底部任务坞 ══════════════════════════════ */

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(14,18,26,.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 55;
  display: flex; flex-direction: column;
  transition: height .2s;
  height: 42px;
}
.dock.open { height: var(--dock-h); }

.dock-head {
  display: flex; align-items: center; gap: 9px;
  padding: 0 13px; height: 41px; flex: none;
  cursor: pointer; user-select: none;
}
.dock-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.dock-badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: rgba(109,140,255,.2);
  color: var(--accent); font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
  font-family: var(--mono);
}
.dock-msg {
  font-size: 11.5px; color: var(--ink-3);
  font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 46vw;
}
.dock-toggle { color: var(--ink-3); font-size: 11px; transition: transform .2s; }
.dock.open .dock-toggle { transform: rotate(180deg); }

.dock-body {
  flex: 1; overflow: auto; padding: 0 13px 13px;
  display: none;
}
.dock.open .dock-body { display: block; }

.job-list { display: flex; flex-direction: column; gap: 7px; }
.job-empty { color: var(--ink-3); font-size: 12px; padding: 18px 0; text-align: center; }

.job {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel); padding: 9px 11px;
}
.job-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px;
}
.job-title { font-size: 12px; font-weight: 550; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-time { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }
.job-msg {
  font-size: 11.5px; color: var(--ink-2); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-bar { height: 3px; border-radius: 2px; background: #1e2534; margin-top: 7px; overflow: hidden; }
.job-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s;
}
.job.done .job-bar i { background: var(--ok); }
.job.failed .job-bar i { background: var(--bad); }
.job-log {
  margin-top: 7px; max-height: 90px; overflow: auto;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  line-height: 1.55; white-space: pre-wrap;
  border-top: 1px solid var(--line-soft); padding-top: 6px;
}
.job-x {
  border: 0; background: transparent; color: var(--ink-3);
  font-size: 11px; padding: 2px 6px; border-radius: 5px;
}
.job-x:hover { background: rgba(255,95,109,.14); color: var(--bad); }

/* ══════════════════════════════ 弹层 / 模态 ══════════════════════════════ */

.popover {
  position: fixed; top: calc(var(--topbar-h) + 6px); left: 150px;
  width: 330px; max-height: 60vh;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  z-index: 80; display: none; flex-direction: column; overflow: hidden;
}
.popover.show { display: flex; }
.pop-head {
  padding: 10px 13px; font-size: 11px; color: var(--ink-3);
  border-bottom: 1px solid var(--line); letter-spacing: .4px;
}
.pop-list { overflow: auto; padding: 5px; flex: 1; }
.pop-foot { padding: 8px; border-top: 1px solid var(--line); }

.pop-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--r-sm);
  cursor: pointer; transition: background .12s;
}
.pop-item:hover { background: rgba(255,255,255,.05); }
.pop-item.cur { background: rgba(109,140,255,.13); }
.pop-item .pi-main { flex: 1; min-width: 0; }
.pop-item .pi-title {
  font-size: 12.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pop-item .pi-sub {
  font-size: 10.5px; color: var(--ink-3); font-family: var(--mono);
  margin-top: 2px;
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 100; display: none;
  align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }

.modal {
  width: 480px; max-width: 92vw; max-height: 86vh;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide { width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.modal-body { padding: 16px; overflow: auto; flex: 1; }
.modal-foot {
  padding: 11px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
}

.toast-wrap {
  position: fixed; right: 16px; bottom: 58px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
}
.toast {
  padding: 9px 14px; border-radius: var(--r-md);
  background: #1d2431; border: 1px solid var(--line);
  color: var(--ink); font-size: 12px;
  box-shadow: var(--shadow-2);
  animation: toastIn .22s ease;
  max-width: 380px;
}
.toast.ok  { border-color: rgba(53,201,138,.4); }
.toast.bad { border-color: rgba(255,95,109,.45); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- 通用 ---- */
.mono { font-family: var(--mono); }
.dim  { color: var(--ink-3); }
.spin {
  display: inline-block; width: 10px; height: 10px;
  border: 1.5px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ------------------------------------------------------------ 集数下拉 */
.ep-sel {
  height: 21px; padding: 0 5px; font-size: 11px; line-height: 1;
  background: #131822; color: var(--ink);
  border: 1px solid var(--line); border-radius: 5px;
  max-width: 168px; cursor: pointer; outline: none;
  font-family: inherit;
}
.ep-sel:hover { border-color: var(--accent-dim, #3a4560); }
.ep-sel:focus { border-color: var(--accent); }
.ep-sel option { background: #131822; color: var(--ink); }

/* ============================================================
   账号 / 登录
   ============================================================ */

.auth-gate {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2138 0%, #0b0d12 55%, #07080c 100%);
  backdrop-filter: blur(2px);
}
.auth-gate[hidden] { display: none; }

.auth-card {
  width: 372px; padding: 30px 30px 24px;
  background: linear-gradient(180deg, #171c27 0%, #12161f 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  animation: authIn .28s ease-out;
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.auth-logo {
  font-size: 30px; line-height: 1; text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-title {
  margin-top: 10px; text-align: center;
  font-size: 17px; font-weight: 650; letter-spacing: .5px;
}
.auth-sub {
  margin-top: 5px; margin-bottom: 20px; text-align: center;
  font-size: 12px; color: var(--ink-3);
}

.auth-tabs {
  display: flex; gap: 4px; padding: 3px; margin-bottom: 16px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.auth-tab {
  flex: 1; padding: 7px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); font-size: 12.5px;
  transition: all .16s;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active {
  background: var(--panel-2); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.auth-field { display: block; margin-bottom: 13px; }
.auth-field > span {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; color: var(--ink-3); letter-spacing: .3px;
}
.auth-field input {
  width: 100%; padding: 9px 11px;
  background: #0d1016; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109,140,255,.13);
}
.auth-field input::placeholder { color: #4a5364; }

.auth-err {
  min-height: 17px; margin-bottom: 9px;
  font-size: 12px; color: var(--bad);
}
.auth-foot {
  margin-top: 14px; text-align: center;
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
}

/* ============================================================
   模式切换 / 用户区
   ============================================================ */

.mode-switch {
  display: flex; gap: 3px; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.mode-btn {
  padding: 5px 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-3);
  font-size: 12px; white-space: nowrap; transition: all .16s;
}
.mode-btn:hover { color: var(--ink-2); }
.mode-btn.active {
  background: linear-gradient(135deg, rgba(109,140,255,.22), rgba(143,109,255,.18));
  color: var(--ink); box-shadow: inset 0 0 0 1px rgba(109,140,255,.4);
}

.user-btn { gap: 7px; max-width: 168px; }
.user-btn .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 10.5px; font-weight: 700; flex: none;
}
.user-btn #user-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pop-item {
  display: block; width: 100%; padding: 9px 12px;
  border: 0; border-radius: var(--r-sm); text-align: left;
  background: transparent; color: var(--ink-2); font-size: 12.5px;
  transition: background .13s, color .13s;
}
.pop-item:hover { background: var(--panel-2); color: var(--ink); }
.pop-item.danger:hover { background: rgba(255,95,109,.13); color: var(--bad); }

/* ============================================================
   右键菜单
   ============================================================ */

.ctx-menu {
  position: fixed; z-index: 8000; display: none;
  min-width: 186px; padding: 5px;
  background: #161b25;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  animation: ctxIn .12s ease-out;
}
.ctx-menu.open { display: block; }
@keyframes ctxIn {
  from { opacity: 0; transform: scale(.97) translateY(-3px); }
  to   { opacity: 1; transform: none; }
}

.ctx-label {
  padding: 6px 10px 5px;
  font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--ink-3);
}
.ctx-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 10px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2);
  font-size: 12.5px; text-align: left; white-space: nowrap;
  transition: background .12s, color .12s;
}
.ctx-item:hover { background: var(--panel-2); color: var(--ink); }
.ctx-item.danger { color: #ff8b95; }
.ctx-item.danger:hover { background: rgba(255,95,109,.14); color: var(--bad); }
.ctx-item .ci-ico {
  width: 15px; flex: none; text-align: center; font-size: 12px; opacity: .85;
}
.ctx-item .ci-key {
  margin-left: auto; padding-left: 14px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
}
.ctx-item[disabled] { opacity: .38; pointer-events: none; }
.ctx-sep {
  height: 1px; margin: 4px 7px;
  background: var(--line-soft);
}

/* ============================================================
   LibTV 创作模式：自由节点
   ============================================================ */

body.mode-free #add-nodes { display: none; }
body.mode-free #hint::after { content: ""; }

.node.free {
  border-style: dashed;
  border-color: rgba(143,109,255,.42);
}
.node.free.selected {
  border-style: solid;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px rgba(143,109,255,.55), 0 10px 32px rgba(143,109,255,.22);
}
.node .node-tag {
  position: absolute; top: -9px; left: 10px;
  padding: 1px 6px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 9.5px; letter-spacing: .4px;
}

/* 自由模式下的节点库抽屉 */
#lib-drawer {
  position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 60;
  width: 214px; padding: 12px;
  background: #10141c; border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .2s ease;
  overflow-y: auto;
}
body.mode-free #lib-drawer { transform: none; }
body.mode-free #viewport { left: 214px; }
#lib-drawer .lib-title {
  margin: 4px 2px 9px; font-size: 10.5px; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-3);
}
.lib-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; margin-bottom: 4px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--panel); color: var(--ink-2);
  font-size: 12.5px; text-align: left; transition: all .14s;
}
.lib-item:hover {
  border-color: rgba(143,109,255,.5); color: var(--ink);
  background: var(--panel-2);
}
.lib-item .li-ico { font-size: 14px; }

/* ---- 自由节点内部 ---- */

.fb-textarea {
  width: 100%; min-height: 96px; max-height: 260px; resize: vertical;
  background: #0d1117; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 9px; font-size: 12px; line-height: 1.65; outline: none;
}
.fb-textarea:focus { border-color: rgba(143,109,255,.55); }
.fb-textarea::placeholder { color: #4a5364; }

.fb-media {
  width: 100%; max-height: 300px; object-fit: contain;
  border-radius: var(--r-sm); background: #0a0d12; display: block;
}
.fb-audio { width: 100%; margin-bottom: 8px; }

.fb-empty {
  height: 92px;
  border: 1px dashed #2b3346; border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-3); font-size: 11px; text-align: center; padding: 0 8px;
  background: repeating-linear-gradient(45deg, #0c1017, #0c1017 6px, #0e1219 6px, #0e1219 12px);
}

.fb-tools {
  display: flex; align-items: center; gap: 5px;
  padding: 0 11px 9px; flex-wrap: wrap;
}
.fb-sel {
  flex: 1; min-width: 0;
  padding: 5px 7px;
  background: #0d1117; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 11px; outline: none;
}
.fb-sel:focus { border-color: rgba(143,109,255,.5); }
.fb-ratio { flex: none; width: 68px; }
.fb-gen { flex: none; padding: 5px 13px; font-size: 11.5px; }

.fb-state { font-size: 11px; color: var(--ink-3); }
.fb-state.ok  { color: var(--ok); }
.fb-state.bad { color: var(--bad); }

.node.free .node-body { max-height: 430px; overflow: auto; }
.node.free .node-icon {
  background: rgba(143,109,255,.16); color: #b9a6ff;
}
.node.free .node-head { cursor: grab; }
.node.free.dragging .node-head { cursor: grabbing; }
/* ---- 设置面板分组标题 ---- */

.set-sec {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin: 18px 0 9px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  letter-spacing: .3px;
}
.set-sec:first-child { margin-top: 0; }

/* ---- [hidden] 兜底：display 显式声明会盖掉 UA 的 display:none ---- */
.auth-field[hidden],
.auth-pass2[hidden],
[hidden].auth-field { display: none !important; }

/* ---- 拉线手感：端口放大 + 热区 + 拖线时目标端口高亮 ---- */
/* .node 原来 overflow:hidden，会把伸在外面的端口和角标裁掉一半，改成 visible */
.node { overflow: visible; }
.node .node-head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.node .node-foot { border-radius: 0 0 var(--r-lg) var(--r-lg); }

.port {
  width: 13px; height: 13px;
  transition: background .14s, border-color .14s, transform .12s, box-shadow .14s;
}
.port::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
.port.out { right: -7px; box-shadow: 0 0 0 3px rgba(109,140,255,.12); }
.port.in  { left: -7px; }
.port:hover { transform: translateY(-50%) scale(1.35); box-shadow: 0 0 0 6px rgba(109,140,255,.2); }

/* 临时引导线：独立 overlay，屏幕坐标，拖多远都不会被裁 */
.link-overlay {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 900; overflow: visible; display: none;
}

/* 正在拉线时所有输入端口亮起来，明确告诉你往哪儿放 */
#viewport.linking { cursor: crosshair; }
#viewport.linking .port.in {
  background: rgba(109,140,255,.5);
  border-color: #a9bcff;
  box-shadow: 0 0 0 5px rgba(109,140,255,.16);
}
#viewport.linking .node:hover .port.in { transform: translateY(-50%) scale(1.45); }

/* 关闭注册时整组登录/注册标签收起（display:flex 会盖掉 UA 的 [hidden]） */
.auth-tabs[hidden] { display: none !important; }

/* 自由节点选中：紫框，一眼看出当前操作的是哪个（Delete 会删它） */
.node.free.sel {
  border-style: solid;
  border-color: rgba(143,109,255,.8);
  box-shadow: 0 0 0 1px rgba(143,109,255,.5), 0 10px 30px rgba(143,109,255,.2);
}

/* 上游参考图已经接进来时的视觉反馈 */
.fb-ref {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px dashed rgba(109,140,255,.45);
  border-radius: var(--r-md);
  background: rgba(109,140,255,.06);
}
.fb-ref img {
  width: 46px; height: 46px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex: 0 0 auto;
}
/* 视频节点三档的说明文字：一行灰字，别抢面板里控件的注意力 */
.fb-hint { margin: 2px 0 7px; font-size: 10.5px; line-height: 1.55; color: var(--ink-3); }
/* 首尾帧两张缩略图之间的箭头 */
.fb-ref-ar { font-style: normal; font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.fb-ref span {
  font-size: 11px;
  color: var(--accent);
  line-height: 1.45;
}
.fb-ref-tag {
  margin-top: 6px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--accent);
  background: rgba(109,140,255,.12);
  border: 1px solid rgba(109,140,255,.3);
}

/* ── 自由节点：正文区自己管布局 ────────────────────────────────────
父级那套 padding + 滚动条会把输入区和控制条挤出去，这里全部交回给节点自己。 */
.node.free .node-body { padding: 0; max-height: none; overflow: visible; }
.node.free .fb-state { display: block; margin-top: 6px; }

/* 空态里的模板列表不需要分隔线，它上面已经有一句说明了 */
.fb-zero .fb-try { border-top: 0; margin-top: 10px; padding-top: 0; width: 100%; }

/* 图片/视频贴边显示，别缩在 10px 内边距里像个卡片 */
.fb-result:has(.fb-media) { padding: 0; }
.fb-result:has(.fb-media) .fb-ref-tag { margin: 7px 10px 10px; }
.fb-result:has(.fb-media) .fb-state { margin: 7px 10px 10px; }


/* ── 分镜组：一个节点管一批镜头 ──────────────────────────────────────
格子用 auto-fill 而不是固定列数，节点被拉宽时自动多排一列，
不用再写一套响应式。 */
.node-sub {
  margin-left: auto; margin-right: 10px;
  font-size: 10px; color: var(--ink-3);
  user-select: none;
}

/* ── 折叠 / 停用 ────────────────────────────────────────────────────
节点一多，整块卡片会把画布塞满；搭长链路时更需要「只留标题」的视角。
停用则是「先别跑」的开关：整块变灰虚线，一眼看出这条链被掐了，
不是画布坏了。 */
.node-fold {
  flex: 0 0 auto; width: 18px; height: 18px; margin-left: 4px;
  display: grid; place-items: center;
  border: 0; border-radius: 5px; cursor: pointer;
  background: transparent; color: var(--ink-3);
  font-size: 11px; line-height: 1;
  transition: background .14s, color .14s;
}
.node-fold:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }

.node.folded .node-body,
.node.folded .fb-bar,
.node.folded .fb-steps,
.node.folded .fb-pg,
.node.folded .fb-film,
.node.folded .fb-ref-strip { display: none !important; }
.node.folded { min-height: 0; }

.node.free.muted { opacity: .55; border-style: dashed; }
.node.free.muted .node-title { text-decoration: line-through; }
.node.free.muted .fb-bar { filter: grayscale(1); }


.fb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
  padding: 10px;
  max-height: 430px;
  overflow: auto;
}

.fb-gc {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, .02);
  cursor: pointer;
  transition: border-color .14s;
}
.fb-gc:hover { border-color: rgba(109, 140, 255, .55); }
.fb-gc.run { border-color: rgba(109, 140, 255, .45); }
.fb-gc.bad { border-color: rgba(255, 95, 109, .45); }

.fb-gc-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 6px;
  background: rgba(255, 255, 255, .03);
  font-size: 9.5px; color: var(--ink-3);
  user-select: none;
}
.fb-gc-h b { color: var(--ink-2); font-weight: 600; }
.fb-gc-h em { font-style: normal; opacity: .8; }

.fb-gc-b {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  background: #0e1117;
}
.fb-gc-b img,
.fb-gc-b video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.fb-gc-ph { font-size: 9.5px; color: var(--ink-3); }
.fb-gc-ph.run { color: var(--accent); }
.fb-gc-ph.bad { color: var(--bad); }

/* 这一格用了谁的脸、在哪儿拍的。没有这行的话，用户看到一格空图
   根本分不清是缺人物图还是缺场景图。 */
.fb-gc-t {
  padding: 3px 6px;
  border-top: 1px solid var(--line-soft);
  font-size: 9px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: none;
}

/* 画面图出来了但视频还没出，压个角标，不然会以为白跑了 */
.fb-gc-badge {
  position: absolute; right: 4px; bottom: 4px;
  padding: 1px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, .62);
  font-size: 8.5px; color: #cfe0ff;
  pointer-events: none;
}

.fb-gc-empty {
  grid-column: 1 / -1;
  padding: 26px 10px;
  text-align: center;
  font-size: 11.5px; color: var(--ink-3);
}
/* 空组不能只是一行「还没有镜头」——那是死格子。
   给一个能立刻加镜的按钮，再给一句「或者接剧本节点」的指引。 */
.fb-addshot { margin-top: 9px; display: inline-block; }
.fb-gc-hint {
  display: block; margin-top: 8px;
  font-size: 10.5px; color: var(--ink-3); opacity: .75;
}

.fb-chip.fb-run {
  border-color: rgba(109, 140, 255, .5);
  background: rgba(109, 140, 255, .1);
  color: var(--ink);
}
.fb-chip.fb-run[disabled] { opacity: .55; cursor: default; }

/* 拆镜自动建出来的参考节点，标一下是人物还是场景。
   它就是个普通图片节点，出图、换模型、重新生成全都照常用。 */
.fb-cast-tag {
  margin-left: 6px; padding: 1px 5px;
  border-radius: 4px;
  background: rgba(109, 140, 255, .16);
  color: #9fb4ff;
  font-size: 9px;
  user-select: none;
}
.fb-cast-tag.sc {
  background: rgba(90, 200, 160, .16);
  color: #7fd8b4;
}

/* ── 分镜工作台 ────────────────────────────────────────────────────
整屏接管，因为它要装下一张 39 行的表。放在画布上面而不是弹窗里，
是因为改表的时候不该被底下的节点晃到眼。 */
#shot-board {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  background: #0b0d12;
  z-index: 900;
}
#shot-board.on { display: flex; }

/* 第二步的清单：认出了谁、各占几个镜头。这几个名字等下会变成画布上的
   节点，先让人扫一眼对不对得上，别等出完片才发现人被拆成了两个。 */
.sb-cast {
  flex: 0 0 auto;
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(109, 140, 255, .035);
}
.sb-cast-h {
  margin-bottom: 8px;
  font-size: 11.5px; color: var(--ink-3);
}
.sb-cast-row {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 7px;
}
.sb-cast-row:last-child { margin-bottom: 0; }
.sb-cast-k {
  flex: 0 0 34px;
  padding-top: 5px;
  font-size: 11px; color: var(--ink-3);
  user-select: none;
}
.sb-ci {
  display: inline-flex; align-items: baseline; gap: 6px;
  max-width: 300px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, .025);
}
.sb-ci.sc { border-color: rgba(90, 200, 160, .28); }
.sb-ci b { font-size: 12px; font-weight: 600; color: var(--ink); }
.sb-ci em {
  font-style: normal; font-size: 9.5px; color: var(--ink-3);
  padding: 0 4px; border-radius: 3px;
  background: rgba(255, 255, 255, .05);
}
.sb-ci i {
  font-style: normal; font-size: 10px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sb-head {
  display: flex; align-items: center; gap: 20px;
  flex: 0 0 auto;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.sb-tit { display: flex; align-items: baseline; gap: 8px; }
.sb-tit b { font-size: 15px; font-weight: 600; }
.sb-tit span { font-size: 11.5px; color: var(--ink-3); }

.sb-steps { display: flex; align-items: center; gap: 6px; }
.sb-step {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11.5px;
  transition: border-color .14s, background .14s, color .14s;
}
.sb-step:hover { border-color: rgba(109, 140, 255, .5); color: var(--ink); }
.sb-step i {
  font-style: normal;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px;
  background: rgba(255, 255, 255, .08);
}
.sb-step em { font-style: normal; font-size: 10px; color: var(--ink-3); }
.sb-step.cur {
  border-color: var(--accent); color: var(--ink);
  background: rgba(109, 140, 255, .1);
}
.sb-step.cur i { background: var(--accent); color: #0b0d12; }
.sb-step.done i { background: rgba(53, 201, 138, .2); color: var(--ok); }
.sb-arrow { color: var(--ink-3); font-size: 11px; }

.sb-x {
  margin-left: auto;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-size: 13px; line-height: 1;
}
.sb-x:hover { border-color: var(--bad); color: var(--bad); }

.sb-tools {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.sb-gap { flex: 1 1 auto; }
.sb-tip { font-size: 11px; color: var(--ink-3); }
.sb-tbtn {
  padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11.5px;
  transition: border-color .14s, color .14s, background .14s;
}
.sb-tbtn:hover {
  border-color: rgba(109, 140, 255, .55);
  color: var(--ink); background: rgba(109, 140, 255, .07);
}

.sb-body { flex: 1 1 auto; overflow: auto; }

.sb-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sb-table th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 10px;
  text-align: left; white-space: nowrap;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-weight: 500; font-size: 10.5px; color: var(--ink-3);
}
.sb-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.sb-table tr.off td { opacity: .38; }
.sb-table tr:hover td { background: rgba(255, 255, 255, .015); }

.c-on { width: 34px; text-align: center; }
.c-no { width: 46px; color: var(--ink-3); text-align: center; padding-top: 12px !important; }
.c-dur { width: 64px; }
/* 画面描述/提示词只放三行摘要，点一下弹窗改 —— 格子才收得住 */
.c-desc { width: 190px; min-width: 150px; max-width: 220px; }
.c-size { width: 78px; }
.c-light { width: 120px; }
.c-line { width: 150px; }
.c-camera { width: 130px; }
.c-prompt { width: 300px; min-width: 240px; max-width: 330px; }
.c-ref { width: 100px; }

/* 表格里长文本的摘要格：三行封顶，点开弹窗编辑。
   宽度跟着 td 走、高度钉死三行 —— td 的 width/max-width 在
   table-layout:auto 下只是「建议值」，长文本一撑就回到五六百像素；
   真正收得住的是内容层自己的行数上限 */
.sb-cell {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  width: 100%;
  overflow: hidden; cursor: text; line-height: 1.6; font-size: 12px;
  color: var(--ink); padding: 5px 7px; border-radius: 6px;
  border: 1px solid transparent; word-break: break-word;
}
.sb-cell:hover { border-color: var(--line); background: rgba(255, 255, 255, .03); }
.sb-cell-ph { color: var(--ink-3); font-style: normal; }

/* 单击一格弹出的大编辑窗 */
.sb-cellpop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center;
}
.sb-cellpop-box {
  width: min(720px, 88vw); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.sb-cellpop-h {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--ink-3); margin-bottom: 10px;
}
.sb-cellpop-h em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.sb-cellpop-ta {
  width: 100%; height: 240px; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  color: var(--ink); font: inherit; font-size: 13px; line-height: 1.75;
}
.sb-cellpop-f {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px;
}

.sb-in {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent; border-radius: 6px;
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  font-family: inherit; font-size: 11.5px; line-height: 1.55;
  resize: none; outline: 0;
  transition: border-color .12s, background .12s;
}
.sb-in:hover { background: rgba(255, 255, 255, .05); }
.sb-in:focus {
  border-color: var(--accent);
  background: rgba(109, 140, 255, .07);
}
.sb-in.num { text-align: center; }
.sb-in::placeholder { color: var(--ink-3); }
.c-ref img { width: 100%; border-radius: 6px; display: block; }
.sb-none { display: block; padding-top: 7px; color: var(--ink-3); font-size: 10.5px; }

.sb-foot {
  display: flex; align-items: center; gap: 16px;
  flex: 0 0 auto;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.sb-sum { font-size: 12px; color: var(--ink-2); }
.sb-sum b { color: var(--ink); font-size: 13px; }
.sb-go {
  margin-left: auto;
  padding: 10px 22px; cursor: pointer;
  border: 0; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 500;
  transition: background .14s, transform .1s;
}
.sb-go:hover { background: #7f9bff; }
.sb-go:active { transform: scale(.985); }
.sb-go:disabled { opacity: .4; cursor: default; }

/* ── 拆镜等待层 ────────────────────────────────────────────────────
拆镜要十几秒，这期间画布不该还能点。做成一条来回扫的进度条而不是
百分比：模型不会告诉我们它读到第几行了，假进度比没进度更糟。 */
#shot-wait {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(6, 8, 12, .72);
  backdrop-filter: blur(3px);
  z-index: 910;
}
#shot-wait.on { display: flex; }

.sw-box {
  width: 340px;
  padding: 26px 26px 20px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  text-align: center;
}
.sw-ico { font-size: 26px; margin-bottom: 12px; }
.sw-t { font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.sw-s {
  font-size: 11.5px; color: var(--ink-3);
  line-height: 1.6; margin-bottom: 16px;
}
.sw-bar {
  height: 3px; border-radius: 2px; overflow: hidden;
  background: rgba(255, 255, 255, .08);
  margin-bottom: 16px;
}
.sw-bar i {
  display: block; width: 40%; height: 100%;
  background: var(--accent);
  animation: swSlide 1.15s ease-in-out infinite;
}
@keyframes swSlide {
  0%   { transform: translateX(-105%); }
  100% { transform: translateX(355%); }
}
.sw-x {
  padding: 7px 18px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 11.5px;
}
.sw-x:hover { border-color: var(--line); color: var(--ink); }

/* ============================================================
   分镜工作台 · 母版面板（第 4 步）
   ============================================================ */
.sb-bible {
  flex: none;
  max-height: 58%;
  overflow: auto;
  border-bottom: 1px solid #2a2f3a;
  background: #14171e;
}
.sb-bible-h {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 14px 8px; position: sticky; top: 0; z-index: 2;
  background: #14171e; border-bottom: 1px solid #222731;
}
.sb-bible-h b { font-size: 13px; color: #e8ecf3; }
.sb-bible-h em { font-size: 11px; color: #6d7686; font-style: normal; }
.sb-bible-b {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px; padding: 10px 14px 14px;
}
.sb-blk {
  border: 1px solid #262c37; border-radius: 8px;
  background: #181c24; overflow: hidden;
  /* 一张「参考素材职责」能列出七八个素材，不封顶就把整行拉到几百像素，
     十块里后面几块全被挤出可视区。卡片自己封顶、自己滚。 */
  display: flex; flex-direction: column;
  max-height: 258px;
}
.sb-blk-h {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px 6px; border-bottom: 1px solid #222731;
}
.sb-blk-h b { font-size: 12px; color: #cdd4e0; }
.sb-blk-h em {
  font-size: 10px; color: #5f6878; font-style: normal;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.sb-blk-h span { font-size: 10px; color: #4d5566; flex: none; }
.sb-blk-b { padding: 7px 8px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.sb-bl-ta {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: #11141a; color: #dfe5ef; border: 1px solid #262c37;
  border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.6;
  font-family: inherit; min-height: 42px;
}
.sb-bl-ta:focus { outline: none; border-color: #3d6ee0; }
.sb-bl-item {
  display: flex; gap: 6px; align-items: flex-start; margin-bottom: 6px;
}
.sb-bl-item.col {
  display: block; padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px dashed #232936;
}
.sb-bl-item.col:last-child { border-bottom: 0; margin-bottom: 0; }
.sb-bl-item > span {
  flex: none; width: 16px; font-size: 10px; color: #4d5566;
  text-align: right; padding-top: 6px;
}
.sb-bl-item textarea {
  flex: 1; box-sizing: border-box; resize: vertical;
  background: #11141a; color: #dfe5ef; border: 1px solid #262c37;
  border-radius: 5px; padding: 4px 7px; font-size: 11.5px; line-height: 1.55;
  font-family: inherit; min-height: 26px;
}
.sb-bl-item textarea:focus { outline: none; border-color: #3d6ee0; }
.sb-bl-h {
  display: block; font-size: 11px; color: #8fa0bb; margin-bottom: 4px;
}
.sb-bl-kv { display: flex; gap: 5px; align-items: flex-start; margin-bottom: 4px; }
.sb-bl-kv i {
  flex: none; width: 52px; font-size: 10px; color: #556; font-style: normal;
  text-align: right; padding-top: 5px;
}
.sb-bl-kv textarea {
  flex: 1; box-sizing: border-box; resize: vertical;
  background: #11141a; color: #cfd7e4; border: 1px solid #232936;
  border-radius: 5px; padding: 4px 7px; font-size: 11px; line-height: 1.5;
  font-family: inherit; min-height: 24px;
}
.sb-bl-kv textarea:focus { outline: none; border-color: #3d6ee0; }

/* 第 4 步的列 */
.c-code, .c-tc { width: 84px; }
.c-framing { width: 170px; }
.c-script { width: 46%; position: relative; }
.sb-in.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.sb-cell-script {
  white-space: pre-wrap; font-size: 11.5px; line-height: 1.6;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  max-height: 96px; overflow: hidden;
}
.sb-cp1 {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  background: #232936; color: #8fa0bb; border: 1px solid #303849;
  border-radius: 4px; cursor: pointer; font-size: 11px; padding: 0;
}
.sb-cp1:hover { background: #3d6ee0; color: #fff; border-color: #3d6ee0; }

/* ============================================================
   分镜工作台 · 第二步「准备资产」
   ============================================================
   这一屏是让用户把人物/场景/道具的图逐个定下来：AI 生成、从画布挑、
   或者自己上传。左边是资产网格，右边是编辑面板，点卡片出面板。 */

.sb-assets {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: stretch;
  overflow: hidden;
}
.sb-a-main {
  flex: 1 1 auto; min-width: 0;
  overflow-y: auto;
  padding: 16px 20px 28px;
}
.sb-a-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.sb-a-bar-e { font-size: 11px; color: var(--bad, #e5484d); }
.sb-a-note {
  margin-bottom: 16px;
  font-size: 11.5px; color: var(--ink-3); line-height: 1.75;
}
.sb-a-note b { color: var(--accent); font-weight: 600; }
.sb-a-sec { margin-bottom: 22px; }
.sb-a-h {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.sb-a-h em {
  font-style: normal; font-size: 10px; font-weight: 400;
  padding: 1px 7px; border-radius: 999px;
  color: var(--ink-3); background: rgba(255, 255, 255, .06);
}
.sb-a-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.sb-a-card {
  position: relative;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden; cursor: pointer;
  transition: border-color .14s, transform .14s;
}
.sb-a-card:hover { border-color: rgba(109, 140, 255, .5); transform: translateY(-1px); }
.sb-a-card.cur { border-color: var(--accent); box-shadow: var(--glow); }
.sb-a-card img {
  display: block; width: 100%; height: 136px;
  object-fit: cover; background: #0d1017;
}
.sb-a-ph {
  display: flex; align-items: center; justify-content: center;
  height: 136px; background: #0d1017;
}
.sb-a-ph i {
  font-style: normal; font-size: 20px; color: var(--ink-3);
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line);
}
.sb-a-ph.big { height: auto; min-height: 190px; border-radius: var(--r-md); }

/* 卡片右上角的放大镜：图小，四视图看不清脸，得能点开 */
.sb-a-zoom {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  width: 24px; height: 24px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 6px;
  background: rgba(10, 13, 18, .66); color: #e6ebf5;
  font-size: 12px; cursor: zoom-in; opacity: 0;
  transition: opacity .14s, background .14s;
}
.sb-a-card:hover .sb-a-zoom { opacity: 1; }
.sb-a-zoom:hover { background: rgba(109, 140, 255, .82); }
/* 编辑面板里那张大图也点得开 */
.sb-ed-img img { cursor: zoom-in; }

/* ---------- 看大图 ---------- */
/* 盖住整页，图居中铺满。滚轮缩放，点哪儿都能关。
   以前点图是开新标签页，看完要关标签再切回来，对比两张图得来回折腾。 */
.zm {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: rgba(6, 8, 12, .93);
  backdrop-filter: blur(3px);
}
.zm.on { display: flex; }
html.zm-lock, html.zm-lock body { overflow: hidden; }
.zm-stage {
  flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 18px;
}
.zm-img {
  display: block; max-width: none;
  border-radius: 4px; box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
  cursor: zoom-out; user-select: none;
}
.zm-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; flex-wrap: wrap;
  background: linear-gradient(to top, rgba(6, 8, 12, .92), rgba(6, 8, 12, 0));
}
.zm-cap {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; color: #dbe2ee;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zm-tools { display: flex; align-items: center; gap: 6px; }
.zm-b {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 7px;
  background: rgba(255, 255, 255, .06); color: #e6ebf5;
  font-size: 12px; line-height: 1; cursor: pointer;
  text-decoration: none; transition: background .14s, border-color .14s;
}
.zm-b:hover { background: rgba(109, 140, 255, .34); border-color: rgba(109, 140, 255, .6); }
.zm-pct {
  min-width: 44px; text-align: center;
  font-size: 11.5px; color: #9fb0c9; font-variant-numeric: tabular-nums;
}
@media (max-width: 620px) {
  .zm-cap { display: none; }
  .zm-bar { justify-content: center; }
}

.sb-a-name {
  padding: 8px 10px 2px;
  font-size: 12px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-a-look {
  padding: 0 10px 9px;
  font-size: 10.5px; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  /* 外观描述从一句话变成 2 到 4 句了，clamp 偶发不生效时会撑出卡片，兜一层固定高度 */
  max-height: 33px;
}
.sb-a-busy {
  position: absolute; left: 0; right: 0; top: 0;
  padding: 6px 8px; text-align: center;
  font-size: 10.5px; color: #0b0d12;
  background: rgba(109, 140, 255, .92);
}
.sb-a-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 190px;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  color: var(--ink-3); cursor: pointer;
  transition: border-color .14s, color .14s;
}
.sb-a-add:hover { border-color: var(--accent); color: var(--accent); }
.sb-a-add i { font-style: normal; font-size: 20px; }
.sb-a-add em { font-style: normal; font-size: 11px; }
.sb-a-empty {
  padding: 46px 0; text-align: center;
  font-size: 12px; color: var(--ink-3);
}

/* 右侧编辑面板 */
.sb-ed {
  position: relative;
  /* 出图提示词升级成整页设定页之后有七八百字，362px 太窄，读起来一行挤十几个字 */
  flex: 0 0 460px; min-width: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
}
.sb-ed-idle { align-items: center; justify-content: center; gap: 9px; }
.sb-ed-t { font-size: 13px; color: var(--ink-2); }
.sb-ed-s { font-size: 11px; color: var(--ink-3); }
.sb-ed-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.sb-ed-img { position: relative; padding: 12px 14px 0; }
.sb-ed-img img {
  display: block; width: 100%; border-radius: var(--r-md);
  border: 1px solid var(--line-soft); background: #0d1017;
}
.sb-ed-f {
  padding: 12px 14px 0;
  /* 提示词是整页设定页，七八百字，让它吃掉面板剩下的高度，别在小框里滚 */
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
.sb-ed-f label {
  display: block; margin: 11px 0 5px;
  font-size: 11px; color: var(--ink-3);
}
.sb-ed-f label:first-child { margin-top: 0; }
/* 提示词是给模型看的整段文字，字号小一点、行高大一点，方便通读和核对 */
.sb-ed-f textarea[data-ed="prompt"] {
  font-size: 11.5px; line-height: 1.62;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  flex: 1 1 auto; min-height: 240px; resize: vertical;
}
.sb-ed-f textarea[data-ed="look"] { font-size: 12px; line-height: 1.6; }
/* 窄屏退回去，别把左边资产卡挤没了 */
@media (max-width: 1320px) {
  .sb-ed { flex: 0 0 340px; }
}
.sb-ed-acts { display: flex; gap: 8px; padding: 14px; }
.sb-ed-acts .sb-tbtn { flex: 1 1 auto; justify-content: center; }
.sb-ed-foot {
  padding: 0 14px 16px;
  font-size: 10.5px; color: var(--ink-3);
}

.sb-tbtn.main {
  border-color: var(--accent); color: #0b0d12;
  background: var(--accent); font-weight: 600;
}
.sb-tbtn.main:hover { background: #7f9aff; }
.sb-tbtn.wide { width: 100%; justify-content: center; }
.sb-tbtn[disabled] { opacity: .5; cursor: not-allowed; }

/* 选图片弹窗：三个来源叠在编辑面板上 */
.sb-pk {
  position: absolute; inset: 10px;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel-2); box-shadow: var(--shadow-2);
  z-index: 5; overflow: hidden;
}
.sb-pk-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.sb-pk-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 10px 14px 0;
}
.sb-pk-t {
  padding: 6px 11px; cursor: pointer;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--ink-3);
  font-family: inherit; font-size: 11.5px;
}
.sb-pk-t:hover { color: var(--ink); }
.sb-pk-t.cur {
  border-color: var(--accent); color: var(--ink);
  background: rgba(109, 140, 255, .1);
}
.sb-pk-b { padding: 12px 14px 16px; overflow-y: auto; }
.sb-pk-p {
  padding: 10px 11px; margin-bottom: 10px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .02);
  font-size: 11px; line-height: 1.75; color: var(--ink-2);
  max-height: 132px; overflow-y: auto;
}
.sb-pk-note { font-size: 11px; color: var(--ink-3); line-height: 1.75; }
.sb-pk-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
}
.sb-pk-it {
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  overflow: hidden; cursor: pointer;
}
.sb-pk-it:hover { border-color: var(--accent); }
.sb-pk-it img { display: block; width: 100%; height: 76px; object-fit: cover; }
.sb-pk-it em {
  display: block; padding: 4px 6px;
  font-style: normal; font-size: 9.5px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-pk-up {
  display: inline-flex; margin-top: 12px;
  padding: 8px 16px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12px; color: var(--ink-2);
}
.sb-pk-up:hover { border-color: var(--accent); color: var(--ink); }

/* 节点里生成结果的折叠条 */
/* 正文直接摆出来，滚 .fb-out 自己的 220px 就能看全。
   以前这里是 96px + 渐隐蒙版：96px 的 60% 往后就淡没了，实际能看清不到三行，
   视觉上等于一片空白 —— 用户关掉右侧面板后以为脚本丢了，只能重新生成一遍。 */
.fb-out.fold .fb-out-b {
  display: block;
  max-height: none;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}
/* 展开 = 外层从 220px 抬到 62vh：一屏能看大半篇，又不会把节点撑成一堵墙 */
.fb-out.open { max-height: 62vh; }
.fb-out.fold.open .fb-out-b {
  display: block;
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}
.fb-out-h { display: flex; align-items: center; gap: 7px; padding-bottom: 6px; }
.fb-out-h b { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.fb-out-h em { font-style: normal; font-size: 10px; color: var(--ink-3); }
.fb-out-x {
  padding: 2px 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 5px;
  background: transparent; color: var(--ink-3);
  font-family: inherit; font-size: 10px;
}
.fb-out-x:hover { border-color: var(--accent); color: var(--accent); }

/* 分镜脚本头部那个「打开分镜 / 拆成分镜」。
   它是回到分镜工作台的入口，得比「展开」显眼 —— 否则用户只能重跑脚本。 */
.fb-out-go {
  margin-left: auto; padding: 2px 9px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: 5px;
  background: rgba(79, 141, 255, .12); color: var(--accent);
  font-family: inherit; font-size: 10.5px; font-weight: 600;
}
.fb-out-go:hover { background: rgba(79, 141, 255, .24); }

/* 分镜组上的「打开脚本节点」：它是回到工作台的唯一入口，
   得跟旁边的批量按钮区分开，不然用户找不到地方改镜头。 */
.fb-chip.fb-open {
  color: var(--accent);
  border-color: rgba(109, 140, 255, .45);
  background: rgba(109, 140, 255, .08);
}
.fb-chip.fb-open:hover {
  color: #0b0d12;
  background: var(--accent);
}

/* 分镜表：音效列、操作列、添加镜头。
   音效是拆镜给的原始信息，得让用户看见能改；操作列给每镜一个删除入口，
   拆多了的镜头不该逼用户回去重拆一遍。 */
.c-sfx { width: 150px; }
.c-op { width: 44px; text-align: center; padding-top: 6px !important; }
.sb-del {
  width: 22px; height: 22px; line-height: 1;
  border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--ink-3);
  font-family: inherit; font-size: 11px; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.sb-del:hover {
  border-color: rgba(255, 95, 109, .6);
  color: var(--bad); background: rgba(255, 95, 109, .1);
}
.sb-addrow { padding: 10px 12px 18px; }
.sb-addrow .sb-tbtn { border-style: dashed; }

/* 准备资产页顶部的全局风格 */
.sb-a-style {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 0;
}
.sb-a-style label {
  flex: 0 0 auto;
  font-size: 11px; color: var(--ink-3); letter-spacing: .3px;
}
.sb-a-style .sb-in { flex: 1 1 auto; }

/* 设置面板里的文本输入（剧本节点的全局风格） */
.fb-set-i {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.fb-set-i:focus { border-color: var(--accent); }

/* 成片入口：拼好了直接点开看，不用去项目目录翻 */
.fb-film {
  text-decoration: none;
  border-color: rgba(90, 200, 130, .55) !important;
  color: #6fd08f !important;
}
.fb-film:hover { background: rgba(90, 200, 130, .12) !important; }
.fb-asm[disabled] { opacity: .45; }

/* 顶栏累计花费：不抢眼，但一直在那儿 */
#cost-text {
  margin-left: 10px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 框选：空白处拖出来的那个虚线框。
   半透明填充是为了让人看清「这一片都被框进来了」，
   不然只有一根细边，拖快了根本看不见。 */
.box-sel {
  position: absolute;
  display: none;
  z-index: 60;
  border: 1px solid var(--accent);
  background: rgba(90, 160, 255, .12);
  border-radius: 3px;
  pointer-events: none;
}
#viewport.boxing { cursor: crosshair; }

/* 分镜组底部的成片播放器。
   拼完片子最想做的就是当场看一遍，所以不跳新标签，直接嵌进来。 */
.fb-film-box { padding: 0 12px 12px; }
.fb-film-box video {
  width: 100%; display: block; border-radius: 8px;
  background: #000; outline: none;
}
.fb-film-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 12px; color: var(--ink-3);
}
.fb-film-meta { font-variant-numeric: tabular-nums; }

/* 操作列加两个挪位按钮：顺序不对时不用删了重加。
   挪动只换位置不动 sid，已经出好的画面图还跟着这一镜走。 */
.c-op { width: 88px; white-space: nowrap; }
.sb-mv {
  width: 20px; height: 22px; margin-right: 2px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--bg-2); color: var(--ink-3);
  font-size: 11px; line-height: 1; cursor: pointer;
  vertical-align: middle;
}
.sb-mv:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.sb-mv[disabled] { opacity: .3; cursor: default; }

/* 按镜配音：出来就是带声音的成片，配色跟「合成成片」区分开 */
.fb-dub { border-color: rgba(180, 140, 255, .5) !important; color: #b39bff !important; }
.fb-dub:hover:not([disabled]) { background: rgba(180, 140, 255, .12) !important; }
.fb-dub[disabled] { opacity: .45; }

/* 缩略图上的重出按钮：hover 才出现，不占地方也不误触 */
.fb-gc-r {
  position: absolute; top: 3px; right: 3px; z-index: 3;
  width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(0, 0, 0, .6); color: var(--ink-3);
  font-size: 11px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.fb-gc:hover .fb-gc-r { opacity: 1; }
/* 拖着换顺序的反馈：拖的那格变淡，落点那格亮边 */
.fb-gc.drag { opacity: .4; }
.fb-gc.over { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 格子里的图不能自己抢拖动，否则拖出去的是一张图 */
.fb-gc img, .fb-gc video { -webkit-user-drag: none; user-drag: none; }
.fb-gc-r:hover { border-color: var(--accent); color: var(--accent); }

/* 单镜停止：只在跑的时候出现，放在 → 和 ↻ 左边，不跟它们抢位置 */
.fb-gc-s {
  position: absolute; top: 3px; right: 43px; z-index: 3;
  width: 18px; height: 18px; padding: 0;
  border: 1px solid rgba(229, 72, 77, .5); border-radius: 5px;
  background: rgba(0, 0, 0, .6); color: #e5484d;
  font-size: 8px; line-height: 1; cursor: pointer;
}
.fb-gc-s:hover { background: rgba(229, 72, 77, .18); color: #ff6b70; }

/* 分镜组三步进度：画面 → 视频 → 成片。
   灰点还没开始，橙点是跑了一部分，绿点这一步齐了。 */
.fb-steps {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 10px 0; font-size: 11px;
  color: var(--ink-3); user-select: none;
}
.fb-step { display: inline-flex; align-items: center; gap: 5px; }
.fb-step i {
  flex: 0 0 auto; width: 7px; height: 7px;
  border-radius: 50%; background: var(--line);
  transition: background .15s;
}
.fb-step.part { color: var(--warn); }
.fb-step.part i { background: var(--warn); }
.fb-step.on { color: var(--ok); }
.fb-step.on i { background: var(--ok); }

/* 参考条：这个节点吃了哪些上游素材，按序号摆一排。
   连线只说明「有依赖」，看不出传进来的是哪张图 —— 出歪了得能一眼定位。 */
.fb-rfs { padding: 8px 10px 0; }
.fb-rfs-h {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 6px; font-size: 11px; color: var(--ink-3);
}
.fb-rfs-h b { font-weight: 600; color: var(--ink-2); }
.fb-rfs-h em {
  font-style: normal; font-size: 10.5px; color: var(--warn);
}
.fb-rfs-b { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-rf {
  position: relative; width: 56px; height: 56px;
  border: 1px solid var(--line); border-radius: 7px;
  overflow: hidden; background: var(--bg-2); cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.fb-rf:hover { border-color: var(--accent); transform: translateY(-1px); }
.fb-rf.off { border-style: dashed; }
.fb-rf img, .fb-rf video {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.fb-rf-x {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 10px; color: var(--ink-3);
}
.fb-rf-n {
  position: absolute; top: 2px; left: 2px; z-index: 2;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 4px; background: rgba(0, 0, 0, .72);
  color: #fff; font-size: 9.5px; line-height: 14px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.fb-rf-k {
  position: absolute; right: 2px; bottom: 2px; z-index: 2;
  font-size: 9px; line-height: 1;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, .9));
}

/* 进度条：后端只报阶段（出图 3→15→100，出视频 3→12→100），
   中间几分钟一动不动看着像卡死。数字由前端按估算时长自己往上爬。 */
.fb-pg { padding: 8px 10px 2px; user-select: none; }
.fb-pg-h {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 5px; font-size: 11px; color: var(--ink-2);
}
.fb-pg-h span {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fb-pg-h b {
  flex: 0 0 auto; font-size: 11px; font-weight: 600;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.fb-pg-t {
  height: 4px; border-radius: 2px;
  background: var(--line); overflow: hidden;
}
.fb-pg-t > i {
  display: block; height: 100%; width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width .45s linear;
}
.fb-pg-e {
  margin-top: 4px; font-size: 10px; color: var(--ink-3);
}
.fb-pg.bad .fb-pg-t > i { background: var(--bad); }
.fb-pg.bad .fb-pg-h b { color: var(--bad); }

/* 分镜格子底部那条细线：一格在跑就该看得见，但不抢缩略图的位置 */
.fb-pg-mini {
  height: 3px; margin: 0; background: var(--line); overflow: hidden;
}
.fb-pg-mini > i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: width .45s linear;
}

/* 合成中：还没有成片可放，只摆一条进度 */
.fb-film-box.busy { padding: 4px 0; }
.fb-film-box.busy .fb-pg { padding: 6px 2px; }

/* 资产卡上的出图进度：文字有了，还得有一条看得见在走的线 */
.sb-a-pg {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  height: 3px; background: rgba(255, 255, 255, .14); overflow: hidden;
}
.sb-a-pg > i {
  display: block; height: 100%; width: 0;
  background: var(--accent); transition: width .45s linear;
}

/* 拆镜等待层：从不确定的滑动条换成真百分比，跟别的生成过程保持一致 */
.sw-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sw-row .sw-bar { flex: 1 1 auto; margin-bottom: 0; }
.sw-bar i { animation: none; width: 0; transition: width .45s linear; }
.sw-pct {
  flex: 0 0 auto; min-width: 34px; text-align: right;
  font-size: 11px; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums;
}


/* ── 单镜详情面板 ──────────────────────────────────
以前点分镜格子只有「有产物就开新窗口」，没产物点了毫无反应。
现在点一下就是这一镜的详情：提示词、台词、时长、场景、镜头运动都能就地改，
改完直接能单独重出这一镜。 */
.fb-gc-o {
  position: absolute; top: 3px; right: 23px; z-index: 3;
  width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(0, 0, 0, .6); color: var(--ink-3);
  font-size: 11px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.fb-gc:hover .fb-gc-o { opacity: 1; }
.fb-gc-o:hover { border-color: var(--accent); color: var(--accent); }

/* ── 分镜多选 ────────────────────────────────────────────────────────
28 镜里挑几镜返工，一格一格点 ↻ 太慢了。缩略图左上角给个勾选框，
勾完工具栏就冒出「重出选中 / 删除选中」。 */
.fb-gc-k {
  position: absolute; top: 4px; left: 4px; z-index: 3;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 10px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s, border-color .12s;
}
.fb-gc:hover .fb-gc-k { opacity: 1; }
.fb-gc-k:hover { border-color: var(--accent); }
.fb-gc.sel .fb-gc-k {
  opacity: 1; background: var(--accent); border-color: var(--accent);
}
.fb-gc.sel { border-color: var(--accent); }
.fb-sel-n { font-size: 10.5px; color: var(--accent); white-space: nowrap; }
.fb-chip.fb-danger:hover {
  border-color: #e5484d; color: #ff8b8f; background: rgba(229, 72, 77, .12);
}

.fb-shot {
  position: fixed; top: 76px; right: 22px; z-index: 920;
  width: 400px; max-height: calc(100vh - 110px);
  display: none; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
}
.fb-shot.on { display: flex; }

.fs-h {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}
.fs-h b { font-size: 13px; color: var(--ink); }
.fs-h em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.fs-st {
  margin-left: auto; font-size: 10px; color: var(--ink-3);
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--bg-2);
  max-width: 150px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis;
}
.fs-x {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--ink-3); font-size: 12px;
}
.fs-x:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }

.fs-body { flex: 1 1 auto; overflow-y: auto; padding: 11px 12px 4px; }
.fs-l {
  display: block; font-size: 10.5px; color: var(--ink-3);
  margin: 0 0 5px;
}
.fs-l:not(:first-child) { margin-top: 11px; }
.fs-ta, .fs-i {
  width: 100%; box-sizing: border-box;
  padding: 7px 9px; margin-bottom: 2px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink);
  font-size: 12px; line-height: 1.55; font-family: inherit;
  resize: vertical;
}
.fs-ta:focus, .fs-i:focus { outline: none; border-color: var(--accent); }
.fs-2 { display: flex; gap: 9px; margin-top: 11px; }
.fs-2 > div { flex: 1 1 0; min-width: 0; }
.fs-2 .fs-i { margin-bottom: 0; }

.fs-refs { display: flex; flex-wrap: wrap; gap: 5px; }
.fs-refs span {
  font-size: 10px; color: var(--ink-2);
  padding: 2px 7px; border-radius: 999px;
  background: rgba(109, 140, 255, .12);
  border: 1px solid rgba(109, 140, 255, .28);
}
.fs-img {
  width: 100%; border-radius: 8px; display: block;
  border: 1px solid var(--line-soft);
}

.fs-f {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 12px; border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}


/* ── 产物操作条 ──────────────────────────────────────────────────────
图、视频、配音出来以后，得能拿走。以前只能右键另存。 */
.fb-media-bar {
  display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px;
}
.fb-mb {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  font-size: 10.5px; line-height: 1.4; text-decoration: none;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line); color: var(--ink-2);
  font-family: inherit;
  transition: border-color .12s, color .12s, background .12s;
}
.fb-mb:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(109, 140, 255, .1);
}
.fb-media[data-role="zoom"] { cursor: zoom-in; }

/* 空节点的上传入口：空框里除了「还没出图」总得有条别的路 */
.fb-up-btn {
  display: block; width: 100%; margin-top: 8px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-size: 11.5px; font-family: inherit;
  background: rgba(255, 255, 255, .04);
  border: 1px dashed var(--line); color: var(--ink-2);
  transition: border-color .12s, color .12s, background .12s;
}
.fb-up-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(109, 140, 255, .1);
}

/* ── 成片剪辑节点 ────────────────────────────────────────────────────
上游接了几段、总共多长，合成前就得能看见 —— 不然点下去不知道在等什么。 */
.fb-film-wait {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 18px 14px; border-radius: 10px;
  border: 1px dashed var(--line); background: rgba(255, 255, 255, .02);
  text-align: center;
}
.fb-film-wait b { font-size: 13px; color: var(--ink); font-weight: 600; }
.fb-film-wait em {
  font-style: normal; font-size: 11px; color: var(--accent);
  padding: 1px 8px; border-radius: 999px;
  background: rgba(109, 140, 255, .12);
}
.fb-film-wait span { font-size: 10.5px; color: var(--ink-3); line-height: 1.6; }

/* ---- 成片剪辑的段条：每段一个方块，点一下剔出/加回片子 ---- */
.fb-fsegs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
/* 序号条上方的模式开关。这排方块到底是「选镜看」还是「剔出片子」，
   光看方块本身分不出来，得在它上面明说，不然用户点哪个都只看到同一条成片。 */
.fb-fsegs-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
}

.fb-fsegs-t {
  flex: 1;
  font-size: 11px;
  opacity: .62;
  line-height: 1.3;
}

.fb-fseg-mode {
  flex: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .16);
  color: inherit;
  white-space: nowrap;
}

.fb-fseg-mode:hover { background: rgba(255, 255, 255, .13); }

.fb-fseg-mode.on {
  background: #2a6df4;
  border-color: #2a6df4;
  color: #fff;
}

.fb-fseg.pv { cursor: zoom-in; }

.fb-fseg.pv:hover { background: rgba(42, 109, 244, .28); }

/* 单镜预览。不抢成片播放器的位置，插在段条下面，关掉就收起来。 */
.fb-fprev {
  margin: 6px 0 4px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.fb-fprev-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, .06);
}

.fb-fprev-h b {
  flex: none;
  color: #6ea8ff;
}

.fb-fprev-h span {
  flex: 1;
  opacity: .72;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-fprev-x {
  flex: none;
  width: 18px;
  height: 18px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: inherit;
  opacity: .6;
}

.fb-fprev-x:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .14);
}

.fb-fprev video {
  display: block;
  width: 100%;
  max-height: 42vh;
  background: #000;
}

.fb-fseg {
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(140, 160, 190, 0.35);
  background: transparent;
  color: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.fb-fseg:hover {
  border-color: #6cf;
  opacity: 1;
}
.fb-fseg.off {
  opacity: 0.32;
  text-decoration: line-through;
}
/* 分镜组的段条：还没出视频的镜剔不了，淡一点、不许点 */
.fb-fseg.na {
  opacity: 0.22;
  cursor: not-allowed;
}
/* 段条拖动排序：拖起来的那块虚一点，落点上打一圈高亮 */
.fb-fseg[draggable="true"] {
  cursor: grab;
}
.fb-fseg.drag {
  opacity: 0.35;
  cursor: grabbing;
}
.fb-fseg.over {
  border-color: #6cf;
  box-shadow: 0 0 0 2px rgba(102, 204, 255, 0.35);
}
.fb-fsegs-tip {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.6;
}

/* 一次出多张时的候选条：小缩略图，选中的描一圈 */
/* 分镜格子里的一排候选圆点：地方太小，只够放点，点一下换图 */
.fb-gc-cd { display: flex; gap: 3px; padding: 0 6px 4px; }
.fb-gc-c {
  width: 10px; height: 10px; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid #4a5568; background: transparent;
}
.fb-gc-c:hover { border-color: #7fb6ff; }
.fb-gc-c.on { background: #5aa9ff; border-color: #5aa9ff; }

.fb-cands {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.fb-cand {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(140, 160, 190, 0.35);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.7;
}
.fb-cand img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fb-cand:hover { opacity: 1; }
.fb-cand.sel {
  opacity: 1;
  border-color: #6cf;
  box-shadow: 0 0 0 2px rgba(102, 204, 255, 0.4);
}

/* 分镜表第三视图（精修提示词）新加的三列 ----
   这一镜讲什么 / 焦段光圈 / 这一镜的禁止项。窄一点，让提示词那列还有地方。 */
.c-title { width: 118px; }
.c-lens { width: 88px; }
.c-limit { width: 148px; min-width: 118px; max-width: 176px; }

/* ---- 单镜面板的运镜快捷 ----
   点一下把「机位在哪、怎么动、从什么构图到什么构图」补成完整一句，
   不然文本框里永远只有「推」「固定」两个字，出片全靠模型猜。 */
.fs-cam { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fs-camchip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid rgba(140, 160, 190, 0.28);
  background: rgba(140, 160, 190, 0.08);
  color: var(--ink-2); font-size: 11.5px; line-height: 1.4;
  cursor: pointer; user-select: none;
}
.fs-camchip:hover { background: rgba(140, 160, 190, 0.18); color: var(--ink-1); }
.fs-camchip.add { border-style: dashed; }
.fs-camchip.mine {
  border-color: rgba(120, 180, 255, 0.45);
  background: rgba(120, 180, 255, 0.1);
}
.fs-camchip i { font-style: normal; opacity: 0.55; margin-left: 2px; }
.fs-camchip i:hover { opacity: 1; color: var(--bad); }

/* ---- 分镜组属性面板的「镜头衔接」开关 ---- */
.fb-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-1);
  cursor: pointer;
  user-select: none;
}
.fb-chk input { width: 13px; height: 13px; margin: 0; cursor: pointer; }

/* ---- 单镜面板里的「场景总控」----
   只读展示：它是整场共用的，要改得去分镜组属性面板，
   在单镜里改会让人以为只影响这一镜。 */
.fs-tot {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(140, 160, 190, 0.22);
  background: rgba(140, 160, 190, 0.06);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-2);
}


/* ---- 首尾帧：这一镜从哪张图起、停在哪张图 ----
   出片前就要能看出来接不接得上。接不上不报错，只是成片里
   「人走出画、下一镜又回到画面中间」，等出完片再返工就贵了。 */
.fb-gc-fl { display: flex; align-items: center; gap: 3px; padding: 0 6px 5px; }
.fb-gc-fl > i { font-style: normal; font-size: 9px; color: var(--ink-3); }
.fb-gc-fl .fl-b {
  width: 26px; height: 26px; border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--ink-3);
  border: 1px dashed rgba(140, 160, 190, 0.35);
  background: rgba(0, 0, 0, 0.25);
}
.fb-gc-fl .fl-b.on { border-style: solid; border-color: rgba(140, 160, 190, 0.55); }
.fb-gc-fl .fl-b.na { color: #c08a4a; border-color: rgba(192, 138, 74, 0.55); }
.fb-gc-fl .fl-b img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ================= 看懂画面：拆层 / 空间 / 光效 / 动作 / 推演 ================= */

/* 节点底部那条「对已有画面做点什么」的工具条，跟生成条分开摆 */
.fb-tools {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 0 0;
  border-top: 1px dashed #262c38; margin-top: 7px;
}
.fb-tools .fb-chip { font-size: 11px; padding: 3px 8px; }
.fb-tools .fb-chip[disabled] { opacity: .45; }

/* ---- 3D-BOX：框直接叠在图上，用百分比定位，缩放跟着走 ---- */
.fb-boxwrap { position: relative; display: block; line-height: 0; }
.fb-boxlayer { position: absolute; inset: 0; pointer-events: none; }
.fb-box {
  position: absolute; border: 1.5px solid; box-sizing: border-box;
  border-radius: 3px; pointer-events: auto;
}
.fb-box > span {
  position: absolute; left: -1px; top: -15px; font-size: 10px; line-height: 14px;
  color: #0b0e14; padding: 0 4px; border-radius: 3px;
  white-space: nowrap; font-weight: 600;
}
.fb-spat { margin-top: 6px; border: 1px solid #2a2f3a; border-radius: 6px; overflow: hidden; }
.fb-spat-h {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: #1a1e27;
}
.fb-spat-h b { font-size: 11px; color: #cfd6e4; }
.fb-spat-h em { font-size: 10px; color: #8b93a7; font-style: normal; }
.fb-spat-h .fb-out-x { margin-left: auto; }
.fb-spat-b {
  padding: 6px 8px; font-size: 11px; line-height: 1.6; color: #9aa4b8;
  max-height: 96px; overflow: auto;
}
.fb-spat-l { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 7px; }
.fb-spat-l i {
  font-style: normal; font-size: 10px; color: #9aa4b8; background: #232833;
  border-radius: 4px; padding: 1px 5px;
}
.fb-spat-l u { text-decoration: none; color: #5a6478; margin-left: 3px; }

/* ---- 动作分解：默认收起，展开看整段拍子 ---- */
.fb-mot { margin-top: 6px; border: 1px solid #2a2f3a; border-radius: 6px; overflow: hidden; }
.fb-mot .fb-out-h {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: #1a1e27;
}
.fb-mot .fb-out-h b { font-size: 11px; color: #cfd6e4; }
.fb-mot .fb-out-h em { font-size: 10px; color: #8b93a7; font-style: normal; }
.fb-mot .fb-out-h .fb-out-x { margin-left: 0; }
.fb-mot .fb-out-h .fb-out-x:first-of-type { margin-left: auto; }
.fb-mot .fb-out-b {
  display: none; padding: 6px 8px; font-size: 11px; line-height: 1.7;
  color: #9aa4b8; white-space: pre-wrap; max-height: 200px; overflow: auto;
}
.fb-mot.open .fb-out-b { display: block; }

/* ---- 弹层里的输入框 ---- */
.fb-inp {
  background: #12161e; border: 1px solid #2f3644; border-radius: 5px;
  color: #cfd6e4; font-size: 12px; padding: 5px 8px; outline: none;
}
.fb-inp:focus { border-color: #4a6fa5; }

/* ---- 小地图：右下角全局视角，点一下跳过去 ---- */
.fb-mmap {
  position: absolute; right: 14px; bottom: 14px; width: 156px; height: 100px;
  background: rgba(16, 19, 26, .88); border: 1px solid #2f3644; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4); z-index: 40;
  cursor: crosshair; overflow: hidden; user-select: none;
}
.fb-mmap > b {
  position: absolute; left: 6px; top: 3px; font-size: 9px; color: #5a6478;
  font-weight: 400; letter-spacing: .5px; pointer-events: none;
}
.fb-mmap-c { position: absolute; inset: 0; }
.fb-mmap-c u { position: absolute; display: block; border-radius: 2px; }
.fb-mmap-c u.mm-g { background: rgba(110, 168, 254, .55); }
.fb-mmap-c u.mm-m { background: rgba(126, 231, 143, .5); }
.fb-mmap-c u.mm-t { background: rgba(154, 164, 184, .38); }
.fb-mmap-v {
  position: absolute; display: block; border: 1.5px solid #6ea8fe;
  border-radius: 2px; background: rgba(110, 168, 254, .12); pointer-events: none;
}

/* ============================================================
   主页：历史项目
   ------------------------------------------------------------
   以前选项目是顶栏下面一个 330px 的小弹层，一行一行往下排。
   项目一多就在一条窄缝里翻，还看不见封面、没法改名、没法删。
   这里做成整页卡片墙，最近改过的排最前面。
   ============================================================ */

.home {
  position: fixed; inset: 0; z-index: 85;
  display: flex; flex-direction: column;
  background:
    radial-gradient(1400px 700px at 50% -20%, #161d2e 0%, #0b0d12 58%, #07080c 100%);
}
.home[hidden] { display: none; }

.home-top {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 18, 26, .8);
  backdrop-filter: blur(10px);
}

.home-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 26px 28px 64px;
}

.home-hd {
  display: flex; align-items: center; gap: 12px;
  max-width: 1680px; margin: 0 auto 18px;
}
.home-title { font-size: 19px; font-weight: 650; letter-spacing: .3px; }
.home-count {
  font-size: 11.5px; color: var(--ink-3); font-family: var(--mono);
  padding: 3px 9px; border-radius: 20px;
  background: rgba(255,255,255,.045); border: 1px solid var(--line-soft);
}
.home-search {
  width: 200px; height: 30px; padding: 0 11px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink); font-size: 12px;
  outline: none; transition: border-color .14s;
}
.home-search:focus { border-color: rgba(109,140,255,.62); }
.home-search::placeholder { color: var(--ink-3); }

.home-grid {
  display: grid; gap: 16px;
  max-width: 1680px; margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
}

/* ---- 一张项目卡 */

.hp-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #161b25 0%, #12161e 100%);
  overflow: hidden; cursor: pointer;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.hp-card:hover {
  border-color: rgba(109,140,255,.55);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.hp-card.cur { border-color: rgba(109,140,255,.72); box-shadow: var(--glow); }

.hp-cover {
  position: relative; aspect-ratio: 16 / 9;
  background: #0e1219; overflow: hidden;
}
/* 资产设定图是「四视图 + 表情 + 服装」拼成的长图，默认居中裁会把
   脸切掉一半、只留中间一块躯干。贴顶裁，露出来的是头部特写，一眼认人。 */
.hp-cover img { width: 100%; height: 100%; object-fit: cover;
  object-position: center; display: block; }
.hp-cover-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(109,140,255,.24) 0%, transparent 62%),
    linear-gradient(135deg, #1b2233 0%, #131822 60%, #0f131b 100%);
}
.hp-cover-ph i {
  font-style: normal; font-size: 34px; font-weight: 700;
  color: rgba(232,236,244,.16); letter-spacing: 2px;
}

.hp-stage, .hp-cur {
  position: absolute; left: 8px; top: 8px;
  font-size: 10px; line-height: 1;
  padding: 4px 7px; border-radius: 5px;
  background: rgba(10,13,18,.72); color: var(--ink-2);
  border: 1px solid rgba(255,255,255,.1);
  font-family: var(--mono);
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hp-cur {
  left: auto; right: 8px;
  background: rgba(109,140,255,.92); color: #fff; border-color: transparent;
}

/* 改名 / 删除：平时藏着，鼠标上卡片才出来，不打扰浏览 */
.hp-more {
  position: absolute; right: 7px; bottom: 7px;
  width: 26px; height: 26px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.16); border-radius: 7px;
  background: rgba(10,13,18,.72); color: #e6ebf5;
  font-size: 15px; letter-spacing: 1px;
  opacity: 0; transition: opacity .14s, background .14s;
}
.hp-card:hover .hp-more { opacity: 1; }
.hp-more:hover { background: rgba(109,140,255,.86); }

.hp-meta { padding: 10px 11px 12px; }
.hp-title {
  font-size: 13px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hp-sub {
  margin-top: 4px; font-size: 10.5px; color: var(--ink-3);
  font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- 空态 */

.home-empty { max-width: 420px; margin: 70px auto 0; text-align: center; }
.home-empty[hidden] { display: none; }
.he-ico {
  font-size: 34px; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.he-title { margin-top: 12px; font-size: 15px; font-weight: 650; }
.he-desc { margin: 6px 0 18px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ---- 卡片上的「⋯」菜单 */

.hp-menu {
  position: fixed; z-index: 96;
  min-width: 132px; padding: 5px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 1px;
}
.hp-menu[hidden] { display: none; }
.hp-mi {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2);
  font-size: 12px; text-align: left;
  transition: background .12s, color .12s;
}
.hp-mi:hover { background: var(--panel-2); color: var(--ink); }
.hp-mi.danger:hover { background: rgba(255,95,109,.13); color: var(--bad); }

/* ---- 模态里的说明 / 危险提示 / 危险按钮 */

.form-tip { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin-top: 8px; }
.del-warn .dw-t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.del-warn .dw-d {
  margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.8;
}
.btn.danger {
  background: rgba(255,95,109,.16); border-color: rgba(255,95,109,.45);
  color: #ffb3ba; font-weight: 600;
}
.btn.danger:hover { background: rgba(255,95,109,.28); border-color: rgba(255,95,109,.7); }

/* 主页上的账号按钮和顶栏那个是同款，但 id 不同 */
.user-btn #home-user-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 主页右上角的账号菜单：别按顶栏那个位置摆，会跑到屏幕左边去 */
#user-pop.home-pos {
  left: auto; right: 16px;
  top: calc(var(--topbar-h) + 6px);
  z-index: 96;
}

@media (max-width: 640px) {
  .home-body { padding: 16px 14px 48px; }
  .home-hd { flex-wrap: wrap; }
  .home-search { width: 100%; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
  .hp-title { font-size: 12px; }
  .hp-cover-ph i { font-size: 26px; }
}


/* ---------- 输入框 @ 补全：列出画布上的图，点一张当参考图 ---------- */
.fb-at {
  position: fixed; z-index: 9999;
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px; border-radius: 10px;
  background: rgba(18, 23, 31, .97);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  max-height: 176px; overflow: auto;
}
.fb-at-i {
  display: flex; align-items: center; gap: 7px; min-height: 38px;
  padding: 3px 9px 3px 3px; border: 0; cursor: pointer;
  border-radius: 7px; background: rgba(255, 255, 255, .06);
  color: #dfe7f2; font: inherit; font-size: 12px; max-width: 100%;
}
.fb-at-i:hover { background: rgba(90, 170, 255, .26); }
.fb-at-i img {
  width: 32px; height: 32px; min-width: 32px; object-fit: cover;
  display: block; border-radius: 6px; flex: 0 0 auto; background: #0a0d12;
}
.fb-at-i span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 提示词弹窗编辑 ────────────────────────────────────────────────
节点里那块框只露半屏，长提示词看不全；点 ⤢ 开这个占满屏的大窗改。 */
.modal.xwide { width: min(1040px, 94vw); }
.pe-ta {
  display: block; width: 100%;
  min-height: 52vh; max-height: 64vh;
  padding: 13px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: #0a0d12;
  color: var(--ink); font-family: inherit; font-size: 13px;
  line-height: 1.75; resize: vertical; outline: 0;
}
.pe-ta:focus { border-color: rgba(109, 140, 255, .55); }


/* ── 顶部「服务端还在跑」横幅 ────────────────────────────────
   任务队列活在服务端，关掉网页照跑。可前端一刷新什么都不记得，
   回来看见一片静止的格子，判断不出上次那批还在不在跑。 */
#runbar {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(22, 26, 34, .93);
  border: 1px solid rgba(120, 170, 255, .34);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .34);
  color: #dfe7f5;
  font-size: 12.5px;
  line-height: 1;
  max-width: min(760px, calc(100vw - 280px));
  backdrop-filter: blur(8px);
}
#runbar[hidden] { display: none; }
#runbar .rb-ico {
  font-size: 14px;
  animation: rbSpin 2.2s linear infinite;
}
@keyframes rbSpin { to { transform: rotate(360deg); } }
#runbar b {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#runbar .rb-t {
  opacity: .58;
  white-space: nowrap;
}
#runbar .rb-clock {
  font-variant-numeric: tabular-nums;
  opacity: .85;
  padding: 0 2px;
}
#runbar .rb-stop {
  border: 0;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 92, 92, .18);
  color: #ff9b9b;
  font-size: 12px;
  line-height: 1;
}
#runbar .rb-stop:hover {
  background: rgba(255, 92, 92, .32);
  color: #fff;
}

/* 分镜格质检角标。后端 jobs.py 每镜出完自动判一次，结论写在 shot.qc 里。
   只显示有问题的，65/67 是 ok，全标上等于没标。
   和右下角的「已出图 / 待出视频」角标对称，一个左下…实际是左上，不打架。 */
.fb-gc-qc {
  position: absolute; left: 4px; top: 4px;
  width: 15px; height: 15px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-style: normal; font-weight: 600;
  line-height: 1; color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .55);
  cursor: help; z-index: 2;
}
.fb-gc-qc.bad { background: rgba(224, 58, 58, .94); }
.fb-gc-qc.warn { background: rgba(226, 146, 28, .94); }
.fb-gc-qc.fade { background: rgba(116, 126, 146, .88); }
