/* ==========================================================================
   星穹文本库 · 寰宇纪元设计系统 (Aether & Mythos Design System)
   核心基调：未来高级科技感 (Sci-Fi HUD, Glassmorphism, Quantum Cyan) 
             × 神话史诗感 (Celestial Gold, Obsidian Deep, Astral Constellation)
   ========================================================================== */

:root {
  /* 基础深邃黑曜石与星云阶跃 */
  --bg-deep: #05070d;
  --bg-surface: #080c18;
  --bg-elevated: #0f1528;
  --bg-panel: rgba(14, 21, 38, 0.72);
  --bg-panel-hover: rgba(22, 33, 60, 0.85);

  /* 史诗神圣金与星神微光 */
  --gold-primary: #f3d790;
  --gold-bright: #ffe8ad;
  --gold-glow: rgba(243, 215, 144, 0.28);
  --gold-subtle: rgba(243, 215, 144, 0.12);
  --gold-line: rgba(243, 215, 144, 0.35);

  /* 未来量子青与智识蓝 */
  --cyan-core: #44e3ed;
  --cyan-bright: #8cf3fa;
  --cyan-glow: rgba(68, 227, 237, 0.32);
  --cyan-soft: rgba(68, 227, 237, 0.12);

  /* 忆质虚空紫与星轨色 */
  --violet-deep: #7866ff;
  --violet-glow: rgba(120, 102, 255, 0.25);
  --rose-quantum: #ff689e;

  /* 文字系统 */
  --text-primary: #f5f7fd;
  --text-secondary: #a7b3d2;
  --text-tertiary: #6b789e;
  --text-gold: #edd287;
  --text-cyan: #7beaf0;

  /* HUD 刻度线条与发光边框 */
  --border-subtle: rgba(132, 155, 218, 0.15);
  --border-active: rgba(243, 215, 144, 0.45);
  --border-cyan: rgba(68, 227, 237, 0.45);
  --hud-corner: #f3d790;

  /* 几何与阴影 */
  --radius-hud: 14px;
  --radius-sm: 8px;
  --radius-round: 9999px;
  --shadow-celestial: 0 16px 40px -10px rgba(0, 0, 0, 0.7), 0 0 24px rgba(68, 227, 237, 0.08);
  --shadow-hover: 0 20px 48px -8px rgba(0, 0, 0, 0.85), 0 0 32px var(--gold-glow);

  /* 字体家族 */
  --font-mythic: "Cinzel", "Noto Serif SC", serif;
  --font-scifi: "Orbitron", "PingFang SC", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
}

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  background-color: var(--bg-deep);
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* 背景星空与量子微粒 Canvas */
#cosmos-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -2;
}

#starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: 
    radial-gradient(1000px 500px at 80% -5%, rgba(120, 102, 255, 0.16), transparent 70%),
    radial-gradient(800px 600px at 15% 35%, rgba(68, 227, 237, 0.09), transparent 60%),
    radial-gradient(1200px 700px at 50% 100%, rgba(243, 215, 144, 0.06), transparent 80%);
}

