/* ============================================================
   MyMusic — Main Stylesheet
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Dark theme (default) — YouTube Music inspired */
  --bg:          #0f0f0f;
  --surface:     #1a1a1a;
  --surface2:    #272727;
  --surface3:    #333333;
  --border:      #333333;
  --accent:      #a855f7;
  --accent-dim:  #7c3aed;
  --accent-glow: rgba(168,85,247,.2);
  --text:        #ffffff;
  --text-2:      #aaaaaa;
  --text-3:      #717171;
  --danger:      #ef4444;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --player-h:    72px;
  --sidebar-w:   240px;
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-full: 9999px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --transition:  150ms ease;
}

[data-theme="light"] {
  --bg:          #ffffff;
  --surface:     #f2f2f2;
  --surface2:    #e5e5e5;
  --surface3:    #d4d4d4;
  --border:      #e0e0e0;
  --accent:      #7c3aed;
  --accent-dim:  #6d28d9;
  --accent-glow: rgba(124,58,237,.12);
  --text:        #0f0f0f;
  --text-2:      #606060;
  --text-3:      #909090;
  --shadow:      0 4px 24px rgba(0,0,0,.08);
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Roboto', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

html, body, #app {
  max-width: 100vw;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── App Shell ─────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  user-select: none;
  -webkit-user-select: none;
}

/* Re-enable selection inside form controls */
#app input,
#app textarea,
#app [contenteditable],
#app .fs-lyrics-content {
  user-select: text;
  -webkit-user-select: text;
}

/* Auth screen */
#view-auth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

/* Main screen (sidebar + content) */
#view-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.sidebar-logo span {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  user-select: none;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--accent); }

.nav-item .nav-icon { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-info {
  display: none;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.user-email {
  font-size: .78rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  gap: 4px;
  padding: 4px 10px;
}

.btn-icon-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
  font-size: 1rem;
}

.btn-icon-sm:hover { background: var(--surface2); color: var(--text); }

/* ── Main Column (search + content) ───────────────────────── */
#main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Global Search Bar ────────────────────────────────────── */
/* Mobile top bar (logo + search icon) — hidden on desktop */
#mobile-top-bar {
  display: none;
}
@media (max-width: 760px) {
  #mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg);
    flex-shrink: 0;
    z-index: 51;
  }
  .mtb-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
  }
  .mtb-logo img {
    border-radius: var(--radius-sm);
  }
  .mtb-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-2);
    transition: background var(--transition);
  }
  .mtb-search-btn:hover { background: var(--surface2); }

  /* Hide header account btn on mobile */
  .header-account-btn { display:none !important; }
  #header-bar { display:block; }

  /* Hide search bar on mobile by default, show when .search-open */
  #search-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--bg);
    padding: 8px 16px;
    flex-direction: column;
  }
  #search-bar.search-open {
    display: flex;
  }
  #search-bar.search-open .search-back-btn {
    display: flex !important;
  }
  #search-bar.search-open .search-input-wrap {
    flex-direction: row-reverse;
  }
  .search-back-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: var(--text-2);
  }
  #search-bar.search-open .search-dropdown {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
}

#search-bar {
  position: relative;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 50;
}
.search-back-btn { display: none; }

/* Header Bar — search + account avatar */
#header-bar { display:flex; align-items:stretch; background:var(--bg); border-bottom:1px solid var(--border); flex-shrink:0; z-index:50; }
#header-bar #search-bar { border-bottom:none; flex:1; min-width:0; padding-right:8px; }
.header-account-btn { display:flex; align-items:center; justify-content:center; padding:0 20px 0 4px; background:none; border:none; cursor:pointer; flex-shrink:0; }
.header-avatar-circle { width:34px; height:34px; border-radius:50%; background:var(--surface2); display:flex; align-items:center; justify-content:center; color:var(--text-2); transition:background .15s,color .15s; overflow:hidden; }
.header-avatar-circle img { width:100%; height:100%; object-fit:cover; display:block; }
.header-avatar-circle span { font-size:14px; font-weight:600; }
.header-account-btn:hover .header-avatar-circle { background:var(--accent); color:#fff; }

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 16px;
  gap: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-3);
}

.search-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}
.search-field::placeholder { color: var(--text-3); }

.search-clear-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
}
.search-clear-btn:hover { background: var(--surface2); color: var(--text); }

/* Search filters */
.search-filters {
  display: flex;
  gap: 6px;
  padding-top: 8px;
}

