/* ==========================================================================
   Romantic Space Date Experience — Luxury Cinematic Styling
   Mobile-First, Glassmorphism, Editorial Typography, Atmospheric Space FX
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --bg-space: #03060d;
  --text-primary: #f8fafc;
  --text-secondary: rgba(248, 250, 252, 0.65);
  --text-muted: rgba(248, 250, 252, 0.4);

  --accent-gold: #fbbf24;
  --accent-rose: #f43f5e;
  --accent-blue: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);

  --glass-bg: rgba(15, 23, 42, 0.55);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.6);

  --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --safe-top: env(safe-area-inset-top, 16px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  background-image:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(76, 46, 120, 0.20) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 82% 72%, rgba(18, 62, 116, 0.22) 0%, transparent 72%),
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(9, 30, 62, 0.35) 0%, transparent 70%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Background Canvas Layer */
#space-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Subtle Film Grain Overlay */
.grain-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Atmospheric Bottom Light Sweep */
.light-sweep-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 95% 55% at 50% 88%, rgba(56, 189, 248, 0.18) 0%, transparent 72%);
  transition: background 1.2s ease;
}

/* UI Container */
#app {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ==========================================================================
   1. OPENING INTRO SCENE
   ========================================================================== */
.scene-intro {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: radial-gradient(ellipse at 50% 45%, rgba(3, 6, 13, 0.55) 0%, rgba(3, 6, 13, 0.9) 62%, rgba(3, 6, 13, 0.97) 100%);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-intro.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.intro-content {
  max-width: 640px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.intro-sequence-box {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.intro-text-line {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 6vw, 2.8rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  max-width: 90vw;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.0s cubic-bezier(0.16, 1, 0.3, 1), transform 1.0s cubic-bezier(0.16, 1, 0.3, 1);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 255, 255, 0.15);
}

.intro-text-line.active {
  opacity: 1;
  transform: translateY(0);
}

.btn-start-trip {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 36px;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-start-trip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.btn-start-trip:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 36px rgba(56, 189, 248, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-start-trip:active {
  transform: scale(0.97);
}

.btn-start-trip .btn-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.btn-start-trip:hover .btn-icon {
  transform: translateX(4px);
}

/* ==========================================================================
   2. TOP HUD HEADER
   ========================================================================== */
.header-hud {
  width: 100%;
  padding: calc(var(--safe-top) + 14px) 24px 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.header-hud.visible {
  opacity: 1;
  transform: translateY(0);
}

.hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.live-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-beacon 2s infinite;
}

@keyframes pulse-beacon {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px #10b981; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-hud {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon-hud:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

/* Audio Visualizer Waves inside HUD button */
.audio-waves {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.audio-waves span {
  width: 2.5px;
  background-color: var(--text-primary);
  border-radius: 2px;
  height: 4px;
  transition: height 0.2s ease;
}

.audio-waves.playing span:nth-child(1) { animation: wave-bar 1.1s ease-in-out infinite; }
.audio-waves.playing span:nth-child(2) { animation: wave-bar 0.8s ease-in-out infinite 0.2s; }
.audio-waves.playing span:nth-child(3) { animation: wave-bar 1.3s ease-in-out infinite 0.4s; }

@keyframes wave-bar {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* ==========================================================================
   3. CENTER STORY & PLANET TEXT OVERLAY
   ========================================================================== */
.main-stage {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 24px 0 24px;
  pointer-events: none;
}

.planet-story-card {
  text-align: center;
  max-width: 580px;
  width: 100%;
  margin-top: 6px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(4, 8, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 18px 24px;
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.planet-story-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.stop-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 4px;
  text-shadow: 0 0 12px var(--accent-glow);
}

.planet-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 255, 255, 0.2);
}

.planet-caption {
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  font-weight: 400;
  line-height: 1.4;
  color: rgba(248, 250, 252, 0.92);
  margin-bottom: 4px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.planet-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   5. BOTTOM NAVIGATION & HUD
   ========================================================================== */
.footer-hud {
  position: relative;
  width: 100%;
  padding: 12px 20px calc(var(--safe-bottom) + 8px) 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 30;
  background: rgba(3, 6, 13, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.footer-hud.visible {
  opacity: 1;
  transform: translateY(0);
}

.distance-tracker {
  display: flex;
  flex-direction: column;
}

.distance-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.distance-value {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: 'tnum';
  letter-spacing: 0.02em;
}

/* Route Timeline Dots */
.route-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.timeline-dot.active {
  background: var(--accent-blue);
  transform: scale(1.4);
  box-shadow: 0 0 10px var(--accent-blue);
}

.timeline-dot.completed {
  background: rgba(255, 255, 255, 0.6);
}

/* Nav Action Buttons */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-nav.prev {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-nav.prev:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-nav.prev:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-nav.next {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.25);
}

.btn-nav.next:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.6), rgba(56, 189, 248, 0.25));
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 8px 26px rgba(56, 189, 248, 0.4);
}

.btn-nav.next:active {
  transform: scale(0.97);
}

/* ==========================================================================
   6. FLIGHT MISSION LOG
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(3, 6, 13, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  max-width: 440px;
  width: 100%;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.9), 0 0 35px rgba(56, 189, 248, 0.15);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 4.5vw, 1.55rem);
  font-weight: 500;
  color: #fff;
  min-width: 0;
}

.btn-close-modal,
.btn-modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-close-modal:hover,
.btn-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: scale(1.05);
}

.flight-log-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 6px;
}

.log-entry-item {
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--accent-blue);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
}

.log-entry-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.log-entry-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   7. RESPONSIVE DESIGN & MOBILE POLISH
   ========================================================================== */
@media (max-width: 768px) {
  .header-hud {
    padding: calc(var(--safe-top) + 10px) 16px 8px 16px;
  }

  .hud-pill {
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  .main-stage {
    padding: 6px 16px 0 16px;
  }

  .planet-story-card {
    margin-top: 2px;
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 92vw;
  }

  .planet-title {
    font-size: 2.1rem;
    margin-bottom: 4px;
  }

  .planet-caption {
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 2px;
  }

  .planet-quote {
    font-size: 0.82rem;
  }

  .footer-hud {
    padding: 8px 12px calc(var(--safe-bottom) + 4px) 12px;
    gap: 8px;
  }

  .distance-label {
    font-size: 0.58rem;
  }

  .distance-value {
    font-size: 0.85rem;
  }

  .btn-nav {
    padding: 8px 12px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .route-timeline {
    padding: 5px 8px;
    gap: 5px;
  }

  .timeline-dot {
    width: 5px;
    height: 5px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    max-width: 92vw;
    padding: 20px 16px;
  }
}

/* Prefer-reduced-motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   8. FLIGHT DECK — VIGNETTE, WARP FX, TELEMETRY, END SCENE
   ========================================================================== */
:root {
  --accent-live: #38bdf8;
}

/* Cinematic corner falloff so the render sits in a lens */
.vignette-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 78% 62% at 50% 46%, transparent 40%, rgba(2, 4, 10, 0.55) 100%),
    linear-gradient(to bottom, rgba(2, 4, 10, 0.5) 0%, transparent 22%, transparent 62%, rgba(2, 4, 10, 0.82) 100%);
}

/* Warp ignition flash */
.warp-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 62%, rgba(224, 242, 254, 0.85) 0%, rgba(56, 189, 248, 0.35) 28%, transparent 62%);
}

.warp-flash.firing {
  animation: warp-ignite 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes warp-ignite {
  0% { opacity: 0; transform: scale(0.9); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.12); }
}

/* In-flight banner */
.warp-banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  width: min(420px, 82vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border-radius: 20px;
  background: rgba(4, 10, 22, 0.5);
  border: 1px solid rgba(148, 197, 255, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 20;
}

.warp-banner.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.warp-banner-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #bae6fd;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.6);
  animation: warp-pulse 1.1s ease-in-out infinite;
}

@keyframes warp-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.warp-banner-target {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  color: #fff;
}

.warp-progress {
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.warp-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.2), var(--accent-live));
  box-shadow: 0 0 12px var(--accent-live);
}

/* Ship telemetry panel */
.telemetry {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%) translateX(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 14;
}

.telemetry.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 12px;
  border-right: 1px solid rgba(148, 197, 255, 0.22);
}

.telemetry-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(186, 230, 253, 0.5);
}

