:root {
  --bg: #070b12;
  --bg-soft: #0b1220;
  --panel: rgba(15, 23, 42, 0.86);
  --panel-strong: #111827;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.32);
  --text: #e5edf8;
  --muted: #e5edf8;
  --muted-2: #9377a0;
  --accent: #fa60f7;
  --accent-2: #ee22a7;
  --accent-soft: rgba(217, 96, 250, 0.14);
  --success-soft: rgba(34, 211, 238, 0.10);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar: 310px;
  font-synthesis-weight: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.13), transparent 34rem),
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.16), transparent 32rem),
    linear-gradient(135deg, #060914 0%, #08111f 42%, #05070d 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

a:hover {
  color: #f693fd;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 28px;
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.sidebar {
  position: sticky;
  top: 28px;
  align-self: start;
  min-height: calc(100vh - 56px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(7, 11, 18, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(212, 96, 250, 0.45);
  border-radius: 16px;
  color: #dbeafe;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.24), rgba(34, 211, 238, 0.13));
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--text);
  line-height: 1.2;
}

.brand small {
  color: var(--muted);
  margin-top: 3px;
}

.nav-label,
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.side-nav {
  padding: 24px 0;
}

.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.44);
}

.nav-section:hover,
.nav-section.active {
  border-color: rgba(217, 96, 250, 0.45);
  color: var(--text);
  background: var(--accent-soft);
}

.nav-section strong {
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #febffd;
  background: rgba(96, 165, 250, 0.13);
  text-align: center;
}

.sidebar-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.50);
}

.compact-stats {
  margin: 0;
}

.compact-stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.11);
}

.compact-stats div:last-child {
  border-bottom: 0;
}

.compact-stats dt {
  color: var(--muted);
}

.compact-stats dd {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.content {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(38, 15, 42, 0.92), rgba(2, 6, 23, 0.78)),
    radial-gradient(circle at top right, rgba(212, 96, 250, 0.22), transparent 22rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.intro-text {
  max-width: 760px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1.05rem;
}

.intro-text p {
  margin: 0 0 10px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.78);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  border-color: rgba(250, 96, 242, 0.7);
  background: linear-gradient(135deg, rgb(246, 147, 253), rgb(238, 34, 167));
  color: #020617;
}

.button.ghost:hover,
.button.primary:hover {
  transform: translateY(-1px);
}

.hero-panel {
  display: grid;
  gap: 14px;
}

.metric {
  display: grid;
  align-content: center;
  min-height: 110px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(2, 6, 23, 0.48);
}

.metric span {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.section-card {
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.68);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.20);
}

.section-card h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.section-topline {
  margin-bottom: 12px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-description {
  color: var(--muted);
  font-size: 0.95rem;
}

.section-description p {
  margin: 0;
}

.section-count {
  display: inline-flex;
  margin-top: 18px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #ecbffe;
  background: rgba(96, 165, 250, 0.12);
  font-size: 0.84rem;
  font-weight: 800;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 20px;
  align-items: end;
  margin-top: 34px;
}

.controls h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.search-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--text);
  background: rgba(2, 6, 23, 0.72);
  outline: none;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.search-box input:focus {
  border-color: rgba(222, 96, 250, 0.72);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 10px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 12px 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.62);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.filter-pill span {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  font-size: 0.82rem;
}

.filter-pill.active,
.filter-pill:hover {
  border-color: rgba(217, 96, 250, 0.55);
  color: var(--text);
  background: var(--accent-soft);
}

.result-line {
  margin: 16px 0;
  color: var(--muted);
}

.qa-list {
  display: grid;
  gap: 14px;
}

.qa-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.72);
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
}

.qa-card[hidden] {
  display: none;
}

details {
  overflow: hidden;
}

summary {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 86px;
  padding: 18px 22px;
  list-style: none;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

.question-index {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(217, 96, 250, 0.36);
  border-radius: 15px;
  color: #dbeafe;
  background: rgba(96, 165, 250, 0.12);
  font-weight: 900;
  font-size: 0.88rem;
}

.question-main {
  min-width: 0;
}

.question-title {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.35;
}

.question-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-action {
  min-width: 78px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
}

details[open] summary {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.09), transparent);
}

details[open] .summary-action {
  color: #dbeafe;
  border-color: rgba(222, 96, 250, 0.42);
  background: rgba(96, 165, 250, 0.12);
}

.answer-body {
  padding: 28px 34px 34px 90px;
  color: #d4deec;
}

.answer-body > *:first-child {
  margin-top: 0;
}

.answer-body > *:last-child {
  margin-bottom: 0;
}

.answer-body h2,
.answer-body h3,
.answer-body h4 {
  margin: 1.5em 0 0.55em;
  color: #f8fafc;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.answer-body p,
.answer-body li {
  color: #cbd5e1;
}

.answer-body ul,
.answer-body ol {
  padding-left: 1.4rem;
}

.answer-body strong {
  color: #f8fafc;
}

.answer-body code {
  padding: 0.18em 0.38em;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  color: #bae6fd;
  background: rgba(2, 6, 23, 0.62);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.answer-body pre {
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: #020617;
}

.answer-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.answer-body blockquote {
  margin: 1.2rem 0;
  padding: 1px 0 1px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.answer-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.2rem 0;
}

.answer-body th,
.answer-body td {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.answer-body th {
  color: #f8fafc;
  background: rgba(96, 165, 250, 0.10);
}

.answer-body img {
  max-width: 100%;
  height: auto;
  margin: 14px 12px 14px 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.source-line {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--muted-2);
  font-size: 0.78rem;
}

.empty-state {
  margin: 24px 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.70);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .side-nav .nav-label {
    grid-column: 1 / -1;
  }

  .nav-section {
    margin: 0;
  }
}

@media (max-width: 920px) {
  .hero,
  .controls {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answer-body {
    padding-left: 34px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1540px);
    padding-top: 12px;
  }

  .sidebar,
  .hero {
    border-radius: 22px;
  }

  .side-nav,
  .section-grid,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero,
  .answer-body {
    padding: 22px;
  }

  summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .question-index,
  .summary-action {
    width: auto;
    justify-self: start;
  }

  .question-meta {
    white-space: normal;
  }
}
