:root {
  --bg-dark: #0f0f0f;
  --bg-light: #fafafa;
  --panel-dark: #181818;
  --panel-light: #f0f0f0;
  --muted-dark: #bdbdbd;
  --muted-light: #555;
  --accent: #1db954;
  --card-dark: #121212;
  --card-light: #fff;
  --glass-dark: rgba(255,255,255,0.03);
  --glass-light: rgba(0,0,0,0.03);
  --shadow-dark: rgba(0,0,0,0.6);
  --shadow-light: rgba(0,0,0,0.15);
  --player-dark: rgba(30,30,30,0.9);
  --player-light: rgba(255,255,255,0.95);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(160deg, #0a0a0a 0%, #1b1b1b 50%, #000 100%);
  color: #eee;
  transition: background 0.4s ease, color 0.3s ease;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #0f0f0f, #1b1b1b);
  color: #fff;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 60;
}

.brand h1 {
  font-size: 1.3rem;
  margin: 0;
  font-weight: 700;
}

.subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
}

.search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
}

.search input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 25px;
  border: none;
  outline: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.95rem;
}

.search button {
  background: linear-gradient(135deg, #00ff9d, #00b3ff);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

.search button:hover {
  transform: scale(1.05);
}

#themeToggle {
  background: linear-gradient(135deg, #1f1f1f, #2d2d2d);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

#themeToggle:hover {
  background: linear-gradient(135deg, #333, #555);
}

.main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  padding: 20px;
  align-items: start;
  max-width: 1200px;
  margin: 18px auto;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 14px;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), var(--glass-dark));
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
  cursor: default;
  border: 1px solid rgba(255,255,255,0.02);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px var(--shadow-dark);
}
.thumb { width: 72px; height: 72px; border-radius: 8px; flex: 0 0 72px; object-fit: cover; background: #222; }
.info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.title { font-weight: 600; }
.artist { font-size: 13px; color: var(--muted-dark); }
.duration { font-size: 12px; color: var(--muted-dark); }
.actions { display: flex; gap: 8px; margin-top: 6px; }
.btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  background: rgba(255,255,255,0.03);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}
.btn.play { background: transparent; border: 1px solid rgba(255,255,255,0.04); }
.btn.play:hover, .btn.dl:hover { transform: scale(1.05); }

.sidebar {
  background: transparent;
  padding: 12px;
  border-radius: 10px;
  position: sticky;
  top: 84px;
  height: fit-content;
}
.list {
  list-style: none;
  padding: 0;
  margin: 10px 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list li {
  font-size: 14px;
  color: var(--muted-dark);
  cursor: pointer;
  transition: color 0.2s;
}
.list li:hover { color: var(--accent); }
.empty {
  color: var(--muted-dark);
  padding: 40px;
  border-radius: 8px;
  text-align: center;
  background: rgba(255,255,255,0.01);
}

.player {
  position: fixed;
  left: 8px; right: 8px; bottom: 8px;
  height: 84px;
  background: var(--player-dark);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 8px 30px var(--shadow-dark);
  z-index: 80;
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}
.player img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: #222; }
.player-left { display: flex; gap: 10px; align-items: center; width: 220px; }
.meta .title { font-size: 14px; }
.meta .artist { font-size: 12px; color: var(--muted-dark); }
.player-center { flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.controls { display: flex; gap: 8px; align-items: center; }
.controls button { background: transparent; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.progress { display: flex; gap: 8px; align-items: center; width: 90%; }
.progress input[type="range"] { width: 100%; }
.player-right { display: flex; gap: 8px; align-items: center; }

.footer { margin-top: 120px; padding: 24px; text-align: center; color: var(--muted-dark); font-size: 13px; }

.player.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}
.player.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width:900px){
  .main { grid-template-columns: 1fr; padding-bottom: 120px; }
  .sidebar { display: none; }
  .search input { width: 100%; }
  .player { left: 8px; right: 8px; padding: 10px; }
}

body.light-mode {
  background: linear-gradient(160deg, #fafafa 0%, #e0e0e0 100%);
  color: #111;
}
body.light-mode .card {
  background: linear-gradient(180deg, rgba(0,0,0,0.03), var(--glass-light));
  color: #111;
}
body.light-mode .player {
  background: var(--player-light);
  box-shadow: 0 4px 10px var(--shadow-light);
}
body.light-mode .list li {
  color: var(--muted-light);
}
body.light-mode .topbar {
  background: linear-gradient(135deg, #fefefe, #eaeaea);
  color: #111;
}
body.light-mode .search input {
  background: rgba(0, 0, 0, 0.07);
  color: #111;
}