.telemetry-value {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(240, 249, 255, 0.92);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

/* Next-stop button turns quiet at the end of the route */
.btn-nav.next.is-final {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  color: rgba(248, 250, 252, 0.75);
}

/* Visited log entries */
.log-entry-item.visited {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.07);
}

/* ==========================================================================
   9. END OF JOURNEY
   ========================================================================== */
.scene-end {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  background: radial-gradient(ellipse at center, rgba(3, 6, 13, 0.72) 0%, rgba(3, 6, 13, 0.92) 100%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.scene-end.visible {
  opacity: 1;
  visibility: visible;
}

.end-card {
  width: min(560px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 34px 30px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(15, 26, 45, 0.85), rgba(4, 8, 18, 0.9));
  border: 1px solid rgba(148, 197, 255, 0.2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(18px) scale(0.97);
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-end.visible .end-card {
  transform: translateY(0) scale(1);
}

.end-badge {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent-live);
  text-shadow: 0 0 18px var(--accent-glow);
}

.end-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 6vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 44px rgba(148, 197, 255, 0.35);
}

.end-message {
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(248, 250, 252, 0.88);
  max-width: 44ch;
}

.end-footer {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.end-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary,
.btn-ghost {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-smooth);
  color: #fff;
}

.btn-primary {
  border: 1px solid rgba(186, 230, 253, 0.5);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(129, 140, 248, 0.3));
  box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.7);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -12px rgba(56, 189, 248, 0.9);
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(248, 250, 252, 0.8);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   10. MOBILE ADJUSTMENTS FOR THE FLIGHT DECK
   ========================================================================== */
@media (max-width: 768px) {
  .telemetry {
    top: auto;
    bottom: 122px;
    right: 0;
    left: 0;
    transform: translateY(10px);
    flex-direction: row;
    justify-content: center;
    gap: 0;
    text-align: center;
  }

  .telemetry.visible {
    transform: translateY(0);
  }

  .telemetry-item {
    padding: 0 14px;
    border-right: 1px solid rgba(148, 197, 255, 0.18);
    align-items: center;
  }

  .telemetry-item:last-child {
    border-right: none;
  }

  .telemetry-label { font-size: 0.52rem; }
  .telemetry-value { font-size: 0.74rem; }

  .warp-banner {
    top: 38%;
    padding: 14px 18px;
  }

  .warp-banner-target { font-size: 1.2rem; }

  .end-card {
    padding: 26px 20px;
    border-radius: 22px;
  }

  .end-message { font-size: 0.92rem; }

  .end-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-primary, .btn-ghost { width: 100%; }
}

/* The unlisted eighth stop */
.btn-surprise {
  border-color: rgba(253, 224, 71, 0.55);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.42), rgba(244, 114, 182, 0.28));
  box-shadow: 0 10px 30px -10px rgba(251, 191, 36, 0.8);
  animation: surprise-breathe 3.2s ease-in-out infinite;
}

