:root {
  /* Rahmenfarben: Standard = Stahlgrau, im Dry-Ride-Modus = Blau (siehe body.dry-mode) */
  --navy: #4a5561;
  --navy-2: #5d6975;
  --green: #2fb35a;
  --green-dark: #23914a;
  --text: #f2f6f8;
  --muted: #c9d2d9;
  --time: #8fe3aa;
  --red: #e0453a;
  --card: #ffffff;
  --ink: #17232b;
  --topbar-h: 52px;
}
body.dry-mode { --navy: #16354a; --navy-2: #1f4a63; --muted: #9fb4c2; --time: var(--green); }
#topbar, #console, #sidebar { transition: background-color .25s; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--navy); color: var(--ink); }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* Topbar */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); padding-top: env(safe-area-inset-top);
  background: var(--navy); color: var(--text); display: flex; align-items: center; gap: 8px; padding-inline: 8px; z-index: 20; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 22px; width: 40px; height: 40px; border-radius: 8px; }
.icon-btn:active { background: rgba(255,255,255,.1); }
.tabs { flex: 1; display: flex; justify-content: center; gap: 6px; }
.tab { padding: 6px 14px; border-radius: 16px; font-size: 15px; }
.tab.active { background: var(--navy-2); font-weight: 600; }
.tab.disabled { color: var(--muted); border: 1px dashed var(--muted); }
.spacer { width: 40px; }

/* Map */
#map { position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; }
#mapButtons { position: fixed; top: calc(var(--topbar-h) + 12px); right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 10; }
.pill { background: var(--navy); color: var(--text); border: 0; border-radius: 20px; padding: 9px 16px; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 22px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }

/* Console */
#console { position: fixed; left: 0; right: 0; bottom: 0; background: var(--navy); color: var(--text);
  border-radius: 16px 16px 0 0; z-index: 15; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.3);
  max-height: 62vh; display: flex; flex-direction: column; }
#consoleHandle { background: none; border: 0; height: 22px; width: 100%; display: flex; justify-content: center; align-items: center; }
#consoleHandle span { width: 44px; height: 5px; border-radius: 3px; background: var(--muted); }
#consoleBody { overflow-y: auto; }
#console.collapsed #consoleBody { display: none; }
#btnProceed { flex-shrink: 0; margin-top: 4px; }