.search-filter-btn {
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.search-filter-btn:hover { background: var(--surface3); color: var(--text); }
.search-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 100;
}

.search-section-label {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background var(--transition);
  outline: none;
}
.search-result-item:hover,
.search-result-item:focus {
  background: var(--surface2);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-dur {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}

.search-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ── Playlist inline search ───────────────────────────────── */
.playlist-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 14px;
  margin-bottom: 16px;
}

.playlist-search-wrap .search-icon {
  flex-shrink: 0;
  color: var(--text-3);
}

.playlist-search-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}
.playlist-search-field::placeholder { color: var(--text-3); }

/* ── Main Content ──────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); }

.btn-icon-round {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
  font-size: .95rem;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon.danger:hover { background: rgba(239,68,68,.15); color: var(--danger); }

/* ── Input ─────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input::placeholder { color: var(--text-3); }

.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.input-hint  { font-size: 12px; color: var(--text-3); }

/* ── Auth ──────────────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-logo img { width: 44px; height: 44px; border-radius: 10px; }

.auth-logo-text { font-size: 1.4rem; font-weight: 700; }

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  gap: 2px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  cursor: pointer;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .85rem;
  display: none;
}
.auth-error.show { display: block; }

.auth-submit {
  width: 100%;
  padding: 11px;
  justify-content: center;
  font-size: .95rem;
  margin-top: 4px;
}

/* ── Songs List ────────────────────────────────────────────── */
.song-list { display: flex; flex-direction: column; gap: 2px; }

.song-item {
  display: grid;
  grid-template-columns: 36px 48px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: default;
  user-select: none;
}
.song-item:hover { background: var(--surface2); }
.song-item.playing { background: var(--surface2); }
.song-item.playing .song-title { color: var(--accent); }

.song-num {
  text-align: center;
  color: var(--text-3);
  font-size: .85rem;
  width: 40px;
}
.song-item.playing .song-num { display: none; }
.playing-bars {
  display: none;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 40px;
}
.song-item.playing .playing-bars { display: flex; }
.playing-bar {
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
  animation: eq 0.8s ease-in-out infinite alternate;
}
.playing-bar:nth-child(2) { animation-delay: .2s; }
.playing-bar:nth-child(3) { animation-delay: .4s; }
@keyframes eq {
  from { height: 3px; }
  to   { height: 14px; }
}

.song-info { min-width: 0; }
.song-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.song-meta {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-weight: 400;
}

.song-duration {
  font-size: .82rem;
  color: var(--text-3);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.song-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.song-item:hover .song-actions { opacity: 1; }

.song-source-badge {
  font-size: .65rem;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ── Song Art Placeholder ──────────────────────────────────── */
.song-art {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

/* ── Playlists Grid ────────────────────────────────────────── */
.playlists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
#home-playlists-grid {
  grid-template-rows: repeat(3, auto);
  grid-auto-rows: 0;
  overflow: hidden;
  row-gap: 20px;
}

.playlist-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.playlist-card:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}

.playlist-card-icon {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 12px;
}
.playlist-card-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface2);
}
.playlist-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.public-badge {
  font-size: 0.75em;
  vertical-align: middle;
  opacity: 0.7;
}
.song-public-badge {
  font-size: 0.65em;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.6;
}

/* Three-dot menu on playlist cards */
.playlist-card-more {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  z-index: 2;
}
.playlist-card:hover .playlist-card-more {
  opacity: 1;
}
.playlist-card-more:hover {
  background: rgba(0,0,0,0.6);
  color: #fff;
}

/* Hide old playlist-card-actions */
.playlist-card-actions { display: none; }

/* Hide old offline bar at bottom of playlist — moved to page-actions button */
.offline-bar { display: none !important; }

.playlist-card-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.playlist-card-count {
  font-size: 12px;
  color: var(--text-2);
}

.playlist-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.playlist-card:hover .playlist-card-actions { opacity: 1; }

.playlist-card-actions .btn-icon {
  width: 28px;
  height: 28px;
  background: var(--surface2);
}

.playlist-create-card {
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  min-height: 130px;
}
.playlist-create-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}
.playlist-create-card span { font-size: 2rem; }
.playlist-create-card p { font-size: .85rem; font-weight: 500; }

/* ── Playlist Detail ───────────────────────────────────────── */
.playlist-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.playlist-detail-cover {
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.pl-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
  z-index: 1;
}
.pl-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3.5rem;
  position: relative;
  z-index: 0;
}
.pl-cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
  border-radius: inherit;
  z-index: 2;
}
.playlist-detail-cover:hover .pl-cover-overlay {
  opacity: 1;
}