.btn-surprise:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -12px rgba(251, 191, 36, 0.95);
}

@keyframes surprise-breathe {
  0%, 100% { box-shadow: 0 10px 30px -10px rgba(251, 191, 36, 0.55); }
  50% { box-shadow: 0 10px 38px -8px rgba(251, 191, 36, 0.95); }
}

.scene-end.is-surprise .end-card {
  border-color: rgba(253, 224, 71, 0.32);
  background: linear-gradient(160deg, rgba(46, 28, 16, 0.88), rgba(10, 6, 14, 0.92));
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 214, 150, 0.2);
}

.scene-end.is-surprise .end-badge {
  color: #fcd34d;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.45);
}

.scene-end.is-surprise .end-title {
  text-shadow: 0 0 46px rgba(251, 191, 36, 0.4);
}

.log-entry-item.secret {
  border-color: rgba(253, 224, 71, 0.4);
  background: rgba(251, 191, 36, 0.08);
}

/* ==========================================================================
   11. CREW MANIFEST & AUTOPILOT
   ========================================================================== */

/* Opening screen: type the two names */
.crew-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.crew-editor.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.crew-editor-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(186, 230, 253, 0.45);
}

.crew-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crew-input {
  width: min(180px, 34vw);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 197, 255, 0.22);
  background: rgba(8, 15, 28, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-align: center;
  letter-spacing: 0.04em;
  outline: none;
  transition: var(--transition-smooth);
}

.crew-input::placeholder {
  color: rgba(248, 250, 252, 0.32);
}

.crew-input:focus {
  border-color: rgba(186, 230, 253, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
  background: rgba(12, 22, 40, 0.8);
}

.crew-plus {
  font-size: 0.95rem;
  color: rgba(248, 250, 252, 0.45);
}

/* Two ways to travel */
.intro-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-start-manual {
  margin-top: 2px;
  padding: 6px 10px;
  border: none;
  background: none;
  color: rgba(248, 250, 252, 0.45);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease, color 0.3s ease;
}

.btn-start-trip.visible ~ .btn-start-manual {
  opacity: 1;
  pointer-events: auto;
}

.btn-start-manual:hover {
  color: rgba(248, 250, 252, 0.85);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Editable crew names in the HUD */
.hud-passengers {
  gap: 6px;
}

.crew-prefix,
.crew-plus-hud {
  color: rgba(248, 250, 252, 0.45);
}

.crew-name {
  display: inline-block;
  min-width: 22px;
  padding: 1px 4px;
  border-radius: 6px;
  border-bottom: 1px dashed rgba(148, 197, 255, 0.3);
  text-transform: uppercase;
  outline: none;
  cursor: text;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.crew-name:empty::before {
  content: attr(data-placeholder);
  color: rgba(248, 250, 252, 0.35);
}

.crew-name:hover {
  background: rgba(148, 197, 255, 0.1);
  border-bottom-color: rgba(186, 230, 253, 0.6);
}

.crew-name:focus {
  background: rgba(56, 189, 248, 0.16);
  border-bottom-color: var(--accent-blue);
}

/* Autopilot button */
.btn-autopilot.engaged {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.16);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
}

.autopilot-icon {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  line-height: 1;
}

.restart-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Countdown to the next automatic jump */
.auto-countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.5s ease, max-height 0.5s ease;
}

.auto-countdown.visible {
  opacity: 1;
  max-height: 24px;
}

.auto-countdown-label {
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(186, 230, 253, 0.5);
  white-space: nowrap;
}

.auto-countdown-track {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.auto-countdown-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.3), var(--accent-live));
  box-shadow: 0 0 10px var(--accent-live);
}

@media (max-width: 768px) {
  .crew-editor { margin-top: 18px; }
  .crew-input { width: 38vw; padding: 9px 10px; font-size: 0.82rem; }
  .crew-name { min-width: 18px; }
}
