:root {
  color-scheme: dark;
  background: #020202;
}

* {
  box-sizing: border-box;
}

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

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

body {
  min-width: 280px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: #020202;
}

.scene__artwork {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  user-select: none;
}

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  display: flex;
  width: 100%;
  padding: 26px 32px;
  justify-content: center;
  pointer-events: none;
}

.site-header h1 {
  margin: 0;
  padding-bottom: 9px;
  color: #fff;
  border-bottom: 9px solid #fff;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -1.35px;
}

.playlist-menu {
  position: absolute;
  top: 25vh;
  bottom: 40px;
  left: 75%;
  z-index: 5;
  display: flex;
  width: 440px;
  padding: 20px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #fff;
  background: rgba(5, 6, 10, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  flex-direction: column;
  gap: 18px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transform: translateX(-50%);
}

.playlist-menu section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-menu h2 {
  margin: 0 0 8px;
  padding-bottom: 5px;
  border-bottom: 3px solid #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.4px;
}

.playlist-menu__tracks {
  display: flex;
  margin: 0;
  padding: 0;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.playlist-track {
  display: flex;
  width: 100%;
  padding: 7px 6px;
  align-items: center;
  gap: 12px;
  color: #fff;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.playlist-track.is-current {
  background: rgba(255, 255, 255, 0.07);
}

.playlist-track:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.playlist-track__marker {
  display: grid;
  width: 18px;
  min-width: 18px;
  height: 20px;
  place-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.playlist-track__marker::before,
.playlist-track__marker::after {
  content: "";
  display: none;
}

.playlist-track__equalizer {
  display: none;
  height: 12px;
  align-items: flex-end;
  gap: 2px;
}

.playlist-track__equalizer span {
  display: block;
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.75);
  transform-origin: bottom;
  animation: equalizer-one 900ms ease-in-out infinite;
}

.playlist-track__equalizer span:nth-child(2) {
  animation-name: equalizer-two;
  animation-duration: 700ms;
}

.playlist-track__equalizer span:nth-child(3) {
  animation-name: equalizer-three;
  animation-duration: 1100ms;
}

.playlist-track.is-current .playlist-track__number {
  display: none;
}

.playlist-menu[data-playback="playing"]
  .playlist-track.is-current
  .playlist-track__equalizer {
  display: flex;
}

.playlist-menu:not([data-playback="playing"])
  .playlist-track.is-current
  .playlist-track__marker::before {
  display: block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid rgba(255, 255, 255, 0.75);
}

.playlist-track__details {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.playlist-track__title {
  font-size: 15px;
  font-weight: 700;
}

.playlist-track__artist {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  font-weight: 500;
}

.playlist-track__duration {
  flex: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .playlist-track:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:hover
    .playlist-track__equalizer,
  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:focus-visible
    .playlist-track__equalizer {
    display: none;
  }

  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:hover
    .playlist-track__marker,
  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:focus-visible
    .playlist-track__marker {
    grid-template-columns: repeat(2, 3px);
    gap: 3px;
  }

  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:hover
    .playlist-track__marker::before,
  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:hover
    .playlist-track__marker::after,
  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:focus-visible
    .playlist-track__marker::before,
  .playlist-menu[data-playback="playing"]
    .playlist-track.is-current:focus-visible
    .playlist-track__marker::after {
    display: block;
    width: 3px;
    height: 12px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 1px;
  }
}

@keyframes equalizer-one {
  0%,
  100% {
    transform: scaleY(0.3);
  }

  50% {
    transform: scaleY(1);
  }
}

@keyframes equalizer-two {
  0%,
  100% {
    transform: scaleY(1);
  }

  40% {
    transform: scaleY(0.4);
  }
}

@keyframes equalizer-three {
  0%,
  100% {
    transform: scaleY(0.5);
  }

  60% {
    transform: scaleY(1);
  }
}

.tv-transform {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 1000px;
  height: 750px;
  transform-origin: 0 0;
  will-change: transform;
}

.tv-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #02040a;
}

.tv-video {
  position: absolute;
  top: -11.4%;
  left: -17.5%;
  width: 135%;
  height: 124%;
  border: 0;
  background: #02040a;
  filter: brightness(0.84) contrast(1.1) saturate(0.84) sepia(0.04);
  opacity: 0;
  pointer-events: none;
  transition: opacity 80ms linear;
}

.tv-screen[data-video-visible="true"] .tv-video {
  opacity: 1;
}

.tv-screen[data-tv-mode="playing"] .tv-video {
  filter: blur(0.7px) brightness(0.68) contrast(1.04) saturate(0.7) sepia(0.06);
}

.tv-idle,
.tv-idle__snow,
.tv-idle__tracking {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tv-idle {
  z-index: 1;
  overflow: hidden;
  color: rgba(218, 232, 242, 0.88);
  background: rgba(2, 5, 12, 0.22);
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0;
  text-shadow:
    0 0 4px rgba(196, 222, 255, 0.7),
    2px 2px 0 rgba(0, 0, 0, 0.72);
  transition: opacity 90ms linear;
}

.tv-screen[data-tv-mode="standby"] .tv-idle,
.tv-screen[data-tv-mode="tuning"] .tv-idle,
.tv-screen[data-tv-mode="ended"] .tv-idle,
.tv-screen[data-tv-mode="paused"] .tv-idle,
.tv-screen[data-tv-mode="playing"] .tv-idle {
  opacity: 1;
}

.tv-screen[data-tv-mode="playing"] .tv-idle {
  background: rgba(1, 4, 10, 0.16);
}

.tv-screen[data-tv-mode="standby"] .tv-idle,
.tv-screen[data-tv-mode="tuning"] .tv-idle,
.tv-screen[data-tv-mode="ended"] .tv-idle {
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.52) 100%),
    rgba(1, 4, 10, 0.72);
}

.tv-idle__snow {
  display: none;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  filter: contrast(1.05) brightness(0.58);
  mix-blend-mode: screen;
  opacity: 0.14;
  transform: scale(1.025);
  animation: tv-static-shift 800ms steps(2, end) infinite;
}

.tv-screen[data-tv-mode="standby"] .tv-idle__snow,
.tv-screen[data-tv-mode="tuning"] .tv-idle__snow,
.tv-screen[data-tv-mode="ended"] .tv-idle__snow,
.tv-screen[data-tv-mode="playing"] .tv-idle__snow {
  display: block;
}

.tv-screen[data-tv-mode="playing"] .tv-idle__snow {
  filter: contrast(1.08) brightness(0.5);
  opacity: 0.08;
}

.tv-idle__tracking {
  top: -18%;
  right: -4%;
  bottom: auto;
  left: -4%;
  display: none;
  width: 108%;
  height: 9%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(211, 228, 243, 0.08) 34%,
    rgba(0, 0, 0, 0.58) 45%,
    rgba(210, 230, 248, 0.2) 54%,
    transparent
  );
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.16);
  opacity: 0.28;
  animation: tv-tracking-roll 16s linear infinite;
}

