:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f4f4f7;
  --bg-tertiary: #ebebf0;
  --text-primary: #0f0d18;
  --text-secondary: #6e6e7c;
  --text-tertiary: #9d9dab;
  --border-color: #e2e0ed;
  --accent-color: #a855f7;
  --accent-hover: #9333ea;
  --accent-glow: rgba(168, 85, 247, 0.12);
  --btn-bg: #0f0f13;
  --btn-text: #ffffff;
  --btn-hover: #3d2d55;
  --shadow: 0 12px 40px rgba(60, 50, 110, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
  --node-shadow: 0 6px 24px rgba(60, 50, 110, 0.07), 0 1px 2px rgba(0, 0, 0, 0.02);
  --grid-dot: rgba(0, 0, 0, 0.06);
  --float-bg: rgba(255, 255, 255, 0.9);
  --dialog-mask: rgba(0, 0, 0, 0.5);
  --drop-mask: rgba(0, 0, 0, 0.06);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
}

body.dark {
  --bg-primary: #0b0a18;
  --bg-secondary: #141324;
  --bg-tertiary: #1f1e30;
  --text-primary: #e6e6f0;
  --text-secondary: #8888a0;
  --text-tertiary: #5e5e74;
  --border-color: #262438;
  --accent-color: #b975f9;
  --accent-hover: #a855f7;
  --accent-glow: rgba(185, 117, 249, 0.12);
  --btn-bg: #e6e6f0;
  --btn-text: #0c0c14;
  --btn-hover: #b8a8d8;
  --shadow: 0 12px 40px rgba(30, 20, 60, 0.45), 0 1px 3px rgba(0, 0, 0, 0.15);
  --node-shadow: 0 6px 24px rgba(30, 20, 60, 0.4), 0 1px 2px rgba(0, 0, 0, 0.15);
  --grid-dot: rgba(255, 255, 255, 0.04);
  --float-bg: rgba(20, 19, 36, 0.92);
  --dialog-mask: rgba(0, 0, 0, 0.7);
  --drop-mask: rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; }
body { color: var(--text-primary); background: var(--bg-primary); transition: background 300ms ease, color 300ms ease; overflow: hidden; }
.project-home { position: fixed; inset: 0; overflow-y: auto; background: var(--bg-primary); z-index: 1; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 60px; min-height: 72vh; padding: 64px 64px 48px; background: var(--bg-secondary); }
.hero-content { display: grid; gap: 16px; }
.hero-title { margin: 0; font-size: 56px; font-weight: 900; letter-spacing: 0.06em; line-height: 1; color: var(--text-primary); }
.hero-subtitle { margin: 0; font-size: 22px; font-weight: 400; color: var(--accent-color); letter-spacing: 0.04em; }
.hero-desc { margin: 8px 0 0; font-size: 15px; line-height: 1.7; color: var(--text-secondary); }
.hero-actions { display: flex; gap: 12px; margin-top: 8px; }
.btn-primary { height: 44px; border: 0; border-radius: 10px; padding: 0 24px; color: #fff; background: #111113; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-primary:hover { background: #2d2d33; }
.btn-ghost { display: inline-flex; align-items: center; height: 44px; border: 1px solid var(--border-color); border-radius: 10px; padding: 0 24px; color: var(--text-primary); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-ghost:hover { border-color: var(--accent-color); }

.hero-visual { position: relative; display: grid; place-items: center; height: 220px; }
.hero-node { position: absolute; display: grid; place-items: center; width: 100px; height: 52px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-primary); box-shadow: 0 4px 16px rgba(0,0,0,0.04); font-size: 13px; font-weight: 700; color: var(--text-primary); }
.hero-node.n1 { left: 0; top: 50%; transform: translateY(-50%); animation: heroBreathe 3.2s ease-in-out infinite; }
.hero-node.n2 { left: 50%; top: 50%; transform: translate(-50%, -50%); border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 16px rgba(0,0,0,0.04); animation: heroBreathe 3.2s ease-in-out 0.4s infinite; }
.hero-node.n3 { right: 0; top: 50%; transform: translateY(-50%); animation: heroBreathe 3.2s ease-in-out 0.8s infinite; }
.hero-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hero-edges path { fill: none; stroke: var(--accent-color); stroke-width: 1.5; stroke-dasharray: 6 4; stroke-linecap: round; opacity: 0.5; }
.hero-edges .he1 { animation: heroEdgePulse 3.2s ease-in-out infinite; }
.hero-edges .he2 { animation: heroEdgePulse 3.2s ease-in-out 0.5s infinite; }

@keyframes heroBreathe {
  0%, 100% { transform: translateY(-50%) scale(1); }
  12% { transform: translateY(-50%) scale(1.04); }
  24% { transform: translateY(-50%) scale(1); }
}
@keyframes heroEdgePulse {
  0%, 100% { stroke-dashoffset: 0; opacity: 0.35; }
  50% { stroke-dashoffset: -20; opacity: 0.7; }
}

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 56px 64px; background: var(--bg-primary); }
.feature-card { display: grid; gap: 12px; border: 1px solid var(--border-color); border-radius: 14px; padding: 28px 24px; background: var(--bg-secondary); }
.feature-card:hover { border-color: var(--accent-color); }
.feature-icon { font-size: 32px; }
.feature-card h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-primary); }
.feature-card p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }

