:root {
  color-scheme: dark;
  --mauve: #cba6f7;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --phosphor: 0 0 0.35rem rgb(166 227 161 / 0.75),
    0 0 1.2rem rgb(166 227 161 / 0.28);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 20rem;
  min-height: 100svh;
  overflow: hidden;
  background: var(--crust);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.scene {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgb(49 50 68 / 0.7), transparent 66%),
    var(--base);
}

.scene::before,
.scene::after {
  position: absolute;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  content: "";
}

.scene::before {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgb(17 17 27 / 0.24) 3px,
    rgb(17 17 27 / 0.24) 4px
  );
  opacity: 0.58;
  animation: scanline-flicker 8s steps(2, end) infinite;
}

.scene::after {
  background: radial-gradient(
    ellipse at center,
    transparent 48%,
    rgb(17 17 27 / 0.22) 74%,
    rgb(0 0 0 / 0.75) 112%
  );
}

.tunnel {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.tunnel::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(42vw, 28rem);
  aspect-ratio: 1;
  border: 1px solid rgb(148 226 213 / 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 2rem rgb(148 226 213 / 0.2),
    inset 0 0 2rem rgb(148 226 213 / 0.12);
  content: "";
  transform: translate(-50%, -50%) scale(0.05);
  animation: tunnel-ring 3.2s linear infinite;
}

.star {
  position: absolute;
  top: var(--y);
  left: var(--x);
  color: var(--teal);
  font-size: clamp(0.55rem, 1.7vw, 1rem);
  line-height: 1;
  opacity: 0.55;
  text-shadow: 0 0 0.65rem currentColor;
  animation: tunnel-star 3.2s linear infinite;
  animation-delay: var(--delay);
}

.star:nth-child(1) {
  --x: 4%;
  --y: 8%;
  --delay: -0.2s;
}

.star:nth-child(2) {
  --x: 18%;
  --y: 4%;
  --delay: -1.8s;
}

.star:nth-child(3) {
  --x: 34%;
  --y: 12%;
  --delay: -2.6s;
}

.star:nth-child(4) {
  --x: 62%;
  --y: 7%;
  --delay: -0.9s;
}

.star:nth-child(5) {
  --x: 79%;
  --y: 13%;
  --delay: -2.2s;
}

.star:nth-child(6) {
  --x: 96%;
  --y: 5%;
  --delay: -1.1s;
}

.star:nth-child(7) {
  --x: 7%;
  --y: 28%;
  --delay: -2.9s;
}

.star:nth-child(8) {
  --x: 23%;
  --y: 24%;
  --delay: -1.4s;
}

.star:nth-child(9) {
  --x: 73%;
  --y: 26%;
  --delay: -0.5s;
}

.star:nth-child(10) {
  --x: 91%;
  --y: 31%;
  --delay: -2.4s;
}

.star:nth-child(11) {
  --x: 2%;
  --y: 47%;
  --delay: -1.2s;
}

.star:nth-child(12) {
  --x: 16%;
  --y: 43%;
  --delay: -2.1s;
}

.star:nth-child(13) {
  --x: 84%;
  --y: 45%;
  --delay: -0.7s;
}

.star:nth-child(14) {
  --x: 98%;
  --y: 52%;
  --delay: -2.8s;
}

.star:nth-child(15) {
  --x: 9%;
  --y: 65%;
  --delay: -0.4s;
}

.star:nth-child(16) {
  --x: 27%;
  --y: 71%;
  --delay: -2s;
}

.star:nth-child(17) {
  --x: 69%;
  --y: 68%;
  --delay: -1.5s;
}

.star:nth-child(18) {
  --x: 93%;
  --y: 72%;
  --delay: -3s;
}

.star:nth-child(19) {
  --x: 3%;
  --y: 91%;
  --delay: -2.5s;
}

.star:nth-child(20) {
  --x: 19%;
  --y: 84%;
  --delay: -0.8s;
}

.star:nth-child(21) {
  --x: 39%;
  --y: 94%;
  --delay: -1.7s;
}

.star:nth-child(22) {
  --x: 61%;
  --y: 88%;
  --delay: -2.3s;
}

.star:nth-child(23) {
  --x: 78%;
  --y: 96%;
  --delay: -1.3s;
}

.star:nth-child(24) {
  --x: 97%;
  --y: 86%;
  --delay: -0.1s;
}

.star:nth-child(3n) {
  color: var(--green);
}

.star:nth-child(5n) {
  color: var(--mauve);
}

.star:nth-child(4n) {
  font-size: clamp(0.75rem, 2vw, 1.25rem);
}

.star:nth-child(7n) {
  font-size: 0.55rem;
}

.logo {
  position: relative;
  z-index: 5;
  padding: clamp(1.4rem, 4vw, 2.8rem);
  background: radial-gradient(
    ellipse at center,
    rgb(30 30 46 / 0.96),
    rgb(30 30 46 / 0.72) 58%,
    transparent 76%
  );
  animation: logo-pulse 3.2s ease-in-out infinite;
}

.ascii {
  margin: 0;
  color: var(--green);
  font-size: clamp(0.45rem, 1.55vw, 1.05rem);
  line-height: 1.05;
  text-align: center;
  text-shadow: var(--phosphor);
  white-space: pre;
}

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

@keyframes scanline-flicker {
  0%,
  18%,
  21%,
  79%,
  100% {
    opacity: 0.58;
  }

  19%,
  80% {
    opacity: 0.42;
  }
}

@keyframes tunnel-star {
  0% {
    top: 50%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.08);
  }

  9% {
    opacity: 0.85;
  }

  82% {
    opacity: 0.72;
  }

  100% {
    top: var(--y);
    left: var(--x);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.75);
  }
}

@keyframes tunnel-ring {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.05);
  }

  14% {
    opacity: 0.5;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.4);
  }
}

@keyframes logo-pulse {
  0%,
  100% {
    filter: brightness(0.9);
    transform: scale(0.99);
  }

  50% {
    filter: brightness(1.18);
    transform: scale(1.01);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene::before,
  .tunnel::before {
    display: none;
  }

  .star,
  .logo {
    animation: none;
  }

  .star {
    opacity: 0.38;
  }
}