/* 滚动条美化 (HUD晶轨感) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(5, 7, 13, 0.85);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-line), var(--border-subtle));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gold-primary), var(--cyan-core));
}

/* 统一超链接重置 */
a {
  color: var(--cyan-bright);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
a:hover {
  text-decoration: none;
  color: var(--gold-bright);
  text-shadow: 0 0 10px var(--gold-glow);
}

/* ==========================================================================
   头部导航顶栏 (Astral Command Deck)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: rgba(8, 12, 24, 0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gold-line) 25%, var(--cyan-core) 50%, var(--gold-line) 75%, transparent 100%);
  opacity: 0.65;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* 品牌 Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-icon {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}

.icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed var(--gold-primary);
  opacity: 0.7;
  animation: rotateRing 20s linear infinite;
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo {
  font-size: 18px;
  color: var(--gold-bright);
  text-shadow: 0 0 14px var(--gold-primary);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.main-title {
  font-family: var(--font-mythic);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #ffffff 20%, var(--gold-bright) 60%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}

.en-sub {
  font-family: var(--font-scifi);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--cyan-core);
  letter-spacing: 2.2px;
  opacity: 0.85;
}

/* 检索命中高亮（实体页片段 / 命令面板结果） */
.snippet mark, .palette-item mark {
  background: rgba(243, 215, 144, 0.28);
  color: var(--gold-bright);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* 导航按钮 */
.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-primary);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn:hover {
  border-color: var(--gold-line);
  background: var(--bg-panel-hover);
  box-shadow: 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

/* 智慧探真 (AI) 专有未来按钮 */
.btn.ai-btn {
  background: linear-gradient(135deg, rgba(68, 227, 237, 0.18), rgba(120, 102, 255, 0.25));
  border: 1px solid rgba(68, 227, 237, 0.5);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(68, 227, 237, 0.2);
}

.btn.ai-btn:hover {
  background: linear-gradient(135deg, rgba(68, 227, 237, 0.3), rgba(120, 102, 255, 0.4));
  border-color: var(--gold-primary);
  box-shadow: 0 0 24px var(--cyan-glow), 0 0 12px var(--gold-glow);
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold-primary), #c99b45);
  border: none;
  color: #070912;
  font-weight: 700;
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--gold-bright), #dfb15a);
  box-shadow: 0 0 20px var(--gold-glow);
}

.btn.danger {
  border-color: rgba(255, 104, 158, 0.4);
  color: var(--rose-quantum);
  background: rgba(255, 104, 158, 0.08);
}

/* ==========================================================================
   主内容区布局
   ========================================================================== */
.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 80px;
  min-height: calc(100vh - 160px);
}

.view {
  opacity: 1;
}

@keyframes cosmicFadeUp {
  from { opacity: 0.2; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 首页 Hero 穹宇大厅 */
.hero {
  position: relative;
  padding: 56px 48px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(16, 23, 46, 0.75) 0%, rgba(8, 12, 24, 0.9) 100%);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow-celestial);
  margin-bottom: 38px;
  overflow: hidden;
}

/* 科技 HUD 角落四方刻度标记 */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.hero::before {
  top: 8px; left: 8px;
  border-top: 2px solid var(--gold-primary);
  border-left: 2px solid var(--gold-primary);
}
.hero::after {
  bottom: 8px; right: 8px;
  border-bottom: 2px solid var(--cyan-core);
  border-right: 2px solid var(--cyan-core);
}

.hero-astral-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 170, 255, 0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(148, 170, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.6;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-scifi);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan-bright);
  background: rgba(68, 227, 237, 0.1);
  border: 1px solid rgba(68, 227, 237, 0.35);
  padding: 4px 14px;
  border-radius: var(--radius-round);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--font-mythic);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--gold-bright) 0%, var(--cyan-bright) 60%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 35px var(--gold-glow);
}

.hero p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.85;
}

.hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 36px auto 0;
  flex-wrap: wrap;
  max-width: 860px;
}

.hstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hud);
  min-width: 140px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hstat:hover {
  border-color: var(--border-active);
  background: rgba(243, 215, 144, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 16px var(--gold-glow);
}

.hstat b {
  font-family: var(--font-scifi);
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 40%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.hstat span {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: 500;
  margin-top: 6px;
}

/* 分组标题与几何线饰 */
.group-title {
  margin: 36px 0 16px;
  font-family: var(--font-scifi);
  font-size: 13px;
  color: var(--gold-primary);
  letter-spacing: 3px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
}

.group-title::before {
  content: "✦";
  font-size: 10px;
  color: var(--cyan-core);
}

.group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-line), var(--border-subtle), transparent);
}

/* 首页分类模块网格 (HUD Hologram Cards) */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.cat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-core), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cat-card:hover {
  transform: translateY(-4px);
  background: var(--bg-panel-hover);
  border-color: var(--gold-line);
  box-shadow: var(--shadow-hover);
}

.cat-card:hover::before {
  opacity: 1;
}

.cat-card .ico {
  font-size: 28px;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.cat-card .nm {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat-card .cnt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--cyan-bright);
  background: var(--cyan-soft);
  border: 1px solid rgba(68, 227, 237, 0.25);
  padding: 2px 10px;
  border-radius: var(--radius-round);
}

