:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #60706b;
  --line: #dce5e1;
  --paper: #fbfcfa;
  --surface: #f2f6f3;
  --green: #154f43;
  --green-light: #e3eee9;
  --blue: #2879d0;
  --gold: #c5752a;
  --shadow: 0 14px 40px rgba(24, 56, 48, .12);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, a { font: inherit; }

.map-app { padding: 24px; }

.map-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
  padding-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.08;
}

.intro { max-width: 680px; margin: 10px 0 0; color: var(--muted); font-size: .95rem; }

.route-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.route-stats span { padding: 11px 15px; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.route-stats span + span { border-left: 1px solid var(--line); }
.route-stats strong { display: block; color: var(--ink); font-size: .96rem; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: #fff;
}

.filters, .map-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.filter, .text-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}

.filter { display: inline-flex; gap: 7px; align-items: center; padding: 7px 12px; }
.filter:hover, .filter:focus-visible { background: var(--surface); }
.filter.is-active { border-color: #aac5bc; color: var(--green); background: var(--green-light); }
.text-button { padding: 7px 10px; color: var(--green); }
.text-button:hover, .text-button:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

.key { display: inline-grid; width: 10px; height: 10px; border-radius: 50%; }
.key--route { background: var(--blue); }
.key--food { background: var(--gold); }
.key--metro { width: 17px; height: 17px; place-items: center; border-radius: 5px; color: #fff; background: var(--green); font-size: .62rem; }
.count { min-width: 20px; padding: 1px 6px; border-radius: 999px; color: #fff; background: var(--green); text-align: center; }

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 610px;
  border: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.map-stage { position: relative; min-height: 610px; }
#map { position: absolute; inset: 0; background: #e8eee9; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }

.map-note {
  position: absolute;
  z-index: 500;
  left: 12px;
  bottom: 24px;
  padding: 6px 9px;
  border: 1px solid rgba(23, 33, 31, .1);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 4px 14px rgba(23, 33, 31, .08);
  font-size: .68rem;
}

.place-detail {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  border-left: 1px solid var(--line);
  background: #fff;
}

.detail-type { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.place-detail h2 { margin: 8px 0 11px; font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; font-weight: 500; line-height: 1.15; }
.place-detail p { margin: 0 0 18px; color: var(--muted); font-size: .9rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.detail-meta span { padding: 5px 8px; border-radius: 7px; color: var(--green); background: var(--green-light); font-size: .72rem; font-weight: 700; }

.detail-actions { display: grid; gap: 8px; margin-top: auto; }
.detail-actions button, .detail-actions a {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  border-radius: 9px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.save-place { color: #fff; background: var(--green); }
.save-place.is-saved { color: var(--green); background: var(--green-light); }
.open-map, .mix-link { color: var(--green); background: #fff; }
.detail-actions button:hover, .detail-actions a:hover { filter: brightness(.96); }
.place-detail .save-status { min-height: 1.25em; margin: 10px 0 0; color: var(--green); font-size: .76rem; font-weight: 700; }

.map-footer { display: flex; justify-content: space-between; gap: 16px; padding: 15px 2px 0; color: var(--muted); font-size: .68rem; }

.map-marker { background: none; border: 0; }
.marker-shell {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 10px rgba(23, 33, 31, .34);
  font-size: .75rem;
  font-weight: 900;
  transform: rotate(-45deg);
}
.marker-shell span { transform: rotate(45deg); }
.map-marker.is-saved .marker-shell { outline: 3px solid #f3c86b; }
.food-marker .marker-shell { width: 24px; height: 24px; border-radius: 50%; background: var(--gold); transform: none; }
.food-marker .marker-shell span { transform: none; font-size: 0; }
.food-marker .marker-shell span::after { content: "•"; font-size: 1.3rem; }
.metro-marker .marker-shell { width: 27px; height: 27px; border-radius: 7px; background: var(--green); transform: none; }
.metro-marker .marker-shell span { transform: none; font-size: .72rem; }

.leaflet-tooltip.map-label {
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 3px 12px rgba(23, 33, 31, .16);
  font-size: .72rem;
  font-weight: 700;
}
.leaflet-tooltip.map-label::before { display: none; }

@media (max-width: 680px) {
  .map-app { padding: 16px; }
  .map-header { grid-template-columns: 1fr; gap: 16px; }
  .route-stats { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .route-stats span { white-space: normal; }
  .map-layout { grid-template-columns: 1fr; }
  .map-stage { min-height: 560px; }
  .place-detail { min-height: 300px; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 560px) {
  .map-app { padding: 12px; }
  .map-header { padding-bottom: 16px; }
  .route-stats span { padding: 9px; font-size: .67rem; }
  .route-stats strong { font-size: .85rem; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .map-actions { align-self: flex-end; }
  .map-stage { min-height: 480px; }
  .place-detail { padding: 21px 18px; }
  .map-footer { flex-direction: column; gap: 3px; }
}

@media print {
  .map-app { padding: 0; }
  .toolbar, .detail-actions, .leaflet-control-container { display: none !important; }
  .map-layout { grid-template-columns: 1fr 260px; box-shadow: none; }
  .map-stage { min-height: 600px; }
}
