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

html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #cfd3ff;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body { cursor: crosshair; touch-action: none; }

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
}

/* Screen-blended wash: lifts the pure-black canvas into a deep nebula without dulling particles. */
.tint {
  position: fixed;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(60% 50% at 20% 30%, rgba(40, 30, 120, 0.22), transparent 70%),
    radial-gradient(50% 45% at 80% 75%, rgba(120, 20, 90, 0.16), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, rgba(6, 8, 22, 1), rgba(0, 0, 0, 1));
  opacity: 0;
  animation: fade-in 2.4s ease-out 0.2s forwards;
}

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(6) infinite;
}

.corner,
.caption {
  position: fixed;
  font: 400 11px/1 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(207, 211, 255, 0.55);
  opacity: 0;
  animation: fade-in 1.2s ease-out 3.4s forwards;
  pointer-events: none;
  user-select: none;
}

.corner { top: max(24px, env(safe-area-inset-top)); }
.tl { left: 28px; display: flex; align-items: center; gap: 10px; }
.tr { right: 28px; font-variant-numeric: tabular-nums; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 12px #00e5ff;
  animation: pulse 2.4s ease-in-out infinite;
}

.caption {
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.sep { width: 28px; height: 1px; background: currentColor; opacity: 0.6; }

.fallback {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  font: 800 clamp(48px, 12vw, 180px) / 1 "Unbounded", system-ui, sans-serif;
  background: linear-gradient(90deg, #00e5ff, #6b5bff, #ff3cac, #ffb547);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.no-webgl .fallback { display: grid; }

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

@keyframes fade-in { to { opacity: 1; } }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .tint, .corner, .caption { animation-delay: 0s; animation-duration: 0.01s; }
}

@media (max-width: 600px) {
  .tl { left: 20px; }
  .tr { right: 20px; }
}

.touch { display: none; }
@media (pointer: coarse) {
  .pointer { display: none; }
  .touch { display: inline; }
}
