/* ══════════════════════════════════════════════════════════════
   AI Canvas Studio — 设计令牌与全局样式
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:            #0a0c10;
  --bg-elev:       #10131a;
  --panel:         #141821;
  --panel-2:       #1a1f2a;
  --panel-3:       #212734;
  --line:          #262e3c;
  --line-soft:     #1e2531;
  /* 画布网格（点 / 线）浓度：刻意比 --line 更淡，避免背景发花、看久了晃眼 */
  --grid-dot:      rgba(150, 168, 196, .13);
  --grid-line:     rgba(150, 168, 196, .07);
  --edge:          #4a5a70;
  --text:          #e7ecf3;
  --text-2:        #a7b1c2;
  --text-3:        #6f7a8c;
  --accent:        #34d3a6;
  --accent-dim:    #1f8f72;
  --accent-soft:   rgba(52, 211, 166, .12);
  --accent-2:      #6ea8fe;
  --accent-2-soft: rgba(110, 168, 254, .12);
  --warn:          #f5b544;
  --danger:        #ff6b6b;
  --danger-soft:   rgba(255, 107, 107, .12);
  --ok:            #3ddc84;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-sm:     7px;
  --shadow-1:      0 1px 2px rgba(0,0,0,.4);
  --shadow-2:      0 10px 30px -6px rgba(0,0,0,.6);
  --shadow-3:      0 24px 60px -12px rgba(0,0,0,.75);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --topbar-h: 52px;
  --rail-w: 62px;
  --dock-w: 348px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

html[data-theme="light"] {
  --bg:            #f3f5f8;
  --bg-elev:       #ffffff;
  --panel:         #ffffff;
  --panel-2:       #f7f9fb;
  --panel-3:       #eef2f6;
  --line:          #d9e0e9;
  --line-soft:     #e6ebf1;
  /* 浅色主题同样收一档，近白底上的网格不再扎眼 */
  --grid-dot:      rgba(84, 104, 134, .10);
  --grid-line:     rgba(84, 104, 134, .055);
  --edge:          #9aa9bd;
  --text:          #10151c;
  --text-2:        #4c5866;
  --text-3:        #8a95a3;
  --accent:        #0f9d78;
  --accent-dim:    #0b7a5d;
  --accent-soft:   rgba(15, 157, 120, .1);
  --accent-2:      #2563eb;
  --accent-2-soft: rgba(37, 99, 235, .1);
  --danger:        #d92d20;
  --danger-soft:   rgba(217, 45, 32, .08);
  --ok:            #12b76a;
  --shadow-1:      0 1px 2px rgba(16,24,40,.06);
  --shadow-2:      0 10px 30px -8px rgba(16,24,40,.18);
  --shadow-3:      0 24px 60px -12px rgba(16,24,40,.28);
}

* { box-sizing: border-box; }
/* 必须放在最前：class 上的 display 会盖掉 UA 的 [hidden]，这里统一兜底 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4,p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; background: var(--panel-2); color: var(--text-2);
}
.ico { width: 16px; height: 16px; flex: none; display: block; }
.ico-lg { width: 20px; height: 20px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::selection { background: var(--accent-soft); }

/* ────────────── 按钮 ────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .1s var(--ease), color .16s;
}
.btn:hover { background: var(--panel-3); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #04211a; font-weight: 650;
}
html[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-block { width: 100%; justify-content: center; height: 36px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 11.5px; }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: var(--radius-sm); color: var(--text-2);
  transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.primary { background: var(--accent); color: #04211a; }
html[data-theme="light"] .icon-btn.primary { color: #fff; }

/* ────────────── 顶栏 ────────────── */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 12px; background: var(--bg-elev);
  border-bottom: 1px solid var(--line); position: relative; z-index: 40;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: var(--radius-sm); }
.brand:hover { background: var(--panel-2); }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 13.5px; letter-spacing: .2px; }
.brand-text small { font-size: 10px; color: var(--text-3); letter-spacing: .3px; }
.topbar-div { width: 1px; height: 22px; background: var(--line); }
.project-chip {
  display: flex; align-items: center; gap: 6px; padding: 0 9px 0 8px;
  height: 30px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.project-chip .ico { width: 14px; height: 14px; color: var(--text-3); }
.project-chip input {
  background: none; border: none; outline: none; width: 168px; font-size: 12.5px; font-weight: 550;
}
.save-state { font-size: 11.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.save-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.save-state[data-state="dirty"]::before { background: var(--warn); }
.save-state[data-state="saving"]::before { background: var(--accent-2); animation: pulse 1s infinite; }
.pill {
  font-style: normal; font-size: 10.5px; padding: 0 5px; height: 16px; line-height: 16px;
  border-radius: 20px; background: var(--panel-3); color: var(--text-2);
}
.dot-badge {
  font-style: normal; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px; text-align: center; border-radius: 20px;
  background: var(--accent); color: #04211a; font-weight: 700;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ────────────── 布局 ────────────── */
.app {
  display: flex; height: calc(100dvh - var(--topbar-h));
  background: var(--bg); position: relative;
}

/* 左侧图标栏 */
.rail {
  width: var(--rail-w); flex: none; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 10px 0;
  background: var(--bg-elev); border-right: 1px solid var(--line); z-index: 30;
}
.rail-gap { flex: 1; }
.rail-btn {
  width: 48px; padding: 7px 2px 5px; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; position: relative;
  transition: background .16s, color .16s;
}
.rail-btn:hover { background: var(--panel-2); color: var(--text-2); }
.rail-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.rail-badge {
  position: absolute; top: 4px; right: 8px; font-style: normal; font-size: 9.5px;
  min-width: 15px; height: 15px; line-height: 15px; text-align: center;
  border-radius: 20px; background: var(--danger); color: #fff; padding: 0 3px;
}

/* 画布舞台 */
.stage { flex: 1; min-width: 0; position: relative; }
.viewport {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--bg); outline: none; cursor: default;
}
.viewport[data-tool="hand"], .viewport.is-panning { cursor: grab; }
.viewport.is-panning { cursor: grabbing; }
.viewport.is-connect { cursor: crosshair; }

.grid-layer {
  position: absolute; inset: 0; pointer-events: none;
  contain: paint;               /* 网格重绘被隔离在这一层，不牵连整个视口 */
  background-image:
    radial-gradient(circle, var(--grid-dot) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-repeat: repeat;
}
.world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
/* 平移 / 缩放期间把世界层提升为合成层：transform 变化走 GPU 合成，不再整层重绘（拖拽卡顿的主因）。
   只在这两个交互态里加，平时不常驻（节点多时合成层很占显存）。 */
.viewport.is-panning .world,
.viewport.is-zooming .world { will-change: transform; }
/* 0×0 的 SVG 根在新版 Chromium 下不绘制子元素，因此给真实尺寸并向负方向偏移，
   内部 <g transform="translate(50000,50000)"> 把坐标平移回世界原点（见 canvas.js init） */
.edge-layer { position: absolute; left: -50000px; top: -50000px; width: 100000px; height: 100000px; pointer-events: none; }
.node-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; }

/* ────────────── 节点 ────────────── */
.node {
  position: absolute; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; overflow: visible;
  transition: border-color .16s, box-shadow .16s;
  cursor: grab;                 /* 整块节点都可以拖动 */
  user-select: none;
  -webkit-user-select: none;
}
.node:active { cursor: grabbing; }
.node:hover { border-color: var(--text-3); }
.node button, .node input, .node textarea, .node select, .node a,
.node video, .node audio, .node .port { cursor: auto; }
.node .node-menu-btn, .node .btn { cursor: pointer; }
.node-title.is-editing { cursor: text; user-select: text; -webkit-user-select: text; outline: none; border-radius: 4px; box-shadow: 0 0 0 1px var(--accent); background: var(--panel-3); padding: 0 3px; }
/* 拖动中的全局反馈 */
body.is-dragging, body.is-panning { cursor: grabbing !important; user-select: none !important; }
body.is-dragging .node, body.is-panning .node { cursor: grabbing; }
.node-media img { pointer-events: none; -webkit-user-drag: none; user-drag: none; }
.node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-2); }
.node.is-running { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 0 34px -8px var(--accent-2); }
.node.is-error { border-color: var(--danger); }
.node-head {
  display: flex; align-items: center; gap: 7px; padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft); cursor: grab; user-select: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--panel-2);
}
.node-head:active { cursor: grabbing; }
.node-kind {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  background: var(--panel-3); color: var(--text-2); flex: none;
}
.node-kind .ico { width: 12px; height: 12px; }
/* 节点编号徽标：全局唯一 #N，用户 / 智能体靠它精确定位节点 */
.node-no {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .02em;
  padding: 1px 5px; border-radius: 6px; font-variant-numeric: tabular-nums;
  background: rgba(52,211,166,.14); color: var(--accent); cursor: help;
}
.node[data-type="image"] .node-kind { background: rgba(110,168,254,.16); color: var(--accent-2); }
.node[data-type="video"] .node-kind { background: rgba(52,211,166,.16); color: var(--accent); }
.node[data-type="audio"] .node-kind { background: rgba(245,181,68,.16); color: var(--warn); }
.node[data-type="skill"] .node-kind { background: rgba(167,139,250,.18); color: #a78bfa; }
.node-title {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.node-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 20px; flex: none;
  background: var(--panel-3); color: var(--text-3);
}
.node-badge[data-s="ready"] { background: var(--accent-soft); color: var(--accent); }
.node-badge[data-s="running"] { background: var(--accent-2-soft); color: var(--accent-2); }
.node-badge[data-s="error"] { background: var(--danger-soft); color: var(--danger); }
.node-body { flex: 1; min-height: 0; padding: 9px 10px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.node-foot {
  border-top: 1px solid var(--line-soft); padding: 7px 9px;
  display: flex; align-items: center; gap: 6px; background: var(--panel-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.node-prompt {
  width: 100%; flex: 1; min-height: 54px; resize: none; outline: none;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 7px 8px; font-size: 12px; line-height: 1.5; color: var(--text-2); font-family: var(--sans);
}
.node-prompt:focus { border-color: var(--accent); color: var(--text); }
.node-prompt::placeholder { color: var(--text-3); }
/* 图片 / 视频节点上常驻的提示词输入框：点一下就能写 */
.node-prompt.inline-prompt {
  flex: none; min-height: 40px; height: 46px; resize: vertical; font-size: 11.5px; line-height: 1.45;
  background: var(--panel-2);
}
.node-prompt.inline-prompt:focus { background: var(--panel-3); }
.node-media {
  flex: 1; min-height: 0; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line-soft); position: relative;
  display: grid; place-items: center;
}
.node-media img, .node-media video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.node-media audio { width: 100%; }
/* 视频节点常驻控制条（右上角）：静音 / 全屏 / 下载 */
.media-vbar {
  position: absolute; top: 7px; right: 7px; z-index: 6;
  display: flex; gap: 4px;
}
.media-vbar button {
  width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255,255,255,.16); border-radius: 7px;
  display: grid; place-items: center; cursor: pointer; color: #fff;
  background: rgba(8,12,18,.62); backdrop-filter: blur(4px);
}
.media-vbar button:hover { background: rgba(8,12,18,.88); }
.media-vbar .ico { width: 14px; height: 14px; }
.media-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-3); font-size: 11.5px; text-align: center; padding: 14px;
}
.media-empty .ico { width: 22px; height: 22px; opacity: .6; }
/* 空态节点：提示区压缩成一条，空间让给提示词框 */
.node-media.is-empty { flex: none; min-height: 52px; }
.node-media.is-empty .media-empty { flex-direction: row; gap: 8px; padding: 9px 14px; font-size: 11px; }
.node-media.is-empty .media-empty .ico { width: 17px; height: 17px; }
/* 视频成片加载失败 / 缓冲慢的提示条（浮在节点媒体区底部） */
.media-hint {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 4;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 6px 9px; border-radius: 8px; font-size: 11px; line-height: 1.4;
  background: rgba(8,12,18,.82); color: #fff; border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(3px);
}
.media-hint button {
  flex: none; padding: 2px 9px; font-size: 10.5px; cursor: pointer;
  border-radius: 7px; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
}
.media-hint button:hover { background: rgba(255,255,255,.22); }

