:root {
  --ink: #17334f;
  --ink-soft: #476480;
  --ink-mute: #607a95;
  --surface: #ffffff;
  --panel: rgba(255, 255, 255, 0.94);
  --teal-strong: #08519c;
  --teal-mid: #3182bd;
  --ring: rgba(49, 130, 189, 0.26);
  --rail-card: #203343;
  --rail-card-border: rgba(255, 255, 255, 0.12);
  --rail-card-sheen: rgba(255, 255, 255, 0.08);
  --rail-card-accent: rgba(255, 255, 255, 0.18);
  --rail-card-grid: rgba(247, 248, 250, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: Tahoma, sans-serif;
  color: var(--ink);
  min-height: 100dvh;
  background: #ffffff;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

.globe-window {
  position: relative;
  min-height: min(64vh, 620px);
  max-height: 100dvh;
  overflow: hidden;
  background: #ffffff;
  isolation: isolate;
  transition: min-height 320ms ease;
}

.detail-panel {
  pointer-events: auto;
}

#globeViz {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: min(64vh, 620px);
  background: transparent;
  transition: filter 320ms ease, transform 320ms ease, opacity 320ms ease;
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 1) 62%,
    rgba(0, 0, 0, 0.88) 74%,
    rgba(0, 0, 0, 0.42) 88%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 1) 62%,
    rgba(0, 0, 0, 0.88) 74%,
    rgba(0, 0, 0, 0.42) 88%,
    rgba(0, 0, 0, 0) 100%
  );
}

#globeViz canvas {
  display: block;
  margin: 0 auto;
  transform-origin: center center;
}

.impact-summary {
  position: absolute;
  left: 2rem;
  bottom: 1rem;
  width: min(320px, calc(100% - 4rem));
  z-index: 10;
  display: grid;
  gap: 0.28rem;
  padding: 0.18rem;
  margin: -0.18rem;
  pointer-events: auto;
  visibility: visible;
  transition: visibility 240ms ease, transform 240ms ease, bottom 220ms ease;
}

.impact-summary__search {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid #000000;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  display: grid;
  gap: 0.34rem;
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.impact-summary__search-input {
  width: 100%;
  min-width: 0;
  border: 1px solid #000000;
  border-radius: 10px;
  background: #ffffff;
  color: #000000;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 0.72rem;
}

.impact-summary__search-input::placeholder {
  color: rgba(0, 0, 0, 0.54);
}

.impact-summary__search-input:focus {
  outline: 2px solid rgba(0, 79, 146, 0.22);
  border-color: #004F92;
}

.impact-summary__item {
  margin: 0;
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid #000000;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: #000000;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  backdrop-filter: blur(6px);
  display: grid;
  gap: 0.18rem;
}

.impact-summary__value,
.impact-summary__label {
  display: block;
}

.impact-summary__value {
  font-family: Tahoma, sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.impact-summary__label {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
}

.impact-summary__button {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid #000000;
  border-radius: 14px;
  background: #000000;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  pointer-events: auto;
}

.impact-summary__button--mode {
  background: rgba(255, 255, 255, 0.82);
  color: #000000;
}

.impact-summary__button:hover,
.impact-summary__button:focus-visible {
  background: #161616;
}

.impact-summary__button--mode:hover,
.impact-summary__button--mode:focus-visible {
  background: rgba(255, 255, 255, 0.94);
}

.survey-card {
  position: absolute;
  top: 1rem;
  left: 2rem;
  width: min(340px, calc(100% - 4rem));
  z-index: 10;
  padding: 0.75rem 0.9rem;
  border: 1px solid #000000;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: #000000;
  backdrop-filter: blur(6px);
}

.survey-card__text {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.08;
}

.network-card {
  position: absolute;
  top: 1rem;
  right: 2rem;
  width: min(360px, calc(100% - 4rem));
  z-index: 10;
  padding: 0.75rem 0.9rem;
  border: 1px solid #000000;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: #000000;
  backdrop-filter: blur(6px);
  transition: opacity 140ms ease, visibility 140ms ease;
}

.network-card__text {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
}

.detail-panel {
  position: absolute;
  top: 5.9rem;
  right: 15rem;
  width: min(392px, calc(100% - 16rem));
  max-height: min(598px, calc(100% - 6.9rem));
  overflow: hidden;
  border: 1px solid #000000;
  border-radius: 20px;
  box-shadow: none;
  padding: 1.1rem;
  background: var(--panel);
  transform: translateX(115%);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms cubic-bezier(0.2, 0.9, 0.24, 1), opacity 220ms ease;
  z-index: 12;
}

.detail-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.map-legend {
  position: absolute;
  right: 2rem;
  bottom: 1rem;
  width: min(240px, calc(100% - 4rem));
  z-index: 6;
  display: grid;
  gap: 0.42rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  color: #000000;
  opacity: 0.38;
  will-change: opacity;
  transition: opacity 240ms ease, visibility 220ms ease;
}

.map-legend:hover,
.map-legend:focus-within {
  opacity: 1;
}

.map-legend__bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(140, 168, 188, 0.92) 0%,
    rgba(108, 139, 162, 0.94) 38%,
    rgba(48, 82, 108, 0.95) 65%,
    rgba(32, 66, 91, 0.96) 82%,
    rgba(14, 34, 52, 0.98) 100%
  );
}

