/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 蒸汽波 & 科技感 样式 */
:root {
    --bg-color: #0d0c1d;
    --primary-color: #9f78ff;
    --secondary-color: #00f5d4;
    --accent-color: #ff00c1;
    --text-color: #e0e0e0;
    --muted-color: #a7a9be;
    --dark-surface: rgba(23, 22, 43, 0.7);
    --border-color: rgba(159, 120, 255, 0.3);
    --glow-color: rgba(159, 120, 255, 0.5);
    --title-font: 'Orbitron', sans-serif;
    --body-font: 'Inter', sans-serif;
}


/* 基础样式 */
body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
    position: relative;
}
h1, h2, h3, h4, h5 { 
    font-family: var(--title-font); 
    letter-spacing: .06em; 
}

/* 背景网格 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(159, 120, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(159, 120, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    pointer-events: none;
    opacity: 0.5;
}

/* 背景光晕 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(159, 120, 255, 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

html {
    scroll-behavior: smooth;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(13, 12, 29, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo .brand { 
  display: flex; 
  align-items: center; 
  gap: 14px;
  position: relative;
  padding: 8px 0;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-logo .brand:hover {
  transform: translateX(2px);
}
.nav-logo .brand::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, transparent 0%, var(--secondary-color) 50%, transparent 100%);
  transition: height 0.3s ease;
  border-radius: 2px;
  box-shadow: 0 0 8px var(--secondary-color);
  opacity: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
}
.nav-logo .brand:hover::before {
  height: 90%;
  opacity: 1;
}

.brand-badge {
  width: 50px; 
  height: 50px; 
  border-radius: 16px;
  position: relative;
  display: grid; 
  place-items: center;
  background: 
    linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  background-size: 100% 100%, 110% 110%;
  background-position: center;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 
    0 10px 40px rgba(159, 120, 255, 0.4),
    0 0 20px var(--glow-color),
    inset 0 1px 2px rgba(255,255,255,.3),
    inset 0 -2px 4px rgba(0,0,0,.4);
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(5deg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.brand-badge-text {
  position: relative;
  z-index: 2;
  font-weight: 900; 
  letter-spacing: 0.5px;
  font-size: 19px;
  color: #fff;
  text-shadow: 
    0 2px 4px rgba(0,0,0,.5),
    0 0 20px rgba(255,255,255,.7),
    0 0 50px var(--glow-color);
  transition: all 0.3s ease;
}

/* 添加光泽和网格组合效果 */
.brand-badge::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    linear-gradient(
      45deg,
      transparent 30%,
      rgba(255,255,255,.15) 50%,
      transparent 70%
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,.02) 2px,
      rgba(255,255,255,.02) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,.02) 2px,
      rgba(255,255,255,.02) 4px
    );
  transform: rotate(45deg);
  transition: all 0.5s;
  animation: shimmer 4s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* 呼吸灯效果 */
@keyframes breathe {
  0%, 100% { 
    box-shadow: 
      0 8px 32px rgba(159, 120, 255, 0.3),
      0 4px 12px rgba(159, 120, 255, 0.2),
      0 0 40px rgba(159, 120, 255, 0.1),
      inset 0 1px 0 rgba(255,255,255,.2),
      inset 0 -1px 0 rgba(0,0,0,.1);
  }
  50% { 
    box-shadow: 
      0 8px 32px rgba(159, 120, 255, 0.4),
      0 4px 12px rgba(159, 120, 255, 0.3),
      0 0 60px rgba(159, 120, 255, 0.2),
      inset 0 1px 0 rgba(255,255,255,.25),
      inset 0 -1px 0 rgba(0,0,0,.15);
  }
}

.brand-badge {
  animation: breathe 3s ease-in-out infinite;
}

/* 添加扫描线效果 */
.brand-badge-scan {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255,255,255,0.8) 50%, 
    transparent 100%
  );
  animation: scan 3s linear infinite;
  opacity: 0;
}

.brand-badge:hover .brand-badge-scan {
  opacity: 0.8;
}

@keyframes scan {
  0% { 
    top: -2px;
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% { 
    top: 100%;
    opacity: 0;
  }
}

/* 内发光效果 */
.brand-badge::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,.15) 0%,
    transparent 50%,
    rgba(255,255,255,.05) 100%
  );
  pointer-events: none;
}

.nav-logo .brand:hover .brand-badge {
  transform: perspective(1000px) rotateX(10deg) rotateY(-10deg) scale(1.05) translateZ(10px);
  box-shadow: 
    0 20px 60px rgba(159, 120, 255, 0.5),
    0 10px 30px rgba(159, 120, 255, 0.4),
    0 0 40px var(--glow-color),
    inset 0 2px 6px rgba(255,255,255,.4),
    inset 0 -2px 6px rgba(0,0,0,.3);
}

.nav-logo .brand:hover .brand-badge-text {
  transform: translateZ(20px);
  text-shadow: 
    0 3px 6px rgba(0,0,0,.6),
    0 0 40px rgba(255,255,255,.8),
    0 0 80px var(--glow-color);
}

.brand-text { 
  display: flex; 
  flex-direction: column; 
  line-height: 1.2;
  position: relative;
}