/* MJ 宫格 / 多张请求的备选切换（费用已产生，轮换不另计费） */.alt-switch {
  position: absolute; left: 8px; bottom: 8px; z-index: 3;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 8px; font-size: 10.5px; cursor: pointer;
  background: rgba(8,12,18,.72); color: #fff; border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(3px);
}
.alt-switch:hover { background: rgba(8,12,18,.92); border-color: var(--accent); }
.alt-switch i { font-style: normal; opacity: .72; font-variant-numeric: tabular-nums; }
/* 参数面板里与计费相关的说明行 */
.p-note { font-size: 10.5px; color: var(--text-3); line-height: 1.55; margin-top: 5px; }
.p-note b { color: var(--text-2); }
.node-prompt.inline-prompt.is-empty { flex: 1 1 auto; height: auto; min-height: 92px; }

/* ══════════ 提示词上方的「素材」条（上传的文本 / 图片 / 视频） ══════════ */
.prompt-attach { flex: none; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.prompt-attach::-webkit-scrollbar { height: 4px; }
.prompt-attach::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.pa-list { display: flex; align-items: center; gap: 5px; min-width: min-content; }
.pa-chip {
  position: relative; flex: none; height: 28px; max-width: 136px; padding: 0 3px;
  display: inline-flex; align-items: center; gap: 4px; overflow: hidden;
  background: var(--panel-3); border: 1px solid var(--line-soft); border-radius: 6px;
}
.pa-chip img, .pa-chip video {
  width: 24px; height: 22px; flex: none; border-radius: 4px; object-fit: cover; background: #000; display: block;
}
.pa-chip .pa-txt {
  width: 22px; height: 22px; flex: none; border-radius: 4px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 10px; font-style: normal;
}
.pa-chip b {
  font-size: 10px; font-weight: 500; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-chip.is-up { border-color: var(--accent-2-soft); }
.pa-chip.is-up b { color: var(--accent-2); }
.pa-chip .pa-x {
  width: 15px; height: 15px; flex: none; border-radius: 4px; font-size: 12px; line-height: 1;
  color: var(--text-3); display: grid; place-items: center;
}
.pa-chip .pa-x:hover { background: var(--danger-soft); color: var(--danger); }
.pa-add {
  flex: none; height: 28px; padding: 0 9px; cursor: pointer; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel-2); border: 1px dashed var(--line); color: var(--text-3); font-size: 10.5px;
  transition: border-color .12s, color .12s;
}
.pa-add:hover { border-color: var(--accent); color: var(--accent); }
.pa-add .ico { width: 13px; height: 13px; }

/* ══════════ 素材大图预览（灯箱） ══════════ */
.lightbox {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 44px;
  cursor: zoom-out;
}
/* 首页作品预览：挂在 body 上，层级要盖过首页浮层（#homeView z-index 900） */
.lightbox.is-solo { z-index: 960; }
.lightbox .lb-media {
  max-width: 92vw; max-height: 84vh; border-radius: 10px; object-fit: contain;
  background: #000; box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  cursor: default; user-select: none; -webkit-user-drag: none;
}
.lightbox .lb-close {
  position: fixed; top: 16px; right: 20px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(15, 18, 24, .72); border: 1px solid var(--line); color: var(--text);
}
.lightbox .lb-close:hover { background: var(--panel-3); }
.lightbox .lb-close .ico { width: 16px; height: 16px; }
.lightbox .lb-title {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--text-2); padding: 5px 14px; border-radius: 20px;
  background: rgba(15, 18, 24, .72); border: 1px solid var(--line); pointer-events: none;
}
/* 节点大图可点击进入灯箱时的悬浮提示 */
.node-media.is-viewable { cursor: zoom-in; }
.node-media.is-viewable:hover::after {
  content: '点击查看大图'; position: absolute; right: 8px; bottom: 8px;
  font-size: 10px; color: var(--text-2); padding: 2px 8px; border-radius: 20px;
  background: rgba(15, 18, 24, .68); border: 1px solid var(--line); pointer-events: none;
}
/* 文本素材全文预览 */
.lb-text-modal { width: min(680px, 92vw); }
.lb-text {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.7; color: var(--text-2);
  max-height: 60vh; overflow-y: auto; font-family: var(--sans);
}

