/* ============================================================
   Work · wanvas 节点流画布样式（绿色主题）
   纯手写、无框架、无编译。
   结构：变量 → 基础 → 顶栏 → 工具条 → 画布/节点/连线
        → 添加节点浮层 → 配置面板 → 设置抽屉 → 任务中心 → 其他
   ============================================================ */

/* 兜底：带 hidden 属性的元素一律隐藏，防止 .modal/.drawer/.inspector 的
   display 规则覆盖 HTML 的 hidden 属性，导致弹窗常驻且关闭无效 */
[hidden] { display: none !important; }

/* 去掉「全选 / 选中文字」时浏览器默认的高亮背景色（让选择不再带背景块）。
   若调试时需要恢复默认选择高亮，把下面两条整段注释掉即可 */
::selection      { background: transparent; color: inherit; }
::-moz-selection { background: transparent; color: inherit; }

/* ---------- 设计变量 ---------- */
:root {
  color-scheme: dark;

  --bg: #0c0e13;
  --grid-dot: rgba(255, 255, 255, 0.06);
  --grid-line: rgba(255, 255, 255, 0.045);
  --panel: #15171c;
  --panel-2: #1c1f26;
  --border: #2a2e37;
  --border-soft: #22262e;
  --text: #e8eaee;
  --muted: #8b919c;
  --accent: #22c55e;              /* 绿色主色（端口/流动连线/选中描边） */
  --accent-soft: rgba(34, 197, 94, 0.14);
  --accent-border: rgba(34, 197, 94, 0.45);
  --danger: #f87171;
  --warn: #f59e0b;
  --blue: #5b8cff;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --topbar-h: 46px;
  --font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* 浅色主题 */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4;
  --grid-dot: rgba(20, 30, 60, 0.14);
  --grid-line: rgba(20, 30, 60, 0.09);
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --border: #d8dce4;
  --border-soft: #e4e7ee;
  --text: #1c2130;
  --muted: #6b7280;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --shadow: 0 8px 24px rgba(30, 40, 70, 0.12);
}

