:root {
  color-scheme: dark;
  --hotones-red: #ed001b;
  --card-black: #080708;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--card-black);
  color: #fff;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: var(--card-black);
  background-image: url("assets/hotones-background.webp");
  background-position: center;
  background-size: cover;
}

button, input { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }

.experience {
  width: min(100vw, 56.25vh);
  width: min(100vw, 56.25svh);
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  background: #170304;
  isolation: isolate;
}

.card { position: absolute; inset: 0; overflow: hidden; }
.card-background, .card-foreground { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: fill; }
.card-background { z-index: 0; }
.vinyl {
  position: absolute;
  z-index: 1;
  width: 119.63%;
  height: auto;
  left: -31.67%;
  top: -15.26%;
  transform-origin: 50% 50%;
  will-change: transform;
  animation: vinyl-spin 8s linear infinite;
  animation-play-state: paused;
}
.card-foreground { z-index: 2; pointer-events: none; }

.play-control {
  position: absolute;
  z-index: 4;
  left: 7.22%;
  bottom: 2.92%;
  width: 9.07%;
  aspect-ratio: 98 / 103;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}
.play-control::before { content: ""; position: absolute; top: 50%; left: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
.play-control img { display: block; object-fit: contain; max-width: 100%; max-height: 100%; }
.play-icon { width: 100%; }
.pause-icon { height: 100%; display: none !important; }
.loading-icon { display: none; width: 42%; aspect-ratio: 1; border: 3px solid rgb(255 255 255 / 42%); border-top-color: #fff; border-radius: 50%; }

.seek-control {
  position: absolute;
  z-index: 4;
  left: 17.4%;
  right: 13.9%;
  bottom: 2.92%;
  height: 5.4%;
}
.progress-track, .progress-fill {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;
  width: 100%;
  height: 14.45%;
  transform: translateY(-50%);
  pointer-events: none;
}
.progress-fill {
  clip-path: inset(0 calc(100% - var(--progress, 0%)) 0 0);
}
.progress-thumb {
  position: absolute;
  top: 50%;
  left: var(--progress, 0%);
  width: 7.8%;
  min-width: 18px;
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#progress {
  position: absolute;
  inset: 50% 0 auto;
  display: block;
  width: 100%;
  height: max(100%, 44px);
  transform: translateY(-50%);
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}
#progress:disabled { cursor: wait; }
.seek-control:focus-within { outline: 2px solid #fff; outline-offset: 1px; }
.seek-control:focus-within #progress { opacity: 0.01; }

.morse {
  position: absolute;
  z-index: 3;
  display: block;
  width: 68.33%;
  height: auto;
  left: 15.83%;
  bottom: 1.15%;
  pointer-events: none;
}

.card[data-state="playing"] .vinyl { animation-play-state: running; }
.card[data-state="loading"] .loading-icon { display: block; animation: indicator-spin .9s linear infinite; }
.card[data-state="loading"] .play-icon { display: none; }
.card[data-state="playing"] .play-icon { display: none; }
.card[data-state="playing"] .pause-icon { display: block !important; }
.card[data-state="error"] .loading-icon { display: none; }
.card[data-state="error"] .player-status { z-index: 5; width: 80%; height: auto; left: 10%; bottom: 9%; margin: 0; padding: 10px 12px; clip: auto; overflow: visible; white-space: normal; text-align: center; font-size: 13px; line-height: 1.5; background: rgb(0 0 0 / 88%); }

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

@keyframes vinyl-spin { to { transform: rotate(360deg); } }
@keyframes indicator-spin { to { transform: rotate(360deg); } }

@media (min-width: 768px) {
  body {
    background-image: linear-gradient(rgb(8 0 2 / 82%), rgb(8 0 2 / 82%)), url("assets/hotones-background.webp");
  }
}

@media (prefers-reduced-motion: reduce) {
  .vinyl { animation-duration: 16s; }
  .card[data-state="loading"] .loading-icon { animation-duration: 1.5s; }
}
