/* Eén smalle kolom: kop met status, parcoursbalk, tabel met doorkomsten */
:root {
  --bg: #f5f7f8; --surface: #ffffff; --fg: #16232b; --muted: #5c6b74; --line: #dde4e8;
  --accent: #0b6670; --accent-soft: #dceeee; --est: #9aa8b0; --warn: #b4531a; --pos: #d7263d;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0f171c; --surface: #16222a; --fg: #e6eef2; --muted: #93a4ae; --line: #26353e;
  --accent: #5cc3c4; --accent-soft: #143a3c; --est: #5d6f79; --warn: #e88a52; --pos: #ff4d5e; color-scheme: dark } }

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 640px; margin: 0 auto; padding-block: 28px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.live { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.live.err i { background: var(--warn); }
@media (prefers-reduced-motion: no-preference) { .live:not(.err):not(.idle) i { animation: pulse 2s infinite; } }   /* idle: vóór de race, ververst elk half uur */
@keyframes pulse { 50% { opacity: .3; } }
button { font: inherit; font-size: 13px; color: var(--accent); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; margin: 4px 0 6px; text-wrap: balance; }
.meta { color: var(--muted); font-size: 15px; }
.meta b { color: var(--fg); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stat { background: var(--surface); padding: 12px 14px; min-width: 0; }
.stat .k { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--display); font-weight: 700; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.stat .sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat .sub.fast { color: var(--accent); font-weight: 600; }
.stat .sub.slow { color: var(--warn); font-weight: 600; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.course { display: grid; gap: 8px; }
.nextup { font-size: 14px; color: var(--muted); }
.nextup b { color: var(--fg); font-weight: 600; }
.nextup b.fast { color: var(--accent); } .nextup b.slow { color: var(--warn); }
/* Split als strook onderaan het samenvattingsblok */
.stats .splitline { grid-column: 1 / -1; background: var(--surface); padding: 10px 14px; }
.splitline span { white-space: nowrap; }
.bar { position: relative; height: 10px; background: var(--line); border-radius: 5px; }
.bar .done { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 5px; transition: width .6s; }
.bar .dot { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); left: 0; transition: left .6s; }
.ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

h2 { font-family: var(--display); font-weight: 700; font-size: 1.4rem; margin: 0 0 8px; }
.tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tr.real td { font-weight: 600; }
tr.real.last td { background: var(--accent-soft); }
tr.real.last td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.est td { color: var(--muted); }
tr.est.gone td { color: var(--est); }
tr.sep td { padding-top: 12px; padding-bottom: 6px; background: var(--bg); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: normal; }
.pill { display: inline-block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 10px; margin-left: 6px; vertical-align: 1px; }
.pill.ok { background: var(--accent); color: var(--surface); }
.pill.est { border: 1px solid var(--est); color: var(--muted); }
.pill.guess { border: 1px dashed var(--est); color: var(--muted); text-transform: none; letter-spacing: 0; }

.note { font-size: 14px; color: var(--muted); max-width: 62ch; margin: 0; }
/* Uitleg onderaan ingeklapt: één regel, openen met een tik */
details.note > summary { cursor: pointer; width: fit-content; list-style: none; }
details.note > summary::-webkit-details-marker { display: none; }
details.note > summary::before { content: "▸ "; }
details.note[open] > summary::before { content: "▾ "; }
details.note > summary:hover { color: var(--fg); }
details.note > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
details.note > p { margin: 8px 0 0; }
.chart { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.trend { margin: 0; font-weight: 600; }
.trend.empty { font-weight: 400; color: var(--muted); }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box .axis { stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; }
.chart-box .lbl { fill: var(--muted); font-size: 11px; font-family: var(--body); font-variant-numeric: tabular-nums; }
.chart-box .val { fill: var(--fg); font-size: 11px; font-weight: 600; font-family: var(--body); font-variant-numeric: tabular-nums; }
.chart-box .fast { fill: var(--accent); }
.chart-box .slow { fill: var(--warn); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .fast { background: var(--accent); } .legend .slow { background: var(--warn); }

.map { height: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; z-index: 0; }
/* Smaller dan het dashboard: een hogere kaart, zodat de route naast het weerkaartje en boven de schuif past */
@media (max-width: 1099px) { .map:not(.rp-map) { height: clamp(400px, 60vh, 520px); } }
.map.leaflet-container { font-family: var(--body); }
.map .leaflet-tile-pane { filter: grayscale(1) contrast(.8) brightness(1.08); opacity: .75; }
@media (prefers-color-scheme: dark) { .map .leaflet-tile-pane { filter: grayscale(1) invert(1) contrast(.8) brightness(.9); opacity: .6; } }
.map .route-casing { stroke: var(--surface); }
.map .route-all { stroke: var(--muted); }
.map .route-done { stroke: var(--accent); }
.map .route-est { stroke: var(--accent); stroke-dasharray: 2 8; }
.map .split, .map .now { fill: var(--accent); stroke: var(--surface); }
.map .next { fill: var(--surface); stroke: var(--muted); }
.live-dot i { position: absolute; inset: 2px; border-radius: 50%; background: var(--pos); border: 2px solid var(--surface); }
.live-dot::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--pos); opacity: .5; }
@media (prefers-reduced-motion: no-preference) { .live-dot::before { animation: ping 1.6s ease-out infinite; } }
@keyframes ping { from { transform: scale(1); opacity: .6; } to { transform: scale(2.8); opacity: 0; } }
.map .km-label { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; box-shadow: none;
  padding: 0 5px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.map .km-label::before { display: none; }
.map .leaflet-popup-content { margin: 8px 12px; font-size: 14px; }
/* Weer tijdens de race op de kaart: rustige stromende lijntjes onder de route (zoals Windfinder), hoe harder het
   waait hoe sneller. Rechtsboven het weer op het gekozen uur, onderin een schuif over de uren van de race. */
.map .leaflet-wind-pane { pointer-events: none; }
.map .leaflet-wind-pane canvas { position: absolute; left: 0; top: 0; }
.wx-card { width: 190px; padding: 8px 10px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 2px 8px rgb(0 0 0 / .12); font-size: 13px; line-height: 1.3; cursor: auto; }
.wx-card[hidden] { display: none; }
.wx-sum { display: flex; align-items: center; gap: 8px; }
.wx-sum svg { flex: none; width: 26px; height: 26px; transition: transform .6s; }
.wx-sum small { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.wx-sum b { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-opts { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.wx-opts button { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; font-size: 13px; }
.wx-opts .chev { width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); transition: transform .2s; }
.wx-opts [aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-1px, -1px); }
.wx-opts label { display: flex; align-items: center; gap: 6px; color: var(--fg); cursor: pointer; }
.wx-opts input.switch { width: 32px; height: 18px; }
.wx-opts input.switch::after { top: 2px; left: 2px; width: 14px; height: 14px; }
.wx-opts input.switch:checked::after { left: 16px; }
.wx-more { display: grid; grid-template-columns: auto auto; gap: 3px 10px; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.wx-more[hidden] { display: none; }
.wx-more dt { color: var(--muted); }
.wx-more dd { margin: 0; text-align: right; }
.wx-more .src { grid-column: 1 / -1; margin-top: 4px; font-size: 11px; color: var(--muted); }
.wx-slide { position: absolute; left: 10px; right: 10px; bottom: 22px; z-index: 1000; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 4px 10px; padding: 6px 12px 8px; background: var(--surface); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 2px 8px rgb(0 0 0 / .12); font-size: 12px; font-variant-numeric: tabular-nums; cursor: auto; }
.wx-slide[hidden] { display: none; }
.wx-slide .lbl { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.wx-slide .lbl b { font-weight: 600; white-space: nowrap; }
@media (max-width: 560px) { .wx-slide .lbl span { display: none; } }   /* smal: alleen "Wind om 12:15 (≈ 22 km)", op één regel */
.wx-slide .lbl span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-slide .end { color: var(--muted); }
.wx-slide input { width: 100%; margin: 0; accent-color: var(--accent); }
.map .wx-pos i { position: absolute; inset: 2px; border-radius: 50%; background: var(--pos); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
@media (min-width: 700px) { .wx-slide { left: 50%; right: auto; width: 440px; transform: translateX(-50%); } }
.wx-race td.rain { color: var(--accent); font-weight: 600; }
.wx-race .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.legend .route { background: var(--accent); }
.legend .now { background: var(--accent); border-radius: 50%; }
.legend .next { border: 2px solid var(--muted); border-radius: 50%; }
.legend .est { background: var(--pos); border-radius: 50%; }
.legend .others { background: var(--muted); border-radius: 50%; }
/* Zonder loper in beeld: het parcours van elke afstand in een eigen kleur (vaste volgorde, de langste eerst), in
   plaats van de route en de live-legenda. Kleuren gecontroleerd op kleurenblindheid; de legenda zet er de naam bij. */
:root { --ov-1: #2a78d6; --ov-2: #eb6834; --ov-3: #1baf7a; --ov-4: #eda100; --ov-5: #e87ba4; --ov-6: #008300; --ov-7: #6250d6; --ov-8: #e34948; }
@media (prefers-color-scheme: dark) { :root { --ov-1: #3987e5; --ov-2: #d95926; --ov-3: #199e70; --ov-4: #c98500; --ov-5: #d55181; --ov-6: #008300; --ov-7: #9085e9; --ov-8: #e66767; } }
.ov-1 { --ov: var(--ov-1); } .ov-2 { --ov: var(--ov-2); } .ov-3 { --ov: var(--ov-3); } .ov-4 { --ov: var(--ov-4); }
.ov-5 { --ov: var(--ov-5); } .ov-6 { --ov: var(--ov-6); } .ov-7 { --ov: var(--ov-7); } .ov-8 { --ov: var(--ov-8); }
body.empty #map .route-casing, body.empty #map .route-all, body.empty #mapsec > .legend:not(.ov-legend) { display: none; }
.map .ov-casing { stroke: var(--surface); }
.map .ov-line { stroke: var(--ov); }
.map.ov-focus .ov-line:not(.on) { stroke-opacity: .2; }
.map .ov-end { fill: var(--fg); stroke: var(--surface); }
.ov-legend { margin-top: 8px; gap: 6px; }
.ov-legend[hidden] { display: none; }
.ov-legend button { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-size: 14px; padding: 4px 10px; background: var(--surface); }
.ov-legend button i { width: 14px; height: 4px; border-radius: 2px; margin: 0; background: var(--ov); }
.ov-legend button small { color: var(--muted); font-size: 13px; }
.ov-legend button[aria-pressed="true"] { border-color: var(--ov); box-shadow: inset 0 0 0 1px var(--ov); }
.map .ov-pop ul { list-style: none; margin: 4px 0 0; padding: 0; }
.map .ov-pop li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.map .ov-pop li i { flex: none; width: 12px; height: 4px; border-radius: 2px; background: var(--ov); }
.map .ov-pop li span { color: var(--muted); }
.map .other { fill: var(--muted); stroke: var(--surface); cursor: pointer; }
.map .other-label { color: var(--muted); }
.follow { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.follow .fh { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; border-radius: 0; background: none;
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; text-align: left; }
.follow .fh:hover { color: var(--fg); }
.follow .chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
.follow.collapsed .chev { transform: rotate(-45deg); }
.follow.collapsed #follow-body { display: none; }
body.empty .stats, body.empty .course, body.empty #tablesec, body.empty #chartsec { display: none; }
.runners { list-style: none; margin: 0; padding: 0; }
.runner { display: flex; border-top: 1px solid var(--line); }
.runner .pick { flex: 1; min-width: 0; display: grid; gap: 4px; text-align: left; border: 0; border-radius: 0; padding: 10px 14px;
  background: none; color: var(--fg); font-size: 15px; }
.runner.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.runner .l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.runner .rn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runner .rb { color: var(--muted); font-size: 13px; white-space: nowrap; }
.runner .rt { margin-left: auto; font-size: 12px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.runner .rt.fast { color: var(--accent); font-weight: 600; }
.runner .rt.slow { color: var(--warn); font-weight: 600; }
.runner .l2 { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.runner .mini { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.runner .mini i { display: block; height: 100%; width: 0; background: var(--accent); }
.runner .del { flex: none; width: 44px; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 0;
  background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.runner .del:hover { color: var(--warn); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.share[hidden] { display: none; }
.share button { font-size: 14px; padding: 5px 12px; }
#share-msg { overflow-wrap: anywhere; }
.other { display: grid; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.other label { font-weight: 600; font-size: 14px; }
.other .row { display: flex; gap: 8px; flex-wrap: wrap; }
.other input { font: inherit; font-variant-numeric: tabular-nums; flex: 1 1 140px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.other input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bibmsg { font-size: 14px; color: var(--muted); }
.bibmsg:empty { display: none; }
.goal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--muted); }
.goal[hidden] { display: none; }
.goal label { font-weight: 600; color: var(--fg); }
.goal input { font: inherit; width: 7em; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); font-variant-numeric: tabular-nums; }
.goal input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hits button { font-size: 14px; padding: 5px 10px; }
.hits button small { color: var(--muted); }
.other button[type=submit] { font-size: 15px; padding: 8px 16px; background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; }
.error { color: var(--warn); }
/* Finishoverzicht */
.fin-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fin-btns[hidden] { display: none; }
.fin { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 22px 18px;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; }
.fin[open] { display: grid; gap: 16px; }
.fin::backdrop { background: rgb(10 20 26 / .55); }
@media (prefers-reduced-motion: no-preference) { .fin[open] { animation: rise .25s ease-out; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.fin h2 { font-size: 2rem; line-height: 1.05; margin: 2px 0 0; padding-right: 32px; text-wrap: balance; }
.fin > .eyebrow { color: var(--accent); font-weight: 600; margin-bottom: -12px; }
.fin > .meta { margin-top: -12px; }
.fin-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; border: 0; font-size: 24px; line-height: 1; color: var(--muted); }
.fin-x:hover { color: var(--fg); }
.fin .k { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fin-time { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; }
.fin-time .big { font-family: var(--display); font-weight: 700; font-size: 3.4rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.fin-time .sub { font-size: 14px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.fin-ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.fin-ranks div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.fin-ranks .k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-ranks .v { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fin-ranks .v small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.fin-ranks .splitline { grid-column: 1 / -1; padding: 10px 14px; }
.fin-chart { display: grid; gap: 4px; }
.chart-box .tline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-box .tarea { fill: var(--accent-soft); }
.chart-box .tdot { stroke: var(--surface); stroke-width: 2; }
.chart-box .tdot.on { stroke: var(--fg); }
.chart-box .xaxis { stroke: var(--line); stroke-width: 1; }
.chart-box .tguide { stroke: var(--muted); stroke-width: 1; }
#fin-chart { position: relative; }
.ttip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; display: grid; gap: 1px;
  background: var(--fg); color: var(--surface); border-radius: 6px; padding: 6px 9px; font-size: 13px; line-height: 1.3;
  white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 4px 12px rgb(0 0 0 / .18); }
.ttip[hidden] { display: none; }
.ttip b { font-size: 15px; }
.ttip span { opacity: .8; }
.fin-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.fin-actions button { font-size: 15px; padding: 7px 14px; }
.fin-actions .primary { background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; }
/* Race-replay: schermvullend, kaart links en tussentijden rechts (op mobiel eronder) */
.rp { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--fg); }
.rp[open] { display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.rp::backdrop { background: var(--bg); }
.rp-stage { position: relative; min-height: 0; }
.rp .rp-map { height: 100%; border: 0; border-radius: 0; }
.rp-map .runner-dot i { position: absolute; inset: 0; border-radius: 50%; background: var(--pos); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--pos); }
.rp-hud { position: absolute; top: 16px; left: 16px; z-index: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; min-width: 190px; box-shadow: 0 6px 20px rgb(0 0 0 / .12); }
.rp-hud .eyebrow { font-size: 11px; color: var(--accent); font-weight: 600; }
.rp-name { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1.1; }
.rp-clock { font-family: var(--display); font-weight: 700; font-size: 2.8rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); margin-top: 4px; }
.rp-now { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-toast { position: absolute; left: 50%; bottom: 28px; z-index: 500; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--surface); border-radius: 10px; padding: 10px 16px; text-align: center; white-space: nowrap;
  font-variant-numeric: tabular-nums; box-shadow: 0 6px 20px rgb(0 0 0 / .2); transition: opacity .25s, transform .25s; }
.rp-toast.on { opacity: 1; transform: translate(-50%, 0); }
.rp-toast b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.rp-toast span { font-size: 14px; opacity: .85; }
.rp-done { position: absolute; inset: 0; z-index: 600; display: grid; place-content: center; text-align: center; pointer-events: none; }
.rp-done[hidden] { display: none; }
.rp-done > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 28px; box-shadow: 0 10px 30px rgb(0 0 0 / .2); }
.rp-done .k { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.rp-done .big { font-family: var(--display); font-weight: 700; font-size: 4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.rp-done .sub { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .rp-done:not([hidden]) > div { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.rp-x { position: absolute; top: 12px; right: 12px; z-index: 500; width: 40px; height: 40px; padding: 0; font-size: 26px; line-height: 1;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 50%; }
.rp-side { display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr); gap: 12px; padding: 16px; border-left: 1px solid var(--line); background: var(--surface); min-height: 0; }
.rp-side h2 { margin: 4px 0 0; }
.rp-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; cursor: pointer; }
.rp-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.rp-ctrl { display: flex; gap: 8px; }
.rp-ctrl button { font-size: 15px; padding: 7px 14px; }
.rp-ctrl .primary { background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; min-width: 92px; }
.rp-list { overflow-y: auto; min-height: 0; border: 1px solid var(--line); border-radius: 8px; }
.rp-list th { position: sticky; top: 0; background: var(--surface); }
.rp-list th, .rp-list td { padding: 8px 10px; font-size: 14px; }
.rp-list th { font-size: 11px; }
.rp-list tr.todo td { color: var(--est); }
.rp-list tr.todo td:not(:first-child) { visibility: hidden; }
.rp-list tr.cur td { background: var(--accent-soft); font-weight: 600; }
.rp-list tr.cur td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rp-list td.fast { color: var(--accent); } .rp-list td.slow { color: var(--warn); }
@media (prefers-reduced-motion: no-preference) { .rp-list tr.new td { animation: flash 1s ease-out; } }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); } }
.rp-chart { display: grid; gap: 4px; }
.rp-chart .k { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#rp-chart { position: relative; }
.chart-box .tdot.last { stroke: var(--fg); }
@media (max-width: 800px) {
  .rp[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46dvh minmax(0, 1fr); }
  /* Op mobiel blijven knoppen en grafiek staan en scrolt alleen de tabel; de kop kan weg */
  .rp-side { border-left: 0; border-top: 1px solid var(--line); padding: 12px 16px; gap: 10px; grid-template-rows: auto auto auto minmax(0, 1fr); }
  .rp-side h2 { display: none; }
  .rp-hud { top: 12px; left: 12px; min-width: 0; padding: 8px 12px; }
  .rp-clock { font-size: 2.2rem; }
  .rp-done .big { font-size: 3rem; }
}
@media (max-width: 420px) { .fin { padding: 18px 16px 16px; } .fin-time .big { font-size: 2.8rem; } .fin-ranks div { padding: 8px 10px; } .fin-ranks .v { font-size: 1.35rem; } }
a { color: var(--accent); }
/* Vóór de start: aftellen, verwachting en kijkplan in plaats van de live-cijfers */
#pre { display: none; gap: 16px; }
body.pre #pre { display: grid; }
body.pre .stats, body.pre .course, body.pre #chartsec, body.pre .lg-live, body.pre.onsite #tablesec { display: none; }
.countdown { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.countdown .k { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.countdown .v { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.countdown .sub { color: var(--muted); font-size: 14px; }
.prestats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
body.pre .goal { display: none; }
.goalstat { display: grid; align-content: start; gap: 2px; margin: 0; }
.goalstat input { font-family: var(--display); font-weight: 700; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums;
  width: 100%; min-width: 0; padding: 0 0 1px; border: 0; border-bottom: 1px dashed var(--muted); border-radius: 0; background: none; color: var(--fg); }
.goalstat input:focus-visible { outline: none; border-bottom: 2px solid var(--accent); }
.goalstat button { justify-self: start; margin-top: 6px; background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; }
.goalstat button[hidden] { display: none; }
@media (max-width: 420px) { .prestats .stat { padding: 10px; } .prestats .stat .v, .goalstat input { font-size: 1.45rem; } }
.spots { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.spots .intro { margin: 0; padding: 12px 14px; color: var(--muted); font-size: 14px; }
.spot-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0 8px 14px; border-top: 1px solid var(--line); }
.spots #myspots:empty + .spot-add { border-top: 0; }
.spot-block { border-top: 1px solid var(--line); padding-bottom: 8px; }
.spot-block:first-child, .spots .intro + .spot-block { border-top: 0; }
.spot-block .spot-row { border-top: 0; }
.passes { list-style: none; margin: 0; padding: 0 14px 0 52px; }
.passes button { display: grid; grid-template-columns: 6.4em minmax(0, auto) minmax(0, 1fr); gap: 10px; align-items: baseline; width: 100%;
  border: 0; border-radius: 0; padding: 3px 0; background: none; color: var(--fg); font-size: 15px; text-align: left; }
.passes .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.passes .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.passes small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passes .sel .who { font-weight: 600; color: var(--accent); }
.passes .past .t, .passes .past .who { color: var(--est); font-weight: 400; }
.spot-note { margin: 4px 14px 0 52px; font-size: 13px; color: var(--muted); }
.spot-note button { border: 0; border-radius: 0; padding: 0; background: none; font-size: 13px; color: var(--accent); text-decoration: underline; }
.spot-row .lt.mine, .map .spot-mk.mine b { background: var(--fg); color: var(--bg); }
.spot-row .spot-name { border: 0; border-radius: 0; padding: 0; background: none; color: var(--fg); font-size: 15px; text-align: left; overflow-wrap: anywhere; }
.spot-rename { font: inherit; width: 100%; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.spot-row .del { width: 40px; height: 36px; border: 0; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); }
.spot-row .del:hover { color: var(--warn); }
.spot-add { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.spot-add button { font-size: 14px; padding: 5px 12px; }
.pickhint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 8px 12px; border-radius: 6px;
  background: var(--accent-soft); font-size: 14px; }
.pickhint[hidden] { display: none; }
body.picking .map { box-shadow: 0 0 0 2px var(--accent); }
body.picking .map.leaflet-container { cursor: crosshair; }
.map .leaflet-popup-content-wrapper, .map .leaflet-popup-tip { background: var(--surface); color: var(--fg); }
.namepop { display: grid; gap: 6px; min-width: 210px; margin: 0; }
.namepop .row { display: flex; gap: 6px; }
.namepop input { flex: 1; min-width: 0; font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.namepop input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend .mine { background: var(--fg); border-radius: 50%; }
body.empty #spotsec, body:not(.pre) #pre-field, body:not(.onsite) #spotsec .spots, body.onsite .onsite-off { display: none; }
.spothead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.spothead h2 { margin: 0; }
.onsite-off { margin: 0; color: var(--muted); font-size: 14px; }
input.switch { appearance: none; flex: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 12px; background: var(--line); cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: left .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { left: 21px; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#spotsec .field { margin-top: 12px; }
.spot-row .lt, .map .spot-mk b { display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--surface); font-weight: 600; font-size: 13px; }
.spot-row .lt { width: 26px; height: 26px; }
.spot-row small { display: block; color: var(--muted); font-size: 13px; }
.map .spot-mk b { width: 100%; height: 100%; border: 2px solid var(--surface); font-size: 12px; font-family: var(--body); }
.field { margin: 0; color: var(--muted); font-size: 14px; }
/* Tabel op mobiel zonder zijwaarts scrollen: compacter, eerste kolom mag afbreken */
@media (max-width: 560px) {
  th, td { padding: 8px 6px; font-size: 14px; }
  th { font-size: 11px; letter-spacing: .03em; }
  th:first-child, td:first-child { padding-left: 10px; white-space: normal; }
  th:last-child, td:last-child { padding-right: 10px; }
  .pill { font-size: 10px; padding: 0 5px; margin-left: 4px; }
}
/* Brede schermen: dashboard met links de loper, cijfers en gevolgde lopers, rechts de kaart (blijft staan bij scrollen) */
@media (min-width: 1100px) {
  .wrap { max-width: 1480px; column-gap: 32px; padding-left: 32px; padding-right: 32px;
    grid-template-columns: minmax(480px, 1fr) minmax(0, 1.6fr);
    grid-template-areas: "top top" "head map" "pre map" "stats map" "course map" "spots map" "follow map" "table map" "chart map" "note map"; }
  .top { grid-area: top; } .follow { grid-area: follow; } header { grid-area: head; } #pre { grid-area: pre; } #spotsec { grid-area: spots; }
  .stats { grid-area: stats; grid-template-columns: repeat(2, 1fr); } .course { grid-area: course; }
  #mapsec { grid-area: map; align-self: start; position: sticky; top: 16px; }
  #tablesec { grid-area: table; } #chartsec { grid-area: chart; } .note { grid-area: note; }
  .map { height: max(460px, calc(100vh - 130px)); }
  /* Zonder loper in beeld: links zoeken, rechts het parcours; zonder route één gecentreerde kolom */
  body.empty .wrap { grid-template-areas: "top top" "head map" "follow map" "note map"; grid-template-rows: auto auto auto 1fr; }
  body.empty .note { align-self: start; }
  body.empty .wrap:has(#mapsec[hidden]) { max-width: 640px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "head" "follow" "note"; }
}
/* Halve marathon, 10, 5 en 2,5 km: versnellen of vertragen zegt met hooguit één tussenpunt weinig; bij de 5 en 2,5 km
   ook geen doorkomsttabel (alleen de finish wordt gemeten). Drie cijfers over: op twee kolommen krijgt de eindtijd de hele breedte. */
body.short #st-trend, body.short #chartsec, body.finonly #tablesec { display: none; }
body.short .stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { body.short .stats { grid-template-columns: repeat(2, 1fr); } body.short #st-finish { grid-column: span 2; } }
@media (min-width: 1100px) { body.short .stats { grid-template-columns: repeat(2, 1fr); } body.short #st-finish { grid-column: span 2; } }
.fin.short .fin-chart, .fin.finonly #fin-details, .rp.short .rp-chart, .rp.finonly .rp-side h2, .rp.finonly .rp-list { display: none; }
