/* Magic Net - 共享设计令牌
   基于对 magicnet.ai 的分析：Inter 字体 / 黑底 / 紫色高亮 / 橙色 CTA / shadcn 风格按钮
*/

:root {
  /* 基础色阶 */
  --bg:         #000000;
  --bg-1:       #0a0a0a;
  --bg-2:       #141414;
  --bg-3:       #1c1c1c;
  --bg-4:       #262626;
  --border:     #262626;
  --border-light: #333333;

  /* 文本 */
  --text:       #fafafa;
  --text-2:     #a3a3a3;
  --text-3:     #737373;
  --text-4:     #525252;

  /* 品牌色 */
  --purple:     #a78bfa;
  --purple-2:   #c4b5fd;
  --purple-glow: rgba(167, 139, 250, 0.35);
  --purple-bg:  rgba(167, 139, 250, 0.12);

  --orange:     #f97316;
  --orange-2:   #fb923c;

  --green:      #22c55e;
  --green-2:    #16a34a;

  --red:        #ef4444;
  --red-2:      #dc2626;

  --blue:       #3b82f6;

  /* workflow 专属 */
  --chat-bg:    #0f0f0f;
  --workflow-empty-button-bg: #1c1c1c;
  --workflow-empty-button-bg-hover: #262626;
  --workflow-empty-button-text: #fafafa;
  --canvas-grid: #1a1a1a;

  /* 间距/圆角（shadcn 风） */
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  16px;
  --radius-full: 9999px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ========== 全站布局 ========== */
.app-shell {
  display: grid;
  grid-template-columns: 64px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 0;
  gap: 8px;
  position: sticky; top: 0;
  height: 100vh;
}
.sidebar-icon {
  width: 40px; height: 40px;
  margin: 0 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.sidebar-icon:hover { background: var(--bg-2); color: var(--text); }
.sidebar-icon.active { background: var(--bg-3); color: var(--text); }
.sidebar-spacer { flex: 1; }
.sidebar-divider { height: 1px; background: var(--border); margin: 4px 16px; }

/* ========== 顶栏 ========== */
.topbar {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 16px;
}
.brand-logo {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--orange) 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: black; font-weight: 800;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  background: var(--bg-3); color: var(--text);
}
.btn:hover { background: var(--bg-4); }
.btn-primary { background: var(--text); color: black; }
.btn-primary:hover { background: var(--text-2); }
.btn-purple { background: var(--purple); color: black; font-weight: 600; }
.btn-purple:hover { background: var(--purple-2); }
.btn-orange { background: var(--orange); color: white; font-weight: 600; }
.btn-orange:hover { background: var(--orange-2); }
.btn-green { background: var(--green); color: white; font-weight: 600; }
.btn-green:hover { background: var(--green-2); }
.btn-blue { background: var(--blue); color: white; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-pill { border-radius: var(--radius-full); }

/* 顶栏右侧 chip */
.chip-credits {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.chip-credits .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.chip-account {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-2); border-radius: var(--radius-full);
  cursor: pointer;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  color: black; font-weight: 700; font-size: 13px;
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: var(--bg-2);
  cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

/* ========== 卡片 ========== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-elev {
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ========== Badge / 标签 ========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  background: var(--bg-3); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-purple { background: var(--purple-bg); color: var(--purple); border-color: transparent; }
.badge-orange { background: rgba(249, 115, 22, 0.15); color: var(--orange); border-color: transparent; }
.badge-green  { background: rgba(34, 197, 94, 0.15);  color: var(--green);  border-color: transparent; }

/* ========== Hero ========== */
.hero-title {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-align: center;
}
.hero-title .accent {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  margin-top: 16px;
  font-size: 18px;
  color: var(--text-2);
  text-align: center;
}

/* ========== Prompt 框（首页核心） ========== */
.prompt-box {
  margin: 40px auto 0;
  max-width: 780px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 0 0 0 var(--purple-glow);
  transition: box-shadow .3s, border-color .3s;
}
.prompt-box:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 6px var(--purple-glow);
}
.prompt-box textarea {
  width: 100%;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 15px;
  resize: none; min-height: 60px;
  font-family: inherit;
}
.prompt-box-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
}
.prompt-box-footer-left { display: flex; gap: 8px; }
.send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  border: 0;
}
.send-btn.active { background: var(--text); color: black; }

