/* =============================================
   ANKIE OP KAMP — Spelers CSS
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width:100%; height:100%; overflow:hidden; font-family:'Nunito',sans-serif; background:#1a1a2e; color:#fff; touch-action:manipulation; }

/* ── Start scherm ─────────────────────────── */
#start-screen { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#0f2027,#203a43,#2c5364); z-index:9999; }
.start-inner  { text-align:center; padding:2rem; max-width:420px; }
.start-logo   { font-size:5rem; margin-bottom:1rem; }
.start-inner h1 { font-size:2.2rem; font-weight:900; color:#fbbf24; margin-bottom:0.4rem; }
.start-inner p  { color:#94a3b8; font-size:1.1rem; margin-bottom:2rem; }
.btn-start {
  background:#fbbf24; color:#1a1a2e; border:none; border-radius:50px;
  font-family:'Nunito',sans-serif; font-weight:900; font-size:1.4rem;
  padding:1rem 3rem; cursor:pointer;
  box-shadow:0 6px 30px rgba(251,191,36,0.4); transition:transform 0.15s;
}
.btn-start:active { transform:scale(0.96); }
.start-hint { color:#64748b; font-size:0.85rem; margin-top:1rem; }

/* ── App & Kaart ──────────────────────────── */
#app { position:fixed; inset:0; }
#map { position:absolute; inset:0; }

/* ── Navigatie banner ────────────────────── */
#nav-banner {
  position:absolute; top:0; left:0; right:0;
  background:rgba(15,32,39,0.97); color:#fff;
  z-index:250; display:none; flex-direction:column;
  backdrop-filter:blur(4px);
  transition: background 0.4s;
}
/* Banner alleen zichtbaar als speler van route af is (offroute-modus class gezet door triggerOffRoute) */
#nav-banner.actief { display:flex; }
/* Gele offroute-modus: zelfde kleur als de gele terugkeerroute op de kaart */
#nav-banner.offroute-modus {
  background: rgba(60,45,0,0.97);
  border-bottom: 3px solid #FFD600;
}
#nav-stap { display:flex; align-items:center; gap:0.9rem; padding:0.65rem 1rem; border-bottom:1px solid rgba(255,255,255,0.1); }
#nav-pijl {
  width:58px; height:58px; min-width:58px; border-radius:14px;
  background:#3b82f6; display:flex; align-items:center; justify-content:center;
  transition:background 0.3s; flex-shrink:0;
  box-shadow:0 2px 8px rgba(0,0,0,0.4);
}
#nav-pijl svg { width:38px; height:38px; }
#nav-tekst { flex:1; font-size:1.05rem; font-weight:800; line-height:1.3; }
#nav-afstand { font-size:1.2rem; font-weight:900; color:#fbbf24; white-space:nowrap; min-width:70px; text-align:right; }
#nav-totaal { padding:0.3rem 1rem; font-size:0.8rem; color:#94a3b8; display:flex; gap:1.2rem; }

/* ── Speler pijl-marker op kaart ─────────────────────────── */
.speler-pijl-wrap {
  pointer-events: none;
  user-select: none;
}
.speler-pijl-ring {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
  transition: transform 0.4s cubic-bezier(0.25,0.8,0.25,1);
  will-change: transform;
}
.speler-pijl-svg {
  width: 48px;
  height: 48px;
  display: block;
}

