* { box-sizing: border-box; }
html, body { height: 100%; }
body { display: flex; flex-direction: column; margin: 0; overflow: hidden; font: 14px/1.5 system-ui, sans-serif; color: #222; }
.map-shell { position: relative; flex: 1; min-height: 0; }
#map { height: 100%; width: 100%; }
/* Leaflet paints #ddd behind layers; match the vector basemap background to avoid a flash before the canvas paints. */
.maplibregl-map, .leaflet-container { background: #f2f3f0; }
.panel { position: absolute; z-index: 800; background: white; border-radius: 9px; box-shadow: 0 2px 14px #0003; }
.panel[hidden] { display: none; }
.toolbar { position: relative; z-index: 900; display: flex; flex: none; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-radius: 0; box-shadow: 0 1px 5px #0003; }
.logo { display: inline-flex; align-items: center; flex: none; height: 30px; padding: 0 10px; border-radius: .375rem; background: #e83838; color: #fff; font-weight: 700; letter-spacing: .01em; line-height: 1; text-decoration: none; transition: background-color .2s ease, color .2s ease; }
.logo:hover, .logo:focus-visible { background: #c52d2d; color: #fff; }
h1 { margin: 0 4px 0 0; font-size: 18px; white-space: nowrap; }
h2 { margin: 0 0 8px; font-size: 14px; }
p { margin: 5px 0 12px; } small { color: #777; }
.search-box { position: relative; flex: 1; min-width: 150px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.filter-panel { top: 8px; left: 8px; z-index: 1200; width: min(360px, calc(100% - 16px)); padding: 12px 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { margin: 0; }
#close-controls { width: 28px; height: 28px; padding: 0; font-size: 20px; line-height: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
button { cursor: pointer; font: inherit; border: 1px solid #ddd; border-radius: 5px; padding: 4px 8px; background: #fff; color: inherit; }
.filter-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0; }
.filter-icon { display: flex; justify-content: space-around; width: 16px; height: 18px; }
.filter-icon span { position: relative; display: block; width: 2px; height: 18px; border-radius: 2px; background: #555; }
.filter-icon span::after { content: ''; position: absolute; left: -3px; width: 8px; height: 5px; border-radius: 2px; background: #555; }
.filter-icon span:first-child::after { top: 3px; }
.filter-icon span:last-child::after { top: 10px; }
button[aria-pressed="true"] { background: #e9f5f2; border-color: #0e9680; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #0e9680; }
label { display: block; font-size: 12px; }
input { width: 100%; padding: 7px; border: 1px solid #ccc; border-radius: 5px; }
#language { flex: none; padding: 4px 5px; border: 1px solid #ddd; border-radius: 5px; background: #fff; color: inherit; font: inherit; }
#results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 900; list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow: auto; background: #fff; border-radius: 6px; box-shadow: 0 2px 12px #0003; }
#results:empty { display: none; }
#results button { width: 100%; text-align: left; margin-top: 4px; }
.legend { right: 12px; bottom: 24px; width: 184px; padding: 10px; }
.legend.minimized { width: auto; }
.legend .panel-heading { margin-bottom: 6px; }
.legend.minimized .panel-heading { margin: 0; }
#toggle-legend { width: 28px; height: 28px; padding: 0; font-size: 13px; line-height: 1; }
.provider { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; padding: 2px 4px; width: 100%; text-align: left; font-size: 12px; }
.swatch { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }
#total { white-space: nowrap; }
#status { position: absolute; z-index: 1000; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 15px; background: white; border-radius: 8px; }
.maplibregl-popup, .leaflet-popup { max-width: calc(100vw - 32px); }
.maplibregl-popup-content, .leaflet-popup-content { max-width: calc(100vw - 64px); overflow-wrap: anywhere; max-height: 65vh; overflow-y: auto; }
.maplibregl-popup-content pre, .leaflet-popup-content pre { white-space: pre-wrap; font-size: 11px; }
@media (max-width: 600px) {
  .toolbar { width: 100%; padding: 7px 8px; }
  .search-box { min-width: 0; }
  #total { display: none; }
  .filter-panel { top: 8px; left: 8px; right: 8px; bottom: auto; width: auto; max-height: 55vh; overflow: auto; padding: 12px; z-index: 1200; }
  .legend { width: 172px; padding: 8px; right: 10px; }
  .legend.minimized { width: auto; }
}