.tv-screen[data-tv-mode="standby"] .tv-idle__tracking,
.tv-screen[data-tv-mode="tuning"] .tv-idle__tracking,
.tv-screen[data-tv-mode="ended"] .tv-idle__tracking {
  display: block;
}

.tv-idle__channel,
.tv-idle__status,
.tv-idle__pause {
  position: absolute;
  z-index: 1;
  display: none;
}

.tv-idle__channel {
  top: 5%;
  right: 4%;
}

.tv-screen[data-tv-mode="standby"] .tv-idle__channel,
.tv-screen[data-tv-mode="tuning"] .tv-idle__channel,
.tv-screen[data-tv-mode="ended"] .tv-idle__channel {
  display: block;
}

.tv-idle__status {
  right: 0;
  bottom: 14%;
  left: 0;
  text-align: center;
}

.tv-screen[data-tv-mode="ended"] .tv-idle__status {
  display: block;
}

.tv-idle__pause {
  top: 5%;
  left: 4%;
  align-items: center;
  gap: 0.32em;
}

.tv-screen[data-tv-mode="paused"] .tv-idle__pause {
  display: flex;
}

.tv-idle__pause span {
  animation: vcr-pause-blink 900ms steps(1, end) infinite;
}

.tv-effects,
.tv-effects::before,
.tv-effects::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tv-effects {
  z-index: 2;
  background:
    radial-gradient(
      ellipse at 50% 47%,
      rgba(48, 84, 158, 0.06) 0%,
      rgba(5, 12, 30, 0.03) 48%,
      rgba(0, 0, 0, 0.44) 100%
    ),
    linear-gradient(90deg, rgba(28, 50, 104, 0.05), transparent 22%, transparent 80%, rgba(7, 2, 14, 0.08));
  box-shadow:
    inset 0 0 42px rgba(48, 88, 186, 0.12),
    inset 0 0 100px rgba(0, 0, 0, 0.4);
}

.tv-screen[data-tv-mode="playing"] .tv-effects {
  background:
    radial-gradient(
      ellipse at 50% 47%,
      rgba(42, 77, 148, 0.04) 0%,
      rgba(3, 9, 23, 0.12) 48%,
      rgba(0, 0, 0, 0.62) 100%
    ),
    linear-gradient(
      90deg,
      rgba(9, 19, 44, 0.16),
      transparent 24%,
      transparent 77%,
      rgba(2, 1, 8, 0.2)
    );
  box-shadow:
    inset 0 0 48px rgba(48, 88, 186, 0.09),
    inset 0 0 125px rgba(0, 0, 0, 0.58);
}