.brand-title { 
  font-family: var(--title-font);
  font-weight: 700; 
  color: #fff;
  font-size: 20px;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #e0e0e0 0%, #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

.nav-logo .brand:hover .brand-title {
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 10px var(--glow-color);
}

.brand-caption { 
  font-size: 11px; 
  color: var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 2px;
  transition: color 0.3s ease;
}

.nav-logo .brand:hover .brand-caption {
  color: var(--primary-color);
}

/* 顶部工具栏 */
/* 顶部按钮区域在本阶段移除 */
.editor-toolbar { display: none; }

/* 主页hero部分 */
/* 应用容器布局 */
.app { 
    padding-top: 70px; 
    background-color: var(--bg-color);
}
.app-container { display: grid; grid-template-columns: 300px 1fr 320px; gap: 0; max-width: 1800px; margin: 0 auto; height: calc(100vh - 70px); }

/* 侧边分镜树 */
/* ============ 分镜编排（storyboard）样式 ============ */
.storyboard-editor {
    border: 1px solid rgba(255, 0, 170, 0.25);
    background: linear-gradient(180deg, rgba(255,0,170,0.06), rgba(0,0,0,0.0));
    box-shadow: 0 0 0 1px rgba(255, 0, 170, 0.15) inset, 0 12px 24px rgba(0,0,0,0.25);
    border-radius: 12px;
    padding: 16px 16px 20px;
    margin-bottom: 16px;
}
.storyboard-editor .section-header { 
    display: grid; 
    grid-template-columns: 1fr auto; 
    gap: 12px; 
    align-items: center; 
}
.storyboard-editor .section-title { 
    font-family: var(--title-font); 
    letter-spacing: .08em; 
    color: #fff; 
    text-shadow: 0 0 8px var(--glow-color); 
}
.storyboard-editor .section-actions { 
    display: flex; 
    gap: 8px; 
}
.storyboard-editor .section-actions .mini-btn { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
}
.storyboard-container { margin-top: 12px; }
.sb-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.sb-label { width: 100px; color: var(--muted-color); flex-shrink: 0; }
.sb-input { 
    flex: 1; 
    min-width: 0; 
    padding: 10px 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    background: rgba(0,0,0,0.35); 
    color: var(--text-color); 
    outline: none; 
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; 
}
.sb-row-2-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}
.sb-row-stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.sb-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}
.sb-select-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted-color);
    pointer-events: none;
    transition: color .2s ease;
}
.sb-select-wrapper:hover::after {
    color: var(--primary-color);
}

select.sb-input { -webkit-appearance: none; appearance: none; padding-right: 30px; }
select.sb-input option {
    background: #1c1b33;
    color: var(--text-color);
    padding: 8px 12px;
}
.sb-input::placeholder { color: var(--muted-color); }
.sb-input:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 2px rgba(159,120,255,.2); 
    background: rgba(0,0,0,0.45);
}
.sb-textarea { 
    width: 100%; 
    padding: 10px 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    background: rgba(0,0,0,0.35); 
    color: var(--text-color); 
    outline: none; 
    resize: vertical; 
    flex: 1;
    min-width: 0;
}
.sb-textarea::placeholder { color: var(--muted-color); }
.sb-textarea:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 2px rgba(159,120,255,.2); 
    background: rgba(0,0,0,0.45);
}
.storyboard-editor h4 { 
    margin-top: 10px; 
    margin-bottom: 6px; 
    color: #e8ddff; 
    text-shadow: 0 0 6px rgba(159,120,255,.6);
    font-family: var(--title-font);
}
.sb-panel-header { 
    color: #e8ddff; 
    font-family: var(--title-font);
}
.sb-panel { border: 1px dashed rgba(255, 0, 170, 0.3); border-radius: 12px; padding: 12px; margin: 12px 0; background: rgba(255,0,170,0.03); }
.sb-panel:hover { box-shadow: 0 0 0 1px rgba(255,0,170,0.2) inset, 0 6px 14px rgba(0,0,0,0.25); }
.sb-panel-header { font-weight: 600; margin-bottom: 6px; }
.sb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sb-col { min-width: 0; }
.sb-subtitle { font-size: 12px; color: var(--muted-color); margin-bottom: 6px; }
.sb-list { display: flex; flex-direction: column; gap: 6px; }
.sb-badge { display: inline-block; background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; }

