:root {
  --background: #111212;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}

.background {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 44%, rgba(70, 73, 73, 0.08), transparent 36%),
    linear-gradient(135deg, #111212 0%, #151616 52%, #0e0f0f 100%);
}

.layer,
.ascii-fire,
.global-vignette,
.global-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rear-layer {
  z-index: 1;
}

.ascii-fire {
  z-index: 2;
  display: block;
  pointer-events: none;
  opacity: 0.92;
  filter:
    contrast(1.05)
    brightness(0.9)
    saturate(0.9);
}

.rear-glass-layer {
  z-index: 3;
  pointer-events: none;
}

.crt-display-effects {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  clip-path: polygon(
    30.73% 100%,
    42.71% 86.11%,
    51.04% 60.19%,
    60.94% 37.04%,
    70.31% 15.28%,
    80.21% 18.98%,
    100% 7.22%,
    100% 100%
  );
}

.crt-roll-band {
  position: absolute;
  left: 26%;
  right: -8%;
  height: 14%;
  top: -18%;
  opacity: 0.24;
  background: linear-gradient(
    180deg,
    rgba(160, 255, 210, 0) 0%,
    rgba(160, 255, 210, 0.08) 42%,
    rgba(210, 255, 232, 0.14) 50%,
    rgba(160, 255, 210, 0.06) 58%,
    rgba(160, 255, 210, 0) 100%
  );
  will-change: transform;
  animation: crt-roll 14s linear infinite;
}

.crt-flicker {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background: rgba(130, 255, 201, 0.04);
  animation: crt-flicker 700ms steps(2, end) infinite;
}

.foreground-layer {
  z-index: 4;
  pointer-events: none;
}

.global-vignette {
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.2) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), rgba(0, 0, 0, 0.12));
}

.global-grain {
  z-index: 6;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      rgba(0, 0, 0, 0.025) 1px,
      rgba(0, 0, 0, 0.025) 3px
    );
}

@media (prefers-reduced-motion: reduce) {
  .ascii-fire {
    opacity: 0.6;
  }
}


@keyframes crt-roll {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(940%);
  }
}

@keyframes crt-flicker {
  0%,
  100% {
    opacity: 0.12;
  }

  26% {
    opacity: 0.18;
  }

  54% {
    opacity: 0.09;
  }

  78% {
    opacity: 0.21;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crt-roll-band,
  .crt-flicker {
    animation: none;
  }

  .crt-roll-band {
    opacity: 0;
  }
}
