* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #fff;
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Controls panel */
#controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#timestamp {
  font-size: 14px;
  color: #888;
  min-width: 100px;
}

#playback {
  display: flex;
  align-items: center;
  gap: 12px;
}

#play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #3b82f6;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#play-btn:hover {
  background: #2563eb;
}

#play-btn.playing {
  background: #ef4444;
}

#frame-slider {
  width: 200px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #333;
  border-radius: 3px;
  cursor: pointer;
}

#frame-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
}

#frame-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
}

#frame-time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
}

#layers {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

#layers label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #ccc;
}

#layers input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
}

/* Legend */
#legend {
  position: absolute;
  bottom: 90px;
  right: 20px;
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-title {
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-bar {
  height: 12px;
  width: 140px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    rgba(0, 255, 0, 0.7) 0%,
    rgba(0, 200, 0, 0.8) 15%,
    rgba(255, 255, 0, 0.9) 40%,
    rgba(255, 140, 0, 0.95) 60%,
    rgba(255, 0, 0, 1) 75%,
    rgba(150, 0, 150, 1) 100%
  );
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #888;
  margin-top: 4px;
}

/* Loading overlay */
#loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
  transition: opacity 0.3s;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Station markers */
.station-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.station-temp {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

.station-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  margin-top: 2px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Station popup */
.maplibregl-popup-content {
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  min-width: 140px;
}

.maplibregl-popup-close-button {
  color: #888;
  font-size: 18px;
}

.popup-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  color: #ccc;
}

.popup-value {
  color: #fff;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  #controls {
    flex-direction: column;
    width: calc(100% - 40px);
    gap: 12px;
  }

  #playback {
    width: 100%;
    justify-content: center;
  }

  #frame-slider {
    flex: 1;
    max-width: 200px;
  }

  #legend {
    bottom: auto;
    top: 20px;
  }
}
