:root {
  --bg: #0b1020;
  --bg2: #111833;
  --card: rgba(22, 30, 60, 0.78);
  --card-border: rgba(120, 150, 255, 0.16);
  --text: #eef2ff;
  --muted: #9aa6cc;
  --accent: #4f8cff;
  --accent2: #7b5cff;
  --jannik: #ffd23f;
  --ok: #2ed47a;
  --warn: #ffb020;
  --bad: #ff5470;
  --radius: 18px;
  --tabbar: 64px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #26306b 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #3b1f6b 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 8px);
}
h1, h2 { margin: 0; }
h1 { font-size: 1.45rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 650; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(11, 16, 32, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo { font-size: 1.7rem; filter: drop-shadow(0 0 8px rgba(255, 210, 63, .5)); }
.title { font-weight: 700; }
.sub { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 0 rgba(46, 212, 122, .7); animation: pulse 2s infinite; }
.dot.stale { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,212,122,.6);} 70% { box-shadow: 0 0 0 8px rgba(46,212,122,0);} 100% { box-shadow: 0 0 0 0 rgba(46,212,122,0);} }
.badge { font-size: .7rem; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.badge.demo { background: var(--accent2); color: #fff; }

main { max-width: 720px; margin: 0 auto; padding: 12px; }
.tab { display: none; animation: fadein .25s ease; }
.tab.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card h2 { margin-bottom: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); font-weight: 600; }

.hero { background: linear-gradient(135deg, rgba(79,140,255,.28), rgba(123,92,255,.22)), var(--card); }
.pill { padding: 5px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: rgba(255,255,255,.1); white-space: nowrap; }
.pill.running { background: rgba(46,212,122,.18); color: var(--ok); }
.pill.pre { background: rgba(255,176,32,.16); color: var(--warn); }
.pill.done { background: rgba(255,210,63,.2); color: var(--jannik); }
.bigstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.big { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.lbl { font-size: .72rem; color: var(--muted); }

.progress { position: relative; height: 14px; border-radius: 999px; background: rgba(255,255,255,.08); margin: 30px 0 30px; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2), var(--jannik)); transition: width 1s linear; }
.progress-ticks .tick { position: absolute; top: -4px; width: 2px; height: 22px; background: rgba(255,255,255,.18); }
.progress-ticks .tick span { position: absolute; top: 22px; left: -10px; font-size: .62rem; color: var(--muted); }
.progress-ticks .tick.me { background: var(--accent); width: 3px; }
.progress-ticks .tick.me span { color: var(--accent); font-weight: 800; top: -18px; left: -8px; }
.runner-dot { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: var(--jannik); color: #222; font-weight: 900; font-size: .8rem; display: grid; place-items: center; box-shadow: 0 0 0 4px rgba(255,210,63,.25), 0 0 18px rgba(255,210,63,.6); transition: left 1s linear; }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn { appearance: none; border: 1px solid var(--card-border); background: rgba(255,255,255,.06); color: var(--text); padding: 11px 14px; border-radius: 12px; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: 0; }
.btn.seen { width: 100%; justify-content: center; margin: 12px 0 6px; background: linear-gradient(135deg, #ffd23f, #ff9f1c); color: #1b1b1b; border: 0; font-size: 1.05rem; padding: 14px; }
.btn.small { padding: 7px 10px; font-size: .82rem; }
.iconbtn { background: rgba(255,255,255,.08); border: 1px solid var(--card-border); color: var(--text); width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; cursor: pointer; }
.iconbtn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; font-size: .88rem; }

.loc-text { font-size: 1rem; line-height: 1.4; }
.loc-text b { color: var(--jannik); }
.search { margin-top: 10px; }
.search input, .field input:not([type=range]) { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(0,0,0,.25); color: var(--text); font-size: 1rem; }
.results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow: auto; }
.results li { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.06); cursor: pointer; }
.results li:hover { background: rgba(255,255,255,.05); }

