:root {
  --bg: #050508;
  --accent: #5336f6;
  --accent-soft: rgba(83,54,246,0.2);
  --text-main: #ffffff;
  --text-subtle: #a8a8bf;
  --radius-xl: 18px;
}

* { box-sizing: border-box; }

html {
  overflow-y: scroll; /* prevent layout shift when scrollbar appears */
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top left, #181828 0, #050508 45%, #020207 100%);
  color: var(--text-main);
}

.app-shell {
  width: min(1480px, 100% - 32px);
  margin: 0 auto;
  padding: 24px 0 40px;
  min-height: 100vh;
}

.app-title {
  font-size: 1.96rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-subtitle {
  color: var(--text-subtle);
  font-size: 0.9rem;
}

/* ===== LAYOUT: 3 COLUMNS ON DESKTOP ===== */
.layout {
  display: grid;
  /* wider middle column so artwork can be larger */
  grid-template-columns: 340px 580px minmax(0, 1fr);
  gap: 32px;
  margin-top: 18px;
  min-height: 88vh;
}

/* PLAYLIST --------------------- */
/* Safer version for Safari / GPU quirks */
.playlist-card {
  background: rgba(10, 10, 20, 0.92);       /* solid-ish background instead of blur */
  padding: 18px 14px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.08);
  /* If you REALLY want the glass look back, uncomment this and test:
     backdrop-filter: blur(18px);
  */
  min-height: 82vh;
}

.playlist {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: calc(82vh - 40px);
  overflow-y: auto;
}

.track {
  display: flex;
  align-items: center;
  padding: 10px 10px;
  border-radius: 999px;
  cursor: pointer;
  /* Remove the transform to keep GPU use minimal */
  transition: background 0.16s ease;
}

.track + .track {
  margin-top: 6px;
}

.track:hover {
  background: rgba(255,255,255,0.06);
}

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

/* THUMBNAILS */
.track-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  margin-right: 12px;
  flex-shrink: 0;
  background: #000;        /* avoids white box while image is loading */
}

.track-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  -webkit-transform: none; /* make sure Safari doesn't try to do anything weird */
}

.track-title {
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-credits {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.track-duration {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-left: 10px;
}

/* PLAYER (CENTER COLUMN) ----------------------- */
.player-card {
  background: rgb(255 255 255 / 0.02);
  padding: 20px 26px 24px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Support BOTH id and class for the artwork container */
.player-artwork,
#player-artwork {
  width: 100%;
  max-width: 620px;   /* large artwork */
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  overflow: hidden;
  margin: 0 auto;
  box-shadow: 0 22px 50px rgba(0,0,0,0.75);
}

/* Still images */
.player-artwork img,
#player-artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Canvas videos */
.player-artwork video.canvas-video,
#player-artwork video.canvas-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-title {
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  margin-top: 20px;
}

.player-credits {
  text-align: center;
  margin-top: 4px;          /* tiny bit more space above */
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: var(--text-subtle);
}

.controls-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin-top: 18px;
}

/* BUTTON SIZES (DESKTOP + MOBILE) */
.icon-button {
  width: 40px;   /* smaller secondary buttons */
  height: 40px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button.primary {
  width: 60px;   /* larger but not huge */
  height: 60px;
  background: var(--accent);
}

/* Ensure SVGs are always visible and properly sized on all devices */
.icon-button svg {
  width: 22px;
  height: 22px;
}

.icon-button.primary svg {
  width: 28px;
  height: 28px;
}

/* Toggle-style buttons (Shuffle / Loop) when active */
.icon-button.active {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  font-size: 0.9rem;
  width: 100%;
  max-width: 540px;
}

.progress-bar-wrap {
  flex: 1;
  height: 8px;
  background: #1a1a26;
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #588fce, #4e3dec);
  transform-origin: left;
  transform: scaleX(0);
}

/* LYRICS (RIGHT COLUMN) ----------------------- */
.lyrics-card {
  background: rgb(255 255 255 / 0.02);
  padding: 20px 22px 24px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
  min-height: 82vh;
  display: flex;
  flex-direction: column;
}

.lyrics-heading {
  font-size: 0.95rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.lyrics-body {
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
  flex: 1;
}

#lyrics-text {
  display: block;
}

/* footer under lyrics: © + buttons spacing */
.lyrics-footer {
  margin-top: 16px;
}

.lyrics-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.player-action {
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .lyrics-card {
    grid-column: 1 / -1; /* span under player */
    min-height: auto;
    margin-top: 8px;
  }

  .playlist-card,
  .player-card {
    min-height: auto;
  }

  .player-artwork,
  #player-artwork {
    max-width: 480px;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .playlist-card,
  .player-card,
  .lyrics-card {
    min-height: auto;
  }

  .playlist {
    max-height: none;
  }

  .player-artwork,
  #player-artwork {
    max-width: 420px;
  }

  /* Reorder on mobile: player, then lyrics, then playlist at bottom */
  .player-card { order: 1; }
  .lyrics-card { order: 2; }
  .playlist-card { order: 3; }
	
  .share-row {
    margin-top: 16px;
    width: 100%;
    max-width: 540px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-subtle);
  }

  .share-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
  }

  .share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .share-pill {
    border: none;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    font-size: 0.78rem;
    cursor: pointer;
    min-width: 32px;
    text-align: center;
  }

  .share-pill:hover {
    background: rgba(255,255,255,0.12);
  }
}
