:root {
  --bg: #0b0d12;
  --panel: #0f1420;
  --panel2: #0b0d12;
  --text: #e7eaf0;
  --muted: #a9b1c3;
  --border: #1e2533;
  --accent: #7c3aed;
  --accent2: #a78bfa;
  --link: #c4b5fd;
  --code: #0b0d12;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 900;
}

.topnav {
  margin-left: 8px;
  display: flex;
  gap: 10px;
}

.topnav a {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
}

.topnav a.active {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,0.03);
}

.spacer { flex: 1; }

.search {
  position: relative;
  max-width: 520px;
  width: 100%;
}

.search input {
  width: 100%;
  padding: 10px 38px 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.search button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.search button:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.search button:focus, .search button:focus-visible { outline: none; }

.layout {
  max-width: 1300px;
  margin: 0 auto;
  padding: 18px 16px 60px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 16px;
}

.sidebar {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 16px;
  padding: 14px;
  height: calc(100vh - 86px);
  position: sticky;
  top: 68px;
  overflow: auto;
}

.side-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 12px 8px 6px;
}

.side a {
  display: block;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
}

.side a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.side a.on { background: rgba(124,58,237,0.14); color: var(--text); border: 1px solid rgba(124,58,237,0.25); }

.content {
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 16px;
  padding: 22px 22px 30px;
}

.content h1 {
  margin: 0 0 12px;
  font-size: 30px;
}

.content h2 {
  margin: 26px 0 10px;
  font-size: 20px;
}

.content h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.content p { margin: 0 0 12px; color: #c7cedd; line-height: 1.65; }

.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

pre {
  margin: 12px 0 16px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  overflow: auto;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--text);
}

.toc {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 16px;
  padding: 14px;
  height: calc(100vh - 86px);
  position: sticky;
  top: 68px;
  overflow: auto;
}

.toc .t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 8px 8px 6px; }
.toc a { display:block; padding: 7px 10px; border-radius: 10px; text-decoration: none; color: var(--muted); }
.toc a:hover { background: rgba(255,255,255,0.04); color: var(--text); }

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: none;
}

.search-results.on { display: block; }

.search-results a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.search-results a:first-child { border-top: 0; }
.search-results a:hover { background: rgba(255,255,255,0.04); }

.search-results .title { font-weight: 800; color: var(--text); font-size: 13px; }
.search-results .path { font-size: 12px; color: var(--muted); margin-top: 2px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .content { padding: 18px; }
}
