/* duisburg.jetzt Stadtkarte — redesign v2 (design/redesign-v2).
   Leitbild: Karte plus durchsuchbare Informationsliste.
   Nur index.html nutzt diese Datei; Archiv, Impressum, Datenschutz, Besucherzahlen bleiben auf styles.css. */

:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #eceae4;
  --text: #17171a;
  --muted: #45454d;      /* 9.0:1 auf Weiß */
  --line: #d6d3cb;
  --line-strong: #a8a49a;
  --accent: #0a58a8;     /* 6.9:1 auf Weiß */
  --accent-strong: #08407a;
  --accent-soft: #e3eefa;
  --accent-ink: #ffffff;
  --warn-bg: #fff1cf;
  --warn-ink: #6b4100;   /* 8.4:1 auf warn-bg */
  --focus: #0a58a8;
  --focus-halo: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 30, .08), 0 6px 24px rgba(20, 20, 30, .10);
  --radius: 12px;
  --radius-s: 8px;
  --tap: 44px;
  --appbar-h: auto;
  --sidebar-w: 420px;
  --sheet-peek: 156px;
  --sheet-visible: 156px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-0: 1rem;      /* 16 px: auch Metazeilen, Datenstand, Legende */
  --fs-1: 1rem;      /* 16 px: Fließtext */
  --fs-2: 1.125rem;  /* 18 px: Überschriften in Listen */
  --fs-3: 1.375rem;  /* 22 px */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body.app {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-1);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;              /* nur ein Scrollbereich: die Liste */
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.25; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: var(--radius-s); font-weight: 600;
}
.skip-link:focus { top: 8px; color: var(--accent-ink); }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-halo);
  border-radius: 6px;
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 14px;
  font: inherit; font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-quiet { border-color: var(--line); }
.btn.active, .btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

/* ---------- Kopfzeile ---------- */
.appbar {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px 6px;
  position: relative; z-index: 40;
}
.appbar-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex: 0 0 auto; min-height: var(--tap); min-width: var(--tap); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #111; }
.brand-text { display: none; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: var(--fs-1); }
.brand-sub { font-size: var(--fs-0); color: var(--muted); }

.search-cluster { flex: 1 1 auto; min-width: 0; position: relative; }
.search-wrap { position: relative; display: block; }
.search-icon { position: absolute; left: 12px; top: 12px; color: var(--muted); pointer-events: none; }
#list-search {
  width: 100%; min-height: var(--tap);
  font: inherit; font-size: var(--fs-1);
  padding: 0 14px 0 40px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--text);
}
#list-search::placeholder { color: var(--muted); opacity: 1; }
#list-search:focus-visible { background: var(--surface); }
.search-geocode-status {
  position: absolute; left: 12px; right: 12px; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  padding: 8px 12px; font-size: var(--fs-1); color: var(--text); z-index: 60;
}
.search-geocode-status[data-kind="strong"] { font-weight: 600; }
.search-geocode-status[data-kind="pending"] { font-style: italic; color: var(--muted); }
.search-geocode-status[data-kind="weak"], .search-geocode-status[data-kind="error"] { color: var(--muted); }

