:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2e37;
  --text: #e6e8eb;
  --muted: #8a8f98;
  --accent: #4f8cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 18px; margin: 0; }

.header-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  margin-left: 16px;
}
.header-links a:hover { text-decoration: underline; }

#status-bar {
  padding: 8px 20px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 20px;
}

@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.panel h2 {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
}

#three-container {
  width: 100%;
  height: 420px;
  border-radius: 8px;
  overflow: hidden;
  background: #05070a;
}

#map {
  width: 100%;
  height: 420px;
  border-radius: 8px;
}

#alt-legend {
  margin-top: 8px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(to right, #2b6cff, #33c8c8, #46d160, #e8c022, #e5484d);
  position: relative;
}

#alt-legend::before,
#alt-legend::after {
  position: absolute;
  top: 16px;
  font-size: 11px;
  color: var(--muted);
}
#alt-legend::before { content: attr(data-min); left: 0; }
#alt-legend::after { content: attr(data-max); right: 0; }

.readout {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 12px 20px;
}

.readout > div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.readout .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

.readout span:last-child {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .readout { grid-template-columns: repeat(2, 1fr); }
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 700 !important;
  width: fit-content;
}
.badge-good { background: rgba(70, 209, 96, 0.18); color: #46d160; }
.badge-warn { background: rgba(232, 192, 34, 0.18); color: #e8c022; }
.badge-bad { background: rgba(229, 72, 77, 0.18); color: #e5484d; }

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 24px;
}

.controls button {
  background: var(--accent);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.controls select {
  background: #0f1115;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
}

.timeline-wrap {
  position: relative;
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
}

#timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  pointer-events: none;
}

#timeline {
  position: relative;
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

#timeline::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  height: 6px;
  background: transparent;
}

#timeline::-moz-range-track {
  height: 6px;
  background: transparent;
}

#timeline::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

#timeline::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.timeline-legend {
  display: flex;
  gap: 20px;
  padding: 0 20px 16px;
  font-size: 12px;
  color: var(--muted);
}

.timeline-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

.dot-good { background: #46d160; }
.dot-warn { background: #e8c022; }
.dot-bad { background: #e5484d; }

.plane-marker {
  font-size: 18px;
  transform-origin: center;
}
