:root {
  --bg: #0b0d11;
  --bg-elevated: #11151c;
  --bg-card: #151a23;
  --border: #232a36;
  --border-subtle: #1b212c;
  --text: #f3f5f8;
  --text-muted: #94a0b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --emerald: #10b981;
  --code-bg: #0d1017;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --code-bg: #f8fafc;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 60px;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -0.02em; }
.brand-badge {
  font-size: 11px; font-family: var(--font-mono);
  padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-hover);
  border: 1px solid rgba(99, 102, 241, 0.28);
}
.topnav { display: flex; align-items: center; gap: 22px; font-size: 14px; color: var(--text-muted); }
.topnav a:hover, .topnav a.active { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  cursor: pointer; transition: all 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.layout {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 240px 1fr 220px; gap: 40px;
  padding: 36px 28px 80px;
}
@media (max-width: 1024px) { .layout { grid-template-columns: 1fr; } .sidebar, .toc { display: none; } }
.sidebar { position: sticky; top: 88px; height: fit-content; font-size: 14px; }
.nav-group { margin-bottom: 24px; }
.nav-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px; }
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.nav-list a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-radius: 6px; color: var(--text-muted);
}
.nav-list a:hover { background: var(--bg-elevated); color: var(--text); }
.nav-list a.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 500; }
.content h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 12px; }
.lead { font-size: 17px; color: var(--text-muted); margin-bottom: 28px; }
.content h2 { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; margin: 40px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }
.content p { margin-bottom: 14px; color: var(--text-muted); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
}
.card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.card p { font-size: 13.5px; margin: 0; }
.preview-box {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin: 18px 0 26px;
}
.preview-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted);
}
.preview-stage {
  padding: 36px 24px; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}
pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--text); margin: 14px 0 22px;
}
code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; }
pre code { background: none; padding: 0; }
table { width: 100%; border-collapse: collapse; margin: 16px 0 28px; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-elevated); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; font-family: var(--font-mono); font-size: 11.5px; background: var(--bg-elevated); border: 1px solid var(--border); }
.toc { position: sticky; top: 88px; height: fit-content; font-size: 13px; color: var(--text-muted); }
.toc ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; border-left: 1px solid var(--border); padding-left: 14px; }
.toc a:hover { color: var(--text); }
.footer { border-top: 1px solid var(--border); padding: 32px 28px; text-align: center; color: var(--text-muted); font-size: 13px; }
