:root {
  color-scheme: dark;
  --ink: #010303;
  --deep: #04100d;
  --green: #37f28f;
  --cyan: #4aa8ff;
  --fault: #e84a8a;
  --purple: #b026ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  position: fixed;
  inset: 0;
}

body.legal-page {
  position: static;
  min-height: 100%;
  overflow: auto;
  color: #d7fbe8;
  background:
    radial-gradient(circle at 8% 0%, rgba(176, 38, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 100% 12%, rgba(74, 168, 255, 0.08), transparent 26rem),
    #010303;
  font-family: "Courier New", Courier, monospace;
  line-height: 1.62;
}

.landing {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(55, 242, 143, 0.07), transparent 30rem),
    radial-gradient(circle at 82% 76%, rgba(74, 168, 255, 0.05), transparent 27rem),
    linear-gradient(145deg, #010303 0%, #04100d 48%, #020607 100%);
  isolation: isolate;
}

.landing.is-intro {
  cursor: pointer;
  background: #000;
}

#network {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
}

.floor-grid,
.grid-overlay,
.light-slices,
.scanlines,
.vignette,
.blackout {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floor-grid {
  z-index: 1;
  top: auto;
  bottom: -22vh;
  height: 60vh;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(55, 242, 143, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 168, 255, 0.12) 1px, transparent 1px);
  background-size: 86px 86px;
  filter: drop-shadow(0 0 7px rgba(55, 242, 143, 0.2));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 72%, transparent 100%);
  transform: perspective(620px) rotateX(66deg) scaleX(1.45);
  transform-origin: center bottom;
  animation: floorDrive 18s linear infinite;
}

.grid-overlay {
  z-index: 3;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(55, 242, 143, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 168, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: radial-gradient(circle at center, black 0%, black 50%, transparent 84%);
  mask-image: radial-gradient(circle at center, black 0%, black 50%, transparent 84%);
}

.light-slices {
  z-index: 4;
  opacity: 0.11;
  mix-blend-mode: screen;
  background:
    linear-gradient(112deg, transparent 0 46%, rgba(74, 168, 255, 0.1) 47%, transparent 48.2% 100%),
    linear-gradient(68deg, transparent 0 62%, rgba(55, 242, 143, 0.08) 63%, transparent 64.2% 100%);
  animation: sliceDrift 22s linear infinite;
}

.scanlines {
  z-index: 5;
  opacity: 0.26;
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(90deg, transparent, rgba(55, 242, 143, 0.06), transparent);
  animation: sweep 12s linear infinite;
}

.vignette {
  z-index: 6;
  background:
    radial-gradient(circle at center, transparent 0%, transparent 48%, rgba(0, 0, 0, 0.84) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.58), transparent 34%, transparent 68%, rgba(0, 0, 0, 0.68));
}

.blackout {
  z-index: 8;
  opacity: 0;
  background: #000;
  transition: opacity 140ms linear;
}

.legal-links {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  gap: 14px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
}

.legal-links a,
.legal-document a {
  color: var(--purple);
  text-decoration: none;
  text-shadow: 0 0 10px rgba(176, 38, 255, 0.55);
}

.legal-links a:hover,
.legal-document a:hover {
  color: #d989ff;
}

.legal-document {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.legal-document h1,
.legal-document h2 {
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0;
}

.legal-document h1 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1;
}

.legal-document h2 {
  margin: 34px 0 10px;
  font-size: 1.2rem;
}

.legal-document p {
  margin: 0 0 16px;
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
}

.legal-note {
  margin-top: 36px;
  color: rgba(215, 251, 232, 0.62);
  font-size: 0.9rem;
}

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

.landing.is-intro .floor-grid,
.landing.is-intro .grid-overlay,
.landing.is-intro .light-slices,
.landing.is-intro .scanlines,
.landing.is-intro .vignette,
.landing.is-intro .blackout,
.landing.is-intro::before,
.landing.is-intro::after {
  opacity: 0;
  animation-play-state: paused;
}

.landing::before {
  opacity: 0.055;
  background-image:
    radial-gradient(circle at 22% 34%, white 0 1px, transparent 1px),
    radial-gradient(circle at 68% 72%, white 0 1px, transparent 1px),
    radial-gradient(circle at 82% 18%, white 0 1px, transparent 1px);
  background-size: 37px 37px, 53px 53px, 79px 79px;
}

.landing::after {
  opacity: 0;
  background:
    linear-gradient(90deg, transparent 0 24%, rgba(232, 74, 138, 0.14) 24% 24.7%, transparent 24.7% 100%),
    linear-gradient(180deg, transparent 0 57%, rgba(74, 168, 255, 0.1) 57% 57.7%, transparent 57.7% 100%);
  animation: glitch 16s steps(1, end) infinite;
}

@keyframes floorDrive {
  from {
    background-position: 0 0, 0 0;
  }

  to {
    background-position: 0 86px, 86px 0;
  }
}

@keyframes sliceDrift {
  from {
    background-position: -25vw 0, 40vw 0;
  }

  to {
    background-position: 65vw 0, -45vw 0;
  }
}

@keyframes sweep {
  from {
    background-position: 0 0, -100vw 0;
  }

  to {
    background-position: 0 60px, 100vw 0;
  }
}

@keyframes glitch {
  0%,
  93%,
  95%,
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0);
  }

  94% {
    opacity: 0.7;
    transform: translate3d(-0.45vw, 0.2vh, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .floor-grid,
  .light-slices,
  .scanlines,
  .landing::after {
    animation-duration: 90s;
  }
}

body.is-paused .floor-grid,
body.is-paused .light-slices,
body.is-paused .scanlines,
body.is-paused .landing::after {
  animation-play-state: paused;
}
