:root {
  --bg: #1e1e1e;
  --surface: #252526;
  --surface-2: #2a2d2e;
  --border: #3a3a3c;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --text-dim: #6e6e6e;
  --accent: #0078d4;
  --accent-hover: #1a8fe8;
  --code-bg: #1a1a1a;
  --mono: "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --sidebar-w: 264px;
  --content-max: 760px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Layout --- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand img { width: 24px; height: 24px; }

.toc {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  font-size: 13px;
}

.toc ul {
  list-style: none;
}

.toc li { }

.toc a {
  display: block;
  padding: 4px 20px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color 0.1s ease, border-color 0.1s ease, background 0.1s ease;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
}

.toc a.active {
  color: var(--accent-hover);
  border-left-color: var(--accent);
}

.toc .toc-h1 {
  font-weight: 600;
  color: var(--text);
  margin-top: 12px;
  font-size: 13px;
}
.toc .toc-h1:first-child { margin-top: 0; }

.toc .toc-h2 {
  padding-left: 36px;
  font-size: 12.5px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

/* --- Main content --- */

.content {
  padding: 64px 48px 96px;
  max-width: calc(var(--content-max) + 96px);
  margin: 0 auto;
  width: 100%;
}

.wip-banner {
  margin-bottom: 32px;
  padding: 12px 16px;
  background: rgba(255, 196, 61, 0.08);
  border: 1px solid rgba(255, 196, 61, 0.4);
  border-left: 3px solid #ffc43d;
  border-radius: 3px;
  color: #e5cc85;
  font-size: 13px;
  line-height: 1.55;
}
.wip-banner strong { color: #ffc43d; font-weight: 600; margin-right: 4px; }
.wip-banner a { color: #ffc43d; text-decoration: underline; }
.wip-banner a:hover { color: #ffd966; }

.doc-header {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.doc-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.doc-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.doc-body h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 56px 0 16px;
  padding-top: 8px;
  letter-spacing: -0.01em;
}
.doc-body h1:first-child { margin-top: 0; }

.doc-body h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
}

.doc-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}

.doc-body p {
  margin: 0 0 16px;
  color: var(--text);
}

.doc-body ul, .doc-body ol {
  margin: 0 0 16px 24px;
  color: var(--text);
}
.doc-body li { margin-bottom: 6px; }

.doc-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: #d4c5a0;
}

.doc-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin: 0 0 20px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.doc-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}

.doc-body blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 0 3px 3px 0;
}
.doc-body blockquote p:last-child { margin-bottom: 0; }

.doc-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.doc-body table {
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 13px;
  width: 100%;
}
.doc-body th, .doc-body td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-align: left;
}
.doc-body th {
  background: var(--surface);
  font-weight: 600;
}

.heading-anchor {
  color: var(--text-dim);
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.1s ease;
  font-weight: 400;
  font-size: 0.8em;
}
.doc-body h1:hover .heading-anchor,
.doc-body h2:hover .heading-anchor,
.doc-body h3:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { text-decoration: none; color: var(--accent); }

.doc-footer {
  margin-top: 96px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}

/* --- Responsive --- */

@media (max-width: 880px) {
  :root { --sidebar-w: 100%; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .toc { max-height: 240px; }
  .content { padding: 32px 20px 64px; }
}