.playlist-detail-info { flex: 1; min-width: 0; }

.playlist-detail-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.playlist-detail-name:hover .edit-icon { opacity: 1; }
.edit-icon { opacity: 0; transition: opacity var(--transition); color: var(--text-3); font-size: .85rem; }

.playlist-detail-meta {
  font-size: 13px;
  color: var(--text-2);
  margin: 6px 0 16px;
}

.playlist-song-item {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: background var(--transition), opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  cursor: default;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.playlist-song-item:hover { background: var(--surface2); }

/* Drag handle — hidden by default, shown in reorder mode */
.drag-handle {
  display: none;
  color: var(--text-3);
  cursor: grab;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  opacity: 0;
  transition: opacity var(--transition);
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; opacity: 1; }

/* Desktop: show drag handle on row hover (before reorder mode) */
@media (hover: hover) and (pointer: fine) {
  .song-list .playlist-song-item {
    grid-template-columns: 28px 48px 1fr auto auto;
  }
  .playlist-song-item .drag-handle {
    display: flex;
    opacity: 0;
    min-width: 28px;
  }
  .playlist-song-item:hover .drag-handle {
    opacity: 0.5;
  }
  .playlist-song-item:hover .drag-handle:hover {
    opacity: 1;
  }
}

/* Reorder mode: show handles, expand grid */
.reorder-mode .playlist-song-item {
  grid-template-columns: 44px 48px 1fr auto auto;
}
.reorder-mode .drag-handle {
  display: flex;
  opacity: 0.6;
}
.reorder-mode .playlist-song-item:hover .drag-handle { opacity: 1; }

/* Long-press visual feedback */
.playlist-song-item.long-press-active {
  background: var(--surface2);
}

/* Dragging states */
.playlist-song-item.dragging {
  opacity: 1;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: scale(1.02);
  background: var(--surface);
  pointer-events: none;
}
.song-list.is-dragging .playlist-song-item:not(.dragging) {
  opacity: 0.6;
  transition: opacity 150ms ease;
}
.playlist-song-item.drag-settling {
  transition: transform 150ms ease-out, box-shadow 150ms ease-out, opacity 150ms ease-out;
  transform: scale(1);
  box-shadow: none;
}

/* Drop indicator line */
.playlist-song-item.drag-over-above::before,
.playlist-song-item.drag-over-below::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  z-index: 10;
  pointer-events: none;
}
.playlist-song-item.drag-over-above::before { top: -1px; }
.playlist-song-item.drag-over-below::after  { bottom: -1px; }

/* Reorder done button */
.reorder-done-btn {
  display: none;
}
.reorder-mode ~ .reorder-done-btn,
.reorder-done-btn.visible {
  display: inline-flex;
}

.playlist-song-item .song-actions {
  opacity: 0;
  transition: opacity var(--transition);
}
.playlist-song-item:hover .song-actions { opacity: 1; }

/* ── Offline Manager ──────────────────────────────────────── */

/* Bar in playlist detail */
.offline-bar {
  margin: 0 0 12px;
  border-radius: var(--radius);
  overflow: hidden;
  animation: offlineFadeIn .25s ease;
}
@keyframes offlineFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.offline-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.offline-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
}
.offline-bar-label svg { flex-shrink: 0; }

.offline-bar-ok  { color: var(--success); }
.offline-bar-err { color: var(--danger); }
.offline-bar-warn { color: var(--warning); }

.offline-bar-pct {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.offline-bar-size {
  font-size: 11px;
  color: var(--text-3);
  padding: 1px 6px;
  background: var(--surface2);
  border-radius: var(--radius-full);
}

.offline-bar-wifi-off {
  color: var(--accent);
  display: flex;
  align-items: center;
}

.offline-bar-nospace-actions {
  display: flex;
  gap: 6px;
}

/* Downloading state — progress bar */
.offline-bar-downloading {
  flex-direction: column;
  align-items: stretch;
}
.offline-bar-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.offline-progress-track {
  width: 100%;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.offline-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .3s ease;
}

/* State-specific animations */
.offline-state-downloading .offline-bar-row {
  border-color: var(--accent-dim);
}
.offline-state-offline .offline-bar-row {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 5%, var(--surface));
}
.offline-state-error .offline-bar-row {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}
.offline-state-no-space .offline-bar-row {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 5%, var(--surface));
}