.progress-ring { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,8,12,.72); }
.progress-ring .bar { width: 70%; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-ring .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-ring .txt { font-size: 11px; color: var(--text-2); margin-top: 8px; text-align: center; }
.node-meta { display: flex; flex-wrap: wrap; gap: 5px; font-size: 10.5px; color: var(--text-3); }
.node-meta em {
  font-style: normal; padding: 1px 6px; border-radius: 20px;
  background: var(--panel-3); border: 1px solid var(--line-soft);
}
.node-actions { display: flex; gap: 5px; margin-left: auto; }
.node-menu-btn { width: 22px; height: 22px; border-radius: 5px; color: var(--text-3); display: grid; place-items: center; }
.node-menu-btn:hover { background: var(--panel-3); color: var(--text); }

/* ══════════ 节点内联参数条（模型 / 比例 / 尺寸 / 时长） ══════════ */
.param-bar { display: flex; flex-wrap: wrap; gap: 4px; flex: none; }
.param-bar .pchip {
  font-size: 10.5px; padding: 2px 7px; border-radius: 20px; cursor: pointer;
  background: var(--panel-3); border: 1px solid var(--line-soft); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  transition: border-color .12s, color .12s, background .12s;
}
.param-bar .pchip:hover { border-color: var(--accent); color: var(--text); }
.param-bar .pchip i { font-style: normal; font-size: 8px; opacity: .7; }
.param-bar .pchip.wide {
  flex: 1; justify-content: space-between; max-width: 100%;
  background: var(--accent-soft); border-color: transparent; color: var(--text);
}
.param-bar .pchip.wide span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.param-bar .pchip.wide:hover { border-color: var(--accent); }
.param-bar .pchip.skill { color: var(--text-3); }
.param-bar .pchip.skill.on {
  background: rgba(167, 139, 250, .16); border-color: transparent; color: #c4b5fd; font-weight: 600;
}
html[data-theme="light"] .param-bar .pchip.skill.on { background: rgba(124, 58, 237, .12); color: #6d28d9; }
.picker.on { border-color: var(--accent); background: var(--accent-soft); }
.skill-note { font-size: 10.5px; color: var(--text-3); line-height: 1.55; margin-top: 5px; }
.skill-note b { color: var(--text-2); font-weight: 600; }
.skill-cur {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 9px;
  border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--accent);
}
.skill-cur b { font-size: 11.5px; color: var(--accent); }
.skill-cur small { font-size: 10px; color: var(--text-3); }

/* ══════════ 节点展开式参数面板 ══════════ */
.node-sheet {
  position: absolute; left: -12px; right: -12px; top: 100%; margin-top: 6px;
  min-width: 300px; max-height: 460px; overflow: hidden auto;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  padding: 10px; z-index: 400; cursor: auto; user-select: text;
  display: flex; flex-direction: column; gap: 8px;
  animation: sheetIn .14s var(--ease);
}
.node-sheet.is-up { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 6px; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.node-sheet.is-up { animation: sheetInUp .14s var(--ease); }
@keyframes sheetInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.node-sheet::-webkit-scrollbar { width: 8px; }
.node-sheet::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.sheet-head {
  display: flex; align-items: center; gap: 7px; position: sticky; top: -10px;
  margin: -10px -10px 0; padding: 9px 10px; background: var(--bg-elev);
  border-bottom: 1px solid var(--line-soft); z-index: 2;
}
.sheet-head b { font-size: 12px; font-weight: 650; }
.sheet-sub { font-size: 10.5px; color: var(--text-3); flex: 1; }
.sheet-close {
  width: 20px; height: 20px; border-radius: 5px; color: var(--text-3);
  display: grid; place-items: center; font-size: 15px; line-height: 1; flex: none;
}
.sheet-close:hover { background: var(--panel-3); color: var(--text); }

.sheet-body { display: flex; flex-direction: column; gap: 9px; }
.sheet-field { display: flex; flex-direction: column; gap: 4px; }
.sheet-field > label { font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.sheet-field textarea {
  width: 100%; resize: vertical; outline: none; font-family: var(--sans);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 7px 8px; font-size: 12px; line-height: 1.55; color: var(--text);
}
.sheet-field textarea:focus { border-color: var(--accent); }
.sheet-field textarea::placeholder { color: var(--text-3); }
.sheet-field input[type="number"] {
  width: 100%; min-width: 0; outline: none; font-family: var(--mono);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 5px 7px; font-size: 11.5px; color: var(--text);
}
.sheet-field input[type="number"]:focus { border-color: var(--accent); }
.sheet-field .row { display: flex; align-items: center; gap: 6px; }
.sheet-field .row.tight { gap: 5px; flex-wrap: nowrap; }
.sheet-field .row.tight input[type="number"] { width: auto; flex: 1 1 0; min-width: 52px; }
.sheet-field .row .x { font-size: 11px; color: var(--text-3); flex: none; }
.sheet-field .row .btn { flex: none; }

.sheet-switch {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--text-2); gap: 8px;
}
.sheet-run { margin-top: 2px; }

/* 芯片组 */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips .chip {
  font-size: 10.5px; padding: 3px 8px; border-radius: 20px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--text-2);
  transition: all .12s;
}
.chips .chip:hover { border-color: var(--accent-dim); color: var(--text); }
.chips .chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* 模型选择按钮 */
.picker {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 11.5px; color: var(--text); cursor: pointer; text-align: left;
}
.picker:hover { border-color: var(--accent); }
.picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker i { font-style: normal; font-size: 9px; opacity: .6; flex: none; }

/* 模型列表 */
.sheet-search {
  width: 100%; outline: none; font-family: var(--sans);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 11.5px; color: var(--text);
}
.sheet-search:focus { border-color: var(--accent); }
.sheet-search::placeholder { color: var(--text-3); }
.sheet-list { display: flex; flex-direction: column; gap: 2px; overflow: visible; }
/* 模型面板：未对接时的引导块与底部说明 */
.sheet-callout {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  margin: 6px 2px 2px; padding: 12px 14px;
  background: var(--panel-2); border: 1px dashed var(--line);
  border-radius: var(--radius); font-size: 11.5px; color: var(--text-2);
}
.sheet-callout b { font-size: 12px; color: var(--text); }
.sheet-callout small { line-height: 1.75; }
.sheet-foot-note { margin: 8px 2px 2px; font-size: 10.5px; color: var(--text-3); text-align: center; }
.sheet-list .opt-manage { border-style: dashed; opacity: .85; }
.sheet-group {
  font-size: 10px; color: var(--text-3); padding: 8px 4px 3px; letter-spacing: .04em;
  border-top: 1px solid var(--line-soft); margin-top: 3px;
}
.sheet-group:first-child { border-top: 0; margin-top: 0; padding-top: 2px; }
.sheet-list .opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  padding: 6px 8px; border-radius: var(--radius-sm); background: transparent;
  border: 1px solid transparent; color: var(--text-2);
}
.sheet-list .opt:hover { background: var(--panel-2); }
.sheet-list .opt b { font-size: 11.5px; font-weight: 600; color: var(--text); }
.sheet-list .opt small { font-size: 10px; color: var(--text-3); line-height: 1.45; }
.sheet-list .opt.is-on { background: var(--accent-soft); border-color: var(--accent); }
.sheet-list .opt.is-on b { color: var(--accent); }
.sheet-list .opt.is-off { opacity: .5; cursor: not-allowed; }
/* 面板里的控件恢复各自的指针形态（.node 全局是 grab） */
.node-sheet button { cursor: pointer; }
.node-sheet textarea, .node-sheet input { cursor: text; }
.node-sheet .chip:disabled, .node-sheet .opt:disabled { cursor: not-allowed; }

