* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Milker";
  src: url("new-ava/assets/fonts/Milker.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #271910;
  font-family: Arial, Helvetica, sans-serif;
}

.scene {
  --scene-shift-x: 4.1vw;
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #271910;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(20, 12, 7, 0.08), rgba(20, 12, 7, 0.24)),
    url("assets/family-dancing-tv-no-player.jpg?v=1") center / cover no-repeat,
    #271910;
  transform-origin: 50% 31%;
  animation: roomZoom 3600ms cubic-bezier(0.19, 1, 0.22, 1) 300ms both;
}

#pageTitle {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.stage {
  position: absolute;
  left: 50%;
  top: 9.8vh;
  width: min(36vw, calc(33dvh * 1.776833));
  aspect-ratio: 1672 / 941;
  z-index: 2;
  transform: translateX(calc(-50% + var(--scene-shift-x)));
  transform-origin: 50% 31%;
  animation: stageZoom 3600ms cubic-bezier(0.19, 1, 0.22, 1) 300ms both;
}

.tv-art {
  position: absolute;
  inset: 0;
  margin: 0;
}

.tv-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.playlist-hotspot,
.tv-hotspot,
.spotify-control,
.screen-off,
.volume-osd {
  position: absolute;
}

.playlist-hotspot {
  left: 91.5%;
  top: 80.3%;
  z-index: 20;
  width: 3.4%;
  height: 5.6%;
  border-radius: 999px;
}

.tv-hotspot {
  z-index: 22;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.volume-hotspot {
  left: 77.1%;
  top: 80.2%;
  width: 3%;
  height: 5.2%;
}

.power-hotspot {
  left: 84.4%;
  top: 80.2%;
  width: 3%;
  height: 5.2%;
}

.tv-hotspot:hover,
.playlist-hotspot:hover {
  background: transparent;
}

.playlist-hotspot:focus-visible,
.tv-hotspot:focus-visible {
  outline: 2px solid rgba(255, 246, 210, 0.78);
  outline-offset: 3px;
}

.scene[data-power="off"] .tv-hotspot:focus-visible,
.scene.is-switching-off .tv-hotspot:focus-visible,
.scene.is-switching-on .tv-hotspot:focus-visible {
  outline-color: rgba(255, 246, 210, 0.42);
}

.spotify-control {
  left: 6.7%;
  top: 7.3%;
  z-index: 2;
  width: 70.5%;
  height: 78.8%;
  overflow: hidden;
  border-radius: 7.2% / 12%;
  opacity: 0;
  pointer-events: none;
}

.fallback-copy,
.spotify-mini,
.caption,
.local-time {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.spotify-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.spotify-frame iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  border: 0;
}

.screen-off {
  left: 5.4%;
  top: 10.4%;
  z-index: 18;
  width: 68.3%;
  height: 80.3%;
  pointer-events: none;
  border-radius: 12% 9% 11% 13% / 17% 15% 19% 21%;
  background:
    radial-gradient(ellipse at center, rgba(28, 28, 28, 0.98) 0%, rgba(0, 0, 0, 1) 70%),
    radial-gradient(ellipse at center, transparent 0 64%, rgba(0, 0, 0, 1) 76% 100%),
    #000;
  clip-path: inset(0 round 12% 9% 11% 13% / 17% 15% 19% 21%);
  opacity: 0;
  transition: none;
}

.crt-flash {
  position: absolute;
  left: 5.4%;
  top: 10.4%;
  z-index: 25;
  width: 68.3%;
  height: 80.3%;
  pointer-events: none;
  border-radius: 12% 9% 11% 13% / 17% 15% 19% 21%;
  clip-path: inset(0 round 12% 9% 11% 13% / 17% 15% 19% 21%);
  opacity: 0;
  transform: scale(1);
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.92) 0 1.4%, rgba(178, 134, 255, 0.72) 1.5% 3%, transparent 3.2%),
    linear-gradient(90deg, transparent 0 6%, rgba(255, 255, 255, 0.95) 44% 56%, transparent 94%),
    rgba(255, 255, 255, 0.04);
  mix-blend-mode: screen;
}

.scene[data-power="off"] .screen-off {
  opacity: 1;
}

