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

html, body {
  height: 100%;
  overflow: hidden;
  background: #04060f;
  color: #eef2ff;
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
}

#space {
  position: fixed;
  inset: 0;
  display: block;
}

.overlay {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

/* ---- Title ---- */
#title {
  top: 8vh;
  left: 0;
  right: 0;
  text-align: center;
  transition: opacity 0.2s linear;
}
#title h1 {
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 0 24px rgba(120, 170, 255, 0.55), 0 2px 0 rgba(0,0,0,0.4);
}
#title .sub {
  margin-top: 0.4rem;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  opacity: 0.85;
}

/* ---- Scroll hint ---- */
#hint {
  bottom: 9vh;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.2rem;
  opacity: 0.9;
  animation: bob 1.6s ease-in-out infinite;
  transition: opacity 0.4s;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---- HUD ---- */
#hud {
  top: 18px;
  left: 18px;
  padding: 10px 16px 12px;
  background: rgba(10, 16, 34, 0.72);
  border: 1px solid rgba(130, 170, 255, 0.25);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s;
  min-width: 210px;
}
#hud .hud-label {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  opacity: 0.65;
}
#hud .hud-km {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#hud .hud-sub {
  font-size: 0.8rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

.hidden { opacity: 0; }

/* ---- Arrival / report cards ---- */
.card {
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(24px);
  width: min(540px, calc(100vw - 32px));
  padding: 18px 22px;
  background: rgba(12, 18, 40, 0.88);
  border: 1px solid rgba(150, 185, 255, 0.35);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
}
.card.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.card h2 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}
.card ul {
  list-style: none;
  font-size: 0.95rem;
  line-height: 1.55;
}
.card .fine {
  font-size: 0.8rem;
  opacity: 0.65;
}
.card .funfact {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 214, 110, 0.12);
  border: 1px solid rgba(255, 214, 110, 0.3);
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.card-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#photonBtn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd24d, #ff9d2e);
  color: #2b1a00;
  box-shadow: 0 2px 12px rgba(255, 180, 60, 0.4);
}
#photonBtn:active { transform: scale(0.96); }
#photonResult {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd24d;
}
.card .truescale {
  margin-top: 12px;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ---- Perseverance skip ---- */
#skip {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 15, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.5s;
}
#skip.show { opacity: 1; }
.skip-inner {
  text-align: center;
  max-width: min(560px, 88vw);
  padding: 28px 32px;
  background: rgba(12, 18, 40, 0.92);
  border: 1px solid rgba(255, 214, 110, 0.4);
  border-radius: 22px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
}
.skip-medal { font-size: 3rem; }
.skip-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 6px;
}
.skip-sub {
  margin-top: 6px;
  font-size: 1rem;
  opacity: 0.85;
}

/* ---- Mission clock ---- */
#clock {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  padding: 8px 20px 10px;
  background: rgba(10, 16, 34, 0.72);
  border: 1px solid rgba(255, 214, 110, 0.35);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s,
              top 0.65s cubic-bezier(0.34, 1.35, 0.35, 1),
              transform 0.65s cubic-bezier(0.34, 1.35, 0.35, 1);
}
#clock .clock-label {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  opacity: 0.7;
}
#clock .clock-time {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffd24d;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
#clock .clock-speed {
  font-size: 0.72rem;
  font-weight: 700;
  color: #9fd6ff;
  min-height: 0.9rem;
  font-variant-numeric: tabular-nums;
}

#clock.center {
  top: 30%;
  transform: translateX(-50%) scale(1.3);
}
#clock.away {
  top: -120px;
  opacity: 0;
}
#hud .hud-label #unitToggle {
  pointer-events: auto;
  cursor: pointer;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid rgba(130, 170, 255, 0.4);
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: #9fd6ff;
}
#hud .hud-label #unitToggle:hover { background: rgba(130, 170, 255, 0.15); }

