/* Geographical stats. The stage stays dark in both themes so the map text stays light on midnight. */
.stats-geo {
  margin-top: 0.75rem;
  color: #e8f1fb;
  font-family: inherit;
}
.stats-geo-stage {
  position: relative;
  height: min(72vh, 760px);
  min-height: 420px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 100%, rgba(46, 230, 255, 0.08), transparent 46%),
    radial-gradient(80% 50% at 70% 0%, rgba(61, 126, 255, 0.16), transparent 42%),
    #070b14;
  border: 1px solid rgba(120, 186, 255, 0.28);
  box-shadow: 0 24px 60px rgba(4, 10, 24, 0.35);
}
#stats-globe,
#stats-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#stats-globe {
  transition: opacity 0.45s ease;
}
#stats-globe.is-away {
  opacity: 0;
  pointer-events: none;
}
#stats-map {
  background: transparent;
  touch-action: none;
  pointer-events: none;
}
.stats-geo-district {
  cursor: pointer;
  transition: fill-opacity 0.45s ease, stroke 0.45s ease;
}
.stats-geo-town {
  cursor: pointer;
  transition: r 0.45s ease, fill 0.45s ease;
}
.stats-geo-label {
  fill: #e8f1fb;
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.stats-geo-hud {
  position: absolute;
  z-index: 2;
  top: 0.7rem;
  left: 0.7rem;
  right: 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  pointer-events: none;
}
.stats-geo-hud button,
.stats-geo-dock button,
.stats-geo-year-switch button,
.stats-geo-close,
.stats-geo-filter,
.stats-geo-unmatched-item,
.stats-geo-bar,
.stats-geo-cat {
  pointer-events: auto;
}
.stats-geo-status {
  margin: 0;
  color: #d5e8ff;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.stats-geo button {
  border: 1px solid rgba(140, 196, 255, 0.4);
  background: rgba(8, 16, 32, 0.72);
  color: #e8f1fb;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.78rem;
}
.stats-geo-meters {
  position: absolute;
  z-index: 2;
  left: 0.7rem;
  bottom: 0.7rem;
  display: flex;
  gap: 0.8rem;
  pointer-events: none;
}
.stats-geo-meter strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
  color: #f4fbff;
}
.stats-geo-meter span,
.stats-geo-unit,
.stats-geo-note,
.stats-geo-credit,
.stats-geo-kicker {
  color: #b7c9de;
  font-size: 0.75rem;
}
.stats-geo-figure {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  color: #f4fbff;
}
.stats-geo-scale,
.stats-geo-filter {
  position: absolute;
  z-index: 2;
  right: 0.7rem;
  bottom: 0.75rem;
  margin: 0;
  color: #d5e8ff;
  font-size: 0.72rem;
}
.stats-geo-scale {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(6, 12, 24, 0.72);
  border: 1px solid rgba(140, 196, 255, 0.32);
  backdrop-filter: blur(8px);
  letter-spacing: 0.03em;
}
.stats-geo-scale i {
  display: block;
  width: 4.8rem;
  height: 0.38rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #3d7eff, #2ee6ff 40%, #ffb020 72%, #ff4d8d);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.4);
}
#stats-map-canvas {
  z-index: 1;
  cursor: grab;
}
.stats-geo [hidden] {
  display: none !important;
}
.stats-geo-meters {
  padding: 0.4rem 0.65rem;
  border-radius: 16px;
  background: rgba(6, 12, 24, 0.62);
  border: 1px solid rgba(140, 196, 255, 0.22);
  backdrop-filter: blur(8px);
}
.stats-geo-filter {
  bottom: 2.1rem;
  cursor: pointer;
}
.stats-geo-sheet {
  position: absolute;
  z-index: 3;
  top: 3.2rem;
  right: 0.7rem;
  width: min(340px, calc(100% - 1.4rem));
  max-height: calc(100% - 4.4rem);
  overflow: auto;
  padding: 0.9rem 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(10, 16, 30, 0.88);
  border: 1px solid rgba(140, 196, 255, 0.32);
  backdrop-filter: blur(10px);
}
.stats-geo-sheet-head {
  position: relative;
}
.stats-geo-close {
  position: absolute;
  top: 0;
  right: 0;
}
.stats-geo-sheet h3 {
  margin: 0.15rem 0 0.35rem;
  color: #f4fbff;
  font-size: 1.25rem;
}
.stats-geo-block-title {
  margin: 0.8rem 0 0.35rem;
  color: #d5e8ff;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.stats-geo-bar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.35rem;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: #e8f1fb;
  text-align: left;
  border-radius: 0;
}
.stats-geo-bar-track {
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.stats-geo-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3d7eff, #2ee6ff 55%, #ffb020);
}
.stats-geo-months {
  display: flex;
  align-items: flex-end;
  gap: 0.28rem;
  height: 84px;
}
.stats-geo-month {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.2rem;
  height: 100%;
  color: #9fb4cc;
  font-size: 0.62rem;
}
.stats-geo-month span:first-child {
  display: block;
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#2ee6ff, #3d7eff);
}
.stats-geo-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0;
}
.stats-geo-dock button.is-active,
.stats-geo-year-switch button.is-active {
  background: #1a56a8;
  color: #f4fbff;
  border-color: transparent;
}
.stats-geo-years {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.stats-geo-year,
.stats-geo-cat,
.stats-geo-responders,
#stats-geo-pane-hours,
#stats-geo-pane-categories,
#stats-geo-pane-years,
#stats-geo-pane-responders {
  background: #101826;
  border: 1px solid rgba(120, 186, 255, 0.24);
  border-radius: 18px;
  padding: 0.85rem;
  color: #e8f1fb;
}
.stats-geo-year-track {
  height: 120px;
  display: flex;
  align-items: flex-end;
  margin-top: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  overflow: hidden;
}
.stats-geo-year-track span {
  display: block;
  width: 100%;
  height: 0;
  background: linear-gradient(#ff4d8d, #ffb020 40%, #2ee6ff);
  transition: height 0.7s ease;
}
.stats-geo-year-track span.is-in {
  height: var(--h, 0%);
}
.stats-geo-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.7rem;
}
.stats-geo-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}
.stats-geo-cat.is-active {
  border-color: #2ee6ff;
}
.stats-geo-ring {
  --pct: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#2ee6ff calc(var(--pct) * 1%), rgba(255, 255, 255, 0.08) 0);
  animation: stats-geo-ring 0.8s ease both;
  animation-delay: var(--delay, 0ms);
}
.stats-geo-ring strong {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #101826;
  color: #f4fbff;
}
@keyframes stats-geo-ring {
  from { transform: scale(0.86); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.stats-geo-credit,
.stats-geo-unmatched {
  margin: 0.45rem 0 0;
}
.stats-geo-unmatched-title {
  margin: 0.4rem 0;
  color: #d5e8ff;
  font-size: 0.75rem;
}
.stats-geo-unmatched-item {
  margin: 0 0.35rem 0.35rem 0;
}
#stats-hours-home {
  min-height: 280px;
}
#stats-mosaic[hidden] {
  display: none !important;
}
@media (max-width: 767px) {
  .stats-geo-stage {
    height: 68dvh;
    min-height: 360px;
    border-radius: 16px;
  }
  .stats-geo-sheet {
    top: auto;
    right: 0.45rem;
    left: 0.45rem;
    bottom: 0.45rem;
    width: auto;
    max-height: 48%;
  }
  .stats-geo-years {
    grid-template-columns: 1fr;
  }
  .stats-geo-meters strong {
    font-size: 1.15rem;
  }
  .stats-geo-label {
    font-size: 13px;
  }
}