/* ---------- 主题色（6 种，点击设置里的色块全局生效） ---------- */
/* --accent-ink：叠在主题色上的文字色（浅色主题用深字，深色主题用白字） */
:root[data-accent="green"]  { --accent: #22c55e; --accent-soft: rgba(34, 197, 94, 0.14);  --accent-border: rgba(34, 197, 94, 0.45);  --accent-ink: #06130a; }
:root[data-accent="teal"]   { --accent: #14b8a6; --accent-soft: rgba(20, 184, 166, 0.14); --accent-border: rgba(20, 184, 166, 0.45); --accent-ink: #06130a; }
:root[data-accent="yellow"] { --accent: #eab308; --accent-soft: rgba(234, 179, 8, 0.14);  --accent-border: rgba(234, 179, 8, 0.45);  --accent-ink: #06130a; }
:root[data-accent="orange"] { --accent: #f97316; --accent-soft: rgba(249, 115, 22, 0.14); --accent-border: rgba(249, 115, 22, 0.45); --accent-ink: #06130a; }
:root[data-accent="blue"]   { --accent: #3b82f6; --accent-soft: rgba(59, 130, 246, 0.14); --accent-border: rgba(59, 130, 246, 0.45); --accent-ink: #ffffff; }
:root[data-accent="purple"] { --accent: #a855f7; --accent-soft: rgba(168, 85, 247, 0.14); --accent-border: rgba(168, 85, 247, 0.45); --accent-ink: #ffffff; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 13px; }
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--text); }
svg { display: block; }
kbd {
  padding: 1px 7px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--panel-2);
  font-family: Consolas, monospace; font-size: 11px; color: var(--muted);
}

/* ---------- 加载屏 ---------- */
#app-loading {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg); transition: opacity 0.35s;
}
#app-loading.is-hidden { opacity: 0; pointer-events: none; }
.loader__logo {
  width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700; color: #0c130d;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 62%, #ffffff), var(--accent));
  animation: pulse 1.2s ease-in-out infinite;
}
.loader__text { color: var(--muted); letter-spacing: 4px; font-size: 12px; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.8; } }

/* ---------- 顶栏（悬浮圆角胶囊条） ---------- */
.topbar {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 100;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.topbar__left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar__logo {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #0c130d;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 62%, #ffffff), var(--accent));
}
.topbar__brand { font-weight: 600; font-size: 14px; }
.topbar__divider { width: 1px; height: 16px; background: var(--border); }
.topbar__title {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 8px; width: 180px; color: var(--muted);
  transition: 0.15s;
}
.topbar__title:hover { border-color: var(--border); color: var(--text); }
.topbar__title:focus { outline: none; border-color: var(--accent); color: var(--text); background: var(--panel); }
/* 顶栏「＋」新建画布：无底色，紧邻最后一个画布标签 */
.topbar__add {
  width: 26px; height: 26px; margin-left: 4px; flex-shrink: 0;
  border-radius: 8px; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.topbar__add:hover { background: var(--panel-2); color: var(--text); }
.topbar__add:active { transform: scale(0.9); }

/* 顶栏内的画布标签（多画布，宽度随文字自适应，双击改名） */
.topbar__tabs {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; flex: 0 1 auto; max-width: calc(100% - 130px); height: 100%;
  margin-left: 12px;
  overflow-x: auto; overflow-y: hidden;
}
.topbar__tabs::-webkit-scrollbar { height: 0; }
.ctab {
  display: flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px; max-width: 220px; flex-shrink: 0;
  border: none; background: transparent; color: var(--muted);
  border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.ctab:hover { background: var(--panel-2); color: var(--text); }
.ctab.is-active {
  background: var(--panel-2); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.ctab__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.ctab__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: none; }
.ctab__x {
  margin-left: 1px; width: 15px; height: 15px; flex-shrink: 0;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; line-height: 1; opacity: 0.55; transition: 0.15s;
}
.ctab__x:hover { background: rgba(239, 68, 68, 0.28); color: #f87171; opacity: 1; }
.ctab__edit {
  width: 110px; height: 22px; padding: 0 7px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--accent); border-radius: 6px;
  font-size: 12.5px; font-family: inherit; outline: none;
}

/* 设置 → 全部画布列表 */
.canvas-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cv-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.cv-row.is-active { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cv-row__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cv-row__main b { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-row__main i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.cv-row__ops { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cv-row__cur { font-size: 11.5px; font-weight: 600; color: var(--accent); }
.mini-btn--del:hover { color: #f87171; }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.topbar__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  color: var(--muted); font-size: 12.5px;
  border: 1px solid transparent; transition: 0.15s;
}
.topbar__btn svg { width: 15px; height: 15px; }
.topbar__btn:hover { color: var(--text); background: var(--panel-2); border-color: var(--border); }

/* ---------- 左侧工具条 ---------- */
.leftbar {
  position: fixed; left: 10px; top: 50%; transform: translateY(-50%);
  z-index: 90;
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 5px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: 46px;
  box-shadow: var(--shadow);
}
.leftbar__btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 52px; padding: 9px 0 7px;
  border-radius: 10px;
  color: var(--muted); font-size: 11px;
  transition: 0.15s;
}
.leftbar__btn svg { width: 19px; height: 19px; }
.leftbar__btn:hover, .leftbar__btn.is-active { color: var(--text); background: var(--panel-2); }
.leftbar__btn.is-active { color: var(--accent); background: var(--accent-soft); }

/* ---------- 画布（全屏铺底，顶栏/工具条悬浮其上） ---------- */
#canvas {
  position: absolute; inset: 0;
  overflow: hidden;
  background-image: radial-gradient(circle, var(--grid-dot) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
}
#canvas.grid-line {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
}
#canvas.no-grid { background-image: none; }
#canvas.is-panning { cursor: grabbing; }
#canvas.is-dropping::after {
  content: "松开以上传图片";
  position: absolute; inset: 12px;
  display: grid; place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  color: var(--accent); font-size: 15px;
  background: var(--accent-soft);
  pointer-events: none;
}
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* 连线：默认灰虚线；选中视频节点后，指向它的连线变绿色并流动 */
#edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#edges path.edge {
  fill: none; stroke: #6b7280; stroke-width: 2;
  stroke-dasharray: 6 6; stroke-linecap: round; opacity: 0.95;
}
#edges path.edge--hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
#edges path.edge.is-selected { stroke: var(--accent); stroke-width: 2.4; }
#edges path.edge.is-flow {
  stroke: url(#flowGrad);
  stroke-width: 2.6;
  animation: edgeFlow 0.9s linear infinite;
}
#edges path.edge--temp { stroke: rgba(255, 255, 255, 0.5); stroke-dasharray: 5 5; }
@keyframes edgeFlow { to { stroke-dashoffset: -24; } }

/* ---------- 空画布提示 ---------- */
#emptyHint { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.empty__main {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border);
  font-size: 14px;
}
.empty__main b { font-weight: 600; }
.empty__cursor { display: grid; place-items: center; }
.empty__tips {
  margin-top: 14px;
  display: flex; justify-content: center; gap: 26px;
  color: var(--muted); font-size: 12px;
}
.empty__tips i { font-style: normal; margin-right: 4px; }
.empty__tips em { font-style: normal; color: var(--text); }

/* ---------- 添加节点浮层 ---------- */
.add-popover {
  position: fixed; z-index: 150;
  width: 167px; max-height: 320px; overflow-y: auto;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding-bottom: 6px;
}
.add-popover__head { padding: 11px 14px 7px; font-size: 12px; color: var(--muted); }
.np-item {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 12px); margin: 0 6px;
  padding: 9px 10px;
  text-align: left; border-radius: 9px;
  transition: 0.12s;
  border: 1px solid transparent;
}
.np-item:hover { background: var(--panel-2); border-color: var(--accent-border); }
.np-item__icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border-soft);
  transition: 0.15s;
}
.np-item:hover .np-item__icon { color: var(--text); border-color: var(--border); }
.np-item__meta { display: flex; flex-direction: column; line-height: 1.3; }
.np-item__meta b { font-size: 13px; font-weight: 600; }
.np-item__meta i { font-style: normal; font-size: 10.5px; color: var(--muted); }

