:root {
  color-scheme: dark;
  --bg: #0b1220;
  --card: #111b31;
  --border: rgba(255, 255, 255, 0.12);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #3b82f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 0, #17233f, var(--bg) 35%);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  background: rgba(11, 18, 32, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { color: #fff; }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.sidebar,
.content-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(17, 27, 49, 0.7);
}

.sidebar {
  height: fit-content;
  padding: 18px;
  position: sticky;
  top: 78px;
}

.sidebar h2 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  transition: .2s;
}

.docs-nav a:hover {
  color: #fff;
  border-color: var(--border);
}

.docs-nav a.active {
  color: #fff;
  background: rgba(59, 130, 246, .18);
  border-color: rgba(59, 130, 246, .5);
}

.content-wrap {
  padding: 22px;
  min-height: 70vh;
}

.markdown-body {
  line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  line-height: 1.25;
}

.markdown-body h1 { font-size: 2rem; }
.markdown-body h2 { margin-top: 1.8rem; font-size: 1.35rem; }
.markdown-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.markdown-body pre {
  background: rgba(2, 6, 23, 0.92);
  padding: 14px;
  border-radius: 10px;
  overflow: auto;
}

.markdown-body a { color: #93c5fd; }

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(59, 130, 246, .15);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.error {
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(127, 29, 29, 0.25);
  border-radius: 10px;
  padding: 12px;
}

.docs-footer {
  margin-top: 12px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: rgba(10, 16, 30, .82);
  width: 100%;
}

.docs-footer .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.footer-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.footer-links a {
  color: var(--muted) !important;
  text-decoration: none !important;
}

.footer-links a:hover {
  color: #fff;
}

.footer-divider {
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.footer-copy {
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (min-width: 901px) {
  .footer-row {
    align-items: center;
    flex-direction: row;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
  }
}
