/* ============================================================
 * Framara · 视觉还原
 * 设计令牌取自原站 canvas.mzsjai.com（--sc-* 变量）
 * ============================================================ */

/* ---------- 主题令牌 ---------- */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --fill: #eef2f7;
  --fill-2: #f1f5f9;
  --border: #e8edf3;
  --border-soft: #f1f5f9;
  --heading: #0f172a;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --text-4: #cbd5e1;
  --grid-dot: #dbe2ea;
  --panel-bg: rgba(255, 255, 255, 0.95);
  --stage-veil: rgba(255, 255, 255, 0.82);   /* 生成中盖在节点框上的遮罩底色 */
  --panel-border: rgba(0, 0, 0, 0.03);
  --panel-shadow: rgba(0, 0, 0, 0.06);
  --node-bg: rgba(255, 255, 255, 0.9);
  --ring: rgba(96, 165, 250, 0.55);
  --ring-strong: rgba(96, 165, 250, 0.9);
  --shadow-lift: 0 8px 24px rgba(15, 23, 42, 0.10);
  --ok: #22c55e;
  --err: #ef4444;
  font-synthesis: none;
}
html.dark {
  --bg: #0b1220;
  --surface: #141d30;
  --surface-2: #101a2c;
  --fill: #1c2740;
  --fill-2: #223052;
  --border: #26314a;
  --border-soft: #1e2a42;
  --heading: #f1f5f9;
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #8593a8;
  --text-4: #56657f;
  --grid-dot: #1c2740;
  --panel-bg: rgba(15, 23, 42, 0.95);
  --stage-veil: rgba(15, 23, 42, 0.82);
  --panel-border: rgba(255, 255, 255, 0.15);
  --panel-shadow: rgba(0, 0, 0, 0.3);
  --node-bg: rgba(15, 23, 42, 0.9);
  --ring: rgba(96, 165, 250, 0.6);
  --ring-strong: rgba(96, 165, 250, 0.95);
  --shadow-lift: 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* 关键：[hidden] 必须真正隐藏，避免被组件 display 规则覆盖 */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

.app { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }

/* 通用浮层面板外观 */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px var(--panel-shadow), 0 0 0 1px var(--panel-border);
}

/* ============================================================
 * 画布
 * ============================================================ */
.canvas-root {
  position: absolute; inset: 0;
  overflow: hidden; cursor: default;
  user-select: none;
}
.canvas-root.panning { cursor: grabbing; }

.noise {
  position: absolute; inset: 0; pointer-events: none; opacity: .3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}
html.dark .noise { opacity: .18; }

.grid-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: .4;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: 0 0;
}
html.dark .grid-bg { opacity: .5; }

/* 世界层 */
.world {
  position: absolute; left: 0; top: 0;
  width: 0; height: 0;
  transform-origin: 0 0;
}
.wire-layer {
  position: absolute; left: -4000px; top: -4000px;
  width: 8000px; height: 8000px;
  overflow: visible; pointer-events: none;
}
.nodes-layer { position: absolute; left: 0; top: 0; }

.wire { fill: none; stroke: var(--ring-strong); stroke-width: 2; pointer-events: stroke; cursor: pointer; }
.wire.temp { stroke-dasharray: 6 4; opacity: .8; }

/* ============================================================
 * 中央 Logo
 * ============================================================ */
.hero {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
  transition: opacity .7s cubic-bezier(.32,.72,0,1), transform .7s cubic-bezier(.32,.72,0,1), filter .7s;
}
.hero.hide { opacity: 0; transform: scale(.96); filter: blur(6px); }

