:root {
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  --color-dark-text: #FCFCFD;
  --color-dark-accent: #6EEDD2;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-h1: clamp(2.6rem, 6.4vw, 5rem);
  --text-h2: clamp(1.6rem, 3vw, 2.4rem);
  --text-body: 1rem;
  --line-height-body: 1.65;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background-color: var(--color-paper);
  color: var(--color-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; height: auto; }

.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-size: 0.95rem; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--color-brand); }
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); background: #5ADBC0; }
.btn-primary:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border: 1px solid var(--color-body);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.btn-secondary:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* Dark area override for contrast */
.section.dark .btn-secondary,
#intro .hero-grid .btn-secondary {
  color: var(--color-dark-text);
  border-color: var(--color-dark-text);
}
.section.dark .btn-secondary:hover {
  background: rgba(252, 252, 253, 0.1);
}

/* Main Layout (Sticky Index) */
.main-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 960px) {
  .main-layout { grid-template-columns: 1fr; }
  .toc-sidebar { position: relative; order: -1; }
}
.toc-sidebar {
  position: sticky;
  top: 80px;
  background: var(--color-paper);
  padding: 24px 0;
  border-right: 1px solid rgba(25, 21, 35, 0.06);
}
.toc-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; color: var(--color-brand); margin-bottom: 16px; }
.toc-list li { margin-bottom: 12px; }
.toc-list a { font-size: 0.9rem; color: var(--color-body); opacity: 0.8; display: block; padding-left: 12px; border-left: 2px solid transparent; }
.toc-list a:hover, .toc-list a.active { opacity: 1; border-left-color: var(--color-brand); color: var(--color-brand); }

.content-area { min-width: 0; }

/* Sections */
.section { padding-block: var(--section-y); }
.section.dark { background: var(--color-dark); color: var(--color-dark-text); }
.section.dark .hl { color: var(--color-dark-accent); }
.section.paper { background: var(--color-paper); color: var(--color-body); }
.section.paper .hl { color: var(--color-brand); }

.masthead {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: inline-block;
}
.section.paper .masthead { color: var(--color-brand); }
.section.dark .masthead { color: var(--color-dark-accent); }

h1 { font-size: var(--text-h1); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 24px; }
h2 { font-size: var(--text-h2); font-weight: 500; line-height: 1.25; margin-bottom: 24px; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin-top: 32px; margin-bottom: 16px; }
p { margin-bottom: 16px; max-width: 38em; }
.text-center { text-align: center; }
.text-center p { margin-inline: auto; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.hero-meta { margin-top: 16px; font-size: 0.85rem; opacity: 0.8; }

/* Cards & Panels */
.card-panel {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  position: relative;
}
.section.dark .card-panel { background: rgba(252, 252, 255, 0.08); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.feature-item h3 { margin-top: 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
dt { font-weight: 600; color: var(--color-brand); }
.section.dark dt { color: var(--color-dark-accent); }
dd { margin-bottom: 16px; }

/* Table */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); }
th { font-weight: 600; background: rgba(25, 21, 35, 0.03); }
.section.dark th { background: rgba(252, 252, 255, 0.05); color: var(--color-dark-text); }
.section.dark td { color: var(--color-dark-text); border-color: rgba(252, 252, 255, 0.1); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 16px; }
details {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  transition: background 0.2s ease;
}
details[open] { background: rgba(25, 21, 35, 0.02); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; font-size: 1.2rem; font-weight: 400; color: var(--color-brand); }
details[open] summary::before { content: "−"; }
.details-content { margin-top: 12px; line-height: 1.7; }
.details-content p { margin-bottom: 12px; }

/* News */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.news-card { padding: 24px; display: flex; flex-direction: column; height: 100%; }
.news-date { font-size: 0.8rem; font-weight: 600; margin-bottom: 12px; opacity: 0.7; }
.news-card h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.news-card p { font-size: 0.95rem; opacity: 0.85; margin-bottom: 0; }

/* Quick Start Steps */
.steps-list { counter-reset: step; }
.step-item { position: relative; padding-left: 48px; margin-bottom: 24px; }
.step-item::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 36px; height: 36px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.section.dark .step-item::before { background: var(--color-dark-accent); }

/* Footer */
.site-footer { background: var(--color-dark); color: var(--color-dark-text); padding: 48px 0; border-top: 1px solid rgba(252, 252, 255, 0.1); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { opacity: 0.8; font-size: 0.9rem; }
.footer-links a:hover { opacity: 1; color: var(--color-dark-accent); }
.copyright { font-size: 0.85rem; opacity: 0.6; }

/* SVG Animation Base */
svg.animated-svg { width: 100%; height: auto; }
.anim-star { animation: twinkle 6s ease-in-out infinite alternate; }
.anim-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 8s linear infinite; }
.anim-float { animation: floatUp 10s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 0.9; transform: scale(1.1); }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}
@keyframes floatUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .anim-star, .anim-line, .anim-float { animation: none !important; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
