:root {
  color-scheme: dark;
  --ink: #01030b;
  --glow: #8fcfff;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

#universe,
#cosmos {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#universe {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(12, 25, 55, .32), transparent 44%),
    #01030b;
}

#cosmos {
  z-index: 1;
  display: block;
  outline: 0;
}

#nebula {
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 16%, rgba(35, 44, 115, .13), transparent 35%),
    radial-gradient(ellipse at 84% 78%, rgba(108, 38, 118, .1), transparent 38%);
  mix-blend-mode: screen;
}

#nebula,
#vignette,
#transition-wash {
  position: absolute;
  inset: 0;
}

#vignette {
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 16vmax 3vmax rgba(0, 0, 8, .72);
  background: radial-gradient(circle, transparent 46%, rgba(0, 1, 8, .38) 100%);
}

#transition-wash {
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(190, 225, 255, .42), rgba(91, 112, 255, .09) 18%, transparent 56%);
  mix-blend-mode: screen;
  transition: opacity 360ms ease;
}

#transition-wash.is-flashing {
  opacity: .58;
}

#scale-nav {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: max(25px, calc(env(safe-area-inset-bottom) + 15px));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(166, 202, 255, .15);
  border-radius: 999px;
  background: rgba(3, 7, 20, .36);
  box-shadow: 0 8px 35px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .045);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.scale-dot {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 260ms ease, transform 260ms ease;
}

.scale-dot::after {
  position: absolute;
  inset: 4px;
  border: 1px solid transparent;
  border-radius: 50%;
  content: "";
  transition: border-color 260ms ease, box-shadow 260ms ease;
}

.scale-dot:hover {
  background: rgba(164, 207, 255, .08);
}

.scale-dot.is-active {
  background: rgba(143, 207, 255, .11);
  transform: scale(1.08);
}

.scale-dot.is-active::after {
  border-color: rgba(178, 222, 255, .58);
  box-shadow: 0 0 15px rgba(103, 170, 255, .36);
}

.icon {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
  opacity: .54;
  transition: opacity 260ms ease, filter 260ms ease;
}

.is-active .icon {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(154, 213, 255, .75));
}

.icon-earth {
  overflow: hidden;
  border: 1px solid #adddff;
  border-radius: 50%;
  background: #164a8a;
}

.icon-earth::before,
.icon-earth::after {
  position: absolute;
  border-radius: 60% 40%;
  background: #8ad5ab;
  content: "";
}

.icon-earth::before { width: 6px; height: 4px; top: 2px; left: 1px; transform: rotate(25deg); }
.icon-earth::after { width: 5px; height: 4px; right: 0; bottom: 1px; transform: rotate(-18deg); }

.icon-system::before,
.icon-system::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.icon-system::before {
  inset: 4px;
  background: #ffe9a8;
  box-shadow: 0 0 7px #ffb95d;
}

.icon-system::after {
  inset: 0;
  border: 1px solid rgba(192, 220, 255, .75);
  transform: rotate(-28deg) scaleY(.42);
}

.icon-galaxy {
  border-radius: 50%;
  background: conic-gradient(from 40deg, transparent, #c4d7ff 12%, transparent 25%, #9aabff 39%, transparent 52%, #e6edff 66%, transparent 79%, #9da9f2 91%, transparent);
  transform: scaleY(.65) rotate(-18deg);
}

.icon-galaxy::after {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 6px white;
  content: "";
}

.icon-group {
  border-radius: 50%;
  background: #dbe8ff;
  box-shadow: -6px 3px 0 -1px #8ca5e2, 6px -3px 0 -1px #b793dc, 5px 6px 0 -2px #7cc8e8;
}

.icon-universe {
  border: 1px solid #b9d7ff;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 9%, transparent 11% 31%, rgba(146, 192, 255, .6) 33% 38%, transparent 40% 61%, rgba(155, 126, 255, .45) 63% 69%, transparent 71%);
}

.edge-control {
  position: fixed;
  z-index: 8;
  top: 50%;
  display: grid;
  width: 54px;
  height: 78px;
  place-items: center;
  border: 1px solid rgba(164, 203, 255, .1);
  border-radius: 28px;
  background: rgba(3, 8, 20, .18);
  opacity: .52;
  cursor: pointer;
  backdrop-filter: blur(9px);
  transform: translateY(-50%);
  transition: opacity 220ms ease, background 220ms ease, transform 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.edge-control:hover {
  background: rgba(25, 45, 80, .34);
  opacity: 1;
}

.edge-control:active { transform: translateY(-50%) scale(.93); }
.edge-control:disabled { opacity: .1; pointer-events: none; }
.edge-control svg { width: 25px; fill: none; stroke: #d8e9ff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; }
#previous { left: max(18px, env(safe-area-inset-left)); }
#next { right: max(18px, env(safe-area-inset-right)); }

button:focus-visible,
#cosmos:focus-visible {
  outline: 2px solid rgba(172, 221, 255, .92);
  outline-offset: 3px;
}

#loader {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-content: center;
  background: #01030b;
  transition: opacity 420ms ease, visibility 420ms;
}

#loader.is-ready {
  visibility: hidden;
  opacity: 0;
}

#loader i {
  grid-area: 1 / 1;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(137, 194, 255, .18);
  border-top-color: rgba(186, 224, 255, .82);
  border-radius: 50%;
  animation: orbit 1.8s linear infinite;
}

#loader i:nth-child(2) { transform: scale(.67); animation-direction: reverse; animation-duration: 1.15s; }
#loader i:nth-child(3) { transform: scale(.25); border-color: rgba(255, 220, 142, .85); animation-duration: 2.6s; }

#webgl-fallback {
  position: fixed;
  z-index: 12;
  inset: 0;
  place-items: center;
  background: #01030b;
}

#webgl-fallback:not([hidden]) { display: grid; }
#webgl-fallback span { width: 86px; height: 86px; border: 1px solid rgba(126, 174, 230, .35); border-radius: 50%; box-shadow: 0 0 45px rgba(51, 100, 180, .22), inset 0 0 22px rgba(82, 130, 210, .16); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes orbit { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .edge-control { top: auto; bottom: max(19px, calc(env(safe-area-inset-bottom) + 9px)); width: 44px; height: 44px; border-radius: 50%; transform: none; }
  .edge-control:active { transform: scale(.92); }
  #previous { left: max(14px, env(safe-area-inset-left)); }
  #next { right: max(14px, env(safe-area-inset-right)); }
  #scale-nav { bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px)); gap: 2px; padding: 5px; }
  .scale-dot { width: 31px; height: 31px; }
  #vignette { box-shadow: inset 0 0 22vmax 5vmax rgba(0, 0, 8, .68); }
}

@media (max-height: 430px) {
  #scale-nav { bottom: max(9px, env(safe-area-inset-bottom)); }
  .edge-control { bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  #loader i { animation-duration: 8s; }
  #transition-wash, .scale-dot, .icon, .edge-control { transition-duration: 1ms; }
}