/* Projects */
.projects-section { padding: 0 64px 64px; background: var(--bg-primary); }
.projects-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.projects-head h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary); }
.projects-head span { font-size: 13px; color: var(--text-secondary); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-content: start; gap: 14px; }

/* Steps */
.section-title { margin: 0 0 24px; font-size: 22px; font-weight: 700; color: var(--text-primary); }
.steps { padding: 0 64px 56px; background: var(--bg-primary); }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step-card { display: grid; gap: 14px; border: 1px solid var(--border-color); border-radius: 14px; padding: 28px 24px; background: var(--bg-secondary); position: relative; }
.step-card:hover { border-color: var(--accent-color); }
.step-number { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #111113; color: #fff; font-size: 16px; font-weight: 800; }
.step-card h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-primary); }
.step-card p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }

/* Responsive extras */
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 48px 24px; gap: 32px; }
  .hero-title { font-size: 40px; }
  .hero-visual { height: 150px; }
  .hero-node { width: 80px; height: 42px; font-size: 11px; }
  .features { grid-template-columns: 1fr; padding: 40px 24px; }
  .steps { padding: 0 24px 48px; }
  .steps-grid { grid-template-columns: 1fr; }
  .projects-section { padding: 0 24px 48px; }
}
.project-card { display: grid; gap: 16px; min-height: 198px; border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; background: var(--bg-secondary); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03); transition: border-color 200ms ease, box-shadow 200ms ease; }
.project-card.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(0, 0, 0, 0.03); }
.project-card-main { display: flex; justify-content: space-between; gap: 12px; }
.project-card-main h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.project-card-main p { margin: 7px 0 0; color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.project-card-main span { flex: 0 0 auto; height: 24px; border-radius: 999px; padding: 4px 8px; color: var(--accent-color); background: var(--accent-glow); font-size: 11px; font-weight: 700; }
.project-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.project-card-stats strong { display: grid; gap: 3px; border-radius: 10px; padding: 10px; background: var(--bg-primary); font-size: 20px; }
.project-card-stats small { color: var(--text-secondary); font-size: 11px; font-weight: 650; }
.project-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.project-card-actions button { height: 30px; border: 1px solid var(--border-color); border-radius: 8px; padding: 0 10px; color: var(--text-primary); background: var(--bg-primary); font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color 160ms ease; }
.project-card-actions button:hover { border-color: var(--accent-color); }
.project-card-actions button.danger { color: #ef4444; }
.project-empty { display: grid; place-items: center; min-height: 260px; border: 1px dashed var(--border-color); border-radius: 12px; color: var(--text-secondary); font-size: 14px; font-weight: 700; background: var(--bg-secondary); }

button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }

/* ── 编辑器头部 ── */
.app-shell { display: grid; grid-template-rows: 56px minmax(0, 1fr); width: 100vw; height: 100vh; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--border-color); background: var(--bg-secondary); z-index: 30; transition: background 300ms ease; }
.header-left, .header-right, .header-center { display: flex; align-items: center; gap: 8px; }
.header-center { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14); }

