/* ===== Base ===== */
html {
  overflow-x: hidden;
}

:root {
  /* THEME VARIABLES */
  --grad-1: #00d0ff;
  --grad-2: #ffffff;
  --grad-3: #9a6bff;
  --grad-1-rgb: 0, 208, 255;
  --grad-2-rgb: 255, 255, 255;
  --grad-3-rgb: 154, 107, 255;
  --accent-gradient: linear-gradient(90deg, var(--grad-1), var(--grad-2) 52%, var(--grad-3));
  --accent-gradient-soft: linear-gradient(120deg, rgba(var(--grad-1-rgb), 0.4), rgba(var(--grad-2-rgb), 0.12) 52%, rgba(var(--grad-3-rgb), 0.4));
  --surface-0: #0b0c10;
  --surface-1: #13151b;
  --surface-2: #1b1f27;
  --surface-3: #252a35;
  --bg: var(--surface-0);
  --bg-elev: var(--surface-1);
  --panel: var(--surface-2);
  --panel-2: var(--surface-3);
  --playlist-surface:
    radial-gradient(circle at top left, rgba(var(--grad-1-rgb), 0.06), transparent 34%),
    radial-gradient(circle at top right, rgba(var(--grad-3-rgb), 0.05), transparent 34%),
    linear-gradient(180deg, rgba(18, 22, 30, 0.88), rgba(12, 15, 22, 0.92));
  --scene-surface:
    radial-gradient(circle at 50% 50%, rgba(var(--grad-1-rgb), 0.06), transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(var(--grad-3-rgb), 0.04), transparent 65%),
    #05070c;
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-strong: rgba(255, 255, 255, 0.18);
  --glow-soft: 0 0 6px rgba(var(--grad-1-rgb), 0.12), 0 0 10px rgba(var(--grad-3-rgb), 0.12);
  --glow-strong: 0 0 8px rgba(var(--grad-1-rgb), 0.22), 0 0 12px rgba(var(--grad-3-rgb), 0.22);
  --focus-outline: rgba(var(--grad-1-rgb), 0.9);
  --accent: var(--grad-1);
  --accent-2: var(--grad-3);
  --accent-3: var(--grad-1);
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.7);
  --frame-top: clamp(6px, 0.6vw, 10px);
  --frame-bottom: clamp(12px, 1.5vw, 26px);
  --frame-left-gap: clamp(10px, 1vw, 14px);
  --ui-btn-bg: rgba(255, 255, 255, 0.04);
  --ui-btn-border: rgba(255, 255, 255, 0.08);
  --ui-btn-text: rgba(245, 247, 255, 0.72);
  --ui-btn-hover-text: #f5f7ff;
  --glow: rgba(255, 255, 255, 0.35);
  --radius-md: 12px;
  --radius-lg: 16px;
  --reactive-bass: 0;
  --reactive-bloom: 0;
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
  display:flex;
  height:100vh;
  background: radial-gradient(circle at 32% 4%, rgba(var(--grad-1-rgb), 0.28), transparent 52%),
              radial-gradient(circle at 12% 8%, rgba(var(--grad-3-rgb), 0.2), transparent 45%),
              var(--bg);
  color:var(--text);
  font-family:'Space Grotesk',sans-serif;
  overflow-x: hidden;
  position: relative;
}

#app-toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  max-width: min(88vw, 360px);
  min-height: 42px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: #f5f7ff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.2;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px rgba(var(--grad-1-rgb), 0.06),
    0 0 10px rgba(var(--grad-1-rgb), 0.08);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 130;
}

#app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

#app-toast.toast-success,
#app-toast.toast-warn {
  border-color: rgba(255,255,255,0.16);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(75vmax 75vmax at 50% 74%, rgba(var(--grad-1-rgb), calc(var(--reactive-bass) * 0.24)), transparent 60%),
    radial-gradient(52vmax 52vmax at 50% 28%, rgba(var(--grad-3-rgb), calc(var(--reactive-bloom) * 0.2)), transparent 68%);
  z-index: 0;
}

body.is-playing::before {
  background:
    radial-gradient(80vmax 80vmax at 50% 74%, rgba(var(--grad-1-rgb), calc(var(--reactive-bass) * 0.34)), transparent 60%),
    radial-gradient(58vmax 58vmax at 50% 28%, rgba(var(--grad-3-rgb), calc(var(--reactive-bloom) * 0.28)), transparent 68%);
}

#playlist,
#visualizer-container {
  position: relative;
  z-index: 1;
}

/* ===== Playlist Panel ===== */
#playlist {
  position: relative;
  width: clamp(200px, 18vw, 260px);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: calc(100vh - var(--frame-top) - var(--frame-bottom));
  margin-top: var(--frame-top);
  margin-bottom: var(--frame-bottom);
  margin-left: var(--frame-left-gap);
  padding: 16px 14px 14px;
  background: var(--playlist-surface);
  border-right: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 8px 26px rgba(0,0,0,0.18);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
}

#playlist h1 { text-align:center; }

.playlist-handle {
  display: none;
}

.title-container {
  text-align:center;
  height:100px;
  margin-bottom: 16px;
  position:relative;
  overflow:visible;
}

.animated-text {
  position:relative;
  width:100%;
  height:100%;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  font-size:48px;
  font-weight:bold;
  cursor:default;
  letter-spacing: 1px;
}

#playlist-title span {
  position: absolute;
  top: 0;
  display: inline-block;
  transform-origin: top center;
  color: #f3fbff;
  text-shadow: 0 0 2px rgba(255,255,255,0.22), 0 0 4px rgba(255,255,255,0.10);
  transition: text-shadow 0.5s;
  animation: titleGlowPulse 1.1s ease-in-out infinite;
}

#playlist-title span[data-letter="P"],
#playlist-title span[data-letter="t"] { color: #00c8ff; }
#playlist-title span[data-letter="y"] { color: #ffffff; }
#playlist-title span[data-letter="l"] { color: #43deff; }
#playlist-title span[data-letter="a"] { color: #8fefff; }
#playlist-title span[data-letter="i"] { color: #d7c0ff; }
#playlist-title span[data-letter="s"] { color: #bc99ff; }

@keyframes titleGlowPulse {
  0% {
    text-shadow: 0 0 4px rgba(var(--grad-1-rgb), 0.55), 0 0 6px rgba(var(--grad-1-rgb), 0.4);
  }
  50% {
    text-shadow: 0 0 4px rgba(var(--grad-2-rgb), 0.8), 0 0 6px rgba(var(--grad-2-rgb), 0.42);
  }
  100% {
    text-shadow: 0 0 4px rgba(var(--grad-3-rgb), 0.58), 0 0 6px rgba(var(--grad-3-rgb), 0.42);
  }
}

/* ===== Playlist Tools ===== */
.playlist-icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: var(--ui-btn-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px rgba(var(--grad-1-rgb), 0.05);
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.playlist-icon-btn img {
  width: 18px;
  height: 18px;
  opacity: 0.9;
  display: block;
  filter:
    drop-shadow(0 0 2px rgba(255,255,255,0.4))
    drop-shadow(0 0 4px rgba(var(--grad-1-rgb), 0.25));
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

#playlist-tools-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 18px);
  width: min(280px, 92vw);
  padding: 0;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: rgba(13, 16, 22, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.42),
    0 0 10px rgba(0, 208, 255, 0.06);
  max-height: 0;
  opacity: 0;
  transform: translateY(10px);
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
  z-index: 12;
}

#playlist-tools.open #playlist-tools-panel {
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}


.playlist-search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.025)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.playlist-search::before {
  content: none;
}

