:root {
  --primary: #5e6ad2;
  --primary-hover: #828fff;
  --primary-soft: rgba(94, 106, 210, .16);
  --primary-line: rgba(130, 143, 255, .38);
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #9aa0aa;
  --ink-tertiary: #62666d;
  --canvas: #010102;
  --surface-0: #08090a;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --surface-4: #202226;
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --success: #27a644;
  --warning: #d9a13b;
  --danger: #e5484d;
  --info: #4aa8ff;
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-pop: 0 24px 80px rgba(0, 0, 0, .52);
  --shadow-node: 0 18px 50px rgba(0, 0, 0, .38);
  --font: "Inter", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Microsoft YaHei UI", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select { outline: none; }
a { color: var(--primary-hover); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2d34; border: 2px solid transparent; background-clip: padding-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #3a3e48; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

/* ========== 通用控件 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-strong); background: var(--surface-2); color: var(--ink);
  font-weight: 550; white-space: nowrap; transition: .16s ease;
}
.btn:hover { background: var(--surface-4); border-color: #454a55; transform: translateY(-.5px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.28); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--hairline); color: var(--ink); }
.btn-danger { color: #ffd7d9; background: rgba(229,72,77,.12); border-color: rgba(229,72,77,.32); }
.btn-danger:hover { background: rgba(229,72,77,.22); border-color: var(--danger); }
.btn-sm { min-height: 28px; padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-icon {
  width: 30px; height: 30px; padding: 0; border-radius: 8px; display: inline-grid; place-items: center;
  color: var(--ink-subtle); border: 1px solid transparent; background: transparent;
}
.btn-icon:hover { color: var(--ink); background: var(--surface-3); border-color: var(--hairline); }
.btn-icon.active { color: #fff; background: var(--primary-soft); border-color: var(--primary-line); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > label { color: var(--ink-subtle); font-size: 12px; font-weight: 600; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--hairline-strong); background: var(--surface-1); color: var(--ink);
  border-radius: var(--radius-sm); padding: 9px 11px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary-line); box-shadow: 0 0 0 3px rgba(94,106,210,.14); }
.input::placeholder, .textarea::placeholder { color: #666c76; }
.select option { background: var(--surface-2); color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 128px; gap: 10px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--ink-muted); font-size: 13px; user-select: none; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.help-text { color: var(--ink-tertiary); font-size: 12px; line-height: 1.55; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--hairline); color: var(--ink-subtle); font-size: 11px; font-weight: 600; }
.badge-primary { color: #cfd4ff; background: var(--primary-soft); border-color: var(--primary-line); }
.badge-success { color: #baf0c6; background: rgba(39,166,68,.13); border-color: rgba(39,166,68,.3); }
.badge-warning { color: #ffe1a3; background: rgba(217,161,59,.13); border-color: rgba(217,161,59,.3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 420px; padding: 11px 14px; border-radius: 11px; color: var(--ink);
  background: rgba(20,21,22,.96); border: 1px solid var(--hairline-strong); box-shadow: var(--shadow-pop);
  animation: toast-in .2s ease; pointer-events: auto;
}
.toast.success { border-color: rgba(39,166,68,.42); }
.toast.error { border-color: rgba(229,72,77,.48); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.modal-overlay {
  position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.66); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 28px; animation: fade-in .16s ease;
}
.modal {
  width: min(980px, 96vw); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #121315, #0d0e10); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
}
.modal-header { height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--hairline); }
.modal-title { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: 10px; background: rgba(255,255,255,.015); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ========== 首页 ========== */
.home-page { height: 100vh; overflow: auto; background:
  radial-gradient(900px 420px at 72% -120px, rgba(94,106,210,.22), transparent 62%),
  radial-gradient(700px 360px at 8% -80px, rgba(74,168,255,.10), transparent 60%),
  var(--canvas);
}
.home-nav { height: 64px; max-width: 1240px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 720; letter-spacing: -.3px; font-size: 16px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #7480ff, #3f48b8); display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.32); font-size: 16px; }
.home-nav-actions { display: flex; gap: 10px; align-items: center; }
.home-container { max-width: 1240px; margin: 0 auto; padding: 46px 28px 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 42px; align-items: center; margin-bottom: 46px; }
.eyebrow { color: #b8beff; font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.06; letter-spacing: -2.4px; margin: 0 0 18px; font-weight: 720; }
.hero p { color: var(--ink-subtle); font-size: 17px; line-height: 1.75; max-width: 680px; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-panel {
  border: 1px solid var(--hairline-strong); border-radius: 22px; background: linear-gradient(180deg, rgba(20,21,22,.92), rgba(10,11,12,.92));
  box-shadow: var(--shadow-pop); padding: 18px; position: relative; overflow: hidden; min-height: 330px;
}
.hero-panel:before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 220px at 70% 0, rgba(94,106,210,.22), transparent 65%); pointer-events: none; }
.mini-canvas { position: relative; height: 292px; border-radius: 15px; border: 1px solid var(--hairline); background-color: #070809; background-image: radial-gradient(circle, #242832 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; }
.mini-node { position: absolute; border: 1px solid #30343e; background: linear-gradient(180deg,#17191d,#101216); border-radius: 11px; padding: 10px 12px; box-shadow: var(--shadow-node); font-size: 12px; color: var(--ink-muted); }
.mini-node strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 13px; }
.mini-node.n1 { left: 28px; top: 34px; width: 142px; }
.mini-node.n2 { right: 24px; top: 72px; width: 132px; border-color: var(--primary-line); }
.mini-node.n3 { left: 92px; bottom: 28px; width: 150px; }
.mini-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-panel-caption { position: relative; display: flex; justify-content: space-between; margin-top: 13px; color: var(--ink-tertiary); font-size: 12px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 18px; }
.section-head h2 { font-size: 23px; letter-spacing: -.5px; margin: 0; }
.section-head p { color: var(--ink-subtle); margin: 5px 0 0; }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.work-card {
  text-align: left; padding: 17px; border-radius: var(--radius-lg); border: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--surface-1), #0c0d0e); min-height: 178px; display: flex; flex-direction: column; gap: 13px;
  transition: .18s ease; position: relative; overflow: hidden;
}
.work-card:hover { border-color: var(--primary-line); transform: translateY(-3px); box-shadow: var(--shadow-node); }
.work-preview { height: 86px; border-radius: 11px; border: 1px solid var(--hairline); background-color: #08090a; background-image: radial-gradient(circle, #242832 1px, transparent 1px); background-size: 16px 16px; position: relative; overflow: hidden; }
.work-preview span { position: absolute; width: 54px; height: 34px; border-radius: 8px; border: 1px solid #343844; background: #15171b; }
.work-preview span:nth-child(1){left:18%;top:24px}.work-preview span:nth-child(2){right:16%;top:14px;border-color:var(--primary-line)}.work-preview span:nth-child(3){left:38%;bottom:8px}
.work-card-title { font-size: 16px; font-weight: 680; letter-spacing: -.2px; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 3px 5px; margin: -3px -5px; color: var(--ink); }
.work-card-title:focus { border-color: var(--primary-line); background: var(--surface-1); }
.work-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink-tertiary); font-size: 12px; margin-top: auto; }
.work-actions { display: flex; gap: 7px; }
.work-actions .btn { flex: 1; }
.empty-works { border: 1px dashed var(--hairline-strong); border-radius: var(--radius-lg); padding: 44px; text-align: center; color: var(--ink-subtle); background: rgba(255,255,255,.012); }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 44px; }
.feature-card { border: 1px solid var(--hairline); background: rgba(15,16,17,.72); border-radius: var(--radius-lg); padding: 18px; }
.feature-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: #c8cdff; margin-bottom: 13px; }
.feature-card h3 { margin: 0 0 7px; font-size: 15px; }
.feature-card p { margin: 0; color: var(--ink-subtle); font-size: 13px; line-height: 1.65; }

/* ========== 画布工作区 ========== */
.canvas-shell { height: 100vh; display: grid; grid-template-rows: 52px minmax(0,1fr); background: var(--canvas); }
.canvas-topbar { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--hairline); background: rgba(10,11,12,.96); z-index: 100; }
.topbar-title { min-width: 160px; max-width: 300px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; color: var(--ink); font-weight: 650; font-size: 14px; }
.topbar-title:hover, .topbar-title:focus { border-color: var(--hairline-strong); background: var(--surface-1); }
.topbar-group { display: flex; align-items: center; gap: 5px; }
.topbar-sep { width: 1px; height: 22px; background: var(--hairline); margin: 0 4px; }
.save-state { color: var(--ink-tertiary); font-size: 12px; min-width: 64px; }
.save-state.saving { color: var(--warning); }
.save-state.saved { color: #8bdba0; }
.zoom-label { min-width: 48px; text-align: center; color: var(--ink-subtle); font-size: 12px; font-family: var(--mono); }
.topbar-spacer { flex: 1; }

.canvas-body { min-height: 0; display: grid; grid-template-columns: clamp(230px,20vw,320px) minmax(0,1fr) clamp(330px,25vw,450px); }
.left-panel, .right-panel { min-width: 0; min-height: 0; overflow: hidden; background: var(--surface-1); transition: width .22s ease; }
.left-panel { border-right: 1px solid var(--hairline); }
.right-panel { border-left: 1px solid var(--hairline); }
.panel-inner { height: 100%; display: flex; flex-direction: column; }
.left-panel .panel-inner { width: clamp(230px,20vw,320px); }
.right-panel .panel-inner { width: clamp(330px,25vw,450px); }
.canvas-shell.left-collapsed .canvas-body { grid-template-columns: 0 minmax(0,1fr) clamp(330px,25vw,450px); }
.canvas-shell.right-collapsed .canvas-body { grid-template-columns: clamp(230px,20vw,320px) minmax(0,1fr) 0; }
.canvas-shell.left-collapsed.right-collapsed .canvas-body { grid-template-columns: 0 minmax(0,1fr) 0; }
.canvas-shell.left-collapsed .left-panel, .canvas-shell.right-collapsed .right-panel { border-color: transparent; }

.panel-header { height: 52px; flex: 0 0 52px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--hairline); }
.panel-title { font-weight: 680; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.panel-header-actions { display: flex; align-items: center; gap: 5px; }
.panel-search { padding: 10px 12px 8px; border-bottom: 1px solid rgba(35,37,42,.7); }
.panel-search .input { padding: 8px 10px; font-size: 13px; }
.directory-list { flex: 1; overflow: auto; padding: 9px; display: flex; flex-direction: column; gap: 5px; }
.directory-item { width: 100%; display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; border: 1px solid transparent; color: var(--ink-muted); text-align: left; }
.directory-item:hover { background: var(--surface-2); border-color: var(--hairline); }
.directory-item.selected { background: var(--primary-soft); border-color: var(--primary-line); color: var(--ink); }
.type-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-tertiary); }
.type-dot.text { background: #8b91a1; }.type-dot.character { background: #828fff; }.type-dot.event { background: #e0a84b; }.type-dot.branch { background: #4fc38a; }.type-dot.note { background: #55c7d8; }
.directory-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.directory-type { color: var(--ink-tertiary); font-size: 11px; margin-left: 6px; }
.directory-delete { opacity: 0; color: var(--ink-tertiary); width: 24px; height: 24px; border-radius: 6px; }
.directory-item:hover .directory-delete { opacity: 1; }
.directory-delete:hover { color: #ffb4b7; background: rgba(229,72,77,.14); }
.directory-empty { padding: 30px 16px; text-align: center; color: var(--ink-tertiary); font-size: 13px; }
.add-menu-wrap { position: relative; }
.add-menu { position: absolute; right: 0; top: 36px; width: 178px; z-index: 300; padding: 6px; border: 1px solid var(--hairline-strong); background: rgba(18,19,21,.98); border-radius: 12px; box-shadow: var(--shadow-pop); }
.add-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; color: var(--ink-muted); text-align: left; font-size: 13px; }
.add-menu button:hover { background: var(--surface-3); color: var(--ink); }
.add-menu .menu-icon { width: 22px; text-align: center; }

.canvas-viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; background-color: #050607; background-image: radial-gradient(circle, #242833 1px, transparent 1px); background-size: 24px 24px; cursor: grab; }
.canvas-viewport.panning { cursor: grabbing; }
.canvas-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
#edge-layer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edge-path { fill: none; stroke: #596071; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: pointer; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: pointer; }
.edge-group.selected .edge-path { stroke: var(--primary-hover); stroke-width: 3; }
.edge-draft { fill: none; stroke: var(--primary-hover); stroke-width: 2; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; pointer-events: none; }
.edge-delete-circle { cursor: pointer; pointer-events: all; }
.edge-editor { position: absolute; z-index: 250; display: flex; gap: 7px; align-items: center; padding: 8px; border: 1px solid var(--hairline-strong); border-radius: 11px; background: rgba(18,19,21,.97); box-shadow: var(--shadow-pop); }
.edge-editor .input { width: 180px; padding: 6px 9px; font-size: 12px; }
.canvas-hint { position: absolute; left: 16px; bottom: 14px; z-index: 80; display: flex; gap: 8px; align-items: center; color: var(--ink-tertiary); font-size: 12px; pointer-events: none; }
.canvas-hint .badge { background: rgba(15,16,17,.82); backdrop-filter: blur(8px); }
.canvas-zoom-bar { position: absolute; right: 16px; bottom: 14px; z-index: 90; display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--hairline); border-radius: 11px; background: rgba(15,16,17,.88); backdrop-filter: blur(10px); }
.canvas-minimap { position: absolute; left: 16px; top: 14px; z-index: 80; padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 10px; background: rgba(15,16,17,.76); color: var(--ink-tertiary); font-size: 11px; backdrop-filter: blur(8px); pointer-events: none; }