/* ---- Ship selector / guess cards ---- */
#ships, #guess {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 15, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#ships.show, #guess.show { opacity: 1; pointer-events: auto; }
.ships-inner {
  width: min(710px, 96vw);
  padding: 22px 30px 24px;
  background: rgba(12, 18, 40, 0.94);
  border: 1px solid rgba(255, 214, 110, 0.4);
  border-radius: 22px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  overflow: hidden;   /* the drum lives INSIDE this box, full stop */
}
.ships-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 12px; }
/* 3D rolodex: cards rotate on a cylinder facing the viewer */
.ships-list {
  position: relative;
  height: 348px;
  margin-top: 6px;
  perspective: 800px;
  transform-style: preserve-3d;
}
.ship-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(430px, 78vw);
  margin-left: max(-215px, -39vw);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: rgba(16, 24, 50, 0.96);
  border: 1.5px solid rgba(130, 170, 255, 0.3);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.38s cubic-bezier(0.3, 1.2, 0.4, 1), opacity 0.38s, border-color 0.2s;
  backface-visibility: hidden;
}
.ship-item.ro-sel {
  border-color: #ffd24d;
  background: rgba(30, 36, 66, 0.98);
  box-shadow: 0 6px 30px rgba(255, 214, 110, 0.18);
}
.ship-pic { width: 130px; height: 62px; flex: none; }
.ship-name { font-weight: 800; font-size: 1.05rem; }
.ship-item ul { list-style: none; margin-top: 2px; }
.ship-item li { font-size: 0.8rem; opacity: 0.85; line-height: 1.35; }
.ship-item li::before { content: '· '; color: #ffd24d; }
.pilot-label {
  margin-top: 14px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
}
.pilot-row { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.pilot-row input {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(130, 170, 255, 0.35);
  background: rgba(4, 6, 15, 0.6);
  color: #eef2ff;
  text-align: center;
}
#pilotName { width: 210px; }
#pilotAge { width: 130px; }
#launchBtn, #guessBtn {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 10px 26px;
  margin-top: 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd24d, #ff9d2e);
  color: #2b1a00;
  box-shadow: 0 2px 14px rgba(255, 180, 60, 0.45);
}
.ships-hint { margin-top: 10px; font-size: 0.75rem; opacity: 0.55; }
.guess-facts { list-style: none; text-align: left; font-size: 0.92rem; line-height: 1.5; display: flex; flex-direction: column; gap: 8px; }
.guess-q { margin-top: 14px; font-size: 1.05rem; font-weight: 700; }
.guess-row { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 6px; }
#guessInput {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  width: 160px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 214, 110, 0.5);
  background: rgba(4, 6, 15, 0.6);
  color: #ffd24d;
  text-align: center;
}
#guessBtn { margin-top: 6px; }
.guess-reveal { margin-top: 10px; font-size: 1.05rem; font-weight: 800; color: #ffd24d; min-height: 1.3rem; }

/* ---- Sound chip ---- */
#soundChip {
  bottom: 18px;
  right: 18px;
  padding: 7px 16px;
  background: rgba(10, 16, 34, 0.75);
  border: 1px solid rgba(130, 170, 255, 0.35);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #9fd6ff;
  pointer-events: auto;
  cursor: pointer;
  animation: chipPulse 2.2s ease-in-out infinite;
  transition: opacity 0.3s;
}
/* ---- Checkpoint jump menu (left, collapsed by default) ---- */
#chapters {
  top: 118px;
  left: 18px;
  pointer-events: auto;
  max-width: 250px;
}
#chaptersBtn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(159, 214, 255, 0.75);
  background: rgba(10, 16, 34, 0.45);
  border: 1px solid rgba(130, 170, 255, 0.25);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
#chaptersBtn:hover,
#chapters.open #chaptersBtn {
  color: #cfe6ff;
  background: rgba(16, 26, 52, 0.75);
  border-color: rgba(150, 190, 255, 0.5);
}
#chaptersList {
  display: none;
  margin-top: 8px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 6px;
  background: rgba(8, 13, 28, 0.62);
  border: 1px solid rgba(130, 170, 255, 0.22);
  border-radius: 12px;
  backdrop-filter: blur(7px);
  scrollbar-width: thin;
}
#chapters.open #chaptersList { display: block; }
#chaptersList button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  color: rgba(226, 236, 255, 0.78);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#chaptersList button:hover { background: rgba(90, 130, 220, 0.25); color: #fff; }
#chaptersList button.here { color: #ffd24d; background: rgba(255, 214, 110, 0.1); }

#soundChip.quiet { animation: none; opacity: 0.65; }
/* (the chip's big home-screen and in-panel modes retired with the music pull —
   it's a plain corner toggle for sound effects now) */
@keyframes chipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(159, 214, 255, 0.35); }
  50% { box-shadow: 0 0 14px 3px rgba(159, 214, 255, 0.25); }
}

/* ---- Autopilot toast ---- */
#toast {
  top: 92px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 22px;
  background: rgba(12, 18, 40, 0.9);
  border: 1px solid rgba(255, 214, 110, 0.45);
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Continue-Mission button (gated stations/chapters) ---- */
#navBtns {
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
}
#advanceBtn {
  transform: translateY(14px);
  padding: 13px 34px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #06122b;
  background: linear-gradient(135deg, #ffe27a, #ffb63c);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 26px rgba(255, 190, 60, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s, transform 0.45s;
  animation: advPulse 2.1s ease-in-out infinite;
}
#advanceBtn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#advanceBtn:active { transform: translateY(2px) scale(0.97); }

/* the quieter siblings: step back to the previous stop / skip a whole chapter */
#backBtn,
#skipBtn {
  transform: translateY(14px);
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #cfe0ff;
  background: rgba(18, 26, 52, 0.85);
  border: 1.5px solid rgba(150, 180, 255, 0.45);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s, transform 0.45s, background 0.2s, border-color 0.2s;
}
#backBtn.show,
#skipBtn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#backBtn:hover, #skipBtn:hover { background: rgba(32, 46, 84, 0.95); border-color: rgba(180, 205, 255, 0.7); }
#backBtn:active, #skipBtn:active { transform: translateY(2px) scale(0.97); }
@keyframes advPulse {
  0%, 100% { box-shadow: 0 6px 26px rgba(255, 190, 60, 0.5); }
  50% { box-shadow: 0 6px 34px rgba(255, 190, 60, 0.85); }
}
