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

:root {
  --bg: #080808;
  --bg2: #111;
  --bg3: #1a1a1a;
  --border: rgba(255,255,255,0.07);
  --text: #e0e0e0;
  --muted: #888;
  --muted2: #555;
  --accent: #2563eb;
  --accent-glow: rgba(37,99,235,0.15);
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 8px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Layout */
.layout { display: flex; flex: 1; min-height: 0; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,8,8,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.header-logo:hover { text-decoration: none; }

.header-sep {
  color: var(--muted2);
  font-size: 18px;
  font-weight: 300;
}

.header-label {
  color: var(--muted);
  font-size: 14px;
}

.header-spacer { flex: 1; }

.header-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-link {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.header-link:hover { color: var(--text); background: var(--bg2); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; text-decoration: none; }

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 20px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--accent-glow);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-link.external::after {
  content: '↗';
  font-size: 11px;
  margin-left: auto;
  opacity: 0.5;
}

/* Main content */
.content {
  flex: 1;
  min-width: 0;
  padding: 48px 64px;
  max-width: 860px;
}

.content h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: #fff;
}

.content h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 40px;
  margin-bottom: 12px;
  color: #fff;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 24px; }

.content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text);
}

.content p {
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.7;
  font-size: 15px;
}

.content ul, .content ol {
  color: var(--muted);
  padding-left: 20px;
  margin-bottom: 16px;
  font-size: 15px;
}

.content li { margin-bottom: 6px; line-height: 1.6; }

.page-desc {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
  padding-bottom: 32px;
}

/* Code */
pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}

p code, li code, td code {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #c3e88d;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}

.copy-btn:hover { color: var(--text); background: var(--muted2); }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 0; border-bottom: 1px solid var(--border); }

.tab {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  user-select: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-panel { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.tab-panel pre { border-radius: 0 0 var(--radius) var(--radius); border: none; margin: 0; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 16px 0 24px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

td:first-child { color: var(--text); font-family: var(--mono); font-size: 12.5px; }

/* Callout */
.callout {
  background: var(--accent-glow);
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--text);
}

.callout-warn {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.3);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-blue { background: rgba(37,99,235,0.15); color: #60a5fa; }
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

/* Hamburger / mobile */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--muted); }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar { display: none; position: fixed; top: 56px; left: 0; bottom: 0; z-index: 50; background: var(--bg); width: 260px; border-right: 1px solid var(--border); }
  .sidebar.open { display: block; }
  .content { padding: 32px 24px; }
  .content h1 { font-size: 26px; }
}
