:root {
  --bg: #0f1720;
  --panel: #17222e;
  --panel-2: #1c2a38;
  --border: #29394a;
  --text: #eef3f8;
  --text-dim: #9fb0c0;
  --accent: #ff7a1a;
  --accent-2: #a855f7;
  --ok: #35d07f;
  --warn: #ffb020;
  --err: #ff5a5a;
  --ridden: #a855f7;
  --planned: #d8b4fe;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* Author-Stylesheets überschreiben das UA-Standardverhalten von [hidden]
   (display:none), sobald eine Klassenregel für dasselbe Element ebenfalls
   `display` setzt (z.B. .battery-indicator, .movement-indicator, .sidebar)
   - unabhängig von der Spezifität gewinnt das Autoren-CSS. Diese Regel stellt
   das erwartete Verhalten global sicher, damit `element.hidden = true` per
   JS überall zuverlässig wirkt. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-wrap: wrap;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-title h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 600;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Viewer-Kopfzeile (index.html): dreispaltiges Layout - links Status/
   Batterie, Mitte Eventname + Kennzahlen zentriert, rechts Bewegung/letztes
   Update. Eigene Modifier-Klasse statt einer Änderung an .topbar selbst,
   damit admin.html (nutzt weiterhin die einfache .topbar-title-Variante
   ohne Zentrierung) unberührt bleibt. */
.topbar-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}
.topbar-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-left { justify-self: start; }
.topbar-viewer .topbar-meta { justify-self: end; }
.topbar-center {
  justify-self: center;
  text-align: center;
  min-width: 0;
  max-width: 100%;
}
.topbar-center h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
  margin-left: auto;
  margin-right: auto;
}

/* Event-Kennzahlen (Gesamtstrecke/Höhenmeter/Zeitlimit) - direkt unter dem
   Eventnamen, zentriert */
.event-meta-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.meta-sep { color: var(--border); }

@media (max-width: 780px) {
  .topbar-viewer {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 6px;
  }
  .topbar-left,
  .topbar-viewer .topbar-meta,
  .topbar-center {
    justify-self: center;
  }
  .topbar-center h1 { max-width: 90vw; font-size: 1.25rem; }
}

/* Banner für "Start steht noch aus" / "Ziel erreicht" */
.race-status-banner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
.race-status-banner.pending { background: rgba(255, 176, 32, 0.12); color: var(--warn); }
.race-status-banner.finished { background: rgba(53, 208, 127, 0.12); color: var(--ok); }

.badge {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-live { background: rgba(53, 208, 127, 0.15); color: var(--ok); }
.badge-idle { background: rgba(255, 176, 32, 0.15); color: var(--warn); }
.badge-offline { background: rgba(255, 90, 90, 0.15); color: var(--err); }
.badge-unknown { background: rgba(159, 176, 192, 0.15); color: var(--text-dim); }

/* Bewegungszustand (Play/Stop) in der Kopfzeile */
.movement-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.movement-indicator.moving { background: rgba(53, 208, 127, 0.15); color: var(--ok); }
.movement-indicator.paused { background: rgba(255, 90, 90, 0.15); color: var(--err); }

/* Batteriestand des Trackers */
.battery-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}
.battery-icon {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 12px;
  border: 1.5px solid var(--text-dim);
  border-radius: 3px;
  padding: 1.5px;
}
.battery-icon::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 3px;
  width: 2.5px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 0 2px 2px 0;
}
.battery-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 1px;
  background: var(--text-dim);
  transition: width 0.4s ease, background 0.4s ease;
}
.battery-pct-text { font-variant-numeric: tabular-nums; }

