:root {
  color-scheme: dark;
  --bg: #02050d;
  --panel: rgba(8, 14, 28, 0.68);
  --panel-strong: rgba(5, 10, 22, 0.91);
  --line: rgba(196, 222, 255, 0.16);
  --text: #f4f8ff;
  --muted: #a6b5cc;
  --blue: #70c8ff;
  --blue-strong: #1d9bf0;
  --violet: #ad8cff;
  --success: #75f0b0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 62% 45%, rgba(22, 74, 130, 0.14), transparent 34%),
    var(--bg);
  color: var(--text);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.glass {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  position: fixed;
  z-index: 24;
  top: 18px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  padding: 10px 12px 10px 14px;
  border-radius: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(126, 206, 255, 0.35);
  border-radius: 50%;
  background:
    radial-gradient(circle at 66% 30%, rgba(255, 255, 255, 0.85) 0 2%, transparent 3%),
    radial-gradient(circle at 36% 62%, #2aa9ef 0 14%, #114a8d 38%, #09152b 68%, #030712 100%);
  box-shadow: 0 0 28px rgba(73, 176, 255, 0.22);
  font-weight: 800;
}

.brand-mark::after {
  position: absolute;
  width: 50px;
  height: 15px;
  border: 1px solid rgba(192, 222, 255, 0.42);
  border-radius: 50%;
  content: "";
  transform: rotate(-22deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.88rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.mission-badge {
  display: grid;
  justify-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.57rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.mission-badge strong {
  color: var(--text);
  font-size: 0.68rem;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-button,
.projector-button,
.primary-button,
.secondary-button,
.panel-action-button,
.journey-nav button,
.mobile-info-button {
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}

.icon-button:hover,
.projector-button:hover,
.primary-button:hover,
.secondary-button:hover,
.panel-action-button:hover,
.journey-nav button:hover {
  transform: translateY(-1px);
  border-color: rgba(154, 215, 255, 0.46);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.icon-button.is-active {
  background: rgba(112, 200, 255, 0.13);
}

.projector-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(35, 140, 217, 0.2), rgba(133, 83, 211, 0.16));
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-panel {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: clamp(22px, 6vw, 94px);
  width: min(550px, 47vw);
  transform: translateY(-44%);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hero-panel.is-hidden {
  pointer-events: none;
  opacity: 0;
  transform: translate(-30px, -44%);
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-panel h1 {
  max-width: 760px;
  margin: 16px 0 20px;
  font-size: clamp(3.1rem, 6.6vw, 7.1rem);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.88;
  text-wrap: balance;
  text-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
}

.hero-copy {
  max-width: 525px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.96rem, 1.2vw, 1.12rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.primary-button,
.secondary-button,
.panel-action-button {
  min-height: 48px;
  padding: 0 19px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 760;
}

.primary-button,
.panel-action-button {
  border-color: rgba(122, 211, 255, 0.45);
  background: linear-gradient(135deg, #168fd2, #6152d6);
  box-shadow: 0 15px 45px rgba(33, 137, 213, 0.25);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
}

.object-panel {
  position: fixed;
  z-index: 16;
  right: 22px;
  bottom: 22px;
  width: min(400px, calc(100vw - 44px));
  padding: 18px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 500ms ease, transform 500ms ease;
}

.object-panel.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-close-button {
  display: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.panel-heading h2 {
  margin: 5px 0 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 1px;
  padding: 7px 9px;
  border: 1px solid rgba(117, 240, 176, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(117, 240, 176, 0.055);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(117, 240, 176, 0.9);
}

.panel-copy {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.facts div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(196, 222, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.026);
}

.facts dt {
  color: var(--muted);
  font-size: 0.64rem;
}

.facts dd {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 720;
  text-overflow: ellipsis;
}

.panel-action-button {
  width: 100%;
  min-height: 46px;
  margin-top: 1px;
}

.source-note {
  margin: 13px 0 0;
  color: rgba(177, 193, 218, 0.66);
  font-size: 0.6rem;
  line-height: 1.5;
}

.journey-nav {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 350ms ease, transform 350ms ease;
}

.journey-nav.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.journey-nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
}

.journey-nav button.is-active {
  color: var(--text);
  background: rgba(112, 200, 255, 0.1);
}

.destination-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.earth-dot {
  background: #3a98e4;
  box-shadow: 0 0 12px rgba(58, 152, 228, 0.7);
}

.moon-dot {
  background: #d8d5cd;
  box-shadow: 0 0 10px rgba(216, 213, 205, 0.45);
}

.overview-dot {
  border: 1px solid rgba(160, 208, 255, 0.68);
  background: rgba(160, 208, 255, 0.12);
  box-shadow: 0 0 12px rgba(112, 200, 255, 0.32);
}

.journey-nav-line {
  width: 30px;
  height: 1px;
  background: rgba(196, 222, 255, 0.2);
}


.overview-labels {
  position: fixed;
  z-index: 13;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.overview-labels.is-visible {
  opacity: 1;
}

.world-label,
.distance-label {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.world-label {
  padding: 5px 8px;
  border: 1px solid rgba(190, 220, 255, 0.18);
  border-radius: 999px;
  background: rgba(3, 8, 18, 0.68);
  color: var(--text);
  font-size: 0.58rem;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.earth-label {
  color: #8fd6ff;
}

.moon-label {
  color: #ebe8df;
}

.distance-label {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.61rem;
  letter-spacing: 0.04em;
}

.journey-hud {
  position: fixed;
  z-index: 22;
  left: 50%;
  bottom: 24px;
  width: min(520px, calc(100vw - 32px));
  padding: 13px 15px;
  border-radius: 16px;
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
}

.journey-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.journey-heading,
.journey-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.journey-heading {
  font-size: 0.73rem;
  font-weight: 760;
}

.journey-heading strong {
  color: var(--blue);
}

.journey-track {
  height: 4px;
  margin: 10px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.journey-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #168fd2, #8b6de6, #dedbd1);
  box-shadow: 0 0 18px rgba(112, 200, 255, 0.5);
}

.journey-readout {
  color: var(--muted);
  font-size: 0.61rem;
}

.navigation-hint {
  position: fixed;
  z-index: 12;
  top: 96px;
  left: 50%;
  display: flex;
  gap: 15px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 450ms ease, transform 450ms ease;
}

.navigation-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.scale-marker {
  position: fixed;
  z-index: 8;
  right: 22px;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: rotate(-90deg) translateX(50%);
  transform-origin: right center;
  color: rgba(183, 201, 225, 0.64);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.scale-marker span {
  display: block;
  width: 56px;
  height: 1px;
  background: rgba(196, 222, 255, 0.35);
}

.mobile-info-button,
.panel-backdrop {
  display: none;
}

.loading-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background:
    radial-gradient(circle at center, rgba(16, 50, 94, 0.2), transparent 34%),
    #01030a;
  transition: opacity 700ms ease, visibility 700ms ease;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-symbol {
  position: relative;
  width: 64px;
  height: 64px;
}

.loading-symbol span,
.loading-symbol i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.loading-symbol span {
  border: 1px solid rgba(112, 200, 255, 0.38);
  animation: pulse 1.8s ease-in-out infinite;
}

.loading-symbol i {
  inset: 11px;
  background:
    radial-gradient(circle at 35% 35%, #6ecaff 0 4%, transparent 5%),
    radial-gradient(circle at 50% 50%, #1b6dae, #07142d 70%);
  box-shadow: 0 0 34px rgba(56, 159, 232, 0.25);
}

.loading-screen p {
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.loading-bar {
  width: 210px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.loading-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d9bf0, #ad8cff);
  transition: width 300ms ease;
}

body.projector-mode .topbar,
body.projector-mode .object-panel,
body.projector-mode .journey-nav,
body.projector-mode .navigation-hint,
body.projector-mode .scale-marker,
body.projector-mode .mobile-info-button {
  opacity: 0;
  pointer-events: none;
}

body.projector-mode {
  cursor: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@media (max-width: 800px) {
  .topbar {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr auto;
    min-height: 54px;
    padding: 7px 9px;
    border-radius: 16px;
  }

  .mission-badge {
    display: none;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand small,
  .top-actions .icon-button,
  .projector-button span {
    display: none;
  }

  .projector-button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.64rem;
  }

  .hero-panel {
    top: auto;
    right: 16px;
    bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
    left: 16px;
    width: auto;
    max-height: calc(100vh - 98px);
    overflow: auto;
    transform: none;
  }

  .hero-panel.is-hidden {
    transform: translateY(24px);
  }

  .hero-panel h1 {
    margin: 10px 0 14px;
    font-size: clamp(2.7rem, 13.7vw, 4.9rem);
  }

  .hero-copy {
    max-width: 520px;
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .hero-actions {
    margin-top: 20px;
  }

  .primary-button,
  .secondary-button {
    min-height: 44px;
    padding: 0 15px;
  }

  .object-panel {
    z-index: 31;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: min(69vh, 630px);
    overflow: auto;
    border-radius: 24px;
    opacity: 0;
    transform: translateY(calc(100% + 28px));
    pointer-events: none;
    overscroll-behavior: contain;
    transition: opacity 260ms ease, transform 340ms cubic-bezier(.22,.72,.25,1);
  }

  .object-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .panel-close-button {
    display: grid;
  }

  .panel-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: block;
    background: rgba(0, 3, 10, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }

  .panel-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-info-button {
    position: fixed;
    z-index: 19;
    right: 12px;
    bottom: max(68px, calc(68px + env(safe-area-inset-bottom)));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px 0 9px;
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 760;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .mobile-info-button span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #168fd2, #6152d6);
    font-family: Georgia, serif;
    font-size: 0.92rem;
    font-weight: 800;
  }

  .mobile-info-button.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .journey-nav {
    right: 12px;
    bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    left: 12px;
    justify-content: center;
    transform: translateY(16px);
  }

  .journey-nav.is-visible {
    transform: translateY(0);
  }

  .journey-hud {
    bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
  }

  .navigation-hint,
  .scale-marker {
    display: none;
  }

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

  .world-label {
    font-size: 0.52rem;
  }

  body.projector-mode .panel-backdrop {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 430px) {
  .hero-actions {
    display: grid;
  }

  .facts {
    grid-template-columns: 1fr 1fr;
  }

  .journey-readout span:last-child {
    display: none;
  }
}

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