.hero-blobs { position: absolute; }
.blob { position: absolute; width: 256px; height: 256px; border-radius: 999px; filter: blur(120px); }
.blob-a { top: -80px; left: -80px; background: rgba(251,191,36,.1); animation: pulse 4s ease-in-out infinite; }
.blob-b { top: -80px; right: -80px; background: rgba(96,165,250,.1); animation: pulse 4s ease-in-out .7s infinite; }
.blob-c { bottom: -80px; left: 40px; background: rgba(52,211,153,.1); animation: pulse 4s ease-in-out 1s infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.hero-lockup { position: relative; display: flex; align-items: center; gap: 16px; }
.hero-logo { display: block; width: auto; height: 58px; object-fit: contain; }
.hero-text { display: flex; flex-direction: column; }
.hero-title {
  margin: 0; font-size: 36px; line-height: 1.1; font-weight: 700;
  letter-spacing: -0.02em; color: var(--heading);
}
.hero-title .grad {
  font-weight: 800;
  background: linear-gradient(90deg, #3b82f6, #a855f7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tagline .d { width: 4px; height: 4px; border-radius: 999px; display: inline-block; }
.tagline .amber { background: #fbbf24; }
.tagline .blue { background: #60a5fa; }
.tagline .emerald { background: #34d399; }
.tagline span {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .18em; padding-left: 4px;
}
.hero-hint {
  position: relative; margin-top: 32px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--text-3);
}

/* ============================================================
 * 左上 返回项目库
 * ============================================================ */
.tl-bar { position: absolute; left: 24px; top: 24px; z-index: 50; display: flex; align-items: center; gap: 8px; }
.pill-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 16px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  transition: color .15s ease-out;
  background: var(--panel-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px var(--panel-shadow), 0 0 0 1px var(--panel-border);
}
.pill-btn:hover { color: var(--text); }

/* ============================================================
 * 左侧竖排工具栏
 * ============================================================ */
.sidebar {
  position: fixed; left: 24px; top: 50%; transform: translateY(-50%);
  z-index: 50; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 6px; border-radius: 16px;
  background: var(--panel-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px var(--panel-shadow), 0 0 0 1px var(--panel-border), 0 0 0 4px rgba(59,130,246,.08);
}
.sb-item { position: relative; }
.sb-btn {
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: all .15s ease-out;
}
.sb-btn:hover { transform: scale(1.05); background: var(--fill); color: var(--text); }

/* ============================================================
 * 底部 AI 输入条
 * ============================================================ */
.chat-wrap {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  z-index: 40; display: flex; flex-direction: column; align-items: center;
}
.chat-pill {
  width: 520px; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 20px;
  background: var(--panel-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px var(--panel-shadow), 0 0 0 1px var(--panel-border), 0 0 0 2px rgba(59,130,246,.2);
}
.chat-spark { color: #3b82f6; flex-shrink: 0; }
.chat-pill input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 13px; color: var(--text); padding: 2px 0;
}
.chat-pill input::placeholder { color: var(--text-3); }
.chat-send { color: var(--text-3); display: flex; padding: 2px; border-radius: 6px; }
.chat-send:hover { color: var(--text); }

/* ============================================================
 * 右下工具栏
 * ============================================================ */
.bottom-toolbar {
  position: absolute; bottom: 32px; right: 32px; z-index: 50;
  display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 16px;
  background: var(--panel-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px var(--panel-shadow), 0 0 0 1px var(--panel-border);
}
.bt-btn {
  padding: 8px; border-radius: 12px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.bt-btn:hover:not(:disabled) { background: var(--fill); color: var(--text); }
.bt-btn:disabled { color: var(--text-4); cursor: not-allowed; }
.bt-sep { width: 1px; height: 24px; background: var(--border); }

/* ============================================================
 * 节点
 * ============================================================ */
.node {
  position: absolute; width: 420px;
  border-radius: 24px;
  background: var(--node-bg);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 0 2px var(--ring), var(--shadow-lift);
  transition: box-shadow .25s, transform .4s cubic-bezier(.32,.72,0,1);
  will-change: transform;
}
.node:hover { box-shadow: 0 0 0 2px var(--ring-strong), var(--shadow-lift); }
.node.selected { box-shadow: 0 0 0 3px var(--ring-strong), var(--shadow-lift); }

.node-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 24px; overflow: hidden;
  display: grid; place-items: center;
}
.stage-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-3); text-align: center; padding: 16px;
}
.stage-ico { display: flex; color: var(--text-3); }
.stage-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.stage-sub { font-size: 10px; color: var(--text-3); }
.stage-media { position: absolute; inset: 0; display: none; }
.stage-media img, .stage-media video { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; user-select: none; }
.stage-media video { object-fit: contain; }   /* 视频按真实比例完整显示，不裁切（全屏同理） */
.stage-media .stage-fs {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(15, 23, 42, .55); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
.stage-media .stage-fs:hover { background: rgba(15, 23, 42, .8); }
/* 统一用自定义按钮触发剧场模式：隐藏 <video> 原生全屏按钮（跨内核） */
.stage-media video::-webkit-media-controls-fullscreen-button { display: none; }
.stage-media video::-moz-media-controls-fullscreen-button { display: none; }
.node.filled .stage-empty { display: none; }
.node.filled .stage-media { display: block; }

/* 生成中：遮罩盖在节点框正中（对标原站 Z.Wk 进度环）
   进度按「模型预估耗时」推进、封顶 95%，完成后整层直接撤掉。 */
.stage-state {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  background: var(--stage-veil);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.stage-state[hidden] { display: none; }
.stage-work-inner {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 12px 16px; max-width: 100%; text-align: center;
}
.stage-work-label {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; line-height: 1.5;
  color: var(--text-2); word-break: break-word;
}
.gen-ring { position: relative; display: inline-block; flex: none; }
.gen-ring svg { display: block; transform: rotate(-90deg); }
.gen-ring-bg { fill: none; stroke: rgba(148, 163, 184, .32); }
.gen-ring-fg, .gen-ring-glow {
  fill: none; stroke: #10b981; stroke-linecap: round;
  transition: stroke-dashoffset .5s ease-out;
}
.gen-ring-fg { animation: ringPulse 1.8s ease-in-out infinite; }
.gen-ring-glow { filter: blur(4px); animation: ringGlow 1.8s ease-in-out infinite; }
@keyframes ringPulse { 0%, 100% { opacity: 1; } 50% { opacity: .78; } }
@keyframes ringGlow { 0%, 100% { opacity: .55; } 50% { opacity: .12; } }

/* 上传节点（对标原站「图片 / 视频资产节点」）：整个节点就是一个可点击的框，
   下方不再有配置面板；空态悬停给一点蓝色反馈，提示可点击上传。 */
.node[data-type="upload"] .node-cfg { display: none !important; }
.node[data-type="upload"]:not(.filled) .node-stage { transition: background .2s; }
.node[data-type="upload"]:not(.filled):hover .node-stage { background: rgba(59, 130, 246, .10); }
/* 上传音频：原生 audio 控件在框内居中，别贴在左上角 */
.stage-media audio { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88%, 340px); }
/* 框选层（左键空地拖拽） */
.sel-box {
  position: fixed; z-index: 60; pointer-events: none;
  border: 1.5px solid #3b82f6; background: rgba(59, 130, 246, .12);
  border-radius: 4px;
}

/* 悬浮标题胶囊（节点上方） */
.node-tag {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  padding-bottom: 8px; pointer-events: none;
}
.node-tag .node-tag-text {
  display: inline-block; padding: 3px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2);
  background: var(--panel-bg); backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* 端口 */
.port {
  position: absolute; top: 50%; z-index: 5;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  transform: translate(-50%, -50%);
  opacity: 0; transition: opacity .2s;
}
.port.in { left: 0; }
.port.out { left: 100%; }
.node:hover .port, .node.selected .port { opacity: 1; }
.port-dot {
  width: 20px; height: 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  transition: transform .15s, background .15s, color .15s;
  cursor: crosshair;
}
.port.in .port-dot { border-color: #4ade80; color: #4ade80; }
.port.out .port-dot { border-color: #60a5fa; color: #60a5fa; }
.port-dot:hover { transform: scale(1.15); }
.port.in .port-dot:hover { background: #22c55e; color: #fff; border-color: #22c55e; }
.port.out .port-dot:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* 配置面板（节点下方，悬停/选中显示） */
.node-cfg {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  width: 412px; padding-top: 8px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease-out;
}
.node:hover .node-cfg, .node.selected .node-cfg { opacity: 1; pointer-events: auto; }
.cfg-card {
  border-radius: 16px; overflow: hidden;
  background: var(--panel-bg); backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px var(--panel-shadow), 0 0 0 1px var(--panel-border);
}
.cfg-body { display: flex; flex-direction: column; }
.cfg-prompt {
  width: 100%; height: 80px; resize: none; border: none; outline: none;
  background: transparent; color: var(--text); font-size: 11px; line-height: 1.6;
  padding: 10px 12px; font-weight: 500;
}
.cfg-prompt::placeholder { color: var(--text-3); }
.cfg-tools {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px; border-top: 1px solid var(--border-soft);
}
.chip {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 8px;
  background: var(--fill); color: var(--text-2);
  font-size: 10px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip:hover { background: var(--fill-2); color: var(--text); }
.chip .chev { opacity: .6; }
.cfg-urlrow {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px; border-top: 1px solid var(--border-soft);
}
.cfg-urlrow label { font-size: 10px; color: var(--text-3); }
.cfg-urlrow input {
  width: 100%; padding: 6px 8px; border-radius: 8px; font-size: 11px;
  background: var(--fill); border: 1px solid var(--border); color: var(--text); outline: none;
}
.cfg-urlrow input:focus { border-color: #3b82f6; }
.gen-btn {
  margin-left: auto; display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 8px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: filter .15s, opacity .15s;
}
.gen-btn:hover { filter: brightness(1.08); }
.gen-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 生成状态/结果 */
.cfg-status {
  display: none; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 12px; font-size: 10px; color: var(--text-2);
  border-top: 1px solid var(--border-soft);
}
.cfg-status.show { display: flex; }
.cfg-status.error { color: var(--err); }
.cfg-status.ok { color: var(--ok); }
.cfg-status .spin {
  width: 10px; height: 10px; border-radius: 999px;
  border: 2px solid rgba(59,130,246,.35); border-top-color: #3b82f6;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cfg-status .dl {
  margin-left: auto; text-decoration: underline; color: #3b82f6; font-weight: 600; cursor: pointer;
}

/* 节点内嵌下拉 */
.cfg-dropdown {
  position: absolute; z-index: 200; min-width: 120px;
  padding: 4px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column; gap: 2px;
}
.cfg-dropdown button {
  text-align: left; padding: 6px 10px; border-radius: 7px;
  font-size: 11px; color: var(--text-2);
}
.cfg-dropdown button:hover { background: var(--fill); color: var(--text); }
.cfg-dropdown button.active { color: #3b82f6; background: var(--fill); font-weight: 600; }

/* ============================================================
 * 右键菜单
 * ============================================================ */
.ctx-menu {
  position: fixed; z-index: 120; width: 210px; padding: 4px;
  border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 1px;
}
.ctx-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text); text-align: left;
  transition: background .12s;
}
.ctx-item svg { color: var(--text-2); flex-shrink: 0; }
.ctx-item:hover { background: var(--fill); }
.ctx-sep { height: 1px; background: var(--border-soft); margin: 4px 0; }

/* ============================================================
 * 设置弹窗
 * ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, .5); backdrop-filter: blur(3px);
}
.modal {
  width: 440px; max-width: 92vw; border-radius: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { margin: 0; font-size: 15px; color: var(--heading); }
.modal-close { width: 30px; height: 30px; border-radius: 8px; color: var(--text-3); font-size: 15px; }
.modal-close:hover { background: var(--fill); color: var(--text); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; color: var(--text); }
.field input {
  padding: 9px 11px; border-radius: 10px; font-size: 13px;
  background: var(--fill); border: 1px solid var(--border); color: var(--text); outline: none;
}
.field input:focus { border-color: #3b82f6; }
.field small { color: var(--text-3); font-size: 11px; }
.field-row { display: flex; align-items: center; gap: 12px; }
.test-result { font-size: 12px; color: var(--text-2); }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--err); }
.btn {
  padding: 8px 14px; border-radius: 10px; font-size: 13px;
  background: var(--fill); color: var(--text); border: 1px solid var(--border);
  transition: background .15s;
}
.btn:hover { background: var(--fill-2); }
.btn.primary { background: linear-gradient(90deg, #3b82f6, #8b5cf6); color: #fff; border: none; font-weight: 600; }
.btn.danger { background: #ef4444; color: #fff; border: none; font-weight: 600; }
.btn.danger:hover { background: #dc2626; filter: none; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; }

/* ============================================================
 * Toast
 * ============================================================ */
.toast-stack {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 8px 14px; border-radius: 10px; font-size: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  transition: opacity .25s;
}
.toast.ok { color: var(--ok); }
.toast.err { color: var(--err); }

/* ============================================================
 * 视图容器
 * ============================================================ */
.view { position: fixed; inset: 0; }
#view-canvas .app { position: relative; width: 100%; height: 100%; }

/* ============================================================
 * 外壳（项目库 / 资产库 / 主体库 / 任务日志）
 * ============================================================ */
#view-shell { display: flex; background: var(--bg); }
.shell-aside {
  width: 256px; flex: 0 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 26px 18px 22px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.shell-logo-row { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 4px 6px 0; }
.brand-img { display: block; width: auto; height: 38px; }
.brand-img.lg { height: 34px; }
.brand-img-dark { display: none; }
html.dark .brand-img-light { display: none; }
html.dark .brand-img-dark { display: block; }
.shell-brand { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--heading); white-space: nowrap; }
.shell-brand span { background: linear-gradient(90deg, #3b82f6, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.shell-section { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 26px 8px 10px; letter-spacing: .02em; }
.shell-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.shell-nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 14px; border-radius: 13px;
  font-size: 15px; font-weight: 500; color: var(--text-2);
  background: transparent; cursor: pointer;
  transition: background .15s, color .15s;
}
.shell-nav-item:hover { background: var(--fill); color: var(--text); }
.shell-nav-item.active { background: rgba(59,130,246,.12); color: #3b82f6; font-weight: 600; }
.shell-nav-item svg { flex: 0 0 auto; }
.shell-user { margin-top: 12px; }
.shell-user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 15px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  cursor: pointer; transition: border-color .15s;
}
.shell-user-card:hover { border-color: var(--border); }
.shell-avatar {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 700;
}
.shell-user-name { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.shell-user-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.shell-user-vip { font-size: 11.5px; margin-top: 3px; font-weight: 600; }
.shell-user-vip.on { color: #e2a93b; }
.shell-user-vip.off { color: var(--text-3); font-weight: 500; }

.shell-main {
  flex: 1; min-width: 0; position: relative;
  display: flex; flex-direction: column; overflow: hidden;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
}
.shell-header {
  height: 64px; flex: 0 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel-bg); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.shell-title {
  display: flex; align-items: center; gap: 9px;
  color: var(--heading); font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
}
.shell-count {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  background: var(--fill); padding: 2px 8px; border-radius: 999px;
}
.shell-head-right { display: flex; align-items: center; gap: 10px; }
.shell-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 8px 12px; width: 210px; color: var(--text-3);
}
.shell-search input {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text); width: 100%;
}
.shell-search input::placeholder { color: var(--text-3); }

/* ---------- 公告喇叭（外壳页顶部栏；点击弹出公告栏浮层） ---------- */
.notice-slot {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 10px;
}
.notice-horn {
  position: relative; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #60a5fa;
  background: linear-gradient(150deg, rgba(59,130,246,.16), rgba(168,85,247,.14));
  border: 1px solid rgba(96,165,250,.30);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease;
}
.notice-horn > svg { animation: hornSwing 3.4s ease-in-out infinite; transform-origin: 50% 12%; }
.notice-horn:hover { transform: translateY(-1px); border-color: rgba(96,165,250,.62); box-shadow: 0 8px 20px rgba(59,130,246,.28); }
.notice-horn:active { transform: translateY(0) scale(.96); }
.notice-horn .nh-halo {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 1px solid rgba(96,165,250,.5);
  animation: hornHalo 2.6s ease-out infinite;
}
.notice-horn .nh-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; box-sizing: border-box;
  background: linear-gradient(135deg, #fb7185, #ef4444); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
  animation: hornPop .36s cubic-bezier(.2,1.7,.4,1) both;
}
.notice-horn.has-new { color: #f472b6; border-color: rgba(244,114,182,.5); }
.notice-horn.has-new .nh-halo { border-color: rgba(244,114,182,.5); }
@keyframes hornSwing {
  0%, 68%, 100% { transform: rotate(0deg); }
  74% { transform: rotate(-12deg); }
  80% { transform: rotate(10deg); }
  86% { transform: rotate(-6deg); }
  92% { transform: rotate(3deg); }
}
@keyframes hornHalo { 0% { transform: scale(.92); opacity: .75; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes hornPop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 公告栏浮层（点击喇叭弹出） ---------- */
.notice-mask {
  position: fixed; inset: 0; z-index: 240;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 76px 16px 26px;
  background: rgba(6, 11, 22, .52);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: noticeFade .2s ease both;
}
.notice-card {
  position: relative; width: 100%; max-width: 470px; max-height: 76vh;
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 26px 72px rgba(2, 8, 23, .5);
  animation: noticeRise .36s cubic-bezier(.16,1,.3,1) both;
}
.notice-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 138px; pointer-events: none;
  background:
    radial-gradient(430px 132px at 10% -34%, rgba(59,130,246,.34), transparent 70%),
    radial-gradient(360px 120px at 98% -22%, rgba(168,85,247,.30), transparent 72%);
}
.notice-head {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 17px 18px 14px; border-bottom: 1px solid var(--border-soft);
}
.notice-head-ico {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #93c5fd;
  background: linear-gradient(150deg, rgba(59,130,246,.24), rgba(168,85,247,.20));
  border: 1px solid rgba(96,165,250,.32);
}
.notice-head-tx { flex: 1 1 auto; min-width: 0; }
.notice-head-tx h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--heading); letter-spacing: -.01em; }
.notice-head-tx p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-3); }
.notice-x {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); border: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.notice-x:hover { background: var(--fill); color: var(--text); }
.notice-list {
  position: relative; padding: 14px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.notice-item {
  position: relative; padding: 13px 16px 14px 18px; overflow: hidden;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  animation: noticeIn .5s cubic-bezier(.16,1,.3,1) both;
}
.notice-item::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #60a5fa, #a855f7); opacity: .75;
}
.notice-item:first-child {
  background: linear-gradient(135deg, rgba(59,130,246,.11), rgba(168,85,247,.11));
  border-color: rgba(96,165,250,.30);
}
.notice-item:first-child::before { opacity: 1; }
.notice-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notice-seal {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #60a5fa;
}
.notice-seal i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.notice-time { font-size: 11px; color: var(--text-3); }
.notice-tx { font-size: 14px; line-height: 1.72; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.notice-empty { padding: 32px 0; text-align: center; color: var(--text-3); font-size: 13px; }
@keyframes noticeFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes noticeRise { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes noticeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(90deg, #3b82f6, #6366f1); color: #fff;
  border-radius: 11px; padding: 9px 15px; font-size: 13px; font-weight: 600;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 11px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
}
.btn-ghost:hover { color: var(--text); }

.shell-body { flex: 1; overflow-y: auto; padding: 22px 28px 32px; }
.shell-body.no-pad { padding: 0; display: flex; min-height: 0; }

/* 胶囊标签页（资产库/主体库 分类） */
.pill-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill-tab {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  background: transparent; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.pill-tab:hover { background: var(--fill); }
.pill-tab.active { font-weight: 600; color: #3b82f6; background: rgba(59,130,246,.12); }
.pill-tab .dot { width: 7px; height: 7px; border-radius: 999px; flex: 0 0 auto; }
.pill-tab .cnt { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-4); }
.pill-tab.active .cnt { color: #60a5fa; }

/* 网格与卡片 */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.grid-cards.small { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.new-card {
  border: 1.5px dashed var(--border); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; color: var(--text-3); min-height: 244px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.new-card:hover { border-color: #93c5fd; }
.new-card.small { min-height: 232px; border-radius: 14px; }
.new-card .ico {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--fill); color: #3b82f6;
  display: flex; align-items: center; justify-content: center;
}
.new-card .t { font-size: 13px; font-weight: 600; color: var(--text-2); }
.new-card .s { font-size: 10.5px; }
.empty-text { margin-top: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 项目库：真实项目卡片 */
.proj-card {
  position: relative;
  border: 1.5px solid var(--border); border-radius: 16px;
  min-height: 244px; padding: 16px; cursor: pointer; background: var(--surface);
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.proj-card:hover { border-color: #93c5fd; box-shadow: 0 6px 18px rgba(59,130,246,.10); transform: translateY(-2px); }
.proj-thumb {
  position: relative;
  flex: 1; min-height: 0; border-radius: 11px; background: var(--surface-2);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 18px 18px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
/* 空画布提示（原站 cp-empty 同款） */
.cp-empty { color: var(--text-4); display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
/* 右上角操作按钮组（hover 显示，铅笔改名 + 红垃圾桶删除） */
.proj-acts {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
.proj-card:hover .proj-acts, .proj-acts:focus-within { opacity: 1; }
.pact {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.pact:hover { color: #2563eb; border-color: #93c5fd; background: #eff6ff; }
.pact-del:hover { color: #ef4444; border-color: #fca5a5; background: #fef2f2; }
.proj-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-meta { font-size: 11px; color: var(--text-3); display: flex; justify-content: space-between; }
.proj-nodes { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.proj-card.dragging { opacity: .4; }
.proj-card.drag-over { border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f6 inset; }
/* 画布管理浮层里复用项目库卡片：网格排列 + 真实缩略图；窄面板里更紧凑 */
.proj-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.proj-thumb .badge {
  position: absolute; top: 8px; right: 8px;
  background: #3b82f6; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.proj-switch { min-height: 0; padding: 12px; }
.proj-switch .proj-thumb { min-height: 92px; }

.cfg-label { font-size: 13px; font-weight: 600; color: var(--text); display: block; margin-bottom: 8px; }
.cfg-textarea {
  width: 100%; resize: vertical; border-radius: 12px; padding: 11px 13px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; line-height: 1.6; outline: none; margin-bottom: 20px;
}
.cfg-textarea:focus { border-color: #93c5fd; }
.upload-dashed {
  width: 100%; height: 104px; border-radius: 12px; cursor: pointer;
  border: 1.5px dashed var(--border); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; color: var(--text-3); transition: border-color .2s, color .2s;
}
.upload-dashed:hover { border-color: #93c5fd; color: #3b82f6; }
.hint-small { font-size: 11.5px; margin-top: 8px; line-height: 1.55; color: var(--text-3); }
.select-full {
  width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 11px; font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
.opt-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.opt-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 9px; padding: 6px 13px; font-size: 12px; font-weight: 600;
  transition: all .15s;
}
.opt-btn:hover { color: var(--text); }
.opt-btn.active { border-color: #3b82f6; background: rgba(59,130,246,.12); color: #3b82f6; }

/* ---------- 主体库（页面级卡片） ---------- */
.subj-card {
  position: relative; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); overflow: hidden; cursor: default;
  transition: border-color .15s, transform .15s;
}
.subj-card:hover { border-color: rgba(59,130,246,.45); }
.subj-thumb {
  aspect-ratio: 4/3; background: var(--fill, rgba(148,163,184,.08));
  display: flex; align-items: center; justify-content: center; color: #94a3b8; overflow: hidden;
}
.subj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.subj-meta { padding: 10px 12px 12px; }
.subj-name { font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-sub { margin-top: 5px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.subj-kind {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
/* 主体库分类配色 = 画布 # 标签的配色，看到颜色就能对上号 */
.subj-kind.k-subject { background: rgba(244, 63, 94, .12); color: #f43f5e; }
.subj-kind.k-scene { background: rgba(6, 182, 212, .12); color: #06b6d4; }
.subj-kind.k-prop { background: rgba(245, 158, 11, .14); color: #d97706; }
.subj-del {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px;
  border: none; background: rgba(15,23,42,.55); color: #e2e8f0; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.subj-card:hover .subj-del { display: flex; }
.subj-del:hover { background: rgba(239,68,68,.85); }

/* ---------- 账户菜单 / 修改密码 ---------- */
.acct-menu {
  position: fixed; z-index: 100001; width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(2,6,23,.28);
}
.acct-head { padding: 9px 12px 10px; border-bottom: 1px solid var(--border-soft, var(--border)); margin-bottom: 5px; }
.acct-name { font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-item {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border: none; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; border-radius: 9px; cursor: pointer; text-align: left;
}
.acct-item:hover { background: var(--fill, rgba(148,163,184,.1)); color: var(--text); }
.acct-item.danger:hover { background: rgba(239,68,68,.1); color: #ef4444; }

/* ---------- 资产库卡片（下载/删除操作） ---------- */
.asset-cell { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.asset-cell img, .asset-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 资产库里的音频素材：原生播放条塞进方形格子太挤，改用音符占位 */
.asset-audio {
  width: 100%; height: 140px;
  display: flex; align-items: center; justify-content: center;
  color: #d97706; background: rgba(217, 119, 6, .10);
}
.asset-ops {
  position: absolute; top: 8px; right: 8px; display: none; gap: 6px;
}
.asset-cell:hover .asset-ops { display: flex; }
.aop {
  width: 28px; height: 28px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(15,23,42,.55); color: #e2e8f0; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.aop:hover { background: rgba(59,130,246,.85); }
.aop-del:hover { background: rgba(239,68,68,.85); }


.p-note { font-size: 12.5px; color: var(--text-3); margin: 0 0 16px; }
.err-banner {
  padding: 14px 16px; border-radius: 12px;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2);
  color: #ef4444; font-size: 13px;
}
.ok-banner {
  padding: 14px 16px; border-radius: 12px;
  background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2);
  color: #22c55e; font-size: 13px;
}

/* ============================================================
 * 节点 v2（按原站实测重做）
 * ============================================================ */
/* 配置面板固定宽度：节点框随比例缩放时面板不跟着压扁（只有上方媒体框变） */
.node-cfg { width: 412px; max-width: 92vw; }
.cfg-card {
  border-radius: 20px; padding: 4px;
  background: var(--panel-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px var(--panel-shadow);
}
.cfg-body { display: flex; flex-direction: column; gap: 4px; }

/* 输入卡 */
.cfg-input {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px; overflow: hidden;
}
.cfg-ta-wrap { position: relative; }
.cfg-ta {
  position: relative; z-index: 1;
  display: block;                 /* 去掉 inline-block 的基线空隙，让外层容器高度 == 输入框高度 */
  width: 100%; height: 80px;
  /* 高度 80~520（对标原站）：内容多时由 JS 自动撑开（taAutoGrow），
     底部把手可手动上下拖（attachTaResize），超过上限后内部滚动 */
  min-height: 80px; max-height: 520px;
  background: transparent; border: none; outline: none;
  resize: none; padding: 12px; font-size: 12px; font-weight: 500; line-height: 1.6;
  color: var(--text);
  /* 预留滚动条槽位，让「文字内容宽度」恒定（不随是否出现滚动条变化），
     从而与下方高亮层的折行点始终一致，避免多标签时彩色块漂移。 */
  scrollbar-gutter: stable;
  overflow-wrap: break-word;
  /* 细滚动条（对标原站 .custom-scrollbar）：6px 宽、透明轨道、圆角半透明滑块 */
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .45) transparent;
  overflow-y: auto;
}
.cfg-ta::-webkit-scrollbar { width: 6px; height: 6px; }
.cfg-ta::-webkit-scrollbar-track { background: transparent; }
.cfg-ta::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .45); border-radius: 3px; }
.cfg-ta::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .65); }
html.dark .cfg-ta { scrollbar-color: rgba(100, 116, 139, .55) transparent; }
html.dark .cfg-ta::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .55); }
html.dark .cfg-ta::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .75); }
.cfg-ta::placeholder { color: var(--text-3); }

/* 「整体化标签」高亮层（对标原站）：与 textarea 完全同字号 / 同行高 / 同内边距，
   垫在透明 textarea 下方；标签文字本身透明，只画出彩色圆角底，
   真实文字由上层 textarea 渲染 → @图片1 看起来就是一整块标签。 */
.cfg-hl {
  position: absolute; inset: 0; z-index: 0;
  padding: 12px; font-size: 12px; font-weight: 500; line-height: 1.6;
  overflow: hidden; pointer-events: none; user-select: none; -webkit-user-select: none;
  color: transparent;
  /* 与 .cfg-ta 的 scrollbar-gutter 同宽，保证高亮文字与真实文字折行一致 */
  padding-right: calc(12px + var(--sbw, 0px));
}
.cfg-hl-inner { white-space: pre-wrap; word-wrap: break-word; will-change: transform; }
.cfg-hl .ref-tag { position: relative; }
.cfg-hl .ref-tag > i {
  position: absolute; inset: 0; display: block; margin: -2px; border-radius: 4px;
}
.cfg-hl .ref-tag > em { position: relative; font-style: normal; }
.cfg-hl .ref-tag.lk-image > i { background: rgba(147, 197, 253, .72); }
.cfg-hl .ref-tag.lk-video > i { background: rgba(167, 243, 208, .72); }
.cfg-hl .ref-tag.lk-audio > i { background: rgba(221, 214, 254, .72); }
.cfg-hl .ref-tag.oob > i { background: rgba(254, 202, 202, .8); }
html.dark .cfg-hl .ref-tag.lk-image > i { background: rgba(30, 64, 175, .55); }
html.dark .cfg-hl .ref-tag.lk-video > i { background: rgba(6, 95, 70, .55); }
html.dark .cfg-hl .ref-tag.lk-audio > i { background: rgba(91, 33, 182, .55); }
html.dark .cfg-hl .ref-tag.oob > i { background: rgba(153, 27, 27, .6); }
.cfg-resize {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: row-resize; opacity: 0; transition: opacity .15s;
  /* 关键：textarea 有 z-index:1，把手默认 z-index:auto 会被它压在下面、
     收不到 mousedown（浏览器命中测试只认最上层元素）。这里抬到 2 压过 textarea，
     把手才真正可点。 */
  z-index: 2;
  /* 未悬停 / 未拖拽时不挡 textarea 正常点击（底部 12px 仍可点文字），
     悬停或拖拽中才接管该区域的点击，避免误触。 */
  pointer-events: none;
}
.cfg-input:hover .cfg-resize, .cfg-input.resizing .cfg-resize { opacity: 1; pointer-events: auto; }
.cfg-resize > div {
  width: 32px; height: 4px; border-radius: 999px;
  background: var(--border); transition: background .15s;
}
/* 悬停 / 拖拽中手柄加深：明确告诉用户「这里能上下拖」（对标原站 slate-100 → slate-200）。
   注意别写反成更浅——白底上更浅 = 依然看不见 = 用户以为没生效。 */
.cfg-input:hover .cfg-resize > div, .cfg-input.resizing .cfg-resize > div { background: var(--grid-dot); }
html.dark .cfg-resize > div { background: var(--border); }
html.dark .cfg-input:hover .cfg-resize > div, html.dark .cfg-input.resizing .cfg-resize > div { background: #3b4a68; }

/* 输入素材条：上游连线传入的素材（可多张，按连线顺序排列） */
.cfg-refs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 10px 2px;
}
.cfg-ref {
  position: relative; flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  background: var(--fill); border: 1px solid var(--border);
  cursor: grab; user-select: none; -webkit-user-select: none;
  transition: transform .15s, border-color .15s, opacity .15s;
}
.cfg-ref:hover { border-color: #3b82f6; transform: translateY(-1px); }
.cfg-ref.dragging { opacity: .35; cursor: grabbing; }
.cfg-ref.over { border-color: #3b82f6; border-style: dashed; }
.cfg-ref img, .cfg-ref video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cfg-ref .cfg-ref-ico {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.cfg-ref.pending { border-style: dashed; }
.cfg-ref-ord {
  position: absolute; left: 3px; top: 3px; min-width: 14px; height: 14px;
  padding: 0 3px; border-radius: 999px;
  background: rgba(59,130,246,.94); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 14px; text-align: center;
  pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.cfg-ref-x {
  position: absolute; right: 2px; top: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: rgba(15,23,42,.74); color: #fff;
  font-size: 11px; line-height: 15px; text-align: center;
  opacity: 0; transition: opacity .15s;
}
.cfg-ref:hover .cfg-ref-x { opacity: 1; }

/* 提示词 @ 引用浮窗（对标原站 ea.X2：输入 @ 跟在光标行下方 4px 弹出，不遮上方素材条） */
.mention-pop {
  position: fixed; z-index: 9999;
  min-width: 200px; max-width: 260px;
  border-radius: 12px; overflow: hidden; padding: 0;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.mention-list { padding: 4px 0; max-height: 260px; overflow-y: auto; }
.mention-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  transition: background .12s;
}
.mention-item.active { background: #f5f3ff; }
html.dark .mention-item.active { background: rgba(91, 33, 182, .25); }
.mention-thumb {
  position: relative; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  overflow: hidden; background: var(--fill-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
}
.mention-thumb img, .mention-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 缩略图右上角的同类序号徽标（原站：min-w-3.5 h-3.5 + rounded-bl-md） */
.mention-badge {
  position: absolute; top: 0; right: 0; min-width: 14px; height: 14px;
  padding: 0 2px; border-bottom-left-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; line-height: 1; color: #fff;
}
.mention-badge.kind-image { background: #3b82f6; }
.mention-badge.kind-video { background: #10b981; }
.mention-badge.kind-audio { background: #8b5cf6; }
.mention-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.mention-label { font-size: 12px; font-weight: 500; color: var(--text); }
.mention-sub {
  font-size: 10px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-empty { padding: 8px 12px; font-size: 12px; color: var(--text-3); }

/* 连线上的素材顺序徽标（①②③） */
.wire-badge { pointer-events: none; }
.wire-badge circle { fill: var(--surface); stroke: var(--ring-strong); stroke-width: 1.2; }
.wire-badge text { fill: var(--text); font-size: 9px; font-weight: 700; }

/* 工具行 */
.cfg-toolrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 4px 8px;
}
.cfg-chips { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; overflow: hidden; }
.cfg-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* 芯片 */
.chip {
  display: flex; align-items: center; gap: 4px; padding: 4px 6px;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  color: var(--text-2); white-space: nowrap; transition: background .15s, color .15s;
}
.chip:hover { background: var(--fill); color: #3b82f6; }
.chip svg { flex: 0 0 auto; }
.chip-label { display: inline-block; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }

/* 生成胶囊（原站：青色→蓝色渐变 圆角全） */
.gen-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; border-radius: 999px; padding: 0 10px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
  flex-shrink: 0; transition: transform .2s, box-shadow .2s;
}
.gen-pill:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(34,211,238,.25); }
.gen-pill:active { transform: scale(.95); }
.gen-pill:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 上弹下拉（分组） */
.cfg-dropdown {
  position: fixed; z-index: 400; min-width: 80px;
  border-radius: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
}
.dd-group {
  padding: 8px 12px 4px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.dd-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  font-size: 10px; font-weight: 700; color: var(--text-2);
}
.dd-item:hover { background: var(--fill); }
.dd-item.active { color: #3b82f6; background: var(--fill); }

/* 视频：扩展配置 + 开关 + 种子 */
.cfg-ext { padding: 0 12px 2px; }
.cfg-ext-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cfg-ext-title { font-size: 9px; font-weight: 500; color: var(--text-3); }
.cfg-ext-toggle { padding: 4px 8px; border-radius: 8px; color: var(--text-2); display: flex; align-items: center; }
.cfg-ext-toggle:hover { background: var(--fill); }
.cfg-ext-body { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .3s ease, opacity .3s ease; }
.cfg-ext.open .cfg-ext-body { max-height: 320px; opacity: 1; }
.ext-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; padding-top: 4px; }
.ext-switch {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 10px; font-weight: 700; color: var(--text-2); user-select: none;
}
.sw {
  position: relative; width: 32px; height: 16px; border-radius: 999px;
  background: var(--text-4); transition: background .2s; display: inline-block; flex: 0 0 auto;
}
.sw i {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s;
}
.sw.on { background: #3b82f6; }
.sw.on i { transform: translateX(16px); }
.ext-seed { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 10px; font-weight: 700; color: var(--text-2); }
.ext-seed input {
  flex: 1; min-width: 0; padding: 5px 8px; border-radius: 8px; font-size: 10px;
  background: var(--fill); border: 1px solid var(--border); color: var(--text); outline: none;
}
.ext-seed input:focus { border-color: #93c5fd; }

/* ============================================================
 * 画布页修正（实测原站：点阵 #cbd5e1/#475569，底色 #f8fafc/#020617）
 * 注意：外壳页用的是另一套点阵（#dbe2ea / #1c2740，22px），别混用
 * ============================================================ */
#view-canvas .app { background: #f8fafc; }
html.dark #view-canvas .app { background: #020617; }

.grid-bg {
  opacity: .4;
  background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
  background-size: 32px 32px;
}
html.dark .grid-bg {
  opacity: .5;
  background-image: radial-gradient(circle, #475569 1px, transparent 1px);
}

/* ============================================================
 * 画布交互补全（实测原站）
 * ============================================================ */

/* 左侧浮层面板（资产库 / 主体库 / 画布管理） */
.dock {
  position: fixed; left: 88px; top: 50%; transform: translateY(-50%);
  width: 252px; max-height: 72vh; z-index: 60;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.16);
}
.dock-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
}
.dock-title { font-size: 14px; font-weight: 700; color: var(--heading); }
.dock-acts { display: flex; align-items: center; gap: 2px; }
.dock-act {
  width: 26px; height: 26px; border-radius: 8px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.dock-act:hover { background: var(--fill); color: var(--text); }
.dock-tabs { display: flex; gap: 6px; padding: 10px 14px 0; }
.dock-tab {
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: var(--text-2); background: transparent;
}
.dock-tab.active { background: rgba(59,130,246,.12); color: #3b82f6; }
.dock-body { padding: 12px 14px 14px; overflow-y: auto; }
.dock-empty {
  border: 1.5px dashed var(--border); border-radius: 12px;
  padding: 30px 14px; text-align: center; color: var(--text-3); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dock-empty .ph { color: var(--text-4); }
.dock-empty .hint { font-size: 11px; color: var(--text-3); }

/* 画布管理：画布卡片 */
.canvas-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  cursor: pointer; transition: border-color .15s;
}
.canvas-card:hover { border-color: #93c5fd; }
.canvas-thumb {
  position: relative; height: 112px; background: #fbfcfe;
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 12px 12px;
  display: flex; align-items: center; justify-content: center;
}
html.dark .canvas-thumb { background: #0f172a; background-image: radial-gradient(circle, #1e293b 1px, transparent 1px); }
.canvas-thumb .badge {
  position: absolute; top: 8px; right: 8px;
  background: #3b82f6; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.canvas-meta { padding: 9px 11px; }
.canvas-meta .t { font-size: 12.5px; font-weight: 600; color: var(--text); }
.canvas-meta .s { font-size: 10.5px; color: var(--text-3); margin-top: 2px; display: flex; justify-content: space-between; }

/* 节点端口菜单 */
.port-menu {
  position: fixed; z-index: 400; min-width: 132px; padding: 4px;
  border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(0,0,0,.2);
  display: flex; flex-direction: column; gap: 1px;
}
.port-menu .pm-title { font-size: 10px; color: var(--text-3); padding: 5px 8px 3px; }
.port-menu button {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: 8px; font-size: 12px; color: var(--text); text-align: left;
}
.port-menu button:hover { background: var(--fill); }
.port-menu button svg { color: var(--text-2); flex: 0 0 auto; }

/* 大弹窗（工作流模板 / 新建画布） */
.modal2 {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,6,23,.45); backdrop-filter: blur(3px);
}
.modal2-card {
  width: 880px; max-width: 92vw; max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.modal2-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
}
.modal2-head .ttl { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: var(--heading); }
.modal2-head .ttl svg { color: #3b82f6; }
.modal2-close { width: 30px; height: 30px; border-radius: 8px; color: var(--text-3); }
.modal2-close:hover { background: var(--fill); color: var(--text); }
.modal2-body { padding: 20px 22px 26px; overflow-y: auto; }
.modal2-desc { font-size: 13px; color: var(--text-2); margin: 0 0 18px; line-height: 1.6; }
.tpl-sec { font-size: 12px; font-weight: 700; color: var(--text-3); margin: 4px 0 10px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 22px; }
.tpl-card {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.tpl-card:hover { border-color: #93c5fd; box-shadow: 0 8px 24px rgba(59,130,246,.12); }
.tpl-prev {
  height: 118px; position: relative; background: #fbfcfe;
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 14px 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
html.dark .tpl-prev { background: #0f172a; background-image: radial-gradient(circle, #1e293b 1px, transparent 1px); }
.tpl-node {
  border-radius: 8px; padding: 5px 10px; font-size: 11px; font-weight: 600;
  border: 1.5px solid; background: var(--surface);
}
.tpl-node.amber { border-color: #fbbf24; color: #b45309; }
.tpl-node.blue { border-color: #60a5fa; color: #1d4ed8; }
.tpl-node.green { border-color: #34d399; color: #047857; }
.tpl-node.gray { border-color: var(--border); color: var(--text-2); }
.tpl-info { padding: 11px 13px; }
.tpl-info .t { font-size: 13px; font-weight: 700; color: var(--text); }
.tpl-info .d { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }

/* AI 输入条的快捷动作（聚焦时展开） */
.chat-quick {
  display: none; gap: 10px; padding: 0 14px 10px; align-items: center;
}
.chat-wrap.open .chat-quick { display: flex; }
.chat-quick button {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
}
.chat-quick button:hover { color: #3b82f6; }
.chat-quick .sep { width: 1px; height: 11px; background: var(--border); }
.chat-wrap { flex-direction: column; }
.chat-wrap.open .chat-pill { align-items: flex-end; }
.chat-wrap.open textarea.chat-ta { height: 52px; }
.chat-pill textarea {
  flex: 1; background: transparent; border: none; outline: none; resize: none;
  font-size: 13px; color: var(--text); padding: 6px 0 0; height: 24px;
  font-family: inherit; line-height: 1.5;
}
.chat-pill textarea::placeholder { color: var(--text-3); }

.chat-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.chat-quick { padding: 2px 6px 6px; }
.asset-mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.asset-mini { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); position: relative; aspect-ratio: 1 / 1; background: var(--surface); }
.asset-mini img, .asset-mini video { width: 100%; height: 100%; display: block; object-fit: cover; }
.asset-mini[draggable="true"] { cursor: grab; }
.asset-mini[draggable="true"]:active { cursor: grabbing; }
.can-drop { outline: 2px dashed rgba(59,130,246,.55); outline-offset: -8px; }
.asset-mini .mini-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 26px; height: 26px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .5); color: #fff; pointer-events: none;
}

/* 修正：AI 输入条改为纵向（快捷动作在上、输入行在下） */
.chat-pill { flex-direction: column; align-items: stretch; }
.chat-wrap.open .chat-pill { align-items: stretch; }
.chat-quick {
  width: 100%; flex-wrap: nowrap; white-space: nowrap;
  padding: 10px 4px 2px; gap: 8px;
}
.chat-quick button { flex: 0 0 auto; white-space: nowrap; }
.chat-quick button span { white-space: nowrap; }
.chat-pill textarea, .chat-pill .chat-ta { resize: none; overflow: hidden; }

/* 历史记录面板：分段标签（原站样式） */
.seg-track { display: flex; gap: 2px; background: var(--fill); padding: 3px; border-radius: 10px; width: 100%; }
.seg-track .dock-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 5px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  color: var(--text-3); background: transparent;
}
.seg-track .dock-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ============================================================
 * 登录 / 注册 浮层
 * ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #e8eefb 0%, #f6f8fb 55%, #eef2f7 100%);
  font-family: system-ui, "Microsoft YaHei", -apple-system, sans-serif;
}
html.dark .login-screen { background: radial-gradient(1200px 600px at 50% -10%, #0b1730 0%, #070b16 55%, #03060d 100%); }
.login-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 26px 24px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .18);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-logo { width: 38px; height: 38px; }
.login-brand-txt { font-size: 19px; font-weight: 800; letter-spacing: -.2px; color: var(--heading); }
.login-brand-txt span { color: #6366f1; }
.login-tabs { display: flex; gap: 4px; background: var(--fill); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.login-tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 9px 0; border-radius: 9px; font-size: 13.5px; font-weight: 700;
  color: var(--text-3); font-family: inherit;
}
.login-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.login-form { display: flex; flex-direction: column; gap: 11px; }
.login-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 11px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.16); }
.login-error { min-height: 16px; font-size: 12.5px; color: #ef4444; line-height: 1.4; }
.login-submit {
  margin-top: 2px; border: 0; cursor: pointer; padding: 12px 0;
  border-radius: 11px; font-size: 14.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  font-family: inherit; transition: opacity .15s, transform .05s;
}
.login-submit:hover { opacity: .94; }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { opacity: .6; cursor: default; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 设置面板：服务端托管说明 */
.field-note { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.field-note .fn-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.field-note p { margin: 0 0 14px; }
.field-note .btn { margin-right: 10px; }


/* ============================================================
 * 头像自定义（v28）
 * ============================================================ */
.acct-head {
  display: flex; align-items: center; gap: 10px;
}
.acct-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(135deg, #3b82f6, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700; overflow: hidden;
}
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shell-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-up { margin-top: 10px; }
.avatar-preview {
  width: 84px; height: 84px; border-radius: 16px; overflow: hidden;
  margin: 4px auto 2px;
  background: linear-gradient(135deg, #3b82f6, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; font-weight: 700;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================
 * 资产详情（右侧 360px 抽屉，对标原站 canvas.mzsjai.com/assets）
 * ============================================================ */
.asset-detail {
  position: absolute; top: 64px; right: 0; bottom: 0;
  width: 360px; max-width: 90vw; z-index: 20;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.ad-head {
  height: 64px; flex: none; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}
.ad-head > span { font-size: 15px; font-weight: 700; color: var(--heading); }
.ad-close {
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; display: flex; padding: 4px; border-radius: 8px;
}
.ad-close:hover { color: var(--text); background: var(--fill); }
.ad-body { flex: 1; overflow: auto; padding: 20px; }
.ad-preview {
  position: relative; border-radius: 14px; overflow: hidden; background: var(--fill);
  margin-bottom: 18px; display: flex; align-items: center; justify-content: center;
  min-height: 160px;
}
.ad-preview.zoomable { cursor: zoom-in; }
.ad-preview img, .ad-preview video { width: 100%; display: block; object-fit: contain; max-height: 70vh; background: #0b1020; }
.ad-preview audio { width: 100%; padding: 16px; }
.ad-zico {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(15, 23, 42, .55); color: #fff;
  border-radius: 8px; padding: 4px 5px; display: flex;
}
.ad-acts { display: flex; gap: 8px; margin-bottom: 20px; }
.ad-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 10px; cursor: pointer; text-decoration: none;
}
.ad-btn:hover { color: var(--text); border-color: var(--ring); }
.ad-jump {
  width: 100%; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  background: rgba(59, 130, 246, .12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, .28);
}
.ad-jump:hover { background: rgba(59, 130, 246, .2); }
.ad-sec { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin: 20px 0 4px; }
.ad-row {
  display: flex; justify-content: space-between; gap: 14px; padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}
.ad-k { font-size: 12.5px; color: var(--text-3); flex: none; }
.ad-v { font-size: 12.5px; color: var(--text); font-weight: 500; text-align: right; word-break: break-all; }
.ad-none {
  font-size: 12.5px; color: var(--text-3); padding: 10px 0; line-height: 1.6;
  border-top: 1px solid var(--border-soft);
}
.ad-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

/* 网格卡片：类型徽标 / 时间条 / 选中态 */
.asset-cell { cursor: pointer; }
.asset-cell.sel { outline: 2px solid #3b82f6; }
.asset-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; letter-spacing: .02em;
}
.asset-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 9px 11px; display: flex; align-items: center; justify-content: flex-end;
  font-size: 10.5px; color: #fff; pointer-events: none;
  background: linear-gradient(to top, rgba(15, 23, 42, .55), transparent);
}

/* 放大预览 */
.asset-zoom {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.az-close {
  position: absolute; top: 20px; right: 24px; border: none;
  background: rgba(255, 255, 255, .14); color: #fff;
  border-radius: 10px; padding: 8px; cursor: pointer; display: flex;
}
.az-inner { max-width: 92vw; max-height: 88vh; display: flex; }
.az-inner img, .az-inner video {
  max-width: 92vw; max-height: 88vh; border-radius: 12px; object-fit: contain;
}

/* 主体详情（复用资产详情同一套视觉） */
.subj-card { cursor: pointer; }
.subj-card.sel { outline: 2px solid #3b82f6; }
.ad-ph {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4); padding: 24px 0;
}
.ad-danger {
  margin-top: 20px;
  background: rgba(239, 68, 68, .12) !important;
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, .28) !important;
}
.ad-danger:hover { background: rgba(239, 68, 68, .2) !important; }

/* @ 浮窗：主体库分组标题 / 前往添加 / 主体引用标签 */
.mention-group {
  padding: 6px 12px 4px; font-size: 10px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
  border-top: 1px solid var(--border-soft); margin-top: 2px;
  background: var(--fill-2);
}
.mention-go {
  display: block; width: calc(100% - 24px); margin: 0 12px 10px;
  padding: 6px 0; border: none; border-radius: 8px; cursor: pointer;
  font-size: 11px; font-weight: 500; color: #3b82f6;
  background: rgba(59, 130, 246, .08);
}
.mention-go:hover { background: rgba(59, 130, 246, .16); }
.mention-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 主体库 # 标签：每个分类一种颜色 + 左侧一根同色小竖条
   （竖条让 # 标签和 @ 素材标签一眼可分 —— @ 是纯色底、没有竖条）
   配色规则：@ 用 蓝(图片)/绿(视频)/紫(音频)，所以 # 这边避开蓝、绿，
   主体=玫红、场景=青绿、道具=琥珀、音频=紫（音频两套都用紫，语义一致）。 */
.cfg-hl .ref-tag.lk-hash > i {
  border-left-width: 2px; border-left-style: solid; border-left-color: transparent;
}
.cfg-hl .ref-tag.lk-h-subject > i { background: rgba(254, 205, 211, .9); border-left-color: #f43f5e; }
.cfg-hl .ref-tag.lk-h-scene > i { background: rgba(165, 243, 252, .9); border-left-color: #06b6d4; }
.cfg-hl .ref-tag.lk-h-prop > i { background: rgba(253, 224, 71, .9); border-left-color: #f59e0b; }
.cfg-hl .ref-tag.lk-h-audio > i { background: rgba(216, 180, 254, .9); border-left-color: #8b5cf6; }
html.dark .cfg-hl .ref-tag.lk-h-subject > i { background: rgba(159, 18, 57, .55); border-left-color: #fb7185; }
html.dark .cfg-hl .ref-tag.lk-h-scene > i { background: rgba(21, 94, 117, .6); border-left-color: #22d3ee; }
html.dark .cfg-hl .ref-tag.lk-h-prop > i { background: rgba(113, 63, 18, .6); border-left-color: #facc15; }
html.dark .cfg-hl .ref-tag.lk-h-audio > i { background: rgba(88, 28, 135, .6); border-left-color: #c084fc; }

/* # 主体库浮窗：选项卡 + 列表 */
.mention-pop.hash-pop { padding-top: 0; }
.hash-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 6px 5px; border-bottom: 1px solid var(--border-soft);
}
.hash-tab {
  flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 6px; border: none; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-2);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.hash-tab:hover { background: var(--fill-2); }
.hash-tab.active { background: rgba(59, 130, 246, .12); color: var(--heading); }
.hash-dot { width: 6px; height: 6px; border-radius: 999px; flex: none; }
.hash-dot.k-subject { background: #f43f5e; }
.hash-dot.k-scene { background: #06b6d4; }
.hash-dot.k-prop { background: #f59e0b; }
.hash-dot.k-audio { background: #8b5cf6; }
.hash-cnt {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  background: var(--fill-2); border-radius: 999px; padding: 0 5px;
}
.hash-thumb { color: var(--text-2); }
.hash-thumb.k-subject { color: #f43f5e; }
.hash-thumb.k-scene { color: #06b6d4; }
.hash-thumb.k-prop { color: #f59e0b; }
.hash-thumb.k-audio { color: #8b5cf6; }
.hash-thumb svg { width: 15px; height: 15px; }
.subj-kind.k-audio { background: rgba(139, 92, 246, .12); color: #8b5cf6; }
.subj-thumb.is-audio { color: #8b5cf6; }
.subj-thumb.is-audio .subj-ph { color: #8b5cf6; }
/* 主体详情里的音频参考：原生播放条别撑破预览区 */
.ad-preview .ad-audio { width: 88%; }
/* 左侧浮层主体缩略图里没有参考图（或音频）时的分类图标占位 */
.dock-mini-ph {
  width: 100%; height: 100%; min-height: 56px;
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
}
.dock-mini-ph.k-subject { color: #f43f5e; }
.dock-mini-ph.k-scene { color: #06b6d4; }
.dock-mini-ph.k-prop { color: #f59e0b; }
.dock-mini-ph.k-audio { color: #8b5cf6; }