/* ---------- 节点（原版风格：标签在上方 + 卡片主体） ---------- */
.node {
  position: absolute;
  background: transparent;
  user-select: none;
  cursor: grab;
}
.node.is-dragging { cursor: grabbing; }

/* 节点上方的小标签 */
.node__label {
  position: absolute; left: 2px; top: -24px;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
  font-size: 11.5px; color: var(--muted);
  pointer-events: none;
}
.node__label span { font-size: 11px; opacity: 0.9; }
.node__label svg { display: block; opacity: 0.9; flex-shrink: 0; }

/* 卡片主体 */
.node__card {
  position: relative;
  background: var(--panel);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.node:hover .node__card { border-color: rgba(255, 255, 255, 0.3); }
.node.is-selected .node__card { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow); }
.node__del {
  position: absolute; right: 7px; top: 7px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ef4444;
  color: #fff; font-size: 13px; line-height: 1;
  opacity: 0; transition: 0.15s;
}
.node:hover .node__del, .node.is-selected .node__del { opacity: 1; }
.node__del:hover { background: #dc2626; transform: scale(1.06); }
.node__replace {
  position: absolute; left: 7px; top: 7px; z-index: 3;
  padding: 3px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #14171d;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  opacity: 0; transition: 0.15s;
}
.node:hover .node__replace, .node.is-selected .node__replace { opacity: 1; }
.node__replace:hover { background: #fff; transform: scale(1.05); }
.node__body { padding: 0; }

/* 端口（实心圆点，金色） */
.port {
  position: absolute; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #14171d;
  cursor: crosshair; z-index: 2;
  transition: transform 0.12s, background 0.12s;
}
.port--left { left: -8px; }
.port--right { right: -8px; }
.port:hover { transform: scale(1.3); background: #fde047; }

/* 图像节点（原版：内层虚线框 + 上传图标 + 上传或粘贴图像） */
.node--image .img-drop {
  margin: 12px;
  height: 176px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.node--image .img-drop:hover { border-color: rgba(255, 255, 255, 0.34); color: #d1d5db; }
.img-drop__icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: #2a2e35;
  display: flex; align-items: center; justify-content: center;
  color: #e5e7eb;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.img-drop__icon:hover {
  background: #343841; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.img-drop__icon:active { transform: scale(0.94); }
.img-drop__icon svg { display: block; }
.img-drop__text { font-size: 13.5px; letter-spacing: 0.5px; }
.img-thumb {
  width: 100%; height: 132px; object-fit: cover;
  display: block; background: #0e1015;
  cursor: pointer;
}
[data-theme="light"] .img-thumb { background: #f3f5f8; }
[data-theme="light"] .node--image .node__card { background: #f5f6f8; }

/* 视频节点（虚线内框 + 居中图标） */
.node--video .vid-drop {
  margin: 12px;
  height: 176px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  border: 1.6px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: #9ca3af;
  transition: border-color 0.15s, color 0.15s;
}
.node--video .vid-drop:hover { border-color: rgba(255, 255, 255, 0.34); color: #c2c7cf; }
.vid-drop__icon { display: block; color: #6b7280; }
.vid-drop__text { font-size: 15px; letter-spacing: 0.5px; }
.node--video .video-state {
  width: 100%; height: 176px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted);
}
.video-state i { font-style: normal; font-size: 13px; }
.node--video video {
  width: 100%; height: 176px; object-fit: cover;
  display: block; background: #000;
}

/* 旋转加载圈 */
.spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent, #34d399);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 视频节点「完成」态：视频 + 下载按钮 */
.vid-wrap { position: relative; width: 100%; height: 176px; background: #000; user-select: none; }
.vid-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-dl {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 12px; line-height: 1; text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
  color: #06130a; background: rgba(255, 255, 255, 0.9);
  font-weight: 600; backdrop-filter: blur(2px);
}
.vid-dl:hover { background: #fff; }

/* 面板内的实时进度横幅 */
.gen-progress {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; margin-top: 4px;
  border-radius: 10px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: #b9f0d8; font-size: 13px;
}
.gen-progress i { font-style: normal; letter-spacing: 0.3px; }

/* ---------- 左下角 ---------- */
.corner { position: fixed; left: 12px; bottom: 12px; z-index: 90; display: flex; gap: 8px; }
.round-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--border);
  color: var(--muted); font-size: 14px;
  box-shadow: var(--shadow); transition: 0.15s;
}
.round-btn svg { width: 15px; height: 15px; }
.round-btn:hover { color: var(--text); border-color: var(--muted); }

/* ---------- 右下角视图工具 ---------- */
.viewbar {
  position: fixed; right: 16px; bottom: 14px; z-index: 90;
  display: flex; align-items: center; gap: 3px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.viewbar__btn {
  min-width: 26px; height: 26px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 6px; color: var(--muted); font-size: 14px;
  transition: 0.12s;
}
.viewbar__btn svg { width: 14px; height: 14px; }
.viewbar__btn:hover { color: var(--text); background: var(--panel-2); }
.viewbar__btn.is-active { color: var(--accent); }
.viewbar__zoom { min-width: 42px; text-align: center; font-size: 11.5px; color: var(--muted); }
.viewbar__sep { width: 1px; height: 14px; background: var(--border); margin: 0 3px; }
.viewbar__slider { display: flex; align-items: center; }
.viewbar__slider input { width: 74px; accent-color: var(--accent); }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  width: 34px; height: 19px; border-radius: 999px;
  background: var(--border); position: relative; transition: 0.18s;
}
.switch span::after {
  content: ""; position: absolute; left: 2.5px; top: 2.5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: 0.18s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch--sm span { width: 30px; height: 17px; }
.switch--sm span::after { width: 12px; height: 12px; }
.switch--sm input:checked + span::after { transform: translateX(13px); }

/* ---------- 节点配置面板（贴在视频节点下方） ---------- */
.inspector {
  position: fixed; z-index: 95;
  width: 640px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px 14px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.ins-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 26px; }
.ins-refs img {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.18);
}
.ins-tools { display: flex; gap: 4px; margin-left: auto; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--muted); transition: 0.12s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.is-active { color: var(--accent); background: var(--accent-soft); }

#cfgPrompt {
  width: 100%; min-height: 150px; padding: 12px 14px;
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  color: var(--text); font-size: 13px; line-height: 1.6;
  resize: vertical; transition: border-color 0.15s;
}
#cfgPrompt::placeholder { color: var(--muted); }
#cfgPrompt:focus { outline: none; border-color: rgba(255, 255, 255, 0.22); }

.ins-bar { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.ins-bar .pill { height: 34px; padding: 0 8px; }
.ins-bar .pill input { width: 46px; font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 38px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px;
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap;
}
.pill:focus-within, .pill:hover { border-color: rgba(255, 255, 255, 0.2); }
.pill input {
  width: 56px; background: transparent; border: 0;
  color: var(--text); font-size: 13px; font-weight: 600; text-align: center;
}
.pill input:focus { outline: none; }
.pill input::placeholder { color: var(--muted); font-weight: 400; }
.pill input::-webkit-outer-spin-button, .pill input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pill input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.pill-seed { width: 58px !important; flex-shrink: 0; }
.pill .mini-btn { padding: 4px 7px; border-radius: 8px; background: transparent; border: 0; font-size: 14px; cursor: pointer; }
.pill .mini-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* 「生成视频」按钮：实心样式（绿底白字）+ 文字前小星星图标 */
.play-btn {
  min-width: 76px; height: 28px; padding: 0 12px; flex-shrink: 0;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--accent);
  border: 1.5px solid var(--accent);
  color: #fff; font-size: 13px; font-weight: 600;
  transition: 0.15s;
}
.play-btn .gen-star { flex-shrink: 0; }
.play-btn:hover { filter: brightness(1.1); }
.play-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
/* 随机种子按钮：与生成按钮同高 */
.ins-bar .mini-btn { height: 28px; padding: 0 10px; display: inline-grid; place-items: center; }

select.pill-sel {
  background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px; height: 34px; padding: 0 6px;
  color: var(--text); font-size: 12px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
select.pill-sel:hover { border-color: rgba(255, 255, 255, 0.2); }
select.pill-sel:focus { outline: none; border-color: rgba(255, 255, 255, 0.2); }

/* 面板全屏（最大化）状态 */
#inspector:fullscreen {
  left: 0 !important; top: 0 !important;
  width: 100vw; max-width: 100vw;
  height: 100vh; max-width: none;
  border-radius: 0; border: 0;
  padding: max(18px, env(safe-area-inset-top)) 22px 22px;
  justify-content: center;
}
#inspector:fullscreen #cfgPrompt { min-height: 45vh; flex: 1; }

/* 更多参数（齿轮/书签展开区） */
.ins-more {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panel-2) 45%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-size: 12px; color: var(--muted);
}
.ins-more label { display: inline-flex; align-items: center; gap: 7px; }
.ins-more select { height: 30px; font-weight: 500; padding: 0 8px; }

.cfg-warn { font-size: 11.5px; line-height: 1.5; color: var(--danger); }

.mini-btn {
  padding: 6px 12px; border-radius: 8px; flex-shrink: 0;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; transition: 0.15s;
}
.mini-btn:hover { color: var(--text); border-color: var(--muted); }
.mini-btn--lg { padding: 7px 16px; }

/* ---------- 登录门（配色跟随当前主题） ---------- */
#loginGate {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: rgba(9, 10, 14, 0.82);
  backdrop-filter: blur(6px);
}
.login-card {
  width: min(400px, calc(100vw - 40px));
  padding: 36px 32px 28px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.login-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: 0.5px; }
.login-desc { margin: 10px 0 24px; font-size: 13px; color: var(--muted); }
.login-input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.login-input::placeholder { color: var(--muted); }
.login-input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%; height: 44px; margin-top: 14px;
  background: var(--accent); 
  border: none; border-radius: 12px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: filter 0.15s, transform 0.1s;
}
.login-btn:hover { filter: brightness(1.1); }
.login-btn:active { transform: scale(0.98); }
.login-err { min-height: 18px; margin-top: 10px; font-size: 12px; color: var(--danger); }
.login-hint { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
#loginGate.shake .login-card { animation: login-shake 0.35s; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ---------- 设置抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 180; }
.drawer__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.drawer__panel {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: min(420px, 92vw);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
  font-size: 16px; font-weight: 600;
}
.drawer__x { color: var(--muted); font-size: 18px; }
.drawer__tabs {
  display: flex; gap: 4px;
  margin: 0 18px 12px; padding: 3px;
  background: var(--panel-2); border-radius: 10px;
}
.drawer__tab {
  flex: 1; padding: 7px 0; border-radius: 8px;
  color: var(--muted); font-size: 12.5px; transition: 0.15s;
}
.drawer__tab.is-active { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.drawer__page { flex: 1; overflow-y: auto; padding: 2px 18px 20px; display: flex; flex-direction: column; gap: 12px; }

.card {
  padding: 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border-soft);
}
.card__title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.card__desc { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 10px; }
.card--me { display: flex; align-items: center; gap: 12px; }
.me-avatar {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); border: 1.5px solid var(--accent);
  color: var(--accent); font-size: 20px;
}
.card--me b { display: block; font-size: 15px; }
.card--me i { font-style: normal; font-size: 11.5px; color: var(--muted); }

.kv {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--muted); flex-shrink: 0; }

/* 设置 → 主题色块（6 选 1，全局生效） */
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 26px; height: 26px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--sw);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
  transition: transform 0.12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sw); }
