:root {
  --ink: #14211d;
  --muted: #5d6b64;
  --faint: #eef3ef;
  --paper: #fbfcf8;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --sea: #1f6f85;
  --deep-sea: #16425b;
  --pine: #1e6558;
  --safety: #ea6c45;
  --sun: #f2bb5f;
  --border: rgba(20, 33, 29, 0.12);
  --shadow: 0 20px 60px rgba(19, 35, 30, 0.18);
  --tight-shadow: 0 10px 30px rgba(19, 35, 30, 0.12);
  --mobile-map-control-bottom: max(88px, calc(24px + env(safe-area-inset-bottom)));
  --mobile-attribution-left: 74px;
  --mobile-attribution-right: 124px;
  --mobile-attribution-bottom: calc(var(--mobile-map-control-bottom) + 12px);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  color: var(--ink);
  background: #dbe8e4;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell,
.map-stage {
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
}

.map-stage {
  position: relative;
  overflow: hidden;
  background: #dce8e4;
}

.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.leaflet-container {
  width: 100%;
  height: 100%;
}

.leaflet-bottom.leaflet-left {
  bottom: var(--mobile-map-control-bottom) !important;
}

.leaflet-bottom.leaflet-right {
  right: var(--mobile-attribution-right) !important;
  bottom: var(--mobile-attribution-bottom) !important;
  left: var(--mobile-attribution-left) !important;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: var(--tight-shadow) !important;
}

.leaflet-control-zoom a {
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

.leaflet-control-attribution {
  max-width: 100%;
  margin: 0 !important;
  border-radius: 10px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  pointer-events: auto;
}

.topbar {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 12px;
  right: auto;
  z-index: 500;
  display: grid;
  max-width: calc(100% - 84px);
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--tight-shadow);
  backdrop-filter: blur(18px);
}

.topbar.is-search-open {
  right: 70px;
  max-width: none;
  grid-template-columns: 1fr;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(19, 35, 30, 0.18));
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  line-height: 1.05;
  font-size: 15px;
  font-weight: 850;
}

.brand div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

.search-control {
  display: flex;
  width: 42px;
  height: 42px;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f6faf7;
  color: var(--muted);
  transition: width 180ms ease, padding 180ms ease;
}

.topbar.is-search-open .search-control {
  grid-column: 1;
  width: 100%;
  padding-right: 12px;
}

.search-toggle {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
}

.search-toggle span {
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
}

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.topbar.is-search-open .search-control input {
  opacity: 1;
  pointer-events: auto;
}

.search-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #527066;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, background-color 160ms ease;
}

.search-close:hover,
.search-close:focus-visible {
  background: rgba(31, 111, 133, 0.1);
}

.topbar.is-search-open .search-close {
  opacity: 1;
  pointer-events: auto;
}

.search-control input::placeholder {
  color: #7b8880;
  font-weight: 560;
}

.layer-toggle {
  position: absolute;
  right: 10px;
  bottom: var(--mobile-map-control-bottom);
  z-index: 500;
  display: flex;
  gap: 6px;
  min-height: 38px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--tight-shadow);
  backdrop-filter: blur(18px);
}

.layer-toggle legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.layer-toggle label {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  min-width: 0;
  place-items: center;
  border-radius: 12px;
}

.layer-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 1;
  cursor: pointer;
  opacity: 0;
}

.layer-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgba(20, 33, 29, 0.1), 0 4px 10px rgba(19, 35, 30, 0.12);
}

