:root {
  --bg: #0a0a0a;
  --fg: #f4f4f4;
  --muted: #8a8a8a;
  --accent: #e0b200;
  --row: #141414;
  --row-hover: #1e1e1e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font: 15px/1.4 -apple-system, "SF Pro Text", system-ui, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.album { max-width: 720px; margin: 0 auto; padding: 24px 16px 140px; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.cover {
  width: min(360px, 80vw);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  object-fit: cover;
}
.meta h1 { margin: 8px 0 4px; font-size: 1.6rem; letter-spacing: -0.01em; }
.meta .artist { margin: 0; color: var(--accent); font-weight: 600; }
.meta .stats { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }

.tracklist { margin-top: 32px; }
.tracklist ol { list-style: none; padding: 0; margin: 0; }
.tracklist li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--row);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.tracklist li:hover { background: var(--row-hover); }
.tracklist li.active { background: var(--row-hover); outline: 1px solid var(--accent); }
.tracklist .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.tracklist .title { font-weight: 500; }
.tracklist .dur { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(12,12,12,0.95);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid #1a1a1a;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.now-playing { text-align: center; color: var(--muted); margin-bottom: 6px; min-height: 1.2em; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress span { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; width: 3.5ch; }
#seek {
  flex: 1;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  cursor: pointer;
}
#seek::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--fg) var(--seek-pct, 0%), rgba(255, 255, 255, 0.15) var(--seek-pct, 0%));
  border-radius: 2px;
}
#seek::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}
#seek::-moz-range-progress {
  height: 4px;
  background: var(--fg);
  border-radius: 2px;
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  margin-top: -5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
#seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding-top: 10px;
}
.controls button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.controls button:active { transform: scale(0.92); }

.btn-skip {
  width: 48px;
  height: 48px;
  color: var(--fg);
  opacity: 0.85;
  border-radius: 50%;
}
.btn-skip:hover { opacity: 1; background: rgba(255, 255, 255, 0.05); }

.btn-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--fg);
  color: #0a0a0a;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}
.btn-play:hover { transform: scale(1.04); }
.btn-play:active { transform: scale(0.94); }

/* Loading pulse on active row while buffering */
.tracklist li.loading { position: relative; overflow: hidden; }
.tracklist li.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transform: translateX(-100%);
  animation: pulse 1.2s linear infinite;
  pointer-events: none;
}
@keyframes pulse { to { transform: translateX(100%); } }

/* Cover tap affordance */
.cover { cursor: pointer; transition: transform 0.12s ease; }
.cover:active { transform: scale(0.98); }

/* Share button under the album meta */
.btn-share-album {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--row);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.12s ease;
}
.btn-share-album:hover { background: var(--row-hover); }
.btn-share-album:active { transform: scale(0.97); }

/* Per-row share button */
.tracklist li { grid-template-columns: 2rem 1fr auto auto; }
.tracklist .title { display: flex; align-items: center; gap: 8px; }
.tracklist .badge-e {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0;
  flex: none;
}
.tracklist .row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tracklist .row-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s ease, background 0.12s ease;
}
.tracklist .row-btn:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.tracklist li.active .row-btn { color: var(--fg); }

/* Lyrics panel */
.lyrics-panel {
  background: var(--row);
  border-radius: 10px;
  margin: 0 0 6px;
  padding: 14px 16px 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(170px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,30,0.95);
  color: var(--fg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