.tv-screen[data-tv-mode="playing"] .tv-effects::before {
  filter: contrast(1.16);
  opacity: 1;
}

.tv-toggle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  width: 82px;
  height: 82px;
  padding: 0;
  place-items: center;
  color: #f2f5ff;
  background: rgba(3, 6, 12, 0.98);
  border: 1px solid rgba(208, 222, 255, 0.56);
  border-radius: 50%;
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.56),
    inset 0 0 12px rgba(84, 126, 214, 0.12);
  cursor: pointer;
  opacity: 0.96;
  transform: translate(-50%, -50%);
  transition:
    opacity 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.tv-screen .tv-control.tv-control.is-hidden {
  pointer-events: none;
  opacity: 0;
}

.tv-toggle:disabled {
  cursor: wait;
  opacity: 0.96;
}

.tv-toggle:focus-visible {
  outline: 3px solid rgba(173, 205, 255, 0.9);
  outline-offset: 4px;
}

.tv-skip {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: flex;
  width: 62px;
  height: 62px;
  padding: 0;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(242, 245, 255, 0.94);
  background: rgba(3, 6, 12, 0.9);
  border: 1px solid rgba(208, 222, 255, 0.4);
  border-radius: 50%;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.48),
    inset 0 0 10px rgba(84, 126, 214, 0.1);
  cursor: pointer;
  opacity: 0.88;
  transform: translate(-50%, -50%);
  transition:
    opacity 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.tv-skip--previous {
  left: calc(50% - 112px);
}

.tv-skip--next {
  left: calc(50% + 112px);
}

.tv-skip:disabled {
  cursor: wait;
}

.tv-skip:focus-visible {
  outline: 3px solid rgba(173, 205, 255, 0.9);
  outline-offset: 4px;
}

.tv-skip__bar {
  display: block;
  width: 5px;
  height: 22px;
  background: currentColor;
  border-radius: 1px;
}

.tv-skip__triangle {
  display: block;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}

.tv-skip--previous .tv-skip__triangle {
  border-right: 17px solid currentColor;
}

.tv-skip--next .tv-skip__triangle {
  border-left: 17px solid currentColor;
}

.tv-toggle__play {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid currentColor;
}

.tv-toggle__pause {
  display: none;
  gap: 6px;
  align-items: center;
}

.tv-toggle__pause span {
  display: block;
  width: 7px;
  height: 27px;
  background: currentColor;
  border-radius: 1px;
}

.tv-toggle[data-state="playing"] .tv-toggle__play {
  display: none;
}

.tv-toggle[data-state="playing"] .tv-toggle__pause {
  display: flex;
}

@media (hover: hover) {
  .tv-toggle:not(:disabled):hover,
  .tv-skip:not(:disabled):hover {
    background: rgba(7, 14, 28, 0.9);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

.tv-effects::before {
  content: "";
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 0,
      rgba(255, 255, 255, 0.018) 2px,
      rgba(0, 0, 0, 0.095) 2px,
      rgba(0, 0, 0, 0.095) 5px
    ),
    repeating-linear-gradient(
      96deg,
      rgba(93, 125, 190, 0.018) 0,
      rgba(93, 125, 190, 0.018) 1px,
      transparent 1px,
      transparent 7px
    );
  mix-blend-mode: multiply;
  opacity: 0.8;
  animation: crt-flicker 6s steps(1, end) infinite;
}

.tv-effects::after {
  content: "";
  background:
    linear-gradient(
      116deg,
      rgba(255, 255, 255, 0.065),
      rgba(255, 255, 255, 0.012) 19%,
      transparent 34%,
      transparent 72%,
      rgba(118, 153, 210, 0.025)
    ),
    radial-gradient(ellipse at 56% 6%, rgba(255, 255, 255, 0.035), transparent 52%);
  mix-blend-mode: screen;
}

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

  95% {
    opacity: 0.72;
  }

  97% {
    opacity: 0.86;
  }
}

@keyframes tv-static-shift {
  0% {
    transform: translate(-0.35%, 0.2%) scale(1.025);
  }

  50% {
    transform: translate(0.35%, -0.25%) scale(1.028);
  }

  100% {
    transform: translate(-0.2%, -0.3%) scale(1.025);
  }
}

@keyframes tv-tracking-roll {
  0%,
  82% {
    transform: translateY(0);
  }

  94% {
    transform: translateY(820%);
  }

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

@keyframes vcr-pause-blink {
  0%,
  58% {
    opacity: 1;
  }

  59%,
  100% {
    opacity: 0.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-effects::before,
  .tv-idle__snow,
  .tv-idle__tracking,
  .tv-idle__pause span,
  .playlist-track__equalizer span {
    animation: none;
  }
}