/* Small buttons */
.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  gap: 4px;
}

/* Playlist card offline badge */
.offline-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent);
  background: var(--surface);
  border-radius: var(--radius-full);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.offline-badge-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: offlineSpin .8s linear infinite;
}
@keyframes offlineSpin {
  to { transform: rotate(360deg); }
}

/* ── Storage Section (Account page) ──────────────────────── */
.offline-storage-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
}

.offline-storage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  margin-bottom: 16px;
}
.offline-storage-title {
  font-size: 15px;
  font-weight: 600;
}

.offline-storage-bar-container {
  margin-bottom: 16px;
}
.offline-storage-bar {
  width: 100%;
  height: 8px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}
.offline-storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  border-radius: 4px;
  transition: width .5s ease;
}
.offline-storage-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
}

.offline-storage-counts {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}
.offline-storage-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.offline-storage-stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.offline-storage-stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.offline-clear-all-btn {
  width: 100%;
  justify-content: center;
}

/* ── Player Bar ────────────────────────────────────────────── */
#player-bar {
  height: var(--player-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}

/* Left: current track */
.player-now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 0 var(--sidebar-w);
}

.player-track-icon,
.player-track-thumb {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
  color: rgba(255,255,255,.7);
}

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

/* Center: controls + progress */
.player-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

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

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--text-2);
  transition: all var(--transition);
  flex-shrink: 0;
}
.ctrl-btn:hover { color: var(--text); }
.ctrl-btn.active { color: var(--accent); }

.ctrl-btn-main {
  width: 36px;
  height: 36px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}
.ctrl-btn-main:hover { transform: scale(1.06); background: var(--accent); color: #fff; }

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

.player-time {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  flex: 1;
  height: 3px;
  background: var(--surface3);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: height var(--transition);
}
.progress-track:hover { height: 5px; }

.progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: var(--radius-full);
  pointer-events: none;
  transition: background var(--transition);
  min-width: 0;
}
.progress-track:hover .progress-fill { background: var(--accent); }

/* Right: volume + speed */
.player-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 200px;
  justify-content: flex-end;
}

.vol-btn {
  color: var(--text-3);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vol-btn:hover { color: var(--text); }

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  background: var(--surface3);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
}
.volume-slider:hover::-webkit-slider-thumb { background: var(--accent); }

.speed-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  outline: none;
}
.speed-select:hover { border-color: var(--accent); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  transform: translateY(16px) scale(.97);
  transition: transform .2s ease;
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 1.1rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* ── File Queue (multi-upload) ─────────────────────────────── */
.file-queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.file-queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius);
  font-size: .85rem;
}

