:root {
  --bg: #121212;
  --panel: #1b1b1b;
  --panel-2: #242424;
  --text: #ffffff;
  --muted: #8b8b8b;
  --line: #333333;
  --accent: #1db954;

  --safe-bottom:
    max(
      env(safe-area-inset-bottom),
      16px
    );
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;

  min-height: 100vh;

  background:
    linear-gradient(
      180deg,
      #1a1a1a 0%,
      var(--bg) 42%
    );

  color: var(--text);

  font-family:
    Inter,
    Arial,
    sans-serif;

  -webkit-font-smoothing:
    antialiased;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color:
    transparent;
}

.app {
  width: 100%;
  max-width: 680px;

  min-height: 100vh;

  margin: 0 auto;

  padding:
    20px
    20px
    calc(32px + var(--safe-bottom));
}

.hidden {
  display: none !important;
}

/* LOADING */

.loading,
.error {
  min-height: 100vh;

  display: grid;
  place-content: center;

  text-align: center;
}

.loading {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.error h1 {
  margin: 0 0 10px;
}

.error p {
  margin: 0;
  color: var(--muted);
}

/* HEADER */

.header {
  margin-bottom: 24px;
}

.header-label {
  margin-bottom: 6px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 700;

  letter-spacing: 0.16em;
}

#album-title {
  margin: 0;

  font-size:
    clamp(
      26px,
      8vw,
      44px
    );

  line-height: 1;

  font-weight: 800;

  overflow-wrap: anywhere;
}

/* COVER */

.cover-wrap {
  width: 100%;

  aspect-ratio: 1;

  margin-bottom: 28px;

  background: var(--panel);

  box-shadow:
    0 20px 60px
    rgba(0, 0, 0, 0.45);

  overflow: hidden;
}

.cover,
.cover-placeholder {
  width: 100%;
  height: 100%;
}

.cover {
  display: block;

  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  place-items: center;

  color: var(--muted);

  font-size: 12px;
  letter-spacing: 0.15em;
}

/* NOW PLAYING */

.now-playing {
  margin-bottom: 20px;
}

.track-meta {
  display: flex;

  align-items: flex-start;

  gap: 14px;
}

.track-number {
  min-width: 34px;

  color: var(--accent);

  font-size: 13px;

  font-weight: 800;

  padding-top: 5px;
}

.track-title-wrap {
  min-width: 0;
}

#track-title {
  margin: 0;

  font-size:
    clamp(
      20px,
      6vw,
      32px
    );

  line-height: 1.1;

  font-weight: 750;

  overflow-wrap: anywhere;
}

/* PROGRESS */

.progress-section {
  margin-bottom: 24px;
}

.progress {
  width: 100%;

  margin: 0;

  appearance: none;

  height: 4px;

  border-radius: 999px;

  background:
    linear-gradient(
      to right,
      var(--accent) 0%,
      var(--accent) var(--progress),
      var(--line) var(--progress),
      var(--line) 100%
    );

  outline: none;
}

.progress::-webkit-slider-thumb {
  appearance: none;

  width: 14px;
  height: 14px;

  border-radius: 50%;

  background: var(--text);
}

.progress::-moz-range-thumb {
  width: 14px;
  height: 14px;

  border: 0;

  border-radius: 50%;

  background: var(--text);
}

.time-row {
  display: flex;

  justify-content: space-between;

  margin-top: 9px;

  color: var(--muted);

  font-size: 12px;

  font-variant-numeric:
    tabular-nums;
}

/* CONTROLS */

.controls {
  display: grid;

  grid-template-columns:
    1fr
    1fr
    74px
    1fr
    1fr;

  align-items: center;

  gap: 8px;

  margin-bottom: 34px;
}

.control-button {
  width: 100%;
  height: 52px;

  background: transparent;

  color: var(--text);

  display: grid;
  place-items: center;

  position: relative;
}

.control-button:active {
  transform: scale(0.93);
}

.control-button.secondary {
  color: var(--muted);

  font-size: 13px;

  font-weight: 700;
}

.play-button {
  width: 74px;
  height: 74px;

  border-radius: 50%;

  background: var(--accent);

  display: grid;
  place-items: center;

  transition:
    transform 0.15s ease;
}

.play-button:active {
  transform: scale(0.93);
}

#play-icon {
  display: block;

  width: 0;
  height: 0;

  margin-left: 5px;

  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid #000;
}

.play-button.playing #play-icon {
  width: 17px;
  height: 20px;

  margin-left: 0;

  border: 0;

  background:
    linear-gradient(
      to right,
      #000 0 6px,
      transparent 6px 11px,
      #000 11px 17px
    );
}

/* PREVIOUS */

.previous-icon {
  position: relative;

  width: 22px;
  height: 20px;

  display: block;
}

.previous-icon::before,
.previous-icon::after {
  content: "";

  position: absolute;

  top: 3px;

  width: 0;
  height: 0;

  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;

  border-right:
    9px solid var(--text);
}

.previous-icon::before {
  left: 1px;
}

.previous-icon::after {
  left: 9px;
}

/* NEXT */

.next-icon {
  position: relative;

  width: 22px;
  height: 20px;

  display: block;
}

.next-icon::before,
.next-icon::after {
  content: "";

  position: absolute;

  top: 3px;

  width: 0;
  height: 0;

  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;

  border-left:
    9px solid var(--text);
}

.next-icon::before {
  left: 3px;
}

.next-icon::after {
  left: 11px;
}

/* TRACK LIST */

.tracks-section {
  border-top:
    1px solid var(--line);

  padding-top: 18px;
}

.section-title {
  margin-bottom: 12px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 700;

  letter-spacing: 0.15em;
}

.track-list {
  max-height: 42vh;

  overflow-y: auto;

  overscroll-behavior:
    contain;

  padding-bottom: 12px;
}

.track-item {
  width: 100%;

  min-height: 58px;

  padding: 12px 10px;

  background: transparent;

  color: var(--text);

  display: grid;

  grid-template-columns:
    34px
    minmax(0, 1fr);

  align-items: center;

  gap: 8px;

  text-align: left;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.06);
}

.track-item:active {
  background:
    rgba(255, 255, 255, 0.06);
}

.track-item.active {
  color: var(--accent);
}

.track-item-number {
  color: var(--muted);

  font-size: 13px;

  font-variant-numeric:
    tabular-nums;
}

.track-item.active
.track-item-number {
  color: var(--accent);
}

.track-item-title {
  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  font-size: 15px;

  font-weight: 600;
}

/* DESKTOP */

@media (min-width: 700px) {
  .app {
    padding-top: 48px;
  }

  .cover-wrap {
    width: min(
      100%,
      540px
    );

    margin-left: auto;
    margin-right: auto;
  }

  .controls {
    max-width: 500px;

    margin-left: auto;
    margin-right: auto;
  }
}