.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.radio-mini { display: inline-flex; align-items: center; gap: 4px; }
.radio-play {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.radio-play:disabled { background: var(--surface-3); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.radio-play.is-playing { background: var(--accent-strong); }
.radio-more { display: none; min-height: var(--tap); align-items: center; padding: 0 6px; font-weight: 600; }
.btn-layers-icon { display: none; }

.stand-line {
  margin: 4px 0 0; font-size: var(--fs-0); color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0;
}
.stand-label { font-weight: 600; }
.fresh-detail { display: none; }
.map-freshness-chip {
  display: inline-block; background: var(--warn-bg); color: var(--warn-ink);
  border-radius: 999px; padding: 1px 10px; font-weight: 600;
}

/* ---------- Nachrichten ---------- */
.newsbar {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 4px 12px 8px;
  position: relative; z-index: 35;
}
.newsbar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.ticker-label { margin: 0; font-size: var(--fs-1); font-weight: 700; }
.newsbar-archiv { display: inline-flex; align-items: center; min-height: var(--tap); margin: -4px 0; font-weight: 600; }
.newsbar-scroll { display: grid; gap: 6px; grid-template-columns: 1fr; }
.news-empty { color: var(--muted); }
.news-card {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 0;
  min-width: 0; min-height: var(--tap);
  padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface-2); color: var(--text);
  cursor: pointer; text-align: left; overflow: hidden;
}
.news-card:hover { border-color: var(--accent); }
.news-card.active, .news-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.news-card.is-inert { cursor: default; }
.news-card > strong { display: none;
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong);
  font-weight: 700; flex: 0 0 auto; order: 2;
}
.news-card .news-title {
  flex: 1 1 100%; order: 1; min-width: 0;
  font-weight: 650; font-size: var(--fs-1); line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1;
}
.news-card .news-summary { display: none; }
.news-card .ticker-when { white-space: normal !important; overflow: visible !important; }
.news-card .ticker-when, .news-card .news-source, .news-card .news-source-link {
  order: 3; font-size: var(--fs-0); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.news-card .news-source-link { color: var(--accent); order: 4; display: inline-block; line-height: 24px; min-height: 24px; }
.news-card .news-source { order: 4; }
.news-card .news-open { display: none; }

/* ---------- Hauptbereich ---------- */
.shell { flex: 1 1 auto; min-height: 0; position: relative; }
.mapwrap { position: absolute; inset: 0; background: var(--surface-3); }
#map { position: absolute; inset: 0; }

.sidebar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  height: var(--sheet-peek);
  background: var(--surface);
  border-top-left-radius: 16px; border-top-right-radius: 16px;
  box-shadow: 0 -4px 24px rgba(20, 20, 30, .18);
  display: flex; flex-direction: column;
  transition: height .22s ease;
}
body[data-sheet="half"] .sidebar { height: 55%; }
body[data-sheet="full"] .sidebar { height: 100%; border-radius: 0; }
.sidebar.is-dragging { transition: none; }
.sheet-handle {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: var(--tap); padding: 6px 0 2px;
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-0);
  cursor: grab; touch-action: none;
}
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sidebar-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0 12px 24px;
}
body[data-sheet="peek"] .sidebar-scroll { overflow: hidden; }

.place-row { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.btn-ganz-duisburg { flex: 0 0 auto; }
.district-pick { flex: 1 1 auto; min-width: 0; display: block; }
#district-select {
  width: 100%; min-height: var(--tap); font: inherit; font-size: var(--fs-1);
  padding: 0 36px 0 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2345454d' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: var(--text); appearance: none; -webkit-appearance: none;
}

/* Themen */
.view-overview { margin: 0 0 8px; }
.catbar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 6px;
}
.catbar::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 16px;
  font: inherit; font-weight: 600; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
}
.cat:hover { background: var(--surface-3); }
.cat.active { background: var(--text); color: var(--surface); border-color: var(--text); }
/* Gespeicherte Ansicht aus der Adresse lädt noch: Startansicht („Ganz Duisburg“, „Heute“, Zeitraum „Alle“) nicht als gewählt zeigen. */
.restore-pending #catbar .cat.active,
.restore-pending #btn-ganz-duisburg { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.view-summary { margin: 4px 0 0; color: var(--muted); }

/* Liste */
.list-card { outline: none; }
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 10px 0 2px; }
#list-title { margin: 0; font-size: var(--fs-3); font-weight: 700; }
.result-count { margin: 0; font-weight: 600; color: var(--accent-strong); }
.list-intro { margin: 2px 0 10px; color: var(--muted); }
.can-do { margin: 0; }

.object-list { display: block; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 2px 0 6px; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 14px; font: inherit; font-size: var(--fs-1);
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
}
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.restore-pending #timebar .time-chip.active { background: var(--surface); color: var(--text); border-color: var(--line-strong); font-weight: inherit; }