.file-queue-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-queue-size {
  font-size: .75rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.file-queue-remove {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.file-queue-remove:hover { background: rgba(239,68,68,.15); color: var(--danger); }

.file-queue-status {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-queue-status.done    { color: var(--success); }
.file-queue-status.error   { color: var(--danger); }

/* Add Songs quick actions */
.add-songs-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.add-songs-quick-actions .btn { flex: 1; justify-content: center; }

/* Upload drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
.drop-zone-icon { font-size: 2rem; margin-bottom: 8px; }
.drop-zone-text { font-size: .85rem; }
.drop-zone-hint { font-size: .75rem; margin-top: 4px; color: var(--text-3); }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease;
  max-width: 360px;
  color: var(--text);
  line-height: 1.4;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error   { background: var(--danger);  color: #fff; }
.toast.info    { background: var(--accent);  color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state-text  { font-size: .85rem; margin-bottom: 20px; }

/* ── Loading Spinner ───────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-3);
  font-size: .9rem;
}

/* ── Add-to-Playlist List ──────────────────────────────────── */
.playlist-pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.playlist-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  font-size: .875rem;
}
.playlist-pick-item:hover { background: var(--surface2); }
.playlist-pick-item .count { font-size: .75rem; color: var(--text-3); }

/* ── Back Button ───────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: .85rem;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius);
  transition: all var(--transition);
  margin-bottom: 16px;
}
.back-btn:hover { background: var(--surface2); color: var(--text); }

/* ── Section Heading ───────────────────────────────────────── */
.section-heading {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
  margin-top: 4px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── Context Menu ──────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  min-width: 190px;
  max-width: calc(100vw - 16px);
  padding: 4px 0;
  animation: ctx-in .12s ease;
}

@keyframes ctx-in {
  from { opacity: 0; transform: scale(.96) translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  font-size: .875rem;
  color: var(--text);
  transition: background var(--transition);
  text-align: left;
  white-space: nowrap;
}
.context-menu-item:hover { background: var(--surface2); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: rgba(239,68,68,.1); }

.ctx-icon {
  display: flex;
  align-items: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.context-menu-item.danger .ctx-icon { color: var(--danger); }

.context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Track Info Modal ──────────────────────────────────────── */
.track-info-art {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.track-info-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-info-row {
  display: flex;
  gap: 12px;
  font-size: .875rem;
  line-height: 1.4;
}

.track-info-key {
  color: var(--text-3);
  min-width: 72px;
  flex-shrink: 0;
  padding-top: 1px;
}

.track-info-val {
  color: var(--text);
  word-break: break-word;
  min-width: 0;
}

/* ── Inline rename ─────────────────────────────────────────── */
.rename-input {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.5px;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  padding: 2px 4px;
  outline: none;
  width: auto;
  color: var(--text);
}

/* ── Mobile progress bar (thin line on top of compact player) ── */
.player-mobile-progress { display: none; }

/* ── Fullscreen Player ─────────────────────────────────────── */
/* ── Fullscreen Player — Desktop hidden ─────────────────── */
/* ── Fullscreen Player (YouTube Music style — all screens) ── */
.fs-player {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: #080808;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
  padding-top: env(safe-area-inset-top, 12px);
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transition: transform .35s cubic-bezier(.32,.72,0,1), filter .35s ease;
  transform: translateY(100%);
  overflow: hidden;
  color: #fff;
  will-change: transform;
}
.fs-player.open {
  display: flex;
  transform: translateY(0);
}
.fs-player.opening {
  display: flex;
  filter: blur(8px);
}
.fs-player.open.opening {
  filter: blur(0);
}

/* Offline banner */
.fs-offline-banner {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  background: var(--surface2);
  color: var(--text-2);
  font-size: 12px;
  z-index: 10;
  animation: fsBannerSlide .3s ease;
}
@keyframes fsBannerSlide {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* Header bar */
.fs-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-shrink: 0;
}
.fs-header-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}
.fs-header-btn:hover { background: rgba(255,255,255,.1); }

.fs-header-tabs {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-full);
  padding: 2px;
}
.fs-tab {
  width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  transition: all var(--transition);
}
.fs-tab.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.fs-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Album art */
.fs-player-art {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 50vh;
  padding: 8px 0;
  position: relative;
  transition: transform .2s ease;
}
.fs-player-art.swiping-left  { transform: translateX(-40px); opacity: .7; }
.fs-player-art.swiping-right { transform: translateX(40px); opacity: .7; }

.fs-player-art-inner {
  width: min(85vw, 400px);
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 4px 16px rgba(0,0,0,.3);
  overflow: hidden;
  color: rgba(255,255,255,.7);
  position: relative;
  cursor: pointer;
  transition: transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.fs-player-art-inner:active { transform: scale(.97); }

/* Track info */
.fs-player-info {
  width: 100%;
  text-align: center;
  padding: 12px 0 4px;
  flex-shrink: 0;
}
.fs-player-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.fs-player-title {
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  letter-spacing: -.01em;
}
.fs-offline-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.fs-player-artist {
  font-size: 14px;
  color: rgba(255,255,255,.55);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Action bar */
.fs-action-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 8px 0 12px;
  flex-shrink: 0;
}
.fs-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 12px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-full);
  transition: color var(--transition);
}
.fs-action-btn:hover,
.fs-action-btn.active { color: #fff; }
.fs-action-btn.liked { color: var(--accent); }
.fs-save-btn {
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-full);
}
.fs-save-btn:hover { background: rgba(255,255,255,.14); }

/* Seek slider */
.fs-player-progress {
  width: 100%;
  flex-shrink: 0;
  padding: 0 0 2px;
}
.fs-seek-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin-bottom: 6px;
  transition: height .15s ease;
}
.fs-seek-slider:hover { height: 6px; }
.fs-seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.fs-seek-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
.fs-player-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,.4);
  font-variant-numeric: tabular-nums;
}