.cat-card .ds {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   分类内页布局与导航
   ========================================================================== */
.cat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

/* 左侧星区总览导航 */
.side {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
}

.side h3 {
  font-family: var(--font-scifi);
  margin: 14px 8px 6px;
  font-size: 11px;
  color: var(--gold-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.side h3:first-child {
  margin-top: 4px;
}

.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
}

.side a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.side a.active {
  background: linear-gradient(90deg, rgba(68, 227, 237, 0.14), transparent);
  border-left-color: var(--cyan-core);
  color: var(--cyan-bright);
  font-weight: 700;
}

.side a .n {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 筛选与排序控制器 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  background: var(--bg-panel);
  padding: 12px 18px;
  border-radius: var(--radius-hud);
  border: 1px solid var(--border-subtle);
}

.filter-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-primary);
  margin-right: 4px;
}

.chip {
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: var(--radius-round);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  color: var(--text-primary);
  border-color: var(--cyan-core);
}

.chip.active {
  background: var(--gold-subtle);
  border-color: var(--gold-primary);
  color: var(--gold-bright);
  font-weight: 700;
  box-shadow: 0 0 10px var(--gold-glow);
}

.select, .filter-bar input.select {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.select:focus {
  border-color: var(--cyan-core);
}

.list-stats {
  color: var(--text-tertiary);
  font-size: 12.5px;
  margin: 6px 2px 16px;
  font-family: var(--font-mono);
}

/* ==========================================================================
   条目卡片矩阵 (Card Grid)
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  background: var(--bg-panel-hover);
  border-color: var(--gold-line);
  box-shadow: var(--shadow-hover);
}

.card:focus-visible {
  outline: 2px solid var(--cyan-core);
}

/* 封面图像展示盒 */
.card .cover {
  height: 140px;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 50%, rgba(30, 44, 80, 0.6), rgba(8, 12, 24, 0.95));
  border: 1px solid rgba(148, 170, 255, 0.1);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.card .cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  transition: transform 0.4s ease;
}

.card:hover .cover img {
  transform: scale(1.05);
}

.card .title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}

/* 徽标系统 (Badges) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-round);
  background: rgba(148, 170, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.badge.blue {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  border-color: rgba(68, 227, 237, 0.3);
}

.badge.gold {
  background: var(--gold-subtle);
  color: var(--gold-bright);
  border-color: var(--gold-line);
}

.badge.violet {
  background: rgba(120, 102, 255, 0.12);
  color: #b0a4ff;
  border-color: rgba(120, 102, 255, 0.3);
}

/* ==========================================================================
   宏篇典籍与对话阅读器 (Reader Deck)
   ========================================================================== */
.reader {
  max-width: 920px;
  margin: 0 auto;
}

/* 单卷/对话阅读器（无 TOC 侧栏）：容器收缩至阅读列宽，视觉真正屏幕居中 */
.reader.reader-solo {
  max-width: 800px;
}

.reader-head {
  margin-bottom: 24px;
}

.crumb {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.crumb a {
  color: var(--text-secondary);
}

.reader-head h1 {
  font-family: var(--font-mythic);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
  letter-spacing: 1px;
  margin: 4px 0 14px;
}

.reader-head .desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.85;
  margin-top: 14px;
  background: var(--bg-panel);
  padding: 12px 18px;
  border-radius: var(--radius-hud);
  border-left: 3px solid var(--cyan-core);
}

/* 核心阅读面板 */
.reader-panel {
  background: linear-gradient(180deg, rgba(14, 21, 38, 0.85) 0%, rgba(8, 12, 24, 0.95) 100%);
  border: 1px solid var(--gold-line);
  border-radius: 20px;
  padding: 36px 42px;
  box-shadow: var(--shadow-celestial);
  backdrop-filter: blur(20px);
  position: relative;
}

.volume {
  margin-bottom: 36px;
}

.volume:last-child {
  margin-bottom: 0;
}

.volume > h3 {
  font-family: var(--font-mythic);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold-primary);
  letter-spacing: 1.5px;
}

.volume > h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}

