:root {
  --bg: #101418;
  --panel: rgba(21, 26, 31, 0.86);
  --panel-strong: rgba(23, 28, 34, 0.96);
  --land: #232b31;
  --land-stroke: rgba(218, 204, 180, 0.15);
  --graticule: rgba(220, 213, 198, 0.08);
  --text: #f3eee5;
  --muted: #b9afa2;
  --muted-2: #8c8276;
  --line: rgba(242, 233, 215, 0.12);
  --out: #f2b46d;
  --in: #7ed4c6;
  --idp: #b6a4ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --focus: #fff2c7;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 10%, rgba(126, 212, 198, 0.10), transparent 34rem),
    radial-gradient(circle at 78% 18%, rgba(242, 180, 109, 0.08), transparent 36rem),
    linear-gradient(180deg, #12171c 0%, var(--bg) 52%, #0b0e12 100%);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10000;
  background: var(--text);
  color: var(--bg);
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
}

.skip-link:focus {
  top: 1rem;
}

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 22px;
}

.masthead {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: clamp(0.74rem, 1vw, 0.88rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(2rem, 5.4vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
  font-weight: 750;
}

.lede {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.5;
}

.mode-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 600px;
}

.mode-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.mode-button:hover,
.mode-button:focus-visible {
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.24);
  outline: none;
}

.mode-button.is-active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}

.mode-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 14px currentColor;
}

.mode-out { color: var(--out); background: var(--out); }
.mode-in { color: var(--in); background: var(--in); }
.mode-idp { color: var(--idp); background: var(--idp); }

.map-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: stretch;
}

.map-card,
.story-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 30, 36, 0.76), rgba(15, 18, 22, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.attribution.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  left: -9999px !important;
  top: auto !important;
}