.icon-button, .project-button, .tool-button, .tool-main, .bottom-controls button { display: inline-grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--text-primary); transition: background 140ms ease, transform 140ms ease; }
.icon-button { width: 36px; height: 36px; }
.icon-button:hover, .project-button:hover, .tool-button:hover, .bottom-controls button:hover { background: var(--bg-tertiary); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.project-button { grid-auto-flow: column; gap: 6px; height: 36px; padding: 0 10px; font-size: 14px; font-weight: 700; }
.project-button svg { width: 16px; height: 16px; }

/* ── 画布区域 ── */
.canvas-area { position: relative; overflow: hidden; }
.viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; background: radial-gradient(circle at 80% 10%, var(--accent-glow), transparent 34%), var(--bg-primary); transition: background 300ms ease; }
.viewport.dragging { cursor: grabbing; }
.viewport.resizing { cursor: nwse-resize; }

/* ── 网格 ── */
.grid-layer { position: absolute; inset: -200%; transform-origin: 0 0; background-image: radial-gradient(circle, var(--grid-dot) 0.7px, transparent 0.7px); background-size: 20px 20px; }

/* ── 边 / 连线 ── */
.edge-layer, .canvas-world { position: absolute; left: 0; top: 0; width: 6000px; height: 4000px; transform-origin: 0 0; }
.edge-layer { overflow: visible; pointer-events: auto; z-index: 1; }
.canvas-world { z-index: 2; pointer-events: none; }
.edge-path { fill: none; stroke: var(--accent-color); stroke-width: 1.5; stroke-dasharray: 6 4; stroke-linecap: round; transition: stroke-width 160ms ease, stroke-dasharray 160ms ease; }
.edge-link { pointer-events: auto; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 18; stroke-linecap: round; pointer-events: stroke; cursor: pointer; }
.edge-link:hover .edge-path { stroke: var(--accent-color); stroke-width: 2.5; stroke-dasharray: 8 5; filter: drop-shadow(0 4px 10px rgba(168, 85, 247, 0.2)); }
.edge-preview { stroke: var(--accent-color); stroke-width: 2.4; stroke-dasharray: 6 5; opacity: 0.72; filter: drop-shadow(0 3px 8px rgba(168, 85, 247, 0.15)); }
.edge-label { fill: var(--text-secondary); font-size: 11px; font-weight: 700; }

