/* ═══════════ 加吉设计云 · 无限画布工作区（V4.0.0；V4.2.0 起黑色主题） ═══════════ */
:root {
  /* V4.2.0 画布以黑色为主：底色是「单 K100」纯黑（CMYK 0/0/0/100 = #000000），
     周围所有界面（顶栏/工具条/菜单/弹窗）统一深色；卡片里的功能页仍保持原样，所见即所得。 */
  --bg: #000000;
  --panel: #15171c;
  --surface: #1b1e24;
  --surface-2: #22262f;
  --ink: #f2f4f8;
  --sub: #9aa3b2;
  --line: #272b33;
  --b1: #ff4d4f;
  --b2: #e7eaef;
  --b3: #cfd4dc;
  --grad: linear-gradient(135deg, #f2f4f8 0%, #d6dbe3 60%, #b9bfc9 120%);
  --grad-soft: linear-gradient(135deg, #f4f5f7 0%, #e9ebef 100%);
  --ok: #16a34a;
  --err: #e5484d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --top-h: 54px;
  /* V4.9.0 画布底色双模式（运营方要求）：黑底 = K100 纯黑；白底 = K20 偏灰（#CCCCCC） */
  --cv-bg: #000000;
  --cv-dot: rgba(255, 255, 255, 0.10);
  --cv-empty: rgba(255, 255, 255, 0.30);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); overflow: hidden;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
svg { display: block; }

/* ═══ 顶栏 ═══ */
#cvTopbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: rgba(10, 11, 14, 0.86);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.cv-brand { display: flex; align-items: center; gap: 10px; }
.cv-logo {
  width: 28px; height: 28px; border-radius: 9px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; font-family: STKaiti, KaiTi, serif;
}
.cv-brand b { font-size: 15px; font-weight: 800; letter-spacing: 0.2px; }
.cv-ver, .cv-cloud { font-size: 11px; color: var(--sub); background: rgba(255, 255, 255, 0.07); padding: 3px 8px; border-radius: 8px; }
.cv-cloud.ok { color: #4ade80; background: rgba(34, 197, 94, 0.16); }
.cv-cloud.fail { color: #f87171; background: rgba(239, 68, 68, 0.16); }
/* V4.4.0 画布存档同步状态（内容实时保存在云服务器） */
.cv-sync { font-size: 11px; color: var(--sub); background: rgba(255, 255, 255, 0.07); padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.cv-sync.saved { color: #4ade80; background: rgba(34, 197, 94, 0.16); }
.cv-sync.saving { color: #fbbf24; background: rgba(245, 158, 11, 0.16); }
.cv-sync.error { color: #f87171; background: rgba(239, 68, 68, 0.16); }
.cv-sync.off { color: var(--sub); }
.cv-top-right { display: flex; align-items: center; gap: 8px; }
.cv-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 10px;
  box-shadow: var(--shadow-sm); transition: transform 0.12s ease, border-color 0.12s ease;
}
.cv-chip:hover { transform: translateY(-1px); border-color: #ffd7c2; }
.cv-chip.primary { background: var(--grad); color: #15181d; border-color: transparent; }
.cv-chip.ghost { background: var(--surface); color: #d7dbe4; }

/* ═══ V4.9.0 右上角头像（点头像弹「账号面板」） ═══ */
.cv-avatar {
  position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--grad); color: #15181d; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: transform 0.12s ease;
}
.cv-avatar:hover { transform: translateY(-1px); }
.cv-avatar-dot {
  position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: #ff4d4f; border: 2px solid var(--bg);
}

/* ═══ V4.9.0 账号面板 ═══ */
#cvUserPanel {
  position: fixed; z-index: 78; width: 328px; max-height: min(80vh, 660px); overflow: auto;
  padding: 14px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); backdrop-filter: blur(10px);
}
.up-head { display: flex; align-items: center; gap: 10px; }
.up-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--grad); color: #15181d; font-size: 17px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.up-id { min-width: 0; }
.up-id b { display: block; font-size: 14px; color: var(--ink); }
.up-id span { display: block; font-size: 11px; color: var(--sub); margin-top: 3px; word-break: break-all; }
.up-vip {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.up-vip-top { display: flex; align-items: center; gap: 8px; }
.up-vip-top b { font-size: 12.5px; color: #ffd0b8; }
.up-vip-until { font-size: 11px; color: var(--sub); margin-right: auto; }
.up-vip-btn {
  border: 1px solid rgba(255, 255, 255, 0.55); background: transparent; color: #ffffff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 8px;
}
.up-vip-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.up-vip-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); margin-top: 8px; overflow: hidden; }
.up-vip-bar i { display: block; height: 100%; background: var(--grad); }
.up-block { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.up-row { display: flex; align-items: center; gap: 8px; }
.up-lb { font-size: 12px; color: var(--sub); }
.up-num { font-size: 15px; color: var(--ink); font-weight: 800; margin-right: auto; font-variant-numeric: tabular-nums; }
.up-mini { border: 0; background: rgba(255, 255, 255, 0.08); color: #cfd6e2; font-size: 11px; padding: 4px 9px; border-radius: 8px; }
.up-mini:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.up-sub { font-size: 11px; color: var(--sub); margin-top: 6px; }
.up-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); margin-top: 8px; overflow: hidden; }
.up-bar i { display: block; height: 100%; background: var(--grad); }
.up-sep { height: 1px; background: var(--line); margin: 12px 0; }
.up-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: transparent; color: #dfe4ec; font-size: 13px; border-radius: 10px; text-align: left;
}
.up-item:hover { background: rgba(255, 255, 255, 0.07); }
.up-item i { font-style: normal; width: 18px; text-align: center; }
.up-item em { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--sub); }
.up-item.up-danger { color: #ff9a9b; }
.up-item.up-danger:hover { background: rgba(255, 77, 79, 0.14); }
.up-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff4d4f; color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-left: auto;
}
.up-notices { margin-top: 8px; max-height: 230px; overflow: auto; }
.up-notices .un-item { padding: 9px 12px; border-radius: 10px; background: var(--surface); margin-bottom: 6px; }
.up-notices .un-item b { display: block; font-size: 12.5px; color: var(--ink); }
.up-notices .un-item p { font-size: 11.5px; color: var(--sub); margin-top: 4px; line-height: 1.55; white-space: pre-wrap; }
.up-notices .un-item span { display: block; font-size: 10.5px; color: #7c8598; margin-top: 5px; }
.up-empty { padding: 16px; text-align: center; font-size: 12px; color: var(--sub); }

/* ═══ V4.9.0 画布底色双模式：白底时把提示文字改成深色（否则浅灰底上看不见） ═══ */
body.theme-light { --cv-bg: #cccccc; --cv-dot: rgba(0, 0, 0, 0.13); --cv-empty: rgba(0, 0, 0, 0.40); }
body.theme-light #cvEmpty { color: var(--cv-empty); }

/* ═══ 左上角：画布切换器 ═══ */
#cvDocBar { position: fixed; left: 14px; top: calc(var(--top-h) + 10px); z-index: 36; display: flex; align-items: center; gap: 8px; }
.doc-btn, .doc-new {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(22, 24, 29, 0.94);
  box-shadow: var(--shadow-sm); font-size: 12.5px; font-weight: 600; color: #e6e9f0;
}
.doc-btn:hover, .doc-new:hover { border-color: #ffd7c2; }
.doc-btn .doc-ico svg { width: 16px; height: 16px; }
.doc-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-caret { color: #8b93a3; font-size: 10px; }
.doc-new { color: #e7eaef; }
.doc-new svg { width: 15px; height: 15px; }

/* ═══ 画布视口 ═══ */
#cvViewport { position: fixed; inset: var(--top-h) 0 0 0; overflow: hidden; touch-action: none; }
/* ★ V4.17.6 快照画布：盖在世界层上面，不拦鼠标（拖拽/滚轮仍由视口处理） */
#cvSnap { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#cvViewport.grabbing { cursor: grabbing; }
#cvGrid {
  position: absolute; inset: 0; pointer-events: none;
  background-color: var(--cv-bg);   /* V4.9.0 跟随「模式切换」：黑底 K100 / 白底 K20 */
  background-image: radial-gradient(circle, var(--cv-dot) 1px, transparent 1px);
  background-size: 28px 28px;
}
#cvWorld {
  position: absolute; top: 0; left: 0; width: 0; height: 0; transform-origin: 0 0; z-index: 2;
  /* ★ V4.17.3 曾在这里把「提升为独立合成层」做成常驻（缩放交给合成器）。
     ★★ V4.17.5 改为**动态开关**（见 canvas.js 的 lodTouchInput）—— 常驻会有一个真实事故：
     运营方机器上「画布缩小后出现断层色块、丢内容」：常驻合成层在 2.5 万×1.4 万像素的世界范围上
     瓦片栅格化失败（GTX 1630 + ToDesk 虚拟显示），没画出来的瓦片变成灰色断层、节点跟着"消失"。
     现在只在拖动 / 缩放期间提升，停止 450ms 后交还浏览器 —— 浏览器就能在空闲时丢弃这个
     巨型层、按当前缩放重新栅格化；手势期间的性能收益（V4.17.3 实测 8 个 longtask → 0）保留。 */
}
#cvCards { position: absolute; top: 0; left: 0; width: 0; height: 0; }

/* ═══ 卡片 ═══ */
.cv-card {
  position: absolute; display: flex; flex-direction: column;
  background: #ffffff; border: 1px solid #2b3038; border-radius: 14px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.62);
  overflow: visible;   /* 连线端口要露在边线上，裁切交给 .cv-body */
  will-change: transform;
}
.cv-card.active { border-color: #ffffff; box-shadow: 0 14px 38px rgba(255, 255, 255, 0.18); }
.cv-card.closing { opacity: 0; transform: scale(0.96); transition: opacity 0.14s ease, transform 0.14s ease; }
.cv-head {
  height: 38px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 12px; cursor: grab;
  background: var(--grad-soft); border-bottom: 1px solid #f0e8e4;
  border-radius: 14px 14px 0 0; user-select: none;
}
.cv-head:active { cursor: grabbing; }
.cv-head .ico { font-size: 14px; line-height: 1; }
.cv-head .name { font-size: 12.5px; font-weight: 800; color: #333d57; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-acts { display: flex; gap: 2px; }
.cv-acts button {
  width: 24px; height: 24px; border: 0; background: transparent; border-radius: 7px;
  color: #7a8194; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.cv-acts button:hover { background: rgba(31, 35, 41, 0.07); color: #1f2329; }
.cv-body { flex: 1; min-height: 0; position: relative; background: #fff; overflow: hidden; border-radius: 0 0 14px 14px; }
.cv-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.cv-body .cv-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: #7a8194; background: #fbfcff; }
/* V4.3.1 加载慢/失败时就地给「点这里重新加载」（卡片是浅色，文字保持深色，别用深色主题的浅色字） */
.cv-body .cv-load.retry { flex-direction: column; gap: 10px; cursor: pointer; }
.cv-body .cv-load .cv-retry { font-style: normal; font-size: 12px; font-weight: 600; color: #d92c2e; border: 1px solid rgba(217,44,46,.35); background: rgba(217,44,46,.08); padding: 3px 10px; border-radius: 999px; }
.cv-body .cv-load.retry:hover .cv-retry { background: rgba(217,44,46,.16); }
.cv-resize {
  position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(31, 35, 41, 0.16) 50%);
  border-bottom-right-radius: 14px;
}
body.cv-dragging iframe { pointer-events: none !important; }
body.cv-dragging { user-select: none; }

/* V4.1.0 起上传/粘贴的图片是「画布图片节点」（.cv-img-node，见下方），不再套卡片窗口；
   旧的三组"图片卡片"样式（卡片下的 img 变体 / .cv-imgwrap / 图片尺寸角标）已随旧形态一并删除。 */
.cv-card.drop-hot { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18), 0 10px 30px rgba(31, 35, 41, 0.10); }

/* ═══ 空状态 ═══ */
#cvEmpty { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
#cvEmpty .t { font-size: 15px; font-weight: 700; color: #e8ecf4; margin-bottom: 8px; }
#cvEmpty .d { font-size: 12.5px; color: var(--sub); line-height: 1.9; }

/* ═══ 连线 ═══ */
#cvEdges { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.cv-wire-halo { fill: none; stroke: #05070a; stroke-width: 5.5; stroke-linecap: round; opacity: 0.9; }
.cv-wire { fill: none; stroke: #9fb0e0; stroke-width: 2.4; stroke-linecap: round; }
.cv-wire-hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
.cv-wire.on { stroke: #e7eaef; stroke-width: 3; }
.cv-wire.flash { stroke: #ff4d4f; stroke-width: 3.4; }
.cv-wire.temp { stroke-dasharray: 6 5; stroke: #e7eaef; }
.cv-edge-del {
  position: absolute; z-index: 6; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 1px solid #6b3a34; background: var(--surface); color: #ff8a8a;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); cursor: pointer;
}
.cv-edge-del:hover { background: #2a2026; }
/* ★★ V4.27.0 连接点大改（对齐 liblib 图2）：
   · 平时隐藏，鼠标移入节点范围才显示；移出自动隐藏；
   · 样式 = 白底圆圈 + 灰色加号（带阴影）；
   · 连线进行中（body.cv-linking）所有 in 点保持可见，否则不知道往哪拖。 */
.cv-port {
  position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  border-radius: 50%; background: #fff; border: 1.5px solid #d6dbe4; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.cv-port::after { content: "+"; font-size: 15px; font-weight: 700; color: #8a93a6; line-height: 1; }
.cv-img-node:hover .cv-port, .cv-card:hover .cv-port, body.cv-linking .cv-port.in { opacity: 1; pointer-events: auto; }
.cv-port.in { left: -11px; }
.cv-port.out { right: -11px; cursor: crosshair; }
.cv-port.out:hover { transform: scale(1.2); border-color: #9aa5c4; }
.cv-port.in:hover { transform: scale(1.15); }
.cv-card.linkable .cv-port.in { border-color: #16a34a; background: #e8f7ef; transform: scale(1.3); }
.cv-card.link-src { border-color: #e7eaef; }
body.cv-linking { cursor: crosshair; }
body.cv-linking iframe { pointer-events: none !important; }

/* ═══ 底部居中悬浮工具条（只图标 + 悬停名称） ═══ */
#cvDock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 35;
  display: flex; align-items: center; gap: 4px; padding: 6px 8px;
  background: rgba(20, 22, 27, 0.96); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px); max-width: calc(100vw - 260px);
}
.dock-items, .dock-tools { display: flex; align-items: center; gap: 2px; }
.dock-items { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.dock-items::-webkit-scrollbar { display: none; }
.cv-dock-btn {
  position: relative; width: 38px; height: 38px; flex: none; border: 0; background: transparent;
  border-radius: 11px; color: #c3cad8; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.cv-dock-btn:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; }
.cv-dock-btn svg { width: 20px; height: 20px; }
.cv-dock-btn.off { opacity: 0.32; }
.cv-dock-btn .bdg {
  position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px; background: #e7eaef; color: #fff; font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.dock-tool {
  width: 34px; height: 34px; border: 0; background: transparent; border-radius: 10px;
  color: #a8b0c0; display: flex; align-items: center; justify-content: center;
}
.dock-tool:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; }
.dock-tool svg { width: 18px; height: 18px; }
.dock-zoom { font-size: 11.5px; color: var(--sub); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }

/* V4.8.8 工具条二次确认气泡（浮在按钮上方；原生 confirm 在桌面壳里不可靠，改自绘） */
#cvDockConfirm {
  position: fixed; z-index: 94; transform: translateY(-100%);
  display: flex; align-items: center; gap: 8px; max-width: min(460px, calc(100vw - 32px));
  padding: 8px 10px 8px 13px; border-radius: 12px;
  background: rgba(20, 22, 27, 0.97); border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); backdrop-filter: blur(10px);
}
#cvDockConfirm .dq { color: #d8dde8; font-size: 12px; line-height: 1.45; }
#cvDockConfirm .dq-no, #cvDockConfirm .dq-yes {
  flex: none; border: 1px solid var(--line); background: transparent; color: #c3cad8;
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 9px; cursor: pointer;
}
#cvDockConfirm .dq-no:hover { border-color: #7a8496; color: #fff; }
#cvDockConfirm .dq-yes { border-color: rgba(255, 255, 255, 0.55); color: #ffffff; }
#cvDockConfirm .dq-yes:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
#cvDockConfirm .dq-yes.danger { border-color: rgba(255, 77, 79, 0.65); color: #ff9a9b; }
#cvDockConfirm .dq-yes.danger:hover { background: rgba(255, 77, 79, 0.2); color: #fff; }

/* 自绘名称气泡（悬停显示） */
#cvTip {
  position: fixed; z-index: 92; pointer-events: none; transform: translate(-50%, -100%);
  background: #2b2f36; color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
#cvTip::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-top-color: #2b2f36; }

/* ═══ 左下角：资产管理 / 小地图 ═══ */
#cvBottomLeft { position: fixed; left: 14px; bottom: 16px; z-index: 36; display: flex; align-items: center; gap: 8px; }
.bl-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(20, 22, 27, 0.96); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; color: #c3cad8;
}
.bl-btn:hover { border-color: #e7eaef; color: #ffffff; }
.bl-btn.on { background: rgba(255, 255, 255, 0.18); border-color: #3a4048; color: #e7eaef; }
.bl-btn svg { width: 19px; height: 19px; }
#cvMiniPop {
  position: absolute; left: 0; bottom: calc(100% + 10px); width: 190px; height: 128px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6); overflow: hidden;
}
#cvMiniCanvas { width: 190px; height: 128px; display: block; }

/* ═══ 弹层通用 ═══ */
.cv-mask {
  position: fixed; inset: 0; z-index: 74; background: rgba(0, 0, 0, 0.62);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(1.5px);
}
.proj-x {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px; border: 0;
  background: transparent; color: #98a0b3; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.proj-x:hover { background: rgba(255, 255, 255, 0.09); color: var(--ink); }

/* 全部项目 */
.proj-box { width: min(980px, 92vw); max-height: 84vh; background: var(--panel); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); }
.proj-head { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.proj-head b { font-size: 15px; font-weight: 800; }
.proj-sub { font-size: 12px; color: var(--sub); }
.proj-new { margin-left: auto; display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid #3a4048; background: rgba(255, 255, 255, 0.16); color: #e7eaef; font-size: 12.5px; font-weight: 700; }
.proj-new svg { width: 14px; height: 14px; }
.proj-grid { padding: 16px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.proj-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; position: relative; }
.proj-card:hover { border-color: #c9ced8; box-shadow: 0 10px 26px rgba(255, 255, 255, 0.14); }
.proj-card.on { border-color: #e7eaef; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16); }
.proj-thumb { height: 128px; background: #0f1115; border-bottom: 1px solid var(--line); }
.proj-thumb svg { width: 100%; height: 100%; display: block; }
.proj-meta { padding: 10px 12px 12px; }
.proj-name { font-size: 13px; font-weight: 700; color: #e6e9f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-info { font-size: 11.5px; color: var(--sub); margin-top: 4px; }
.proj-acts { display: flex; gap: 6px; margin-top: 9px; }
.proj-acts button { flex: 1; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: #cfd6e2; }
.proj-acts button:hover { border-color: #e7eaef; color: var(--ink); }
.proj-acts button.danger:hover { border-color: #6b3a34; color: #ff8a8a; }

/* 资产管理 */
.asset-box { width: min(1020px, 94vw); max-height: 86vh; background: var(--panel); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); }
.asset-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.asset-head b { font-size: 15px; font-weight: 800; }
.asset-head input { flex: 1; max-width: 320px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; outline: none; background: #12141a; color: var(--ink); }
.asset-head input:focus { border-color: #e7eaef; }
.asset-refresh { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: #a8b0c0; display: flex; align-items: center; justify-content: center; }
.asset-refresh svg { width: 16px; height: 16px; }
.asset-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
.asset-tag { border: 1px solid var(--line); background: var(--surface); color: #cfd6e2; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.asset-tag.on { background: rgba(255, 255, 255, 0.18); border-color: #3a4048; color: #e7eaef; }
.asset-grid { padding: 14px 16px 18px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 13px; }
.asset-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--surface); }
.asset-card:hover { border-color: #c9ced8; box-shadow: 0 10px 24px rgba(255, 255, 255, 0.12); }
.asset-img { height: 128px; background: #0f1115; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-meta { padding: 9px 10px 10px; }
.asset-name { font-size: 12.5px; font-weight: 700; color: #e6e9f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tagline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; min-height: 18px; }
.asset-tagline span { font-size: 10.5px; color: #e7eaef; background: rgba(255, 255, 255, 0.16); border: 1px solid #333a44; padding: 1px 6px; border-radius: 6px; }
.asset-info { font-size: 10.5px; color: var(--sub); margin-top: 5px; }
.asset-acts { display: flex; gap: 5px; margin-top: 8px; }
.asset-acts button { flex: 1; height: 27px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-size: 11px; font-weight: 600; color: #cfd6e2; }
.asset-acts button:hover { border-color: #e7eaef; color: var(--ink); }
.asset-acts button.main { border-color: #3a4048; background: rgba(255, 255, 255, 0.16); color: #e7eaef; }
.asset-acts button.danger:hover { border-color: #6b3a34; color: #ff8a8a; }
.asset-empty { padding: 8px 18px 22px; font-size: 12.5px; color: var(--sub); }

/* 保存资产弹窗 */
.save-box { width: min(680px, 94vw); background: var(--panel); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); }
.save-head { display: flex; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.save-head b { font-size: 15px; font-weight: 800; }
.save-body { display: flex; gap: 18px; padding: 18px 18px 6px; }
.save-thumb { width: 208px; flex: none; }
.save-thumb img { width: 208px; height: 168px; object-fit: contain; background: #0f1115; border: 1px solid var(--line); border-radius: 12px; }
.save-thumb span { display: block; font-size: 11.5px; color: var(--sub); margin-top: 7px; word-break: break-all; }
.save-form { flex: 1; min-width: 0; }
.sf-label { display: block; font-size: 12.5px; font-weight: 700; color: #cfd6e2; margin: 0 0 6px; }
.sf-label i { color: #e5484d; font-style: normal; }
.sf-count { position: relative; margin-bottom: 14px; }
.sf-count input { width: 100%; height: 38px; padding: 0 58px 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; outline: none; background: #12141a; color: var(--ink); }
.sf-count input:focus { border-color: #ffd7c2; }
.sf-count span { position: absolute; right: 11px; top: 12px; font-size: 11px; color: #8b93a3; }
#saveDir { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: #e6e9f0; background: #12141a; outline: none; margin-bottom: 14px; }
.sf-tags { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 42px; }
.sf-tags input { width: 100%; border: 0; outline: none; font-size: 12.5px; height: 22px; background: transparent; }
.sf-taglist { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sf-taglist span { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: #e7eaef; background: rgba(255, 255, 255, 0.16); border: 1px solid #333a44; padding: 2px 7px; border-radius: 7px; cursor: pointer; }
.sf-taglist span i { font-style: normal; color: #ff8a8a; }
.sf-suggest { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.sf-suggest span { font-size: 11px; color: #cfd6e2; border: 1px dashed #3a414d; padding: 2px 8px; border-radius: 7px; cursor: pointer; }
.sf-suggest span:hover { border-color: #e7eaef; color: #e7eaef; }
.save-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px 16px; }
.btn-line, .btn-main { height: 36px; padding: 0 18px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.btn-line { border: 1px solid var(--line); background: var(--surface); color: #cfd6e2; }
.btn-line:hover { border-color: #e7eaef; }
.btn-main { border: 0; background: var(--grad); color: #15181d; }
.btn-main:disabled { opacity: 0.55; cursor: not-allowed; }

/* ═══ 空白右键菜单 / 双击新建菜单 / 卡片右键菜单 ═══ */
#cvMenu, #cvCtx, #cvCardMenu {
  position: fixed; z-index: 66; width: 268px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.66);
}
#cvMenu .mn-h, #cvCtx .ct-h, #cvCardMenu .ct-h { font-size: 11.5px; color: var(--sub); padding: 7px 10px 5px; font-weight: 600; }
.mn-i, .ct-i {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 10px; border-radius: 9px;
  font-size: 12.5px; color: #e6e9f0; font-weight: 600;
}
.mn-i:hover, .ct-i:hover { background: rgba(255, 255, 255, 0.08); }
.ct-i .k { margin-left: auto; font-size: 11px; color: #8b93a3; font-weight: 500; }
.ct-i.off { opacity: 0.42; }
.ct-sep { height: 1px; background: var(--line); margin: 5px 8px; }
.ct-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ct-2 .ct-i { padding: 7px 9px; font-size: 12px; }

/* ═══════════ V4.1.0 画布图片节点（上传/粘贴的图直接摆在画布上，不套卡片窗口） ═══════════ */
.cv-img-node {
  position: absolute; border-radius: 10px; overflow: visible;
  background: #101216; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.66);
  border: 1px solid #2b3038; will-change: transform;
}
.cv-img-node img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  border-radius: 9px; pointer-events: none; user-select: none; -webkit-user-drag: none;
}
/* ★ V4.27.0 双角标（对齐 liblib）：左上 = 图片名字，右上 = 图片像素 */
.cv-img-node .cv-img-name {
  position: absolute; left: 8px; top: 6px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; font-weight: 600; color: #333d57;
  background: rgba(255, 255, 255, 0.86); border-radius: 6px; padding: 1px 6px; pointer-events: none;
}
.cv-img-node .cv-img-tag {
  position: absolute; right: 8px; top: 6px; font-size: 10.5px; font-weight: 600; color: #333d57;
  /* 角标压在图片上，保持浅底深字，任何底图上都读得清 */
  background: rgba(255, 255, 255, 0.86); border-radius: 6px; padding: 1px 6px; pointer-events: none;
}
/* V4.14.0 图片节点四个角都能拖（用户要求）；原来只有右下角一个柄 */
.cv-img-node .cv-img-grip {
  position: absolute; width: 12px; height: 12px; border-radius: 4px;
  background: #fff; border: 1.5px solid #e7eaef; opacity: 0;
  transition: opacity 0.12s ease; z-index: 4;
}
.cv-img-node .cv-img-grip[data-h="nw"] { left: -6px; top: -6px; cursor: nwse-resize; }
.cv-img-node .cv-img-grip[data-h="ne"] { right: -6px; top: -6px; cursor: nesw-resize; }
.cv-img-node .cv-img-grip[data-h="sw"] { left: -6px; bottom: -6px; cursor: nesw-resize; }
.cv-img-node .cv-img-grip[data-h="se"] { right: -6px; bottom: -6px; cursor: nwse-resize; }
.cv-img-node:hover .cv-img-grip, .cv-img-node.sel .cv-img-grip { opacity: 1; }
/* V4.14.0 锁定态（右键锁定）：虚线框 + 角标小锁，且不显示缩放手柄 */
.cv-img-node.locked { border-style: dashed; border-color: #7f8ea3; }
.cv-img-node.locked .cv-img-grip { display: none; }
.cv-img-node .cv-img-lock {
  position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; display: none;
  align-items: center; justify-content: center; border-radius: 6px; color: #3d4b60;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none; z-index: 5;
}
.cv-img-node.locked .cv-img-lock { display: flex; }
.cv-img-node .cv-img-lock svg {
  width: 13px; height: 13px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.cv-img-node.sel { border-color: #e7eaef; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22), 0 10px 30px rgba(31, 35, 41, 0.16); }
.cv-img-node.closing { opacity: 0; transform: scale(0.96); transition: opacity 0.14s ease, transform 0.14s ease; }
.cv-img-node .cv-port { z-index: 3; }
/* 连线时与卡片同一套提示态 */
.cv-img-node.link-src { border-color: #e7eaef; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2); }
.cv-img-node.linkable .cv-port.in { border-color: #16a34a; background: #e8f7ef; transform: scale(1.3); }

/* 裁切模式：暗色遮罩 + 选框 + 8 个手柄 */
.cv-img-node.cropping { overflow: hidden; cursor: crosshair; }
.cv-crop-shade { position: absolute; background: rgba(0, 0, 0, 0.58); pointer-events: none; }
.cv-crop-box {
  position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: move; touch-action: none;
}
.cv-crop-box .ch {
  position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.cv-crop-box .ch[data-h="nw"] { left: -6px;  top: -6px;    cursor: nwse-resize; }
.cv-crop-box .ch[data-h="n"]  { left: 50%;   top: -6px;    margin-left: -6px; cursor: ns-resize; }
.cv-crop-box .ch[data-h="ne"] { right: -6px; top: -6px;    cursor: nesw-resize; }
.cv-crop-box .ch[data-h="e"]  { right: -6px; top: 50%;     margin-top: -6px;  cursor: ew-resize; }
.cv-crop-box .ch[data-h="se"] { right: -6px; bottom: -6px; cursor: nwse-resize; }
.cv-crop-box .ch[data-h="s"]  { left: 50%;   bottom: -6px; margin-left: -6px; cursor: ns-resize; }
.cv-crop-box .ch[data-h="sw"] { left: -6px;  bottom: -6px; cursor: nesw-resize; }
.cv-crop-box .ch[data-h="w"]  { left: -6px;  top: 50%;     margin-top: -6px;  cursor: ew-resize; }

/* ═══ 图片浮层工具条（屏幕坐标，浮在图片正上方） ═══ */
/* ★★ V4.25.0 imgBar 精简：非核心按钮默认折叠（DOM 保留 —— 真机断言按 data-a 直达，JS click 不受 display:none 影响） */
#cvImgActs:not(.open) .ib-btn[data-a="repaint"],
#cvImgActs:not(.open) .ib-btn[data-a="layers"],
#cvImgActs:not(.open) .ib-btn[data-a="repair"],
#cvImgActs:not(.open) .ib-btn[data-a="copy"],
#cvImgActs:not(.open) .ib-btn[data-a="crop"],
#cvImgActs:not(.open) .ib-btn[data-a="rotate"],
#cvImgActs:not(.open) .ib-sep { display: none; }
#cvImgActs.open .ib-more-btn { display: none; }
#cvImgBar {
  position: fixed; z-index: 38; display: flex; align-items: center; gap: 2px;
  background: rgba(20, 22, 27, 0.97); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.66); padding: 5px 6px; backdrop-filter: blur(10px);
}
#cvImgBar .ib-acts, #cvImgBar .ib-crop { display: flex; align-items: center; gap: 2px; }
#cvImgBar .ib-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 46px; height: 46px; justify-content: center;
  border: 0; background: transparent; border-radius: 9px; color: #d7dbe4;
}
#cvImgBar .ib-btn svg { width: 17px; height: 17px; }
#cvImgBar .ib-btn .ib-lb { font-size: 10.5px; font-weight: 600; line-height: 1; }
#cvImgBar .ib-btn:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; }
#cvImgBar .ib-btn.off { opacity: 0.4; }
#cvImgBar .ib-btn.ok { color: #4ade80; }
#cvImgBar .ib-btn.ok:hover { background: rgba(34, 197, 94, 0.16); }
#cvImgBar .ib-btn.danger { color: #ff8a8a; }
#cvImgBar .ib-btn.danger:hover { background: rgba(239, 68, 68, 0.16); }
#cvImgBar .ib-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
#cvImgBar .ib-crop-t { font-size: 11.5px; font-weight: 800; color: var(--ink); padding: 0 8px; }
#cvImgBar .ib-x {
  border: 0; background: transparent; color: #8b93a3; width: 28px; height: 46px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-left: 2px;
}
#cvImgBar .ib-x svg { width: 15px; height: 15px; }
#cvImgBar .ib-x:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; }

/* ═══ 命名对话框（新建 / 重命名画布） ═══ */
.name-box {
  width: 366px; background: var(--panel); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
}
.name-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line);
}
.name-head b { font-size: 14px; font-weight: 800; }
.name-body { padding: 16px 18px 6px; }
.name-body input {
  width: 100%; height: 42px; border: 1px solid #2b3038; border-radius: 11px;
  padding: 0 13px; font-size: 13.5px; outline: none; background: #12141a; color: var(--ink);
}
.name-body input:focus { border-color: #e7eaef; background: #161a21; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16); }
.name-tip { font-size: 11.5px; color: var(--sub); margin-top: 8px; }
.name-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 16px; }

/* V4.8.8 通用确认弹窗正文 + 危险操作按钮 */
.ask-q { font-size: 13px; line-height: 1.6; color: #d5dae4; }
.btn-main.danger { background: linear-gradient(135deg, #ff4d4f, #d9363e); }

/* 右键菜单里的二次确认行 */
.ct-confirm { display: flex; align-items: center; gap: 8px; padding: 7px 9px; }
.ct-confirm .cq {
  font-size: 12px; font-weight: 700; color: #e6e9f0; margin-right: auto; white-space: nowrap;
}
.ct-confirm button {
  border: 0; border-radius: 8px; padding: 5px 11px; font-size: 11.5px; font-weight: 700;
}
.ct-confirm .cq-no { background: var(--surface-2); color: #cfd6e2; }
.ct-confirm .cq-no:hover { background: #2f3540; }
.ct-confirm .cq-yes { background: var(--grad); color: #15181d; }
.ct-confirm .cq-yes.danger { background: linear-gradient(135deg, #e5484d 0%, #c8383c 100%); }

/* ═══ 提示条 / toast ═══ */
#cvLinkHint {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 31;
  font-size: 11.5px; font-weight: 600; color: #7ef0c0; background: rgba(14, 44, 35, 0.95);
  border: 1px solid #1d6b52; padding: 6px 13px; border-radius: 9px; pointer-events: none;
}
#cvToast {
  position: fixed; left: 50%; top: calc(var(--top-h) + 16px); transform: translateX(-50%);
  z-index: 96; font-size: 12.5px; font-weight: 600; color: #fff; background: #2b2f36;
  padding: 9px 16px; border-radius: 10px; box-shadow: 0 10px 26px rgba(31, 35, 41, 0.22); max-width: 70vw;
}
#cvToast.ok { background: #1c7f55; }
#cvToast.err { background: #b83838; }
/* ★ V4.17.4 常驻提示（图层拆分等待期）：不会被普通 toast 顶掉，带动画圆点表示"还在干活" */
#cvToastStick {
  position: fixed; left: 50%; top: calc(var(--top-h) + 16px); transform: translateX(-50%);
  z-index: 97; font-size: 12.5px; font-weight: 600; color: #fff; background: #1c7f55;
  padding: 9px 16px; border-radius: 10px; box-shadow: 0 10px 26px rgba(31, 35, 41, 0.22); max-width: 70vw;
}
#cvToastStick::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px;
  border-radius: 50%; background: #bfe8d4; vertical-align: 1px;
  animation: cvStickPulse 1.1s ease-in-out infinite;
}
#cvToastStick.err { background: #b83838; }
#cvToastStick.err::before { animation: none; background: #fff; }
@keyframes cvStickPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ═══ V4.2.0 深色主题收尾：输入提示文字 / 弹层滚动条（浅色主题下的默认值在黑底上几乎看不见） ═══ */
input::placeholder, textarea::placeholder { color: #6b7382; }
.proj-grid, .asset-grid, .save-body { scrollbar-width: thin; scrollbar-color: #333a45 transparent; }
.proj-grid::-webkit-scrollbar, .asset-grid::-webkit-scrollbar { width: 10px; height: 10px; }
.proj-grid::-webkit-scrollbar-thumb, .asset-grid::-webkit-scrollbar-thumb { background: #333a45; border-radius: 6px; }
.proj-grid::-webkit-scrollbar-track, .asset-grid::-webkit-scrollbar-track { background: transparent; }

/* ═══════════ V4.6.0 老照片修复：待修复新图（占位节点）+ 跟随式控制面板 ═══════════
   交互：点图片工具条上的「老图修复」→ 画布上原图右边长出一张"待修复"的新图（占位，带连线），
   并在它下面带出这个面板；面板跟着这张图走（拖图/缩放/平移画布都会实时跟随），是"成组"的。 */
.cv-img-node.pending-repair {
  border: 1.5px dashed #5d6673;
  background: repeating-linear-gradient(45deg, #0d0f13 0 11px, #12151a 11px 22px);
  box-shadow: none;
}
.cv-img-node.pending-repair img { visibility: hidden; }
.cv-img-node.rp-anchor {
  border-color: var(--b2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.26), 0 12px 30px rgba(0, 0, 0, 0.55);
}
.cv-img-node .cv-img-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 7px; padding: 12px; text-align: center; pointer-events: none; color: var(--sub);
}
.cv-img-node .cv-img-ph .ph-ico { font-size: 26px; line-height: 1; opacity: 0.95; }
.cv-img-node .cv-img-ph b { font-size: 13.5px; font-weight: 800; color: #e8ecf4; letter-spacing: 0.4px; }
.cv-img-node .cv-img-ph .ph-sub { font-size: 11px; line-height: 1.6; color: #8b93a3; }
.cv-img-node.rp-busy .cv-img-ph b { color: var(--b2); }
.cv-img-node.rp-busy .cv-img-ph .ph-sub { color: #cdd3de; }

#cvRepair, #cvSplit {
  position: fixed; z-index: 39; width: 396px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; max-height: min(70vh, 520px);
  background: rgba(20, 22, 27, 0.985); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.72); backdrop-filter: blur(12px);
  color: var(--ink); overflow: hidden;
}
#cvRepair .rp-head, #cvSplit .rp-head {
  flex: none;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 13px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
#cvRepair .rp-ico, #cvSplit .rp-ico { display: flex; color: var(--b2); }
#cvRepair .rp-ico svg, #cvSplit .rp-ico svg { width: 17px; height: 17px; }
#cvRepair .rp-title, #cvSplit .rp-title { font-size: 13.5px; font-weight: 800; letter-spacing: 0.3px; }
#cvRepair .rp-src, #cvSplit .rp-src { flex: 1; font-size: 11.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cvRepair .rp-x, #cvSplit .rp-x {
  border: 0; background: transparent; color: #8b93a3; width: 24px; height: 24px; border-radius: 7px;
  font-size: 12px; line-height: 1; cursor: pointer; flex: none;
}
#cvRepair .rp-x:hover, #cvSplit .rp-x:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
#cvRepair .rp-body, #cvSplit .rp-body { padding: 10px 12px 12px; flex: 1 1 auto; min-height: 0; overflow: auto; }
#cvRepair .rp-lab, #cvSplit .rp-lab {
  display: flex; align-items: baseline; gap: 7px; font-size: 11.5px; font-weight: 700;
  color: #cdd3de; margin: 8px 0 5px;
}
#cvRepair .rp-lab:first-child, #cvSplit .rp-lab:first-child { margin-top: 0; }
#cvRepair .rp-opt, #cvSplit .rp-opt { font-size: 10.5px; font-weight: 500; color: #6f7787; }
/* ★ V4.16.1 运营方要求：面板不再展示「修复类型」
   （#cvRepair .rp-modes / .rp-mode / .rp-mc 已随 DOM 一起移除）。
   注意：修复要求本身仍在**后台配置与云端提示词**（cloud-server/lib/oldphoto.js）里照常生效，前台只是不显示。 */
#cvRepair .rp-tiers, #cvSplit .rp-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#cvRepair .rp-tier, #cvSplit .rp-tier {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px;
  color: #dfe3ea; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
#cvRepair .rp-tier b, #cvSplit .rp-tier b { font-size: 12.5px; font-weight: 700; }
#cvRepair .rp-tier span, #cvSplit .rp-tier span { font-size: 10.5px; line-height: 1.5; color: #8b93a3; }
#cvRepair .rp-tier:hover, #cvSplit .rp-tier:hover { border-color: #3a4150; background: var(--surface-2); }
#cvRepair .rp-tier.on, #cvSplit .rp-tier.on { border-color: var(--b2); background: rgba(255, 255, 255, 0.13); }
#cvRepair .rp-tier.on b, #cvSplit .rp-tier.on b { color: #ffffff; }
#cvRepair .rp-note, #cvSplit .rp-note {
  width: 100%; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 10px; color: #e8ecf4; font-size: 12.5px; outline: none;
}
#cvRepair .rp-note:focus, #cvSplit .rp-note:focus { border-color: #4a5261; }
#cvRepair .rp-note::placeholder, #cvSplit .rp-note::placeholder { color: #6a7383; }
#cvRepair .rp-plan, #cvSplit .rp-plan {
  margin: 8px 0 0; padding: 7px 9px; border-radius: 9px; font-size: 11px; line-height: 1.55;
  color: #a9b4c7; background: rgba(255, 255, 255, 0.03); border: 1px dashed #333a46;
}
#cvRepair .rp-run, #cvSplit .rp-run {
  width: 100%; margin-top: 10px; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--grad); color: #15181d; font-size: 13.5px; font-weight: 800; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
#cvRepair .rp-run:hover, #cvSplit .rp-run:hover { filter: brightness(1.06); }
#cvRepair .rp-run:disabled, #cvSplit .rp-run:disabled { opacity: 0.6; cursor: default; filter: none; }
#cvRepair .rp-run .rp-cost, #cvSplit .rp-run .rp-cost { font-size: 11px; font-weight: 700; opacity: 0.82; }
#cvRepair .rp-tip, #cvSplit .rp-tip { margin-top: 6px; font-size: 10.5px; line-height: 1.6; color: #6f7787; }

/* ═══ V4.12.0 会员中心全屏浮层（铺满整屏，只在右上角留一个 ×） ═══ */
#cvMemberModal { position: fixed; inset: 0; z-index: 9990; background: #08080c; }
#cvMemberModal iframe { display: block; width: 100%; height: 100%; border: 0; background: #08080c; }
/* ★ V4.16.0 历史作品浮层：与会员中心同一套满屏外壳（同一个 .mm-x 关闭按钮，放右上角） */
#cvHistoryModal { position: fixed; inset: 0; z-index: 9991; background: #08080c; }
#cvHistoryModal iframe { display: block; width: 100%; height: 100%; border: 0; background: #08080c; }
#cvMemberModal .mm-x,
#cvHistoryModal .mm-x {
  position: absolute; top: 16px; right: 20px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
#cvMemberModal .mm-x:hover,
#cvHistoryModal .mm-x:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.36); transform: rotate(90deg); }
#cvMemberModal .mm-x svg,
#cvHistoryModal .mm-x svg { width: 17px; height: 17px; }
body.member-open { overflow: hidden; }

/* ═══════════ V4.14.0 框选 + 多选 + 打组（用户要求） ═══════════ */
/* 框选的选择框：用屏幕坐标定位（跟着鼠标走，不随画布缩放变形） */
.cv-marquee {
  position: fixed; z-index: 9500; pointer-events: none;
  border: 1px solid #e7eaef; background: rgba(255, 255, 255, 0.12); border-radius: 3px;
}
/* 多选动作区（图片工具条里的「已选 N 张 · 打组 · 解组」） */
#cvImgBar .ib-multi { display: flex; align-items: center; gap: 6px; padding: 0 4px; }
#cvImgBar .ib-count {
  font-size: 12px; font-weight: 600; color: #ffd9c2; padding: 0 8px 0 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.16); margin-right: 2px; white-space: nowrap;
}
/* 成组的图片给一条青色描边，一眼看出哪些是一组 */
.cv-img-node.grouped { border-color: #2dd4bf; }
.cv-img-node.grouped.sel { border-color: #e7eaef; }

/* ★ V4.16.1 「综合修复」说明卡（#cvRepairModes .rp-single）已随前台隐藏一并移除：
   客户不再看到修复类型与修复项清单，但后台配置 + 云端提示词里的修复要求原样保留。 */

/* ═══════════════════════════════════════════════════════════════
   V4.15.0 画布界面「去橙色 · 黑底白字」（运营方 2026-10-07 要求）
   两件事：
     ① 【真 bug】「画布」倒三角下拉的面板写死 background:#fff，而菜单项文字是浅色
        （.ct-i 的 #e6e9f0 是给深色菜单写的）→ 白底浅字，看不清。改成深色面板。
     ② 顶栏的橙色元素（品牌标 / 积分胶囊 / 头像 / 新画布）与画布上的橙色选中态，统一改黑底白字。
   范围：只改**画布这一层的界面色**（顶栏 / 切换器 / 下拉 / 选中态）。
   卡片内部的功能页（表单、按钮、会员与充值页）保持原样 —— 那里浅底浅字本是可读的，
   强行改黑会变成"到处是黑块"，反而更难用。
   ═══════════════════════════════════════════════════════════════ */
/* ① 品牌标：原来是红橙渐变底 */
.cv-logo { background: #0c0d10; color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.34); }
/* ② 顶栏胶囊（会员中心 / 积分余额 / 登录注册）：统一黑底白字 */
.cv-chip { background: #0c0d10; color: #ffffff; border-color: rgba(255, 255, 255, 0.20); }
.cv-chip:hover { border-color: rgba(255, 255, 255, 0.52); }
.cv-chip.primary { background: #0c0d10; color: #ffffff; border-color: rgba(255, 255, 255, 0.34); }
.cv-chip.ghost { background: #0c0d10; color: #ffffff; }
/* ③ 头像：原来是红橙渐变底 */
.cv-avatar { background: #0c0d10; color: #ffffff; border-color: rgba(255, 255, 255, 0.34); }
/* ④ 画布切换器 / 新画布：黑底白字（新画布不再用橙色文字） */
.doc-btn, .doc-new { background: #0c0d10; color: #ffffff; }
.doc-btn:hover, .doc-new:hover { border-color: rgba(255, 255, 255, 0.52); }
.doc-new { color: #ffffff; }
.doc-caret { color: #9aa3b2; }
/* ⑤ 下拉面板（关键修复）：黑底白字，悬停有明确反馈 */
#cvDocMenu { background: var(--panel) !important; color: var(--ink); border-color: var(--line); }
#cvDocMenu .ct-h { font-size: 11.5px; color: var(--sub); padding: 7px 10px 5px; font-weight: 600; }
#cvDocMenu .ct-i { color: #e6e9f0; }
#cvDocMenu .ct-i:hover { background: rgba(255, 255, 255, 0.10); }
#cvDocMenu .ct-i .k { color: #8b93a3; }
/* ⑥ 画布上的选中态：橙 → 白（黑底上白色更清楚，也彻底不留橙色） */
.cv-wire.on { stroke: #ffffff; }
.cv-wire.flash { stroke: #ffffff; }
.cv-wire.temp { stroke: rgba(255, 255, 255, 0.85); }
.cv-marquee { border: 1px solid rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.10); }
.cv-img-node.sel { border-color: #ffffff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.26), 0 10px 30px rgba(0, 0, 0, 0.5); }
.cv-img-node.link-src { border-color: #ffffff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22); }
.cv-card.link-src { border-color: #ffffff; }
.cv-img-node.grouped { border-color: rgba(255, 255, 255, 0.62); }
.cv-img-node.grouped.sel { border-color: #ffffff; }
.proj-card.on { border-color: #ffffff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24); }
/* ⑦ 底部工具条计数角标：橙底白字 → 白底黑字 */
.cv-dock-btn .bdg { background: #ffffff; color: #0b0b10; }

/* ═══════════════════════════════════════════════════════════════
   ★ V4.16.0 卡片本体也改黑底（运营方 2026-10-07：「所有界面都改成黑底」）
   V4.2.0 的旧规则是「画布深色、卡片浅色（卡片里是功能页，所见即所得）」——
   本次运营方明确要求连功能页一起黑，所以卡片外壳与卡片内的加载态一并转深色。
   ⚠️ 卡片里文字原来刻意写成**固定深色**（为了在浅色卡片上看得见），现在必须翻成浅色，
      否则就是「黑底黑字」（这正是 V4.2.0 注释里提醒过的那个坑的反向情况）。 */
.cv-card { background: #14141b; border-color: #3a3f4a; }
.cv-head {
  background: linear-gradient(135deg, #1b1b22 0%, #232028 100%);
  border-bottom: 1px solid #2c2c38;
}
.cv-head .ttl { color: #e6e8f0; }
.cv-acts button { color: #9aa3b2; }
.cv-acts button:hover { background: rgba(255, 255, 255, 0.10); color: #ffffff; }
.cv-body { background: #14141b; }
.cv-body iframe { background: #14141b; }
.cv-body .cv-load { background: #101015; color: #9aa3b2; }
/* 卡片标题栏上的小图标/分隔符在深底上要够亮 */
.cv-head .ico { filter: none; }

/* ★ V4.16.5 图片分层面板里的「模型」选择器（运营方要求：模型用简称，如 5.0 / 4.5） */
#cvSplit .rp-models { display: flex; flex-wrap: wrap; gap: 6px; }
#cvSplit .rp-model {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 11px; color: #dfe3ea; cursor: pointer; font-size: 12.5px; font-weight: 600;
  transition: border-color 0.12s, background 0.12s;
}
#cvSplit .rp-model:hover { border-color: #3a4150; background: var(--surface-2); }
#cvSplit .rp-model.on { border-color: var(--b2); background: rgba(255, 255, 255, 0.13); color: #ffffff; }
#cvSplit .rp-model i { font-style: normal; font-size: 10.5px; color: #8b93a3; }
#cvSplit .rp-model.on i { color: #ff9a5c; }

/* ★ V4.16.5 分层面板是 3 档（1K/2K/4K）→ 单独 3 列（老图修复那边仍是 2 档 2 列） */
#cvSplit .rp-tiers { grid-template-columns: repeat(3, 1fr) !important; }

/* ═══════════════════════════════════════════════════════════════════════════════
   ★ V4.17.1 图片节点改「棋盘格」打底 + 白底模式补齐（运营方报的两个现象同一个根因）
   · 白底模式下画布异常：canvas.css 里图片节点 / 卡片外壳是**硬编码深色**（#101216 / #14141b），
     切换主题只改了变量（--bg 等）没改它们 → 白底下这些地方仍是黑块。
   · 「图片分层后多余位置不是透明的」：**图层本身是透明的**，但透明区透出了节点的深色底 →
     看起来是黑的。改成棋盘格后，透明区一眼就能认出来（和不透明区分得开）。
   ⚠️ 这两条要一起改，只改一条会互相掩盖。
   ═══════════════════════════════════════════════════════════════════════════════ */
.cv-img-node {
  /* ★ V4.17.2 运营方要求：「拆分图那些区域全部改为透明底 —— 没有底色、没有任何方格、没有任何颜色，
     只保留拆分图有颜色的区域」。所以节点**不再给任何底色 / 棋盘格**：
     图层本身透明的区域就直接透出画布底色，一眼就能看出"这块是空的"。
     （V4.17.1 曾用棋盘格打底来"让透明看得见"，运营方明确不要 —— 改为真透明。）
     附带好处：白底模式下也不再有"一块块深色方块"（那本来就是这个硬编码底色造成的）。 */
  background: transparent;
  background-image: none;
  border-color: transparent;
  box-shadow: none;
}
html[data-theme="light"] .cv-img-node {
  background: transparent;
  background-image: none;
  border-color: transparent;
  box-shadow: none;
}
/* 选中时才给一圈描边（否则"没有任何颜色"的节点选中了也看不出来） */
.cv-img-node.sel { border-color: var(--accent, #e7eaef); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55); }
/* 白底模式下画布里的卡片外壳、缩略图容器、加载遮罩一起翻浅 */
html[data-theme="light"] .cv-card { background: #ffffff; border-color: #e2e6ee; }
html[data-theme="light"] .cv-card .ttl { color: #1b1f27; }
html[data-theme="light"] .cv-body, html[data-theme="light"] .cv-body iframe { background: #ffffff; }
html[data-theme="light"] .cv-load { background: #f7f8fb; color: #6b7280; }
html[data-theme="light"] .proj-thumb, html[data-theme="light"] .asset-img { background: #eef0f4; }
html[data-theme="light"] .save-thumb img { background: #eef0f4; }
html[data-theme="light"] .cv-edge-del:hover { background: #eceef2; }

/* ═══════════ ★★ V4.20.0 生成节点（gen）+ 屏幕空间控制面板 ═══════════ */
#cvGenPanel[hidden] { display: none !important; }
#cvGenPanel {
  position: fixed; z-index: 39; width: 400px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; max-height: min(76vh, 620px);
  background: rgba(20, 22, 27, 0.985); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.72); backdrop-filter: blur(12px);
  color: var(--ink); overflow: hidden;
}
#cvGenPanel .rp-head {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 13px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
#cvGenPanel .rp-ico { display: flex; color: var(--b2); }
#cvGenPanel .rp-ico svg { width: 17px; height: 17px; }
#cvGenPanel .rp-title { font-size: 13.5px; font-weight: 800; letter-spacing: 0.3px; }
#cvGenPanel .rp-src { flex: 1; font-size: 11.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cvGenPanel .rp-x {
  border: 0; background: transparent; color: #8b93a3; width: 24px; height: 24px; border-radius: 7px;
  font-size: 12px; line-height: 1; cursor: pointer; flex: none;
}
#cvGenPanel .rp-x:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
#cvGenPanel .rp-body { padding: 10px 12px 12px; flex: 1 1 auto; min-height: 0; overflow: auto; }
#cvGenPanel .rp-lab { display: flex; align-items: baseline; gap: 7px; font-size: 11.5px; font-weight: 700; color: #cdd3de; margin: 8px 0 5px; }
#cvGenPanel .rp-lab:first-child { margin-top: 0; }
#cvGenPanel .rp-opt { font-size: 10.5px; font-weight: 500; color: #6f7787; }
#cvGenPanel .rp-tiers { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
#cvGenPanel .rp-tier {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px;
  color: #dfe3ea; cursor: pointer; text-align: center; transition: border-color 0.12s, background 0.12s;
}
#cvGenPanel .rp-tier b { font-size: 12px; font-weight: 700; display: block; }
#cvGenPanel .rp-tier span { font-size: 10px; color: #8b93a3; }
#cvGenPanel .rp-tier:hover { border-color: #3a4150; background: var(--surface-2); }
#cvGenPanel .rp-tier.on { border-color: var(--b2); background: rgba(255, 255, 255, 0.13); }
#cvGenPanel .rp-tier.on b { color: #ffffff; }
.gp-refs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gp-addref {
  border: 1px dashed #3a4150; background: var(--surface); color: #cdd3de; border-radius: 9px;
  padding: 7px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.gp-addref:hover { border-color: var(--b2); color: #ffffff; }
.gp-ref-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.gp-thumb { width: 40px; height: 40px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; position: relative; }
.gp-thumb:hover::after { content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.62); color: #fff; font-size: 12px; }
.gp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-prompt {
  width: 100%; box-sizing: border-box; margin-top: 8px; resize: vertical; min-height: 62px; max-height: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  color: #e8ecf4; font-size: 12.5px; line-height: 1.6; outline: none; font-family: inherit;
}
.gp-prompt:focus { border-color: #4a5261; }
.gp-prompt::placeholder { color: #6a7383; }
.gp-row { display: flex; gap: 7px; margin-top: 8px; }
.gp-sel {
  border: 1px solid var(--line); background: var(--surface); color: #dfe3ea; border-radius: 9px;
  padding: 8px 11px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.gp-sel:hover { border-color: #3a4150; background: var(--surface-2); }
.gp-sel.grow { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.gp-plan {
  margin: 8px 0 0; padding: 7px 9px; border-radius: 9px; font-size: 11px; line-height: 1.55;
  color: #a9b4c7; background: rgba(255, 255, 255, 0.03); border: 1px dashed #333a46;
}
.gp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.gp-cost { font-size: 13px; font-weight: 800; color: #ffffff; }
.gp-go {
  /* ★ V4.26.0 箭头改小（运营方：太大了，参考他给的界面）42 → 30 */
  width: 30px; height: 30px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--grad); color: #15181d; font-size: 14px; font-weight: 900; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.gp-go:hover { filter: brightness(1.08); }
.gp-go:disabled { opacity: 0.55; cursor: default; filter: none; }
.gp-menu {
  position: absolute; left: 12px; right: 12px; bottom: 8px; z-index: 5;
  background: rgba(24, 26, 32, 0.99); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7); padding: 8px; max-height: 300px; overflow: auto;
}
.gp-setpop .rp-tiers { grid-template-columns: 1fr 1fr 1fr; }
.gp-mi {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; background: transparent; color: #dfe3ea; border-radius: 8px; padding: 9px 10px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.gp-mi:hover { background: rgba(255, 255, 255, 0.06); }
.gp-mi.on { background: rgba(255, 255, 255, 0.13); color: #ffffff; }
.gp-mcost { font-size: 10.5px; color: #8b93a3; font-weight: 500; }
.gp-ratios { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gp-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gp-ratio {
  border: 1px solid var(--line); background: var(--surface); color: #dfe3ea; border-radius: 8px;
  padding: 7px 4px; font-size: 11.5px; font-weight: 600; cursor: pointer; text-align: center;
}
.gp-ratio:hover { border-color: #3a4150; }
.gp-ratio.on { border-color: var(--b2); background: rgba(255, 255, 255, 0.13); color: #ffffff; }

/* —— 生成节点本体（图片节点样式 + 标题在上方） —— */
.cv-card.cv-gen { background: #14141b; border: 1px solid #3a3f4a; border-radius: 12px; }
.cv-card.cv-gen .cv-gen-name {
  position: absolute; top: -24px; left: 2px; font-size: 11.5px; font-weight: 700; color: #b9c0cd;
  white-space: nowrap; pointer-events: none;
}
.cv-card.cv-gen .cv-gen-body { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; }
.cv-card.cv-gen .cv-gen-view { position: absolute; inset: 0; }
.cv-card.cv-gen .cv-gen-view img { width: 100%; height: 100%; object-fit: contain; display: block; background: #0e0f13; }
.cv-card.cv-gen .cv-gen-grid {
  position: absolute; left: 6px; bottom: 6px; right: 6px; display: flex; gap: 5px; overflow-x: auto;
  padding: 4px; background: rgba(10, 11, 14, 0.78); border-radius: 8px;
}
.cv-card.cv-gen .cv-gen-grid img {
  width: 42px; height: 42px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; flex: none;
}
.cv-card.cv-gen .cv-gen-grid img.on { border-color: var(--b2); }
.cv-card.cv-gen .cv-gen-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; color: #77808f; font-size: 12px;
}
.cv-card.cv-gen .cv-gen-empty .ge-ico { font-size: 30px; opacity: 0.6; }
.cv-card.cv-gen .cv-gen-empty .ge-t { font-size: 12.5px; color: #98a0ad; }
.cv-card.cv-gen .ge-btn {
  border: 1px solid #3a3f4a; background: #1c1f26; color: #dfe3ea; border-radius: 9px;
  padding: 8px 16px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.cv-card.cv-gen .ge-btn:hover { border-color: var(--b2); color: #ffffff; }
.cv-card.cv-gen .cv-gen-busy {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: rgba(8, 9, 12, 0.78); color: #dfe3ea; font-size: 12.5px; z-index: 2;
}
.cv-card.cv-gen .cv-gen-busy .spin {
  width: 26px; height: 26px; border-radius: 999px; border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--b2); animation: cvspin 0.9s linear infinite;
}
@keyframes cvspin { to { transform: rotate(360deg); } }
.cv-card.cv-gen .cv-gen-x {
  position: absolute; top: 5px; right: 5px; z-index: 3; width: 22px; height: 22px; border-radius: 7px;
  border: 0; background: rgba(0, 0, 0, 0.4); color: #98a0ad; font-size: 11px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity 0.12s;
}
.cv-card.cv-gen:hover .cv-gen-x { opacity: 1; }
.cv-card.cv-gen .cv-gen-x:hover { background: rgba(220, 60, 60, 0.75); color: #fff; }

/* ═══ ★ V4.21.1 生成节点左侧输入端口常显（运营方：左侧要能看见输入节点）═══
   图片卡片的状态是「拖线时才亮」，生成节点不同 —— 图生图是它的主路径，输入端口必须一直可见可点。 */
.cv-card.cv-gen .cv-port.in {
  display: block; left: -8px; width: 16px; height: 16px; margin-top: -8px;
  border-color: #16a34a; background: #e8f7ef; box-shadow: 0 0 0 3px rgba(22, 163, 115, 0.18);
  /* ★ V4.27.0 基础类把连接点改成了 hover 显示，但 gen 节点的「图」输入口是**功能入口**
     （点它选参考图），必须常显 —— 不属于「图片两侧的连线端口 hover 显示」范畴。 */
  opacity: 1; pointer-events: auto;
}
.cv-card.cv-gen .cv-port.in:hover { transform: scale(1.35); background: #fff; }
.cv-card.cv-gen .cv-port.in::after {
  content: "图"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #16a34a; pointer-events: none;
}
/* ═══════════ ★★ V4.22.0 元素编辑（图片节点局部对话编辑）═══════════ */

/* 顶部悬浮条：✕ 元素编辑 | ◎ ▢ ✏ ↺ —— 与图片工具条同一观感语言 */
#cvElemBar {
  position: fixed; z-index: 41; display: flex; align-items: center; gap: 4px;
  background: rgba(18, 19, 24, 0.97); border: 1px solid var(--line); border-radius: 11px;
  padding: 5px 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
#cvElemBar[hidden] { display: none; }
#cvElemBar .ee-title {
  font-size: 12.5px; font-weight: 800; color: #e8ecf4; letter-spacing: 0.3px;
  padding: 0 6px 0 2px; border-right: 1px solid var(--line); margin-right: 2px;
}
#cvElemBar .ee-tool {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: #cdd3de; font-size: 14px; line-height: 1; cursor: pointer;
}
#cvElemBar .ee-tool:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
#cvElemBar .ee-tool.on { background: rgba(255, 255, 255, 0.16); border-color: var(--b2); color: #ffffff; }
#cvElemBar .ee-x {
  width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent;
  color: #8b93a3; font-size: 12px; line-height: 1; cursor: pointer; margin-left: 2px;
}
#cvElemBar .ee-x:hover { background: rgba(220, 60, 60, 0.75); color: #fff; }

/* 节点上的选区覆盖层：压暗四周、抠亮选区；白描边框可拖动 */
.cv-ee-ov { position: absolute; inset: 0; z-index: 4; border-radius: 10px; overflow: hidden; cursor: crosshair; touch-action: none; }
.cv-ee-ov .cv-ee-cv { display: block; width: 100%; height: 100%; }

/* 底部对话编辑面板：选区 chip + 指令输入 + 积分 + 取消/确认箭头 */
#cvElemPanel {
  position: fixed; z-index: 41; width: 400px; max-width: calc(100vw - 16px);
  background: rgba(20, 22, 27, 0.985); border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.7); color: var(--ink); padding: 10px 12px;
}
#cvElemPanel[hidden] { display: none; }
#cvElemPanel .ep-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 24px; }
#cvElemPanel .ep-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  background: rgba(22, 163, 115, 0.16); border: 1px solid #16a34a; border-radius: 999px;
  color: #7ee2b8; font-size: 11.5px; font-weight: 700;
}
#cvElemPanel .ep-chip button {
  border: 0; background: transparent; color: #7ee2b8; cursor: pointer; font-size: 10px; line-height: 1; padding: 0;
}
#cvElemPanel .ep-chip button:hover { color: #fff; }
#cvElemPanel .ep-hint { font-size: 11.5px; color: #6f7787; }
#cvElemPanel .ep-input {
  width: 100%; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; color: #e8ecf4; font-size: 12.5px; outline: none; font-family: inherit;
}
#cvElemPanel .ep-input:focus { border-color: #4a5261; }
#cvElemPanel .ep-input::placeholder { color: #6a7383; }
#cvElemPanel .ep-foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
#cvElemPanel .ep-cancel {
  flex: 1; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: #cdd3de; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
#cvElemPanel .ep-cancel:hover { border-color: #3a4150; background: var(--surface-2); }
#cvElemPanel .ep-cost { font-size: 12.5px; font-weight: 800; color: #ffffff; white-space: nowrap; }
#cvElemPanel .ep-go {
  flex: 1; height: 36px; border-radius: 9px; border: 0; cursor: pointer;
  background: var(--grad); color: #15181d; font-size: 15px; font-weight: 900; line-height: 1;
}
#cvElemPanel .ep-go:hover { filter: brightness(1.08); }
#cvElemPanel .ep-go:disabled { opacity: 0.55; cursor: default; filter: none; }
/* ═══════════ ★★ V4.23.0 生成面板参考图重排版 + 元素编辑配套 ═══════════ */

/* 比例按钮的**形状预览**：小框按真实比例绘制 */
.gp-ratio .gp-sh {
  display: block; margin: 0 auto 3px; border: 1.5px solid currentColor;
  border-radius: 3px; background: rgba(255, 255, 255, 0.06);
}
.gp-ratio.on .gp-sh { border-color: currentColor; background: rgba(255, 255, 255, 0.25); }

/* 画质 / 背景网格（与数量同一布局语言） */
.gp-quals, .gp-bgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gp-quals { grid-template-columns: repeat(3, 1fr); }

/* 提示词优化按钮（积分左侧「文A」） */
.gp-polish {
  height: 32px; min-width: 34px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: #dfe3ea;
  font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.gp-polish:hover { border-color: var(--b2); color: #ffffff; }
.gp-polish:disabled { opacity: 0.5; cursor: default; }
#cvGenPanel .gp-foot { gap: 6px; }
#cvGenPanel .gp-cost { margin-left: auto; }
#cvGenPanel .gp-sel { padding: 7px 8px; font-size: 11.5px; }

/* 生成等待：节点内读百分比 + 取消 */
.cv-gen-prog {
  display: flex; align-items: center; gap: 10px;
  background: rgba(10, 11, 14, 0.85); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 8px 7px 14px;
}
.cv-gen-pct { font-size: 12.5px; font-weight: 700; color: #e8ecf4; }
.cv-gen-cancel {
  height: 26px; padding: 0 12px; border-radius: 999px; border: 1px solid #3a3f4a;
  background: #1c1f26; color: #cdd3de; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.cv-gen-cancel:hover { border-color: var(--b2); color: #ffffff; }

/* 生成节点顶部动作条（与下方面板成对出现） */
#cvGenBar {
  position: fixed; z-index: 41; display: flex; align-items: center; gap: 3px;
  background: rgba(18, 19, 24, 0.97); border: 1px solid var(--line); border-radius: 11px;
  padding: 4px 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
#cvGenBar[hidden] { display: none; }
#cvGenBar .gb-title {
  font-size: 12px; font-weight: 800; color: #e8ecf4; padding: 0 6px 0 2px;
  border-right: 1px solid var(--line); margin-right: 2px;
}
#cvGenBar .gb-b {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: #cdd3de; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
#cvGenBar .gb-b:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
#cvGenBar .gb-b.danger:hover { background: rgba(220, 60, 60, 0.75); color: #fff; }

/* 资产分类筛选条 + 保存弹窗新建分类行 */
.asset-folders { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sf-newfolder { display: flex; gap: 6px; margin-top: 6px; }
.sf-newfolder[hidden] { display: none; }
.sf-newfolder input {
  flex: 1; background: var(--surface, #1c1f26); border: 1px solid #3a3f4a; border-radius: 8px;
  padding: 7px 10px; color: #e8ecf4; font-size: 12px; outline: none;
}
.sf-newfolder button {
  padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface, #1c1f26); color: #cdd3de; font-size: 12px; cursor: pointer;
}
.sf-newfolder #saveFolderOk { border-color: var(--b2); color: #ffffff; }