/* 节点 */
.node { position: absolute; min-width: 260px; min-height: 170px; display: flex; flex-direction: column; border: 1px solid #2b2f39; border-radius: 14px; background: linear-gradient(180deg, rgba(23,25,29,.98), rgba(14,16,19,.98)); box-shadow: var(--shadow-node); z-index: 10; overflow: visible; }
.node.selected { border-color: var(--primary-line); box-shadow: var(--shadow-node); z-index: 40; }
.node.focused { z-index: 60; box-shadow: 0 34px 110px rgba(0,0,0,.66), 0 0 0 2px rgba(130,143,255,.24); }
.node.type-character { border-top: 2px solid #828fff; }
.node.type-event { border-top: 2px solid #e0a84b; }
.node.type-branch { border-top: 2px solid #4fc38a; }
.node.type-note { border-top: 2px solid #55c7d8; }
.node-toolbar {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 80;
  min-height: 36px; display: flex; align-items: center; gap: 7px; padding: 5px 7px 5px 9px;
  border: 1px solid var(--hairline-strong); border-radius: 12px; background: rgba(17,18,20,.98);
  box-shadow: var(--shadow-node); cursor: grab; user-select: none;
  opacity: 0; transform: translateY(5px); pointer-events: none; transition: opacity .14s ease, transform .14s ease;
}
.node-toolbar:active { cursor: grabbing; }
.node:hover .node-toolbar, .node.selected .node-toolbar, .node.focused .node-toolbar { opacity: 1; transform: translateY(0); pointer-events: auto; }
.node-type-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); font-size: 12px; flex: 0 0 auto; }
.node-title { min-width: 0; width: 120px; flex: 1; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 4px 6px; color: var(--ink); font-weight: 650; font-size: 13px; cursor: text; }
.node-title:focus { border-color: var(--primary-line); background: var(--surface-1); }
.node-toolbar-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.node-toolbar .btn-icon { width: 27px; height: 27px; border-radius: 7px; }
.node-delete-btn:hover { color: #ffd7d9; background: rgba(229,72,77,.18); border-color: rgba(229,72,77,.35); }
.node-body { flex: 1; min-height: 0; padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; border-radius: 14px; overflow: hidden; }
.node-body textarea { width: 100%; flex: 1; min-height: 70px; resize: none; border: 0; background: transparent; color: var(--ink-muted); line-height: 1.68; padding: 2px 2px; overflow: auto; }
.node-body textarea:focus { color: var(--ink); }
.node-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; flex: 0 0 auto; }
.node-meta-grid .input, .node-body .select { padding: 7px 9px; font-size: 12px; background: rgba(0,0,0,.16); }
.node-collapsed-bar { display: none; width: 100%; height: 100%; align-items: center; gap: 9px; padding: 0 13px; color: var(--ink); text-align: left; border-radius: 14px; cursor: pointer; background: transparent; }
.node-collapsed-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: 13px; }
.node-collapsed-hint { color: var(--ink-tertiary); font-size: 11px; flex: 0 0 auto; }
.port {
  position: absolute; top: 50%;
  width: calc(20px / var(--canvas-scale, 1));
  height: calc(20px / var(--canvas-scale, 1));
  margin-top: calc(-10px / var(--canvas-scale, 1));
  display: grid; place-items: center;
  border-radius: 50%; color: #fff; cursor: crosshair; z-index: 8;
  background: linear-gradient(180deg, #8f85ff 0%, #6b5cec 100%);
  border: calc(1.2px / var(--canvas-scale, 1)) solid rgba(235,237,255,.9);
  box-shadow: 0 4px 12px rgba(89,76,239,.34), 0 0 0 calc(2px / var(--canvas-scale, 1)) rgba(10,11,16,.72);
  opacity: 0; pointer-events: none; transform: scale(.82); transform-origin: center;
  touch-action: none;
  transition: opacity .14s ease, transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.port svg { display: block; width: calc(11px / var(--canvas-scale, 1)); height: calc(11px / var(--canvas-scale, 1)); filter: drop-shadow(0 1px 1px rgba(0,0,0,.38)); position: relative; z-index: 1; }
.port::before {
  content: ""; position: absolute; z-index: 0; border-radius: 999px;
  inset: calc(-6px / var(--canvas-scale, 1)) calc(-7px / var(--canvas-scale, 1));
}
.port-left { left: calc(-21px / var(--canvas-scale, 1)); }
.port-right { right: calc(-21px / var(--canvas-scale, 1)); }
.node:hover > .port,
.node.port-hover > .port,
.node:focus-within > .port,
.node.selected > .port,
.node.drop-target > .port,
.port:hover { opacity: 1; pointer-events: auto; transform: scale(1); }
.port:hover { transform: scale(1.08); box-shadow: 0 6px 16px rgba(105,92,246,.48), 0 0 0 calc(3px / var(--canvas-scale, 1)) rgba(139,124,255,.16); }
.port.is-hover-follow {
  z-index: 12;
  will-change: transform;
  transition: opacity .12s ease, transform 90ms cubic-bezier(.22,1,.36,1), box-shadow .12s ease, background .12s ease;
}
.node.drop-target { border-color: rgba(79,195,138,.78) !important; box-shadow: 0 0 0 2px rgba(79,195,138,.20), var(--shadow-node) !important; }
.port.drop-active {
  opacity: 1; pointer-events: auto;
  background: linear-gradient(180deg, #67e2a8 0%, #2fae72 100%);
  border-color: #ddfff0; transform: scale(1.14);
  box-shadow: 0 0 0 calc(5px / var(--canvas-scale, 1)) rgba(79,195,138,.20), 0 8px 22px rgba(47,174,114,.42);
}
body.is-connecting-edge { cursor: crosshair; }
body.is-connecting-edge .canvas-world { user-select: none; -webkit-user-select: none; }
body.is-connecting-edge .node.connect-source > .port,
body.is-connecting-edge .port.connecting {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(.72) !important;
  box-shadow: none !important;
  transition: none !important;
}
body.is-connecting-edge .node:not(.connect-source):not(.drop-target) { opacity: .88; }
.resize-handle { position: absolute; right: -3px; bottom: -3px; width: 28px; height: 28px; cursor: nwse-resize; z-index: 6; background: transparent; }
.resize-handle:before { display: none; }
.node.collapsed { min-height: 42px; height: 42px !important; }
.node.collapsed .node-body, .node.collapsed .resize-handle { display: none; }
.node.collapsed .node-collapsed-bar { display: flex; }

/* Agent 面板 */
.chat-panel { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--surface-1); }
.chat-header { padding: 12px 13px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 9px; }
.chat-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.agent-avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg,#7480ff,#3f48b8); color: white; font-size: 14px; }
.chat-model-row { display: grid; grid-template-columns: minmax(0,1fr) 32px; gap: 7px; }
.chat-model-row .select { padding: 7px 9px; font-size: 12px; }
.chat-messages { flex: 1; min-height: 0; overflow: auto; padding: 15px 13px; display: flex; flex-direction: column; gap: 13px; background: linear-gradient(180deg, rgba(255,255,255,.012), transparent 220px); }
.message { display: flex; gap: 9px; max-width: 100%; }
.message.user { justify-content: flex-end; }
.message-bubble { max-width: 92%; padding: 10px 12px; border-radius: 13px; border: 1px solid var(--hairline); background: var(--surface-2); color: var(--ink-muted); white-space: normal; overflow-wrap: anywhere; }
.message.user .message-bubble { background: var(--primary); border-color: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.message.assistant .message-bubble { border-bottom-left-radius: 5px; }
.message-bubble p { margin: 0 0 8px; }.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble pre { background: #08090b; border: 1px solid var(--hairline); border-radius: 9px; padding: 10px; overflow: auto; font-family: var(--mono); font-size: 12px; }
.message-bubble code { font-family: var(--mono); font-size: .92em; background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 5px; }
.message-bubble pre code { background: none; padding: 0; }
.message-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.action-chip { font-size: 11px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--primary-line); color: #d5d9ff; background: var(--primary-soft); }
.typing { display: inline-flex; gap: 4px; padding: 3px 0; }.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-subtle); }.typing i:nth-child(2){opacity:.72}.typing i:nth-child(3){opacity:.48}
@keyframes blink { 0%,80%,100%{opacity:.25;transform:translateY(0)} 40%{opacity:1;transform:translateY(-2px)} }
.chat-quick { padding: 8px 12px 0; display: flex; gap: 7px; flex-wrap: wrap; }
.quick-chip { padding: 5px 9px; border-radius: 999px; border: 1px solid var(--hairline-strong); background: var(--surface-2); color: var(--ink-subtle); font-size: 11px; }
.quick-chip:hover { color: var(--ink); border-color: var(--primary-line); background: var(--primary-soft); }
.chat-input-area { padding: 11px 12px 13px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.chat-input-wrap { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 8px; align-items: end; }
.chat-input { min-height: 46px; max-height: 132px; resize: none; padding: 11px 12px; border-radius: 12px; }
.send-btn { width: 38px; height: 38px; border-radius: 12px; padding: 0; font-size: 16px; }
.chat-consent { color: var(--ink-tertiary); font-size: 11px; line-height: 1.45; }

/* 设置弹窗 */
.settings-layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 16px; min-height: 540px; }
.model-list { border: 1px solid var(--hairline); border-radius: 13px; background: var(--surface-1); padding: 9px; display: flex; flex-direction: column; gap: 7px; }
.model-list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 5px 8px; }
.model-list-title { font-weight: 680; font-size: 13px; }
.model-list-items { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.model-list-item { width: 100%; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-muted); }
.model-list-item:hover { background: var(--surface-2); }.model-list-item.active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--ink); }
.model-list-item strong { display: block; font-size: 13px; margin-bottom: 3px; }.model-list-item span { display: block; font-size: 11px; color: var(--ink-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-form { border: 1px solid var(--hairline); border-radius: 13px; background: var(--surface-1); padding: 17px; overflow: auto; }
.settings-form h3 { margin: 0 0 4px; font-size: 17px; }.settings-form .sub { color: var(--ink-subtle); margin: 0 0 16px; font-size: 12px; }
.range-row { display: grid; grid-template-columns: 1fr 52px; gap: 10px; align-items: center; }.range-row output { text-align: right; color: var(--ink-muted); font-family: var(--mono); font-size: 12px; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.security-note { margin-top: 15px; padding: 11px 12px; border-radius: 11px; border: 1px solid rgba(74,168,255,.22); background: rgba(74,168,255,.08); color: #b9dcff; font-size: 12px; line-height: 1.6; }
.test-result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12px; white-space: pre-wrap; display: none; }.test-result.ok { display: block; background: rgba(39,166,68,.1); border: 1px solid rgba(39,166,68,.28); color: #baf0c6; }.test-result.err { display: block; background: rgba(229,72,77,.1); border: 1px solid rgba(229,72,77,.3); color: #ffc9cb; }

/* 响应式 */
@media (max-width: 1180px) {
  .feature-grid { grid-template-columns: repeat(2,1fr); }
  .hero { grid-template-columns: 1fr; }.hero-panel { max-width: 560px; width: 100%; }
  .canvas-body { grid-template-columns: clamp(210px,24vw,280px) minmax(0,1fr) clamp(300px,30vw,380px); }
  .canvas-shell.left-collapsed .canvas-body { grid-template-columns: 0 minmax(0,1fr) clamp(300px,30vw,380px); }
  .canvas-shell.right-collapsed .canvas-body { grid-template-columns: clamp(210px,24vw,280px) minmax(0,1fr) 0; }
  .canvas-shell.left-collapsed.right-collapsed .canvas-body { grid-template-columns: 0 minmax(0,1fr) 0; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .home-page { overflow: visible; }
  .feature-grid { grid-template-columns: 1fr; }.hero-container, .home-container { padding-left: 18px; padding-right: 18px; }
  .home-nav { height: auto; min-height: 64px; flex-wrap: wrap; gap: 10px; padding: 12px 18px; }
  .home-nav-actions { width: 100%; flex-wrap: wrap; }
  .home-nav-actions .btn { flex: 1 1 auto; }
  .hero { margin-bottom: 30px; gap: 26px; }
  .hero-actions .btn { flex: 1 1 150px; }
  .work-actions { flex-wrap: wrap; }
  .canvas-shell { height: 100vh; }
  .canvas-body { display: block; position: relative; }
  .canvas-viewport { position: absolute; inset: 0; }
  .left-panel, .right-panel { position: absolute; top: 0; bottom: 0; z-index: 160; width: min(86vw, 340px); box-shadow: var(--shadow-pop); transition: transform .2s ease; }
  .left-panel { left: 0; }.right-panel { right: 0; }
  .panel-inner, .left-panel .panel-inner, .right-panel .panel-inner { width: min(86vw,340px); }
  .canvas-shell.left-collapsed .left-panel { transform: translateX(-105%); }
  .canvas-shell.right-collapsed .right-panel { transform: translateX(105%); }
  .canvas-shell.left-collapsed .canvas-body, .canvas-shell.right-collapsed .canvas-body, .canvas-shell.left-collapsed.right-collapsed .canvas-body { grid-template-columns: none; }
  .settings-layout { grid-template-columns: 1fr; }.model-list { max-height: 210px; }
}

/* ========== 参考界面优化 v3：深色创作工作台 ========== */
:root {
  --primary: #7886ff;
  --primary-hover: #98a4ff;
  --primary-soft: rgba(124, 132, 255, .16);
  --primary-line: rgba(139, 124, 255, .42);
  --ink: #f4f6fb;
  --ink-muted: #c7cdda;
  --ink-subtle: #969fb0;
  --ink-tertiary: #667082;
  --canvas: #17181d;
  --surface-0: #101116;
  --surface-1: #191b21;
  --surface-2: #20232b;
  --surface-3: #262a34;
  --surface-4: #303644;
  --hairline: rgba(255, 255, 255, .08);
  --hairline-strong: rgba(255, 255, 255, .13);
  --studio-center: #292c35;
  --accent-purple: #8b7cff;
  --left-w: 272px;
  --right-w: 432px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-pop: 0 28px 90px rgba(0, 0, 0, .56);
  --shadow-node: 0 18px 48px rgba(0, 0, 0, .34);
}

.canvas-shell.studio-v3 { grid-template-rows: minmax(0, 1fr); background: #17181d; }
.studio-v3 .canvas-body {
  height: 100vh;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
  background: #17181d;
}
.studio-v3 .canvas-shell.left-collapsed .canvas-body,
.canvas-shell.studio-v3.left-collapsed .canvas-body { grid-template-columns: 0 minmax(0, 1fr) var(--right-w); }
.canvas-shell.studio-v3.right-collapsed .canvas-body { grid-template-columns: var(--left-w) minmax(0, 1fr) 0; }
.canvas-shell.studio-v3.left-collapsed.right-collapsed .canvas-body { grid-template-columns: 0 minmax(0, 1fr) 0; }

/* 左侧目录 */
.studio-v3 .left-panel { background: #191b20; border-right: 1px solid rgba(255,255,255,.07); }
.studio-v3 .left-panel .panel-inner { width: var(--left-w); }
.studio-v3 .catalog-header { height: 64px; flex-basis: 64px; padding: 0 16px; border-bottom: 0; }
.studio-v3 .catalog-title { font-size: 18px; font-weight: 760; letter-spacing: -.02em; }
.studio-v3 .panel-header-actions { gap: 3px; }
.studio-v3 .add-menu-wrap { display: flex; align-items: center; gap: 3px; }
.studio-v3 .icon-action {
  width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center;
  color: #aab2c3; border: 1px solid transparent; background: transparent; transition: .16s ease;
}
.studio-v3 .icon-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.studio-v3 .icon-action:hover { color: #fff; background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.08); }
.studio-v3 .icon-action-muted { color: #858ea3; }
.studio-v3 .add-menu { top: 41px; right: -2px; border-radius: 14px; background: rgba(23,25,32,.98); }
.studio-v3 .work-switcher { display: flex; align-items: center; gap: 7px; padding: 0 13px 10px; }
.studio-v3 .work-back { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; color: #8d96a8; }
.studio-v3 .work-back svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.studio-v3 .work-back:hover { color: #fff; background: rgba(255,255,255,.07); }
.studio-v3 .work-switcher-title {
  min-width: 0; flex: 1; background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 5px 7px; color: #d9deea; font-size: 12.5px; font-weight: 620;
}
.studio-v3 .work-switcher-title:hover, .studio-v3 .work-switcher-title:focus { background: #20232b; border-color: rgba(255,255,255,.09); }
.studio-v3 .save-state { min-width: auto; font-size: 11px; white-space: nowrap; }
.studio-v3 .panel-search { padding: 0 14px 10px; border-bottom: 0; }
.studio-v3 .panel-search .input { height: 34px; padding: 7px 11px; border-radius: 10px; background: #20232b; border-color: rgba(255,255,255,.07); }
.studio-v3 .directory-list { padding: 3px 10px 12px; gap: 4px; }
.studio-v3 .directory-item { grid-template-columns: 18px minmax(0, 1fr) 28px; gap: 8px; padding: 10px; border-radius: 12px; }
.studio-v3 .directory-item:hover { background: #222630; border-color: rgba(255,255,255,.07); }
.studio-v3 .directory-item.selected { background: #2a2e3a; border-color: rgba(139,124,255,.35); }
.studio-v3 .type-dot { width: 13px; height: 13px; border-radius: 4px; }
.studio-v3 .directory-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 620; color: #d7dce8; }
.studio-v3 .directory-type { display: none; }
.studio-v3 .directory-delete { width: 26px; height: 26px; border-radius: 8px; }
.studio-v3 .catalog-footer {
  margin-top: auto; padding: 11px 16px 14px; border-top: 1px solid rgba(255,255,255,.06);
  color: #687286; font-size: 11px; display: flex; align-items: center; gap: 8px;
}
.catalog-footer-dot { width: 7px; height: 7px; border-radius: 50%; background: #58d38a; box-shadow: 0 0 0 3px rgba(88,211,138,.12); }

/* 中间画布卡片 */
.studio-v3 .canvas-viewport {
  margin: 12px 12px 12px 10px;
  border: 0;
  border-radius: 16px;
  background-color: #292c35;
  background-image: radial-gradient(circle, rgba(255,255,255,.075) 1px, transparent 1px);
  box-shadow: inset 0 0 0 1px rgba(126,140,190,.22), 0 18px 50px rgba(0,0,0,.22);
}
.studio-v3.left-collapsed .canvas-viewport { margin-left: 12px; }
.studio-v3.right-collapsed .canvas-viewport { margin-right: 12px; }
.canvas-surface-bar { position: absolute; left: 14px; right: 14px; top: 12px; z-index: 95; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.canvas-context-pill {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; max-width: 56%; height: 30px; padding: 0 11px;
  border-radius: 999px; color: #dce1ee; background: rgba(24,26,33,.56); border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px); font-size: 12px; font-weight: 650;
}
.canvas-context-pill span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.context-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #8b7cff; }
.canvas-surface-actions { display: flex; gap: 7px; pointer-events: auto; }
.surface-icon-btn {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #d6dcea;
  background: rgba(20,22,28,.62); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px); transition: .16s ease;
}
.surface-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.surface-icon-btn:hover { background: rgba(42,46,58,.94); border-color: rgba(139,124,255,.45); }
.studio-v3 .canvas-minimap {
  top: 54px; left: 16px; padding: 5px 10px; border-radius: 999px; color: #aab2c3;
  background: rgba(20,22,28,.58); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(10px);
}
.studio-v3 .canvas-hint { display: none !important; }
.studio-v3 .canvas-zoom-bar { right: 16px; bottom: 16px; padding: 5px; gap: 2px; border-radius: 13px; background: rgba(20,22,28,.74); border-color: rgba(255,255,255,.09); backdrop-filter: blur(14px); }
.zoom-icon-btn { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #c6cdda; }
.zoom-icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.zoom-icon-btn:hover, .zoom-fit-btn:hover { background: rgba(255,255,255,.08); }
.zoom-fit-btn { height: 28px; padding: 0 9px; border-radius: 8px; color: #c6cdda; font-size: 12px; }

/* 节点卡片 */
.studio-v3 .node { border: 1px solid rgba(255,255,255,.09); background: linear-gradient(180deg, rgba(35,38,48,.96), rgba(27,30,39,.96)); box-shadow: 0 20px 55px rgba(0,0,0,.30); border-radius: 16px; }
.studio-v3 .node.selected { border-color: rgba(139,124,255,.66); box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.studio-v3 .node.type-character, .studio-v3 .node.type-event, .studio-v3 .node.type-branch, .studio-v3 .node.type-note { border-top: 1px solid rgba(255,255,255,.09); }
.studio-v3 .node-type-icon { width: 26px; height: 26px; border-radius: 9px; background: rgba(139,124,255,.14); border: 1px solid rgba(139,124,255,.24); color: #d5d8ff; }
.studio-v3 .node-toolbar { bottom: calc(100% + 9px); padding: 6px 7px 6px 9px; border-radius: 14px; background: rgba(22,24,31,.95); border-color: rgba(255,255,255,.1); backdrop-filter: blur(16px); box-shadow: 0 18px 50px rgba(0,0,0,.42); }
.toolbar-icon-btn { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #aeb7ca; transition: .15s ease; }
.toolbar-icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.studio-v3 .node-delete-btn:hover { color: #ffd7d9; background: rgba(229,72,77,.18); }
.studio-v3 .node-body { padding: 13px 15px 14px; }
.studio-v3 .node-body textarea { color: #d4d9e6; font-size: 14px; line-height: 1.75; }
.studio-v3 .node-body textarea::placeholder { color: #747e91; }
.node-title-label { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 0 1px 9px; margin-bottom: 2px; border-bottom: 1px solid rgba(255,255,255,.07); cursor: text; }
.node-title-label-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #eef1ff; font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.node-title-label-type { flex: 0 0 auto; padding: 2px 7px; border-radius: 999px; color: #9aa5bd; background: rgba(255,255,255,.055); font-size: 10px; line-height: 1.5; }
.studio-v3 .node .port { background: linear-gradient(180deg, #8f85ff 0%, #6b5cec 100%); border-color: rgba(235,237,255,.9); }

/* 右侧 Agent */
.studio-v3 .right-panel { background: #191b20; border-left: 1px solid rgba(255,255,255,.07); }
.studio-v3 .right-panel .panel-inner { width: var(--right-w); }
.studio-v3 .studio-chat-header { padding: 14px 16px 11px; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.07); background: linear-gradient(180deg, rgba(255,255,255,.018), transparent); }
.chat-header-top { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 9px; align-items: center; }
.chat-conv-wrap { position: relative; min-width: 0; }
.chat-conv-switch { max-width: 100%; display: inline-flex; align-items: center; gap: 5px; padding: 6px 7px; border-radius: 9px; color: #f1f3f9; font-size: 15px; font-weight: 720; }
.chat-conv-switch span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-conv-switch svg { width: 15px; height: 15px; fill: none; stroke: #9aa4b8; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-conv-switch:hover { background: rgba(255,255,255,.06); }
.new-chat-btn { height: 34px; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px; border-radius: 11px; border: 1px solid rgba(255,255,255,.12); background: #242833; color: #eef1f8; font-size: 12.5px; font-weight: 650; }
.new-chat-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.new-chat-btn:hover { background: #2b3040; border-color: rgba(139,124,255,.45); }
.chat-header-actions { display: flex; align-items: center; gap: 2px; }
.chat-header-actions .icon-action { width: 30px; height: 30px; }
.chat-conv-menu {
  position: absolute; left: 0; top: 42px; width: 264px; z-index: 300; padding: 7px;
  border-radius: 14px; border: 1px solid rgba(255,255,255,.11); background: rgba(24,26,33,.98);
  box-shadow: var(--shadow-pop); backdrop-filter: blur(18px);
}
.chat-conv-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; color: #cbd2e1; text-align: left; font-size: 13px; }
button.chat-conv-item:hover { background: rgba(255,255,255,.07); }
.chat-conv-item.is-current { background: rgba(124,132,255,.13); border: 1px solid rgba(139,124,255,.25); }
.chat-conv-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-conv-meta { flex: 0 0 auto; color: #747f94; font-size: 11px; }
.chat-conv-plus { color: #aeb7ff; font-weight: 700; }
.chat-conv-sep { padding: 8px 10px 5px; color: #747f94; font-size: 11px; font-weight: 700; }
.chat-conv-empty { padding: 10px; color: #747f94; font-size: 12px; }
.studio-v3 .chat-model-row { grid-template-columns: minmax(0,1fr) 34px; gap: 8px; }
.studio-v3 .chat-model-row .select { height: 34px; padding: 7px 10px; border-radius: 10px; background: #20232b; border-color: rgba(255,255,255,.07); font-size: 12px; }
.studio-v3 .chat-messages { padding: 20px 18px 12px; gap: 14px; background: transparent; }
.studio-v3 .chat-messages.is-empty { display: flex; flex-direction: column; justify-content: center; }
.chat-empty { margin: auto 0; padding: 20px 14px 34px; text-align: center; }
.chat-empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 18px; color: #aab4ff; background: rgba(124,132,255,.13); border: 1px solid rgba(139,124,255,.24); box-shadow: 0 16px 40px rgba(0,0,0,.24); }
.chat-empty-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.chat-empty h3 { margin: 0 0 9px; font-size: 18px; font-weight: 760; letter-spacing: -.02em; }
.chat-empty p { max-width: 330px; margin: 0 auto; color: #9aa4b8; font-size: 13px; line-height: 1.75; }
.chat-empty-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 18px; }
.chat-empty-hints span { padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); color: #8d97aa; font-size: 11px; }
.studio-v3 .message-bubble { border-radius: 15px; background: #232733; border-color: rgba(255,255,255,.075); color: #d2d8e5; line-height: 1.65; }
.studio-v3 .message.user .message-bubble { background: linear-gradient(135deg, #7886ff, #6658e8); border-color: transparent; box-shadow: 0 12px 30px rgba(0,0,0,.26); }
.studio-v3 .chat-quick { padding: 0 16px 8px; display: flex; flex-wrap: nowrap; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.studio-v3 .chat-quick::-webkit-scrollbar { display: none; }
.studio-v3 .quick-chip { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; background: #20232b; border-color: rgba(255,255,255,.08); color: #9aa4b8; }
.studio-v3 .chat-input-area { padding: 10px 16px 14px; border-top: 1px solid rgba(255,255,255,.07); background: linear-gradient(180deg, transparent, rgba(0,0,0,.12)); }
.chat-composer-card { padding: 13px 14px 11px; border-radius: 18px; border: 1px solid rgba(255,255,255,.09); background: #242833; box-shadow: 0 14px 38px rgba(0,0,0,.20); transition: border-color .16s ease, box-shadow .16s ease; }
.chat-composer-card:focus-within { border-color: rgba(139,124,255,.48); box-shadow: 0 0 0 3px rgba(124,132,255,.12), 0 14px 38px rgba(0,0,0,.22); }
.chat-composer-card .chat-input { width: 100%; min-height: 68px; max-height: 132px; padding: 0; border: 0; outline: 0; resize: none; background: transparent; color: #e7ebf5; font-size: 13.5px; line-height: 1.65; }
.chat-composer-card .chat-input::placeholder { color: #778195; }
.chat-composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.composer-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #9aa5ba; border: 1px solid transparent; background: transparent; }
.composer-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.composer-icon:hover { color: #eef2ff; background: rgba(255,255,255,.07); }
.composer-send { width: 42px; height: 42px; margin-left: auto; border-radius: 50%; display: grid; place-items: center; color: #d8deeb; background: #3a4050; border: 1px solid rgba(255,255,255,.08); transition: .16s ease; }
.composer-send svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-send:hover { transform: translateY(-1px); background: #464d60; }
.chat-composer-card.has-text .composer-send { color: #fff; background: linear-gradient(135deg, #7886ff, #6959e8); border-color: transparent; box-shadow: 0 12px 28px rgba(0,0,0,.30); }
.composer-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.composer-file-input { display: none !important; }
.composer-model-select {
  flex: 1 1 auto; min-width: 120px; height: 36px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,.08); background: #20232b; color: #cfd6e6;
  font-size: 12px; padding: 0 9px; outline: none;
}
.composer-model-select:focus { border-color: rgba(139,124,255,.55); }
.composer-attachments { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.065);
  border: 1px solid rgba(255,255,255,.08); color: #d5dbe8; font-size: 11px;
}
.attachment-chip-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: rgba(120,134,255,.22); color: #b9c2ff; }
.attachment-chip-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip-size { color: #8791a5; }
.attachment-remove { border: 0; background: transparent; color: #98a2b6; font-size: 15px; line-height: 1; cursor: pointer; }
.attachment-remove:hover { color: #fff; }
.message-attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.message-attachments img, .message-attachments video { display: block; max-width: 230px; max-height: 150px; border-radius: 10px; object-fit: cover; }
.message-attachments audio { width: 220px; height: 36px; }
.msg-attachment-image { display: block; }
.msg-attachment-file {
  display: inline-flex; align-items: center; gap: 9px; min-width: 180px; max-width: 100%;
  padding: 9px 10px; border-radius: 11px; color: #e4e9f5; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
}
.msg-attachment-file small { display: block; color: #939db1; margin-top: 2px; }
.msg-attachment-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(120,134,255,.22); color: #b9c2ff; flex: 0 0 auto; }
.composer-send.is-loading,
.composer-send.is-loading:disabled {
  opacity: 1;
  cursor: progress;
  background: linear-gradient(135deg, #7886ff, #6959e8);
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(0,0,0,.30);
}
.send-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.34);
  border-top-color: #fff;
  animation: composer-send-spin .72s linear infinite;
}
@keyframes composer-send-spin { to { transform: rotate(360deg); } }
.studio-v3 .chat-consent { margin-top: 9px; text-align: center; color: #687286; font-size: 10.5px; line-height: 1.5; }

/* 情绪曲线浮层 */
.emotion-card {
  position: absolute; left: 18px; bottom: 18px; z-index: 96; width: 326px; max-width: calc(100% - 36px);
  padding: 13px 14px 10px; border-radius: 16px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(22,24,31,.93); backdrop-filter: blur(16px); box-shadow: 0 22px 60px rgba(0,0,0,.38);
}
.emotion-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.emotion-head strong { font-size: 13.5px; font-weight: 740; letter-spacing: -.01em; }
.emotion-head-actions { display: flex; align-items: center; gap: 7px; }
.emotion-analyze-btn { height: 27px; padding: 0 11px; border-radius: 9px; border: 1px solid rgba(139,124,255,.45); color: #c9c4ff; background: rgba(124,132,255,.13); font-size: 11.5px; font-weight: 680; }
.emotion-analyze-btn:hover { background: rgba(124,132,255,.22); }
.emotion-icon-btn { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; color: #8d97aa; }
.emotion-icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.emotion-icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.emotion-chart { width: 100%; }
.emotion-chart svg { display: block; width: 100%; height: 132px; overflow: visible; }
.emotion-grid-line { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.emotion-axis-text { fill: #747f94; font-size: 10px; }
.emotion-line { fill: none; stroke: #9a8cff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.emotion-dot { fill: #e7e6ff; stroke: #8b7cff; stroke-width: 2; }
.emotion-empty { height: 132px; display: grid; place-items: center; padding: 0 18px; text-align: center; color: #747f94; font-size: 12px; line-height: 1.6; }
.emotion-reopen { position: absolute; left: 18px; bottom: 18px; z-index: 96; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid rgba(139,124,255,.38); background: rgba(22,24,31,.92); color: #c9c4ff; font-size: 12px; backdrop-filter: blur(12px); }
.emotion-reopen:hover { background: rgba(124,132,255,.18); }

@media (max-width: 1180px) {
  :root { --left-w: 244px; --right-w: 372px; }
  .chat-header-top { grid-template-columns: minmax(0,1fr) auto auto; }
  .new-chat-btn { padding: 0 10px; }
}
@media (max-width: 900px) {
  .studio-v3 .canvas-body { display: block; position: relative; }
  .studio-v3 .left-panel, .studio-v3 .right-panel { position: absolute; top: 0; bottom: 0; z-index: 160; width: min(86vw, 340px); box-shadow: var(--shadow-pop); transition: transform .2s ease; }
  .studio-v3 .left-panel { left: 0; }
  .studio-v3 .right-panel { right: 0; }
  .studio-v3 .left-panel .panel-inner, .studio-v3 .right-panel .panel-inner { width: min(86vw, 340px); }
  .studio-v3 .canvas-viewport { position: absolute; inset: 0; margin: 0; border-radius: 0; box-shadow: none; }
  .studio-v3.left-collapsed .left-panel { transform: translateX(-105%); }
  .studio-v3.right-collapsed .right-panel { transform: translateX(105%); }
  .canvas-surface-bar { top: 10px; left: 10px; right: 10px; }
  .canvas-context-pill { max-width: 42%; }
  .emotion-card { left: 14px; bottom: 14px; width: min(326px, calc(100% - 28px)); }
}

/* v3.2 截图同款文本框按钮：画布节点只保留右上角展开键，低频操作收纳到目录 */
.studio-v3 .directory-item { position: relative; grid-template-columns: 16px minmax(0, 1fr); padding-right: 10px; }
.studio-v3 .directory-actions {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 1px;
  padding-left: 24px; border-radius: 0 11px 11px 0; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(34,38,48,0), #222630 34%); transition: opacity .15s ease;
}
.studio-v3 .directory-item.selected .directory-actions { background: linear-gradient(90deg, rgba(42,46,58,0), #2a2e3a 34%); }
.studio-v3 .directory-item:hover .directory-actions,
.studio-v3 .directory-item.selected .directory-actions,
.studio-v3 .directory-actions:focus-within { opacity: 1; pointer-events: auto; }
.studio-v3 .directory-action-btn { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #8b95a8; transition: color .15s ease, background .15s ease; }
.studio-v3 .directory-action-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.studio-v3 .directory-action-btn:hover { color: #f2f4ff; background: rgba(255,255,255,.08); }
.studio-v3 .directory-rename:hover { color: #d6d2ff; background: rgba(139,124,255,.15); }
.studio-v3 .directory-delete { opacity: 1; }
.studio-v3 .directory-delete:hover { color: #ffd2d5; background: rgba(229,72,77,.16); }
.studio-v3 .directory-action-btn:focus-visible,
.studio-v3 .node-corner-btn:focus-visible { outline: 2px solid rgba(151,160,255,.78); outline-offset: 2px; }

.studio-v3 .node-body { padding: 12px 14px 14px; }
.studio-v3 .node-head { position: relative; z-index: 2; display: flex; align-items: center; min-height: 30px; margin: 0 38px 3px 0; border-radius: 8px; cursor: grab; }
.studio-v3 .node-head:active { cursor: grabbing; }
.studio-v3 .node-title-input {
  width: 100%; min-width: 0; height: 28px; padding: 3px 2px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: #a4adbf; font-size: 12.5px; font-weight: 650; line-height: 1.4; cursor: text;
}
.studio-v3 .node-title-input:hover { color: #dce2ef; }
.studio-v3 .node-title-input:focus { color: #f1f3ff; background: rgba(0,0,0,.14); border-color: rgba(139,124,255,.35); outline: none; }
.studio-v3 .node-corner-btn {
  position: absolute; top: 10px; right: 10px; z-index: 8; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 10px; display: grid; place-items: center; background: #14161c; color: #c8cedb;
  box-shadow: 0 8px 20px rgba(0,0,0,.22); transition: background .15s ease, color .15s ease, transform .15s ease;
}
.studio-v3 .node-corner-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.studio-v3 .node-corner-btn:hover { color: #fff; background: #0e1016; transform: translateY(-1px); }
.studio-v3 .node-corner-btn:active { transform: translateY(0) scale(.97); }
.studio-v3 .node.focused .node-corner-btn { top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 11px; }
.studio-v3 .node.focused .node-head { margin-right: 46px; }
.studio-v3 .node.collapsed .node-corner-btn { display: none; }

.studio-v3 #canvas-stat { display: none !important; }
.zoom-bar-divider { width: 1px; height: 18px; margin: 0 3px; background: rgba(255,255,255,.1); }
.studio-v3 .canvas-zoom-bar #viewport-focus { color: #c6cdda; }

@media (max-width: 900px) {
  .studio-v3 .directory-item { grid-template-columns: 16px minmax(0, 1fr) auto; padding-right: 7px; }
  .studio-v3 .directory-actions {
    position: static; transform: none; padding-left: 0; opacity: 1; pointer-events: auto; background: none;
  }
  .studio-v3 .directory-action-btn { width: 28px; height: 28px; }
  .zoom-bar-divider { display: none; }
}

/* v3.5 浮层工作台：目录与 Agent 浮在满屏无限画布上，画布视口不随面板压缩 */
.canvas-shell.studio-v3 { --panel-left: var(--left-w); --panel-right: var(--right-w); overflow: hidden; }
.canvas-shell.studio-v3.left-collapsed { --panel-left: 0px; }
.canvas-shell.studio-v3.right-collapsed { --panel-right: 0px; }
.studio-v3 .canvas-body {
  display: block; position: relative; height: 100vh; min-height: 0; overflow: hidden; background: #17181d;
}
.studio-v3 .canvas-viewport,
.studio-v3.left-collapsed .canvas-viewport,
.studio-v3.right-collapsed .canvas-viewport,
.studio-v3.left-collapsed.right-collapsed .canvas-viewport {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0;
  background-color: #20242e; box-shadow: none;
}
.studio-v3 .left-panel,
.studio-v3 .right-panel {
  position: absolute; top: 0; bottom: 0; z-index: 140; min-width: 0; overflow: hidden;
  background: #17191f; transition: transform .22s cubic-bezier(.22,.8,.28,1), box-shadow .2s ease;
}
.studio-v3 .left-panel {
  left: 0; width: var(--left-w); transform: translateX(0);
  border-right: 1px solid rgba(255,255,255,.08); box-shadow: 22px 0 60px rgba(0,0,0,.34);
}
.studio-v3 .right-panel {
  right: 0; width: var(--right-w); transform: translateX(0);
  border-left: 1px solid rgba(255,255,255,.08); box-shadow: -22px 0 60px rgba(0,0,0,.34);
}
.studio-v3 .left-panel .panel-inner,
.studio-v3 .right-panel .panel-inner { width: 100%; height: 100%; }
.studio-v3.left-collapsed .left-panel { transform: translateX(-102%); box-shadow: none; }
.studio-v3.right-collapsed .right-panel { transform: translateX(102%); box-shadow: none; }

.studio-v3 .canvas-surface-bar { display: block; inset: 0; top: 0; right: 0; bottom: 0; left: 0; }
.studio-v3 .canvas-context-pill {
  position: absolute; top: 14px; right: auto; margin: 0;
  left: calc(var(--panel-left) + (100% - var(--panel-left) - var(--panel-right)) / 2);
  transform: translateX(-50%); max-width: min(44vw, 520px);
}
.studio-v3 .canvas-surface-left-actions {
  position: absolute; top: 14px; left: 16px; z-index: 180;
  display: flex; align-items: center; gap: 8px; pointer-events: auto;
}
.studio-v3 #reopen-left { position: static; top: auto; left: auto; flex: 0 0 auto; }
.studio-v3 .novel-surface-create,
.studio-v3 .novel-surface-filter { position: relative; flex: 0 0 auto; }
.studio-v3 #reopen-right { position: absolute; top: 14px; right: 16px; z-index: 180; pointer-events: auto; }

.studio-v3 .canvas-zoom-bar {
  z-index: 120; right: calc(var(--panel-right) + 18px); bottom: 18px;
  transition: right .22s cubic-bezier(.22,.8,.28,1), background .15s ease;
}
.studio-v3 .emotion-reopen {
  z-index: 120; left: calc(var(--panel-left) + 18px); bottom: 18px;
  transition: left .22s cubic-bezier(.22,.8,.28,1), background .15s ease;
}
.studio-v3 .emotion-card {
  z-index: 115; left: calc(var(--panel-left) + 18px); bottom: 18px;
  transition: left .22s cubic-bezier(.22,.8,.28,1);
}

@media (max-width: 900px) {
  .canvas-shell.studio-v3 { --left-w: min(86vw, 340px); --right-w: min(86vw, 340px); }
  .studio-v3 .left-panel,
  .studio-v3 .right-panel { width: min(86vw, 340px); }
  .studio-v3 .canvas-context-pill { left: 50%; max-width: calc(100% - 112px); }
  .studio-v3 .canvas-zoom-bar { right: 14px; bottom: 14px; }
  .studio-v3 .emotion-reopen { left: 14px; bottom: 14px; }
  .studio-v3 .emotion-card { left: 14px; bottom: 14px; }
}

/* v3.8：左侧只保留章节新建，其他节点类型移到画布顶部工具栏 */
.studio-v3 .canvas-top-dock {
  position: absolute; top: 12px; z-index: 130;
  left: calc(var(--panel-left) + (100% - var(--panel-left) - var(--panel-right)) / 2);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - var(--panel-left) - var(--panel-right) - 28px);
  padding: 5px; border: 1px solid rgba(255,255,255,.09); border-radius: 15px;
  background: rgba(18,20,27,.78); backdrop-filter: blur(16px);
  box-shadow: 0 14px 38px rgba(0,0,0,.28); pointer-events: auto;
  transition: left .22s cubic-bezier(.22,.8,.28,1), max-width .22s cubic-bezier(.22,.8,.28,1);
}
.studio-v3 .canvas-top-dock .canvas-context-pill {
  position: static; left: auto; transform: none; max-width: 220px; height: 30px;
  padding: 0 8px 0 7px; background: transparent; border: 0; box-shadow: none; backdrop-filter: none;
  cursor: pointer;
}
.studio-v3 .canvas-create-dock {
  display: flex; align-items: center; gap: 3px; padding-left: 7px;
  border-left: 1px solid rgba(255,255,255,.09);
}
.studio-v3 .top-create-btn {
  height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: #c8cfdd; font-size: 12px; font-weight: 650; line-height: 1; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.studio-v3 .top-create-btn:hover { color: #fff; background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.08); transform: translateY(-1px); }
.studio-v3 .top-create-btn:active { transform: translateY(0) scale(.97); }
.studio-v3 .top-create-icon {
  width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 7px; background: rgba(255,255,255,.07); font-size: 11px; font-style: normal;
}
.studio-v3 .top-create-character:hover { border-color: rgba(130,143,255,.38); background: rgba(130,143,255,.14); }
.studio-v3 .top-create-event:hover { border-color: rgba(224,168,75,.38); background: rgba(224,168,75,.13); }
.studio-v3 .top-create-branch:hover { border-color: rgba(79,195,138,.38); background: rgba(79,195,138,.13); }
.studio-v3 .top-create-note:hover { border-color: rgba(85,199,216,.38); background: rgba(85,199,216,.13); }

/* 节点放大按钮固定在卡片右上角；资料卡按钮保留在标题行右侧 */
.studio-v3 .node-head { gap: 8px; margin: 0 0 4px; min-height: 32px; }
.studio-v3 .node-body .node-novel-bar { min-height: 28px; padding-right: 42px; }
.studio-v3 .node-focus-corner {
  position: absolute; top: 9px; right: 10px; z-index: 9; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 9px;
}
.studio-v3 .node.focused .node-body .node-novel-bar { padding-right: 48px; }
.studio-v3 .node.focused .node-focus-corner { top: 16px; right: 18px; width: 32px; height: 32px; border-radius: 10px; }
.studio-v3 .node.focused .node-head { margin-right: 0; }
.studio-v3 .node-title-input { flex: 1 1 auto; }

/* 放大舞台：目录和 AI 双栏打开，节点精确填满两栏之间 */
.studio-v3.stage-focus .canvas-top-dock,
.studio-v3.stage-focus .canvas-zoom-bar,
.studio-v3.stage-focus #canvas-back-home,
.studio-v3.stage-focus .emotion-card,
.studio-v3.stage-focus .emotion-reopen,
.studio-v3.stage-focus .canvas-minimap,
.studio-v3.stage-focus .canvas-hint { display: none !important; }
.studio-v3.stage-focus .node:not(.focused),
.studio-v3.stage-focus .edge-group,
.studio-v3.stage-focus #edge-draft { visibility: hidden !important; }
.studio-v3.stage-focus .node.focused {
  border-radius: 0; border-color: rgba(255,255,255,.08);
  background: #171a21; box-shadow: none; min-width: 0; min-height: 0;
}
.studio-v3.stage-focus .node.focused .node-body { padding: 18px 24px 22px; background: #171a21; }
.studio-v3.stage-focus .node.focused .node-head { min-height: 38px; margin-bottom: 10px; }
.studio-v3.stage-focus .node.focused .node-title-input { height: 34px; color: #f2f4fb; font-size: 18px; font-weight: 720; }
.studio-v3.stage-focus .node.focused .node-body textarea { font-size: 15px; line-height: 1.85; }
.studio-v3.stage-focus .node .port,
.studio-v3.stage-focus .node .resize-handle { display: none !important; }
.studio-v3.stage-focus .node.focused .node-focus-corner { background: #202431; }

@media (max-width: 1180px) {
  .studio-v3 .canvas-top-dock { gap: 4px; padding: 4px; }
  .studio-v3 .canvas-top-dock .canvas-context-pill { display: none; }
  .studio-v3 .canvas-create-dock { gap: 2px; padding-left: 0; border-left: 0; }
  .studio-v3 .top-create-btn { padding: 0 7px; gap: 0; }
  .studio-v3 .top-create-label { display: none; }
  .studio-v3 .top-create-icon { width: 24px; height: 24px; font-size: 12px; }
}
@media (max-width: 900px) {
  .studio-v3 .canvas-top-dock {
    left: 58px; right: 58px; transform: none; max-width: none; justify-content: center;
    overflow-x: auto; scrollbar-width: none;
  }
  .studio-v3 .canvas-top-dock::-webkit-scrollbar { display: none; }
  .studio-v3 .top-create-label { display: inline; }
  .studio-v3 .top-create-btn { gap: 6px; padding: 0 9px; }
}
@media (max-width: 560px) {
  .studio-v3 .canvas-top-dock { left: 52px; right: 52px; }
  .studio-v3 .top-create-label { display: none; }
  .studio-v3 .top-create-btn { padding: 0 6px; }
}

/* v3.8.2：外壳尺寸不随画布变换，增强节点拖拽热区反馈 */
.canvas-shell.studio-v3 { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.studio-v3 .canvas-viewport { touch-action: none; }
.studio-v3 .canvas-viewport input,
.studio-v3 .canvas-viewport textarea,
.studio-v3 .canvas-viewport select { touch-action: auto; }
.studio-v3 .node[data-drag="node"] .node-head,
.studio-v3 .node[data-drag="node"] .node-body,
.studio-v3 .node[data-drag="node"] .node-meta-grid { cursor: grab; }
.studio-v3 .node[data-drag="node"] .node-head:active,
.studio-v3 .node[data-drag="node"] .node-body:active,
.studio-v3 .node[data-drag="node"] .node-meta-grid:active { cursor: grabbing; }
.studio-v3 .node[data-drag="node"] .node-body textarea,
.studio-v3 .node[data-drag="node"] .node-body input { cursor: text; }
.studio-v3 .node[data-drag="node"] .node-body select { cursor: pointer; }
.studio-v3 .node[data-drag="node"] { cursor: grab; }
.studio-v3 .node[data-drag="node"] button,
.studio-v3 .node[data-drag="node"] a,
.studio-v3 .node[data-drag="node"] select,
.studio-v3 .node[data-drag="node"] .port,
.studio-v3 .node[data-drag="node"] .resize-handle { cursor: pointer; }
body.is-node-dragging,
body.is-node-dragging * { user-select: none !important; }
body.is-node-dragging .node[data-drag="node"],
body.is-node-dragging .node[data-drag="node"] * { cursor: grabbing !important; }
body.is-node-dragging .node.is-dragging { box-shadow: 0 22px 60px rgba(0,0,0,.38), 0 0 0 1px rgba(126,140,255,.38); }

/* v3.8.4 专注舞台紧凑化：只影响节点放大后的三栏编辑舞台，普通画布继续使用 v3.8.3 密度 */
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 252px; --right-w: 384px; }
}
@media (min-width: 901px) and (max-width: 1366px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 224px; --right-w: 328px; }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 210px; --right-w: 292px; }
}

.canvas-shell.studio-v3.stage-focus .catalog-header { height: 54px; flex-basis: 54px; padding: 0 13px; }
.canvas-shell.studio-v3.stage-focus .catalog-title { font-size: 16px; }
.canvas-shell.studio-v3.stage-focus .work-switcher { gap: 6px; padding: 0 11px 7px; }
.canvas-shell.studio-v3.stage-focus .work-switcher-title { font-size: 12px; padding: 4px 6px; }
.canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 11px 7px; }
.canvas-shell.studio-v3.stage-focus .panel-search .input { height: 32px; }
.canvas-shell.studio-v3.stage-focus .directory-list { padding: 2px 8px 9px; gap: 3px; }
.canvas-shell.studio-v3.stage-focus .directory-item { gap: 7px; padding: 7px 8px; border-radius: 10px; }
.canvas-shell.studio-v3.stage-focus .directory-name { gap: 7px; font-size: 12.5px; }
.canvas-shell.studio-v3.stage-focus .directory-action-btn { width: 24px; height: 24px; }
.canvas-shell.studio-v3.stage-focus .catalog-footer { padding: 8px 12px 10px; font-size: 10.5px; }

.canvas-shell.studio-v3.stage-focus .node.focused .node-body { padding: 14px 20px 16px; gap: 6px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-head { min-height: 32px; margin-bottom: 6px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-title-input { height: 30px; font-size: 16px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-body textarea { font-size: 14px; line-height: 1.72; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner { top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 10px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-meta-grid { gap: 6px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-meta-grid .input,
.canvas-shell.studio-v3.stage-focus .node.focused .node-body .select { padding: 6px 9px; font-size: 12.5px; }

.canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 10px 13px 9px; gap: 8px; }
.canvas-shell.studio-v3.stage-focus .chat-conv-switch { font-size: 14px; padding: 5px 6px; }
.canvas-shell.studio-v3.stage-focus .new-chat-btn { height: 31px; padding: 0 11px; border-radius: 10px; font-size: 12px; }
.canvas-shell.studio-v3.stage-focus .chat-header-actions .icon-action { width: 28px; height: 28px; }
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select { height: 31px; }
.canvas-shell.studio-v3.stage-focus .chat-messages { padding: 12px 13px 8px; gap: 10px; }
.canvas-shell.studio-v3.stage-focus .chat-empty { padding: 8px 10px 18px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 44px; height: 44px; margin-bottom: 11px; border-radius: 15px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 22px; height: 22px; }
.canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin-bottom: 7px; font-size: 15.5px; }
.canvas-shell.studio-v3.stage-focus .chat-empty p { max-width: 300px; font-size: 12px; line-height: 1.58; }
.canvas-shell.studio-v3.stage-focus .chat-empty-hints { gap: 6px; margin-top: 12px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-hints span { padding: 4px 8px; font-size: 10.5px; }
.canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 12px 7px; gap: 6px; }
.canvas-shell.studio-v3.stage-focus .quick-chip { padding: 5px 9px; font-size: 10.5px; }
.canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 8px 12px 10px; gap: 6px; }
.canvas-shell.studio-v3.stage-focus .chat-composer-card { padding: 10px 12px 9px; border-radius: 16px; }
.canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 52px; font-size: 13px; line-height: 1.58; }
.canvas-shell.studio-v3.stage-focus .chat-composer-bar { gap: 7px; margin-top: 7px; }
.canvas-shell.studio-v3.stage-focus .composer-icon { width: 30px; height: 30px; }
.canvas-shell.studio-v3.stage-focus .composer-icon svg { width: 16px; height: 16px; }
.canvas-shell.studio-v3.stage-focus .composer-send { width: 38px; height: 38px; }
.canvas-shell.studio-v3.stage-focus .composer-send svg { width: 17px; height: 17px; }
.canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 7px; font-size: 10px; }

@media (max-height: 760px) {
  .canvas-shell.studio-v3.stage-focus .catalog-header { height: 50px; flex-basis: 50px; }
  .canvas-shell.studio-v3.stage-focus .directory-item { padding-top: 6px; padding-bottom: 6px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 38px; height: 38px; margin-bottom: 8px; border-radius: 13px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 20px; height: 20px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin-bottom: 5px; font-size: 14.5px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty p { line-height: 1.5; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-hints { margin-top: 9px; }
  .canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 44px; }
}

/* v3.8.6：在 v3.8.5 高密度字号基础上加宽专注舞台栏位；左栏 +1/3，AI 栏 +2/4（1/2），只影响放大编辑态 */
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 224px; --right-w: 384px; }
}
@media (min-width: 901px) and (max-width: 1366px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 200px; --right-w: 329px; }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 187px; --right-w: 293px; }
}

.canvas-shell.studio-v3.stage-focus .catalog-header { height: 36px; flex-basis: 36px; padding: 0 9px; }
.canvas-shell.studio-v3.stage-focus .catalog-title { font-size: 11px; }
.canvas-shell.studio-v3.stage-focus .icon-action { width: 22px; height: 22px; border-radius: 7px; }
.canvas-shell.studio-v3.stage-focus .icon-action svg { width: 12px; height: 12px; }
.canvas-shell.studio-v3.stage-focus .work-switcher { gap: 4px; padding: 0 8px 5px; }
.canvas-shell.studio-v3.stage-focus .work-back { width: 20px; height: 20px; border-radius: 6px; }
.canvas-shell.studio-v3.stage-focus .work-back svg { width: 12px; height: 12px; }
.canvas-shell.studio-v3.stage-focus .work-switcher-title { padding: 3px 5px; font-size: 8.5px; border-radius: 6px; }
.canvas-shell.studio-v3.stage-focus .save-state { font-size: 8px; }
.canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 8px 5px; }
.canvas-shell.studio-v3.stage-focus .panel-search .input { height: 22px; padding: 4px 7px; border-radius: 7px; font-size: 9px; }
.canvas-shell.studio-v3.stage-focus .directory-list { padding: 2px 6px 6px; gap: 2px; }
.canvas-shell.studio-v3.stage-focus .directory-item { grid-template-columns: 11px minmax(0, 1fr) auto; gap: 5px; padding: 5px 6px; border-radius: 8px; }
.canvas-shell.studio-v3.stage-focus .type-dot { width: 9px; height: 9px; border-radius: 3px; }
.canvas-shell.studio-v3.stage-focus .directory-name { gap: 5px; font-size: 8.5px; }
.canvas-shell.studio-v3.stage-focus .directory-action-btn { width: 16px; height: 16px; border-radius: 6px; }
.canvas-shell.studio-v3.stage-focus .directory-action-btn svg { width: 10px; height: 10px; }
.canvas-shell.studio-v3.stage-focus .catalog-footer { padding: 5px 8px 7px; gap: 5px; font-size: 7.5px; }
.canvas-shell.studio-v3.stage-focus .catalog-footer-dot { width: 5px; height: 5px; box-shadow: 0 0 0 2px rgba(88,211,138,.12); }

.canvas-shell.studio-v3.stage-focus .node.focused .node-body { padding: 9px 13px 11px; gap: 4px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-head { gap: 5px; min-height: 21px; margin-bottom: 4px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-title-input { height: 20px; padding: 2px; font-size: 11px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-body textarea { font-size: 9.5px; line-height: 1.62; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner { top: 9px; right: 9px; width: 20px; height: 20px; border-radius: 7px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner svg { width: 10px; height: 10px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-meta-grid { gap: 4px; }
.canvas-shell.studio-v3.stage-focus .node.focused.type-character .node-meta-grid,
.canvas-shell.studio-v3.stage-focus .node.focused.type-branch .node-meta-grid { grid-template-columns: minmax(0, 1fr); }
.canvas-shell.studio-v3.stage-focus .node.focused .node-meta-grid .input,
.canvas-shell.studio-v3.stage-focus .node.focused .node-body .select { padding: 4px 6px; border-radius: 6px; font-size: 8.5px; }

.canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 7px 9px 6px; gap: 5px; }
.canvas-shell.studio-v3.stage-focus .chat-header-top { gap: 6px; }
.canvas-shell.studio-v3.stage-focus .chat-conv-switch { gap: 4px; padding: 3px 4px; border-radius: 7px; font-size: 9.5px; }
.canvas-shell.studio-v3.stage-focus .chat-conv-switch svg { width: 10px; height: 10px; }
.canvas-shell.studio-v3.stage-focus .new-chat-btn { height: 21px; gap: 4px; padding: 0 8px; border-radius: 7px; font-size: 8.5px; }
.canvas-shell.studio-v3.stage-focus .new-chat-btn svg { width: 10px; height: 10px; }
.canvas-shell.studio-v3.stage-focus .chat-header-actions { gap: 1px; }
.canvas-shell.studio-v3.stage-focus .chat-header-actions .icon-action { width: 20px; height: 20px; }
.canvas-shell.studio-v3.stage-focus .chat-header-actions .icon-action svg { width: 11px; height: 11px; }
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row { grid-template-columns: minmax(0,1fr) 23px; gap: 5px; }
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select { height: 21px; padding: 4px 7px; border-radius: 7px; font-size: 8.5px; }
.canvas-shell.studio-v3.stage-focus .chat-messages { padding: 8px 9px 5px; gap: 7px; }
.canvas-shell.studio-v3.stage-focus .message-bubble { font-size: 9.5px; line-height: 1.55; border-radius: 11px; }
.canvas-shell.studio-v3.stage-focus .message-bubble pre { font-size: 8.5px; padding: 7px; border-radius: 7px; }
.canvas-shell.studio-v3.stage-focus .chat-empty { padding: 5px 7px 12px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 30px; height: 30px; margin-bottom: 7px; border-radius: 10px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 15px; height: 15px; }
.canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin-bottom: 5px; font-size: 10.5px; }
.canvas-shell.studio-v3.stage-focus .chat-empty p { max-width: 300px; font-size: 8px; line-height: 1.5; }
.canvas-shell.studio-v3.stage-focus .chat-empty-hints { gap: 4px; margin-top: 8px; }
.canvas-shell.studio-v3.stage-focus .chat-empty-hints span { padding: 3px 6px; font-size: 7.5px; }
.canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 8px 5px; gap: 4px; }
.canvas-shell.studio-v3.stage-focus .quick-chip { padding: 3px 6px; font-size: 7.5px; }
.canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 5px 8px 7px; gap: 4px; }
.canvas-shell.studio-v3.stage-focus .chat-composer-card { padding: 7px 8px 6px; border-radius: 11px; }
.canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 35px; font-size: 9px; line-height: 1.5; }
.canvas-shell.studio-v3.stage-focus .chat-composer-bar { gap: 5px; margin-top: 5px; }
.canvas-shell.studio-v3.stage-focus .composer-icon { width: 20px; height: 20px; border-radius: 7px; }
.canvas-shell.studio-v3.stage-focus .composer-icon svg { width: 11px; height: 11px; }
.canvas-shell.studio-v3.stage-focus .composer-send { width: 25px; height: 25px; border-radius: 50%; }
.canvas-shell.studio-v3.stage-focus .composer-send svg { width: 11px; height: 11px; }
.canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 5px; font-size: 7px; line-height: 1.4; }

@media (max-height: 760px) {
  .canvas-shell.studio-v3.stage-focus .catalog-header { height: 34px; flex-basis: 34px; }
  .canvas-shell.studio-v3.stage-focus .directory-item { padding-top: 4px; padding-bottom: 4px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 26px; height: 26px; margin-bottom: 5px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 13px; height: 13px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin-bottom: 3px; font-size: 10px; }
  .canvas-shell.studio-v3.stage-focus .chat-empty-hints { margin-top: 6px; }
  .canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 30px; }
}

/* v3.8.7：双击文本框只展开节点本身，不缩放整个画布；展开态锁定拖动/连线 */
.canvas-shell.quick-expand-active .canvas-top-dock,
.canvas-shell.quick-expand-active .canvas-zoom-bar,
.canvas-shell.quick-expand-active .canvas-hint,
.canvas-shell.quick-expand-active .canvas-minimap,
.canvas-shell.quick-expand-active .emotion-card,
.canvas-shell.quick-expand-active .emotion-reopen { display: none !important; }
.canvas-shell.quick-expand-active .canvas-world .node:not(.quick-expanded),
.canvas-shell.quick-expand-active .edge-group,
.canvas-shell.quick-expand-active #edge-draft { visibility: hidden !important; }
.canvas-shell.quick-expand-active .canvas-viewport { cursor: default; }
.studio-v3 .node.quick-expanded {
  z-index: 70 !important;
  overflow: hidden;
  border-color: rgba(130,143,255,.44);
  box-shadow: 0 30px 90px rgba(0,0,0,.58), 0 0 0 2px rgba(130,143,255,.16);
}
.studio-v3 .node.quick-expanded .node-body {
  padding: calc(14px * var(--quick-content-scale, 1)) calc(18px * var(--quick-content-scale, 1));
  gap: calc(8px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-head {
  min-height: calc(28px * var(--quick-content-scale, 1));
  margin-bottom: calc(5px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-title-input {
  height: calc(28px * var(--quick-content-scale, 1));
  font-size: calc(15px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-body textarea {
  font-size: calc(14px * var(--quick-content-scale, 1));
  line-height: 1.7;
}
.studio-v3 .node.quick-expanded .node-meta-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: calc(7px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-meta-grid .input,
.studio-v3 .node.quick-expanded .node-body .select {
  padding: calc(7px * var(--quick-content-scale, 1)) calc(9px * var(--quick-content-scale, 1));
  font-size: calc(12px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-focus-corner {
  top: calc(10px * var(--quick-content-scale, 1));
  right: calc(10px * var(--quick-content-scale, 1));
  width: calc(30px * var(--quick-content-scale, 1));
  height: calc(30px * var(--quick-content-scale, 1));
  border-radius: calc(10px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-focus-corner svg {
  width: calc(15px * var(--quick-content-scale, 1));
  height: calc(15px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .port,
.studio-v3 .node.quick-expanded .resize-handle { display: none !important; }
.canvas-shell.quick-expand-active .node.quick-expanded,
.canvas-shell.quick-expand-active .node.quick-expanded .node-head,
.canvas-shell.quick-expand-active .node.quick-expanded .node-body { cursor: default; }
.canvas-shell.quick-expand-active .node.quick-expanded textarea,
.canvas-shell.quick-expand-active .node.quick-expanded input,
.canvas-shell.quick-expand-active .node.quick-expanded select { cursor: text; }

/* v3.8.9：参考大编辑卡重做双击展开态：稳定屏幕字号、填满正文区、干净边框与右上角收起 */
.studio-v3 .node.quick-expanded {
  overflow: visible !important;
  border: 2px solid rgba(238, 240, 246, .76) !important;
  border-radius: calc(26px * var(--quick-content-scale, 1)) !important;
  background: linear-gradient(180deg, rgba(25, 25, 28, .992), rgba(15, 15, 18, .992)) !important;
  box-shadow: 0 34px 96px rgba(0, 0, 0, .68), inset 0 1px 0 rgba(255, 255, 255, .07) !important;
}
.studio-v3 .node.quick-expanded:focus-within {
  border-color: rgba(245, 247, 255, .94) !important;
  box-shadow: 0 38px 104px rgba(0, 0, 0, .72), 0 0 0 3px rgba(126, 140, 255, .13), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
}
.studio-v3 .node.quick-expanded::before {
  content: attr(data-quick-label);
  position: absolute;
  left: calc(3px * var(--quick-content-scale, 1));
  bottom: calc(100% + (13px * var(--quick-content-scale, 1)));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: calc(18px * var(--quick-content-scale, 1));
  padding-left: calc(23px * var(--quick-content-scale, 1));
  color: rgba(174, 181, 198, .82);
  font-size: calc(13px * var(--quick-content-scale, 1));
  font-weight: 560;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeb5c6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='8' y1='6' x2='21' y2='6'/%3E%3Cline x1='8' y1='12' x2='21' y2='12'/%3E%3Cline x1='8' y1='18' x2='21' y2='18'/%3E%3Cline x1='3' y1='6' x2='3.01' y2='6'/%3E%3Cline x1='3' y1='12' x2='3.01' y2='12'/%3E%3Cline x1='3' y1='18' x2='3.01' y2='18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left center;
  background-size: calc(16px * var(--quick-content-scale, 1)) calc(16px * var(--quick-content-scale, 1));
}
.studio-v3 .node.quick-expanded .node-body {
  height: 100%;
  box-sizing: border-box;
  padding: calc(30px * var(--quick-content-scale, 1)) calc(36px * var(--quick-content-scale, 1)) calc(26px * var(--quick-content-scale, 1)) !important;
  gap: calc(14px * var(--quick-content-scale, 1)) !important;
  border-radius: inherit !important;
  background: transparent;
  overflow: hidden;
}
.studio-v3 .node.quick-expanded .node-head {
  flex: 0 0 auto;
  min-height: calc(38px * var(--quick-content-scale, 1)) !important;
  margin: 0 calc(46px * var(--quick-content-scale, 1)) calc(14px * var(--quick-content-scale, 1)) 0 !important;
  gap: calc(10px * var(--quick-content-scale, 1)) !important;
}
.studio-v3 .node.quick-expanded .node-focus-corner { display: none !important; }
.studio-v3 .node.quick-expanded .node-title-input {
  height: calc(38px * var(--quick-content-scale, 1)) !important;
  padding: 0 !important;
  color: #f5f7ff !important;
  font-size: calc(25px * var(--quick-content-scale, 1)) !important;
  font-weight: 760 !important;
  line-height: 1.35 !important;
  letter-spacing: .01em;
  background: transparent !important;
  border-color: transparent !important;
}
.studio-v3 .node.quick-expanded .node-title-input:focus { box-shadow: none !important; }
.studio-v3 .node.quick-expanded .node-body textarea {
  flex: 1 1 0% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  color: #e7ebf8 !important;
  font-size: calc(18px * var(--quick-content-scale, 1)) !important;
  line-height: 1.85 !important;
}
.studio-v3 .node.quick-expanded .node-body textarea::placeholder { color: rgba(151, 161, 184, .62) !important; }
.studio-v3 .node.quick-expanded .node-meta-grid {
  flex: 0 0 auto;
  gap: calc(10px * var(--quick-content-scale, 1)) !important;
}
.studio-v3 .node.quick-expanded .node-meta-grid .input,
.studio-v3 .node.quick-expanded .node-body .select {
  min-height: calc(42px * var(--quick-content-scale, 1));
  box-sizing: border-box;
  padding: calc(10px * var(--quick-content-scale, 1)) calc(13px * var(--quick-content-scale, 1)) !important;
  border-radius: calc(12px * var(--quick-content-scale, 1)) !important;
  border-color: rgba(255, 255, 255, .09) !important;
  background: rgba(255, 255, 255, .055) !important;
  color: #eef2ff !important;
  font-size: calc(15px * var(--quick-content-scale, 1)) !important;
}
.studio-v3 .node-quick-close {
  position: absolute;
  top: calc(16px * var(--quick-content-scale, 1));
  right: calc(18px * var(--quick-content-scale, 1));
  z-index: 9;
  width: calc(34px * var(--quick-content-scale, 1));
  height: calc(34px * var(--quick-content-scale, 1));
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  background: rgba(9, 11, 17, .42);
  color: #dce2f2;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.studio-v3 .node-quick-close svg {
  width: calc(16px * var(--quick-content-scale, 1));
  height: calc(16px * var(--quick-content-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.studio-v3 .node-quick-close:hover { color: #fff; background: rgba(139, 124, 255, .28); transform: translateY(-1px); }
.studio-v3 .node-quick-close:active { transform: translateY(0) scale(.96); }
@media (max-width: 900px) {
  .studio-v3 .node.quick-expanded .node-body { padding: 22px 18px 18px !important; }
  .studio-v3 .node.quick-expanded .node-title-input { font-size: calc(21px * var(--quick-content-scale, 1)) !important; }
  .studio-v3 .node.quick-expanded .node-body textarea { font-size: calc(16px * var(--quick-content-scale, 1)) !important; line-height: 1.75 !important; }
  .studio-v3 .node.quick-expanded::before { display: none; }
}

/* v3.9.0：画布右键新建菜单 */
.canvas-context-menu {
  position: absolute;
  z-index: 320;
  width: 198px;
  box-sizing: border-box;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 15px;
  background: rgba(22, 24, 31, .98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(18px);
  user-select: none;
  animation: canvas-context-in .12s ease-out;
}
.canvas-context-menu.hidden { display: none; }
.canvas-context-item {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d9dfef;
  font-size: 13px;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.canvas-context-item:hover,
.canvas-context-item:focus-visible {
  outline: none;
  color: #fff;
  background: rgba(139, 124, 255, .22);
}
.canvas-context-item.is-primary { color: #fff; font-weight: 680; }
.canvas-context-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  color: #cfd6e8;
  font-size: 12px;
  font-weight: 750;
}
.canvas-context-item.is-primary .canvas-context-icon {
  border-color: transparent;
  background: linear-gradient(135deg, #7886ff, #9b7dff);
  color: #fff;
}
.canvas-context-label { min-width: 0; flex: 1; }
.canvas-context-sep { height: 1px; margin: 6px 7px; background: rgba(255, 255, 255, .09); }
@keyframes canvas-context-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 900px) {
  .canvas-context-menu { width: 186px; }
  .canvas-context-item { height: 40px; }
}

/* v3.9.1：节点右键删除与锚定位置二次确认 */
.canvas-context-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.canvas-context-item.is-danger { color: #ffd7d9; }
.canvas-context-item.is-danger:hover,
.canvas-context-item.is-danger:focus-visible {
  color: #fff;
  background: rgba(229, 72, 77, .24);
}
.canvas-context-item.is-danger .canvas-context-icon {
  color: #ffb4b7;
  border-color: rgba(229, 72, 77, .30);
  background: rgba(229, 72, 77, .13);
}
.canvas-context-item.is-danger:hover .canvas-context-icon,
.canvas-context-item.is-danger:focus-visible .canvas-context-icon {
  color: #fff;
  border-color: rgba(255, 154, 158, .42);
  background: rgba(229, 72, 77, .34);
}

.node-delete-popover {
  position: fixed;
  z-index: 410;
  width: 268px;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid rgba(255, 132, 137, .24);
  border-radius: 15px;
  background: #191b22;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .62), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: node-delete-pop-in .12s ease-out;
}
.node-delete-popover.hidden { display: none; }
.node-delete-popover::before {
  content: "";
  position: absolute;
  left: 24px;
  top: -6px;
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(255, 132, 137, .24);
  border-top: 1px solid rgba(255, 132, 137, .24);
  background: #191b22;
}
.node-delete-popover[data-placement="top"]::before {
  top: auto;
  bottom: -6px;
  border-left: 0;
  border-top: 0;
  border-right: 1px solid rgba(255, 132, 137, .24);
  border-bottom: 1px solid rgba(255, 132, 137, .24);
}
.node-delete-head { display: flex; align-items: flex-start; gap: 10px; }
.node-delete-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  color: #ffb4b7;
  border: 1px solid rgba(229, 72, 77, .30);
  background: rgba(229, 72, 77, .13);
}
.node-delete-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.node-delete-heading { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 1px; }
.node-delete-heading strong { color: #fff; font-size: 13.5px; line-height: 1.35; font-weight: 720; }
.node-delete-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #aeb8cc;
  font-size: 12px;
  line-height: 1.35;
}
.node-delete-warning {
  margin: 10px 0 13px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .052);
  color: #aeb8cc;
  font-size: 11.5px;
  line-height: 1.55;
}
.node-delete-actions { display: flex; justify-content: flex-end; gap: 8px; }
.node-delete-actions button {
  min-height: 31px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .11);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.node-delete-cancel { color: #cfd6e8; background: rgba(255, 255, 255, .055); }
.node-delete-cancel:hover,
.node-delete-cancel:focus-visible { outline: none; color: #fff; background: rgba(255, 255, 255, .10); }
.node-delete-ok { color: #fff; border-color: rgba(229, 72, 77, .46); background: linear-gradient(135deg, #d94b50, #b9343a); }
.node-delete-ok:hover,
.node-delete-ok:focus-visible { outline: none; border-color: rgba(255, 154, 158, .62); background: linear-gradient(135deg, #e4565c, #c63a41); }
@keyframes node-delete-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 900px) {
  .node-delete-popover { width: min(268px, calc(100vw - 16px)); }
}

/* v3.9.2：外壳面板字号统一。
   画布世界 #world 的 scale 只负责节点/连线；目录、Agent、浮层等独立框体始终使用稳定的屏幕字号。
   专注舞台只保留略紧凑的间距，不再使用 v3.8.6 的 7.5–9.5px 超压缩字号。 */
.canvas-shell.studio-v3 {
  --shell-title-size: 16px;
  --shell-directory-size: 14px;
  --shell-item-size: 13px;
  --shell-body-size: 12.5px;
  --shell-small-size: 10.5px;
}
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 232px; --right-w: 360px; }
}
@media (min-width: 901px) and (max-width: 1366px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 218px; --right-w: 336px; }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 206px; --right-w: 306px; }
}

/* 左侧目录：普通画布与专注舞台使用同一套可读字号 */
.canvas-shell.studio-v3 .catalog-header,
.canvas-shell.studio-v3.stage-focus .catalog-header {
  height: 58px;
  flex-basis: 58px;
  padding: 0 15px;
}
.canvas-shell.studio-v3 .catalog-title,
.canvas-shell.studio-v3.stage-focus .catalog-title {
  font-size: var(--shell-title-size);
  font-weight: 760;
  letter-spacing: -.015em;
  line-height: 1.25;
}
.canvas-shell.studio-v3 .panel-header-actions .icon-action,
.canvas-shell.studio-v3.stage-focus .panel-header-actions .icon-action {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.canvas-shell.studio-v3 .panel-header-actions .icon-action svg,
.canvas-shell.studio-v3.stage-focus .panel-header-actions .icon-action svg {
  width: 16px;
  height: 16px;
}
.canvas-shell.studio-v3 .work-switcher,
.canvas-shell.studio-v3.stage-focus .work-switcher {
  gap: 7px;
  padding: 0 13px 9px;
}
.canvas-shell.studio-v3 .work-switcher-title,
.canvas-shell.studio-v3.stage-focus .work-switcher-title {
  padding: 5px 7px;
  font-size: 12.5px;
  line-height: 1.35;
}
.canvas-shell.studio-v3 .save-state,
.canvas-shell.studio-v3.stage-focus .save-state { font-size: 10.5px; }
.canvas-shell.studio-v3 .panel-search,
.canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 13px 9px; }
.canvas-shell.studio-v3 .panel-search .input,
.canvas-shell.studio-v3.stage-focus .panel-search .input {
  height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12.5px;
}
.canvas-shell.studio-v3 .directory-list,
.canvas-shell.studio-v3.stage-focus .directory-list {
  padding: 2px 9px 12px;
  gap: 4px;
}
.canvas-shell.studio-v3 .directory-item,
.canvas-shell.studio-v3.stage-focus .directory-item {
  grid-template-columns: 16px minmax(0, 1fr) 28px;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
}
.canvas-shell.studio-v3 .directory-name,
.canvas-shell.studio-v3.stage-focus .directory-name {
  gap: 8px;
  font-size: var(--shell-directory-size);
  font-weight: 650;
  line-height: 1.35;
}
.canvas-shell.studio-v3 .type-dot,
.canvas-shell.studio-v3.stage-focus .type-dot { width: 12px; height: 12px; border-radius: 4px; }
.canvas-shell.studio-v3 .directory-action-btn,
.canvas-shell.studio-v3.stage-focus .directory-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.canvas-shell.studio-v3 .directory-action-btn svg,
.canvas-shell.studio-v3.stage-focus .directory-action-btn svg { width: 14px; height: 14px; }
/* 操作组的透明渐变区域不能盖住目录名称点击热区，只有具体按钮接收指针事件 */
.canvas-shell.studio-v3 .directory-actions,
.canvas-shell.studio-v3.stage-focus .directory-actions { pointer-events: none !important; }
.canvas-shell.studio-v3 .directory-actions .directory-action-btn,
.canvas-shell.studio-v3.stage-focus .directory-actions .directory-action-btn { pointer-events: auto !important; }
.canvas-shell.studio-v3 .catalog-footer,
.canvas-shell.studio-v3.stage-focus .catalog-footer {
  padding: 10px 14px 12px;
  gap: 8px;
  font-size: var(--shell-small-size);
  line-height: 1.45;
}
.canvas-shell.studio-v3 .catalog-footer-dot,
.canvas-shell.studio-v3.stage-focus .catalog-footer-dot { width: 7px; height: 7px; }

/* 右侧 Agent：降低空状态和会话标题的“放大老年界面”感，保持与左栏同一阶差 */
.canvas-shell.studio-v3 .studio-chat-header,
.canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 12px 15px 10px; gap: 9px; }
.canvas-shell.studio-v3 .chat-conv-switch,
.canvas-shell.studio-v3.stage-focus .chat-conv-switch {
  gap: 6px;
  padding: 5px 6px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 720;
  line-height: 1.35;
}
.canvas-shell.studio-v3 .new-chat-btn,
.canvas-shell.studio-v3.stage-focus .new-chat-btn {
  height: 32px;
  gap: 6px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}
.canvas-shell.studio-v3 .chat-header-actions .icon-action,
.canvas-shell.studio-v3.stage-focus .chat-header-actions .icon-action { width: 29px; height: 29px; }
.canvas-shell.studio-v3 .studio-chat-header .chat-model-row .select,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select {
  height: 33px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.canvas-shell.studio-v3 .chat-messages,
.canvas-shell.studio-v3.stage-focus .chat-messages { padding: 17px 16px 12px; gap: 13px; }
.canvas-shell.studio-v3 .message-bubble,
.canvas-shell.studio-v3.stage-focus .message-bubble { font-size: var(--shell-item-size); line-height: 1.68; }
.canvas-shell.studio-v3 .chat-empty,
.canvas-shell.studio-v3.stage-focus .chat-empty { padding: 16px 12px 26px; }
.canvas-shell.studio-v3 .chat-empty-icon,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 17px;
}
.canvas-shell.studio-v3 .chat-empty-icon svg,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 25px; height: 25px; }
.canvas-shell.studio-v3 .chat-empty h3,
.canvas-shell.studio-v3.stage-focus .chat-empty h3 {
  margin: 0 0 8px;
  font-size: var(--shell-title-size);
  font-weight: 760;
  letter-spacing: -.015em;
  line-height: 1.3;
}
.canvas-shell.studio-v3 .chat-empty p,
.canvas-shell.studio-v3.stage-focus .chat-empty p {
  max-width: 330px;
  margin: 0 auto;
  font-size: var(--shell-body-size);
  line-height: 1.7;
}
.canvas-shell.studio-v3 .chat-empty-hints,
.canvas-shell.studio-v3.stage-focus .chat-empty-hints { gap: 7px; margin-top: 15px; }
.canvas-shell.studio-v3 .chat-empty-hints span,
.canvas-shell.studio-v3.stage-focus .chat-empty-hints span { padding: 5px 9px; font-size: 10.5px; }
.canvas-shell.studio-v3 .chat-quick,
.canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 15px 8px; gap: 7px; }
.canvas-shell.studio-v3 .quick-chip,
.canvas-shell.studio-v3.stage-focus .quick-chip { padding: 6px 10px; font-size: 11.5px; }
.canvas-shell.studio-v3 .chat-input-area,
.canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 10px 15px 13px; }
.canvas-shell.studio-v3 .chat-composer-card,
.canvas-shell.studio-v3.stage-focus .chat-composer-card { padding: 12px 13px 10px; border-radius: 17px; }
.canvas-shell.studio-v3 .chat-composer-card .chat-input,
.canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input {
  min-height: 62px;
  font-size: 13px;
  line-height: 1.62;
}
.canvas-shell.studio-v3 .chat-composer-bar,
.canvas-shell.studio-v3.stage-focus .chat-composer-bar { gap: 8px; margin-top: 8px; }
.canvas-shell.studio-v3 .composer-icon,
.canvas-shell.studio-v3.stage-focus .composer-icon { width: 32px; height: 32px; }
.canvas-shell.studio-v3 .composer-icon svg,
.canvas-shell.studio-v3.stage-focus .composer-icon svg { width: 17px; height: 17px; }
.canvas-shell.studio-v3 .composer-send,
.canvas-shell.studio-v3.stage-focus .composer-send { width: 40px; height: 40px; }
.canvas-shell.studio-v3 .composer-send svg,
.canvas-shell.studio-v3.stage-focus .composer-send svg { width: 18px; height: 18px; }
.canvas-shell.studio-v3 .chat-consent,
.canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 8px; font-size: 10.5px; line-height: 1.5; }

/* 专注舞台中间的节点仍属于画布编辑层；恢复到舒适编辑字号，避免被历史高密度规则压成小字 */
.canvas-shell.studio-v3.stage-focus .node.focused .node-body { padding: 16px 22px 18px; gap: 7px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-head { min-height: 34px; margin-bottom: 8px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-title-input { height: 32px; font-size: 17px; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-body textarea { font-size: 14.5px; line-height: 1.76; }
.canvas-shell.studio-v3.stage-focus .node.focused .node-meta-grid .input,
.canvas-shell.studio-v3.stage-focus .node.focused .node-body .select { padding: 7px 10px; font-size: 12px; }

@media (max-width: 900px) {
  .canvas-shell.studio-v3 .catalog-header,
  .canvas-shell.studio-v3.stage-focus .catalog-header { height: 54px; flex-basis: 54px; }
  .canvas-shell.studio-v3 .directory-item,
  .canvas-shell.studio-v3.stage-focus .directory-item { padding: 9px; }
  .canvas-shell.studio-v3 .chat-messages,
  .canvas-shell.studio-v3.stage-focus .chat-messages { padding: 14px 12px 10px; }
  .canvas-shell.studio-v3 .chat-input-area,
  .canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 9px 12px 12px; }
}

/* v3.9.3：外壳最终统一层。
   五号字按 Windows/浏览器标准换算为 10.5pt = 14px；目录、Agent、浮层、菜单和设置弹窗不再使用多套字号。
   专注舞台只切换中间画布节点编辑态，左右外壳继续使用普通画布的展开尺寸，避免再出现“另一套缩小界面”。 */
.canvas-shell.studio-v3 {
  --shell-font-base: 14px;
  --left-w: 272px;
  --right-w: 432px;
}
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus {
    --left-w: 272px !important;
    --right-w: 432px !important;
  }
}
@media (min-width: 901px) and (max-width: 1366px) {
  .canvas-shell.studio-v3.stage-focus {
    --left-w: 272px !important;
    --right-w: 432px !important;
  }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3.stage-focus {
    --left-w: 272px !important;
    --right-w: 432px !important;
  }
}

.canvas-shell.studio-v3 .left-panel,
.canvas-shell.studio-v3 .right-panel,
.canvas-shell.studio-v3 .canvas-top-dock,
.canvas-shell.studio-v3 .canvas-zoom-bar,
.canvas-shell.studio-v3 .canvas-minimap,
.canvas-shell.studio-v3 .edge-editor,
.canvas-shell.studio-v3 .emotion-card,
.canvas-shell.studio-v3 .emotion-reopen,
.canvas-shell.studio-v3 .canvas-context-menu,
.node-delete-popover,
#modal-root .modal,
#toast-root .toast {
  font-size: 14px;
}
.canvas-shell.studio-v3 .left-panel *,
.canvas-shell.studio-v3 .right-panel *,
.canvas-shell.studio-v3 .canvas-top-dock *,
.canvas-shell.studio-v3 .canvas-zoom-bar *,
.canvas-shell.studio-v3 .canvas-minimap,
.canvas-shell.studio-v3 .edge-editor *,
.canvas-shell.studio-v3 .emotion-card *,
.canvas-shell.studio-v3 .emotion-reopen,
.canvas-shell.studio-v3 .canvas-context-menu *,
.node-delete-popover *,
#modal-root .modal *,
#toast-root .toast,
#toast-root .toast * {
  font-size: 14px !important;
}

/* 左侧目录：普通态与专注态完全同尺寸 */
.canvas-shell.studio-v3 .catalog-header,
.canvas-shell.studio-v3.stage-focus .catalog-header {
  height: 64px !important;
  flex: 0 0 64px !important;
  padding: 0 16px !important;
}
.canvas-shell.studio-v3 .catalog-title,
.canvas-shell.studio-v3.stage-focus .catalog-title {
  line-height: 1.3 !important;
  font-weight: 760 !important;
}
.canvas-shell.studio-v3 .work-switcher,
.canvas-shell.studio-v3.stage-focus .work-switcher {
  gap: 7px !important;
  padding: 0 13px 10px !important;
}
.canvas-shell.studio-v3 .work-switcher-title,
.canvas-shell.studio-v3.stage-focus .work-switcher-title {
  padding: 5px 7px !important;
  line-height: 1.35 !important;
}
.canvas-shell.studio-v3 .panel-search,
.canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 14px 10px !important; }
.canvas-shell.studio-v3 .panel-search .input,
.canvas-shell.studio-v3.stage-focus .panel-search .input {
  height: 34px !important;
  padding: 7px 11px !important;
  border-radius: 10px !important;
}
.canvas-shell.studio-v3 .directory-list,
.canvas-shell.studio-v3.stage-focus .directory-list {
  padding: 3px 10px 12px !important;
  gap: 4px !important;
}
.canvas-shell.studio-v3 .directory-item,
.canvas-shell.studio-v3.stage-focus .directory-item {
  grid-template-columns: 18px minmax(0, 1fr) 28px !important;
  gap: 8px !important;
  padding: 10px !important;
  border-radius: 12px !important;
}
.canvas-shell.studio-v3 .directory-name,
.canvas-shell.studio-v3.stage-focus .directory-name {
  gap: 8px !important;
  line-height: 1.35 !important;
  font-weight: 650 !important;
}
.canvas-shell.studio-v3 .type-dot,
.canvas-shell.studio-v3.stage-focus .type-dot { width: 13px !important; height: 13px !important; border-radius: 4px !important; }
.canvas-shell.studio-v3 .directory-action-btn,
.canvas-shell.studio-v3.stage-focus .directory-action-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 8px !important;
}
.canvas-shell.studio-v3 .directory-action-btn svg,
.canvas-shell.studio-v3.stage-focus .directory-action-btn svg { width: 14px !important; height: 14px !important; }
.canvas-shell.studio-v3 .catalog-footer,
.canvas-shell.studio-v3.stage-focus .catalog-footer {
  padding: 11px 16px 14px !important;
  gap: 8px !important;
  line-height: 1.45 !important;
}

/* 右侧 Agent：普通态与专注态统一为舒展的桌面对话框尺寸 */
.canvas-shell.studio-v3 .studio-chat-header,
.canvas-shell.studio-v3.stage-focus .studio-chat-header {
  padding: 14px 16px 11px !important;
  gap: 11px !important;
}
.canvas-shell.studio-v3 .chat-header-top,
.canvas-shell.studio-v3.stage-focus .chat-header-top { gap: 9px !important; }
.canvas-shell.studio-v3 .chat-conv-switch,
.canvas-shell.studio-v3.stage-focus .chat-conv-switch {
  gap: 5px !important;
  padding: 6px 7px !important;
  border-radius: 9px !important;
  line-height: 1.35 !important;
}
.canvas-shell.studio-v3 .chat-conv-switch svg,
.canvas-shell.studio-v3.stage-focus .chat-conv-switch svg { width: 15px !important; height: 15px !important; }
.canvas-shell.studio-v3 .new-chat-btn,
.canvas-shell.studio-v3.stage-focus .new-chat-btn {
  height: 34px !important;
  gap: 6px !important;
  padding: 0 13px !important;
  border-radius: 11px !important;
}
.canvas-shell.studio-v3 .new-chat-btn svg,
.canvas-shell.studio-v3.stage-focus .new-chat-btn svg { width: 15px !important; height: 15px !important; }
.canvas-shell.studio-v3 .studio-chat-header .icon-action,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .icon-action {
  width: 32px !important;
  height: 32px !important;
}
.canvas-shell.studio-v3 .studio-chat-header .icon-action svg,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .icon-action svg { width: 16px !important; height: 16px !important; }
.canvas-shell.studio-v3 .studio-chat-header .chat-model-row,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row {
  grid-template-columns: minmax(0, 1fr) 34px !important;
  gap: 8px !important;
}
.canvas-shell.studio-v3 .studio-chat-header .chat-model-row .select,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select {
  height: 34px !important;
  padding: 7px 10px !important;
  border-radius: 10px !important;
}
.canvas-shell.studio-v3 .chat-messages,
.canvas-shell.studio-v3.stage-focus .chat-messages {
  padding: 20px 18px 14px !important;
  gap: 14px !important;
}
.canvas-shell.studio-v3 .message-bubble,
.canvas-shell.studio-v3.stage-focus .message-bubble { line-height: 1.68 !important; }
.canvas-shell.studio-v3 .chat-empty,
.canvas-shell.studio-v3.stage-focus .chat-empty { padding: 20px 14px 34px !important; }
.canvas-shell.studio-v3 .chat-empty-icon,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon {
  width: 58px !important;
  height: 58px !important;
  margin: 0 auto 16px !important;
  border-radius: 18px !important;
}
.canvas-shell.studio-v3 .chat-empty-icon svg,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 28px !important; height: 28px !important; }
.canvas-shell.studio-v3 .chat-empty h3,
.canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin: 0 0 9px !important; line-height: 1.35 !important; font-weight: 760 !important; }
.canvas-shell.studio-v3 .chat-empty p,
.canvas-shell.studio-v3.stage-focus .chat-empty p { max-width: 330px !important; line-height: 1.75 !important; }
.canvas-shell.studio-v3 .chat-empty-hints,
.canvas-shell.studio-v3.stage-focus .chat-empty-hints { gap: 7px !important; margin-top: 18px !important; }
.canvas-shell.studio-v3 .chat-empty-hints span,
.canvas-shell.studio-v3.stage-focus .chat-empty-hints span { padding: 5px 9px !important; }
.canvas-shell.studio-v3 .chat-quick,
.canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 16px 8px !important; gap: 7px !important; }
.canvas-shell.studio-v3 .quick-chip,
.canvas-shell.studio-v3.stage-focus .quick-chip { padding: 6px 10px !important; }
.canvas-shell.studio-v3 .chat-input-area,
.canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 12px 16px 14px !important; gap: 8px !important; }
.canvas-shell.studio-v3 .chat-composer-card,
.canvas-shell.studio-v3.stage-focus .chat-composer-card {
  padding: 13px 14px 11px !important;
  border-radius: 18px !important;
}
.canvas-shell.studio-v3 .chat-composer-card .chat-input,
.canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input {
  min-height: 68px !important;
  line-height: 1.65 !important;
}
.canvas-shell.studio-v3 .chat-composer-bar,
.canvas-shell.studio-v3.stage-focus .chat-composer-bar { gap: 8px !important; margin-top: 9px !important; }
.canvas-shell.studio-v3 .composer-icon,
.canvas-shell.studio-v3.stage-focus .composer-icon { width: 34px !important; height: 34px !important; }
.canvas-shell.studio-v3 .composer-icon svg,
.canvas-shell.studio-v3.stage-focus .composer-icon svg { width: 18px !important; height: 18px !important; }
.canvas-shell.studio-v3 .composer-send,
.canvas-shell.studio-v3.stage-focus .composer-send { width: 42px !important; height: 42px !important; }
.canvas-shell.studio-v3 .composer-send svg,
.canvas-shell.studio-v3.stage-focus .composer-send svg { width: 19px !important; height: 19px !important; }
.canvas-shell.studio-v3 .chat-consent,
.canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 9px !important; line-height: 1.5 !important; }

@media (max-width: 900px) {
  .canvas-shell.studio-v3 .catalog-header,
  .canvas-shell.studio-v3.stage-focus .catalog-header { height: 56px !important; flex-basis: 56px !important; padding: 0 14px !important; }
  .canvas-shell.studio-v3 .studio-chat-header,
  .canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 12px 14px 10px !important; }
  .canvas-shell.studio-v3 .chat-messages,
  .canvas-shell.studio-v3.stage-focus .chat-messages { padding: 16px 14px 12px !important; }
  .canvas-shell.studio-v3 .chat-input-area,
  .canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 10px 12px 12px !important; }
  .canvas-shell.studio-v3 .chat-composer-card .chat-input,
  .canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 56px !important; }
}

/* v3.9.4：按用户 3120×1716 参考图校准。
   参考图在 Windows 200% 缩放下对应 1560×858 CSS 视口：左栏约 246px、右栏约 529px，
   外壳采用浮动圆角三栏；#world 内节点仍随画布缩放，不使用这里的外壳字号。 */
.canvas-shell.studio-v3 {
  --shell-edge: 15px;
  --shell-gap: 12px;
  --left-w: clamp(220px, 15.8vw, 247px);
  --right-w: clamp(360px, 33.9vw, 529px);
  --left-space: calc(var(--left-w) + var(--shell-gap));
  --right-space: calc(var(--right-w) + var(--shell-gap));
  --shell-font-base: 13.5px;
  background: #26282d !important;
}
.canvas-shell.studio-v3.left-collapsed { --left-space: 0px; }
.canvas-shell.studio-v3.right-collapsed { --right-space: 0px; }
@media (min-width: 901px) and (max-width: 1180px) {
  .canvas-shell.studio-v3 {
    --shell-edge: 11px;
    --shell-gap: 9px;
    --left-w: 214px;
    --right-w: 348px;
  }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3 { --left-w: 202px; --right-w: 318px; }
}
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus {
    --left-w: clamp(220px, 15.8vw, 247px) !important;
    --right-w: clamp(360px, 33.9vw, 529px) !important;
  }
}
@media (min-width: 901px) and (max-width: 1180px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 214px !important; --right-w: 348px !important; }
}
@media (min-width: 901px) and (max-width: 1024px) {
  .canvas-shell.studio-v3.stage-focus { --left-w: 202px !important; --right-w: 318px !important; }
}

/* 浮动圆角外壳：画布视口本身成为中间卡片，坐标换算继续使用 #viewport 的真实 rect。 */
.canvas-shell.studio-v3 .canvas-body { background: #26282d !important; }
.canvas-shell.studio-v3 .left-panel,
.canvas-shell.studio-v3 .right-panel {
  top: var(--shell-edge) !important;
  bottom: var(--shell-edge) !important;
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,.065) !important;
  background: #1c1e23 !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.30) !important;
}
.canvas-shell.studio-v3 .left-panel {
  left: var(--shell-edge) !important;
  width: var(--left-w) !important;
}
.canvas-shell.studio-v3 .right-panel {
  right: var(--shell-edge) !important;
  width: var(--right-w) !important;
}
.canvas-shell.studio-v3 .panel-inner,
.canvas-shell.studio-v3 .chat-panel { background: transparent !important; }
.canvas-shell.studio-v3.left-collapsed .left-panel {
  transform: translateX(calc(-100% - var(--shell-edge) - 14px)) !important;
  box-shadow: none !important;
}
.canvas-shell.studio-v3.right-collapsed .right-panel {
  transform: translateX(calc(100% + var(--shell-edge) + 14px)) !important;
  box-shadow: none !important;
}
.canvas-shell.studio-v3 .canvas-viewport {
  inset: auto !important;
  top: var(--shell-edge) !important;
  bottom: var(--shell-edge) !important;
  left: calc(var(--shell-edge) + var(--left-space)) !important;
  right: calc(var(--shell-edge) + var(--right-space)) !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 18px !important;
  border: 1px solid rgba(126,140,190,.20) !important;
  background-color: #292c35 !important;
  background-image: radial-gradient(circle, rgba(255,255,255,.060) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.018), 0 18px 50px rgba(0,0,0,.24) !important;
  transition: left .22s cubic-bezier(.22,.8,.28,1), right .22s cubic-bezier(.22,.8,.28,1), border-radius .2s ease;
}
.canvas-shell.studio-v3 .canvas-top-dock {
  left: 50% !important;
  max-width: calc(100% - 28px) !important;
}
.canvas-shell.studio-v3 .canvas-zoom-bar { right: 18px !important; bottom: 18px !important; }
.canvas-shell.studio-v3 .emotion-reopen { left: 18px !important; bottom: 18px !important; }
.canvas-shell.studio-v3 .emotion-card { left: 18px !important; bottom: 18px !important; }

/* 专注舞台中间节点贴合中间卡片；左右外壳仍保持普通态尺寸。 */
.canvas-shell.studio-v3.stage-focus .canvas-viewport { background-color: #30333a !important; }
.canvas-shell.studio-v3.stage-focus .node.focused {
  border-radius: 16px !important;
  border: 1px solid rgba(103,124,220,.58) !important;
  background: #30333a !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.030), 0 24px 70px rgba(0,0,0,.28) !important;
}
.canvas-shell.studio-v3.stage-focus .node.focused .node-body {
  padding: 22px 28px 26px !important;
  background: #30333a !important;
}

/* 先解除 v3.9.3 对所有外壳后代强制 14px；再按参考图恢复清晰层级。 */
.canvas-shell.studio-v3 .left-panel *,
.canvas-shell.studio-v3 .right-panel *,
.canvas-shell.studio-v3 .canvas-top-dock *,
.canvas-shell.studio-v3 .canvas-zoom-bar *,
.canvas-shell.studio-v3 .canvas-minimap,
.canvas-shell.studio-v3 .edge-editor *,
.canvas-shell.studio-v3 .emotion-card *,
.canvas-shell.studio-v3 .emotion-reopen,
.canvas-shell.studio-v3 .canvas-context-menu *,
.node-delete-popover *,
#modal-root .modal *,
#toast-root .toast,
#toast-root .toast * { font-size: inherit !important; }
.canvas-shell.studio-v3 .left-panel { font-size: 14px !important; }
.canvas-shell.studio-v3 .right-panel { font-size: 13.5px !important; }
.canvas-shell.studio-v3 .canvas-top-dock,
.canvas-shell.studio-v3 .canvas-zoom-bar,
.canvas-shell.studio-v3 .edge-editor,
.canvas-shell.studio-v3 .emotion-card,
.canvas-shell.studio-v3 .canvas-context-menu,
.node-delete-popover,
#modal-root .modal,
#toast-root .toast { font-size: 13.5px !important; }
.canvas-shell.studio-v3 .canvas-minimap,
.canvas-shell.studio-v3 .emotion-reopen { font-size: 12px !important; }

/* 左侧目录：参考图中目录是左栏主视觉，使用 15–17px 的稳定桌面字号。 */
.canvas-shell.studio-v3 .catalog-header,
.canvas-shell.studio-v3.stage-focus .catalog-header {
  height: 58px !important;
  flex: 0 0 58px !important;
  padding: 0 16px !important;
}
.canvas-shell.studio-v3 .catalog-title,
.canvas-shell.studio-v3.stage-focus .catalog-title { font-size: 17px !important; font-weight: 760 !important; }
.canvas-shell.studio-v3 .work-switcher,
.canvas-shell.studio-v3.stage-focus .work-switcher { gap: 7px !important; padding: 0 13px 8px !important; }
.canvas-shell.studio-v3 .work-switcher-title,
.canvas-shell.studio-v3.stage-focus .work-switcher-title { font-size: 12.5px !important; line-height: 1.35 !important; }
.canvas-shell.studio-v3 .save-state,
.canvas-shell.studio-v3.stage-focus .save-state { font-size: 11px !important; }
.canvas-shell.studio-v3 .panel-search,
.canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 13px 9px !important; }
.canvas-shell.studio-v3 .panel-search .input,
.canvas-shell.studio-v3.stage-focus .panel-search .input {
  height: 32px !important;
  font-size: 12.5px !important;
  border-radius: 10px !important;
}
.canvas-shell.studio-v3 .directory-list,
.canvas-shell.studio-v3.stage-focus .directory-list { padding: 2px 9px 12px !important; gap: 4px !important; }
.canvas-shell.studio-v3 .directory-item,
.canvas-shell.studio-v3.stage-focus .directory-item {
  min-height: 40px !important;
  grid-template-columns: 16px minmax(0, 1fr) 28px !important;
  gap: 8px !important;
  padding: 8px 9px !important;
  border-radius: 12px !important;
}
.canvas-shell.studio-v3 .directory-name,
.canvas-shell.studio-v3.stage-focus .directory-name { font-size: 15px !important; line-height: 1.38 !important; font-weight: 650 !important; }
.canvas-shell.studio-v3 .catalog-footer,
.canvas-shell.studio-v3.stage-focus .catalog-footer {
  padding: 10px 15px 12px !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
}

/* 右侧 Agent：宽栏承载对话；标题/正文/输入框按参考图形成 12–15px 层级。 */
.canvas-shell.studio-v3 .studio-chat-header,
.canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 12px 18px 11px !important; gap: 9px !important; }
.canvas-shell.studio-v3 .chat-conv-switch,
.canvas-shell.studio-v3.stage-focus .chat-conv-switch { font-size: 14.5px !important; font-weight: 720 !important; }
.canvas-shell.studio-v3 .new-chat-btn,
.canvas-shell.studio-v3.stage-focus .new-chat-btn { height: 34px !important; padding: 0 13px !important; font-size: 13px !important; border-radius: 11px !important; }
.canvas-shell.studio-v3 .studio-chat-header .chat-model-row,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row { margin-top: 9px !important; }
.canvas-shell.studio-v3 .studio-chat-header .chat-model-row .select,
.canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select { height: 33px !important; font-size: 12.5px !important; border-radius: 10px !important; }
.canvas-shell.studio-v3 .chat-messages,
.canvas-shell.studio-v3.stage-focus .chat-messages { padding: 16px 20px 12px !important; gap: 13px !important; }
.canvas-shell.studio-v3 .message-bubble,
.canvas-shell.studio-v3.stage-focus .message-bubble { font-size: 13.5px !important; line-height: 1.70 !important; }
.canvas-shell.studio-v3 .chat-empty,
.canvas-shell.studio-v3.stage-focus .chat-empty { padding: 18px 16px 24px !important; }
.canvas-shell.studio-v3 .chat-empty-icon,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 54px !important; height: 54px !important; margin-bottom: 14px !important; }
.canvas-shell.studio-v3 .chat-empty-icon svg,
.canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 26px !important; height: 26px !important; }
.canvas-shell.studio-v3 .chat-empty h3,
.canvas-shell.studio-v3.stage-focus .chat-empty h3 { margin-bottom: 8px !important; font-size: 16px !important; }
.canvas-shell.studio-v3 .chat-empty p,
.canvas-shell.studio-v3.stage-focus .chat-empty p { max-width: 440px !important; font-size: 13px !important; line-height: 1.72 !important; }
.canvas-shell.studio-v3 .chat-empty-hints span,
.canvas-shell.studio-v3.stage-focus .chat-empty-hints span { font-size: 12px !important; }
.canvas-shell.studio-v3 .chat-quick,
.canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 18px 9px !important; gap: 7px !important; }
.canvas-shell.studio-v3 .quick-chip,
.canvas-shell.studio-v3.stage-focus .quick-chip { padding: 6px 11px !important; font-size: 12px !important; }
.canvas-shell.studio-v3 .chat-input-area,
.canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 10px 18px 14px !important; gap: 8px !important; }
.canvas-shell.studio-v3 .chat-composer-card,
.canvas-shell.studio-v3.stage-focus .chat-composer-card { padding: 13px 15px 11px !important; border-radius: 18px !important; }
.canvas-shell.studio-v3 .chat-composer-card .chat-input,
.canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 64px !important; font-size: 15px !important; line-height: 1.62 !important; }
.canvas-shell.studio-v3 .chat-consent,
.canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 8px !important; font-size: 11px !important; line-height: 1.5 !important; }

/* 顶部画布工具与浮层控件保持紧凑，不跟随目录/输入框放大。 */
.canvas-shell.studio-v3 .canvas-top-dock .top-create-btn { font-size: 12px !important; }
.canvas-shell.studio-v3 .canvas-zoom-bar,
.canvas-shell.studio-v3 .canvas-zoom-bar .zoom-label,
.canvas-shell.studio-v3 .canvas-zoom-bar .zoom-fit-btn { font-size: 12px !important; }
.canvas-shell.studio-v3 .emotion-card .emotion-head strong { font-size: 14px !important; }
.canvas-shell.studio-v3 .emotion-analyze-btn,
.canvas-shell.studio-v3 .emotion-reopen { font-size: 12px !important; }
.canvas-shell.studio-v3 .canvas-context-menu button,
.node-delete-popover { font-size: 13.5px !important; }
.node-delete-popover .confirm-title { font-size: 14px !important; font-weight: 720 !important; }
.node-delete-popover .confirm-text,
.node-delete-popover .confirm-cancel,
.node-delete-popover .confirm-delete { font-size: 12.5px !important; }

@media (max-width: 900px) {
  .canvas-shell.studio-v3 {
    --shell-edge: 0px;
    --shell-gap: 0px;
    --left-space: 0px;
    --right-space: 0px;
    --left-w: min(86vw, 340px) !important;
    --right-w: min(86vw, 340px) !important;
  }
  .canvas-shell.studio-v3 .left-panel,
  .canvas-shell.studio-v3 .right-panel { top: 0 !important; bottom: 0 !important; border-radius: 0 !important; border-width: 0 !important; }
  .canvas-shell.studio-v3 .left-panel { left: 0 !important; }
  .canvas-shell.studio-v3 .right-panel { right: 0 !important; }
  .canvas-shell.studio-v3 .canvas-viewport { inset: 0 !important; top: 0 !important; bottom: 0 !important; left: 0 !important; right: 0 !important; border-radius: 0 !important; border: 0 !important; }
  .canvas-shell.studio-v3.left-collapsed .left-panel { transform: translateX(-105%) !important; }
  .canvas-shell.studio-v3.right-collapsed .right-panel { transform: translateX(105%) !important; }
  .canvas-shell.studio-v3 .canvas-top-dock { left: 58px !important; right: 58px !important; max-width: none !important; }
  .canvas-shell.studio-v3 .canvas-zoom-bar { right: 14px !important; bottom: 14px !important; }
  .canvas-shell.studio-v3 .emotion-reopen,
  .canvas-shell.studio-v3 .emotion-card { left: 14px !important; bottom: 14px !important; }
  .canvas-shell.studio-v3.stage-focus .node.focused { border-radius: 0 !important; }
}

/* v3.9.5：高 DPR + 浏览器缩放叠加补偿。
   用户 Windows 200% 系统缩放再叠加浏览器 Ctrl + 缩放时，CSS px 会被物理放大；
   该模式只在 901–1366 CSS px 且 resolution≥2.25dppx 时由 JS 加 body class。 */
#zoom-scale-hint {
  position: fixed; left: 224px; bottom: 60px; transform: none;
  z-index: 9600; display: flex; align-items: center; gap: 12px;
  max-width: min(560px, calc(100vw - 670px)); padding: 9px 10px 9px 14px;
  border-radius: 13px; background: rgba(28,30,35,.97);
  border: 1px solid rgba(255,255,255,.11); box-shadow: 0 14px 38px rgba(0,0,0,.36);
  color: #dfe3ee; font-size: 12px; line-height: 1.55;
}
#zoom-scale-hint b { color: #fff; font-weight: 750; }
#zoom-scale-hint .zoom-scale-hint-close {
  flex: 0 0 auto; height: 28px; padding: 0 12px; border: 0; border-radius: 9px;
  color: #eef1f8; background: #3a4157; font-size: 12px; cursor: pointer;
}
body.shell-high-scale-compact #zoom-scale-hint { font-size: 10.5px; }
body.shell-high-scale-compact #zoom-scale-hint .zoom-scale-hint-close { height: 25px; font-size: 10.5px; }
body.shell-high-scale-compact .canvas-shell.studio-v3,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus {
  --shell-edge: 12px !important;
  --shell-gap: 10px !important;
  --left-w: 197px !important;
  --right-w: 423px !important;
  --shell-font-base: 12.5px;
}
body.shell-high-scale-compact .canvas-shell.studio-v3 .left-panel,
body.shell-high-scale-compact .canvas-shell.studio-v3 .right-panel {
  top: var(--shell-edge) !important; bottom: var(--shell-edge) !important; border-radius: 16px !important;
}
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-viewport {
  top: var(--shell-edge) !important; bottom: var(--shell-edge) !important; border-radius: 16px !important;
}
body.shell-high-scale-compact .canvas-shell.studio-v3 .catalog-header,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .catalog-header {
  height: 48px !important; flex-basis: 48px !important; padding: 0 13px !important;
}
body.shell-high-scale-compact .canvas-shell.studio-v3 .catalog-title,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .catalog-title { font-size: 13.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .work-switcher,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .work-switcher { gap: 6px !important; padding: 0 11px 7px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .work-switcher-title,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .work-switcher-title { font-size: 10.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .save-state,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .save-state { font-size: 9.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .panel-search,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .panel-search { padding: 0 11px 8px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .panel-search .input,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .panel-search .input { height: 29px !important; font-size: 10.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .directory-list,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .directory-list { padding: 1px 8px 9px !important; gap: 3px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .directory-item,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .directory-item {
  min-height: 34px !important; grid-template-columns: 14px minmax(0,1fr) 25px !important;
  gap: 7px !important; padding: 6px 8px !important; border-radius: 10px !important;
}
body.shell-high-scale-compact .canvas-shell.studio-v3 .directory-name,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .directory-name { font-size: 12px !important; line-height: 1.35 !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .catalog-footer,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .catalog-footer { padding: 8px 12px 10px !important; font-size: 9.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .studio-chat-header,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .studio-chat-header { padding: 10px 14px 9px !important; gap: 8px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-conv-switch,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-conv-switch { font-size: 11.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .new-chat-btn,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .new-chat-btn { height: 30px !important; padding: 0 11px !important; font-size: 10.5px !important; border-radius: 10px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .studio-chat-header .chat-model-row,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row { margin-top: 8px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .studio-chat-header .chat-model-row .select,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .studio-chat-header .chat-model-row .select { height: 30px !important; font-size: 10px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-messages,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-messages { padding: 13px 16px 10px !important; gap: 11px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .message-bubble,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .message-bubble { font-size: 11px !important; line-height: 1.65 !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty { padding: 14px 12px 18px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty-icon,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty-icon { width: 44px !important; height: 44px !important; margin-bottom: 11px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty-icon svg,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty-icon svg { width: 22px !important; height: 22px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty h3,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty h3 { font-size: 13px !important; margin-bottom: 7px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty p,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty p { font-size: 10.5px !important; line-height: 1.68 !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-empty-hints span,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-empty-hints span { font-size: 10px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-quick,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-quick { padding: 0 14px 7px !important; gap: 6px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .quick-chip,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .quick-chip { padding: 5px 9px !important; font-size: 9.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-input-area,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-input-area { padding: 8px 14px 11px !important; gap: 7px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-composer-card,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-composer-card { padding: 10px 12px 9px !important; border-radius: 15px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-composer-card .chat-input,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-composer-card .chat-input { min-height: 54px !important; font-size: 12px !important; line-height: 1.55 !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .chat-consent,
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .chat-consent { margin-top: 7px !important; font-size: 9px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-top-dock .top-create-btn { font-size: 10px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-zoom-bar,
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-zoom-bar .zoom-label,
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-zoom-bar .zoom-fit-btn { font-size: 10px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3 .canvas-context-menu button,
body.shell-high-scale-compact .node-delete-popover { font-size: 11px !important; }
body.shell-high-scale-compact .node-delete-popover .confirm-title { font-size: 11.5px !important; }
body.shell-high-scale-compact .node-delete-popover .confirm-text,
body.shell-high-scale-compact .node-delete-popover .confirm-cancel,
body.shell-high-scale-compact .node-delete-popover .confirm-delete { font-size: 10.5px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .node.focused .node-title-input { font-size: 15px !important; }
body.shell-high-scale-compact .canvas-shell.studio-v3.stage-focus .node.focused .node-body { font-size: 12.5px !important; padding: 18px 22px 22px !important; }

/* v3.11.2：正文 Tab 只保留章节筛选；章节正文使用普通节点放大框，嵌在目录与对话框之间 */
@media (min-width: 901px) {
  .canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-novel-bar,
  .canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-inspector-corner {
    display: none !important;
  }
  .canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-head {
    min-height: 38px;
    margin: 0 48px 12px 0 !important;
  }
  .canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-body {
    padding: 20px 28px 24px !important;
    gap: 0;
  }
  .canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-body textarea {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    font-size: 16px !important;
    line-height: 1.9 !important;
  }
}

/* v3.11.4：专注舞台退出键固定为清晰可见的右上角圆形按钮，避免被高密度旧规则缩成小点 */
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner,
.canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-focus-corner {
  top: 16px !important;
  right: 16px !important;
  width: 36px !important;
  height: 36px !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 12px !important;
  background: rgba(32,36,49,.96) !important;
  color: #f4f6ff !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.08) !important;
  backdrop-filter: blur(10px);
  z-index: 30 !important;
}
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2.1 !important;
}
.canvas-shell.studio-v3.stage-focus .node.focused .node-focus-corner:hover {
  background: linear-gradient(135deg, #7886ff, #6555df) !important;
  border-color: rgba(255,255,255,.28) !important;
  transform: translateY(-1px);
}
.canvas-shell.studio-v3.stage-focus .node.focused.novel-kind-chapter .node-head {
  margin-right: 56px !important;
}

/* v3.11.5：左上角浮层按钮统一横向成组，避免 reopen、新建、筛选三个按钮叠在同一坐标 */
.canvas-shell.studio-v3 .canvas-surface-left-actions {
  top: 14px !important;
  left: 16px !important;
  gap: 8px !important;
}
.canvas-shell.studio-v3 .canvas-surface-left-actions .surface-icon-btn { flex: 0 0 auto; }
.canvas-shell.studio-v3.stage-focus #novel-create-toggle,
.canvas-shell.studio-v3.stage-focus #novel-filter-toggle { display: none !important; }
.canvas-shell.studio-v3.stage-focus .canvas-surface-left-actions { top: 10px !important; left: 12px !important; gap: 6px !important; }
@media (min-width: 901px) and (max-width: 1600px) {
  .canvas-shell.studio-v3:not(.left-collapsed):not(.right-collapsed) .canvas-surface-left-actions { top: 56px !important; }
}
@media (max-width: 900px) {
  .canvas-shell.studio-v3 .canvas-surface-left-actions { top: 10px !important; left: 10px !important; gap: 6px !important; }
  .canvas-shell.studio-v3 .canvas-surface-left-actions .surface-icon-btn { width: 30px; height: 30px; border-radius: 9px; }
  .canvas-shell.studio-v3 #reopen-right { top: 10px !important; right: 10px !important; width: 30px; height: 30px; border-radius: 9px; }
  .canvas-shell.studio-v3:not(.left-collapsed) .canvas-surface-left-actions { display: none !important; }
  .canvas-shell.studio-v3 .canvas-top-dock {
    top: 52px !important;
    left: 10px !important;
    right: 10px !important;
    transform: none !important;
    max-width: none !important;
  }
}

.studio-v3 .canvas-top-dock {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.055));
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(255,255,255,.05), 0 12px 30px rgba(0,0,0,.22);
}
.studio-v3 .top-dock-pill {
  position: absolute; top: 0; left: 0; z-index: 0; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.32);
  background: linear-gradient(135deg, rgba(255,255,255,.24), rgba(124,108,255,.30) 48%, rgba(91,119,255,.24));
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.46), inset 0 -1px 0 rgba(255,255,255,.08), 0 8px 22px rgba(91,100,255,.22);
  will-change: transform; pointer-events: none;
}
.studio-v3 .canvas-context-pill,
.studio-v3 .top-create-btn { position: relative; z-index: 2; }
.studio-v3 .canvas-context-pill.is-active,
.studio-v3 .top-create-btn.is-active { color: #fff; }
.studio-v3 .top-create-btn.is-active .top-create-icon {
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.16);
}