.playlist-search:focus-within {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.playlist-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.playlist-search input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

@media (hover: hover) and (pointer: fine) {
  #playlist-tools-panel:hover {
    box-shadow: 0 0 0 1px rgba(var(--grad-1-rgb), 0.18), 0 0 18px rgba(var(--grad-1-rgb), 0.18), 0 0 18px rgba(var(--grad-3-rgb), 0.12);
    filter: drop-shadow(0 0 6px rgba(var(--grad-1-rgb), 0.24)) drop-shadow(0 0 6px rgba(var(--grad-3-rgb), 0.18));
  }
}

.playlist-search input:focus-visible {
  outline: none;
}

/* ===== Song List ===== */
#song-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 10px 6px;
  position: relative;
}

#song-list-empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 8px;
  margin: 8px 6px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
}

#song-list::-webkit-scrollbar { width:6px; }
#song-list::-webkit-scrollbar-track { background: transparent; border-radius:999px; }
#song-list::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.18) !important;
  border-radius:999px;
  box-shadow:none;
  animation:none;
}
#song-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 200, 255, 0.3) !important;
}

.song {
  border-bottom: 1px solid rgba(255,255,255,0.045);
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  align-items: start;
  gap: 8px;
  width: calc(100% - 2px);
  margin-bottom: 6px;
  padding: 9px 8px;
  border-radius: 12px;
  border: 1px solid rgba(110, 220, 255, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.012));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.025),
    0 0 8px rgba(0, 208, 255, 0.035);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.song-index {
  font-size: 10px;
  color: rgba(200, 225, 255, 0.34);
  text-align: right;
  line-height: 1.3;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.song-title {
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.22;
  font-weight: 600;
  color: rgba(238, 246, 255, 0.84);
  letter-spacing: 0.1px;
}

.song:hover:not(.active) {
  transform: translateX(3px);
  border-color: rgba(110, 220, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 12px rgba(0, 208, 255, 0.08),
    0 0 18px rgba(154, 107, 255, 0.05);
}

.song:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.song-remove-btn {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  margin-top: 1px;
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.48);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s ease;
}

.song-remove-btn:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.06);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    0 0 10px rgba(255,255,255,0.08),
    0 0 8px rgba(0,208,255,0.05);
  transform: scale(1.04);
}

.song-remove-btn:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
}
.song.active {
  border-left: 2px solid rgba(110, 235, 255, 0.95);
  animation: none;
  border-color: rgba(120, 220, 255, 0.16);
  border-left-color: rgba(110, 235, 255, 0.95);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.028)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 0 0 1px rgba(120, 220, 255, 0.06),
    0 0 8px rgba(0, 208, 255, 0.05);
  transform: translateX(1px);
}

.song.active .song-title {
  color: #f7fcff;
  font-weight: 700;
}

.song.active .song-index {
  color: rgba(170, 235, 255, 0.82);
}

.song.active .song-remove-btn {
  color: rgba(255,255,255,0.62);
  background: rgba(255,255,255,0.06);
}

@media (min-width: 769px) {
  .song {
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    padding: 10px 10px;
  }

  .song-title {
    font-size: 11.5px;
    line-height: 1.3;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
}

@keyframes activeFlash {
  0%{background:#2f3440;}
  30%{background: rgba(0, 200, 255, 0.06);}
  100%{background: transparent;}
}

#playlist-drop-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(280px, calc(100% - 28px));
  min-height: 130px;
  padding: 14px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  overflow: hidden;
  pointer-events: none;
  cursor: pointer;
  user-select: none;
  opacity: 1;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.28s ease, box-shadow 0.28s ease, opacity 0.28s ease;
  z-index: 2;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

#playlist-drop-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  backdrop-filter: none;
  opacity: 1;
  transition: opacity 0.3s ease, background 0.3s ease;
}

#playlist-drop-overlay > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  #playlist-footer {
    flex-wrap: nowrap;
  }

  #fileupload-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
  }

  #playlist-footer #fileupload-container {
    width: auto;
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }

  #playlist-drop-overlay {
    display: none;
  }

  #playlist-tools-panel {
    right: 10%;
    left: 0%;
    bottom: calc(100% + 12px);
    width: min(92vw, 210px);
    transform: translate(-50%, 10px);
  }

  #playlist-tools.open #playlist-tools-panel {
    transform: translate(-50%, 0);
  }
}

#playlist-drop-overlay span {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.08);
}

#playlist.has-songs #playlist-drop-overlay {
  opacity: 0;
}

#playlist:not(.has-songs) #playlist-drop-overlay {
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  #playlist:not(.has-songs):not(.drag-active) #playlist-drop-overlay:hover {
    opacity: 0.9;
    transform: translate(-50%, calc(-50% - 1px)) scale(1.016);
    border-color: rgba(var(--grad-1-rgb), 0.62);
    box-shadow: 0 0 0 1px rgba(var(--grad-1-rgb), 0.28), 0 0 6px rgba(var(--grad-1-rgb), 0.16), 0 0 8px rgba(255, 255, 255, 0.06);
  }

  #playlist:not(.has-songs):not(.drag-active) #playlist-drop-overlay:hover::before {
    opacity: 1;
    background: transparent;
  }

  #playlist:not(.has-songs):not(.drag-active) #playlist-drop-overlay:hover span {
    color: rgba(255, 255, 255, 0.98);
    text-shadow: 0 0 10px rgba(var(--grad-1-rgb), 0.26), 0 0 8px rgba(255, 255, 255, 0.12);
  }

#playlist:not(.has-songs):not(.drag-active) #playlist-drop-overlay:hover #drop-hint {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.08);
}

}

#playlist-drop-overlay #drop-hint {
  color: rgba(255, 255, 255, 0.82);
}

#playlist.drag-active #playlist-drop-overlay {
  border-color: var(--grad-1);
  box-shadow: 0 0 0 1px rgba(var(--grad-1-rgb), 0.7), 0 0 10px var(--accent-3), 0 0 8px #ffffff, 0 0 16px var(--accent-2);
}

#playlist.drag-active #playlist-drop-overlay::before {
  opacity: 0.65;
  background: rgba(20, 20, 20, 0.24);
}

#playlist.drag-active #playlist-drop-overlay span {
  color: rgba(255, 255, 255, 0.7);
}

#playlist.drag-active #playlist-drop-overlay #drop-hint {
  color: rgba(232, 239, 255, 0.72);
}

/* ===== Upload Area ===== */
#playlist-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  margin-top: 10px;
}

#playlist-footer #playlist-actions {
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
}

#playlist-footer #fileupload-container {
  width: auto;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0;
  margin-right: 0;
  min-height: 44px;
}

#playlist-footer #playlist-tools {
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
}

#playlist-footer #playlist-actions {
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
}

#fileupload-container {
  margin-top: 0;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  transition: box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

#playlist-tools,
#playlist-actions {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  opacity: 0;
  pointer-events: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
  transition: opacity 0.25s ease;
}

#playlist.has-songs #playlist-tools,
#playlist.has-songs #playlist-actions {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

#playlist-tools > #playlist-tools-toggle {
  width: 100%;
  height: 100%;
}

#custom-file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 42px;
  height: 42px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.16);
  overflow: hidden;
  color: #f5f7ff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  white-space: nowrap;
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px rgba(var(--grad-1-rgb), 0.06),
    0 0 10px rgba(var(--grad-1-rgb), 0.08);
  transition:
    all 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#custom-file-upload::after {
  content: none;
}

#upload-btn-mobile {
  display: none;
}

