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

body {
  background: #000;
  color: #e0e0e0;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#scene-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  font-size: 14px;
  color: #aaa;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00aaff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#header {
  position: fixed;
  top: 16px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
}

#header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 170, 255, 0.4);
}

.subtitle {
  font-size: 11px;
  color: #667;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(transparent, rgba(0, 0, 10, 0.85) 30%);
  padding: 40px 20px 16px;
}

#info-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  padding: 0 8px 12px;
  justify-content: center;
}

.info-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  white-space: nowrap;
}

.info-label {
  font-size: 10px;
  color: #556;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 13px;
  color: #dde;
  font-weight: 500;
}

#timeline-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

#play-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

#play-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

#scrubber {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #00aaff;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: grab;
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.5);
}

#scrubber::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #00aaff;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: grab;
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.5);
}

#speed-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ccc;
  font-family: inherit;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

#speed-select option {
  background: #111;
  color: #ccc;
}

#video-panel {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 20;
  width: 340px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
}

#video-panel.hidden {
  display: none;
}

#video-iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

#video-close {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 21;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #ccc;
  font-size: 18px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

#video-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#legend {
  position: fixed;
  top: 220px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  transition: top 0.25s ease;
}

#legend.video-closed {
  top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #889;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.label-3d {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transform: translate(-50%, -100%);
  padding-bottom: 6px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

.label-earth {
  color: #6af;
}

.label-moon {
  color: #bbb;
}

.label-spacecraft {
  color: #fff;
  font-size: 12px;
  text-shadow: 0 0 10px rgba(0, 170, 255, 0.6), 0 0 4px rgba(0, 0, 0, 0.9);
}

.label-sun {
  color: #ffe080;
  text-shadow: 0 0 10px rgba(255, 200, 50, 0.5), 0 0 4px rgba(0, 0, 0, 0.9);
}

#github-link {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #667;
  text-decoration: none;
  font-size: 11px;
  pointer-events: auto;
  margin-top: 4px;
  transition: color 0.15s;
}

#github-link:hover {
  color: #aab;
}

#github-link svg {
  opacity: 0.7;
}