/* 面板内图片编辑区（蒸汽波霓虹风格） */
.sb-panel-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.sb-image { position: relative; }
.sb-image-wrap { position: relative; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,0,170,0.25) inset, 0 6px 16px rgba(0,0,0,0.25); }
.sb-image-wrap img { width: 100%; height: 180px; object-fit: cover; display: block; }
.sb-image-remove { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.5); color: #fff; border: none; border-radius: 999px; padding: 6px 8px; cursor: pointer; }
.sb-image-placeholder { width: 100%; height: 180px; border: 1px dashed rgba(255,0,170,0.35); color: #ff55aa; background: rgba(255,0,170,0.06); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: all .2s ease; }
.sb-image-placeholder:hover { background: rgba(255,0,170,0.1); box-shadow: 0 0 16px rgba(255,0,170,0.2) inset; }
.sb-image-placeholder i { font-size: 20px; }
.sb-form { min-width: 0; }

/* ======= 模板画布（根据 layout_template 渲染） ======= */
.sb-layout { border: 1px dashed rgba(255, 0, 170, 0.35); border-radius: 12px; padding: 12px; background: rgba(255,0,170,0.03); margin: 12px 0 18px; }
.sb-layout-inner { display: grid; gap: 10px; width: 100%; aspect-ratio: 9/16; }
.sb-slot { position: relative; border: 1px solid rgba(255,0,170,0.35); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: rgba(255,0,170,0.06); }
.sb-slot.dragover { outline: 2px solid var(--primary-color); background: rgba(159,120,255,0.15); }
.sb-slot .sb-image-remove { position: absolute; top: 8px; right: 8px; }
.sb-slot-img, .sb-slot-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 在占位状态下让按钮更贴近漫画风格 */
.sb-slot .sb-image-placeholder { width: 100%; height: 100%; border: none; background: repeating-linear-gradient(45deg, rgba(255,0,170,0.06) 0 10px, rgba(255,0,170,0.1) 10px 20px); color: #ff55aa; border-radius: 0; }

/* 多图层容器与图层样式 */
.sb-slot-layers { position: absolute; inset: 0; overflow: hidden; }
.sb-layer { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(var(--scale, 1)) rotate(var(--rotate, 0deg)); cursor: grab; user-select: none; touch-action: none; z-index: var(--z, 1); }
.sb-layer img { display: block; width: 100%; height: auto; max-width: none; pointer-events: none; }
.sb-layer.selected { outline: 2px dashed rgba(0,245,212,.6); box-shadow: 0 0 0 2px rgba(0,245,212,.2) inset; }

/* 图层内悬浮工具条 */
.sb-layer-tools { position: absolute; right: 8px; top: 8px; display: none; gap: 8px; z-index: 3; pointer-events: auto; }
.sb-layer.selected .sb-layer-tools { display: flex; }
.sb-layer-tools .grp { display: inline-flex; background: rgba(0,0,0,0.5); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.sb-layer:hover .sb-layer-tools { opacity: 1; }
.sb-tool-btn { background: transparent; border: none; color: #fff; padding: 6px 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-right: 1px solid rgba(255,255,255,0.12); }
.sb-tool-btn:last-child { border-right: none; }
.sb-tool-btn:hover { background: rgba(159,120,255,0.35); }
.sb-tool-btn.danger { color: #ff4d6d; }
.sb-tool-btn.danger:hover { background: #ff4d6d; color: white; }

/* 槽位工具条（层级调整） */
.sb-slot-tools { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; z-index: 2; }
.sb-slot-tools { display:none; }

/* 生图按钮 */
.sb-gen-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    z-index: 3;
}
.sb-gen-btn:hover { background: var(--primary-color); border-color: var(--primary-color); }

/* 交互手柄：四角缩放 + 旋转手柄 */
.sb-handles { position: absolute; inset: 0; pointer-events: none; display: none; }
.sb-layer.selected .sb-handles { display: block; }
.sb-handle { position: absolute; width: 12px; height: 12px; border: 2px solid #fff; background: rgba(0,0,0,0.4); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.3); pointer-events: auto; cursor: nwse-resize; }
.sb-handle.tl { left: -6px; top: -6px; cursor: nwse-resize; }
.sb-handle.tr { right: -6px; top: -6px; cursor: nesw-resize; }
.sb-handle.bl { left: -6px; bottom: -6px; cursor: nesw-resize; }
.sb-handle.br { right: -6px; bottom: -6px; cursor: nwse-resize; }
.sb-rotate { position: absolute; left: 50%; top: -28px; transform: translateX(-50%); pointer-events: auto; }
.sb-rotate .dot { width: 12px; height: 12px; border: 2px solid #fff; background: rgba(0,0,0,0.4); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.3); cursor: grab; }
.sb-rotate .dot { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="white" d="M12 2v3l4-4l-4-4v3C6.48 0 2 4.48 2 10c0 2.21.72 4.24 1.94 5.9l1.46-1.46A7 7 0 0 1 5 10c0-3.86 3.14-7 7-7m7.06 3.1l-1.46 1.46A7 7 0 0 1 19 10c0 3.86-3.14 7-7 7v-3l-4 4l4 4v-3c5.52 0 10-4.48 10-10c0-2.21-.72-4.24-1.94-5.9"/></svg>') 16 16, grab; }
.sb-rotate::before { content: ''; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 2px; height: 16px; background: rgba(255,255,255,0.6); }

/* 单图 */
.sb-layout-single .sb-layout-inner { grid-template-columns: 1fr; grid-template-rows: 1fr; }

/* 纵向（vertical）上下各半 */
.sb-layout-double_vertical .sb-layout-inner { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }

/* 横向（horizontal）左右各半 */
.sb-layout-double_horizontal .sb-layout-inner { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }

/* 上单下双 顶部全景，底部两格略高 */
.sb-layout-triple_top_single_bottom_double .sb-layout-inner { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.sb-layout-triple_top_single_bottom_double .sb-slot:nth-child(1) { grid-column: 1 / -1; }

/* 上双下单 底部跨栏为情绪大格 */
.sb-layout-triple_top_double_bottom_single .sb-layout-inner { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.sb-layout-triple_top_double_bottom_single .sb-slot:nth-child(3) { grid-column: 1 / -1; }

/* 四宫格 2*2，留出更紧凑的 gutter */
.sb-layout-quad_grid_2x2 .sb-layout-inner { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; }

.sidebar { 
    border-right: 1px solid var(--border-color); 
    height: 100%; 
    background: rgba(13, 12, 29, 0.5);
    display: flex;
    flex-direction: column;
}
.sidebar-header { 
    padding: 16px 14px; 
    display: grid; 
    grid-template-columns: 1fr auto; 
    gap: 10px; 
    align-items: center; 
    position: sticky; top: 0; 
    background: rgba(13, 12, 29, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10;
    border-bottom: 1px solid var(--border-color); 
}
.sidebar-header h3 { 
    font-family: var(--title-font);
    font-size: 20px; 
    letter-spacing: .08em; 
    color: #fff;
    text-shadow: 0 0 8px var(--glow-color);
}
.tree-search { 
    width: 100%; 
    padding: 10px 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    font-size: 14px; 
    background: rgba(0,0,0,0.3);
    color: var(--text-color);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05); 
    transition: all 0.3s ease;
}
.tree-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--glow-color);
}

.tree { 
    padding: 8px 0 16px; 
    flex-grow: 1;
    overflow-y: auto; /* 允许目录独立滚动 */
    height: calc(100vh - 180px); /* 设定一个大致的高度 */
}
.mini-btn { 
    margin-top: 8px; 
    padding: 8px 12px; 
    font-size: 12px; 
    border: 1px solid var(--border-color);
    border-radius: 10px; 
    background: var(--dark-surface);
    color: var(--text-color);
    cursor: pointer; 
    box-shadow: 0 1px 2px rgba(0,0,0,.2); 
    transition: all 0.3s ease;
}
.btn-primary { 
    border-color: rgba(159,120,255,.5); 
    background: linear-gradient(180deg, rgba(159,120,255,.25), rgba(159,120,255,.1)); 
}
.btn-primary:hover { 
    background: linear-gradient(180deg, rgba(159,120,255,.45), rgba(159,120,255,.2)); 
    box-shadow: 0 0 14px var(--glow-color);
}
.mini-btn:hover { 
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.tree .tree-group { 
    padding: 10px 14px; 
    color: var(--primary-color); 
    font-size: 12px; 
    text-transform: uppercase; 
    letter-spacing: .06em; 
    opacity: .9;
    font-weight: 600;
}
.tree ul { list-style: none; }
.tree .node { 
    display: flex; 
    align-items: center; 
    gap: 8px; padding: 8px 12px; 
    cursor: pointer; 
    border-left: 3px solid transparent; 
    transition: all .15s ease;
    position: relative;
}

.tree .node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tree .node:hover { 
    background: rgba(159, 120, 255, 0.1); 
    border-left-color: var(--primary-color); 
}
.tree .node.active { 
    background: rgba(159, 120, 255, 0.2); 
    border-left-color: var(--secondary-color); 
}
.tree .node.active::before {
    opacity: 0.1;
}

.tree .node .badge { 
    background: rgba(0, 245, 212, 0.15); 
    color: var(--secondary-color); 
    padding: 2px 6px; 
    border-radius: 6px; 
    font-size: 12px; 
    border: 1px solid rgba(0, 245, 212, 0.3);
}
.tree .node .thumb { 
    width: 28px; 
    height: 28px; 
    border-radius: 4px; 
    background: var(--dark-surface);
    border: 1px solid var(--border-color);
    object-fit: cover; 
}
.tree .node .title { 
    font-weight: 600; 
    color: #fff; 
}
.tree .node .muted { 
    color: #9ca3af; 
    font-size: 12px; 
}

.paragraph-id-badge {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 14px;
}

/* 空目录占位 */
.empty-tree { 
    display: grid; 
    place-items: center; 
    padding: 24px; 
    color: #9ca3af;
    height: 100%;
}
.empty-tree .empty-card { 
    text-align: center; 
    background: var(--dark-surface); 
    border: 1px dashed var(--border-color); 
    border-radius: 10px; 
    padding: 24px; 
    width: calc(100% - 24px); 
}
.empty-tree .empty-card i { 
    font-size: 24px; 
    color: var(--primary-color);
    margin-bottom: 12px; 
    display: block; 
    text-shadow: 0 0 10px var(--glow-color);
}
.empty-tree .mini-btn { margin-top: 10px; }

.empty-actions-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: #a7a9be;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.action-card:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--glow-color);
}

.action-card i {
    font-size: 20px;
    margin-bottom: 4px;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.action-card:hover i {
    color: #fff;
}

.action-card:first-child {
    grid-column: 1 / -1; /* 让第一个按钮占据整行 */
    background: rgba(159, 120, 255, 0.1);
    font-weight: 600;
    color: #fff;
}

.action-card:first-child:hover {
    background: var(--primary-color);
}

/* 可编辑文本 */
.editable-text {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
  cursor: text;
  min-width: 60px;
}
.editable-text:hover {
  background: rgba(159, 120, 255, 0.1);
}
.editable-text:focus {
  outline: none;
  background: rgba(159, 120, 255, 0.2);
  box-shadow: 0 0 0 2px var(--glow-color);
}

/* 故事标题 */
.story-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid var(--border-color);
}
.story-header .story-title {
  color: white;
  font-weight: 700;
}
.story-header .editable-text:hover {
  background: rgba(255, 255, 255, 0.2);
}
.story-header .editable-text:focus {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* 组头部 */
.tree-group.editable {
  margin-bottom: 8px;
}
.group-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--dark-surface);
  border-left: 3px solid var(--primary-color);
}
.group-header:hover .delete-btn {
  opacity: 1;
}

/* 删除按钮 */
.delete-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #ff4d6d;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  flex-shrink: 0; /* 防止删除按钮被压缩 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.delete-btn:hover {
  background: rgba(255, 77, 109, 0.1);
  text-shadow: 0 0 5px #ff4d6d;
}
.delete-btn.small {
  font-size: 12px;
  padding: 2px 6px;
}
.node.with-delete {
  position: relative;
  /* padding-right: 40px; */ /* 移除固定padding，使用flex gap */
  display: flex;
  align-items: center;
  justify-content: space-between; /* 让内容和按钮分布两端 */
  gap: 8px; /* 增加元素间距 */
}
.node.with-delete .delete-btn {
  /* position: absolute; */ /* 改为flex布局，不再需要绝对定位 */
  /* right: 8px; */
  /* top: 50%; */
  /* transform: translateY(-50%); */
  z-index: 10; /* 确保删除按钮在最上层 */
}
.node.with-delete:hover .delete-btn {
  opacity: 1;
}

/* Section节点的内容容器 */
.node.with-delete .section-content {
  display: flex;
  align-items: center;
  gap: 8px; /* 增加标题和ID之间的间距 */
  flex-grow: 1; /* 允许内容区占据多余空间 */
  min-width: 0; /* 允许flex子元素收缩 */
  /* padding-right: 70px; */ /* 移除 */
}
.node.with-delete .section-content .title {
  flex-shrink: 0; /* section ID不收缩 */
}
.node.with-delete .section-content .muted {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-grow: 1; /* 允许收缩 */
  min-width: 0; /* 允许收缩 */
  overflow: hidden; /* 在容器级别处理溢出 */
}
.node.with-delete .section-content .section-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* 操作按钮区域 */
.action-buttons {
  padding: 12px;
  background: rgba(13, 12, 29, 0.5);
  border-top: 1px solid var(--border-color);
}
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.mini-btn.btn-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}
.mini-btn.btn-primary:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}
.mini-btn.btn-block {
  width: 100%;
  justify-content: center;
}
/* 段落下的新操作按钮容器 */
.tree-actions-paragraph {
  display: flex;
  justify-content: center; /* 居中按钮 */
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
  background: rgba(13, 12, 29, 0.5);
  margin-top: 8px; /* 与上方内容保持间距 */
}

/* 新的圆形/胶囊形图标按钮 */
.action-btn-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%; /* 圆形 */
  background: var(--dark-surface);
  border: 1px solid var(--border-color);
  color: #a7a9be;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 12px;
  position: relative;
  line-height: 0; /* 确保flex子元素精确居中 */
}

.action-btn-circle.small {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.action-btn-circle:hover {
  transform: translateY(-2px) scale(1.1);
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 0 15px var(--glow-color);
}

/* 主操作按钮的特殊样式 */
.action-btn-circle.primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  border: none;
  color: white;
  box-shadow: 0 0 10px var(--glow-color);
}

.action-btn-circle.primary:hover {
  box-shadow: 0 0 20px var(--accent-color);
  color: white; /* 确保悬停时颜色不变 */
}

/* 禁用状态下的生成按钮（加载中） */
.action-btn-circle.primary:disabled {
    cursor: wait;
    background: var(--accent-color);
}

.action-btn-circle.primary:disabled i {
    margin-right: 0; /* 确保加载图标居中 */
}

/* 按钮内的图标样式 */
.action-btn-circle i {
  transition: transform 0.3s ease;
}

.action-btn-circle:hover i {
  transform: scale(1.1);
}

/* 首页 Hero Section */
.hero {
    background: transparent;
    padding: 180px 0 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80vw;
    height: 80vw;
    max-width: 1200px;
    max-height: 1200px;
    background: radial-gradient(circle, rgba(159, 120, 255, 0.2) 0%, rgba(159, 120, 255, 0) 60%);
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    animation: pulse 5s infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
    70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text {
    text-align: center;
}

.hero-title {
    font-family: var(--title-font);
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.3;
    letter-spacing: 0.05em;
    text-shadow: 0 0 20px var(--glow-color);
}

.gradient-text {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.1rem;
    margin: 0 auto 2rem;
    max-width: 650px;
    opacity: 0.8;
    line-height: 1.7;
    color: var(--text-color);
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 14px 35px;
    border: 2px solid transparent;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    background-size: 200% 200%;
    transition: background-position 0.5s ease;
    z-index: -1;
    opacity: 0;
}

.btn:hover::before {
    background-position: 100% 100%;
    opacity: 1;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(159, 120, 255, 0.6);
}

.btn-primary:hover {
    background: transparent;
    color: #fff;
    border-color: var(--accent-color);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 193, 0.7);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--glow-color);
}

.btn-full {
    width: 100%;
}

.hero-image {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

.flow-diagram {
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.flow-card {
    background: var(--dark-surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.flow-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px var(--glow-color);
    border-color: var(--primary-color);
}

.flow-card i {
    font-size: 2rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--glow-color);
}

.flow-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.flow-arrow {
    font-size: 2rem;
    color: var(--border-color);
    animation: arrow-pulse 2s infinite ease-in-out;
}

@keyframes arrow-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        color: var(--secondary-color);
    }
}

/* 故事创作区域 */
.story-creation-section {
    padding: 100px 0;
    background: transparent;
    position: relative;
}

.creation-panel {
    max-width: 800px;
    margin: 0 auto;
    background: var(--dark-surface);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

#storyInput,
#apiKeyInput {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    background-color: rgba(0,0,0,0.2);
    color: var(--text-color);
    font-family: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#storyInput::after,
#apiKeyInput::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(159, 120, 255, 0.2), transparent);
    transition: left 0.8s ease;
    animation: scan-glow 3s linear infinite;
}

@keyframes scan-glow {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }
    100% {
        transform: translateX(200%) skewX(-15deg);
    }
}


#storyInput {
    min-height: 250px;
    margin-bottom: 1.5rem;
    resize: vertical;
}