.swatch.is-active::after { content: "✓"; }
.swatch[data-a="yellow"].is-active::after,
.swatch[data-a="orange"].is-active::after { color: rgba(0, 0, 0, 0.55); }
.kv-input {
  width: 190px; padding: 7px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
}
.kv-input:focus { outline: none; border-color: var(--accent); }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.btn {
  padding: 8px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 500; transition: 0.15s;
}
.btn--primary { background: var(--accent); color: #06130a; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: var(--panel); border: 1px solid var(--border); color: var(--muted); }
.btn--ghost:hover { color: var(--text); border-color: var(--muted); }
/* 危险操作按钮（清空画布 / 退出）：跟随当前主题色，与登录按钮一致 */
.btn--danger { background: var(--accent);  border: 1px solid var(--accent); font-weight: 600; }
.btn--danger:hover { filter: brightness(1.1); }
.btn--block { width: 100%; margin-top: 10px; }

/* 服务商卡片 */
.provider-card {
  padding: 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel-2);
}
.provider-card .p-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.provider-card .p-head b { font-size: 13px; }
.provider-card .p-del { color: var(--muted); font-size: 14px; }
.provider-card .p-del:hover { color: var(--danger); }
.provider-card .field { margin-bottom: 8px; }

/* 二维码占位 */
.qr-box { display: grid; place-items: center; padding: 14px 0 4px; }
#qrFake { border-radius: 8px; background: #fff; padding: 8px; }
#qrFake rect { fill: #222; }

