
:root{
  --ks-bg:#f6f4ef;
  --ks-card:#ffffff;
  --ks-text:#20201e;
  --ks-muted:#696963;
  --ks-line:#dedbd2;
  --ks-accent:#e56a36;
  --ks-accent-soft:#fae6dc;
  --ks-mind:#6d3d78;
  --ks-mind-soft:#eee4f0;
  --ks-route:#d95f2b;
  --ks-ok:#287a57;
  --ks-shadow:0 12px 35px rgba(31,31,27,.10);
}
*{box-sizing:border-box}
body{margin:0;background:var(--ks-bg);color:var(--ks-text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
a{color:inherit}
.shell{max-width:1180px;margin:auto;padding:18px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.brand{display:flex;align-items:flex-end;gap:14px;min-width:0;flex-wrap:wrap}
.wordmark{font-family:Georgia,"Times New Roman",serif;font-size:34px;line-height:1;color:#e0a11f;font-weight:700;letter-spacing:-.02em;white-space:nowrap}
.brand strong{display:block;font-size:16px}
.brand small{display:block;color:var(--ks-muted);font-size:12px;margin-top:2px}
.live-pill{display:flex;align-items:center;gap:7px;background:#fff;border:1px solid var(--ks-line);padding:9px 12px;border-radius:999px;font-weight:800;font-size:12px}
.live-dot{width:8px;height:8px;border-radius:50%;background:#b8b7b0}
.live-dot.on{background:#e34b3f;box-shadow:0 0 0 5px rgba(227,75,63,.12)}
.hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,.75fr);gap:14px}
.panel{background:var(--ks-card);border:1px solid var(--ks-line);border-radius:22px;box-shadow:var(--ks-shadow);overflow:hidden}
.map-wrap{position:relative}
#map{height:620px;width:100%;background:#e8e7e2}
.map-overlay{position:absolute;left:14px;top:14px;z-index:500;display:flex;gap:8px;flex-wrap:wrap}
.chip{background:rgba(255,255,255,.94);border:1px solid rgba(0,0,0,.07);backdrop-filter:blur(7px);border-radius:999px;padding:8px 10px;font-size:12px;font-weight:800}
.sidebar{padding:18px;display:flex;flex-direction:column;gap:13px}
.eyebrow{font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:var(--ks-muted);font-weight:800}
.big{font-size:38px;line-height:1;font-weight:900;letter-spacing:-.04em}
.next-name{font-size:20px;font-weight:850;line-height:1.15;margin-top:4px}
.next-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:5px}
.metric{border:1px solid var(--ks-line);border-radius:16px;padding:12px;background:#fbfaf7}
.metric span{display:block;color:var(--ks-muted);font-size:11px;margin-bottom:4px}
.metric b{font-size:19px}
.progress{height:10px;background:#ece9e1;border-radius:999px;overflow:hidden}
.progress>i{height:100%;display:block;background:var(--ks-accent);width:0%}
.timeline{display:flex;flex-direction:column;gap:7px;max-height:260px;overflow:auto;padding-right:3px}
.stop-row{display:grid;grid-template-columns:48px 1fr auto;gap:9px;align-items:center;padding:8px 0;border-bottom:1px solid #efede7}
.stop-row:last-child{border-bottom:0}
.stop-time{font-size:12px;font-weight:900}
.stop-name{font-size:12px;font-weight:720}
.badge{font-size:10px;border-radius:999px;padding:5px 7px;background:#f0eee8;color:#5b5a55}
.badge.bigstop{background:var(--ks-mind-soft);color:var(--ks-mind);font-weight:800}
.note{font-size:11px;color:var(--ks-muted);line-height:1.45}
.toolbar{display:flex;gap:8px;flex-wrap:wrap}
button,.button{appearance:none;border:0;border-radius:12px;padding:10px 13px;background:var(--ks-text);color:#fff;font-weight:800;cursor:pointer;text-decoration:none;font-size:13px}
button.secondary,.button.secondary{background:#fff;color:var(--ks-text);border:1px solid var(--ks-line)}
input{width:100%;padding:11px 12px;border:1px solid var(--ks-line);border-radius:12px;background:#fff;font:inherit}
.section-title{font-weight:900;font-size:14px;margin:0}
.alert{padding:10px 12px;border-radius:12px;background:#fff4e9;border:1px solid #f2d4bd;font-size:12px;line-height:1.4}
.tracker{max-width:660px;margin:32px auto}
.tracker .panel{padding:22px}
.tracker .status{font-size:14px;line-height:1.5;padding:12px;border-radius:12px;background:#f4f2ec;margin:12px 0}
.kv{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.kv .metric{min-height:74px}
.footer{padding:18px 0 3px;color:var(--ks-muted);font-size:11px;text-align:center}
.leaflet-control-attribution{font-size:9px!important}
.ks-stop-icon{background:transparent!important;border:0!important}
.ks-stop-dot{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#fff;border:3px solid var(--ks-accent);font-size:10px;font-weight:900;box-shadow:0 3px 10px rgba(0,0,0,.18)}
.ks-stop-dot.bigstop{border-color:var(--ks-mind)}
.ks-rider-icon{background:transparent!important;border:0!important}
.ks-rider-dot{width:24px;height:24px;border-radius:50%;background:#20201e;border:5px solid #fff;box-shadow:0 0 0 3px var(--ks-accent),0 4px 14px rgba(0,0,0,.3)}
@media(max-width:800px){
  .shell{padding:10px}
  .hero{grid-template-columns:1fr}
  #map{height:54vh;min-height:410px}
  .sidebar{padding:15px}
  .big{font-size:31px}
  .topbar{align-items:flex-start}
  .wordmark{font-size:26px}
}

/* v2: MapLibre + OpenFreeMap */
.maplibregl-map{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.maplibregl-ctrl-group{border-radius:12px!important;overflow:hidden;box-shadow:0 4px 18px rgba(0,0,0,.12)!important}
.maplibregl-ctrl-attrib{font-size:9px!important}
.ks-map-marker{width:30px;height:30px;display:grid;place-items:center;border-radius:50%;background:#fff;border:3px solid var(--ks-accent);font-size:10px;font-weight:900;box-shadow:0 3px 10px rgba(0,0,0,.18);cursor:pointer}
.ks-map-marker.bigstop{border-color:var(--ks-mind)}
.ks-rider-marker{width:26px;height:26px;border-radius:50%;background:#20201e;border:5px solid #fff;box-shadow:0 0 0 3px var(--ks-accent),0 4px 14px rgba(0,0,0,.3)}
.maplibregl-popup-content{border-radius:14px!important;padding:12px 14px!important;box-shadow:0 10px 28px rgba(0,0,0,.15)!important}

/* v3 polish */
.ks-rider-marker{
  width:28px;height:28px;border-radius:50%;
  background:#151513;border:5px solid #fff;
  box-shadow:0 0 0 4px var(--ks-accent),0 5px 18px rgba(0,0,0,.35);
  position:relative;
}
.ks-rider-marker.live::after{
  content:"";
  position:absolute;inset:-13px;border-radius:50%;
  border:3px solid rgba(229,106,54,.36);
  animation:ksPulse 1.8s ease-out infinite;
}
@keyframes ksPulse{
  0%{transform:scale(.65);opacity:.95}
  80%,100%{transform:scale(1.25);opacity:0}
}
@media (prefers-reduced-motion: reduce){
  .ks-rider-marker.live::after{animation:none}
}
button.active{
  background:var(--ks-accent);
  color:#fff;
  border-color:var(--ks-accent);
}
.chip.warn{background:#fff4e9;color:#8a4c24}
.chip.live{background:#eef8f2;color:#236a4b}


/* v5 checkpoint progress states */
.ks-map-marker.future{
  background:#f2f1ed;
  border-color:#aaa8a0;
  color:#77756f;
}
.ks-map-marker.current{
  background:#e0a11f;
  border-color:#e0a11f;
  color:#171714;
  box-shadow:0 0 0 4px rgba(224,161,31,.18),0 4px 14px rgba(0,0,0,.22);
}
.ks-map-marker.completed{
  background:#171714;
  border-color:#171714;
  color:#fff;
}
.stop-row.future{opacity:.58}
.stop-row.current{opacity:1}
.stop-row.current .stop-time,.stop-row.current .stop-name{color:#b97700}
.stop-row.completed{opacity:.86}
.stop-row.completed .stop-time,.stop-row.completed .stop-name{color:#171714}


/* v6: legenda + locatie verwijderen */
.legend{display:flex;flex-wrap:wrap;gap:10px 14px;padding:10px 0 2px;border-top:1px solid #efede7;font-size:11px;color:var(--ks-muted)}
.legend span{display:flex;align-items:center;gap:6px;white-space:nowrap}
.legend-dot{width:11px;height:11px;border-radius:50%;display:inline-block;border:2px solid transparent}
.legend-dot.completed{background:#20201e;border-color:#20201e}
.legend-dot.current{background:var(--ks-accent);border-color:var(--ks-accent)}
.legend-dot.future{background:#c9c7c1;border-color:#c9c7c1}
button.danger{background:#fff;color:#9b2f2f;border:1px solid #e4bcbc}
button.danger:hover{background:#fff5f5}

/* v7 secure tracker + manual override */
.tracker-panel{padding:22px;margin-bottom:16px}
.override-panel{margin-top:16px}
.field-label{display:block;font-size:12px;font-weight:800;margin:12px 0 6px;color:var(--ks-muted)}
select{width:100%;padding:11px 12px;border:1px solid var(--ks-line);border-radius:12px;background:#fff;font:inherit}
.override-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.full-btn{width:100%;margin-top:8px}
.chip.manual{background:#fff0df;color:#9d581d}
@media(max-width:640px){.override-grid{grid-template-columns:1fr}}


/* v8: 24-uurs countdown, start/finish en feestelijke finish */
.event-clock{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 22px;margin-bottom:14px;border-left:6px solid #c8c5bd}
.event-clock.active{border-left-color:var(--ks-accent);background:linear-gradient(90deg,#fff7f1,#fff)}
.event-clock.finished{border-left-color:#e0a11f;background:linear-gradient(90deg,#fff5e0,#fff)}
.event-clock-title{font-size:22px;font-weight:900;margin-top:3px}
.event-clock-sub{font-size:12px;color:var(--ks-muted);margin-top:4px}
.event-countdown{font-variant-numeric:tabular-nums;font-size:40px;line-height:1;font-weight:950;letter-spacing:-.04em;white-space:nowrap}
.event-clock.active .event-countdown{color:var(--ks-accent)}
.finish-banner{padding:22px;margin-bottom:14px;text-align:center;background:linear-gradient(135deg,#fff1e7,#fff9e5);border-color:#f0c08e}
.finish-kicker{font-size:12px;font-weight:950;letter-spacing:.16em;color:#b66025}
.finish-title{font-size:34px;font-weight:950;margin:5px 0}
.finish-copy{font-size:15px;line-height:1.45;max-width:720px;margin:auto;color:#4c443d}
.start-finish-marker{width:36px;height:36px;font-size:9px}
.event-point.current .stop-time,.event-point.current .stop-name{color:#b97700}
.event-override-buttons{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0 16px}
.confetti-layer{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:9999}
.confetti-piece{position:absolute;top:-24px;width:10px;height:18px;border-radius:2px;opacity:.9;animation:confettiFall linear infinite}
@keyframes confettiFall{0%{transform:translate3d(0,-30px,0) rotate(0deg)}100%{transform:translate3d(var(--drift),110vh,0) rotate(720deg)}}
@media(max-width:700px){
  .event-clock{align-items:flex-start;flex-direction:column;gap:10px;padding:16px}
  .event-countdown{font-size:36px}
  .event-override-buttons{grid-template-columns:1fr}
  .finish-title{font-size:28px}
}
@media(prefers-reduced-motion:reduce){.confetti-piece{display:none}}


/* v9: live donatiestand */
.donation-strip{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:22px;padding:18px 22px;margin-bottom:14px;border-left:6px solid #e0a11f;background:linear-gradient(90deg,#fff9ec,#fff)}
.donation-copy{min-width:0}
.donation-main{font-size:24px;line-height:1.05;margin:4px 0 5px}
.donation-main strong{font-size:34px;font-weight:950;letter-spacing:-.04em;color:#171714}
.donation-sub{font-size:13px;line-height:1.4;color:#514b43}
.donation-progress{height:10px;max-width:650px;margin-top:10px;background:#eee9df;border-radius:999px;overflow:hidden}
.donation-progress>i{display:block;height:100%;width:0;background:#e0a11f;border-radius:999px;transition:width .5s ease}
.donation-updated{font-size:10px;color:var(--ks-muted);margin-top:6px}
.donate-cta{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 22px;border-radius:14px;background:#171714;color:#fff!important;text-decoration:none;font-size:15px;font-weight:900;white-space:nowrap}
.donate-cta:hover{transform:translateY(-1px)}
.donation-strip.goal-hit{background:linear-gradient(90deg,#fff4dc,#fff)}
.donation-strip.goal-hit .donation-progress>i{background:#e56a36}
@media(max-width:700px){
  .donation-strip{grid-template-columns:1fr;gap:14px;padding:16px}
  .donation-main strong{font-size:30px}
  .donate-cta{width:100%}
}


/* v10: maphoogte + MIND-stijl donatieknop */
@media (min-width:801px){
  .hero{align-items:stretch}
  .map-wrap{position:relative;min-height:760px;height:auto}
  .map-wrap #map{position:absolute;inset:0;width:100%;height:100%;min-height:760px}
}
.donate-cta{
  min-width:220px;
  min-height:52px;
  padding:0 28px;
  border-radius:4px;
  background:#ef8200;
  color:#fff!important;
  font-size:16px;
  font-weight:700;
  box-shadow:none;
  transition:background .15s ease;
}
.donate-cta:hover{
  transform:none;
  background:#dc7600;
}
@media(max-width:800px){
  .map-wrap{min-height:520px}
  #map{height:520px;min-height:520px}
}


/* v11: laatste donaties in MIND-stijl */
.recent-donations{padding:18px 22px;margin-bottom:14px}
.recent-donations-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:8px}
.recent-donations-title{font-size:20px;font-weight:900;margin-top:3px}
.recent-donations-link{font-size:12px;color:#777;text-decoration:none}
.recent-donations-link:hover{text-decoration:underline}
.recent-donations-list{display:grid;grid-template-columns:1fr 1fr;gap:0 28px}
.donor-card{display:grid;grid-template-columns:58px 1fr;gap:14px;align-items:start;padding:15px 0;border-bottom:1px solid #eceae5;min-width:0}
.donor-avatar{width:58px;height:58px;border-radius:50%;display:grid;place-items:center;color:white;font-size:24px;font-weight:900;flex:0 0 auto}
.donor-copy{min-width:0;padding-top:2px}
.donor-top{font-size:16px;line-height:1.25;min-width:0}
.donor-top strong{font-weight:900}
.donor-top span{color:#aaa;font-weight:400}
.donor-amount{font-size:16px;font-weight:900;margin-top:4px}
.donor-message{font-size:14px;line-height:1.42;margin-top:8px;color:#292929;overflow-wrap:anywhere}
.recent-donations-empty{padding:16px 0;color:var(--ks-muted);font-size:13px}
@media(max-width:760px){
  .recent-donations-list{grid-template-columns:1fr}
  .recent-donations-head{align-items:flex-start;flex-direction:column}
}

/* v13: gebalanceerde 3-koloms layout */
@media (min-width:1181px){
  .shell{max-width:1480px}
  .hero{
    display:grid;
    grid-template-columns:300px minmax(560px,1fr) 350px;
    gap:16px;
    align-items:start;
  }
  .donation-sidebar{
    padding:18px;
    align-self:start;
    max-height:760px;
    overflow:hidden;
  }
  .donation-sidebar .recent-donations-head{margin-bottom:6px}
  .donation-sidebar .recent-donations-title{font-size:18px}
  .donation-sidebar .recent-donations-list{
    display:flex;
    flex-direction:column;
    gap:0;
    overflow:auto;
    max-height:620px;
    padding-right:3px;
  }
  .donation-sidebar .donor-card{
    display:grid;
    grid-template-columns:50px minmax(0,1fr);
    gap:12px;
    padding:14px 0;
    border-bottom:1px solid #eceae5;
  }
  .donation-sidebar .donor-card:last-child{border-bottom:0}
  .donation-sidebar .donor-avatar{width:50px;height:50px;font-size:20px}
  .donation-sidebar .donor-top{font-size:14px;line-height:1.25}
  .donation-sidebar .donor-amount{font-size:15px;margin-top:3px}
  .donation-sidebar .donor-message{font-size:12px;line-height:1.4;margin-top:6px}
  .donor-all-link{display:inline-block;margin-top:12px;padding-top:12px;border-top:1px solid #eceae5;font-weight:700;color:#6f6d67}

  .map-wrap{position:relative;height:760px;min-height:760px}
  .map-wrap #map{position:absolute;inset:0;width:100%;height:100%;min-height:760px}
  .sidebar{height:760px;overflow:hidden}
}

@media (min-width:801px) and (max-width:1180px){
  .shell{max-width:1080px}
  .hero{grid-template-columns:minmax(0,1.35fr) 340px;gap:14px;align-items:start}
  .donation-sidebar{grid-column:1/-1;padding:18px 22px}
  .donation-sidebar .recent-donations-list{display:grid;grid-template-columns:1fr 1fr;gap:0 24px}
  .map-wrap{height:700px;min-height:700px}
  .map-wrap #map{position:absolute;inset:0;width:100%;height:100%;min-height:700px}
  .sidebar{height:700px;overflow:hidden}
}

@media(max-width:800px){
  .hero{display:grid;grid-template-columns:1fr;gap:14px}
  .donation-sidebar{padding:16px}
  .donation-sidebar .recent-donations-list{display:flex;flex-direction:column}
  .donor-card{grid-template-columns:52px minmax(0,1fr)}
  .map-wrap{min-height:520px;height:520px}
  .map-wrap #map{height:520px;min-height:520px}
}

.recent-donations-empty{display:flex;flex-direction:column;gap:4px;padding:14px 0;color:var(--ks-muted);font-size:12px;line-height:1.4}.recent-donations-empty strong{color:var(--ks-text);font-size:13px}


/* v14: keep route controls + legend reachable */
.hero{
  align-items:start;
}
.sidebar{
  min-height:0;
  overflow:visible;
}
.timeline{
  max-height:360px;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
}
.legend,
.toolbar,
.sidebar > .note:last-child{
  flex:0 0 auto;
}
.sidebar .legend{
  position:sticky;
  bottom:54px;
  z-index:3;
  background:linear-gradient(180deg,rgba(255,255,255,.92),#fff 35%);
  padding-top:12px;
  margin-top:4px;
}
.sidebar .toolbar{
  position:sticky;
  bottom:0;
  z-index:4;
  background:#fff;
  padding:10px 0 2px;
  border-top:1px solid #efede7;
}
@media (max-width:800px){
  .sidebar .legend,
  .sidebar .toolbar{
    position:static;
  }
  .timeline{
    max-height:none;
    overflow:visible;
  }
}


/* v16: sidebar containment — nothing may leak outside the white panel */
@media (min-width:801px){
  .sidebar{
    display:flex !important;
    flex-direction:column;
    height:760px;
    min-height:760px;
    overflow:hidden !important;
  }

  .route-planning-block{
    display:flex;
    flex-direction:column;
    flex:1 1 auto;
    min-height:0;
    overflow:hidden;
  }

  .route-planning-block .section-title{
    flex:0 0 auto;
    margin-bottom:5px;
  }

  .sidebar .timeline{
    flex:1 1 auto;
    min-height:0;
    max-height:none !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    scrollbar-gutter:stable;
    padding-right:4px;
  }

  .sidebar .legend{
    position:static !important;
    inset:auto !important;
    z-index:auto !important;
    flex:0 0 auto;
    margin-top:8px;
    padding:10px 0 4px;
    background:#fff !important;
    border-top:1px solid #efede7;
  }

  .sidebar .toolbar{
    position:static !important;
    inset:auto !important;
    z-index:auto !important;
    flex:0 0 auto;
    padding:8px 0 4px;
    background:#fff !important;
    border-top:0 !important;
  }

  .sidebar > .note:last-child{
    flex:0 0 auto;
    margin-top:2px;
    padding-bottom:0;
  }
}

@media (min-width:801px) and (max-width:1180px){
  .sidebar{
    height:700px;
    min-height:700px;
  }
}

@media (max-width:800px){
  .sidebar{
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }
  .route-planning-block{
    display:block;
    overflow:visible;
  }
  .sidebar .timeline{
    max-height:none !important;
    overflow:visible !important;
  }
  .sidebar .legend,
  .sidebar .toolbar{
    position:static !important;
  }
}

/* v26: gecentreerde foto-marker met radar rondom de hoofden */
.ks-rider-marker{
  width:76px !important;
  height:58px !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  filter:drop-shadow(0 4px 6px rgba(0,0,0,.28));
  transform-origin:center center;
}

/* De foto blijft exact in het midden van de MapLibre-marker.
   Omdat de Marker in app.js anchor:'center' gebruikt, ligt dit middelpunt
   exact op de actuele/virtuele routecoördinaat. */
.ks-rider-marker img{
  position:relative;
  z-index:3;
  display:block;
  width:76px;
  height:58px;
  object-fit:contain;
  object-position:center;
  user-select:none;
  -webkit-user-drag:none;
}

/* Geen losse stip meer: twee transparante radargolven vanuit het midden. */
.ks-rider-marker.live::before,
.ks-rider-marker.live::after{
  content:"";
  position:absolute;
  z-index:1;
  left:50%;
  top:50%;
  width:72px;
  height:60px;
  border:2px solid rgba(229,106,54,.58);
  border-radius:50%;
  transform:translate(-50%,-50%) scale(.72);
  opacity:0;
  pointer-events:none;
  animation:ksHeadRadar 2.2s ease-out infinite;
}

.ks-rider-marker.live::after{
  animation-delay:1.1s;
}

.ks-rider-marker.estimated{
  opacity:.92;
}

@keyframes ksHeadRadar{
  0%{
    transform:translate(-50%,-50%) scale(.72);
    opacity:.72;
  }
  65%{
    opacity:.22;
  }
  100%{
    transform:translate(-50%,-50%) scale(1.55);
    opacity:0;
  }
}

@media (max-width:800px){
  .ks-rider-marker{
    width:66px !important;
    height:50px !important;
  }
  .ks-rider-marker img{
    width:66px;
    height:50px;
  }
  .ks-rider-marker.live::before,
  .ks-rider-marker.live::after{
    width:62px;
    height:52px;
  }
}

@media (prefers-reduced-motion: reduce){
  .ks-rider-marker.live::before,
  .ks-rider-marker.live::after{
    animation:none;
    opacity:.25;
    transform:translate(-50%,-50%) scale(1.1);
  }
}


/* v28: opvallende uitnodiging voor het onthaal */
.event-clock{
  display:grid;
  grid-template-columns:minmax(250px,.9fr) minmax(460px,1.45fr) auto;
  align-items:center;
  gap:24px;
  overflow:visible;
}

.finish-invite{
  position:relative;
  min-width:0;
  padding:16px 24px 17px;
  border:2px solid rgba(225,116,36,.62);
  border-radius:20px;
  background:
    radial-gradient(circle at 15% 20%,rgba(255,255,255,.95),rgba(255,255,255,0) 34%),
    linear-gradient(135deg,#fff5df 0%,#fffaf2 52%,#fff0cf 100%);
  box-shadow:
    0 7px 22px rgba(198,108,26,.16),
    0 0 0 5px rgba(238,154,55,.08);
  text-align:center;
  animation:finishInviteGlow 2.8s ease-in-out infinite;
}

.finish-invite[hidden]{
  display:none !important;
}

.finish-invite::before{
  content:"";
  position:absolute;
  inset:-4px;
  border-radius:23px;
  pointer-events:none;
  border:1px solid rgba(255,185,73,.34);
  opacity:.7;
}

.finish-invite-kicker{
  margin-bottom:5px;
  font-size:11px;
  line-height:1.2;
  font-weight:950;
  letter-spacing:.12em;
  color:#b65a1f;
}

.finish-invite-text{
  font-size:18px;
  line-height:1.24;
  font-weight:950;
  color:#1f1d1a;
}

.finish-invite .spark{
  position:absolute;
  z-index:2;
  color:#e6931b;
  line-height:1;
  pointer-events:none;
  text-shadow:0 0 8px rgba(245,168,46,.5);
  animation:finishSpark 2.15s ease-in-out infinite;
}

.finish-invite .spark-1{
  left:-10px;
  top:-7px;
  font-size:23px;
}
.finish-invite .spark-2{
  right:17px;
  top:-13px;
  font-size:18px;
  animation-delay:.5s;
}
.finish-invite .spark-3{
  right:-9px;
  bottom:-6px;
  font-size:22px;
  animation-delay:1s;
}
.finish-invite .spark-4{
  left:23px;
  bottom:-11px;
  font-size:16px;
  animation-delay:1.45s;
}

@keyframes finishInviteGlow{
  0%,100%{
    box-shadow:
      0 7px 22px rgba(198,108,26,.14),
      0 0 0 5px rgba(238,154,55,.06);
    transform:translateY(0);
  }
  50%{
    box-shadow:
      0 9px 28px rgba(198,108,26,.23),
      0 0 0 8px rgba(238,154,55,.11);
    transform:translateY(-1px);
  }
}

@keyframes finishSpark{
  0%,100%{
    transform:scale(.72) rotate(0deg);
    opacity:.28;
  }
  45%{
    transform:scale(1.2) rotate(13deg);
    opacity:1;
  }
  70%{
    transform:scale(.92) rotate(-7deg);
    opacity:.6;
  }
}

@media(max-width:1180px){
  .event-clock{
    grid-template-columns:minmax(220px,.85fr) minmax(340px,1.25fr) auto;
    gap:16px;
  }
  .finish-invite{
    padding:13px 17px 14px;
  }
  .finish-invite-text{
    font-size:16px;
  }
}

@media(max-width:850px){
  .event-clock{
    grid-template-columns:1fr auto;
    grid-template-areas:
      "copy countdown"
      "invite invite";
    gap:13px 12px;
  }
  .event-clock-copy{grid-area:copy}
  .event-countdown{grid-area:countdown}
  .finish-invite{
    grid-area:invite;
    width:100%;
    box-sizing:border-box;
    padding:14px 18px 15px;
    text-align:left;
  }
  .finish-invite-text{
    font-size:16px;
  }
}

@media(max-width:560px){
  .event-clock{
    grid-template-columns:1fr;
    grid-template-areas:
      "copy"
      "countdown"
      "invite";
  }
  .event-countdown{
    justify-self:start;
  }
  .finish-invite{
    text-align:left;
  }
  .finish-invite-kicker{
    font-size:10px;
  }
  .finish-invite-text{
    font-size:15px;
  }
}

@media(prefers-reduced-motion:reduce){
  .finish-invite,
  .finish-invite .spark{
    animation:none !important;
  }
}


/* v29: uitnodiging exact gecentreerd boven de kaartkolom */
@media (min-width:1181px){
  .event-clock{
    display:grid;
    grid-template-columns:300px minmax(560px,1fr) 350px;
    gap:16px;
    align-items:center;
  }

  .event-clock-copy{
    grid-column:1;
    min-width:0;
  }

  .finish-invite{
    grid-column:2;
    width:100%;
    box-sizing:border-box;
    justify-self:stretch;
    margin:0;
  }

  .event-countdown{
    grid-column:3;
    justify-self:end;
    text-align:right;
  }
}


/* v30: checkpoint hold – marker blijft op checkpoint, voorspelling pauzeert */
.ks-rider-marker.checkpoint-hold::before,
.ks-rider-marker.checkpoint-hold::after{
  animation-duration:2.8s;
}


/* v32: bij gedetecteerde stilstand blijft de marker op de echte GPS-fix staan */
.ks-rider-marker.stationary-hold::before,
.ks-rider-marker.stationary-hold::after{
  animation-duration:3.6s;
  opacity:.65;
}


/* v33: na 3 minuten zonder GPS terug naar laatst echte locatie */
.ks-rider-marker.gps-expired::before,
.ks-rider-marker.gps-expired::after{
  animation:none !important;
  opacity:.16;
  transform:translate(-50%,-50%) scale(1.08);
}


/* v35: slaap/rust-indicatie boven de fietsers bij gedetecteerde stilstand */
.ks-rider-marker .marker-zzz{
  position:absolute;
  left:50%;
  top:-18px;
  transform:translateX(-50%) rotate(-6deg);
  z-index:4;
  display:none;
  padding:1px 7px 2px;
  border-radius:999px;
  background:rgba(255,255,255,.94);
  border:1px solid rgba(225,116,36,.24);
  box-shadow:0 2px 8px rgba(0,0,0,.12);
  color:#4b4945;
  font-size:14px;
  font-weight:900;
  letter-spacing:.02em;
  line-height:1;
  text-transform:lowercase;
  pointer-events:none;
}

.ks-rider-marker.stationary-hold .marker-zzz{
  display:block;
  animation:markerZzzFloat 1.8s ease-in-out infinite;
}

@keyframes markerZzzFloat{
  0%,100%{
    transform:translateX(-50%) translateY(0) rotate(-6deg);
    opacity:.82;
  }
  50%{
    transform:translateX(-50%) translateY(-3px) rotate(-3deg);
    opacity:1;
  }
}

@media (max-width:800px){
  .ks-rider-marker .marker-zzz{
    top:-16px;
    font-size:12px;
    padding:1px 6px 2px;
  }
}

@media (prefers-reduced-motion: reduce){
  .ks-rider-marker.stationary-hold .marker-zzz{
    animation:none;
  }
}


/* v41: ETA-disclaimer */
.eta-disclaimer{
  margin:0;
  padding:9px 11px;
  border-radius:10px;
  background:#f7f4ee;
  border:1px solid #e7e1d7;
  color:#6d675e;
  font-size:11px;
  line-height:1.35;
  font-weight:600;
}


/* v44: overall en live snelheid naast elkaar */
.speed-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.speed-grid .metric:last-child{
  grid-column:1 / -1;
}
.speed-grid .metric{
  min-width:0;
}
.speed-grid .metric b{
  display:block;
  white-space:nowrap;
}

@media(max-width:560px){
  .speed-grid{
    grid-template-columns:1fr;
  }
  .speed-grid .metric:last-child{
    grid-column:auto;
  }
}


/* v45: afgesneden route + overgeslagen checkpoint */
.ks-map-marker.skipped{
  background:#ece9e3 !important;
  color:#777168 !important;
  border-color:#a9a39a !important;
  opacity:.92;
  position:relative;
}
.ks-map-marker.skipped::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:34px;
  height:3px;
  background:#b23b2c;
  border-radius:3px;
  transform:translate(-50%,-50%) rotate(-45deg);
  box-shadow:0 1px 2px rgba(255,255,255,.9);
}
.stop-row.skipped{
  opacity:.58;
}
.stop-row.skipped .stop-name,
.stop-row.skipped .stop-time{
  text-decoration:line-through;
  text-decoration-thickness:2px;
}
.stop-row.skipped .badge{
  color:#a13b30;
  font-weight:950;
}


/* v46: routeplanning weer duidelijk zichtbaar */
@media (min-width:801px){
  .sidebar{
    gap:10px !important;
  }

  .speed-grid{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:7px !important;
  }

  .speed-grid .metric:last-child{
    grid-column:auto !important;
  }

  .speed-grid .metric{
    padding:9px 7px !important;
  }

  .speed-grid .metric span{
    font-size:10px !important;
    line-height:1.15 !important;
  }

  .speed-grid .metric b{
    font-size:16px !important;
    line-height:1.2 !important;
  }

  .route-planning-block{
    display:flex !important;
    flex:1 1 auto !important;
    min-height:235px !important;
    overflow:hidden !important;
  }

  .route-planning-block .section-title{
    display:block !important;
  }

  .sidebar .timeline{
    display:flex !important;
    flex-direction:column !important;
    flex:1 1 auto !important;
    min-height:180px !important;
    overflow-y:auto !important;
  }
}

/* P6 is a deliberately skipped checkpoint on the dashed old route */
.ks-map-marker.skipped{
  z-index:3;
}


/* v47: locatie van de bezoeker */
.viewer-location-marker{
  position:relative;
  width:24px;
  height:24px;
  border-radius:50%;
  background:rgba(53,126,221,.16);
  border:2px solid rgba(255,255,255,.98);
  box-shadow:
    0 1px 6px rgba(0,0,0,.26),
    0 0 0 1px rgba(53,126,221,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:auto;
}

.viewer-location-core{
  width:11px;
  height:11px;
  border-radius:50%;
  background:#357edd;
  box-shadow:0 0 0 3px rgba(53,126,221,.20);
}

.viewer-location-marker::after{
  content:"";
  position:absolute;
  inset:-10px;
  border-radius:50%;
  border:2px solid rgba(53,126,221,.28);
  animation:viewerLocationPulse 2.2s ease-out infinite;
  pointer-events:none;
}

@keyframes viewerLocationPulse{
  0%{
    transform:scale(.65);
    opacity:.75;
  }
  100%{
    transform:scale(1.45);
    opacity:0;
  }
}

.viewer-location-status{
  padding:7px 9px;
  border-radius:9px;
  background:#f7f4ee;
  border:1px solid #e8e1d6;
  color:#716b63;
  font-size:10.5px;
  line-height:1.35;
}

.viewer-location-status.active{
  background:#eef5ff;
  border-color:#cbdcf7;
  color:#315e9d;
}

.viewer-location-status.error{
  background:#fff1ef;
  border-color:#f0cbc4;
  color:#98483d;
}

.toolbar button:disabled{
  opacity:.45;
  cursor:not-allowed;
}

button.secondary.active,
.button.secondary.active{
  background:#eef5ff;
  border-color:#9fbee9;
  color:#285d9f;
}

@media(prefers-reduced-motion:reduce){
  .viewer-location-marker::after{
    animation:none;
    opacity:.25;
  }
}


/* v48: native MapLibre geolocation control */
.maplibregl-user-location-dot,
.maplibregl-user-location-dot::before{
  background-color:#357edd !important;
}
.maplibregl-user-location-accuracy-circle{
  background-color:rgba(53,126,221,.14) !important;
}


/* v49: kaartknoppen altijd zichtbaar op de kaart */
.map-wrap{
  position:relative;
}

.map-controls{
  position:absolute;
  top:58px;
  right:12px;
  z-index:20;
  display:flex;
  flex-direction:column;
  gap:7px;
  width:132px;
  pointer-events:auto;
}

.map-controls button{
  width:100%;
  min-height:38px;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.96);
  border:1px solid rgba(35,32,28,.14);
  box-shadow:0 3px 12px rgba(0,0,0,.10);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  font-size:11px;
  font-weight:850;
  line-height:1.1;
}

.map-controls button:hover{
  background:#fff;
}

.map-controls .map-control-primary{
  background:#fff;
  border-color:#8fb6ea;
  color:#245b9d;
  box-shadow:0 4px 14px rgba(53,126,221,.17);
}

.map-controls .map-control-primary.active{
  background:#357edd;
  border-color:#357edd;
  color:#fff;
}

.map-controls button:disabled{
  opacity:.45;
  box-shadow:none;
}

.map-location-status{
  position:absolute;
  top:222px;
  right:12px;
  z-index:20;
  width:210px;
  margin:0;
  box-shadow:0 3px 12px rgba(0,0,0,.08);
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  pointer-events:none;
}

@media (max-width:800px){
  .map-controls{
    top:auto;
    right:10px;
    bottom:42px;
    width:126px;
    gap:6px;
  }

  .map-controls button{
    min-height:36px;
    padding:7px 8px;
    font-size:10.5px;
  }

  .map-location-status{
    top:auto;
    right:10px;
    bottom:205px;
    width:min(210px,calc(100% - 20px));
    font-size:10px;
  }
}
