:root {
  --bg: #050b14;
  --bg-soft: #0b1628;
  --panel: rgba(12, 26, 48, 0.72);
  --panel-border: rgba(56, 189, 248, 0.22);
  --text: #e0f2fe;
  --text-muted: #7dd3fc;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.32);
  --neon-purple: #a855f7;
  --neon-cyan: #22d3ee;
  --neon-blue: #3b82f6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* 星空画布 */
#starfield {
  position: fixed;
  inset: 0;
  z-index: -3;
  background: radial-gradient(ellipse at bottom, #0b1628 0%, #020617 60%, #000000 100%);
}

/* 网格扫描背景 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 78%);
  animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
  0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
  100% { transform: perspective(500px) rotateX(60deg) translateY(60px); }
}

/* 扫描线 */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(56, 189, 248, 0.03) 2px,
    rgba(56, 189, 248, 0.03) 4px
  );
  opacity: 0.6;
}

/* Hero 区域 */
.hero {
  position: relative;
  text-align: center;
  padding: 100px 20px 80px;
  overflow: hidden;
  border-bottom: 1px solid var(--panel-border);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.1), transparent 40%);
  z-index: 0;
  pointer-events: none;
}
#neuralCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.8;
}
.hero-content {
  position: relative;
  z-index: 2;
}
.robot-avatar {
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  position: relative;
  z-index: 2;
}
.robot-avatar svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.6));
  animation: robotFloat 4s ease-in-out infinite;
}
@keyframes robotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, var(--neon-cyan) 35%, var(--accent) 70%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px var(--accent-glow));
  position: relative;
}
.hero h1::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, transparent 40%, rgba(255,255,255,0.4) 50%, transparent 60%, transparent 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 4s ease-in-out infinite;
  background-size: 200% 100%;
  background-position: 100% 0;
}
@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.hero .subtitle {
  margin-top: 20px;
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}
.hero .badge {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 32px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  color: var(--neon-cyan);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.35);
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15), inset 0 0 20px rgba(34, 211, 238, 0.05);
  position: relative;
  overflow: hidden;
}
.hero .badge::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--neon-cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--neon-cyan);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* 装饰角标 */
.corner-deco {
  position: absolute;
  width: 80px;
  height: 80px;
  border: 2px solid rgba(56, 189, 248, 0.25);
  z-index: 1;
}
.corner-deco.top-left {
  top: 20px;
  left: 20px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 16px;
}
.corner-deco.top-right {
  top: 20px;
  right: 20px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 16px;
}
.corner-deco.bottom-left {
  bottom: 20px;
  left: 20px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 16px;
}
.corner-deco.bottom-right {
  bottom: 20px;
  right: 20px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 16px;
}

.main {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 280px);
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 320px;
  flex-shrink: 0;
  padding: 32px 0 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.30) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.30);
  border-radius: 6px;
}
.toc-title {
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin: 0 0 18px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toc-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 2px;
  box-shadow: 0 0 10px var(--neon-cyan);
}
.toc, .toc-children {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-children {
  padding-left: 16px;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease;
  max-height: 1200px;
  opacity: 1;
}
.toc-group.collapsed > .toc-children {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.toc-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  user-select: none;
}
.toc-group-header:hover {
  background: rgba(56, 189, 248, 0.10);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.1);
}
.toc-group-header .arrow {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.65rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 5px;
}
.toc-group-header .arrow:hover {
  background: rgba(56, 189, 248, 0.15);
}
.toc-group.collapsed > .toc-group-header .arrow {
  transform: rotate(-90deg);
}
.toc-group-header a {
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-group.level-1 > .toc-group-header a {
  font-size: 1rem;
  color: #fff;
}
.toc-group-header:hover a,
.toc-group-header a.active {
  color: var(--accent);
}
.toc-group.level-1 > .toc-group-header:hover a,
.toc-group.level-1 > .toc-group-header a.active {
  color: var(--neon-cyan);
}
.toc-children .toc-item a {
  display: block;
  padding: 6px 10px 6px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-children .toc-item a:hover {
  color: var(--text);
  background: rgba(56, 189, 248, 0.08);
}
.toc-children .toc-item a.active {
  color: var(--neon-cyan);
  background: rgba(34, 211, 238, 0.12);
  border-left-color: var(--neon-cyan);
  box-shadow: inset 0 0 16px rgba(34, 211, 238, 0.15);
}

.content {
  flex: 1;
  padding: 40px 48px 80px 56px;
  max-width: 960px;
}
.content-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 48px 56px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.35),
    0 0 60px rgba(56, 189, 248, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.content-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--accent), var(--neon-purple), transparent);
  opacity: 0.6;
}