.btn-icon {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-icon:hover { border-color: var(--accent-2); }
.btn-icon.active { background: var(--accent-2); color: #06202e; border-color: var(--accent-2); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon:disabled:hover { border-color: var(--border); }

/* ---------- Layout: linke Sidebar (Wetter/Wind) / Hauptbereich / rechte Sidebar (Kontrollstellen) ---------- */

.app-layout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  max-width: 1520px;
  margin: 0 auto;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.8rem;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.sidebar-right {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

@media (max-width: 1180px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex: none; position: static; max-height: none; }
  .sidebar .widget { flex: 1; }
}
@media (max-width: 640px) {
  .sidebar { flex-direction: column; }
}

/* Wetter-/Wind-Widgets */
.widget {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.widget-title {
  font-size: 0.72rem;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 600;
}
.widget-body {
  display: flex;
  align-items: center;
  gap: 12px;
}
.weather-icon { font-size: 2.1rem; line-height: 1; }
.weather-info { display: flex; flex-direction: column; gap: 2px; }
.weather-temp { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.weather-label { font-size: 0.78rem; color: var(--text-dim); }

/* Unterteilung eines Widgets in mehrere Bereiche (z.B. "Aktuelles Wetter" +
   "Wettervorhersage", oder "Windrichtung" + "Fahrtrichtung") */
.widget-subsection + .widget-subsection {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.widget-subtitle {
  font-size: 0.66rem;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-weight: 600;
}

/* 6-Stunden-Wettervorhersage: horizontale, bei Bedarf scrollbare Reihe */
.forecast-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: var(--text-dim);
  flex: 0 0 auto;
  min-width: 34px;
}
.forecast-item .forecast-icon { font-size: 1.15rem; line-height: 1; }
.forecast-item .forecast-temp {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}
.forecast-empty { font-size: 0.78rem; color: var(--text-dim); }

.wind-compass {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.wind-compass-ring {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--panel-2);
}
.wind-compass-n {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-dim);
  font-weight: 700;
}
.wind-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  font-size: 1.3rem;
  color: var(--accent-2);
  line-height: 1;
  transition: transform 0.4s ease;
}
.wind-info { display: flex; flex-direction: column; gap: 2px; }
.wind-speed { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wind-dir { font-size: 0.78rem; color: var(--text-dim); }

/* Fahrtrichtung: gleicher Kompass wie Windrichtung, aber mit einem
   Radfahrer-von-oben-Symbol (Vorderrad/Kopf zeigt in Fahrtrichtung) statt
   einer Pfeil-Glyphe - Farben sind direkt im SVG-Markup gesetzt (Lila-/
   Violetttöne, siehe public/index.html), daher hier nur die Größe. */
.travel-arrow-icon {
  width: 22px;
  height: 22px;
  display: block;
}

/* Rückenwind/Seitenwind/Gegenwind-Einordnung (vergleicht Fahrt- mit
   Windrichtung) - bewusst in denselben Lila-/Violetttönen wie der Rest der
   Oberfläche gehalten (nur die Intensität variiert je nach Einordnung),
   statt der zuvor gelb/rot/grünen Ampelfarben. */
.wind-classification {
  margin-top: 10px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--text-dim);
  background: var(--panel-2);
}
.wind-classification.wind-cls-head { color: #e2c8ff; background: rgba(168, 85, 247, 0.32); }
.wind-classification.wind-cls-cross { color: #d8b4fe; background: rgba(168, 85, 247, 0.18); }
.wind-classification.wind-cls-tail { color: var(--accent-2); background: rgba(168, 85, 247, 0.08); }

/* ---------- Ein-/ausklappbare Bereiche (Aktuelle Werte / Auswertung / Höhenprofil) ---------- */

.collapsible-section {
  background: transparent;
}
.section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.section-header-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.chevron {
  color: var(--text-dim);
  transition: transform 0.2s ease;
  font-size: 0.9rem;
}
.collapsible-section.collapsed .chevron { transform: rotate(-90deg); }

/* Dezente violette Einfärbung, solange ein Bereich aufgeklappt ("ausgewählt") ist */
.collapsible-section:not(.collapsed) .section-header {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.45);
}
.section-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.collapsible-section.collapsed .section-body { display: none; }

#map {
  height: 52vh;
  min-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 0 2px;
}

/* Umschalter Satellit/Karte für den Untergrund der 3D-Ansicht - als
   MapLibre-Kartensteuerelement rechts unter dem Zoom-Regler platziert (siehe
   TerrainBaseControl in viewer.js), nur sichtbar solange 3D aktiv ist. Reine
   Icon-Knöpfe, ausgewählt = lila hinterlegt, nicht ausgewählt = blass -
   dieselbe Aktiv/Inaktiv-Sprache wie bei den übrigen .btn-icon-Knöpfen. */
.terrain-base-ctrl {
  display: flex;
  flex-direction: column;
}
.terrain-base-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
}
.terrain-base-btn:hover {
  opacity: 0.85;
}
.terrain-base-btn.active {
  opacity: 1;
  background: var(--accent-2);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.stacked {
  text-align: center;
  line-height: 1.35;
}

.stat-value-sep {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gmaps-segments-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gmaps-segment-btn.active {
  background: var(--accent-2);
  color: #06202e;
  border-color: var(--accent-2);
  font-weight: 700;
}

.profile-panel .section-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 640px) {
  .chart-container { height: 190px; }
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-mode-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.profile-mode-buttons .btn-icon {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.legend span { display: flex; align-items: center; gap: 6px; }

.swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.swatch-planned { background: var(--planned); }
.swatch-ridden { background: var(--ridden); }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 1rem;
}

/* Passwort-Sperre für Zuschauer-Events mit gesetztem Zuschauer-Passwort
   (siehe server/auth.js, routes/public.js) - deckt die ganze Seite ab, bis
   ein gültiges Passwort eingegeben wurde. */
.password-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.password-gate-box {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.password-gate-box h2 { margin: 0; font-size: 1.2rem; }
.password-gate-box p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.password-gate-box input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}
.password-gate-box button {
  background: var(--accent-2);
  color: #06202e;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.password-gate-box button:hover { filter: brightness(1.08); }
.password-gate-error { color: #ff6b6b !important; font-size: 0.85rem; }

/* MapLibre Popups/Controls im Dark Theme lesbar halten */
.maplibregl-popup-content {
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.82rem;
  padding: 6px 10px;
}
.maplibregl-popup-tip { border-top-color: var(--panel-2) !important; border-bottom-color: var(--panel-2) !important; }
.maplibregl-ctrl-attrib { font-size: 0.68rem; }
.maplibregl-ctrl-scale {
  background: rgba(23, 34, 46, 0.85);
  border-color: var(--text-dim);
  color: var(--text);
  font-size: 0.7rem;
}

/* Kilometer-Marker auf der geplanten Strecke (alle 25 km) */
.km-marker-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--accent-2);
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* "Start"/"Ziel"-Marker an den Enden der geplanten Strecke: Kreis mit Karomuster */
.start-finish-marker-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.start-finish-marker-icon.start {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #1fae63 25%, transparent 25%, transparent 75%, #1fae63 75%, #1fae63),
    linear-gradient(45deg, #1fae63 25%, transparent 25%, transparent 75%, #1fae63 75%, #1fae63);
  background-size: 13px 13px;
  background-position: 0 0, 6.5px 6.5px;
}
.start-finish-marker-icon.finish {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #e34343 25%, transparent 25%, transparent 75%, #e34343 75%, #e34343),
    linear-gradient(45deg, #e34343 25%, transparent 25%, transparent 75%, #e34343 75%, #e34343);
  background-size: 13px 13px;
  background-position: 0 0, 6.5px 6.5px;
}

/* Richtungspfeile alle 5 km auf der geplanten Strecke - Pfeilspitze vorn,
   hinten mit Kerbe (SVG-Polygon statt CSS-Rand-Dreieck, damit sich die Kerbe
   sauber darstellen lässt) */
.direction-arrow-icon {
  width: 20px;
  height: 20px;
  display: block;
  overflow: visible;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.direction-arrow-icon path {
  fill: var(--planned);
}

/* Kontrollstellen (Kxx) - rot solange offen, grün sobald erreicht */
.checkpoint-marker-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  background: var(--err);
  transition: background 0.4s ease;
}
.checkpoint-marker-icon.passed { background: var(--ok); }

/* Aktuelle Live-Position - Radfahrer-von-oben-Symbol statt eines schlichten
   Punkts, Vorderrad/Kopf zeigt in die tatsächliche Fahrtrichtung (identisches
   Symbol wie beim Fahrtrichtungs-Kompass-Widget, in Lila-/Violetttönen).
   Hintergrund bewusst WEISS (statt des dunklen Panel-Tons) - auf dem dunklen
   Hintergrund ging das dunkle Violett des Rads/Rahmens optisch fast unter;
   auf Weiß hebt sich das komplette Symbol klar ab. Der Ring um den weißen
   Kreis ist violett statt orange, passend zur neuen Icon-Farbgebung. */
.current-position-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(168, 85, 247, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.current-position-bike-icon {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.4s ease;
}

/* Kontrollstellen-Checkliste (rechte Sidebar) - km-Werte rechtsbündig auf
   gleicher Spaltenbreite, damit keine "Stufen" entstehen */
.checkpoint-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.checkpoint-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
/* Bewusst bleibt beim Erreichen NUR das Kästchen grün - Name/km/Nummer
   behalten ihre normale Textfarbe, damit die Liste ruhig/lesbar bleibt. */
.cp-row {
  display: grid;
  grid-template-columns: 26px 15px 1fr auto;
  align-items: center;
  gap: 9px;
}
.checkpoint-item .cp-idx { font-weight: 700; color: var(--text-dim); }
.checkpoint-item .cp-check {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: inline-block;
  position: relative;
}
.checkpoint-item.passed .cp-check {
  background: var(--ok);
  border-color: var(--ok);
}
.checkpoint-item.passed .cp-check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: #06202e;
}
.checkpoint-item .cp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.checkpoint-item .cp-km {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 58px;
}
/* Datum/Uhrzeit des Erreichens - unter der Zeile, unter der Namensspalte ausgerichtet */
.cp-passed-at {
  padding-left: 59px;
  font-size: 0.7rem;
  color: var(--ok);
}

/* Eigenes Tooltip für Kontrollstellen-Namen (Sidebar + Karten-Marker) -
   siehe showCpNameTooltip() in viewer.js für die Begründung, warum kein
   natives title-Attribut verwendet wird. */
.cp-name-tooltip {
  position: fixed;
  z-index: 4000;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--accent-2);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.3;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 640px) {
  .stat-value { font-size: 1.15rem; }
  #map { height: 42vh; }
}
