/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000;
  --bg2: #111;
  --bg3: #1c1c1e;
  --bg4: #2c2c2e;
  --sidebar-w: 220px;
  --player-h: 90px;
  --accent: #fc3c44;
  --accent2: #ff6b6b;
  --text: #fff;
  --text2: rgba(255,255,255,0.6);
  --text3: rgba(255,255,255,0.35);
  --border: rgba(255,255,255,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas:
    "sidebar main"
    "player player";
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ===== Sidebar ===== */
.sidebar {
  grid-area: sidebar;
  background: rgba(20,20,22,0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding-bottom: 12px;
}

.sidebar-header {
  padding: 20px 16px 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-section {
  padding: 8px 8px;
  flex: 1;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  transition: all 0.15s ease;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-item.active { background: rgba(252,60,68,0.15); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }

.sidebar-open-folder {
  padding: 8px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.open-folder-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.open-folder-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* ===== Main ===== */
.main {
  grid-area: main;
  overflow-y: auto;
  position: relative;
}

.view {
  display: none;
  min-height: 100%;
  padding: 0 0 24px;
}
.view.active { display: flex; flex-direction: column; }

.view-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.view-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 6px;
  padding: 7px;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.icon-btn.active { color: var(--accent); background: rgba(252,60,68,0.15); }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text3);
}

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 160px;
}
.search-input::placeholder { color: var(--text3); }

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text2);
  text-align: center;
}

.empty-icon { color: var(--text3); margin-bottom: 8px; }
.empty-state h2 { font-size: 22px; font-weight: 600; color: var(--text); }
.empty-state p { font-size: 15px; }

.primary-btn {
  margin-top: 8px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.primary-btn:hover { opacity: 0.85; }

/* ===== Album Grid ===== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  padding: 24px 28px;
}

.album-card {
  cursor: pointer;
  transition: transform 0.2s ease;
}
.album-card:hover { transform: scale(1.03); }
.album-card:hover .album-play-btn { opacity: 1; transform: translateY(0); }

.album-cover-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.album-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c2c2e, #1c1c1e);
  color: var(--text3);
}

.album-play-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.album-info { padding: 10px 4px 0; }
.album-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-artist { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-year { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ===== Songs List ===== */
.songs-list {
  padding: 8px 28px 24px;
}

.songs-header {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 80px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.song-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 80px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.song-row:hover { background: rgba(255,255,255,0.06); }
.song-row.playing { color: var(--accent); }
.song-row.playing .song-artist { color: rgba(252,60,68,0.7); }

.song-num { font-size: 13px; color: var(--text3); text-align: center; }
.song-row.playing .song-num { color: var(--accent); }
.song-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }

.song-mini-art {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg4);
}

.song-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-duration { font-size: 13px; color: var(--text2); text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Artists Grid ===== */
.artists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  padding: 24px 28px;
}

.artist-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 16px 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.artist-card:hover { background: rgba(255,255,255,0.05); }

.artist-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg4), var(--bg3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--text2);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.artist-avatar img { width: 100%; height: 100%; object-fit: cover; }
.artist-name { font-size: 13px; font-weight: 600; text-align: center; }
.artist-count { font-size: 12px; color: var(--text2); }

/* ===== YouTube ===== */
.yt-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--player-h) - 80px);
}

.yt-results {
  overflow-y: auto;
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: var(--text3);
  padding: 60px 20px;
  text-align: center;
}

.yt-result-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  align-items: flex-start;
}
.yt-result-item:hover { background: rgba(255,255,255,0.06); }
.yt-result-item.active { background: rgba(252,60,68,0.1); }

.yt-thumb {
  width: 120px;
  height: 68px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg4);
}

.yt-result-meta { flex: 1; min-width: 0; }
.yt-result-title { font-size: 13px; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-result-uploader { font-size: 12px; color: var(--text2); margin-top: 4px; }
.yt-result-duration { font-size: 11px; color: var(--text3); margin-top: 2px; }

.yt-searching {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text2);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.yt-player-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  overflow: hidden;
}

