* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; z-index: 1; }

#overlay {
  position: absolute; inset: 0; z-index: 400;
  pointer-events: none;
}

/* ── Panel (desktop) ── */
#panel {
  position: absolute; top: 12px; left: 12px; z-index: 1000;
  width: 270px; padding: 14px 16px;
  background: rgba(17, 24, 39, 0.92); color: #e5e7eb;
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
#panel h1 { margin: 0; font-size: 20px; letter-spacing: .5px; }
#panel .sub { margin: 2px 0 12px; font-size: 12px; color: #93c5fd; }
#panel hr { border: none; border-top: 1px solid #374151; margin: 12px 0; }

.row { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 13px; }
.row label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.row .lbl { font-size: 12px; color: #cbd5e1; min-width: 92px; }
.row input[type=range] { flex: 1; accent-color: #3b82f6; }
.row select {
  flex: 1; background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
  border-radius: 6px; padding: 3px 6px; font-size: 13px;
}

.time-row button {
  background: #2563eb; color: #fff; border: none; padding: 6px 10px;
  border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.time-row button:hover { background: #1d4ed8; }
.time { font-size: 12px; color: #fbbf24; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: #064e3b; color: #6ee7b7; white-space: nowrap;
}
.badge.old { background: #5b3a00; color: #fbbf24; }
.badge.fc  { background: #1e3a8a; color: #93c5fd; }

.radar-info { font-size: 12px; line-height: 1.4; }
.radar-info b { color: #38bdf8; }

#legend { margin-top: 12px; }
#legend .bar {
  height: 10px; border-radius: 5px; margin: 5px 0 3px;
  background: linear-gradient(90deg,#e5e7eb,#9ca3af,#fde047,#f97316,#ef4444,#a21caf);
}
#legend .scale { display: flex; justify-content: space-between; font-size: 10px; color: #9ca3af; }

#codes-legend { margin-top: 12px; }
#codes-legend .codes { display: flex; gap: 6px; margin-top: 5px; }
.code {
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; color: #111;
}
.code.c1 { background: #facc15; }
.code.c2 { background: #fb923c; }
.code.c3 { background: #ef4444; color: #fff; }

.prov-tip {
  font-size: 12px; line-height: 1.35; background: #111827; color: #e5e7eb;
  border: 1px solid #374151; border-radius: 6px;
}
.prov-tip .c1 { color: #facc15; } .prov-tip .c2 { color: #fb923c; } .prov-tip .c3 { color: #f87171; }

.status { margin-top: 10px; font-size: 11px; color: #9ca3af; min-height: 14px; }
.status.err { color: #fca5a5; }

.station-marker {
  background: #111827; color: #fff; border: 2px solid #38bdf8;
  border-radius: 6px; padding: 1px 5px; font-size: 11px; font-weight: 600;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

.temp-label {
  color: #111; font-size: 13px; font-weight: 800;
  padding: 3px 7px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  white-space: nowrap; pointer-events: none;
  border: 1.5px solid rgba(0,0,0,.25);
  display: inline-block;
}

/* ── Vaste playbar (verborgen op desktop) ── */
#playbar {
  display: none;
}
#panel-toggle {
  background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
  border-radius: 8px; padding: 0 12px; height: 36px;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
#panel-toggle:active { background: #374151; }
#play-m {
  background: #2563eb; color: #fff; border: none;
  border-radius: 8px; padding: 0 12px; height: 36px;
  font-size: 15px; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
#play-m:active { background: #1d4ed8; }
.playbar-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; flex-shrink: 0; min-width: 72px;
}

/* ── Mobiel: bottom-sheet + vaste playbar ── */
@media (max-width: 600px) {
  /* Vaste balk onderaan */
  #playbar {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100;
    align-items: center; gap: 8px;
    padding: 8px 12px 12px; /* extra onderkant voor swipe-home-balk */
    background: rgba(17,24,39,0.97);
    border-top: 1px solid #374151;
    backdrop-filter: blur(6px);
  }
  #playbar input[type=range] { flex: 1; accent-color: #3b82f6; height: 20px; }
  #playbar .time { font-size: 11px; }
  #playbar .badge { font-size: 10px; padding: 2px 6px; }

  #panel {
    /* Bottom-sheet — boven de playbar (60px) */
    position: fixed !important;
    top: unset !important; left: 0 !important; right: 0 !important;
    bottom: 60px !important; /* hoogte van de playbar */
    width: 100% !important; border-radius: 18px 18px 0 0;
    max-height: calc(75vh - 60px);
    overflow-y: auto;
    padding: 16px 18px 20px;
    transform: translateY(calc(100% + 60px));
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }

  /* Drag-indicator bovenaan het sheet */
  #panel::before {
    content: "";
    display: block;
    width: 40px; height: 4px;
    background: #4b5563; border-radius: 2px;
    margin: 0 auto 14px;
  }

  #panel.open {
    transform: translateY(0);
  }

  /* Verberg in-panel afspeelcontrols op mobiel (staan al in de playbar) */
  #panel .time-row,
  #panel .row:has(#live-badge) { display: none; }

  /* Grotere touch-targets */
  .row { margin: 10px 0; font-size: 15px; }
  .row label { gap: 10px; }
  .row input[type=checkbox] { width: 18px; height: 18px; }
  .row input[type=range] { height: 22px; }
  .row select { padding: 6px 8px; font-size: 15px; }
  .time-row button { padding: 10px 16px; font-size: 15px; }
  #panel h1 { font-size: 22px; }
  .lbl { font-size: 13px; }
  .badge { font-size: 12px; padding: 3px 10px; }
  .time { font-size: 13px; }
  .status { font-size: 12px; }

  /* Badge + tijd compact naast elkaar */
  .row:has(#live-badge) { gap: 10px; }

  /* Waarschuwingspaneel op canvas iets kleiner houden */
  /* (wordt getekend via JS, niet hier aanpasbaar) */
}

/* Kleine telefoons in landscape: sheet iets kleiner */
@media (max-width: 600px) and (orientation: landscape) {
  #panel { max-height: 90vh; }
  #panel-toggle { bottom: 10px; }
}
