@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;500;600&display=swap');

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

body {
  background: #000;
  overflow: hidden;
  font-family: 'Rajdhani', sans-serif;
  color: #e0e8ff;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

canvas {
  display: block;
}

/* ============== TOGGLE BUTTONS ============== */
#ui-top-right {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1005;
  display: flex;
  gap: 12px;
}

#toggle-controls,
#btn-audio {
  width: 48px;
  height: 48px;
  background: rgba(10, 30, 80, 0.75);
  border: 1px solid rgba(80, 140, 255, 0.4);
  color: #8ab4e8;
  border-radius: 12px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#toggle-controls:hover,
#btn-audio:hover {
  background: rgba(20, 50, 120, 0.85);
  border-color: #5a9eff;
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(90, 158, 255, 0.4);
}

#btn-audio.playing {
  color: #ffcc00;
  border-color: rgba(255, 204, 0, 0.5);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
}

/* ============== CONTROLS PANEL ============== */
#controls-panel {
  position: fixed;
  top: 20px;
  left: 80px;
  z-index: 99;
  background: rgba(5, 12, 35, 0.88);
  border: 1px solid rgba(80, 140, 255, 0.35);
  border-radius: 14px;
  padding: 18px 22px;
  backdrop-filter: blur(16px);
  min-width: 280px;
  box-shadow: 0 8px 40px rgba(0, 40, 120, 0.4), inset 0 1px 0 rgba(100, 160, 255, 0.1);
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform-origin: top left;
}

#controls-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateX(-10px);
}

#controls-panel h3 {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #5a9eff;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.25);
}

.control-group {
  margin-bottom: 14px;
}

.control-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #8ab4e8;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.control-group label span {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  color: #5af0ff;
  background: rgba(0, 200, 255, 0.1);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(0, 200, 255, 0.2);
}

/* Speed slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, #1a3a7a, #3a7aff);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, #7ab8ff, #2060dd);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(100, 160, 255, 0.8);
  border: 2px solid rgba(180, 220, 255, 0.6);
  transition: box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 18px rgba(100, 200, 255, 1);
}

/* Buttons row */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.ctrl-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid rgba(80, 140, 255, 0.35);
  border-radius: 8px;
  background: rgba(20, 50, 120, 0.5);
  color: #8ab4e8;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.ctrl-btn:hover {
  background: rgba(40, 90, 200, 0.7);
  border-color: rgba(120, 180, 255, 0.7);
  color: #c8deff;
  box-shadow: 0 0 15px rgba(80, 150, 255, 0.35);
}

.ctrl-btn.active {
  background: rgba(60, 120, 255, 0.5);
  border-color: rgba(100, 180, 255, 0.8);
  color: #d0eaff;
  box-shadow: 0 0 18px rgba(80, 150, 255, 0.5);
}

/* Divider */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(80, 140, 255, 0.3), transparent);
  margin: 14px 0;
}

/* ============== PLANET INFO PANEL ============== */
#info-panel {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%) translateX(110%);
  z-index: 1000;
  background: rgba(5, 12, 35, 0.96);
  border: 1px solid rgba(80, 140, 255, 0.5);
  border-radius: 16px;
  padding: 0;
  /* Changed to allow scrollable content padding */
  backdrop-filter: blur(25px);
  min-width: 280px;
  max-width: 320px;
  max-height: 85vh;
  box-shadow: 0 10px 50px rgba(0, 30, 100, 0.6), inset 0 1px 0 rgba(100, 160, 255, 0.1);
  transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#info-panel.visible {
  transform: translateY(-50%) translateX(0);
}

.info-scroll-container {
  padding: 24px 26px;
  overflow-y: auto;
  flex: 1;
}

/* Custom scrollbar */
.info-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.info-scroll-container::-webkit-scrollbar-track {
  background: rgba(80, 140, 255, 0.05);
  border-radius: 10px;
}

.info-scroll-container::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #5a9eff, #2060dd);
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(80, 150, 255, 0.4);
}

.info-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #7ab3ff;
}

#info-astro-desc {
  margin-top: 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #c0d8ff;
  text-align: justify;
  background: rgba(80, 140, 255, 0.08);
  padding: 15px;
  border-radius: 12px;
  border: 1px dashed rgba(80, 140, 255, 0.3);
}

#info-astro-desc h4 {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: #5af0ff;
  margin-bottom: 10px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

