:root {
  --white: #FFF;
  --gray: #e6e6e6;
  --cyan: #00aeef;
  --magenta: #ae3aa3;
  --black: #000;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  background: #f1f1f1;
}

body {
  margin: 0;
  font-family: "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--black);
  background: #f1f1f1;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--magenta); }

.layout-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 100vh;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 1rem;
  background: var(--white);
  border-right: 1px solid var(--gray);
  overflow: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: .9rem;
}

.brand img {
  display: block;
  height: 34px;
  width: auto;
  max-width: 44vw;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--gray);
  border-radius: 10px;
  background: var(--white);
  color: var(--black);
  font-size: .95rem;
  line-height: 1.2;
  padding: .7rem .8rem;
}

.search-wrap input:focus {
  outline: 0;
  border-color: var(--cyan);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 54vh;
  overflow: auto;
  border: 1px solid var(--gray);
  border-radius: 10px;
  background: var(--white);
}

.search-results .group {
  padding: .55rem .8rem .2rem;
  color: var(--black);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .7rem;
  font-weight: 700;
}

.search-results a {
  display: block;
  padding: .54rem .8rem;
  border-top: 1px solid var(--gray);
  color: var(--black);
}

.search-results a:hover {
  background: var(--gray);
  color: var(--magenta);
}

.page {
  width: min(1140px, 100%);
  margin: 1rem 1rem 7.5rem 0;
}

.filters {
  margin-top: 1rem;
}

.filters h3 {
  margin: 1rem 0 .45rem;
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--black);
}

.filter-link {
  display: block;
  padding: .42rem .52rem;
  border: 1px solid var(--gray);
  border-radius: 8px;
  margin-bottom: .38rem;
  color: var(--black);
  background: var(--white);
}

.filter-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.filter-link.active {
  border-color: var(--magenta);
  color: var(--magenta);
}

section {
  background: var(--white);
  border: 1px solid var(--gray);
  border-radius: 12px;
  padding: 1rem;
}

section + section { margin-top: 1rem; }

h1 {
  margin: 0 0 .5rem;
  font-size: clamp(1.4rem, 2.6vw, 2.05rem);
  letter-spacing: -0.02em;
  color: var(--black);
}

p {
  margin: 0 0 .5rem;
  color: var(--black);
  line-height: 1.52;
}

.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: .95rem;
}

.album-card {
  background: var(--white);
  border: 1px solid var(--gray);
  border-radius: 10px;
  overflow: hidden;
}

.album-main-link {
  display: block;
}

.album-card:hover {
  border-color: var(--cyan);
}

.album-card img,
.album-card .art-placeholder,
.album-art {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.album-card .art-placeholder {
  display: grid;
  place-items: center;
  color: var(--black);
  background: var(--gray);
}

.album-card h3,
.album-card p {
  margin: .42rem .68rem;
}

.album-card h3 {
  color: var(--black);
  font-size: .95rem;
  line-height: 1.3;
}

.album-card p {
  margin-bottom: .75rem;
  color: var(--black);
  font-size: .84rem;
}

.album-artists a,
.album-artist a {
  color: var(--cyan);
}

.album-artists a:hover,
.album-artist a:hover {
  color: var(--magenta);
}

.album-page {
  display: grid;
  gap: .7rem;
}

.album-hero {
  display: grid;
  grid-template-columns: minmax(180px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.album-art-wrap {
  width: 100%;
}

.album-art {
  max-width: 320px;
  border-radius: 10px;
  border: 1px solid var(--gray);
}

.album-meta {
  min-width: 0;
}

.album-artist {
  font-size: 1rem;
  color: var(--black);
  margin-bottom: .6rem;
}

.album-desc {
  max-width: 72ch;
}

.download-wrap {
  margin-top: .3rem;
}

.download {
  display: inline-block;
  border: 1px solid var(--cyan);
  background: var(--white);
  color: var(--cyan);
  border-radius: 8px;
  padding: .5rem .78rem;
  font-weight: 700;
}

.download:hover {
  border-color: var(--magenta);
  color: var(--magenta);
}

.tracklist {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--gray);
  border-bottom: 1px solid var(--gray);
}

.track {
  display: flex;
  align-items: center;
  gap: .58rem;
  margin: 0;
  padding: .58rem .64rem;
  border-top: 1px solid var(--gray);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.track:first-child {
  border-top: 0;
}

.track:hover {
  background: var(--gray);
}

.track.active {
  background: var(--black);
}

.track-index {
  width: 30px;
  min-width: 30px;
  text-align: center;
  color: var(--black);
  font-size: .82rem;
  font-weight: 700;
  position: relative;
}

.track:hover .track-index,
.track.active .track-index {
  color: transparent;
}

.track:hover .track-index::after,
.track.active .track-index::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 4px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid var(--cyan);
}

.track.active.playing .track-index::before,
.track.active.playing .track-index::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 3px;
  height: 12px;
  border: 0;
  background: var(--cyan);
}

.track.active.playing .track-index::before {
  left: 10px;
}

.track.active.playing .track-index::after {
  left: 16px;
}

.track-name {
  min-width: 0;
  color: var(--black);
  font-size: .94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track.active .track-name {
  color: var(--white);
  font-weight: 700;
}

.track-permalink {
  color: var(--black);
  font-size: .86rem;
  line-height: 1;
  margin-left: .2rem;
}

.track-permalink:hover {
  color: var(--magenta);
}

.track-duration {
  margin-left: auto;
  color: var(--black);
  font-size: .84rem;
  min-width: 44px;
  text-align: right;
}

.track.active .track-duration {
  color: var(--white);
}

.player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  display: grid;
  grid-template-columns: 132px 60px minmax(170px, 320px) minmax(220px, 1fr);
  align-items: center;
  gap: .62rem;
  padding: .62rem .88rem;
  border: 2px solid var(--magenta);
  border-radius: 999px;
  background: var(--white);
}

.player-btn {
  min-width: 48px;
  width: 48px;
  height: 48px;
  border: 2px solid var(--black);
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  position: relative;
}

.player-btn:hover {
  border-color: var(--magenta);
  background: var(--magenta);
  color: var(--white);
}

#playerToggle:hover {
  border-color: var(--magenta);
  background: var(--magenta);
  color: var(--white);
}

