:root {
  /* PapaMap palette — neutral surfaces; status colors are Okabe-Ito bluish
     green + vermillion (colorblind-safe). Grey is deliberately the darkest,
     most prominent pin color: an untagged room is the call to action. */
  --bg: #eef1ef;
  --header: rgba(251, 253, 252, .97);
  --bar: rgba(255, 255, 255, .95);
  --ink: #1c2b26;
  --muted: #64716b;
  --muted-2: #39463f;
  --line: #d8ded9;
  --line-soft: #e4e9e4;
  --green: #009e73;
  --green-strong: #00775a;
  --red: #d55e00;
  --grey-pin: #3d4247;
  --shadow-soft: 0 1px 0 rgba(0, 0, 0, .06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--green-strong); }
a:hover { color: var(--green); }

#map { position: absolute; inset: 0; background: var(--bg); }

/* Keep the MapLibre default chrome out of the way — we ship our own. */
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right { display: none; }

/* ---------- Top overlay (header + stats strip + filter bar) ---------- */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  padding-top: var(--safe-top);
}

header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 24px;
  background: var(--header);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  text-decoration: none;
}
.brandmark:hover { color: inherit; }
.wordmark { display: flex; align-items: baseline; gap: 8px; }
.wordmark .name {
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}
.wordmark .city {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

/* The one German line in an otherwise English UI. */
.tagline {
  flex: 1 1 auto;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { flex: 0 0 auto; }
.header-actions a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.header-actions a:hover { text-decoration: underline; }

/* ---------- Stats strip ---------- */
#stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 26px;
  padding: 7px 24px;
  background: var(--bar);
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-2);
}
#stats b { color: var(--ink); font-weight: 700; }
#stats code { font-size: 11.5px; }
#stats a { font-weight: 600; }
#stats .cta-grey { color: var(--grey-pin); font-weight: 600; }
#stats .honesty { color: var(--muted); }

/* ---------- Chip filter bar (legend + toggles) ---------- */
.chip-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: var(--bar);
  border-top: 1px solid var(--line-soft);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.chip-bar .spacer { flex: 1 1 auto; }
.chip-bar .count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-2);
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: opacity .12s ease, border-color .12s ease;
}
.chip:hover { border-color: var(--green); }
/* Toggled off: washed out, but the dot keeps its color so the legend reads. */
.chip.off { opacity: .4; }
.chip .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}
.chip .cnt { opacity: .55; font-weight: 500; }

/* ---------- Zoom controls ---------- */
#zoom-ctrl {
  position: absolute;
  top: 140px;
  right: 16px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#zoom-ctrl button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  color: var(--muted-2);
}
#zoom-ctrl button:hover { border-color: var(--green); color: var(--green-strong); }

/* ---------- Attribution ---------- */
#attribution {
  position: absolute;
  bottom: calc(8px + var(--safe-bottom));
  right: 10px;
  z-index: 9;
  font-size: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, .8);
  padding: 2px 8px;
  border-radius: 6px;
}
#attribution a { color: var(--muted); text-decoration: none; }
#attribution a:hover { text-decoration: underline; }

/* ---------- Popup ---------- */
.maplibregl-popup-content {
  font-family: var(--ui);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 24px rgba(15, 25, 20, .25);
}
.maplibregl-popup-close-button {
  font-size: 18px;
  padding: 2px 8px;
  color: var(--muted);
}
.maplibregl-popup-close-button:hover { color: var(--ink); background: none; }

.popup h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); padding-right: 14px; }
.popup .sub {
  font-size: 11px;
  text-transform: capitalize;
  color: var(--muted);
  margin-top: 1px;
}
.popup .status { font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
.popup .status.ok { color: var(--green-strong); }
.popup .status.bad { color: #a84a00; }   /* darker vermillion for contrast on white */
.popup .status.ask { color: var(--grey-pin); }
.popup .row { font-size: 12.5px; color: var(--muted-2); margin: 2px 0; }
.popup .links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.popup .btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted-2);
}
.popup .btn:hover { border-color: var(--green); color: var(--green-strong); }
.popup .btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.popup .btn.primary:hover { background: var(--green-strong); border-color: var(--green-strong); color: #fff; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  header { padding: 8px 14px; gap: 6px 12px; }
  .tagline { flex-basis: 100%; order: 3; font-size: 12px; }
  #stats { padding: 6px 14px; gap: 2px 18px; font-size: 12px; }
  .chip-bar { padding-left: 14px; padding-right: 14px; }
  .chip { padding: 7px 11px; font-size: 12px; }
}
