/* static/css/creative.css — 创作空间 · 无限画布
   视觉语言复用工作流画布（flow-canvas.css）：深色画布 + 网格 + 绿色主题节点，
   但为 AI 创作场景做了独立前缀（.cr-）与布局（顶部项目栏 / 左侧节点库 / 右侧检视器）。 */

/* ---- 视图容器：占满 main-canvas ---- */
#view-canvas { display: none; }
#view-canvas.active {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  animation: fadeIn .35s ease both;
}
.cr-app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  position: relative;
  /* 左右侧面板宽度变量：默认最小宽度，JS 拖拽时会覆盖并持久化 */
  --cr-library-w: 280px;
  --cr-inspector-w: 280px;
}

/* ---- 顶部项目栏 ---- */
.cr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(14,14,18,0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 30;
  flex-shrink: 0;
}
.cr-topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cr-logo {
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--text);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.cr-logo::before {
  content: ''; width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, var(--neon), var(--neon-bright));
  box-shadow: 0 0 10px rgba(74,222,128,0.5);
}
.cr-project-switch { position: relative; }
.cr-project-current {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .18s ease; max-width: 280px;
}
.cr-project-current:hover { border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.06); }
.cr-project-current svg { width: 14px; height: 14px; opacity: .6; flex-shrink: 0; }
#crProjectCurrentName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-project-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; max-height: 360px; overflow-y: auto;
  padding: 6px; border-radius: 12px; background: rgba(14,14,18,0.90);
  border: 1px solid rgba(74,222,128,0.18); box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%); z-index: 110;
}
.cr-project-menu[hidden] { display: none; }
.cr-menu-group-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 8px 10px 4px;
}
.cr-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text-dim); cursor: pointer; transition: background .15s ease;
}
.cr-menu-item:hover { background: var(--surface-hover); color: var(--text); }
.cr-menu-item.active { color: var(--neon-bright); background: rgba(74,222,128,0.1); }
.cr-menu-item .cr-mi-cat {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--border);
}
.cr-menu-item .cr-mi-del { margin-left: 8px; opacity: .5; }
.cr-menu-item .cr-mi-del:hover { opacity: 1; color: #f87171; }
.cr-project-cat {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: rgba(74,222,128,0.1); color: var(--neon-bright); border: 1px solid rgba(74,222,128,0.2);
}
.cr-project-cat:empty { display: none; }
.cr-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#view-canvas .cr-topbar { display: none; }
.cr-btn {
  padding: 7px 14px; border-radius: 10px; border: 1px solid transparent;
  background: var(--neon); color: #07120a; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .18s ease; white-space: nowrap;
}
.cr-btn:hover { filter: brightness(1.08); }
.cr-btn.ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.cr-btn.ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.04); }
.cr-btn.primary { background: var(--neon); color: #07120a; }

/* ---- 主体三栏 ---- */
.cr-main { flex: 1; min-height: 0; display: flex; position: relative; }

/* 面板拖拽分割线（极简细线 + hover 光边） */
.cr-resizer {
  width: 12px;
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  z-index: 20;
  background: transparent;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
}
.cr-resizer::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(74,222,128,0.07);
  box-shadow: none;
  transition: all .22s ease;
}
.cr-resizer:hover::before,
.cr-resizer.dragging::before {
  width: 1px;
  background: rgba(74,222,128,0.6);
  box-shadow:
    0 0 5px rgba(74,222,128,0.5),
    0 0 12px rgba(74,222,128,0.22);
}
.cr-resizer.dragging::before {
  background: rgba(74,222,128,0.85);
  box-shadow:
    0 0 7px rgba(74,222,128,0.7),
    0 0 20px rgba(74,222,128,0.32);
}

