:root {
  --accent: #1a7f37;
  --accent-donker: #14612a;
  --papier: #ffffff;
  --inkt: #22261f;
  --grijs: #6b7264;
  --rand: #e3e1d8;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--inkt);
  overscroll-behavior: none;
}

#map { position: fixed; inset: 0; background: #eef0e8; }

/* laadscherm */
.laden {
  position: fixed; inset: 0; z-index: 3000;
  background: #f6f4ef;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .4s;
}
.laden.weg { opacity: 0; pointer-events: none; }
.laden-kaart { text-align: center; }
.logo { font-size: 56px; }
.laden h1 { margin: 8px 0 4px; font-size: 32px; }
.laden p { color: var(--grijs); margin: 0; }

/* onderpaneel */
.paneel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000;
  background: var(--papier);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
  padding: 6px 20px calc(16px + env(safe-area-inset-bottom));
  max-height: 62vh; overflow-y: auto;
}
.paneel-greep {
  width: 44px; height: 5px; border-radius: 3px;
  background: var(--rand); margin: 6px auto 2px;
}
.paneel h2 { margin: 10px 0 12px; font-size: 22px; }

.modus { display: flex; gap: 8px; margin: 10px 0 14px; }
.modus button { flex: 1; padding: 12px; font-size: 17px; }
.modus button.actief {
  background: #f0f7ee; border-color: var(--accent);
  color: var(--accent-donker); font-weight: 700;
}

.rij { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.afstand-groot { font-size: 34px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.afstand-groot span { font-variant-numeric: tabular-nums; }
label { font-size: 17px; }

input[type=range] {
  width: 100%; margin: 14px 0 18px; accent-color: var(--accent);
  height: 34px;
}

.start-rij { margin-bottom: 14px; font-size: 16px; color: var(--grijs); }
.start-rij .gekozen { color: var(--inkt); font-weight: 600; }

button {
  font-family: inherit; font-size: 18px; border: 1.5px solid var(--rand);
  background: var(--papier); color: var(--inkt);
  border-radius: 14px; padding: 14px 18px; cursor: pointer;
}
button.groot { width: 100%; padding: 16px; font-size: 19px; margin-top: 8px; }
button.primair {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
button.primair:disabled { background: #b9c4b4; border-color: #b9c4b4; }
button.klein { padding: 8px 12px; font-size: 15px; border-radius: 10px; }
.knoppenrij { display: flex; gap: 10px; }
.knoppenrij .groot { margin-top: 8px; }
.knoppenrij #btn-start { flex: 2; }
.knoppenrij #btn-gpx, .knoppenrij #btn-wis { flex: 1; }

.hint { color: var(--grijs); font-size: 14px; margin: 12px 0 2px; }

/* rondje-opties */
.optie {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; margin-bottom: 10px;
}
.optie .letter {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.optie.actief { border-color: var(--accent); background: #f0f7ee; }
.optie .om { color: var(--grijs); font-size: 14px; }

/* knooppuntenbriefje */
.briefje { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.briefje .knoop, .bordjes-briefje .knoop {
  min-width: 44px; height: 44px; padding: 0 6px; border-radius: 10px;
  background: #f0f7ee; border: 1.5px solid var(--accent);
  color: var(--accent-donker); font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.knoop.gehad {
  opacity: .45; background: #ebebe3; border-color: #9a9a90; color: #666;
}
.knoop.nu { background: var(--accent); color: #fff; }
#route-titel small { color: var(--grijs); font-weight: 400; }

/* bordjes-modus */
.bordjes {
  position: fixed; inset: 0; z-index: 2500;
  background: #f6f4ef;
  display: flex; flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.bordjes[hidden] { display: none; }
.bordjes-kop { display: flex; justify-content: space-between; align-items: center; color: var(--grijs); }
.bordjes-nu { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bordjes-label { font-size: 22px; color: var(--grijs); }
.bordjes-nummer {
  font-size: min(46vw, 44vh); line-height: 1.05; font-weight: 800;
  color: var(--accent-donker); font-variant-numeric: tabular-nums;
}
.bordjes-afstand { font-size: 30px; color: var(--inkt); font-variant-numeric: tabular-nums; }
/* knooppuntenstrip in bordjes-modus */
.bordjes-briefje {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  scroll-behavior: smooth;
}
.bordjes-briefje .knoop { flex: none; }

/* bordjes-modus met kaart: overlay transparant, compacte kaart onderin */
.bordjes.kaart { background: transparent; pointer-events: none; }
.bordjes.kaart .bordjes-kop button,
.bordjes.kaart .bordjes-briefje,
.bordjes.kaart .bordjes-nu { pointer-events: auto; }
.bordjes.kaart #bordjes-info {
  background: rgba(255,255,255,.92); border-radius: 10px; padding: 4px 10px;
}
.bordjes.kaart .bordjes-nu {
  position: absolute; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  flex: none; background: #fff; border-radius: 18px;
  padding: 8px 22px 10px; box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.bordjes.kaart .bordjes-label { font-size: 14px; }
.bordjes.kaart .bordjes-nummer { font-size: 60px; }
.bordjes.kaart .bordjes-afstand { font-size: 19px; }
.bordjes.kaart .bordjes-briefje {
  position: absolute; left: 8px; right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.92); border-radius: 12px;
  padding: 6px 8px;
}

/* luchtfoto-toggle */
.luchtfoto-knop {
  position: fixed; right: 10px;
  top: calc(96px + env(safe-area-inset-top));
  z-index: 2600;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-weight: 600;
}

/* centreerknop in kaartmodus */
.centreer {
  position: absolute; right: 12px;
  bottom: calc(210px + env(safe-area-inset-bottom));
  pointer-events: auto; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-weight: 600;
}

/* positiemarker */
.pos-stip {
  width: 32px; height: 32px; border-radius: 50%;
  background: #2a6fdb; border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.pos-pijl { color: #fff; font-size: 16px; line-height: 1; }

/* start-/finishvlag op de kaart */
.vlag {
  transform: translate(-50%, -160%);
  color: #fff; font-weight: 700; font-size: 13px;
  padding: 3px 9px; border-radius: 9px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* landschapsprofiel */
.land-balk {
  display: flex; height: 14px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--rand); margin: 2px 0 6px;
}
.land-balk span { display: block; height: 100%; }
.land-tekst { font-size: 14px; color: var(--grijs); margin-bottom: 8px; }

/* afstandslabels op de route: kale tekst met witte gloed */
.kp-afstand {
  font-size: 12.5px; font-weight: 600; color: #14612a;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff, 0 0 5px #fff;
}

/* knooppunt-labels op de kaart: rond bordje, zoals langs de weg */
.kp-label {
  min-width: 30px; height: 30px; padding: 0 5px;
  border-radius: 999px;
  background: #fff; border: 2px solid var(--accent);
  color: var(--accent-donker);
  font-weight: 700; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.kp-label.in-route { background: var(--accent); color: #fff; }
