:root {
  --bg: #0f141d;
  --surface: #171e2a;
  --surface-2: #1e2736;
  --text: #e8ebf2;
  --muted: #98a2b6;
  --accent: #b78bff;
  --accent-ink: #1a0f2e;
  --accent-soft: rgba(153, 69, 255, 0.16);
  --green: #14f195;
  --border: #263044;
  --glow: rgba(153, 69, 255, 0.28);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f0f1f7;
    --text: #18202e;
    --muted: #586174;
    --accent: #6c2fd9;
    --accent-ink: #ffffff;
    --accent-soft: rgba(108, 47, 217, 0.09);
    --green: #0a9d61;
    --border: #e1e4ee;
    --glow: rgba(108, 47, 217, 0.14);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
strong { color: var(--text); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  white-space: nowrap;
}

.brand img { border-radius: 9px; }

.switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.switch a {
  padding: 5px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.switch a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 16px 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.updated::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* Content */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}

.summary {
  margin: 0 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
}

.toc {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.toc summary {
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
}

.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.toc[open] summary::after { content: "−"; }

.toc ol {
  margin: 0;
  padding: 0 18px 14px 40px;
  columns: 2 220px;
  column-gap: 24px;
}

.toc li { margin: 4px 0; break-inside: avoid; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 10px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h2 .num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

h2 + p, h2 + ul { margin-top: 0; }

ul { padding-left: 4px; list-style: none; }

li {
  position: relative;
  margin: 8px 0;
  padding-left: 22px;
}

li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

.toc li { padding-left: 0; }
.toc li::before { content: none; }

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.9em;
}

/* Footer */
footer {
  margin-top: 48px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
}

footer a { font-weight: 600; text-decoration: none; }

@media (max-width: 420px) {
  .brand span { display: none; }
}