#apiKeyInput {
    margin-bottom: 0.5rem;
}

#storyInput:focus,
#apiKeyInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--glow-color);
}


.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 0 5px var(--glow-color);
}

.btn-text {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    text-align: right;
    display: block;
    width: 100%;
    margin-top: 8px;
    transition: color 0.3s ease;
}

.btn-text:hover {
    color: #fff;
    text-decoration: underline;
    text-shadow: 0 0 5px var(--secondary-color);
}

/* 底部操作栏 */
.tree-actions {
  padding: 12px;
  margin-top: auto; /* 将其推到底部 */
  background: rgba(13, 12, 29, 0.5);
  border-top: 1px solid var(--border-color);
}

/* 右侧编辑器 */
.editor { 
    padding: 24px;
    height: calc(100vh - 70px); /* 设定高度以启用粘性定位 */
    overflow-y: auto;
    background-color: var(--bg-color);
    position: sticky; /* 应用粘性定位 */
    top: 70px; /* 从导航栏下方开始固定 */
}
.meta-aside { 
    border-left: 1px solid var(--border-color); 
    background: rgba(13, 12, 29, 0.5);
    height: calc(100vh - 70px); /* 设定高度以启用粘性定位 */
    overflow-y: auto;
    position: sticky; /* 应用粘性定位 */
    top: 70px; /* 从导航栏下方开始固定 */
}
.meta-aside-inner { 
    padding: 20px; 
}
.meta-aside h3 { 
    font-family: var(--title-font);
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 8px var(--glow-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-aside h3 .mini-btn {
    margin-top: 0;
    height: 28px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.meta-aside h3 .mini-btn i {
    font-size: 14px;
}

.meta-aside h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.meta-aside h4 .count-badge {
    transform: translateY(-1px);
}

.editor-empty { 
    margin: 80px auto; 
    text-align: center; 
    color: #9ca3af;
    height: calc(100% - 160px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.editor-empty i { 
    font-size: 48px; 
    color: var(--primary-color);
    margin-bottom: 16px;
    text-shadow: 0 0 15px var(--glow-color);
    animation: float 3s ease-in-out infinite;
}
.hidden { display: none !important; }

.editor-panel { display: flex; flex-direction: column; gap: 16px; }
.editor-header { 
    display: flex; 
    align-items: flex-start; /* 改为 flex-start 以适应多行 */
    flex-direction: column; /* 垂直排列 */
    gap: 8px; /* 增加ID和标题之间的间距 */
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
#editorTitle { 
    font-family: var(--title-font);
    font-size: 24px; 
    font-weight: 700; 
    color: #fff;
    text-shadow: 0 0 10px var(--glow-color);
    display: flex;
    flex-direction: column; /* 内部也垂直排列 */
    align-items: flex-start;
    gap: 4px;
}

.section-id-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
}

.section-intent-text {
    font-size: 22px;
    font-weight: normal;
    padding: 4px 6px; /* 为可编辑状态提供一些内边距 */
    border-radius: 6px;
    width: 100%;
}

.editor-meta-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-badge { 
    background: var(--dark-surface); 
    color: var(--secondary-color);
    padding: 4px 10px; 
    border-radius: 999px; 
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.editor-content { 
  padding: 20px 0;
  min-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* 主画布区域 */
.main-canvas-section {
  background: var(--dark-surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border-color);
}

.canvas-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #fff;
  margin: 0;
  font-weight: 600;
}

.canvas-header h3 i {
    color: var(--primary-color);
}

.canvas-tools {
  display: flex;
  gap: 8px;
}

.tool-btn {
  padding: 6px 10px;
  background: var(--dark-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 0 8px var(--glow-color);
}

.canvas-area {
  height: 350px;
  background: repeating-radial-gradient(circle at center, rgba(159, 120, 255, 0.05), rgba(159, 120, 255, 0.05) 1px, transparent 1px, transparent 20px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--border-color);
  transition: all 0.3s;
}

.canvas-area.dragover {
  background-color: rgba(159, 120, 255, 0.2);
  border-color: var(--primary-color);
}

.canvas-placeholder {
  text-align: center;
  color: #9ca3af;
  cursor: pointer;
  padding: 40px;
  transition: all 0.3s;
  z-index: 1;
}

.canvas-placeholder:hover {
  color: #fff;
}

.canvas-placeholder i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  color: var(--primary-color);
  text-shadow: 0 0 15px var(--glow-color);
}

.canvas-placeholder p {
  font-size: 14px;
  margin: 0;
}

/* 信息面板布局 */
.info-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

.info-section {
  background: var(--dark-surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

/* 面板悬停效果 - 简约 */
.info-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--glow-color);
  border-color: var(--primary-color);
}

/* 移除所有装饰线 */

/* 移除过度的光泽效果 */

/* 移除扫描线动画 */

/* 面板内的标题样式 */
.info-section .section-title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 1;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

/* 移除面板标题的装饰线 */
.info-section .section-title::after {
  display: none;
}

/* 隐藏图标 */
.info-section .section-title i {
  display: none;
}

.core-info .info-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 1200px) {
  .core-info .info-blocks {
    grid-template-columns: 1fr;
  }
}

.info-block { 
  margin: 0;
}
.info-block h4 { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  color: #fff; 
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.info-block h4 i {
    color: var(--secondary-color);
}

.text-block { 
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px; 
  padding: 14px 16px; 
  color: var(--text-color); 
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.7;
  min-height: 50px;
  position: relative;
  transition: all 0.3s ease;
}

.text-block:hover {
  border-color: var(--primary-color);
  background: rgba(159, 120, 255, 0.1);
}

/* 元信息网格布局 */
.meta-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.meta-group {
  margin: 0;
}

.meta-group h5 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 10px;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-list.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.meta-list.compact li {
  background: var(--dark-surface);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  height: fit-content;
  position: relative;
  backdrop-filter: blur(4px);
  box-shadow: none;
  margin: 4px; /* 添加margin防止重叠 */
}

.meta-list.compact li:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  transform: translateY(-2px); /* 悬停时保留Y轴位移 */
  box-shadow: 0 0 10px var(--glow-color);
}

/* 针对对白列表的特殊样式 */
#metaDialogues.meta-list.compact li {
    width: 100%;
    border-radius: 8px; /* 可以用方角矩形 */
    justify-content: flex-start;
    padding: 8px 14px;
    font-size: 13px; /* 字体可以稍大一些 */
}

/* 长文本处理 */
.meta-list.compact li[title] {
  cursor: help;
}
.meta-list { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
  position: relative;
}
.meta-list li { 
  background: var(--dark-surface); 
  border: 1px solid var(--border-color); 
  border-radius: 8px; 
  padding: 8px 12px;
  margin: 4px -10px; /* 用负外边距补偿内边距 */
  font-size: 14px; 
  color: var(--text-color);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 高亮状态 - 当前section使用的元信息 */
.meta-list li.meta-item-highlighted {
  background: linear-gradient(95deg, 
    rgba(159, 120, 255, 0.2) 0%,
    rgba(0, 245, 212, 0.15) 100%
  );
  border: 1px solid var(--primary-color);
  position: relative;
  color: #fff;
  font-weight: 500;
  padding: 8px 22px 8px 30px; /* 增加左右内边距 */
  box-shadow: 0 0 15px var(--glow-color);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 渐变边框效果 */
.meta-list li.meta-item-highlighted::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 8px;
  background: linear-gradient(
    90deg, 
    var(--primary-color), 
    var(--secondary-color), 
    var(--primary-color)
  );
  background-size: 200% 100%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: borderFlow 4s linear infinite;
}

.meta-list li.meta-item-highlighted:hover::before {
  opacity: 0.5;
}

/* 边框流动动画 */
@keyframes borderFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* 左侧优雅圆点指示器 */
.meta-list li.meta-item-highlighted::after {
  content: '';
  position: absolute;
  left: 18px; /* 调整圆点位置 */
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  box-shadow: 
    0 0 8px var(--glow-color),
    0 0 16px var(--secondary-color);
  animation: dotPulse 2s ease-in-out infinite;
  transition: all 0.3s ease;
}

/* 圆点脉冲动画 */
@keyframes dotPulse {
  0%, 100% {
    width: 4px;
    height: 4px;
    box-shadow: 
      0 0 8px var(--glow-color),
      0 0 16px var(--secondary-color);
  }
  50% {
    width: 6px;
    height: 6px;
    box-shadow: 
      0 0 12px var(--glow-color),
      0 0 24px var(--secondary-color);
  }
}

/* 淡化状态 - 未使用的元信息 */
.meta-list li.meta-item-faded {
  opacity: 0.45;
  filter: grayscale(30%);
  transform: scale(0.98);
}

/* 悬停效果 */
.meta-list li:hover {
  background: rgba(159, 120, 255, 0.1);
  /* transform: translateX(2px); */ /* 移除，因为会与负外边距冲突 */
  transition: all 0.2s ease;
}

.meta-list li.meta-item-highlighted:hover {
  background: linear-gradient(95deg, 
    rgba(159, 120, 255, 0.25) 0%,
    rgba(0, 245, 212, 0.2) 100%
  );
  border-color: var(--secondary-color);
  transform: scale(1.01);
  box-shadow: 0 0 20px var(--secondary-color);
}

/* 高亮项悬停时圆点增强 */
.meta-list li.meta-item-highlighted:hover::after {
  width: 6px;
  height: 6px;
  left: 17px; /* 调整圆点位置 */
  background: linear-gradient(135deg, 
    var(--primary-color) 0%, 
    var(--secondary-color) 100%
  );
  box-shadow: 
    0 0 16px var(--glow-color),
    0 0 32px var(--secondary-color),
    inset 0 0 2px rgba(255, 255, 255, 0.6);
}

/* 模态框 */
.modal { 
    position: fixed; 
    inset: 0; 
    background: rgba(13, 12, 29, 0.5); 
    backdrop-filter: blur(10px);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 10000; 
    pointer-events: auto; 
}
.modal-content { pointer-events: auto; }
.modal.hidden { display: none; }
.modal-content { 
    width: min(900px, 92vw); 
    background: var(--bg-color); 
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0,0,0,.5); 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
}
.modal-header { 
    padding: 14px 20px; 
    border-bottom: 1px solid var(--border-color); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}
.modal-header h3 {
    font-family: var(--body-font);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.02em;
}
.modal-body { padding: 16px 20px; }
.modal-footer { 
    padding: 12px 20px; 
    border-top: 1px solid var(--border-color); 
    display: flex; 
    gap: 10px; 
    justify-content: flex-end; 
    background: rgba(0,0,0,0.2);
}
.icon-btn { 
    background: transparent; 
    border: 0; 
    font-size: 18px; 
    cursor: pointer; 
    color: #9ca3af; 
    transition: all 0.3s ease;
}
.icon-btn:hover {
    color: #fff;
    transform: rotate(90deg);
}
#jsonInput { 
    width: 100%; 
    min-height: 260px; 
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 13px; line-height: 1.5; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 10px; 
    resize: vertical; 
    background: rgba(0,0,0,0.3);
    color: var(--text-color);
}
#jsonExample { 
    background: #0b1021; 
    color: #e5e7eb; 
    padding: 12px; 
    border-radius: 8px; 
    overflow: auto; 
    border: 1px solid var(--border-color);
}
.json-hint summary { 
    cursor: pointer; 
    color: var(--secondary-color); 
    margin: 8px 0; 
}

/* 实体总览 */
.entities-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 24px; 
}
.count-badge { 
    background: var(--primary-color); 
    color: #fff; 
    padding: 2px 8px; 
    border-radius: 999px; 
    font-size: 12px; 
}