.scene.is-switching-off .screen-off {
  animation: screenBlackout 720ms cubic-bezier(0.65, 0, 0.35, 1) both;
}

.scene.is-switching-on .screen-off {
  animation: screenReveal 780ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scene.is-switching-off .crt-flash {
  animation: tvOff 720ms cubic-bezier(0.65, 0, 0.35, 1) both;
}

.scene.is-switching-on .crt-flash {
  animation: tvOn 780ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scene[data-power="off"] .spotify-control,
.scene[data-power="off"] .playlist-hotspot {
  pointer-events: none;
}

.volume-osd {
  left: 14.5%;
  top: 15.5%;
  z-index: 24;
  padding: 0.35em 0.55em;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.58);
  font: 700 clamp(10px, 1.2vw, 18px) Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.volume-osd.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scene[data-power="off"] .volume-osd {
  opacity: 0;
}

.saloon-player {
  position: absolute;
  left: calc(50% + var(--scene-shift-x) - 1.2vw);
  bottom: 8vh;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(36rem, calc(100vw - 48px));
  padding: 12px 20px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateX(-50%);
  backdrop-filter: blur(22px) saturate(1.5);
}

.morning-playlist-title {
  position: absolute;
  left: max(24px, 3vw);
  top: max(22px, 3vh);
  z-index: 6;
  margin: 0;
  color: rgba(255, 246, 210, 0.92);
  font-family: "Milker", "Arial Black", Impact, sans-serif;
  font-size: clamp(19px, 2.25vw, 40px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 rgba(84, 36, 9, 0.86),
    0 8px 18px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.spotify-top-link {
  position: absolute;
  right: max(24px, 3vw);
  top: max(22px, 3vh);
  z-index: 17;
  color: rgba(255, 246, 210, 0.9);
  font-family: "Milker", "Arial Black", Impact, sans-serif;
  font-size: clamp(11px, 1.1vw, 18px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  text-shadow:
    0 2px 0 rgba(84, 36, 9, 0.86),
    0 6px 14px rgba(0, 0, 0, 0.28);
  transition: color 140ms ease, transform 140ms ease;
}

.spotify-top-link:hover {
  color: #fff;
  transform: translateY(-1px);
}

.spotify-top-link:active {
  transform: translateY(1px);
}

.spotify-top-link:focus-visible {
  outline: 3px solid #22c7ff;
  outline-offset: 4px;
}

.site-credit {
  position: absolute;
  left: max(18px, 2vw);
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 17;
  margin: 0;
  color: rgba(255, 246, 210, 0.7);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.site-credit a {
  color: rgba(255, 246, 210, 0.95);
  text-decoration: underline;
  text-decoration-color: rgba(255, 246, 210, 0.45);
  text-underline-offset: 2px;
}

.site-credit a:hover {
  color: #fff;
}

.site-credit a:focus-visible {
  outline: 2px solid rgba(255, 246, 210, 0.82);
  outline-offset: 3px;
}

.record-wrap {
  position: relative;
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
}

.record-disc {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.32);
  outline: 1px solid rgba(255, 255, 255, 0.2);
  animation: recordSpin 8s linear infinite;
  animation-play-state: paused;
}

.scene[data-play-state="playing"] .record-disc {
  animation-play-state: running;
}

.record-disc img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.saloon-player-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.track-title,
.track-artist {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

.track-artist {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.25;
}

.player-status {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 6px 0 0;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  font: 700 10px/1.1 Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}

.player-status:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.player-status:focus-visible {
  outline: 2px solid rgba(255, 246, 210, 0.82);
  outline-offset: 2px;
}

.track-progress-wrap {
  margin-top: 8px;
}

.track-progress {
  position: relative;
  height: 8px;
  cursor: pointer;
}

.track-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%);
}

.track-progress span {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 1;
  display: block;
  width: 0%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%);
}

.track-progress i {
  position: absolute;
  left: 0%;
  top: 50%;
  z-index: 2;
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 140ms ease;
}

.track-progress:hover i,
.track-progress:focus-visible i {
  opacity: 1;
}

.track-time {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  line-height: 1;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.saloon-player-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.saloon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  appearance: none;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.saloon-button.skip {
  width: 36px;
  height: 36px;
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
}

.saloon-button.play {
  width: 44px;
  height: 44px;
  color: #000;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.saloon-button:hover {
  transform: scale(1.04);
}

.saloon-button.skip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.saloon-button:active {
  transform: scale(0.95);
}

.saloon-button:focus-visible,
.track-progress:focus-visible {
  outline: 2px solid rgba(255, 246, 210, 0.82);
  outline-offset: 3px;
}

.scene[data-power="off"] .saloon-player {
  opacity: 0.58;
}

.scene[data-power="off"] .saloon-button,
.scene[data-power="off"] .track-progress {
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .scene {
    --scene-shift-x: 2.3vw;
  }

  .stage {
    top: 12vh;
    width: min(62vw, calc(27dvh * 1.776833));
    transform: translateX(calc(-50% + var(--scene-shift-x)));
  }

  .spotify-control {
    border-radius: 10px;
  }

  .saloon-player {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 28px);
    gap: 10px;
    width: min(34rem, calc(100vw - 28px));
    padding: 10px 12px 10px 10px;
  }

  .morning-playlist-title {
    left: 18px;
    top: 18px;
    font-size: clamp(16px, 5vw, 26px);
  }

  .spotify-top-link {
    right: 18px;
    top: 18px;
    font-size: 11px;
  }

  .site-credit {
    left: 50%;
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 10px;
    white-space: nowrap;
    transform: translateX(-50%);
  }

  .record-wrap {
    flex-basis: 62px;
    width: 62px;
    height: 62px;
  }

  .track-title {
    font-size: 14px;
  }

  .track-artist {
    font-size: 12px;
  }

  .saloon-button.skip {
    width: 32px;
    height: 32px;
  }

  .saloon-button.play {
    width: 40px;
    height: 40px;
  }
}

@media (max-height: 640px) {
  .saloon-player {
    bottom: 14px;
    width: min(32rem, calc(100vw - 28px));
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .record-wrap {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
  }

  .track-progress-wrap {
    margin-top: 5px;
  }
}

@media (max-width: 720px) and (max-height: 640px) {
  .saloon-player {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 26px);
    width: calc(100vw - 24px);
  }

  .site-credit {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

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

@keyframes roomZoom {
  0% {
    transform: translateX(var(--scene-shift-x)) scale(1);
  }

  72%,
  100% {
    transform: translateX(var(--scene-shift-x)) scale(1.14);
  }
}

@keyframes stageZoom {
  0% {
    transform: translateX(calc(-50% + var(--scene-shift-x))) scale(1);
  }

  72%,
  100% {
    transform: translateX(calc(-50% + var(--scene-shift-x))) scale(1.14);
  }
}

@keyframes recordSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tvOff {
  0% {
    opacity: 0;
    transform: scale(1, 1);
    filter: blur(0);
  }

  18% {
    opacity: 0.7;
    transform: scale(1.02, 0.74);
    filter: blur(0.4px);
  }

  48% {
    opacity: 1;
    transform: scale(0.96, 0.025);
    filter: blur(1px);
  }

  72% {
    opacity: 0.92;
    transform: scale(0.55, 0.008);
    filter: blur(1.8px);
  }

  100% {
    opacity: 0;
    transform: scale(0.04, 0.004);
    filter: blur(3px);
  }
}

@keyframes tvOn {
  0% {
    opacity: 0;
    transform: scale(0.05, 0.004);
    filter: blur(3px);
  }

  20% {
    opacity: 1;
    transform: scale(0.9, 0.018);
    filter: blur(1px);
  }

  46% {
    opacity: 0.82;
    transform: scale(1.01, 0.7);
    filter: blur(0.5px);
  }

  70% {
    opacity: 0.36;
    transform: scale(1.01, 1.03);
    filter: blur(0.2px);
  }

  100% {
    opacity: 0;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes screenBlackout {
  0% {
    opacity: 0;
    transform: scale(1, 1);
  }

  42% {
    opacity: 0.06;
    transform: scale(1, 1);
  }

  58% {
    opacity: 0.72;
    transform: scale(1, 0.965);
  }

  100% {
    opacity: 1;
    transform: scale(1, 1);
  }
}

@keyframes screenReveal {
  0%,
  34% {
    opacity: 1;
    transform: scale(1, 1);
  }

  62% {
    opacity: 0.9;
    transform: scale(1, 0.985);
  }

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