@media (min-width: 769px) {
  #playlist .title-container {
    margin-top: -16px;
  }

  #playlist {
    width: clamp(240px, calc(18vw + 40px), 300px);
    min-width: 240px;
    height: calc(100vh - var(--frame-top) - var(--frame-bottom));
    margin-top: var(--frame-top);
    margin-bottom: var(--frame-bottom);
    margin-left: var(--frame-left-gap);
  }

  #playlist-footer #playlist-tools,
  #playlist-footer #playlist-actions {
    height: 38px;
    min-height: 38px;
  }

  #playlist.has-songs #playlist-footer {
    justify-content: flex-start;
  }

  #fileupload-container {
    flex-wrap: nowrap;
  }

  #playlist.has-songs #playlist-actions {
    margin: 0;
  }

  #playlist-footer #fileupload-container {
    flex: 1 1 auto;
  }

  #playlist.has-songs #fileupload-container {
    justify-content: flex-start;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
  }

  #playlist.has-songs #custom-file-upload {
    transform: none;
  }

  #playlist-tools-panel {
    right: 0;
    left: auto;
    bottom: calc(100% + 16px);
    width: min(300px, calc(100vw - 24px));
    max-width: min(var(--playlist-search-panel-max-width, 300px), calc(100vw - 16px));
    max-height: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    overflow: visible;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }

  #playlist-tools.open #playlist-tools-panel {
    max-width: min(var(--playlist-search-panel-max-width, 300px), calc(100vw - 16px));
    opacity: 1;
    visibility: visible;
    transform: translateY(-6px);
    pointer-events: auto;
    transition-delay: 0s;
  }

  #playlist-tools-panel .playlist-search {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    padding: 10px 12px;
  }

  #playlist-tools-panel .playlist-search input {
    min-width: 0;
    font-size: 13px;
  }
}

#playlist-actions button {
  width: 100%;
  height: 100%;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#playlist-actions #playlist-clear-btn {
  display: none;
  position: relative;
  align-self: center;
  font-size: 0;
  text-shadow: none;
}

#playlist.has-songs #playlist-actions #playlist-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
  #fileupload-container:hover:not(:has(#playlist-actions #playlist-clear-btn:hover)) {
    box-shadow: none;
  }

  #custom-file-upload:hover {
    transform: translateY(-1px);
    border-color: rgba(134, 228, 255, 0.35);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.12),
      0 0 0 1px rgba(72, 205, 255, 0.18),
      0 0 14px rgba(72, 205, 255, 0.18);
  }

  .playlist-icon-btn:hover {
    transform: none;
    border-color: rgba(134, 228, 255, 0.35);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.12),
      0 0 0 1px rgba(72, 205, 255, 0.18),
      0 0 12px rgba(72, 205, 255, 0.18);
    filter: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .playlist-icon-btn:hover img {
    opacity: 1;
    transform: scale(1.02);
    filter: brightness(1.12) saturate(0.88);
  }

}

#custom-file-upload:active {
  transform: scale(0.98);
}

#drop-hint {
  font-size: 12px;
  color: rgba(232, 239, 255, 0.88);
  max-width: 230px;
}

/* ===== Visualizer & Controls ===== */
#visualizer-container {
  flex:1;
  min-width: 0;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:20px;
  position:relative;
}

#controls-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  bottom: auto;
  z-index: 30;
  width: 21px;
  height: 21px;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#controls-toggle-btn img {
  width: 19px;
  height: 19px;
}

#controls-toggle-btn::before {
  content: none;
}

@media (hover: hover) and (pointer: fine) {
  #controls-toggle-btn:hover,
  #controls-toggle-btn:active,
  #controls-toggle-btn.active {
    transform: none;
    box-shadow: none;
    filter: none;
    opacity: 0.9;
  }
}

body:not(.controls-hidden) #controls-toggle-btn {
  top: 10px;
  right: 10px;
  left: auto;
  width: 21px;
  height: 21px;
}

body:not(.controls-hidden) #controls-toggle-btn img {
  width: 19px;
  height: 19px;
  transform: translateY(4px);
}

body.controls-hidden #controls-toggle-btn {
  position: fixed;
  left: 50%;
  right: auto;
  top: auto;
  bottom: 14px;
  transform: translateX(-50%);
  width: 21px;
  height: 21px;
}

body.controls-hidden #controls-toggle-btn img {
  width: 19px;
  height: 19px;
}
canvas {
  width:100%;
  height:100%;
  background: var(--scene-surface);
  border-radius: 18px;
  box-shadow:
    0 0 calc(28px + (var(--reactive-bass) * 42px)) rgba(var(--grad-1-rgb), calc(var(--reactive-bloom) * 0.34)),
    0 0 calc(18px + (var(--reactive-bloom) * 26px)) rgba(var(--grad-3-rgb), calc(var(--reactive-bloom) * 0.2));
  transform: scale(clamp(1.06, calc(1 + 0.00019 * 100vw), 1.26));
  transform-origin: center center;
}

#visualizer-container {
  padding: clamp(6px, 0.6vw, 10px) clamp(10px, 2.2vw, 42px) clamp(12px, 1.5vw, 26px);
}

#audio-controls {
  position:absolute;
  bottom:10px;
  width: clamp(520px, 50vw, 820px);
  left:50%;
  transform: translate(-50%, 0);
  display:flex;
  flex-direction:column;
  align-items:center;
  background: rgba(10, 12, 18, 0.44);
  padding:10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px) saturate(118%);
  -webkit-backdrop-filter: blur(14px) saturate(118%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34), 0 0 18px rgba(var(--grad-1-rgb), 0.08);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, border-color 0.28s ease;
  z-index: 3;
}

#audio-controls::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    linear-gradient(180deg, rgba(var(--grad-1-rgb), 0.03), rgba(var(--grad-3-rgb), 0.02));
  pointer-events: none;
}

#audio-controls > * {
  position: relative;
  z-index: 1;
}

body.controls-hidden #audio-controls {
  width: auto;
  min-width: 0;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

body.controls-hidden #audio-controls > :not(#controls-toggle-btn) {
  display: none !important;
}

/* Audio controls main row */
#audio-controls .controls {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  position: relative;
}

.controls button {
  background: transparent;
  border: none;
  cursor:pointer;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  filter: none;
}
.icon-btn {
  width: 58px;
  height: 58px;
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(180deg, rgba(14, 16, 20, 0.85), rgba(8, 10, 12, 0.85)) padding-box,
              var(--accent-gradient) border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.icon-btn img {
  width: 34px;
  height: 34px;
  transition:0.2s;
  filter: drop-shadow(3px 3px 6px rgba(var(--grad-1-rgb), 0.35));
}

#shuffle-btn,
#prev-btn,
#next-btn,
#repeat-btn {
  width: 55px;
  height: 55px;
  min-width: 55px;
  min-height: 55px;
}

#shuffle-btn img,
#prev-btn img,
#next-btn img,
#repeat-btn img {
  width: 31px;
  height: 31px;
}

#play-pause-btn {
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  border-radius: 14px;
}

#play-pause-btn img {
  width: 40px;
  height: 40px;
}

#eq-icon {
  width: 35px;
  height: 35px;
}