.book-text {
  font-family: var(--font-serif);
  font-size: calc(16px * var(--reader-font-scale, 1));
  line-height: 2.15;
  color: #e2e8f8;
  letter-spacing: 0.3px;
}

.book-text b {
  color: var(--gold-bright);
}

.book-text img {
  max-width: min(100%, 540px);
  border-radius: 12px;
  display: block;
  margin: 20px auto;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.obtain {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

/* 对话体阅读器 (Interactive Dialog HUD) */
.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat .bubble-row {
  display: flex;
  gap: 14px;
  max-width: 88%;
}

.chat .bubble-row.right {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border: 1.5px solid var(--gold-line);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(243, 215, 144, 0.2);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  background: rgba(18, 26, 48, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 18px;
  backdrop-filter: blur(10px);
}

.bubble-row.right .bubble {
  background: rgba(120, 102, 255, 0.16);
  border: 1px solid rgba(120, 102, 255, 0.35);
  border-radius: 16px 4px 16px 16px;
}

.bubble .who {
  font-size: calc(11.5px * var(--reader-font-scale, 1));
  color: var(--cyan-core);
  margin-bottom: 4px;
  font-family: var(--font-scifi);
  letter-spacing: 0.8px;
  font-weight: 700;
}

.bubble-row.right .bubble .who {
  color: var(--gold-bright);
}

.bubble .txt {
  font-size: calc(15px * var(--reader-font-scale, 1));
  line-height: 1.85;
  font-family: var(--font-serif);
  color: #e5ebfa;
}

/* 短信表情贴纸（BWIKI 原站按 80px 渲染，随排版缩放同步伸缩） */
.emoji-sticker {
  display: block;
  width: calc(80px * var(--reader-font-scale, 1));
  height: auto;
}

.narration {
  align-self: center;
  max-width: 82%;
  text-align: center;
  font-size: calc(13px * var(--reader-font-scale, 1));
  color: var(--text-tertiary);
  font-style: italic;
  padding: 4px 12px;
  line-height: 1.8;
}

.scene-sep {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 75%;
  margin: 16px 0;
  color: var(--gold-line);
}

.scene-sep::before, .scene-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

.scene-sep .diamond {
  font-size: 12px;
  color: var(--gold-primary);
  text-shadow: 0 0 10px var(--gold-glow);
}

.step-head {
  font-family: var(--font-mythic);
  font-size: 16px;
  color: var(--gold-bright);
  margin: 24px 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}

.desc-card {
  background: rgba(243, 215, 144, 0.07);
  border: 1px solid var(--gold-line);
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: calc(13.5px * var(--reader-font-scale, 1));
  color: #e8dcb8;
  line-height: 1.85;
  align-self: stretch;
}

/* 选项分支 (Interactive Decision Tree) */
.options-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  margin: 8px 0;
}

.option-item {
  border: 1px solid rgba(68, 227, 237, 0.25);
  border-radius: var(--radius-hud);
  overflow: hidden;
  background: rgba(14, 21, 38, 0.6);
  transition: border-color 0.2s ease;
}

.option-item:hover {
  border-color: var(--cyan-core);
}

.option-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #e5f0ff;
  background: linear-gradient(90deg, rgba(68, 227, 237, 0.12), transparent);
  user-select: none;
  transition: all 0.2s ease;
}

.option-head:hover {
  background: linear-gradient(90deg, rgba(68, 227, 237, 0.2), transparent);
  color: #ffffff;
}

.option-head .tag {
  font-family: var(--font-scifi);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan-bright);
  background: var(--cyan-soft);
  border: 1px solid rgba(68, 227, 237, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

.option-head .arrow {
  margin-left: auto;
  transition: transform 0.25s ease;
  color: var(--cyan-core);
  font-size: 11px;
}

.option-item.open .option-head .arrow {
  transform: rotate(90deg);
}

.option-body {
  display: none;
  padding: 14px 18px 18px 24px;
  border-top: 1px dashed var(--border-subtle);
  background: rgba(8, 12, 24, 0.4);
}

.option-item.open .option-body {
  display: block;
}

/* 过场折叠块 */
.fold-block {
  align-self: stretch;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hud);
  overflow: hidden;
  margin: 6px 0;
}

.fold-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  transition: background 0.2s ease;
}