/* ========== Scene chips (UGC/TVC/品牌设计/电商产品) ========== */
.scene-chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px; margin-top: 24px;
}
.scene-chip {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 14px; color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.scene-chip:hover { border-color: var(--purple); color: var(--text); }

/* ========== 项目卡片 ========== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.project-card {
  aspect-ratio: 1 / 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, border-color .15s;
  position: relative; overflow: hidden;
}
.project-card:hover { border-color: var(--text-3); transform: translateY(-2px); }
.project-card-new {
  flex-direction: column;
  color: var(--text-3);
  gap: 8px;
}
.project-card-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  background: linear-gradient(0deg, rgba(0,0,0,.9) 0%, transparent 100%);
  font-size: 12px; color: var(--text-2);
}

/* ========== React Flow 风格画布（workflow.html） ========== */
.workflow-shell {
  display: grid;
  grid-template-columns: 1fr 480px;
  height: calc(100vh - 56px);
}
.canvas {
  position: relative; overflow: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle, var(--canvas-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.node {
  position: absolute;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-width: 220px;
  font-size: 13px;
  overflow: hidden;
  user-select: none;
}
.node-header {
  padding: 8px 12px;
  background: var(--bg-3);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.node-body { padding: 12px; }
.node-handle {
  width: 14px; height: 14px;
  background: var(--purple);
  border: 2px solid var(--bg);
  border-radius: 50%;
  position: absolute;
  top: 50%; transform: translateY(-50%);
  cursor: crosshair;
  transition: transform .15s, box-shadow .15s, background .15s;
  z-index: 5;
}
.node-handle:hover {
  transform: translateY(-50%) scale(1.5);
  box-shadow: 0 0 0 4px rgba(167,139,250,0.25);
}
/* 连线时目标 handle 高亮（hot） */
.node-handle.hot {
  background: var(--green) !important;
  transform: translateY(-50%) scale(1.6);
  box-shadow: 0 0 0 6px rgba(34,197,94,0.35), 0 0 12px var(--green);
  animation: handlePulse 0.8s ease-in-out infinite;
}
@keyframes handlePulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(34,197,94,0.35), 0 0 12px var(--green); }
  50% { box-shadow: 0 0 0 10px rgba(34,197,94,0.2), 0 0 20px var(--green); }
}
.node-handle.right { right: -7px; }
.node-handle.left { left: -7px; }
/* 输入 handle 旁边小图标提示（可连接） */
.node-handle.left::before {
  content: '+';
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: white; font-size: 11px; font-weight: bold;
  opacity: 0;
  transition: opacity .15s;
}
.node-handle.left:hover::before { opacity: 1; }
/* 连线 SVG 让出 pointer events 给 handle */
#edges-layer { pointer-events: none; }
#edges-layer .edge { pointer-events: auto; }

.chat-panel {
  border-left: 1px solid var(--border);
  background: var(--chat-bg);
  display: flex; flex-direction: column;
}
.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.5;
  max-width: 85%;
}
.chat-msg.user { background: var(--bg-3); align-self: flex-end; }
.chat-msg.ai { background: transparent; color: var(--text-2); }
.chat-input {
  border-top: 1px solid var(--border);
  padding: 12px;
}
.chat-input-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.chat-input-box textarea {
  width: 100%; background: transparent; border: 0; outline: 0;
  color: var(--text); resize: none; min-height: 40px;
  font-family: inherit; font-size: 13px;
}

/* ========== 价格卡片 ========== */
.price-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
}
.price-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}
.price-card.featured {
  border: 1.5px solid var(--purple);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.08) 0%, transparent 60%);
}
.price-card .price { font-size: 36px; font-weight: 700; margin: 16px 0 8px; }
.price-card .price-unit { font-size: 14px; color: var(--text-3); font-weight: 400; }
.price-card ul { list-style: none; padding: 0; margin: 16px 0 0; font-size: 13px; color: var(--text-2); }
.price-card li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; }
.price-card li::before { content: '✓'; color: var(--green); flex-shrink: 0; }
.featured-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--purple); color: black; padding: 4px 12px;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
}

