/* The scene sits below the application. The application owns its own panels. */
.universe-scene {
  --universe-pointer-x: 0px;
  --universe-pointer-y: 0px;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
  background: #080b17;
  contain: strict;
}

.universe-base,
.universe-cloud,
.universe-nebula-image,
.universe-stars,
.universe-grain,
.universe-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.universe-base {
  background:
    radial-gradient(ellipse at 77% 1%, #25244a 0%, transparent 49%),
    radial-gradient(ellipse at 21% 52%, #15162e 0%, transparent 54%),
    linear-gradient(155deg, #101329 0%, #090d1d 53%, #070b15 100%);
}

.universe-cloud {
  inset: -14%;
  width: 128%;
  height: 128%;
  transform-origin: 70% 22%;
  will-change: transform;
}

.universe-cloud-near {
  opacity: .78;
  background:
    radial-gradient(ellipse 13% 8% at 72% 21%, #ab86e21f 0%, #7251b223 44%, transparent 100%),
    radial-gradient(ellipse 23% 6% at 64% 28%, #9065d926 0%, transparent 100%),
    radial-gradient(ellipse 30% 9% at 61% 23%, #7454bc31 0%, transparent 100%),
    radial-gradient(ellipse 24% 12% at 80% 18%, #59449d42 0%, transparent 100%),
    radial-gradient(ellipse 29% 12% at 83% 39%, #263e7a45 0%, transparent 100%),
    radial-gradient(ellipse 23% 11% at 31% 54%, #353b7733 0%, transparent 100%);
  animation: universe-cloud-near 42s ease-in-out infinite alternate;
}

.universe-cloud-far {
  opacity: .66;
  background:
    radial-gradient(ellipse 17% 6% at 53% 23%, #a1bce129 0%, transparent 100%),
    radial-gradient(ellipse 21% 4% at 70% 17%, #ced4ff25 0%, transparent 100%),
    radial-gradient(ellipse 31% 11% at 66% 18%, #b784e72a 0%, transparent 100%),
    radial-gradient(ellipse 16% 6% at 80% 31%, #5898bb26 0%, transparent 100%),
    radial-gradient(ellipse 39% 17% at 70% 26%, #3a327b30 0%, transparent 100%);
  animation: universe-cloud-far 58s ease-in-out infinite alternate;
}

/* Optional art can be supplied by the host via this custom property. */
.universe-nebula-image {
  inset: -4%;
  width: 108%;
  height: 108%;
  opacity: .46;
  background-image: var(--universe-nebula-image, none);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  mix-blend-mode: screen;
  mask-image: linear-gradient(#000 0%, #000a 40%, transparent 85%);
  transform: translate3d(calc(var(--universe-pointer-x) * .3), calc(var(--universe-pointer-y) * .3), 0);
  transition: transform 1.6s ease-out;
}

.universe-planet-wrap {
  position: absolute;
  top: 55px;
  right: -94px;
  width: clamp(280px, 31vw, 510px);
  aspect-ratio: 1;
  opacity: .58;
  transform: translate3d(calc(var(--universe-pointer-x) * -.7), calc(var(--universe-pointer-y) * -.7), 0);
  transition: transform 1.4s ease-out;
}

.universe-planet {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 23%, #6b628e25 0%, #24233f 35%, #111322 64%, #090c18 78%);
  box-shadow:
    inset 2px 2px 0 #c0b8ec45,
    inset 11px 9px 23px #8880c91c,
    -11px -7px 45px #8d78c50a;
}

.universe-orbit {
  position: absolute;
  left: -41%;
  top: 27%;
  width: 182%;
  height: 38%;
  border: 1px solid #c5b9ed24;
  border-left-color: #c5b9ed05;
  border-bottom-color: #c5b9ed0d;
  border-radius: 50%;
  transform: rotate(-28deg);
  box-shadow: 0 -2px 9px #a296db07;
}

.universe-orbit-second {
  left: -50%;
  top: 23%;
  width: 200%;
  height: 46%;
  opacity: .32;
}

.universe-grain {
  opacity: .042;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='universe-grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.79' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23universe-grain)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.universe-stars { opacity: .9; }

.universe-shade {
  background:
    linear-gradient(90deg, #080b1729, transparent 42%),
    linear-gradient(180deg, transparent 10%, #060a1620 48%, #060a1670 100%);
}

.universe-scene[data-running="false"] .universe-cloud { animation-play-state: paused; }

@keyframes universe-cloud-near {
  from { transform: translate3d(-1.3%, -.8%, 0) rotate(-3deg) scale(1.01); }
  to { transform: translate3d(2.4%, 1.3%, 0) rotate(2deg) scale(1.09); }
}

@keyframes universe-cloud-far {
  from { transform: translate3d(2.1%, 1.4%, 0) rotate(3deg) scale(1.04); }
  to { transform: translate3d(-1.8%, -.7%, 0) rotate(-2deg) scale(1.12); }
}

@media (max-width: 760px) {
  .universe-planet-wrap { top: 44px; right: -165px; opacity: .35; }
  .universe-cloud-near { opacity: .7; }
  .universe-nebula-image { opacity: .32; }
  .universe-grain { opacity: .025; }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) .universe-cloud { animation: none; will-change: auto; }
  html:not([data-motion="on"]) .universe-nebula-image,
  html:not([data-motion="on"]) .universe-planet-wrap { transform: none; transition: none; }
}