.fold-head:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.fold-head .arrow {
  margin-left: auto;
  transition: transform 0.25s ease;
  font-size: 11px;
}

.fold-block.open .fold-head .arrow {
  transform: rotate(90deg);
}

.fold-body {
  display: none;
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.fold-block.open .fold-body {
  display: block;
}

/* 对话分支批量控制条：吸顶随行，长对话一键展开/收起全部选项与折叠场景 */
.fold-toolbar {
  position: sticky;
  top: 74px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 9px 16px;
  border-radius: var(--radius-hud);
  background: rgba(10, 15, 28, 0.88);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

.fold-toolbar-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.fold-toolbar-info svg {
  width: 14px;
  height: 14px;
  display: block;
  color: var(--cyan-core);
  flex-shrink: 0;
}

.fold-toolbar-info b {
  color: var(--gold-primary);
  font-family: var(--font-mono);
  font-weight: 600;
}

.fold-toolbar-actions {
  display: inline-flex;
  gap: 8px;
}

.fold-tool-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-round);
  border: 1px solid rgba(68, 227, 237, 0.35);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fold-tool-btn:hover {
  border-color: var(--cyan-core);
  color: #ffffff;
  transform: translateY(-1px);
}

.fold-tool-btn[data-fold-act="close"] {
  border-color: var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
}

.fold-tool-btn[data-fold-act="close"]:hover {
  border-color: var(--gold-line);
  color: var(--gold-primary);
}

/* 阅读器底部实体引用与来源卡 */
.reader-foot {
  margin-top: 22px;
  padding: 18px 24px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.85;
}

.entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ==========================================================================
   实体交叉引用星网 (Entity View)
   ========================================================================== */
.entity-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding: 24px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow-celestial);
}

.entity-avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--bg-elevated);
  border: 2px solid var(--gold-primary);
  box-shadow: 0 0 20px var(--gold-glow);
}

.entity-avatar.placeholder {
  display: grid;
  place-items: center;
  font-size: 32px;
}

.entity-head h1 {
  font-family: var(--font-mythic);
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.entity-head .sub {
  color: var(--cyan-bright);
  font-size: 13px;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.ent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ent-item {
  display: flex;
  gap: 18px;
  padding: 16px 20px;
  border-radius: var(--radius-hud);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.25s ease;
}

.ent-item:hover {
  background: var(--bg-panel-hover);
  border-color: var(--cyan-core);
  box-shadow: 0 0 20px var(--cyan-soft);
  transform: translateX(4px);
}

.ent-item .snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.ent-item .right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   宏篇典制 (About View)
   ========================================================================== */
.about {
  max-width: 840px;
  margin: 0 auto;
}

.about h2 {
  font-family: var(--font-mythic);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 20px;
  color: #ffffff;
}

.about section {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hud);
  padding: 24px 30px;
  margin-bottom: 18px;
}

.about h3 {
  font-family: var(--font-mythic);
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.about p, .about li {
  font-size: 14px;
  line-height: 1.95;
  color: var(--text-secondary);
}

.about b {
  color: var(--text-primary);
}

.about ul {
  padding-left: 20px;
  margin: 10px 0;
}

/* ==========================================================================
   智真探求 AI 问答侧栏 (AI Oracle Panel)
   ========================================================================== */
.ai-mask {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(3, 5, 12, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ai-panel {
  position: fixed;
  z-index: 200;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 94vw);
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 30, 0.98);
  backdrop-filter: blur(30px);
  border-left: 1px solid var(--gold-line);
  box-shadow: -20px 0 80px rgba(0, 0, 0, 0.8), -5px 0 25px rgba(68, 227, 237, 0.1);
  animation: hudSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes hudSlideIn {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.ai-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 23, 46, 0.6);
}

.ai-head h2 {
  font-family: var(--font-mythic);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-bright);
  flex: 1;
}

.ai-head .rag-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--font-scifi);
  color: var(--cyan-bright);
  cursor: pointer;
  user-select: none;
}