/* ── 浮动工具栏 ── */
.floating-toolbar { position: absolute; left: 16px; top: 50%; z-index: 12; display: grid; gap: 6px; transform: translateY(-50%); padding: 8px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--float-bg); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.tool-main, .tool-button { width: 42px; height: 42px; }
.tool-main { color: #fff; background: #0f0f13; }
.tool-main:hover { background: var(--btn-hover); transform: translateY(-1px); }
.toolbar-separator { width: 100%; height: 1px; background: var(--border-color); margin: 2px 0; }

/* ── 节点菜单 ── */
.node-menu { position: absolute; left: 74px; top: 50%; z-index: 20; display: grid; min-width: 184px; transform: translateY(-50%); padding: 8px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-primary); box-shadow: var(--shadow); }
.node-menu button { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 10px; background: transparent; text-align: left; color: var(--text-primary); font-size: 13px; font-weight: 650; transition: background 140ms ease; }
.node-menu button:hover { background: var(--bg-tertiary); }
.node-menu-icon { width: 10px; height: 10px; border-radius: 50%; }
.node-menu-icon.blue { background: var(--accent-color); }
.node-menu-icon.violet { background: #c084fc; }
.node-menu-icon.green { background: #22c55e; }
.node-menu-icon.orange { background: #f59e0b; }
.node-menu-icon.purple { background: #a78bfa; }
.node-menu-icon.red { background: #ef4444; }

/* ── 右键菜单 ── */
.context-menu { position: fixed; z-index: 60; display: grid; min-width: 184px; max-width: min(240px, calc(100vw - 16px)); padding: 6px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--float-bg); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.context-menu[hidden] { display: none; }
.context-menu-title { min-width: 0; padding: 7px 9px 6px; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
.context-menu button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 32px; border: 0; border-radius: 7px; padding: 0 9px; color: var(--text-primary); background: transparent; font-size: 13px; font-weight: 650; text-align: left; transition: background 140ms ease; }
.context-menu button:hover { background: var(--bg-tertiary); }
.context-menu button.danger { color: #ef4444; }
.context-menu-separator { height: 1px; margin: 5px 4px; background: var(--border-color); }

/* ── 模板面板 ── */
.template-panel { position: absolute; top: 14px; right: 14px; bottom: 14px; z-index: 32; display: grid; grid-template-rows: auto auto auto auto auto minmax(0, 1fr); width: min(360px, calc(100vw - 32px)); border: 1px solid var(--border-color); border-radius: 14px; padding: 14px; overflow: hidden; background: var(--float-bg); box-shadow: var(--shadow); backdrop-filter: blur(18px); color: var(--text-primary); }
.template-panel[hidden] { display: none; }
.template-panel.is-drop-target { border-color: var(--accent-color); box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow); }
.template-panel-head, .template-panel-actions, .template-section-title, .template-card-actions { display: flex; align-items: center; gap: 8px; }
.template-panel-head { justify-content: space-between; padding-bottom: 10px; }
.template-eyebrow { color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.template-panel h2 { margin: 2px 0 0; font-size: 19px; line-height: 1.15; }
.template-close { flex: 0 0 auto; }
.template-panel-actions { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.primary-small, .ghost-small, .template-section-title button, .template-card-actions button { height: 34px; border: 1px solid var(--border-color); border-radius: 9px; padding: 0 10px; font-size: 12px; font-weight: 700; transition: background 160ms ease, border-color 160ms ease; }
.primary-small { color: var(--btn-text); border-color: var(--btn-bg); background: var(--btn-bg); }
.ghost-small, .template-section-title button, .template-card-actions button { color: var(--text-primary); background: var(--bg-secondary); }
.template-drop-zone { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; min-height: 46px; margin-bottom: 12px; border: 1px dashed var(--accent-color); border-radius: 11px; padding: 10px 12px; color: var(--text-primary); background: var(--accent-glow); }
.template-drop-zone span { color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.template-section-title { justify-content: space-between; margin: 4px 0 8px; color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.template-section-title button { height: 28px; }
.template-categories { display: grid; gap: 6px; margin-bottom: 12px; }
.template-categories button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 36px; border: 1px solid var(--border-color); border-radius: 10px; padding: 0 10px; color: var(--text-primary); background: var(--bg-secondary); text-align: left; transition: border-color 160ms ease, background 160ms ease; }
.template-categories button.active { border-color: var(--text-primary); background: var(--bg-tertiary); }
.template-categories span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.template-categories strong { color: var(--text-secondary); font-size: 12px; }
.template-list { display: grid; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.template-card { display: grid; gap: 10px; border: 1px solid var(--border-color); border-radius: 10px; padding: 10px; background: var(--bg-secondary); }
.template-card-main { display: grid; gap: 3px; }
.template-card-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.template-card-main span, .template-empty { color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.template-card-actions { justify-content: flex-start; }
.template-card-actions button { height: 30px; }
.template-card-actions button.danger { color: #ef4444; }
.template-empty { border: 1px dashed var(--border-color); border-radius: 10px; padding: 16px; text-align: center; }

/* ── 拖放覆盖层 ── */
.drop-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; background: var(--drop-mask); }
.drop-overlay[hidden] { display: none; }
.drop-overlay div { border: 1px solid rgba(168, 85, 247, 0.5); border-radius: 14px; padding: 18px 24px; color: var(--text-primary); background: var(--bg-primary); box-shadow: var(--shadow); font-size: 16px; font-weight: 700; }

/* ── 底部控制栏 ── */
.bottom-controls { position: absolute; left: 16px; bottom: 18px; z-index: 12; display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--float-bg); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.bottom-controls button { width: 30px; height: 30px; font-size: 17px; font-weight: 700; }
.bottom-controls svg { width: 16px; height: 16px; }
#zoomLabel { min-width: 44px; color: var(--text-secondary); text-align: center; font-size: 12px; font-weight: 700; }

/* ── 底部对话框 ── */
.chat-dock { position: absolute; left: 50%; bottom: 18px; z-index: 14; width: min(720px, calc(100vw - 260px)); transform: translateX(-50%); color: var(--text-primary); }
.processing, .composer, .suggestions { border: 1px solid var(--border-color); background: var(--float-bg); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.processing { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 10px 14px; border-color: rgba(168, 85, 247, 0.35); border-radius: 14px; color: var(--accent-color); font-size: 13px; font-weight: 650; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(168, 85, 247, 0.2); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.composer { border-radius: 16px; padding: 12px; }
.composer textarea { width: 100%; min-height: 42px; max-height: 120px; border: 0; resize: none; outline: none; color: var(--text-primary); background: transparent; font-size: 14px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--text-tertiary); }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.ghost-button, .send-button { border: 0; border-radius: 10px; font-size: 12px; font-weight: 700; transition: background 160ms ease; }
.ghost-button { height: 32px; padding: 0 12px; color: var(--text-primary); background: var(--bg-tertiary); }
.send-button { display: inline-grid; place-items: center; width: 36px; height: 36px; color: var(--btn-text); background: var(--btn-bg); }
.send-button:hover { background: var(--btn-hover); }
.send-button svg { width: 18px; height: 18px; }
.switch-label { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.switch-label input { display: none; }
.switch-label span { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #ccc; transition: background 200ms ease; }
.switch-label span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); transition: transform 200ms ease; }
.switch-label input:checked + span { background: var(--accent-color); }
.switch-label input:checked + span::after { transform: translateX(14px); }
.suggestions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; padding: 7px; border-radius: 999px; color: var(--text-secondary); font-size: 12px; }
.suggestions button { border: 1px solid var(--border-color); border-radius: 999px; padding: 4px 9px; color: var(--text-primary); background: var(--bg-primary); font-size: 12px; font-weight: 650; transition: border-color 160ms ease; }
.suggestions button:hover { border-color: var(--accent-color); }

/* ── 节点 ── */
.node-group { position: absolute; z-index: 0; width: var(--w); height: var(--h); transform: translate(var(--x), var(--y)); border: 1px solid rgba(168, 85, 247, 0.2); border-radius: 18px; background: rgba(168, 85, 247, 0.03); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); pointer-events: none; }
.node-group-title { position: absolute; left: 12px; right: 12px; top: 10px; display: flex; align-items: center; min-width: 160px; height: 44px; border: 1px solid rgba(168, 85, 247, 0.2); border-radius: 12px; padding: 0 14px; overflow: hidden; color: var(--accent-color); background: var(--float-bg); box-shadow: 0 4px 12px rgba(168, 85, 247, 0.06); cursor: grab; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; pointer-events: auto; }
.node-group-title:active { cursor: grabbing; }
.node { position: absolute; z-index: 1; width: var(--node-width); min-height: var(--node-height); transform: translate(var(--x), var(--y)); pointer-events: auto; }
.node-card { position: relative; display: flex; flex-direction: column; min-height: var(--node-height); border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-primary); box-shadow: var(--node-shadow); overflow: hidden; color: var(--text-primary); transition: border-color 200ms ease, box-shadow 200ms ease; }
.node-card.selected { border-color: var(--text-primary); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08), var(--node-shadow); }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 10px 12px; border-bottom: 1px solid var(--border-color); cursor: grab; }
.node-head:active { cursor: grabbing; }
.node-title { min-width: 0; overflow: hidden; color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }
.node-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 140ms ease; }
.node-card:hover .node-actions, .node-card.selected .node-actions { opacity: 1; }
.node-action { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); transition: background 140ms ease; }
.node-action:hover { background: var(--bg-tertiary); }
.node-action svg { width: 14px; height: 14px; }
.node-body { padding: 12px; flex: 1; }
.node-resize-handle { position: absolute; right: 5px; bottom: 5px; z-index: 4; width: 13px; height: 13px; border: 0; background: linear-gradient(135deg, transparent 58%, rgba(168, 85, 247, 0.45) 59% 66%, transparent 67%), linear-gradient(135deg, transparent 72%, rgba(168, 85, 247, 0.45) 73% 80%, transparent 81%); cursor: nwse-resize; opacity: 0.5; transition: opacity 140ms ease; }
.node-resize-handle:hover { opacity: 1; }
.node textarea, .node input, .node select { width: 100%; border: 1px solid var(--border-color); border-radius: 10px; outline: none; color: var(--text-primary); background: var(--bg-secondary); font-size: 13px; transition: border-color 160ms ease; }
.node textarea { min-height: 120px; resize: none; padding: 10px; line-height: 1.5; }
.node textarea:focus, .node input:focus, .node select:focus { border-color: var(--accent-color); }
.node[data-type="text"] .node-body { display: flex; }
.node[data-type="text"] textarea { flex: 1; min-height: 0; }
.node input, .node select { height: 34px; padding: 0 9px; font-weight: 650; }
.node-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.node-row + .node-row, .node-row + .node-button, .node-indicators + .node-button { margin-top: 10px; }
.node-row select { width: 162px; }
.node-tip { margin-top: 10px; border-radius: 9px; padding: 8px; color: var(--text-secondary); background: var(--bg-tertiary); font-size: 12px; line-height: 1.45; }
.node-indicators { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.indicator { border-radius: 999px; padding: 4px 8px; color: var(--text-secondary); background: var(--bg-tertiary); font-size: 11px; font-weight: 700; }
.indicator.ready { color: #15803d; background: rgba(34, 197, 94, 0.12); }
.node-button, .node-secondary-button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 38px; border-radius: 10px; font-size: 13px; font-weight: 700; transition: background 160ms ease; }
.node-button { border: 0; color: var(--btn-text); background: var(--btn-bg); }
.node-button:hover { background: var(--btn-hover); }
.node-secondary-button { border: 1px solid var(--border-color); color: var(--text-primary); background: var(--bg-secondary); }
.node-split { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ── 媒体预览 ── */
.image-preview, .video-preview, .empty-media { display: grid; place-items: center; aspect-ratio: 1 / 1; border-radius: 13px; overflow: hidden; background: var(--bg-tertiary); }
.image-preview { background: var(--preview-bg, linear-gradient(135deg, #a855f7, #6366f1 42%, #facc15)); }
.image-preview.has-image { position: relative; cursor: zoom-in; }
.image-preview img, .video-preview video { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.loading-card { color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.empty-media { color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.video-preview video { border-radius: 12px; }
.media-toolbar { display: flex; gap: 8px; margin-top: 10px; }
.media-toolbar button { flex: 1; height: 32px; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); background: var(--bg-secondary); font-size: 12px; font-weight: 700; transition: border-color 160ms ease; }
.media-toolbar button:hover { border-color: var(--accent-color); }

/* ── 图片预览弹窗 ── */
.image-preview-dialog { position: fixed; inset: 0; z-index: 70; margin: 0; max-width: none; max-height: none; border: 0; padding: 0; }
.image-preview-dialog[open] { display: grid; place-items: center; background: var(--dialog-mask); }
.image-preview-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); max-width: 90vw; max-height: 90vh; }
.image-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 14px; color: #fff; }
.image-preview-head strong { color: #fff; }
.image-preview-head div { display: flex; align-items: center; gap: 8px; }
.image-preview-stage { display: grid; place-items: center; min-height: 0; }
.image-preview-stage img { max-width: 100%; max-height: 70vh; border-radius: 12px; object-fit: contain; user-select: none; -webkit-user-drag: none; }

/* ── 框选 ── */
.marquee-selection { position: fixed; z-index: 50; border: 1px dashed var(--accent-color); background: var(--accent-glow); pointer-events: none; border-radius: 4px; }
.marquee-selection[hidden] { display: none; }

/* ── 节点连接点 ── */
.node-port { position: absolute; width: 14px; height: 14px; border: 2px solid var(--border-color); border-radius: 50%; background: var(--bg-primary); z-index: 3; cursor: crosshair; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.node-port:hover { border-color: var(--accent-color); background: var(--accent-color); transform: scale(1.3); }
.node-port.input { left: -7px; top: 50%; transform: translateY(-50%); }
.node-port.output { right: -7px; top: 50%; transform: translateY(-50%); }
.node-port.input:hover, .node-port.output:hover { transform: translateY(-50%) scale(1.3); border-color: var(--accent-color); background: var(--accent-color); }

/* ── 设置弹窗 ── */
.modal { position: fixed; z-index: 40; max-width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; background: var(--bg-primary); box-shadow: var(--shadow); color: var(--text-primary); }
.modal::backdrop { background: var(--dialog-mask); }
.modal[open] { display: grid; gap: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-note { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.modal label { display: grid; gap: 6px; }
.modal label span { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.modal input, .modal select { height: 38px; border: 1px solid var(--border-color); border-radius: 10px; padding: 0 10px; color: var(--text-primary); background: var(--bg-secondary); font-size: 13px; outline: none; transition: border-color 160ms ease; }
.modal input:focus, .modal select:focus { border-color: var(--accent-color); }
.advanced-settings { border-top: 1px solid var(--border-color); padding-top: 14px; }
.advanced-settings summary { color: var(--accent-color); font-size: 13px; font-weight: 700; cursor: pointer; }
.service-settings { display: grid; gap: 16px; margin-top: 14px; }
.service-setting-card { display: grid; gap: 10px; border: 1px solid var(--border-color); border-radius: 12px; padding: 14px; background: var(--bg-secondary); }
.service-setting-card h3 { margin: 0; font-size: 14px; color: var(--accent-color); }
.service-setting-card p { margin: 0; color: var(--text-tertiary); font-size: 11px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .send-button { width: auto; padding: 0 18px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 100; transform: translateX(-50%); padding: 10px 20px; border-radius: 10px; background: var(--bg-primary); border: 1px solid var(--border-color); box-shadow: var(--shadow); color: var(--text-primary); font-size: 13px; font-weight: 700; animation: toastIn 200ms ease, toastOut 200ms 2.3s ease forwards; pointer-events: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--border-color); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Paywall */
#paywallModal { text-align: center; max-width: 400px; }
#paywallModal::backdrop { background: rgba(0, 0, 0, 0.5); }
.paywall-content { display: grid; gap: 16px; justify-items: center; }
.paywall-icon { font-size: 48px; }
.paywall-content h2 { margin: 0; font-size: 20px; color: var(--text-primary); }
.paywall-content p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.paywall-content strong { color: var(--accent-color); }
.paywall-actions { display: grid; gap: 10px; justify-items: center; margin-top: 8px; }
.paywall-hint { font-size: 12px; color: var(--text-tertiary); }

/* ── 暗夜主题叠加层 ── */
body.dark .node-card.selected { border-color: var(--text-primary); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06), var(--node-shadow); }
body.dark .project-card.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06), 0 2px 12px rgba(0, 0, 0, 0.15); }
body.dark .image-preview-head,
body.dark .image-preview-head strong { color: #e6e6f0; }
body.dark .indicator.ready { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
body.dark .status-dot { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
body.dark .project-card-stats strong { background: var(--bg-primary); }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border-color); background: var(--bg-secondary); padding: 48px 64px 32px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; max-width: none; }
.footer-brand { display: flex; align-items: baseline; gap: 12px; }
.footer-logo { font-size: 20px; font-weight: 900; letter-spacing: 0.06em; color: var(--text-primary); }
.footer-slogan { font-size: 13px; color: var(--accent-color); letter-spacing: 0.04em; }
.footer-links { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--accent-color); }
.footer-copy { font-size: 12px; color: var(--text-tertiary); }

@media (max-width: 800px) {
  .site-footer { padding: 32px 24px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ── 工具栏 tooltip ── */
.tool-button, .tool-main, .icon-button[title] { position: relative; }
.tool-button::after, .tool-main::after, .icon-button[title]::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--text-primary);
  color: var(--btn-text);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 100;
}
.tool-button:hover::after, .tool-main:hover::after, .icon-button[title]:hover::after {
  opacity: 1;
}

/* ── 空状态优化 ── */
.project-empty {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 260px;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  background: var(--bg-secondary);
  text-align: center;
  padding: 48px 24px;
}
.project-empty p { margin: 0; color: var(--text-tertiary); font-size: 13px; font-weight: 500; max-width: 360px; line-height: 1.7; }