.map-legend__labels {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.72);
}

.impact-summary:hover ~ .detail-panel.open,
.impact-summary:focus-within ~ .detail-panel.open {
  opacity: 0.18;
  z-index: 9;
}

.globe-window:has(.detail-panel.open) .network-card {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.detail-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.92rem;
  font-weight: 800;
  color: #000000;
}

.panel-close {
  border: 0;
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-weight: 700;
  cursor: pointer;
  background: #000000;
  color: #fff;
}

.detail-panel h2 {
  margin: 0.34rem 0 0;
  color: #000000;
  font-family: Tahoma, sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
}

.detail-total {
  margin: 0.5rem 0 0.72rem;
  color: #000000;
  font-size: 1.15rem;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin: 0.1rem 0 0.72rem;
}

.chip {
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #000000;
  border-radius: 999px;
  padding: 0.46rem 0.82rem;
  font-size: 0.96rem;
  cursor: pointer;
}

.chip.active {
  background: #0E2234;
  color: #fff;
}

.detail-empty {
  margin: 0.2rem 0 0;
  color: #000000;
  font-size: 1.12rem;
}

.detail-metric-list {
  list-style: none;
  margin: 0.84rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.52rem;
}

.detail-metric-list li {
  border: 1px solid rgba(32, 66, 90, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  padding: 0.67rem 0.78rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
  animation: riseIn 320ms ease both;
}

.detail-metric-name {
  font-size: 1.1rem;
  color: #000000;
}

.detail-metric-value {
  font-family: Tahoma, sans-serif;
  color: #000000;
  font-weight: 800;
  font-size: 1.29rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(22px, -16px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding: 0;
  }

  .globe-window,
  #globeViz {
    min-height: min(58vh, 520px);
    max-height: 100dvh;
  }

  .impact-summary {
    left: 2rem;
    right: 2rem;
    bottom: 0.7rem;
    top: auto;
    width: auto;
    gap: 0.22rem;
    padding: 0;
    margin: 0;
    transform: none;
    opacity: 1;
  }

  .impact-summary__item {
    width: 100%;
    padding: 0.42rem 0.68rem;
    border-radius: 14px;
    gap: 0.14rem;
  }

  .impact-summary__search {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .impact-summary__search-input {
    font-size: 0.94rem;
    padding: 0.54rem 0.78rem;
    border-radius: 14px;
  }

  .impact-summary__value {
    font-size: 1.12rem;
  }

  .impact-summary__label {
    font-size: 0.9rem;
  }

  .impact-summary__button {
    width: 100%;
    padding: 0.54rem 0.78rem;
    border-radius: 14px;
    font-size: 0.94rem;
  }

  .survey-card {
    display: none;
  }

  .survey-card__text {
    font-size: 1.18rem;
    line-height: 1.1;
  }

  .network-card {
    display: none;
  }

  .globe-window:not(.is-collapsed) .impact-summary__item {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
  }

  .globe-window:has(.detail-panel.open) .impact-summary {
    bottom: 0.7rem;
  }

  .detail-panel {
    top: auto;
    right: 2rem;
    left: 2rem;
    width: auto;
    bottom: calc(0.7rem + 8.2rem);
    border-radius: 16px;
    max-height: min(540px, 76vh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
  }

  .detail-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .map-legend {
    display: none;
  }
}

@media (max-height: 650px) and (min-width: 981px) {
  .impact-summary {
    left: 1.5rem;
    width: min(272px, calc(100% - 3rem));
  }

  .impact-summary__search-input {
    font-size: 0.92rem;
    padding: 0.52rem 0.62rem;
  }

  .impact-summary__value {
    font-size: 1.33rem;
  }

  .impact-summary__label {
    font-size: 1.06rem;
  }

  .survey-card {
    display: none;
  }

  .survey-card__text {
    font-size: 1.28rem;
  }

  .network-card {
    right: 1.5rem;
    top: 0.8rem;
    width: min(304px, calc(100% - 3rem));
    padding: 0.62rem 0.72rem;
  }

  .network-card__text {
    font-size: 0.92rem;
  }

  .map-legend {
    right: 1.5rem;
    bottom: 0.8rem;
    width: min(214px, calc(100% - 3rem));
    padding: 0.7rem 0.78rem;
  }

  .map-legend__labels {
    font-size: 0.72rem;
  }

  .detail-panel {
    top: 4.1rem;
    right: 10rem;
    width: min(314px, calc(100% - 11rem));
    max-height: min(448px, calc(100% - 4.85rem));
    padding: 0.78rem;
  }

  .detail-panel h2 {
    font-size: 1.33rem;
  }

  .detail-total {
    margin: 0.28rem 0 0.44rem;
    font-size: 1.06rem;
  }

  .category-chips {
    gap: 0.24rem;
    margin: 0.04rem 0 0.44rem;
  }

  .chip {
    padding: 0.26rem 0.48rem;
    font-size: 0.87rem;
  }

  .detail-metric-list {
    margin-top: 0.42rem;
    gap: 0.24rem;
  }

  .detail-metric-list li {
    padding: 0.36rem 0.46rem;
  }

  .detail-metric-name,
  .detail-metric-value {
    font-size: 0.97rem;
  }
}

@media (max-height: 650px) and (max-width: 980px) {
  .impact-summary {
    left: 1.5rem;
    right: 1.5rem;
    width: auto;
  }

  .impact-summary__search-input {
    font-size: 0.86rem;
    padding: 0.46rem 0.66rem;
  }

  .impact-summary__button {
    font-size: 0.86rem;
    padding: 0.46rem 0.66rem;
  }

  .impact-summary__value {
    font-size: 1rem;
  }

  .impact-summary__label {
    font-size: 0.82rem;
  }

  .survey-card {
    display: none;
  }

  .survey-card__text {
    font-size: 1rem;
  }

  .network-card {
    display: none;
  }

  .detail-panel {
    top: auto;
    right: 1.5rem;
    left: 1.5rem;
    bottom: calc(0.55rem + 7.4rem);
    max-height: min(440px, 68vh);
    padding: 0.64rem;
  }

  .detail-panel h2 {
    font-size: 1.12rem;
  }

  .detail-total {
    margin: 0.26rem 0 0.42rem;
    font-size: 0.9rem;
  }

  .category-chips {
    gap: 0.18rem;
    margin: 0.04rem 0 0.34rem;
  }

  .chip {
    padding: 0.18rem 0.36rem;
    font-size: 0.74rem;
  }

  .detail-metric-list {
    margin-top: 0.4rem;
    gap: 0.22rem;
  }

  .detail-metric-list li {
    padding: 0.34rem 0.44rem;
  }

  .detail-metric-name,
  .detail-metric-value {
    font-size: 0.82rem;
  }
}
