/* Full-bleed dark map; a readout panel top-left and a time bar along the bottom, like the QGIS Temporal Controller. */
:root {
  --sea: #0b0f14;
  --panel: rgba(14, 20, 27, 0.86);
  --panel-solid: #0e141b;
  --line: rgba(160, 180, 200, 0.18);
  --fg: #e6edf3;
  --muted: #8b9bab;
  --accent: #00d1ff;
  --up: #7cd992;
  --down: #ff8a5c;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--sea); color: var(--fg); font: 14px/1.45 var(--font-body); overflow: hidden; }
#map { position: absolute; inset: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.panel {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; width: 340px; max-width: calc(100% - 32px);
  background: var(--panel); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 16px; z-index: 2; max-height: calc(100% - 170px); overflow-y: auto;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h1 { font-size: 1rem; font-weight: 600; margin: 0; text-wrap: balance; }
.collapse { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; font: 500 0.75rem var(--font-body); padding: 3px 8px; cursor: pointer; }
.panel.closed .panel-body { display: none; }
.panel-body { display: grid; gap: 10px; margin-top: 8px; }
.clock { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; margin: 0; font-variant-numeric: tabular-nums; }
.clock .muted { font-size: 0.95rem; }
.sub { margin: -6px 0 0; color: var(--muted); font-size: 0.78rem; }

.ports { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.port { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; cursor: pointer; }
.port-name { font-size: 0.85rem; }
.port-name small { color: var(--muted); }
.port-value { font-family: var(--font-mono); font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.port-value .pct { display: inline-block; min-width: 4.6em; }
.pct.up { color: var(--up); }
.pct.down { color: var(--down); }
.spark { grid-column: 1 / -1; width: 100%; height: 30px; display: block; }
.spark .area { fill: rgba(0, 209, 255, 0.12); }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.spark .base { stroke: var(--muted); stroke-dasharray: 2 3; stroke-width: 1; }
.spark .cursor { stroke: var(--fg); stroke-width: 1; }
.spark .dot { fill: var(--fg); }
.port-error { color: var(--muted); font-size: 0.8rem; }

.atsea { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 10px; }
.atsea .count { font-family: var(--font-mono); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 0.8rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend .sw { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 6px currentColor; background: currentColor; flex: none; }
.legend .n { margin-left: auto; font-family: var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }

.status {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px;
  font-family: var(--font-mono); font-size: 0.85rem; max-width: calc(100% - 32px); text-align: center;
}
.status.error { border-color: var(--down); }

.controls {
  position: absolute; left: 16px; right: 16px; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 2;
  display: flex; align-items: center; gap: 14px; background: var(--panel); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.play { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); cursor: pointer; display: grid; place-items: center; }
.play svg { width: 20px; height: 20px; fill: #04131b; }
.play:focus-visible, .collapse:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline { flex: 1; min-width: 0; display: grid; gap: 2px; }
#slider { width: 100%; accent-color: var(--accent); margin: 0; }
.ticks { position: relative; height: 16px; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span::before { content: ""; position: absolute; left: 50%; top: -3px; width: 1px; height: 4px; background: var(--muted); }
.speed { display: grid; gap: 2px; flex: none; }
.speed select { background: var(--panel-solid); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; font: 0.8rem var(--font-mono); padding: 4px 6px; }

.credits {
  position: absolute; left: 16px; right: 16px; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 2;
  font-size: 0.72rem; color: var(--muted); line-height: 1.35;
  background: var(--panel); border-radius: 6px; padding: 3px 8px; width: fit-content; max-width: calc(100% - 32px);
}
.maplibregl-ctrl-bottom-right { bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
.maplibregl-ctrl-attrib { background: rgba(14, 20, 27, 0.7) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }

.deck-tooltip { font-family: var(--font-body) !important; font-size: 0.8rem !important; background: var(--panel-solid) !important; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px !important; }
.deck-tooltip b { font-size: 0.85rem; }

@media (max-width: 640px) {
  .panel { width: auto; right: 16px; padding: 10px 12px 12px; max-height: 40%; }
  .panel-body { gap: 6px; }
  .clock { font-size: 1.05rem; }
  .sub, .spark, .legend { display: none; }
  .ports { gap: 3px; }
  .atsea { padding-top: 6px; }
  .controls { gap: 10px; padding: 8px 10px; bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
  .speed .label { display: none; }
  .credits { font-size: 0.66rem; }
  .maplibregl-ctrl-bottom-right { bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .controls { backdrop-filter: none; }
}