/* ---------- 全屏模式（只保留图像/视频节点，其余界面全部隐藏） ---------- */
body.is-zen .topbar,
body.is-zen .leftbar,
body.is-zen .viewbar,
body.is-zen .corner,
body.is-zen #emptyHint,
body.is-zen #inspector { display: none !important; }

/* ---------- 任务中心 ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.modal__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
.modal__card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal__card--wide { width: min(520px, calc(100vw - 32px)); }
/* 任务中心：右侧全高抽屉（与设置抽屉同风格，从右侧打开） */
#tasksModal { place-items: stretch end; padding-right: 0; }
#tasksModal .modal__card--wide {
  width: min(420px, 92vw);
  height: 100%;
  max-height: 100%;
  border-radius: 16px 0 0 16px;
  border-left: 1px solid var(--border);
  border-right: 0;
}
#tasksModal .modal__body { flex: 1; min-height: 0; }
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 16px 10px;
}
.modal__head b { font-size: 15px; }
.modal__sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.modal__x { color: var(--muted); font-size: 17px; }
.modal__x:hover { color: var(--text); }
.modal__body { padding: 4px 16px 16px; overflow-y: auto; }

.stats-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.stat {
  padding: 10px 4px; text-align: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2);
}
.stat b { display: block; font-size: 17px; }
.stat i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.stat.is-hit { border-color: var(--accent-border); background: var(--accent-soft); }