.obj-group { margin: 0 0 14px; }
.obj-group h3 {
  margin: 0 0 6px; padding: 8px 0 6px; font-size: var(--fs-2); font-weight: 700;
  border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.obj-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.obj-row {
  display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 48px;
  padding: 10px 12px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer;
}
button.obj-row:hover { border-color: var(--accent); background: var(--surface); }
.obj-row.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.obj-row .name { font-weight: 650; font-size: var(--fs-1); line-height: 1.3; overflow-wrap: anywhere; }
.obj-row .meta { font-size: var(--fs-0); color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.obj-empty { color: var(--muted); margin: 4px 0 8px; }
.obj-group[data-cat^="autobahn"] .obj-row { box-shadow: inset 4px 0 0 #1d4ed8; }
.obj-group[data-cat="sites"] .obj-row { box-shadow: inset 4px 0 0 #e85d04; }
.obj-group[data-cat="netze"] .obj-row { box-shadow: inset 4px 0 0 #f48c06; }
.obj-group[data-cat="markets"] .obj-row { box-shadow: inset 4px 0 0 #b45309; }
.obj-group[data-cat="listings"] .obj-row { box-shadow: inset 4px 0 0 #db2777; }
.obj-group .obj-row.active { box-shadow: inset 4px 0 0 var(--accent); }

.theme-skeleton { display: grid; gap: 6px; margin: 4px 0 12px; }
.theme-skeleton-row { height: 48px; border-radius: var(--radius-s); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 45%, var(--surface-3) 90%); background-size: 220% 100%; animation: skel .9s ease-in-out infinite; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .theme-skeleton-row { animation: none; } .sidebar { transition: none; } }

/* Kennzahlen */
.kontext-panel {
  margin: 0 0 14px; padding: 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line);
}
.kontext-title { margin: 0 0 4px; font-size: var(--fs-2); }
.kontext-place { margin: 0 0 6px; color: var(--muted); }
.kontext-empty { margin: 0; color: var(--muted); }
.kontext-mode { display: none; }
body[data-cat="today"] .kontext-mode[data-theme~="today"],
body[data-cat="harbour"] .kontext-mode[data-theme~="harbour"],
body[data-cat="economy"] .kontext-mode[data-theme~="economy"],
body[data-cat="nature"] .kontext-mode[data-theme~="nature"],
body[data-cat="traffic"] .kontext-mode[data-theme~="traffic"],
body[data-cat="housing"] .kontext-mode[data-theme~="housing"],
body[data-cat="politics"] .kontext-mode[data-theme~="politics"],
body[data-cat="everyday"] .kontext-mode[data-theme~="everyday"],
body[data-cat="all"] .kontext-mode[data-theme~="all"] { display: block; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 0; }
.kpi-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; min-width: 0; }
.kpi-grid dt { font-size: var(--fs-0); color: var(--muted); font-weight: 600; }
.kpi-grid dd { margin: 2px 0 0; font-size: var(--fs-2); font-weight: 700; overflow-wrap: anywhere; line-height: 1.25; }
.kpi-grain { font-weight: 400; }
.kontext-grain-band { margin: 10px 0 0; font-size: var(--fs-0); font-weight: 700; color: var(--muted); }
.kontext-grain-hint { font-weight: 400; }
.kontext-sources { margin-top: 8px; }
.kontext-sources summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--accent); }
.kontext-meta { margin: 4px 0 0; font-size: var(--fs-0); color: var(--muted); overflow-wrap: anywhere; }

/* Legende auf der Karte */
.map-legend {
  position: absolute; left: 10px; top: 10px; z-index: 10;
  max-width: min(320px, calc(100% - 80px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow);
}
.map-legend summary { min-height: var(--tap); padding: 0 14px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.tafel-legend { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.tafel-legend li { display: none; align-items: center; gap: 8px; font-size: var(--fs-0); }
body[data-cat="today"] .tafel-legend li[data-theme~="today"],
body[data-cat="harbour"] .tafel-legend li[data-theme~="harbour"],
body[data-cat="economy"] .tafel-legend li[data-theme~="economy"],
body[data-cat="nature"] .tafel-legend li[data-theme~="nature"],
body[data-cat="traffic"] .tafel-legend li[data-theme~="traffic"],
body[data-cat="housing"] .tafel-legend li[data-theme~="housing"],
body[data-cat="politics"] .tafel-legend li[data-theme~="politics"],
body[data-cat="everyday"] .tafel-legend li[data-theme~="everyday"],
body[data-cat="all"] .tafel-legend li[data-theme~="all"] { display: flex; }
.swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.swatch.band { width: 22px; height: 7px; border-radius: 999px; }
.swatch.band.thick { width: 24px; height: 10px; }
.swatch.dash { background-image: repeating-linear-gradient(90deg, transparent 0 4px, rgba(255,255,255,.75) 4px 7px); }
.swatch.outline { background: rgba(29, 78, 216, .15); border: 2px solid #1d4ed8; }

.loading {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 15;
  background: var(--surface); color: var(--text); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 600;
}
.loading.hidden { display: none; }

/* Details */
.detail-slot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 45;
  max-height: 78%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-top-left-radius: 16px; border-top-right-radius: 16px;
  box-shadow: 0 -6px 28px rgba(20, 20, 30, .25);
  padding: 4px 16px 20px;
}
.details-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; background: var(--surface); padding: 6px 0; z-index: 1; }
.details-heading { margin: 0; font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
#details h3 { margin: 4px 0 6px; font-size: var(--fs-3); }
#details dl { margin: 0; display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: 6px 14px; }
#details dt { font-size: var(--fs-0); color: var(--muted); font-weight: 600; padding-top: 2px; }
#details dd { margin: 0; font-size: var(--fs-1); overflow-wrap: anywhere; }
#details .placeholder { color: var(--muted); }
#details .badge { display: inline-block; font-size: var(--fs-0); font-weight: 700; padding: 2px 10px; border-radius: 999px; color: #fff; background: #44403c; }
.badge.live { background: #b4410a; } .badge.planned { background: #6a24a8; } .badge.tree { background: #2d6a4f; }
.badge.play { background: #0f766e; } .badge.heat { background: #b42302; } .badge.district { background: #44403c; }
.badge.housing { background: #6d28d9; } .badge.listing { background: #be185d; } .badge.school { background: #0369a1; }
.badge.market { background: #92400e; } .badge.harbour { background: #1e3a5f; } .badge.jobs { background: #0369a1; }
.badge.unemployed { background: #9a3412; } .badge.sites { background: #92400e; } .badge.universities { background: #6d28d9; }
.badge.autobahn { background: #1d4ed8; } .badge.autobahn-closure { background: #b91c1c; } .badge.news { background: #92400e; }

/* Schichten */
.panel-left {
  display: none; position: absolute; inset: 0; z-index: 55;
  background: var(--surface); overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 24px;
}
.panel-left.is-open { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-left h2 { font-size: var(--fs-2); margin: 4px 0 8px; }
.panel-left .card { margin-bottom: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: var(--tap); border-bottom: 1px solid var(--surface-3); cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.hint { color: var(--muted); }
.legend ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; }

/* Fuß */
.footer { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-0); }
.footer-legal a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* MapLibre */
.maplibregl-ctrl-group button { width: var(--tap) !important; height: var(--tap) !important; }
.maplibregl-ctrl-top-right { top: 6px; right: 6px; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(min(var(--sheet-visible), var(--sheet-peek)) + 4px); transition: bottom .22s ease; }
.maplibregl-ctrl-attrib { font-size: 12px; }
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 24px; }
/* Quellen-Knopf „i“: sichtbar wie bisher 28 × 28, Trefferfläche 44 × 44 (unsichtbarer Rand von 8 Pixeln ringsum).
   Das Element selbst ist 44 × 44 und durchsichtig; Kreis und Symbol zeichnet ::before an der alten Stelle. */
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button {
  width: 44px; height: 44px; top: -8px; right: -8px;
  background-color: transparent; background-size: 0 0; border-radius: 0;
}
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button, .maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button { left: -8px; right: auto; }
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button::before {
  content: ""; position: absolute; inset: 8px; border-radius: 12px;
  background-color: hsla(0, 0%, 100%, .5); background-image: inherit;
}
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button { background-color: transparent; }
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button::before { background-color: rgba(0, 0, 0, .05); }
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button:focus { box-shadow: none; }
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button:focus::before { box-shadow: 0 0 2px 2px #0096ff; }

/* ---------- Tablet: 640 px und breiter ---------- */
@media (min-width: 640px) {
  .appbar { padding: 8px 16px 6px; }
  .brand-text { display: flex; }
  .radio-more { display: inline-flex; }
  .newsbar { padding: 4px 16px 10px; }
  .newsbar-scroll { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .newsbar-scroll .news-card:nth-child(n+4) { display: none; }
  .news-card { flex-direction: row; padding: 8px 12px; min-height: 0; }
  .news-card .news-title { -webkit-line-clamp: 2; }
  .sidebar-scroll { padding: 0 16px 24px; }
}
@media (max-width: 639px) {
  :root { --sheet-peek: 112px; }
  .newsbar-scroll .news-card:nth-child(n+4) { display: none; }
  .newsbar { padding: 0 12px 6px; }
  .newsbar-head { min-height: 32px; }
  .news-card { padding: 5px 10px; }
  .news-card > strong { display: none; }
  .news-card .ticker-when { flex: 0 1 auto; }
  .news-card .news-source, .news-card .news-source-link { flex: 1 1 0; min-width: 6em; }
  .stand-line { margin-top: 2px; row-gap: 2px; }
  .stand-label-long, .fresh-detail { display: none; }
  .map-freshness-chip { padding: 0 8px; }
  .sheet-handle { min-height: 44px; padding: 4px 0 0; }
  .btn-layers { padding: 0; width: var(--tap); justify-content: center; }
  .btn-layers-long { display: none; }
  .btn-layers-icon { display: block; }
}

/* ---------- Desktop: 1024 px und breiter ---------- */
@media (min-width: 1024px) {
  :root { --sheet-visible: 0px; }
  .appbar { padding: 6px 20px; }
  .appbar { display: flex; align-items: center; gap: 16px; }
  .appbar-row { flex: 1 1 auto; gap: 16px; }
  .search-cluster { max-width: 560px; }
  .top-actions { margin-left: auto; }
  .stand-line { order: 0; margin: 0; flex: 0 1 auto; max-width: 360px; }
  .appbar-row .top-actions { order: 2; }
  .newsbar { padding: 6px 20px; display: flex; gap: 12px; align-items: stretch; }
  .newsbar-head { flex: 0 0 auto; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-height: 0; }
  .newsbar-scroll { flex: 1 1 auto; min-width: 0; }
  .news-card { padding: 4px 10px; }
  .newsbar-head { min-height: 32px; }
  .newsbar-scroll { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .newsbar-scroll .news-card:nth-child(4) { display: flex; }
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .sidebar {
    position: relative; inset: auto; height: auto !important; z-index: 5;
    border-radius: 0; box-shadow: none; border-right: 1px solid var(--line);
    grid-column: 1; grid-row: 1; transition: none;
  }
  .sheet-handle { display: none; }
  .sidebar-scroll { overflow-y: auto !important; padding: 14px 20px 24px; }
  .catbar { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0 0 4px; }
  .filters { flex-wrap: wrap; overflow: visible; margin: 0 0 10px; padding: 0; }
  .mapwrap { position: relative; inset: auto; grid-column: 2; grid-row: 1; }
  .detail-slot {
    left: auto; right: 62px; top: 10px; bottom: auto; width: min(420px, calc(100% - 84px));
    max-height: calc(100% - 20px); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  }
  .panel-left { inset: 0 auto 0 auto; left: var(--sidebar-w); width: 380px; border-right: 1px solid var(--line); box-shadow: var(--shadow); }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 0; }
}
@media (min-width: 1440px) {
  .newsbar-scroll { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .newsbar-scroll .news-card:nth-child(5) { display: flex; }
}
@media (min-width: 1440px) { :root { --sidebar-w: 460px; } }

/* Nachricht im Detail: Zeit, Stadtteil, Quelle direkt unter dem Titel */
.news-detail-meta { margin: 4px 0 10px; font-size: var(--fs-1); color: var(--muted); }
.news-detail-meta a { font-weight: 600; }

/* ---------- Stufe-1-Fixes: Suche, Vorschlag, Sheet, Quellen ---------- */
#list-search { padding: 0 10px 0 36px; }
.search-icon { left: 10px; }
/* Löschen-Knopf nur, wenn etwas im Feld steht */
#list-search:placeholder-shown::-webkit-search-cancel-button { display: none; }
#list-search::-webkit-search-cancel-button { cursor: pointer; }
.search-geocode-status {
  display: flex; align-items: center; min-height: var(--tap);
  font-size: var(--fs-1); line-height: 1.35; overflow-wrap: anywhere;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  padding: 11px 12px;
}
.search-geocode-status[hidden] { display: none; }
/* Detail-Quelle: 44 Pixel Tippfläche */
.news-detail-meta a, #details dd a { display: inline-flex; align-items: center; min-height: var(--tap); }
.news-card .news-source { white-space: normal; overflow: visible; text-overflow: clip; }
.sheet-count { display: none; }
.radio-play-text { display: none; }

@media (max-width: 1023px) {
  /* Vorschlagsbox über die volle Breite der Kopfzeile, damit sie in eine Zeile passt */
  .search-cluster, .search-wrap { position: static; }
  .search-geocode-status { left: 8px; right: 8px; top: calc(100% - 4px); }
  /* Themen als eine wischbare Zeile */
  .catbar {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    margin: 0 -12px; padding: 2px 12px 6px; scrollbar-width: none;
  }
  /* Trefferzahl in der Kopfzeile des Sheets */
  .sheet-count { display: block; margin: 0; padding: 0 12px 4px; text-align: center; font-weight: 600; color: var(--accent-strong); }
  .sheet-count[hidden] { display: none; }
  .list-head .result-count {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  /* Nachrichtenleiste klappt ein, wenn die Liste aufgezogen ist – außer im Leer-Zustand (halb offen, damit
     „Zeitraum: Alle" im Bild ist): dann bleiben die Meldungen stehen, statt nur die Überschrift zu zeigen. */
  body[data-sheet="half"]:not(.list-empty) .newsbar-scroll, body[data-sheet="full"] .newsbar-scroll { display: none; }
  body[data-sheet="half"]:not(.list-empty) .newsbar, body[data-sheet="full"] .newsbar { padding-bottom: 2px; }
}
@media (max-width: 639px) {
  :root { --sheet-peek: 136px; }
  .news-card .news-title { -webkit-line-clamp: 2; }
  .news-card .news-source { flex: 1 1 auto; min-width: 0; }
  /* Radio mit sichtbarer Beschriftung */
  .radio-play { width: auto; padding: 0 12px; border-radius: 999px; gap: 6px; }
  .radio-play-text { display: inline; font-weight: 700; }
}
@media (max-width: 639px) {
  /* Platz für den ganzen Platzhalter "Ort oder Thema": Lupe aus, schmalere Abstände */
  .appbar-row, .top-actions { gap: 6px; }
  .search-icon { display: none; }
  #list-search { padding: 0 12px; }
  .radio-play { padding: 0 10px; gap: 5px; }
}
/* Erklärung kurz (2 Zeilen), Kennzahlen eingeklappt; Knopf klappt beides auf */
.list-card:not(.context-open) .list-intro {
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; margin-bottom: 2px;
}
.list-card:not(.context-open) .kontext-panel { display: none; }
.context-toggle {
  display: inline-flex; align-items: center; min-height: var(--tap); margin: 0 0 8px; padding: 0;
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline;
}
.skip-link { min-height: var(--tap); }
@media (min-width: 1024px) {
  /* Desktop: Unterfilter als eine Zeile, Themen-Erklärung mit eingeklappt, damit ein Eintrag ohne Scrollen sichtbar ist */
  .list-card .filters { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding: 0 0 6px; }
  .sidebar:not(.context-open) .view-summary { display: none; }
  .list-card:not(.context-open) .list-intro { -webkit-line-clamp: 1; }
  .list-head { margin-top: 6px; }
  .sidebar-scroll { padding-top: 8px; }
  .view-overview { margin-bottom: 4px; }
}
@media (max-width: 639px) {
  /* Zwei Meldungen am Handy (Titel bis zu zwei Zeilen), alle weiteren unter "Alle Nachrichten" */
  .newsbar-scroll .news-card:nth-child(n+3) { display: none; }
}

/* ---------- Stufe 1, Commit C: Details im Sheet, kurzer Ortshinweis ---------- */
/* Unter 1024 Pixel liegen die Details im Sheet (ui.js verschiebt den Knoten). Das Sheet geht
   beim Öffnen auf halb; die Karte darüber bleibt frei, damit der Ort zu sehen ist. */
@media (max-width: 1023px) {
  .sidebar > .detail-slot {
    position: static; flex: 1 1 auto; min-height: 0; max-height: none;
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 0; box-shadow: none; z-index: auto;
    padding: 0 16px;
    /* Durchsichtig, Weiß kommt vom Sheet: Deckende scrollende oder klebende Flächen über der
       WebGL-Karte ließ Chromium die Karte als verdeckt wegschneiden (graue Fläche). */
    background: transparent;
  }
  .sidebar > .detail-slot[hidden] { display: none; }
  /* Kopfzeile mit "Schließen" bleibt stehen, nur der Inhalt scrollt. Auch sie ohne eigene
     Hintergrundfarbe (sonst wieder ein grauer Streifen über dem Sheet). */
  .sidebar > .detail-slot > .details-toolbar { position: static; flex: 0 0 auto; background: transparent; }
  .sidebar > .detail-slot > #details {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding-bottom: 20px;
  }
  body.details-open[data-sheet="peek"] .sidebar > .detail-slot > #details { overflow: hidden; }
  body.details-open .sidebar > .sheet-count,
  body.details-open .sidebar > .sidebar-scroll { display: none; }
}
/* Ortshinweis unter der Suche: am Desktop so breit wie der Text (eine Zeile), höchstens 560 Pixel. */
@media (min-width: 1024px) {
  .search-geocode-status { right: auto; width: max-content; min-width: calc(100% - 24px); max-width: 560px; }
}
/* Stufe 6: Einzelwort-Suche. Erst "Stichwort: …", darunter der Ort als Vorschlag-Knopf (44 Pixel, 16 Pixel Schrift).
   Der Hinweis steht nicht mehr im label des Suchfelds, damit der Knopf kein Teil der Feldbeschriftung ist. */
.search-geocode-status[data-suggest] {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  -webkit-line-clamp: none; overflow: visible; padding-bottom: 4px;
}
.search-place-suggest {
  display: flex; align-items: center; min-height: var(--tap);
  margin: 0 -8px; padding: 0 8px; width: calc(100% + 16px);
  font: inherit; font-size: var(--fs-1); font-weight: 600; text-align: left; line-height: 1.3;
  color: var(--text); background: transparent; border: 0; border-radius: var(--radius-s);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere;
}
.search-place-suggest:hover { background: var(--surface-2); }

/* ---------- Stufe 2, Schritt 1: keine Überhöhe ---------- */
/* Die unsichtbare Trefferzahl (1 Pixel, absolut positioniert) richtet sich am Listenbereich aus,
   nicht mehr an der Seite. Vorher machte sie die Seite am Handy und Tablet höher als den Bildschirm. */
.sidebar-scroll { position: relative; }

/* ---------- Stufe 2, Schritt 4: Quelle je Zeile, Leer-Zustand ---------- */
.obj-row .src { font-size: 16px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.empty-state {
  margin: 8px 0 12px; padding: 12px 14px; border-radius: var(--radius-s);
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid rgba(107, 65, 0, .25);
}
.empty-state-text { margin: 0 0 8px; font-weight: 600; font-size: var(--fs-1); }
.empty-state-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-state-actions .btn { background: var(--surface); color: var(--text); }

/* ---------- Stufe 2, Schritt 5: Zeitraum, Alles zurücksetzen ---------- */
.timebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 2px; }
.timebar-label { font-weight: 600; margin-right: 4px; }
.timebar-hint { margin: 2px 0 4px; font-size: 16px; color: var(--muted); }
.btn-reset-all { margin-left: auto; }
@media (min-width: 1024px) {
  /* Desktop: Zeitraum in einer Zeile, damit die Liste nicht weiter nach unten rutscht */
  .timebar { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 2px 0 0; gap: 4px; }
  .timebar .chip { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
}

/* ---------- Stufe 2, Korrektur: erster Eintrag am Desktop ohne Scrollen, Leer-Zustand am Handy ---------- */
@media (min-width: 1024px) {
  /* Kleinere Abstände über dem ersten Eintrag (Tippflächen bleiben 44 Pixel, Schrift 16 Pixel) */
  .context-toggle { margin-bottom: 2px; }
  .list-card .filters { margin-bottom: 2px; }
  .obj-group h3 { padding: 4px 0 4px; margin-bottom: 4px; }
}
@media (max-width: 1023px) {
  /* Zeitraum in einer Zeile neben der Beschriftung */
  .timebar { flex-wrap: nowrap; gap: 4px; }
  .timebar .chip { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
  .timebar-label { margin-right: 2px; }
}
@media (max-width: 1023px) {
  /* Leer-Zustand oben im Sheet: schmaler Abstand nach oben */
  .sidebar-scroll > .empty-state { margin: 0 0 10px; }
}

/* ---------- Stufe 2 (b): Quelle der Meldung, Wort und Link in einer Zeile ---------- */
.news-detail-meta:has(+ .news-detail-src) { margin-bottom: 0; }
.news-detail-src {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin: 0 0 10px;
  font-size: var(--fs-1); color: var(--muted);
}
.news-detail-src-label { flex: 0 0 auto; }
.news-detail-src a {
  flex: 0 1 auto; min-width: var(--tap); min-height: var(--tap); display: inline-flex; align-items: center;
  font-weight: 600; overflow-wrap: anywhere;
}

/* ---------- Stufe 2 (c): Detailkarte am Desktop mit 16 Pixel Abstand zu den Zoomknöpfen ---------- */
/* Zoomknöpfe: 16 Pixel vom rechten Rand, 44 Pixel breit = 60 Pixel; dazu 16 Pixel Abstand = 76 Pixel. */
@media (min-width: 1024px) {
  .detail-slot { right: 76px; width: min(420px, calc(100% - 92px)); }
}

/* ---------- Stufe 2 (e): „Alle Themen“ und „Zeitraum: Alle“ sichtbar beschriftet ---------- */
/* Der Zeitraum steht wieder in einer eigenen Zeile mit sichtbarer Beschriftung. Damit der erste Eintrag
   bei 1280×800 trotzdem sichtbar bleibt, steht der Knopf „Kennzahlen zeigen“ am Desktop neben der
   Listenüberschrift, und die einzeilige Erklärung erscheint erst nach dem Aufklappen. */
.context-toggle .ct-short { display: none; }
@media (min-width: 1024px) {
  .list-head .context-toggle { margin: 0 0 0 auto; }
  .list-head .context-toggle .ct-long { display: none; }
  .list-head .context-toggle .ct-short { display: inline; }
  .list-head { align-items: center; }
  .list-card:not(.context-open) .list-intro { display: none; }
}

/* ---------- Stufe 2, Korrektur 3: "Alles zurücksetzen" am Handy und Tablet immer im Bild ---------- */
@media (max-width: 1023px) {
  /* Steht oben rechts im Sheet, in der Zeile des Griffs; der Inhalt darunter scrollt. */
  .sidebar > .btn-reset-all {
    position: absolute; top: 0; right: 8px; z-index: 2; margin: 0;
    min-height: var(--tap); background: var(--surface);
  }
  .sidebar > .btn-reset-all[hidden] { display: none; }
  /* Griff-Text weicht nach links aus, damit er nicht unter dem Knopf liegt. */
  .sidebar:has(> .btn-reset-all:not([hidden])) > .sheet-handle { padding-right: 184px; }
  /* Bei offenen Details hat die Kopfzeile "Schließen"; dort kein zweiter Knopf darüber. */
  body.details-open .sidebar > .btn-reset-all { display: none; }
}

/* ---------- Stufe 2, Korrektur 3: jeder Link mindestens 44 × 44 Pixel ---------- */
/* Kurze Quellennamen (z. B. "Verdi") bekommen eine Tippfläche von mindestens 44 Pixel Breite. */
#details a, .news-detail-src a, .news-detail-meta a { display: inline-flex; align-items: center; min-height: var(--tap); min-width: var(--tap); }

/* ---------- Stufe 3: Nachrichtenleiste am Handy ---------- */
/* Drei Meldungen stehen untereinander und sind ohne Wischen ganz zu sehen (Titel eine Zeile).
   Die weiteren liegen rechts daneben: seitlich wischen oder mit der Tabulatortaste hinspringen.
   Ein schmaler Rand der nächsten Spalte zeigt, dass es weitergeht. Die Seite selbst scrollt nicht seitlich. */
@media (max-width: 639px) {
  .newsbar-scroll {
    display: grid; grid-auto-flow: column; grid-template-columns: none;
    grid-template-rows: repeat(3, auto); grid-auto-columns: calc(100% - 28px);
    column-gap: 10px; row-gap: 6px;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding: 0 12px; scrollbar-width: none;
    margin: 0 -12px; padding: 0 12px;
  }
  .newsbar-scroll::-webkit-scrollbar { display: none; }
  /* 3 Pixel mehr Abstand unten: Die Leiste bleibt so hoch wie vorher, die Karte behält 534 Pixel. */
  .newsbar { padding-bottom: 9px; }
  .newsbar-scroll .news-card:nth-child(n) { display: flex; }
  .newsbar-scroll .news-card[hidden] { display: none; }
  .newsbar-scroll .news-card:nth-child(3n+1) { scroll-snap-align: start; }
  .news-card .news-title { -webkit-line-clamp: 1; }
  /* Zeit und Quelle in einer Zeile; eine lange Quelle wird mit „…" gekürzt (ganz in der Meldung). */
  .news-card { flex-wrap: wrap; }
  .news-card .ticker-when { flex: 0 0 auto; }
  .news-card .news-source, .news-card .news-source-link { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