/* 中间画布舞台 */
.cr-stage { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.cr-canvas-viewport {
  position: absolute; inset: 0; overflow: hidden; cursor: default;
  outline: none; /* 画布可聚焦（tabindex=0）但不显示焦点框 */
  background-color: var(--bg);
  /* 页面/body 背景光效（可复用模板变量，设置 → 外观可调）+ 原有点阵网格 */
  background-image:
    radial-gradient(560px 560px at 12% -6%, var(--ambient-glow-a, rgba(74,222,128,0.16)), transparent 62%),
    radial-gradient(560px 560px at 106% -6%, var(--ambient-glow-b, rgba(34,211,238,0.13)), transparent 62%),
    radial-gradient(560px 560px at -6% 106%, var(--ambient-glow-b, rgba(34,211,238,0.13)), transparent 62%),
    radial-gradient(560px 560px at 106% 112%, var(--ambient-glow-a, rgba(74,222,128,0.16)), transparent 62%),
    radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    radial-gradient(rgba(74,222,128,0.05) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 22px 22px, 44px 44px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 11px 11px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
  touch-action: none;
}
/* 进入编辑画布：去掉背景光效，只保留纯色点阵 */
.cr-canvas-viewport.cr-scene-editing {
  background-image:
    radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    radial-gradient(rgba(74,222,128,0.05) 1px, transparent 1px);
  background-size: 22px 22px, 44px 44px;
  background-position: 0 0, 11px 11px;
  background-repeat: repeat, repeat;
}
.cr-canvas-viewport:active { cursor: grabbing; }
.cr-canvas-viewport.panning .cr-node { pointer-events: none; }

/* ── 画布拖拽上传遮罩（参考 image#3）── */
.cr-canvas-drop-overlay {
  position: absolute; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  background: rgba(0,0,0,0.55);
  border: 2px dashed rgba(80,160,255,0.5);
  border-radius: 12px;
  pointer-events: none;
  animation: crDropPulse 1.6s ease-in-out infinite alternate;
}
@keyframes crDropPulse {
  from { border-color: rgba(80,160,255,0.35); background: rgba(0,0,0,0.45); }
  to   { border-color: rgba(80,160,255,0.7); background: rgba(0,0,0,0.62); }
}
.cr-canvas-drop-icon {
  width: 56px; height: 56px; display: grid; place-items: center;
  color: rgba(255,255,255,0.65); font-size: 32px;
}
.cr-canvas-drop-title {
  font-size: 18px; font-weight: 600; color: rgba(255,255,255,0.88);
  letter-spacing: 0.04em;
}
.cr-canvas-drop-sub {
  font-size: 13px; color: rgba(255,255,255,0.42);
}
.cr-canvas-layer {
  position: absolute; inset: 0; width: 30000px; height: 30000px;
  transform-origin: 0 0; will-change: transform; background: transparent;
  /* 画布层置于左侧工具条(70)/底部工具条(60)之上：透明层不遮挡它们，但其中的节点提示词面板可点击；
     指针事件透传（pointer-events:none），由节点层(.cr-nodes-layer)重新开启 */
  z-index: 71; pointer-events: none;
}
.cr-canvas-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.cr-canvas-svg path { fill: none; }
.cr-canvas-svg path.cr-edge {
  stroke: url(#crEdgeGrad); stroke-width: 7;
  /* 抗锯齿渲染（SVG 等效 ctx.imageSmoothingEnabled=true）：shape-rendering 显式几何精度，消除锯齿毛刺 */
  shape-rendering: geometricPrecision;
  /* 端点/拐角圆润（等效 ctx.lineCap=round / lineJoin=round），减少生硬拐角观感 */
  stroke-linecap: round; stroke-linejoin: round;
  /* 线条透明度 0.85：适配深色画布，避免完全死白 */
  opacity: 0.85;
  /* 线宽不随画布缩放（低倍缩放时细水平线不会被缩没） */
  vector-effect: non-scaling-stroke;
  /* 不用 drop-shadow 滤镜：SVG 滤镜会让每条连线每帧离屏重绘，节点一多就卡 */
  pointer-events: none;
}
.cr-canvas-svg path.cr-edge.done { stroke: url(#crEdgeGradDone); }
.cr-canvas-svg path.cr-edge-temp { stroke: rgba(74,222,128,0.7); stroke-width: 2.5; stroke-dasharray: 5 4; }
.cr-edge-wrap { pointer-events: none; }
/* 选中节点：上下游连线同样使用加粗后的线宽（7px，不能比普通更细），虚线分段调大清晰可辨，滚动动画保留 */
.cr-edge-wrap.active .cr-edge {
  stroke: url(#crEdgeGradActive); stroke-width: 7;
  stroke-dasharray: 18 10; animation: crEdgeFlow 0.8s linear infinite;
  opacity: 1;
}
.cr-edge-wrap.active .cr-edge.done { stroke: url(#crEdgeGradDoneActive); stroke-width: 7; }
/* 暗色主题：默认连线为灰色 */
html:not([data-theme="light"]) .cr-canvas-svg path.cr-edge,
html:not([data-theme="light"]) .cr-canvas-svg path.cr-edge.done {
  stroke: #8a9099; /* 暗色默认连线：比之前稍暗，避免过亮刺眼 */
}
html:not([data-theme="light"]) .cr-edge-wrap.active .cr-edge {
  stroke: url(#crEdgeGradActive); stroke-width: 7;
}
html:not([data-theme="light"]) .cr-edge-wrap.active .cr-edge.done {
  stroke: url(#crEdgeGradDoneActive); stroke-width: 7;
}
.cr-edge-wrap.active .cr-edge.done { stroke: url(#crEdgeGradDoneActive); }
.cr-edge-wrap.dim .cr-edge { stroke: #d6d6d6 !important; filter: none !important; opacity: 0.85; }
/* 暗色主题：未选中路径的连线用中性灰色，比之前再暗一点 */
html:not([data-theme="light"]) .cr-edge-wrap.dim .cr-edge {
  stroke: rgba(100,100,100,0.5) !important;
  filter: none !important;
  opacity: 0.9;
}
.cr-edge-hit { fill: none; stroke: transparent; stroke-width: 28; pointer-events: stroke; cursor: pointer; z-index: 3; }
.cr-edge-cut { opacity: 0; transition: opacity .15s ease; pointer-events: none; cursor: pointer; }
.cr-edge-hit:hover ~ .cr-edge-cut { opacity: 1; }
.cr-edge-cut > circle { fill: rgba(14,15,19,0.92); stroke: rgba(255,255,255,0.45); stroke-width: 1; }
.cr-edge-cut-icon { width: 22px; height: 22px; color: #fff; }
.cr-edge-wrap:has(.cr-edge-hit:hover) .cr-edge { stroke: url(#crEdgeGradActive); filter: drop-shadow(0 0 6px rgba(74,222,128,0.45)); }
@keyframes crEdgeFlow { to { stroke-dashoffset: -12; } }
.cr-nodes-layer { position: absolute; inset: 0; z-index: 2; pointer-events: auto; }
.cr-nodes-layer.editing { pointer-events: none; }
.cr-nodes-layer.editing .cr-node, .cr-nodes-layer.editing .cr-group { pointer-events: auto; }

/* 空状态 */
.cr-empty {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 5;
  background: rgba(10,11,14,0.4); backdrop-filter: blur(2px);
}
.cr-empty[hidden] { display: none; }
.cr-empty-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cr-empty-title { font-size: 20px; font-weight: 800; color: var(--text); }
.cr-empty-sub { font-size: 13px; color: var(--text-muted); }
.cr-empty .cr-btn { margin-top: 6px; }

.cr-empty .cr-btn { margin-top: 6px; }

/* 空画布引导（画布无节点时居中显示：双击屏幕 + 自由生成入口） */
.cr-scene-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  z-index: 45; pointer-events: none;
}
.cr-scene-empty[hidden] { display: none; }
.cr-scene-empty-inner {
  pointer-events: auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 20px 24px; border-radius: 18px;
  /* 无边框、无底纹：与画布融为一体 */
  background: transparent; border: none; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-theme="light"] .cr-scene-empty-inner {
  background: transparent; border: none; box-shadow: none;
}
.cr-scene-empty-hint { display: flex; align-items: center; gap: 10px; }
.cr-se-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; border-radius: 999px;
  background: transparent; border: none;
  color: #4ade80; font-size: 13px; font-weight: 700;
}
.cr-se-pill svg { width: 13px; height: 13px; }
.cr-se-sub { color: var(--text-muted); font-size: 13px; }
.cr-scene-empty-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.cr-scene-empty-actions > button,
.cr-se-wf-wrap > button {
  height: 34px; padding: 0 12px; border-radius: 8px;
  border: none; background: transparent;
  color: var(--text-dim); font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s ease;
}
.cr-scene-empty-actions > button:hover,
.cr-se-wf-wrap > button:hover { color: var(--neon-bright, #4ade80); }
html[data-theme="light"] .cr-scene-empty-actions > button,
html[data-theme="light"] .cr-se-wf-wrap > button { background: transparent; color: #374151; }
html[data-theme="light"] .cr-scene-empty-actions > button:hover,
html[data-theme="light"] .cr-se-wf-wrap > button:hover { color: #0f766e; }
.cr-se-arrow { font-size: 10px; opacity: .7; }
.cr-se-wf-wrap { position: relative; }
.cr-se-wf-menu {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  min-width: 180px; max-height: 280px; overflow-y: auto; padding: 6px;
  border-radius: 12px; z-index: 9999;
  background: rgba(28,28,30,0.90); border: 1px solid var(--modal-border);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
html[data-theme="light"] .cr-se-wf-menu { background: rgba(255,255,255,0.90); border-color: rgba(0,0,0,0.12); }
.cr-se-wf-menu[hidden] { display: none; }
.cr-se-wf-item {
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-dim); text-align: left;
  transition: background .12s ease, color .12s ease;
}
.cr-se-wf-item:hover { background: var(--surface-hover); color: var(--text); }
html[data-theme="light"] .cr-se-wf-item { color: #1f2937; }
html[data-theme="light"] .cr-se-wf-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
.cr-se-wf-empty { padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); text-align: center; }

/* ---- 我的工作流（打组保存的工作流）弹窗 ---- */
.cr-gw-overlay { z-index: 320; }
.cr-gw-overlay .ui-modal-card { max-width: 920px; width: 92vw; max-height: 82vh; overflow: hidden; }
.cr-gw { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 18px 20px 20px; gap: 14px; }
.cr-gw-head { display: flex; align-items: center; gap: 12px; }
.cr-gw-title { font-size: 18px; font-weight: 800; color: var(--text); flex-shrink: 0; }
.cr-gw-search {
  flex: 1; min-width: 120px; height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border, rgba(255,255,255,0.12)); background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 13px; outline: none;
}
.cr-gw-search:focus { border-color: rgba(74,222,128,0.5); }
.cr-gw-close {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--text-dim); font-size: 20px; line-height: 1; cursor: pointer; flex-shrink: 0;
}
.cr-gw-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-gw-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-gw-cat {
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; color: var(--text-dim); border: 1px solid transparent;
  background: rgba(255,255,255,0.05); transition: all .12s ease;
}
.cr-gw-cat:hover { color: var(--text); background: rgba(255,255,255,0.09); }
.cr-gw-cat.active { color: #4ade80; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.10); }
.cr-gw-grid {
  flex: 1; min-height: 0; overflow-y: auto; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 4px 2px 8px;
}
.cr-gw-card {
  border-radius: 14px; overflow: hidden; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.cr-gw-card:hover { transform: translateY(-2px); border-color: rgba(74,222,128,0.45); box-shadow: 0 10px 26px rgba(0,0,0,0.35); }
.cr-gw-preview { aspect-ratio: 4 / 3; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-gw-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-gw-ph { color: rgba(255,255,255,0.25); }
.cr-gw-ph svg { width: 34px; height: 34px; }
.cr-gw-info { padding: 10px 12px; }
.cr-gw-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-gw-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.cr-gw-empty {
  grid-column: 1 / -1; text-align: center; color: var(--text-muted);
  font-size: 13px; padding: 60px 20px; line-height: 1.8; white-space: pre-line;
}
html[data-theme="light"] .cr-gw-card { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-gw-card:hover { border-color: #0d9488; box-shadow: 0 10px 26px rgba(15,23,42,0.12); }
html[data-theme="light"] .cr-gw-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-gw-cat { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .cr-gw-cat.active { color: #15803d; border-color: rgba(21,128,61,0.4); background: rgba(21,128,61,0.10); }

/* ---- 节点（卡片风格） ---- */
.cr-node {
  position: absolute; width: 220px;
  border-radius: 14px; background: rgba(20,21,26,0.96);
  border: 1px solid rgba(255,255,255,0.09); cursor: grab;
  transition: border-width .15s ease, border-color .2s ease, box-shadow .22s ease, transform .16s ease;
  user-select: none; box-shadow: 0 14px 34px rgba(0,0,0,0.55);
  display: flex; flex-direction: column; overflow: visible; touch-action: none;
  box-sizing: border-box;
  /* 关键：节点层级须高于连线 SVG(z-index:1)，否则外露的连线柄(端口/侧加号)会被 SVG 盖住而不可点击，
  // 导致「从 + 号拖拽连线」永远无法命中起点（mousedown 落到了 SVG 下方的视口层）。 */
  z-index: 2;
}
.cr-node:hover { border-color: rgba(255,255,255,0.16); box-shadow: 0 20px 46px rgba(0,0,0,0.6); }
.cr-node.selected { border-color: var(--node-color); box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 36px color-mix(in srgb, var(--node-color) 22%, transparent); z-index: 90; }
.cr-node.dragging { opacity: .9; z-index: 50; cursor: grabbing; }
.cr-select-rect { position: absolute; border: 1px solid rgba(74,222,128,0.9); background: rgba(74,222,128,0.12); border-radius: 4px; pointer-events: none; z-index: 40; }

/* 连接端口 */
.cr-node-port {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--node-color); border: 2px solid rgba(18,19,24,0.95);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
  cursor: crosshair; transition: transform .12s ease, box-shadow .12s ease; z-index: 4;
}
.cr-node-port.in  { left: -7px; }
.cr-node-port.out { right: -7px; }
.cr-node-port:hover { transform: translateY(-50%) scale(1.35); box-shadow: 0 0 0 2px var(--node-color); }

/* 卡片本体 */
.cr-node-card { position: relative; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.cr-node-header {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; min-height: 36px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--node-color) 20%, transparent), color-mix(in srgb, var(--node-color) 5%, transparent));
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cr-node-header-icon {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(0,0,0,0.25); color: var(--node-color); flex-shrink: 0;
}
.cr-node-header-icon svg { width: 13px; height: 13px; }
.cr-node-title {
  flex: 1; min-width: 0; font-size: 12px; font-weight: 800; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; border-radius: 4px; padding: 1px 4px; margin: -1px -4px;
}
.cr-node-title[contenteditable="true"] { background: rgba(0,0,0,0.3); box-shadow: 0 0 0 1px var(--node-color); }
.cr-node-upload {
  border: 1px solid color-mix(in srgb, var(--node-color) 45%, transparent);
  background: color-mix(in srgb, var(--node-color) 14%, transparent);
  color: var(--node-color); border-radius: 7px; font-size: 11px; font-weight: 700;
  padding: 4px 9px; cursor: pointer; flex-shrink: 0; transition: all .14s ease;
}
.cr-node-upload:hover { background: color-mix(in srgb, var(--node-color) 28%, transparent); color: #fff; }

/* 框选期间：节点两侧 + 号不显示（含 hover / selected 触发的 visible） */
.cr-canvas-viewport.cr-box-selecting .cr-node-side-add,
.cr-canvas-viewport.cr-box-selecting .cr-node:hover .cr-node-side-add,
.cr-canvas-viewport.cr-box-selecting .cr-node-side-add.visible {
  opacity: 0 !important;
  pointer-events: none;
}

/* 侧边加号（快速连线新增节点） */
.cr-node-side-add {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
  background: #111111; color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18); opacity: 0; transition: opacity .15s ease, transform .12s ease;
  z-index: 6;
}
.cr-node-side-add svg { width: 14px; height: 14px; }
.cr-node-side-add.left  { left: -34px; }
.cr-node-side-add.right { right: -34px; }
.cr-node:hover .cr-node-side-add { opacity: 1; }
.cr-node-side-add:hover { transform: translateY(-50%) scale(1.14); background: #1f2937; color: #fff; }

/* 节点主体 */
.cr-node-body { position: relative; padding: 10px; min-height: 56px; background: rgba(14,15,19,0.5); display: flex; flex-direction: column; gap: 8px; }
.cr-text-area {
  min-height: 40px; max-height: 120px; overflow: auto;
  font-size: 11px; line-height: 1.55; color: var(--text-dim); outline: none;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(0,0,0,0.2); border-radius: 8px; padding: 8px 10px;
}
.cr-text-area:empty::before { content: '双击开始编辑…'; color: var(--text-muted); }
/* 编辑态：无蓝色边框，仅微调背景 */
.cr-text-area[contenteditable="true"] { background: rgba(0,0,0,0.25); cursor: text; }
.cr-node.cr-text-node .cr-text-area[contenteditable="true"]:empty::before { content: '请输入文本内容…'; color: rgba(255,255,255,0.28); }

/* 文本节点内文本区域：阻止滚轮默认滚动，让事件冒泡到画布层触发缩放 */
.cr-node.cr-text-node .cr-text-area { overscroll-behavior: contain; }


.cr-storyboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.cr-sb-cell { aspect-ratio: 16 / 9; border-radius: 6px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); font-size: 10px; }
.cr-sb-cell:hover { border-color: var(--node-color); }

.cr-media {
  position: relative; min-height: 96px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.07);
}
.cr-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cr-media-ph { display: grid; place-items: center; gap: 4px; color: var(--node-color); opacity: .55; font-size: 10px; text-align: center; padding: 8px; }
.cr-media-ph svg { width: 30px; height: 30px; opacity: .7; }
.cr-media-hint { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* 节点底部输入条 */
.cr-node-footer { padding: 8px 10px; background: rgba(0,0,0,0.18); border-top: 1px solid rgba(255,255,255,0.05); }
.cr-node-input textarea { width: 100%; resize: none; border: none; outline: none; background: transparent; color: var(--text-dim); font-size: 11px; line-height: 1.5; font-family: inherit; }
.cr-node-input textarea::placeholder { color: var(--text-muted); }

/* 类型主题 —— 通过 CSS 变量统一配色 */
.cr-node.type-text       { --node-color: #38bdf8; }
.cr-node.type-image      { --node-color: #22d3ee; }
.cr-node.type-video      { --node-color: #ec4899; }
.cr-node.type-audio      { --node-color: #f59e0b; }
.cr-node.type-3d         { --node-color: #a78bfa; }
.cr-node.type-director   { --node-color: #f43f5e; }
.cr-node.type-script     { --node-color: #34d399; }
.cr-node.type-storyboard { --node-color: #6366f1; }
.cr-node.type-compose    { --node-color: #fb923c; }
.cr-node.type-ai-app     { --node-color: #818cf8; }
.cr-node.type-upload     { --node-color: #94a3b8; }
.cr-node.type-import     { --node-color: #94a3b8; }
.cr-node.type-group      { --node-color: #4ade80; }

/* ---- 文本节点（参考图风格） ---- */
/* 统一间距变量：工具栏/输入框与卡片之间的固定留白（像素） */
.cr-node.cr-text-node { --node-panel-gap: 25px; width: auto; height: auto; background: transparent; border: none; box-shadow: none; border-radius: 0; overflow: visible; }
.cr-node.cr-text-node .cr-node-card {
  width: 100%; height: 100%; min-width: 220px; min-height: 160px;
  border-radius: 22px; background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  overflow: hidden; position: relative;
  box-sizing: border-box;
}
.cr-node.cr-text-node:hover .cr-node-card { border-color: rgba(255,255,255,0.38); }
/* 选中态用 outline 而非加粗 border，避免内部文字被挤压 */
/* 选中环圆角跟随卡片：避免方形环在四角戳出圆角 */
.cr-node.cr-text-node.selected { border-radius: 22px; }
.cr-node.cr-text-node.cr-image-node.selected,
.cr-node.cr-text-node.cr-video-node.selected,
.cr-node.cr-text-node.cr-audio-node.selected { border-radius: 14px; }
.cr-node.cr-text-node.selected .cr-node-card {
  border: 1px solid var(--modal-border);
  outline: 2px solid rgba(255,255,255,0.62);
  outline-offset: -1px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55), 0 0 36px rgba(255,255,255,0.08);
}
.cr-node.cr-text-node .cr-node-label {
  position: absolute; top: -28px; left: 4px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 800; color: rgba(255,255,255,0.72);
  pointer-events: auto;
}
.cr-node.cr-text-node .cr-node-label [data-edit="name"] {
  cursor: text; min-width: 20px; padding: 2px 6px; border-radius: 6px;
  transition: background .15s ease;
}
.cr-node.cr-text-node .cr-node-label [data-edit="name"]:hover { background: rgba(255,255,255,0.08); }
.cr-node.cr-text-node .cr-node-label [data-edit="name"][contenteditable="true"] {
  background: rgba(0,0,0,0.35); outline: none; color: #fff;
}
.cr-node.cr-text-node .cr-node-label-icon { width: 18px; height: 18px; display: grid; place-items: center; color: rgba(255,255,255,0.6); }
.cr-node.cr-text-node .cr-node-label-icon svg { width: 15px; height: 15px; }
.cr-node.cr-text-node .cr-node-body { padding: 0; background: transparent; min-height: 0; flex: 1; position: relative; }
.cr-node.cr-text-node .cr-text-area {
  width: 100%; height: 100%; min-height: 120px; max-height: none;
  padding: 22px 24px; border-radius: 0; background: transparent;
  font-size: 14px; line-height: 1.65; color: rgba(255,255,255,0.88);
  white-space: pre-wrap; word-break: break-word; overflow: auto; outline: none;
  cursor: text;
}
.cr-node.cr-text-node .cr-text-area.is-empty::before { content: '双击开始编辑…'; color: rgba(255,255,255,0.28); }
.cr-node.cr-text-node .cr-text-area[contenteditable="true"] { background: rgba(0,0,0,0.25); cursor: text; }
/* 连接端口整体隐藏：节点两侧已有「+」号图标作为连线入口（拉线时命中 + 号触发范围即可连接） */
.cr-node .cr-node-port { display: none; }
.cr-node.cr-text-node .cr-node-side-add {
  width: 30px; height: 30px; border: 1px solid rgba(255,255,255,0.25);
  background: #111111; color: #ffffff;
  left: var(--side-add-left-x, -25px);
  top: var(--side-add-left-y, 50%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  /* 从节点边缘缩放弹出：hidden scale(0)，显示时弹性放大到 scale(1) */
  transition: opacity .22s cubic-bezier(.34,1.4,.5,1), transform .28s cubic-bezier(.34,1.6,.5,1.15),
              top .26s cubic-bezier(.34,1.45,.5,1), left .26s cubic-bezier(.34,1.45,.5,1),
              background .15s ease, color .15s ease, border-color .15s ease;
}
.cr-node.cr-text-node .cr-node-side-add.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.cr-node.cr-text-node .cr-node-side-add.right { left: var(--side-add-right-x, calc(100% + 25px)); top: var(--side-add-right-y, 50%); }
.cr-node.cr-text-node .cr-node-side-add.visible:hover { transform: translate(-50%, -50%) scale(1.14); background: #1f2937; color: #fff; border-color: rgba(255,255,255,0.35); }

/* 拖拽手柄 —— 右下角圆弧角标（单元素：内联 SVG 绘制，热区即本身） */
.cr-node.cr-text-node .cr-node-resize {
  position: absolute; right: -4px; bottom: -4px;
  width: 20px; height: 20px;   /* 整体缩小到 20px，仅留短弧；同时作为 hover 热区 */
  cursor: nwse-resize; z-index: 5; opacity: 0; transition: opacity .18s ease;
  background: transparent;
}
.cr-node.cr-text-node .cr-node-resize svg {
  display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none;
}
.cr-node.cr-text-node .cr-node-resize path {
  fill: none; stroke: rgba(255,255,255,0.45); stroke-width: 2.5;
  stroke-linecap: round;            /* 线头圆润 */
  transition: stroke .18s ease;
}
/* 仅在鼠标进入右下角或拖拽中显示（不再响应整节点 hover） */
.cr-node.cr-text-node .cr-node-resize:hover,
.cr-node.cr-text-node.resizing .cr-node-resize { opacity: 1; }
.cr-node.cr-text-node .cr-node-resize:hover path {
  stroke: rgba(255,255,255,0.85);
}

/* ── 生成中遮罩（v5 重设计：转圈 spinner + 阶段化文本 + 早期取消）── */
.cr-generating-mask {
  position: absolute; inset: 0;
  /* 实体深蓝渐变背景（不透出下方画面，对齐 uiverse 该 loader 的深蓝视觉基调） */
  background:
    radial-gradient(circle at 50% 40%, rgba(30, 64, 175, 0.55) 0%, rgba(15, 23, 42, 0.92) 70%, rgba(0, 0, 0, 0.98) 100%),
    linear-gradient(0deg, #1a3379, #0f172a, #000);
  /* 圆角略小于节点(.cr-node 14px)，确保四角完全盖住节点边框不漏底层 */
  border-radius: 12px;
  overflow: hidden;
  animation: crGenFadeIn .25s ease;
}
@keyframes crGenFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── uiverse joao-canais「Generating」辉光环 loader（圆环+生成中约占满，取消按钮定位中下） ── */
.gen-loader {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding-top: 10px;
}
.gen-loader-wrapper {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 150px; height: 150px;
  font-family: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 1.15em; font-weight: 500;
  color: #fff;
  border-radius: 50%;
  -webkit-user-select: none; user-select: none;
}
.gen-loader-circle {
  position: absolute; inset: 0;
  border-radius: 50%;
  animation: genLoaderCombine 2.3s linear infinite;
  z-index: 0;
}
/* "Generating..." 逐字文字：比圆环略小，叠加在圆环中心 */
.gen-loader-copy {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 0;
  letter-spacing: 0.04em;
  font-size: 0.95em;
}
/* 「生成中」副标题（已按需求去掉，规则保留以便日后复用） */
.cr-gen-text-sub {
  margin-top: 16px;
  font-size: 14px; font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
@keyframes genLoaderCombine {
  0% {
    transform: rotate(90deg);
    box-shadow:
      0 6px 12px 0 #38bdf8 inset,
      0 12px 18px 0 #005dff inset,
      0 36px 36px 0 #1e40af inset,
      0 0 3px 1.2px rgba(56, 189, 248, 0.3),
      0 0 6px 1.8px rgba(0, 93, 255, 0.2);
  }
  25% {
    transform: rotate(180deg);
    box-shadow:
      0 6px 12px 0 #0099ff inset,
      0 12px 18px 0 #38bdf8 inset,
      0 36px 36px 0 #005dff inset,
      0 0 6px 2.4px rgba(56, 189, 248, 0.3),
      0 0 12px 3.6px rgba(0, 93, 255, 0.2),
      0 0 18px 6px rgba(30, 64, 175, 0.15);
  }
  50% {
    transform: rotate(270deg);
    box-shadow:
      0 6px 12px 0 #60a5fa inset,
      0 12px 6px 0 #0284c7 inset,
      0 24px 36px 0 #005dff inset,
      0 0 3px 1.2px rgba(56, 189, 248, 0.3),
      0 0 6px 1.8px rgba(0, 93, 255, 0.2);
  }
  75% {
    transform: rotate(360deg);
    box-shadow:
      0 6px 12px 0 #3b82f6 inset,
      0 12px 18px 0 #0ea5e9 inset,
      0 36px 36px 0 #2563eb inset,
      0 0 6px 2.4px rgba(56, 189, 248, 0.3),
      0 0 12px 3.6px rgba(0, 93, 255, 0.2),
      0 0 18px 6px rgba(30, 64, 175, 0.15);
  }
  100% {
    transform: rotate(450deg);
    box-shadow:
      0 6px 12px 0 #4dc8fd inset,
      0 12px 18px 0 #005dff inset,
      0 36px 36px 0 #1e40af inset,
      0 0 3px 1.2px rgba(56, 189, 248, 0.3),
      0 0 6px 1.8px rgba(0, 93, 255, 0.2);
  }
}
.gen-loader-copy .lr-letter {
  display: inline-block;
  opacity: 0.4;
  transform: translateY(0);
  animation: genLoaderLetter 2.4s infinite;
  border-radius: 50ch; border: none;
}
.gen-loader-copy .lr-letter:nth-child(1)  { animation-delay: 0s; }
.gen-loader-copy .lr-letter:nth-child(2)  { animation-delay: 0.1s; }
.gen-loader-copy .lr-letter:nth-child(3)  { animation-delay: 0.2s; }
.gen-loader-copy .lr-letter:nth-child(4)  { animation-delay: 0.3s; }
.gen-loader-copy .lr-letter:nth-child(5)  { animation-delay: 0.4s; }
.gen-loader-copy .lr-letter:nth-child(6)  { animation-delay: 0.5s; }
.gen-loader-copy .lr-letter:nth-child(7)  { animation-delay: 0.6s; }
.gen-loader-copy .lr-letter:nth-child(8)  { animation-delay: 0.7s; }
.gen-loader-copy .lr-letter:nth-child(9)  { animation-delay: 0.8s; }
.gen-loader-copy .lr-letter:nth-child(10) { animation-delay: 0.9s; }
.gen-loader-copy .lr-letter:nth-child(11) { animation-delay: 1s; }
.gen-loader-copy .lr-letter:nth-child(12) { animation-delay: 1.1s; }
.gen-loader-copy .lr-letter:nth-child(13) { animation-delay: 1.2s; }
@keyframes genLoaderLetter {
  0%,
  100% { opacity: 0.4; transform: translateY(0); }
  20%   { opacity: 1; text-shadow: #f8fcff 0 0 5px; }
  40%   { opacity: 0.7; transform: translateY(0); }
}

.cr-gen-cancel-wrap {
  position: absolute; left: 0; right: 0;
  top: 80%;
  display: flex; justify-content: center; align-items: center;
  z-index: 1;
}
.cr-gen-cancel {
  padding: 7px 22px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.92); font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: opacity .35s ease, background .15s ease, border-color .15s ease;
}
.cr-gen-cancel:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.5); }
.cr-gen-cancel:active { transform: scale(.97); }

/* 顶部文本工具栏 —— 以节点标题（.cr-node-label）为基准定位 */
/* 标题在节点本地坐标中 top:-28px；工具栏自身高约42px */
/* 固定间距（视觉像素）：工具栏底部距标题顶部 = --node-title-toolbar-gap (8px) */
/* 水平居中对齐节点，垂直 top 除以 cr-scale 抵消画布缩放，使视觉间距恒定 */
.cr-node-text-toolbar {
  position: absolute;
  top: calc(-28px - (42px + var(--node-title-toolbar-gap, 8px)) / var(--cr-scale, 1));
  left: 50%;
  transform: translateX(-50%) scale(calc(1 / var(--cr-scale, 1)));
  transform-origin: top center;
  display: inline-flex; align-items: center; gap: 3px; padding: 5px 8px;
  border-radius: 999px; background: var(--modal-bg); border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.14), 0 1px 3px rgba(0,0,0,0.06);
  z-index: 80; /* 与提示词输入面板完全同级（面板也是 z-index: 80） */
}
/* 工具栏显隐与提示词输入面板一致：由 JS hidden 控制（showBothNodePanels / hideTextNodePanels） */
.cr-node-text-toolbar[hidden] { display: none; }
.cr-node-text-toolbar button {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,0.7); font-size: 12px; font-weight: 700; cursor: pointer;
}
.cr-node-text-toolbar button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.cr-node-text-toolbar .sep { width: 1px; height: 18px; background: rgba(255,255,255,0.12); margin: 0 2px; }
.cr-node-text-toolbar sub { font-size: 9px; opacity: .7; }
/* 工具栏 SVG 图标尺寸（斜体/自动排版/复制/插入表格等线性图标） */
.cr-node-text-toolbar button svg, .cr-tf-toolbar button svg { width: 16px; height: 16px; display: block; }
.cr-node-text-toolbar button { display: inline-flex; align-items: center; justify-content: center; }

/* 表格网格选择层 —— 插入表格时 hover 选行列 */
.cr-table-picker {
  position: fixed; z-index: 99999; width: 232px; padding: 12px;
  background: #1b1b1f; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.55);
}
.cr-table-picker-grid {
  display: grid; grid-template-columns: repeat(var(--cols, 8), 1fr); gap: 4px;
}
.cr-table-picker-cell {
  aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,0.06);
  cursor: pointer; transition: background .08s ease;
}
.cr-table-picker-cell.on { background: #6c8cff; }
.cr-table-picker-label {
  margin-top: 10px; text-align: center; font-size: 12px; color: rgba(255,255,255,0.72);
}

/* 工具栏反向缩放：不随画布缩放而变小，保持固定像素大小（与上方定位规则保持一致） */
.cr-node-text-toolbar {
  transform: translateX(-50%) scale(calc(1 / var(--cr-scale, 1)));
  transform-origin: top center;
}

/* 全屏文本编辑器 */
.cr-text-fullscreen-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity .2s ease;
}
.cr-text-fullscreen-modal.visible { pointer-events: auto; opacity: 1; }
.cr-text-fullscreen-modal[hidden] { display: none !important; }
.cr-tf-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.72);
}
.cr-tf-card {
  position: relative; width: 80vw; max-width: 960px; height: 78vh;
  display: flex; flex-direction: column;
  border-radius: 16px; background: var(--modal-bg); border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  overflow: hidden;
}
.cr-tf-header {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06); background: #141414;
  flex-shrink: 0;
}
.cr-tf-title { color: rgba(255,255,255,.55); font-size: 12px; white-space: nowrap; }
.cr-tf-toolbar {
  display: inline-flex; align-items: center; gap: 3px; margin-left: auto;
}
.cr-tf-toolbar button {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,.7); font-size: 12px; font-weight: 700; cursor: pointer;
}
.cr-tf-toolbar button:hover { background: rgba(255,255,255,.1); color: #fff; }
.cr-tf-toolbar .sep { width: 1px; height: 18px; background: rgba(255,255,255,.12); margin: 0 2px; }
.cr-tf-close {
  width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,.5); font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.cr-tf-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.cr-tf-body {
  flex: 1; padding: 20px 28px; overflow-y: auto;
  color: rgba(255,255,255,.88); font-size: 15px; line-height: 1.75;
  outline: none; min-height: 200px;
}
.cr-tf-body:empty::before { content: '开始输入…'; color: rgba(255,255,255,.25); }
.cr-tf-footer {
  padding: 6px 18px; text-align: center; border-top: 1px solid rgba(255,255,255,.04);
  flex-shrink: 0;
}
.cr-tf-hint { color: rgba(255,255,255,.22); font-size: 11px; }

/* 统一 AI 输入框（节点 prompt + 智能体共用） */
.cr-ai-input-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px; border-radius: 24px;
  background: var(--modal-bg); border: 1px solid var(--modal-border);
  box-shadow: 0 20px 54px rgba(0,0,0,0.45);
}
.cr-ai-input-header { display: flex; align-items: center; }
.cr-ai-input-main {
  display: flex; align-items: flex-start; gap: 10px; position: relative;
}
/* 图片节点输入框：参考图画廊 + textarea 纵向排列（画廊在上，textarea 在下） */
.cr-ai-input-box[data-ai-input-type="image"] .cr-ai-input-main {
  flex-direction: column; width: 100%;
}
/* 浮动面板内 main 容器：上下排列（参考画廊在上、提示词输入框在下），撑满宽度 */
.cr-node-prompt-panel .cr-ai-input-main {
  flex-direction: column; width: 100%;
}
/* 浮动面板输入框：左右等距 */
.cr-node-prompt-panel .cr-ai-input-box {
  padding-left: 12px; padding-right: 12px;
}
/* 浮动面板参考画廊：占满宽度、允许换行（参考项横向排、整体在输入框上方） */
.cr-node-prompt-panel .cr-image-ref-gallery {
  width: 100%; flex-wrap: wrap; padding-left: 0; padding-right: 0;
}
/* 所有节点浮动面板 输入区（contenteditable）；Prompt Pro 组件面板除外（由组件控制填充/滚动） */
.cr-node-prompt-panel .cr-ai-input-textarea:not(.ui-pp-textarea) {
  width: 100% !important; flex: 0 1 auto !important; min-height: 60px !important; overflow: hidden;
}
/* 图片节点 expand 按钮：定位到右上角（与文本节点一致） */
.cr-ai-input-box[data-ai-input-type="image"] .cr-ai-input-expand {
  position: absolute; right: 0; top: 0; bottom: auto;
}
.cr-ai-input-upload {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  border: 1px dashed rgba(255,255,255,0.18); background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6); display: grid; place-items: center; cursor: pointer;
  transition: all .18s ease;
}
.cr-ai-input-upload:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); color: #fff; }
.cr-ai-input-upload svg { width: 15px; height: 15px; }
.cr-ai-input-textarea {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: rgba(255,255,255,0.88); font-size: 14px; line-height: 1.55; font-family: inherit;
  min-height: 156px; padding-top: 6px; padding-right: 32px; padding-bottom: 4px;
  white-space: pre-wrap; word-break: break-word; overflow-y: auto; cursor: text;
}
.cr-ai-input-textarea:empty::before {
  content: attr(data-placeholder); color: rgba(255,255,255,0.32); pointer-events: none;
}
.cr-ai-input-textarea[contenteditable] { white-space: pre-wrap; word-break: break-word; }
/* 内联 mention chip：绿色小图标 + @引用词（单流排版，永不错位） */
.cr-mention-chip {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
  padding: 0 5px; margin: 0 1px;
  background: rgba(74,222,128,0.16); border: 1px solid rgba(74,222,128,0.4);
  border-radius: 6px; color: rgba(74,222,128,0.98); font-size: 13px; line-height: 1.5;
  cursor: default; user-select: none; outline: none;
}
.cr-mention-chip:hover { background: rgba(74,222,128,0.26); border-color: rgba(74,222,128,0.7); }
.cr-mention-mini { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: rgba(0,0,0,0.35); }
.cr-mention-mini-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; font-size: 12px; color: rgba(74,222,128,0.85); background: rgba(74,222,128,0.22); border-radius: 4px; }
.cr-mention-chip[draggable] { cursor: grab; }
.cr-mention-chip[draggable]:active { cursor: grabbing; }
.cr-mention-dragging { opacity: 0.5; }
/* ===== 提示词输入框 @引用参考 ===== */
.cr-ai-input-editor { position: relative; flex: 1; min-width: 0; width: 100%; }
.cr-ai-input-editor .cr-ai-input-textarea {
  width: 100%; display: block; box-sizing: border-box;
  color: rgba(255,255,255,0.88);
}
/* @ 已连接素材下拉列表 */
.cr-mention-menu {
  position: fixed; z-index: 9500; display: none; min-width: 210px; max-width: 260px; max-height: 240px;
  overflow-y: auto; padding: 5px; box-sizing: border-box;
  background: rgba(28,28,30,0.90); border: 1px solid var(--modal-border);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.cr-mention-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px;
  cursor: pointer; transition: background .12s;
}
.cr-mention-menu-item:hover, .cr-mention-menu-item.active { background: rgba(148,163,184,0.18); }
.cr-mention-menu-mini { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; background: rgba(0,0,0,0.35); flex-shrink: 0; }
.cr-mention-menu-item i.mi-t, .cr-mention-menu-item i.mi-v, .cr-mention-menu-item i.mi-a, .cr-mention-menu-item i.mi-i {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: inline-grid; place-items: center; font-style: normal;
  color: rgba(203,213,225,0.85); background: rgba(148,163,184,0.22); font-size: 13px;
}
.cr-mention-menu-item i.mi-t::before { content: '¶'; }
.cr-mention-menu-item i.mi-v::before { content: '▷'; }
.cr-mention-menu-item i.mi-a::before { content: '♪'; }
.cr-mention-menu-item i.mi-i::before { content: '▧'; }
.cr-mention-menu-txt { flex: 0 0 auto; color: rgba(255,255,255,0.95); font-size: 13px; font-weight: 600; }
.cr-mention-menu-name { flex: 1; min-width: 0; color: rgba(255,255,255,0.5); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
/* 菜单分组标题 */
.cr-mention-menu-title {
  padding: 6px 8px 2px; font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.35); letter-spacing: 0.06em;
}
/* 素材库文件夹项 */
.cr-mention-folder-item { color: rgba(255,255,255,0.65); }
.cr-mention-folder-item .cr-mention-menu-txt { font-weight: 500; }
.cr-mention-folder-icon { flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center; opacity: 0.65; }
.cr-mention-folder-svg { width: 18px; height: 18px; }
/* 放大弹窗(.cr-prompt-modal)内 textarea 同为透明 + 镜像层对齐 */
.cr-prompt-modal .cr-mention-layer { font-size: 15px; line-height: 1.55; }
.cr-ai-input-expand {
  position: absolute; right: 0; top: 0; width: 28px; height: 28px; border-radius: 8px;
  border: none; background: transparent; color: rgba(255,255,255,0.35);
  display: grid; place-items: center; cursor: pointer; transition: all .18s ease;
}
.cr-ai-input-expand:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75); }
.cr-ai-input-expand svg { width: 14px; height: 14px; }
.cr-ai-input-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.cr-ai-input-params {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cr-ai-input-model-params {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* ===== 自定义下拉选择器（替代原生 select，暗色主题 + 图标） ===== */
.cr-custom-select {
  position: relative; display: inline-block; font-size: 12px; user-select: none;
  vertical-align: middle; max-width: 160px; min-width: 90px;
}
.cr-cs-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  width: 100%; padding: 5px 22px 5px 9px;
  border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.72);
  cursor: pointer; outline: none; text-align: left;
  transition: border-color .18s ease, background .18s ease;
  box-sizing: border-box; line-height: 1.3;
}
.cr-cs-trigger:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.18); }
.cr-custom-select.cs-open > .cr-cs-trigger {
  border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.06);
}
.cr-cs-trig-icon {
  flex-shrink: 0; width: 15px; height: 15px; display: grid; place-items: center;
  color: rgba(255,255,255,0.55); transition: color .18s ease;
}
.cr-cs-trig-icon svg { width: 100%; height: 100%; overflow: visible; }
.cr-cs-trig-label {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; font-size: inherit;
}
.cr-cs-arrow {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; color: rgba(255,255,255,0.35); pointer-events: none;
  transition: transform .2s ease, color .2s ease;
}
.cr-custom-select.cs-open > .cr-cs-trigger .cr-cs-arrow {
  transform: translateY(-50%) rotate(180deg); color: rgba(74,222,128,0.7);
}

/* 提示词工具按钮运行中：图标切换为 Progress 旋转指示（翻译 / 优化提示词） */
.cr-ai-input-optimize.cr-running, .ui-pp-tool[data-pp-translate].cr-running { pointer-events: none; opacity: .8; }
.cr-spin {
  display: inline-block; width: 13px; height: 13px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.22); border-top-color: var(--neon, #22d3ee);
  border-radius: 50%; animation: cr-spin .8s linear infinite; vertical-align: -2px;
}
html[data-theme="light"] .cr-spin { border-color: rgba(0,0,0,0.15); border-top-color: #0d9488; }
@keyframes cr-spin { to { transform: rotate(360deg); } }

/* 下拉面板 */
.cr-cs-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 200;
  min-width: 100%; width: max-content; max-width: 280px;
  padding: 4px; border-radius: 12px;
  background: rgba(28,28,30,0.90); border: 1px solid var(--modal-border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 1px rgba(255,255,255,0.06) inset;
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  opacity: 0;
  /* 纯动画 transform，无缩放干扰（父元素 .cr-custom-select 已无 scale） */
  transform: translateY(-6px) scale(0.97);
  pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
/* 自动避边：靠近视口底部时翻转到上方 */
.cr-cs-dropdown.cs-above { top: auto; bottom: calc(100% + 4px); transform: translateY(6px) scale(0.97); }
.cr-cs-dropdown:not([hidden]) { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
  overflow-y: auto; max-height: 260px;
  overscroll-behavior: contain;
}
.cr-cs-dropdown:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 下拉选项：行间距加大，视觉更舒展 */
.cr-cs-option {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.72); font-size: 12px; cursor: pointer;
  transition: background .12s ease, color .12s ease;
  white-space: nowrap; line-height: 1.3;
}
.cr-cs-option:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.95); }
.cr-cs-option.cr-cs-selected {
  background: rgba(74,222,128,0.12); color: #4ade80;
}
.cr-cs-option.cr-cs-selected:hover { background: rgba(74,222,128,0.18); }

/* 选项图标 */
.cr-cs-opt-icon {
  flex-shrink: 0; width: 15px; height: 15px; display: grid; place-items: center;
  color: rgba(255,255,255,0.45); transition: color .15s ease;
}
.cr-cs-opt-icon svg { width: 100%; height: 100%; overflow: visible; }
.cr-cs-option:hover .cr-cs-opt-icon { color: rgba(255,255,255,0.7); }
.cr-cs-option.cr-cs-selected .cr-cs-opt-icon { color: #4ade80; }

/* 选项文字 */
.cr-cs-opt-label {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-size: inherit; color: inherit;
}

/* 平台/模型选择器保持固定像素大小：
   · 节点 prompt 面板（.cr-node-prompt-panel）已整体反向缩放，内部选择器无需再缩；
   · 智能体输入框位于画布层外，本身就不随画布缩放；
   · 因此 .cr-cs-trigger 不再使用 --cr-scale 反向缩放。 */
.cr-cs-dropdown { transform-origin: top center; }

/* 移动端适配 */
@media (max-width: 600px) {
  .cr-custom-select { max-width: 130px; min-width: 70px; }
  .cr-cs-dropdown { max-width: 240px; max-height: 200px; }
  .cr-cs-option { padding: 6px 8px; gap: 5px; font-size: 11px; }
  .cr-cs-opt-icon { width: 13px; height: 13px; }
}

/* 隐藏旧的原生 select（保留作为降级） */
.cr-ai-input-select { display: none !important; }
.cr-ai-input-type-tag {
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75); font-size: 12px; font-weight: 600;
}
.cr-ai-input-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* FF 智能体：回答风格选择（简洁/标准/详细）——原生下拉，单独显示 */
.cr-agent-style-select {
  display: inline-block !important;
  height: 26px; padding: 0 6px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08); color: var(--text, #e5e7eb);
  font-size: 11.5px; cursor: pointer; outline: none; flex-shrink: 0;
}
.cr-agent-style-select option { background: #1c1c1c; color: #e5e7eb; }
html[data-theme="light"] .cr-agent-style-select { background: #fff; color: #111827; border-color: #cbd5e1; }
html[data-theme="light"] .cr-agent-style-select option { background: #fff; color: #111827; }

.cr-ai-input-optimize {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
  color: rgba(255,255,255,0.5); display: grid; place-items: center; cursor: pointer;
  transition: all .18s ease;
}
.cr-ai-input-optimize:hover { background: rgba(255,255,255,0.08); color: #fbbf24; }
.cr-ai-input-optimize:disabled,
.cr-node.generating .cr-ai-input-optimize {
  opacity: .4 !important; cursor: not-allowed !important; color: rgba(255,255,255,.28) !important;
}
html[data-theme="light"] .cr-ai-input-optimize:disabled,
html[data-theme="light"] .cr-node.generating .cr-ai-input-optimize {
  color: rgba(0,0,0,.38) !important; /* 浅色主题禁用态用深灰，避免白图标在白色面板上不可见 */
}
.cr-ai-input-optimize:disabled:hover,
.cr-node.generating .cr-ai-input-optimize:hover { background: transparent !important; }
.cr-ai-input-optimize svg { width: 15px; height: 15px; }
.cr-ai-input-submit {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--neon); color: #07120a; display: grid; place-items: center;
  cursor: pointer; transition: all .18s ease;
}
.cr-ai-input-submit:hover { filter: brightness(1.08); transform: scale(1.04); }
.cr-ai-input-submit svg { width: 16px; height: 16px; }
.cr-ai-input-submit:disabled,
.cr-node.generating .cr-ai-input-submit {
  opacity: 1 !important; cursor: not-allowed !important; transform: none !important;
  background: #adadad !important; /* 生成中/禁用态：灰色圆底，图标保持可见 */
  box-shadow: none !important;
  color: #ffffff !important;
}
.cr-ai-input-submit:disabled:hover,
.cr-node.generating .cr-ai-input-submit:hover {
  filter: none !important; transform: none !important;
  background: #adadad !important; box-shadow: none !important;
}
/* 生成中/禁用态：彻底关闭 .btn-neon::before 的绿色渐变（悬停也不显示，避免“灰色/绿色底”） */
.cr-ai-input-submit:disabled::before,
.cr-ai-input-submit:disabled:hover::before,
.cr-node.generating .cr-ai-input-submit::before,
.cr-node.generating .cr-ai-input-submit:hover::before,
.cr-node.generating .cr-ai-input-submit:active::before {
  opacity: 0 !important; animation: none !important;
}

/* 提示词放大弹窗 */
.cr-prompt-modal {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: safe center; justify-content: center;
  overflow-y: auto; padding: 24px; opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.cr-prompt-modal[hidden] { display: none; }
.cr-prompt-modal.visible { opacity: 1; pointer-events: auto; }
.cr-prompt-modal .cr-pm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(6px); }
.cr-prompt-modal .cr-pm-card {
  position: relative; width: 760px; max-width: calc(100vw - 48px);
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px 22px 22px; border-radius: 24px;
  background: #1a1a1a; border: 1px solid var(--border);
  box-shadow: 0 28px 80px rgba(0,0,0,0.65);
}
.cr-prompt-modal .cr-pm-body {
  flex: 0 1 auto;
}
/* 放大弹窗内容与浮动面板保持一致：参考画廊在上、提示词输入框在下（上下排列） */
.cr-prompt-modal .cr-ai-input-main {
  flex-direction: column; width: 100%; align-items: stretch;
}
.cr-prompt-modal .cr-image-ref-gallery {
  width: 100%; flex-wrap: wrap;
}
.cr-prompt-modal .cr-ai-input-textarea {
  width: 100% !important; flex: 0 1 auto !important;
}
.cr-prompt-modal .cr-pm-header { display: flex; align-items: center; justify-content: space-between; }
.cr-prompt-modal .cr-pm-title { font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.85); }
.cr-prompt-modal .cr-pm-close {
  width: 32px; height: 32px; border-radius: 10px; border: none; background: transparent;
  color: rgba(255,255,255,0.5); display: grid; place-items: center; cursor: pointer;
}
.cr-prompt-modal .cr-pm-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cr-prompt-modal .cr-pm-close svg { width: 16px; height: 16px; }
/* 弹窗内 textarea：与浮动面板一致 + 自动扩高（JS 控制上限：大窗口至多 620px，小窗口按 80vh 收敛） */
.cr-prompt-modal .cr-ai-input-textarea,
.cr-prompt-modal .cr-ai-input-box[data-ai-input-type="image"] .cr-ai-input-textarea {
  min-height: 180px !important;
  overflow-y: hidden;
}
/* 弹窗内 input-box 与卡片背景一致 */
.cr-prompt-modal .cr-ai-input-box {
  background: #1a1a1a; border: none; box-shadow: none; width: 100%;
}
.cr-prompt-modal .cr-ai-input-main { width: 100%; }
.cr-prompt-modal .cr-ai-input-textarea { width: 100% !important; flex: 0 1 auto !important; }
/* 弹窗参考图画廊左对齐，与输入框左边齐平 */
.cr-prompt-modal .cr-image-ref-gallery { padding-left: 0; padding-right: 0; }
.cr-prompt-modal .cr-ai-input-textarea::placeholder { color: rgba(255,255,255,0.32); }
.cr-prompt-modal .cr-pm-footer { display: flex; justify-content: flex-end; gap: 10px; }
.cr-prompt-modal .cr-pm-cancel {
  padding: 8px 18px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12);
  background: transparent; color: rgba(255,255,255,0.7); font-size: 13px; cursor: pointer;
}
.cr-prompt-modal .cr-pm-cancel:hover { background: rgba(255,255,255,0.06); }
.cr-prompt-modal .cr-pm-submit {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 10px;
  border: none; background: var(--neon); color: #07120a; font-size: 13px; font-weight: 700; cursor: pointer;
}
.cr-prompt-modal .cr-pm-submit svg { width: 14px; height: 14px; }

/* 底部提示词输入面板 */
/* 固定间距（视觉像素）：卡片底部距输入框顶部 = --node-panel-gap (25px) */
/* 100% 是父元素（.cr-node）未缩放高度；画布缩放后节点视觉高度 = 100% * cr-scale， */
/* 所以只需把“间距”除以 cr-scale 抵消，100% 本身不需要除。 */
.cr-node-prompt-panel {
  position: absolute;
  top: calc(100% + var(--node-panel-gap, 25px) / var(--cr-scale, 1));
  left: 50%;
  transform: translateX(-50%) scale(calc(1 / var(--cr-scale, 1))) translateZ(0);
  transform-origin: top center;
  width: 786px; max-width: calc(100vw - 40px);
  min-height: 260px;
  z-index: 80;
  will-change: transform;
  backface-visibility: hidden;
}
.cr-node-prompt-panel[hidden] { display: none; }
/* 视频节点提示词输入 950px（参数更多），其余节点 750px */
.cr-node.cr-video-node .cr-node-prompt-panel { width: 986px; }

/* 分组 */
.cr-group {
  position: absolute; border-radius: 18px;
  background: rgba(32,34,40,0.42);
  border: 1px solid #313131;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.22);
  z-index: 1; pointer-events: auto; cursor: grab; user-select: none;
}
.cr-group:active { cursor: grabbing; }
.cr-group.active { border-color: var(--group-color, #22d3ee); box-shadow: inset 0 0 40px rgba(0,0,0,0.22), 0 0 0 1px var(--group-color, #22d3ee); }
/* 拖动节点悬停在分组上（等待 2 秒自动加入）的高亮反馈 */
.cr-group.cr-drop-target {
  box-shadow: inset 0 0 40px rgba(0,0,0,0.22), 0 0 0 3px rgba(74,222,128,0.85), 0 0 24px rgba(74,222,128,0.35);
}
/* 设置了组颜色的组：边框显示组颜色 + 底纹（背景）也带同色淡染（暗色主题） */
.cr-group[data-has-color="1"]:not(.active) { border-color: var(--group-color); }
.cr-group[data-has-color="1"] {
  background: color-mix(in srgb, var(--group-color) 8%, rgba(32,34,40,0.42));
}
/* 暗色主题：选中组的边框固定为 #8f8f8f */
html:not([data-theme="light"]) .cr-group.active {
  border-color: #8f8f8f !important;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.22), 0 0 0 1px #8f8f8f;
}
html[data-theme="light"] .cr-group { background: rgba(255,255,255,0.25); border-color: #313131; }
html[data-theme="light"] .cr-group.active { border-color: var(--group-color, #0d9488); }
/* 浅色主题：设置了组颜色的组，未选中时同样显示该颜色，底纹用浅色淡染 */
html[data-theme="light"] .cr-group[data-has-color="1"]:not(.active) { border-color: var(--group-color); }
html[data-theme="light"] .cr-group[data-has-color="1"] {
  background: color-mix(in srgb, var(--group-color) 9%, rgba(255,255,255,0.28));
}
.cr-group-header {
  position: absolute; top: -36px; left: 18px; padding: 8px 22px; border-radius: 999px;
  background: rgba(18,18,22,0.92); border: 1px solid var(--group-color, #313131);
  color: #f8fafc; font-size: 26px; font-weight: 800; pointer-events: auto; /* 标题固定亮色 */
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  cursor: grab; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  /* 标题骑在组边框上：一半在上、一半在下，压在边框线中间 */
  z-index: 4;
}
html[data-theme="light"] .cr-group-header { background: rgba(255,255,255,0.92); color: #111827; text-shadow: none; }
.cr-group-resize {
  position: absolute; right: -7px; bottom: -7px; width: 15px; height: 15px; border-radius: 50%;
  background: #3b82f6; border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35); cursor: nwse-resize; z-index: 3;
  display: none;
}
.cr-group.active .cr-group-resize { display: block; }

/* 组悬浮工具栏（参考图：胶囊深色工具条，悬浮在组上方） */
.cr-group-toolbar {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 2px; padding: 5px 8px;
  border-radius: 999px; z-index: 300;
  background: rgba(20,21,26,0.92); border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.2);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  font-size: 12.5px; color: var(--text); white-space: nowrap;
}
html[data-theme="light"] .cr-group-toolbar {
  background: rgba(255,255,255,0.88);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 6px 20px rgba(15,23,42,0.12);
}
.cr-group-toolbar[hidden] { display: none; }
.cr-group-toolbar .cgt-act {
  height: 30px; padding: 0 11px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,0.78); font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .12s ease, color .12s ease;
}
.cr-group-toolbar .cgt-act:hover { background: rgba(255,255,255,0.12); color: #fff; }
.cr-group-toolbar .cgt-run { color: #4ade80; font-weight: 700; }
.cr-group-toolbar .cgt-run:hover { background: rgba(74,222,128,0.14); color: #4ade80; }
.cr-group-toolbar .cgt-danger { color: #f87171; }
.cr-group-toolbar .cgt-danger:hover { background: rgba(248,113,113,0.14); color: #f87171; }
/* 布局按钮下拉箭头/整组执行 ▶ 图标放大，提升点击辨识度（工具栏布局保持不变） */
.cr-group-toolbar .cgt-arrow { font-size: 15px; margin-left: 4px; line-height: 1; }
.cr-group-toolbar .cgt-run { font-size: 14px; letter-spacing: .02em; }
.cr-group-toolbar .cgt-act { font-size: 13px; }
.cr-group-toolbar .cgt-color { padding: 0 9px; }
.cr-group-toolbar .cgt-color-dot {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  background: var(--group-color, #313131); border: 2px solid rgba(255,255,255,0.85);
}
html[data-theme="light"] .cr-group-toolbar .cgt-act { color: #374151; }
html[data-theme="light"] .cr-group-toolbar .cgt-act:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-group-toolbar .cgt-run { color: #16a34a; }
html[data-theme="light"] .cr-group-toolbar .cgt-danger { color: #dc2626; }
.cr-group-toolbar .cgt-sep { width: 1px; height: 18px; background: rgba(255,255,255,0.12); margin: 0 3px; }
html[data-theme="light"] .cr-group-toolbar .cgt-sep { background: rgba(0,0,0,0.10); }
.cr-group-toolbar .cgt-arrow { font-size: 15px; opacity: .85; margin-left: 4px; line-height: 1; }
.cr-group-toolbar .cgt-wrap { position: relative; }
.cr-group-toolbar .cgt-menu {
  position: absolute; left: 0; top: calc(100% + 6px); min-width: 130px; padding: 6px;
  border-radius: 12px; z-index: 9999;
  background: rgba(28,28,30,0.90); border: 1px solid var(--modal-border);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
html[data-theme="light"] .cr-group-toolbar .cgt-menu { background: rgba(255,255,255,0.86); border-color: rgba(0,0,0,0.12); }
.cr-group-toolbar .cgt-menu[hidden] { display: none; }
.cr-group-toolbar .cgt-menu .cm-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 9px; border: none; background: transparent;
  font-size: 13.5px; color: var(--text-dim); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cr-group-toolbar .cgt-menu .cm-item:hover { background: var(--surface-hover); color: var(--text); }
html[data-theme="light"] .cr-group-toolbar .cgt-menu .cm-item { color: #1f2937; }
html[data-theme="light"] .cr-group-toolbar .cgt-menu .cm-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
.cr-group-toolbar .cgt-color-menu {
  width: 166px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px;
}
.cr-group-toolbar .cgt-color-menu[hidden] { display: none; }
.cgt-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(255,255,255,0.25);
  transition: transform .1s ease;
}
.cgt-swatch:hover { transform: scale(1.15); }

/* ---- 底部工具条 ---- */
.cr-bottom-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px;
  background: rgba(14,14,18,0.92);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55); backdrop-filter: blur(14px);
  z-index: 100; font-size: 13px; color: var(--text); user-select: none;
}
.cr-bottom-bar[hidden] { display: none; }
.cr-bb-left, .cr-bb-zoom, .cr-bb-right { display: flex; align-items: center; gap: 6px; }
.cr-bb-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 2px; }
.cr-bb-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--text-dim); display: grid; place-items: center; cursor: pointer; transition: all .18s ease;
}
.cr-bb-btn svg { width: 16px; height: 16px; }
.cr-bb-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-bb-btn.active { color: var(--neon-bright); background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.25); }
.cr-bb-zoom-value { min-width: 44px; text-align: center; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cr-bb-zoom input[type="range"] { width: 96px; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,0.12); border-radius: 2px; outline: none; cursor: pointer; }
.cr-bb-zoom input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--neon-bright); box-shadow: 0 0 8px rgba(74,222,128,0.45); }
.cr-bb-zoom input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--neon-bright); border: none; box-shadow: 0 0 8px rgba(74,222,128,0.45); }
body.cr-dragging .cr-bottom-bar { pointer-events: none; opacity: .35; }

/* ---- 进入画布编辑后的「返回浏览」按钮 ---- */
.cr-back-browse {
  position: absolute; top: 14px; left: 14px; z-index: 100;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 10px;
  background: rgba(14,14,18,0.9); backdrop-filter: blur(10px);
  border: 1px solid rgba(74,222,128,0.25); color: var(--text);
  font-size: 12px; font-weight: 700; cursor: pointer; user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45); transition: all .15s ease;
}
.cr-back-browse:hover { border-color: rgba(74,222,128,0.55); color: var(--neon-bright); background: rgba(20,22,26,0.95); }
.cr-back-browse[hidden] { display: none; }

#view-canvas .cr-topbar { display: none; }/* ---- 项目管理页排序下拉：复用项目统一 base-select（ui.select） ---- */
.cr-level-tools .cr-level-sort-select { width: 118px; flex-shrink: 0; }
.cr-level-tools .cr-level-sort-select .ui-select-trigger {
  height: 30px; padding: 0 10px; gap: 6px; border-radius: 9px;
  font-size: 12px; color: var(--text, #e5e7eb);
  background: var(--surface, rgba(255,255,255,0.04)); border: 1px solid var(--border, rgba(255,255,255,0.10));
}
.cr-level-tools .cr-level-sort-select .ui-select-trigger svg { width: 13px; height: 13px; }
.cr-level-tools .cr-level-sort-select .ui-select-dropdown .ui-select-option { font-size: 12px; }

/* ---- 左侧画布工具条 ---- */
.cr-canvas-toolbox {
  position: absolute; top: 50%; left: 14px; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; border-radius: 999px;
  background: rgba(20,20,24,0.92); border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55); backdrop-filter: blur(14px);
  z-index: 100; user-select: none;
}
.cr-canvas-toolbox[hidden] { display: none; }
.cr-ctb-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid transparent; background: transparent;
  color: var(--text-dim); cursor: pointer;
  transition: all .18s ease;
}
.cr-ctb-btn svg { width: 18px; height: 18px; }
.cr-ctb-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-ctb-btn.ctb-add {
  background: linear-gradient(135deg, var(--neon-bright, #86efac), var(--neon, #4ade80) 55%, var(--neon, #4ade80));
  color: #06200e; border: none;
  box-shadow: 0 2px 10px rgba(74,222,128,0.35), inset 0 1px 0 rgba(255,255,255,0.40);
}
.cr-ctb-btn.ctb-add:hover {
  background: linear-gradient(135deg, var(--neon-bright, #86efac), var(--neon, #4ade80) 55%, var(--neon, #4ade80));
  filter: brightness(1.06); transform: scale(1.05);
}
.cr-ctb-btn.ctb-add.active {
  filter: brightness(1.06);
  box-shadow: 0 0 0 2px rgba(74,222,128,0.45), 0 2px 10px rgba(74,222,128,0.35);
}

/* ---- 节点库侧边面板 ---- */
.cr-node-palette {
  position: absolute; top: 0; left: 0;
  max-height: calc(100% - 120px); width: 230px;
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  border-radius: 16px; background: rgba(22,22,26,0.98);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.65); backdrop-filter: blur(18px);
  z-index: 100; user-select: none;
}
.cr-node-palette[hidden] { display: none; }
.cr-np-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cr-np-title { font-size: 13px; font-weight: 800; color: var(--text); }
.cr-np-close {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
}
.cr-np-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-np-close svg { width: 14px; height: 14px; }
.cr-np-search {
  position: relative; display: flex; align-items: center;
}
.cr-np-search svg {
  position: absolute; left: 10px; width: 14px; height: 14px; color: var(--text-muted);
}
.cr-np-search input {
  width: 100%; height: 32px; padding: 0 10px 0 30px;
  border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.04); color: var(--text); font-size: 12px;
  outline: none;
}
.cr-np-search input::placeholder { color: var(--text-muted); }
.cr-np-search input:focus { border-color: rgba(74,222,128,0.35); background: rgba(255,255,255,0.06); }
.cr-np-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 10px; }
.cr-np-category { display: flex; flex-direction: column; gap: 4px; }
.cr-np-cat-title {
  display: flex; align-items: center; gap: 6px; padding: 4px 2px;
  font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.cr-np-cat-title::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--neon); }
.cr-np-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: rgba(255,255,255,0.03);
  transition: all .14s ease;
}
.cr-np-item:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); transform: translateX(2px); }
.cr-np-item-icon {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(255,255,255,0.08); color: var(--text-dim); flex-shrink: 0;
}
.cr-np-item-icon svg { width: 13px; height: 13px; }
.cr-np-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cr-np-item-name { font-size: 12px; font-weight: 700; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.cr-np-item:hover .cr-np-item-name { color: var(--text); }
.cr-np-item-desc { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-np-badge { font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: rgba(168,85,247,0.18); color: #c084fc; border: 1px solid rgba(168,85,247,0.35); }

/* 多选工具栏：与节点上方工具栏同款胶囊风格 */
.cr-select-bar {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px;
  border-radius: 999px;
  background: rgba(14,14,18,0.92); border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.10);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  z-index: 300; font-size: 12.5px; color: var(--text); white-space: nowrap;
}
html[data-theme="light"] .cr-select-bar {
  background: rgba(255,255,255,0.88);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 4px 14px rgba(15,23,42,0.10), 0 1px 2px rgba(15,23,42,0.06);
}
.cr-select-bar[hidden] { display: none; }
.cr-select-bar .csb-count { color: var(--text-muted); font-size: 11.5px; padding: 0 4px; }
.cr-select-bar .csb-act,
.cr-select-bar .csb-group {
  height: 30px; padding: 0 12px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,0.78); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cr-select-bar .csb-act:hover { background: rgba(255,255,255,0.12); color: #fff; }
.cr-select-bar .csb-group { color: #c4ff4d; font-weight: 700; }
.cr-select-bar .csb-group:hover { background: rgba(196,255,77,0.14); color: #c4ff4d; }
html[data-theme="light"] .cr-select-bar .csb-act,
html[data-theme="light"] .cr-select-bar .csb-group { color: #374151; }
html[data-theme="light"] .cr-select-bar .csb-act:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-select-bar .csb-group { color: #15803d; }
html[data-theme="light"] .cr-select-bar .csb-group:hover { background: rgba(22,163,74,0.10); color: #15803d; }
.cr-select-bar .csb-layout-wrap { position: relative; }
.cr-select-bar .csb-layout-arrow { font-size: 10px; opacity: .7; margin-left: 2px; }
.cr-layout-menu {
  position: absolute; left: 0; top: calc(100% + 6px); min-width: 130px; padding: 6px;
  border-radius: 12px; z-index: 9999;
  background: rgba(28,28,30,0.90); border: 1px solid var(--modal-border);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
html[data-theme="light"] .cr-layout-menu {
  background: rgba(255,255,255,0.86);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 14px 36px rgba(15,23,42,0.14);
}
.cr-layout-menu[hidden] { display: none; }
.cr-layout-menu .cm-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 9px; border: none; background: transparent;
  font-size: 13.5px; color: var(--text-dim); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cr-layout-menu .cm-item:hover { background: var(--surface-hover); color: var(--text); }
html[data-theme="light"] .cr-layout-menu .cm-item { color: #1f2937; }
html[data-theme="light"] .cr-layout-menu .cm-item:hover { background: rgba(0,0,0,0.05); color: #111827; }

/* 选区外框（多选时围绕选中节点） */
.cr-selection-box {
  position: absolute; pointer-events: none; z-index: 55;
  border: 1.5px dashed rgba(74,222,128,0.85);
  background: rgba(74,222,128,0.06);
  border-radius: 6px;
}
.cr-selection-box[hidden] { display: none; }

/* 对齐吸附线：浅灰虚线，透明度 0.6，拖拽结束自动消失 */
.cr-align-guides { position: absolute; inset: 0; pointer-events: none; z-index: 58; overflow: visible; }
.cr-align-guide-v, .cr-align-guide-h {
  stroke: rgba(190,195,204,0.75); stroke-width: 1; stroke-dasharray: 5 4; opacity: 0.6;
}
.cr-align-guide-v.hit, .cr-align-guide-h.hit { stroke: rgba(190,195,204,0.9); opacity: 0.6; }

.cr-node-rename-input {
  box-sizing: border-box;
  border: 1px solid var(--neon, #22d3ee);
  border-radius: 6px;
  padding: 2px 6px;
  font: 600 13px/1.4 inherit;
  color: #111827;
  background: #fff;
  outline: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
html[data-theme="light"] .cr-node-rename-input {
  border-color: #0d9488;
  box-shadow: 0 4px 16px rgba(13,148,136,0.20);
}

/* ---- 右键菜单 ---- */
.cr-context-menu {
  position: fixed; display: none; min-width: 172px; max-width: 240px; padding: 6px;
  z-index: 1000; /* 层级处理：防止被其他浮层遮挡 */ border-radius: 14px;
  background: rgba(28,28,30,0.90);
  border: 1px solid var(--modal-border);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
.cr-context-menu.visible { display: block; animation: fadeIn .12s ease; }
.cr-context-menu .cm-group-title {
  padding: 8px 14px 5px; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  color: var(--text-muted); text-transform: uppercase;
}
.cr-context-menu .cm-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 9px; border: none; background: transparent;
  font-size: 13.5px; color: var(--text-dim); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cr-context-menu .cm-item:hover { background: var(--surface-hover); color: var(--text); }
.cr-context-menu .cm-item:active { transform: scale(0.98); }
.cr-context-menu .cm-item svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.cr-context-menu .cm-item:hover svg { color: var(--text); }
.cr-context-menu .cm-item .cm-label { flex: 1; }
.cr-context-menu .cm-item .cm-shortcut { margin-left: auto; font-size: 11.5px; color: var(--text-muted); letter-spacing: .02em; }
.cr-context-menu .cm-item .cm-arrow { margin-left: auto; width: 14px; height: 14px; color: var(--text-muted); }
/* 禁用项（如无可撤销/重做）：整体置灰，不可点、无悬停 */
.cr-context-menu .cm-item.disabled { opacity: .45; cursor: default; pointer-events: none; }
.cr-context-menu .cm-item.disabled:hover { background: transparent; color: var(--text-dim); }
.cr-context-menu .cm-item .cm-badge {
  margin-left: 6px; padding: 1px 6px; border-radius: 5px;
  background: var(--neon-dim); border: 1px solid var(--neon-glow);
  color: var(--neon-bright); font-size: 10px; font-weight: 700;
}
.cr-context-menu .cm-item.danger { color: var(--danger); }
.cr-context-menu .cm-item.danger svg { color: var(--danger); }
.cr-context-menu .cm-item.danger:hover { background: rgba(239,68,68,0.12); color: var(--danger); }
.cr-context-menu .cm-sep { height: 1px; background: var(--border); margin: 5px 10px; }
html[data-theme="light"] .cr-context-menu { background: #ffffff; border-color: rgba(0,0,0,0.08); box-shadow: 0 18px 50px rgba(15,23,42,0.12), 0 2px 10px rgba(15,23,42,0.06); }
.cr-context-submenu { padding: 12px 10px; }
.cr-context-submenu .cm-group-title { color: rgba(255,255,255,0.3); }

/* ---- 右侧检视器 ---- */
.cr-inspector {
  width: var(--cr-inspector-w);
  min-width: 260px; max-width: 700px;
  flex-shrink: 0; background: rgba(12,13,17,0.6);
  display: flex; flex-direction: column; overflow-y: auto;
}
.cr-inspector[hidden] { display: none; }
.cr-inspector-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.cr-inspector-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.cr-insp-head { display: flex; align-items: center; gap: 10px; }
.cr-insp-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03)); border: 1px solid var(--border); }
.cr-insp-icon svg { width: 18px; height: 18px; }
.cr-insp-type { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.cr-insp-title-input { font-size: 15px; font-weight: 800; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; width: 100%; outline: none; }
.cr-insp-title-input:focus { border-color: var(--neon); background: rgba(74,222,128,0.06); }
.cr-insp-field { display: flex; flex-direction: column; gap: 6px; }
.cr-insp-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.cr-insp-textarea {
  width: 100%; min-height: 90px; resize: vertical; border-radius: 10px; padding: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; line-height: 1.55; font-family: inherit; outline: none;
}
.cr-insp-textarea:focus { border-color: var(--neon); }
.cr-insp-result { border-radius: 12px; padding: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cr-insp-result-imgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cr-insp-result-imgs img { width: 100%; border-radius: 8px; display: block; cursor: pointer; border: 1px solid var(--border); }
.cr-insp-result-text { font-size: 12px; line-height: 1.6; color: var(--text-dim); white-space: pre-wrap; max-height: 180px; overflow: auto; }
.cr-insp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-insp-del { color: #f87171; border-color: rgba(239,68,68,0.3); }
.cr-insp-del:hover { background: rgba(239,68,68,0.12); }

/* 新建项目 / 分类弹窗 */
.cr-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 300; animation: fadeIn .2s ease;
}
.cr-modal {
  width: 420px; max-width: calc(100vw - 40px); padding: 22px; border-radius: 16px;
  background: rgba(18,19,24,0.98); border: 1px solid rgba(74,222,128,0.2);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 16px;
}
.cr-modal h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--text); }
.cr-modal-row { display: flex; flex-direction: column; gap: 6px; }
.cr-modal input, .cr-modal select {
  width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text); outline: none;
}
.cr-modal input:focus, .cr-modal select:focus { border-color: var(--neon); }
.cr-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.cr-modal-hint { font-size: 11px; color: var(--text-muted); }

@media (max-width: 1024px) {
  /* 无限画布内部三栏布局在窄屏下保持，仅收起左侧标题/提示与右侧面板宽度 */
  .cr-library .cr-library-title, .cr-library .cr-library-hint { display: none; }
  .cr-inspector { width: 260px; }
  .cr-agent-mode-btn span { display: none; }
  .cr-resizer { display: none; }
}

/* ---- 顶部项目切换（+ 号 + 当前项目名） ---- */
.cr-project-switch { display: flex; align-items: center; gap: 10px; }
.cr-project-new {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.35);
  color: var(--neon-bright); cursor: pointer; transition: all .18s ease;
}
.cr-project-new svg { width: 18px; height: 18px; }
.cr-project-new:hover { background: rgba(74,222,128,0.22); transform: scale(1.05); }
.cr-project-current {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 700; max-width: 220px;
}
#crProjectCurrentName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 左侧项目管理面板 ---- */
.cr-library {
  width: var(--cr-library-w); min-width: 180px; max-width: 360px;
  flex-shrink: 0; padding: 12px;
  /* 与漫咔（Storytap）左侧大纲一致的简洁半透明面板背景：无毛玻璃、无模糊 */
  background: rgba(0,0,0,0.10);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
/* 浅色主题：与漫咔浅色面板一致 */
html[data-theme="light"] .cr-library {
  background: rgba(0,0,0,0.05);
  border-right: 1px solid rgba(0,0,0,0.08);
}
.cr-library[hidden] { display: none; }
.cr-resizer-left[hidden] { display: none; }
.cr-library-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 6px 6px;
}
.cr-library-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.cr-library-title::before {
  content: ''; width: 8px; height: 8px; border-radius: 2px;
  background: linear-gradient(135deg, var(--neon), var(--neon-bright));
  box-shadow: 0 0 8px rgba(74,222,128,0.35);
}
.cr-library-add {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.35);
  color: var(--neon-bright); cursor: pointer; transition: all .18s ease;
}
.cr-library-add svg { width: 14px; height: 14px; }
.cr-library-add:hover { background: rgba(74,222,128,0.22); transform: scale(1.05); }
.cr-library-hint { margin-top: auto; font-size: 10px; color: var(--text-muted); line-height: 1.5; padding-top: 10px; border-top: 1px solid var(--border); }
.cr-project-list {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 4px; margin: -4px;
  display: flex; flex-direction: column; gap: 5px;
}
.cr-project-empty { padding: 28px 10px; text-align: center; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
/* 左侧树形：文件夹 / 项目（不显示画面） */
.cr-tree-folder, .cr-tree-project { display: block; }
.cr-tree-children {
  display: block; padding-left: 12px; position: relative;
}
.cr-tree-row {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  transition: all .15s ease;
}
.cr-tree-row:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.1);
  color: var(--text);
}
.cr-tree-row.active {
  background: rgba(74,222,128,0.1);
  border-color: rgba(74,222,128,0.25);
  color: var(--neon-bright);
  box-shadow: 0 0 0 1px rgba(74,222,128,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}
.cr-tree-arrow {
  flex-shrink: 0; width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--text-muted); transition: all .15s ease;
}
.cr-tree-arrow svg { width: 10px; height: 10px; }
.cr-tree-arrow.expanded { transform: rotate(90deg); color: var(--text); }
.cr-tree-arrow.spacer { opacity: 0; pointer-events: none; }
.cr-tree-icon {
  flex-shrink: 0; width: 18px; height: 18px;
  display: grid; place-items: center; color: var(--text-muted);
}
.cr-tree-icon svg { width: 14px; height: 14px; }
.cr-tree-folder > .cr-tree-row .cr-tree-icon { color: rgba(250,204,21,0.85); }
.cr-tree-project > .cr-tree-row .cr-tree-icon { color: rgba(74,222,128,0.85); }
.cr-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.cr-tree-actions {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 2px;
  padding: 2px 4px; border-radius: 7px;
  background: rgba(18,19,24,0.85); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.06);
  opacity: 0; transition: opacity .15s ease; pointer-events: auto;
}
.cr-tree-row:hover .cr-tree-actions { opacity: 1; }
.cr-tree-btn {
  width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  font-size: 12px; line-height: 1; cursor: pointer; transition: all .15s ease;
}
.cr-tree-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: var(--text); }
.cr-tree-btn.add:hover { color: var(--neon-bright); background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.35); }
.cr-tree-btn.del:hover { color: #f87171; background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); }

/* 中间浏览视图：面包屑浮层 + 层级画布节点 */
.cr-browser {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: transparent; z-index: 6; pointer-events: none;
}
.cr-browser[hidden] { display: none; }
.cr-browser-header {
  flex-shrink: 0; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: .01em;
  background: rgba(14,14,18,0.4); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 6px;
  pointer-events: auto;
}
.cr-crumb { cursor: pointer; color: var(--text-dim); transition: all .15s ease; padding: 2px 6px; border-radius: 6px; }
.cr-crumb:hover { color: var(--neon-bright); background: rgba(74,222,128,0.08); }
.cr-crumb-sep { color: var(--text-muted); opacity: .4; font-weight: 400; }
.cr-browser-body { display: none; }

/* ---- 画布加载提示：进入画布时数据库数据未就绪的短暂过渡，避免误看成空画布 ---- */
.cr-scene-loading {
  position: absolute; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(10,12,16,0.55); backdrop-filter: blur(4px);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  pointer-events: none;
}
.cr-scene-loading[hidden] { display: none; }
.cr-scene-loading-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(74,222,128,0.25); border-top-color: var(--neon);
  animation: crSceneSpin .7s linear infinite;
}
@keyframes crSceneSpin { to { transform: rotate(360deg); } }

/* 层级画布节点：项目组 / 项目 / 画面 */
.cr-level-node {
  position: relative; width: 300px; border-radius: 18px;
  cursor: pointer; user-select: none; touch-action: none;
  transition: box-shadow .25s ease, border-color .2s ease, transform .18s ease;
  display: flex; flex-direction: column; gap: 10px;
}
.cr-level-node:hover { transform: translateY(-3px) scale(1.01); }
.cr-level-node.dragging { opacity: .85; z-index: 50; transform: scale(1.04); box-shadow: 0 24px 60px rgba(0,0,0,0.55); pointer-events: none; }
.cr-level-node.drop-target { box-shadow: 0 0 0 3px var(--neon-bright), 0 20px 50px rgba(0,0,0,0.45); border-color: var(--neon-bright) !important; }

/* 项目组节点：玻璃磨砂文件夹 */
.cr-level-folder {
  min-height: 150px; padding: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.04) 50%, rgba(74,222,128,0.06) 100%);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 18px 46px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.cr-level-folder::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 55%;
  border-radius: 18px 18px 0 0; pointer-events: none;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,0.12), transparent 60%);
}
.cr-level-folder .cr-ln-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.14);
  color: var(--text); font-size: 22px;
}
.cr-level-folder .cr-ln-body { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cr-level-folder .cr-ln-title { font-size: 15px; font-weight: 800; color: var(--text); }
.cr-level-folder .cr-ln-meta { font-size: 11px; color: var(--text-dim); }
.cr-level-folder .cr-ln-items {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px;
}
.cr-level-folder .cr-ln-item-chip {
  padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,0.2); color: var(--text-dim); border: 1px solid var(--border);
}

/* 项目节点：深色信息卡 */
/* 项目节点：顶部 4:3 缩略图 + 下方信息区（大圆角卡片） */
.cr-level-project {
  padding: 14px; border-radius: 24px; overflow: hidden;
  isolation: isolate;
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(20,22,28,0.8);
  border: 1px solid var(--border);
  box-shadow: 0 18px 44px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.04);
}
.cr-level-project .cr-ln-cover {
  position: relative; width: 100%; aspect-ratio: 4 / 3; flex-shrink: 0;
  border-radius: 14px; overflow: hidden;
  background: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px) 0 0/14px 14px, linear-gradient(165deg, rgba(74,222,128,0.18), rgba(20,22,28,0.95) 70%);
}
.cr-level-project .cr-ln-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-level-project .cr-ln-cover-ph { display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.4); }
.cr-level-project .cr-ln-cover-ph svg { width: 56px; height: 56px; opacity: .8; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35)); }
/* 信息区：位于缩略图下方 */
.cr-level-project .cr-ln-info {
  position: static; flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 5px;
  padding: 2px 2px 0;
  background: transparent; backdrop-filter: none; border-top: none;
}
.cr-level-project .cr-ln-title { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-level-project .cr-ln-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-level-project .cr-ln-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cr-level-project .cr-ln-status {
  font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(74,222,128,0.14); color: var(--neon-bright); border: 1px solid rgba(74,222,128,0.28);
}
.cr-level-project .cr-ln-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--neon-bright); box-shadow: 0 0 6px rgba(74,222,128,0.8); }
.cr-level-project .cr-ln-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
/* 邀请协作按钮 */
.cr-level-project .cr-ln-share {
  border: none; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 800; color: var(--text);
  background: rgba(255,255,255,0.1); border: 1px solid var(--border);
  transition: background .15s ease, transform .1s ease;
}
.cr-level-project .cr-ln-share:hover { background: rgba(255,255,255,0.18); }
.cr-level-project .cr-ln-share:active { transform: scale(0.95); }
.cr-level-project .cr-ln-share svg { width: 13px; height: 13px; }

/* 画面节点 */
.cr-level-scene {
  width: 180px; min-height: 130px; padding: 12px;
  background: rgba(20,22,28,0.72); border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
}
.cr-level-scene .cr-ln-thumb {
  flex: 1; min-height: 0; width: 100%; border-radius: 12px;
  background: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px) 0 0/12px 12px, rgba(74,222,128,0.04);
  border: 1px solid var(--border); margin-bottom: 8px;
}
.cr-level-scene .cr-ln-title { font-size: 13px; font-weight: 800; color: var(--text); }
.cr-level-scene .cr-ln-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* 异常画布卡：数据库登记但实体数据缺失（仅删除按钮，禁用双击打开） */
.cr-level-scene-missing {
  border: 1.5px dashed rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.05);
  box-shadow: none;
}
.cr-level-scene-missing .cr-ln-thumb-missing {
  flex: 1; min-height: 0; width: 100%; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: rgba(248, 113, 113, 0.75);
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.06);
  font-size: 11px; margin-bottom: 8px;
}
.cr-level-scene-missing .cr-ln-thumb-missing svg { width: 30px; height: 30px; opacity: .85; }
.cr-level-scene-missing .cr-ln-missing-text { font-size: 10px; line-height: 1.5; color: #f87171; }
.cr-level-scene-missing .cr-ln-del-missing {
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 800; color: #fff;
  background: rgba(248, 113, 113, 0.85);
  transition: background .15s ease;
}
.cr-level-scene-missing .cr-ln-del-missing:hover { background: #ef4444; }
html[data-theme="light"] .cr-level-scene-missing { background: rgba(248, 113, 113, 0.05); }
html[data-theme="light"] .cr-level-scene-missing .cr-ln-del-missing { color: #fff; }

/* 「添加画布」虚线卡片：与画布卡同尺寸（宽高由 JS 内联），虚线边框 + 透明背景 + 居中大号加号 */
.cr-level-add-scene {
  border: 1.5px dashed rgba(148, 163, 184, 0.45);
  background: transparent;
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
}
.cr-level-add-scene:hover {
  border-color: var(--neon-bright, #4ade80);
  background: rgba(74, 222, 128, 0.05);
}
.cr-ln-add-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-muted, #8a8f98); pointer-events: none;
}
.cr-level-add-scene:hover .cr-ln-add-inner { color: var(--neon-bright, #4ade80); }
.cr-ln-add-plus { font-size: 44px; line-height: 1; font-weight: 300; }
.cr-ln-add-text { font-size: 12px; font-weight: 600; letter-spacing: .5px; }

/* 层级节点选中态 */
.cr-level-node.selected {
  border-color: rgba(74,222,128,0.75) !important;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.6), 0 22px 56px rgba(0,0,0,0.55), 0 0 40px rgba(74,222,128,0.12);
}

/* 节点右上角菜单按钮（列表模式下 .cr-level-node 为 relative 网格卡片，按钮绝对定位在卡片右上角） */
.cr-ln-menu-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; opacity: 0;
  transition: opacity .2s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.cr-level-node:hover .cr-ln-menu-btn { opacity: 1; }
.cr-ln-menu-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.cr-ln-menu-btn:active { transform: scale(0.95); }
.cr-ln-menu-btn svg { width: 14px; height: 14px; }
/* 选中时始终显示菜单按钮 */
.cr-level-node.selected .cr-ln-menu-btn { opacity: 1; background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.25); color: var(--neon-bright); }

.cr-project-empty { padding: 20px 10px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* ---- 右侧智能体面板 ---- */
.cr-inspector {
  width: var(--cr-inspector-w); min-width: 320px; max-width: 700px;
  flex-shrink: 0; overflow: hidden;
  background: rgba(10,11,14,0.55);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  transition: width .28s ease, min-width .28s ease, opacity .22s ease, border-width .28s ease;
}
.cr-inspector.hidden {
  width: 0 !important; min-width: 0 !important; max-width: 0 !important;
  opacity: 0; border-left-width: 0;
  pointer-events: none;
}
.cr-inspector.resizing {
  transition: none !important;
}
.cr-agent-panel {
  position: relative;
  flex: 1; min-height: 0; width: 100%; min-width: 320px; max-width: 700px;
  display: flex; flex-direction: column;
  opacity: 1; transition: opacity .18s ease;
}
.cr-inspector.hidden .cr-agent-panel { opacity: 0; }
.cr-agent-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 12px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cr-agent-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cr-agent-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(74,222,128,0.28), rgba(34,211,238,0.18));
  border: 1px solid rgba(74,222,128,0.32); color: var(--neon-bright); flex-shrink: 0;
}
.cr-agent-avatar svg { width: 17px; height: 17px; }
.cr-agent-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cr-agent-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.cr-agent-status {
  font-size: 10px; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.cr-agent-copy {
  width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer;
  transition: all .15s ease; padding: 0; flex-shrink: 0;
}
.cr-agent-copy:hover { color: var(--neon-bright); background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.25); }
.cr-agent-copy svg { width: 12px; height: 12px; }
.cr-agent-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.cr-agent-header-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer;
  transition: all .15s ease; padding: 0;
}
.cr-agent-header-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.cr-agent-header-btn svg { width: 18px; height: 18px; }

.cr-agent-history {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  background: rgba(10,11,14,0.96);
  backdrop-filter: blur(10px);
}
.cr-agent-history[hidden] { display: none; }
.cr-agent-history-header {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 12px; border-bottom: 1px solid var(--border);
}
.cr-agent-history-title { font-size: 14px; font-weight: 700; color: var(--text); }
.cr-agent-history-actions { display: flex; align-items: center; gap: 4px; }
.cr-agent-history-btn {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer;
  transition: all .15s ease; padding: 0;
}
.cr-agent-history-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.cr-agent-history-btn svg { width: 15px; height: 15px; }
.cr-agent-history-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cr-agent-history-empty { font-size: 12px; color: var(--text-muted); padding: 20px 0; text-align: center; }
.cr-agent-history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: all .15s ease;
}
.cr-agent-history-item:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); }
.cr-agent-history-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cr-agent-history-item-text { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-agent-history-item-time { font-size: 10px; color: var(--text-muted); }
.cr-agent-history-item-sid { font-size: 10px; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: .7; word-break: break-all; }
.cr-agent-history-item-del {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer;
  transition: all .15s ease; padding: 0; flex-shrink: 0;
}
.cr-agent-history-item-del:hover { color: #f87171; background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); }
.cr-agent-history-item-del svg { width: 14px; height: 14px; }
.cr-agent-node-inspector {
  flex-shrink: 0; max-height: 45%; overflow-y: auto;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.cr-agent-node-inspector[hidden] { display: none; }
.cr-agent-node-inspector .cr-insp-head { margin-bottom: 10px; }
.cr-agent-node-inspector .cr-insp-field { margin-bottom: 10px; }
.cr-agent-node-inspector .cr-insp-actions { margin-top: 10px; }

.cr-agent-welcome {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
}
.cr-agent-welcome[hidden] { display: none; }
.cr-agent-greeting { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.cr-agent-greeting-emoji { font-size: 34px; line-height: 1; }
.cr-agent-greeting-title { font-size: 18px; font-weight: 800; color: var(--text); }
.cr-agent-greeting-sub { font-size: 12px; color: var(--text-muted); }
.cr-agent-skills { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cr-agent-skill {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); cursor: pointer;
  transition: all .18s ease;
}
.cr-agent-skill:hover { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.3); transform: translateY(-1px); }
.cr-agent-skill-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,0.06); border: 1px solid var(--border); font-size: 15px; }
.cr-agent-skill-body { flex: 1; min-width: 0; }
.cr-agent-skill-name { font-size: 13px; font-weight: 700; color: var(--text); }
.cr-agent-skill-desc { font-size: 11px; color: var(--text-muted); }

.cr-agent-messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px;
}
.cr-agent-messages[hidden] { display: none; }
.cr-agent-msg { display: flex; gap: 10px; max-width: 92%; }
.cr-agent-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cr-agent-msg.bot { align-self: flex-start; }
.cr-agent-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-dim); font-size: 12px;
}
.cr-agent-msg.user .cr-agent-msg-avatar { background: rgba(74,222,128,0.15); color: var(--neon-bright); border-color: rgba(74,222,128,0.25); }
.cr-agent-msg-content { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.cr-agent-msg-bubble {
  padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.55;
  background: rgba(255,255,255,0.06); border: none; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-word;
}
.cr-agent-msg.user .cr-agent-msg-bubble { background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.25); color: var(--text); }
.cr-agent-msg-bubble img { max-width: 100%; border-radius: 8px; display: block; margin-top: 6px; }
.cr-agent-struct { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.cr-agent-struct div { color: var(--neon-bright); }
.cr-agent-warn { color: #fbbf24; }
.cr-agent-wf { margin-top: 10px; border: 1px solid rgba(74,222,128,0.28); background: rgba(74,222,128,0.06); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.cr-agent-wf-head { font-size: 13px; font-weight: 600; color: var(--neon-bright); }
.cr-agent-wf-steps { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cr-agent-wf-plan { font-size: 12px; color: var(--text); line-height: 1.5; }
.cr-agent-wf-run { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: none; background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; line-height: 1.2; }
.cr-agent-wf-run:hover { filter: brightness(1.08); }
.cr-agent-wf-run:disabled { opacity: .5; cursor: not-allowed; }
.cr-agent-wf-note { font-size: 11px; color: var(--text-dim); opacity: .85; }
/* 思考中气泡（显示在消息列表内，请求完成后被替换） */
.cr-agent-msg.bot .cr-agent-thinking-bubble {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 10px 12px; min-width: 56px;
  background: transparent; border: none;
}
.cr-agent-thinking-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted);
  animation: crAgentBounce 1.2s infinite ease-in-out;
}
.cr-agent-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.cr-agent-thinking-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes crAgentBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}
/* AI 消息操作栏 */
.cr-agent-msg-actions {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  align-self: flex-start;
}
.cr-agent-action-btn {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center; transition: all .18s ease;
}
.cr-agent-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-agent-action-btn.active { color: var(--neon-bright); background: rgba(74,222,128,0.12); }
.cr-agent-action-btn svg { width: 13px; height: 13px; }
.cr-agent-action-time { margin-left: 6px; font-size: 11px; color: var(--text-muted); }

.cr-agent-input {
  flex-shrink: 0; padding: 12px 14px 14px; border-top: 1px solid var(--border);
  background: var(--modal-bg); display: flex; flex-direction: column; gap: 10px;
}
.cr-agent-input .cr-ai-input-box { border-radius: 20px; }
.cr-agent-footnote { font-size: 10px; color: var(--text-muted); text-align: center; }

/* 层级浏览时平移禁用过节点交互 */
.cr-canvas-viewport.panning .cr-level-node { pointer-events: none; }

/* 左侧树不再显示画面行 */
.cr-tree-scene { display: none; }

/* 右下角智能体虚拟形象 FAB */
.cr-agent-fab {
  position: fixed; bottom: 26px; right: 26px; z-index: 300;
  width: 64px; height: 64px; border-radius: 50%;
  border: none; background: transparent; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  filter: drop-shadow(0 10px 30px rgba(74,222,128,0.25));
  animation: crFabFloat 3s ease-in-out infinite;
}
.cr-agent-fab[hidden] { display: none; }
.cr-agent-fab-glow {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(167,243,208,0.95), rgba(74,222,128,0.55) 35%, rgba(21,128,61,0.45) 70%, rgba(6,78,59,0.55) 100%);
  box-shadow:
    inset -4px -4px 10px rgba(0,0,0,0.25),
    inset 4px 4px 12px rgba(255,255,255,0.28),
    0 0 20px rgba(74,222,128,0.35),
    0 0 40px rgba(74,222,128,0.15);
  transition: box-shadow .25s ease;
}
.cr-agent-fab::before {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(74,222,128,0), rgba(74,222,128,0.45), rgba(34,211,238,0.45), rgba(74,222,128,0));
  animation: crFabSpin 4s linear infinite;
  z-index: -1; filter: blur(2px); opacity: .7;
}
.cr-agent-fab:hover { transform: scale(1.08); }
.cr-agent-fab:hover .cr-agent-fab-glow {
  box-shadow:
    inset -4px -4px 10px rgba(0,0,0,0.2),
    inset 4px 4px 12px rgba(255,255,255,0.32),
    0 0 28px rgba(74,222,128,0.5),
    0 0 56px rgba(74,222,128,0.25);
}
.cr-agent-fab-face {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 7px;
}
.cr-agent-fab-eye {
  width: 7px; height: 9px; border-radius: 50%;
  background: rgba(6,78,59,0.85);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
  animation: crFabBlink 4s infinite;
}
@keyframes crFabFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes crFabSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes crFabBlink {
  0%, 48%, 52%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}
@media (max-width: 640px) {
  .cr-agent-fab { width: 54px; height: 54px; bottom: 18px; right: 18px; }
  .cr-agent-fab-eye { width: 6px; height: 8px; }
}

/* ===== 图片节点 v5：工具栏图标化 / 相框占位符 / 参考图放大 / 输入框分行 / 尺寸悬浮窗 ===== */

/* --- 节点容器 --- */
.cr-node.cr-text-node.cr-image-node { width: auto; min-width: 280px; }
.cr-node.cr-text-node.cr-image-node .cr-node-card { min-height: 0; border-radius: 14px; }
.cr-node.cr-text-node.cr-image-node .cr-node-body { flex: 0 0 auto; display: block; min-height: 0; }

/* --- 图片主体（按比例缩放） --- */
.cr-image-body {
  width: 100%; aspect-ratio: 16 / 9; background: #0a0a0a;
  display: grid; place-items: center; overflow: hidden; position: relative;
  border-radius: 10px;
}
.cr-image-body img.cr-image-rendered { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- 占位符（相框山景 SVG，无文字） --- */

/* --- 工具栏（图片节点专用，带图标+文字） --- */
.cr-img-tb {
  max-width: none; width: auto; min-width: 0;
  border-radius: 12px !important; padding: 6px 10px !important; gap: 1px !important;
}
.cr-img-tb button {
  width: auto; height: auto; min-width: unset; min-height: 28px; padding: 3px 7px;
  border-radius: 6px; font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.72);
  gap: 4px; white-space: nowrap;
}
.cr-img-tb button:hover { background: rgba(255,255,255,0.1) !important; color: #fff !important; }

/* 工具栏图标 */
.cr-img-tb-icon { width: 15px; height: 15px; flex-shrink: 0; color: inherit; }
.cr-img-tb-icon svg { display: block; width: 100%; height: 100%; }

/* R 标识（圆形底） */
.cr-img-tb-r {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,0.12); font-size: 11px; font-weight: 700;
}

/* 下拉箭头 */
.cr-img-tb-arrow {
  display: inline-block; margin-left: 1px;
  width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor; opacity: .5;
}

/* 分隔线 */
.cr-img-tb .sep { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 4px; }

/* 「更多」溢出菜单（中间工具 >8 收起，含自定义工具栏入口） */
.cr-img-tb-more-wrap { position: relative; display: inline-flex; }
.cr-img-tb-more-pop {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  min-width: 172px; padding: 6px; border-radius: 10px;
  background: var(--modal-bg, #1c1c1c); border: 1px solid var(--border, #222222);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55); z-index: 90;
  display: flex; flex-direction: column; gap: 2px;
}
.cr-img-tb-more-pop[hidden] { display: none; }
.cr-img-tb .cr-img-tb-more-item {
  width: 100%; min-height: 32px; padding: 6px 10px; border-radius: 7px;
  display: flex; align-items: center; gap: 8px; justify-content: flex-start;
  font-size: 12.5px; font-weight: 400; color: rgba(255,255,255,0.85); text-align: left;
}
.cr-img-tb .cr-img-tb-more-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.cr-img-tb .cr-img-tb-more-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.cr-img-tb-more-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }

/* ── 图片编辑弹窗（旋转/裁剪/标注/自定义工具栏）── */
.cr-img-edit-mask {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.cr-img-edit-mask[hidden] { display: none; }
.cr-img-edit-modal {
  width: min(860px, 94vw); max-height: 92vh; overflow: hidden;
  background: #1c1c1c; border: 1px solid #222222; border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.65);
  display: flex; flex-direction: column;
}
.cr-img-edit-head {
  height: 46px; padding: 0 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #222222;
}
.cr-img-edit-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.92); }
.cr-img-edit-close {
  width: 28px; height: 28px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7);
  font-size: 16px; cursor: pointer; display: grid; place-items: center;
}
.cr-img-edit-close:hover { background: rgba(255,255,255,0.16); color: #fff; }
.cr-img-edit-body {
  padding: 16px; overflow: auto; flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.28);
}
.cr-img-edit-foot {
  min-height: 50px; padding: 10px 14px; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid #222222;
}
.cr-img-edit-foot-sep { width: 1px; height: 20px; background: #2a2a2a; margin: 0 6px; }
.cr-img-edit-preview { max-width: 100%; max-height: 62vh; display: flex; }
.cr-img-edit-preview img { max-width: 100%; max-height: 62vh; object-fit: contain; border-radius: 8px; }
.cr-img-edit-foot .btn {
  min-height: 30px; padding: 4px 12px; border-radius: 7px; border: 1px solid #2c2c2c;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); font-size: 12.5px; cursor: pointer;
}
.cr-img-edit-foot .btn:hover { background: rgba(255,255,255,0.12); }
.cr-img-edit-foot .btn.active { border-color: rgba(74,222,128,0.7); color: #4ade80; background: rgba(74,222,128,0.1); }
.cr-img-edit-foot .btn-primary {
  border-color: rgba(74,222,128,0.7); color: #0a1a0a; font-weight: 600;
  background: linear-gradient(135deg, #4ade80, #34d399);
}
.cr-img-edit-foot .btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #4ade80, #34d399); }

/* 裁剪（参考裁剪工具：紫色 L 角标 + 白色圆形 + 手柄 + 三分法虚线网格 + 尺寸胶囊 + 底部控制面板） */
.cr-img-crop-stage {
  position: relative; background: #0d0d0d; border-radius: 8px; overflow: hidden; touch-action: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.cr-img-crop-box {
  position: absolute; border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45); cursor: move;
}
/* 三分法虚线网格 */
.cr-img-crop-grid { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cr-img-crop-grid i { position: absolute; border: 0 dashed rgba(255,255,255,0.5); }
.cr-img-crop-grid i.v1 { left: 33.333%; top: 0; bottom: 0; border-left-width: 1px; }
.cr-img-crop-grid i.v2 { left: 66.666%; top: 0; bottom: 0; border-left-width: 1px; }
.cr-img-crop-grid i.h1 { top: 33.333%; left: 0; right: 0; border-top-width: 1px; }
.cr-img-crop-grid i.h2 { top: 66.666%; left: 0; right: 0; border-top-width: 1px; }
/* 四角 L 形控制点（淡紫色） */
.cr-img-crop-l { position: absolute; width: 18px; height: 18px; z-index: 4; }
.cr-img-crop-l.nw { left: -2px; top: -2px; border-left: 3px solid #a78bfa; border-top: 3px solid #a78bfa; cursor: nwse-resize; }
.cr-img-crop-l.ne { right: -2px; top: -2px; border-right: 3px solid #a78bfa; border-top: 3px solid #a78bfa; cursor: nesw-resize; }
.cr-img-crop-l.sw { left: -2px; bottom: -2px; border-left: 3px solid #a78bfa; border-bottom: 3px solid #a78bfa; cursor: nesw-resize; }
.cr-img-crop-l.se { right: -2px; bottom: -2px; border-right: 3px solid #a78bfa; border-bottom: 3px solid #a78bfa; cursor: nwse-resize; }
/* 四边圆形 + 手柄（白色圆 + 黑色 +） */
.cr-img-crop-e {
  position: absolute; width: 18px; height: 18px; border-radius: 50%; z-index: 4;
  background: #ffffff; color: #111111; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.cr-img-crop-e::after { content: '+'; }
.cr-img-crop-e.n { left: 50%; top: -9px; transform: translateX(-50%); cursor: ns-resize; }
.cr-img-crop-e.s { left: 50%; bottom: -9px; transform: translateX(-50%); cursor: ns-resize; }
.cr-img-crop-e.w { top: 50%; left: -9px; transform: translateY(-50%); cursor: ew-resize; }
.cr-img-crop-e.e { top: 50%; right: -9px; transform: translateY(-50%); cursor: ew-resize; }
/* 右上角尺寸胶囊 */
.cr-img-crop-size {
  position: absolute; right: 8px; top: 8px; z-index: 3; pointer-events: none;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.92); color: #222222;
  font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
/* 底部控制面板 */
.cr-img-crop-panel { width: 100%; }
.cr-img-crop-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 12px;
}
.cr-img-crop-title b { display: block; font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.92); }
.cr-img-crop-title span { display: block; margin-top: 1px; font-size: 12px; color: rgba(255,255,255,0.45); }
.cr-img-crop-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cr-img-crop-cancel {
  background: transparent; border: none; color: rgba(255,255,255,0.55);
  padding: 7px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.cr-img-crop-cancel:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.06); }
.cr-img-crop-apply {
  background: #4ade80; color: #0a1a0a; border: none;
  padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cr-img-crop-apply:hover { filter: brightness(1.08); }
.cr-img-crop-ratios { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-img-crop-ratio {
  padding: 7px 16px; border-radius: 8px; border: 1px solid #2a2a2a;
  background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.75);
  font-size: 13px; cursor: pointer;
}
.cr-img-crop-ratio:hover { background: rgba(255,255,255,0.08); }
.cr-img-crop-ratio.active {
  background: #4ade80; color: #0a1a0a; border-color: #4ade80; font-weight: 600;
}

/* 标注（参考标注工具：顶部工具栏 + 虚线编辑边界 + 标点控制） */
.cr-img-annotate-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.cr-img-annotate-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid #222222;
}
.cr-img-annotate-tool {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
  color: rgba(255,255,255,0.72); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.cr-img-annotate-tool svg { width: 16px; height: 16px; display: block; }
.cr-img-annotate-tool:hover { background: rgba(255,255,255,0.1); color: #fff; }
.cr-img-annotate-tool.active { background: rgba(74,222,128,0.14); color: #4ade80; }
.cr-img-annotate-tbsep { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 5px; }
.cr-img-annotate-color {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25);
  cursor: pointer; padding: 0; flex-shrink: 0;
}
.cr-img-annotate-color.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
.cr-img-annotate-width { display: inline-flex; align-items: center; }
.cr-img-annotate-width input[type="range"] {
  width: 90px; height: 4px; border-radius: 2px; cursor: pointer;
  accent-color: #4ade80;
}
.cr-img-annotate-save { margin-left: 4px; }
.cr-img-annotate-stage {
  position: relative; border-radius: 8px; overflow: hidden; background: #0d0d0d;
  outline: 1.5px dashed rgba(167,139,250,0.75); outline-offset: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.cr-img-annotate-stage canvas { display: block; cursor: crosshair; }

/* 自定义工具栏 */
.cr-img-tb-custom { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; width: 100%; }
.cr-img-tb-custom-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: rgba(255,255,255,0.04); border: 1px solid #222222; border-radius: 9px;
  font-size: 13px; color: rgba(255,255,255,0.85); cursor: pointer; user-select: none;
}
.cr-img-tb-custom-item:hover { background: rgba(255,255,255,0.07); }
.cr-img-tb-custom-item input { accent-color: #4ade80; width: 15px; height: 15px; }
.cr-img-tb-custom-hint { width: 100%; margin-top: 4px; font-size: 11.5px; color: rgba(255,255,255,0.4); }

/* --- 图片节点参考图画廊行（参考 AI图片创作助手，图3） --- */
.cr-image-ref-gallery {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 2px; flex-wrap: wrap;
}
/* 参考图缩略图卡片（圆角 + 图片 + 底部标签） */
.cr-ref-thumb {
  position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
  flex-shrink: 0; cursor: default;
}
.cr-ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 缩略图底部标签（实底渐变 + 更清晰） */
.cr-ref-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 3px 2px 5px; font-size: 10px; font-weight: 600;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  text-align: center; line-height: 1.2;
  background: linear-gradient(transparent, rgba(0,0,0,0.55) 30%, rgba(0,0,0,0.85));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 删除按钮 */
.cr-ref-thumb-x {
  position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: #e74c3c; color: #fff; font-size: 11px; line-height: 1;
  border: none; cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s; z-index: 2;
}
.cr-ref-thumb:hover .cr-ref-thumb-x { opacity: 1; }
/* [+] 添加按钮（与缩略图同尺寸，虚线边框） */
.cr-ref-add-btn {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0;
  border: 1.5px dashed rgba(255,255,255,0.25); background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.45); font-size: 22px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; transition: all .15s ease;
}
.cr-ref-add-btn svg { width: 20px; height: 20px; }
.cr-ref-add-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.45); color: rgba(255,255,255,0.8); }
/* 文本节点面板中隐藏添加参考按钮（文本节点通过连线获取上游参考，不主动添加） */
.cr-ai-input-box[data-ai-input-type="text"] .cr-ref-add-btn { display: none; }

/* ── 上游连线节点引用（图片节点检查器）── */
/* 上游引用缩略图：与手动参考图同尺寸，带蓝色边框标识来源为连线 */
.cr-ref-thumb.cr-ref-upstream {
  border-color: rgba(148,163,184,0.35);
  box-shadow: 0 0 0 1px rgba(148,163,184,0.12);
  cursor: grab;
}
.cr-ref-thumb.cr-ref-upstream:hover {
  border-color: rgba(148,163,184,0.6);
  box-shadow: 0 0 0 1px rgba(148,163,184,0.25);
}
/* 图片/文本之间的分隔线 */
.cr-ref-separator {
  width: 1px; height: 48px; flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.15), transparent);
  margin: 0 4px;
}
html[data-theme="light"] .cr-ref-separator {
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.35), transparent);
}
/* 上游文本节点方块卡片（与图片缩略图 1:1 同尺寸 64x64） */
.cr-ref-text-item {
  position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  flex-shrink: 0; cursor: grab;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(148,163,184,0.35);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(148,163,184,0.12);
  transition: background .15s, border-color .15s;
}
.cr-ref-text-item:hover { background: rgba(255,255,255,0.12); border-color: rgba(148,163,184,0.6); }
/* 文本卡片图标（相对方块居中放大，灰色） */
.cr-ref-text-item .cr-ref-text-icon {
  width: 26px; height: 26px; color: rgba(203,213,225,0.85);
  font-size: 26px; line-height: 1; margin-top: -6px;
}
/* 文本卡片底部标签（继承 .cr-ref-label 底边样式） */
.cr-ref-text-item .cr-ref-label { font-size: 10px; }
/* 参考卡片拖拽高亮 */
.cr-ref-upstream.cr-ref-dragging { opacity: .5; }
.cr-ref-upstream.cr-ref-drag-over { border-color: rgba(74,222,128,0.7) !important; box-shadow: 0 0 0 2px rgba(74,222,128,0.4) !important; }
/* 参考卡片右下角全屏查看按钮 */
.cr-ref-full {
  position: absolute; right: 4px; bottom: 4px; z-index: 3;
  width: 22px; height: 22px; border-radius: 6px;
  border: none; cursor: pointer; display: grid; place-items: center;
  background: rgba(0,0,0,0.55); color: rgba(255,255,255,0.85);
  opacity: 0; transition: opacity .15s;
}
.cr-ref-full svg { width: 13px; height: 13px; }
.cr-ref-upstream:hover .cr-ref-full { opacity: 1; }
.cr-ref-full:hover { background: rgba(0,0,0,0.8); color: #fff; }

/* ── 上游引用缩略图 hover 预览弹层（图片放大 / 文本全文） ── */
.cr-ref-preview-pop {
  position: fixed; z-index: 9000;
  max-width: 240px; min-width: 220px; max-height: 320px;
  border-radius: 12px; background: rgba(26,26,31,0.90);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 18px 48px rgba(0,0,0,0.6);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  padding: 10px; display: none;
  pointer-events: auto;
  overflow: hidden; box-sizing: border-box;
}
.cr-ref-preview-pop.cr-ref-preview-image { padding: 0; position: fixed; box-sizing: border-box; border-radius: 10px;
  display: block; width: max-content; min-width: 0; max-width: 240px; max-height: 366px; }
.cr-ref-preview-pop.cr-ref-preview-image .cr-ref-preview-imgbody {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  width: max-content; min-width: 0; flex: none;
  background: #0e0e12; border-radius: 10px 10px 0 0;
}
/* 图片/视频按自身比例显示：横图贴宽 240px，竖图贴高 320px，完整显示不裁切 */
.cr-ref-preview-pop.cr-ref-preview-image img {
  display: block; max-width: 240px; max-height: 320px; width: auto; height: auto; object-fit: contain; margin: 0;
}
.cr-ref-preview-pop.cr-ref-preview-image video {
  display: block; max-width: 240px; max-height: 320px; width: auto; height: auto; object-fit: contain; margin: 0;
  background: #000;
}
.cr-ref-preview-pop.cr-ref-preview-image audio { width: 220px; height: 40px; border-radius: 8px; margin: 0; }
/* 底部「查看大图/原视频/全文」按钮条：简约带背景 */
.cr-ref-preview-label {
  padding: 6px 10px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-ref-preview-foot {
  display: flex; justify-content: center; padding: 6px;
  background: rgba(255,255,255,0.05);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.cr-ref-preview-full {
  display: inline-flex; align-items: center; gap: 5px;
  border: none; border-radius: 7px; cursor: pointer; padding: 5px 12px;
  background: rgba(0,0,0,0.45); color: rgba(255,255,255,0.9);
  font-size: 11px; line-height: 1; transition: background .15s, color .15s;
}
.cr-ref-preview-full:hover { background: rgba(0,0,0,0.75); color: #fff; }
.cr-ref-preview-full svg { width: 12px; height: 12px; }
.cr-ref-preview-pop.cr-ref-preview-text { position: fixed; padding: 8px; width: 240px; box-sizing: border-box; border: none; }
/* 文本预览主体：宽 240 × 高约 320（含底部按钮），无名称，正文在框内滚动 */
.cr-ref-preview-pop.cr-ref-preview-text .cr-ref-preview-text-body {
  height: 260px;
  min-height: 100px; max-height: 260px;
  overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.6; color: rgba(255,255,255,0.85);
  box-sizing: border-box; width: 100%;
}

/* ── 参考卡片全屏预览弹层（遮罩 + 大图 / 全文） ── */
.cr-ref-full-pop {
  position: fixed; inset: 0; z-index: 9500; display: none;
  background: rgba(5,5,8,0.88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  align-items: center; justify-content: center; flex-direction: column;
  padding: 40px 30px;
}
.cr-ref-full-pop.open { display: flex; }
.cr-ref-full-title {
  color: rgba(255,255,255,0.92); font-size: 15px; font-weight: 600;
  margin-bottom: 18px; max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-ref-full-close {
  position: absolute; top: 22px; right: 26px; width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
  background: rgba(255,255,255,0.1); color: #fff; font-size: 22px; line-height: 1;
  display: grid; place-items: center; transition: background .15s;
}
.cr-ref-full-close:hover { background: rgba(255,255,255,0.25); }
.cr-ref-full-body { max-width: 90vw; max-height: 82vh; display: flex; align-items: center; justify-content: center; }
.cr-ref-full-body img { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 8px; }
.cr-ref-full-text {
  max-width: 88vw; max-height: 78vh; overflow-y: auto;
  color: rgba(255,255,255,0.88); font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 22px 26px;
}
body.cr-ref-full-open { overflow: hidden; }
.cr-ref-preview-empty { color: rgba(255,255,255,0.35); font-style: italic; }
.cr-ref-text-icon {
  display: inline-flex; width: 16px; height: 16px; flex-shrink: 0;
  color: rgba(255,255,255,0.55); font-size: 14px; line-height: 1;
}
.cr-ref-text-label {
  font-size: 11px; color: rgba(255,255,255,0.75); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}

/* 浮动面板内 input-box 撑满、纵向布局 */
.cr-node-prompt-panel .cr-ai-input-box {
  display: flex; flex-direction: column; width: 100%;
}
/* 已由上方 .cr-node-prompt-panel .cr-ai-input-textarea 统一控制（含 !important） */

/* --- 尺寸选择器悬浮窗（采用与 .cr-cs-dropdown 一致的玻璃拟态深色样式，背景 #1c1c1c） --- */
.cr-size-picker-popup {
  /* JS 动态定位（position:fixed + top/left），自动避边（视口下方溢出则翻转至上方） */
  z-index: 9000;
  width: 340px; padding: 14px; border-radius: 14px;
  background: rgba(28,28,30,0.90); border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 1px rgba(255,255,255,0.06) inset;
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
}
.cr-size-picker-popup[hidden] { display: none; }
.cr-size-ratio-auto { border-style: dashed !important; }
.cr-size-ratio-auto .cr-size-ratio-svg rect { stroke-dasharray: 3 3; opacity: 0.55; }
.cr-img-size-toggle {
  height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; transition: all .15s ease;
}
.cr-img-size-toggle:hover { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.3); }
.cr-img-size-toggle::before { content: ''; width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 3px; opacity: .7; }
.cr-img-size-toggle:active { transform: scale(.96); }

/* ── 图片节点历史记录按钮（右上角）── */
.cr-node-history-btn {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  height: 28px; padding: 0 10px; border-radius: 14px;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.88); font-size: 11.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; transition: all .15s ease;
}
.cr-node-history-btn:hover { background: rgba(0,0,0,0.78); border-color: rgba(255,255,255,0.36); }
.cr-node-history-btn svg { width: 12px; height: 12px; opacity: .8; }
.cr-node-history-count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: rgba(74,222,128,0.85); color: #0a1a0a;
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ── 图片节点历史记录浮动面板（右侧弹出）── */
.cr-image-history-panel {
  position: fixed; z-index: 9000;
  width: min(420px, 90vw); max-height: min(620px, 86vh);
  border-radius: 14px; background: #1a1a1f;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 22px 60px rgba(0,0,0,0.65);
  display: none; overflow: hidden;
  pointer-events: auto;
}
.cr-image-history-panel.open { display: flex; flex-direction: column; }
.cr-image-history-head {
  height: 44px; padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cr-image-history-title { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); display: flex; align-items: center; gap: 6px; }
.cr-image-history-title i { background: rgba(74,222,128,0.85); color: #0a1a0a; font-style: normal; padding: 1px 7px; border-radius: 9px; font-size: 11px; }
.cr-image-history-close {
  width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,0.06);
  border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 16px;
  display: grid; place-items: center; transition: all .15s ease;
}
.cr-image-history-close:hover { background: rgba(255,255,255,0.16); color: #fff; }
.cr-image-history-body { padding: 12px; overflow-y: auto; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; align-content: start; align-items: start; }
.cr-image-history-hint { font-size: 11px; color: rgba(255,255,255,0.45); padding: 0 2px 2px; grid-column: 1 / -1; }
.cr-image-history-item {
  /* 注意：不能给 grid item 设 overflow:hidden —— Chrome 会把它和 aspect-ratio 叠加后按 min-content 收缩行轨道，导致两列卡片重叠 */
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  cursor: grab; transition: all .15s ease;
}
.cr-image-history-item[draggable="true"]:active { cursor: grabbing; }
.cr-image-history-item:hover { border-color: rgba(74,222,128,0.5); transform: translateY(-1px); }
.cr-image-history-item.is-current { border-color: rgba(74,222,128,0.55); box-shadow: 0 0 0 1px rgba(74,222,128,0.25); }
.cr-image-history-item img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.cr-image-history-actions {
  position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px;
}
.cr-image-history-action {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(15,16,20,0.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18); color: rgba(255,255,255,0.85);
  display: grid; place-items: center; cursor: pointer; transition: all .15s ease;
}
.cr-image-history-action:hover { background: rgba(74,222,128,0.85); color: #0a1a0a; border-color: rgba(74,222,128,0.4); }
.cr-image-history-action svg { width: 14px; height: 14px; }
.cr-image-history-foot {
  padding: 8px 14px; font-size: 11.5px; color: rgba(255,255,255,0.45);
  text-align: center; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}

/* ── 节点渲染性能：渲染隔离（content-visibility 在 viewport 边缘/动画期间可能影响 getBoundingClientRect 精度，按需启用） ── */
.cr-node { contain: layout style; }
.cr-image-rendered { background: rgba(0,0,0,0.4); }
.cr-size-picker-inner { display: flex; flex-direction: column; gap: 10px; }
.cr-size-picker-row { display: flex; align-items: center; }
.cr-size-picker-label {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.82);
  margin-bottom: 2px; letter-spacing: 0.02em;
}

/* 比例网格：一排 6 个（12 项共两行），与用户规范一致 */
.cr-size-ratio-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
}
.cr-size-ratio-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px 5px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.08);
  background: transparent; color: rgba(255,255,255,0.5); cursor: pointer;
  transition: all .15s ease; font-size: 11px; font-weight: 500;
  min-height: 54px;
}
.cr-size-ratio-btn:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.75); background: rgba(255,255,255,0.04); }
.cr-size-ratio-btn.selected {
  border-color: #4ade80; color: #4ade80; background: rgba(74,222,128,0.08);
  box-shadow: 0 0 0 1px rgba(74,222,128,0.15), inset 0 0 12px rgba(74,222,128,0.06);
}
.cr-size-ratio-svg { width: 40px; height: 32px; }
.cr-size-ratio-svg rect {
  fill: transparent; stroke: currentColor; stroke-width: 1.5; rx: 3;
  transition: fill .15s ease;
}
.cr-size-ratio-btn.selected .cr-size-ratio-svg rect { fill: rgba(74,222,128,0.12); stroke: #4ade80; }

/* 分辨率行 */
.cr-size-res-grid { display: flex; gap: 8px; }
.cr-size-res-btn {
  flex: 1; padding: 8px 0; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.08);
  background: transparent; color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all .15s ease;
}
.cr-size-res-btn:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.85); }
.cr-size-res-btn.selected {
  border-color: #4ade80; color: #4ade80; background: rgba(74,222,128,0.1);
  box-shadow: 0 0 0 1px rgba(74,222,128,0.15);
}

/* 宽高输入行 */
.cr-size-wh-row { justify-content: space-between; gap: 16px; }
.cr-size-wh-row label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255,255,255,0.55); font-weight: 500;
}
.cr-size-wh-input {
  width: 90px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.88); font-size: 13px; font-weight: 500;
  outline: none; transition: border-color .15s ease;
}
.cr-size-wh-input:focus { border-color: rgba(74,222,128,0.5); box-shadow: 0 0 0 2px rgba(74,222,128,0.1); }
/* Remove number input spinners */
.cr-size-wh-input::-webkit-inner-spin-button,
.cr-size-wh-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ═════════════════════════════════════════
   视频节点（视觉/圆角/阴影/悬停与图片节点统一）
   基类复用 .cr-node.cr-text-node.cr-image-node → 圆角/阴影/hover 由全局统一控制
   ═════════════════════════════════════════ */
