: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); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .08rem;
  font-weight: 800;
  letter-spacing: .01em;
  font-size: clamp(1.1rem, 2.3vw, 1.35rem);
}

.brand-flux { color: var(--black); }
.brand-nine { color: var(--magenta); }

.search-wrap {
  position: relative;
  width: min(620px, 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, 94vw);
  margin: 1.2rem auto 7.5rem;
}

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: auto auto auto minmax(180px, 360px) 1fr;
  align-items: center;
  gap: .9rem;
  padding: .76rem .88rem;
  border: 1px solid #000;
  border-radius: 12px;
  background: #000;
}

.player-btn {
  min-width: 44px;
  width: 44px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #000;
  color: #e6e6e6;
  font-weight: 700;
  padding: .52rem .52rem;
  cursor: pointer;
}

.player-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: #000;
}

.player-meta {
  min-width: 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(--white);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.player-seek {
  width: 100%;
  accent-color: var(--cyan);
}

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

@media (max-width: 780px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    justify-content: center;
  }

  .player {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: auto auto auto 1fr;
    grid-template-areas:
      "btn prev next meta"
      "seek seek seek seek";
  }

  #playerToggle { grid-area: btn; }
  #playerPrev { grid-area: prev; }
  #playerNext { grid-area: next; }
  .player-meta { grid-area: meta; }
  .player-seek { grid-area: seek; }

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