:root {
  color-scheme: dark;
  --bg: #090909;
  --ink: #f7f1df;
  --hot: #ff4d6d;
  --mint: #31e6b5;
  --gold: #ffd166;
  --blue: #4cc9f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 77, 109, 0.28), transparent 26%),
    radial-gradient(circle at 78% 18%, rgba(49, 230, 181, 0.24), transparent 24%),
    radial-gradient(circle at 55% 86%, rgba(76, 201, 240, 0.22), transparent 28%),
    #090909;
  cursor: crosshair;
}

.stage.is-boosting .danmaku-row {
  animation-duration: 4s;
}

.stage.is-overload {
  animation: pulseStage 900ms ease-in-out infinite alternate;
}

.wall,
.effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wall {
  opacity: 0.68;
  z-index: 0;
  transform: rotate(-6deg) scale(1.16);
}

.danmaku-row {
  position: absolute;
  top: var(--top);
  left: 0;
  display: flex;
  align-items: center;
  width: max-content;
  min-width: 220vw;
  color: rgba(247, 241, 223, 0.62);
  font-size: var(--size);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    2px 0 0 rgba(49, 230, 181, 0.4),
    -2px 0 0 rgba(255, 77, 109, 0.36),
    0 0 18px rgba(255, 255, 255, 0.12);
  animation-duration: var(--duration);
  animation-delay: var(--offset);
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  will-change: transform;
}

.danmaku-row span {
  display: inline-block;
  padding-right: clamp(28px, 5vw, 72px);
}

.danmaku-row:nth-child(3n) {
  color: rgba(255, 209, 102, 0.82);
}

.danmaku-row:nth-child(4n) {
  color: rgba(49, 230, 181, 0.72);
}

.danmaku-row:nth-child(5n) {
  color: rgba(255, 77, 109, 0.74);
}

.danmaku-row--left {
  animation-name: danmakuLeft;
}

.danmaku-row--right {
  animation-name: danmakuRight;
}

.stage.is-overload .danmaku-row {
  animation-duration: 3.4s;
  opacity: 0.92;
}

.hero {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  width: min(1120px, calc(100vw - 32px));
  height: 100%;
  margin: 0 auto;
  text-align: center;
}

.kicker,
.status {
  margin: 0;
  color: rgba(247, 241, 223, 0.82);
  font-size: clamp(13px, 2vw, 18px);
  font-weight: 800;
}

h1 {
  position: relative;
  max-width: 100%;
  margin: 16px 0 18px;
  color: #fff;
  font-size: clamp(58px, 15vw, 190px);
  font-weight: 1000;
  line-height: 0.92;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  animation: titleJitter 1.7s steps(2, end) infinite;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.9),
    0 0 26px rgba(255, 77, 109, 0.56),
    0 0 34px rgba(49, 230, 181, 0.42);
}

h1::before,
h1::after {
  position: absolute;
  inset: 0;
  content: attr(data-text);
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

h1::before {
  color: var(--mint);
  transform: translate(6px, -4px);
  clip-path: inset(0 0 46% 0);
  animation: glitchTop 760ms steps(2, end) infinite;
}

h1::after {
  color: var(--hot);
  transform: translate(-7px, 5px);
  clip-path: inset(52% 0 0 0);
  animation: glitchBottom 620ms steps(2, end) infinite;
}

.status {
  min-height: 1.6em;
}

.controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  display: flex;
  gap: 10px;
}

.control {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(9, 9, 9, 0.58);
  color: var(--ink);
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.control:hover,
.control:focus-visible,
.control[aria-pressed="true"] {
  border-color: rgba(255, 209, 102, 0.8);
  color: var(--gold);
  outline: none;
}

.particle,
.trail {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  color: var(--ink);
  font-weight: 1000;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
}

.particle {
  font-size: clamp(18px, 3vw, 34px);
  text-shadow:
    2px 0 0 rgba(49, 230, 181, 0.82),
    -2px 0 0 rgba(255, 77, 109, 0.8),
    0 0 16px rgba(255, 77, 109, 0.66);
}

.trail {
  font-size: 18px;
  color: rgba(49, 230, 181, 0.78);
  text-shadow: 0 0 12px rgba(49, 230, 181, 0.56);
}

@keyframes danmakuLeft {
  from {
    transform: translate3d(12vw, 0, 0);
  }

  to {
    transform: translate3d(-58%, 0, 0);
  }
}

@keyframes danmakuRight {
  from {
    transform: translate3d(-58%, 0, 0);
  }

  to {
    transform: translate3d(12vw, 0, 0);
  }
}

@keyframes titleJitter {
  0%,
  100% {
    transform: translate(0, 0) skewX(0deg);
  }

  24% {
    transform: translate(1px, -1px) skewX(-1deg);
  }

  26% {
    transform: translate(-2px, 1px) skewX(1deg);
  }

  72% {
    transform: translate(0, 0) skewX(0deg);
  }

  74% {
    transform: translate(2px, 0) skewX(-1deg);
  }
}

@keyframes glitchTop {
  0%,
  100% {
    clip-path: inset(0 0 58% 0);
    transform: translate(5px, -4px);
  }

  34% {
    clip-path: inset(12% 0 42% 0);
    transform: translate(10px, -2px);
  }

  68% {
    clip-path: inset(0 0 66% 0);
    transform: translate(3px, -7px);
  }
}

@keyframes glitchBottom {
  0%,
  100% {
    clip-path: inset(48% 0 0 0);
    transform: translate(-6px, 5px);
  }

  42% {
    clip-path: inset(64% 0 0 0);
    transform: translate(-11px, 2px);
  }

  76% {
    clip-path: inset(38% 0 18% 0);
    transform: translate(-3px, 8px);
  }
}

@keyframes pulseStage {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.75) contrast(1.08);
  }
}

@media (max-width: 720px) {
  .stage {
    min-height: 460px;
  }

  .wall {
    transform: rotate(-8deg) scale(1.2);
  }

  .controls {
    right: 12px;
    bottom: 12px;
  }

  .control {
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .danmaku-row,
  h1,
  h1::before,
  h1::after,
  .stage.is-overload {
    animation: none;
  }
}
