* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100dvh; /* dynamic viewport height - fixes mobile jump */
  overflow: hidden; /* prevent body from scrolling */
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: #121212; 
  color: #fff; 
  height: 100vh; 
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* TOP - Fixed */
.top-fixed {
  position: fixed;
  top: env(safe-area-inset-top, 0); /* handles iPhone notch */
  left: 0;
  right: 0;
  z-index: 100;
}
.top-fixed button {
  flex-shrink: 0;
}
.top-row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
#eq-preview { width: 80px; height: 80px; background: #000; border-radius: 4px; }
#albumArt { width: 60px; height: 60px; background: #333; border-radius: 4px; object-fit: cover; }

.folder-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 4px;
  margin-top: 8px;
}

.folder-actions button,.folder-actions label {
  background: #1DB954; 
  border: none; 
  padding: 5px 8px;
  border-radius: 20px; 
  color: #000; 
  font-weight: 600; 
  cursor: pointer; 
  font-size: 11px;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
#file-input, #folder-input { display: none; }
#now-title {
  font-weight: 600;
  font-size: 12px; /* Add this - was likely 14px */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px; /* Drop from 150px to 120px */
}

#now-artist {
  font-size: 11px; /* Drop from 12px */
  color: #b3b3b3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px; /* Match title */
}

/* MIDDLE - Scrollable */
.playlist {
  flex: 1; 
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px;
}

#song-list { list-style: none; }
#song-list li {
  padding: 8px; border-bottom: 1px solid #282828; cursor: pointer;
  display: flex; gap: 10px; align-items: center;
}
#song-list li:hover, #song-list li.active { background: #282828; }
.song-thumb { width: 40px; height: 40px; background: #333; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.song-meta { flex: 1; min-width: 0; }
.song-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
  min-width: 0;}
.song-artist { font-size: 12px; color: #b3b3b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.del-song { background: none; border: none; color: #b3b3b3; cursor: pointer; padding: 4px; }

#song-list li.active {
  background: #1ed76022; /* light green tint */
  border-left: 3px solid #1ed760; /* perpendicular green line */
  padding-left: 9px; /* 12px original - 3px border = 9px to keep alignment */
}

/* BOTTOM - Fixed */
.bottom-fixed {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0); /* handles home bar */
  left: 0;
  right: 0;
  z-index: 100;
}
.controls { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.controls button {
  background: none;
  border: none;
  color: #b3b3b3;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  width: 32px; /* Add this - locks width */
  height: 32px; /* Add this */
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px; /* Don't grow or shrink */
}
.controls button:active {
  transform: scale(0.9);
}
#play {
  width: 32px;
  text-align: center;
}

#shuffle, #repeat, #save-eq {
  font-size: 18px;
}
#shuffle.active, #repeat.active {
  color: #1DB954;
}

.controls select {
  background: #282828;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
}
.waveform-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#waveform {
  flex: 1; /* Takes all available space */
  min-width: 0; /* ← This is the critical fix */
  height: 40px;
}

#timer {
  flex-shrink: 0; /* Don't let timer squish */
  white-space: nowrap; /* Keep "1:23 / 3:45" together */
  font-variant-numeric: tabular-nums; /* Prevents width jitter */
}
#seek { 
  flex: 1 1 100px;
  min-width: 60px;
}
#timer { 
  font-size: 12px; 
  color: #b3b3b3; 
  min-width: 80px; 
  text-align: right; 
  white-space: nowrap;
}

.vu-wrapper { position: relative; height: 20px; margin: 8px 0; }
#vu-meter { width: 100%; height: 20px; pointer-events: none; }
#volume {
  position: absolute; top: 0; left: 0; width: 100%; height: 20px;
  z-index: 2; opacity: 0.8;
}

/* NEW: EQ Sliders */
.eq-controls {
  display: grid; 
  grid-template-columns: repeat(10, 1fr); 
  gap: 4px; 
  margin-top: 8px;
}
.eq-band { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}
.eq-band input { 
  writing-mode: vertical-lr; 
  direction: rtl; 
  width: 20px; 
  height: 60px;
  accent-color: #1DB954;
}
.eq-band div { 
  font-size: 10px; 
  color: #fff; 
  margin: 2px 0; 
  min-height: 12px;
}
.eq-band label { 
  font-size: 9px; 
  color: #b3b3b3; 
  margin-top: 2px; 
}

input[type="range"] { accent-color: #1DB954; }

/* Search bar in top-fixed */
#search {
  grid-column: 1 / -1; /* Span all columns */
  margin-top: 6px;
  padding: 6px 8px;
  background: #282828;
  border: 1px solid #444;
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
#search::placeholder { color: #666; }

.lyrics-box {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  line-height: 2;
  color: #b3b3b3;
}

.lyric-line {
  transition: all 0.2s ease;
  opacity: 0.4;
}

.lyric-line.active {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  opacity: 1;
}

#cover {
  width: 70px;
  height: 70px;
  aspect-ratio: 1 / 1;  /* force square */
  margin-right: 4px;
  flex-shrink: 0;
}

#cover img {
  width: 90%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

#cover.no-song img {
  object-fit: cover;
  padding: 0;
  background: #1E293B;
}


/* In your CSS for the icons/buttons */
.top-fixed svg, 
.bottom-fixed svg {
  width: 24px;   /* or whatever size you’re using */
  height: 24px;
  flex-shrink: 0; /* prevents flex from squishing it */
}

.song-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  cursor: pointer;
}
.song-art {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}
.song-row.active {
  background: #1ed76022; /* subtle green tint */
  border-left: 3px solid #1ed760;
}

.top-fixed, .bottom-fixed {
  background: #121212;
  padding: 8px 12px;
}

/* Mobile tweaks */
@media (max-width: 400px) {
  .folder-actions button {
    flex: 1 1 45%;
  }
  .folder-actions button:last-child {
    flex: 1 1 100%;
  }
  .controls {
    gap: 6px;
  }
  .controls button {
    font-size: 18px;
    min-width: 24px;
  }
  #play { font-size: 24px; }
  #timer {
    font-size: 11px;
    min-width: 70px;
  }
  .controls select {
    font-size: 11px;
    padding: 2px 4px;
  }
  .eq-band input {
    height: 50px;
    width: 18px;
  }
  .eq-band label {
    font-size: 8px;
  }
}

#now-title, #now-artist {
  max-width: 150px;
}

@media (max-width: 450px) {
  #now-title, #now-artist {
    max-width: 100px;
    font-size: 11px;
  }
}