:root {
  --bg: #0b0d10;
  --panel: #12161c;
  --panel-2: #171c24;
  --panel-3: #1d2430;
  --text: #f5f7fb;
  --muted: #98a3b3;
  --accent: #1db954;
  --accent-2: #1ed760;
  --border: rgba(255,255,255,0.08);
  --danger: #ef4444;
  --shadow: 0 18px 60px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: linear-gradient(180deg, #0b0d10 0%, #090b0e 100%); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
body { padding-bottom: 110px; }

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: calc(100vh - 110px);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.96);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: calc(100vh - 110px);
}

.sidebar h1 { margin: 0 0 8px; color: var(--accent); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }

.nav { display: grid; gap: 10px; }
.nav-btn, .song-actions button, .playlist-form button, .inline-btn, .chip-btn, #playlist-form button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  transition: 0.18s ease;
}

.nav-btn:hover, .song-actions button:hover, .inline-btn:hover, .chip-btn:hover, #playlist-form button:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.16);
}

.nav-btn.active, .primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #081109;
  border-color: transparent;
  font-weight: 700;
}

.create-playlist-card, .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

#create-playlist-card h3, .create-playlist-card h3 { margin-top: 0; }
#playlist-form { display: grid; gap: 10px; }
#playlist-form input, #playlist-form textarea, .search-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--text);
  padding: 12px;
}
#playlist-form textarea { min-height: 82px; resize: vertical; }

.content { padding: 28px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar h2 { margin: 0; }
.status { margin: 0; color: var(--muted); }

.view-content { display: grid; gap: 18px; }
.stats-grid, .song-grid, .artist-grid, .playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card, .artist-card, .playlist-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.song-list { display: grid; gap: 12px; }
.song-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
}
.song-card img, .artist-card img, .playlist-card img, .now-playing-cover {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  background: #0f1318;
}
.artist-card img, .playlist-card img { width: 100%; height: 180px; margin-bottom: 14px; }
.song-meta h3, .artist-card h3, .playlist-card h3, .detail-header h3 { margin: 0 0 6px; }
.song-meta p, .artist-card p, .playlist-card p { margin: 0; }
.song-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.song-actions .danger { border-color: rgba(239, 68, 68, 0.4); color: #ffb4b4; }
.song-actions .liked { border-color: rgba(29, 185, 84, 0.45); color: #b8ffd1; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.artist-card button, .playlist-card button, .detail-header button { width: 100%; }
.detail-panel {
  display: grid;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
}
.detail-header {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.detail-header img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 22px;
}
.detail-header .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  background: rgba(8, 10, 14, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.now-playing { display: flex; align-items: center; gap: 14px; min-width: 0; }
.now-playing h3 { margin: 0 0 6px; }
.now-playing p { margin: 0; }
.player-controls audio { width: 100%; }
.hidden { display: none; }
.empty-state {
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,0.01);
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .detail-header { grid-template-columns: 1fr; }
  .player-bar { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content { padding: 18px; }
  .song-card { grid-template-columns: 1fr; }
  .song-actions { justify-content: flex-start; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions, .search-wrap { width: 100%; align-items: stretch; }
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: min(100%, 360px);
}

.search-wrap {
  width: min(100%, 360px);
}

.song-actions select {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn.liked {
  background: rgba(29, 185, 84, 0.14);
  border-color: rgba(29, 185, 84, 0.45);
  color: #b8ffd1;
}

.icon-btn.liked svg {
  fill: currentColor;
}

.search-results-note {
  margin: 0 0 14px;
}

.auth-card,
.user-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
}

.auth-hint {
  margin: 0;
  font-size: 13px;
}

.user-panel h3 {
  margin: 0;
}

.auth-empty-panel {
  min-height: 240px;
  align-content: center;
}