@media (hover: hover) and (pointer: fine) {
  .controls button:hover,
  .icon-btn:hover {
    transform: scale(1.022);
    box-shadow:
      0 0 0 1px rgba(var(--grad-1-rgb), 0.13),
      0 0 8px rgba(var(--grad-1-rgb), 0.10),
      0 0 10px rgba(var(--grad-3-rgb), 0.07);
    filter:
      drop-shadow(0 0 2px rgba(var(--grad-1-rgb), 0.18))
      drop-shadow(0 0 3px rgba(var(--grad-3-rgb), 0.12));
  }

  #play-pause-btn:hover {
    transform: none;
    box-shadow:
      0 0 0 1px rgba(var(--grad-1-rgb), 0.12),
      0 0 7px rgba(var(--grad-1-rgb), 0.08),
      0 0 9px rgba(var(--grad-3-rgb), 0.06);
    filter:
      drop-shadow(0 0 1px rgba(var(--grad-1-rgb), 0.12))
      drop-shadow(0 0 2px rgba(var(--grad-3-rgb), 0.08));
  }
}

.controls button.active,
.icon-btn.active {
  transform: scale(1.06);
  filter: drop-shadow(0 0 8px rgba(var(--grad-1-rgb), 0.45)) drop-shadow(0 0 8px rgba(var(--grad-3-rgb), 0.35));
}

.controls button:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45);
}

#audio-controls .controls #eq-btn {
  background: linear-gradient(180deg, rgba(14, 16, 20, 0.7), rgba(8, 10, 12, 0.7)) padding-box,
              var(--accent-gradient-soft) border-box;
  border: 0;
  box-shadow: var(--glow-soft);
  position: static;
  transform: none;
  margin-right: 10px;
}

@media (min-width: 769px) {
  #controls-toggle-btn {
    width: 22px;
    height: 22px;
  }

  #controls-toggle-btn img {
    width: 20px;
    height: 20px;
  }

  #audio-controls .controls {
    width: 100%;
    justify-content: center;
    gap: 1px;
  }
}

/* --- Sliders --- */
#seek-bar,#volume-bar {
  -webkit-appearance:none;
  appearance:none;
  border-radius:10px;
  outline:none;
  cursor:pointer;
  margin:5px 0;
  height:8px;
  background: var(--accent-gradient);
  box-shadow: 0 0 6px rgba(var(--grad-1-rgb), 0.45), 0 0 10px rgba(var(--grad-3-rgb), 0.45), 0 0 12px rgba(var(--grad-1-rgb), 0.25);
}

#seek-bar {
  width: min(80%, 520px);
  margin-bottom: 5px;
}

#seek-bar::-webkit-slider-thumb, #volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #fff;
  box-shadow: 0 0 8px rgba(var(--grad-1-rgb), 0.45), 0 0 8px rgba(var(--grad-3-rgb), 0.4), 0 0 10px rgba(var(--grad-1-rgb), 0.35);
  cursor: pointer;
  transition: 0.2s;
}
#seek-bar::-webkit-slider-thumb:hover, #volume-bar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(var(--grad-1-rgb), 0.55), 0 0 10px rgba(var(--grad-3-rgb), 0.5), 0 0 12px rgba(var(--grad-1-rgb), 0.45);
}
#time-display { color: var(--muted); font-size:14px; margin-bottom:5px; }
#volume-percentage { margin-left:5px; color: var(--muted); }

/* =========================
   MOBILE APP LAYOUT
========================= */

@media (max-width: 768px) {

  body {
    flex-direction: column;
    overflow: hidden;
  }

  /* VISUALIZER = MAIN SCREEN */
  #visualizer-container {
    flex: 1;
    width: 100%;
    height: 100vh;
    padding: 6px 12px;
  }

  canvas {
    width: 88%;
    height: 93%;
    max-width: 88vw;
    max-height: 93vh;
    box-shadow: none;
    transform: scale(clamp(0.84, calc(0.82 + 0.00018 * 100vw), 0.96));
  }

  /* CONTROLS = BOTTOM BAR */
  #audio-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    transform: none;
    border-radius: 16px 16px 0 0;
    backdrop-filter: blur(14px) saturate(118%);
    background: rgba(8, 10, 12, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.34), 0 0 14px rgba(var(--grad-1-rgb), 0.08);
    z-index: 20;
  }

  body.controls-hidden #audio-controls {
    transform: none;
    width: auto;
  }

  body.controls-hidden #audio-controls > :not(#controls-toggle-btn) {
    display: none !important;
  }

  body:not(.controls-hidden) #controls-toggle-btn {
    position: absolute;
    top: 4px;
    right: 9px;
    bottom: auto;
    z-index: 35;
    width: 22px;
    height: 22px;
  }

  body:not(.controls-hidden) #controls-toggle-btn img {
    width: 18px;
    height: 18px;
    transform: translateY(-2px);
  }

  body.controls-hidden #controls-toggle-btn {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 12px;
    top: auto;
    transform: translateX(-50%);
  }

  .icon-btn {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
  }

  #audio-controls .controls {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  #shuffle-btn,
  #prev-btn,
  #next-btn,
  #repeat-btn {
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
  }

  #shuffle-btn img,
  #prev-btn img,
  #next-btn img,
  #repeat-btn img {
    width: 31px;
    height: 31px;
  }

  #play-pause-btn {
    width: 73px;
    height: 73px;
    min-width: 73px;
    min-height: 73px;
  }

  #play-pause-btn img {
    width: 40px;
    height: 40px;
  }

  #seek-bar,
  #volume-bar {
    height: 12px;
  }

  #seek-bar {
    width: min(72%, 360px);
  }

  #audio-controls .controls #eq-btn {
    width: calc(clamp(50px, 14.5vw, 40px) + 1px);
    height: calc(clamp(50px, 14.5vw, 40px) + 1px);
    margin-right: 3px;
  }

  /* HANDLE = always visible on mobile */
  .playlist-handle {
    display: block;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 55px;
    height: 6px;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    z-index: 55;
    transition: top 0.3s ease, bottom 0.3s ease;
  }

  /* PLAYLIST = panel hidden above screen */
  #playlist {
    position: fixed;
    top: -60vh;
    left: -2px;
    width: calc(100% - 16px);
    height: 60vh;
    background: #333;
    border-radius: 0 0 16px 16px;
    z-index: 40;
    transition: top 0.35s ease, height 0.35s ease;
    overflow: hidden;
    padding-top: 12px;
  }

  #playlist-tools {
    margin: 0;
  }

  #playlist-footer {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transform: translateY(-4px);
  }

  #playlist-footer #fileupload-container {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    min-width: auto;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding-left: 8px;
  }

  #song-list {
    padding-right: 2px;
    margin-top: -50px;
  }

  .song {
    font-size: 13px;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 6px;
    margin-bottom: 3px;
    grid-template-columns: 16px minmax(0, 1fr) 18px;
  }

  .song-title {
    min-width: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.25;
  }

  .song-index {
    font-size: 10px;
    opacity: 1;
  }

  .song-remove-btn {
    width: 18px;
    height: 18px;
    font-size: 11px;
    opacity: 0.9;
  }

  #playlist.open {
    top: 6px;
  }

  #playlist.open .playlist-handle {
    position: absolute;
    top: auto;
    bottom: 8px;
  }

  body.eq-mobile-open #playlist {
    top: calc(-60vh + var(--eq-mobile-push, 0px));
    height: calc(60vh - var(--eq-mobile-push, 0px));
  }

  body.eq-mobile-open #playlist.open {
    top: max(0px, calc(6px - var(--eq-mobile-push, 0px)));
  }

  body.eq-mobile-open #playlist .title-container {
    display: none;
  }

  body.eq-mobile-open #playlist #song-list {
    padding-top: 6px;
    padding-bottom: 58px;
  }

  body.eq-mobile-open #playlist #fileupload-container {
    position: sticky;
    bottom: 0;
    z-index: 5;
    width: auto;
    margin: 0 auto 4px;
    padding: 0;
    border-radius: 12px;
    gap: 8px;
    flex-direction: row;
    background: transparent;
    box-shadow: none;
  }

  body.eq-mobile-open #playlist-footer {
    width: calc(100% - 12px);
    margin: 0 auto 4px;
  }

  body.eq-mobile-open #playlist-footer #fileupload-container {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    min-width: auto;
    min-height: 42px;
    margin: 0;
    align-items: center;
    justify-content: center;
  }

  body.eq-mobile-open #playlist-footer #playlist-tools {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  body.eq-mobile-open #playlist #custom-file-upload,
  body.eq-mobile-open #playlist #upload-btn-mobile,
  body.eq-mobile-open #playlist #playlist-clear-btn,
  body.eq-mobile-open #playlist #playlist-tools-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    font-size: 0;
    background: rgba(19, 23, 32, 0.9);
    align-items: center;
    justify-content: center;
    filter: none;
    transition: transform 0.2s ease, filter 0.2s ease;
  }

  body.eq-mobile-open #playlist #custom-file-upload {
    display: none;
  }

  body.eq-mobile-open #playlist #upload-btn-mobile {
    display: inline-flex;
  }

  #playlist .title-container {
    padding-top: 5px;
    margin-top: -11px;
  }

  .animated-text {
    font-size: 31px;
    letter-spacing: 1.8px;
  }

  #playlist-title span {
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.4), 0 0 4px rgba(255, 255, 255, 0.16);
  }

  #fileupload-container {
    width: auto;
    min-height: 42px;
    padding: 0;
    gap: 8px;
    flex-direction: row;
    justify-content: flex-start;
    background: transparent;
    box-shadow: none;
  }

  #playlist-actions {
    width: auto;
    max-height: 48px;
    margin: 0;
    overflow: visible;
  }

  #playlist.has-songs #playlist-actions {
    margin: 0;
  }

  #custom-file-upload,
  #upload-btn-mobile,
  .playlist-icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    font-size: 0;
    background: rgba(19, 23, 32, 0.9);
    align-items: center;
    justify-content: center;
    filter: none;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  }

  #custom-file-upload {
    display: none;
  }

  #upload-btn-mobile {
    display: inline-flex;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    cursor: pointer;
  }

  #playlist-tools {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
  }

  #fileupload-container {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  #upload-btn-mobile:focus {
    outline: none;
  }

  #upload-btn-mobile:focus-visible,
  .playlist-icon-btn:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
  }
}