.yt-player-wrap {
  background: #000;
  aspect-ratio: 16/9;
  position: relative;
}
.yt-player-wrap iframe,
.yt-player-wrap > div { width: 100% !important; height: 100% !important; }

.yt-player-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.yt-now-playing {
  display: flex;
  gap: 12px;
  align-items: center;
}

#ytThumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg4);
}

.yt-meta { flex: 1; min-width: 0; }
.yt-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-artist { font-size: 12px; color: var(--text2); margin-top: 3px; }

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.download-btn:hover { opacity: 0.85; }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.yt-download-status {
  padding: 0 16px 16px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}
.yt-download-status.success { color: #30d158; }
.yt-download-status.error { color: var(--accent); }

.yt-search-wrap { flex: 1; }
.yt-search-wrap .search-input { width: 100%; }

/* ===== Player Bar ===== */
.player-bar {
  grid-area: player;
  background: rgba(18,18,20,0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
}

.player-artwork {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#artworkCanvas {
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.player-track-info { min-width: 0; flex: 1; }
.player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.heart-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.heart-btn:hover { color: var(--text2); }
.heart-btn.loved { color: var(--accent); fill: var(--accent); }
.heart-btn.loved svg { fill: var(--accent); }

.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ctrl-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.ctrl-btn.active { color: var(--accent); }

.play-pause-btn {
  background: rgba(255,255,255,0.1) !important;
  padding: 6px !important;
}
.play-pause-btn:hover { background: rgba(255,255,255,0.18) !important; }

.player-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.time {
  font-size: 11px;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.progress-bar:hover .progress-thumb { opacity: 1; }

.progress-fill {
  height: 100%;
  background: var(--text2);
  border-radius: 2px;
  width: 0%;
  transition: background 0.1s;
  pointer-events: none;
}
.progress-bar:hover .progress-fill { background: var(--accent); }

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  left: 0%;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.player-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text3);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.album-modal {
  background: var(--bg3);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.18); }

.modal-album-header {
  display: flex;
  gap: 20px;
  padding: 28px 28px 20px;
  align-items: flex-end;
}

.modal-album-art {
  width: 140px;
  height: 140px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  background: var(--bg4);
}

.modal-album-art-placeholder {
  width: 140px;
  height: 140px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg4), var(--bg3));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  flex-shrink: 0;
}