/* 通用隐藏/显示按钮样式复用上方btn */
.btn-primary-modal {
    padding: 10px 24px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 14px;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px var(--glow-color);
}
.btn-primary-modal:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--glow-color);
}

/* 生图弹窗布局 */
.imggen-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: stretch; }
.imggen-left { background: rgba(0,0,0,0.25); border: 1px solid var(--border-color); border-radius: 10px; padding: 10px; display: grid; gap: 10px; }
#imgGenPreview { width: 100%; height: auto; background: #fff; border-radius: 8px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset; }
.imggen-hint { color: #9ca3af; font-size: 12px; }
.imggen-right { display: flex; flex-direction: column; gap: 14px; }
.imggen-right .sb-row { align-items: center; }
.imggen-right .sb-label { width: 64px; }
.imggen-right .mini-btn { margin-top: 0; }
.imggen-right #imgGenLocalDirLabel { flex: 1; }
.imggen-prompt { flex: 1; display: flex; flex-direction: column; }
.imggen-prompt .sb-textarea { flex: 1; min-height: 0; }
.imggen-candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.imggen-candidates .cand { border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.25); cursor: pointer; }
.imggen-candidates .cand img { width: 100%; height: 100px; object-fit: cover; display: block; }
.imggen-candidates .cand.active { outline: 2px solid var(--secondary-color); }

