:root {
  color-scheme: dark;
  --bg: #0a0e1a;
  --panel: #131a2a;
  --border: #1f2638;
  --fg: #e8eaed;
  --muted: #8a93a7;
  --accent: #6cd4ff;
  --warn: #ff7b7b;
}

* { box-sizing: border-box; }

/* FOUC suppression: hide bound elements until Spektrum's bindDOM
 * finishes and strips the data-cloak attribute. Uses visibility so
 * the layout doesn't shift on reveal. */
[data-cloak] { visibility: hidden; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}

main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

h1 {
  font-weight: 200;
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -0.02em;
}

h2 {
  font-weight: 400;
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status-pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}
.status-pill.ready {
  color: var(--accent);
  border-color: var(--accent);
}

.map-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0.75rem;
  min-height: 70vh;
}

#map {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 70vh;
}

#map .leaflet-container .leaflet-control-attribution {
  background: transparent;
  opacity: 0.5;
}

/* Belt-and-braces against Leaflet's tile fade-in. The map-wide
 * fadeAnimation:false option handles most of it, but builds that ship
 * an inline `transition: opacity ...` style on tile <img> elements can
 * still slip a fade through. Force every tile to appear instantly. */
#map .leaflet-tile,
#map .leaflet-tile-loaded {
  transition: none !important;
}

.layers-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}

.layer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.layer-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.layer-opacity {
  width: 100%;
}

.color-mode {
  margin-top: 0.85rem;
  padding: 0.4rem 0.55rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}
.color-mode legend {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.3rem;
}
.color-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.timeline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.play-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scrubber {
  flex: 1;
}

.frame-meta {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 18rem;
  text-align: right;
}
.frame-meta code {
  color: var(--accent);
}

.kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.18em;
  width: 14px;
  height: 14px;
}
.kind-icon.observed { color: var(--accent); }
.kind-icon.interpolated { color: #c9c9c9; }
.kind-icon.forecast { color: #ffb86b; }

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pipe-stage {
  flex: 1 1 auto;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pipe-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pipe-value {
  font-size: 0.95rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.pipe-value.muted { color: var(--muted); }

.error {
  color: var(--warn);
  font-size: 0.9rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--panel);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

@media (max-width: 720px) {
  .map-wrap { grid-template-columns: 1fr; }
  #map { min-height: 50vh; }
  .frame-meta { min-width: 0; }
}