@media (max-width: 720px) {
  .node-sheet { max-height: 60vh; min-width: 240px; }
}

/* 端口 */
.port {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--bg-elev);
  top: 50%; transform: translateY(-50%); transition: transform .12s, border-color .12s, background .12s;
  z-index: 3; cursor: crosshair;
}
/* 视觉 12px，命中区放大到 34px，拉线不用瞄准 */
.port-hit { position: absolute; inset: -11px; border-radius: 50%; display: block; }
.port::after {
  content: attr(data-hint); position: absolute; left: 50%; top: -19px; transform: translateX(-50%);
  font-size: 9.5px; color: var(--text-3); white-space: nowrap; opacity: 0;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
  transition: opacity .12s; pointer-events: none;
}
.node:hover .port::after { opacity: 1; }
.node:hover .port { border-color: var(--accent); }
/* 拉线时鼠标悬停的目标节点 */
.node.is-droptarget { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 0 30px -6px var(--accent-2); }
.node.is-droptarget .port-in { border-color: var(--accent-2); background: var(--accent-2); transform: translateY(-50%) scale(1.5); }

/* 拉线到空白处弹出的「创建节点」菜单
   （用 .popmenu.create-menu 提高优先级，避免被后面的 .popmenu 规则盖掉） */
.popmenu.create-menu {
  position: fixed; bottom: auto; left: auto; width: 258px; z-index: 120;
  padding: 6px; background: var(--bg-elev);
  box-shadow: 0 26px 60px -14px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.25);
  animation: sheetIn .13s var(--ease);
}
.popmenu.create-menu .create-head {
  padding: 7px 9px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px;
  font-size: 12px; font-weight: 650; display: flex; flex-direction: column; gap: 1px;
  color: var(--text);
}
.popmenu.create-menu .create-head small { font-size: 10.5px; color: var(--text-3); font-weight: 400; }
.popmenu.create-menu button {
  flex-direction: row; align-items: center; gap: 9px; padding: 7px 8px; width: 100%;
}
.popmenu.create-menu button:hover { background: var(--panel-2); }
.popmenu.create-menu .ci {
  width: 26px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--panel-3); color: var(--text-2);
}
.popmenu.create-menu .ci .ico { width: 15px; height: 15px; }
.popmenu.create-menu button[data-create="image"] .ci { background: rgba(110,168,254,.16); color: var(--accent-2); }
.popmenu.create-menu button[data-create="video"] .ci { background: rgba(52,211,166,.16); color: var(--accent); }
.popmenu.create-menu button[data-create="audio"] .ci { background: rgba(245,181,68,.16); color: var(--warn); }
.popmenu.create-menu .txts { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.port-in { left: -7px; }
.port-out { right: -7px; }
.port:hover, .port.is-hot { border-color: var(--accent); background: var(--accent); transform: translateY(-50%) scale(1.35); }
.node[data-type="text"] .port-out { border-color: var(--accent-2); }
.port-label {
  position: absolute; font-size: 9.5px; color: var(--text-3); top: -16px; left: -6px;
  white-space: nowrap; pointer-events: none;
}
.edge { fill: none; stroke: var(--edge); stroke-width: 2; }
.edge.is-active { stroke: var(--accent-2); }
.edge-hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.edge-temp { stroke: var(--accent); stroke-dasharray: 5 4; }
.edge-del:hover { stroke: var(--danger); }

/* 内联弹层 */
.node-pop {
  position: absolute; z-index: 60; top: 34px; right: 8px; min-width: 168px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-3); padding: 5px;
}
.node-pop button {
  display: flex; width: 100%; align-items: center; gap: 7px; padding: 6px 8px;
  border-radius: 6px; font-size: 12px; color: var(--text-2); text-align: left;
}
.node-pop button:hover { background: var(--panel-2); color: var(--text); }
.node-pop button.danger { color: var(--danger); }

/* ────────────── 底部工具栏 ────────────── */
.canvas-toolbar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px; padding: 5px 7px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(14px); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3); z-index: 25;
}
.tool-group { display: flex; align-items: center; gap: 3px; }
.tool {
  height: 30px; min-width: 30px; padding: 0 7px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-2); font-size: 12px; transition: background .15s, color .15s;
}
.tool:hover { background: var(--panel-3); color: var(--text); }
.tool[data-active="true"] { background: var(--accent-soft); color: var(--accent); }
.tool-wide { padding: 0 12px; }
.tool-danger:hover { background: var(--danger-soft); color: var(--danger); }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.zoom-readout {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  min-width: 42px; text-align: center; user-select: none;
}
.sel-count { font-size: 11.5px; color: var(--text-2); padding: 0 6px; white-space: nowrap; }
.popmenu {
  position: absolute; bottom: calc(100% + 9px); left: 0; width: 246px; padding: 5px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; gap: 2px;
}
.popmenu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 9px; border-radius: 6px; text-align: left;
}
.popmenu button:hover { background: var(--panel-2); }
.popmenu button b { font-size: 12.5px; font-weight: 600; }
.popmenu button small { font-size: 11px; color: var(--text-3); }

