:root {
  color-scheme: dark;
  background: #050507;
  --paper: rgba(250, 252, 246, 0.94);
  --paper-soft: rgba(250, 252, 246, 0.72);
  --green: #6edb54;
  --shadow: rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050507;
}

body {
  min-height: 100svh;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
}

#signal,
.screen-noise,
.signal-tear,
.notice,
.status {
  position: fixed;
}

#signal {
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #050507;
}

.screen-noise {
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.12), transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.64) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.055) 0,
      rgba(255, 255, 255, 0.055) 1px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.12) 4px
    );
  mix-blend-mode: overlay;
}

.screen-noise::before,
.screen-noise::after {
  content: "";
  position: absolute;
  inset: -10%;
}

.screen-noise::before {
  background-image:
    linear-gradient(90deg, rgba(255, 0, 0, 0.08), rgba(0, 255, 255, 0.05)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 5px);
  opacity: 0.18;
  animation: drift 7s steps(24) infinite;
}

.screen-noise::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 42%,
    rgba(255, 255, 255, 0.22) 45%,
    transparent 48%,
    transparent 100%
  );
  opacity: 0.12;
  animation: tracking 8s linear infinite;
}

.signal-tear {
  inset: -4%;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(
      to bottom,
      transparent 0 12%,
      rgba(255, 255, 255, 0.35) 12.5% 13%,
      transparent 13.5% 46%,
      rgba(255, 40, 80, 0.24) 46.5% 48%,
      transparent 48.5% 74%,
      rgba(68, 255, 229, 0.22) 75% 76%,
      transparent 77% 100%
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0 9px,
      rgba(255, 255, 255, 0.15) 10px,
      transparent 12px 26px
    );
  mix-blend-mode: screen;
}

.notice {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  pointer-events: none;
}

.notice__frame {
  width: min(760px, calc(100vw - 48px));
  min-height: 330px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: 36px 24px;
  color: var(--paper);
  text-align: center;
  text-shadow:
    2px 0 rgba(255, 0, 0, 0.35),
    -2px 0 rgba(0, 255, 255, 0.28),
    0 3px 18px var(--shadow);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
  animation: messageRoll 12s steps(2) infinite;
}

.vie-logo {
  width: clamp(82px, 9vw, 120px);
  height: auto;
  color: var(--paper);
  fill: currentColor;
  opacity: 0.94;
  transform: translateZ(0);
  filter:
    drop-shadow(2px 0 rgba(255, 0, 0, 0.24))
    drop-shadow(-2px 0 rgba(0, 255, 255, 0.2))
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.48));
}

.notice__kicker,
.notice__line {
  margin: 0;
}

.notice__kicker {
  color: var(--paper);
  font-size: 30px;
  line-height: 1.08;
  font-weight: 700;
  text-transform: uppercase;
}

.notice__line {
  color: var(--paper-soft);
  font-size: 21px;
  line-height: 1.35;
  white-space: pre-line;
}

.notice__line--last::after {
  content: "";
  display: inline-block;
  width: 0.62em;
  height: 1em;
  margin-left: 0.22em;
  background: var(--green);
  transform: translateY(0.16em);
  animation: cursor 1.2s steps(2) infinite;
}

.status {
  inset: auto 18px 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(250, 252, 246, 0.58);
  font-size: 12px;
  line-height: 1.2;
  text-shadow: 0 2px 10px var(--shadow);
  pointer-events: none;
}

body[data-site="game"] .notice__kicker {
  font-size: 38px;
}

body[data-site="game"] .notice__line--last::after {
  background: #ff4c5f;
}

body.is-glitching #signal {
  filter: saturate(1.32) contrast(1.14) hue-rotate(-5deg);
}

body.is-glitching .screen-noise::before {
  opacity: 0.36;
  animation: drift 260ms steps(6) infinite;
}

body.is-glitching .screen-noise::after {
  opacity: 0.3;
  animation: tracking 420ms linear infinite;
}

body.is-glitching .signal-tear {
  animation: tear var(--glitch-duration, 360ms) steps(5, end) both;
}

body.is-glitching .notice__frame {
  animation: glitchNotice var(--glitch-duration, 360ms) steps(2, end) both;
}

body.is-glitching .vie-logo {
  animation: logoGlitch var(--glitch-duration, 360ms) steps(2, end) both;
}

@media (max-width: 640px) {
  .notice {
    padding: 28px 18px;
  }

  .notice__frame {
    width: min(420px, calc(100vw - 36px));
    min-height: 300px;
    gap: 20px;
    padding: 30px 12px;
  }

  .vie-logo {
    width: 82px;
  }

  .notice__kicker {
    font-size: 24px;
  }

  body[data-site="game"] .notice__kicker {
    font-size: 31px;
  }

  .notice__line {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen-noise::before,
  .screen-noise::after,
  .signal-tear,
  .notice__frame,
  .vie-logo,
  .notice__line--last::after {
    animation: none;
  }
}

@keyframes cursor {
  0%,
  42% {
    opacity: 1;
  }

  43%,
  100% {
    opacity: 0;
  }
}

@keyframes drift {
  0% {
    transform: translate3d(-1.5%, 0, 0);
  }

  100% {
    transform: translate3d(1.5%, 0, 0);
  }
}

@keyframes tracking {
  0% {
    transform: translateY(-70%);
  }

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

@keyframes messageRoll {
  0%,
  88%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  89% {
    transform: translate3d(1px, -1px, 0);
  }

  90% {
    transform: translate3d(-1px, 1px, 0);
  }
}

@keyframes tear {
  0% {
    opacity: 0;
    transform: translate3d(-4%, 0, 0) scaleX(1.02);
  }

  16% {
    opacity: 0.72;
    transform: translate3d(5%, -1%, 0) scaleX(1.06);
  }

  34% {
    opacity: 0.42;
    transform: translate3d(-2%, 2%, 0) scaleX(0.98);
  }

  62% {
    opacity: 0.84;
    transform: translate3d(8%, 0, 0) scaleX(1.08);
  }

  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scaleX(1);
  }
}

@keyframes glitchNotice {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    clip-path: inset(0);
  }

  14% {
    transform: translate3d(10px, -2px, 0);
    clip-path: inset(0 0 72% 0);
  }

  28% {
    transform: translate3d(-9px, 3px, 0);
    clip-path: inset(62% 0 18% 0);
  }

  46% {
    transform: translate3d(5px, 0, 0);
    clip-path: inset(22% 0 42% 0);
  }

  68% {
    transform: translate3d(-3px, 1px, 0);
    clip-path: inset(0);
  }
}

@keyframes logoGlitch {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  20% {
    transform: translate3d(-11px, 0, 0) skewX(-7deg);
  }

  42% {
    transform: translate3d(9px, -2px, 0) skewX(5deg);
  }

  64% {
    transform: translate3d(-3px, 1px, 0);
  }
}