/* Transport controls */
.fs-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 4px 0 8px;
  flex-shrink: 0;
}
.fs-player-controls .ctrl-btn {
  width: 48px;
  height: 48px;
  color: rgba(255,255,255,.8);
  transition: color var(--transition), transform .1s ease;
}
.fs-player-controls .ctrl-btn:hover { color: #fff; }
.fs-player-controls .ctrl-btn:active { transform: scale(.9); }
.fs-player-controls .ctrl-btn.active { color: var(--accent); }
.fs-player-controls .fs-play-btn {
  width: 64px;
  height: 64px;
  background: #fff;
  color: #080808;
  border-radius: 50%;
}
.fs-player-controls .fs-play-btn:hover { background: rgba(255,255,255,.9); }

/* Context label */
.fs-context-label {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  text-align: center;
  padding: 0 0 8px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* Settings panel */
.fs-settings-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: #181818;
  border-radius: 16px 16px 0 0;
  padding: 20px 24px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fsSettingsSlide .25s ease;
}
@keyframes fsSettingsSlide {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.fs-setting-group {}
.fs-setting-label {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
  display: block;
}
.fs-speed-buttons {
  display: flex;
  gap: 8px;
}
.fs-speed-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.08);
  border: 1px solid transparent;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.fs-speed-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.fs-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fs-vol-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: rgba(255,255,255,.5);
}
.fs-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
.fs-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

/* Lyrics panel (overlay) */
.fs-lyrics-panel {
  position: absolute;
  inset: 0;
  background: #080808;
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
}
.fs-lyrics-panel.open {
  transform: translateY(0);
}
.fs-lyrics-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.fs-lyrics-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.fs-lyrics-panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: rgba(255,255,255,.5);
  cursor: pointer;
  background: none;
  border: none;
}
.fs-lyrics-panel-close:hover { color: #fff; }
.fs-lyrics-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(255,255,255,.6);
  white-space: pre-wrap;
  word-break: break-word;
}
.fs-lyrics-content.loading,
.fs-lyrics-content.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.3);
  font-size: 13px;
}

/* More menu */
.fs-more-btn { color: rgba(255,255,255,.6); }

/* Desktop: larger art, centered layout with max-width */
@media (min-width: 761px) {
  .fs-player {
    padding: 0 48px;
    justify-content: center;
  }
  .fs-player-art-inner {
    width: min(50vh, 420px);
  }
  .fs-player-title {
    font-size: 24px;
  }
  .fs-player-artist {
    font-size: 15px;
  }
  .fs-player-progress {
    max-width: 500px;
    margin: 0 auto;
  }
  .fs-player-controls {
    gap: 24px;
  }
  .fs-player-controls .ctrl-btn {
    width: 52px;
    height: 52px;
  }
  .fs-player-controls .fs-play-btn {
    width: 68px;
    height: 68px;
  }
  .fs-action-bar {
    gap: 32px;
  }
  .fs-player-info {
    max-width: 500px;
    margin: 0 auto;
  }
  .fs-settings-panel {
    max-width: 400px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
  /* player bar cursor hint */
  #player-bar .player-now-playing,
  #player-bar .player-track-info {
    cursor: pointer;
  }
}

/* Mobile art size */
@media (max-width: 760px) {
  .fs-player-art-inner {
    width: min(85vw, 360px);
  }
}

/* ── Home Page ─────────────────────────────────────────────── */
.home-page {
  max-width: 1400px;
}

/* Hero row: greeting + CTA buttons */
.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.home-greeting-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}

.home-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Section heading */
.home-section {
  margin-bottom: 36px;
}

.home-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.home-section-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.home-see-all {
  font-size: 12px;
  color: var(--accent);
  padding: 4px 8px;
  white-space: nowrap;
}
.home-see-all:hover { color: var(--text); background: var(--surface2); }

/* Empty / error state inside home */
.home-empty {
  font-size: 13px;
  color: var(--text-3);
  padding: 12px 0;
}

/* ── Track card scroll row ─────────────────────────────────── */
.track-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-rows: 0;
  overflow: hidden;
  gap: 16px;
  row-gap: 20px;
}

.track-card {
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform var(--transition);
  user-select: none;
  min-width: 0;
}
.track-card:hover { transform: translateY(-3px); }

.track-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  background: var(--surface2);
}

.track-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Play overlay button */
.track-card-play {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 2;
}
.track-card:hover .track-card-play {
  opacity: 1;
  transform: translateY(0);
}
.track-card-play:hover { background: var(--accent-dim); transform: scale(1.08) translateY(0) !important; }

.track-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-card-artist {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Skeleton loader ────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--surface3) 50%,
    var(--surface2) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-card .track-card-cover,
.skeleton-card .track-card-img { display: none; }

.skeleton-line {
  height: 12px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}
