:root {
  color-scheme: dark;
  font-family: Arial, sans-serif;
  color: #f4f6fa;
  background: #171a21;
  --surface: #222934;
  --line: #353e4a;
  --muted: #c6cfdb;
  --accent: #f07ab6;
  --pending: #f0cc83;
  --store: #7ee6ef;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100svh; margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
::selection { background: #66334e; color: white; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 82px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { object-fit: contain; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(18px, 2.2vw, 25px); line-height: 1.12; }
.brand p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.map-actions { display: flex; gap: 8px; }
.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
  padding: 9px 12px;
  color: inherit;
  background: var(--surface);
  border: 1px solid #4c5868;
  border-radius: 7px;
}
.control:hover { background: #303a48; }
.satellite-toggle { white-space: nowrap; }
.switch-track {
  position: relative;
  flex: 0 0 34px;
  height: 20px;
  border: 1px solid #8592a5;
  border-radius: 999px;
  background: #313b49;
  transition: background-color 500ms ease, border-color 500ms ease;
}
.switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f4f6fa;
  transition: transform 500ms ease, background-color 500ms ease;
}
.satellite-toggle[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.satellite-toggle[aria-checked="true"] .switch-track::before { transform: translateX(14px); background: #351327; }

@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-track::before { transition: none; }
}
.satellite-imagery { filter: brightness(.84); }

.layout { display: grid; grid-template-columns: clamp(310px, 26vw, 380px) minmax(0, 1fr); height: calc(100dvh - 82px); min-height: 480px; }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.introduction { padding: 22px 22px 0; }
h2 { font-size: 23px; line-height: 1.12; text-wrap: balance; }
.introduction > p:not(.result-count) { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.introduction .draft { padding: 10px 12px; background: #3a3023; color: #ffe1a6 !important; border-radius: 7px; }
label { display: block; margin: 18px 0 6px; font-size: 14px; }
input { width: 100%; min-height: 44px; padding: 9px 12px; color: inherit; caret-color: var(--accent); background: var(--surface); border: 1px solid #4c5868; border-radius: 7px; }
input::placeholder { color: #acb8c8; }
.result-count { min-height: 33px; padding: 10px 0 7px; font-size: 12px; color: var(--muted); }
.destinations { list-style: none; margin: 0; padding: 0 22px 18px; overflow: auto; scrollbar-color: #576575 #171a21; }
.destinations li { border-top: 1px solid var(--line); }
.destination {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 9px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  color: inherit;
}
.destination:not(:disabled):hover, .destination[aria-pressed="true"] { background: #302632; }
.destination:disabled { cursor: default; }
.destination-name { font-size: 14px; font-weight: 600; }
.destination-meta, .distance { color: var(--muted); font-size: 12px; line-height: 1.35; }
.destination-meta { display: block; margin-top: 4px; }
.distance { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pending-text { color: var(--pending); }

.map-shell, #map { position: relative; min-height: 0; background: #20262d; }
.map-shell { isolation: isolate; }
#map { height: 100%; }
.legend {
  position: absolute;
  z-index: 800;
  right: 12px;
  top: 12px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  background: #171a21;
  border: 1px solid #4c5868;
  border-radius: 7px;
}
.legend span { display: flex; align-items: center; gap: 7px; }
.key { display: inline-block; flex: none; width: 11px; height: 11px; }
.key-area { background: #80375c; border: 1px solid var(--accent); border-radius: 2px; }
.key-point { background: #ed73b2; border-radius: 50%; }
.key-pending { border: 1px dashed var(--pending); border-radius: 2px; }
.key-store { background: var(--store); border-radius: 50%; }
.map-status { position: absolute; bottom: 32px; left: 12px; z-index: 800; max-width: calc(100% - 24px); padding: 9px 12px; background: #171a21; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.place-label span { display: inline-block; transform: translate(-50%, -50%); color: #d2dbe6; font: 600 13px Arial, sans-serif; white-space: nowrap; text-shadow: 0 1px 4px #171a21; }
.leaflet-bar a, .leaflet-bar a:hover, .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: #f4f6fa; }
.leaflet-bar a.leaflet-disabled { color: #aab2bd; background: #29323e; }
.leaflet-container .leaflet-control-attribution { background: #171a21; color: #d5dce6; }
.leaflet-container .leaflet-control-attribution a { color: #bce8f1; }
.leaflet-container a.leaflet-popup-close-button { color: #e8eaf0; }
.popup-title { display: block; margin-bottom: 4px; font-size: 15px; }
.popup-detail { display: block; line-height: 1.55; }
.store-pin {
  display: grid;
  place-items: center;
  background: var(--store);
  border: 2px solid #153d45;
  border-radius: 50%;
  color: #0b272d;
}
.store-pin svg { display: block; }

@media (max-width: 700px) {
  .toolbar { min-height: 76px; padding: 10px 12px; }
  .brand { gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand p { font-size: 12px; }
  .control { font-size: 12px; padding-inline: 8px; }
  .control svg { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .map-shell { height: clamp(310px, 49svh, 460px); grid-row: 1; }
  .sidebar { border-right: 0; border-top: 1px solid var(--line); }
  .introduction { padding: 16px 16px 0; }
  h2 { font-size: 20px; }
  .destinations { padding-inline: 16px; overflow: visible; }
  .legend { right: 8px; top: 8px; }
}

@media (max-width: 480px) {
  .toolbar { flex-wrap: wrap; }
  .map-actions { flex: 1 0 100%; }
  .map-actions .control { flex: 1; }
}

@media (max-width: 365px) {
  .brand img { display: none; }
}
