@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0e0e0e;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #666;
  --accent: #c8f060;
  --active-bg: #1f2a0f;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; overflow: hidden; }
body { display: flex; flex-direction: column; }

#header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
#header h1 { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
#track-count { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }

#playlist { flex: 1; overflow-y: auto; }
#playlist::-webkit-scrollbar { width: 4px; }
#playlist::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.group-heading {
  padding: 14px 20px 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-top: 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.group-heading:first-child { margin-top: 0; }

.track { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s; user-select: none; }
.track:hover { background: var(--surface); }
.track.active { background: var(--active-bg); color: var(--accent); }

.track-num { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); width: 24px; text-align: right; flex-shrink: 0; }
.track.active .track-num { display: none; }
.playing-icon { display: none; width: 14px; height: 14px; flex-shrink: 0; }
.track.active.playing .playing-icon { display: block; }
.track.active.playing .track-num { display: none; }
.track-info { flex: 1; min-width: 0; }
.track-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 14px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track.active .track-artist { color: color-mix(in srgb, var(--accent) 60%, transparent); }
.track-duration { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); flex-shrink: 0; }

#player-bar { background: var(--surface); border-top: 1px solid var(--border); padding: 16px 20px; flex-shrink: 0; }
#now-playing { margin-bottom: 12px; }
#now-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#now-artist { font-size: 12px; color: var(--muted); margin-top: 2px; }

#progress-container { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
#time-current, #time-total { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); flex-shrink: 0; width: 36px; }
#time-total { text-align: right; }
#progress { flex: 1; height: 15px; background: var(--border); border-radius: 2px; cursor: pointer; }
#progress-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; pointer-events: none; }

#controls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 10px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: color 0.15s, background 0.15s; }
.btn:hover { color: var(--text); background: var(--border); }
.btn.active { color: var(--accent); }
#btn-play { background: var(--accent); color: var(--bg); border-radius: 50%; width: 56px; height: 56px; padding: 0; }
#btn-play:hover { opacity: 0.9; }

#volume-container { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#volume { width: 70px; -webkit-appearance: none; height: 3px; background: var(--border); border-radius: 2px; outline: none; cursor: pointer; }
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); cursor: pointer; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.playing-icon svg rect { animation: pulse 1.2s ease-in-out infinite; }
.playing-icon svg rect:nth-child(2) { animation-delay: 0.2s; }
.playing-icon svg rect:nth-child(3) { animation-delay: 0.4s; }

#empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

@media (max-width: 480px) {
  .track { padding: 16px 14px; }
  .track-title { font-size: 20px; }
  .track-artist { font-size: 16px; }
  #player-bar, #header { padding: 14px; }
  #volume-container { display: none; }
}