/* ── Kaart markers (start / finish) ─────────────────────────── */
.kaart-marker { display:flex; flex-direction:column; align-items:center; cursor:default; }
.marker-paal {
  width:4px; height:28px;
  background:linear-gradient(to bottom,#334155,#1e293b);
  border-radius:0 0 3px 3px;
}
.marker-start-bord {
  background:#16a34a; color:#fff;
  font-family:'Nunito',sans-serif; font-weight:900; font-size:0.75rem;
  padding:0.25rem 0.6rem; border-radius:6px;
  border:2.5px solid #fff;
  box-shadow:0 2px 8px rgba(0,0,0,0.45);
  letter-spacing:0.05em; white-space:nowrap;
}
.marker-vlag-wrap { display:flex; flex-direction:column; align-items:center; }
.marker-vlag-blok {
  width:36px; height:22px;
  background-image:
    linear-gradient(45deg,#000 25%,transparent 25%),
    linear-gradient(-45deg,#000 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#000 75%),
    linear-gradient(-45deg,transparent 75%,#000 75%);
  background-size:8px 8px;
  background-position:0 0,0 4px,4px -4px,-4px 0;
  background-color:#fff;
  border:2.5px solid #1e293b;
  border-radius:3px 3px 0 0;
  box-shadow:0 2px 6px rgba(0,0,0,0.4);
}
.marker-vlag-label {
  background:#1e293b; color:#fff;
  font-family:'Nunito',sans-serif; font-weight:900; font-size:0.7rem;
  padding:0.15rem 0.5rem; border-radius:0 0 5px 5px;
  border:2px solid #334155; border-top:none;
  white-space:nowrap; box-shadow:0 2px 6px rgba(0,0,0,0.4);
}

/* ── Off-route alarm (rode rand gloed) ──── */
.offroute-alarm {
  position:absolute; inset:0; z-index:245; pointer-events:none;
  box-shadow: inset 0 0 0 8px rgba(239,68,68,0.95);
  animation: alarm-gloed 0.5s ease-in-out infinite alternate;
}
@keyframes alarm-gloed {
  from { box-shadow: inset 0 0 30px 12px rgba(239,68,68,0.7); }
  to   { box-shadow: inset 0 0 80px 30px rgba(239,68,68,1.0); }
}

/* ── Timer / Stopwatch banner ────────────── */
#timer-banner {
  position:absolute; top:0; left:0; right:0; z-index:260;
  background:rgba(15,32,39,0.97); color:#fff;
  display:flex; align-items:center; gap:0.7rem; padding:0.55rem 1rem;
  backdrop-filter:blur(4px); border-bottom:2px solid rgba(255,255,255,0.12);
}
#nav-banner.actief ~ #timer-banner,
#nav-banner.actief + #route-alert + #timer-banner {
  /* als nav-banner ook actief is, schuif timer-banner eronder */
  top:auto;
}
#timer-banner-label { font-size:0.85rem; color:#94a3b8; white-space:nowrap; }
.timer-banner-display {
  font-size:1.5rem; font-weight:900; font-variant-numeric:tabular-nums;
  flex:1; text-align:center; letter-spacing:0.04em;
}
.timer-banner-btn {
  background:rgba(255,255,255,0.15); color:#fff; border:1.5px solid rgba(255,255,255,0.3);
  border-radius:20px; padding:0.3rem 0.85rem; font-family:'Nunito',sans-serif;
  font-weight:800; font-size:0.9rem; cursor:pointer; white-space:nowrap;
  transition:background 0.15s;
}
.timer-banner-btn:active { background:rgba(255,255,255,0.3); }
.timer-banner-btn-stop   { border-color:#ef4444; color:#fca5a5; }
.timer-banner-btn-klaar  { border-color:#22c55e; color:#86efac; font-size:1rem; }

/* ── Route alert ─────────────────────────── */
/* Onder nav-banner — positie wordt ook via JS gezet in positioneerRouteAlert() */
.route-alert {
  position:absolute; top:12px; left:50%; transform:translateX(-50%);
  background:rgba(239,68,68,0.95); color:#fff; border-radius:16px;
  padding:0.9rem 1.8rem; text-align:center;
  box-shadow:0 4px 24px rgba(0,0,0,0.35); z-index:240; min-width:260px;
  animation:slideDown 0.4s ease;
  transition: padding 0.35s, border-radius 0.35s, min-width 0.35s;
}
/* Compact variant: kleinere padding, pill-vorm */
.route-alert.compact {
  padding:0.45rem 1rem;
  min-width:0;
  border-radius:20px;
}
.route-alert-compact { font-size:0.9rem; font-weight:800; white-space:nowrap; }
.route-alert .alert-icon { font-size:1.8rem; display:block; margin-bottom:0.2rem; }
.route-alert .alert-text { font-size:1.2rem; font-weight:900; display:block; }
.route-alert .alert-sub  { font-size:0.9rem; opacity:0.88; display:block; }
@keyframes slideDown { from{transform:translateX(-50%) translateY(-40px);opacity:0} to{transform:translateX(-50%) translateY(0);opacity:1} }

/* ── Bericht overlay ─────────────────────── */
.bericht-overlay {
  position:absolute; inset:0;
  background:rgba(0,0,0,0.75); z-index:600;
  display:flex; align-items:center; justify-content:center; padding:1.5rem;
  animation:fadeIn 0.3s ease;
}
.bericht-card {
  background:#1e3a5f; color:#fff; border-radius:24px; padding:2rem;
  max-width:480px; width:100%; box-shadow:0 16px 60px rgba(0,0,0,0.6);
  border:2px solid rgba(59,130,246,0.4);
}
.bericht-header { display:flex; align-items:center; gap:0.75rem; margin-bottom:1.2rem; }
.bericht-icon   { font-size:2rem; }
.bericht-card h2 { font-size:1.5rem; font-weight:900; color:#93c5fd; }
.bericht-card p  { font-size:1.15rem; line-height:1.65; margin-bottom:1.5rem; color:#e2e8f0; }

/* ── Opdracht overlay ────────────────────── */
.opdracht-overlay {
  position:absolute; inset:0; background:rgba(0,0,0,0.72); z-index:400;
  display:flex; align-items:center; justify-content:center; padding:1.5rem;
  animation:fadeIn 0.3s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.opdracht-card { background:#fff; color:#1e293b; border-radius:24px; padding:2rem; max-width:560px; width:100%; box-shadow:0 16px 60px rgba(0,0,0,0.5); max-height:90vh; overflow-y:auto; }
.opdracht-header { display:flex; align-items:center; gap:0.75rem; margin-bottom:1.2rem; position:relative; }
.opdracht-icon   { font-size:2rem; }
.opdracht-card h2 { font-size:1.5rem; font-weight:900; color:#1e3a5f; flex:1; }
.opdracht-sluit-btn {
  background:rgba(0,0,0,0.07); border:none; border-radius:50%;
  width:2.2rem; height:2.2rem; font-size:1.1rem; cursor:pointer;
  color:#64748b; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:background 0.15s;
}
.opdracht-sluit-btn:hover { background:rgba(0,0,0,0.14); color:#1e293b; }
#opdracht-afbeelding-wrap { margin-bottom:1rem; }
#opdracht-afbeelding { width:100%; border-radius:12px; max-height:220px; object-fit:cover; }
#opdracht-tekst { font-size:1.1rem; line-height:1.6; color:#374151; margin-bottom:1rem; }

/* ── Timer info in popup (handmatige start) ─ */
.opdracht-timer-info {
  display:flex; align-items:center; gap:0.5rem; margin-bottom:1rem;
  background:#fef3c7; border-radius:12px; padding:0.6rem 1rem;
}
.timer-label     { font-weight:700; color:#92400e; font-size:0.95rem; }
.timer-value     { font-size:1.8rem; font-weight:900; font-variant-numeric:tabular-nums; color:#1e3a5f; }
.timer-info-tekst { font-size:0.85rem; color:#78350f; flex:1; }

/* ── Beloning / straf badges ─────────────── */
.beloning-badge { border-radius:10px; padding:0.5rem 0.9rem; font-weight:700; font-size:0.95rem; margin-bottom:0.5rem; }
.beloning-badge.beloning { background:#dcfce7; color:#166534; border:1.5px solid #86efac; }
.beloning-badge.straf    { background:#fee2e2; color:#991b1b; border:1.5px solid #fca5a5; }

/* ── Voltooien / uitstellen / gefaald knoppen ─────── */
.opdracht-knoppen {
  display:grid; grid-template-columns:1fr 1fr; gap:0.5rem; margin-top:0.5rem;
}
.btn-klaar {
  background:#16a34a; color:#fff; border:none; border-radius:50px;
  font-family:'Nunito',sans-serif; font-weight:900; font-size:1.15rem;
  padding:0.9rem 0.5rem; cursor:pointer; box-shadow:0 4px 16px rgba(22,163,74,0.35);
  transition:transform 0.15s;
}
.btn-klaar:active { transform:scale(0.97); }
.btn-gefaald {
  background:#dc2626; color:#fff; border:none; border-radius:50px;
  font-family:'Nunito',sans-serif; font-weight:900; font-size:1.15rem;
  padding:0.9rem 0.5rem; cursor:pointer; box-shadow:0 4px 16px rgba(220,38,38,0.3);
  transition:transform 0.15s;
}
.btn-gefaald:active { transform:scale(0.97); }
.btn-uitstellen {
  width:100%; background:transparent; color:#64748b;
  border:1.5px solid #e2e8f0; border-radius:50px;
  font-family:'Nunito',sans-serif; font-weight:700; font-size:1rem;
  padding:0.65rem; cursor:pointer; margin-top:0.5rem;
  transition:background 0.15s;
}
.btn-uitstellen:hover { background:#f1f5f9; }

/* ── Resultaat overlay ───────────────────── */
.resultaat-overlay {
  position:absolute; inset:0; background:rgba(0,0,0,0.82); z-index:500;
  display:flex; align-items:center; justify-content:center; padding:2rem;
  animation:fadeIn 0.35s ease;
}
.resultaat-card { background:#fff; color:#1e293b; border-radius:24px; padding:2.5rem 2rem; max-width:420px; width:100%; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,0.6); }
.resultaat-emoji { font-size:4rem; margin-bottom:0.8rem; }
.resultaat-card h2 { font-size:1.8rem; font-weight:900; color:#1e3a5f; margin-bottom:0.6rem; }
.resultaat-card p  { font-size:1.1rem; color:#374151; line-height:1.5; margin-bottom:1.5rem; }

/* ── Opdrachten knop ─────────────────────── */
#btn-geschiedenis {
  position:absolute; bottom:3.2rem; left:1rem; z-index:150;
  background:rgba(15,32,39,0.92); border:2px solid rgba(255,255,255,0.2);
  color:#fff; border-radius:50px; padding:0.55rem 1.1rem;
  font-family:'Nunito',sans-serif; font-size:0.9rem; font-weight:700;
  cursor:pointer; display:flex; align-items:center; gap:0.4rem;
}
#btn-geschiedenis:active { background:rgba(59,130,246,0.5); }
#geschiedenis-badge { background:#3b82f6; color:#fff; border-radius:50px; padding:0.1rem 0.45rem; font-size:0.75rem; font-weight:900; min-width:1.2rem; text-align:center; }

/* ── Geschiedenis panel ──────────────────── */
#geschiedenis-panel {
  position:absolute; bottom:0; left:0; right:0; max-height:70vh;
  background:rgba(15,32,39,0.98); border-top:2px solid rgba(255,255,255,0.15);
  border-radius:20px 20px 0 0; z-index:350;    /* onder opdracht-overlay (z:300) maar boven kaart */
  display:flex; flex-direction:column;
  transform:translateY(100%); transition:transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
#geschiedenis-panel.open { transform:translateY(0); }
.panel-handle { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.2rem 0.6rem; border-bottom:1px solid rgba(255,255,255,0.1); }
.panel-handle h3 { font-size:1.1rem; font-weight:900; }
.panel-close { background:rgba(255,255,255,0.1); border:none; color:#fff; border-radius:50%; width:2rem; height:2rem; font-size:1rem; cursor:pointer; display:flex; align-items:center; justify-content:center; }
#geschiedenis-lijst { overflow-y:auto; padding:0.8rem 1rem 1.5rem; display:flex; flex-direction:column; gap:0.75rem; }
.gesch-item { background:rgba(255,255,255,0.06); border-left:4px solid #3b82f6; border-radius:10px; padding:0.75rem 1rem; }
.gesch-item.voltooid { border-left-color:#22c55e; }
.gesch-item.gefaald  { border-left-color:#ef4444; }
.gesch-titel  { font-weight:900; font-size:1rem; margin-bottom:0.25rem; }
.gesch-tekst  { font-size:0.88rem; color:#94a3b8; line-height:1.4; }
.gesch-status { font-size:0.75rem; margin-top:0.3rem; font-weight:700; }
.gesch-status.ontvangen { color:#60a5fa; }
.gesch-status.voltooid  { color:#4ade80; }
.gesch-status.gefaald   { color:#f87171; }
/* klikbaar item highlight */
.gesch-item-open { cursor:pointer; }
.gesch-item-open:active { background:rgba(255,255,255,0.12); }
.gesch-item:hover .gesch-status { text-decoration:underline; }
.geen-opdrachten { text-align:center; color:#64748b; padding:2rem; font-size:0.95rem; }

/* ── Status bar ──────────────────────────── */
#status-bar { position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,0.55); padding:0.4rem 1rem; display:flex; align-items:center; gap:0.6rem; font-size:0.85rem; z-index:100; }

/* ── Centreer / volgmodus knop ───────────────────────── */
.btn-centreer {
  position: absolute;
  right: 12px;
  bottom: 52px;   /* net boven de status-bar */
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(15,32,39,0.92);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.btn-centreer svg { width: 24px; height: 24px; }
.btn-centreer:active { transform: scale(0.93); }

/* Actieve staat: volgmodus aan — blauw oplichten */
.btn-centreer.actief {
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.45), 0 2px 10px rgba(0,0,0,0.45);
}

.gps-dot { width:10px; height:10px; border-radius:50%; display:inline-block; flex-shrink:0; }
.gps-searching { background:#f59e0b; animation:blink 1s ease-in-out infinite; }
.gps-good  { background:#22c55e; }
.gps-ok    { background:#86efac; }
.gps-weak  { background:#f97316; }
.gps-error { background:#ef4444; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.status-sep { opacity:0.4; }

/* ── Utility ─────────────────────────────── */
.hidden { display:none !important; }
.maplibregl-ctrl-bottom-right { bottom:2rem; }
.maplibregl-ctrl-attrib { font-size:0.7rem; }