#info-astro-desc h4::before {
  content: '✦';
  color: #FFD700;
}

/* Related Body Links */
.related-item-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 12px;
  background: rgba(80, 140, 255, 0.1);
  border: 1px solid rgba(80, 140, 255, 0.4);
  border-radius: 10px;
  color: #5a9eff;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.related-item-link:hover {
  background: rgba(80, 140, 255, 0.2);
  border-color: #5a9eff;
  color: #fff;
  box-shadow: 0 0 15px rgba(90, 158, 255, 0.3);
}

.related-item-link span {
  font-size: 16px;
}

#info-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #4a7abf;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

#info-close:hover {
  color: #9ac0ff;
}

#info-symbol {
  font-size: 52px;
  text-align: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(120, 200, 255, 0.8));
  line-height: 1;
}

#info-name {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: #c0d8ff;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

#info-subtitle {
  font-size: 11px;
  text-align: center;
  color: #4a7abf;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.info-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(80, 140, 255, 0.4), transparent);
  margin: 12px 0;
}

.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 0;
  gap: 10px;
}

.info-label {
  font-size: 12px;
  color: #4a7abf;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.info-value {
  font-size: 13px;
  font-weight: 600;
  color: #a8c8ff;
  text-align: right;
}

#info-color-accent {
  height: 3px;
  border-radius: 2px;
  margin-bottom: 16px;
}

/* ============== LOADING SCREEN ============== */
#loading {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #050d20 0%, #000510 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

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

.loading-title {
  font-family: 'Orbitron', monospace;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #5a9eff;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(90, 158, 255, 0.8);
}

.loading-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  color: #3a6abf;
  letter-spacing: 3px;
  margin-bottom: 40px;
}

.loading-ring {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(80, 140, 255, 0.15);
  border-top: 3px solid #5a9eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px rgba(90, 158, 255, 0.3);
}

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

/* ============== HELP HINT ============== */
#help-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 12, 35, 0.75);
  border: 1px solid rgba(80, 140, 255, 0.25);
  border-radius: 30px;
  padding: 6px 20px;
  font-size: 12px;
  color: #4a7abf;
  letter-spacing: 1px;
  backdrop-filter: blur(8px);
  z-index: 90;
  transition: opacity 1s ease;
  pointer-events: none;
}

#help-hint.fade {
  opacity: 0;
}

/* ============== TOOLTIP ============== */
#tooltip {
  position: fixed;
  background: rgba(5, 12, 35, 0.9);
  border: 1px solid rgba(80, 140, 255, 0.4);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #a8c8ff;
  pointer-events: none;
  z-index: 200;
  display: none;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(0, 40, 120, 0.5);
}

/* ============== ORBIT LINES TOGGLE ============== */
.control-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #8ab4e8;
}

.control-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #5a9eff;
  cursor: pointer;
}

/* ============== MOBILE RESPONSIVENESS ============== */
@media (max-width: 768px) {
  #ui-top-right {
    top: 16px;
    right: 16px;
    gap: 10px;
  }

  #toggle-controls,
  #btn-audio {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  #controls-panel {
    left: 20px;
    top: 80px;
    width: calc(100% - 40px);
    max-width: none;
    transform-origin: top center;
  }

  #controls-panel.hidden {
    transform: scale(0.95) translateY(-20px);
  }

  #info-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: 70vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }

  #info-panel.visible {
    transform: translateY(0);
  }

  #info-close {
    top: 12px;
    right: 12px;
    font-size: 20px;
    padding: 12px;
    background: rgba(80, 140, 255, 0.15);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 1px solid rgba(80, 140, 255, 0.3);
    backdrop-filter: blur(5px);
    z-index: 1001;
  }

  .info-scroll-container {
    padding: 30px 20px 40px;
  }

  #info-symbol {
    font-size: 44px;
  }

  #info-name {
    font-size: 18px;
  }

  .info-row {
    padding: 8px 0;
  }

  .info-label {
    font-size: 11px;
  }

  .info-value {
    font-size: 12px;
  }

  #info-astro-desc {
    font-size: 13px;
    line-height: 1.5;
  }
}

@media (max-height: 600px) {
  #info-panel {
    max-height: 85vh;
  }

  .info-scroll-container {
    padding-top: 20px;
  }

  #info-symbol {
    font-size: 36px;
    margin-bottom: 4px;
  }
}