:root {
  --enamel: #1b3f8b;        /* street-sign blue */
  --enamel-deep: #13306d;
  --marble: #eef0ed;        /* cool marble, the panel ground */
  --paper: #fbfbf9;
  --ink: #1d2433;
  --ink-soft: #5b6475;
  --rule: #d5d9d3;
  --c-square: #2f6fd6;
  --c-landmark: #7d4cb8;
  --c-monument: #a3441f;
  --c-culture: #c0307a;
  --c-green: #2e7d4f;
  --focus: #f2b705;
  --panel-w: 400px;
  --cond: "Fira Sans Condensed", "Arial Narrow", sans-serif;
  --sans: "Fira Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--marble);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--enamel); text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.app { display: flex; height: 100dvh; }
.map { flex: 1; min-width: 0; background: #dfe3dd; }

/* ---------- Panel ---------- */
.panel {
  width: var(--panel-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--marble);
  border-right: 1px solid var(--rule);
  z-index: 500;
  min-height: 0;
}
.panel-handle { display: none; }

/* The street sign: the one loud element */
.sign {
  position: relative;
  padding: 20px 20px 14px;
}
.sign-plate {
  display: block;
  padding: 14px 18px 13px;
  border-radius: 9px;
  background: var(--enamel);
  color: #fff;
  text-decoration: none;
  box-shadow:
    inset 0 0 0 3px var(--enamel),
    inset 0 0 0 5px #fff,
    0 1px 0 var(--enamel-deep),
    0 6px 14px -8px rgba(19, 48, 109, .55);
}
.sign-kicker {
  display: block;
  font: 500 13px/1.2 var(--cond);
  letter-spacing: .02em;
  opacity: .85;
}
.sign-title {
  display: block;
  margin-top: 2px;
  font: 700 33px/1.05 var(--cond);
  text-transform: uppercase;
  letter-spacing: .01em;
}
.sign-sub {
  display: block;
  margin-top: 3px;
  font: 500 15px/1.2 var(--cond);
  opacity: .8;
}
.lang {
  position: absolute;
  top: 32px; right: 34px;
  padding: 3px 8px;
  border: 1.5px solid rgba(255, 255, 255, .75);
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font: 600 13px/1 var(--cond);
  cursor: pointer;
}
.lang:hover { background: rgba(255, 255, 255, .12); }

.controls { padding: 0 20px; display: grid; gap: 12px; }

.search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  height: 44px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.search:focus-within { border-color: var(--enamel); box-shadow: 0 0 0 3px rgba(27, 63, 139, .15); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; }

.cats { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cat {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cat .n { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cat:has(input:checked) { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.cat:has(input:not(:checked)) { color: var(--ink-soft); background: transparent; }
.cat:has(input:not(:checked)) .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.cat:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.row { display: flex; gap: 8px; }
.select { flex: 1; min-width: 0; }
.select select {
  width: 100%; height: 40px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%235b6475' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 12px;
  appearance: none;
  cursor: pointer;
}
.near {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  white-space: nowrap;
}
.near svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.near[aria-pressed="true"] { background: var(--enamel); border-color: var(--enamel); color: #fff; }
.near[disabled] { opacity: .6; cursor: progress; }

.count {
  margin: 14px 20px 6px;
  color: var(--ink-soft);
  font-size: 13px;
}

.list {
  list-style: none;
  margin: 0; padding: 0 12px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}
.item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: start;
  gap: 2px 8px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.item:hover, .item[aria-current="true"] { background: var(--paper); }
.item[aria-current="true"] { box-shadow: inset 3px 0 0 var(--enamel); }
.mark {
  margin-top: 3px;
  width: 12px; height: 12px;
  justify-self: center;
  border-radius: 50%;
  background: var(--c);
}
.mark.num {
  width: 20px; height: 20px; margin-top: 0;
  display: grid; place-items: center;
  color: #fff;
  font: 600 11px/1 var(--cond);
  border-radius: 5px;
}
.item-name { font: 600 15.5px/1.25 var(--cond); letter-spacing: .01em; text-transform: uppercase; }
.item-meta { grid-column: 2; color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.item-dist { font-size: 13px; color: var(--enamel); font-variant-numeric: tabular-nums; padding-top: 1px; }

.empty { padding: 16px 10px; color: var(--ink-soft); }
.empty button {
  margin-top: 8px; padding: 6px 12px;
  border: 1px solid var(--enamel); border-radius: 6px;
  background: none; color: var(--enamel); cursor: pointer;
}

.foot {
  padding: 10px 20px 16px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.foot p { margin: 4px 0; }
.foot a { color: inherit; }

/* ---------- Map markers & popups ---------- */
.pin-num {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--c-green);
  color: #fff;
  font: 600 12px/1 var(--cond);
  box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0, 0, 0, .3);
}
.pin-num.on { box-shadow: 0 0 0 3px var(--focus), 0 2px 6px rgba(0, 0, 0, .35); }

.leaflet-popup-content-wrapper { border-radius: 10px; padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; width: 270px !important; font: 400 14px/1.45 var(--sans); }
.pop-sign {
  margin: 12px 12px 0;
  padding: 9px 30px 8px 12px;
  border-radius: 6px;
  background: var(--enamel);
  color: #fff;
  box-shadow: inset 0 0 0 2px var(--enamel), inset 0 0 0 3.5px #fff;
}
.pop-name { display: block; font: 700 18px/1.15 var(--cond); text-transform: uppercase; }
.pop-en { display: block; margin-top: 2px; font: 500 13px/1.2 var(--cond); opacity: .82; }
.pop-body { padding: 10px 14px 12px; }
.pop-cat { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.pop-cat i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.pop-body dl { margin: 6px 0 10px; display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
.pop-body dt { color: var(--ink-soft); }
.pop-body dd { margin: 0; }
.pop-links { display: flex; gap: 14px; flex-wrap: wrap; }
.pop-links a, .pop-links button {
  padding: 0; border: 0; background: none;
  color: var(--enamel); font-weight: 500; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.leaflet-container a.leaflet-popup-close-button { color: #fff; top: 16px; right: 16px; width: 22px; height: 22px; font-size: 20px; }

.leaflet-control-attribution { font-size: 11px; }

/* ---------- Mobile: panel becomes a bottom sheet ---------- */
@media (max-width: 760px) {
  .app { display: block; position: relative; }
  .map { position: absolute; inset: 0; }
  .panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: auto;
    height: 46dvh;
    border-right: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 24px rgba(20, 30, 50, .18);
    transition: height .25s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.expanded { height: 88dvh; }
  .panel.collapsed { height: 188px; }
  .panel-handle {
    display: grid; place-items: center;
    height: 22px; width: 100%;
    border: 0; background: none; cursor: grab; flex: none;
  }
  .grip { width: 44px; height: 5px; border-radius: 3px; background: #b7bdb4; }
  .sign { padding: 2px 14px 10px; }
  .sign-plate { padding: 9px 14px 8px; }
  .sign-kicker { display: none; }
  .sign-title { font-size: 24px; }
  .sign-sub { font-size: 13px; }
  .lang { top: 14px; right: 26px; }
  .controls { padding: 0 14px; gap: 10px; }
  .count { margin: 10px 16px 4px; }
  .list { padding: 0 6px 8px; }
  .foot { display: none; padding: 8px 16px 12px; }
  .panel.expanded .foot { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.zone-tip { font: 600 13px/1.2 var(--cond); }

/* Softer base map so the boundaries and markers stand out (tiles stay OSM) */
.leaflet-tile-pane { filter: saturate(.45) brightness(1.03); }

.layers-box {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .14);
  font: 400 13px/1.3 var(--sans);
  color: var(--ink);
  max-width: 250px;
}
.lyr-toggle {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  padding: 8px 11px;
  border: 0; background: none; cursor: pointer;
  font: 600 14px/1 var(--cond);
}
.lyr-toggle svg { width: 17px; height: 17px; fill: none; stroke: var(--enamel); stroke-width: 2; stroke-linejoin: round; }
.lyr-list { padding: 0 11px 9px; border-top: 1px solid var(--rule); }
.lyr-hint { margin: 7px 0 4px; color: var(--ink-soft); font-size: 12px; }
.lyr { display: grid; grid-template-columns: auto 30px 1fr; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer; }
.lyr input { margin: 0; accent-color: var(--enamel); }
.swatch { width: 28px; height: 14px; }
.lyr small { display: block; color: var(--ink-soft); font-size: 11px; }

.comm-label {
  display: grid; place-items: center;
  width: 34px; height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .88);
  border: 1.5px solid #2b3242;
  color: #2b3242;
  font: 700 13px/1 var(--cond);
  cursor: pointer;
}
.comm-label.on { background: #2b3242; color: #fff; }

/* Fountains: a drop, blue when working, grey when not */
.pin-drop {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #0b8bd1;
  box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0, 0, 0, .3);
}
.pin-drop svg, .mark.drop svg { width: 11px; height: 14px; fill: #fff; }
.pin-drop.off, .mark.drop.off { background: #8a919e; }
.mark.drop {
  width: 18px; height: 18px; margin-top: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #0b8bd1;
}
.mark.drop svg { width: 9px; height: 12px; }
.pop-note { margin: -4px 0 6px; font-size: 13px; }
.pop-small { margin: -2px 0 10px; font-size: 12px; color: var(--ink-soft); }