.skeleton-line.short { width: 50% !important; }

/* Playlist card on home page (no edit/delete actions) */
.home-pl-card .playlist-card-actions { display: none !important; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 760px) {
  :root {
    --sidebar-w: 0px;
    --player-h: 56px;
    --mobile-nav-h: 52px;
  }

  #sidebar { display: none; }

  #search-bar {
    padding: 8px 16px;
  }
  .search-dropdown {
    left: 8px;
    right: 8px;
  }

  #content {
    padding: 16px;
    padding-bottom: calc(var(--mobile-nav-h) + var(--player-h) + 16px);
    overflow-x: hidden;
    word-break: break-word;
  }

  /* ── Mobile bottom nav (YTM-style) ── */
  #mobile-nav {
    position: fixed;
    bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    height: var(--mobile-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 90;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-3);
    transition: color var(--transition);
    cursor: pointer;
    min-width: 0;
  }
  .mobile-nav-item.active { color: var(--text); }
  .mobile-nav-item svg { flex-shrink: 0; }

  /* ── Compact player (56px, tappable to open fullscreen) ── */
  #player-bar {
    height: var(--player-h);
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    gap: 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    cursor: pointer;
    border-top: none;
  }

  .player-mobile-progress {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--surface3);
  }
  .player-mobile-progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s linear;
  }

  .player-now-playing {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .player-track-icon,
  .player-track-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
  }
  .player-track-title {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-track-artist {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-center { display: none; }
  .player-right { display: none; flex: 0; }

  .player-mobile-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
  .player-mobile-controls .ctrl-btn { width: 36px; height: 36px; }
  .player-mobile-controls .ctrl-btn-main {
    width: 36px;
    height: 36px;
  }

  /* ── Content adjustments ── */
  .playlist-detail-header { flex-direction: column; gap: 16px; align-items: center; text-align: center; }
  .playlist-detail-cover { width: 120px; height: 120px; }
  .playlist-detail-name { font-size: 20px; justify-content: center; }
  .playlist-detail-info { display: flex; flex-direction: column; align-items: center; }

  .playlists-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  /* Home page mobile */
  .home-greeting-text { font-size: 20px; }
  .home-hero { margin-bottom: 20px; }
  .home-hero-actions .btn span { display: none; } /* icon-only on very small screens */
  .track-cards-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; grid-template-rows: repeat(4, auto); }
  .track-card-play { width: 34px; height: 34px; opacity: 1; transform: none; }

  .song-item { grid-template-columns: 30px 40px 1fr auto; gap: 10px; padding: 6px 8px; }
  .song-art { width: 40px; height: 40px; }
  .song-duration { display: none; }
  .song-actions { opacity: 1; }
  .playlist-song-item .song-actions { opacity: 1; }
  .playlist-song-item { grid-template-columns: 40px 1fr auto auto; }
  .reorder-mode .playlist-song-item { grid-template-columns: 44px 40px 1fr auto auto; }

  .page-title { font-size: 18px; }

  /* Account page mobile */
  .account-page { padding: 0; }
  .account-section { padding: 14px; }
  .account-avatar { width: 52px; height: 52px; font-size: 1.2rem; }
}

/* ── Account Page ──────────────────────────────────────────── */
.account-page {
  max-width: 520px;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-top: 8px;
}

/* Avatar wrapper (clickable) */
.account-avatar-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}
.account-avatar-wrapper:hover .account-avatar-overlay { opacity: 1; }

.account-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 600;
}

.account-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
}

.account-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--transition);
}

.account-user-info {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.account-user-email {
  font-size: .85rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.account-user-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.account-edit-name-btn {
  display: flex;
  align-items: center;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: color var(--transition);
}
.account-edit-name-btn:hover { color: var(--accent); }

/* ── Avatar crop modal ──────────────────────────────────── */
.avatar-crop-container {
  display: flex;
  justify-content: center;
}
.avatar-crop-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}
.avatar-crop-canvas-wrap img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.avatar-crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  cursor: move;
  touch-action: none;
}

/* ── Lyrics editor ──────────────────────────────────────── */
.lyrics-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.account-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.account-section-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 16px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.account-row:last-child {
  border-bottom: none;
}

.account-row-stack {
  flex-wrap: wrap;
}
.account-row-stack .account-row-label {
  flex-shrink: 1;
  min-width: 0;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}

.account-row-label {
  font-size: .85rem;
  color: var(--text-2);
  flex-shrink: 0;
}