.modal-album-meta { min-width: 0; }
.modal-album-meta .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text3); font-weight: 600; }
.modal-album-meta h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin: 6px 0 4px; }
.modal-album-meta .artist { font-size: 16px; color: var(--accent); font-weight: 500; }
.modal-album-meta .info { font-size: 13px; color: var(--text2); margin-top: 4px; }
.modal-play-all {
  margin-top: 14px;
  padding: 9px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.modal-play-all:hover { opacity: 0.85; }

.modal-tracks { padding: 8px 28px 28px; }

.modal-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.modal-track:hover { background: rgba(255,255,255,0.06); }
.modal-track.playing { color: var(--accent); }

.modal-track-num { width: 24px; text-align: center; font-size: 13px; color: var(--text3); flex-shrink: 0; }
.modal-track.playing .modal-track-num { color: var(--accent); }
.modal-track-info { flex: 1; min-width: 0; }
.modal-track-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-track-dur { font-size: 13px; color: var(--text2); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(50,50,54,0.96);
  backdrop-filter: blur(20px);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  border: 1px solid var(--border);
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Now Playing Indicator ===== */
@keyframes bar-bounce {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.now-playing-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  color: var(--accent);
}
.now-playing-bars span {
  display: block;
  width: 3px;
  height: 100%;
  background: currentColor;
  border-radius: 1px;
  transform-origin: bottom;
  animation: bar-bounce 0.8s ease-in-out infinite;
}
.now-playing-bars span:nth-child(2) { animation-delay: 0.2s; }
.now-playing-bars span:nth-child(3) { animation-delay: 0.4s; }

/* ===== Mobile-only elements (hidden on desktop) ===== */
.mobile-tabs { display: none; }
.mobile-player-btns { display: none; }
.mobile-progress-fill { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --player-h: 64px;
    --tabs-h: 56px;
  }

  /* Layout: single column, main scrolls, player + tabs fixed at bottom */
  body {
    display: block;
    overflow: hidden;
    height: 100%;
    position: relative;
  }

  .sidebar { display: none; }

  .main {
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Player bar: compact single row ---- */
  .player-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    height: var(--player-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    grid-template-columns: unset;
    z-index: 40;
  }

  /* Hide desktop-only player sections on mobile */
  .player-controls { display: none; }
  .player-right { display: none; }

  /* Show mobile-only elements */
  .mobile-player-btns { display: flex; }
  .mobile-progress-fill { display: block; }

  /* Mobile player: artwork + info take all space, then just prev/play/next */
  .player-artwork {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  #artworkCanvas { width: 40px; height: 40px; }

  .player-title { font-size: 13px; }
  .player-artist { font-size: 12px; }
  .heart-btn { display: none; }

  /* Inline mobile playback controls */
  .mobile-player-btns {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
  }

  /* Progress bar: thin line at very top of player bar */
  .player-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: rgba(255,255,255,0.1);
  }
  .mobile-progress-fill {
    position: absolute;
    top: 0; left: 0;
    height: 2px;
    background: var(--accent);
    pointer-events: none;
    transition: width 0.5s linear;
    z-index: 1;
  }

  /* ---- Bottom Tab Bar ---- */
  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(18,18,20,0.97);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top: 1px solid var(--border);
    z-index: 50;
  }

  .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text3);
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    padding: 6px 4px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .tab-btn.active { color: var(--accent); }
  .tab-btn svg { flex-shrink: 0; }

  /* ---- View header ---- */
  .view-header {
    padding: 16px 16px 12px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .view-header h1 { font-size: 22px; }
  .view-controls { gap: 6px; width: 100%; }
  .search-wrap { flex: 1; }
  .search-input { width: 100%; }
  .icon-btn { padding: 6px; }

  /* ---- Library / Album grid ---- */
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    padding: 16px;
  }

  /* ---- Songs list ---- */
  .songs-list { padding: 4px 12px; }
  .songs-header { grid-template-columns: 32px 1fr 56px; }
  .song-row { grid-template-columns: 32px 1fr 56px; padding: 8px 8px; }
  .song-artist { display: none; }
  .song-mini-art { width: 32px; height: 32px; }

  /* ---- Artists ---- */
  .artists-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding: 16px;
  }
  .artist-avatar { width: 80px; height: 80px; font-size: 26px; }

  /* ---- YouTube: stack vertically, toggle panels ---- */
  .yt-layout {
    flex-direction: column;
    height: auto;
    display: flex;
  }
  .yt-results {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 55vw;
    overflow-y: auto;
    padding: 8px 12px;
  }
  .yt-player-panel {
    flex: 1;
  }
  .yt-player-wrap {
    aspect-ratio: 16/9;
  }
  .yt-player-info { padding: 12px; }

  /* YouTube search controls stack */
  #view-youtube .view-controls {
    flex-direction: column;
  }
  .yt-search-wrap { width: 100%; }

  /* ---- Modal ---- */
  .album-modal {
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    max-width: 100%;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-album-header { padding: 20px 20px 16px; gap: 14px; }
  .modal-album-art, .modal-album-art-placeholder { width: 100px; height: 100px; }
  .modal-album-meta h2 { font-size: 18px; }
  .modal-tracks { padding: 4px 20px 24px; }

  /* ---- Toast ---- */
  .toast {
    bottom: calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
  }

  /* ---- Empty state ---- */
  .empty-state { padding: 40px 20px; }
}
