#spaceZoom {
  position: absolute;
  z-index: 1000;
  left: 16px;
  bottom: calc(128px + env(safe-area-inset-bottom));
  box-shadow: 0 4px 16px #0003;
  font-size: 26px;
  color: var(--ink);
}

.space-view {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #edf6ff;
  background-color: #060b17;
  background-image:
    radial-gradient(ellipse at 30% 74%, #142c4880, transparent 65%),
    radial-gradient(1px 1px at 19% 48%, #deeaffc0 90%, transparent),
    radial-gradient(1px 1px at 78% 23%, #b7d1ff90 90%, transparent),
    radial-gradient(1px 1px at 37% 73%, #fff8 90%, transparent),
    radial-gradient(1px 1px at 9% 12%, #fff8 90%, transparent);
  background-size: auto, 223px 217px, 347px 181px, 401px 257px, 509px 389px;
}

.space-view[open] { animation: space-entry .48s ease-out both; }
.space-view::backdrop { background: #060b17; }

@keyframes space-entry {
  from { opacity: 0; }
  to { opacity: 1; }
}

.space-scene {
  position: absolute;
  inset: 0;
  width: min(100%, 1300px);
  height: min(100%, 900px);
  margin: auto;
}

.space-back {
  position: absolute;
  z-index: 1;
  top: calc(16px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #acbedd56;
  border-radius: 999px;
  background: #0d1627;
  color: #edf6ff;
}

.space-earth {
  position: absolute;
  top: 51%;
  left: 32%;
  width: min(53vw, 76vh, 670px);
  aspect-ratio: 1;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 48px #539de044, 0 0 5px #76bbf2;
}

.space-moon {
  position: absolute;
  top: 37%;
  left: 76%;
  width: clamp(80px, 13vw, 170px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}

.space-moon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 15px #bec8de24;
}

.space-pin {
  position: absolute;
  top: 31%;
  left: 59%;
  width: 13px;
  height: 13px;
  border: 2px solid #fff1df;
  border-radius: 50% 50% 50% 0;
  background: #ff5a36;
  box-shadow: 0 0 11px #ff887b;
  transform: rotate(-45deg);
}

.space-credit {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  margin: 0;
  color: #b6c3d8;
  text-align: center;
  font-size: 11px;
}

.moon-story {
  width: min(calc(100% - 28px), 560px);
  max-height: calc(100% - 28px);
  padding: 18px;
  border: 1px solid #687b97;
  border-radius: 20px;
  background: #101827;
  color: #edf6ff;
  box-shadow: 0 18px 80px #0009;
}

.moon-story::backdrop { background: #03060cd1; }
.moon-story form { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.moon-close { width: 44px; height: 44px; border: 1px solid #687b97; border-radius: 50%; background: #16233a; color: inherit; font-size: 25px; }
.moon-story img { display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; }
.moon-story h2 { margin: 12px 0 0; font: 600 clamp(29px, 5vw, 40px)/1.12 Caveat, cursive; }
.moon-story p { margin: 6px 0 4px; color: #b6c3d8; }
.moon-preview { display: block; width: 100%; max-height: 150px; object-fit: contain; margin: 6px 0; border-radius: 12px; }

@media (max-width: 600px) {
  .space-earth { top: 54%; left: 39%; width: min(70vw, 52vh); }
  .space-moon { top: 31%; left: 77%; width: clamp(74px, 23vw, 120px); }
}

@media (prefers-reduced-motion: reduce) {
  .space-view[open] { animation: none; }
}