.map-card {
  position: relative;
  z-index: 1;
  min-height: min(70vw, 800px);
  height: calc(100vh - 184px);
  max-height: 880px;
  overflow: hidden;
  border-radius: 30px;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.map-bg {
  fill: #101418;
}

.zoom-root {
  cursor: grab;
}

.zoom-root:active {
  cursor: grabbing;
}

.graticule {
  fill: none;
  stroke: var(--graticule);
  stroke-width: 0.65;
  vector-effect: non-scaling-stroke;
}

.sphere-outline {
  fill: rgba(246, 238, 221, 0.012);
  stroke: rgba(246, 238, 221, 0.16);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.land {
  fill: var(--land);
  stroke: var(--land-stroke);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
}

.dot {
  cursor: pointer;
  stroke: rgba(255, 255, 255, 0.76);
  stroke-width: 0.75px;
  paint-order: stroke fill;
  transition: opacity 160ms ease;
}

.dot.out { fill: color-mix(in srgb, var(--out) 88%, white); }
.dot.in { fill: color-mix(in srgb, var(--in) 88%, white); }
.dot.idp { fill: color-mix(in srgb, var(--idp) 88%, white); }

.dot-halo {
  pointer-events: none;
  opacity: 0.14;
}

.dot:focus {
  outline: none;
}

.dot.is-highlighted {
  stroke: var(--focus);
  stroke-width: 1.6px;
}

.loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(10, 13, 16, 0.82);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.loader-mark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--out);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tooltip {
  position: fixed;
  z-index: 40;
  width: min(320px, calc(100vw - 36px));
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 14px;
  background: rgba(17, 21, 26, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(14px);
}

.tooltip h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.tooltip dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tooltip dt {
  color: var(--muted-2);
}

.tooltip dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 15;
  width: min(300px, calc(100% - 36px));
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.legend-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px;
}

.legend-body {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
}

.legend.is-collapsed .legend-body {
  display: none;
}

.legend-svg {
  width: 100%;
  height: 86px;
  display: block;
}

.legend-note {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 0.75rem;
  line-height: 1.35;
}

.corner-art {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  width: min(180px, 28vw);
  margin: 0;
  color: rgba(243, 238, 229, 0.72);
  opacity: 0.82;
  user-select: none;
}

.corner-art svg {
  width: 100%;
  height: auto;
  display: block;
}

.corner-art figcaption {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.72rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.moon {
  fill: rgba(246, 238, 221, 0.16);
}

.boat-line,
.water-line {
  fill: none;
  stroke: rgba(246, 238, 221, 0.54);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.boat-line.faint,
.water-line {
  stroke: rgba(246, 238, 221, 0.28);
}

.source-button {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 16;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.source-button:hover,
.source-button:focus-visible {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.26);
  outline: none;
}

.attribution {
  position: absolute;
  left: 22px;
  top: 20px;
  z-index: 12;
  color: rgba(185, 175, 162, 0.62);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}


.attribution.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  left: -9999px !important;
  top: auto !important;
}

.story-panel {
  position: relative;
  z-index: 5;
  border-radius: 30px;
  padding: clamp(18px, 2.3vw, 30px);
  min-height: 520px;
}

.panel-kicker {
  margin: 0 0 10px;
  color: var(--muted-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.story-panel h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.2vw, 2.35rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.story-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.stat-block {
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-number {
  display: block;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  font-weight: 760;
}

.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 0.86rem;
}

.top-list-wrap h3 {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.top-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.25rem;
}

.top-list li {
  color: var(--muted);
  padding-left: 2px;
}

.top-list button {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 7px;
  cursor: pointer;
}

.top-list button:hover,
.top-list button:focus-visible {
  color: var(--text);
  outline: none;
}

.top-list .value {
  color: var(--text);
  white-space: nowrap;
}

.care-note {
  position: absolute;
  left: clamp(18px, 2.3vw, 30px);
  right: clamp(18px, 2.3vw, 30px);
  bottom: clamp(18px, 2.3vw, 30px);
  margin: 0;
  color: var(--muted-2) !important;
  font-size: 0.84rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 7, 10, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0 0 12px;
}

.modal-card p,
.modal-card li {
  color: var(--muted);
  line-height: 1.55;
}

.modal-card a {
  color: var(--text);
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.4rem;
}

.made-with {
  margin-bottom: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 1080px) {
  .masthead {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .mode-controls {
    justify-content: flex-start;
  }

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

  .map-card {
    height: 66vh;
    min-height: 520px;
  }

  
.attribution.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  left: -9999px !important;
  top: auto !important;
}

.story-panel {
    min-height: auto;
  }

  .care-note {
    position: static;
    margin-top: 24px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1460px);
    padding-top: 18px;
  }

  .map-card {
    border-radius: 22px;
    height: 62vh;
    min-height: 470px;
  }

  
.attribution.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  clip: rect(0, 0, 0, 0) !important;
  left: -9999px !important;
  top: auto !important;
}

.story-panel {
    border-radius: 22px;
  }

  .mode-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .attribution {
    display: none;
  }

  .corner-art {
    display: none;
  }

  .legend {
    left: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }

  .source-button {
    right: 10px;
    top: 10px;
  }
}


/* v3 refinements: mobile header, anchored popups, and compact touch layout */
.tooltip.is-mobile {
  z-index: 80;
  max-height: 46svh;
  overflow: auto;
  pointer-events: none;
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    padding: 0 10px 12px;
  }

  .masthead {
    position: sticky;
    top: 0;
    z-index: 60;
    margin: 0 -10px 10px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(16, 20, 24, 0.97), rgba(16, 20, 24, 0.86));
    backdrop-filter: blur(16px);
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.45rem, 6.4vw, 1.95rem);
    line-height: 1.02;
    letter-spacing: -0.05em;
  }

  .lede {
    display: none;
  }

  .mode-controls {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 7px;
    max-width: 100%;
    margin-top: 8px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mode-controls::-webkit-scrollbar {
    display: none;
  }

  .mode-button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .mode-dot {
    width: 0.62rem;
    height: 0.62rem;
  }

  .map-stage {
    gap: 10px;
  }

  .map-card {
    height: calc(100svh - 150px);
    min-height: 420px;
    border-radius: 18px;
  }

  .source-button {
    right: 8px;
    top: 8px;
    padding: 7px 10px;
    font-size: 0.86rem;
  }

  .legend {
    left: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    border-radius: 18px;
  }

  .legend-toggle {
    padding: 10px 12px;
  }

  .legend-body {
    padding: 10px 12px 12px;
  }

  .legend-svg {
    height: 76px;
  }

  .tooltip {
    border-radius: 16px;
    padding: 12px;
  }

  .tooltip h3 {
    font-size: 0.98rem;
  }

  .tooltip dl {
    font-size: 0.84rem;
  }

  .story-panel {
    padding: 16px;
  }

  .stat-block {
    margin: 16px 0;
    padding: 14px 0;
  }

  .modal-card {
    padding: 24px 18px 18px;
    border-radius: 20px;
  }
}

@media (max-width: 420px) {
  .map-card {
    height: calc(100svh - 142px);
    min-height: 380px;
  }

  .legend-note {
    font-size: 0.7rem;
  }
}
