:root {
  --bg-top: #071824;
  --bg-bottom: #0e2f45;
  --panel: rgba(9, 26, 39, 0.76);
  --panel-border: rgba(184, 227, 255, 0.28);
  --text: #e6f5ff;
  --muted: #a0c4d8;
  --accent: #6ad4ff;
  --accent-strong: #29b6f6;
  --warning: #ffd166;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.4;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 15%, rgba(41, 182, 246, 0.28), transparent 34%),
    radial-gradient(circle at 88% 22%, rgba(106, 212, 255, 0.2), transparent 28%),
    radial-gradient(circle at 55% 100%, rgba(11, 142, 182, 0.2), transparent 38%);
}

.shell {
  width: min(1180px, 94vw);
  margin: 2rem auto 3rem;
}

.hero {
  background: linear-gradient(140deg, rgba(10, 26, 36, 0.7), rgba(17, 62, 84, 0.75));
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.5rem 1.4rem 1.8rem;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  font-size: 0.78rem;
}

h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: clamp(1.85rem, 4vw, 2.95rem);
  line-height: 1.05;
  width: fit-content;
  max-width: 100%;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 100%;
}

.content {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1rem;
}

.panel {
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

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

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-family: "IBM Plex Mono", monospace;
}

#map {
  height: 440px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.map-legend-wrap {
  margin-top: 0.75rem;
  width: 100%;
}

.contour-legend {
  border-radius: 10px;
  border: 1px solid rgba(11, 30, 44, 0.42);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  padding: 0.55rem 0.6rem;
}

.contour-legend-horizontal {
  width: 100%;
}

.contour-legend h4 {
  margin: 0 0 0.45rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: #15374e;
  letter-spacing: 0.02em;
}

.contour-legend-scale {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.contour-legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.contour-legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid rgba(12, 39, 57, 0.45);
  flex: 0 0 16px;
  opacity: 0.5;
}

.contour-legend-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: #103046;
  line-height: 1.15;
  text-align: center;
}

.table-wrap {
  width: 100%;
}

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

th,
td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  overflow-wrap: anywhere;
}

th {
  font-size: 0.84rem;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

th:nth-child(1),
td:nth-child(1) {
  width: 2rem;
}

th:nth-child(3),
td:nth-child(3) {
  width: 5.1rem;
  white-space: nowrap;
}

th:nth-child(4),
td:nth-child(4) {
  width: 5.6rem;
  white-space: nowrap;
}

td {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.09);
  font-size: 0.94rem;
}

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

.table-row-trigger {
  cursor: pointer;
}

.table-row-trigger td {
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
}

.table-row-trigger.is-selected {
  background: rgba(106, 212, 255, 0.2);
}

.table-row-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.value {
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", monospace;
}

.placeholder,
.error {
  text-align: center;
  color: var(--muted);
}

.error {
  color: var(--warning);
}

footer {
  margin-top: 0.95rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: "IBM Plex Mono", monospace;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal 540ms ease forwards;
}

.content {
  animation-delay: 90ms;
}

footer.reveal {
  animation-delay: 150ms;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .panel-header p {
    width: 100%;
  }

  #map {
    max-height: unset;
    height: 360px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(1260px, 96vw);
    margin-top: 1.2rem;
  }

  .hero {
    padding: 1.1rem 0.95rem 1.3rem;
  }

  .contour-legend {
    padding: 0.48rem 0.5rem;
  }

  .contour-legend h4 {
    font-size: 0.66rem;
  }

  .contour-legend-scale {
    gap: 0.2rem;
  }

  .contour-legend-swatch {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
  }

  .contour-legend-label {
    font-size: 0.58rem;
  }

  th,
  td {
    padding: 0.5rem 0.38rem;
  }

  th {
    font-size: 0.74rem;
  }

  td {
    font-size: 0.84rem;
  }

  .table-row-trigger td {
    padding-top: 0.64rem;
    padding-bottom: 0.64rem;
  }

  th:nth-child(1),
  td:nth-child(1) {
    width: 1.8rem;
  }

  th:nth-child(3),
  td:nth-child(3) {
    width: 4.4rem;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: 4.7rem;
  }
}