@media (max-width: 768px) {
  #upload-btn-mobile:active,
  .playlist-icon-btn:active {
    transform: scale(1.06);
    border-color: rgba(255, 255, 255, 0.75);
    filter: drop-shadow(0 0 8px rgba(var(--grad-1-rgb), 0.45)) drop-shadow(0 0 8px rgba(var(--grad-3-rgb), 0.35));
    box-shadow: 0 0 8px rgba(var(--grad-1-rgb), 0.3), 0 0 10px rgba(var(--grad-3-rgb), 0.25);
  }
}

/* Visually hidden helper for accessibility */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* EQ panel */
#eq-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 28px));
  max-height: min(56vh, 360px);
  overflow: visible !important;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(12, 14, 18, 0.94), rgba(9, 11, 14, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--glow-soft);
  padding: clamp(10px, 1.6vw, 14px);
  border-radius: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 25;
}

#audio-controls.eq-open #eq-panel {
  display: flex;
  overflow: visible !important;
}

.eq-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transform: translateY(-5px);
}

.eq-panel-header h3 {
  margin: 0;
  font-size: clamp(17px, 2.1vw, 20px);
  letter-spacing: 0.4px;
  text-shadow: 0 0 6px rgba(255,255,255,0.35), 0 0 10px rgba(var(--grad-1-rgb), 0.2);
}

#eq-close-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(14, 16, 20, 0.9), rgba(8, 10, 12, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

#eq-close-btn img {
  width: 20px;
  height: 20px;
}

.eq-presets {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  overflow: visible;
}

.eq-presets label {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.eq-preset-dropdown {
  position: relative;
  min-width: 0;
  z-index: 120;
}

.eq-preset-dropdown.open {
  z-index: 10000;
}

.eq-preset-toggle {
  width: 100%;
  height: 35px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(150, 220, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 26, 34, 0.96), rgba(12, 15, 21, 0.98));
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(80, 190, 255, 0.04);
  cursor: pointer;
}

.eq-preset-toggle:focus {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 0 0 1px rgba(92, 214, 255, 0.22),
    0 0 10px rgba(0, 208, 255, 0.12);
}

.eq-preset-caret {
  opacity: 0.8;
  font-size: 12px;
  transition: transform 160ms ease;
}

.eq-preset-caret::before {
  content: "\25be";
}

.eq-preset-dropdown.open .eq-preset-caret {
  transform: rotate(180deg);
}

.eq-preset-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(135, 215, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(16, 20, 27, 0.985), rgba(9, 12, 17, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 14px 28px rgba(0,0,0,0.42),
    0 0 0 1px rgba(70, 170, 255, 0.05);
  z-index: 9999;
  pointer-events: auto;
  max-height: min(220px, var(--eq-menu-max-height, 220px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 208, 255, 0.35) transparent;
}

.eq-preset-menu::-webkit-scrollbar {
  width: 6px;
}

.eq-preset-menu::-webkit-scrollbar-track {
  background: transparent;
}

.eq-preset-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 208, 255, 0.28);
  border-radius: 999px;
}

.eq-preset-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 208, 255, 0.4);
}

.eq-preset-dropdown.open .eq-preset-menu {
  display: flex;
}

.eq-preset-option {
  width: 100%;
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(235, 245, 255, 0.9);
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.15px;
  cursor: pointer;
}

.eq-preset-option:hover,
.eq-preset-option:focus {
  background: rgba(120, 210, 255, 0.08);
  color: #ffffff;
  outline: none;
}

.eq-preset-option.is-selected {
  background:
    linear-gradient(90deg, rgba(60, 180, 255, 0.2), rgba(0, 208, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(120, 220, 255, 0.16);
  color: #fff;
}

@media (min-width: 769px) {
  .song {
    font-size: 13px;
    padding: 10px 8px;
    gap: 8px;
    grid-template-columns: 18px minmax(0, 1fr) 20px;
  }

  .song-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    letter-spacing: 0.2px;
  }

  .song-index {
    font-size: 12px;
    opacity: 0.75;
  }

  .song-remove-btn {
    width: 22px;
    height: 22px;
    font-size: 16px;
    border-radius: 999px;
    opacity: 0.8;
  }

  .song-remove-btn:hover {
    opacity: 1;
  }
}

.eq-preset-toggle,
#eq-reset-btn {
  height: 35px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
}

#eq-preset-select.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#eq-reset-btn:focus {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
}

#eq-reset-btn {
  padding: 0 12px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(28, 31, 38, 0.92), rgba(18, 20, 26, 0.92));
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 600;
  letter-spacing: 0.15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  #eq-reset-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(34, 38, 46, 0.96), rgba(22, 24, 30, 0.96));
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  }
}

.eq-band {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eq-band label {
  width: clamp(52px, 16vw, 64px);
  font-size: clamp(13px, 1.8vw, 14px);
}

.eq-band input[type="range"] {
  flex: 1;
  min-width: 0;
}

#eq-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 10px;
  background: var(--accent-gradient);
  box-shadow:
    0 0 6px rgba(var(--grad-3-rgb), 0.65),
    0 0 10px rgba(var(--grad-1-rgb), 0.4);
  cursor: pointer;
  touch-action: pan-x;
}