/* ========== Masonry (explore) ========== */
.masonry {
  column-count: 5; column-gap: 12px;
}
@media (max-width: 1280px) { .masonry { column-count: 4; } }
@media (max-width: 1024px) { .masonry { column-count: 3; } }
@media (max-width: 768px)  { .masonry { column-count: 2; } }
.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
}

/* ========== 通用 ========== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.text-muted { color: var(--text-2); }
.text-subtle { color: var(--text-3); }
.text-purple { color: var(--purple); }
.text-orange { color: var(--orange); }
.divider { height: 1px; background: var(--border); }
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* ========== 衬线斜体（seedance 风格） ========== */
.serif-italic {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 600;
}

/* ========== JUNKY CREAM 专属（独立设计系统） ========== */
.jc-theme {
  --jc-red:  #dc2626;
  --jc-red-dark: #991b1b;
  --jc-cream: #f5e6d3;
}
.jc-hero {
  background:
    radial-gradient(ellipse at center, rgba(220, 38, 38, 0.3) 0%, transparent 60%),
    linear-gradient(180deg, #1a0a0a 0%, #000 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.jc-logo {
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
}

/* ========== 交互组件（添加节点菜单 / 参数面板 / Toast / 模态框）========== */
.add-node-menu {
  position: fixed; z-index: 9000;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  min-width: 280px; max-height: 480px; overflow-y: auto;
  backdrop-filter: blur(20px);
}
.add-menu-section { padding: 4px 0; }
.add-menu-section + .add-menu-section { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }
.add-menu-title {
  padding: 6px 12px; font-size: 11px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.add-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
}
.add-menu-item:hover { background: var(--bg-3); }
.add-menu-icon {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}

/* 参数面板（右侧浮出） */
.param-panel {
  position: fixed; top: 76px; right: 0; bottom: 0;
  width: 340px;
  background: var(--bg-2); border-left: 1px solid var(--border);
  z-index: 800;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .2s ease;
}
.param-panel.show { transform: translateX(0); }
.param-panel-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.param-panel-body {
  flex: 1; overflow-y: auto; padding: 16px;
}
.param-panel-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: space-between;
}
.param-row {
  margin-bottom: 14px;
}
.param-row label {
  display: block; font-size: 12px; color: var(--text-3);
  margin-bottom: 6px; font-weight: 500;
}
.param-row textarea, .param-row input, .param-row select {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  color: var(--text); font-family: inherit; font-size: 13px;
  outline: 0; resize: vertical;
}
.param-row textarea:focus, .param-row input:focus, .param-row select:focus {
  border-color: var(--purple);
}
.param-meta {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 4px;
}

/* SVG 连线 — 干净的紫色 */
.edge { fill: none; stroke: #a78bfa; stroke-width: 2; opacity: 0.85; }

/* 节点状态 — 不闪烁、不动 opacity，只用边框光晕 */
.node {
  transition: border-color .2s, box-shadow .2s;
}
.node-status-running {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple), 0 0 24px rgba(167,139,250,0.35);
}
/* 运行中：节点边缘有柔和呼吸光晕，但节点本身不变 opacity */
.node-status-running::before {
  content: ''; position: absolute; inset: -2px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--purple), #7c3aed, var(--purple));
  background-size: 200% 200%;
  z-index: -1;
  opacity: 0.4;
  animation: borderFlow 3s linear infinite;
  filter: blur(8px);
}
@keyframes borderFlow {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}
.node-status-done {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}
.node-status-error {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}
.node { position: relative; }

