:root {
  color-scheme: dark;
  --background: #000;
  --widget: #090909;
  --hover: #141414;
  --text: #f5f5f5;
  --muted: #777;
  --dim: #414141;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  display: grid;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 42px 20px;
  place-items: center;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.album-widget {
  width: min(100%, 680px);
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid #1e1e1e;
  border-radius: 32px;
  background: var(--widget);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .7);
}

.album-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.album-header img {
  display: block;
  width: clamp(78px, 14vw, 104px);
  height: clamp(78px, 14vw, 104px);
  flex: 0 0 auto;
  border-radius: 16px;
  object-fit: cover;
}

.album-header div {
  min-width: 0;
}

.album-header h1 {
  margin: 0;
  font-size: clamp(32px, 7vw, 52px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: 1;
}

.album-header p {
  margin: 9px 0 0;
  overflow: hidden;
  color: #a0a0a0;
  font-size: clamp(10px, 2.3vw, 13px);
  font-weight: 600;
  letter-spacing: .07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player {
  margin-top: 30px;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 17px;
}

.play-button {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  border-radius: 50%;
  place-items: center;
  background: var(--text);
  color: #050505;
  transition: transform .18s ease, background .18s ease;
}

.play-button:hover {
  background: #fff;
  transform: scale(1.04);
}

.play-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pause-icon,
.is-playing .play-icon {
  display: none;
}

.is-playing .pause-icon {
  display: block;
}

.track-status {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.track-status strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-status > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.waveform {
  position: relative;
  height: 92px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

#wave-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.wave-cursor {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 0;
  width: 1px;
  background: rgba(255, 255, 255, .8);
  pointer-events: none;
}

.tracklist {
  margin-top: 22px;
}

.track-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: background .15s ease;
}

.track-row:hover,
.track-row:focus-visible,
.track-row.active {
  background: var(--hover);
}

.track-number,
.track-duration {
  color: var(--dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.track-duration {
  justify-self: end;
}

.track-title {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row.active .track-number,
.track-row.active .track-duration {
  color: var(--muted);
}

.track-row.active .track-title {
  color: #fff;
}

.number-label {
  display: inline;
}

.equalizer {
  display: none;
  align-items: end;
  gap: 2px;
  width: 12px;
  height: 11px;
}

.equalizer i {
  width: 2px;
  height: 100%;
  background: #fff;
  animation: equalize .65s ease-in-out infinite alternate;
  transform-origin: bottom;
}

.equalizer i:nth-child(2) { animation-delay: -.2s; }
.equalizer i:nth-child(3) { animation-delay: -.45s; }

.track-row.active.is-playing .number-label {
  display: none;
}

.track-row.active.is-playing .equalizer {
  display: inline-flex;
}

@keyframes equalize {
  from { transform: scaleY(.25); }
  to { transform: scaleY(1); }
}

button:focus-visible,
[role="slider"]:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 520px) {
  body {
    align-items: start;
    padding: 14px 10px;
  }

  .album-widget {
    padding: 20px 15px 16px;
    border-radius: 24px;
  }

  .album-header {
    gap: 15px;
  }

  .album-header img {
    border-radius: 12px;
  }

  .album-header h1 {
    font-size: clamp(30px, 11vw, 43px);
  }

  .album-header p {
    letter-spacing: .035em;
  }

  .player {
    margin-top: 25px;
  }

  .waveform {
    height: 78px;
  }

  .track-status {
    display: block;
  }

  .track-status strong,
  .track-status > span {
    display: block;
  }

  .track-status > span {
    margin-top: 5px;
  }

  .track-row {
    min-height: 46px;
    padding-inline: 9px;
  }
}

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