/* The Living Universe — background only.
   Every moving thing in this sky is moved by transform and opacity
   alone (see app.js), so the GPU compositor does the moving: the
   GlideCore compound. Filters and gradients below are painted once
   at build and never touched per frame. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: #010208;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 68% 30%, #0a1030 0%, rgba(10, 16, 48, 0) 55%),
    radial-gradient(100% 80% at 22% 78%, #120a2e 0%, rgba(18, 10, 46, 0) 55%),
    radial-gradient(160% 120% at 50% 50%, #05081a 0%, #02030c 55%, #010208 100%);
  cursor: grab;
}
#sky:active { cursor: grabbing; }

/* The painted deep field (thousands of faint stars, the Milky Way
   band, distant galaxy smudges) is one canvas painted once; the
   camera moves it by transform like every other layer. */
#deepfield {
  position: absolute;
  left: 0; top: 0;
  width: 5200px; height: 3400px;
  will-change: transform;
}

.layer {
  position: absolute;
  left: 0; top: 0;
  width: 5200px; height: 3400px;
  will-change: transform;
  pointer-events: none;
}

/* A soft telescope vignette: the edges of the view fall away. */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(115% 100% at 50% 46%, rgba(0,0,0,0) 58%, rgba(0,0,2,0.42) 88%, rgba(0,0,1,0.78) 100%);
}

/* ---------------- stars ---------------- */
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  will-change: transform, opacity;
}
.star.spiky::before,
.star.spiky::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.85), rgba(255,255,255,0));
}
.star.spiky::before { width: 520%; height: 1px; transform: translate(-50%, -50%); }
.star.spiky::after  { width: 1px; height: 520%; transform: translate(-50%, -50%); background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0.85), rgba(255,255,255,0)); }

/* ---------------- nebulae ---------------- */
/* Two painted gradient veils per nebula, cross-faded by opacity so
   the cloud slowly shifts and changes color weight. */
.nebula { position: absolute; will-change: transform, opacity; }
.nebula .veil { position: absolute; inset: 0; border-radius: 50%; will-change: opacity; }
.nebula .veil-a { filter: blur(26px); }
.nebula .veil-b { filter: blur(42px); }
.dark-nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,0.92) 30%, rgba(0,0,0,0.55) 62%, rgba(0,0,0,0) 78%);
  will-change: transform, opacity;
}

/* ---------------- galaxies ---------------- */
/* Each galaxy is a canvas painted once (unique arms, pitch, palette);
   only the wrapper rotates, by transform. */
.galaxy { position: absolute; will-change: transform; }
.galaxy canvas { display: block; width: 100%; height: 100%; }

/* ---------------- planets ---------------- */
.planet {
  position: absolute;
  border-radius: 50%;
  overflow: visible;
  will-change: transform;
}
.planet .surface {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  will-change: transform;
}
.planet .surface .tex {
  position: absolute;
  top: -25%; bottom: -25%;
  left: -60%; width: 220%;
  will-change: transform;
}
.planet .shade {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(38% 38% at 34% 30%, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 55%),
              radial-gradient(90% 90% at 70% 75%, rgba(0,0,0,0) 52%, rgba(0,0,5,0.55) 88%, rgba(0,0,3,0.8) 100%);
}
.planet .ring {
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-18deg) scaleY(0.34);
  border-style: solid;
  pointer-events: none;
}

/* ---------------- special objects ---------------- */
.pulsar { position: absolute; will-change: transform; }
.pulsar .beam {
  position: absolute;
  left: 50%; top: 50%;
  width: 340%; height: 26%;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(190,220,255,0.75), rgba(160,200,255,0.18) 55%, rgba(160,200,255,0));
  clip-path: polygon(0 38%, 100% 0, 100% 100%, 0 62%);
  will-change: opacity;
}
.pulsar .core {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%;
  background: #eaf4ff;
  box-shadow: 0 0 18px 6px rgba(180,215,255,0.85);
  transform: translate(-50%, -50%);
  will-change: opacity;
}

.blackhole { position: absolute; will-change: transform; }
.blackhole .disk {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(255,190,110,0) 0deg, rgba(255,190,110,0.85) 60deg, rgba(255,230,180,0.25) 130deg,
    rgba(255,160,80,0.7) 200deg, rgba(255,240,200,0.15) 280deg, rgba(255,190,110,0) 360deg);
  -webkit-mask: radial-gradient(50% 50% at 50% 50%, transparent 56%, #000 62%, #000 82%, transparent 96%);
          mask: radial-gradient(50% 50% at 50% 50%, transparent 56%, #000 62%, #000 82%, transparent 96%);
  transform: scaleY(0.42);
  will-change: transform;
}
.blackhole .hole {
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 22px 7px rgba(255,200,130,0.5), inset 0 0 12px #000;
  transform: translate(-50%, -50%);
}

.comet { position: absolute; will-change: transform, opacity; }
.comet .head {
  position: absolute; right: 0; top: 50%;
  border-radius: 50%;
  background: #f4faff;
  box-shadow: 0 0 14px 5px rgba(190,225,255,0.8);
  transform: translateY(-50%);
}
.comet .tail {
  position: absolute; right: 6px; top: 50%;
  height: 10px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(170,215,255,0), rgba(180,220,255,0.4) 70%, rgba(230,245,255,0.85));
  clip-path: polygon(0 0, 100% 38%, 100% 62%, 0 100%);
}

.meteor {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.95));
  border-radius: 2px;
  will-change: transform, opacity;
  opacity: 0;
}

.cluster { position: absolute; will-change: transform; }
.cluster canvas { display: block; width: 100%; height: 100%; }
.cluster .cstar { position: absolute; border-radius: 50%; background: #fff; will-change: transform, opacity; }

.constellation { position: absolute; will-change: transform, opacity; }
.constellation svg { display: block; overflow: visible; }

.planetary-nebula { position: absolute; will-change: transform, opacity; }
.planetary-nebula .shell {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(140,255,215,0.55);
  box-shadow: 0 0 26px 6px rgba(120,255,205,0.28), inset 0 0 26px rgba(120,255,205,0.3);
}
.planetary-nebula .heart {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%;
  background: #eafff6;
  box-shadow: 0 0 12px 4px rgba(190,255,230,0.8);
  transform: translate(-50%, -50%);
}

.remnant { position: absolute; will-change: transform; }
.remnant svg { display: block; overflow: visible; }

.belt { position: absolute; will-change: transform; }
.belt .rock { position: absolute; border-radius: 40%; background: #9a8f83; will-change: transform; }

.binary { position: absolute; will-change: transform; }
.binary .bstar { position: absolute; border-radius: 50%; will-change: opacity; }

.quasar { position: absolute; will-change: transform, opacity; }
.quasar .qcore {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%;
  background: #fdf6e8;
  box-shadow: 0 0 30px 12px rgba(255,240,200,0.75), 0 0 90px 34px rgba(255,220,160,0.3);
  transform: translate(-50%, -50%);
}
.quasar .jet {
  position: absolute; left: 50%; top: 50%;
  height: 2px;
  background: linear-gradient(90deg, rgba(200,225,255,0.7), rgba(200,225,255,0));
  transform-origin: 0 50%;
}

@media (prefers-reduced-motion: reduce) {
  .star, .nebula, .galaxy, .planet, .pulsar, .blackhole, .comet { will-change: auto; }
}
