:root {
  color-scheme: dark;
  --bg: #08131d;
  --panel: rgba(10, 24, 36, 0.88);
  --panel-border: rgba(131, 169, 198, 0.18);
  --text: #edf6fb;
  --muted: #98b2c4;
  --accent: #8ecae6;
  --accent-2: #ffb703;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(142, 202, 230, 0.14), transparent 32%),
    linear-gradient(180deg, #0a1620 0%, #071018 100%);
}

code {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

.page-shell {
  width: calc(100vw - 24px);
  margin: 0;
  padding: 10px 12px 56px;
}

.top-frame {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.shell-rail,
.shell-main {
  min-width: 0;
}

.top-bar {
  padding: 8px 12px;
  margin-bottom: 0;
  min-height: 0;
  align-self: start;
  border-radius: 16px;
}

.top-bar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-bar-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.top-bar-buttons-dynamic {
  opacity: 0.96;
}

.top-bar-divider {
  width: 1px;
  height: 26px;
  background: rgba(131, 169, 198, 0.18);
}

.top-bar-button {
  appearance: none;
  border: 1px solid rgba(131, 169, 198, 0.22);
  background: rgba(142, 202, 230, 0.06);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 6px 12px;
  border-radius: 999px;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
  font-size: 0.92rem;
  line-height: 1.1;
}

.top-bar-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 183, 3, 0.35);
  background: rgba(255, 183, 3, 0.08);
}

.top-bar-button.active {
  border-color: rgba(255, 183, 3, 0.35);
  background: rgba(255, 183, 3, 0.16);
  color: var(--accent-2);
}

.hero,
.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.96;
}

.hero p,
.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.meta {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(142, 202, 230, 0.08);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.home-primary,
.home-secondary {
  min-width: 0;
}

.home-secondary {
  display: grid;
  gap: 18px;
}

.placeholder-panel {
  min-height: 220px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.subpanel {
  margin-top: 18px;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.03);
}

.about-list {
  display: grid;
  gap: 12px;
}

.about-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}

.about-step strong {
  color: var(--accent-2);
}

.subnav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.leaderboard-panel {
  margin-top: 0;
}

.world-radiation-panel {
  overflow: hidden;
}

.world-map-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.world-map-panel {
  position: relative;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(131, 169, 198, 0.14);
  background: linear-gradient(180deg, #03070c 0%, #06101a 100%);
  padding: 10px;
}

.world-map-image {
  width: 100%;
  display: block;
  height: auto;
  filter: saturate(0.88) brightness(0.72) contrast(1.04);
  border-radius: 14px;
}

.world-map-image-svg {
  filter:
    brightness(0)
    saturate(100%)
    invert(81%)
    sepia(21%)
    saturate(1475%)
    hue-rotate(164deg)
    brightness(101%)
    contrast(102%);
}

.world-map-tint {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border-radius: 14px;
  background:
    radial-gradient(circle at top, rgba(142, 202, 230, 0.04), transparent 32%),
    linear-gradient(180deg, rgba(2, 6, 10, 0.02), rgba(3, 9, 15, 0.06));
}

.world-map-caption {
  position: absolute;
  left: 28px;
  bottom: 28px;
  display: grid;
  gap: 4px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(131, 169, 198, 0.18);
  background: rgba(7, 16, 24, 0.88);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.28);
}

.world-map-caption strong {
  color: var(--accent-2);
}

.world-map-caption span {
  color: var(--muted);
  font-size: 0.9rem;
}

.world-map-legend {
  display: grid;
  gap: 14px;
}

.world-legend-scale {
  display: grid;
  gap: 8px;
}

.world-legend-gradient {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(190 88% 42%), hsl(130 88% 46%), hsl(56 90% 56%), hsl(10 92% 58%), hsl(320 88% 62%));
  border: 1px solid rgba(131, 169, 198, 0.16);
}

.world-legend-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.world-legend-list {
  display: grid;
  gap: 8px;
}

