:root {
  --bg: #0b0b0f;
  --panel: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.09);
  --text: rgba(235, 236, 244, 0.92);
  --muted: rgba(235, 236, 244, 0.55);
  --accent: #8b7cf7;
  --accent-2: #4f9cf9;
  --code-bg: rgba(255, 255, 255, 0.055);
  --warn: #f5b455;
  --top-h: 52px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(99, 91, 255, 0.13), transparent 60%),
    radial-gradient(50rem 35rem at -10% 110%, rgba(59, 130, 246, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky; top: 0; z-index: 10; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(11, 11, 15, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 6px; }
.brand-docs {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(139, 124, 247, 0.22), rgba(79, 156, 249, 0.22));
  border: 1px solid rgba(139, 124, 247, 0.35);
  color: rgba(235, 236, 244, 0.85);
}
.gh { font-size: 13px; color: var(--muted); }
.gh:hover { color: var(--text); text-decoration: none; }

.shell {
  display: grid; grid-template-columns: 230px minmax(0, 1fr) 200px;
  gap: 36px; max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px;
}
.side { position: sticky; top: calc(var(--top-h) + 24px); align-self: start; }
.side-toggle { display: none; }
.nav-section { margin-bottom: 18px; }
.nav-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin-bottom: 6px;
}
.nav a {
  display: block; padding: 5px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--muted); font-size: 13.5px; border: 1px solid transparent;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(139, 124, 247, 0.14), rgba(79, 156, 249, 0.10));
  border-color: rgba(139, 124, 247, 0.30);
}

.toc { position: sticky; top: calc(var(--top-h) + 24px); align-self: start; font-size: 12.5px; }
.toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 6px; }
.toc a { display: block; padding: 3px 0 3px 10px; color: var(--muted); border-left: 1px solid var(--border); }
.toc a:hover { color: var(--text); border-left-color: var(--accent); text-decoration: none; }

.content { min-width: 0; }
article h1 {
  font-size: 30px; line-height: 1.25; margin: 4px 0 14px; letter-spacing: -0.015em;
  background: linear-gradient(92deg, #fff 30%, rgba(189, 178, 255, 0.9));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
article h2 { font-size: 21px; margin: 38px 0 10px; padding-top: 10px; border-top: 1px solid var(--border); letter-spacing: -0.01em; }
article h3 { font-size: 16.5px; margin: 26px 0 8px; }
article h1 .anchor, article h2 .anchor, article h3 .anchor, article h4 .anchor {
  margin-left: 8px; opacity: 0; font-weight: 400; color: var(--accent);
}
article h1:hover .anchor, article h2:hover .anchor, article h3:hover .anchor, article h4:hover .anchor { opacity: 1; text-decoration: none; }
article p { margin: 10px 0; }
article ul, article ol { padding-left: 24px; }
article li { margin: 4px 0; }
article hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }
article img { max-width: 100%; }

article code {
  font: 12.8px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 1.5px 5px;
}
article pre {
  position: relative; overflow-x: auto;
  background: rgba(0, 0, 0, 0.38); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin: 14px 0;
}
article pre code { background: none; border: 0; padding: 0; font-size: 13px; color: rgba(222, 226, 240, 0.92); }
pre .copy {
  position: absolute; top: 8px; right: 8px;
  font: 11px system-ui, sans-serif; color: var(--muted);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
  border-radius: 7px; padding: 3px 9px; cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
pre:hover .copy { opacity: 1; }
pre .copy:hover { color: var(--text); }

article table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13.5px; display: block; overflow-x: auto; }
article th, article td { text-align: left; padding: 7px 12px; border: 1px solid var(--border); vertical-align: top; }
article th { background: var(--panel); font-weight: 600; white-space: nowrap; }
article tr:nth-child(2n) td { background: rgba(255, 255, 255, 0.018); }

article blockquote {
  margin: 14px 0; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  color: rgba(235, 236, 244, 0.78);
}
article blockquote.warn { border-left-color: var(--warn); background: rgba(245, 180, 85, 0.07); }
article blockquote p { margin: 6px 0; }

.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 44px; }
.pager a {
  flex: 1; max-width: 48%; padding: 12px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
}
.pager a:hover { text-decoration: none; border-color: rgba(139, 124, 247, 0.4); }
.pager a span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.pager-next { text-align: right; }
.foot { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; }
  .side { position: static; }
  .nav-static { display: none; }
  .side-toggle { display: block; }
  .side-toggle summary {
    cursor: pointer; list-style: none; padding: 10px 14px; border-radius: 10px;
    background: var(--panel); border: 1px solid var(--border); font-size: 13.5px;
  }
  .side-toggle[open] summary { border-radius: 10px 10px 0 0; }
  .side-toggle .nav { padding: 10px 14px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 10px 10px; background: rgba(11, 11, 15, 0.6); }
  article h1 { font-size: 24px; }
}