.cr-node.cr-text-node.cr-video-node { width: auto; min-width: 280px; }
.cr-node.cr-text-node.cr-video-node .cr-node-card { min-height: 0; border-radius: 14px; overflow: hidden; }
.cr-node.cr-text-node.cr-video-node .cr-node-body { flex: 0 0 auto; display: block; min-height: 0; }

/* 视频主体容器：16:9 占位，与 .cr-image-body 一致圆角 */
.cr-video-body {
  position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  background: #0a0a0a;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 10px;
}
.cr-video-body video.cr-video-el {
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: transparent;
}
/* 封面/未播放：cover 填充，杜绝黑边（容器比例与视频比例不一致时裁剪边缘）；
   播放中：contain，完整显示视频画面（不拉伸变形） */
.cr-video-body:not(.playing) video.cr-video-el { object-fit: cover; }
.cr-video-body.playing video.cr-video-el { object-fit: contain; }
/* 二次生成中：悬停不显示播放器/控制条 */
.cr-video-body.generating .cr-video-big-play { display: none; }
.cr-video-body.generating:hover .cr-video-controlbar,
.cr-video-body.generating:hover .cr-video-big-play { opacity: 0 !important; pointer-events: none; }

/* 中央大播放按钮（未播放时显示，hover 节点时浮现） */
.cr-video-big-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.55); color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  cursor: pointer; opacity: .85; transition: all .18s ease; z-index: 3;
  pointer-events: auto;
}
/* Bug1：常驻显示播放图标（未 hover 也显示）；鼠标移入（触发悬浮播放）→ 隐藏；移出恢复 */
.cr-video-body:hover .cr-video-big-play { opacity: 0; pointer-events: none; }
/* Bug1 双保险：hovering（JS 状态）与播放中均隐藏图标 */
.cr-video-body.hovering .cr-video-big-play,
.cr-video-body.playing .cr-video-big-play { opacity: 0; pointer-events: none; }
.cr-video-big-play svg { width: 22px; height: 22px; margin-left: 3px; }
.cr-video-big-play:hover { transform: translate(-50%,-50%) scale(1.1); background: rgba(0,0,0,0.75); opacity: 1; }
.cr-video-body.playing .cr-video-big-play { opacity: 0; pointer-events: none; }