#eq-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 6px rgba(255,255,255,0.9),
    0 0 8px rgba(var(--grad-1-rgb), 0.55),
    0 0 6px rgba(var(--grad-3-rgb), 0.45);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

#eq-panel input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

#eq-panel input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.25);
  box-shadow:
    0 0 8px rgba(255,255,255,1),
    0 0 12px rgba(var(--grad-1-rgb), 0.6),
    0 0 10px rgba(var(--grad-3-rgb), 0.55);
}

/* Mobile only: EQ replaces controls */
@media (max-width: 768px) {
  #audio-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background: linear-gradient(180deg, rgba(12, 14, 18, 0.92), rgba(8, 10, 12, 0.92)) padding-box,
                var(--accent-gradient) border-box;
    border: 0;
    box-shadow: var(--glow-soft);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
  }

  #audio-controls.eq-open #shuffle-btn,
  #audio-controls.eq-open #prev-btn,
  #audio-controls.eq-open #play-pause-btn,
  #audio-controls.eq-open #next-btn,
  #audio-controls.eq-open #repeat-btn,
  #audio-controls.eq-open #seek-bar,
  #audio-controls.eq-open #time-display,
  #audio-controls.eq-open #volume-bar,
  #audio-controls.eq-open #volume-percentage {
    display: none;
  }

  #eq-panel {
    position: static;
    transform: translate(0, 0);
    width: min(420px, calc(100vw - 18px));
    max-width: min(420px, calc(100vw - 18px));
    max-height: min(46vh, 320px);
    margin-top: clamp(6px, 1.5vh, 10px);
    border-radius: 12px;
    display: none;
    opacity: 1;
  }

  #audio-controls.eq-open #eq-panel {
    display: flex;
    overflow: visible !important;
  }
}

/* Extra mobile fit / scale */
@media (max-width: 768px) {
  #audio-controls {
    padding: clamp(10px, 2.2vh, 14px) 10px 8px;
    gap: clamp(4px, 1vh, 8px);
    max-height: min(42vh, 320px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #audio-controls .controls {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
    transform: translateY(-4px);
  }

  .icon-btn {
    width: clamp(55px, 14.5vw, 60px);
    height: clamp(55px, 14.5vw, 60px);
    flex: 0 0 auto;
  }

  .icon-btn img {
    width: clamp(31px, 8.8vw, 35px);
    height: clamp(31px, 8.8vw, 35px);
  }

  #shuffle-btn,
  #prev-btn,
  #next-btn,
  #repeat-btn {
    width: clamp(51px, 12.8vw, 58px);
    height: clamp(51px, 12.8vw, 58px);
  }

  #play-pause-btn {
    width: clamp(66px, 16.8vw, 74px);
    height: clamp(66px, 16.8vw, 74px);
  }

  #play-pause-btn img {
    width: clamp(37px, 9.8vw, 42px);
    height: clamp(37px, 9.8vw, 42px);
  }

  #audio-controls .icon-btn img {
    width: 35px;
    height: 35px;
  }

  #audio-controls #eq-icon {
    width: 33px;
    height: 33px;
  }

  #seek-bar,
  #volume-bar {
    margin: 3px 0;
    height: 10px;
  }

  #time-display,
  #volume-percentage {
    font-size: clamp(12px, 3.3vw, 14px);
    margin: 0;
  }

  #eq-panel {
    margin-top: 6px;
    padding: 8px;
  }

  #audio-controls.eq-open {
    width: 100%;
    max-height: calc(100dvh - 8px);
    padding: 8px 8px 0;
    overflow: visible;
    align-items: center;
    justify-content: flex-end;
    z-index: 65;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    box-shadow: none;
  }

  #audio-controls.eq-open::before {
    content: none;
  }

  #audio-controls.eq-open #eq-panel {
    width: calc(88vw + 20px);
    max-width: calc(88vw + 20px);
    max-height: min(44vh, 300px);
    margin: 0 auto 6px;
    padding: clamp(5px, 1.6vw, 7px);
    gap: 6px;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  #audio-controls.eq-open #eq-panel .eq-panel-header {
    gap: 6px;
    transform: translateY(-5px);
  }

  #audio-controls.eq-open #eq-panel .eq-panel-header h3 {
    font-size: clamp(13px, 3.8vw, 15px);
  }

  #audio-controls.eq-open #eq-panel #eq-close-btn {
    width: 30px;
    height: 30px;
    transform: translateY(3px);
  }

  #audio-controls.eq-open #eq-panel #eq-close-btn img {
    width: 17px;
    height: 17px;
  }

  .eq-presets {
    grid-template-columns: 1fr;
    gap: 4px;
    transform: translateY(-4.5px);
  }

  #audio-controls.eq-open #eq-panel .eq-presets label {
    font-size: 11px;
  }

  .eq-preset-toggle,
  #eq-reset-btn {
    width: 100%;
    height: 28px;
    font-size: 11px;
  }

  .eq-band {
    gap: 5px;
  }

  #audio-controls.eq-open #eq-panel .eq-band label {
    width: 42px;
    font-size: 12px;
  }

  #audio-controls.eq-open #eq-panel input[type="range"] {
    height: var(--mobile-slider-track-height);
    box-shadow: none;
  }

  #audio-controls.eq-open #eq-panel input[type="range"]::-webkit-slider-runnable-track {
    height: var(--mobile-slider-track-height);
  }

  #audio-controls.eq-open #eq-panel input[type="range"]::-webkit-slider-thumb {
    width: var(--mobile-slider-thumb-size);
    height: var(--mobile-slider-thumb-size);
    margin-top: var(--mobile-slider-thumb-offset);
    box-shadow: none;
  }

  #audio-controls.eq-open #eq-panel input[type="range"]::-moz-range-thumb {
    width: var(--mobile-slider-thumb-size);
    height: var(--mobile-slider-thumb-size);
    box-shadow: none;
  }
}

@media (max-width: 420px), (max-height: 740px) {
  #eq-panel {
    width: min(340px, calc(100vw - 16px));
    max-width: min(340px, calc(100vw - 16px));
    max-height: min(42vh, 250px);
    padding: 6px;
  }

  #audio-controls.eq-open {
    max-height: calc(100dvh - 6px);
    padding: 6px 6px 0;
  }

  #audio-controls.eq-open #eq-panel {
    width: calc(88vw + 20px);
    max-width: calc(88vw + 20px);
    max-height: min(44vh, 300px);
    margin: 0 auto 4px;
    overflow: visible !important;
  }

  body:not(.controls-hidden) #controls-toggle-btn {
    top: 4px;
    right: 6px;
    left: auto;
    width: 30px;
    height: 30px;
  }

  body.controls-hidden #controls-toggle-btn {
    left: 50%;
    right: auto;
    top: auto;
    bottom: 12px;
    transform: translateX(-50%);
  }

  #audio-controls {
    max-height: min(38vh, 270px);
    padding-top: 6px;
    padding-bottom: 6px;
  }

  #audio-controls .controls {
    gap: 9px;
  }

  .icon-btn {
    width: clamp(55px, 15.6vw, 60px);
    height: clamp(55px, 15.6vw, 60px);
  }

  .icon-btn img {
    width: clamp(31px, 9.2vw, 35px);
    height: clamp(31px, 9.2vw, 35px);
  }

  #shuffle-btn,
  #prev-btn,
  #next-btn,
  #repeat-btn {
    width: clamp(51px, 14.2vw, 58px);
    height: clamp(51px, 14.2vw, 58px);
  }

  #play-pause-btn {
    width: clamp(66px, 18vw, 74px);
    height: clamp(66px, 18vw, 74px);
  }

  #play-pause-btn img {
    width: clamp(37px, 10.5vw, 42px);
    height: clamp(37px, 10.5vw, 42px);
  }

  #eq-icon {
    width: clamp(23px, 8vw, 33px);
    height: clamp(23px, 8vw, 33px);
  }

  #seek-bar,
  #volume-bar {
    height: 8px;
  }
}

