:root {
  color-scheme: light;
  --ink: #17211b;
  --paper: #f5f0e4;
  --accent: #146b5c;
  --accent-dark: #0e4038;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--paper);
}

#map {
  position: relative;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

#map.dragging {
  cursor: grabbing;
}

#tile-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #d9e1d7;
}

.tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  image-rendering: auto;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-label,
.filter-panel,
.parks-panel,
.draw-panel,
.zoom-controls {
  position: absolute;
  z-index: 5;
  border: 1px solid rgba(23, 33, 27, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(23, 33, 27, 0.12);
  backdrop-filter: blur(10px);
}

.map-label {
  left: 16px;
  bottom: 16px;
  display: grid;
  gap: 3px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
}

.map-label strong {
  font-size: 14px;
  line-height: 1.2;
}

.map-label span {
  color: #55625b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.zoom-controls {
  top: 16px;
  right: 16px;
  display: grid;
  overflow: hidden;
}

.filter-panel {
  top: 16px;
  left: 16px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.parks-panel {
  top: 72px;
  right: 16px;
  display: grid;
  width: min(310px, calc(100vw - 32px));
  max-height: min(62vh, 560px);
  overflow: hidden;
  touch-action: auto;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(23, 33, 27, 0.12);
  padding: 10px 12px;
}

.panel-heading strong,
.draw-panel strong {
  font-size: 14px;
  line-height: 1.2;
}

.panel-heading span,
.draw-panel span {
  color: #55625b;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.park-search {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid rgba(23, 33, 27, 0.1);
  padding: 8px 12px 10px;
}

.park-search span {
  color: #55625b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.park-search input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(14, 64, 56, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}

.park-search input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(20, 107, 92, 0.16);
}

.park-list {
  display: grid;
  gap: 1px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 5px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.park-list label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  border-radius: 6px;
  padding: 6px 7px;
  font-size: 12px;
  cursor: pointer;
}

.park-list label:hover {
  background: rgba(20, 107, 92, 0.08);
}

.park-list input {
  width: 16px;
  height: 16px;
  accent-color: #8f1f1f;
}

.park-list .park-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.park-list label.is-hidden {
  opacity: 0.56;
}

.park-list-empty {
  color: #6a766f;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 750;
}

.draw-panel {
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  width: min(310px, calc(100vw - 32px));
  padding: 10px 12px;
}

.draw-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.draw-buttons button {
  min-height: 34px;
  border: 1px solid rgba(14, 64, 56, 0.22);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.draw-buttons button:hover,
.draw-buttons button.is-active {
  background: #e8f1ed;
}

.draw-buttons button.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.treasure-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(14, 64, 56, 0.18);
  border-radius: 7px;
  background: #146b5c;
  color: #fff;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.treasure-link:hover {
  background: #0e4038;
}

.filter-panel label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.filter-panel input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.filter-panel .switch-row {
  align-items: center;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #bac7c0;
  transition: background 140ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 33, 27, 0.24);
  content: "";
  transition: transform 140ms ease;
}

.switch-row input:checked + .switch-track {
  background: var(--accent);
}

.switch-row input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch-row input:focus-visible + .switch-track {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.filter-meta {
  color: #55625b;
  font-size: 12px;
  font-weight: 700;
}

.zoom-controls button {
  width: 42px;
  height: 40px;
  border: 0;
  border-bottom: 1px solid rgba(23, 33, 27, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  font: inherit;
  font-size: 24px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.zoom-controls button:last-child {
  border-bottom: 0;
}

.zoom-controls button:hover {
  background: #e8f1ed;
}

.feature-tooltip {
  position: absolute;
  z-index: 6;
  max-width: min(260px, calc(100vw - 24px));
  transform: translate(-50%, calc(-100% - 12px));
  border: 1px solid rgba(14, 64, 56, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 8px 10px;
  box-shadow: 0 12px 28px rgba(23, 33, 27, 0.18);
  pointer-events: none;
}

.feature-tooltip strong,
.feature-tooltip span {
  display: block;
}

.feature-tooltip strong {
  font-size: 13px;
  line-height: 1.2;
}

.feature-tooltip span {
  margin-top: 3px;
  color: #55625b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .map-label {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .zoom-controls {
    top: 10px;
    right: 10px;
  }

  .filter-panel {
    top: 10px;
    left: 10px;
  }

  .parks-panel,
  .draw-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    width: auto;
  }

  .parks-panel {
    top: auto;
    bottom: 84px;
    max-height: 32vh;
  }

  .draw-panel {
    bottom: 10px;
  }
}