/* 加载态：spinner（8 条径向短线，动画与图片生成遮罩一致风格） */
.cr-video-loading {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center; background: rgba(0,0,0,0.35);
}
.cr-video-loading[hidden] { display: none; }
.cr-video-spinner {
  position: relative; width: 44px; height: 44px;
}
.cr-video-spinner i {
  position: absolute; left: 50%; top: 50%;
  width: 3px; height: 12px; margin: -6px -1.5px; border-radius: 1.5px;
  background: rgba(255,255,255,0.85); transform-origin: center 6px;
  animation: crVidSpin 1.1s linear infinite;
}
.cr-video-spinner i:nth-child(1){ transform: rotate(0deg) translateY(-16px); animation-delay: 0s; }
.cr-video-spinner i:nth-child(2){ transform: rotate(45deg) translateY(-16px); animation-delay: .14s; }
.cr-video-spinner i:nth-child(3){ transform: rotate(90deg) translateY(-16px); animation-delay: .28s; }
.cr-video-spinner i:nth-child(4){ transform: rotate(135deg) translateY(-16px); animation-delay: .41s; }
.cr-video-spinner i:nth-child(5){ transform: rotate(180deg) translateY(-16px); animation-delay: .55s; }
.cr-video-spinner i:nth-child(6){ transform: rotate(225deg) translateY(-16px); animation-delay: .69s; }
.cr-video-spinner i:nth-child(7){ transform: rotate(270deg) translateY(-16px); animation-delay: .83s; }
.cr-video-spinner i:nth-child(8){ transform: rotate(315deg) translateY(-16px); animation-delay: .96s; }
@keyframes crVidSpin { 0%,100% { opacity: .16; } 50% { opacity: 1; } }

/* 底部控制条 */
.cr-video-controlbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.82) 60%);
  opacity: 0; transition: opacity .2s ease;
}
.cr-video-body:hover .cr-video-controlbar,
.cr-video-body.playing .cr-video-controlbar { opacity: 1; }

/* 控制按钮 */
.cr-video-btn {
  width: 26px; height: 26px; flex-shrink: 0;
  border: none; border-radius: 6px; cursor: pointer;
  display: grid; place-items: center;
  background: transparent; color: rgba(255,255,255,0.9);
  transition: background .15s, transform .12s;
}
.cr-video-btn:hover { background: rgba(255,255,255,0.18); }
.cr-video-btn:active { transform: scale(.92); }
.cr-video-btn svg { width: 15px; height: 15px; }
.cr-video-btn-ghost { font-size: 11px; font-weight: 600; width: auto; padding: 0 5px; }

