/* ============================================================
   SPACE ACADEMY — styles
   Change the CONTROL PANEL colors to re-skin the whole page.
   ============================================================ */

/* 🎛️ CONTROL PANEL */
:root {
  --bg-deep: #070a18;
  --text: #e9effd;
  --text-dim: #93a1c4;

  --accent: #22d3ee;
  --accent-bright: #8df2ff;
  --accent-ink: #032530;
  --accent-glow: rgba(34, 211, 238, 0.35);

  --shine-gold: #ffd75e;
  --shine-seafoam: #5df2c0;

  --star-blue: #a8ccff;
  --star-white: #f4f7ff;
  --star-yellow: #ffe9a8;
  --star-red: #ffb59e;

  --good: #5df2c0;
  --bad: #ff8a8a;

  --surface: rgba(148, 184, 255, 0.06);
  --surface-border: rgba(148, 184, 255, 0.18);

  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  --font-head: "Pacifico", cursive;
  --font-name: "Akaya Kanadaka", "Space Grotesk", sans-serif;

  --radius: 18px;
}

/* BASE */
*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

main, .top, .foot { position: relative; z-index: 1; }

h1, h2 { font-family: var(--font-head); font-weight: 400; line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2.2rem, 7vw, 4rem); }
h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); color: var(--accent-bright); }
h3 { font-family: var(--font-name); font-size: 1.5rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.8rem; }
strong { color: var(--accent-bright); }

/* HEADER */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 16px;
  background: rgba(7, 10, 24, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-border);
}
.logo { font-family: var(--font-name); font-size: 1.4rem; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top nav a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
}
.top nav a:hover { color: var(--accent-bright); }

/* LAYOUT */
main { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.panel { padding: 4.5rem 0 2rem; }
.kicker {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.sub { color: var(--text-dim); max-width: 60ch; }
.note { color: var(--text-dim); font-size: 0.9rem; font-family: var(--font-mono); margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* BUTTONS */
.btn, .chip {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.8rem 1.6rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  border: none;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 36px var(--accent-glow); }
.chip {
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
}
.chip:hover { border-color: var(--accent); }
.chip.active, .chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }

/* HERO */
.hero {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 0;
}
.shine {
  background: linear-gradient(90deg, var(--shine-gold), var(--shine-seafoam));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { font-size: 1.2rem; color: var(--text-dim); max-width: 55ch; }

/* PLANETS */
.scale-toggle { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }

.planet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 0.5rem;
  min-height: 170px;
  padding: 1.5rem 1rem;
  border-radius: var(--radius);
  background: radial-gradient(ellipse at left, rgba(255, 200, 80, 0.18), transparent 45%);
}
.planet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 12px;
}
.planet-btn:hover, .planet-btn.active { color: var(--accent-bright); }
.planet-btn.active .planet { box-shadow: 0 0 0 3px var(--accent), 0 0 28px var(--accent-glow); }

.planet {
  position: relative;
  display: block;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--paint);
  transition: width 0.6s ease, height 0.6s ease, box-shadow 0.2s;
  animation: bob 4s ease-in-out infinite;
  animation-delay: var(--delay);
}
/* Saturn's rings */
.planet.ringed::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190%;
  height: 46%;
  border-radius: 50%;
  border: max(2px, calc(var(--size) * 0.07)) solid rgba(230, 210, 160, 0.75);
  transform: translate(-50%, -50%) rotate(-18deg);
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.planet-card { margin-top: 1.25rem; display: grid; gap: 1rem; grid-template-columns: 1fr; }
.planet-card h3 { font-size: 2rem; color: var(--shine-gold); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 1rem;
  padding: 0;
  list-style: none;
}
.stats li {
  background: rgba(7, 10, 24, 0.55);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}
.stats span { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; }
.stats b { font-size: 1.05rem; }
.fact {
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  color: var(--text);
}

/* MOON */
.moon-lab {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}
#moonSvg { width: min(220px, 60vw); flex: none; filter: drop-shadow(0 0 18px rgba(255, 250, 220, 0.18)); }
.moon-info { flex: 1 1 260px; }
.phase-name { font-family: var(--font-name); font-size: 2rem; color: var(--shine-gold); margin: 0; }
.slider-label { display: block; margin: 1rem 0 0.3rem; font-size: 0.9rem; color: var(--text-dim); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin-bottom: 1rem; }

.size-compare { display: flex; align-items: center; gap: 1.5rem; margin: 0.5rem 0 1rem; }
.ball { display: block; border-radius: 50%; }
.ball.earth {
  width: 110px;
  height: 110px;
  background: radial-gradient(circle at 35% 30%, #7fd3ff, #1f6fd1 55%, #0d3a7a);
  box-shadow: inset -10px -8px 0 rgba(40, 160, 90, 0.55);
}
/* Moon width = 27.3% of Earth's — keep this exact! */
.ball.moon {
  width: calc(110px * 0.273);
  height: calc(110px * 0.273);
  background: radial-gradient(circle at 35% 30%, #f3f1e7, #9c998e);
}

/* STARS */
.path-pick { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.life-cycle {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  counter-reset: step;
}
.life-cycle li {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1rem;
  animation: pop 0.45s ease backwards;
  animation-delay: calc(var(--i) * 90ms);
}
.life-cycle li::before {
  content: counter(step);
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.8rem;
}
.life-cycle .emoji { font-size: 2.2rem; display: block; }
.life-cycle b { display: block; font-family: var(--font-name); font-size: 1.3rem; color: var(--accent-bright); }
.life-cycle p { font-size: 0.92rem; color: var(--text-dim); margin: 0; }
@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
}

.mini-head { margin-top: 2rem; }
.star-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
}
.swatch span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 22px var(--c);
  margin-bottom: 0.5rem;
}
.swatch small { color: var(--text-dim); font-size: 0.8rem; }

/* QUIZ */
.quiz-box { margin-top: 1rem; }
.q-progress { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-dim); }
.q-bar { height: 6px; border-radius: 999px; background: var(--surface-border); margin: 0.4rem 0 1.2rem; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--shine-seafoam)); transition: width 0.3s; }
.q-text { font-size: 1.3rem; font-weight: 600; }
.answers { display: grid; gap: 0.6rem; margin: 1rem 0; }
.answer {
  font: inherit;
  text-align: left;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: rgba(7, 10, 24, 0.55);
  color: var(--text);
  cursor: pointer;
}
.answer:hover:not(:disabled) { border-color: var(--accent); }
.answer.right { border-color: var(--good); background: rgba(93, 242, 192, 0.14); }
.answer.wrong { border-color: var(--bad); background: rgba(255, 138, 138, 0.14); }
.answer:disabled { cursor: default; }
.explain { min-height: 1.6em; }
.badge { text-align: center; }
.badge .medal { font-size: 4rem; display: block; animation: pop 0.6s ease; }

/* FOOTER */
.foot {
  text-align: center;
  padding: 2.5rem 16px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Calm mode for people who turn off motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 560px) {
  .top { flex-direction: column; gap: 0.3rem; }
  .planet-row { justify-content: center; }
}
