/* ============================================================
   醉银绘 — 无限画布（画布系统提取自 hero8152/Infinite-Canvas，
   视觉按 StarArt 暗色霓虹主题重塑；全部色值引用全局 :root 变量自动跟随主题）
   ============================================================ */

/* ---------- 编辑器容器 ---------- */
.page.cv-root {
  display: block;
  overflow: hidden;
  height: 100%;
  position: relative;
  padding: 0;
}

.cv-root .cv-topbar {
  position: absolute;
  top: 14px; left: 16px; right: 16px;
  display: flex; align-items: flex-start; gap: 12px;
  z-index: 30;
  pointer-events: none;
}
.cv-root .cv-panel {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(12, 18, 29, .92);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
}

.cv-nav { gap: 10px; max-width: 46%; }
.cv-back {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; color: var(--text-2);
  border: 1px solid var(--border);
  background: rgba(17, 26, 41, .8);
  transition: all .15s;
}
.cv-back:hover { color: var(--cyan); border-color: var(--cyan); }
.cv-title-input {
  width: 190px;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: "Courier New", monospace; font-size: 14px; font-weight: 700; letter-spacing: .04em;
  text-overflow: ellipsis;
}
.cv-title-input:hover { color: var(--cyan); }
.cv-save-state {
  font: 10px "Courier New", monospace; letter-spacing: .08em;
  color: var(--text-3); white-space: nowrap;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border);
  text-transform: uppercase;
}
.cv-save-state.saving { color: var(--cyan); border-color: rgba(66, 232, 255, .4); }
.cv-save-state.ok { color: var(--lime, #b5ff72); border-color: rgba(181, 255, 114, .3); }
.cv-save-state.err { color: #ff6b8b; border-color: rgba(255, 107, 139, .4); }

.cv-toolbar { margin-left: auto; max-width: calc(100% - 120px); }
.cv-tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: rgba(17, 26, 41, .8);
  border: 1px solid var(--border);
  color: var(--text-2);
  font: 11px "Courier New", monospace; letter-spacing: .06em;
  white-space: nowrap;
  transition: all .15s;
}
.cv-tool svg { width: 14px; height: 14px; }
.cv-tool:hover { color: var(--cyan); border-color: var(--cyan); background: rgba(66, 232, 255, .08); }
.cv-sep { width: 1px; height: 18px; background: var(--border); flex: none; }

/* ---------- 画板 ---------- */
.cv-board {
  position: absolute; inset: 0;
  overflow: hidden;
  cursor: grab;
  background-color: var(--bg-deep, #04060b);
  background-image: radial-gradient(rgba(66, 232, 255, .09) 1px, transparent 1px);
  background-size: 24px 24px;
}
body.cv-grabbing, body.cv-grabbing .cv-board { cursor: grabbing; }

.cv-world {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
}
.cv-links {
  position: absolute; left: 0; top: 0;
  width: 6000px; height: 4000px; /* 覆盖全局 svg{width:16px} 规则，保证连线命中区域正确 */
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}
.cv-links .link {
  fill: none;
  stroke: rgba(156, 178, 201, .5);
  stroke-width: 2.5;
  opacity: .9;
  pointer-events: none;
}
.cv-links .link-active { stroke: var(--pink); opacity: 1; }
.cv-links .link.temp { stroke: var(--cyan); stroke-dasharray: 7 6; }
.cv-links .link-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
}
.cv-link-controls { position: absolute; left: 0; top: 0; z-index: 3; }
.link-delete {
  position: absolute;
  width: 20px; height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font: 700 13px/1 monospace;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 0 14px rgba(255, 60, 166, .55);
  z-index: 4;
}
.link-delete.show { display: inline-flex; }

.cv-nodes { position: relative; z-index: 2; }

/* ---------- 节点卡片 ---------- */
.node {
  position: absolute;
  min-width: 200px; min-height: 64px;
  background: linear-gradient(180deg, rgba(21, 34, 54, .97), rgba(13, 21, 36, .97));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .5);
  user-select: none;
}
.node.sized { display: flex; flex-direction: column; }
.node.selected {
  border-color: var(--pink);
  box-shadow: 0 0 0 1px var(--pink), 0 0 26px rgba(255, 60, 166, .3), 0 14px 38px rgba(0, 0, 0, .5);
}
.node-head {
  height: 36px; flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 13px 13px 0 0;
  cursor: move;
}
.node-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--grad);
  box-shadow: 0 0 8px rgba(255, 60, 166, .6);
}
.node-title {
  flex: 1;
  font: 700 10px "Courier New", monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.node-del {
  width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; color: var(--text-3);
  opacity: 0; transition: all .15s;
}
.node-del svg { width: 12px; height: 12px; }
.node:hover .node-del { opacity: 1; }
.node-del:hover { color: #ff6b8b; background: rgba(255, 107, 139, .12); }
.node-body { padding: 10px; position: relative; }
.node.sized .node-body { flex: 1; overflow: auto; }

/* 端口 */
.port {
  position: absolute;
  width: 34px; height: 34px;
  top: 50%;
  transform: translateY(-50%);
  cursor: crosshair;
  z-index: 5;
}
.port::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--bg-deep, #04060b);
  transition: transform .12s;
}
.port.out { right: -17px; }
.port.out::after { background: var(--pink); box-shadow: 0 0 10px rgba(255, 60, 166, .7); }
.port.in { left: -17px; }
.port.in::after { background: var(--cyan); box-shadow: 0 0 10px rgba(66, 232, 255, .6); }
.port:hover::after { transform: translate(-50%, -50%) scale(1.35); }

/* 缩放手柄 */
.resize-handle {
  position: absolute;
  right: 4px; bottom: 4px;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity .15s;
  z-index: 5;
}
.resize-handle::after {
  content: "";
  position: absolute; right: 4px; bottom: 4px;
  width: 7px; height: 7px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
}
.node:hover .resize-handle, .node.selected .resize-handle { opacity: 1; }

/* 图片节点 */
.image-node { width: 260px; }
.node-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 9px;
  background: rgba(4, 6, 11, .6);
  display: block;
}
.image-node .node-body { padding: 8px; }
.img-actions {
  position: absolute; right: 14px; top: 14px;
  display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
.image-node:hover .img-actions { opacity: 1; }
.cv-mini-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(4, 6, 11, .8);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.cv-mini-btn svg { width: 13px; height: 13px; }
.cv-mini-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.blank-image {
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border-2);
  border-radius: 9px;
  color: var(--text-3);
  font: 11px "Courier New", monospace; letter-spacing: .06em;
  cursor: pointer;
  transition: all .15s;
}
.blank-image:hover { border-color: var(--pink); color: var(--pink); background: rgba(255, 60, 166, .05); }

