:root {
  color-scheme: dark;
  --night: #080d14;
  --night-soft: #0d141f;
  --moon: #e8e2d3;
  --moon-muted: rgba(232, 226, 211, 0.56);
  --moon-faint: rgba(232, 226, 211, 0.13);
  --terminal-blue: #839db7;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: clip;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--moon);
  background: var(--night);
  font-family:
    "Sarasa Mono SC",
    "Maple Mono NF CN",
    "Noto Sans Mono CJK SC",
    "Microsoft YaHei UI",
    monospace;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.034;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(
      circle at 73% 26%,
      rgba(126, 148, 179, 0.09),
      transparent 27%
    ),
    radial-gradient(
      circle at 28% 82%,
      rgba(90, 115, 153, 0.06),
      transparent 32%
    ),
    linear-gradient(145deg, transparent, rgba(22, 31, 44, 0.24));
}

button {
  font: inherit;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  overflow: hidden;
  padding: 34px 42px 40px;
  isolation: isolate;
}

.moon {
  position: absolute;
  top: 11vh;
  right: -8vw;
  z-index: -1;
  width: clamp(330px, 37vw, 630px);
  aspect-ratio: 1;
  border: 1px solid rgba(232, 226, 211, 0.105);
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 32% 28%,
      rgba(232, 226, 211, 0.023) 0 2%,
      transparent 2.3%
    ),
    radial-gradient(
      circle at 62% 66%,
      rgba(232, 226, 211, 0.017) 0 6%,
      transparent 6.3%
    ),
    radial-gradient(
      circle at 44% 48%,
      rgba(232, 226, 211, 0.023),
      rgba(232, 226, 211, 0.006) 58%,
      transparent 70%
    );
  box-shadow:
    inset 40px -30px 90px rgba(215, 223, 231, 0.015),
    0 0 130px rgba(129, 151, 180, 0.055);
}

.moon::after {
  position: absolute;
  inset: 14%;
  border: 1px solid rgba(232, 226, 211, 0.04);
  border-radius: 50%;
  content: "";
}

.lyric-block {
  width: min(850px, 74vw);
  margin: clamp(88px, 13vh, 150px) 0 130px clamp(8px, 7vw, 108px);
}

.track {
  display: flex;
  gap: 13px;
  align-items: center;
  margin: 0 0 28px;
  color: rgba(232, 226, 211, 0.34);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.track::before {
  width: 28px;
  height: 1px;
  content: "";
  background: rgba(232, 226, 211, 0.32);
}

.lyrics {
  min-height: 318px;
  font-size: clamp(17px, 2.05vw, 31px);
  font-weight: 400;
  line-height: 1.94;
  letter-spacing: 0.045em;
}

.lyric-line {
  min-height: 1.94em;
  margin: 0;
  color: rgba(232, 226, 211, 0.19);
  transition:
    color 800ms ease,
    transform 800ms ease;
}

.lyric-line.is-complete {
  color: var(--moon-muted);
}

.lyric-line.is-active {
  color: #eee9dd;
  text-shadow: 0 0 25px rgba(214, 225, 235, 0.07);
  transform: translateX(8px);
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.04em;
  margin-left: 0.1em;
  vertical-align: -0.12em;
  background: #e7e1d4;
  box-shadow: 0 0 16px rgba(220, 228, 236, 0.17);
  animation: blink 850ms steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.footer {
  position: absolute;
  right: 42px;
  bottom: 36px;
  left: 42px;
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  color: rgba(232, 226, 211, 0.28);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.progress {
  width: min(280px, 30vw);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
}

.progress-track {
  height: 1px;
  overflow: hidden;
  background: rgba(232, 226, 211, 0.1);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: rgba(232, 226, 211, 0.52);
  transition: width 180ms linear;
}

.replay-button {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 0;
  border: 0;
  color: rgba(232, 226, 211, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  background: transparent;
  opacity: 0;
  transform: translateY(7px);
  transition:
    color 180ms ease,
    opacity 1.1s ease,
    transform 1.1s ease;
}

.replay-button[hidden] {
  display: none;
}

.replay-button.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.replay-button:hover {
  color: var(--moon);
}

.replay-button:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--terminal-blue);
  outline-offset: 7px;
}

.enter-key {
  display: grid;
  min-width: 66px;
  height: 29px;
  padding: 0 10px;
  border: 1px solid rgba(232, 226, 211, 0.21);
  border-radius: 4px;
  place-items: center;
  color: rgba(232, 226, 211, 0.66);
}

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

@media (max-width: 720px) {
  .stage {
    min-height: 100svh;
    padding: 24px 20px 30px;
  }

  .moon {
    top: 20vh;
    right: -43vw;
    width: 95vw;
  }

  .lyric-block {
    width: 100%;
    margin: 14vh 0 150px;
  }

  .lyrics {
    min-height: 390px;
    font-size: clamp(14px, 4vw, 17px);
    line-height: 2;
    letter-spacing: 0.02em;
  }

  .lyric-line {
    min-height: 2em;
  }

  .footer {
    right: 20px;
    bottom: 28px;
    left: 20px;
  }

  .progress {
    width: min(44vw, 210px);
  }

  .replay-button > span:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (max-height: 700px) and (min-width: 721px) {
  .lyric-block {
    margin-top: 54px;
    margin-bottom: 100px;
  }

  .lyrics {
    min-height: 270px;
    font-size: clamp(16px, 1.7vw, 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
