@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #000;
  --panel: #121212;
  --panel2: #181818;
  --hover: #282828;
  --muted: #a7a7a7;
  --green: #1ed760;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  background: var(--bg);
  color: #fff;
  font:
    14px Montserrat,
    Arial,
    sans-serif;
  overflow: hidden;
}
button,
input {
  font: inherit;
}
button {
  border: 0;
}
a {
  color: inherit;
  text-decoration: none;
}

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 64px 1fr 78px;
  gap: 8px;
  padding: 8px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
}
.brand {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.search {
  height: 44px;
  width: min(520px, 45vw);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f1f1f;
  border-radius: 24px;
  padding: 0 16px;
}
.search img {
  width: 21px;
  height: 21px;
  opacity: 0.8;
}
.search input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: #fff;
}
.search input::placeholder {
  color: #aaa;
}
.top-spacer {
  flex: 1;
}
.top-link {
  font-weight: 600;
  color: #b3b3b3;
  cursor: pointer;
  line-height: 1.3;
  text-align: right;
}
.top-link:hover {
  color: #fff;
}

.main {
  min-height: 0;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 8px;
}
.sidebar {
  background: var(--panel);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
  scrollbar-width: none;
}
.recent-list::-webkit-scrollbar {
  display: none;
}
.recent-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px;
  border-radius: 7px;
  cursor: pointer;
}
.recent-item:hover {
  background: var(--hover);
}
.recent-item img {
  width: 42px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
}
.recent-item .recent-title {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item .recent-artist {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-empty {
  color: #777;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 2px;
}
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
}
.library-head button {
  background: transparent;
  color: #aaa;
  font-size: 25px;
  cursor: pointer;
}
.library-head button:hover {
  color: #fff;
}

.content {
  background: linear-gradient(180deg, #1b1b1b 0, #121212 210px);
  border-radius: 10px;
  overflow-y: auto;
  scrollbar-width: none;
  min-height: 0;
}
.content::-webkit-scrollbar {
  display: none;
}
.hero {
  padding: 28px 28px 10px;
}
.hero-kicker {
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.hero h1 {
  font-size: clamp(24px, 4vw, 48px);
  margin: 6px 0;
}
.hero p {
  color: var(--muted);
  max-width: 620px;
  line-height: 1.5;
}
.sections {
  padding: 8px 28px 34px;
}
.section {
  margin-top: 28px;
}

.mobile-recent-section {
  display: none;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section h2 {
  font-size: 22px;
}
.show-all {
  color: #aaa;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}
.show-all:hover {
  color: #fff;
  text-decoration: underline;
}
.row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.row::-webkit-scrollbar {
  display: none;
}
.row.expanded {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  overflow: visible;
}

.row.expanded .card {
  width: auto;
  min-width: 0;
}
.card {
  width: 160px;
  min-width: 160px;
  background: var(--panel2);
  padding: 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s ease;
}
.card:hover {
  background: var(--hover);
  transform: translateY(-2px);
}
.cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
  display: block;
  background: #222;
}
.card-title {
  font-weight: 700;
  margin-top: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-artist {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artist .cover {
  border-radius: 50%;
}
.empty {
  padding: 50px 10px;
  text-align: center;
  color: #888;
}

/* Mini Player Footer */
.mini-player {
  background: #181818;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.mp-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}
.mp-info img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.mp-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mp-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.mp-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.mp-controls button {
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.mp-controls button:disabled {
  color: #555;
  cursor: default;
  opacity: 0.4;
}

.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-left: 2px;
}
.play.is-playing {
  padding-left: 0;
}

.mp-controls .play {
  background: #fff;
  color: #000;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 13px;
  flex-shrink: 0;
}

.mp-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.mp-right button {
  background: transparent;
  color: #aaa;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}
.mp-right button:hover:not(:disabled) {
  color: #fff;
  background: var(--hover);
}
.mp-right button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Overlay */
.player-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 100;
}
.player-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.player-modal {
  position: relative;
  width: min(92vw, 520px);
  background: #181818;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 80px #000;
}
.player-close {
  position: absolute;
  right: 13px;
  top: 10px;
  background: transparent;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}
.video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.modal-info {
  padding: 14px 2px 8px;
}
.modal-info h2 {
  font-size: 20px;
}
.modal-info p {
  color: #aaa;
  margin-top: 4px;
}
.modal-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}
.modal-controls button {
  background: transparent;
  color: #fff;
  font-size: 21px;
  cursor: pointer;
}
.modal-controls .play {
  background: var(--green);
  color: #000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 16px;
}
.modal-controls input {
  accent-color: var(--green);
  width: 110px;
}
.youtube-link {
  display: block;
  color: var(--green);
  font-size: 12px;
  margin-top: 8px;
}
.hidden {
  display: none !important;
}

/* Responsive Layout */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 190px 1fr;
  }
  .search {
    width: min(350px, 40vw);
  }
}
@media (max-width: 680px) {
  .app {
    grid-template-rows: 56px 1fr 68px;
    padding: 4px;
    gap: 6px;
  }
  .topbar {
    padding: 0 4px;
    gap: 10px;
  }
  .brand {
    width: 32px;
    height: 32px;
  }
  .search {
    flex: 1;
    width: auto;
    height: 38px;
    padding: 0 12px;
  }
  .top-link {
    font-size: 10px;
  }

  .main {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }

  .mobile-recent-section {
    display: block;
  }
  .hero,
  .sections {
    padding-left: 14px;
    padding-right: 14px;
  }
  .hero {
    padding-top: 18px;
  }
  .card {
    width: 130px;
    min-width: 130px;
    padding: 9px;
  }
  .row.expanded {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Fixed compact footer alignment */
  .mini-player {
    padding: 0 10px;
    gap: 6px;
    grid-template-columns: 1fr auto 1fr;
  }
  .mp-info img {
    width: 36px;
    height: 36px;
  }
  .mp-title {
    font-size: 11px;
  }
  .mp-artist {
    font-size: 10px;
  }
  .mp-controls {
    gap: 8px;
  }
  .mp-controls button {
    font-size: 16px;
  }
  .mp-controls .play {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
}
