:root {
  --magenta: #d6008f;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --bg: #fafaf7;
  --panel: #ffffffee;
  --live: #0a9c4c;
  --border: #e3e3df;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  padding: 10px 16px 6px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 .reg { color: var(--magenta); }

.status {
  font-size: 0.9rem;
  color: var(--muted);
}

.status.airborne { color: var(--live); font-weight: 600; }
.status.stale { color: #b45309; }

#controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 8px;
  flex-wrap: wrap;
}

#controls button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 36px;
}

#controls button:disabled { opacity: 0.4; cursor: default; }

#controls button.live {
  border-color: var(--live);
  color: var(--live);
  font-weight: 700;
  letter-spacing: 0.05em;
}

#controls button.live.on {
  background: var(--live);
  color: #fff;
}

#controls input[type=date] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.95rem;
  min-height: 36px;
  background: #fff;
  color: var(--ink);
}

.dayinfo {
  font-size: 0.85rem;
  color: var(--muted);
}

#map {
  flex: 1 1 auto;
  min-height: 60vh;
  width: 100%;
  background: #ffffff;
}

/* VFR-chart feel: soften the topo colours */
.pane-topo { filter: saturate(0.55) contrast(0.95); }

.flightlist {
  padding: 6px 16px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.flightlist .chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.flightlist .chip.active {
  border-color: var(--magenta);
  color: var(--magenta);
}

/* Aircraft marker: a div we rotate ourselves */
.ac-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  will-change: transform;
}

.ac-icon svg { width: 36px; height: 36px; }

.ac-icon.historic svg { width: 24px; height: 24px; opacity: 0.9; }

/* Data popup (Leaflet tooltip) */
.leaflet-tooltip.ac-data {
  background: var(--panel);
  border: 1px solid var(--magenta);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.leaflet-tooltip.ac-data .cs {
  font-weight: 700;
  color: var(--magenta);
}

.leaflet-tooltip.ac-data .age { color: var(--muted); }
.leaflet-tooltip.ac-data table { border-collapse: collapse; }
.leaflet-tooltip.ac-data td { padding: 0 6px 0 0; }
.leaflet-tooltip.ac-data td:last-child { text-align: right; padding: 0; font-variant-numeric: tabular-nums; }

.leaflet-tooltip-top.ac-data::before { border-top-color: var(--magenta); }

.snap-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--magenta);
  box-shadow: 0 0 0 2px #fff;
}

.leaflet-control-attribution { font-size: 10px; }

@media (max-width: 480px) {
  header { padding: 8px 16px 4px; }
  h1 { font-size: 1.1rem; }
  #controls { padding: 0 16px 6px; }
  #map { min-height: 65vh; }
}
