:root {
  --bg: #101820;               /* Dark navy background */
  --card: #1b2735;             /* Deep slate blue for panels */
  --text: #f8f9fa;             /* Near-white default text */
  --muted: #a6b1c7;            /* Muted gray-blue text */
  --accent: #FFD700;           /* Gold for highlights */
  --ring: #ffe66d;             /* Warm yellow */
  --hover-bg: #ffe66d;         /* Yellow hover background */
  --hover-text: #101820;       /* Dark hover text for contrast */
  --progress-fill: #4b9bff;    /* Sky blue for progress bar */
  --now-playing-color: #FFD700; /* Gold for Now Playing text */
}

.player-container {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.title {
  text-align: center;
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1rem;
}

.player {
  display: flex;        
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;      
}

.panel {
  background: var(--card);
  padding: 0.5rem;       
  border-radius: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  flex: none;            
}

.label {
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-align: center;    
}

iframe,
audio {
  width: 100%;
  border: none;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Playlist styles */
.playlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: center;   
}

.track {
  display: block;
  padding: 0;
  cursor: pointer;
}

.track span {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 0.4rem;
  transition: 0.2s ease, box-shadow 0.2s ease;
}

.track:hover span {
  background: rgba(255, 215, 0, 0.3);   
  color: var(--text);                   
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.track.active span {
  background: rgba(255, 215, 0, 0.15);  
  color: var(--accent);                 
  font-weight: bold;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

#common-controls {
  margin-bottom: 1rem;
  text-align: center;
}

#now-playing {
  font-size: 0.9rem;          
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--now-playing-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  text-align: center;         
}

.controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: nowrap;           
  margin-bottom: 0.5rem;
}

.controls button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--muted);
  padding: 2px 0.8rem;        
  border-radius: 9999px;      
  cursor: pointer;
  white-space: nowrap;        
  font-size: 0.9rem;          
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;           
  transition: background 0.2s, color 0.2s;
}

.controls button:hover,
#mp3-toggle:hover {
  background: var(--hover-bg);
  color: var(--hover-text);
}

.controls button:focus,
#mp3-toggle:focus {
  outline: none;
}

.controls button:active,
#mp3-toggle:active {
  background: var(--card);
  color: var(--text);
}

/* Disable hover styles on touch devices to prevent "sticking" */
@media (hover: none) and (pointer: coarse) {
  .controls button:hover,
  #mp3-toggle:hover {
    background: var(--card);
    color: var(--text);
  }
}

/* MP3-specific controls */
#mp3-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 8px;
  align-items: flex-end;       
}

#mp3-toggle {
  flex: none;                
  min-width: 90px;           
  text-align: center;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0.8rem;
  font-size: 0.9rem;
  min-height: 32px;          
  transition: background 0.2s, color 0.2s;
}

.slider-group {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;               
}

#seek {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  appearance: none;
  background: linear-gradient(to right, var(--progress-fill) 0%, var(--progress-fill) 0%, #444 0%, #444 100%);
  cursor: pointer;
}

#seek::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid #fff;
  margin-top: -4px;
}

#seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid #fff;
}

#mp3-times {
  display: flex;
  justify-content: space-between;   
  font-size: 0.9rem;
}

#volume-container {
  text-align: center;         
  margin-top: 0.5rem;
}

#volume {
  width: 150px;
  vertical-align: middle;
}

@media (max-width: 700px) {
  .player {
    flex-direction: column;
    align-items: center;      
  }

  .panel {
    width: auto;              
    max-width: 95%;           
    margin: 0 auto;           
  }

  .playlist {
    text-align: center;       
  }

  #now-playing {
    text-align: center;       
  }
}