/* 进度条 */
.cr-video-progress {
  position: relative; flex: 1; height: 4px; cursor: pointer;
  background: rgba(255,255,255,0.22); border-radius: 2px;
  display: flex; align-items: center;
}
.cr-video-progress-buffered {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(255,255,255,0.28); border-radius: 2px;
  transition: width .2s linear;
}
.cr-video-progress-played {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--node-color, #ec4899); border-radius: 2px;
}
.cr-video-progress-thumb {
  position: absolute; top: 50%; width: 10px; height: 10px; left: 0;
  transform: translate(-50%,-50%); border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.cr-video-progress:hover .cr-video-progress-thumb { background: var(--node-color, #ec4899); }

/* 时间显示 */
.cr-video-time { font-size: 10.5px; color: rgba(255,255,255,0.85); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 时长角标（右上角） */
.cr-video-badge {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  height: 22px; padding: 0 8px; border-radius: 11px;
  display: inline-flex; align-items: center;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff; font-size: 10.5px; font-weight: 600;
  white-space: nowrap; cursor: default;
}

/* 视频节点工具栏（沿用图片 .cr-img-tb） */
.cr-vid-tb button[data-cmd="play"], .cr-vid-tb button[data-cmd="replay"] { font-size: 12px; min-width: 24px; }
.cr-vid-tb button[data-cmd="speed"] { font-size: 11px; font-weight: 600; }

/* 上传/占位态（复用 .cr-media-ph），与图片占位一致 */
.cr-video-body .cr-media-ph { color: rgba(255,255,255,0.45); }

/* 生成中：节点左上角生成时长徽标（图片/视频节点） */
.cr-gen-time {
  position: absolute; top: -27px; right: 8px; left: auto; z-index: 6;
  padding: 2px 8px; border-radius: 8px;
  background: rgba(0,0,0,0.62); color: rgba(255,255,255,0.92);
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  pointer-events: none; backdrop-filter: blur(2px);
  white-space: nowrap;
}
.cr-image-body .cr-media-ph { color: rgba(255,255,255,0.45); }

/* 生成失败原因：节点视口内红色提示条（图片/视频/文本/音频节点共用） */
.cr-gen-error {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 7;
  display: flex; align-items: flex-start; gap: 6px;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(168, 24, 24, 0.9); color: #fff;
  font-size: 11px; line-height: 1.45; max-height: 70%; overflow: auto;
  border: 1px solid rgba(255,255,255,0.22);
  pointer-events: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.cr-gen-error-msg { flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.cr-gen-error-x {
  border: none; background: transparent; color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; opacity: .8; flex-shrink: 0;
}
.cr-gen-error-x:hover { opacity: 1; }

/* 图片节点 inner：小图/原图按缩放切换（无"原图"角标按钮） */
.cr-image-inner { position: relative; width: 100%; height: 100%; background: #0a0a0a; }
.cr-image-inner img.cr-image-rendered { background: #0a0a0a; }
.cr-image-inner img.cr-image-rendered { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── 参考选择弹窗（画布 / 我的资产 双 Tab）── */
.cr-ref-picker-mask {
  position: fixed; inset: 0; z-index: 12000;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
}
.cr-ref-picker-mask[hidden] { display: none; }
/* —— 参考选择弹窗：扁平简约，背景默认 #1c1c1c —— */
.cr-ref-picker {
  width: min(1040px, 94vw); height: min(720px, 90vh);
  background: var(--modal-bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: inherit;
}
.cr-ref-picker-head {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.cr-ref-picker-title { font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.95); letter-spacing: .01em; }
.cr-ref-picker-title u { text-decoration: none; color: #4ade80; }
.cr-ref-picker-tabs { display: flex; gap: 4px; margin-left: 4px; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 3px; }
.cr-ref-tab {
  padding: 6px 18px; border-radius: 6px; cursor: pointer;
  color: rgba(255,255,255,0.55); font-size: 13px; font-weight: 500;
  border: none; background: transparent; transition: all .15s;
}
.cr-ref-tab:hover { color: #fff; }
.cr-ref-tab.active { color: #fff; background: #2a2a2a; }
.cr-ref-picker-close {
  margin-left: auto; width: 34px; height: 34px; border-radius: 8px;
  border: none; cursor: pointer; background: transparent; color: rgba(255,255,255,0.55);
  font-size: 20px; transition: all .15s;
}
.cr-ref-picker-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

.cr-ref-picker-body { flex: 1; display: flex; flex-direction: column; padding: 18px 24px 20px; overflow: hidden; }
.cr-ref-picker-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.cr-ref-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cr-ref-chip {
  padding: 5px 14px; border-radius: 6px; cursor: pointer;
  color: rgba(255,255,255,0.55); font-size: 12.5px; border: 1px solid rgba(255,255,255,0.07);
  background: transparent; transition: all .15s;
}
.cr-ref-chip:hover { color: #fff; background: rgba(255,255,255,0.05); }
.cr-ref-chip.active { color: #fff; background: rgba(74,222,128,0.14); border-color: rgba(74,222,128,0.35); }

.cr-ref-picker-search {
  display: flex; align-items: center; gap: 7px; margin-left: auto;
  background: var(--modal-bg); border: 1px solid var(--modal-border);
  border-radius: 8px; padding: 0 12px; height: 34px;
  transition: border-color .15s;
}
.cr-ref-picker-search:focus-within { border-color: rgba(74,222,128,0.4); }
.cr-ref-picker-search input {
  background: var(--surface-2); border: 1px solid var(--border); outline: none; color: var(--text);
  font-size: 13px; width: 160px; border-radius: 8px; padding: 7px 10px;
}
.cr-size-picker-popup input[type="number"], .cr-size-picker-popup input[type="text"] {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; outline: none;
}
.cr-ref-picker-search input:focus, .cr-size-picker-popup input:focus { border-color: var(--neon); }
html[data-theme="light"] .cr-ref-picker-search input,
html[data-theme="light"] .cr-size-picker-popup input[type="number"],
html[data-theme="light"] .cr-size-picker-popup input[type="text"] { background: #fff; color: #111; }
.cr-ref-picker-search input::placeholder { color: rgba(255,255,255,0.35); }
.cr-ref-picker-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.35); flex-shrink: 0; }
.cr-ref-picker-sort {
  background: #232323; border: 1px solid var(--border);
  border-radius: 8px; color: rgba(255,255,255,0.7); font-size: 12.5px;
  padding: 7px 12px; cursor: pointer; outline: none;
}

.cr-ref-picker-grid {
  flex: 1; overflow-y: auto; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px; align-content: start; padding: 2px;
}
.cr-ref-picker-grid::-webkit-scrollbar { width: 8px; }
.cr-ref-picker-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.cr-ref-picker-grid::-webkit-scrollbar-track { background: transparent; }

.cr-ref-item {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: #232323;
  aspect-ratio: 1/1; display: flex; flex-direction: column;
  transition: all .15s;
}
.cr-ref-item:hover { border-color: rgba(74,222,128,0.45); transform: translateY(-2px); }
.cr-ref-item .cr-ref-item-thumb {
  flex: 1; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center;
  background: var(--modal-bg); overflow: hidden;
}
.cr-ref-item .cr-ref-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-ref-item .cr-ref-item-thumb svg { width: 30px; height: 30px; color: rgba(255,255,255,0.35); }
.cr-ref-item .cr-ref-item-name {
  padding: 6px 9px; font-size: 11px; color: rgba(255,255,255,0.82);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #232323;
}
.cr-ref-item .cr-ref-item-tag {
  position: absolute; top: 7px; left: 7px; font-size: 10px; color: #fff;
  background: rgba(74,222,128,0.22); border: none; border-radius: 4px; padding: 1px 6px;
}
.cr-ref-item .cr-ref-item-type {
  position: absolute; bottom: 27px; right: 6px; font-size: 10px; color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5); border-radius: 4px; padding: 1px 6px;
}

/* 本地上传按钮（画布 tab 第一个） */
.cr-ref-upload-item {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 1px dashed rgba(74,222,128,0.35); background: rgba(74,222,128,0.05);
  aspect-ratio: 1/1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: rgba(74,222,128,0.85); transition: all .15s;
}
.cr-ref-upload-item:hover { background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.6); }
.cr-ref-upload-item svg { width: 30px; height: 30px; }
.cr-ref-upload-item span { font-size: 12px; font-weight: 500; }

.cr-ref-picker-empty {
  grid-column: 1 / -1; text-align: center; color: rgba(255,255,255,0.4);
  font-size: 13px; padding: 60px 0;
}

/* ── 媒体查看器（图片/视频/文本 + 元数据信息栏）── */
.cr-media-viewer-mask {
  position: fixed; inset: 0; z-index: 13000;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cr-media-viewer-mask[hidden] { display: none; }
/* 媒体查看器：全屏占满视口；容器半透磨砂，透出画布背景 */
.cr-media-viewer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: rgba(18,18,20,0.30);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none; border-radius: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.cr-media-viewer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}
.cr-mv-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.cr-mv-meta-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,0.55); white-space: nowrap; }
/* 标签灰色、值白色（与设计稿一致：名称: 灰色 / 图片: 白色） */
.cr-mv-meta-item b { font-weight: 500; color: rgba(148,163,184,0.75); }
.cr-mv-meta-item span { color: rgba(255,255,255,0.95); }
.cr-mv-meta-src .cr-mv-src-pill {
  padding: 1px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(168,85,247,0.18); border: 1px solid rgba(168,85,247,0.45); color: #d8b4fe;
  text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.cr-mv-meta-src .cr-mv-src-pill:hover { background: rgba(168,85,247,0.30); border-color: rgba(168,85,247,0.7); color: #fff; }
.cr-mv-meta-src .cr-mv-src-pill::after { content: '↗'; font-size: 10px; opacity: .8; }
/* 提示词标签 + 复制按钮 + 悬停浮层 */
.cr-mv-meta-prompt { max-width: 420px; }
.cr-mv-prompt-tag {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; font-size: 11.5px; cursor: default;
  background: rgba(148,163,184,0.14); border: 1px solid rgba(148,163,184,0.32); color: rgba(255,255,255,0.9);
}
.cr-mv-prompt-tag:hover { background: rgba(148,163,184,0.24); border-color: rgba(148,163,184,0.5); }
.cr-mv-copy-btn {
  width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.75); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.cr-mv-copy-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.cr-mv-copy-btn svg { width: 13px; height: 13px; }
.cr-mv-prompt-tip {
  position: fixed; z-index: 14000; max-width: 320px; max-height: 200px; overflow: auto;
  padding: 8px 10px; border-radius: 10px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  background: rgba(24,25,30,0.96); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.92);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.cr-mv-tools { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cr-mv-tool {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.cr-mv-tool:hover { background: rgba(255,255,255,0.12); color: #fff; }
.cr-mv-zoom-val { min-width: 52px; text-align: center; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.85); }
.cr-mv-sep { width: 1px; height: 18px; background: rgba(255,255,255,0.14); margin: 0 4px; }
.cr-media-viewer-close {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.cr-media-viewer-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.cr-media-viewer-body {
  flex: 1; display: flex; min-height: 0;
}
.cr-media-viewer-stage {
  flex: 1; min-width: 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,20,22,0.22);
}
.cr-media-viewer-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.cr-media-viewer-stage .cr-mv-zoom {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; line-height: 0;
  will-change: transform; cursor: grab; user-select: none;
}
.cr-media-viewer-stage .cr-mv-zoom img { display: block; max-width: none; max-height: none; border-radius: 2px; }
.cr-media-viewer-stage.cr-mv-dragging { cursor: grabbing; }
.cr-media-viewer-stage.cr-mv-dragging .cr-mv-zoom { cursor: grabbing; }
.cr-media-viewer-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.cr-media-viewer-stage .cr-mv-text { max-width: 100%; max-height: 100%; overflow: auto; white-space: pre-wrap; word-break: break-word; color: rgba(255,255,255,0.88); font-size: 14px; line-height: 1.65; }
.cr-media-viewer-stage .cr-mv-empty { color: rgba(255,255,255,0.4); font-size: 14px; }
.cr-media-viewer-info {
  width: 260px; flex-shrink: 0; border-left: 1px solid rgba(255,255,255,0.07);
  padding: 16px; overflow-y: auto; background: rgba(25,25,27,0.26);
}
.cr-mv-info-title { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); margin-bottom: 12px; }
.cr-mv-info-list { display: flex; flex-direction: column; gap: 10px; }
.cr-mv-info-row { display: flex; align-items: flex-start; gap: 8px; }
.cr-mv-info-row .cr-mv-k { width: 42px; flex-shrink: 0; font-size: 12px; color: rgba(255,255,255,0.45); padding-top: 1px; }
.cr-mv-info-row .cr-mv-v { font-size: 12px; color: rgba(255,255,255,0.82); word-break: break-all; }
.cr-mv-info-row a.cr-mv-v { color: #5eb0ff; text-decoration: none; }
.cr-mv-info-row a.cr-mv-v:hover { text-decoration: underline; }

/* ── Sonner 风格 toast 提示 ── */
#crToastContainer {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 99999; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.cr-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--modal-bg); border: 1px solid var(--modal-border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  font-size: 13px; line-height: 1.5; color: var(--text);
  pointer-events: auto; white-space: normal; word-break: break-word;
  max-width: min(560px, calc(100vw - 40px));
  opacity: 0; transform: translateY(12px); transition: all .22s cubic-bezier(.22,.61,.36,1);
}
.cr-toast-enter { opacity: 1; transform: translateY(0); }
.cr-toast-exit { opacity: 0; transform: translateY(-8px); transition: all .18s ease-in; }
.cr-toast-icon { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.cr-toast-info .cr-toast-icon { background: rgba(96,165,250,0.18); color: #60a5fa; }
.cr-toast-success .cr-toast-icon { background: rgba(74,222,128,0.18); color: #4ade80; }
.cr-toast-warning .cr-toast-icon { background: rgba(251,191,36,0.18); color: #fbbf24; }
.cr-toast-error .cr-toast-icon { background: rgba(248,113,113,0.18); color: #f87171; }
.cr-toast-msg { flex: 1; min-width: 0; }

/* ============ ComfyUI 工作流暴露参数（画布节点，样式与提示词面板一致） ============ */
  .cr-comfy-fields {
    margin-top: 10px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
    max-height: none; overflow: visible; /* 工作流参数不设滚动框，完整展开 */
    border: 1px solid var(--border, rgba(255,255,255,0.10)); border-radius: 12px;
    background: var(--modal-bg, #1c1c1c);
  }
  html[data-theme="light"] .cr-comfy-fields { border-color: rgba(0,0,0,0.12); }
  .cr-comfy-fields-title {
    font-size: 11.5px; font-weight: 700; color: var(--text-dim, #9ca3af);
    text-transform: uppercase; letter-spacing: .06em;
    display: flex; align-items: center; gap: 6px;
  }
  .cr-comfy-fields-title::before { content: ''; width: 3px; height: 11px; border-radius: 2px; background: var(--neon, #4ade80); }
  .cr-comfy-managed {
    font-size: 11px; color: var(--text-muted, #6b7280); line-height: 1.4;
    padding: 5px 8px; border-radius: 8px; background: rgba(74,222,128,0.06);
    border: 1px dashed rgba(74,222,128,0.22);
  }
  .cr-comfy-empty { font-size: 11.5px; color: var(--text-muted, #6b7280); padding: 4px 0; }
  .cr-comfy-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  /* 工作流参数分栏：上传内容 / 补充输入与规格 / 其他设置（视频三栏，图片音频两栏） */
  .cr-comfy-fields-cols { display: grid; gap: 14px; align-items: start; }
  .cr-comfy-fields-cols.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cr-comfy-fields-cols.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-comfy-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .cr-comfy-col + .cr-comfy-col { border-left: 1px solid rgba(255,255,255,0.10); padding-left: 14px; }
  .cr-comfy-col-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--text-muted,#94a3b8); }
  .cr-comfy-col-title::before { content: ''; width: 3px; height: 10px; border-radius: 2px; background: var(--neon, #4ade80); }
  /* 工作流选择器（显示在“工作流参数”区域顶部） */
  .cr-comfy-workflow-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.16); }
  html[data-theme="light"] .cr-comfy-workflow-bar { border-bottom-color: rgba(0,0,0,0.16); }
  .cr-comfy-workflow-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted, #94a3b8); flex: none; }
  .cr-comfy-workflow-slot { display: inline-flex; align-items: center; min-width: 0; }
  .cr-comfy-workflow-bar .ui-select-trigger {
    height: 28px; padding: 0 8px; font-size: 12.5px; gap: 5px;
    border: 1px solid rgba(255,255,255,0.14); border-radius: 8px;
    background: rgba(255,255,255,0.05); color: var(--text, #e5e7eb);
  }
  .cr-comfy-workflow-bar .ui-select.open .ui-select-trigger { border-color: var(--neon-glow, rgba(74,222,128,0.4)); color: var(--neon-bright, #86efac); }
  html[data-theme="light"] .cr-comfy-workflow-bar .ui-select-trigger { background: #fff; border-color: rgba(0,0,0,0.15); color: #111827; }
  html[data-theme="light"] .cr-comfy-workflow-bar .ui-select.open .ui-select-trigger { color: #15803d; }
  .cr-comfy-col-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .cr-comfy-col .cr-comfy-field-text textarea { min-height: 52px; }
  html[data-theme="light"] .cr-comfy-col + .cr-comfy-col { border-left-color: rgba(0,0,0,0.10); }
  .cr-comfy-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .cr-comfy-field-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
  .cr-comfy-field-text { grid-column: 1 / -1; }
  .cr-comfy-field-media { grid-column: 1 / -1; }
  .cr-comfy-field-name { font-size: 11.5px; color: var(--text-muted,#94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cr-comfy-field textarea, .cr-comfy-field select, .cr-comfy-field input[type="number"], .cr-comfy-field input[type="text"] {
    width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; color: var(--text,#e5e7eb); font-size: 12px; padding: 6px 8px; outline: none;
    transition: border-color .15s ease, background .15s ease;
  }
  .cr-comfy-field-row input[type="number"], .cr-comfy-field-row input[type="text"], .cr-comfy-field-row select { width: 150px; }
  .cr-comfy-field-row .cr-comfy-field-name { flex: 1; }
  html[data-theme="light"] .cr-comfy-field textarea, html[data-theme="light"] .cr-comfy-field select,
  html[data-theme="light"] .cr-comfy-field input[type="number"], html[data-theme="light"] .cr-comfy-field input[type="text"] {
    background: #fff; border-color: rgba(0,0,0,0.15); color: #111827;
  }
  .cr-comfy-field textarea:focus, .cr-comfy-field input:focus, .cr-comfy-field select:focus { border-color: var(--neon-glow, rgba(74,222,128,0.4)); }
  /* 工作流媒体字段：工作流需要几张图就显示几个框（左对齐，无 + 添加按钮，空框点击可上传） */
  .cr-comfy-media-slots { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .cr-comfy-media-slot {
    position: relative; width: 52px; height: 52px; border-radius: 9px; overflow: hidden;
    display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.12);
    transition: border-color .15s ease, background .15s ease;
  }
  .cr-comfy-media-slot:hover { border-color: rgba(125,211,252,0.55); background: rgba(255,255,255,0.06); }
  .cr-comfy-media-slot.has-value { border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); cursor: default; }
  .cr-comfy-media-slot img,
  .cr-comfy-media-slot .cr-comfy-media-slot-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 4px; }
  html[data-theme="light"] .cr-comfy-media-slot { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.14); }
  html[data-theme="light"] .cr-comfy-media-slot:hover { background: rgba(0,0,0,0.08); }
  html[data-theme="light"] .cr-comfy-media-slot.has-value { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.14); }
  .cr-comfy-media-ico { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-muted,#94a3b8); font-size: 22px; }
.cr-comfy-media-ico svg { width: 15px; height: 15px; color: var(--text-muted,#94a3b8); }
  .cr-comfy-media-x { display: none !important; }
  /* 布尔开关：复用系统 Switch 组件（滑块式） */
  .cr-comfy-switch { position: relative; display: inline-flex; cursor: pointer; user-select: none; }
  .cr-comfy-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
  .cr-comfy-switch-slider { position: relative; width: 34px; height: 18px; border-radius: 999px; background: rgba(148,163,184,0.35); border: 1px solid rgba(148,163,184,0.5); transition: background .15s ease, border-color .15s ease; }
  .cr-comfy-switch-slider::before { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; transition: transform .15s ease, background .15s ease; }
  .cr-comfy-switch input:checked + .cr-comfy-switch-slider { background: var(--neon, #4ade80); border-color: var(--neon, #4ade80); }
  .cr-comfy-switch input:checked + .cr-comfy-switch-slider::before { transform: translateX(16px); background: #fff; }
  html[data-theme="light"] .cr-comfy-switch-slider { background: #cbd5e1; border-color: #94a3b8; }
  html[data-theme="light"] .cr-comfy-switch-slider::before { background: #64748b; }
  html[data-theme="light"] .cr-comfy-switch input:checked + .cr-comfy-switch-slider { background: #15803d; border-color: #15803d; }
  html[data-theme="light"] .cr-comfy-switch input:checked + .cr-comfy-switch-slider::before { background: #fff; }
  /* 旧胶囊开关样式保留（不再使用） */
  .cr-comfy-toggle { display: inline-flex; border: 1px solid rgba(255,255,255,0.14); border-radius: 999px; overflow: hidden; }
  .cr-comfy-toggle-btn {
    border: none; background: transparent; color: var(--text-muted,#94a3b8);
    font-size: 11.5px; padding: 3px 12px; cursor: pointer; transition: all .15s ease;
  }
  .cr-comfy-toggle-btn.active { background: var(--neon, #4ade80); color: #07120a; font-weight: 700; }

/* ============ 音频节点（样式对齐图片/视频节点，不可缩放） ============ */
  .cr-audio-body {
    position: relative;
    width: 100%; min-height: 64px; aspect-ratio: 16 / 9;
    background: #0a0a0a;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; border-radius: 10px;
  }
  .cr-audio-body audio.cr-audio-el {
    width: 100%; display: block; padding: 0 10px; box-sizing: border-box;
  }
  .cr-audio-body .cr-media-ph { color: rgba(255,255,255,0.45); }
  .cr-audio-node .cr-node-card { cursor: default; }

html[data-theme="light"] .cr-toast { background: #ffffff; border-color: rgba(0,0,0,0.12); color: #111827; }

html[data-theme="light"] .cr-cs-dropdown,
html[data-theme="light"] .cr-size-picker-popup,
html[data-theme="light"] .cr-mention-menu {
  background: rgba(255,255,255,0.86);
  border-color: rgba(0,0,0,0.12);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}
/* 大弹窗与节点工具栏保持实底（毛玻璃只用于菜单/下拉/悬浮预览） */
html[data-theme="light"] .cr-ref-picker,
html[data-theme="light"] .cr-node-text-toolbar { background: #ffffff; border-color: rgba(0,0,0,0.12); }
/* @提及菜单：浅色下文字颜色修正（配合磨砂半透明白底） */
html[data-theme="light"] .cr-mention-menu-title { color: #6b7280; }
html[data-theme="light"] .cr-mention-menu-item { color: #1f2937; }
html[data-theme="light"] .cr-mention-menu-item:hover,
html[data-theme="light"] .cr-mention-menu-item.active { background: rgba(0,0,0,0.06); }
html[data-theme="light"] .cr-mention-menu-item i.mi-t,
html[data-theme="light"] .cr-mention-menu-item i.mi-v,
html[data-theme="light"] .cr-mention-menu-item i.mi-a,
html[data-theme="light"] .cr-mention-menu-item i.mi-i { color: #374151; background: rgba(0,0,0,0.06); }
html[data-theme="light"] .cr-mention-menu-txt { color: #111827; }
html[data-theme="light"] .cr-mention-menu-name { color: #6b7280; }
html[data-theme="light"] .cr-context-menu .cm-item { color: #374151; }
html[data-theme="light"] .cr-context-menu .cm-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
html[data-theme="light"] .cr-context-menu .cm-item.danger { color: #dc2626; }

/* ============ 提示词输入：+ / @ 快捷栏 + 引用 chip 精细化 ============ */
  .cr-prompt-quickbar { display: flex; gap: 6px; margin-top: 6px; padding-left: 2px; }
  .cr-prompt-qb {
    width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
    font-size: 14px; font-weight: 700; cursor: pointer; transition: color .15s, border-color .15s;
  }
  .cr-prompt-qb:hover { color: var(--neon-bright); border-color: var(--neon-glow); }
  .cr-prompt-qb svg { width: 14px; height: 14px; }
  html[data-theme="light"] .cr-prompt-qb { background: #fff; color: #374151; }
  html[data-theme="light"] .cr-prompt-qb:hover { color: #15803d; }

  .cr-mention-chip {
    display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
    padding: 1px 8px; margin: 0 2px;
    background: var(--neon-dim); border: 1px solid var(--neon-glow);
    border-radius: 999px; color: var(--neon-bright); font-size: 12px; line-height: 1.6;
    cursor: default; user-select: none; outline: none;
  }
  html[data-theme="light"] .cr-mention-chip { color: #15803d; }
  .cr-mention-chip:hover { background: var(--neon-dim); border-color: var(--neon-glow); }



/* 亮色主题：应用内对比度修正（画布主体保持深色播放区） */
html[data-theme="light"] .cr-ref-label { color: #111; text-shadow: none; background: linear-gradient(transparent, rgba(0,0,0,0.05) 30%, rgba(0,0,0,0.14)); }
html[data-theme="light"] .cr-media-ph { color: rgba(0,0,0,0.45); }
html[data-theme="light"] .cr-image-body .cr-media-ph { color: rgba(0,0,0,0.45); }
html[data-theme="light"] .cr-ref-thumb, html[data-theme="light"] .cr-ref-text-item { background: #fff; border-color: rgba(0,0,0,0.16); }
html[data-theme="light"] .cr-node-text-toolbar button { color: #1f2937; }
html[data-theme="light"] .ai-model-fetch-item em { border-color: rgba(0,0,0,0.16); color: #52525b; }
html[data-theme="light"] .cr-ref-media-icon { color: rgba(0,0,0,0.5); }

/* ── 节点内直接编辑（裁剪/标注，不弹窗）── */
.cr-node-edit-stage { position: absolute; inset: 0; z-index: 6; overflow: hidden; }
.cr-node-edit-stage.cr-img-crop-stage { box-shadow: none; }
.cr-node-edit-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
/* 浮动条样式与节点间距均与提示词输入面板（Prompt Pro）一致 */
.cr-node-edit-bar {
  position: absolute;
  top: calc(100% + var(--node-panel-gap, 25px) / var(--cr-scale, 1));
  left: 50%;
  transform: translateX(-50%) scale(calc(1 / var(--cr-scale, 1))) translateZ(0);
  transform-origin: top center;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 16px; z-index: 80;
  background: var(--modal-bg, #1c1c1c); border: 1px solid var(--border, rgba(255,255,255,0.10));
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 4px 14px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.cr-node-edit-bar.cr-img-annotate-toolbar { background: var(--modal-bg, #1c1c1c); border-color: var(--border, rgba(255,255,255,0.10)); }
.cr-node-edit-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 4px; }
.cr-node-edit-bar .cr-img-crop-ratios { gap: 6px; }
.cr-node-edit-bar .cr-img-crop-ratio { padding: 5px 12px; font-size: 12px; }
.cr-node-edit-bar .cr-img-crop-size { position: static; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); }

/* ============ 无限画布 · 浅色主题（透亮干净） ============ */
html[data-theme="light"] .cr-app { background: #fbfcfd; border-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-topbar { background: rgba(255,255,255,0.9); border-bottom-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-library { background: rgba(255,255,255,0.86); border-right-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-library-title::before { box-shadow: 0 0 6px rgba(22,163,74,0.25); }
html[data-theme="light"] .cr-library-add { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.32); color: #15803d; }
html[data-theme="light"] .cr-library-add:hover { background: rgba(22,163,74,0.16); }
html[data-theme="light"] .cr-library-hint { color: #9ca3af; border-top-color: rgba(0,0,0,0.08); }

/* 左侧项目树 */
html[data-theme="light"] .cr-tree-row { background: rgba(0,0,0,0.02); border-color: transparent; color: #3f4a45; }
html[data-theme="light"] .cr-tree-row:hover { background: rgba(0,0,0,0.05); border-color: transparent; color: #111827; }
html[data-theme="light"] .cr-tree-row.active { background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.30); color: #15803d; box-shadow: none; }
html[data-theme="light"] .cr-tree-folder > .cr-tree-row .cr-tree-icon { color: #d97706; }
html[data-theme="light"] .cr-tree-project > .cr-tree-row .cr-tree-icon { color: #16a34a; }
html[data-theme="light"] .cr-tree-arrow { color: #6b7280; }
html[data-theme="light"] .cr-tree-btn { color: #6b7280; background: transparent; border-color: transparent; }
html[data-theme="light"] .cr-tree-btn:hover { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.10); color: #111827; }
html[data-theme="light"] .cr-tree-btn.add:hover { color: #15803d; background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.30); }
html[data-theme="light"] .cr-tree-btn.del:hover { color: #dc2626; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.22); }

/* 顶部面包屑 / 空态 */
html[data-theme="light"] .cr-browser-header { background: rgba(255,255,255,0.85); border-bottom-color: rgba(0,0,0,0.08); color: #374151; }
html[data-theme="light"] .cr-crumb { color: #374151; }
html[data-theme="light"] .cr-crumb:hover { color: #15803d; background: rgba(22,163,74,0.08); }
html[data-theme="light"] .cr-empty { background: rgba(255,255,255,0.45); }

/* 层级画布节点卡（文件夹/项目/画面） */
html[data-theme="light"] .cr-level-folder { background: linear-gradient(135deg, #ffffff, #f4f8f6 55%, #ecf5f0); border-color: rgba(0,0,0,0.10); box-shadow: 0 14px 34px rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-level-folder .cr-ln-icon { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.10); color: #374151; }
html[data-theme="light"] .cr-level-folder .cr-ln-item-chip { background: rgba(0,0,0,0.05); color: #4b5563; border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-level-project { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.10); box-shadow: 0 14px 34px rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-level-project .cr-ln-icon { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.25); color: #15803d; }
html[data-theme="light"] .cr-level-project { background: rgba(255,255,255,0.97); border-color: rgba(0,0,0,0.1); box-shadow: 0 14px 34px rgba(15,23,42,0.1); }
html[data-theme="light"] .cr-level-project .cr-ln-cover { background: radial-gradient(rgba(0,0,0,0.05) 1px, transparent 1px) 0 0/14px 14px, linear-gradient(165deg, rgba(22,163,74,0.12), rgba(243,244,246,0.95) 70%); }
html[data-theme="light"] .cr-level-project .cr-ln-cover-ph { color: rgba(15,23,42,0.35); }
html[data-theme="light"] .cr-level-project .cr-ln-title { color: #111827; }
html[data-theme="light"] .cr-level-project .cr-ln-meta { color: #6b7280; }
html[data-theme="light"] .cr-level-project .cr-ln-status { background: rgba(22,163,74,0.12); color: #15803d; border-color: rgba(22,163,74,0.25); }
html[data-theme="light"] .cr-level-project .cr-ln-dot { background: #16a34a; box-shadow: 0 0 6px rgba(22,163,74,0.7); }
html[data-theme="light"] .cr-level-project .cr-ln-time { color: #9ca3af; }
html[data-theme="light"] .cr-level-project .cr-ln-share { color: #111827; background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); }
html[data-theme="light"] .cr-level-project .cr-ln-share:hover { background: rgba(0,0,0,0.1); }
html[data-theme="light"] .cr-level-scene { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.10); box-shadow: 0 14px 34px rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-level-node.selected { box-shadow: 0 0 0 2px rgba(22,163,74,0.35), 0 12px 28px rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-level-node.dragging, html[data-theme="light"] .cr-level-node.drop-target { box-shadow: 0 0 0 3px rgba(22,163,74,0.50), 0 14px 30px rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-ln-menu-btn { color: #6b7280; background: rgba(255,255,255,0.75); border-color: rgba(0,0,0,0.12); }

/* 底部工具条 / 左侧工具箱 / 节点库 */
html[data-theme="light"] .cr-bottom-bar { background: rgba(255,255,255,0.96); box-shadow: 0 12px 30px rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-bb-divider { background: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-bb-btn { color: #374151; }
html[data-theme="light"] .cr-bb-zoom-value { color: #4b5563; }
html[data-theme="light"] .cr-bb-btn:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-bb-btn.active { color: #15803d; background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.25); }
html[data-theme="light"] .cr-bb-zoom input[type="range"] { background: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-canvas-toolbox { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.10); box-shadow: 0 12px 30px rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-ctb-btn { color: #374151; }
html[data-theme="light"] .cr-ctb-btn:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-node-palette { background: rgba(255,255,255,0.98); border-color: rgba(0,0,0,0.10); box-shadow: 0 18px 44px rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-np-search input { background: #ffffff; border-color: rgba(0,0,0,0.12); color: #111827; }

/* 节点卡片 */
html[data-theme="light"] .cr-node { background: #ffffff; border-color: rgba(0,0,0,0.08); box-shadow: 0 10px 26px rgba(0,0,0,0.06); }
html[data-theme="light"] .cr-node:hover { border-color: rgba(0,0,0,0.18); box-shadow: 0 14px 30px rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-node.selected { box-shadow: 0 14px 30px rgba(0,0,0,0.08), 0 0 0 1px var(--node-color), 0 0 20px color-mix(in srgb, var(--node-color) 26%, transparent); }
html[data-theme="light"] .cr-node-body { background: rgba(255,255,255,0.55); }
html[data-theme="light"] .cr-image-body { background: #eef1f3; }
html[data-theme="light"] .cr-image-inner { background: #eef1f3; }
html[data-theme="light"] .cr-image-inner img.cr-image-rendered { background: #eef1f3; }
html[data-theme="light"] .cr-image-body .cr-media-ph { color: #94a3b8; }
html[data-theme="light"] .cr-node-footer { background: rgba(0,0,0,0.03); border-top-color: rgba(0,0,0,0.06); }
html[data-theme="light"] .cr-node-header .cr-node-title, html[data-theme="light"] .cr-node-title[contenteditable="true"] { color: #111827; }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-label { color: #111827; }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-label-icon { color: #6b7280; }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card { border-color: rgba(0,0,0,0.10); box-shadow: 0 10px 26px rgba(0,0,0,0.06); }
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card { border-color: rgba(0,0,0,0.24); }
html[data-theme="light"] .cr-node-input textarea { color: #374151; }

/* AI 悬浮球：浅色更收敛 */
html[data-theme="light"] .cr-agent-fab { filter: drop-shadow(0 6px 14px rgba(22,163,74,0.18)); }
html[data-theme="light"] .cr-agent-fab-glow {
  background: radial-gradient(circle at 35% 30%, rgba(220,252,231,0.98), rgba(74,222,128,0.55) 45%, rgba(22,163,74,0.42) 80%);
  box-shadow: inset -2px -2px 6px rgba(0,0,0,0.08), inset 2px 2px 8px rgba(255,255,255,0.7), 0 0 12px rgba(22,163,74,0.16);
}

/* ── 浅色主题 · 细节收敛（返回按钮 / 阴影 / 图标对比 / FAB）── */
html[data-theme="light"] .cr-back-browse {
  background: rgba(255,255,255,0.92); backdrop-filter: blur(10px);
  border-color: rgba(0,0,0,0.12); color: #1f2937;
  box-shadow: 0 6px 18px rgba(17,24,39,0.10);
}
html[data-theme="light"] .cr-back-browse:hover {
  border-color: rgba(22,163,74,0.45); color: #15803d; background: rgba(255,255,255,0.98);
}
html[data-theme="light"] .cr-back-browse svg { color: #374151; }

/* 节点阴影进一步柔化（带一点冷色调环境光） */
html[data-theme="light"] .cr-node {
  box-shadow: 0 8px 22px rgba(15,23,42,0.05), 0 1px 3px rgba(15,23,42,0.04);
}
html[data-theme="light"] .cr-node:hover {
  box-shadow: 0 12px 26px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.04);
}
html[data-theme="light"] .cr-node.selected {
  box-shadow: 0 12px 26px rgba(15,23,42,0.08), 0 0 0 1px var(--node-color), 0 0 20px color-mix(in srgb, var(--node-color) 22%, transparent);
}
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card {
  box-shadow: 0 8px 22px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
}
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card {
  box-shadow: 0 12px 26px rgba(15,23,42,0.08), 0 1px 3px rgba(15,23,42,0.04);
}
html[data-theme="light"] .cr-level-folder,
html[data-theme="light"] .cr-level-project,
html[data-theme="light"] .cr-level-scene {
  box-shadow: 0 10px 24px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
}

/* 工具栏图标对比度加深 */
html[data-theme="light"] .cr-ctb-btn { color: #1f2937; }
html[data-theme="light"] .cr-ctb-btn svg { stroke: currentColor; }
html[data-theme="light"] .cr-ctb-btn.ctb-add {
  background: linear-gradient(135deg, #16a34a, #15803d 55%, #15803d);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(21,128,61,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
html[data-theme="light"] .cr-ctb-btn.ctb-add:hover {
  background: linear-gradient(135deg, #15803d, #166534 55%, #166534);
  color: #ffffff;
}

/* ---- 右侧 FF 智能体面板：浅色主题适配（原样式按深色硬编码，浅色下会灰底黑字/发白） ---- */
html[data-theme="light"] .cr-inspector {
  background: rgba(255,255,255,0.82);
  border-left: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
html[data-theme="light"] .cr-agent-header { border-bottom-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-agent-header-btn:hover,
html[data-theme="light"] .cr-agent-history-btn:hover { color: #111827; background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-agent-copy:hover { color: #15803d; background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.25); }
html[data-theme="light"] .cr-agent-history { background: rgba(255,255,255,0.96); }
html[data-theme="light"] .cr-agent-history-item { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-agent-history-item:hover { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.14); }
html[data-theme="light"] .cr-agent-history-item-del:hover { color: #dc2626; background: rgba(220,38,38,0.10); border-color: rgba(220,38,38,0.20); }
html[data-theme="light"] .cr-agent-node-inspector { background: rgba(0,0,0,0.02); }
html[data-theme="light"] .cr-agent-skill { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-agent-skill:hover { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.30); }
html[data-theme="light"] .cr-agent-skill-icon { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-agent-msg-avatar { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-agent-msg.user .cr-agent-msg-avatar { background: rgba(22,163,74,0.12); color: #15803d; border-color: rgba(22,163,74,0.25); }
html[data-theme="light"] .cr-agent-msg-bubble { background: rgba(0,0,0,0.05); color: #1f2937; }
html[data-theme="light"] .cr-agent-msg.user .cr-agent-msg-bubble { background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.25); color: #111827; }
html[data-theme="light"] .cr-agent-msg-actions { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .cr-agent-action-btn:hover { background: rgba(0,0,0,0.08); color: #111827; }
html[data-theme="light"] .cr-agent-action-btn.active { color: #15803d; background: rgba(22,163,74,0.12); }
html[data-theme="light"] .cr-agent-input { background: #ffffff; border-top-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-agent-warn { color: #b45309; }
html[data-theme="light"] .cr-agent-struct div { color: #15803d; }
html[data-theme="light"] .cr-agent-wf { border-color: rgba(22,163,74,0.35); background: rgba(22,163,74,0.06); }
html[data-theme="light"] .cr-agent-wf-head { color: #15803d; }
html[data-theme="light"] .cr-bb-btn { color: #1f2937; }
html[data-theme="light"] .cr-bb-btn svg { stroke: currentColor; }
html[data-theme="light"] .cr-bb-zoom-value { color: #374151; }

/* 右下角智能体 FAB：颜色加深、眼睛更清晰 */
html[data-theme="light"] .cr-agent-fab { filter: drop-shadow(0 6px 14px rgba(22,163,74,0.22)); }
html[data-theme="light"] .cr-agent-fab-glow {
  background: radial-gradient(circle at 35% 30%, #d1fae5, #4ade80 42%, #16a34a 72%, #15803d 100%);
  box-shadow:
    inset -3px -3px 8px rgba(6,78,59,0.22),
    inset 3px 3px 10px rgba(255,255,255,0.55),
    0 0 14px rgba(22,163,74,0.22),
    0 0 30px rgba(22,163,74,0.10);
}
html[data-theme="light"] .cr-agent-fab-eye {
  background: #14532d;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85), inset 0 1px 1px rgba(0,0,0,0.25);
}
html[data-theme="light"] .cr-agent-fab::before { opacity: .4; }

/* ── 浅色主题 · 第二轮细节微调 ── */
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card {
  box-shadow: 0 8px 20px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.03);
}
html[data-theme="light"] .cr-node.cr-text-node.selected .cr-node-card {
  box-shadow: 0 12px 24px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04), 0 0 0 1px color-mix(in srgb, var(--node-color) 40%, transparent);
  outline-color: rgba(22,163,74,0.45);
}
html[data-theme="light"] .cr-bb-divider { background: rgba(0,0,0,0.18); }

/* ── 浅色主题 · 画布灰底点阵 + 面板毛玻璃 ── */
html[data-theme="light"] .cr-canvas-viewport {
  background-color: #e6e6e6; /* 用户指定：浅色画布底 #e6e6e6 */
  /* 浅色：更淡的光效（模板变量）+ 原有点阵 */
  background-image:
    radial-gradient(560px 560px at 12% -6%, var(--ambient-glow-a-light, rgba(22,163,74,0.12)), transparent 62%),
    radial-gradient(560px 560px at 106% -6%, var(--ambient-glow-b-light, rgba(8,145,178,0.10)), transparent 62%),
    radial-gradient(560px 560px at -6% 106%, var(--ambient-glow-b-light, rgba(8,145,178,0.10)), transparent 62%),
    radial-gradient(560px 560px at 106% 112%, var(--ambient-glow-a-light, rgba(22,163,74,0.12)), transparent 62%),
    radial-gradient(rgba(15,23,42,0.14) 1px, transparent 1px),
    radial-gradient(rgba(15,23,42,0.07) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 24px 24px, 48px 48px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 12px 12px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
  /* 画布背景不做毛玻璃，保持纯色点阵 */
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-theme="light"] .cr-canvas-viewport.cr-scene-editing {
  background-image:
    radial-gradient(rgba(15,23,42,0.14) 1px, transparent 1px),
    radial-gradient(rgba(15,23,42,0.07) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px;
  background-position: 0 0, 12px 12px;
  background-repeat: repeat, repeat;
}
html[data-theme="light"] .cr-level-scene .cr-ln-thumb {
  background: radial-gradient(rgba(15,23,42,0.10) 1px, transparent 1px) 0 0/12px 12px, rgba(15,23,42,0.03);
  border-color: rgba(0,0,0,0.10);
}

/* 毛玻璃：半透明白底 + 背景模糊，透出点阵画布 */
html[data-theme="light"] .cr-topbar,
html[data-theme="light"] .cr-library,
html[data-theme="light"] .cr-browser-header,
html[data-theme="light"] .cr-bottom-bar,
html[data-theme="light"] .cr-canvas-toolbox,
html[data-theme="light"] .cr-node-palette,
html[data-theme="light"] .cr-back-browse,
html[data-theme="light"] .cr-context-menu,
html[data-theme="light"] .cr-project-menu,
html[data-theme="light"] .cr-empty {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
html[data-theme="light"] .cr-topbar { background: rgba(255,255,255,0.58); }
html[data-theme="light"] .cr-library { background: rgba(255,255,255,0.56); }
html[data-theme="light"] .cr-browser-header { background: rgba(255,255,255,0.60); }
html[data-theme="light"] .cr-bottom-bar { background: rgba(255,255,255,0.64); }
html[data-theme="light"] .cr-canvas-toolbox { background: rgba(255,255,255,0.66); }
html[data-theme="light"] .cr-node-palette { background: rgba(255,255,255,0.68); }
html[data-theme="light"] .cr-back-browse { background: rgba(255,255,255,0.68); }
html[data-theme="light"] .cr-context-menu,
html[data-theme="light"] .cr-project-menu {
  background: rgba(255,255,255,0.86);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}
html[data-theme="light"] .cr-empty { background: rgba(255,255,255,0.55); }

/* ── 浅色主题 · 节点修正（背景#f3f3f3 / 阴影减淡 / 四角直角修复 / placeholder 可见） ── */
/* 文本/媒体节点外层强制透明无阴影：避免方形白底在圆角外露出四个直角 */
html[data-theme="light"] .cr-node.cr-text-node,
html[data-theme="light"] .cr-node.cr-text-node.cr-image-node,
html[data-theme="light"] .cr-node.cr-text-node.cr-video-node,
html[data-theme="light"] .cr-node.cr-text-node.cr-audio-node {
  background: transparent; border: none; box-shadow: none;
}
html[data-theme="light"] .cr-node.cr-text-node { border-radius: 22px; }
html[data-theme="light"] .cr-node.cr-text-node.cr-image-node,
html[data-theme="light"] .cr-node.cr-text-node.cr-video-node,
html[data-theme="light"] .cr-node.cr-text-node.cr-audio-node { border-radius: 14px; }

/* 通用节点（非文本）：背景 #f3f3f3、阴影更轻 */
html[data-theme="light"] .cr-node { background: #f3f3f3; }
html[data-theme="light"] .cr-node:not(.cr-text-node) { box-shadow: 0 4px 14px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.03); }
html[data-theme="light"] .cr-node:not(.cr-text-node):hover { box-shadow: 0 8px 20px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.03); }

/* 文本节点卡片：背景 #f3f3f3、边框更淡、阴影更轻 */
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card {
  background: #f3f3f3;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 4px 14px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.03);
}
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card {
  border-color: rgba(0,0,0,0.16);
  box-shadow: 0 8px 20px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.03);
}
html[data-theme="light"] .cr-node.cr-text-node.selected .cr-node-card {
  box-shadow: 0 10px 22px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.03), 0 0 0 1px color-mix(in srgb, var(--node-color) 42%, transparent);
}

/* 文本内容与 placeholder：浅色下深色文字 + 可见的占位灰字 */
html[data-theme="light"] .cr-node.cr-text-node .cr-text-area { color: #374151; }
html[data-theme="light"] .cr-node.cr-text-node .cr-text-area.is-empty::before,
html[data-theme="light"] .cr-node.cr-text-node .cr-text-area:empty::before { color: #9ca3af; }
html[data-theme="light"] .cr-node.cr-text-node .cr-text-area[contenteditable="true"] { background: rgba(0,0,0,0.04); }

/* 图片/视频/音频占位区与卡片同色系，略深一点区分 */
html[data-theme="light"] .cr-node.cr-text-node .cr-image-body,
html[data-theme="light"] .cr-node.cr-text-node .cr-video-body,
html[data-theme="light"] .cr-node.cr-text-node .cr-audio-body { background: #ececee; }

/* ── 浅色主题 · 节点边框/加号按钮/阴影减淡/菜单可见性 ── */
/* 默认节点边框：不再是白色/不可见，改为清晰的浅灰 */
html[data-theme="light"] .cr-node { border-color: rgba(0,0,0,0.14); }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card { border-color: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card { border-color: rgba(0,0,0,0.22); }

/* 两侧加号：默认白底深灰图标 + 轻阴影；悬停跟随节点颜色 */
.cr-node-side-add {
  background: rgba(255,255,255,0.96); color: #1f2937;
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: 0 2px 8px rgba(0,0,0,0.16);
}
.cr-node-side-add:hover {
  background: var(--node-color); color: #fff;
  border-color: color-mix(in srgb, var(--node-color) 65%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-color) 20%, transparent), 0 4px 12px rgba(0,0,0,0.18);
}
html[data-theme="light"] .cr-node-side-add {
  background: #fff; color: #374151;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 2px 8px rgba(15,23,42,0.10);
}
html[data-theme="light"] .cr-node-side-add:hover {
  background: var(--node-color); color: #fff; border-color: var(--node-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-color) 22%, transparent), 0 4px 10px rgba(15,23,42,0.12);
}
/* 文本节点加号：悬停同样跟随节点颜色（替换原先强制白色） */
.cr-node.cr-text-node .cr-node-side-add.visible:hover {
  transform: translate(-50%, -50%) scale(1.14);
  background: var(--node-color); color: #fff; border-color: var(--node-color);
}

/* 阴影整体减淡 */
html[data-theme="light"] .cr-node:not(.cr-text-node) { box-shadow: 0 2px 10px rgba(15,23,42,0.03), 0 1px 2px rgba(15,23,42,0.02); }
html[data-theme="light"] .cr-node:not(.cr-text-node):hover { box-shadow: 0 6px 16px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.02); }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card { box-shadow: 0 2px 10px rgba(15,23,42,0.03), 0 1px 2px rgba(15,23,42,0.02); }
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card { box-shadow: 0 6px 16px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.02); }
html[data-theme="light"] .cr-level-folder,
html[data-theme="light"] .cr-level-project,
html[data-theme="light"] .cr-level-scene { box-shadow: 0 6px 16px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.02); }
html[data-theme="light"] .cr-bottom-bar { box-shadow: 0 6px 18px rgba(15,23,42,0.08); }
html[data-theme="light"] .cr-canvas-toolbox { box-shadow: 0 6px 18px rgba(15,23,42,0.08); }
html[data-theme="light"] .cr-node-palette { box-shadow: 0 10px 26px rgba(15,23,42,0.10); }

html[data-theme="light"] .cr-ref-preview-pop {
  background: rgba(255,255,255,0.86);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 18px 48px rgba(0,0,0,0.18);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* 右键菜单：浅色磨砂毛玻璃（半透明白 + 背景模糊，透出画布点阵） */
html[data-theme="light"] .cr-context-menu,
html[data-theme="light"] .cr-context-submenu {
  background: rgba(255,255,255,0.86);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
}
html[data-theme="light"] .cr-context-menu .cm-item { color: #1f2937; }
html[data-theme="light"] .cr-context-menu .cm-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
html[data-theme="light"] .cr-context-menu .cm-item svg,
html[data-theme="light"] .cr-context-menu .cm-shortcut,
html[data-theme="light"] .cr-context-menu .cm-arrow,
html[data-theme="light"] .cr-context-menu .cm-group-title { color: #6b7280; }

/* 文本节点加号：深浅主题悬停统一跟随节点颜色；浅色默认白底 */
.cr-node.cr-text-node .cr-node-side-add.visible:hover {
  transform: translate(-50%, -50%) scale(1.14);
  background: var(--node-color); color: #fff; border-color: var(--node-color);
}
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add {
  background: #fff; color: #374151; border-color: rgba(0,0,0,0.10);
  box-shadow: 0 2px 8px rgba(15,23,42,0.10);
}
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover {
  background: var(--node-color); color: #fff; border-color: var(--node-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-color) 22%, transparent), 0 4px 10px rgba(15,23,42,0.12);
}

/* ── 浅色主题 · 加号改黑 + 节点边框改白 ── */
/* 加号按钮：白底 + 黑色加号，悬停保持黑色（不再跟随节点颜色） */
html[data-theme="light"] .cr-node-side-add,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add {
  background: #ffffff; color: #111111; border-color: rgba(0,0,0,0.10);
  box-shadow: 0 2px 8px rgba(15,23,42,0.10);
}
html[data-theme="light"] .cr-node-side-add:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover {
  background: #f3f4f6; color: #111111; border-color: rgba(0,0,0,0.20);
  box-shadow: 0 2px 8px rgba(15,23,42,0.12);
}
/* 深色主题：悬停也保持中性（白色圆底黑加号），不再变节点色 */
.cr-node-side-add:hover,
.cr-node.cr-text-node .cr-node-side-add.visible:hover {
  background: rgba(255,255,255,0.98); color: #111; border-color: rgba(255,255,255,0.8);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.10), 0 4px 12px rgba(0,0,0,0.18);
}

/* 节点默认边框：白色 */
html[data-theme="light"] .cr-node { border-color: #ffffff; }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card { border-color: #ffffff; }
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card { border-color: rgba(255,255,255,0.85); }

/* ── 浅色主题 · 节点悬停变亮 / 正文黑色 / 标题灰 ── */
html[data-theme="light"] .cr-node { background: #f3f3f3; }
html[data-theme="light"] .cr-node:hover { background: #fafafa; }
html[data-theme="light"] .cr-node.cr-text-node .cr-node-card { background: #f3f3f3; }
html[data-theme="light"] .cr-node.cr-text-node:hover .cr-node-card,
html[data-theme="light"] .cr-node.cr-text-node:focus-within .cr-node-card { background: #fafafa; }
/* 节点主体内容文字：黑色 */
html[data-theme="light"] .cr-node.cr-text-node .cr-text-area { color: #000000; }
html[data-theme="light"] .cr-node-input textarea,
html[data-theme="light"] .cr-text-area { color: #000000; }
/* 节点标题文字：#939393 */
html[data-theme="light"] .cr-node.cr-text-node .cr-node-label,
html[data-theme="light"] .cr-node-header .cr-node-title,
html[data-theme="light"] .cr-node-title[contenteditable="true"] { color: #939393; }

/* ── 浅色主题 · 加号按钮强制黑色（兜底，覆盖任何历史蓝色规则）── */
html[data-theme="light"] .cr-node-side-add,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add,
html[data-theme="light"] .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0,0,0,0.12) !important;
  box-shadow: 0 2px 8px rgba(15,23,42,0.10) !important;
}

/* ── 浅色主题 · 加号按钮改为黑色（黑底白+，覆盖之前误设的白色）── */
html[data-theme="light"] .cr-node-side-add,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add,
html[data-theme="light"] .cr-node-side-add.visible,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible,
html[data-theme="light"] .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node-side-add:hover {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.25) !important;
  box-shadow: 0 2px 8px rgba(15,23,42,0.18) !important;
}
html[data-theme="light"] .cr-node-side-add:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover {
  background: #1f2937 !important;
  color: #ffffff !important;
}

/* ── 浅色主题 · +号图标改为黑色（白底黑+，图标为黑色）── */
html[data-theme="light"] .cr-node-side-add,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add,
html[data-theme="light"] .cr-node-side-add.visible,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible,
html[data-theme="light"] .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node-side-add:hover {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0,0,0,0.12) !important;
  box-shadow: 0 2px 8px rgba(15,23,42,0.10) !important;
}
html[data-theme="light"] .cr-node-side-add svg,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add svg {
  color: #000000 !important;
  stroke: #000000 !important;
}

/* ── 浅色主题 · 悬停切换为黑底白+ ── */
html[data-theme="light"] .cr-node-side-add:hover,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover,
html[data-theme="light"] .cr-node-side-add.visible:hover {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.25) !important;
  box-shadow: 0 2px 8px rgba(15,23,42,0.18) !important;
}
html[data-theme="light"] .cr-node-side-add:hover svg,
html[data-theme="light"] .cr-node.cr-text-node .cr-node-side-add.visible:hover svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* ── ComfyUI 参数：媒体字段用图标显示（有值用主色 + 清除按钮） ── */
.cr-comfy-media-thumb {
  position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; flex-shrink: 0;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.12);
}
html[data-theme="light"] .cr-comfy-media-thumb { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); }
/* 有值也保持灰色小图标（已用缩略图展示时不显示图标） */
.cr-comfy-media-slot.has-value .cr-comfy-media-ico { color: var(--text-muted,#94a3b8); }

/* ── 浅色主题 · 节点工具栏悬停颜色（深色主题的白色 hover 在浅色下不可见） ── */
html[data-theme="light"] .cr-node-text-toolbar button:hover,
html[data-theme="light"] .cr-img-tb button:hover,
html[data-theme="light"] .cr-img-tb .cr-img-tb-more-item:hover {
  background: rgba(0,0,0,0.06) !important;
  color: #111827 !important;
}
html[data-theme="light"] .cr-node-text-toolbar .sep,
html[data-theme="light"] .cr-img-tb .sep { background: rgba(0,0,0,0.12); }
html[data-theme="light"] .cr-img-tb-custom-item:hover { background: rgba(0,0,0,0.05); }

/* ── 面包屑：项目名可点击返回项目 ── */
.crumbs .crumb-project { cursor: pointer; border-bottom: 1px dashed transparent; transition: all .15s ease; }
.crumbs .crumb-project:hover { border-bottom-color: currentColor; }

/* ── 项目管理树 · 重新设计 ── */
.cr-tree-row { border-radius: 10px; }
.cr-tree-row.active { position: relative; }
.cr-tree-row.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 3px; background: var(--neon-bright, #4ade80);
}
.cr-tree-count {
  flex-shrink: 0; font-size: 10px; line-height: 16px; padding: 0 6px; border-radius: 8px;
  color: var(--text-muted); background: rgba(255,255,255,0.06);
}
html[data-theme="light"] .cr-tree-count { background: rgba(0,0,0,0.05); color: #6b7280; }
.cr-tree-scene { display: block; }
.cr-tree-scene > .cr-tree-row { color: var(--text-dim); font-weight: 400; }
.cr-tree-scene > .cr-tree-row .cr-tree-icon { color: var(--text-muted); }
.cr-tree-scene > .cr-tree-row.active { color: var(--neon-bright); }
.cr-tree-scene > .cr-tree-row.active .cr-tree-icon { color: var(--neon-bright); }
.cr-tree-children { margin-left: 8px; border-left: none; padding-left: 2px; }
html[data-theme="light"] .cr-tree-children { border-left-color: transparent; }

/* ── 项目管理树 · 简洁设计（参考 Notion 风格：灰白、选中浅灰、悬停显示操作） ── */
.cr-tree-row {
  padding: 7px 10px; border-radius: 8px;
  background: transparent; border: none;
  color: var(--text-dim); font-weight: 500;
}
.cr-tree-row:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.cr-tree-row.active { background: rgba(255,255,255,0.09); color: var(--text); }
.cr-tree-row.active::before { display: none; } /* 去掉绿色左侧竖条 */
.cr-tree-folder > .cr-tree-row .cr-tree-icon,
.cr-tree-project > .cr-tree-row .cr-tree-icon { color: var(--text-muted); }
.cr-tree-row.active .cr-tree-icon { color: var(--text); }
.cr-tree-children { margin-left: 10px; border-left: none; padding-left: 0; }
html[data-theme="light"] .cr-tree-row { background: transparent; border: none; color: #4b5563; }
html[data-theme="light"] .cr-tree-row:hover { background: rgba(0,0,0,0.045); color: #111827; }
html[data-theme="light"] .cr-tree-row.active { background: rgba(0,0,0,0.07); color: #111827; box-shadow: none; }
html[data-theme="light"] .cr-tree-folder > .cr-tree-row .cr-tree-icon,
html[data-theme="light"] .cr-tree-project > .cr-tree-row .cr-tree-icon { color: #6b7280; }
html[data-theme="light"] .cr-tree-row.active .cr-tree-icon { color: #374151; }
html[data-theme="light"] .cr-tree-children { border-left: none; }

/* ── 项目管理树 · 按钮菜单重设计（扁平线性图标，参考截图） ── */
.cr-tree-actions {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 1px;
  padding: 0; border-radius: 8px;
  background: transparent; border: none; backdrop-filter: none;
  opacity: 0; transition: opacity .15s ease;
}
.cr-tree-row:hover .cr-tree-actions,
.cr-tree-row.active .cr-tree-actions { opacity: 1; }
.cr-tree-btn {
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center;
  background: transparent; border: none; color: var(--text-muted);
  font-size: 0; line-height: 1; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.cr-tree-btn svg { width: 15px; height: 15px; display: block; }
.cr-tree-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-tree-btn.add:hover { color: var(--neon-bright); background: rgba(74,222,128,0.12); }
.cr-tree-btn.del:hover { color: #f87171; background: rgba(239,68,68,0.12); }
html[data-theme="light"] .cr-tree-actions { background: transparent; border: none; }
html[data-theme="light"] .cr-tree-btn { color: #9ca3af; }
html[data-theme="light"] .cr-tree-btn:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-tree-btn.add:hover { color: #15803d; background: rgba(22,163,74,0.10); }
html[data-theme="light"] .cr-tree-btn.del:hover { color: #dc2626; background: rgba(239,68,68,0.10); }
/* 行距：更宽松，接近参考图 40px+ 行高 */
.cr-tree-row { padding: 9px 10px; }
.cr-tree-children { margin-left: 12px; }

/* ── 项目管理树 · 间距调整（箭头在右、行间留白、底纹不粘连） ── */
.cr-tree-row {
  margin: 2px 0;
  padding: 9px 10px;
  gap: 9px;
}
.cr-tree-row > .cr-tree-name { padding-right: 4px; }
.cr-tree-arrow { margin-left: 2px; }
.cr-tree-children {
  margin-left: 14px;
  margin-top: 3px;
  margin-bottom: 3px;
  display: flex; flex-direction: column; gap: 2px;
}
.cr-tree-children .cr-tree-row { margin: 0; }
.cr-tree-folder + .cr-tree-folder,
.cr-tree-project + .cr-tree-project,
.cr-tree-folder + .cr-tree-project,
.cr-tree-project + .cr-tree-folder { margin-top: 3px; }
.cr-library-list { padding: 4px 6px 10px; display: flex; flex-direction: column; gap: 2px; }

/* ── 项目管理树 · ⋯ 操作菜单 ── */
.cr-tree-menu {
  position: fixed; z-index: 6000; min-width: 168px; padding: 5px;
  border-radius: 12px;
  background: var(--modal-bg, #1c1c1c); border: 1px solid var(--border, rgba(255,255,255,0.1));
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; gap: 1px;
}
.cr-tree-menu[hidden] { display: none; }
.cr-tree-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 9px; border: none; border-radius: 8px;
  background: transparent; color: var(--text, #f5f5f5);
  font-size: 13px; text-align: left; cursor: pointer;
  transition: background .12s ease;
}
.cr-tree-menu-item svg { flex-shrink: 0; color: var(--text-muted); }
.cr-tree-menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
html[data-theme="light"] .cr-tree-menu { background: #ffffff; border-color: rgba(0,0,0,0.10); box-shadow: 0 14px 40px rgba(15,23,42,0.12); }
html[data-theme="light"] .cr-tree-menu-item { color: #1f2937; }
html[data-theme="light"] .cr-tree-menu-item:hover { background: rgba(0,0,0,0.05); color: #111827; }
html[data-theme="light"] .cr-tree-menu-item svg { color: #6b7280; }

/* ── 项目管理树 · 对齐与间距微调 ── */
.cr-tree-children { margin-left: 15px; } /* 项目列表与文件夹名称左侧对齐 */
.cr-tree-arrow { margin-left: 6px; }     /* 收放图标在名称后，留出清晰间距 */
.cr-tree-row { gap: 9px; }

/* ── 文件夹收放图标：紧贴名称右侧（⋯ 操作推到最右） ── */
.cr-tree-folder > .cr-tree-row .cr-tree-name { flex: 0 1 auto; padding-right: 0; }
.cr-tree-folder > .cr-tree-row .cr-tree-arrow { margin-left: -7px; } /* 抵消行 gap:9，图标紧贴名称 */
.cr-tree-folder > .cr-tree-row .cr-tree-actions { margin-left: auto; }

/* ── 项目管理树 · 项目编辑时间 + 悬停切换 ⋯ 菜单 ── */
.cr-tree-meta { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-shrink: 0; min-width: 0; }
.cr-tree-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; padding-left: 6px; }
.cr-tree-meta .cr-tree-actions { display: none; position: static; transform: none; opacity: 1; }
.cr-tree-row:hover .cr-tree-meta .cr-tree-actions { display: flex; }
.cr-tree-row:hover .cr-tree-meta .cr-tree-time { display: none; }
html[data-theme="light"] .cr-tree-time { color: #9ca3af; }

/* ── 项目管理树 · 悬停不改变布局（时间隐藏时保留占位，⋯ 绝对定位覆盖） ── */
.cr-tree-meta { position: relative; width: 58px; justify-content: flex-end; }
.cr-tree-meta .cr-tree-time { visibility: visible; }
.cr-tree-row:hover .cr-tree-meta .cr-tree-time { visibility: hidden; } /* 保留占位，不改变行宽/间距 */
.cr-tree-meta .cr-tree-actions {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: none; opacity: 1;
}
.cr-tree-row:hover .cr-tree-meta .cr-tree-actions { display: flex; }

/* 去掉画布内部顶部“项目 / 画面”次级面包屑条（顶部全局面包屑已足够） */
.cr-browser { display: none !important; }

/* ── 项目下画布卡片：大/中/小切换 + 居中 + 缩略图 + 编辑时间 ── */
.cr-scene-size {
  display: flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px;
  background: rgba(20,20,24,0.9); border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.cr-scene-size[hidden] { display: none; }
.cr-scene-size button {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 12px; line-height: 1; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: all .15s ease;
}
.cr-scene-size button:hover { color: #fff; background: rgba(255,255,255,0.08); }
.cr-scene-size button.active { background: rgba(74,222,128,0.18); color: var(--neon-bright); font-weight: 700; }
html[data-theme="light"] .cr-scene-size { background: rgba(255,255,255,0.92); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-scene-size button { color: #6b7280; }
html[data-theme="light"] .cr-scene-size button:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .cr-scene-size button.active { background: rgba(22,163,74,0.12); color: #15803d; }

/* 右上角工具条：排序 + 大/中/小 用 flex 排布，避免重叠 */
.cr-level-tools {
  position: absolute; top: 14px; right: 14px; z-index: 90;
  display: flex; align-items: center; gap: 8px;
}
.cr-level-tools > * { position: static; }
/* 排列顺序：最近更新 / 最早创建 / 名称（右上角，项目卡与画布卡共用） */
.cr-level-sort { display: inline-block; }
.cr-level-sort[hidden] { display: none; }
.cr-level-sort .cr-cs-trigger {
  border: 1px solid var(--border); border-radius: 999px; background: rgba(20,20,24,0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text-muted); font-size: 12px; padding: 5px 12px; height: auto; min-width: 86px;
}
.cr-level-sort .cr-cs-trigger:hover { border-color: rgba(74,222,128,0.5); color: var(--text); }
.cr-level-sort .cr-cs-dropdown { z-index: 95; }
html[data-theme="light"] .cr-level-sort .cr-cs-trigger { background: rgba(255,255,255,0.94); border-color: rgba(0,0,0,0.10); }

/* 层级卡片翻页器：卡片过多时底部左右翻页 */
.cr-level-pager {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 92; display: flex; align-items: center; gap: 4px; padding: 4px 6px;
  border-radius: 999px;
  background: rgba(20,20,24,0.9); border: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  user-select: none;
}
.cr-level-pager[hidden] { display: none; }
.cr-level-pager button {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 18px; line-height: 1; width: 28px; height: 28px;
  border-radius: 50%; cursor: pointer; transition: all .15s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.cr-level-pager button:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,0.1); }
.cr-level-pager button:disabled { opacity: .3; cursor: default; }
.cr-level-page-info { font-size: 12px; color: var(--text-muted); min-width: 56px; text-align: center; }
html[data-theme="light"] .cr-level-pager { background: rgba(255,255,255,0.94); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .cr-level-pager button { color: #6b7280; }
html[data-theme="light"] .cr-level-pager button:hover:not(:disabled) { color: #111827; background: rgba(0,0,0,0.06); }


/* 层级卡片翻页动画：下一页从右滑入，上一页从左滑入 */
#crNodesLayer.cr-page-next .cr-level-node,
#crNodesLayer.cr-page-prev .cr-level-node { animation-duration: .3s; animation-timing-function: cubic-bezier(.16,1,.3,1); animation-fill-mode: backwards; }
#crNodesLayer.cr-page-next .cr-level-node { animation-name: crPageSlideInRight; }
#crNodesLayer.cr-page-prev .cr-level-node { animation-name: crPageSlideInLeft; }
@keyframes crPageSlideInRight { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
@keyframes crPageSlideInLeft { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: translateX(0); } }

/* 场景卡缩略图：最新生成图，cover 填充 */
.cr-level-scene .cr-ln-thumb { overflow: hidden; position: relative; }
.cr-level-scene .cr-ln-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-level-scene .cr-ln-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.cr-level-scene .cr-ln-edit-hint { font-size: 10px; color: var(--text-muted); }
.cr-level-scene .cr-ln-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
html[data-theme="light"] .cr-level-scene .cr-ln-edit-hint,
html[data-theme="light"] .cr-level-scene .cr-ln-time { color: #9ca3af; }

/* ── 场景卡缩略图：1/2/3 张平铺网格 + 无图占位 ── */
.cr-level-scene .cr-ln-thumbs {
  display: grid; gap: 3px; width: 100%; height: 100%;
}
.cr-level-scene .cr-ln-thumbs[data-count="1"] { grid-template-columns: 1fr; }
.cr-level-scene .cr-ln-thumbs[data-count="2"] { grid-template-columns: 1fr 1fr; }
.cr-level-scene .cr-ln-thumbs[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.cr-level-scene .cr-ln-thumb-cell { min-width: 0; overflow: hidden; border-radius: 6px; }
.cr-level-scene .cr-ln-thumb-cell .cr-ln-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-level-scene .cr-ln-thumb-ph {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-muted); font-size: 11px;
}
.cr-level-scene .cr-ln-thumb-ph svg { width: 34px; height: 34px; opacity: .55; }
html[data-theme="light"] .cr-level-scene .cr-ln-thumb-ph { color: #9ca3af; }

/* 项目分享/邀请弹窗 */
.cr-share-modal { max-width: 440px; }
.cr-share-desc { font-size: 12px; color: var(--text-muted); line-height: 1.7; margin: 4px 0 12px; }
.cr-share-link-row { display: flex; align-items: center; gap: 8px; }
.cr-share-link-row input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); font-size: 12px;
}
.cr-share-link-row .cr-btn { flex-shrink: 0; }
.cr-share-hint { margin-top: 10px; font-size: 11px; color: var(--text-dim); }
html[data-theme="light"] .cr-share-link-row input { background: rgba(0,0,0,0.04); color: #111827; }

/* 项目封面设置弹窗：分段式模式切换 + 图片网格 */
.cr-cover-modal { max-width: 540px; }
.cr-cover-options { display: flex; flex-direction: column; gap: 4px; }
.cr-cover-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255,255,255,0.03);
  transition: background .15s ease, border-color .15s ease;
}
.cr-cover-opt:hover { background: rgba(255,255,255,0.06); }
.cr-cover-opt:has(input:checked) { border-color: rgba(74,222,128,0.55); background: rgba(74,222,128,0.08); }
.cr-cover-opt input { accent-color: var(--neon-bright); width: 15px; height: 15px; margin: 0; flex-shrink: 0; cursor: pointer; }
.cr-cover-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cr-cover-opt b { font-size: 13px; color: var(--text); }
.cr-cover-opt small { font-size: 11px; color: var(--text-muted); }
.cr-cover-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cr-cover-body { min-height: 110px; margin-top: 4px; }
.cr-cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cr-cover-item {
  position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: rgba(255,255,255,0.05);
}
.cr-cover-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-cover-item.active { border-color: var(--neon-bright); box-shadow: 0 0 0 2px rgba(74,222,128,0.3); }
.cr-cover-empty { padding: 30px 12px; text-align: center; color: var(--text-muted); font-size: 12px; border: 1px dashed var(--border); border-radius: 12px; }
.cr-cover-preview {
  min-height: 150px; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 1px dashed var(--border); background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
}
/* 只有选中“上传图片”单选时才显示上传区（hidden 属性优先于 display:flex） */
.cr-cover-preview[hidden] { display: none !important; }
.cr-cover-preview img { max-width: 100%; max-height: 220px; object-fit: contain; display: block; }
.cr-cover-upload-btn { color: var(--text-muted); font-size: 13px; padding: 40px 16px; }
.cr-cover-preview span.cr-cover-ok { color: var(--neon-bright); font-size: 12px; padding: 6px 0; }
html[data-theme="light"] .cr-cover-item { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .cr-cover-preview { background: rgba(0,0,0,0.03); }

/* 行内重命名输入框（新建项目/画布直接添加后聚焦输入名称，回车确认） */
.cr-tree-rename {
  flex: 1; min-width: 0; padding: 2px 6px; margin: -1px 0;
  font-size: 12px; font-weight: 600; color: var(--text);
  background: rgba(255,255,255,0.08); border: 1px solid var(--neon-bright);
  border-radius: 6px; outline: none;
}
/* 卡片标题输入框：固定紧凑高度，不参与父级 flex 拉伸 */
.cr-ln-rename {
  flex: none; height: 26px; line-height: 1; width: calc(100% - 4px);
  font-size: 13px; font-weight: 800; color: var(--text);
  background: rgba(0,0,0,0.35); border: 1px solid var(--neon-bright);
  border-radius: 8px; outline: none; padding: 2px 6px;
  box-sizing: border-box;
}
html[data-theme="light"] .cr-tree-rename { color: #111827; background: rgba(0,0,0,0.05); }
html[data-theme="light"] .cr-ln-rename { color: #111827; background: rgba(255,255,255,0.9); border-color: #16a34a; }

/* 封面网格上传按钮 */
.cr-cover-upload-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1.5px dashed rgba(255,255,255,0.25); background: rgba(255,255,255,0.03); color: var(--text-muted);
  font-size: 11px; cursor: pointer; aspect-ratio: 4/3; border-radius: 10px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cr-cover-upload-cell:hover { background: rgba(74,222,128,0.08); border-color: var(--neon-bright); color: var(--neon-bright); }
.cr-cover-upload-cell svg { width: 22px; height: 22px; }
html[data-theme="light"] .cr-cover-upload-cell { border-color: rgba(0,0,0,0.2); color: #6b7280; }
html[data-theme="light"] .cr-cover-upload-cell:hover { background: rgba(22,163,74,0.08); border-color: #16a34a; color: #15803d; }

/* 浅色主题：弹窗改为白底，避免“深色背景 + 深色文字”不可见 */
html[data-theme="light"] .cr-modal {
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 30px 80px rgba(15,23,42,0.2);
}
html[data-theme="light"] .cr-modal input,
html[data-theme="light"] .cr-modal select {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.12);
  color: #111827;
}
html[data-theme="light"] .cr-modal h3 { color: #111827; }
html[data-theme="light"] .cr-cover-opt { background: rgba(0,0,0,0.02); }
html[data-theme="light"] .cr-cover-opt:hover { background: rgba(0,0,0,0.05); }
html[data-theme="light"] .cr-cover-opt:has(input:checked) { border-color: rgba(22,163,74,0.5); background: rgba(22,163,74,0.08); }
html[data-theme="light"] .cr-cover-opt b { color: #111827; }
html[data-theme="light"] .cr-cover-opt small { color: #6b7280; }
html[data-theme="light"] .cr-cover-hint { color: #6b7280; }
html[data-theme="light"] .cr-cover-upload-btn { color: #6b7280; }

/* 封面弹窗：换一换 + 裁剪器 */
.cr-cover-shuffle { margin-top: 10px; width: 100%; justify-content: center; }
.cr-cover-preview .cr-crop-wrap {
  position: relative; width: 100%; height: 280px; overflow: hidden; border-radius: 12px;
  background: rgba(0,0,0,0.5); border: 1px solid var(--border);
}
.cr-cover-preview .cr-crop-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-select: none; }
.cr-cover-preview .cr-crop-box {
  position: absolute; border: 1.5px dashed rgba(74,222,128,0.9); background: rgba(74,222,128,0.08);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45); cursor: move; touch-action: none;
}
.cr-cover-preview .cr-crop-handle {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
  border-radius: 50%; background: #4ade80; border: 2px solid #fff; cursor: nwse-resize;
}
.cr-cover-preview .cr-crop-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.cr-cover-preview .cr-crop-done { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; }
html[data-theme="light"] .cr-cover-preview .cr-crop-wrap { background: rgba(0,0,0,0.12); }

/* ═══════ 画布左侧工具条：搜索 / 资产 / 工作流 / 历史 / 画板 / 剪辑 ═══════ */
/* Command 搜索 */
.cr-cmd-overlay { z-index: 340; }
.cr-cmd-overlay .ui-modal-card { max-width: 560px; overflow: hidden; }
.cr-cmd { display: flex; flex-direction: column; min-height: 0; padding: 8px; gap: 6px; }
.cr-cmd-input-wrap { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border, rgba(255,255,255,0.12)); border-radius: 12px; background: rgba(255,255,255,0.05); }
.cr-cmd-input-wrap svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.cr-cmd-input { flex: 1; border: none; outline: none; background: transparent; color: var(--text); font-size: 14px; }
.cr-cmd-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cr-cmd-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.cr-cmd-item:hover, .cr-cmd-item.active { background: rgba(74,222,128,0.12); }
.cr-cmd-icon { width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; color: var(--text-dim); }
.cr-cmd-icon svg { width: 16px; height: 16px; }
.cr-cmd-name { font-size: 13.5px; font-weight: 600; color: var(--text); min-width: 0; }
.cr-cmd-type { font-size: 11px; color: var(--text-muted); background: rgba(255,255,255,0.07); padding: 2px 8px; border-radius: 999px; }
.cr-cmd-snip { flex: 1; min-width: 0; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.cr-cmd-empty { padding: 34px 16px; text-align: center; color: var(--text-muted); font-size: 13px; white-space: pre-line; }
.cr-cmd-hint { font-size: 11px; color: var(--text-muted); padding: 4px 8px; border-top: 1px solid var(--border); }

/* 资产库弹窗 */
.cr-ast-overlay { z-index: 330; }
.cr-ast-overlay .ui-modal-card { max-width: 860px; width: 90vw; max-height: 82vh; overflow: hidden; }
.cr-ast { display: flex; flex-direction: column; min-height: 0; padding: 16px 18px; gap: 12px; }
.cr-ast-head { display: flex; align-items: center; gap: 12px; }
.cr-ast-title { font-size: 17px; font-weight: 800; }
.cr-ast-search { flex: 1; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; outline: none; }
.cr-ast-close { width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.cr-ast-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-ast-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-ast-cat { padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; color: var(--text-dim); border: 1px solid transparent; background: rgba(255,255,255,0.05); }
.cr-ast-cat.active { color: #4ade80; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.10); }
.cr-ast-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 4px 2px 8px; }
.cr-ast-card { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); }
.cr-ast-card:hover { border-color: rgba(74,222,128,0.45); }
.cr-ast-preview { aspect-ratio: 1 / 1; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-ast-img { width: 100%; height: 100%; object-fit: cover; }
.cr-ast-ph { color: rgba(255,255,255,0.25); }
.cr-ast-ph svg { width: 30px; height: 30px; }
.cr-ast-info { padding: 8px 10px; }
.cr-ast-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-ast-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cr-ast-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 7px; border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s ease; }
.cr-ast-card:hover .cr-ast-del { opacity: 1; }
.cr-ast-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); font-size: 13px; padding: 60px 20px; line-height: 1.8; white-space: pre-line; }

/* 历史弹窗 */
.cr-his-overlay { z-index: 330; }
.cr-his-overlay .ui-modal-card { max-width: 860px; width: 90vw; max-height: 82vh; overflow: hidden; }
.cr-his { display: flex; flex-direction: column; min-height: 0; padding: 16px 18px; gap: 12px; }
.cr-his-head { display: flex; align-items: center; justify-content: space-between; }
.cr-his-title { font-size: 17px; font-weight: 800; }
.cr-his-close { width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.cr-his-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-his-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cr-his-tab { padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; color: var(--text-dim); border: 1px solid transparent; background: rgba(255,255,255,0.05); }
.cr-his-tab.active { color: #4ade80; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.10); }
.cr-his-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 4px 2px 8px; }
.cr-his-card { border-radius: 12px; overflow: hidden; cursor: pointer; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); }
.cr-his-card:hover { border-color: rgba(74,222,128,0.45); }
.cr-his-preview { position: relative; aspect-ratio: 4 / 3; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-his-img, .cr-his-video { width: 100%; height: 100%; object-fit: cover; }
.cr-his-badge { position: absolute; top: 6px; left: 6px; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,0.6); color: #fff; }
.cr-his-ph { color: rgba(255,255,255,0.3); }
.cr-his-ph svg { width: 34px; height: 34px; }
.cr-his-name { padding: 8px 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-his-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); font-size: 13px; padding: 60px 20px; line-height: 1.8; white-space: pre-line; }

/* 画板（白板） */
.cr-board-overlay { position: fixed; inset: 0; z-index: 350; background: #101114; display: flex; flex-direction: column; }
.cr-board-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(20,21,26,0.96); border-bottom: 1px solid var(--border); z-index: 2; }
.cr-board-title { font-size: 15px; font-weight: 800; }
.cr-board-sub { font-size: 12px; color: var(--text-muted); }
.cr-board-close { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.cr-board-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-board-canvas { flex: 1; min-height: 0; touch-action: none; cursor: crosshair; }
.cr-board-toolbar { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 14px; background: rgba(20,21,26,0.94); border: 1px solid var(--border); box-shadow: 0 14px 40px rgba(0,0,0,0.5); z-index: 3; }
.cr-bd-btn { width: 34px; height: 34px; border-radius: 9px; border: none; background: transparent; color: var(--text-dim); display: grid; place-items: center; cursor: pointer; }
.cr-bd-btn svg { width: 17px; height: 17px; }
.cr-bd-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-bd-btn.active { background: rgba(74,222,128,0.15); color: #4ade80; }
.cr-bd-btn.cr-bd-save { width: auto; padding: 0 14px; gap: 6px; display: flex; align-items: center; color: #4ade80; background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.35); font-size: 12.5px; font-weight: 700; }
.cr-bd-color { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: transparent; cursor: pointer; }
.cr-bd-width-wrap { display: flex; align-items: center; gap: 6px; padding: 0 8px; border-left: 1px solid var(--border); }
.cr-bd-width-label { font-size: 11.5px; color: var(--text-muted); }
.cr-bd-width { width: 90px; }
.cr-board-foot { position: absolute; left: 18px; bottom: 18px; display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); z-index: 2; }

/* 剪辑（简易视频编辑） */
.cr-edit-overlay { position: fixed; inset: 0; z-index: 350; background: #121316; display: flex; flex-direction: column; }
.cr-edit-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(20,21,26,0.96); border-bottom: 1px solid var(--border); }
.cr-edit-title { font-size: 15px; font-weight: 800; }
.cr-edit-close { width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.cr-edit-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-edit-export { margin-left: auto; padding: 8px 18px; border-radius: 10px; border: none; background: rgba(74,222,128,0.16); border: 1px solid rgba(74,222,128,0.4); color: #4ade80; font-size: 13px; font-weight: 700; cursor: pointer; }
.cr-edit-export:hover { background: rgba(74,222,128,0.26); }
.cr-edit-body { flex: 1; min-height: 0; display: flex; }
.cr-edit-media { width: 240px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: rgba(255,255,255,0.02); }
.cr-edit-media-tabs { padding: 10px 14px 4px; font-size: 13px; font-weight: 700; }
.cr-edit-media-filters { display: flex; gap: 6px; padding: 6px 12px; flex-wrap: wrap; }
.cr-em-f { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; cursor: pointer; color: var(--text-dim); background: rgba(255,255,255,0.06); }
.cr-em-f.active { color: #4ade80; background: rgba(74,222,128,0.12); }
.cr-edit-project { display: flex; gap: 6px; padding: 6px 12px; align-items: center; }
.cr-edit-project select { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; border-radius: 6px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text); }
.cr-edit-project button { font-size: 11px; padding: 4px 8px; white-space: nowrap; }
.cr-em-section { grid-column: 1 / -1; font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 8px 2px 2px; border-top: 1px dashed rgba(255,255,255,0.08); }
.cr-em-section:first-child { border-top: none; }
.cr-em-actions { display: flex; gap: 4px; padding: 4px 6px; }
.cr-em-act { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid rgba(74,222,128,0.35); background: rgba(74,222,128,0.10); color: #4ade80; cursor: pointer; }
.cr-em-act:hover { background: rgba(74,222,128,0.22); }
.cr-em-act.danger { border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.1); color: #f87171; }
.cr-edit-media-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.cr-em-item { border-radius: 10px; overflow: hidden; cursor: pointer; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.cr-em-item:hover { border-color: rgba(74,222,128,0.45); }
.cr-em-thumb { aspect-ratio: 4 / 3; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-em-img, .cr-em-video { width: 100%; height: 100%; object-fit: cover; }
.cr-em-ph { color: var(--text-muted); font-size: 12px; }
.cr-em-name { padding: 6px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-em-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); font-size: 12px; padding: 40px 10px; line-height: 1.7; }
.cr-edit-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #0b0c0e; }
.cr-edit-player { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.cr-edit-player video, .cr-edit-player img { max-width: 92%; max-height: 92%; }
.cr-edit-ph { color: var(--text-muted); text-align: center; line-height: 1.8; font-size: 13px; }
.cr-edit-controls { height: 44px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 16px; }
.cr-ec-play { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(74,222,128,0.15); color: #4ade80; cursor: pointer; }
.cr-ec-time { font-size: 12px; color: var(--text-muted); }
.cr-ec-ratio { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.cr-edit-props { width: 220px; border-left: 1px solid var(--border); display: flex; flex-direction: column; background: rgba(255,255,255,0.02); }
.cr-edit-props-title { padding: 10px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); }
.cr-edit-props-body { flex: 1; min-height: 0; padding: 14px; font-size: 12.5px; color: var(--text-muted); white-space: pre-line; line-height: 1.8; }
.cr-edit-timeline { height: 180px; border-top: 1px solid var(--border); display: flex; flex-direction: column; background: rgba(255,255,255,0.02); }
.cr-edit-tl-tools { display: flex; align-items: center; gap: 4px; padding: 6px 12px; }
.cr-etl-btn { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.cr-etl-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cr-etl-spacer { flex: 1; }
.cr-edit-ruler { position: relative; height: 22px; border-top: 1px solid var(--border); overflow: hidden; }
.cr-et-ruler-tick { position: absolute; top: 4px; font-size: 10px; color: var(--text-muted); }
.cr-edit-tracks { flex: 1; min-height: 0; overflow: auto; padding: 6px 12px; }
.cr-edit-track { display: flex; gap: 8px; min-height: 44px; align-items: center; }
.cr-edit-track-name { width: 52px; font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }
.cr-edit-clips { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.cr-edit-clip { height: 40px; border-radius: 8px; background: rgba(74,222,128,0.14); border: 1px solid rgba(74,222,128,0.3); display: flex; flex-direction: column; justify-content: center; padding: 4px 8px; cursor: pointer; flex-shrink: 0; }
.cr-edit-clip.selected { border-color: #4ade80; background: rgba(74,222,128,0.24); }
.cr-ec-name { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-ec-time { font-size: 10px; color: var(--text-muted); }
/* ===== FF 智能体输入框：浅色主题适配 ===== */
html[data-theme="light"] .cr-ai-input-box {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.10);
}
html[data-theme="light"] .cr-ai-input-textarea { color: #1f2937; }
html[data-theme="light"] .cr-ai-input-textarea::placeholder,
html[data-theme="light"] .cr-ai-input-textarea:empty::before { color: #9ca3af; }
html[data-theme="light"] .cr-ai-input-tool,
html[data-theme="light"] .cr-ai-input-expand,
html[data-theme="light"] .cr-ai-input-optimize { color: #4b5563; }
html[data-theme="light"] .cr-ai-input-tool:hover,
html[data-theme="light"] .cr-ai-input-expand:hover { background: rgba(0, 0, 0, 0.06); color: #111827; }
html[data-theme="light"] .cr-ai-input-upload { border-color: rgba(0,0,0,0.18); background: rgba(0,0,0,0.04); color: #4b5563; }
html[data-theme="light"] .cr-ai-input-submit { background: #16a34a; color: #fff; }
html[data-theme="light"] .cr-ai-input-select { color: #374151; background: #fff; }
/* ===== FF 智能体输入框内部控件：浅色主题完整适配 ===== */
html[data-theme="light"] .cr-agent-input .cr-cs-trigger,
html[data-theme="light"] .cr-ai-input-box .cr-cs-trigger,
html[data-theme="light"] .cr-cs-trigger {
  color: #374151; background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.14);
}
html[data-theme="light"] .cr-cs-trigger:hover { background: rgba(0, 0, 0, 0.08); border-color: rgba(0, 0, 0, 0.22); }
html[data-theme="light"] .cr-cs-option { color: #374151; }
html[data-theme="light"] .cr-cs-option:hover { background: rgba(0, 0, 0, 0.05); color: #111827; }
html[data-theme="light"] .cr-cs-opt-icon { color: #4b5563; }
html[data-theme="light"] .cr-ai-input-type-tag {
  color: #4b5563; background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.14);
}
html[data-theme="light"] .cr-ai-input-upload {
  color: #4b5563; border-color: rgba(0, 0, 0, 0.20); background: rgba(0, 0, 0, 0.04);
}
html[data-theme="light"] .cr-ai-input-upload:hover { color: #111827; background: rgba(0, 0, 0, 0.08); border-color: rgba(0, 0, 0, 0.3); }
html[data-theme="light"] .cr-cs-dropdown {
  background: #ffffff; border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}
/* FF 智能体输入框：去掉底色，融入面板 */
#crAgentInput .cr-ai-input-box {
  background: transparent;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] #crAgentInput .cr-ai-input-box {
  border-color: rgba(0, 0, 0, 0.10);
}
/* Agent 模式按钮与平台/模型同排 */
#crAgentInput .cr-ai-input-params { display: inline-flex; align-items: center; }
/* FF 智能体输入框：去掉分隔线/底色，Agent 与平台/模型强制同一排 */
#crAgentInput.cr-agent-input,
#crAgentInput { border-top: none; background: transparent; }
html[data-theme="light"] #crAgentInput.cr-agent-input { background: transparent; border-top: none; }
#crAgentInput .cr-ai-input-box,
#crAgentInput .cr-agent-input { background: transparent; }
#crAgentInput .cr-ai-input-box { background: #1c1c1c; border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 10px 12px 8px; }
html[data-theme="light"] #crAgentInput .cr-ai-input-box { background: #ffffff; border-color: rgba(0,0,0,0.14); }
/* FF 智能体输入框下拉：始终向上展开（输入框位于底部，向下会被面板裁剪） */
#crAgentInput .cr-cs-dropdown { top: auto; bottom: calc(100% + 4px); }
#crAgentInput .cr-cs-trig-label { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#crAgentInput .cr-ai-input-footer { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
#crAgentInput .cr-ai-input-params#crAgentMode { flex: 0 0 auto; }
#crAgentInput .cr-ai-input-params#crAgentMode .cr-cs-trigger { max-width: 92px; padding: 5px 8px; font-size: 11px; }
#crAgentInput .cr-ai-input-model-params { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
#crAgentInput .cr-custom-select { max-width: 104px; min-width: 70px; }
#crAgentInput .cr-cs-trigger { padding: 5px 8px; font-size: 11px; }
#crAgentInput .cr-ai-input-actions { flex: 0 0 auto; margin-left: auto; }
#crAgentInput .cr-ai-input-actions .cr-ai-input-optimize { width: 28px; height: 28px; }
#crAgentInput .cr-ai-input-submit { width: 32px; height: 32px; }

/* ═══ 无限画布项目管理页（层级浏览）：body 背景光效 + 内容框毛玻璃 ═══ */
/* 画布容器透明，透出页面背景光效 */
.cr-app { background: transparent; }
/* 层级浏览：项目管理边栏毛玻璃 */
#view-canvas:not(.cr-scene-editing) .cr-library {
  background: linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-right: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
/* 项目管理页：FF 智能体面板与右侧分割条彻底隐藏（display:none 不占布局），
   避免进入列表页时面板闪动导致项目/画布列表每次归位 */
#view-canvas:not(.cr-scene-editing) #crInspector,
#view-canvas:not(.cr-scene-editing) #crResizerRight { display: none !important; }
/* 进入编辑画布：项目管理边栏恢复简洁半透明背景（不模糊） */
#view-canvas.cr-scene-editing .cr-library {
  background: rgba(0,0,0,0.10);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-right: 1px solid var(--border);
  box-shadow: none;
}
/* 层级浏览：项目/画面卡片毛玻璃 */
#view-canvas:not(.cr-scene-editing) .cr-level-project {
  background: linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.12);
}
#view-canvas:not(.cr-scene-editing) .cr-level-folder {
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
}
/* 浅色主题：玻璃更通透 */
html[data-theme="light"] #view-canvas:not(.cr-scene-editing) .cr-library {
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(255,255,255,0.76));
  border-right: 1px solid rgba(0,0,0,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}
html[data-theme="light"] #view-canvas.cr-scene-editing .cr-library {
  background: rgba(0,0,0,0.05);
  border-right: 1px solid rgba(0,0,0,0.08);
}
html[data-theme="light"] #view-canvas:not(.cr-scene-editing) .cr-level-project {
  background: linear-gradient(145deg, rgba(255,255,255,0.90), rgba(255,255,255,0.72));
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 14px 34px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* FF智能体消息：复制按钮（我的消息/机器人消息气泡下方） */
.cr-agent-msg-copy {
  display: inline-flex; align-items: center; gap: 4px;
  width: 24px; height: 24px; margin-top: 4px; padding: 0;
  border-radius: 7px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.05); color: var(--text-dim);
  cursor: pointer; transition: all .15s ease;
}
.cr-agent-msg-copy:hover { background: rgba(74,222,128,0.14); border-color: rgba(74,222,128,0.4); color: var(--neon-bright); }
.cr-agent-msg.user .cr-agent-msg-copy { margin-left: auto; }
.cr-agent-msg.bot .cr-agent-msg-copy { margin-right: auto; }

/* ═══ 预设提示词库下拉：风格与「系统提示词」弹层一致 ═══ */
.cr-preset-lib {
  position: fixed; z-index: 99999;
  width: 260px; max-width: 92vw; max-height: 420px; overflow: hidden;
  padding: 10px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--modal-bg, #1c1c1c);
  border: 1px solid var(--modal-border, rgba(255,255,255,0.12));
  box-shadow: 0 16px 44px rgba(0,0,0,0.55);
}
.cr-preset-lib-head { display: flex; align-items: center; gap: 6px; }
.cr-preset-lib .ui-pills { flex: 0 0 auto; min-width: 0; justify-content: flex-start; }
.cr-preset-lib .ui-pills .ui-pill { flex: 0 0 auto; padding: 4px 10px; font-size: 11.5px; }
.cr-preset-lib-add { font-size: 11.5px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; margin-left: auto; }
.cr-preset-lib-close {
  width: 22px; height: 22px; flex-shrink: 0; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.cr-preset-lib-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }
html[data-theme="light"] .cr-preset-lib-close:hover { background: rgba(0,0,0,0.05); }
.cr-preset-lib-search {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  color: var(--text); font-size: 12px; padding: 6px 8px; outline: none;
}
.cr-preset-lib-search:focus { border-color: var(--neon-glow, rgba(74,222,128,0.4)); }
html[data-theme="light"] .cr-preset-lib-search { background: #fff; border-color: rgba(0,0,0,0.15); color: #111827; }
.cr-preset-lib-list {
  max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.cr-preset-lib-item {
  display: flex; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text); transition: all .12s ease;
}
.cr-preset-lib-item:hover { background: rgba(255,255,255,0.06); border-color: rgba(125,211,252,0.3); }
html[data-theme="light"] .cr-preset-lib-item:hover { background: rgba(0,0,0,0.05); }
.cr-preset-lib-menu {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border: none; border-radius: 5px;
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;
  display: grid; place-items: center; transition: all .12s;
}
.cr-preset-lib-menu:hover { background: var(--surface-2, rgba(255,255,255,0.08)); color: var(--neon-bright); }
.cr-preset-lib-item-body { flex: 1; min-width: 0; }
.cr-preset-lib-item-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-preset-lib-item-desc { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
/* ⋮ 菜单：竖排、带底纹卡片（编辑/删除） */
.cr-preset-lib-item-menu {
  position: fixed; z-index: 100001; min-width: 110px;
  display: flex; flex-direction: column; gap: 2px; padding: 5px;
  background: var(--modal-bg, #1c1c1c);
  border: 1px solid var(--modal-border, rgba(255,255,255,0.12));
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
}
.cr-preset-lib-item-menu button {
  display: flex; align-items: center; gap: 6px; text-align: left;
  padding: 5px 8px; border: none; background: transparent; color: var(--text);
  font-size: 12px; border-radius: 6px; cursor: pointer; transition: background .12s;
}
.cr-preset-lib-item-menu button:hover { background: var(--surface-hover); }
.cr-preset-lib-item-menu button.danger { color: #f87171; }
.cr-preset-lib-empty { font-size: 11.5px; color: var(--text-muted); padding: 4px 2px; }
/* 添加/编辑表单：风格与系统提示词编辑区一致 */
.cr-preset-form { width: 320px; padding: 10px; }
.cr-preset-form .cr-preset-lib-tabs-title { font-size: 12px; font-weight: 700; color: var(--text); }
.cr-preset-form-field { display: flex; flex-direction: column; gap: 4px; }
.cr-preset-form-field label { font-size: 11px; color: var(--text-muted); }
.cr-preset-form-field input, .cr-preset-form-field textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  color: var(--text); font-size: 12px; padding: 6px 8px; outline: none; font-family: inherit; line-height: 1.5;
}
.cr-preset-form-field input:focus, .cr-preset-form-field textarea:focus { border-color: var(--neon-glow, rgba(74,222,128,0.4)); }
html[data-theme="light"] .cr-preset-form-field input, html[data-theme="light"] .cr-preset-form-field textarea { background: #fff; border-color: rgba(0,0,0,0.15); color: #111827; }
.cr-preset-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.cr-preset-form-foot button { font-size: 11.5px; padding: 4px 10px; }

/* 添加/编辑提示词：居中弹窗（风格与系统提示词窗口一致） */
.cr-preset-add-overlay {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.cr-preset-add { width: 560px; max-width: 94vw; max-height: 86vh; overflow-y: auto; position: static; }
.cr-preset-add-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cr-preset-add-title { font-size: 13px; font-weight: 700; color: var(--text); }
.cr-preset-add-close {
  width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; transition: all .12s;
}
.cr-preset-add-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }
html[data-theme="light"] .cr-preset-add-close:hover { background: rgba(0,0,0,0.05); }
.cr-preset-add .cr-preset-add-pills { justify-content: flex-start; }
.cr-preset-add-pills { flex-wrap: wrap; }
.cr-preset-add-list {
  max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border, rgba(255,255,255,0.10)); border-radius: 8px; padding: 4px;
}
.cr-preset-add-item {
  display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer;
  padding: 5px 8px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--text); transition: all .12s ease;
}
.cr-preset-add-item:hover { background: rgba(255,255,255,0.06); border-color: rgba(125,211,252,0.3); }
html[data-theme="light"] .cr-preset-add-item:hover { background: rgba(0,0,0,0.05); }
.cr-preset-add-item-body { flex: 1; min-width: 0; }
.cr-preset-add-item-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-preset-add-item-desc { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.cr-preset-add-item-kind {
  flex: none; font-size: 10px; color: var(--text-muted);
  border: 1px solid var(--border, rgba(255,255,255,0.14)); border-radius: 999px; padding: 1px 7px;
}
.cr-preset-add-item-use {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border: 1px solid var(--border, rgba(255,255,255,0.14)); border-radius: 999px;
  background: transparent; color: var(--text-muted); font-size: 10.5px; cursor: pointer; transition: all .12s;
}
.cr-preset-add-item-use:hover { color: var(--neon-bright, #86efac); border-color: rgba(74,222,128,0.35); background: var(--neon-dim, rgba(74,222,128,0.10)); }
.cr-preset-add-divider {
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted);
}
.cr-preset-add-divider::before, .cr-preset-add-divider::after { content: ''; flex: 1; height: 1px; background: var(--border, rgba(255,255,255,0.10)); }
.cr-preset-add-hint { font-size: 10.5px; color: var(--text-muted); }
.cr-preset-add .cr-preset-form-field input, .cr-preset-add .cr-preset-form-field textarea { font-size: 12px; }
.cr-preset-add .cr-preset-form-foot button { font-size: 12px; padding: 5px 14px; }
.cr-preset-add .cr-preset-add-selected {
  background: var(--neon-dim, rgba(74,222,128,0.10)); border-color: var(--neon-glow, rgba(74,222,128,0.45));
  box-shadow: 0 0 0 1px var(--neon-glow, rgba(74,222,128,0.35));
}
.cr-preset-add .cr-preset-add-selected .cr-preset-add-item-title { color: var(--neon-bright, #86efac); }
.cr-preset-add-check {
  flex: none; display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-bright, #86efac), var(--neon, #4ade80));
  color: #06200e;
}
html[data-theme="light"] .cr-preset-add-check { color: #ffffff; }


/* ═══════ 渲染性能（画布渲染性能优化设计方案.md）═══════ */
/* 图片 LOD 切换淡化过渡，防闪烁（canvas.js _applyImageResolution 控制 class/opacity） */
.cr-image-rendered { transition: opacity 120ms ease; }
.cr-image-rendered.img-lod-swap { opacity: 0.35; }
/* 节点卡片合成层提示（增量优化，低风险；content-visibility 为远期候选，未启用） */
.cr-node { will-change: transform; }

/* ═══════ 媒体查看器分组翻页（2026-08-13）═══════ */
.cr-mv-page { min-width: 46px; text-align: center; font-size: 12px; color: var(--text-muted, #9ca3af); }
html[data-theme="light"] .cr-mv-page { color: #6b7280; }
.cr-mv-tool:disabled { opacity: 0.35; pointer-events: none; }

/* 保存状态指示器（新建/删除/粘贴后立即持久化，落库成功显示“已保存”） */
.cr-save-status {
  position: absolute; top: 10px; right: 14px; z-index: 90;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(20,22,28,0.88); border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.72); backdrop-filter: blur(6px);
  pointer-events: none; user-select: none;
}
.cr-save-status.saving { color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.cr-save-status.saving::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #fbbf24; animation: crSavePulse 1s ease-in-out infinite; }
.cr-save-status.error { color: #f87171; border-color: rgba(248,113,113,0.4); }
.cr-save-status:not(.saving):not(.error) { color: #4ade80; border-color: rgba(74,222,128,0.28); }
@keyframes crSavePulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* 视频规格-音频能力（Bug3）：不支持音频的模型开关置灰禁用 */
.ui-pp-spec-res[data-video-audio][disabled] { opacity: .35; cursor: not-allowed; filter: grayscale(1); pointer-events: none; }
.ui-pp-spec-disabled-tip { display: inline-block; margin-left: 8px; font-size: 11px; color: var(--cr-dim, #8a8f98); }

/* ═══════ 画布本地设置弹窗 / 快捷键弹窗 / 小地图（canvas-settings.js） ═══════ */
.cr-cs-overlay .ui-modal-card, .cr-sc-overlay .ui-modal-card { max-width: 560px; width: 92%; padding: 0; border-radius: 14px; overflow: hidden; }
.cr-cs-head, .cr-sc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08)); }
.cr-cs-head strong, .cr-sc-head strong { font-size: 15px; }
.cr-cs-head span, .cr-sc-head span { font-size: 11px; color: var(--cr-dim, #8a8f98); }
.cr-cs-x { background: none; border: 0; color: var(--cr-dim, #8a8f98); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.cr-cs-x:hover { color: var(--text, #fff); }
.cr-cs-body { padding: 6px 18px 14px; max-height: 62vh; overflow-y: auto; }
.cr-cs-group { padding: 10px 0; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); }
.cr-cs-group:last-child { border-bottom: 0; }
.cr-cs-group h4 { margin: 0 0 6px; font-size: 12px; color: var(--neon-bright, #4ade80); letter-spacing: .03em; }
.cr-cs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; }
.cr-cs-label { flex: 1; min-width: 0; }
.cr-cs-label strong { display: block; font-size: 13px; }
.cr-cs-label span { display: block; font-size: 11px; color: var(--cr-dim, #8a8f98); margin-top: 1px; }
.cr-cs-toggle { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.cr-cs-toggle input { opacity: 0; width: 0; height: 0; }
.cr-cs-toggle-slider { position: absolute; inset: 0; background: rgba(255,255,255,.14); border-radius: 22px; transition: background .15s; }
.cr-cs-toggle-slider::before { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.cr-cs-toggle input:checked + .cr-cs-toggle-slider { background: var(--neon-bright, #4ade80); }
.cr-cs-toggle input:checked + .cr-cs-toggle-slider::before { transform: translateX(18px); }
.cr-cs-num { width: 84px; background: rgba(255,255,255,.08); border: 1px solid var(--border, rgba(255,255,255,.14)); border-radius: 8px; color: var(--text, #fff); padding: 6px 8px; font-size: 12px; text-align: right; }
.cr-cs-unit { font-size: 11px; color: var(--cr-dim, #8a8f98); margin-left: 4px; flex: none; }
.cr-cs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cr-cs-chip { background: rgba(255,255,255,.07); border: 1px solid var(--border, rgba(255,255,255,.14)); color: var(--text, #e5e7eb); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.cr-cs-chip.active { background: rgba(74,222,128,.16); border-color: rgba(74,222,128,.4); color: var(--neon-bright, #4ade80); }
.cr-cs-foot, .cr-sc-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
.cr-cs-primary { background: var(--neon-bright, #4ade80); color: #06281a; font-weight: 600; border: 0; border-radius: 8px; padding: 7px 16px; cursor: pointer; }
.cr-cs-primary:hover { filter: brightness(1.08); }
.cr-sc-list { padding: 8px 18px; max-height: 55vh; overflow-y: auto; }
.cr-sc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); }
.cr-sc-row:last-child { border-bottom: 0; }
.cr-sc-meta { flex: 1; min-width: 0; }
.cr-sc-label { font-size: 13px; display: block; }
.cr-sc-desc { font-size: 11px; color: var(--cr-dim, #8a8f98); }
.cr-sc-key { width: 140px; background: rgba(255,255,255,.08); border: 1px solid var(--border, rgba(255,255,255,.14)); border-radius: 8px; color: var(--text, #fff); padding: 6px 8px; font-size: 12px; text-align: center; cursor: text; }
.cr-sc-key:focus { border-color: var(--neon-bright, #4ade80); outline: none; }
.cr-sc-reset { background: none; border: 1px solid var(--border, rgba(255,255,255,.14)); color: var(--cr-dim, #8a8f98); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.cr-sc-reset:hover { color: var(--text, #fff); }
html[data-theme="light"] .cr-cs-toggle-slider { background: rgba(0,0,0,.18); }
html[data-theme="light"] .cr-cs-toggle-slider::before { background: #fff; }
html[data-theme="light"] .cr-cs-num, html[data-theme="light"] .cr-sc-key { background: rgba(0,0,0,.05); color: #111827; }

/* 小地图 */
.cr-minimap { position: absolute; width: 200px; height: 132px; z-index: 70; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); background: rgba(15,23,42,.82); cursor: grab; user-select: none; }
.cr-minimap:active { cursor: grabbing; }
.cr-minimap.dock-right-bottom { right: 12px; bottom: 12px; }
.cr-minimap.dock-left-bottom { left: 12px; bottom: 12px; }
.cr-minimap.dock-right-top { right: 12px; top: 12px; }
.cr-minimap.dock-left-top { left: 12px; top: 12px; }
.cr-minimap canvas { width: 100%; height: 100%; display: block; }
.cr-minimap-label { position: absolute; left: 8px; top: 6px; font-size: 10px; color: rgba(255,255,255,.55); pointer-events: none; z-index: 1; }
html[data-theme="light"] .cr-minimap { background: rgba(241,245,249,.94); border-color: rgba(0,0,0,.12); }
html[data-theme="light"] .cr-minimap-label { color: rgba(0,0,0,.5); }

/* ═══ 画布刷新恢复 loading（2026-08-13）═══ */
.cr-canvas-loading {
  position: absolute; inset: 0; z-index: 300; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(10, 12, 18, 0.72); backdrop-filter: blur(6px);
  color: var(--text, #e5e7eb); font-size: 13px;
}
.cr-canvas-loading[hidden] { display: none; }
.cr-canvas-loading-spin {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(148,163,184,.25); border-top-color: var(--neon-bright, #4ade80);
  animation: cr-loading-spin .8s linear infinite;
}
@keyframes cr-loading-spin { to { transform: rotate(360deg); } }
html[data-theme="light"] .cr-canvas-loading { background: rgba(255,255,255,0.78); }

/* ═══ 项目管理浏览态独立 loading（2026-08-13 页面解耦）═══ */
.cr-browser-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: var(--app-bg, #0b0d12); color: var(--text, #e5e7eb); font-size: 13px; z-index: 20;
}
.cr-browser-loading[hidden] { display: none; }
.cr-browser-loading-spin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(148,163,184,.25); border-top-color: var(--neon-bright, #4ade80);
  animation: cr-loading-spin .8s linear infinite;
}

/* 项目管理浏览态层级卡片容器（与画布编辑层彻底解耦；编辑态隐藏） */
/* 列表浏览模式：卡片直接挂载到容器流式网格，不套用画布编辑的 view transform/absolute 大坐标 */
.cr-level-canvas {
  position: absolute; inset: 0; overflow-y: auto;
  /* 列表浏览网格：整块居中，行内强制左对齐（最后一行卡片少也靠左）；
     列数/卡宽/间距由 JS 写入 CSS 变量（--cr-level-cols / --cr-level-card-w / --cr-level-gap），
     与 computeLevelPages 分页计算同源，缩放窗口自动变化；
     安全 padding：上 76px 避让右上角排序/大中小控件、下 92px 避让底部分页器、左右 24px 不贴边 */
  display: grid;
  grid-template-columns: repeat(var(--cr-level-cols, 4), var(--cr-level-card-w, 300px));
  gap: var(--cr-level-gap, 24px);
  align-content: flex-start;
  justify-content: center;
  padding: 76px 24px 92px;
}
#crLevelCanvas[hidden] { display: none; }

/* ═══ 生成完成通知（画布右上角轻量 toast；2026-08-14）═══ */
#crNotifyToastContainer {
  position: fixed; top: 72px; right: 20px; z-index: 99998;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.cr-notify-toast {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  background: var(--modal-bg, rgba(20,22,28,.95)); border: 1px solid rgba(74,222,128,.35);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 12px; color: var(--text, #e5e7eb);
  opacity: 0; transform: translateX(14px); transition: all .22s cubic-bezier(.22,.61,.36,1);
}
.cr-notify-toast.show { opacity: 1; transform: translateX(0); }
.cr-notify-icon {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(74,222,128,.18); color: #4ade80; font-size: 11px; font-weight: 700; flex: none;
}
html[data-theme="light"] .cr-notify-toast { background: rgba(255,255,255,.97); border-color: rgba(74,222,128,.5); }

/* 项目管理主体空态提示（防止纯空白） */
.cr-level-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--text-muted, #8a8f98); font-size: 13px; text-align: center; z-index: 2;
}


/* ---- 剪辑台：专业非线性编辑器（使用系统变量/组件） ---- */
.cr-edit-tip { position: fixed; z-index: 100500; background: rgba(18,20,24,0.95); border: 1px solid var(--border-strong); color: var(--text); font-size: 11.5px; padding: 4px 9px; border-radius: 6px; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,0.45); }
/* 右键菜单：不透明背景 */
.ui-lib3-ctx { background: #17191e; backdrop-filter: none; -webkit-backdrop-filter: none; }
.cr-edit-overlay { position: fixed; inset: 0; z-index: 400; background: #101114; display: flex; flex-direction: column; color: var(--text); }
.cr-edit-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cr-edit-title { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; }
.cr-edit-project { display: flex; gap: 6px; align-items: center; min-width: 0; }
.cr-edit-project select { min-width: 160px; }
.cr-edit-export { padding: 7px 16px; border-radius: 8px; border: 1px solid rgba(74,222,128,0.4); background: rgba(74,222,128,0.14); color: var(--neon-bright); font-size: 13px; font-weight: 700; cursor: pointer; }
.cr-edit-export:hover { background: rgba(74,222,128,0.24); }
.cr-edit-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-size: 20px; cursor: pointer; display: grid; place-items: center; line-height: 1; }
.cr-edit-close:hover { background: var(--surface-hover); color: var(--text); }
.cr-edit-main { flex: 1; min-height: 0; display: flex; }

/* 左侧媒体边栏 */
.cr-edit-media { width: 400px; min-width: 280px; max-width: 1400px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); overflow: hidden; transition: width .18s ease; }
.cr-edit-media.collapsed { width: 34px !important; min-width: 34px; max-width: 34px; }
.cr-edit-media.collapsed .cr-em-tabs,
.cr-edit-media.collapsed .cr-edit-media-list,
.cr-edit-media.collapsed .cr-em-searchbar,
.cr-edit-media.collapsed .cr-edit-panel-head > span { display: none; }
.cr-edit-media.collapsed .cr-edit-panel-head { justify-content: center; padding: 8px 0; }
.cr-edit-media.collapsed .cr-edit-panel-fold { transform: rotate(180deg); }
.cr-edit-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 2px 12px; font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.cr-edit-panel-fold { width: 24px; height: 24px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; border-radius: 6px; display: grid; place-items: center; transition: transform .18s ease; }
.cr-edit-panel-fold:hover { background: var(--surface-hover); color: var(--text); }
.cr-em-tabs { display: flex; gap: 4px; padding: 4px 10px 8px; flex-wrap: nowrap; overflow-x: auto; flex-shrink: 0; }
.cr-em-tabs span { flex-shrink: 0; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--text-muted); background: var(--surface); border: 1px solid transparent; white-space: nowrap; }
.cr-em-tabs span:hover { color: var(--text-dim); }
.cr-em-tabs span.active { color: var(--neon-bright); background: rgba(74,222,128,0.14); border: 1px solid rgba(74,222,128,0.35); }
.cr-edit-media-list { flex: 1; min-height: 0; overflow: hidden; display: flex; padding: 0; }
.cr-em-searchbar { display: flex; align-items: center; gap: 4px; padding: 6px 10px 2px; flex-shrink: 0; }
.cr-em-search-ico { display: grid; place-items: center; color: var(--text-muted); width: 16px; height: 16px; margin-right: -18px; z-index: 1; pointer-events: none; }
.cr-em-search-ico svg { width: 13px; height: 13px; }
.cr-em-search { flex: 1; min-width: 0; padding-left: 24px !important; }
.cr-em-search-btn { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-muted); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-em-search-btn:hover { color: var(--neon-bright); border-color: rgba(74,222,128,0.4); }
.cr-em-search-btn svg { width: 13px; height: 13px; }
.cr-em-bins { width: 148px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; padding: 6px; }
.cr-em-bin { display: flex; align-items: center; gap: 5px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; }
.cr-em-bin:hover { background: var(--surface-hover); }
.cr-em-bin.active { background: rgba(74,222,128,0.14); color: var(--neon-bright); }
.cr-em-bin.sub { padding-left: 20px; font-size: 11.5px; }
.cr-em-bin-ico { flex-shrink: 0; font-size: 12px; }
.cr-em-bin-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cr-em-bin em { font-style: normal; font-size: 10px; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: 0 6px; flex-shrink: 0; }
.cr-em-grid { flex: 1; min-width: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); grid-auto-rows: max-content; gap: 8px; padding: 8px; align-content: start; align-items: start; }
.cr-em-badge { position: absolute; top: 4px; right: 4px; z-index: 2; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; }
.cr-em-badge.video { color: #93c5fd; }
.cr-em-badge.audio { color: #86efac; }
.cr-em-badge svg { width: 11px; height: 11px; }
.cr-edit-media-list.lib-mode { display: flex; flex-direction: column; padding: 0; gap: 0; }
.cr-em-item { border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); border: 1px solid var(--border); }
.cr-em-item:hover { border-color: rgba(74,222,128,0.45); }
.cr-em-thumb { position: relative; height: 82px; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-em-playline { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.22); z-index: 3; }
.cr-em-playline i { display: block; height: 100%; width: 0%; background: var(--neon); box-shadow: 0 0 6px rgba(74,222,128,0.8); transition: width .1s linear; }
.cr-em-name { padding: 6px 8px 2px; font-size: 11px; font-weight: 600; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-em-actions { display: flex; gap: 4px; padding: 4px 6px 6px; }
.cr-em-actions .cr-em-act { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid rgba(74,222,128,0.35); background: rgba(74,222,128,0.10); color: var(--neon-bright); cursor: pointer; }
.cr-em-actions .cr-em-act:hover { background: rgba(74,222,128,0.22); }
.cr-em-img, .cr-em-video { width: 100%; height: 100%; object-fit: contain; }
.cr-em-ph { color: var(--text-muted); font-size: 12px; }
.cr-em-name { padding: 6px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.cr-em-section { grid-column: 1 / -1; font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 8px 2px 2px; border-top: 1px dashed var(--border); }
.cr-em-section:first-child { border-top: none; }
.cr-em-actions { display: flex; gap: 4px; padding: 4px 6px; }
.cr-em-act { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid rgba(74,222,128,0.35); background: rgba(74,222,128,0.10); color: var(--neon-bright); cursor: pointer; }
.cr-em-act:hover { background: rgba(74,222,128,0.22); }
.cr-em-act.danger { border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.1); color: #f87171; }
.cr-em-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); font-size: 12px; padding: 40px 10px; line-height: 1.7; }

/* 素材仓库三栏（嵌入边栏） */
.cr-em-lib { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--border); }
.cr-em-lib-tree { width: 150px; min-width: 120px; max-width: 260px; border-right: 1px solid var(--border); overflow-y: auto; padding: 6px; flex-shrink: 0; }
.cr-em-lib-node { display: flex; align-items: center; gap: 5px; padding: 5px 6px; border-radius: 6px; font-size: 12px; color: var(--text-dim); cursor: pointer; white-space: nowrap; overflow: hidden; }
.cr-em-lib-node:hover { background: var(--surface-hover); }
.cr-em-lib-node.active { background: rgba(74,222,128,0.14); color: var(--neon-bright); }
.cr-em-lib-arrow { width: 10px; flex-shrink: 0; font-size: 9px; color: var(--text-muted); }
.cr-em-lib-ico { flex-shrink: 0; font-size: 12px; }
.cr-em-lib-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cr-em-lib-node em { font-style: normal; font-size: 10px; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: 0 6px; flex-shrink: 0; }
.cr-em-lib-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-em-lib-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); align-items: center; }
.cr-em-lib-search { flex: 1; min-width: 90px; }
.cr-em-lib-toolbar select { width: auto; }
.cr-em-lib-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 8px; align-content: start; }
.cr-em-lib-card { position: relative; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); border: 1px solid var(--border); }
.cr-em-lib-card:hover { border-color: rgba(74,222,128,0.45); }
.cr-em-lib-card.cur, .cr-em-lib-card.sel { border-color: var(--neon); box-shadow: 0 0 0 1px rgba(74,222,128,0.35); }
.cr-em-lib-thumb { position: relative; aspect-ratio: 4 / 3; background: rgba(0,0,0,0.35); display: grid; place-items: center; overflow: hidden; }
.cr-em-lib-thumb img, .cr-em-lib-thumb video { width: 100%; height: 100%; object-fit: cover; }
.cr-em-lib-badge { position: absolute; font-size: 9px; padding: 1px 5px; border-radius: 999px; background: rgba(0,0,0,0.6); color: var(--text); z-index: 2; pointer-events: none; }
.cr-em-lib-badge.video, .cr-em-lib-badge.image { left: 4px; bottom: 4px; }
.cr-em-lib-badge.trans { right: 4px; bottom: 4px; color: var(--neon-bright); }
.cr-em-lib-badge.ai { right: 4px; top: 4px; color: #38bdf8; }
.cr-em-lib-check { position: absolute; top: 4px; left: 4px; z-index: 3; width: 14px; height: 14px; accent-color: var(--neon); }
.cr-em-lib-name { padding: 5px 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.cr-em-lib-detail { width: 210px; min-width: 160px; max-width: 280px; border-left: 1px solid var(--border); overflow-y: auto; padding: 10px; flex-shrink: 0; }
.cr-em-lib-detail-name { font-size: 13px; font-weight: 700; margin-bottom: 8px; word-break: break-all; color: var(--text); }
.cr-em-lib-detail-preview { aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.35); margin-bottom: 10px; display: grid; place-items: center; }
.cr-em-lib-detail-preview img, .cr-em-lib-detail-preview video { width: 100%; height: 100%; object-fit: contain; }
.cr-em-lib-detail-meta { font-size: 11px; color: var(--text-muted); line-height: 1.9; margin-bottom: 10px; word-break: break-all; }
.cr-em-lib-detail-ai b { display: block; font-size: 11px; color: var(--text-muted); margin: 0 0 6px; }
.cr-em-lib-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.cr-em-lib-tag { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.3); color: var(--neon-bright); display: inline-flex; align-items: center; gap: 4px; }
.cr-em-lib-tag button { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 11px; padding: 0; line-height: 1; }
.cr-em-lib-none { font-size: 11px; color: var(--text-muted); }
.cr-em-lib-detail-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
[data-libresize] { width: 5px; cursor: col-resize; flex-shrink: 0; background: transparent; }
[data-libresize]:hover, [data-libresize].active { background: rgba(74,222,128,0.25); }

/* 中间合成画布 */
.cr-edit-center { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-elevated); }
.cr-edit-viewport { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; position: relative; overflow: hidden; background: #000000; }
.cr-edit-canvas { position: relative; width: auto; height: auto; aspect-ratio: 16 / 9; max-width: 100%; max-height: 100%; background: #000000; border: 1px solid var(--border); border-radius: 0; overflow: hidden; }
.cr-edit-canvas .cr-edit-layer { position: absolute; inset: 0; pointer-events: none; }
.cr-edit-canvas .cr-edit-el { position: absolute; pointer-events: auto; object-fit: contain; background: transparent; cursor: move; max-width: none; max-height: none; }
.cr-edit-canvas .cr-edit-el.sel { outline: 1.5px solid var(--neon); outline-offset: -1px; }
.cr-edit-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--text-muted); font-size: 14px; pointer-events: none; z-index: 2; }
.cr-edit-empty span { font-size: 12px; color: var(--text-dim); }
.cr-edit-ratio { position: absolute; right: 8px; top: 8px; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,0.55); color: var(--text); font-size: 11px; font-weight: 700; z-index: 5; }
.cr-edit-selectbox { position: absolute; border: 1px solid #38bdf8; background: rgba(56,189,248,0.12); display: none; z-index: 6; pointer-events: none; }
.cr-edit-handles { position: absolute; border: 1px dashed var(--neon); pointer-events: none; z-index: 4; transform: translate(-50%,-50%); }
.cr-edit-h { position: absolute; width: 10px; height: 10px; background: var(--neon); border-radius: 2px; pointer-events: auto; box-shadow: 0 0 0 1px rgba(0,0,0,0.4); }
.cr-edit-h[data-h="tl"] { left: -5px; top: -5px; cursor: nwse-resize; }
.cr-edit-h[data-h="tr"] { right: -5px; top: -5px; cursor: nesw-resize; }
.cr-edit-h[data-h="bl"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.cr-edit-h[data-h="br"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.cr-edit-h[data-h="t"] { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.cr-edit-h[data-h="b"] { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.cr-edit-h[data-h="l"] { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.cr-edit-h[data-h="r"] { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }

/* 右侧属性边栏 */
.cr-edit-props { width: 264px; min-width: 220px; max-width: 460px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; transition: width .18s ease; }
.cr-edit-props.collapsed { width: 34px !important; min-width: 34px; max-width: 34px; }
.cr-edit-props.collapsed .cr-edit-props-body { display: none; }
.cr-edit-props.collapsed .cr-edit-props-title span { display: none; }
.cr-edit-props.collapsed .cr-edit-props-title { justify-content: center; padding: 8px 0; }
.cr-edit-props.collapsed .cr-edit-panel-fold { transform: rotate(180deg); }
.cr-edit-props-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 14px; font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--border); color: var(--text-muted); flex-shrink: 0; }
.cr-edit-props-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.cr-edit-props-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 24px 6px; }
.cr-edit-prop-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.cr-edit-prop-group b { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.cr-edit-prop-group label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); margin-bottom: 6px; }
.cr-edit-prop-group input[type="number"], .cr-edit-prop-group input[type="text"] { flex: 1; min-width: 0; padding: 4px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 12px; }
.cr-edit-prop-group input[type="range"] { flex: 1; accent-color: var(--neon); }
.cr-edit-prop-group select { flex: 1; padding: 4px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 12px; }

/* 分割条 */
.cr-edit-resize { width: 6px; cursor: col-resize; background: transparent; position: relative; z-index: 8; flex-shrink: 0; }
.cr-edit-resize:hover, .cr-edit-resize.active { background: rgba(74,222,128,0.28); }
.cr-edit-monitors { flex: 1; min-height: 0; display: flex; }
.cr-edit-program { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-edit-source-transport { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 8px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.cr-edit-source-transport button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-edit-source-transport button:hover { background: var(--surface-hover); color: var(--text); }
.cr-edit-source-transport button svg { width: 15px; height: 15px; }
.cr-edit-source-transport .cr-ec-play { width: 32px; height: 32px; }
.cr-edit-source { width: 46%; min-width: 320px; max-width: 62%; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.cr-edit-source[hidden] { display: none !important; }
.cr-edit-source-head { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-bottom: 1px solid var(--border); font-size: 11px; flex-shrink: 0; }
.cr-edit-source-title { font-weight: 700; color: var(--text); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-edit-source-head button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-edit-source-head button:hover { background: var(--surface-hover); color: var(--text); }
.cr-edit-source-head button svg { width: 14px; height: 14px; }
.cr-edit-source-body { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 10px; background: #000000; }
.cr-edit-source.focused .cr-edit-source-body { box-shadow: inset 0 0 0 1px rgba(74,222,128,0.55); }
.cr-edit-program.focused .cr-edit-viewport { box-shadow: inset 0 0 0 1px rgba(74,222,128,0.35); }
.cr-edit-timeline.focused .cr-edit-scroll-x { box-shadow: inset 0 0 0 1px rgba(74,222,128,0.22); }
.cr-edit-source-media { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 0; }
.cr-edit-source-empty { color: var(--text-muted); text-align: center; font-size: 12px; line-height: 1.9; padding: 20px; }
.cr-edit-transport { display: flex; align-items: center; gap: 4px; padding: 5px 12px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.cr-et-tr-left, .cr-et-tr-center, .cr-et-tr-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.cr-et-tr-center { margin: 0 auto; }
.cr-edit-transport button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-edit-transport button:hover { background: var(--surface-hover); color: var(--text); }
.cr-edit-transport button.on { color: var(--neon-bright); background: rgba(74,222,128,0.14); }
.cr-edit-transport button svg { width: 15px; height: 15px; }
.cr-edit-transport .cr-ec-play { width: 32px; height: 32px; }
.cr-et-vol-label { font-size: 11px; color: var(--text-muted); }
.cr-et-rate { font-size: 11px; font-weight: 700; color: var(--neon-bright); min-width: 24px; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cr-edit-transport input[type="range"] { width: 90px; accent-color: var(--neon); }
.cr-edit-resize-h { height: 6px; cursor: row-resize; background: transparent; position: relative; z-index: 8; flex-shrink: 0; }
.cr-edit-resize-h:hover, .cr-edit-resize-h.active { background: rgba(74,222,128,0.28); }

/* 底部时间轴 */
.cr-edit-timeline { height: 252px; min-height: 150px; border-top: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
.cr-edit-tl-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.cr-et-tl-main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px; }
.cr-et-tl-right { flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.cr-et-tl-right input[type="range"] { width: 80px; }
.cr-et-tl-sep { width: 1px; height: 16px; background: var(--border); margin: 0 6px; }
.cr-edit-tl-toolbar button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-edit-tl-toolbar button:hover { background: var(--surface-hover); color: var(--text); }
.cr-edit-tl-toolbar button.on { color: var(--neon-bright); background: rgba(74,222,128,0.14); }
.cr-edit-tl-toolbar button svg { width: 16px; height: 16px; }
.cr-edit-tl-toolbar input[type="range"] { width: 110px; accent-color: var(--neon); flex-shrink: 0; }
.cr-et-timecode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--neon-bright); padding: 0 4px 0 10px; white-space: nowrap; }
.cr-et-total { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cr-ec-play { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(74,222,128,0.35); background: rgba(74,222,128,0.12); color: var(--neon-bright); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cr-ec-play:hover { background: rgba(74,222,128,0.22); }
.cr-ec-play svg { width: 15px; height: 15px; }
.cr-edit-scroll-x { flex: 1; min-width: 0; min-height: 0; overflow-x: scroll; overflow-y: hidden; position: relative; display: flex; flex-direction: column; }
.cr-edit-scroll-x.panning { cursor: grabbing; }
.cr-edit-scroll-x.panning * { cursor: grabbing !important; }
.cr-edit-ruler { position: relative; height: 28px; flex-shrink: 0; border-bottom: 1px solid var(--border); background: var(--surface); min-width: 100%; }
.cr-et-ruler-tick { position: absolute; bottom: 0; width: 1px; height: 7px; background: rgba(255,255,255,0.07); }
.cr-et-ruler-tick.sec { height: 13px; background: rgba(255,255,255,0.14); }
.cr-et-ruler-tick.main { height: 20px; width: 1.5px; background: rgba(255,255,255,0.30); }
.cr-et-ruler-label { position: absolute; top: 2px; font-size: 10px; font-weight: 500; color: var(--text-muted); transform: translateX(3px); white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); padding: 0 3px; border-radius: 3px; line-height: 1.4; }
.cr-et-dropzone { display: none !important; }
.cr-et-dropzone.show { display: block; }
.cr-et-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 9; cursor: ew-resize; pointer-events: auto; box-shadow: 0 0 6px rgba(239,68,68,0.6); } /* 播放头位于所有轨道元素最上层；下拉菜单 z-index 60 例外 */
.cr-et-playhead::before { content: ''; position: absolute; top: 0; left: -5px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid #ef4444; }
.cr-edit-tracks-body { flex: 1; min-height: 0; display: flex; }
.cr-edit-tracks-head { position: relative; width: 196px; flex-shrink: 0; border-right: 1px solid var(--border); overflow: hidden; background: var(--surface); z-index: 6; display: flex; flex-direction: column; box-sizing: border-box; } /* z-index 高于调速表头(5)：滚动到轨道头下方时由轨道头遮挡，不做代码偏移避让 */
.cr-edit-st-head { flex-shrink: 0; }
.cr-et-th-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.cr-edit-tl-corner { height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.cr-et-th-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.cr-edit-tl-corner span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 700; color: var(--neon-bright); letter-spacing: 0.5px; }
.cr-et-trackhead { position: relative; display: flex; align-items: center; gap: 5px; padding: 0 7px; border-bottom: 1px solid var(--border); cursor: grab; box-sizing: border-box; flex-shrink: 0; }
.cr-et-th-resize { position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; cursor: row-resize; z-index: 6; background: rgba(255,255,255,0.08); }
.cr-et-th-resize:hover { background: rgba(74,222,128,0.4); }
.cr-et-th-resize::after { content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 2px; border-radius: 2px; background: rgba(255,255,255,0.28); }
.cr-et-th-resize:hover::after { background: var(--neon); }
.cr-et-trackhead.video { background: rgba(59,130,246,0.07); border-left: 3px solid #3b82f6; }
.cr-et-trackhead.audio { background: rgba(34,197,94,0.07); border-left: 3px solid #22c55e; }
.cr-et-trackhead.subtitle { background: rgba(148,163,184,0.09); border-left: 3px solid #94a3b8; }
.cr-et-track-label { flex-shrink: 0; font-size: 10px; font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,0.35); color: var(--text); }
.cr-et-trackhead.video .cr-et-track-label { color: #93c5fd; }
.cr-et-trackhead.audio .cr-et-track-label { color: #86efac; }
.cr-et-trackhead.subtitle .cr-et-track-label { color: #cbd5e1; }
.cr-et-track-icon { display: grid; place-items: center; width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.cr-et-track-icon svg { width: 13px; height: 13px; }
.cr-et-track-name { flex: 1; min-width: 0; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-et-track-btns { display: flex; flex-wrap: nowrap; gap: 1px; flex-shrink: 0; align-items: center; }
.cr-et-track-btns button { width: 17px; height: 17px; border: none; background: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; border-radius: 4px; padding: 0; flex-shrink: 0; }
.cr-et-track-btns button svg { width: 12px; height: 12px; }
.cr-et-trackhead:active { cursor: grabbing; }
.cr-et-trackhead-add { padding: 6px 8px; }
.cr-et-trackhead-add button { font-size: 11px; padding: 4px 10px; border-radius: 6px; border: 1px dashed rgba(74,222,128,0.4); background: transparent; color: var(--neon-bright); cursor: pointer; width: 100%; }
.cr-et-trackhead-add button:hover { background: rgba(74,222,128,0.1); }
.cr-edit-st-tracks { flex-shrink: 0; }
.cr-edit-tracks { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; display: flex; flex-direction: column; padding: 0; }
.cr-edit-tracks.centered { justify-content: center; }
.cr-et-track { position: relative; border-bottom: 1px solid var(--border); box-sizing: border-box; flex-shrink: 0; }
.cr-et-track.video { background: rgba(59,130,246,0.05); --cr-clip-border: #2d84ad; --cr-clip-name-bg: #2d84ad; }
.cr-et-track.audio { background: rgba(34,197,94,0.05); --cr-clip-border: #239c6e; --cr-clip-name-bg: #239c6e; }
.cr-et-track.subtitle { background: rgba(148,163,184,0.06); }
.cr-et-clip { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; overflow: hidden; background: var(--bg-elevated); border: 2px solid var(--cr-clip-border, var(--border)); cursor: pointer; min-width: 16px; box-sizing: border-box; }
.cr-et-clip:hover { border-color: rgba(249,115,22,0.6); }
.cr-et-clip.selected { border-color: #ef4444 !important; outline: 2px solid rgba(239,68,68,0.9); outline-offset: 0; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.cr-et-clip.locked { opacity: 0.55; }
/* 跨轨拖动：原轨道片段半透明显示（源片段），目标轨拖拽预览保持正常 */
/* 跨轨拖动：原轨道片段直接不显示（不透明残留），避免与拖拽预览叠影 */
.cr-et-clip.cr-et-drag-origin { display: none !important; }
.cr-et-clip.disabled { opacity: 0.5; filter: grayscale(0.6); }
.cr-et-clip.grouped { border-style: dashed; }
.cr-et-frame { position: absolute; top: 0; bottom: 18px; background: linear-gradient(180deg, rgba(74,222,128,0.25), rgba(59,130,246,0.3)); opacity: 0.8; pointer-events: none; }
.cr-et-film { position: absolute; top: 0; left: 0; width: 100%; height: calc(100% - 18px); object-fit: cover; object-position: center center; pointer-events: none; display: block; }
.cr-et-clip-name { position: absolute; left: 0; right: 0; bottom: 0; height: 17px; line-height: 17px; padding: 0 6px; font-size: 9.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 3; pointer-events: none; background: var(--cr-clip-name-bg, rgba(22,24,28,0.94)); border-top: 1px solid rgba(255,255,255,0.14); box-sizing: border-box; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.cr-et-speed { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: #fff; background: rgba(16,34,52,0.85); padding: 1px 6px; border-radius: 3px; z-index: 4; cursor: pointer; white-space: nowrap; }
.cr-speed-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cr-speed-presets button { font-size: 12px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.cr-speed-presets button:hover { border-color: rgba(74,222,128,0.45); }
.cr-speed-presets button.active { background: rgba(74,222,128,0.16); border-color: rgba(74,222,128,0.5); color: var(--neon-bright); }

/* ── 速度更改：片段底部状态栏 + 顶部全局调速条 + 下拉菜单 + 片段内速度控制点 ── */
/* 底部状态栏：无外边框、无自定义背景（继承片段标题栏原有颜色），倍率文字居左，行高小幅加高 */
.cr-et-speedbar { position: absolute; left: 0; right: 0; bottom: 0; height: 19px; display: flex; align-items: center; justify-content: center; gap: 1px; padding: 0 4px; font-size: 10px; font-weight: 700; color: #fff; background: transparent; z-index: 7; box-sizing: border-box; pointer-events: none; }
/* 分段速度条：按分段宽度定位（inline left/width 覆盖），不受 right:0 影响 */
.cr-et-speedbar-seg { right: auto; }
/* 数值：仅文字本身，无背景色块 */
.cr-et-speedbar-val { line-height: 19px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: transparent; text-shadow: 0 1px 2px rgba(0,0,0,0.7); }
/* 小箭头：紧贴 100% 文字右侧（跟随文字一起居中），放大字号，无底色无边框 */
.cr-et-speedbar-btn { border: none; background: transparent; color: #fff; font-size: 17px; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; padding: 0 0 0 1px; pointer-events: auto; text-shadow: 0 1px 2px rgba(0,0,0,0.7); transform: translateY(-2px); } /* ▾ 字形视觉偏低，向上微调 2px 与 100% 文字对齐 */
.cr-et-speedbar-btn:hover { color: #4ade80; }
/* 打开速度调整后：隐藏标题文字但保留标题栏颜色背景（100% 下方显示片段本身颜色，而不是黑色） */
.cr-et-clip.sp-ui .cr-et-clip-name { color: transparent; text-shadow: none; }
/* 打开更改速度后：该片段两边的淡入淡出拖拽图标一并隐藏（功能停用，避免与速度控制冲突） */
.cr-et-clip.sp-ui ~ .cr-et-fade-l, .cr-et-clip.sp-ui ~ .cr-et-fade-r { display: none; }
/* 顶部全局调速条（R 激活显示，紧贴片段框上部，不挤压片段） */
.cr-et-speed-topbar { position: fixed; z-index: 5; height: 24px; /* z 低于播放头(9)：播放头红线压在面板上方，面板不遮挡/不压在红线上 */ display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 11px; font-weight: 700; color: #fff; background: #0d1b2a; border: none; border-radius: 6px; box-sizing: border-box; cursor: default; user-select: none; box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
.cr-et-stopbar-label { white-space: nowrap; }
/* 关闭按钮：仅 × 图标，无边框、无底色，放在“更改速度”文字前面（居左） */
.cr-et-stopbar-close { width: 20px; height: 20px; border: none; background: transparent; color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.cr-et-stopbar-close:hover { color: #ef4444; }
/* 调速表头分段热区：每个分段的右侧边线窄区域可拖动调速（左快右慢），中间大片区域不响应 */
.cr-et-stopbar-seg { position: absolute; top: 0; bottom: 0; right: 0; width: 10px; cursor: ew-resize; background: rgba(255,255,255,0.16); border-right: 1px solid rgba(255,255,255,0.6); box-shadow: -1px 0 0 rgba(0,0,0,0.35); z-index: 1; }
.cr-et-stopbar-seg:hover { background: rgba(255,255,255,0.34); }
/* 下拉菜单：z-index 60 高于播放头(9)，弹出时盖住播放头 */
.cr-et-speed-menu { position: fixed; z-index: 60; min-width: 152px; background: #17191e; border: 1px solid var(--border-strong); border-radius: 9px; padding: 4px; box-shadow: 0 12px 30px rgba(0,0,0,0.6); user-select: none; }
.cr-et-speed-menu button { display: block; width: 100%; text-align: left; font-size: 12px; color: var(--text); background: transparent; border: none; border-radius: 6px; padding: 5px 9px; cursor: pointer; white-space: nowrap; }
.cr-et-speed-menu button:hover { background: rgba(74,222,128,0.14); color: var(--neon-bright); }
.cr-et-speed-menu button:disabled { opacity: 0.4; cursor: not-allowed; }
.cr-et-speed-menu button:disabled:hover { background: transparent; color: var(--text); }
.cr-et-speed-menu .cr-et-sm-sub b { float: right; opacity: 0.65; font-weight: 400; }
.cr-et-sm-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.cr-et-sm-submenu { position: absolute; left: calc(100% - 2px); top: 0; min-width: 120px; background: #17191e; border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px; box-shadow: 0 10px 26px rgba(0,0,0,0.55); }
.cr-et-sm-submenu[hidden] { display: none; }
/* 片段内速度控制点：竖线贯穿到标题栏下方；顶部手柄=白灰色 SVG 图标；下方竖条=时间位置；
   整个速度点与竖线整体加阴影 */
.cr-et-sppt { position: absolute; top: 0; bottom: 0; width: 0; z-index: 6; pointer-events: none; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.9)); } /* 硬阴影：速度点 + 竖线整体 */
.cr-et-sppt-ln { position: absolute; left: -0.5px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.7); }
.cr-et-sppt-upper { position: absolute; left: -8px; top: -1px; width: 26px; height: 18px; pointer-events: none; z-index: 8; }
.cr-et-sppt-upper-icon { position: absolute; left: 0; top: 1px; width: 16px; height: 16px; display: block; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.9)); } /* 顶部圆点头部：硬阴影 */
/* 左半=前段、右半=后段；两半都可水平拖拽调速，右侧略外扩便于抓取 */
.cr-et-sppt-upper-zone { position: absolute; top: 0; bottom: 0; cursor: ew-resize; pointer-events: auto; }
.cr-et-sppt-upper-l { left: 0; width: 45%; }
.cr-et-sppt-upper-r { right: 0; width: 60%; }
.cr-et-sppt-lower { position: absolute; left: -4px; bottom: 18px; width: 8px; height: 11px; background: #fff; border-radius: 2px 2px 0 0; cursor: ew-resize; pointer-events: auto; z-index: 8; box-shadow: 1px 1px 0 rgba(0,0,0,0.9); } /* 下方位置点：硬阴影 */
.cr-et-sppt-end .cr-et-sppt-ln { background: rgba(255,255,255,0.35); }

/* ── 片段码表标记：速度被修改过（全局≠1 或开启分段控制点）才显示，左下角，不可点击 ── */
.cr-et-speed-badge { position: absolute; left: 3px; bottom: 19px; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; color: #fff; background: transparent; border: none; border-radius: 0; padding: 0; z-index: 4; pointer-events: none; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.9)); }
.cr-et-speed-badge svg { width: 14px; height: 14px; display: block; }

/* ── 片段淡入淡出：边角白色三角拖拽手柄 + 胶片上透明度渐变 ── */
/* 淡入淡出：边角 SVG 拖拽图标浮在片段外侧，hover 片段才显示；遮罩为斜线硬切压暗（非透明，不露时间线背景） */
/* 边角淡入淡出图标：缩小一号、垂直居中于片段边缘中线；纯白填充 + 深灰描边；位置跟随淡入/淡出控制点 X */
/* 淡入淡出边角图标：扩大 hover 显示与命中区域（clip hover 或 图标自身 hover 均显示，带放大命中区防消失） */
.cr-et-fade-l, .cr-et-fade-r { position: absolute; width: 12px; height: 12px; z-index: 8; cursor: default; pointer-events: auto; opacity: 0; transition: opacity .12s ease; transform: translateX(-50%); }
.cr-et-fade-l::before, .cr-et-fade-r::before { content: ''; position: absolute; inset: -12px; border-radius: 8px; }
.cr-et-fade-l svg, .cr-et-fade-r svg { width: 12px; height: 12px; display: block; fill: #ffffff; stroke: #000000; stroke-width: 72; paint-order: stroke fill; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
/* hover 显示：片段本身 hover、图标自身 hover（含放大命中区）均保持可见，避免移到图标时消失/错乱 */
.cr-et-clip:hover ~ .cr-et-fade-l, .cr-et-clip:hover ~ .cr-et-fade-r,
.cr-et-fade-l:hover, .cr-et-fade-r:hover { opacity: 1; }
.cr-et-fade-l:hover, .cr-et-fade-r:hover { color: #4ade80; }
.cr-et-fade-ovl { position: absolute; top: 0; bottom: 18px; z-index: 3; pointer-events: none; }
/* 轨道片段上的淡入淡出指示（深色主题高对比）：整块高度覆盖、起始/末端 alpha≈0.85 平滑衰减到 0；
   内侧边界加一条细半透白竖线标出淡入结束/淡出开始位置；常驻显示；仅轨道 UI，不影响播放器（播放器只做 opacity） */
.cr-et-fade-ovl-l { left: 0; width: var(--fade-x); background: linear-gradient(90deg, rgba(255,255,255,0.85), rgba(255,255,255,0)); }
.cr-et-fade-ovl-l::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.75); }
.cr-et-fade-ovl-r { right: 0; width: var(--fade-x); background: linear-gradient(270deg, rgba(255,255,255,0.85), rgba(255,255,255,0)); }
.cr-et-fade-ovl-r::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.75); }

.cr-clip-colors { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cr-clip-colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; }
.cr-clip-colors button:hover { border-color: var(--neon); }
.cr-et-clip.linked::after { content: '⛓'; position: absolute; right: 3px; top: 2px; font-size: 9px; color: rgba(255,255,255,0.75); z-index: 5; pointer-events: none; }
.cr-et-wave { position: absolute; left: 4px; right: 4px; bottom: 19px; height: 16px; z-index: 2; pointer-events: none; opacity: 0.85; }
/* 修剪热区（轨道层）：整条侧边高度跟随片段（top:6px/bottom:6px 与片段内边距一致），
   内 16px + 外 16px 内外都可 hover/拖拽；进入热区即切换修剪光标，不渲染 SVG 图标；
   左=left-trim.svg，右=独立镜像 right-trim.svg（cursor 不能 transform）；行高变化自动同步；音频/视频统一 */
.cr-et-trim-l, .cr-et-trim-r { position: absolute; top: 6px; bottom: 6px; z-index: 5; pointer-events: auto; }
.cr-et-trim-l { cursor: url('/images/left-trim.svg') 1 14, ew-resize; }
.cr-et-trim-r { cursor: url('/images/right-trim.svg') 19 14, ew-resize; }

/* 全屏预览 */
.cr-edit-fullscreen .cr-edit-timeline { display: none; }
.cr-edit-fullscreen .cr-edit-media, .cr-edit-fullscreen .cr-edit-props, .cr-edit-fullscreen .cr-edit-source { display: none; }
.cr-edit-fullscreen .cr-edit-viewport { padding: 20px; }

/* 时间轴滚动条（横向滚动条强制常显，避免内容被截断却看不到滚动条） */
.cr-edit-scroll-x::-webkit-scrollbar, .cr-edit-tracks::-webkit-scrollbar, .cr-edit-tracks-head::-webkit-scrollbar,
.cr-edit-tl-toolbar::-webkit-scrollbar, .cr-edit-media-list::-webkit-scrollbar, .cr-em-tabs::-webkit-scrollbar,
.cr-em-lib-tree::-webkit-scrollbar, .cr-em-lib-grid::-webkit-scrollbar, .cr-em-lib-detail::-webkit-scrollbar,
.cr-edit-props-body::-webkit-scrollbar { width: 8px; height: 10px; }
.cr-edit-scroll-x::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.28); border-radius: 5px; }
.cr-edit-scroll-x::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }
.cr-edit-scroll-x::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); }
.cr-edit-scroll-x::-webkit-scrollbar-thumb, .cr-edit-tracks::-webkit-scrollbar-thumb, .cr-edit-tracks-head::-webkit-scrollbar-thumb,
.cr-edit-tl-toolbar::-webkit-scrollbar-thumb, .cr-edit-media-list::-webkit-scrollbar-thumb, .cr-em-tabs::-webkit-scrollbar-thumb,
.cr-em-lib-tree::-webkit-scrollbar-thumb, .cr-em-lib-grid::-webkit-scrollbar-thumb, .cr-em-lib-detail::-webkit-scrollbar-thumb,
.cr-edit-props-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.cr-edit-scroll-x::-webkit-scrollbar-track, .cr-edit-tracks::-webkit-scrollbar-track, .cr-edit-tracks-head::-webkit-scrollbar-track,
.cr-edit-tl-toolbar::-webkit-scrollbar-track, .cr-edit-media-list::-webkit-scrollbar-track, .cr-em-tabs::-webkit-scrollbar-track,
.cr-em-lib-tree::-webkit-scrollbar-track, .cr-em-lib-grid::-webkit-scrollbar-track, .cr-em-lib-detail::-webkit-scrollbar-track,
.cr-edit-props-body::-webkit-scrollbar-track { background: transparent; }

/* ── 视频-音频固定分界线：隔开视频轨组（上）与音频轨组（下），不可拖拽 ── */
.cr-et-divider-head, .cr-et-divider-row { flex-shrink: 0; box-sizing: border-box; }
.cr-et-divider-row { position: relative; background: rgba(120,120,140,0.07); border-top: 1px solid rgba(255,255,255,0.16); border-bottom: 1px solid rgba(255,255,255,0.16); pointer-events: none; }
.cr-et-divider-row::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: linear-gradient(90deg, rgba(59,130,246,0.55), rgba(148,163,184,0.5), rgba(34,197,94,0.55)); transform: translateY(-50%); }
.cr-et-divider-row::after { content: '视频轨 / 音频轨'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 9px; letter-spacing: 1px; color: rgba(255,255,255,0.45); background: var(--surface); padding: 0 7px; border-radius: 3px; line-height: 1.6; white-space: nowrap; }
.cr-et-divider-head { height: 14px; display: flex; align-items: center; justify-content: center; border-top: 1px solid rgba(255,255,255,0.16); border-bottom: 1px solid rgba(255,255,255,0.16); background: rgba(120,120,140,0.07); }
.cr-et-divider-head span { font-size: 9px; letter-spacing: 1px; color: rgba(255,255,255,0.45); white-space: nowrap; }

/* 跨分界线拖拽：禁止光标 */
body.cr-et-forbidden, body.cr-et-forbidden * { cursor: not-allowed !important; }

/* ── 拖拽真实样式预览（非半透明虚影，与正式片段UI完全一致） ── */
.cr-et-preview-row { position: absolute; left: 0; z-index: 12; pointer-events: none; box-sizing: border-box; }
.cr-et-preview-row.video { background: transparent; }
.cr-et-preview-row.audio { background: transparent; }
.cr-et-preview { pointer-events: none !important; opacity: 1 !important; } /* 与最终落位片段UI完全一致，不添加识别描边 */
.cr-et-preview-tip { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); z-index: 13; font-size: 10px; font-weight: 600; color: #fff; background: rgba(249,115,22,0.92); padding: 2px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }

/* ── 字幕片段与文字动画 ── */
.cr-et-clip.subtitle { display: flex; align-items: center; justify-content: center; background: rgba(148,163,184,0.10); border-color: rgba(148,163,184,0.45); }
.cr-et-clip.subtitle .cr-et-clip-name { display: none; }
.cr-et-subtxt { position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); text-align: center; font-size: 12px; font-weight: 700; color: #e2e8f0; pointer-events: none; z-index: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 1px; }
.cr-edit-subtitle { position: absolute; transform: translate(-50%,-50%); color: #fff; font-weight: 800; text-align: center; white-space: pre-wrap; line-height: 1.25; pointer-events: none; z-index: 5; text-shadow: 0 2px 10px rgba(0,0,0,0.85), 0 0 2px rgba(0,0,0,0.6); letter-spacing: 2px; }
.cr-edit-subtitle.sel { outline: 2px solid #f97316; outline-offset: 4px; }

/* ── 拖拽信息徽标：实时显示片段时长与插入时间点 ── */
.cr-et-drag-info { position: fixed; z-index: 100001; background: rgba(10,12,16,0.94); border: 1px solid rgba(74,222,128,0.55); color: #e5f6e9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; padding: 4px 9px; border-radius: 6px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,0.45); white-space: nowrap; letter-spacing: 0.3px; }


/* ── 时间线入点/出点标记 + 导出范围条 ── */
.cr-et-inout-range { position: absolute; top: 0; bottom: 0; background: rgba(59,130,246,0.20); border-left: 1px solid rgba(34,211,238,0.7); border-right: 1px solid rgba(239,68,68,0.7); z-index: 5; pointer-events: none; }
.cr-et-inout-in, .cr-et-inout-out { position: absolute; top: 0; width: 0; z-index: 6; pointer-events: none; }
.cr-et-inout-in::before { content: ''; position: absolute; left: -5px; top: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #22d3ee; }
.cr-et-inout-in::after { content: ''; position: absolute; left: -1px; top: 6px; width: 2px; bottom: 0; background: #22d3ee; box-shadow: 0 0 5px rgba(34,211,238,0.8); }
.cr-et-inout-out::before { content: ''; position: absolute; left: -5px; top: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #ef4444; }
.cr-et-inout-out::after { content: ''; position: absolute; left: -1px; top: 6px; width: 2px; bottom: 0; background: #ef4444; box-shadow: 0 0 5px rgba(239,68,68,0.8); }

/* ── 磁吸对齐参考线（吸附时金色竖线） ── */
.cr-et-snap-guide { position: absolute; top: 0; width: 1px; background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.9); z-index: 8; pointer-events: none; }

/* ── 跟随鼠标的拖拽预览（进入时间线后切换为普通片段样式） ── */
.cr-et-drag-follow { position: fixed; z-index: 100000; pointer-events: none; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45)); }
.cr-et-df-block { position: absolute; border-radius: 6px; overflow: hidden; box-shadow: 0 6px 14px rgba(0,0,0,0.4); background: #1c2026; border: 1px solid rgba(255,255,255,0.14); }
.cr-et-df-block .cr-et-clip { position: absolute; left: 0; top: 6px; bottom: 6px; width: 100% !important; background: transparent !important; }
/* 拖拽预览块内的胶片图：底层先显示素材缩略图背景，帧图加载后盖在上面 */
.cr-et-df-block .cr-et-film { background: transparent; position: absolute; z-index: 2; }
.cr-et-df-block .cr-et-df-thumbimg { z-index: 1; }
.cr-et-df-block .cr-et-clip-name { z-index: 3; }
.cr-et-df-thumb { border-radius: 6px; border: 1px solid var(--border); box-shadow: 0 6px 14px rgba(0,0,0,0.4); background-color: #1a1c20; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 20px; }

/* ── 源素材播放条：播放头 + 入点/出点标记（精致样式） ── */
.cr-edit-source-scrub { position: relative; height: 28px; margin: 2px 12px 6px; background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; cursor: pointer; flex-shrink: 0; user-select: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 6px rgba(0,0,0,0.3); }
.cr-edit-source-scrub::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: var(--scrub-progress, 0%); background: linear-gradient(90deg, rgba(74,222,128,0.22), rgba(74,222,128,0.08)); border-radius: 8px 0 0 8px; pointer-events: none; }
.cr-edit-source-scrub:hover { border-color: rgba(74,222,128,0.4); }
.cr-edit-source-scrub-track { position: absolute; top: 50%; left: 12px; right: 12px; height: 4px; transform: translateY(-50%); background: rgba(255,255,255,0.12); border-radius: 3px; }
.cr-edit-source-in { position: absolute; top: 4px; bottom: 4px; width: 3px; background: #22c55e; z-index: 3; border-radius: 2px; box-shadow: 0 0 6px rgba(34,197,94,0.8); display: none; }
.cr-edit-source-in::before { content: ''; position: absolute; top: -1px; left: -5px; border-right: 7px solid #22c55e; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.cr-edit-source-out { position: absolute; top: 4px; bottom: 4px; width: 3px; background: #ef4444; z-index: 3; border-radius: 2px; box-shadow: 0 0 6px rgba(239,68,68,0.8); display: none; }
.cr-edit-source-out::before { content: ''; position: absolute; top: -1px; right: -5px; border-left: 7px solid #ef4444; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.cr-edit-source-scrub-head { position: absolute; top: 50%; width: 12px; height: 12px; transform: translate(-50%, -50%); background: #f8fafc; border-radius: 50%; z-index: 4; box-shadow: 0 0 0 3px rgba(248,250,252,0.16), 0 1px 5px rgba(0,0,0,0.65); }
.cr-edit-source-scrub-head::after { content: ''; position: absolute; top: 50%; left: 50%; width: 2px; height: 18px; transform: translate(-50%, -50%); background: rgba(248,250,252,0.5); border-radius: 1px; }
.cr-edit-source-body[draggable="true"] { cursor: grab; }
.cr-edit-source-body[draggable="true"]:active { cursor: grabbing; }

/* ═══════════════════════════════════════════════════════════════════════════
   时间线轨道区域 UI 视觉翻新（仅外观样式，不改任何拖拽/吸附/插入/替换逻辑）
   风格：深色专业剪辑界面 · 极简 · 半透明 / 渐变 / 细线 / 发光 / 圆角卡片
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. 时间线整体背景 ── */
.cr-edit-timeline {
  background: linear-gradient(180deg, #13161b 0%, #0e1014 100%);
  border-top-color: rgba(255,255,255,0.06);
}
.cr-edit-tl-toolbar {
  background: rgba(255,255,255,0.015);
  border-bottom-color: rgba(255,255,255,0.05);
}
.cr-edit-tl-toolbar button { border-radius: 8px; }
.cr-edit-tl-toolbar button:hover { background: rgba(255,255,255,0.07); color: #fff; }
.cr-edit-tl-toolbar button.on { background: rgba(74,222,128,0.12); box-shadow: inset 0 0 0 1px rgba(74,222,128,0.22); }
.cr-edit-tl-toolbar input[type="range"] { accent-color: #4ade80; }

/* ── 2. 轨道头：轻量胶囊标签 + hover 才突出的图标按钮 ── */
.cr-edit-tracks-head {
  background: linear-gradient(180deg, rgba(255,255,255,0.024), rgba(255,255,255,0.008));
  border-right-color: rgba(255,255,255,0.06);
  /* 保留 position/z-index：调速表头遮挡规则不变 */
}
.cr-edit-tl-corner { background: transparent; border-bottom-color: rgba(255,255,255,0.05); }
.cr-edit-tl-corner span { color: rgba(255,255,255,0.55); font-weight: 600; font-size: 13px; letter-spacing: 0.4px; }

.cr-et-trackhead {
  padding: 0 10px;
  gap: 7px;
  background: transparent;
  border-bottom-color: rgba(255,255,255,0.045);
}
.cr-et-trackhead.video, .cr-et-trackhead.audio, .cr-et-trackhead.subtitle {
  border-left: none;
  background: transparent;
}
/* 类型微区分：左侧 2px 细高亮线（轻），不再用厚重色块 */
.cr-et-trackhead.video { box-shadow: inset 2px 0 0 rgba(96,165,250,0.32); }
.cr-et-trackhead.audio { box-shadow: inset 2px 0 0 rgba(74,222,128,0.32); }
.cr-et-trackhead.subtitle { box-shadow: inset 2px 0 0 rgba(148,163,184,0.32); }

/* 胶囊轨道编号 */
.cr-et-track-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.7);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 1px 2px rgba(0,0,0,0.25);
}
.cr-et-trackhead.video .cr-et-track-label { color: rgba(147,197,253,0.92); background: rgba(59,130,246,0.14); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.22), 0 0 12px rgba(59,130,246,0.10); }
.cr-et-trackhead.audio .cr-et-track-label { color: rgba(134,239,172,0.92); background: rgba(34,197,94,0.13); box-shadow: inset 0 0 0 1px rgba(74,222,128,0.20), 0 0 12px rgba(34,197,94,0.10); }
.cr-et-trackhead.subtitle .cr-et-track-label { color: rgba(203,213,225,0.90); background: rgba(148,163,184,0.15); box-shadow: inset 0 0 0 1px rgba(148,163,184,0.24); }

.cr-et-track-icon { color: rgba(255,255,255,0.38); }
.cr-et-track-name { color: rgba(255,255,255,0.42); font-size: 10px; letter-spacing: 0.2px; }

/* 控制按钮：默认极淡，hover 才突出 */
.cr-et-track-btns { gap: 2px; }
.cr-et-track-btns button {
  width: 20px; height: 20px;
  border-radius: 6px;
  color: rgba(255,255,255,0.30);
  opacity: 0.72;
  transition: color .12s ease, background .12s ease, opacity .12s ease;
}
.cr-et-trackhead:hover .cr-et-track-btns button { opacity: 1; }
.cr-et-track-btns button:hover { color: #fff; background: rgba(255,255,255,0.10); }
.cr-et-track-btns button svg { width: 13px; height: 13px; }

.cr-et-th-resize { background: transparent; }
.cr-et-th-resize::after { height: 1px; top: 4px; background: rgba(255,255,255,0.10); }
.cr-et-th-resize:hover::after { background: rgba(74,222,128,0.75); box-shadow: 0 0 6px rgba(74,222,128,0.5); }

/* ── 3. 轨道行：细分隔线 + 轻渐变 + 视频/音频微区分 ── */
.cr-edit-tracks { background: rgba(0,0,0,0.20); }
.cr-et-track {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cr-et-track.video {
  background: linear-gradient(180deg, rgba(59,130,246,0.055), rgba(59,130,246,0.012));
  --cr-clip-border: rgba(86,165,220,0.55);
  --cr-clip-name-bg: rgba(45,132,173,0.92);
}
.cr-et-track.audio {
  background: linear-gradient(180deg, rgba(34,197,94,0.05), rgba(34,197,94,0.012));
  --cr-clip-border: rgba(64,190,140,0.55);
  --cr-clip-name-bg: rgba(35,156,110,0.92);
}
.cr-et-track.subtitle {
  background: linear-gradient(180deg, rgba(148,163,184,0.05), rgba(148,163,184,0.012));
}
/* 选中轨道：左边缘细高亮（轨道内存在选中片段时），不做大面积高亮 */
.cr-et-track:has(.cr-et-clip.selected) {
  box-shadow: inset 3px 0 0 rgba(239,68,68,0.45), inset 0 1px 0 rgba(255,255,255,0.03);
}

/* ── 4. 片段卡片：圆角卡片 + 半透明高亮边框 + 轻微暗部 ── */
.cr-et-clip {
  border-radius: 7px;
  border: 2px solid var(--cr-clip-border, rgba(255,255,255,0.14));
  background: linear-gradient(180deg, #20242b, #171a20);
  box-shadow: 0 1px 3px rgba(0,0,0,0.38), inset 0 0 0 1px rgba(255,255,255,0.035);
  transition: box-shadow .12s ease, border-color .12s ease;
}
.cr-et-clip:hover {
  border-color: rgba(148,197,255,0.60);
  box-shadow: 0 3px 10px rgba(0,0,0,0.42), 0 0 0 1px rgba(148,197,255,0.16), inset 0 0 0 1px rgba(255,255,255,0.06);
}
.cr-et-clip.selected {
  border-color: rgba(239,68,68,0.9) !important;
  outline: 1px solid rgba(239,68,68,0.40);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.35), 0 0 14px rgba(239,68,68,0.30);
}
.cr-et-clip.grouped { border-style: solid; }
.cr-et-clip.locked { opacity: 0.5; }
/* 轻微暗部渐变 + 顶部微光：现代素材块质感（不遮挡交互，z-index 1 位于胶片上方、名称栏下方） */
.cr-et-clip::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0) 32%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.22));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.cr-et-film { filter: brightness(0.96) saturate(0.94); } /* 胶片只做亮度校正，不加圆角（圆角由片段卡片统一控制） */
.cr-et-clip-name {
  border-top-color: rgba(255,255,255,0.10);
  font-weight: 600;
}
.cr-et-clip.subtitle {
  background: rgba(148,163,184,0.07);
  border-color: rgba(148,163,184,0.30);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.cr-et-subtxt { color: rgba(226,232,240,0.92); font-weight: 600; letter-spacing: 0.8px; }

/* 音频波形：更细腻、更轻 */
.cr-et-wave { opacity: 0.95; }
.cr-et-wave path { stroke: rgba(148,163,184,0.55) !important; stroke-width: 1.1; }

/* 兜底渐变帧条 */
.cr-et-frame {
  background: linear-gradient(180deg, rgba(96,165,250,0.16), rgba(148,163,184,0.05));
  opacity: 0.7;
}

/* ── 5. 时间刻度 + 播放头 ── */
.cr-edit-ruler {
  background: linear-gradient(180deg, rgba(255,255,255,0.022), rgba(255,255,255,0));
  border-bottom-color: rgba(255,255,255,0.05);
}
.cr-et-ruler-tick { background: rgba(255,255,255,0.055); }
.cr-et-ruler-tick.sec { background: rgba(255,255,255,0.10); }
.cr-et-ruler-tick.main { width: 1px; background: rgba(255,255,255,0.20); }
.cr-et-ruler-label {
  font-weight: 400;
  font-size: 9.5px;
  color: rgba(255,255,255,0.34);
  background: transparent;
  padding: 0;
}
.cr-et-playhead {
  width: 1.5px;
  background: rgba(255,90,98,0.95);
  box-shadow: 0 0 8px rgba(239,68,68,0.5), 0 0 2px rgba(239,68,68,0.65);
}
.cr-et-playhead::before {
  left: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid rgba(255,90,98,0.95);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}

/* ── 6. 拖拽预览 / 插入提示：轻发光描边 + 半透明高亮 ── */
.cr-et-preview {
  outline: 1px solid rgba(74,222,128,0.32);
  outline-offset: 1px;
  border-radius: 8px;
  box-shadow: 0 0 14px rgba(74,222,128,0.14), 0 2px 8px rgba(0,0,0,0.35);
}
.cr-et-preview-tip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(217,251,229,0.95);
  background: rgba(16,20,26,0.92);
  border: 1px solid rgba(74,222,128,0.45);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45), 0 0 12px rgba(74,222,128,0.16);
}
.cr-et-drag-info {
  border-color: rgba(74,222,128,0.40);
  border-radius: 8px;
  background: rgba(12,14,18,0.92);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5), 0 0 14px rgba(74,222,128,0.10);
}
.cr-et-df-block {
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(180deg, #22262d, #171a1f);
  box-shadow: 0 10px 24px rgba(0,0,0,0.5), 0 0 16px rgba(74,222,128,0.10);
}
.cr-et-drag-follow { filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5)); }
.cr-et-df-thumb {
  border-radius: 9px;
  border-color: rgba(255,255,255,0.10);
  background: linear-gradient(180deg, #1b1e24, #121418);
  box-shadow: none;
}
.cr-et-dropzone.show {
  background: rgba(74,222,128,0.05);
  border: 1px dashed rgba(74,222,128,0.40);
  border-radius: 9px;
  margin: 4px 6px;
  color: rgba(217,251,229,0.80);
  font-size: 11px;
  letter-spacing: 0.6px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 24px rgba(74,222,128,0.05);
}

/* ── 7. 分隔线 / 吸附参考线 / 滚动条：更轻 ── */
.cr-et-divider-row {
  background: rgba(255,255,255,0.02);
  border-top-color: rgba(255,255,255,0.05);
  border-bottom-color: rgba(255,255,255,0.05);
}
.cr-et-divider-row::before { height: 1px; background: linear-gradient(90deg, rgba(96,165,250,0.30), rgba(148,163,184,0.22), rgba(74,222,128,0.30)); }
.cr-et-divider-row::after { color: rgba(255,255,255,0.34); background: transparent; font-size: 8.5px; letter-spacing: 1.5px; }
.cr-et-divider-head { background: rgba(255,255,255,0.02); border-top-color: rgba(255,255,255,0.05); border-bottom-color: rgba(255,255,255,0.05); }
.cr-et-divider-head span { color: rgba(255,255,255,0.34); font-size: 8.5px; letter-spacing: 1.5px; }

.cr-et-snap-guide {
  background: rgba(251,191,36,0.80);
  box-shadow: 0 0 6px rgba(251,191,36,0.55);
}

.cr-edit-scroll-x::-webkit-scrollbar, .cr-edit-tracks::-webkit-scrollbar, .cr-edit-tracks-head::-webkit-scrollbar { width: 6px; height: 8px; }
.cr-edit-scroll-x::-webkit-scrollbar-thumb, .cr-edit-tracks::-webkit-scrollbar-thumb, .cr-edit-tracks-head::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 4px; }
.cr-edit-scroll-x::-webkit-scrollbar-thumb:hover, .cr-edit-tracks::-webkit-scrollbar-thumb:hover, .cr-edit-tracks-head::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }
.cr-edit-scroll-x::-webkit-scrollbar-track, .cr-edit-tracks::-webkit-scrollbar-track, .cr-edit-tracks-head::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }

/* ═══════════════════════════════════════════════════════════════════════════
   素材 Tab：项目-画布联动（我的导入 + 绑定画布资源）
   ═══════════════════════════════════════════════════════════════════════════ */
.cr-em-bindbar { display: flex; align-items: center; gap: 6px; padding: 4px 10px 2px; flex-shrink: 0; }
.cr-em-bind-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.cr-em-bind { flex: 1; min-width: 0; font-size: 11px; }
.cr-em-toolbar { display: flex; align-items: center; gap: 3px; padding: 2px 10px 4px; flex-shrink: 0; }
.cr-em-mode { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; cursor: pointer; color: var(--text-muted); background: transparent; border: 1px solid transparent; white-space: nowrap; }
.cr-em-mode:hover { color: var(--text); }
.cr-em-mode.active { color: var(--neon-bright); background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.30); }
.cr-em-tool-sp { flex: 1; }
.cr-em-vt { width: 22px; height: 20px; border: none; background: transparent; color: var(--text-muted); border-radius: 5px; cursor: pointer; display: grid; place-items: center; font-size: 13px; line-height: 1; padding: 0; }
.cr-em-vt:hover { background: rgba(255,255,255,0.07); color: #fff; }
.cr-em-vt.active { color: var(--neon-bright); background: rgba(74,222,128,0.14); }
.cr-em-sort { font-size: 10.5px; padding: 2px 4px; border-radius: 6px; background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }

.cr-em-tree { width: 150px; flex-shrink: 0; border-right: 1px solid rgba(255,255,255,0.06); overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.cr-em-node { display: flex; align-items: center; gap: 5px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; }
.cr-em-node:hover { background: rgba(255,255,255,0.06); }
.cr-em-node.active { background: rgba(74,222,128,0.13); color: var(--neon-bright); box-shadow: inset 0 0 0 1px rgba(74,222,128,0.18); }
.cr-em-node.sub { padding-left: 22px; font-size: 11px; }
.cr-em-node-ico { flex-shrink: 0; font-size: 11px; }
.cr-em-node-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cr-em-node em { font-style: normal; font-size: 9.5px; color: var(--text-muted); background: rgba(255,255,255,0.05); border-radius: 999px; padding: 0 6px; flex-shrink: 0; }
.cr-em-cvlabel { font-size: 9.5px; color: var(--text-muted); padding: 6px 6px 2px 22px; letter-spacing: 0.4px; }
.cr-em-node-empty { font-size: 10.5px; color: var(--text-muted); padding: 6px 8px; line-height: 1.5; }

/* 视频卡片右下角时长 */
.cr-em-dur { position: absolute; right: 4px; bottom: 4px; z-index: 2; font-size: 9px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.62); border-radius: 4px; padding: 1px 4px; letter-spacing: 0.3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cr-em-body { min-width: 0; }
.cr-em-src { font-size: 9.5px; color: var(--text-muted); padding: 0 8px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 列表视图 */
.cr-em-grid.list { display: flex; flex-direction: column; gap: 4px; padding: 8px; align-content: stretch; }
.cr-em-item.list { display: flex; align-items: center; gap: 8px; border-radius: 8px; padding: 4px; }
.cr-em-item.list .cr-em-thumb { width: 56px; height: 38px; flex-shrink: 0; border-radius: 6px; }
.cr-em-item.list .cr-em-body { flex: 1; min-width: 0; }
.cr-em-item.list .cr-em-name { padding: 0 0 1px; font-size: 11px; }
.cr-em-item.list .cr-em-actions { padding: 0; }

/* 速度控制点顶部手柄：整柄唯一热区（只控制该点左侧分段，左拖加快/右拖放慢） */
.cr-et-sppt-upper-full { left: 0; right: 0; }

/* ═══ 速度标记图标放大 + 胶片渐变灰底 + 音频波形优化 ═══ */
/* 速度修改标记：放大到 18px，仍无边框无底纹、白色填充 + 硬阴影 */
.cr-et-speed-badge { width: 18px; height: 18px; }
.cr-et-speed-badge svg { width: 18px; height: 18px; }

/* 胶片渐变灰底：图片加载/seek 期间先显示灰色渐变，杜绝黑屏闪烁 */
.cr-et-film {
  background: linear-gradient(180deg, #2d3138 0%, #23262c 45%, #1a1d22 100%);
}

/* 音频波形优化：底色 = 音频片段颜色（降透明度变暗），柱形更细腻圆润 */
.cr-et-wave {
  left: 6px; right: 6px; bottom: 20px; height: 18px; opacity: 1;
  width: calc(100% - 12px); /* SVG 为替换元素：必须显式宽度才铺满片段，否则按内在 100px 渲染 */
  background: linear-gradient(180deg, rgba(35,156,110,0.24), rgba(35,156,110,0.07));
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.cr-et-wave path {
  stroke: rgba(158,226,193,0.95) !important;
  stroke-width: 1.7;
  stroke-linecap: round;
}
