* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #map { height: 100%; width: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

#title {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(255,255,255,0.97); padding: 10px 14px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
#title h1 { font-size: 18px; font-weight: 700; color: #1a1a1a; }
#title p { font-size: 12px; color: #555; margin-top: 2px; }
#sources { margin-top: 8px; border-top: 1px solid #e5e5e5; padding-top: 6px; }
#sources-toggle {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: #333;
}
#sources-body { margin-top: 6px; max-height: 55vh; overflow-y: auto; overflow-x: hidden; }
.src-all {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 600; color: #222; margin-bottom: 6px;
}
.src-all input { cursor: pointer; }

#sources-table { border-collapse: collapse; width: 100%; font-size: 12px; color: #333; }
#sources-table thead th {
  font-size: 10px; font-weight: 600; color: #999; text-align: left;
  padding: 0 8px 3px 0; border-bottom: 1px solid #eee;
}
.src-row { cursor: pointer; }
.src-row:hover { background: #f2f6fb; }
.src-row td { padding: 2px 8px 2px 0; white-space: nowrap; }
.src-row td:first-child { padding-right: 4px; }
.src-row input { cursor: pointer; vertical-align: middle; }
.src-year { color: #555; font-variant-numeric: tabular-nums; }
.src-lic a { color: #4576c4; text-decoration: none; }
.src-lic a:hover { text-decoration: underline; }
.src-lic-plain { color: #999; }
/* „Zugang"-Spalte: Format-Label(s) verlinkt auf den Endpunkt (README-Spalte). */
.src-access { font-size: 11px; }
.src-access a { color: #4576c4; text-decoration: none; }
.src-access a:hover { text-decoration: underline; }
.src-access .sep { color: #c4c4c4; }

/* BASt-Backbone unten abgesetzt (kein Bundesland). */
tbody.bast-body td { border-top: 1px solid #d5d5d5; padding-top: 5px; }
tbody.bast-body .src-name { font-style: italic; color: #444; }
/* die src-hint-Zeile darunter hat keine eigene Trennlinie */
tbody.bast-body tr.src-hint td { border-top: none; padding-top: 0; }

/* kleiner Hinweis unter einer Quelle (z.B. UBA-HVS: >3 Mio Kfz/Jahr, ab Zoom 9) */
tr.src-hint td { padding: 0 0 4px 24px; font-size: 10px; color: #a8a8a8; font-style: italic; }

.src-details {
  margin-top: 7px; font-size: 11px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.src-details > a { color: #4576c4; text-decoration: none; }
.src-details > a:hover { text-decoration: underline; }
/* dezente GitHub-/Issue-Icons rechts neben dem README-Hinweis */
.src-links { display: inline-flex; gap: 9px; align-items: center; }
.src-links a { color: #b4b4b4; display: inline-flex; }
.src-links a:hover { color: #444; }
.src-links svg { display: block; }

#legend {
  position: absolute; bottom: 22px; left: 12px; z-index: 2;
  background: rgba(255,255,255,0.97); padding: 10px 12px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); min-width: 190px;
}
/* DTV <-> SV-Anteil Umschalter (segmented control) im Legenden-Kopf. */
#legend-modes {
  display: inline-flex; margin-bottom: 8px;
  border: 1px solid #d8d8d8; border-radius: 6px; overflow: hidden;
}
#legend-modes button {
  font: inherit; font-size: 11px; font-weight: 600; padding: 3px 10px;
  border: none; background: #fff; color: #777; cursor: pointer;
}
#legend-modes button + button { border-left: 1px solid #d8d8d8; }
#legend-modes button.active { background: #4576c4; color: #fff; }
.legend-title { font-size: 12px; font-weight: 600; margin-bottom: 8px; color: #222; }
.legend-row {
  display: flex; align-items: center; font-size: 11px; color: #333; margin: 2px 0;
  transition: color 0.2s;
}
.legend-swatch {
  width: 22px; height: 5px; border-radius: 2px; margin-right: 8px; flex: none;
  transition: background 0.2s;
}
/* per-Zoom ausgefiltert -> ausgegraut */
.legend-row.dimmed { color: #c2c2c2; }
.legend-row.dimmed .legend-swatch { background: #dcdcdc !important; }
#legend-cut { font-size: 10px; color: #888; font-style: italic; margin-top: 8px; }
/* barrierefreie-Farben-Umschalter unter der Skala. */
#legend-cvd {
  display: flex; align-items: center; gap: 6px; margin-top: 9px;
  font-size: 10px; color: #888; cursor: pointer;
}
#legend-cvd input { cursor: pointer; margin: 0; }

.maplibregl-popup-content {
  font-size: 13px; line-height: 1.5; padding: 11px 14px; border-radius: 9px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.popup-road { font-weight: 700; font-size: 15px; color: #111; }
.popup-dtv { color: #d73027; font-weight: 700; font-size: 16px; margin: 3px 0 1px; }
.popup-unit { color: #9a9a9a; font-weight: 600; font-size: 11px; }
.popup-sv { color: #555; font-size: 12px; margin-top: 1px; }
.popup-meta { color: #777; font-size: 11.5px; margin-top: 1px; }
/* Metrik-Badge + SV-Label: gepunktete Unterstreichung = „hover für Erklärung". */
.popup-metric { color: #9a9a9a; font-weight: 600; font-size: 11px; cursor: help; border-bottom: 1px dotted #c4c4c4; }
.popup-hint { color: #444; cursor: help; border-bottom: 1px dotted #c4c4c4; }

/* ---- schmale Screens / Mobile ------------------------------------------- */
@media (max-width: 640px) {
  #title {
    left: 8px; right: 8px; top: 8px; padding: 8px 11px;
    max-width: none;
  }
  #title h1 { font-size: 16px; }
  #title p { font-size: 11px; }
  /* zusätzliche „Zugang"-Spalte kann schmale Screens sprengen -> horizontal scrollbar */
  #sources-body { max-height: 42vh; overflow-x: auto; }
  .src-row td { padding-right: 6px; }

  #legend { bottom: 8px; left: 8px; padding: 8px 10px; min-width: 0; }
  .legend-title { font-size: 11px; }
  .legend-row { font-size: 10px; margin: 1px 0; }
  .legend-swatch { width: 18px; margin-right: 6px; }
}
