:root {
  --bg: #050505;
  --surface: #0a0a0a;
  --surface-2: #0f0f10;
  --line: #333333;
  --text: #e5e5e5;
  --muted: #737373;
  --brand: #8b5cf6;
  --brand-soft: rgba(139, 92, 246, 0.2);
  --accent: #f59e0b;
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

a {
  color: #c5afff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bg-glow {
  position: fixed;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(96px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.bg-a {
  background: radial-gradient(circle, #6d28d9 0%, transparent 66%);
  top: -10vw;
  left: -14vw;
}

.bg-b {
  background: radial-gradient(circle, #4c1d95 0%, transparent 65%);
  right: -10vw;
  bottom: -16vw;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(8px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  border: 1px solid #4c1d95;
  background: linear-gradient(140deg, rgba(76, 29, 149, 0.5), rgba(91, 33, 182, 0.35));
}

.brand-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  letter-spacing: 0.2px;
  font-weight: 700;
  color: #ffffff;
}

.brand-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #3f3f46;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #e5e5e5;
  background: #101010;
  transition: all 150ms ease;
}

.btn:hover {
  border-color: var(--brand);
  color: #ffffff;
  text-decoration: none;
}

.btn.ghost {
  background: transparent;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1420px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.95), rgba(7, 7, 8, 0.96));
  padding: 14px;
}

.search-label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

#search {
  width: 100%;
  margin-bottom: 14px;
  background: #000000;
  border: 1px solid #2d2d33;
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

#search:focus {
  outline: none;
  border-color: var(--brand);
}

.nav-group {
  margin-bottom: 14px;
}

.nav-title {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  margin-bottom: 3px;
}

.nav-link {
  display: block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #d4d4d8;
}

.nav-link:hover {
  border-color: #40304d;
  background: rgba(139, 92, 246, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.12);
  color: #ffffff;
}

.content-area {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(9, 9, 9, 0.95), rgba(4, 4, 5, 0.96));
  padding: 20px 24px 28px;
  min-height: 76vh;
}

.page-meta {
  border-bottom: 1px solid #2c2c2e;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

#current-page {
  margin: 0;
  color: #9f9fa9;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.2;
  color: #ffffff;
}

.content h1 {
  font-size: 34px;
  margin-top: 10px;
}

.content h2 {
  font-size: 24px;
  margin-top: 28px;
}

.content h3 {
  font-size: 19px;
  margin-top: 24px;
}

.content h4 {
  font-size: 16px;
  margin-top: 20px;
}

.content p,
.content li {
  line-height: 1.72;
  color: #e2e2e5;
}

.content ul,
.content ol {
  padding-left: 22px;
}

.content blockquote {
  margin: 18px 0;
  border-left: 3px solid var(--brand);
  padding: 2px 0 2px 12px;
  color: #cbcbcf;
  background: rgba(139, 92, 246, 0.07);
}

.content code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92em;
}

.content :not(pre) > code {
  background: #161319;
  border: 1px solid #3c3245;
  border-radius: 6px;
  padding: 2px 6px;
  color: #eadfff;
}

.content pre {
  overflow: auto;
  background: #000000;
  border: 1px solid #2d2d33;
  border-radius: 10px;
  padding: 12px;
}

.content pre code {
  color: #d4d4d8;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.content th,
.content td {
  border: 1px solid #34343a;
  padding: 9px;
  vertical-align: top;
}

.content th {
  background: #111113;
}

.content hr {
  border: none;
  border-top: 1px solid #2f2f36;
  margin: 30px 0;
}

.mermaid {
  display: flex;
  justify-content: center;
  overflow: auto;
  background: #070707;
  border: 1px solid #363640;
  border-radius: 10px;
  padding: 10px;
  margin: 14px 0;
}

.error-card {
  border-radius: 10px;
  border: 1px solid #6b1e3a;
  background: #2a1019;
  color: #ffd8e5;
  padding: 12px;
}

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

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .top-actions {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .content-area {
    padding: 16px;
  }

  .content h1 {
    font-size: 28px;
  }
}