/* 提示词节点 */
.prompt-node { width: 310px; }
.prompt-input {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  background: rgba(4, 6, 11, .55);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  padding: 9px 10px;
  outline: none;
}
.prompt-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(66, 232, 255, .12); }

/* 生成节点 */
.generate-node { width: 350px; }
.gen-form { display: flex; flex-direction: column; gap: 8px; }
.gen-row { display: flex; gap: 8px; }
.gen-row.gen-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.gen-row label {
  display: flex; flex-direction: column; gap: 3px;
  font: 9px "Courier New", monospace; letter-spacing: .1em;
  color: var(--text-3); text-transform: uppercase;
}
.gen-form select, .gen-form input {
  width: 100%;
  height: 28px;
  background: rgba(4, 6, 11, .55);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  padding: 0 7px;
  outline: none;
}
.gen-form select:focus, .gen-form input:focus { border-color: var(--cyan); }
.gen-prompt {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: rgba(4, 6, 11, .55);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 7px 9px;
  outline: none;
}
.gen-prompt:focus { border-color: var(--cyan); }
.gen-more summary {
  cursor: pointer;
  font: 10px "Courier New", monospace; letter-spacing: .1em;
  color: var(--text-3); text-transform: uppercase;
}
.gen-more[open] summary { margin-bottom: 6px; }
.gen-more input { margin-bottom: 6px; }
.gen-run-row { display: flex; align-items: center; gap: 10px; }
.cv-run-btn {
  flex: 1;
  height: 32px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font: 700 12px "Courier New", monospace; letter-spacing: .08em;
  box-shadow: 0 2px 16px rgba(255, 60, 166, .35);
  transition: filter .15s;
}
.cv-run-btn svg { width: 13px; height: 13px; }
.cv-run-btn:hover { filter: brightness(1.15); }
.gen-status {
  font: 10px "Courier New", monospace; letter-spacing: .08em;
  color: var(--text-3); white-space: nowrap;
}
.gen-status.running, .gen-status.queued { color: var(--cyan); }
.gen-status.failed { color: #ff6b8b; }
.gen-status.done { color: var(--lime, #b5ff72); }
.gen-error {
  font-size: 11px;
  color: #ff6b8b;
  background: rgba(255, 107, 139, .08);
  border: 1px solid rgba(255, 107, 139, .25);
  border-radius: 7px;
  padding: 5px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 输出节点 */
.output-node { width: 440px; }
.output-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.output-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in;
  background: rgba(4, 6, 11, .6);
}
.output-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.output-item:hover { border-color: var(--cyan); }
.output-del {
  position: absolute; right: 4px; top: 4px;
  width: 20px; height: 20px;
  border-radius: 6px;
  background: rgba(4, 6, 11, .85);
  color: var(--text-2);
  display: none; align-items: center; justify-content: center;
}
.output-del svg { width: 10px; height: 10px; }
.output-item:hover .output-del { display: inline-flex; }
.output-del:hover { color: #ff6b8b; }
.output-empty {
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font: 11px "Courier New", monospace; letter-spacing: .06em;
  border: 1.5px dashed var(--border);
  border-radius: 9px;
}

/* 分组节点 */
.node.group-node {
  pointer-events: none;
  background: rgba(66, 232, 255, .045);
  border: 1.5px dashed rgba(66, 232, 255, .45);
  border-radius: 16px;
  box-shadow: none;
  min-width: 0; min-height: 0;
}
.node.group-node .node-head {
  pointer-events: auto;
  background: rgba(12, 18, 29, .85);
  border-bottom: none;
  border-radius: 15px 15px 0 0;
  height: 32px;
  position: absolute;
  left: -1px; right: -1px; top: -33px;
  border: 1px solid rgba(66, 232, 255, .35);
}
.node.group-node .node-dot { background: var(--cyan); box-shadow: 0 0 8px rgba(66, 232, 255, .7); }
.node.group-node.selected { border-color: var(--cyan); box-shadow: 0 0 22px rgba(66, 232, 255, .25); }
.group-label {
  position: absolute;
  left: 14px; bottom: 10px;
  width: calc(100% - 28px);
  background: transparent;
  border: none; outline: none;
  color: rgba(66, 232, 255, .75);
  font: 700 11px "Courier New", monospace; letter-spacing: .1em;
  pointer-events: auto;
}

/* ---------- 框选 / 拖放 ---------- */
.cv-selection-box {
  position: absolute;
  z-index: 22;
  border: 1px solid var(--cyan);
  background: rgba(66, 232, 255, .08);
  border-radius: 4px;
  pointer-events: none;
}
.cv-drop-overlay {
  position: absolute; inset: 14px;
  z-index: 40;
  display: none;
  align-items: center; justify-content: center;
  border: 2px dashed var(--pink);
  border-radius: 18px;
  background: rgba(255, 60, 166, .06);
  color: var(--pink);
  font: 700 15px "Courier New", monospace; letter-spacing: .12em;
  pointer-events: none;
}
.cv-drop-overlay.show { display: flex; }

/* ---------- 右键菜单 ---------- */
.cv-menu {
  position: absolute;
  z-index: 45;
  min-width: 190px;
  background: rgba(12, 18, 29, .97);
  border: 1px solid var(--border-2);
  border-radius: 13px;
  padding: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  backdrop-filter: blur(14px);
}
.cv-menu-btn {
  width: 100%;
  height: 36px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
}
.cv-menu-btn svg { width: 14px; height: 14px; color: var(--text-3); }
.cv-menu-btn:hover { background: rgba(66, 232, 255, .08); color: var(--cyan); }
.cv-menu-btn:hover svg { color: var(--cyan); }

/* ---------- 小地图 & 缩放条 ---------- */
.cv-minimap {
  position: absolute;
  right: 20px; bottom: 20px;
  width: 196px; height: 134px;
  z-index: 24;
  background: rgba(12, 18, 29, .92);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
  cursor: crosshair;
}
.cv-minimap-content { position: relative; width: 100%; height: 100%; overflow: hidden; }
.minimap-node {
  position: absolute;
  background: rgba(156, 178, 201, .4);
  border-radius: 2.5px;
}
.minimap-node.sel { background: var(--pink); }
.cv-minimap-viewport {
  position: absolute;
  border: 1.5px solid var(--cyan);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(66, 232, 255, .35);
  pointer-events: none;
}
.cv-zoombar {
  position: absolute;
  left: 20px; bottom: 20px;
  z-index: 24;
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(12, 18, 29, .92);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
  font-family: "Courier New", monospace;
}
.cv-zbtn {
  min-width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
}
.cv-zbtn svg { width: 13px; height: 13px; }
.cv-zbtn:hover { color: var(--cyan); background: rgba(66, 232, 255, .08); }
.cv-zval {
  min-width: 44px;
  text-align: center;
  font-size: 11px; letter-spacing: .05em;
  color: var(--text-2);
}

/* ---------- 底部操作提示 ---------- */
.cv-hints {
  position: absolute;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(12, 18, 29, .8);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  color: var(--text-3);
  font: 10.5px "Courier New", monospace; letter-spacing: .06em;
  white-space: nowrap;
  pointer-events: none;
}
.cv-hints b { color: var(--cyan); }

/* 断线刀轨迹 */
.cv-knife-trail {
  position: fixed; inset: 0;
  z-index: 999;
  pointer-events: none;
}
.cv-knife-trail i {
  position: absolute;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ff6b8b;
  box-shadow: 0 0 8px rgba(255, 107, 139, .8);
}

/* ---------- 灯箱 ---------- */
.cv-lightbox {
  position: fixed; inset: 0;
  z-index: 300;
  background: rgba(4, 6, 11, .8);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
}
.cv-lightbox[hidden] { display: none; }
.cv-lightbox-shell {
  max-width: 92vw; max-height: 90vh;
  display: flex; flex-direction: column; gap: 12px;
}
.cv-lightbox-shell img {
  max-width: 92vw; max-height: 78vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border-2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.cv-lightbox-bar {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
}
.cv-lightbox-cap {
  max-width: 420px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2); font-size: 12.5px;
}

/* ---------- 资产库弹窗 ---------- */
.cv-asset-modal {
  position: fixed; inset: 0;
  z-index: 300;
  background: rgba(4, 6, 11, .72);
  backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
}
.cv-asset-modal[hidden] { display: none; }
.cv-asset-panel {
  width: min(760px, 92vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--panel, #0c121d);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}
.cv-asset-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-size: 15px; font-weight: 700;
}
.cv-asset-head svg { width: 17px; height: 17px; color: var(--cyan); }
.cv-asset-close {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; color: var(--text-2);
}
.cv-asset-close:hover { color: var(--text); background: var(--card-hover, #1b2d46); }
.cv-asset-grid {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding-right: 4px;
}
.cv-asset-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2, #111a29);
  transition: all .15s;
}
.cv-asset-item:hover { border-color: var(--pink); transform: translateY(-2px); }
.cv-asset-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.cv-asset-item span {
  font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cv-asset-loading {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 列表页 ---------- */
.cv-list .crumb { display: inline-flex; align-items: center; gap: 8px; }
.cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.cv-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius, 18px);
  background: linear-gradient(180deg, var(--card, #152236), var(--panel-2, #111a29));
  padding: 16px;
  cursor: pointer;
  transition: all .18s ease;
  display: flex; flex-direction: column; gap: 12px;
}
.cv-card:hover, .cv-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(66, 232, 255, .14), 0 14px 34px rgba(0, 0, 0, .4);
  outline: none;
}
.cv-card-top { display: flex; align-items: center; }
.cv-card-icon {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  border-radius: 12px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
}
.cv-card-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.cv-card:hover .cv-card-actions { opacity: 1; }
.cv-card-title {
  font-size: 15.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cv-card-meta {
  display: flex; gap: 14px;
  color: var(--text-3);
  font: 11px "Courier New", monospace; letter-spacing: .04em;
}
.cv-card-meta svg { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; margin-right: 4px; }
.cv-empty { text-align: center; padding: 70px 20px; }
.cv-empty .empty-code { color: var(--text-3); font: 11px "Courier New", monospace; letter-spacing: .2em; }
.cv-empty h3 { margin: 10px 0 6px; font-size: 20px; }
.cv-empty p { color: var(--text-2); max-width: 460px; margin: 0 auto 18px; line-height: 1.7; }

.cv-trash-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.cv-trash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2, #111a29);
}
.cv-trash-name { font-weight: 600; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-trash-meta { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .cv-root .cv-topbar { flex-wrap: wrap; }
  .cv-nav { max-width: 100%; }
  .cv-toolbar { margin-left: 0; max-width: 100%; overflow-x: auto; }
  .cv-tool span { display: none; }
  .cv-tool { padding: 0 9px; }
  .cv-hints { display: none; }
  .cv-minimap { display: none; }
}

/* ============================================================
   扩展：触屏支持 / 便签 / 工具箱 / 视频 / 遮罩编辑器 / 模板 / 历史
   ============================================================ */

/* 触屏：画布接管手势（双指捏合缩放、单指平移）；输入控件保留原生滚动 */
.cv-board { touch-action: none; }
.node textarea, .node input, .node select, .node video { touch-action: auto; }

/* 双列参数行（生成节点：类型+模型；工具箱：工具+译向） */
.gen-row.gen-2 { display: grid; grid-template-columns: 1fr 1fr; }
.gen-variants-label { margin-top: 2px; }

/* ---------- 便签节点 ---------- */
.note-node { background: linear-gradient(180deg, rgba(24, 34, 30, .97), rgba(14, 22, 20, .97)); }
.note-dots {
  display: flex; gap: 6px;
  margin-bottom: 8px;
}
.note-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.note-dot:hover { transform: scale(1.2); }
.note-dot.on { border-color: #fff; }
.note-dot.note-cyan { background: #42e8ff; }
.note-dot.note-pink { background: #ff3ca6; }
.note-dot.note-lime { background: #b5ff72; }
.note-dot.note-violet { background: #a78bfa; }
.note-input {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  background: rgba(4, 6, 11, .5);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  padding: 9px 10px;
  outline: none;
}
.note-input:focus { border-color: var(--cyan); }
.note-cyan { border-left: 3px solid #42e8ff; }
.note-pink { border-left: 3px solid #ff3ca6; }
.note-lime { border-left: 3px solid #b5ff72; }
.note-violet { border-left: 3px solid #a78bfa; }

/* ---------- 工具箱节点 ---------- */
.toolbox-node .tb-text, .toolbox-node .tb-result {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  background: rgba(4, 6, 11, .55);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  padding: 6px 8px;
  outline: none;
}
.toolbox-node .tb-result { border-color: rgba(181, 255, 114, .25); min-height: 70px; }
.toolbox-node .tb-text:focus, .toolbox-node .tb-result:focus { border-color: var(--cyan); }
.toolbox-node .gen-form select {
  width: 100%;
  height: 28px;
  background: rgba(4, 6, 11, .55);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  padding: 0 7px;
  outline: none;
}
.toolbox-node .gen-row label {
  display: flex; flex-direction: column; gap: 3px;
  font: 9px "Courier New", monospace; letter-spacing: .1em;
  color: var(--text-3); text-transform: uppercase;
}

/* ---------- 输出节点视频 ---------- */
.output-item video.node-video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  background: rgba(4, 6, 11, .6);
}

/* ---------- 遮罩编辑器弹窗 ---------- */
.cv-mask-modal {
  position: fixed; inset: 0;
  z-index: 320;
  background: rgba(4, 6, 11, .78);
  backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
}
.cv-mask-modal[hidden] { display: none; }
.cv-mask-panel {
  width: min(860px, 94vw);
  max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--panel, #0c121d);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}
.cv-mask-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 15px; font-weight: 700;
}
.cv-mask-head svg { width: 17px; height: 17px; color: var(--pink); }
.cv-mask-hint { color: var(--text-3); font-size: 12px; font-weight: 400; }
.cv-mask-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  color: var(--text-2); font-size: 12.5px;
}
.cv-mask-toolbar input[type="range"] { vertical-align: middle; }
.cv-mask-toolbar .grow { flex: 1; }
.cv-mask-dim { color: var(--text-3); font: 11px "Courier New", monospace; }
.cv-mask-stage {
  overflow: auto;
  display: flex; justify-content: center;
  background: repeating-conic-gradient(rgba(255,255,255,.05) 0% 25%, transparent 0% 50%) 50%/22px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  min-height: 200px;
}
.cv-mask-wrap { position: relative; }
.cv-mask-wrap canvas { display: block; }
.cv-mask-wrap .cv-mask-paint { position: absolute; inset: 0; cursor: crosshair; }
.cv-mask-panel .modal-foot { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.btn.active, .cv-mask-eraser.active { color: var(--pink); border-color: var(--pink); background: rgba(255, 60, 166, .1); }

/* ---------- 工作流模板 ---------- */
.cv-tpl-save { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cv-tpl-tip { color: var(--text-3); font-size: 11.5px; }
.cv-tpl-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.cv-tpl-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2, #111a29);
  transition: border-color .15s;
}
.cv-tpl-item:hover { border-color: var(--cyan); }
.cv-tpl-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-tpl-meta { color: var(--text-3); font: 10.5px "Courier New", monospace; letter-spacing: .05em; }
.cv-tpl-acts { display: flex; gap: 6px; margin-top: auto; }

/* ---------- 版本历史面板 ---------- */
.cv-history-panel { width: min(560px, 92vw); }

/* ---------- 生成节点状态 done ---------- */
.gen-status.done { color: var(--lime, #b5ff72); }
