:root {
  --bg: #0d0d1a;
  --bg2: #1a1a2e;
  --bg3: #252540;
  --accent: #ff2d95;
  --accent2: #00f0ff;
  --text: #eee;
  --text2: #999;
  --green: #00e676;
  --red: #ff4444;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}
header {
  text-align: center;
  padding: 24px 16px 16px;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border-bottom: 2px solid var(--accent);
}
header h1 { font-size: 1.6rem; }
#song-counter { color: var(--accent2); font-size: 1rem; margin-top: 4px; }

main { max-width: 600px; margin: 0 auto; padding: 16px; }

/* Search */
.search-section { margin-bottom: 16px; position: relative; }
#search-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--bg3);
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg2);
  border-radius: 0 0 var(--radius) var(--radius);
  border: 2px solid var(--bg3);
  border-top: none;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 100;
}
.search-results.hidden { display: none; }
.search-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg3);
  transition: background 0.15s;
}
.search-card:last-child { border-bottom: none; }
.search-card:hover { background: var(--bg3); }
.search-card img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.search-card .info { flex: 1; min-width: 0; }
.search-card .info .title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-card .info .artist { color: var(--text2); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-card .actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.btn-preview { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px; }
.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add:disabled { background: var(--green); opacity: 0.7; cursor: default; }

/* Sort */
.sort-section { display: flex; gap: 8px; margin-bottom: 16px; }
.sort-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--bg3);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.sort-btn.active { border-color: var(--accent); background: var(--bg3); }

/* Song List */
.song-list { display: flex; flex-direction: column; gap: 8px; }
.song-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  transition: transform 0.15s;
}
.song-card:hover { transform: scale(1.01); }
.song-card img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.song-card .info { flex: 1; min-width: 0; }
.song-card .info .title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-card .info .artist { color: var(--text2); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-card .info .added-by { color: var(--text2); font-size: 0.7rem; margin-top: 2px; }
.vote-section { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.vote-count { font-weight: 700; font-size: 1rem; color: var(--accent); }
.btn-vote {
  background: none; border: 2px solid var(--accent);
  border-radius: 50%; width: 36px; height: 36px;
  font-size: 1.1rem; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-vote:hover { background: var(--accent); }
.btn-vote.voted { background: var(--accent); opacity: 0.5; cursor: default; }
.loading { text-align: center; color: var(--text2); padding: 20px; }

/* Toast */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #000; padding: 10px 20px;
  border-radius: var(--radius); font-weight: 600; z-index: 200;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.error { background: var(--red); color: #fff; }

/* Audio Player */
.audio-player {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg3);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  z-index: 150;
  border-top: 2px solid var(--accent2);
}
.audio-player.hidden { display: none; }
#stop-preview { background: none; border: none; font-size: 1.3rem; cursor: pointer; }
#now-playing { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Footer */
footer { text-align: center; padding: 24px 16px; color: var(--text2); font-size: 0.85rem; }