.ai-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.msg {
  max-width: 90%;
  font-size: 14px;
  line-height: 1.85;
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(120, 102, 255, 0.25), rgba(68, 227, 237, 0.15));
  border: 1px solid rgba(120, 102, 255, 0.4);
  padding: 10px 16px;
  border-radius: 16px 4px 16px 16px;
  color: #ffffff;
}

.msg.assistant {
  align-self: flex-start;
}

.msg .bubble-in {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: 14px 18px;
  border-radius: 4px 16px 16px 16px;
  backdrop-filter: blur(10px);
}

.msg .refs {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(243, 215, 144, 0.05);
  border: 1px dashed var(--gold-line);
  border-radius: var(--radius-sm);
}

.msg .refs a {
  font-size: 12px;
  color: var(--cyan-bright);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.msg .refs .n {
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-weight: 700;
}

.ai-cite {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(243, 215, 144, 0.18);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--gold-line);
}

/* 思维链折叠块（服务商返回 reasoning/thinking 时展示） */
.ai-think {
  margin-bottom: 8px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(120, 102, 255, 0.06);
  padding: 6px 10px;
}

.ai-think summary {
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}

.ai-think[open] summary {
  margin-bottom: 6px;
  color: var(--cyan-core);
}

.ai-think-body {
  max-height: 240px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}

/* 未被回答引用的检索块折叠公示 */
.refs-extra {
  border-top: 1px dashed var(--border-subtle);
  padding-top: 4px;
}

.refs-extra summary {
  font-size: 11.5px;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  margin: 2px 0 4px;
}

/* AI 出处段落锚点命中：短暂金色描边高亮后自动消退 */
.anchor-hit {
  background: rgba(243, 215, 144, 0.14) !important;
  box-shadow: 0 0 0 1px rgba(243, 215, 144, 0.5), 0 0 18px rgba(243, 215, 144, 0.18);
  border-radius: 6px;
  transition: box-shadow 0.3s ease;
}

.ai-form {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(12, 17, 34, 0.8);
}

.ai-form textarea {
  flex: 1;
  resize: none;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  outline: none;
}

.ai-form textarea:focus {
  border-color: var(--cyan-core);
}

.ai-config {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(14, 20, 38, 0.95);
  font-size: 12.5px;
}

.ai-config label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
}

.ai-config input, .ai-config select {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  outline: none;
}

/* ==========================================================================
   页脚 (Cosmic Footer)
   ========================================================================== */
.foot {
  padding: 48px 28px;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  background: rgba(6, 9, 18, 0.85);
  position: relative;
}

.foot-runes {
  font-family: var(--font-mythic);
  color: var(--gold-primary);
  opacity: 0.35;
  letter-spacing: 8px;
  margin-bottom: 18px;
  font-size: 12px;
}

.foot-title {
  font-family: var(--font-mythic);
  font-size: 14px;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.foot-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan-core);
  margin-bottom: 12px;
}

/* ==========================================================================
   现代极客文档站系统 (Modern Geek Architecture Extension)
   ========================================================================== */

/* ── 顶栏与快捷触发器 ── */
.command-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-round);
  padding: 6px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.command-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 16px var(--cyan-glow);
}
.kbd-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
}
.ai-sparkle {
  color: var(--gold-primary);
  animation: pulseSparkle 2s infinite ease-in-out;
}
@keyframes pulseSparkle {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; filter: drop-shadow(0 0 6px var(--gold-primary)); }
}

