:root {
  color-scheme: light;
  --blue: #1769aa;
  --blue-dark: #0e4f86;
  --ink: #17212b;
  --muted: #657382;
  --line: #dce3e9;
  --surface: #ffffff;
  --background: #f3f6f8;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--background); }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; }
button { border: 0; border-radius: 12px; min-height: 44px; padding: 0 16px; cursor: pointer; font-weight: 650; background: var(--blue); color: #fff; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #91c9f6; outline-offset: 2px; }
button.secondary { background: #e9f2f9; color: var(--blue-dark); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--blue); font-weight: 850; font-size: 23px; }
.brand { flex: 1; min-width: 0; }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.brand h1 span { color: var(--blue); }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.icon-button { min-width: 44px; width: 44px; padding: 0; font-size: 24px; border-radius: 50%; }
main { max-width: 1000px; margin: 0 auto; }
.search-panel { background: #fff; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
#searchForm { display: flex; gap: 8px; }
#placeSearch { min-width: 0; flex: 1; border: 1px solid #c9d3dc; background: #fff; border-radius: 12px; padding: 0 13px; min-height: 46px; color: var(--ink); }
.filters { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.filters label { white-space: nowrap; }
.filters select { flex: 1; min-width: 0; min-height: 42px; border: 1px solid #c9d3dc; background: white; border-radius: 10px; padding: 0 9px; color: var(--ink); }
.status { padding: 10px 15px; font-size: 13px; color: #3f5262; background: #eaf3fa; min-height: 40px; }
.status.error { color: #8a2e25; background: #fff0ed; }
.view-tabs { display: flex; padding: 10px 14px 0; gap: 8px; background: #fff; }
.tab { flex: 1; background: transparent; color: #526273; border-radius: 10px 10px 0 0; border-bottom: 3px solid transparent; }
.tab.active { color: var(--blue-dark); border-bottom-color: var(--blue); background: #f2f8fc; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 4px; border-radius: 20px; font-size: 12px; background: #dcecf8; color: var(--blue-dark); }
.view { display: none; }
.view.active { display: block; }
#map { width: 100%; height: min(58vh, 620px); min-height: 340px; background: #e8eef2; z-index: 1; }
.map-note { background: #fff; color: var(--muted); font-size: 11px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.results-list { padding: 10px; }
.result-card { width: 100%; text-align: left; display: block; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 13px; padding: 13px; margin-bottom: 8px; min-height: 0; }
.result-card strong { display: block; font-size: 15px; line-height: 1.3; margin-bottom: 5px; }
.result-card .road { color: #526273; font-size: 13px; margin-bottom: 7px; }
.result-card .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--blue-dark); font-size: 12px; }
.empty { padding: 24px 15px; color: var(--muted); text-align: center; background: #fff; border: 1px dashed #cbd5de; border-radius: 12px; }
.detail-panel { position: relative; margin: 10px; padding: 17px; border-radius: 16px; background: white; border: 1px solid var(--line); box-shadow: 0 4px 16px #182c3b12; }
.detail-panel[hidden] { display: none; }
.close-detail { position: absolute; right: 10px; top: 10px; background: #edf2f5; color: #263746; width: 38px; min-height: 38px; padding: 0; font-size: 24px; }
.detail-kicker { color: var(--blue); font-weight: 800; font-size: 10px; letter-spacing: 1px; margin-bottom: 5px; }
.detail-panel h2 { font-size: 19px; margin: 0 40px 5px 0; }
.detail-road, .detail-distance { margin: 5px 0; color: #536474; font-size: 14px; }
.detail-distance { font-weight: 700; color: var(--blue-dark); }
.detail-actions { display: flex; gap: 8px; margin-top: 14px; }
.detail-actions button { flex: 1; }
.small-note { font-size: 11px; line-height: 1.4; color: var(--muted); margin: 13px 0 0; }
footer { max-width: 1000px; margin: 0 auto; padding: 14px 16px 25px; font-size: 11px; color: var(--muted); line-height: 1.5; }
footer p { margin: 4px 0; }
footer a { color: var(--blue-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.layby-pin { display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid white; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--blue); color: white; box-shadow: 0 2px 7px #0004; font-size: 15px; font-weight: 800; }
.layby-pin span { transform: rotate(45deg); }
.leaflet-popup-content { font-family: inherit; }
@media (min-width: 760px) {
  .topbar { padding-left: 22px; padding-right: 22px; }
  .search-panel { padding: 16px 22px; }
  #map { height: 560px; }
  .results-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .result-card { margin: 0; }
  .detail-panel { margin: 14px 22px; }
}
