#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #d9cbe3;
  overflow: hidden;
}
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 10%, rgba(255, 248, 220, 0.55), transparent 48%);
  mix-blend-mode: screen;
}
#loft {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(1.5px 0 0 color-mix(in srgb, var(--hood) 55%, transparent))
          drop-shadow(-1.5px 0 0 color-mix(in srgb, var(--night) 55%, transparent));
}
body.is-lite #loft,
body.is-reduced #loft,
body.is-static #loft { filter: none; }
body.is-static #loft { display: none; }
body.is-static #stage {
  background: #d9cbe3 url("../assets/ui/loft-still.webp") center bottom / cover no-repeat;
}
@media (max-width: 820px) {
  #stage::before { opacity: 0.25; }
}
#stage .grain,
#stage .scan,
#stage .bleed,
#stage .tracking { position: absolute; inset: 0; pointer-events: none; }
#stage .grain {
  background-image: url("../assets/ui/noise.png");
  opacity: 0.18;
  mix-blend-mode: overlay;
}
#stage .scan {
  background: repeating-linear-gradient(
    to bottom,
    rgba(40, 20, 40, 0.16) 0 1px,
    transparent 1px 4px
  );
  opacity: 0.35;
}
body.is-reduced .scan,
body.is-reduced .bleed,
body.is-reduced .tracking,
body.atmosphere .scan,
body.atmosphere .bleed,
body.atmosphere .tracking { display: none; }
.trail { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.spark {
  position: fixed;
  width: 5px;
  height: 5px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  animation: twinkle 0.6s ease-out forwards;
}
.spark.star {
  width: auto;
  height: auto;
  margin: -0.6em 0 0 -0.4em;
  background: none;
  color: var(--gold);
  font-size: 0.85rem;
  line-height: 1;
}
#stage .bleed {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--hood) 28%, transparent),
    transparent 10%,
    transparent 90%,
    color-mix(in srgb, var(--night) 32%, transparent));
  mix-blend-mode: multiply;
  opacity: 0.65;
}
#stage .tracking {
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--pale) 18%, transparent), transparent);
  height: 18%;
  inset: auto 0 0 0;
  animation: track 9s linear infinite;
  opacity: 0.35;
}
@keyframes track {
  from { transform: translateY(-120vh); }
  to { transform: translateY(20vh); }
}
body.no-webgl #stage {
  background:
    radial-gradient(ellipse at 50% 42%, var(--dusk), transparent 58%),
    linear-gradient(var(--void), var(--wood) 80%, var(--carpet));
}

main { position: relative; z-index: 1; }
.gate {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 6rem 6vw 8vh;
}
.gate-card {
  width: min(26rem, calc(100% - 1.25rem));
  padding: 1.1rem 1rem 1rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.gate-card h1 {
  margin: 0;
  font-size: clamp(3.4rem, 9vw, 6.2rem);
  font-style: italic;
  color: var(--paper);
}
.portal-line { margin: 0.7rem 0 0; font-size: 1.2rem; color: var(--lilac); }
.portal-hint, .portal-reduced {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--paper);
}
.portal-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.seed-hit {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(34vmin, 240px);
  height: min(34vmin, 240px);
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.seed-hit:hover,
.seed-hit:focus-visible {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
}

.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles i {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--pale);
  border-radius: 50%;
  animation: twinkle 3.2s ease-in-out infinite;
}
.sparkles i:nth-child(1) { left: 12%; top: 22%; }
.sparkles i:nth-child(2) { left: 70%; top: 16%; animation-delay: .4s; }
.sparkles i:nth-child(3) { left: 82%; top: 48%; animation-delay: .8s; }
.sparkles i:nth-child(4) { left: 28%; top: 62%; animation-delay: 1.1s; }
.sparkles i:nth-child(5) { left: 58%; top: 30%; animation-delay: 1.6s; }
.sparkles i:nth-child(6) { left: 40%; top: 74%; animation-delay: 2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.6); }
  50% { opacity: 0.85; transform: scale(1.35); }
}
.sprites { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.sprite {
  position: absolute;
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 4px 0 rgba(28, 23, 27, 0.25));
}
.s1 { left: 3vw; top: 18vh; }
.s2 { left: 5vw; top: 64vh; }
.s3 { right: 14vw; top: 16vh; }
.s4 { right: 8vw; top: 58vh; width: 48px; height: 48px; }
@media (prefers-reduced-motion: no-preference) {
  .sprite { animation: floaty 7s ease-in-out infinite; }
  .s2 { animation-delay: -2s; }
  .s3 { animation-delay: -4s; }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (max-width: 760px) {
  .portal-line { color: #f6eadc; }
  .gate { padding: 5.5rem 1rem 6.5rem; }
  .seed-hit { left: 50%; top: 34%; width: min(42vw, 180px); height: min(42vw, 180px); }
  .sprite { width: 46px; height: 60px; }
  .s2, .s3, .s4 { display: none; }
  .s1 { top: 11vh; left: 0.6rem; }
}