/* ── Command Palette (⌘K) 全局居中模态框 ── */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  animation: fadeIn 0.15s ease-out;
}
.palette-overlay.open {
  display: flex;
}
.palette-box {
  width: 100%;
  max-width: 650px;
  background: rgba(18, 25, 42, 0.94);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-hud);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 35px var(--gold-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlide {
  from { transform: translateY(-15px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.palette-input-wrap {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}
.palette-icon {
  color: var(--gold-primary);
  font-size: 18px;
}
.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 16px;
  font-family: inherit;
}
.palette-input::placeholder {
  color: var(--text-tertiary);
}
.palette-results-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.palette-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  padding: 8px 12px 2px;
  text-transform: uppercase;
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.palette-item:hover, .palette-item.selected {
  background: rgba(255, 255, 255, 0.08);
}
.palette-item.selected {
  border-left: 3px solid var(--gold-primary);
  background: rgba(243, 215, 144, 0.1);
}
.palette-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.palette-item-icon {
  font-size: 18px;
}
.palette-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.palette-item-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.35);
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.palette-footer-keys {
  display: flex;
  gap: 12px;
}

/* ── 首页 Bento Grid 与极客氛围 ── */
.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-round);
  background: linear-gradient(90deg, rgba(243, 215, 144, 0.1), rgba(68, 227, 237, 0.08));
  border: 1px solid var(--border-active);
  color: var(--gold-primary);
  font-size: 12px;
  font-family: var(--font-scifi);
  letter-spacing: 1px;
  margin-bottom: 22px;
}
.hero-title-modern {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-title-modern span {
  background: linear-gradient(135deg, var(--gold-primary) 20%, #fff 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.quick-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 36px;
}
.quick-tag {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-round);
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.quick-tag:hover {
  border-color: var(--border-active);
  color: var(--gold-primary);
  transform: translateY(-1px);
}
.bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 36px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.bento-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.bento-card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hud);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.bento-card:hover {
  transform: translateY(-3px);
  border-color: rgba(243, 215, 144, 0.45);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(243, 215, 144, 0.12);
}
.bento-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.bento-card .card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.bento-card .card-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
}
.bento-card .card-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}
.bento-card .card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.bento-card .card-meta-line {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gold-primary);
  font-weight: 500;
}
.col-span-7 { grid-column: span 7; }
.col-span-5 { grid-column: span 5; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-12 { grid-column: span 12; }
@media (max-width: 960px) {
  .col-span-7, .col-span-5, .col-span-4, .col-span-6 { grid-column: span 12; }
}

/* ── 正文阅读器 (Modern Reader & Volume Tabs) ── */
.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 48px;
  align-items: start;
}
@media (max-width: 1080px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .reader-toc-aside { display: none; }
}
.reader-main-column {
  max-width: 74ch;
  margin: 0 auto;
  width: 100%;
}
.reader-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.volume-tabs-bar {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(8, 12, 24, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 0;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.volume-tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 215, 144, 0.3) transparent;
  padding: 4px 2px;
  flex: 1;
  min-width: 0;
  scroll-behavior: smooth;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.volume-tabs-scroll.is-dragging {
  cursor: grabbing !important;
  scroll-behavior: auto !important;
}
.volume-tabs-scroll::-webkit-scrollbar {
  height: 3px;
}
.volume-tabs-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.volume-tabs-scroll::-webkit-scrollbar-thumb {
  background: rgba(243, 215, 144, 0.3);
  border-radius: 4px;
}
.vol-tab-item {
  white-space: nowrap;
  padding: 7px 16px;
  border-radius: var(--radius-round);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.vol-tab-item:hover {
  border-color: var(--border-active);
  color: var(--gold-primary);
}
.vol-tab-item.active {
  background: linear-gradient(135deg, rgba(243, 215, 144, 0.2), rgba(68, 227, 237, 0.15));
  border-color: var(--gold-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px var(--gold-glow);
}
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tool-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.tool-icon-btn:hover {
  border-color: var(--border-active);
  color: var(--gold-primary);
}
.reader-toc-aside {
  position: sticky;
  top: 90px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hud);
  padding: 18px;
}
.toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toc-item a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.toc-item a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}
.toc-item.active a {
  color: var(--gold-primary);
  border-left-color: var(--gold-primary);
  background: rgba(243, 215, 144, 0.08);
  font-weight: 600;
}

.foot-copy {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.8;
}

/* ==========================================================================
   响应式调整
   ========================================================================== */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; padding: 12px 18px; }
  .cat-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .hero { padding: 36px 24px; }
  .hero h1 { font-size: 28px; }
  .reader-panel { padding: 24px 20px; }
  .app { padding: 20px 16px 60px; }
}

.hidden { display: none !important; }
.muted { color: var(--text-tertiary); }
.loading {
  padding: 80px 0;
  text-align: center;
  font-family: var(--font-scifi);
  color: var(--cyan-bright);
  font-size: 14px;
  letter-spacing: 3px;
}
.loading::before {
  content: "✦ ";
  animation: cosmicSpin 2s linear infinite;
  display: inline-block;
  color: var(--gold-primary);
}
@keyframes cosmicSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   SVG 线性图标体系 (icons.js · 24×24 stroke=currentColor)
   颜色随 currentColor 继承，各容器仅控制尺寸与状态色
   ========================================================================== */
