@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

:root {
  --gold: #ffb347;
  --orange: #ff6a00;
  --deep: #020408;
  --text: #e8d5b0;
  --dim: #7a6a50;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  cursor: crosshair;
}

/* ─── STARFIELD ─────────────────────────────── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ui-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 180;
  appearance: none;
  border: 1px solid rgba(255,179,71,0.18);
  background: rgba(2,6,14,0.76);
  color: var(--gold);
  border-radius: 999px;
  padding: 9px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 2.4px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 18px rgba(0,0,0,0.25);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ui-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(255,179,71,0.42);
  box-shadow: 0 0 22px rgba(255,120,0,0.16);
  background: rgba(8,12,20,0.88);
  color: #fff;
}

.ui-toggle:active {
  transform: translateY(0);
}

body.ui-hidden header,
body.ui-hidden .earth-panel,
body.ui-hidden .object-bar,
body.ui-hidden .legend {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.ui-hidden .ui-toggle {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ─── HEADER ─────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 36px 12px;
  background: linear-gradient(to bottom, rgba(2,4,8,0.92) 60%, transparent);
  pointer-events: none;
}

.label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--dim);
  font-family: 'Orbitron', sans-serif;
}

.earth-panel {
  position: fixed;
  top: 92px;
  left: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: clamp(150px, 15vw, 178px);
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(4,8,16,0.72), rgba(2,4,8,0.18));
  border: 1px solid rgba(255,179,71,0.12);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.earth-date {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 1.5px;
}

.earth-time {
  font-size: 20px;
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
}

.header-center {
  text-align: center;
  line-height: 1;
}

.object-bar {
  position: fixed;
  top: 92px;
  right: 20px;
  z-index: 120;
  width: clamp(168px, 16vw, 194px);
  max-height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  background: linear-gradient(180deg, rgba(4,8,16,0.76), rgba(2,4,8,0.24));
  border: 1px solid rgba(255,179,71,0.12);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.object-bar-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(255,179,71,0.8);
}

.object-bar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 4px;
}

.object-bar-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.object-chip {
  appearance: none;
  border: 1px solid rgba(255,179,71,0.14);
  background: rgba(2,6,14,0.78);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  letter-spacing: 1.6px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease, background 0.22s ease;
  backdrop-filter: blur(8px);
}

.object-chip:hover,
.object-chip.is-active {
  transform: translateX(-1px) scale(1.01);
  border-color: rgba(255,179,71,0.5);
  box-shadow: 0 0 16px rgba(255,120,0,0.12);
  color: #fff;
  background: rgba(8,12,20,0.92);
}

#space-stage {
  position: fixed;
  inset: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  padding: 96px 248px 28px 248px;
}

#space-stage::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.header-center h1 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 8px;
  color: #fff;
  text-shadow:
    0 0 20px rgba(255,179,71,0.6),
    0 0 60px rgba(255,106,0,0.3);
  line-height: 1.15;
}

.header-center h1 span {
  color: var(--gold);
}

.subtitle {
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--dim);
  margin-top: 6px;
  font-family: 'Orbitron', sans-serif;
}

/* ─── SOLAR SYSTEM ───────────────────────────── */
#solar-system {
  position: relative;
  z-index: 1;
  width: 180vmax;
  height: 180vmax;
  min-width: 1100px;
  min-height: 1100px;
  margin: 0 auto;
}

/* ─── SUN ────────────────────────────────────── */
.sun {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  z-index: 10;
  cursor: pointer;
}

.sun:hover {
  filter: brightness(1.06);
}

.sun-surface {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
    #fff7c0 0%,
    #ffd040 18%,
    #ff9800 45%,
    #e65c00 75%,
    #8b2500 100%);
  animation: sun-pulse 3s ease-in-out infinite alternate;
}

.sun-corona {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255,180,50,0.35) 0%,
    rgba(255,100,0,0.18) 40%,
    transparent 70%);
  animation: corona-spin 12s linear infinite;
}

.sun-glow {
  position: absolute;
  inset: -60px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255,150,0,0.12) 0%,
    transparent 65%);
  animation: sun-pulse 4s ease-in-out infinite alternate-reverse;
}

@keyframes sun-pulse {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(1.04); opacity: 0.92; }
}

@keyframes corona-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── ORBITS ─────────────────────────────────── */
.orbit {
  position: absolute;
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  animation: orbit-spin var(--duration) linear infinite;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* planet-wrap positions planet at top of orbit */
.planet-wrap {
  position: absolute;
  top: 0;
  left: 50%;
  width: 64px;
  height: 64px;
  transform: translateX(-50%) translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── PLANETS ────────────────────────────────── */
.planet {
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), var(--color) 50%, rgba(0,0,0,0.4));
  box-shadow:
    0 0 8px 2px var(--glow),
    inset -2px -2px 5px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  /* counter-rotate so planet stays upright */
  animation: counter-spin var(--duration) linear infinite;
}

@keyframes counter-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