@media (min-width: 769px) {
  body:not(.controls-hidden) #controls-toggle-btn {
    position: absolute;
    top: -10px;
    right: -5px;
    left: auto;
    bottom: auto;
    transform: none;
    width: 22px;
    height: 22px;
  }

  body.controls-hidden #controls-toggle-btn {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
  }

  body.controls-hidden #controls-toggle-btn img {
    width: 22px;
    height: 22px;
  }
}

/* EQ mode (desktop + mobile) */
#audio-controls.eq-open #shuffle-btn,
#audio-controls.eq-open #prev-btn,
#audio-controls.eq-open #play-pause-btn,
#audio-controls.eq-open #next-btn,
#audio-controls.eq-open #repeat-btn,
#audio-controls.eq-open #seek-bar,
#audio-controls.eq-open #time-display,
#audio-controls.eq-open #volume-bar,
#audio-controls.eq-open #volume-percentage,
#audio-controls.eq-open #controls-toggle-btn {
  display: none;
}

#audio-controls.eq-open #eq-btn {
  display: none;
}

#audio-controls.eq-open #eq-panel {
  width: min(420px, calc(100% - 8px));
  margin-left: auto;
  margin-right: auto;
  z-index: 70;
  overflow: visible !important;
}

#audio-controls.eq-open {
  background: transparent;
  backdrop-filter: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* Desktop narrow (devtools resize, no mobile emulation) */
@media (max-width: 1024px) and (min-width: 769px) {
  #playlist {
    width: clamp(240px, calc(30vw + 40px), 300px);
    min-width: 220px;
    padding: 14px;
  }

  #seek-bar {
    width: 78%;
    max-width: 460px;
  }

  #audio-controls .controls #eq-btn {
    width: 39px;
    height: 39px;
    margin-right: 10px;
  }

  .icon-btn {
    width: 60px;
    height: 60px;
  }

  .icon-btn img {
    width: 42px;
    height: 42px;
  }

  #audio-controls .controls {
    gap: 4px;
  }
}

/* Final controls alignment tuning */
#audio-controls .controls {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  transform: none;
  padding-right: 78px;
}

@media (min-width: 769px) {
  #audio-controls .controls {
    transform: translateX(2px);
  }
}

@media (max-width: 768px) {
  #audio-controls .controls {
    gap: 1px;
    padding-right: 64px;
  }
}

/* --- Clear modal --- */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 14, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 140;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(92vw, 466px);
  padding: 20px 20px 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(12, 16, 24, 0.94), rgba(8, 11, 18, 0.92));
  border: 1px solid rgba(120, 220, 255, 0.10);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.42),
    0 0 24px rgba(0, 208, 255, 0.06);
}

.modal-card h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #eef7ff;
}

.modal-card p {
  color: rgba(235, 244, 255, 0.62);
  font-size: 12.5px;
  margin-bottom: 15px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-btn:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
}

.modal-actions .modal-btn {
  height: 36px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  color: rgba(245, 250, 255, 0.88);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.18s ease;
}

.modal-actions .modal-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
}

.modal-actions .modal-btn:first-child {
  border-color: rgba(90, 220, 255, 0.24);
  color: #f4fcff;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035)),
    linear-gradient(135deg, rgba(0,208,255,0.05), rgba(255,255,255,0.02));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 8px 14px rgba(255,255,255,0.04),
    0 0 0 1px rgba(0,208,255,0.06),
    0 0 10px rgba(0,208,255,0.06);
  backdrop-filter: blur(8px) saturate(112%);
  -webkit-backdrop-filter: blur(8px) saturate(112%);
}

.modal-actions .modal-btn:first-child:hover {
  border-color: rgba(120, 228, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.045)),
    linear-gradient(135deg, rgba(0,208,255,0.06), rgba(255,255,255,0.025));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 8px 14px rgba(255,255,255,0.05),
    0 0 0 1px rgba(0,208,255,0.10),
    0 0 12px rgba(0,208,255,0.10);
}

@media (max-width: 720px) {
  .modal-card {
    width: min(92vw, 400px);
    padding: 20px 20px 22px;
  }
}

/* =========================
   MOBILE COLOR CONSISTENCY
========================= */
@media (max-width: 900px) {
  :root {
    --mobile-neon-track: var(--accent-gradient);
    --mobile-neon-track-rest: rgba(255, 255, 255, 0.16);
    --mobile-neon-glow-soft: 0 0 5px rgba(var(--grad-1-rgb), 0.35), 0 0 7px rgba(var(--grad-3-rgb), 0.35), 0 0 8px rgba(var(--grad-1-rgb), 0.25);
    --mobile-neon-glow-thumb: 0 0 6px rgba(255, 255, 255, 0.88), 0 0 7px rgba(var(--grad-1-rgb), 0.35), 0 0 7px rgba(var(--grad-3-rgb), 0.35), 0 0 8px rgba(var(--grad-1-rgb), 0.3);
    --mobile-slider-track-height: 6px;
    --mobile-slider-thumb-size: 13px;
    --mobile-slider-thumb-offset: calc((var(--mobile-slider-track-height) - var(--mobile-slider-thumb-size)) / 2);
  }

  body {
    min-height: 100svh;
    min-height: 100dvh;
  }

  #visualizer-container {
    min-height: 100svh;
    min-height: 100dvh;
  }

  #playlist {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
  }

  #audio-controls {
    background: rgba(16, 18, 24, 0.72);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
  }

  #eq-panel {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  #seek-bar,
  #volume-bar {
    -webkit-appearance: none;
    appearance: none;
    --range-progress: 0%;
    background: var(--accent-gradient);
    border-radius: 999px;
    box-shadow: none;
    height: var(--mobile-slider-track-height);
  }

  #seek-bar::-webkit-slider-runnable-track,
  #volume-bar::-webkit-slider-runnable-track {
    height: var(--mobile-slider-track-height);
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    border: 0;
  }

  #seek-bar::-webkit-slider-thumb,
  #volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--mobile-slider-thumb-size);
    height: var(--mobile-slider-thumb-size);
    margin-top: var(--mobile-slider-thumb-offset);
    border-radius: 50%;
    border: 0;
    background: #ffffff;
    box-shadow: none;
  }

  #seek-bar::-moz-range-track,
  #volume-bar::-moz-range-track {
    height: var(--mobile-slider-track-height);
    border-radius: 999px;
    background: var(--accent-gradient);
    box-shadow: none;
    border: 0;
  }

  #seek-bar::-moz-range-progress,
  #volume-bar::-moz-range-progress {
    height: var(--mobile-slider-track-height);
    border-radius: 999px;
    background: var(--accent-gradient);
    box-shadow: none;
  }

  #seek-bar::-moz-range-thumb,
  #volume-bar::-moz-range-thumb {
    width: var(--mobile-slider-thumb-size);
    height: var(--mobile-slider-thumb-size);
    border-radius: 50%;
    border: 0;
    background: #ffffff;
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  #audio-controls .icon-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 12px;
  }

  #audio-controls #play-pause-btn,
  #audio-controls #shuffle-btn,
  #audio-controls #prev-btn,
  #audio-controls #next-btn,
  #audio-controls #repeat-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  #audio-controls #play-pause-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 14px;
  }

  #audio-controls #play-pause-btn img,
  #audio-controls #shuffle-btn img,
  #audio-controls #prev-btn img,
  #audio-controls #next-btn img,
  #audio-controls #repeat-btn img {
    width: 30px;
    height: 30px;
  }

  #audio-controls #play-pause-btn img {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 640px) {
  html, body { min-height: 100svh; }
  body {
    background:
      radial-gradient(circle at 15% 20%, rgba(var(--grad-3-rgb), 0.12), transparent 55%),
      radial-gradient(circle at 85% 10%, rgba(var(--grad-1-rgb), 0.14), transparent 55%),
      #15161a;
  }
}

