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

html {
  overflow-anchor: none;
}

/* ── DESIGN TOKENS ── */
:root {
  --bg: #0c0d10;
  --surface: #121316;
  --surface-1: #1b1b1f;
  --surface-2: #1f1f23;
  --surface-3: #292a2d;
  --surface-4: #343538;
  --panel: #15171d;
  --panel-dark: #0d0e11;
  --line: #2d3039;
  --line-subtle: rgba(255, 255, 255, 0.08);
  --ink: #e3e2e6;
  --ink-var: #c8c4d5;
  --muted: #9296a4;
  --accent: #8b7ff5;
  --accent-soft: rgba(139, 127, 245, 0.15);
  --accent-hover: #9d93f7;
  --primary: #c6bfff;
  --primary-btn: #8b7ff5;
  --primary-hover: #b8b0ff;
  --cta-bg: #8d81f7;
  --cta-ink: #160066;
  --cyan: #68d6e3;
  --cyan-btn: #57c7d4;
  --cyan-soft: rgba(87, 199, 212, 0.15);
  --cyan-ink: #00363c;
  --green: #4ecba0;
  --green-ink: #0e1a15;
  --amber: #f5a623;
  --red: #f55b5b;
  --blue: #6aa8ff;
  --salmon: #ffb4ab;
  --orange: #f57c5b;
  /* exam-specific aliases */
  --dim: #8a8f9e;
  --outline: #928f9e;
  --outline-var: #474553;
  --panel-2: #1f1f23;
  --panel-border: #2d3039;
}

/* ── BASE ── */
body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}
a,
button {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--primary);
}

/* ── NAV ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 61px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-var);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.active {
  font-weight: 700;
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
}

.nav-toggle svg {
  width: 18px;
  height: 18px;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-close {
  display: block;
}

@media (max-width: 760px) {
  .navbar {
    padding: 0 20px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 61px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }

  .nav-links.open {
    max-height: 320px;
  }

  .nav-links a {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-subtle);
  }

  .nav-links a.active {
    border-bottom: 1px solid var(--line-subtle);
  }
}

/* ── SHARED SIDEBAR NAV ── */
.domain-nav {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.domain-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--ink-var);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-align: left;
  width: 100%;
  line-height: 20px;
  min-height: 44px;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}

.domain-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.domain-link.active {
  background: rgba(198, 191, 255, 0.08);
  color: var(--primary);
}

.domain-link-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.domain-link-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  opacity: 0.55;
}

.domain-link.active .domain-link-icon svg {
  opacity: 1;
}

.dl-label {
  display: flex;
  flex-direction: column;
}

.dl-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  line-height: 14px;
  margin-top: 2px;
}

.domain-link.active .dl-pct {
  color: var(--primary);
  opacity: 0.7;
}

/* ── SHARED: TWO-COLUMN PAGE SIDEBAR ── */
.domain-sidebar {
  position: sticky;
  top: 61px;
  width: 256px;
  flex: 0 0 256px;
  height: calc(100vh - 61px);
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow-y: auto;
}

.domain-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.domain-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.domain-toggle-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-toggle-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

.domain-sidebar.open .domain-toggle-chevron {
  transform: rotate(180deg);
}

@media (max-width: 760px) {
  .domain-sidebar {
    position: static;
    flex: none;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .domain-toggle {
    display: flex;
  }

  .domain-nav {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: max-height 0.2s ease;
  }

  .domain-sidebar.open .domain-nav {
    max-height: 480px;
    overflow-y: auto;
    padding: 8px 16px 16px;
  }

  .domain-link {
    min-height: auto;
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* ── SHARED: DOMAIN HEADER TYPOGRAPHY ── */
.domain-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--cyan);
}

.domain-h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ── SHARED: PROGRESS BAR ── */
.progress-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 256px;
}

.progress-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
}

.progress-track {
  width: 256px;
  height: 6px;
  background: var(--surface-4);
  border-radius: 9999px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--cyan);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

@media (max-width: 640px) {
  .progress-block,
  .progress-track {
    width: 100%;
  }
}

/* ── SHARED: STAT BOXES ── */
.stat-box {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.stat-box:hover {
  border-color: rgba(198, 191, 255, 0.4);
}

.stat-box.active {
  border-color: rgba(198, 191, 255, 0.2);
}

/* ── SHARED: DOMAIN NAV BUTTONS ── */
.btn-prev {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-prev:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn-prev[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.btn-next {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--cta-ink);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-next:hover {
  opacity: 0.9;
}

.btn-next[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── SHARED: DOMAIN NAV FOOTER ── */
.domain-nav-footer {
  border-top: 1px solid var(--line);
  padding-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 640px) {
  .domain-nav-footer {
    padding-top: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

/* ── SITE FOOTER ── */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-disclaimer {
  font-size: 11px;
  color: var(--muted);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footer-copy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

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

.footer-copy a:hover {
  color: var(--ink);
}

.footer-links {
  display: flex;
  gap: 32px;
}

.footer-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .footer-inner {
    padding: 20px 20px 24px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}