.planet:hover {
  transform: rotate(0deg) scale(1.6) !important;
  box-shadow:
    0 0 20px 6px var(--glow),
    0 0 40px 10px rgba(255,200,100,0.3),
    inset -2px -2px 5px rgba(0,0,0,0.5);
  z-index: 50;
}

.orbit:hover {
  animation-play-state: paused;
}

.orbit.is-selected,
.sun.is-selected {
  box-shadow: 0 0 0 1px rgba(255,179,71,0.35), 0 0 28px rgba(255,179,71,0.15);
}

.orbit.is-selected {
  animation-play-state: paused;
}

.orbit.is-selected .planet,
.orbit.is-selected .saturn-planet,
.orbit.is-selected .saturn-rings {
  animation-play-state: paused;
}

.planet-wrap:hover .planet,
.planet-wrap:hover .saturn-planet,
.planet-wrap:hover .saturn-rings {
  animation-play-state: paused;
}

/* ─── EARTH SPECIAL ──────────────────────────── */
.earth-planet {
  background: radial-gradient(circle at 35% 35%,
    rgba(255,255,255,0.7) 0%,
    #6ab4ff 20%,
    #2266cc 45%,
    #1a8040 60%,
    #2266cc 80%,
    rgba(0,0,20,0.6) 100%);
}

/* Moon */
.moon-orbit {
  position: absolute;
  width: 40px;
  height: 40px;
  top: 50%; left: 50%;
  margin: -20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  animation: orbit-spin 2.7s linear infinite;
  pointer-events: none;
}

.moon {
  position: absolute;
  width: 5px; height: 5px;
  background: radial-gradient(circle at 35% 35%, #f0f0e0, #aaa);
  border-radius: 50%;
  top: 0; left: 50%;
  transform: translateX(-50%) translateY(-50%);
  animation: counter-spin 2.7s linear infinite;
}

/* ─── SATURN RINGS ───────────────────────────── */
.saturn-group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saturn-planet {
  position: relative;
  z-index: 2;
  animation: counter-spin var(--duration) linear infinite;
}

.saturn-rings {
  position: absolute;
  width: 68px;
  height: 16px;
  border-radius: 50%;
  border: 5px solid rgba(200,170,80,0.55);
  box-shadow:
    0 0 0 2px rgba(180,140,50,0.3),
    0 0 0 5px rgba(160,120,30,0.15);
  pointer-events: none;
  z-index: 1;
  animation: counter-spin var(--duration) linear infinite;
}

/* ─── TOOLTIP ────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 200;
  background: rgba(2, 6, 14, 0.92);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 190px;
  max-width: 210px;
  pointer-events: none;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 30px rgba(255,120,0,0.15),
    0 4px 40px rgba(0,0,0,0.7);
  transition: opacity 0.15s;
}

.tooltip.hidden { opacity: 0; }

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tooltip-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  flex-shrink: 0;
}

.tooltip-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.8px;
  color: #fff;
  word-break: break-word;
}

.tooltip-divider {
  height: 1px;
  background: linear-gradient(to right, rgba(255,179,71,0.5), transparent);
  margin-bottom: 10px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 16px;
}

.tooltip-label {
  font-size: 6px;
  letter-spacing: 1.7px;
  color: var(--dim);
  font-family: 'Orbitron', sans-serif;
  white-space: nowrap;
}

.tooltip-row span:last-child {
  flex: 0 0 80px;
  font-size: 9px;
  color: var(--gold);
  text-align: right;
  line-height: 1.15;
  word-break: break-word;
}

.tooltip-earth-now {
  font-family: 'Orbitron', sans-serif !important;
  font-weight: 700 !important;
  color: #88ccff !important;
  font-size: 10px !important;
  line-height: 1.15;
}

.tooltip-fact {
  margin-top: 8px;
  font-size: 8px;
  color: rgba(232,213,176,0.6);
  line-height: 1.6;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 8px;
  font-style: italic;
}

/* ─── LEGEND ─────────────────────────────────── */
.legend {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.legend-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  letter-spacing: 4px;
  color: rgba(122,106,80,0.6);
  animation: pulse-text 3s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* Orbit label rings on hover (subtle glow) */
.orbit:hover {
  border-color: rgba(255,179,71,0.2);
}

@media (max-width: 1100px) {
  header {
    padding-inline: 20px;
  }

  .earth-panel,
  .object-bar {
    top: auto;
    bottom: 14px;
    max-height: 36vh;
  }

  .earth-panel {
    left: 12px;
  }

  .object-bar {
    right: 12px;
    width: 168px;
  }

  #space-stage {
    padding: 86px 200px 112px 200px;
  }
}

@media (max-width: 760px) {
  header {
    padding-top: 12px;
  }

  .earth-panel,
  .object-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .earth-panel {
    top: 80px;
    bottom: auto;
  }

  .object-bar {
    top: auto;
    bottom: 80px;
    max-height: 24vh;
  }

  #space-stage {
    padding: 180px 16px 172px 16px;
  }
}