.node-title { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-close {
  width: 18px; height: 18px; border: 0; background: transparent;
  color: var(--text-3); cursor: pointer; font-size: 16px;
  border-radius: 4px; line-height: 1; padding: 0;
}
.node-close:hover { background: var(--red); color: white; }

.node-textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; color: var(--text);
  font-family: inherit; font-size: 12px; resize: none; min-height: 50px;
  outline: 0;
}
.node-textarea:focus { border-color: var(--purple); }

.node-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--bg-4); border-top-color: var(--purple);
  animation: spin 0.8s linear infinite;
  margin: auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.node-gen-result {
  width: 100%; height: 100%; border-radius: 6px;
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  position: relative;
}
.node-gen-result[data-seed]:nth-child(odd) { background: linear-gradient(135deg, #4a1a3a, #1a0a4a); }
.node-gen-result.video .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: rgba(255,255,255,0.9);
}
.waveform {
  width: 100%; height: 100%; border-radius: 6px;
  background:
    repeating-linear-gradient(90deg,
      var(--green) 0 2px, transparent 2px 6px,
      var(--green) 6px 9px, transparent 9px 14px,
      var(--green) 14px 17px, transparent 17px 22px);
  opacity: 0.4;
}

/* Toast */
.toast {
  padding: 12px 16px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0; transform: translateX(20px);
  transition: opacity .25s, transform .25s;
  min-width: 240px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9500; backdrop-filter: blur(8px);
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); max-width: 480px; width: 90vw;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 24px 20px; }