.account-row-value {
  font-size: .9rem;
  color: var(--text);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border-radius: var(--radius-full);
  padding: 4px;
  cursor: pointer;
}

.account-theme-option {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-3);
  transition: all var(--transition);
  cursor: pointer;
}

.account-theme-option.active {
  background: var(--accent);
  color: #fff;
}

.account-logout-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.account-logout-btn:hover {
  background: var(--danger);
  color: #fff;
}

.account-lang-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: .85rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.auth-lang-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
  color: var(--text-3);
}

.auth-lang-select {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 2px 2px;
  font-size: .78rem;
  color: var(--text-3);
  cursor: pointer;
  outline: none;
  transition: color var(--transition), border-color var(--transition);
}
.auth-lang-select:hover,
.auth-lang-select:focus {
  color: var(--text-2);
  border-bottom-color: var(--border);
}
.auth-lang-select option {
  background: var(--surface2);
  color: var(--text);
}

@media (min-width: 761px) {
  #mobile-nav { display: none; }
  .player-mobile-controls { display: none; }
}

/* ── Import Jobs Panel ─────────────────────────────────────── */
#import-jobs-panel {
  position: fixed;
  bottom: calc(var(--player-h) + 12px);
  right: 16px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 200;
  overflow: hidden;
  display: none;
  max-height: calc(100vh - var(--player-h) - 32px);
  display: none;
  flex-direction: column;
}
#import-jobs-panel.visible { display: flex; }

.ijp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.ijp-header-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.ijp-header-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
  display: none;
}
.ijp-header-badge.visible { display: inline-block; }
.ijp-toggle-btn {
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.ijp-toggle-btn:hover { color: var(--text); }

.ijp-body {
  display: block;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - var(--player-h) - 90px);
}
.ijp-body.collapsed { display: none; }

.ijp-job {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ijp-job:last-child { border-bottom: none; }

.ijp-job-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ijp-job-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.ijp-job-icon.running  { background: rgba(168,85,247,.15); color: var(--accent); }
.ijp-job-icon.done     { background: rgba(34,197,94,.12);  color: var(--success); }
.ijp-job-icon.failed   { background: rgba(239,68,68,.12);  color: var(--danger); }
.ijp-job-icon.cancelled{ background: var(--surface2);      color: var(--text-3); }
.ijp-job-icon.pending  { background: var(--surface2);      color: var(--text-3); }

.ijp-job-info { min-width: 0; flex: 1; }
.ijp-job-url {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ijp-job-stage {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.ijp-job-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ijp-cancel-btn {
  color: var(--text-3);
  padding: 2px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--transition);
}
.ijp-cancel-btn:hover { color: var(--danger); }

.ijp-progress-track {
  width: 100%;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
.ijp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}
.ijp-progress-fill.done { background: var(--success); }
.ijp-progress-fill.failed { background: var(--danger); }

/* Mobile: panel sits above the player bar */
@media (max-width: 760px) {
  #import-jobs-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: calc(var(--player-h) + 56px); /* above mobile nav + player */
    max-height: 50vh;
  }
  .ijp-body {
    max-height: calc(50vh - 50px);
  }
}

/* ── Downloads Page ─────────────────────────────────────────── */
.offline-storage-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 24px;
}
.offline-storage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 10px;
}
.offline-storage-nums {
  margin-left: auto;
  font-size: .8rem;
  color: var(--text-3);
}
.offline-storage-bar {
  height: 6px;
  background: var(--surface3, #2a2a2a);
  border-radius: 3px;
  overflow: hidden;
}
.offline-storage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .4s ease;
}

.offline-section { margin-bottom: 32px; }
.offline-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 14px;
}

/* Playlist grid */
.offline-pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.offline-pl-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}
.offline-pl-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 4px;
}
.offline-pl-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.offline-pl-meta {
  font-size: .75rem;
  color: var(--text-3);
}
.offline-pl-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* Downloaded track items — reuse song-item style */
.offline-track-item { cursor: pointer; }
.offline-track-item:hover { background: var(--surface2); }

@media (max-width: 480px) {
  .offline-pl-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ── Discover (Public Library) ─────────────────────────────── */
.discover-sort-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.discover-sort-bar .sort-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .85rem;
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.discover-sort-bar .sort-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.song-owner {
  opacity: .6;
  font-size: .8em;
}
.explore-pl-owner {
  font-size: .75rem;
  opacity: .55;
  margin-top: 2px;
}