.hud {
  position: absolute; left: 14px; bottom: 16px; display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 20px; font-size: 11px; color: var(--text-3);
  background: color-mix(in srgb, var(--bg-elev) 80%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(10px); pointer-events: none; z-index: 24;
}
.hud-sep { width: 1px; height: 12px; background: var(--line); }

/* 空画布引导 */
.welcome { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.welcome-card {
  pointer-events: auto; width: min(560px, 84%); padding: 26px 30px 20px; text-align: center;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3);
}
.welcome-icon { color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.welcome-icon svg { width: 40px; height: 40px; }
.welcome-card h2 { font-size: 17px; font-weight: 650; margin-bottom: 8px; }
.welcome-card p { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.welcome-actions { display: flex; gap: 8px; justify-content: center; margin: 18px 0 14px; flex-wrap: wrap; }
.welcome-tips { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-3); }

/* ────────────── 智能体停靠面板 ────────────── */
.dock {
  width: var(--dock-w); flex: none; display: flex; flex-direction: column;
  background: var(--bg-elev); border-left: 1px solid var(--line); z-index: 30;
}
.dock[hidden] { display: none; }
.app.dock-collapsed .dock { display: none; }
.dock-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.dock-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dock-title > div { min-width: 0; overflow: hidden; }
.agent-avatar {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent-2-soft));
  border: 1px solid var(--line); color: var(--accent);
}
.agent-avatar svg { width: 19px; height: 19px; }
.dock-title b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-title small { display: block; font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-head-actions { display: flex; align-items: center; gap: 5px; }
.mini-select {
  height: 26px; max-width: 118px; padding: 0 5px; font-size: 11px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; outline: none;
}
.mini-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px;
  font-size: 11px; color: var(--text-2); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer; white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.mini-btn:hover { color: var(--text); border-color: var(--accent); }
.mini-btn .ico { width: 12px; height: 12px; }
.dock-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.dock-tab {
  padding: 6px 12px 8px; font-size: 12.5px; color: var(--text-3); font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.dock-tab:hover { color: var(--text-2); }
.dock-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.dock-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.dock-panel.is-active { display: flex; }

/* ── 智能体状态条（默认隐藏：点右上角小圆点展开；云服务异常时自动展开） ── */
[data-panel="chat"] { position: relative; }
.chat-dot {
  position: absolute; top: 9px; right: 12px; z-index: 6;
  width: 22px; height: 22px; border-radius: 50%; padding: 0;
  border: 1px solid var(--line); background: var(--panel-2);
  opacity: .45; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}
.chat-dot:hover { opacity: 1; }
.chat-dot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.chat-dot.is-on .dot { background: var(--accent); }
.chat-dot.is-warn .dot { background: var(--warn, #d9a13b); }
.chat-status {
  display: none; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 8px 36px 8px 12px; border-bottom: 1px solid var(--line); font-size: 10.5px;
}
.chat-status.is-show { display: flex; }
.cs-chip {
  padding: 2px 7px; border-radius: 20px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis;
}
.cs-chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cs-chip.is-dim { opacity: .6; }
.cs-chip.is-warn { background: var(--warn-soft, rgba(255,190,90,.12)); border-color: var(--warn, #d9a13b); color: var(--warn, #d9a13b); }
.cs-spacer { flex: 1; }
.cs-btn {
  padding: 2px 8px; border-radius: 20px; font-size: 10.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); cursor: pointer;
}
.cs-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── 工具调用步骤卡 ── */
.msg.step .msg-head { color: var(--accent); }
.msg.step.is-bad .msg-head { color: var(--warn, #d9a13b); }
.step-args {
  font-size: 10.5px; color: var(--text-3); font-family: var(--mono);
  padding: 3px 8px; background: var(--panel-3); border-radius: 6px;
  word-break: break-all; line-height: 1.5;
}
.step-out {
  font-size: 11.5px; line-height: 1.65; color: var(--text-2);
  padding: 6px 9px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 2px solid var(--accent); border-radius: 6px;
}
.msg.step.is-bad .step-out { border-left-color: var(--warn, #d9a13b); }

/* ── 提示词工作台 ── */
.pt-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.pt-block { display: flex; flex-direction: column; gap: 7px; }
.pt-label {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.pt-label em { font-style: normal; font-weight: 400; opacity: .75; }
.pt-hint { font-size: 10.5px; color: var(--text-3); line-height: 1.55; }
.pt-block textarea {
  width: 100%; resize: vertical; min-height: 62px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.6; outline: none;
}
.pt-block textarea:focus { border-color: var(--accent); }
.pt-quick { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.pt-quick::-webkit-scrollbar { display: none; }
.pt-rows { display: flex; flex-direction: column; gap: 6px; }
.pt-row { display: flex; align-items: center; gap: 8px; }
.pt-row > span { flex: none; width: 38px; font-size: 11px; color: var(--text-3); }
/* 参数适用范围小徽标：图 = 仅图片模型，视频 = 仅视频模型 */
.pt-row .pt-kind {
  display: inline-block; margin-left: 3px; padding: 0 4px; border-radius: 5px;
  font-size: 9px; font-style: normal; line-height: 13px; vertical-align: 1px;
  background: var(--panel-3); color: var(--text-3);
}
.pt-row select {
  flex: 1; min-width: 0; height: 26px; padding: 0 6px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; outline: none;
}
.pt-row .chip-row { flex: 1; }
.pt-out { display: flex; flex-direction: column; gap: 9px; }
.pt-out-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-2); }
.pt-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); padding: 9px; display: flex; flex-direction: column; gap: 6px;
}
.pt-card.is-video { border-left: 2px solid var(--accent-2); }
.pt-card-head { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.pt-card-head b { font-size: 12px; }
.pt-kind {
  font-size: 10px; padding: 1px 6px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
}
.pt-card.is-video .pt-kind { background: var(--accent-2-soft); color: var(--accent-2); }
.pt-id { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.pt-text {
  width: 100%; resize: vertical; padding: 7px 9px; font-size: 11.5px; line-height: 1.65;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  outline: none; font-family: inherit;
}
.pt-text:focus { border-color: var(--accent); }
.pt-line { font-size: 10.5px; color: var(--text-3); line-height: 1.55; word-break: break-word; }
.pt-line span {
  display: inline-block; min-width: 26px; margin-right: 5px; padding: 0 5px;
  border-radius: 4px; background: var(--panel-3); color: var(--text-2);
}
.pt-warn { font-size: 10.5px; color: var(--warn, #d9a13b); line-height: 1.55; }
.pt-card-foot { display: flex; gap: 5px; flex-wrap: wrap; }
.pt-mini {
  padding: 3px 9px; border-radius: 20px; font-size: 10.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); cursor: pointer;
}
.pt-mini:hover { color: var(--accent); border-color: var(--accent); }

.skill-search {
  margin: 10px 12px 8px; display: flex; align-items: center; gap: 7px;
  padding: 0 9px; height: 32px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.skill-search .ico { color: var(--text-3); }
.skill-search input { flex: 1; min-width: 0; background: none; border: none; outline: none; font-size: 12.5px; }
.cat-row { display: flex; gap: 5px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat {
  flex: none; padding: 3px 10px; border-radius: 20px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
}
.cat:hover { border-color: var(--text-3); }
.cat.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.skill-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skill-card {
  text-align: left; padding: 9px 10px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .15s, transform .12s, background .15s; position: relative; overflow: hidden;
}
.skill-card:hover { border-color: var(--text-3); transform: translateY(-1px); }
.skill-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.skill-swatch { display: flex; gap: 3px; margin-bottom: 7px; }
.skill-swatch i { width: 16px; height: 5px; border-radius: 3px; display: block; }
.skill-card b { display: block; font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.skill-card small { display: block; font-size: 10.5px; color: var(--text-3); line-height: 1.45; }
.skill-free {
  position: absolute; top: 7px; right: 7px; font-size: 9.5px; padding: 0 5px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

.skill-detail { display: flex; flex-direction: column; gap: 10px; }
.detail-back { align-self: flex-start; }
.detail-hero {
  border-radius: var(--radius-lg); padding: 13px; border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
}
.detail-hero h3 { font-size: 14.5px; margin-bottom: 3px; }
.detail-hero .en { font-size: 10.5px; color: var(--text-3); font-family: var(--mono); letter-spacing: .4px; }
.detail-hero p { margin-top: 8px; font-size: 12px; color: var(--text-2); line-height: 1.65; }
.detail-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 11px; background: var(--panel); }
.detail-block h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-3);
  margin-bottom: 7px; display: flex; align-items: center; gap: 6px;
}
.detail-block h4::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.rule-list { display: flex; flex-direction: column; gap: 5px; }
.rule-list li { font-size: 11.5px; color: var(--text-2); display: flex; gap: 7px; line-height: 1.6; }
.rule-list li span:first-child { color: var(--accent); flex: none; font-family: var(--mono); font-size: 10.5px; padding-top: 2px; }
.shot-list { display: flex; flex-direction: column; gap: 6px; }
.shot-list li {
  display: flex; gap: 8px; font-size: 11.5px; color: var(--text-2);
  padding: 6px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-soft);
}
.shot-list li b { color: var(--accent-2); font-family: var(--mono); font-size: 10.5px; flex: none; padding-top: 1px; }
.param-row { display: flex; flex-direction: column; gap: 6px; }
.param-row label { font-size: 11px; color: var(--text-3); }
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 3px 9px; border-radius: 20px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
}
.chip:hover { border-color: var(--text-3); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #04211a; font-weight: 600; }
html[data-theme="light"] .chip.is-active { color: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-2); }
.switch {
  width: 34px; height: 19px; border-radius: 20px; background: var(--panel-3);
  border: 1px solid var(--line); position: relative; flex: none; transition: background .18s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--text-3); transition: transform .18s var(--ease), background .18s;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(15px); background: #fff; }

.skill-runbar { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.runbar-idea input {
  width: 100%; height: 34px; padding: 0 10px; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none;
}
.runbar-idea input:focus { border-color: var(--accent); }

/* 对话 */
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.msg-head { font-size: 10.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.msg-bubble {
  padding: 9px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.65;
  background: var(--panel-2); border: 1px solid var(--line-soft); white-space: pre-wrap; word-break: break-word;
}
.msg.me .msg-bubble { background: var(--accent-soft); border-color: transparent; }
.msg.sys .msg-bubble { background: transparent; border-style: dashed; color: var(--text-3); font-size: 11.5px; }
.msg-bubble code {
  font-family: var(--mono); font-size: 11.5px; background: var(--panel-3);
  padding: 1px 5px; border-radius: 4px;
}
.msg-bubble h5 { margin: 8px 0 4px; font-size: 12.5px; color: var(--accent); }
.msg-bubble table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 11.5px; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.msg-bubble th { background: var(--panel-3); color: var(--text-2); font-weight: 600; }
.msg-attach { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg-attach img, .msg-attach video { width: 88px; height: 60px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.chat-quick { display: flex; gap: 5px; padding: 0 12px 6px; overflow-x: auto; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-input {
  display: flex; gap: 7px; align-items: flex-end; padding: 9px 12px 12px;
  border-top: 1px solid var(--line); position: relative;
}
.chat-input textarea {
  flex: 1; min-height: 74px; max-height: 190px; resize: none; outline: none;
  padding: 9px 10px; font-size: 12.5px; line-height: 1.55;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input .icon-btn { width: 38px; height: 38px; flex: none; }
.chat-input .icon-btn.attached { color: var(--accent); background: var(--accent-soft); }

/* 待发送的图片 / 视频附件（对话框输入区上方） */
.chat-files {
  display: flex; gap: 7px; padding: 8px 12px 2px; overflow-x: auto;
  scrollbar-width: thin;
}
.chat-file {
  position: relative; flex: none; width: 74px; height: 74px;
  border-radius: 9px; overflow: hidden; border: 1px solid var(--line);
  background: var(--panel-2);
}
.chat-file img, .chat-file video { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-file .cf-kind {
  position: absolute; left: 4px; bottom: 3px; font-size: 9px; line-height: 13px;
  padding: 0 4px; border-radius: 5px; background: rgba(8,12,18,.72); color: #fff;
  font-style: normal; letter-spacing: .02em;
}
.chat-file .cf-del {
  position: absolute; right: 3px; top: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: rgba(8,12,18,.72); color: #fff;
  display: grid; place-items: center; font-size: 11px; line-height: 1; cursor: pointer;
}
.chat-file .cf-del:hover { background: var(--danger); }
.chat-file .cf-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 4px 2px;
  font-size: 9px; color: #fff; background: linear-gradient(transparent, rgba(8,12,18,.78));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 拖拽进对话框：整个输入区高亮 + 提示条 */
.chat-input.is-drop { outline: 1px dashed var(--accent); outline-offset: -4px; border-radius: var(--radius-sm); }
.chat-drop-hint {
  display: none; position: absolute; inset: 6px 12px;
  align-items: center; justify-content: center; font-size: 12px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--radius-sm); pointer-events: none;
}
.chat-input.is-drop .chat-drop-hint { display: flex; }

/* 运行面板 */
.run-summary { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; border-bottom: 1px solid var(--line); }
.stat { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line-soft); }
.stat b { display: block; font-size: 16px; font-family: var(--mono); }
.stat small { font-size: 10.5px; color: var(--text-3); }
.run-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.run-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 11.5px;
}
.run-item .st { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); margin-top: 5px; flex: none; }
.run-item[data-s="running"] .st { background: var(--accent-2); animation: pulse 1s infinite; }
.run-item[data-s="ready"] .st { background: var(--ok); }
.run-item[data-s="error"] .st { background: var(--danger); }
.run-item .txt { flex: 1; min-width: 0; color: var(--text-2); }
.run-item .txt b { display: block; color: var(--text); font-size: 12px; font-weight: 600; }
.run-item time { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

/* ────────────── 设置抽屉 ────────────── */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(940px, 94vw); z-index: 90;
  background: var(--bg-elev); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column;
  animation: slideIn .26s var(--ease);
}
@keyframes slideIn { from { transform: translateX(26px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head b { font-size: 15px; }
.drawer-head small { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.drawer-head-actions { display: flex; align-items: center; gap: 6px; }
.drawer-body { flex: 1; min-height: 0; display: flex; }
.settings-nav {
  width: 186px; flex: none; padding: 12px 9px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; background: var(--panel-2);
}
.snav {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2); text-align: left;
}
.snav:hover { background: var(--panel-3); color: var(--text); }
.snav.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.snav .ico { width: 15px; height: 15px; }
.snav em { font-style: normal; margin-left: auto; font-size: 10.5px; color: var(--text-3); }
.settings-body { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 22px 40px; }
.settings-body h3 { font-size: 15px; margin-bottom: 4px; }
.settings-body .note {
  font-size: 12px; line-height: 1.7; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--warn, #e8b84a);
  border-radius: var(--radius, 10px); padding: 9px 12px;
}
.settings-body h4 { font-size: 13px; margin: 22px 0 8px; display: flex; align-items: center; gap: 7px; }
.settings-body h4:first-of-type { margin-top: 14px; }
.settings-body h4 .ico { color: var(--accent); }
.settings-body > p.desc { font-size: 12px; color: var(--text-2); line-height: 1.7; max-width: 74ch; }
.hint {
  font-size: 11.5px; color: var(--text-3); background: var(--panel-2);
  border: 1px solid var(--line-soft); border-left: 2px solid var(--accent-2);
  border-radius: 6px; padding: 8px 11px; margin: 10px 0; line-height: 1.65;
}
.hint.warn { border-left-color: var(--warn); }
.hint b { color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.field > label { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.field > label .tag { font-size: 10px; padding: 0 5px; border-radius: 20px; background: var(--panel-3); color: var(--text-3); }
.field input[type="text"], .field input[type="password"], .field input[type="number"], .field select, .field textarea {
  width: 100%; height: 32px; padding: 0 10px; font-size: 12.5px; outline: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans);
}
.field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .row { display: flex; gap: 7px; }
.field .row input { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

.prov-group { margin-bottom: 8px; }
.prov-group > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-2); font-size: 12.5px; font-weight: 600;
}
.prov-group > summary::-webkit-details-marker { display: none; }
.prov-group > summary .ico { color: var(--accent); }
.prov-group > summary em { font-style: normal; margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 400; }
.prov-group[open] > summary { border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 0; }
.prov-list { border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.prov-item { border-bottom: 1px solid var(--line-soft); background: var(--bg-elev); }
.prov-item:last-child { border-bottom: none; }
.prov-head {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; cursor: pointer;
}
.prov-head:hover { background: var(--panel-2); }
.prov-logo {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: var(--panel-3); font-size: 11px; font-weight: 700; font-family: var(--mono); color: var(--text-2);
}
.prov-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.prov-name .env { font-size: 9.5px; padding: 0 5px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.prov-sub { font-size: 10.5px; color: var(--text-3); }
.prov-head .spacer { flex: 1; }
.prov-status { font-size: 10.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.prov-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.prov-status[data-s="on"]::before { background: var(--ok); }
.prov-status[data-s="ok"] { color: var(--ok); }
.prov-status[data-s="ok"]::before { background: var(--ok); }
.prov-status[data-s="bad"] { color: var(--danger); }
.prov-status[data-s="bad"]::before { background: var(--danger); }
.prov-body { padding: 4px 12px 14px; border-top: 1px dashed var(--line-soft); }
.prov-body[hidden] { display: none; }
.switch-mini { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.model-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.model-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; font-family: var(--mono);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); cursor: pointer;
}
.model-tag:hover { border-color: var(--accent); color: var(--accent); }
.model-tag.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.drawer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; border-top: 1px solid var(--line); background: var(--panel-2); font-size: 11.5px; color: var(--text-3);
}
.drawer-foot > div { display: flex; gap: 7px; }

/* ────────────── Toast / Modal ────────────── */
.toast-layer { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-3);
  font-size: 12.5px; max-width: 74vw; animation: toastIn .22s var(--ease);
}
.toast .ico { color: var(--accent); }
.toast[data-kind="error"] .ico { color: var(--danger); }
.toast[data-kind="warn"] .ico { color: var(--warn); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-root:empty { display: none; }
.modal-root { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.modal {
  width: min(680px, 92vw); max-height: 86dvh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 14.5px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.code {
  font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 12px; overflow-x: auto; white-space: pre; line-height: 1.6;
}
.kbd-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kbd-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.kbd-table td:first-child { width: 160px; }
.slove-list { display: flex; flex-direction: column; gap: 9px; }
.slove-item { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.slove-item b { color: var(--text); display: block; }
.slove-item .num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none;
}

/* ────────────── 响应式 ────────────── */
@media (max-width: 1180px) { :root { --dock-w: 316px; } }
@media (max-width: 1024px) {
  .brand-text small, .btn span, .rail-btn span { display: none; }
  .rail { --rail-w: 48px; width: 48px; }
  .rail-btn { width: 38px; }
  .dock { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); box-shadow: var(--shadow-3); }
  .app:not(.dock-open) .dock { display: none; }
  .settings-nav { width: 150px; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .skill-grid { grid-template-columns: 1fr; }
  .drawer-body { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══════════════ 账号体系：登录浮层 / 用户芯片 / 管理面板 ══════════════ */
#authOverlay {
  position: fixed; inset: 0; z-index: 900; display: none;
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
}
#authOverlay.is-open { display: flex; }
.auth-card {
  width: 340px; padding: 26px 26px 20px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 12px;
}
.auth-logo { font-size: 20px; color: var(--accent); letter-spacing: 2px; }
.auth-card h2 { margin: 0; font-size: 16px; }
.auth-tabs { display: flex; gap: 6px; }
.auth-tab {
  flex: 1; padding: 7px 0; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer;
}
.auth-tab.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label { font-size: 11px; color: var(--text-3); }
.auth-field input {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-err { display: none; font-size: 11.5px; color: var(--danger, #ef6b6b); }
.auth-foot { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.auth-foot span { font-size: 10.5px; color: var(--text-3); }
body.auth-locked .viewport, body.auth-locked .agent-dock { filter: blur(3px) saturate(.9); pointer-events: none; }

.user-chip .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
}
.user-chip .uname { font-size: 12px; }
.user-chip.is-on .avatar { background: var(--accent); color: var(--bg); }

.acct-pop { position: fixed; z-index: 950; width: 250px; display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.acct-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 4px; }
.acct-head b { font-size: 13px; }
.acct-head small { font-size: 10.5px; color: var(--text-3); }
.acct-head small b { color: var(--accent); }
.tag-admin {
  font-style: normal; font-size: 9.5px; padding: 1px 6px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); vertical-align: 1px;
}
.tag-banned {
  font-style: normal; font-size: 9.5px; padding: 1px 6px; border-radius: 20px;
  background: color-mix(in srgb, var(--danger, #ef6b6b) 18%, transparent); color: var(--danger, #ef6b6b);
}
.acct-pop .ci.danger { color: var(--danger, #ef6b6b); }
.acct-pop .ci.danger .txts b { color: var(--danger, #ef6b6b); }

/* ══════════════ 多画布（项目）切换器 ══════════════ */
.proj-btn .pill { margin-left: 2px; }
.proj-btn .caret {
  font-style: normal; font-size: 9px; color: var(--text-3); margin-left: 1px;
  transition: transform .2s; line-height: 1;
}
.proj-btn:hover .caret, .proj-btn.is-open .caret { color: var(--accent); }
.proj-btn.is-open .caret { transform: rotate(180deg); }
.proj-btn.is-open { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.proj-pop { width: 268px; max-height: 60vh; overflow: auto; }
.proj-pop .ci {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; text-align: left;
}
.proj-pop .ci:hover { background: var(--panel-2); }
.proj-pop .ci.is-on { background: var(--accent-soft, rgba(52, 211, 166, .12)); }
.proj-pop .ci.is-on b { color: var(--accent); }
.proj-pop .txts { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.proj-pop .txts b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-pop .txts small { font-size: 10.5px; color: var(--text-3); }
.proj-pop .cur-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.proj-pop .proj-del {
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  padding: 3px 7px; border-radius: 7px; font-size: 11.5px; line-height: 1; flex: none;
}
.proj-pop .proj-del:hover { color: var(--danger, #ef6b6b); background: color-mix(in srgb, var(--danger, #ef6b6b) 14%, transparent); }
.proj-pop .proj-new { color: var(--accent); border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 9px 9px; }
.proj-pop .proj-new b { color: var(--accent); }

/* ── 设置 · 作品审核 ── */
.mod-list { display: flex; flex-direction: column; gap: 8px; }
.mod-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.mod-item.is-hidden { opacity: .62; }
.mod-item.is-hidden .mod-info b { text-decoration: line-through; color: var(--text-3); }
.mod-thumb { width: 56px; height: 42px; border-radius: 7px; overflow: hidden; flex: none; background: var(--panel-2); display: grid; place-items: center; }
.mod-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mod-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mod-info b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.mod-info small { font-size: 10.5px; color: var(--text-3); }
.mod-state { font-style: normal; font-size: 10px; padding: 2px 8px; border-radius: 20px; flex: none; }
.mod-state[data-s="on"] { background: var(--accent-soft, rgba(52, 211, 166, .14)); color: var(--accent); }
.mod-state[data-s="off"] { background: rgba(239, 107, 107, .14); color: var(--danger, #ef6b6b); }
.mod-item .spacer { flex: 1; }

.auth-admin-modal { width: 560px; max-height: 78vh; overflow: auto; }
.admin-body { padding: 4px 18px 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th {
  text-align: left; font-size: 10.5px; color: var(--text-3); font-weight: 600;
  padding: 8px 8px; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft, rgba(128,128,128,.12)); }
.admin-table td.num { font-weight: 700; color: var(--accent); }
.grant-box { display: inline-flex; gap: 5px; margin-right: 6px; align-items: center; }
.grant-box input { width: 70px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 12px; }
.admin-note { font-size: 10.5px; color: var(--text-3); margin: 12px 2px 0; }
.btn.danger-ghost { color: var(--danger, #ef6b6b); border-color: color-mix(in srgb, var(--danger, #ef6b6b) 45%, transparent); }

/* ══════════════ 右下角小地图 ══════════════ */
.minimap {
  position: absolute; right: 14px; bottom: 16px;
  width: 208px; height: 134px; z-index: 26;
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-2); overflow: hidden;
  cursor: crosshair; user-select: none; touch-action: none;
}
.minimap canvas { display: block; width: 100%; height: 100%; }

/* ══════════════ 首页（轮播 · 最近项目 · 作品展示） ══════════════ */
body.at-home .app { display: none; }
.home { display: none; height: calc(100dvh - var(--topbar-h)); }
body.at-home .home { display: flex; }
.home-side {
  width: 196px; flex: none; display: flex; flex-direction: column;
  background: var(--bg-elev); border-right: 1px solid var(--line); padding: 14px 10px;
}
.home-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
.home-brand .ico { width: 22px; height: 22px; color: var(--accent); }
.home-nav { display: flex; flex-direction: column; gap: 3px; }
.hn-btn {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer; text-align: left;
}
.hn-btn .ico { width: 16px; height: 16px; flex: none; }
.hn-btn:hover { background: var(--panel-2); color: var(--text); }
.hn-btn.is-on { background: var(--accent-soft, rgba(52, 211, 166, .13)); color: var(--accent); font-weight: 600; }
.home-side-foot { margin-top: auto; font-size: 10.5px; color: var(--text-3); padding: 8px; }
/* 侧栏收起 / 展开：默认收起，点汉堡展开 */
.side-toggle {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  margin: 0 0 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); cursor: pointer; flex: none;
}
.side-toggle:hover { background: var(--panel-2); color: var(--text); }
.side-toggle .ico { width: 17px; height: 17px; }
.home-side.is-collapsed { width: 58px; padding: 14px 8px; }
.home-side.is-collapsed .home-brand span,
.home-side.is-collapsed .hn-btn span,
.home-side.is-collapsed .home-side-foot { display: none; }
.home-side.is-collapsed .side-toggle { margin: 0 auto 12px; }
.home-side.is-collapsed .home-brand { justify-content: center; padding: 0 0 14px; }
.home-side.is-collapsed .hn-btn { justify-content: center; padding: 9px 0; }

.home-main { flex: 1; overflow: auto; padding: 18px 26px 30px; scroll-behavior: smooth; }

/* ── 区块通用 ── */
.home-section { margin: 18px 0 6px; }
.hs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hs-head b { font-size: 15px; }

/* ── 最近项目 ── */
.hs-projects { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.proj-card { width: 148px; flex: none; cursor: pointer; border-radius: 12px; transition: transform .2s; }
.proj-card:hover { transform: translateY(-3px); }
.pc-cover { position: relative; height: 96px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-ghost { font-size: 12px; color: var(--text-3); letter-spacing: .2em; }
.proj-card.new .pc-cover { border-style: dashed; border-width: 1.5px; background: var(--panel); flex-direction: column; display: flex; align-items: center; justify-content: center; gap: 3px; }
.proj-card.new .plus { font-size: 22px; color: var(--accent); line-height: 1; }
.proj-card.new small { font-size: 11px; color: var(--text-3); }
.pc-cur { position: absolute; top: 6px; left: 6px; font-style: normal; font-size: 9.5px; padding: 1px 7px; border-radius: 20px; background: var(--accent); color: #04211a; font-weight: 700; }
/* 悬停卡片出现的删除按钮（右上角） */
.pc-del {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; font-size: 11px; line-height: 1;
  color: #fff; background: rgba(10, 12, 16, .58); border: 1px solid rgba(255, 255, 255, .28);
  backdrop-filter: blur(4px); cursor: pointer;
  opacity: 0; transform: scale(.85); transition: opacity .18s, transform .18s, background .18s, border-color .18s;
}
.proj-card:hover .pc-del { opacity: 1; transform: scale(1); }
.proj-card .pc-del:hover, .proj-card .pc-del:focus-visible { background: var(--danger, #ef6b6b); border-color: transparent; }
.pc-meta { padding: 7px 3px 0; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pc-meta b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta small { font-size: 10.5px; color: var(--text-3); }

/* ── 创作输入条 ── */

/* ── 作品展示 ── */
.works-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 6px 0 10px; flex-wrap: wrap; }
.works-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.works-tabs button { border: 0; background: transparent; color: var(--text-2); font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.works-tabs button:hover { color: var(--text); }
.works-tabs button.is-on { color: var(--accent); font-weight: 700; background: var(--accent-soft, rgba(52, 211, 166, .12)); }
.works-search { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); color: var(--text-3); }
.works-search input { border: 0; background: transparent; color: var(--text); outline: none; font-size: 12px; width: 130px; }
.works-search .ico { width: 14px; height: 14px; }
.works-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.works-chips button { border: 1px solid var(--line); background: var(--panel); color: var(--text-2); font-size: 11.5px; padding: 4px 13px; border-radius: 18px; cursor: pointer; }
.works-chips button:hover { border-color: var(--accent); color: var(--accent); }
.works-chips button.is-on { background: var(--accent); border-color: var(--accent); color: #04211a; font-weight: 700; }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.work-card { cursor: pointer; border-radius: 12px; transition: transform .2s; }
.work-card:hover { transform: translateY(-3px); }
/* 发布作品可点开大图 */
.work-card.is-pub .wc-cover { cursor: zoom-in; }
.wc-cover { position: relative; aspect-ratio: 16 / 9.6; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; }
.wc-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .55)); }
.wc-title { position: relative; z-index: 2; color: #fff; font-size: 16px; font-weight: 800; text-align: center; padding: 0 10px; text-shadow: 0 2px 10px rgba(0, 0, 0, .55); letter-spacing: .02em; }
.wc-mark { position: absolute; top: 8px; left: 10px; z-index: 2; font-style: normal; font-size: 10px; color: rgba(255, 255, 255, .85); border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px; padding: 1px 7px; }
/* 发布视频封面加载失败（发布地址被回收）时的占位 */
.wc-cover video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.wc-dead {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 0 10px;
  font-style: normal; font-size: 11px; color: var(--text-3); text-align: center;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 8px, transparent 8px 16px);
}
.lightbox .lb-hint { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); font-size: 12px; color: #fca5a5; }

/* ── 首页轮播（后台「轮播管理」条目：照片 / 视频） ── */
.home-carousel { position: relative; margin: 4px 0 10px; height: clamp(240px, 36vw, 400px); }
.hc-stage { position: absolute; inset: 0; overflow: visible; }
.hc-slide {
  position: absolute; left: 50%; top: 0; height: 100%;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; will-change: transform, opacity;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .18);
}
.hc-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.hc-txt {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 3px; padding: 40px 18px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62));
}
.hc-txt b { color: #fff; font-size: 16px; text-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.hc-txt span { color: rgba(255, 255, 255, .82); font-size: 12px; }
.hc-tag { position: absolute; top: 10px; left: 12px; font-style: normal; font-size: 10px; color: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; padding: 1px 8px; background: rgba(0, 0, 0, .28); }
.hc-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text); font-size: 20px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; opacity: .8; transition: opacity .18s, background .18s;
}
.hc-arrow:hover { opacity: 1; background: var(--panel-2); }
.hc-prev { left: 8px; }
.hc-next { right: 8px; }
.hc-dots { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); display: flex; gap: 7px; z-index: 20; }
.hc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); opacity: .4; cursor: pointer; transition: all .2s; }
.hc-dots i.is-on { background: var(--accent); opacity: 1; width: 18px; border-radius: 4px; }
.wc-play { position: absolute; right: 10px; bottom: 8px; z-index: 2; font-size: 11px; color: #fff; opacity: 0; transition: opacity .2s; }
.work-card:hover .wc-play { opacity: 1; }
.wc-meta { padding: 7px 3px 0; display: flex; flex-direction: column; gap: 1px; }
.wc-meta b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-meta small { font-size: 10.5px; color: var(--text-3); }
.works-empty { grid-column: 1 / -1; text-align: center; color: var(--text-3); padding: 40px 0; font-size: 12.5px; }
.home-foot { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); }

/* ══════════════ 作品发布 ══════════════ */
.wc-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.btn.is-published { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); cursor: default; }

/* ══════════════════ 本机文件夹资产存储（local://） ══════════════════ */
/* 节点媒体上的「本机资产还没读回来」提示 */
.ls-tip {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  padding: 6px 9px; border-radius: 8px; font-size: 11px; line-height: 1.4;
  background: rgba(8,12,18,.82); color: #fff; border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(3px);
}
.ls-tip button {
  flex: none; padding: 2px 9px; font-size: 10.5px; cursor: pointer;
  border-radius: 7px; color: #06231b; background: var(--accent); border: 0; font-weight: 650;
}
.ls-tip button:hover { filter: brightness(1.08); }

/* 顶栏「资产存哪里」徽章 */
#storageChip.is-local { color: var(--accent); }
#storageChip.need-auth { color: var(--warn); }
#storageChip.need-auth::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn); margin-left: 3px; display: inline-block;
}

/* 新建项目 / 存储设置弹窗 */
.np-modal { width: min(560px, 92vw); }
.np-modal .modal-body { padding: 16px 18px; }
.np-label { display: block; font-size: 12px; color: var(--text-2); margin: 16px 0 7px; font-weight: 650; }
.np-label:first-child { margin-top: 0; }
.np-name {
  width: 100%; padding: 9px 11px; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px; outline: none;
  font-family: inherit;
}
.np-name:focus { border-color: var(--accent); }
.np-opts { display: flex; flex-direction: column; gap: 9px; }
.np-opt {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; cursor: pointer; background: var(--panel-2);
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.np-opt b { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.np-opt b i {
  font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .02em;
  padding: 1px 6px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
}
.np-opt small { display: block; margin-top: 5px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); }
.np-opt.is-on { border-color: var(--accent); background: var(--accent-soft); }
.np-opt.is-off { opacity: .5; cursor: not-allowed; }
.np-dir {
  display: block; margin: 9px 0; font-size: 11.5px; color: var(--text-3);
  padding: 6px 9px; border-radius: 6px; background: rgba(0,0,0,.18); word-break: break-all;
}
.np-dir.is-set { color: var(--accent); }
html[data-theme="light"] .np-dir { background: rgba(0,0,0,.045); }
.np-warn { margin: 12px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--warn); }
.np-line { margin: 0; font-size: 12.5px; color: var(--text-2); }
.np-dirname {
  margin: 9px 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 13px; color: var(--accent); word-break: break-all;
}
.np-note { margin: 0; font-size: 11.5px; line-height: 1.7; color: var(--text-3); }