/* 仅隐藏 README 顶部的“目录”标题，保留后续一级章节标题 */
.markdown-body h1:first-of-type { display:block; }
.markdown-body h1 {
  margin: 64px 0 24px;
  padding-bottom: 14px;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  border-bottom: 1px solid rgba(125, 211, 252, 0.25);
  scroll-margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}
.markdown-body h1::before {
  content: "◈";
  color: var(--neon-purple);
  font-size: 0.85em;
  text-shadow: 0 0 12px var(--neon-purple);
}
.markdown-body h2 {
  margin: 56px 0 22px;
  padding-bottom: 12px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(125, 211, 252, 0.20);
  scroll-margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.markdown-body h2::before {
  content: "◆";
  color: var(--neon-cyan);
  font-size: 0.8em;
  text-shadow: 0 0 10px var(--neon-cyan);
}
.markdown-body h2:first-of-type { margin-top: 0; }
.markdown-body h3 {
  margin: 36px 0 16px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  scroll-margin-top: 32px;
}
.markdown-body h4 {
  margin: 24px 0 12px;
  font-size: 1.05rem;
  color: var(--accent-2);
}
.markdown-body p {
  margin: 14px 0;
  color: var(--text);
}
.markdown-body a {
  color: var(--neon-cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.30);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  word-break: break-all;
}
.markdown-body a:hover {
  color: #fff;
  border-bottom-color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
}
.markdown-body ul, .markdown-body ol {
  margin: 14px 0;
  padding-left: 24px;
}
.markdown-body li {
  margin: 8px 0;
  color: var(--text);
}
.markdown-body li::marker {
  color: var(--neon-cyan);
}
.markdown-body blockquote {
  margin: 22px 0;
  padding: 16px 22px;
  border-left: 3px solid var(--neon-purple);
  background: rgba(168, 85, 247, 0.08);
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
  box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.05);
}
.markdown-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: rgba(34, 211, 238, 0.12);
  color: var(--neon-cyan);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.9em;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.1);
}
.markdown-body pre {
  background: rgba(6, 16, 30, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 10px;
  padding: 18px;
  overflow-x: auto;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  color: #bae6fd;
  box-shadow: none;
}
.markdown-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.35), transparent);
  margin: 48px 0;
}
.markdown-body strong {
  color: #fff;
  font-weight: 600;
}

/* 加载与错误提示 */
.status {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.status.error {
  color: #f87171;
}
.status a {
  color: var(--accent);
  text-decoration: underline;
}
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.menu-toggle {
  display: none;
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(12, 26, 48, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--neon-cyan);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
  backdrop-filter: blur(10px);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: rgba(34, 211, 238, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.3);
}

@media (max-width: 980px) {
  .hero { padding: 80px 20px 60px; }
  .corner-deco { width: 50px; height: 50px; }
  .main { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    z-index: 1000;
    background: rgba(6, 14, 26, 0.98);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    padding: 70px 16px 32px;
    border-right: 1px solid rgba(56, 189, 248, 0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .content { padding: 28px 20px 60px; }
  .content-card { padding: 28px 24px; }
  .markdown-body h2 { font-size: 1.45rem; }
  .markdown-body h3 { font-size: 1.15rem; }
  .back-to-top { bottom: 20px; right: 20px; width: 44px; height: 44px; }
}
