:root {
  color-scheme: dark;
  --bg: #080c19;
  --bg-soft: #0d1426;
  --panel: #11182d;
  --panel-strong: #151d34;
  --line: #26314d;
  --text: #f7f8ff;
  --muted: #aebae5;
  --quiet: #7783b3;
  --blue: #2378ff;
  --cyan: #00b7ff;
  --green: #2fd18c;
  --amber: #f0be55;
  --coral: #ff6f61;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 56px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 25, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  color: var(--text);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: 0 10px 26px rgba(35, 120, 255, 0.36);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(17, 24, 45, 0.74);
}

.menu-toggle span {
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.site-header.menu-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header.menu-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.site-header.menu-open .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-link,
.primary-action,
.ghost-action {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  font-size: 14px;
}

.nav-link.active,
.nav-link:hover {
  color: #fff;
  background: var(--blue);
}

main {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
  min-height: 310px;
  padding: 28px 0 24px;
}

.section-kicker {
  display: block;
  width: 48px;
  height: 3px;
  margin-bottom: 24px;
  border-radius: 999px;
  background: var(--blue);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.96;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.24;
}

.hero p,
.section-head p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-copy p {
  margin-bottom: 8px;
}

.hero-descriptor {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.data-note {
  color: var(--cyan);
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-bottom: 18px;
}

.primary-action,
.ghost-action {
  padding: 0 18px;
  font-weight: 700;
}

.primary-action {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 14px 28px rgba(35, 120, 255, 0.28);
}

.ghost-action {
  color: #fff;
  border-color: var(--line);
}

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

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

.metric-card,
.panel,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-label,
.eyebrow {
  margin-bottom: 10px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 700;
}

.metric-value.blue {
  color: var(--cyan);
}

.metric-value.green {
  color: var(--green);
}

.metric-value.amber {
  color: var(--amber);
}

.metric-value.coral {
  color: var(--coral);
}

.metric-sub {
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.wide {
  grid-column: span 2;
}

.panel.full-width {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chart-slot {
  min-height: 270px;
}

.chart-slot.tall {
  min-height: 340px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
}

.axis-label {
  fill: var(--quiet);
  font-size: 12px;
}

.chart-grid {
  stroke: rgba(174, 186, 229, 0.14);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  opacity: 0.15;
}

.chart-point {
  pointer-events: none;
}

.chart-hit,
.chart-hit-rect {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.chart-highlight {
  cursor: crosshair;
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  max-width: min(280px, calc(100vw - 28px));
  padding: 9px 11px;
  border: 1px solid rgba(174, 186, 229, 0.25);
  border-radius: 8px;
  background: rgba(8, 12, 25, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  gap: 7px;
  cursor: default;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.bar-label {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(174, 186, 229, 0.13);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

.section-head {
  margin: 34px 0 24px;
}

.section-head.with-tool {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
}

.section-head h1 {
  margin-bottom: 14px;
  font-size: clamp(40px, 6vw, 64px);
}

.search-box {
  display: grid;
  gap: 8px;
  width: min(320px, 100%);
  color: var(--quiet);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-group {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  width: min(520px, 100%);
}

.panel-tool-row {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: -4px 0 16px;
}

.select-box {
  width: 150px;
}

.search-box input,
.search-box select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: var(--panel);
}

.search-box select {
  cursor: pointer;
}

.search-box input:focus,
.search-box select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 120, 255, 0.18);
}

.split-block {
  display: grid;
  gap: 16px;
}

.detail-summary {
  margin: -4px 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.detail-grid .metric-card {
  min-height: 96px;
  padding: 14px;
  box-shadow: none;
  background: var(--panel-strong);
}

.split-total {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 700;
}

.stack {
  display: flex;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(174, 186, 229, 0.13);
}

.stack span {
  min-width: 2px;
  cursor: default;
}

.legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.legend-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(174, 186, 229, 0.08);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(174, 186, 229, 0.1);
  text-align: left;
}

th {
  color: var(--quiet);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--muted);
}

td strong {
  color: var(--text);
}

.table-action {
  max-width: 260px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-weight: 800;
  text-align: left;
}

.table-action:hover {
  color: var(--cyan);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.source-card {
  padding: 18px;
}

.source-card h2 {
  margin-bottom: 12px;
}

.source-card p {
  min-height: 44px;
  color: var(--muted);
  line-height: 1.45;
}

.source-card a {
  color: var(--cyan);
  overflow-wrap: anywhere;
}

.methodology-prose {
  max-width: 880px;
  padding: 2px 0 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.78;
}

.methodology-prose p {
  margin: 0 0 18px;
}

.methodology-prose ul {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding-left: 20px;
}

.methodology-prose li {
  padding-left: 4px;
}

.methodology-prose a {
  color: var(--cyan);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.methodology-prose a:hover {
  color: var(--text);
}

.notes {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 25, 0.94);
}

.site-footer__inner {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.site-footer__support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(47, 209, 140, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(47, 209, 140, 0.1), rgba(35, 120, 255, 0.08));
}

.site-footer__support p,
.site-footer__inner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.site-footer__support p {
  max-width: 620px;
  color: var(--text);
}

.site-footer__donation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.site-footer__donation-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(174, 186, 229, 0.28);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  background: rgba(17, 24, 45, 0.74);
}

.site-footer__donation-links a:hover {
  border-color: rgba(47, 209, 140, 0.55);
  background: rgba(47, 209, 140, 0.14);
}

.site-footer__inner p + p {
  margin-top: 6px;
}

.site-footer__inner a {
  color: var(--cyan);
  text-decoration: none;
}

.site-footer__inner a:hover {
  color: var(--text);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 940px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .top-nav {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: visible;
  }

  .site-header.menu-open .top-nav {
    display: grid;
    gap: 6px;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
    text-align: left;
  }

  main {
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

  .site-footer__inner {
    width: min(100% - 28px, 1180px);
  }

  .hero,
  .section-head.with-tool {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section-head.with-tool {
    flex-direction: column;
  }

  .tool-group {
    justify-content: flex-start;
    width: 100%;
  }

  .hero {
    display: grid;
    min-height: auto;
  }

  .hero-actions {
    justify-content: start;
    padding-bottom: 0;
  }

  .site-footer__support {
    align-items: stretch;
    flex-direction: column;
  }

  .site-footer__donation-links {
    justify-content: flex-start;
  }

  .metric-grid,
  .metric-grid.compact,
  .dashboard-grid,
  .detail-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide,
  .panel.full-width {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 42px;
  }

  .nav-link {
    padding: 0 11px;
  }

  .metric-card,
  .panel,
  .source-card {
    padding: 15px;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }

  .tool-group {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tool-row {
    align-items: stretch;
    flex-direction: column;
  }

  .select-box {
    width: 100%;
  }

  .site-footer__donation-links a {
    width: 100%;
  }
}