/* QR code mock */
.qr-mock {
  width: 220px; height: 220px; margin: 0 auto;
  background: white; border-radius: var(--radius);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.qr-pattern {
  width: 100%; height: 100%;
  background-image:
    radial-gradient(black 30%, transparent 30%),
    radial-gradient(black 30%, transparent 30%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  border-radius: 6px;
  opacity: 0.85;
}
.qr-logo {
  position: absolute;
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800;
  color: white;
}
.qr-alipay .qr-logo { background: #1677ff; }
.qr-wechat .qr-logo { background: #07c160; }

/* Chat typing dots */
.chat-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px !important; max-width: 60px !important; }
.chat-typing .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
  animation: typing 1.2s infinite ease-in-out;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Image detail modal */
.image-detail-body {
  display: grid; grid-template-columns: 1fr 1fr;
}
.image-detail-img {
  aspect-ratio: 1/1; min-height: 360px;
  background: linear-gradient(135deg, #2a1a4a, #1a0a2a);
}
.image-detail-img.m-a { background: linear-gradient(135deg, #4a1a3a, #1a0a2a); }
.image-detail-img.m-b { background: linear-gradient(135deg, #1a3a4a, #0a1a2a); }
.image-detail-img.m-c { background: linear-gradient(135deg, #3a4a1a, #1a2a0a); }
.image-detail-meta { padding: 20px; }

/* Run button running state */
.btn.running { background: var(--bg-3); cursor: wait; }
.btn.running .node-spinner { display: inline-block; vertical-align: middle; }

/* ========== v2 升级：模板库 / Mini-map / 搜索框 / 进度条 / 框选 ========== */

/* 模板库 modal */
.template-modal { max-width: 900px; }
.template-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 0 20px 20px;
}
.template-card {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; cursor: pointer;
  transition: transform .15s, border-color .15s;
  overflow: hidden;
}
.template-card:hover { transform: translateY(-2px); border-color: var(--purple); }
.template-preview {
  height: 120px; position: relative;
  background-color: var(--bg-2);
  background-image: radial-gradient(circle, #2a2a2a 1px, transparent 1px);
  background-size: 12px 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.template-mini-node {
  position: absolute; background: var(--bg);
  border: 1px solid var(--border-light); border-radius: 4px;
  font-size: 8px; padding: 3px 5px; color: var(--text-2);
}
.template-card-body { padding: 14px; }
.template-card-title { font-weight: 600; font-size: 14px; }
.template-card-desc { font-size: 12px; color: var(--text-3); margin-top: 4px; line-height: 1.4; }
.template-card-meta {
  display: flex; gap: 6px; margin-top: 10px;
  font-size: 10px; color: var(--text-3);
}

/* 搜索框（添加菜单顶部） */
.menu-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-2); z-index: 1;
}
.menu-search input {
  width: 100%; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: 0;
}
.menu-search input:focus { border-color: var(--purple); }
.add-menu-empty {
  padding: 20px 12px; text-align: center;
  font-size: 12px; color: var(--text-3);
}

/* Mini-map */
.minimap {
  position: absolute; bottom: 60px; right: 16px;
  width: 180px; height: 120px;
  background: rgba(20,20,20,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  z-index: 9;
  overflow: hidden;
  cursor: pointer;
}
.minimap-canvas {
  position: relative; width: 100%; height: 100%;
}
.minimap-node {
  position: absolute;
  background: var(--purple);
  border-radius: 1px;
  opacity: 0.5;
}
.minimap-node.selected { opacity: 1; }
.minimap-viewport {
  position: absolute;
  border: 1.5px solid var(--purple);
  border-radius: 2px;
  background: rgba(167, 139, 250, 0.1);
  pointer-events: none;
}
.minimap-toggle {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,0.4);
  border-radius: 3px; color: var(--text-3);
  font-size: 10px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
}

/* 顶部进度条（运行全部时） */
.run-progress {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.05);
  z-index: 200;
}
.run-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--orange));
  width: 0%;
  transition: width .3s;
  box-shadow: 0 0 10px rgba(167,139,250,0.5);
}

/* 框选 */
.selection-box {
  position: absolute;
  border: 1px dashed var(--purple);
  background: rgba(167, 139, 250, 0.1);
  pointer-events: none;
  z-index: 5;
}

/* 节点 mock 输出（升级）— 用 SVG 渐变 + 形状假装"生成结果" */
.gen-art {
  width: 100%; height: 100%; border-radius: 6px;
  position: relative; overflow: hidden;
}
.gen-art-portrait {
  background:
    radial-gradient(ellipse 60% 40% at 50% 35%, #d4a574 0%, #8b5a3c 20%, transparent 40%),
    radial-gradient(ellipse 80% 60% at 50% 80%, #1a0a4a 0%, transparent 40%),
    linear-gradient(180deg, #2a1a4a 0%, #0a0a2a 100%);
}
.gen-art-landscape {
  background:
    radial-gradient(circle at 70% 30%, #fbbf24 0%, transparent 15%),
    linear-gradient(180deg, #1e3a8a 0%, #7c3aed 40%, #f97316 70%, #1a0a0a 100%);
}
.gen-art-cyber {
  background:
    radial-gradient(circle at 30% 60%, #06b6d4 0%, transparent 30%),
    radial-gradient(circle at 70% 40%, #d946ef 0%, transparent 30%),
    linear-gradient(180deg, #0a0a2a 0%, #1a0a4a 100%);
}
.gen-art-product {
  background:
    radial-gradient(circle at 50% 50%, #f5f5f5 0%, #d4d4d4 30%, transparent 50%),
    linear-gradient(135deg, #525252 0%, #171717 100%);
}
.gen-art-nature {
  background:
    radial-gradient(ellipse at 50% 30%, #fde047 0%, transparent 25%),
    linear-gradient(180deg, #87ceeb 0%, #15803d 50%, #166534 100%);
}
.gen-art-anime {
  background:
    radial-gradient(circle at 50% 40%, #fce7f3 0%, #fb7185 20%, transparent 35%),
    linear-gradient(180deg, #fbcfe8 0%, #818cf8 60%, #4c1d95 100%);
}
.gen-art-scifi {
  background:
    radial-gradient(circle at 50% 50%, #000 0%, transparent 20%),
    radial-gradient(ellipse at 50% 50%, #6366f1 0%, transparent 40%),
    linear-gradient(180deg, #1e1b4b 0%, #000 100%);
}
.gen-art-watercolor {
  background:
    radial-gradient(circle at 30% 40%, rgba(96, 165, 250, 0.6) 0%, transparent 30%),
    radial-gradient(circle at 70% 60%, rgba(244, 114, 182, 0.5) 0%, transparent 30%),
    radial-gradient(circle at 50% 80%, rgba(251, 191, 36, 0.4) 0%, transparent 30%),
    linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
}
/* 视频特有：闪烁动效 */
.gen-art.video::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  animation: shimmer 2.5s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.gen-art.video .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* 上下文菜单（节点右键） */
.context-menu {
  position: fixed; z-index: 9001;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
  min-width: 160px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.context-menu-item {
  padding: 7px 12px; border-radius: 4px;
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.context-menu-item:hover { background: var(--bg-3); }
.context-menu-item.danger { color: var(--red); }
.context-menu-item.danger:hover { background: rgba(239,68,68,0.1); }
.context-menu-shortcut {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  font-family: ui-monospace, monospace;
}
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* 顶栏撤销重做按钮 */
.history-controls { display: flex; gap: 4px; }
.history-controls .icon-btn { width: 32px; height: 32px; background: transparent; }
.history-controls .icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* 顶栏模板按钮 */
.btn-template {
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(249,115,22,0.15));
  border: 1px solid var(--purple);
  color: var(--purple);
}

/* ========== 批量生成节点（核心 demo 卖点）========== */
.batch-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  width: 100%; padding: 4px 0;
}
.batch-grid > * {
  aspect-ratio: 3/4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-3);
  position: relative;
}
.batch-cell {
  background: #eee;
}
.batch-cell img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  animation: cellIn .25s ease-out;
}
@keyframes cellIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.batch-grid.placeholder > * {
  border: 1px dashed var(--border-light);
  background: var(--bg-3);
}
.batch-grid.placeholder > *::after {
  content: '?';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4); font-size: 12px;
}
.batch-cell-skeleton {
  background: linear-gradient(90deg, var(--bg-3) 0%, var(--bg-4) 50%, var(--bg-3) 100%) !important;
  background-size: 200% 100% !important;
  animation: skeletonShift 1.4s ease-in-out infinite;
}
@keyframes skeletonShift {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.batch-grid .gen-art {
  width: 100%; height: 100%;
}
/* batch 节点上的小标识：第 N/6 张 */
.batch-grid .gen-art::after {
  content: attr(data-idx);
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,0.6); color: white;
  font-size: 9px; padding: 1px 5px;
  border-radius: 4px; line-height: 1.3;
}

/* 批量节点参数显示 */
.batch-meta {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 0;
  font-size: 11px; color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.batch-count-pill {
  background: var(--purple); color: black;
  padding: 1px 7px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 10px;
}

/* 节点头部 - 添加运行/复制按钮 */
.node-actions {
  display: flex; gap: 2px; margin-left: 6px;
}
.node-action-btn {
  width: 18px; height: 18px;
  background: transparent; border: 0; color: var(--text-3);
  border-radius: 3px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.node-action-btn:hover { background: var(--bg-4); color: var(--text); }

/* 项目卡片右键菜单 */
.project-card-menu {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 4px;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0;
  transition: opacity .15s;
  color: white;
}
.project-card:hover .project-card-menu { opacity: 1; }

/* 多选节点 */
.node.multi-selected {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange);
}

/* 聊天历史侧边栏（折叠） */
.chat-history-tab {
  position: absolute; left: -28px; top: 50%; transform: translateY(-50%);
  background: var(--bg-2); border: 1px solid var(--border);
  border-right: 0; border-radius: 6px 0 0 6px;
  padding: 16px 4px; cursor: pointer; color: var(--text-3);
  writing-mode: vertical-rl;
  font-size: 11px;
}

/* 工作流统计 */
.wf-stats {
  position: absolute; top: 16px; right: 16px;
  background: rgba(20,20,20,0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 11px; color: var(--text-3);
  backdrop-filter: blur(8px);
  display: flex; gap: 12px;
}
.wf-stats strong { color: var(--text); font-weight: 600; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* 工具类 */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mt-16 { margin-top: 64px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