.standard-layer-icon {
  --map-grid: rgba(79, 116, 105, 0.22);
  background:
    linear-gradient(90deg, transparent 0 31%, var(--map-grid) 32% 34%, transparent 35% 66%, var(--map-grid) 67% 69%, transparent 70%),
    linear-gradient(0deg, transparent 0 28%, rgba(255, 255, 255, 0.68) 29% 33%, transparent 34% 64%, var(--map-grid) 65% 67%, transparent 68%),
    radial-gradient(ellipse at 16% 82%, #9fcdd8 0 30%, transparent 31%),
    radial-gradient(ellipse at 82% 18%, #edf4dc 0 34%, transparent 35%),
    linear-gradient(90deg, #dcead1 0 50%, #c8e0bd 51% 100%);
}

.satellite-layer-icon {
  background:
    radial-gradient(circle at 68% 26%, rgba(246, 238, 176, 0.72) 0 11%, transparent 12%),
    radial-gradient(circle at 25% 74%, rgba(38, 95, 72, 0.95) 0 20%, transparent 21%),
    linear-gradient(140deg, #254f3e 0 34%, #5f7654 35% 55%, #1c5965 56% 74%, #8a7b55 75%);
}

.layer-toggle input:checked + .layer-icon {
  border-color: #ffffff;
  box-shadow:
    0 0 0 3px rgba(18, 113, 126, 0.82),
    0 8px 18px rgba(19, 35, 30, 0.2);
}

.layer-toggle input:focus-visible + .layer-icon {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

.tool-actions {
  display: flex;
  gap: 8px;
}

.app-menu-control {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 12px;
  z-index: 650;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(21, 36, 31, 0.08);
}

.icon-button.ghost {
  background: #f5f7f4;
  box-shadow: none;
}

.menu-toggle {
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.menu-toggle span {
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  top: -6px;
}

.menu-toggle span::after {
  top: 6px;
}

.app-menu {
  position: absolute;
  top: 52px;
  right: 0;
  display: grid;
  min-width: 224px;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--tight-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
  visibility: hidden;
  backdrop-filter: blur(20px);
}

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

.app-menu a,
.app-menu button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
  text-align: left;
  text-decoration: none;
}

.app-menu a:hover,
.app-menu a:focus-visible,
.app-menu button:hover,
.app-menu button:focus-visible {
  background: rgba(31, 111, 133, 0.1);
  outline: none;
}

.filter-icon,
.rules-icon {
  position: relative;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.filter-icon::before,
.filter-icon::after {
  position: absolute;
  left: 1px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.filter-icon::before {
  top: 4px;
  box-shadow: 0 8px 0 currentColor;
}

.filter-icon::after {
  top: 3px;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: #fff;
  transform: translateX(8px);
}

.rules-icon::before {
  position: absolute;
  inset: 1px 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
  content: "";
}

.rules-icon::after {
  position: absolute;
  top: 6px;
  left: 7px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
  content: "";
}

.spot-marker {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  background: var(--pin-color);
  box-shadow: 0 8px 18px rgba(14, 30, 26, 0.28);
  transform: rotate(-45deg);
}

.spot-marker::after {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.spot-marker.is-selected {
  width: 38px;
  height: 38px;
  box-shadow: 0 0 0 8px rgba(234, 108, 69, 0.18), 0 12px 25px rgba(14, 30, 26, 0.32);
}

.spot-sheet,
.filter-panel,
.rules-panel {
  position: fixed;
  z-index: 600;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.spot-sheet {
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 10px;
  max-height: min(72dvh, 580px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 24px;
  transform: translateY(calc(100% + 24px));
  transition: transform 220ms ease;
}

.spot-sheet.is-open {
  transform: translateY(0);
}

.spot-sheet.is-expanded {
  transform: translateY(0);
}

.sheet-handle {
  display: block;
  width: 68px;
  height: 22px;
  margin: 4px auto 0;
  border: 0;
  background: transparent;
}

.sheet-handle::before {
  display: block;
  width: 44px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: rgba(20, 33, 29, 0.22);
  content: "";
}

.sheet-empty,
.sheet-body {
  padding: 0 18px 18px;
}

.sheet-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sheet-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-title-row h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.06;
  letter-spacing: 0;
}

.headline {
  margin: 9px 0 14px;
  color: #35463f;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
}

.info-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f5f8f3;
  color: #31443b;
  font-size: 12px;
  font-weight: 750;
}

.info-chip.warning {
  border-color: rgba(234, 108, 69, 0.34);
  background: #fff1ea;
  color: #9b3e25;
}

.info-grid {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.info-block {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.info-block h3 {
  margin: 0 0 5px;
  color: #26362f;
  font-size: 12px;
  font-weight: 850;
}

.info-block p {
  margin: 0;
  color: #4d5e56;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.35;
}

.filter-panel,
.rules-panel {
  top: max(14px, env(safe-area-inset-top));
  right: 10px;
  left: 10px;
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 16px;
  border-radius: 24px;
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.filter-panel.is-open,
.rules-panel.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header p {
  margin: 0 0 2px;
  color: var(--safety);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-header h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.1;
}

.filter-group {
  margin-bottom: 18px;
}

.filter-group h3 {
  margin: 0 0 10px;
  color: #33443d;
  font-size: 13px;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  position: relative;
}

.filter-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-chip span {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #394a43;
  font-size: 13px;
  font-weight: 760;
}

.filter-chip input:checked + span {
  border-color: rgba(31, 111, 133, 0.55);
  background: #e6f2f2;
  color: #125267;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: #2f4139;
  font-weight: 800;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--pine);
}

.text-button {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 15px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
}

.rules-list {
  display: grid;
  gap: 10px;
}

.rule-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.rule-item h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.rule-item p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.rule-item a {
  color: var(--sea);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.cookie-banner {
  position: fixed;
  right: 10px;
  bottom: calc(var(--mobile-map-control-bottom) + 58px);
  left: 10px;
  z-index: 750;
  display: grid;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  visibility: hidden;
  backdrop-filter: blur(22px);
}

.cookie-banner.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.cookie-copy h2 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.15;
}

.cookie-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.4;
}

.cookie-copy a {
  color: var(--sea);
  font-weight: 850;
}

.cookie-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cookie-actions .text-button {
  min-height: 42px;
  margin-top: 0;
}

.text-button.light {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}

body.legal-page {
  height: auto;
  min-height: 100%;
  background: linear-gradient(180deg, #e6f0ee 0%, #fbfcf8 42%, #eef3ef 100%);
}

.legal-main {
  width: min(860px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.legal-back {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--deep-sea);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.legal-card {
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--tight-shadow);
}

.legal-kicker {
  margin: 0 0 10px;
  color: var(--safety);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.legal-card h1 {
  margin: 0 0 22px;
  font-size: clamp(32px, 8vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.legal-card section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.legal-card section + section {
  margin-top: 20px;
}

.legal-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.2;
}

.legal-card p {
  margin: 0;
  color: #394a43;
  font-size: 15px;
  line-height: 1.6;
}

.legal-card p + p {
  margin-top: 12px;
}

.legal-card a {
  color: var(--sea);
  font-weight: 850;
}

.legal-card code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #eef3ef;
  font-size: 0.92em;
}

@media (min-width: 720px) {
  .topbar {
    grid-template-columns: auto auto;
    right: auto;
    width: auto;
  }

  .topbar.is-search-open {
    grid-template-columns: minmax(180px, 240px) minmax(280px, 1fr);
    width: min(620px, calc(100% - 100px));
  }

  .search-control {
    grid-column: auto;
  }

  .topbar.is-search-open .search-control {
    grid-column: auto;
  }

  .spot-sheet {
    top: auto;
    right: auto;
    bottom: 16px;
    left: 50%;
    width: min(560px, calc(100vw - 32px));
    max-height: min(58dvh, 560px);
    border-radius: 24px;
    transform: translate(-50%, calc(100% + 24px));
  }

  .spot-sheet.is-open,
  .spot-sheet.is-expanded {
    transform: translate(-50%, 0);
  }

  .sheet-handle {
    display: block;
  }

  .sheet-body,
  .sheet-empty {
    padding: 20px;
  }

  .filter-panel,
  .rules-panel {
    top: 92px;
    right: auto;
    left: 50%;
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100dvh - 108px);
    transform: translate(-50%, -16px);
  }

  .filter-panel.is-open,
  .rules-panel.is-open {
    transform: translate(-50%, 0);
  }

  .leaflet-bottom.leaflet-left {
    bottom: 0 !important;
    left: 0 !important;
  }

  .leaflet-bottom.leaflet-right {
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    display: block;
  }

  .leaflet-control-attribution {
    margin: 0 10px 0 0 !important;
    border-radius: 10px 0 0 0;
    text-align: right;
    white-space: nowrap;
  }

  .cookie-banner {
    right: 16px;
    bottom: 16px;
    left: 16px;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .cookie-actions {
    width: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