.player-meta {
  min-width: 0;
  grid-column: 3;
  grid-row: 1;
}

#playerPrev {
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  margin-right: 0;
}

#playerToggle {
  z-index: 3;
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 60px;
  min-width: 60px;
  height: 60px;
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--white);
}

#playerNext {
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  margin-left: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
}

.icon {
  width: 14px;
  height: 14px;
  position: relative;
  display: inline-block;
}

.icon-play::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.is-playing .icon-play::before {
  content: "";
  left: 1px;
  top: 1px;
  width: 4px;
  height: 12px;
  border: 0;
  background: currentColor;
  box-shadow: 7px 0 0 0 currentColor;
}

.icon-prev::before,
.icon-prev::after,
.icon-next::before,
.icon-next::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.icon-prev::before {
  left: 1px;
  border-right: 8px solid currentColor;
}

.icon-prev::after {
  left: 8px;
  width: 2px;
  height: 14px;
  border: 0;
  background: currentColor;
}

.icon-next::before {
  right: 1px;
  border-left: 8px solid currentColor;
}

.icon-next::after {
  right: 8px;
  width: 2px;
  height: 14px;
  border: 0;
  background: currentColor;
}

.player-title {
  color: var(--black);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-artist-link {
  display: inline;
  color: var(--cyan);
  font-size: .8rem;
}

.player-artist-link:hover {
  color: var(--magenta);
}

.player-subline {
  margin-top: .08rem;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sep {
  color: var(--black);
}

.player-time {
  color: var(--black);
  font-size: .75rem;
  margin-top: .14rem;
}

.player-seek {
  width: 100%;
  accent-color: var(--magenta);
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--magenta) 0%, var(--magenta) calc(var(--seek-progress, 0%) + 1px), var(--gray) calc(var(--seek-progress, 0%) + 1px), var(--gray) 100%);
  grid-column: 4;
  grid-row: 1;
  min-width: 160px;
}

.player-cover-link {
  grid-column: 2;
  grid-row: 1;
  display: inline-block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 0;
}

.player-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-seek::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.player-seek::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -4px;
  border-radius: 999px;
  border: 0;
  background: var(--magenta);
}

.player-seek::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--gray);
}

.player-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 0;
  background: var(--magenta);
}

#audioEngine {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 780px) {
  .layout-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--gray);
  }

  .page {
    margin: 1rem .7rem 7.5rem;
  }

  .player {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: 116px 48px 1fr;
    grid-template-areas:
      "btn cover meta"
      "seek seek seek";
    gap: .75rem;
    border-radius: 24px;
    padding: .7rem .75rem;
  }

  #playerPrev {
    grid-area: btn;
    justify-self: start;
    margin-right: 0;
  }
  #playerToggle {
    grid-area: btn;
    justify-self: center;
  }
  #playerNext {
    grid-area: btn;
    justify-self: end;
    margin-left: 0;
  }
  .player-cover-link { grid-area: cover; }
  .player-meta { grid-area: meta; }
  .player-seek { grid-area: seek; }

  .album-hero {
    grid-template-columns: 1fr;
  }
}