.countdown { text-align: center; background: linear-gradient(160deg, rgba(255,210,63,.18), rgba(255,159,28,.08)), var(--card); }
.count { font-size: 3.3rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--jannik); text-shadow: 0 0 24px rgba(255,210,63,.35); }
.countdown.imminent .count { animation: throb 1s infinite; }
@keyframes throb { 50% { transform: scale(1.05); } }

.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: .86rem; }
.seg button.on { background: var(--accent); color: #fff; }
.switch { display: flex; gap: 10px; align-items: center; margin: 8px 0; font-size: .92rem; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.field { display: block; margin: 10px 0; font-size: .92rem; }
.field input { margin-top: 6px; }
.field input[type=range] { width: 100%; accent-color: var(--jannik); }

/* options */
.opt { position: relative; overflow: hidden; }
.opt::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--ok); }
.opt.knapp::before { background: var(--warn); }
.opt.riskant::before { background: var(--bad); }
.opt-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.opt-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chip { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.1); }
.chip.sicher { background: rgba(46,212,122,.18); color: var(--ok); }
.chip.knapp { background: rgba(255,176,32,.18); color: var(--warn); }
.chip.riskant { background: rgba(255,84,112,.18); color: var(--bad); }
.chip.tag { background: rgba(79,140,255,.2); color: #b9ceff; }
.chip.hot { background: rgba(255,210,63,.18); color: var(--jannik); }
.kmbadge { font-size: .8rem; font-weight: 800; padding: 4px 8px; border-radius: 10px; background: var(--jannik); color: #222; white-space: nowrap; }
.timegrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.timegrid > div { background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 10px; }
.timegrid .v { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.timegrid .l { font-size: .7rem; color: var(--muted); }
.buffer.ok .v { color: var(--ok); } .buffer.knapp .v { color: var(--warn); } .buffer.riskant .v { color: var(--bad); }
.leave { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(90deg, rgba(79,140,255,.25), rgba(123,92,255,.18)); padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; font-weight: 700; }
.leave .cd { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.leave.urgent { background: linear-gradient(90deg, rgba(255,84,112,.35), rgba(255,176,32,.2)); animation: throb 1.2s infinite; }

.legs { list-style: none; margin: 0; padding: 0; }
.leg { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.leg:last-child { border-bottom: 0; }
.leg .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .92rem; }
.leg .t small { display: block; color: var(--muted); font-weight: 500; }
.leg .d { font-size: .9rem; line-height: 1.35; }
.leg .d .dir { color: var(--muted); font-size: .8rem; }
.line { display: inline-block; min-width: 34px; text-align: center; padding: 2px 7px; border-radius: 6px; font-weight: 800; font-size: .82rem; color: #fff; margin-right: 6px; }
.line.walk { background: rgba(255,255,255,.12); }
.delay { color: var(--bad); font-weight: 800; font-size: .8rem; }
.ontime { color: var(--ok); font-size: .78rem; font-weight: 700; }
.remark { background: rgba(255,176,32,.12); border-left: 3px solid var(--warn); padding: 6px 8px; border-radius: 6px; font-size: .8rem; margin: 6px 0; }
.follow { font-size: .84rem; color: var(--muted); margin-top: 10px; }
.follow b { color: var(--text); }
.opt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.warnbox { background: rgba(255,84,112,.12); border: 1px solid rgba(255,84,112,.35); padding: 10px 12px; border-radius: 12px; margin-top: 8px; font-size: .9rem; }
.infobox { background: rgba(79,140,255,.12); border: 1px solid rgba(79,140,255,.35); padding: 10px 12px; border-radius: 12px; margin-top: 8px; font-size: .9rem; }

.preview-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); gap: 8px; }
.preview-item:last-child { border-bottom: 0; }
.preview-item .n { font-weight: 700; }
.preview-item .s { font-size: .8rem; color: var(--muted); }

/* map */
#tab-map.active { position: fixed; inset: 0; top: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 10; padding: 0; margin: 0; max-width: none; }
#map { position: absolute; inset: 0; background: #1a2140; }
.map-hint { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .88rem; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.map-legend { position: absolute; bottom: 10px; left: 10px; z-index: 500; background: rgba(11,16,32,.85); padding: 6px 10px; border-radius: 10px; font-size: .75rem; display: flex; gap: 10px; flex-wrap: wrap; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -2px; }
.lg.course { background: #ff4f81; border-radius: 3px; height: 4px; vertical-align: 2px; }
.lg.jannik { background: var(--jannik); } .lg.me { background: var(--accent); } .lg.hot { background: #ff9f1c; }
.jannik-marker { width: 30px; height: 30px; border-radius: 50%; background: var(--jannik); border: 3px solid #fff; display: grid; place-items: center; font-weight: 900; color: #222; box-shadow: 0 0 0 6px rgba(255,210,63,.35), 0 0 20px rgba(255,210,63,.8); animation: throb 1.6s infinite; }
.me-marker { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(79,140,255,.3); }
.km-marker { background: #fff; color: #111; font-weight: 800; font-size: 10px; border-radius: 8px; padding: 1px 4px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.4); white-space: nowrap; }
.hot-marker { font-size: 16px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.spot-marker { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #4f8cff; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #141b34; color: var(--text); }
.leaflet-popup-content { margin: 10px 12px; font-size: .88rem; }
.leaflet-container a.leaflet-popup-close-button { color: #fff; }

/* splits */
table.splits { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.splits th { text-align: left; color: var(--muted); font-size: .75rem; font-weight: 600; padding: 6px 4px; }
.splits td { padding: 9px 4px; border-top: 1px solid rgba(255,255,255,.06); }
.splits tr.pred td { color: var(--muted); font-style: italic; }
.splits tr.last td { color: var(--jannik); font-weight: 700; }
.chart svg { width: 100%; height: auto; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); }

/* info */
.weather { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.wx { min-width: 64px; text-align: center; background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 4px; font-size: .8rem; }
.wx .i { font-size: 1.4rem; } .wx .tt { font-weight: 800; font-size: 1rem; } .wx.now { outline: 2px solid var(--accent); }
.linkgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(0,0,0,.2); border-radius: 14px; padding: 12px 6px; text-decoration: none; color: var(--text); font-size: 1.4rem; text-align: center; }
.tile span { font-size: .75rem; color: var(--muted); }
.tips ul { padding-left: 18px; margin: 0; line-height: 1.5; font-size: .92rem; }
.tips li { margin-bottom: 6px; }

/* tabbar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: rgba(11,16,32,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--card-border); }
.tabbar button { flex: 1; background: none; border: 0; color: var(--muted); font-size: .72rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.tabbar button span { font-size: 1.25rem; }
.tabbar button.on { color: var(--text); }
.tabbar button.on span { filter: drop-shadow(0 0 6px rgba(79,140,255,.9)); }

/* sheet + toast */
.sheet { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.sheet-inner { width: 100%; max-width: 720px; margin: 0 auto; max-height: 82vh; overflow: auto; background: #121934; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--card-border); animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.dep { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: .92rem; }
.dep .when { font-weight: 800; font-variant-numeric: tabular-nums; }
.dep.cancel { opacity: .6; text-decoration: line-through; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); transform: translateX(-50%); z-index: 3000; background: #fff; color: #111; padding: 10px 16px; border-radius: 999px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: 90vw; text-align: center; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.confetti { position: fixed; top: -10px; z-index: 4000; font-size: 22px; pointer-events: none; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }
@media (min-width: 700px) { .big { font-size: 1.9rem; } }
.sprinter summary { cursor: pointer; font-size: .92rem; list-style: none; }
.sprinter summary::-webkit-details-marker { display: none; }
.sprinter[open] summary { margin-bottom: 10px; }
.sprinter > .card { margin: 0; box-shadow: none; }

.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.count { font-size: 3rem; }
.finish { background: linear-gradient(160deg, rgba(46,212,122,.14), rgba(79,140,255,.08)), var(--card); }