.filter-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.filter-row .switch { margin-right: 4px; }

/* 任务卡片 */
.task-card {
  padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel-2);
}
.task-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.task-card__head b { font-size: 13.5px; }
.badge {
  padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 500;
}
.badge--ok { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.badge--run { background: rgba(91, 140, 255, 0.12); color: var(--blue); border: 1px solid rgba(91, 140, 255, 0.4); }
.badge--fail { background: rgba(248, 113, 113, 0.12); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.4); }
.badge--tag { background: var(--panel); color: var(--muted); border: 1px solid var(--border); }
.task-kv { display: flex; gap: 8px; font-size: 12px; padding: 2.5px 0; }
.task-kv > span { color: var(--muted); flex-shrink: 0; }
.task-kv > i { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-kv > i.is-err { color: var(--danger); }
.task-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.task-empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 12.5px; }

.detail-pre {
  font-family: Consolas, monospace; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px;
  white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow: auto;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: calc(var(--topbar-h) + 14px); left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 9px 18px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  border: 1px solid var(--border);
  color: var(--text); font-size: 13px;
  box-shadow: var(--shadow);
  animation: drop 0.25s ease;
  max-width: 70vw;
}
.toast.ok { border-color: var(--accent-border); }
.toast.err { border-color: rgba(248, 113, 113, 0.4); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }


