:root {
  --bg: #0b1220;
  --bg-elevated: #121a2b;
  --bg-card: #162033;
  --border: #243049;
  --text: #e8eef9;
  --text-muted: #9aa8c0;
  --accent: #6ea8fe;
  --accent-2: #8b7cf7;
  --success: #3dd68c;
  --warning: #f5a524;
  --code-bg: #0a101c;
  --link: #8ec5ff;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --max: 920px;
  --nav-w: 280px;
  --font: "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2744 0%, transparent 50%),
              radial-gradient(900px 500px at 100% 0%, #241b3d 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem; z-index: 100;
  background: var(--accent); color: #041018; padding: .5rem 1rem; border-radius: 8px;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(11, 18, 32, 0.85);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.75rem; color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; color: #071018; font-size: 14px;
  box-shadow: 0 4px 16px rgba(110, 168, 254, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 0.98rem; }
.brand-text span { font-size: 0.75rem; color: var(--text-muted); }
.badge {
  font-size: 0.72rem; padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-elevated);
  white-space: nowrap;
}

.layout {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: var(--nav-w) 1fr;
  gap: 1.5rem; padding: 1.5rem 1.25rem 3rem;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static !important; }
}

.sidebar {
  position: sticky; top: 72px; align-self: start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.sidebar h2 {
  margin: 0 0 0.75rem; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700;
}
.sidebar nav a {
  display: block; padding: 0.55rem 0.7rem; border-radius: 10px;
  color: var(--text); margin-bottom: 0.25rem; border: 1px solid transparent;
}
.sidebar nav a:hover { background: var(--bg-card); text-decoration: none; }
.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(110,168,254,0.18), rgba(139,124,247,0.14));
  border-color: rgba(110,168,254,0.35);
}
.sidebar nav a small {
  display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 0.1rem;
}
.disclaimer {
  margin-top: 1rem; padding: 0.75rem; border-radius: 10px;
  background: rgba(245, 165, 36, 0.08); border: 1px solid rgba(245, 165, 36, 0.25);
  color: #f0c987; font-size: 0.78rem; line-height: 1.5;
}

.content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
@media (max-width: 600px) {
  .content { padding: 1.25rem; }
}

.hero {
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}
.hero h1 {
  margin: 0 0 0.6rem; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.25;
  background: linear-gradient(90deg, #fff, #b7c9ef);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; color: var(--text-muted); max-width: 60ch; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
}
.card {
  display: block; padding: 1.2rem; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); transition: transform .15s ease, border-color .15s ease;
}
.card:hover {
  transform: translateY(-2px); border-color: rgba(110,168,254,0.5); text-decoration: none;
}
.card .num {
  font-size: 0.75rem; font-weight: 700; color: var(--accent); letter-spacing: 0.04em;
}
.card h3 { margin: 0.35rem 0 0.4rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.doc h1 { font-size: 1.85rem; margin-top: 0; line-height: 1.3; }
.doc h2 {
  font-size: 1.35rem; margin-top: 2.2rem; padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.doc h3 { font-size: 1.1rem; margin-top: 1.5rem; color: #d5e0f5; }
.doc h4 { font-size: 1rem; margin-top: 1.2rem; color: #c5d0e6; }
.doc p, .doc li { color: #d3dced; }
.doc blockquote {
  margin: 1rem 0; padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(110,168,254,0.08);
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
}
.doc blockquote p { margin: 0.35rem 0; }
.doc table {
  width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem;
  overflow-x: auto; display: block;
}
.doc th, .doc td {
  border: 1px solid var(--border); padding: 0.55rem 0.7rem; text-align: left;
}
.doc th { background: var(--bg-card); color: #fff; }
.doc tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.doc code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--code-bg); padding: 0.12em 0.4em; border-radius: 6px;
  border: 1px solid var(--border);
}
.doc pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem 1.1rem; overflow-x: auto;
}
.doc pre code {
  border: none; padding: 0; background: transparent; font-size: 0.84rem;
}
.doc hr {
  border: none; border-top: 1px solid var(--border); margin: 2rem 0;
}
.doc .mermaid {
  background: #0e1626; border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; margin: 1.25rem 0; overflow-x: auto;
}
.doc ul, .doc ol { padding-left: 1.35rem; }
.doc strong { color: #fff; }

.footer {
  max-width: 1280px; margin: 0 auto; padding: 0 1.25rem 2.5rem;
  color: var(--text-muted); font-size: 0.82rem;
}
.footer-inner {
  border-top: 1px solid var(--border); padding-top: 1rem;
  display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between;
}

.toc-inline { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