.side-ico { display: inline-flex; flex-shrink: 0; color: var(--text-tertiary); transition: color 0.2s; }
.side-ico svg { width: 16px; height: 16px; display: block; }
.side a:hover .side-ico, .side a.active .side-ico { color: var(--gold-primary); }

.cat-card .ico { color: var(--cyan-core); filter: none; transition: color 0.2s; }
.cat-card .ico svg { width: 26px; height: 26px; display: block; }
.cat-card:hover .ico { color: var(--gold-primary); }

.card-icon-box { color: var(--gold-primary); }
.card-icon-box svg { width: 22px; height: 22px; display: block; }

.qt-ico { display: inline-flex; flex-shrink: 0; color: var(--gold-primary); }
.qt-ico svg { width: 14px; height: 14px; display: block; }

.crumb-ico { display: inline-flex; vertical-align: -2px; color: var(--cyan-core); }
.crumb-ico svg { width: 13px; height: 13px; display: block; }

.chip-ico { display: inline-flex; vertical-align: -2px; margin-right: 3px; }
.chip-ico svg { width: 13px; height: 13px; display: block; }

.h1-ico { display: inline-flex; vertical-align: -3px; color: var(--gold-primary); }
.h1-ico svg { width: 26px; height: 26px; display: block; }

.li-ico { display: inline-flex; vertical-align: -2px; color: var(--cyan-core); }
.li-ico svg { width: 15px; height: 15px; display: block; }

.palette-item-icon { display: inline-flex; flex-shrink: 0; align-items: center; }
.palette-item-icon svg { width: 18px; height: 18px; display: block; }

.entity-avatar.placeholder { color: var(--gold-primary); }
.entity-avatar.placeholder svg { width: 32px; height: 32px; display: block; }

.loc { display: inline-flex; align-items: center; gap: 4px; }
.loc svg { width: 12px; height: 12px; display: block; }

/* 卷内纲目（TOC 第二节）：与卷目列表区分层级 */
.toc-sec-title { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border-subtle); }
.toc-section-list .toc-item a { font-size: 12.5px; color: var(--text-tertiary); }
.toc-section-list .toc-item.active a { color: var(--cyan-core); border-left-color: var(--cyan-core); background: rgba(68, 227, 237, 0.08); }

/* 首页全域总览：紧凑行式清单（替代原重复卡片网格） */
.ov-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--border-subtle);
}
.ov-row:last-child { border-bottom: none; }
.ov-row .group-title {
  flex-shrink: 0;
  width: 130px;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
.ov-row .group-title::after { display: none; }
.ov-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1; }
.ov-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-round);
  background: var(--bg-panel);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.ov-chip:hover {
  border-color: var(--border-active);
  color: var(--gold-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.ov-ico { display: inline-flex; color: var(--cyan-core); transition: color 0.2s; }
.ov-ico svg { width: 15px; height: 15px; display: block; }
.ov-chip:hover .ov-ico { color: var(--gold-primary); }
.ov-cnt { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
@media (max-width: 900px) {
  .ov-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .ov-row .group-title { width: auto; margin: 0; padding: 0; }
}

/* ==========================================================================
   无障碍与动效舒适 (Accessibility & Motion Comfort)
   ========================================================================== */
/* 键盘焦点光环：链接 / 按钮 / 输入控件 / role=button 与 tabindex 自定义件统一量子青描边 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan-core);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 对话选项/折叠头获得焦点时同步点亮边框，焦点位置一目了然 */
.option-item:focus-within {
  border-color: var(--cyan-core);
}

.fold-block:focus-within {
  border-color: var(--gold-line);
}

/* 减弱动效偏好：停驻星环旋转、粒子脉动等全部循环动画与过渡，平滑滚动降为即时跳转 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* 星轨画布在 JS 侧降级为静态星图（见 app.js initCosmicCanvas） */
}