.world-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(131, 169, 198, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.world-legend-row.is-muted {
  opacity: 0.45;
}

.world-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.compare-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.compare-control {
  display: grid;
  gap: 6px;
}

.compare-control span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.compare-control select {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(131, 169, 198, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(142, 202, 230, 0.06);
  color: var(--text);
  font: inherit;
}

.compare-board {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 220px);
  gap: 14px;
  align-items: start;
}

.compare-entity {
  padding: 18px;
  border: 1px solid rgba(131, 169, 198, 0.16);
  border-radius: 18px;
}

.compare-entity-label {
  font-weight: 700;
  margin-bottom: 4px;
}

.compare-entity-meta {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.compare-matrix {
  margin: 0;
}

.compare-matrix-head,
.compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.compare-matrix-head {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(131, 169, 198, 0.12);
}

.compare-matrix-head span:nth-child(2) {
  text-align: center;
}

.compare-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(131, 169, 198, 0.08);
}

.compare-row:last-child {
  border-bottom: 0;
}

.compare-row span:last-child,
.compare-matrix-head span:last-child {
  text-align: right;
}

.compare-metric-label {
  color: var(--muted);
  text-align: center;
}

.timeline-chart-panel {
  margin-bottom: 18px;
}

.timeline-chart-panel-compact {
  margin-bottom: 0;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(142, 202, 230, 0.06);
  border: 1px solid rgba(131, 169, 198, 0.14);
}

.timeline-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.timeline-legend-red { background: #e85b68; }
.timeline-legend-blue { background: #5aa7ff; }
.timeline-legend-green { background: #57d68d; }
.timeline-legend-gold { background: #f7c548; }
.timeline-legend-purple { background: #b58cff; }

.timeline-chart-wrap {
  overflow-x: auto;
}

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

.timeline-grid-line {
  stroke: rgba(131, 169, 198, 0.14);
  stroke-width: 1;
}

.timeline-axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

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

.timeline-line-red { stroke: #e85b68; }
.timeline-line-blue { stroke: #5aa7ff; }
.timeline-line-green { stroke: #57d68d; }
.timeline-line-gold { stroke: #f7c548; }
.timeline-line-purple { stroke: #b58cff; }

.timeline-point {
  stroke: rgba(8, 19, 29, 0.9);
  stroke-width: 2;
}

.timeline-point-red { fill: #e85b68; }
.timeline-point-blue { fill: #5aa7ff; }
.timeline-point-green { fill: #57d68d; }
.timeline-point-gold { fill: #f7c548; }
.timeline-point-purple { fill: #b58cff; }

.compact-panel {
  padding: 14px 18px;
}

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

.detail-grid-wide {
  margin-bottom: 12px;
}

.detail-grid-sides {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(131, 169, 198, 0.12);
  background: rgba(142, 202, 230, 0.04);
}

.detail-button {
  width: 100%;
  text-align: left;
  appearance: none;
  cursor: pointer;
  color: inherit;
}

.detail-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 183, 3, 0.35);
}

.detail-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-card strong {
  font-size: 1rem;
}

.detail-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(131, 169, 198, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 183, 3, 0.12);
  color: var(--accent-2);
  font-size: 0.82rem;
}

.breadcrumb-row,
.scope-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.crumb,
.scope-button,
.inline-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.crumb,
.scope-button {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(142, 202, 230, 0.08);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.crumb:hover,
.scope-button:hover,
.inline-link:hover {
  color: var(--accent);
}

.crumb.active,
.scope-button.active {
  background: rgba(255, 183, 3, 0.16);
  color: var(--accent-2);
}

.crumb-sep {
  color: var(--muted);
}

.scope-caption {
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.inline-link {
  padding: 0;
  text-decoration: none;
}

.entity-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(142, 202, 230, 0.08);
  border: 1px solid rgba(131, 169, 198, 0.16);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, color 140ms ease;
}

.entity-pill:hover {
  transform: translateY(-1px);
  background: rgba(255, 183, 3, 0.08);
  border-color: rgba(255, 183, 3, 0.28);
}

.side-inline {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.side-pill-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.side-inline-red {
  background: rgba(220, 53, 69, 0.14);
  color: #ff9aa4;
}

.side-inline-blue {
  background: rgba(13, 110, 253, 0.14);
  color: #88bcff;
}

.side-inline-green {
  background: rgba(25, 135, 84, 0.14);
  color: #8cf0c1;
}

.side-inline-gold {
  background: rgba(255, 193, 7, 0.14);
  color: #ffd56b;
}

.side-inline-purple {
  background: rgba(111, 66, 193, 0.14);
  color: #c8a5ff;
}

.resource-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.resource-inline img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap-wide {
  overflow-x: auto;
}

.table-wide {
  min-width: 1220px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(131, 169, 198, 0.12);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(142, 202, 230, 0.06);
}

tbody tr.active-row {
  background: rgba(255, 183, 3, 0.08);
}

.row-tone-red {
  background: rgba(220, 53, 69, 0.08);
}

.row-tone-blue {
  background: rgba(13, 110, 253, 0.08);
}

.row-tone-green {
  background: rgba(25, 135, 84, 0.08);
}

.row-tone-gold {
  background: rgba(255, 193, 7, 0.08);
}

.row-tone-purple {
  background: rgba(111, 66, 193, 0.08);
}

.side-red {
  border-color: rgba(220, 53, 69, 0.35);
  background: rgba(220, 53, 69, 0.12);
}

.side-blue {
  border-color: rgba(13, 110, 253, 0.35);
  background: rgba(13, 110, 253, 0.12);
}

.side-green {
  border-color: rgba(25, 135, 84, 0.35);
  background: rgba(25, 135, 84, 0.12);
}

.side-gold {
  border-color: rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.12);
}

.side-purple {
  border-color: rgba(111, 66, 193, 0.35);
  background: rgba(111, 66, 193, 0.12);
}

.empty-cell {
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: rgba(142, 202, 230, 0.08);
}

.status-live {
  color: #7fe38d;
  background: rgba(127, 227, 141, 0.12);
}

.status-draft {
  color: #ffcf70;
  background: rgba(255, 207, 112, 0.12);
}

.status-ended {
  color: #ff9a8b;
  background: rgba(255, 154, 139, 0.12);
}

.tone-positive {
  color: #8ff0a4;
}

.tone-negative {
  color: #ff9a8b;
}

.tone-neutral {
  color: var(--text);
}

@media (max-width: 700px) {
  .page-shell {
    width: calc(100vw - 12px);
    padding: 6px 6px 28px;
  }

  .hero,
  .panel {
    border-radius: 16px;
  }

  .hero {
    padding: 22px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .top-frame,
  .home-layout {
    grid-template-columns: 1fr;
  }

  .top-bar-groups {
    flex-direction: column;
    align-items: stretch;
  }

  .top-bar-divider {
    width: 100%;
    height: 1px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .compare-controls,
  .compare-board,
  .timeline-grid,
  .compare-matrix-head,
  .compare-row {
    grid-template-columns: 1fr;
  }

  .world-map-wrap {
    grid-template-columns: 1fr;
  }

  .compare-row span:last-child,
  .compare-matrix-head span:last-child,
  .compare-metric-label {
    text-align: left;
  }
}

@media (max-width: 1080px) {
  .top-frame,
  .home-layout {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .compare-controls,
  .compare-board,
  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .world-map-wrap,
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}