/* 编辑区右侧/底部候选列表容器 */
.sb-candidates-panel { border: 1px dashed rgba(255,0,170,0.35); border-radius: 12px; padding: 10px; background: rgba(255,0,170,0.03); margin-top: 10px; }
.sb-cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.sb-cand { border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.25); cursor: pointer; }
.sb-cand img { width: 100%; height: 100px; object-fit: cover; display: block; }

/* 将候选浮层放在画布内部底部 */
.sb-layout { position: relative; }
.sb-candidates-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px;
  background: linear-gradient(0deg, rgba(13,12,29,0.85), rgba(13,12,29,0.0));
}

/* 响应式 */
/* 响应式布局调整 */
@media screen and (max-width: 1200px) {
  .info-panels {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 1024px) {
  .app-container { 
    grid-template-columns: 240px 1fr; 
  }
  .meta-aside { 
    display: none; 
  }
}

@media screen and (max-width: 768px) {
  .app-container { 
    grid-template-columns: 1fr; 
  }
  .sidebar { 
    position: static; 
    height: auto; 
  }
  .canvas-area {
    height: 300px;
  }
  .entities-grid { 
    grid-template-columns: 1fr; 
  }
  .tab-header {
    overflow-x: auto;
  }
}

@media screen and (max-width: 520px) {
  .canvas-area {
    height: 250px;
  }
  .tab-btn {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* 通用section样式 */
section {
    padding: 100px 0;
}

.section-title {
    font-family: var(--title-font);
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #fff;
    position: relative;
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px var(--glow-color);
}

/* 通用页面的section标题装饰线（不影响面板） */
section > .container > .section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    box-shadow: 0 0 10px var(--secondary-color), 0 0 10px var(--primary-color);
}

/* 关于我部分 */
.about {
    background: #f8fafc;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #666;
    line-height: 1.8;
}

.skills {
    margin-top: 2rem;
}

.skills h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.skill-tag {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-weight: 500;
}

/* 项目部分 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.project-image {
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-placeholder {
    color: white;
    text-align: center;
}

.project-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.project-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tech span {
    background: #f1f5f9;
    color: #6366f1;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 联系方式部分 */
.contact {
    background: #f8fafc;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.contact-item i {
    font-size: 1.5rem;
    color: #6366f1;
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
}

.contact-item p {
    color: #666;
}

/* 表单样式 */
.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* 页脚样式 */
.footer {
    background: #000;
    color: #9ca3af;
    padding: 3rem 0 1.5rem;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 2;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.footer-section p {
    color: #9ca3af;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: #1f2937;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 0 10px var(--glow-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    body::before {
        background-size: 40px 40px;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.2);
        padding: 2rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-container {
        display: flex;
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-stats {
        flex-direction: row;
        justify-content: space-around;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .container {
        padding: 0 15px;
    }

    .nav-container {
        padding: 0 15px;
    }

    .about-stats {
        flex-direction: column;
    }
}

/* 滚动动画 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    animation: slideInUp 0.8s ease forwards;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    border: 2px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

.tree ul li {
  border-bottom: 1px solid var(--border-color); /* 为每个段落添加底部边界 */
}

/* 段落容器 */
.node.with-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  min-height: 60px;
  padding: 8px 12px;
}

.paragraph-row-1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
}

.paragraph-row-2 {
  width: 100%;
}

/* 悬停时出现的操作按钮容器 */
.paragraph-actions-hover {
  display: flex;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.node.with-actions:hover .paragraph-actions-hover {
  opacity: 1;
  visibility: visible;
}

/* 小节 (Section) 节点的缩进和样式 */
.tree ul ul {
  padding-left: 20px; /* 为小节列表添加缩进 */
}

.tree .node.section-node { /* 为小节节点添加一个特定类以区分 */
  padding-left: 15px;
  position: relative;
  border-left: 2px solid var(--border-color);
  margin-left: 5px;
}

.tree .node.section-node:hover {
  border-left-color: var(--primary-color);
}
.tree .node.section-node.active {
  border-left-color: var(--secondary-color);
}
.action-btn-circle.delete {
  background: #2d1a27;
  color: #ff4d6d;
  border-color: #5c2c3e;
}

.action-btn-circle.delete:hover {
  background: #ff4d6d;
  color: white;
  border-color: #ff4d6d;
}

.action-btn-circle.primary:disabled {
    cursor: wait;
    background: var(--accent-color);
}

/* 生成中的段落样式 */
.node.generating {
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(159, 120, 255, 0.25) 45%,
    rgba(159, 120, 255, 0.35) 50%,
    rgba(159, 120, 255, 0.25) 55%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: scanning-glow 2s linear infinite;
  border-left-color: var(--secondary-color) !important;
}

@keyframes scanning-glow {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