@media (max-width: 640px) {
  @supports (-webkit-touch-callout: none) {
    body{
      background:
        radial-gradient(circle at 15% 20%, rgba(var(--grad-3-rgb), 0.10), transparent 62%),
        radial-gradient(circle at 85% 10%, rgba(var(--grad-1-rgb), 0.10), transparent 62%),
        var(--bg) !important;
      }
  }
}

/* =========================
   MOBILE BUTTON POLISH
========================= */
@media (max-width: 768px) {
  :root {
    --mobile-btn-bg: linear-gradient(180deg, rgba(20, 24, 34, 0.96), rgba(12, 14, 20, 0.96));
    --mobile-btn-border: rgba(255, 255, 255, 0.28);
    --mobile-btn-shadow: 0 6px 16px rgba(0, 0, 0, 0.34), 0 0 10px rgba(var(--grad-1-rgb), 0.18);
    --mobile-btn-shadow-active: 0 0 10px rgba(var(--grad-1-rgb), 0.34), 0 0 12px rgba(var(--grad-3-rgb), 0.24);
  }

  .icon-btn,
  #upload-btn-mobile,
  .playlist-icon-btn,
  #controls-toggle-btn {
    border-radius: 13px;
    border: 1px solid var(--mobile-btn-border);
    background: var(--mobile-btn-bg);
    box-shadow: var(--mobile-btn-shadow);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.16s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  }

  #controls-toggle-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .icon-btn img,
  #upload-btn-mobile img,
  .playlist-icon-btn img,
  #controls-toggle-btn img {
    width: 21px;
    height: 21px;
  }

  #controls-toggle-btn img {
    width: 24px;
    height: 24px;
  }

  #audio-controls .controls {
    gap: 5px;
  }

  .icon-btn:active,
  #upload-btn-mobile:active,
  .playlist-icon-btn:active,
  #controls-toggle-btn:active {
    transform: translateY(1px) scale(0.98);
    border-color: rgba(255, 255, 255, 0.52);
    box-shadow: var(--mobile-btn-shadow-active);
  }

  .icon-btn:focus-visible,
  #upload-btn-mobile:focus-visible,
  .playlist-icon-btn:focus-visible,
  #controls-toggle-btn:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
  }
}

/* === SMALLER LAPTOPS / 1366x768 / niższe 14" === */
@media (min-width: 769px) and (max-width: 1440px),
       (min-width: 769px) and (max-height: 900px) {

  :root {
    --scene-surface:
      radial-gradient(circle at 50% 50%, rgba(var(--grad-1-rgb), 0.035), transparent 38%),
      radial-gradient(circle at 50% 50%, rgba(var(--grad-3-rgb), 0.022), transparent 44%),
      #05070c;
  }

  /* 1. Sidebar / playlist trochę ciaśniejszy */
  #playlist {
    flex: 0 0 clamp(188px, 16.6vw, 228px);
    width: clamp(188px, 16.6vw, 228px);
    min-width: 188px;
    padding: 12px 11px 11px;
  }

  .title-container {
    height: clamp(72px, calc(64px + 1.5vw), 84px);
    margin-bottom: clamp(8px, calc(4px + 0.5vw), 10px);
  }

  .animated-text {
    font-size: clamp(34px, calc(28px + 0.85vw), 40px);
    letter-spacing: clamp(0.2px, calc(0.05px + 0.05vw), 0.6px);
  }

  #playlist-title span {
    font-size: inherit;
  }

  /* 2. Add Files trochę mniejszy */
  #playlist-footer {
    gap: 6px;
    margin-top: 8px;
  }

  #fileupload-container {
    gap: 4px;
    min-height: 38px;
  }

  #playlist-footer #fileupload-container {
    min-height: 38px;
  }

  #custom-file-upload {
    min-height: 36px;
    height: 36px;
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 10px;
  }

  #song-list {
    padding: 6px 8px 8px 4px;
  }

  .song {
    gap: 6px;
    margin-bottom: 5px;
    padding: 8px 7px;
  }

  .song-index {
    font-size: 10px;
  }

  .song-title {
    font-size: 11px;
    line-height: 1.2;
  }

  /* 3. Ikonki przy Add Files / search / clear trochę mniejsze */
  #playlist-footer #playlist-actions,
  #playlist-footer #playlist-tools,
  #playlist-actions button,
  #playlist-tools > #playlist-tools-toggle {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .playlist-icon-btn img {
    width: 15px;
    height: 15px;
  }

  /* 4. Visualizer lekko mniejszy */
  #visualizer-container {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    padding: 6px 10px 10px;
  }

  canvas,
  #canvasA {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    transform: scale(clamp(0.95, calc(0.89 + 0.00008 * 100vw), 1.01));
    transform-origin: center center;
  }

  /* 5. Audio controls bardziej zwarte i trochę mniejsze */
  #audio-controls {
    width: clamp(480px, 46vw, 720px);
    padding: 8px;
    bottom: 8px;
    backdrop-filter: blur(10px) saturate(112%);
    -webkit-backdrop-filter: blur(10px) saturate(112%);
  }

  #audio-controls::before {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
      linear-gradient(180deg, rgba(var(--grad-1-rgb), 0.02), rgba(var(--grad-3-rgb), 0.014));
  }

  #audio-controls .controls {
    gap: clamp(0px, calc(0.5vw - 3px), 0px);
    padding-right: clamp(34px, 3.8vw, 48px);
    transform: translateX(-1px);
  }

  /* 6. Główne przyciski audio trochę mniejsze */
  .icon-btn {
    width: 52px;
    height: 52px;
    min-width: 44px;
    min-height: 44px;
  }

  .icon-btn img {
    width: 28px;
    height: 28px;
  }

  #shuffle-btn,
  #prev-btn,
  #next-btn,
  #repeat-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  #shuffle-btn img,
  #prev-btn img,
  #next-btn img,
  #repeat-btn img {
    width: 26px;
    height: 26px;
  }

  #play-pause-btn {
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
  }

  #play-pause-btn img {
    width: 30px;
    height: 30px;
  }

  /* 7. EQ button i toggle też delikatnie mniejsze */
  #audio-controls .controls #eq-btn {
    width: 34px;
    height: 34px;
    margin-right: clamp(0px, calc(0.35vw - 2px), 3px);
  }

  body:not(.controls-hidden) #controls-toggle-btn {
    transform: scale(0.9);
    transform-origin: top right;
  }

  body.controls-hidden #controls-toggle-btn {
    transform: translateX(-50%) scale(0.9);
    transform-origin: center center;
  }

  /* 8. Seek/volume i time display odrobinę ciaśniej */
  #time-display,
  #volume-percentage {
    font-size: 12px;
  }

  #seek-bar,
  #volume-bar {
    margin-top: 2px;
    margin-bottom: 2px;
  }
}
