:root {
  --bg: #0b1020;
  --panel: rgba(14, 19, 36, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e8ecf6;
  --muted: #8f98b3;
  --accent: #66c6ff;
  --accent-2: #b48cff;
  --observed: #4aa8ff;
  --forecast: #b48cff;
  --warn: #ffb86b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --dock: 240px; /* hoogte van het dok onderaan, gezet door app.js */
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
p { margin: 0 0 8px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

#map { position: fixed; top: 0; left: 0; right: 0; bottom: var(--dock); background: var(--bg); }
body.view-chart #map { display: none; }
.leaflet-container { font-family: var(--font); background: var(--bg); }
.leaflet-control-attribution {
  background: rgba(11, 16, 32, 0.7) !important;
  color: var(--muted) !important;
  font-size: 10px;
  backdrop-filter: blur(6px);
}
.leaflet-control-attribution a { color: var(--accent); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--panel-border) !important;
  backdrop-filter: blur(10px);
}
.leaflet-pane.radar-pane img {
  transition: opacity 140ms linear;
  image-rendering: auto;
  mix-blend-mode: normal;
}

/* ---- panelen ---- */
.panel {
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.brand {
  top: 14px; left: 14px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 14px;
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(102, 198, 255, 0.18), rgba(180, 140, 255, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5c6a8a; box-shadow: 0 0 0 0 rgba(102, 255, 170, 0.5);
}
.dot.live { background: #4dffa6; animation: pulse 2.4s ease-out infinite; }
.dot.stale { background: var(--warn); }
.dot.error { background: #ff5c7a; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(77, 255, 166, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(77, 255, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 255, 166, 0); }
}

.toolbar { display: flex; gap: 6px; padding-left: 6px; border-left: 1px solid var(--panel-border); }
[hidden] { display: none !important; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); }
.icon-btn[aria-pressed="true"] { background: rgba(102, 198, 255, 0.16); border-color: rgba(102, 198, 255, 0.35); color: var(--accent); }
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 11px; background: rgba(255, 255, 255, 0.05); margin-right: 4px; }
.seg .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
.seg .icon-btn svg { width: 18px; height: 18px; }
.icon-btn.busy { color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.close {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 8px; border: 0;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* weerbericht */
.report {
  top: 78px; left: 14px; width: 360px; max-width: calc(100vw - 28px);
  max-height: calc(100vh - var(--dock) - 100px); overflow: auto;
  padding: 14px 16px 10px;
}
.report h2 { margin-bottom: 4px; padding-right: 28px; }
.report details { margin: 4px 0 10px; }
.report summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.report details p { font-size: 13px; margin-top: 8px; white-space: pre-line; }
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 6px; }
.day {
  background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 8px 4px;
  text-align: center; font-size: 11px; color: var(--muted);
}
.day b { display: block; font-size: 13px; color: var(--text); margin: 2px 0; }
.day .rain { color: var(--accent); }

/* puntverwachting (in het dok) */
.spot-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.loc-search { width: 300px; max-width: 100%; position: relative; }
.loc-search input {
  width: 100%; background: rgba(255, 255, 255, 0.06); color: var(--text);
  border: 1px solid var(--panel-border); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px;
}
.loc-search input:focus { outline: none; border-color: rgba(102, 198, 255, 0.5); }
.suggest {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 5;
  margin: 0; padding: 4px; list-style: none;
  background: rgba(16, 22, 42, 0.97); border: 1px solid var(--panel-border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow: auto;
}
.suggest li {
  padding: 6px 9px; border-radius: 7px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.suggest li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li .type { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; flex: none; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: rgba(102, 198, 255, 0.14); }
.suggest li b { font-weight: 600; color: var(--accent); }
.suggest .empty { color: var(--muted); cursor: default; }
.icon-btn.small { width: 32px; height: 32px; flex: none; }
.icon-btn.small svg { width: 18px; height: 18px; }
#loc-fav[aria-pressed="true"] svg { fill: var(--warn); stroke: var(--warn); }
#loc-fav[aria-pressed="true"] { background: rgba(255, 184, 107, 0.14); border-color: rgba(255, 184, 107, 0.35); }
.favs { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 4px; }
.favs:empty { display: none; }
.fav {
  border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.04); color: var(--muted);
  border-radius: 999px; padding: 3px 9px; font-size: 12px; cursor: pointer;
}
.fav:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.fav.active { color: var(--accent); border-color: rgba(102, 198, 255, 0.4); background: rgba(102, 198, 255, 0.12); }
.spot-head { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.spot-text { min-width: 0; text-align: right; }
.spot-text h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-text p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-verdict {
  font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(77, 255, 166, 0.12); color: #4dffa6; white-space: nowrap; flex: none;
}
.spot-verdict:empty { display: none; }
.spot-verdict.wet { background: rgba(102, 198, 255, 0.16); color: var(--accent); }
.spot-verdict.now { background: rgba(180, 140, 255, 0.18); color: var(--accent-2); }
.spot-chart { position: relative; height: 120px; }
.spot-chart svg { width: 100%; height: 100%; display: block; overflow: hidden; }
.spot-chart .grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.spot-chart .area { fill: url(#spotgrad); }
.spot-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.spot-chart .ylabel { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.spot-chart .unit { fill: var(--muted); font-size: 10px; }
.spot-chart .skeleton { position: absolute; left: 0; right: 0; top: 10px; bottom: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); }
.spot-chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

/* weergave: alleen kaart / beide / alleen grafiek */
body.view-map .spot-bar, body.view-map .spot-chart { display: none; }
body.view-chart .dock { top: 72px; }
body.view-chart .tl-body { flex: 1; }
body.view-chart .spot-chart { flex: 1; height: auto; min-height: 120px; }
body.view-chart .legend { display: none; }

/* legenda */
.legend {
  right: 14px; bottom: calc(var(--dock) + 14px);
  padding: 8px 10px; width: 190px;
}
.legend-bar { height: 10px; border-radius: 6px; }
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 4px; }

/* dok: tijdlijn + puntverwachting */
.dock {
  left: 0; right: 0; bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0;
  padding: 10px 16px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.dock-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(145deg, var(--accent), #3b8bff);
  color: #061126; display: grid; place-items: center; flex: none;
  box-shadow: 0 6px 18px rgba(102, 198, 255, 0.35);
  transition: transform 100ms;
}
.play:active { transform: scale(0.95); }
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .ic-pause { display: none; }
.play.playing .ic-play { display: none; }
.play.playing .ic-pause { display: block; }
.tl-time { flex: none; min-width: 120px; }
.tl-clock { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.tl-kind { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.badge {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: rgba(74, 168, 255, 0.18); color: var(--observed);
}
.badge.forecast { background: rgba(180, 140, 255, 0.18); color: var(--forecast); }
.tl-controls { display: flex; gap: 10px; align-items: center; flex: none; }
.ctl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.ctl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ctl select {
  background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 4px 6px; font: inherit; font-size: 12px;
}
.ctl input[type=range] { width: 90px; accent-color: var(--accent); }

.tl-body { position: relative; display: flex; flex-direction: column; }
.tl-track {
  position: relative; height: 44px;
  border-radius: 10px; background: rgba(255, 255, 255, 0.04);
  cursor: pointer; touch-action: none; user-select: none; outline: none;
}
.tl-track:focus-visible { box-shadow: 0 0 0 2px rgba(102, 198, 255, 0.5); }
.tl-bars { position: absolute; inset: 4px 0; display: flex; align-items: flex-end; gap: 2px; padding: 0 2px; }
.tl-bar {
  flex: 1; min-height: 3px; border-radius: 3px 3px 1px 1px;
  background: var(--observed); opacity: 0.45; transition: opacity 120ms, transform 120ms;
}
.tl-bar.forecast { background: var(--forecast); }
.tl-bar.active { opacity: 1; transform: scaleY(1.04); transform-origin: bottom; }
.tl-bar.past { opacity: 0.3; }
.tl-now {
  position: absolute; top: 0; bottom: -2px; width: 0; border-left: 1px dashed rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.tl-now span {
  position: absolute; top: -2px; left: 4px;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.tl-cursor {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6); pointer-events: none; border-radius: 2px;
  transition: left 80ms linear;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), #fff 50%);
}
.tl-axis {
  position: relative; height: 14px; margin-top: -4px; font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tl-axis span { position: absolute; transform: translateX(-50%); }

/* stations */
.station {
  background: rgba(10, 14, 28, 0.82); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px; padding: 2px 7px 2px 5px; font-size: 11px; font-weight: 600;
  color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); transform: translate(-50%, -50%);
  backdrop-filter: blur(6px);
}
.station .arrow { width: 10px; height: 10px; flex: none; fill: var(--accent); }
.station .rain { color: var(--accent); font-weight: 500; }
.leaflet-tooltip.station-tip {
  background: var(--panel); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; padding: 8px 10px;
  backdrop-filter: blur(10px);
}
.leaflet-tooltip.station-tip::before { display: none; }
.station-tip b { display: block; margin-bottom: 2px; }
.station-tip .muted { font-size: 11px; }

.spot-marker {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(102, 198, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}

.toast {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 2000;
  background: rgba(255, 92, 122, 0.95); color: #fff; padding: 8px 14px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow);
}

/* ---- klein scherm ---- */
@media (max-width: 720px) {
  .brand { left: 10px; right: 10px; top: 10px; padding: 8px 10px; gap: 8px; }
  .brand h1 { font-size: 16px; }
  .brand .status { display: none; }
  .toolbar { margin-left: auto; gap: 2px; padding-left: 4px; }
  .seg { margin-right: 2px; }
  .seg .icon-btn, .toolbar .icon-btn { width: 30px; height: 30px; }
  .report { top: 64px; left: 10px; width: auto; right: 10px; }
  .legend { display: none; }
  .dock { padding: 8px 10px 6px; gap: 6px; }
  .dock-head { gap: 8px; }
  .tl-clock { font-size: 22px; }
  .tl-time { min-width: 0; }
  .spot-head { order: 5; flex-basis: 100%; justify-content: space-between; }
  .spot-text { text-align: left; }
  .tl-controls { margin-left: auto; }
  .ctl input[type=range] { width: 64px; }
  .ctl.speed { display: none; }
  .loc-search { width: auto; flex: 1; }
  .favs { flex-basis: 100%; margin-left: 0; }
  .spot-chart { height: 90px; }
  body.view-chart .dock { top: 58px; }
  .leaflet-control-zoom { display: none; }
}