html[data-theme="light"] #panel-stats #stats-geo :is(#stats-geo-sheet, #stats-geo-pane-map, #stats-geo-pane-categories, #stats-geo-pane-years, #stats-geo-responders-summary, .stats-geo-dock) :is(h1, h2, h3, p, li, td, th, strong, span, button, label, .stats-geo-note, .stats-geo-kicker, .stats-geo-unit, .stats-geo-figure, .stats-geo-block-title, .stats-geo-status, .stats-geo-month, .muted),
html[data-theme="dark"] #panel-stats #stats-geo :is(#stats-geo-sheet, #stats-geo-pane-map, #stats-geo-pane-categories, #stats-geo-pane-years, #stats-geo-responders-summary, .stats-geo-dock) :is(h1, h2, h3, p, li, td, th, strong, span, button, label, .stats-geo-note, .stats-geo-kicker, .stats-geo-unit, .stats-geo-figure, .stats-geo-block-title, .stats-geo-status, .stats-geo-month, .muted) {
  color: #f4fbff !important;
}

#stats-geo #stats-members-card {
  max-height: none;
  overflow: visible;
}

#stats-geo-pane-hours .stats-hours-frame,
#stats-geo-pane-hours #stats-hours-home {
  height: auto;
  min-height: 0;
  overflow: visible;
  pointer-events: auto;
}

#stats-geo-pane-hours #hours-by-month {
  transform: none;
  width: 100%;
  height: auto;
  max-height: none;
}

.pub-map {
  margin: 1.15rem 0 0.4rem;
}

.pub-map .stats-geo-stage {
  height: min(62vh, 560px);
  min-height: 320px;
}

.pub-map .stats-geo :is(h1, h2, h3, p, li, span, button, strong, label) {
  color: #f4fbff;
}

@media (min-width: 768px) {
  #panel-stats .stats-geo,
  #panel-stats .stats-geo-stage {
    width: 100%;
    max-width: none;
  }

  #panel-stats .stats-geo-stage {
    height: calc(100dvh - 8.5rem);
    min-height: 640px;
  }
}

@media (min-width: 1100px) {
  #stats-main-view > #stats-geo {
    grid-column: 1 / -1;
  }
}

#stats-share-studio .stats-studio-card {
  max-height: min(92dvh, 980px);
  overflow: auto;
}

#stats-share-studio .stats-studio-preview {
  overflow: auto;
  flex: 1;
  min-height: 220px;
}

#stats-share-studio .stats-studio-preview canvas {
  max-height: none;
  width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  .stats-geo.is-split .stats-geo-stage {
    height: 28dvh;
    min-height: 180px;
  }

  .stats-geo.is-split #stats-geo-extra {
    scroll-margin-top: 0.6rem;
  }
}