.wp-row { display: flex; align-items: center; gap: 8px; position: relative; }
.wp-tag { width: 54px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.wp-input-wrap { flex: 1; position: relative; }
.wp-input { width: 100%; padding: 10px 10px; border-radius: 8px; border: 0; font-size: 15px; background: #fff; color: var(--ink); }
.wp-time { font-size: 13px; color: var(--time); width: 44px; text-align: right; flex-shrink: 0; }
.wp-remove { width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--navy-2); color: var(--text); font-size: 18px; flex-shrink: 0; }
.wp-remove.ghost { visibility: hidden; }
.add-between { display: flex; justify-content: center; margin: 2px 0; }
.add-between button { width: 26px; height: 22px; border-radius: 6px; border: 0; background: var(--navy-2); color: var(--text); font-size: 16px; line-height: 1; }

.suggestions { position: fixed; background: #fff; color: var(--ink); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.35); z-index: 70; max-height: 220px; overflow-y: auto; }
.suggestions div { padding: 10px; font-size: 14px; border-bottom: 1px solid #eee; }
.suggestions .empty { color: #6b7d88; font-style: italic; }
.suggestions div:active, .suggestions div:hover { background: #eef6f0; }

.row.options { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0 8px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.switch input { display: none; }
.switch .slider { width: 42px; height: 24px; border-radius: 12px; background: #5b6f7c; position: relative; transition: .2s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { left: 21px; }
.starttime { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.starttime select { padding: 7px; border-radius: 8px; border: 0; font-size: 14px; }

.summary { font-size: 14px; color: var(--muted); margin: 4px 0 8px; }
.primary { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font-weight: 700; font-size: 16px; }
.primary:disabled { background: #4d6372; color: #b8c6cf; }
.primary.small { width: auto; padding: 9px 16px; font-size: 14px; }
.secondary { width: 100%; padding: 12px; border: 2px solid var(--green); border-radius: 10px; background: transparent; color: var(--green-dark); font-weight: 600; font-size: 15px; margin-top: 10px; }
.secondary:disabled { border-color: #c6d0d6; color: #9aa8b1; }
.link { background: none; border: 0; color: #557; margin-top: 12px; text-decoration: underline; }

/* Sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; }
.sheet-card { background: var(--card); width: 100%; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); text-align: center; }
.sheet-card h3 { margin: 0 0 14px; }
.hint { font-size: 13px; color: #6b7d88; margin: 10px 0 0; }

/* Sidebar */
#sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 85vw); background: var(--navy); color: var(--text); z-index: 50; padding: 12px 16px; box-shadow: 4px 0 14px rgba(0,0,0,.4); }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; }
.field { display: block; margin: 14px 0 10px; font-size: 14px; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 10px; border-radius: 8px; border: 0; font-size: 15px; }
#sidebar .hint { color: var(--muted); }
.attribution a { color: inherit; }
.attribution { position: absolute; bottom: 16px; left: 16px; right: 16px; font-size: 11px; color: var(--muted); }

/* Marker */
.mk { display: flex; flex-direction: column; align-items: center; padding-bottom: 6px; }
.mk-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.mk-pin b { transform: rotate(45deg); color: #fff; font-size: 13px; }
.mk-start .mk-pin { background: var(--green); }
.mk-stop .mk-pin { background: #2d7fd3; }
.mk-goal .mk-pin { background: var(--ink); }
.mk-time { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2d7fd3; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(45,127,211,.25); }

/* Popup Frage Ziel/Stopp */
.ask { display: flex; flex-direction: column; gap: 6px; }
.ask button { padding: 8px 12px; border-radius: 8px; border: 0; background: var(--navy); color: #fff; font-weight: 600; }

/* Toast */
#toast { position: fixed; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; max-width: 90vw; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
#toast.warn { background: var(--red); }

/* ---------- Dry Ride ---------- */
.pill.active { background: var(--green); }
#dryPanel { position: fixed; left: 0; right: 0; bottom: var(--console-h, 160px); z-index: 14; background: rgba(22,53,74,.96); color: var(--text);
  padding: 8px 14px 10px; border-radius: 14px 14px 0 0; box-shadow: 0 -2px 10px rgba(0,0,0,.25); }
.dry-head { display: flex; align-items: center; gap: 10px; }
.dry-step { width: 38px; height: 34px; border: 0; border-radius: 8px; background: var(--navy-2); color: var(--text); font-size: 15px; }
.dry-time { flex: 1; text-align: center; font-weight: 700; font-size: 17px; display: flex; flex-direction: column; }
.dry-time small { font-weight: 400; font-size: 12px; color: var(--muted); min-height: 15px; }
.dry-slider-wrap { position: relative; margin: 6px 0 16px; }
#drySlider { width: 100%; accent-color: var(--green); }
#dryTicks { position: absolute; left: 8px; right: 8px; top: 24px; height: 12px; }
#dryTicks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.dry-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); align-items: center; }
.dry-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; }
.dry-legend .src { margin-left: auto; }
.info-text { text-align: left; line-height: 1.45; margin: 0 0 12px; }
.mk-time.hit { background: var(--green); }

/* ---------- Regen-Check ---------- */
.rainbox { font-size: 13px; border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; line-height: 1.4; text-align: left; }
.rainbox ul { margin: 4px 0 0; padding-left: 18px; }
.rainbox.wet { background: #efe6f8; color: #4a2370; border-left: 4px solid #5b2a86; }
.rainbox.edge { background: #efe6f8; color: #4a2370; border-left: 4px solid #5b2a86; }
.rainbox.dry { background: #e3f6e9; color: #145c2c; border-left: 4px solid var(--green); }
.rainbox.unknown { background: #eceff1; color: #455a64; border-left: 4px solid #9aa5ad; }
.wet-title { color: #5b2a86; }
.cp-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 14px; }
.cp-bar #cpLabel { flex: 1; text-align: center; }
.cp-next { border: 0; border-radius: 8px; background: var(--green); color: #fff; font-weight: 700; padding: 8px 12px; }

/* Stunden-Marker auf der Route */
.hour-mk { cursor: pointer; position: relative; width: 14px; height: 14px; }
.hour-mk i { position: absolute; inset: 0; border-radius: 50%; background: #ffd84d; border: 3px solid var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.hour-mk span { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #ffd84d;
  font-size: 13px; font-weight: 800; padding: 2px 7px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.4); white-space: nowrap; }
.hour-mk:hover span { background: #000; }


/* ---------- Navigation ---------- */
body.navigating #topbar, body.navigating #console, body.navigating #mapButtons, body.navigating #dryPanel { display: none !important; }
body.navigating #map { top: 0; }
body.navigating .maplibregl-ctrl-bottom-right { bottom: 110px; }
#navTop { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; gap: 12px; align-items: center;
  background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 12px; box-shadow: 0 3px 12px rgba(0,0,0,.35); }
#navIcon { width: 64px; height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
#navIcon svg { transition: transform .3s; }
.nav-flag { font-size: 44px; }
.nav-rb { font-size: 46px; position: relative; line-height: 1; }
.nav-rb b { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: 18px; }
.nav-main { flex: 1; min-width: 0; }
#navDist { font-size: 30px; font-weight: 800; line-height: 1.1; }
#navText { font-size: 17px; line-height: 1.25; }
#navThen { font-size: 13px; color: var(--muted); margin-top: 2px; }
#navThen:empty { display: none; }
#navCenter { position: fixed; right: 12px; bottom: 130px; z-index: 30; }
#navBottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--navy); color: #fff;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; box-shadow: 0 -3px 12px rgba(0,0,0,.3); }
.nav-row { display: flex; align-items: center; gap: 10px; }
.nav-stats { flex: 1; text-align: center; display: flex; flex-direction: column; }
.nav-stats b { font-size: 22px; }
.nav-stats > span { font-size: 14px; color: var(--muted); }
.nav-btn { border: 0; border-radius: 10px; background: var(--navy-2); color: #fff; font-size: 20px; min-width: 48px; height: 46px; padding: 0 12px; }
.nav-btn.stop { background: #5b6f7c; font-size: 15px; font-weight: 700; }
.nav-rain { font-size: 14px; font-weight: 600; border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; text-align: center; }
.nav-rain:empty { display: none; }
.nav-rain.wet { background: #efe6f8; color: #4a1675; }
.nav-rain.unknown { background: #eceff1; color: #455a64; }
.nav-rain.dry { background: #e3f6e9; color: #145c2c; }
.nav-me { width: 40px; height: 40px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.dry-legend .scale { display: inline-flex; height: 10px; border-radius: 3px; overflow: hidden; }
.dry-legend .scale i { width: 18px; height: 10px; margin: 0; border-radius: 0; }
.dry-legend .scale-lbl { text-transform: uppercase; font-size: 10px; letter-spacing: .03em; }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 6px; font-size: 15px; padding: 10px 12px; border-radius: 8px; background: var(--navy-2); }
.nav-sim { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.nav-sim .nav-btn { height: 38px; min-width: 44px; font-size: 18px; }
.nav-sim b { color: #fff; min-width: 34px; font-size: 15px; }
