:root {
  --bg: #0f1216;
  --panel: rgba(18, 22, 28, 0.94);
  --line: #2a313b;
  --text: #e7eaee;
  --muted: #8b95a3;
  --accent: #ed7953;
  --ok: #5cc28a;
  --warn: #e5b94a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
#map { position: fixed; inset: 0; }

#panel {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: 340px;
  overflow-y: auto; padding: 16px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(6px); font-size: 14px; line-height: 1.4;
}
header h1 { margin: 0; font-size: 18px; font-weight: 650; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
section { padding: 14px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }
h2 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
a { color: #9cc7ff; }

.banner { margin-top: 12px; padding: 8px 10px; border-radius: 6px; background: #3a2f12; color: #f3d58a; font-size: 13px; }

.seg { display: flex; gap: 4px; background: #0b0e12; padding: 3px; border-radius: 7px; }
.seg button {
  flex: 1; border: 0; padding: 6px 8px; border-radius: 5px; background: transparent;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.seg button.on { background: #262d37; color: var(--text); }

.daynav { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.daynav button {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line);
  background: #161b22; color: var(--text); font-size: 18px; cursor: pointer;
}
.daynav button:disabled { opacity: .35; cursor: default; }
#daylabel { flex: 1; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
#daylabel small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

#spark { width: 100%; height: 56px; display: block; }
#spark .line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#spark .pt { fill: var(--accent); cursor: pointer; }
#spark .pt.sel { fill: #fff; }
#spark .hit { fill: transparent; cursor: pointer; }

#legend { margin-top: 12px; }
#legend-bar { height: 10px; border-radius: 3px; }
#legend-ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

#stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
#stats div { background: #0b0e12; border-radius: 6px; padding: 6px 8px; }
#stats dt { font-size: 11px; color: var(--muted); }
#stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

#passes { list-style: none; margin: 0; padding: 0; }
#passes li.pass {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px; margin: 0 -8px;
  border-radius: 6px; cursor: pointer;
}
#passes li.pass:hover, #passes li.pass.sel { background: #1b222b; }
.pass .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.pass .cd { color: var(--muted); font-size: 12px; text-align: right; }
.pass .meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; margin-left: 4px; }
.badge.day { background: #1f3a2b; color: var(--ok); }
.badge.night { background: #262a33; color: var(--muted); }

.toggle { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }

footer { padding-top: 12px; font-size: 12px; color: var(--muted); }
footer p { margin: 0 0 6px; }

.sat-marker {
  display: flex; align-items: center; gap: 4px; font-size: 11px; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; pointer-events: none;
}
.sat-marker i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }

.maplibregl-popup-content { background: #161b22; color: var(--text); font: 13px/1.4 system-ui, sans-serif; padding: 10px 12px; }
.maplibregl-popup-tip { border-top-color: #161b22 !important; border-bottom-color: #161b22 !important; }
.maplibregl-popup-close-button { color: var(--muted); }
.popup table { border-collapse: collapse; }
.popup td { padding: 1px 8px 1px 0; vertical-align: top; }
.popup td:first-child { color: var(--muted); }

@media (max-width: 720px) {
  #panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 48vh;
    border-radius: 12px 12px 0 0; padding: 12px 16px;
  }
}
