:root {
  --bg-main: #f2eee8;
  --bg-panel: rgba(250, 248, 244, 0.88);
  --ink-strong: #1d2938;
  --ink-soft: #4e5f73;
  --accent: #0f766e;
  --accent-soft: #8fd3ca;
  --warning: #d97706;
  --danger: #b91c1c;
  --ok: #166534;
  --stroke: rgba(28, 47, 70, 0.12);
  --shadow: 0 24px 48px rgba(28, 47, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 1.2rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: linear-gradient(130deg, #efe8dc 0%, #f5f3ee 45%, #ecf3f2 100%);
  color: var(--ink-strong);
  position: relative;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
}

.backdrop-a {
  background: #99dbc8;
  top: -8rem;
  right: -8rem;
}

.backdrop-b {
  background: #f7c79f;
  bottom: -10rem;
  left: -10rem;
}

.card {
  border: 1px solid var(--stroke);
  border-radius: 1rem;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.2rem;
}

.eyebrow {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

h1 {
  margin: 0.2rem 0;
  font-size: clamp(1.6rem, 2.3vw, 2.1rem);
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  max-width: 50ch;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.display-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.24rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 35, 52, 0.2);
  background: rgba(255, 255, 255, 0.78);
}

.mode-switch-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.42rem 0.66rem;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.mode-switch-btn:hover {
  background: rgba(15, 118, 110, 0.14);
  color: #0f605a;
}

.mode-switch-btn.is-active {
  background: linear-gradient(120deg, #0f766e 0%, #1d9b92 100%);
  color: #ffffff;
}

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.chip {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(15, 118, 110, 0.12);
  border: 1px solid rgba(15, 118, 110, 0.22);
  color: #0f4d48;
}

.primary-btn {
  border: none;
  border-radius: 0.65rem;
  padding: 0.55rem 0.95rem;
  background: linear-gradient(110deg, #13766f 0%, #1f9f96 100%);
  color: #fff;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}

.primary-btn:active {
  transform: translateY(0);
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.search-input {
  width: min(25rem, 46vw);
  min-width: 14rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(28, 47, 70, 0.22);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-strong);
  font-family: inherit;
  font-size: 0.92rem;
}

.search-input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.search-submit-btn {
  padding-inline: 0.75rem;
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border-radius: 0.68rem;
  border: 1px solid rgba(28, 47, 70, 0.2);
  background: rgba(249, 247, 242, 0.96);
  box-shadow: 0 14px 28px rgba(20, 35, 55, 0.2);
  display: grid;
  gap: 0.25rem;
  z-index: 700;
  max-height: 18rem;
  overflow: auto;
}

.search-results[hidden] {
  display: none !important;
}

.search-results:empty {
  display: none !important;
}

.search-result-empty {
  padding: 0.5rem 0.6rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.search-result-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.84);
  padding: 0.46rem 0.52rem;
  text-align: left;
  color: var(--ink-strong);
  font-family: inherit;
  cursor: pointer;
}

.search-result-button:hover,
.search-result-button.is-active {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(143, 211, 202, 0.26);
}

.search-result-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
}

.search-result-meta {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.layout {
  margin-top: 1rem;
  display: block;
}

.map-wrap {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.map-stage {
  position: relative;
}

#map {
  width: 100%;
  height: clamp(24rem, 70vh, 52rem);
  border-radius: 0.8rem;
  border: 1px solid var(--stroke);
}

.layers-menu-toggle {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 560;
  border: 1px solid rgba(22, 35, 52, 0.24);
  border-radius: 0.62rem;
  padding: 0.42rem 0.72rem;
  background: rgba(250, 248, 244, 0.88);
  color: var(--ink-strong);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 35, 55, 0.14);
  backdrop-filter: blur(6px);
}

.map-locate-btn {
  border: 1px solid rgba(22, 35, 52, 0.28);
  border-radius: 999px;
  background: rgba(250, 248, 244, 0.94);
  color: #13324a;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(20, 35, 55, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.map-locate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(20, 35, 55, 0.24);
}

.map-locate-btn:disabled {
  cursor: default;
  opacity: 0.72;
  transform: none;
}

.layers-menu {
  position: absolute;
  top: 3.2rem;
  right: 0.8rem;
  z-index: 560;
  width: min(24rem, calc(100% - 1.6rem));
  max-height: calc(100% - 4rem);
  overflow: auto;
  padding: 0.72rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(28, 47, 70, 0.2);
  background: rgba(249, 247, 242, 0.9);
  box-shadow: 0 16px 32px rgba(20, 35, 55, 0.16);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.layers-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.map-hint {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

h2 {
  margin: 0;
  font-size: 1.1rem;
}

.helper-text {
  margin: 0.38rem 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.mode-state {
  margin-top: -0.1rem;
  margin-bottom: 0.52rem;
  padding: 0.38rem 0.5rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(22, 95, 42, 0.25);
  background: rgba(22, 95, 42, 0.1);
  color: #1f5b35;
}

.dataset-meta {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.66rem;
  border-radius: 0.65rem;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 0.4rem;
}

.dataset-meta-title {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dataset-meta-content {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.dataset-meta-line {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.dataset-meta-line strong {
  color: var(--ink-strong);
  font-weight: 700;
}

.dataset-meta-sources {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.36rem;
}

.dataset-meta-source {
  padding: 0.4rem 0.5rem;
  border-radius: 0.56rem;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.75);
}

.dataset-meta-source-name {
  margin: 0 0 0.22rem;
  font-size: 0.82rem;
  color: var(--ink-strong);
}

.layers-list,
.legend-list,
.zones-list {
  display: grid;
  gap: 0.45rem;
}

.layers-list.is-disabled {
  opacity: 0.58;
}

.layers-list.is-disabled .layer-item {
  pointer-events: none;
}

.layer-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 0.65rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.6);
}

.layer-item input {
  accent-color: var(--accent);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.legend-item.is-disabled {
  opacity: 0.66;
}

.legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 0.2rem;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.summary {
  border-radius: 0.72rem;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
  border: 1px solid transparent;
}

.summary-neutral {
  background: rgba(117, 137, 158, 0.12);
  border-color: rgba(117, 137, 158, 0.22);
  color: #35506c;
}

.summary-allowed {
  background: rgba(22, 101, 52, 0.12);
  border-color: rgba(22, 101, 52, 0.25);
  color: var(--ok);
}

.summary-limited {
  background: rgba(217, 119, 6, 0.13);
  border-color: rgba(217, 119, 6, 0.24);
  color: var(--warning);
}

.summary-forbidden {
  background: rgba(185, 28, 28, 0.13);
  border-color: rgba(185, 28, 28, 0.24);
  color: var(--danger);
}

.zones-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.zone-item {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.62);
  border-radius: 0.7rem;
  padding: 0.55rem 0.65rem;
}

.zone-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.zone-name {
  font-weight: 700;
}

.zone-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.zone-body {
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 0.85rem;
  box-shadow: 0 16px 30px rgba(20, 35, 55, 0.22);
}

.leaflet-popup-content {
  margin: 0.72rem 0.78rem;
}

.point-popup-shell .leaflet-popup-content-wrapper {
  max-width: min(26rem, calc(100vw - 1.4rem));
}

.point-popup {
  min-width: 16rem;
  max-width: 22rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.point-popup-header {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.point-popup-target {
  margin: 0 0 0.44rem;
  font-size: 0.81rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.point-popup-summary {
  margin: 0 0 0.48rem;
  padding: 0.34rem 0.52rem;
  border-radius: 0.66rem;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 0.86rem;
}

.point-popup-summary.summary-allowed {
  background: rgba(22, 101, 52, 0.12);
  border-color: rgba(22, 101, 52, 0.25);
  color: var(--ok);
}

.point-popup-summary.summary-limited {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.24);
  color: var(--warning);
}

.point-popup-summary.summary-forbidden {
  background: rgba(185, 28, 28, 0.14);
  border-color: rgba(185, 28, 28, 0.24);
  color: var(--danger);
}

.point-popup-summary.summary-neutral {
  background: rgba(117, 137, 158, 0.12);
  border-color: rgba(117, 137, 158, 0.22);
  color: #35506c;
}

.point-popup-summary-sources {
  margin: -0.1rem 0 0.42rem;
  font-size: 0.74rem;
  color: #617083;
}

.point-popup-metrics {
  margin: 0 0 0.48rem;
  padding: 0.46rem 0.52rem;
  border: 1px solid var(--stroke);
  border-radius: 0.64rem;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 0.26rem;
}

.point-popup-metric {
  margin: 0;
  font-size: 0.78rem;
  color: #56677b;
}

.point-popup-metric strong {
  color: var(--ink-strong);
}

.point-popup-debug {
  margin: 0 0 0.48rem;
  padding: 0.42rem 0.5rem;
  border: 1px dashed rgba(93, 108, 124, 0.38);
  border-radius: 0.62rem;
  background: rgba(236, 241, 245, 0.7);
}

.point-popup-debug-title {
  margin: 0 0 0.32rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #536378;
  font-weight: 700;
}

.point-popup-debug-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.22rem;
}

.point-popup-debug-line {
  margin: 0;
  font-size: 0.74rem;
  color: #4f6277;
}

.point-popup-zones {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 14rem;
  overflow: auto;
  display: grid;
  gap: 0.42rem;
}

.point-popup-layer {
  border: 1px solid var(--stroke);
  border-radius: 0.62rem;
  background: rgba(255, 255, 255, 0.68);
  padding: 0.45rem 0.52rem;
}

.point-popup-layer-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.82rem;
}

.point-popup-layer-status {
  margin: 0.18rem 0 0.35rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.point-popup-layer-zones {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.point-popup-zone {
  padding: 0.45rem 0.52rem;
  border-radius: 0.6rem;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.72);
}

.point-popup-zone-title {
  margin: 0;
  font-size: 1rem;
}

.point-popup-zone-meta {
  margin: 0.28rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.point-popup-zone-field {
  line-height: 1.45;
}

.point-popup-zone-field strong {
  color: #2a3d52;
}

.point-popup-zone-section-title {
  margin: 0.42rem 0 0.12rem;
  font-size: 0.78rem;
  font-weight: 760;
  color: #22374e;
}

.point-popup-zone-footnote {
  margin: 0.22rem 0 0;
  color: #617083;
  font-size: 0.73rem;
}

.footer-note {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.3rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.footer-note a,
.legal-section a {
  color: #0f6b63;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed rgba(15, 107, 99, 0.45);
}

.footer-note a:hover,
.legal-section a:hover {
  border-bottom-style: solid;
}

.legal-section {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.7rem;
}

.legal-card {
  border: 1px solid var(--stroke);
  border-radius: 0.72rem;
  padding: 0.72rem;
  background: rgba(255, 255, 255, 0.62);
}

.legal-card h3 {
  margin: 0.22rem 0 0.3rem;
  font-size: 1rem;
}

.legal-code {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.legal-meta {
  margin: 0.24rem 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.legal-list {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.44rem;
}

.legal-list li {
  color: var(--ink-strong);
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
}

.animate-up {
  opacity: 0;
  transform: translateY(12px);
  animation: fade-up 380ms ease forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .map-wrap {
    min-height: auto;
  }

  #map {
    height: 58vh;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .search-input {
    width: min(100%, 26rem);
  }
}

@media (max-width: 680px) {
  body {
    padding: 0.7rem;
  }

  #map {
    height: 52vh;
  }

  .footer-note {
    padding-left: 0.1rem;
  }

  .search-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .search-input {
    width: 100%;
    min-width: 0;
  }

  .search-results {
    grid-column: 1 / -1;
  }
}

/* Home map-first layout */
body.home-map {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #d9e1d7;
  overflow: hidden;
  --home-topbar-height: 58px;
  --home-footer-height: 42px;
}

.home-map .backdrop {
  display: none;
}

.home-map .layout {
  margin: 0;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.home-map .map-wrap {
  height: 100%;
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.home-map .map-stage {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
}

.home-map #map {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.home-map .topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.7rem);
  left: 0.8rem;
  width: min(26rem, calc(100vw - 1.6rem));
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 1.4rem);
  z-index: 760;
  overflow: hidden;
  border-radius: 0.82rem;
  background: rgba(247, 245, 240, 0.88);
  box-shadow: 0 16px 30px rgba(13, 26, 44, 0.2);
  display: grid;
  gap: 0;
  padding: 0;
}

.home-map .topbar.is-collapsed {
  width: fit-content;
  max-width: calc(100vw - 1.6rem);
}

.home-map .topbar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  padding: 0.45rem;
  background: rgba(20, 30, 42, 0.92);
}

.menu-toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf5;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.48rem 0.62rem;
  cursor: pointer;
}

.menu-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.home-map .search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
  min-width: 0;
  background: transparent;
}

.home-map .search-input {
  width: 100%;
  min-width: 0;
  border-radius: 0.45rem;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #f4f8fb;
  font-size: 0.86rem;
}

.home-map .search-input::placeholder {
  color: rgba(237, 245, 252, 0.72);
}

.home-map .search-input:focus {
  border-color: rgba(143, 211, 202, 0.8);
  box-shadow: 0 0 0 3px rgba(143, 211, 202, 0.25);
}

.home-map .search-submit-btn {
  padding: 0.5rem 0.64rem;
  border-radius: 0.45rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.home-map .search-results {
  z-index: 780;
}

.home-map .topbar.is-collapsed .search-submit-btn {
  display: none;
}

.home-map .topbar.is-collapsed .search-form {
  width: auto;
  flex: 0 1 auto;
}

.home-map .topbar.is-collapsed .search-input {
  width: min(10rem, 38vw);
}

.home-map .topbar.is-collapsed .search-input:focus {
  width: min(19rem, 70vw);
}

.home-map .topbar-content {
  padding: 0.72rem 0.78rem 0.8rem;
  overflow: auto;
  display: grid;
  gap: 0.62rem;
}

.home-map .topbar.is-collapsed .topbar-content {
  display: none;
}

.home-map h1 {
  margin: 0.08rem 0;
  font-size: clamp(1.14rem, 1.6vw, 1.45rem);
}

.home-map .subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.home-map .topbar-actions {
  min-width: 0;
  gap: 0.48rem;
  align-items: center;
  justify-content: flex-start;
}

.home-map .chip {
  width: 100%;
  white-space: normal;
  padding: 0.34rem 0.58rem;
  line-height: 1.22;
  font-size: 0.76rem;
  background: rgba(15, 118, 110, 0.14);
}

.home-map .display-mode-switch {
  width: 100%;
  justify-content: stretch;
}

.home-map .mode-switch-btn {
  flex: 1 1 0;
  text-align: center;
}

.home-map .layers-control {
  position: relative;
  width: 100%;
}

.home-map .layers-menu-toggle {
  position: static;
  width: 100%;
  box-shadow: none;
  border-radius: 0.65rem;
  padding: 0.48rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
}

.home-map .layers-menu {
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  width: auto;
  max-height: min(58vh, 30rem);
  z-index: 770;
}

.home-map .map-locate-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 5.9rem);
  right: 0.8rem;
  z-index: 690;
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.home-map .map-hint {
  display: none;
}

.home-map .footer-note {
  position: fixed;
  right: 0.8rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.65rem);
  left: auto;
  z-index: 730;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  justify-items: end;
  gap: 0.42rem;
}

.footer-info-toggle {
  border: 1px solid rgba(19, 35, 58, 0.2);
  border-radius: 999px;
  background: rgba(248, 247, 243, 0.9);
  color: #16384d;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.66rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(13, 26, 44, 0.16);
}

.footer-info-panel {
  width: min(28rem, 72vw);
  border: 1px solid rgba(19, 35, 58, 0.2);
  border-radius: 0.72rem;
  background: rgba(248, 247, 243, 0.86);
  box-shadow: 0 12px 24px rgba(13, 26, 44, 0.16);
  backdrop-filter: blur(6px);
  font-size: 0.72rem;
  padding: 0.46rem 0.58rem;
  display: grid;
  gap: 0.4rem;
}

.footer-info-panel[hidden] {
  display: none !important;
}

.home-map .footer-note code {
  display: inline-block;
  max-width: min(22rem, 56vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.home-map .leaflet-top.leaflet-left,
.home-map .leaflet-top.leaflet-right {
  margin-top: calc(env(safe-area-inset-top, 0px) + 0.7rem);
}

.home-map .leaflet-top.leaflet-left {
  margin-left: 0.8rem;
}

.home-map .leaflet-top.leaflet-right {
  margin-right: 0.8rem;
}

.home-map .leaflet-bottom.leaflet-left,
.home-map .leaflet-bottom.leaflet-right {
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.65rem);
}

.home-map .leaflet-bottom.leaflet-left {
  margin-left: 0.8rem;
}

.home-map .leaflet-bottom.leaflet-right {
  margin-right: 0.8rem;
}

.home-map .leaflet-control-zoom {
  border-radius: 0.65rem;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(16, 30, 47, 0.2);
}

.home-map .basemap-control {
  margin-bottom: 0.48rem;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.home-map .basemap-options {
  display: flex;
  gap: 0.34rem;
}

.home-map .basemap-options.is-collapsed {
  gap: 0;
}

.home-map .basemap-theme-toggle {
  margin-top: 0.34rem;
  display: flex;
  gap: 0.34rem;
}

.home-map .basemap-theme-toggle.is-hidden {
  display: none;
}

.home-map .basemap-theme-btn {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(13, 26, 44, 0.62);
  color: #e8edf4;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.22rem 0.52rem;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.home-map .basemap-theme-btn:hover {
  background: rgba(13, 26, 44, 0.78);
}

.home-map .basemap-theme-btn.is-active {
  background: rgba(31, 159, 150, 0.92);
  border-color: rgba(255, 255, 255, 0.85);
  color: #ffffff;
}

.home-map .basemap-theme-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.home-map .basemap-option {
  position: relative;
  width: 4.95rem;
  height: 4.95rem;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 0.2rem;
  padding: 0.35rem;
  color: #f7fafc;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 18px rgba(13, 26, 44, 0.2);
  overflow: hidden;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.home-map .basemap-option::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    170deg,
    rgba(15, 23, 40, 0.14) 0%,
    rgba(15, 23, 40, 0.22) 36%,
    rgba(15, 23, 40, 0.48) 100%
  );
}

.home-map .basemap-option span {
  position: absolute;
  left: 0.35rem;
  bottom: 0.28rem;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(9, 16, 26, 0.85);
}

.home-map .basemap-option:hover {
  transform: translateY(-1px);
}

.home-map .basemap-option.is-hidden {
  display: none;
}

.home-map .basemap-option.is-active {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(31, 159, 150, 0.92),
    0 8px 18px rgba(13, 26, 44, 0.24);
}

.home-map .basemap-control[data-default-theme="dark"] .basemap-option--default {
  background-image: url("icons/basemap-default-dark.svg");
}

.home-map .basemap-control[data-default-theme="light"] .basemap-option--default {
  background-image: url("icons/basemap-default-light.svg");
}

.home-map .basemap-option--aerial {
  background-image: url("icons/basemap-aerial.svg");
}

@media (max-width: 1080px) {
  .home-map .topbar {
    left: 0.65rem;
    width: min(24rem, calc(100vw - 1.3rem));
    top: calc(env(safe-area-inset-top, 0px) + 0.62rem);
  }

  .home-map .topbar.is-collapsed {
    max-width: calc(100vw - 1.3rem);
  }

  .home-map .map-locate-btn {
    right: 0.65rem;
  }

  .home-map .footer-note {
    right: 0.65rem;
  }

  .home-map .leaflet-top.leaflet-left {
    margin-left: 0.65rem;
  }

  .home-map .leaflet-top.leaflet-right {
    margin-right: 0.65rem;
  }

  .home-map .leaflet-bottom.leaflet-left {
    margin-left: 0.65rem;
  }

  .home-map .leaflet-bottom.leaflet-right {
    margin-right: 0.65rem;
  }

  .home-map .basemap-option {
    width: 4.35rem;
    height: 4.35rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 680px) {
  .home-map .topbar {
    left: 0.45rem;
    width: min(22rem, calc(100vw - 0.9rem));
    top: calc(env(safe-area-inset-top, 0px) + 0.45rem);
  }

  .home-map .topbar.is-collapsed {
    max-width: calc(100vw - 0.9rem);
  }

  .home-map .topbar-toolbar {
    grid-template-columns: auto 1fr;
    padding: 0.36rem;
  }

  .home-map .topbar.is-collapsed .search-input {
    width: min(8.5rem, 50vw);
  }

  .home-map .topbar.is-collapsed .search-input:focus {
    width: min(16rem, 68vw);
  }

  .home-map .topbar-content {
    padding: 0.6rem 0.62rem 0.66rem;
  }

  .home-map .chip {
    font-size: 0.74rem;
  }

  .home-map .mode-switch-btn {
    font-size: 0.75rem;
  }

  .home-map .layers-menu {
    position: fixed;
    left: 0.45rem;
    right: 0.45rem;
    top: calc(env(safe-area-inset-top, 0px) + 3.8rem);
    width: auto;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8.5rem);
  }

  .home-map .map-locate-btn {
    right: 0.45rem;
    top: calc(env(safe-area-inset-top, 0px) + 5.55rem);
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.2rem;
  }

  .home-map .footer-note {
    right: 0.45rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.45rem);
  }

  .footer-info-panel {
    width: min(21rem, calc(100vw - 0.9rem));
    font-size: 0.68rem;
  }

  .home-map .leaflet-top.leaflet-left {
    margin-left: 0.45rem;
  }

  .home-map .leaflet-top.leaflet-right {
    margin-right: 0.45rem;
  }

  .home-map .leaflet-bottom.leaflet-left {
    margin-left: 0.45rem;
  }

  .home-map .leaflet-bottom.leaflet-right {
    margin-right: 0.45rem;
  }

  .home-map .basemap-options {
    gap: 0.28rem;
  }

  .home-map .basemap-theme-toggle {
    gap: 0.28rem;
  }

  .home-map .basemap-option {
    width: 3.72rem;
    height: 3.72rem;
    padding: 0.28rem;
    font-size: 0.68rem;
  }

  .home-map .basemap-theme-btn {
    font-size: 0.68rem;
    padding: 0.2rem 0.45rem;
  }

  .point-popup-shell .leaflet-popup-content {
    margin: 0.55rem 0.58rem;
  }

  .point-popup {
    min-width: 0;
    max-width: min(86vw, 21rem);
  }

  .point-popup-target {
    letter-spacing: 0.01em;
    font-size: 0.76rem;
  }

  .point-popup-summary {
    font-size: 0.8rem;
  }

  .point-popup-layer-title {
    font-size: 0.78rem;
  }

  .point-popup-zone-title {
    font-size: 0.94rem;
  }

  .point-popup-zone-meta,
  .point-popup-zone-footnote {
    font-size: 0.74rem;
  }

  .point-popup-metric {
    font-size: 0.73rem;
  }

  .point-popup-debug-line {
    font-size: 0.71rem;
  }

  .point-popup-zones {
    max-height: min(33vh, 11rem);
    gap: 0.35rem;
  }
}
