:root {
  --blauw: #0019a8;      /* Underground-blauw */
  --geel: #ffc917;       /* NS-geel */
  --paper: #f6f5f1;
  --card: #ffffff;
  --ink: #1a1a1a;
  --dim: #666660;
  --rand: #c9c7bf;
  --tint: #fff3c4;
  --trein: #f5b800;
  --metro: #0063d3;
  --tram: #e03e2f;
  --bus: #00854d;
  --veer: #0099ad;
  --overig: #6b6b6b;
  --ok: #00854d;
  --warn: #d97400;
  --bad: #d02b2b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Fira Sans", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#map { position: absolute; inset: 0; }
#map canvas { outline: none; }

/* ---------- merk: bord in bewegwijzeringsstijl ---------- */
/* stationsnaambalk: volledig ronde uiteinden, zoals de balk door de roundel */
.brand {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 10;
  background: var(--blauw);
  color: #fff;
  border-radius: 999px;
  padding: 12px 22px 11px;
}

.wordmark {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.w-dots { display: inline-flex; gap: 3px; }
.w-dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  animation: drift 2.8s ease-in-out infinite;
}
.w-dots i:nth-child(1) { background: var(--geel); }
.w-dots i:nth-child(2) { background: #4cd08b; animation-delay: 0.4s; }
.w-dots i:nth-child(3) { background: #ff6a5a; animation-delay: 0.9s; }
@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.live {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 6px;
}
.live strong { color: var(--geel); font-variant-numeric: tabular-nums; }
.pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--geel);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- filters + kleurkeuze ---------- */
.controls {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.chips { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

/* lijnbalken zoals het line status-bord: massief in de modaliteitskleur */
.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 3px;
  padding: 8px 12px;
  font: 600 13px "Fira Sans", sans-serif;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.chip:hover { filter: brightness(1.08); }
.chip .n { opacity: 0.75; font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.chip.off { background: #b9b7af !important; color: #f6f5f1 !important; opacity: 0.7; }

.colorby {
  display: inline-flex;
  border: 1px solid var(--rand);
  background: var(--card);
  border-radius: 4px;
  overflow: hidden;
}
.cb-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 600 12px "Fira Sans", sans-serif;
  padding: 7px 12px;
  cursor: pointer;
}
.cb-btn + .cb-btn { border-left: 1px solid var(--rand); }
.cb-btn.active { background: var(--blauw); color: #fff; }

/* ---------- detailpaneel ---------- */
.panel[hidden] { display: none; }

.panel {
  position: absolute;
  top: 12px; bottom: 12px; right: 12px;
  z-index: 20;
  width: min(370px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--rand);
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--blauw);
  color: #fff;
}

/* roundel-achtige lijnschijf */
.line-badge {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: 700 15px/1 "Fira Sans", sans-serif;
  border: 2.5px solid rgba(255, 255, 255, 0.85);
}

.panel-title { flex: 1; min-width: 0; }
.panel-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}
.panel-title p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
}

.close {
  flex: none;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.close:hover { background: rgba(255, 255, 255, 0.26); }

/* dienststatus zoals het service-statusbord */
.delay-hero {
  padding: 12px 15px;
  border-bottom: 1px solid var(--rand);
  border-left: 6px solid currentColor;
  font: 600 14px "Fira Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.delay-hero[hidden] { display: none; }
.delay-hero .dtijd { font-weight: 400; color: var(--dim); font-size: 13px; }
.delay-hero.ok { color: var(--ok); }
.delay-hero.warn { color: var(--warn); }
.delay-hero.bad { color: var(--bad); }
.delay-hero.none { color: var(--dim); }

/* haltelijst */
.stops {
  list-style: none;
  margin: 0;
  padding: 6px 0 12px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--rand) transparent;
}

.stop {
  display: grid;
  grid-template-columns: 48px 18px 1fr auto;
  align-items: center;
  gap: 0 8px;
  padding: 7px 14px 7px 10px;
  font-size: 13.5px;
}

.stop .time {
  font-weight: 500;
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* lijndiagram zoals in een metrostel: dikke lijnkleur met witte haltecirkels */
.stop .rail {
  position: relative;
  width: 18px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stop .rail::before {
  content: "";
  position: absolute;
  top: -8px; bottom: -8px;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  background: var(--accent, var(--blauw));
}
.stop:first-child .rail::before { top: 50%; border-radius: 3px 3px 0 0; }
.stop:last-child .rail::before { bottom: 50%; border-radius: 0 0 3px 3px; }
.stop .rail::after {
  content: "";
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent, var(--blauw));
  box-sizing: content-box;
}
.stop.skipped .rail::after { background: var(--accent, var(--blauw)); border-color: transparent; opacity: 0.35; }

.stop .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop .dchip {
  font-weight: 600;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  padding: 2px 6px;
}
.stop .dchip.ok { color: var(--ok); background: rgba(0, 133, 77, 0.1); }
.stop .dchip.warn { color: var(--warn); background: rgba(217, 116, 0, 0.12); }
.stop .dchip.bad { color: var(--bad); background: rgba(208, 43, 43, 0.1); }

.stop.passed { opacity: 0.42; }
.stop.skipped .name { text-decoration: line-through; color: var(--dim); }
.stop.next { background: var(--tint); }
.stop.next .rail::after { width: 12px; height: 12px; border-width: 3px; }
.stop.next .name { font-weight: 700; }
.stop.next .name::after {
  content: "volgende";
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--blauw);
  margin-left: 8px;
}

/* ---------- vertrekkenlijst (station) ---------- */
.dep {
  display: grid;
  grid-template-columns: 48px 34px 1fr auto;
  align-items: center;
  gap: 0 8px;
  padding: 7px 14px 7px 10px;
  font-size: 13.5px;
  border-bottom: 1px solid #f0efe9;
}
.dep .time {
  font-weight: 500;
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dep .dline {
  flex: none;
  border-radius: 3px;
  padding: 3px 0;
  text-align: center;
  font: 700 11px "Fira Sans", sans-serif;
}
.dep .dest { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep .dplat {
  font-size: 11px;
  color: var(--dim);
  background: var(--paper);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
}
.dep .dchip {
  font-weight: 600;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  padding: 2px 6px;
  margin-left: 6px;
}
.dep .dchip.ok { color: var(--ok); background: rgba(0, 133, 77, 0.1); }
.dep .dchip.warn { color: var(--warn); background: rgba(217, 116, 0, 0.12); }
.dep .dchip.bad { color: var(--bad); background: rgba(208, 43, 43, 0.1); }
.dep.skipped .dest { text-decoration: line-through; color: var(--dim); }
.dep-empty { padding: 16px 14px; color: var(--dim); font-size: 13.5px; }

/* ---------- tooltip ---------- */
.tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  background: var(--blauw);
  color: #fff;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12.5px;
  white-space: nowrap;
  transform: translate(12px, -50%);
}
.tooltip .tl { font-weight: 600; }
.tooltip .td { color: var(--geel); font-variant-numeric: tabular-nums; font-size: 12px; margin-left: 4px; }
.tooltip .ts { color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums; font-size: 12px; margin-left: 6px; }

/* ---------- credit ---------- */
.credit {
  position: absolute;
  left: 12px; bottom: 10px;
  z-index: 10;
  font-size: 10.5px;
  color: var(--dim);
  background: rgba(246, 245, 241, 0.88);
  padding: 4px 8px;
  border-radius: 3px;
}
.credit a { color: var(--ink); text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.maplibregl-ctrl-attrib { display: none !important; }

/* ---------- splash ---------- */
.splash {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: var(--blauw);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.4s;
}
.splash.gone { opacity: 0; pointer-events: none; }
.splash-mark {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.splash-mark .w-dots i { width: 9px; height: 9px; }
.splash p { color: rgba(255, 255, 255, 0.7); font-size: 14px; margin: 0; }

/* ---------- mobiel ---------- */
@media (max-width: 640px) {
  .panel {
    top: auto;
    left: 10px; right: 10px; bottom: 10px;
    height: 50vh;
    width: auto;
  }
  .brand { padding: 8px 12px 7px; }
  .wordmark { font-size: 20px; }
  .controls { top: auto; bottom: 12px; right: 10px; align-items: flex-end; }
  .chip { padding: 6px 9px 6px 7px; font-size: 12px; }
  .credit { display: none; }
}