/* ---------- 面板参考图卡片（可点选 / 拖动排序；单行放下 9 张不换行） ---------- */
/* 注意：不能加 overflow（会裁剪挂在里面的 .ref-picker 弹层） */
.ins-refs { position: relative; display: flex; gap: 5px; flex-wrap: nowrap; }
@media (max-width: 680px) {
  .ins-refs { flex-wrap: wrap; }
}
.ref-chip {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 3px;
  background: var(--panel-2);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: grab; transition: 0.12s;
}
.ref-chip:hover { border-color: rgba(255, 255, 255, 0.28); }
.ref-chip.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.ref-chip img { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; pointer-events: none; }
.ref-chip i { font-style: normal; font-size: 10px; color: var(--muted); line-height: 1; }
.ref-chip.is-active i { color: var(--accent); }
.ref-chip.is-drag-over { border-color: var(--accent); transform: translateY(-2px); }

/* ＋ 快捷添加按钮（选择画布图片 / 上传新图） */
.ref-add {
  width: 48px; height: 48px; border-radius: 9px; flex-shrink: 0;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  display: grid; place-items: center;
  font-size: 18px; line-height: 1; color: var(--muted);
  cursor: pointer; user-select: none;
}
.ref-add:hover { border-color: var(--accent); color: var(--accent); }

/* ＋ 弹出的画布图片快选层 */
.ref-picker {
  position: absolute; z-index: 40;
  top: calc(100% + 6px); left: 0;
  width: 264px; max-height: 250px; overflow: auto;
  background: var(--panel, #14161c);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px; padding: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}
.ref-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.ref-picker__head b { font-size: 12px; color: var(--text); }
.ref-picker__up {
  font-size: 11px; color: var(--accent);
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px; padding: 3px 8px; cursor: pointer;
}
.ref-picker__up:hover { border-color: var(--accent); }
.ref-picker__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ref-picker__item {
  aspect-ratio: 1; border-radius: 7px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ref-picker__item:hover { border-color: var(--accent); }
.ref-picker__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-picker__empty { font-size: 11.5px; color: var(--muted); margin: 4px 0 2px; }

/* ---------- 上传弹窗 ---------- */
.up-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 30px 16px; margin-bottom: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  color: var(--muted); transition: 0.15s; cursor: pointer;
}
.up-drop svg { width: 30px; height: 30px; opacity: 0.8; }
.up-drop b { font-size: 13.5px; color: var(--text); font-weight: 600; }
.up-drop i { font-style: normal; font-size: 11.5px; }
.up-drop:hover, .up-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.up-url { display: flex; gap: 8px; }
.up-url input {
  flex: 1; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  transition: border-color 0.15s;
}
.up-url input:focus { outline: none; border-color: var(--accent); }

/* ---------- 媒体全屏查看（双击图片/视频打开；Esc/点击遮罩/× 关闭） ---------- */
#mediaView {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
}
#mediaView .mv__mask {
  position: absolute; inset: 0;
  background: rgba(9, 10, 14, 0.88);
  backdrop-filter: blur(4px);
}
#mediaView .mv__x {
  position: absolute; right: 18px; top: 16px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, 0.12);
  color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
  transition: background 0.15s;
}
#mediaView .mv__x:hover { background: rgba(255, 255, 255, 0.24); }
.mv__img {
  position: relative; z-index: 1;
  max-width: calc(100vw - 48px); max-height: calc(100vh - 48px);
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.mv__vid {
  position: relative; z-index: 1;
  width: min(1280px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
  border-radius: 10px; background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ---------- 参考图拾取模式 ---------- */
/* 画布上可添加的图片：主题色圈 + 指针；已连线的：绿色圈 */
#canvas .node.is-pickable {
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent);
  cursor: pointer;
  outline: none;
}
#canvas .node.is-refpicked {
  box-shadow: 0 0 0 3px #22c55e, 0 0 0 6px color-mix(in srgb, #22c55e 35%, transparent);
  cursor: pointer;
  outline: none;
}
.refpick-hint {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 250;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--accent-border);
  box-shadow: var(--shadow); font-size: 13px;
  pointer-events: none;
}
.refpick-hint kbd {
  padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel-2); font-family: inherit; font-size: 12px;
}
