/* ============================================================
   KATALIST — layout.css
   Reset, app shell, auth screen, sidebar, views, mobile
   ============================================================ */

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-mono);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; }

/* ── AUTH ─────────────────────────────────────────────────── */
#screen-auth {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

#screen-auth::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 0%, transparent 100%);
  pointer-events: none;
}

#screen-auth::after {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.auth-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; padding: 0 24px;
}

.auth-logo { text-align: center; margin-bottom: 48px; }

.auth-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--fire-1), var(--fire-3));
  margin-bottom: 16px;
  box-shadow: 0 0 30px #ff4d0040;
}
.auth-logo-mark svg { width: 30px; height: 30px; fill: white; }

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--text-primary);
}
.auth-logo p { font-size: 12px; color: var(--text-muted); margin-top: 4px; letter-spacing: 0.08em; }

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.auth-tabs {
  display: flex; margin-bottom: 28px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md); padding: 3px;
}
.auth-tab {
  flex: 1; padding: 8px; text-align: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.05em; color: var(--text-muted);
  cursor: pointer; border-radius: 6px;
  transition: all 0.15s ease; border: none; background: none;
}
.auth-tab.active {
  background: var(--bg-overlay); color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-secondary);
}
.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-primary); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-input::placeholder { color: var(--text-muted); }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 11px; margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-strong);
}

.auth-message { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12px; display: none; }
.auth-message.error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: var(--danger);  display: block; }
.auth-message.success { background: rgba(79,255,143,0.1); border: 1px solid rgba(79,255,143,0.25); color: var(--success); display: block; }

.auth-verify { text-align: center; padding: 8px 0; }
.verify-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-dim); border: 1px solid var(--accent-glow);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.auth-verify h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.auth-verify p { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.05em; cursor: pointer; border: none;
  transition: all 0.15s ease; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--waveform));
  color: white; box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: var(--bg-elevated); color: var(--text-muted); box-shadow: none; border-color: var(--border-strong); cursor: not-allowed; }

.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 14px; height: 14px; fill: currentColor; }

.btn-full { width: 100%; margin-top: 4px; }
.btn-loading { opacity: 0.6; pointer-events: none; }
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ── APP SHELL ────────────────────────────────────────────── */
#screen-app { flex-direction: row; height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  height: 100%; background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}
#sidebar.collapsed { width: 56px; min-width: 56px; }

.sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; min-height: 56px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; overflow: hidden; }

.logo-mark {
  width: 28px; height: 28px; min-width: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--fire-1), var(--fire-3));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px #ff4d0040;
}
.logo-mark svg { width: 16px; height: 16px; fill: white; }

.logo-text {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  letter-spacing: -0.3px; white-space: nowrap; transition: opacity 0.2s ease;
}
#sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

.sidebar-collapse-btn {
  width: 24px; height: 24px; border: none; background: none;
  color: var(--text-muted); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: all 0.15s ease;
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-collapse-btn svg { transition: transform 0.2s ease; }
#sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 8px 8px 4px; white-space: nowrap; overflow: hidden; transition: opacity 0.2s ease;
}
#sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  cursor: pointer; transition: all 0.1s ease; white-space: nowrap;
  overflow: hidden; border: none; background: none; width: 100%;
  text-align: left; font-family: var(--font-mono); font-size: 12px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; min-width: 16px; fill: currentColor; }
.nav-item-text { transition: opacity 0.2s ease; }
#sidebar.collapsed .nav-item-text { opacity: 0; width: 0; overflow: hidden; }
#sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 8px 0; }

.nav-playlist-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  cursor: pointer; transition: all 0.1s ease; white-space: nowrap; overflow: hidden; font-size: 12px;
}
.nav-playlist-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-playlist-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-playlist-art { width: 20px; height: 20px; min-width: 20px; border-radius: 3px; background: var(--bg-elevated); flex-shrink: 0; }
.nav-playlist-name { overflow: hidden; text-overflow: ellipsis; flex: 1; }
#sidebar.collapsed .nav-playlist-item { justify-content: center; gap: 0; padding: 0; height: 32px; }
#sidebar.collapsed .nav-playlist-name { display: none; }

.sidebar-storage { padding: 12px 16px; border-top: 1px solid var(--border); transition: opacity 0.2s ease; }
#sidebar.collapsed .sidebar-storage { opacity: 0; pointer-events: none; }
.storage-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-bottom: 6px; }
.storage-bar { height: 3px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.storage-fill.warning { background: var(--warning); }
.storage-fill.danger { background: var(--danger); }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.content-area { flex: 1; overflow-y: auto; overflow-x: hidden; }
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.view { display: none; height: 100%; flex-direction: column; }
.view.active { display: flex; }

.view-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.view-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
#song-view-title {
  border-bottom: 1px dashed var(--border-strong);
  cursor: text; transition: color 0.15s ease, border-color 0.15s ease;
}
#song-view-title:hover { color: var(--accent); border-bottom-color: var(--accent); }
.song-title-input {
  font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.3px;
  background: transparent; border: none; border-bottom: 2px solid var(--accent);
  color: var(--text); outline: none; padding: 0; min-width: 120px; width: auto;
}
.view-actions { display: flex; gap: 8px; }

.view-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.view-body::-webkit-scrollbar { width: 6px; }
.view-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 24px; text-align: center; gap: 12px;
}
.empty-state svg { width: 40px; height: 40px; fill: var(--text-muted); margin-bottom: 4px; }
.empty-state h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state p { font-size: 12px; color: var(--text-muted); max-width: 280px; line-height: 1.6; }

.placeholder-block {
  background: var(--bg-elevated); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md); padding: 40px;
  text-align: center; color: var(--text-muted); font-size: 12px;
}

/* ── TOASTS ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: calc(var(--player-height) + 16px); right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none;
}
.toast {
  padding: 10px 14px; border-radius: var(--radius-md); font-size: 12px;
  background: var(--bg-overlay); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease; max-width: 320px; color: var(--text-primary);
}
.toast.error { border-color: var(--danger); color: var(--danger); opacity: 0.9; }
.toast.success { border-color: var(--success); color: var(--success); opacity: 0.9; }

@keyframes toastIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.spinner {
  width: 14px; height: 14px; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite; display: inline-block;
}

.hidden { display: none !important; }

/* ── BOTTOM NAV (mobile, hidden by default) ───────────────── */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px; background: var(--bg-surface);
  border-top: 1px solid var(--border); z-index: 60;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-muted); cursor: pointer; transition: color 0.1s ease;
  border: none; background: none; font-family: var(--font-mono);
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { width: 20px; height: 20px; fill: currentColor; }
.bottom-nav-label { font-size: 10px; letter-spacing: 0.05em; }

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar hidden on mobile */
  #sidebar { display: none; }

  /* Full-height flex column — no overflow:hidden so fixed children work */
  #screen-app { flex-direction: column; height: 100vh; }

  /* Main content fills space, scrolls, leaves room for fixed player + nav */
  #main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px; /* 64px player + 56px bottom nav */
  }

  /* Content area is transparent on mobile — main-content scrolls */
  .content-area { overflow: visible; flex: none; }

  /* Views are natural height on mobile */
  .view { height: auto; min-height: 0; }
  .view.active { display: flex; flex-direction: column; }

  /* Player: fixed above bottom nav */
  #player-bar {
    position: fixed !important;
    bottom: 56px; left: 0; right: 0;
    z-index: 50;
    margin-bottom: 0;
  }

  /* Show bottom nav */
  #bottom-nav { display: flex; }

  /* Remaining player layout handled in player.css mobile section */
  .player-info { min-width: 0; }

  /* Tighter view spacing */
  .view-header {
    padding: 10px 12px 10px;
    flex-wrap: wrap; gap: 6px;
  }
  .view-actions { flex-wrap: wrap; gap: 4px; }
  .view-body { padding: 12px 16px; overflow: visible; }
  .view-title { font-size: 17px; flex-shrink: 0; }

  /* Song view: back + play buttons same size so artwork centers */
  #view-song .view-header #btn-back-to-playlist-from-song,
  #view-song .view-header #btn-play-song {
    width: 90px; justify-content: center;
    padding: 6px 10px; gap: 5px;
    align-self: stretch;
  }

  /* Song view: title drops to its own line on mobile */
  #view-song .view-header #song-view-title {
    width: 100%; order: 1;
    text-align: center; padding: 14px 0 6px;
  }

  /* Prevent horizontal overflow in all views */
  .view, .view-header, .view-body { max-width: 100%; box-sizing: border-box; }
  .content-area { max-width: 100%; overflow-x: hidden; }

  /* Files toolbar wraps */
  .files-toolbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .files-search { flex: 1 1 100%; }

  /* Toast position */
  #toast-container { bottom: calc(64px + 56px + 8px); right: 8px; }

  /* Now Playing view on mobile — natural scroll, tighter spacing */
  .np-player-panel {
    padding: 20px 20px;
    gap: 20px;
    justify-content: flex-start;
  }
  .np-artwork-large { width: min(240px, 54vw); }
  .np-controls .ctrl-btn { width: 36px; height: 36px; }
  .np-controls .ctrl-btn.play-pause { width: 52px; height: 52px; }
  .np-controls .ctrl-btn svg { width: 16px; height: 16px; }
  .np-controls .ctrl-btn.play-pause svg { width: 18px; height: 18px; }
  #np-panel-queue { overflow: visible; }
  #np-panel-queue .view-body { overflow: visible; padding: 0; }
  #np-panel-queue .now-playing-card { padding: 12px 16px; }
  #np-panel-queue .queue-item { padding-left: 8px; padding-right: 8px; }
}

/* ============================================================
   PLAYLIST DETAIL VIEW
   ============================================================ */

.playlist-header-info {
  flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  align-items: center; text-align: center;
}
.playlist-song-count {
  font-size: 11px; color: var(--text-muted); letter-spacing: 0.05em;
}

.playlist-song-row {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: default; transition: background 0.1s ease;
  border-bottom: 1px solid var(--border);
}
.playlist-song-row:last-of-type { border-bottom: none; }
.playlist-song-row:hover { background: var(--bg-hover); }
.playlist-song-row:hover .song-detail-btn { opacity: 1; }
.playlist-song-row.playing { background: var(--accent-dim); }
.playlist-song-row.playing .song-title-text { color: var(--accent); }
.playlist-song-row.no-audio { opacity: 0.5; cursor: default; }

.song-track-num {
  width: 16px; text-align: right; font-size: 11px;
  color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.song-play-icon {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-secondary);
}
.playlist-song-row:hover .song-play-icon { color: var(--accent); }
.playlist-song-row.playing .song-play-icon { color: var(--accent); }

.song-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin-left: 6px; }
.song-title-text {
  font-size: 13px; font-family: var(--font-display); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-version-label { font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; }

.song-duration {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

.song-detail-btn {
  opacity: 0; flex-shrink: 0; transition: opacity 0.1s ease;
}

.playlist-add-song-row {
  padding: 12px 0; display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between;
  border-top: 1px dashed var(--border-strong); margin-top: 4px; gap: 12px;
}
.playlist-add-song-left {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.playlist-delete-btn { color: var(--danger) !important; flex-shrink: 0; }

.playlist-list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s ease; border-radius: var(--radius-sm);
}
.playlist-list-row:hover { background: var(--bg-hover); padding-left: 8px; padding-right: 8px; }
.playlist-list-art {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); flex-shrink: 0;
}
.playlist-list-info { flex: 1; min-width: 0; }
.playlist-list-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.playlist-list-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.playlist-list-arrow { flex-shrink: 0; }
.playlist-list-drag-handle {
  flex-shrink: 0; color: var(--text-muted); cursor: grab;
  opacity: 0.35; touch-action: none;
}
.playlist-list-drag-handle:hover { opacity: 0.7; }
.playlist-list-row.dragging { opacity: 0.35; }
.playlist-list-row.drag-over-top    { border-top: 2px solid var(--accent); }
.playlist-list-row.drag-over-bottom { border-bottom: 2px solid var(--accent); }

/* ============================================================
   SONG DETAIL VIEW
   ============================================================ */

.song-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 24px; flex-shrink: 0; background: var(--bg-surface);
}
.song-tab {
  padding: 12px 16px; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.05em; color: var(--text-muted); border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.1s ease, border-color 0.1s ease;
}
.song-tab:hover { color: var(--text-primary); }
.song-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.song-tab-panels {
  flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
}
.song-tab-panel {
  display: none; flex-direction: column; flex: 1;
  overflow-y: auto; padding: 20px 24px; gap: 12px;
}
.song-tab-panel::-webkit-scrollbar { width: 6px; }
.song-tab-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.song-tab-panel.active { display: flex; }

.tab-empty-msg { font-size: 12px; color: var(--text-muted); padding: 16px; text-align: center; white-space: normal; word-break: break-word; }

/* ── Versions tab ── */
.version-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-surface);
}
.version-row:hover { background: var(--bg-hover); }

.version-active-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-strong); flex-shrink: 0; transition: background 0.15s ease;
}
.version-active-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }

.version-info { flex: 1; min-width: 0; }
.version-label-row { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.version-number-prefix { font-weight: 600; }
.version-label-suffix { }
.version-label-text { cursor: text; border-bottom: 1px dashed var(--border); }
.version-label-text:hover { border-bottom-color: var(--accent); }
.btn-add-version-label {
  background: none; border: none; padding: 0 0 0 4px;
  color: var(--text-muted); font-size: 11px; cursor: pointer;
  font-family: var(--font-mono); opacity: 0.6;
}
.btn-add-version-label:hover { opacity: 1; color: var(--accent); }
.version-label-input {
  background: var(--bg-input); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 2px 8px;
  color: var(--text); font-family: var(--font-mono); font-size: 13px;
  outline: none; width: 200px; margin-left: 6px;
}
.version-filename { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.version-duration { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.version-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.version-active-badge {
  font-size: 11px; color: var(--accent); letter-spacing: 0.05em;
  padding: 4px 8px; border-radius: var(--radius-sm);
  background: var(--accent-dim); border: 1px solid var(--accent-glow);
}

/* ── Lyrics tab ── */
.lyric-pills {
  display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0;
}
.lyric-pill {
  padding: 6px 14px; border-radius: 999px; font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  cursor: pointer; border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text-secondary);
  transition: all 0.1s ease;
}
.lyric-pill:hover { color: var(--text-primary); border-color: var(--text-muted); }
.lyric-pill.active {
  background: var(--accent-dim); border-color: var(--accent-glow); color: var(--accent);
}
.lyric-pill-new { border-style: dashed; }
.lyric-pill-rename-input {
  padding: 6px 14px; border-radius: 999px; font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  background: var(--accent-dim); border: 1px solid var(--accent);
  color: var(--accent); outline: none; min-width: 60px;
}

.lyric-editor {
  flex: 1; flex-direction: column; gap: 8px; min-height: 0;
}
.lyric-textarea {
  flex: 1; min-height: 300px; width: 100%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  color: var(--text-primary); resize: vertical; outline: none;
  transition: border-color 0.15s ease;
}
.lyric-textarea:focus { border-color: var(--accent); }
.lyric-editor-footer {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.lyric-save-status { font-size: 11px; color: var(--text-muted); }

/* ── Notes tab ── */
.note-add-row {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.note-add-row .form-input { flex: 1; }

.note-item {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.note-item.resolved { opacity: 0.5; }
.note-item.resolved .note-content { text-decoration: line-through; }
.note-content { flex: 1; font-size: 13px; line-height: 1.5; word-break: break-word; }
.note-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Markers tab ── */
.marker-add-row {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.marker-add-row .form-input { flex: 1; }
.marker-current-time {
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--accent);
  font-weight: 500; min-width: 36px; text-align: center; flex-shrink: 0;
  background: var(--accent-dim); border: 1px solid var(--accent-glow);
  padding: 6px 10px; border-radius: var(--radius-sm);
}

.marker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-surface);
}
.marker-timestamp-pill {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--accent); background: var(--accent-dim);
  border: 1px solid var(--accent-glow); border-radius: 999px;
  padding: 4px 10px; cursor: pointer; flex-shrink: 0;
  transition: filter 0.1s ease; font-family: var(--font-mono);
}
.marker-timestamp-pill:hover { filter: brightness(1.2); }
.marker-version-tag {
  font-size: 10px; color: var(--accent); font-family: var(--font-mono);
  background: var(--accent-dim); border-radius: 3px; padding: 1px 5px;
  flex-shrink: 0; letter-spacing: 0.04em;
}
.marker-content { flex: 1; font-size: 13px; }

/* ============================================================
   FOLDER NAVIGATION
   ============================================================ */

.files-breadcrumb {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 24px 0; flex-shrink: 0; flex-wrap: wrap;
}
.breadcrumb-seg {
  background: none; border: none; padding: 4px 8px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted); cursor: pointer;
  border-radius: var(--radius-sm); transition: all 0.1s ease;
}
.breadcrumb-seg:hover { color: var(--text-primary); background: var(--bg-hover); }
.breadcrumb-seg.active { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); font-size: 12px; user-select: none; }

.folder-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.1s ease;
  border-bottom: 1px solid var(--border);
}
.folder-row:hover { background: var(--bg-hover); }
.folder-row:hover .folder-row-actions { opacity: 1; }
.folder-row-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--accent); }
.folder-row-name { flex: 1; font-size: 13px; font-family: var(--font-display); font-weight: 500; }
.folder-row-actions { opacity: 0; transition: opacity 0.1s ease; flex-shrink: 0; }
.folder-row-arrow { flex-shrink: 0; color: var(--text-muted); }

.folder-card .file-card-art.folder-art {
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
}
.folder-card .file-card-art.folder-art svg { color: var(--accent); }

.file-row.selected { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.file-card.selected { outline: 2px solid var(--accent); outline-offset: 2px; }

.file-select-cb {
  width: 16px; height: 16px; flex-shrink: 0; cursor: pointer;
  accent-color: var(--accent);
}

.card-select-overlay {
  position: absolute; top: 8px; left: 8px; z-index: 2;
}

/* ============================================================
   DRAG-TO-REORDER (playlist songs + queue)
   ============================================================ */

.drag-handle {
  width: 12px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: grab; flex-shrink: 0;
  opacity: 0; transition: opacity 0.1s ease;
}
.playlist-song-row:hover .drag-handle,
.queue-item:hover .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }

.playlist-song-row.drag-over-top { border-top: 2px solid var(--accent); }
.playlist-song-row.drag-over-bottom { border-bottom: 2px solid var(--accent); }
.playlist-song-row.dragging { opacity: 0.4; }
.queue-item.drag-over-top    { border-top:    2px solid var(--accent); }
.queue-item.drag-over-bottom { border-bottom: 2px solid var(--accent); }
.queue-item.dragging { opacity: 0.4; }

/* ============================================================
   ALBUM ARTWORK
   ============================================================ */

.playlist-artwork-block {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 0 0 20px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.artwork-square {
  width: 160px; height: 160px; flex-shrink: 0;
  border-radius: var(--radius-md); overflow: hidden;
  cursor: default; position: relative;
  border: 1px solid var(--bg-surface);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
}
.artwork-square.artwork-editable { cursor: pointer; }
.artwork-square .artwork-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.15s ease;
}
.artwork-square.artwork-editable:hover .artwork-overlay { opacity: 1; }

.playlist-meta-col {
  display: flex; flex-direction: column; gap: 4px; padding-top: 4px;
}
.playlist-art-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
}

.playlist-edit-actions {
  display: flex; flex-direction: column; gap: 6px; margin-top: 10px;
}


/* ── ARTWORK PICKER MODAL ────────────────────────────────── */
.artwork-picker-modal .add-song-modal-content {
  max-height: unset;
}
.artwork-picker-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 16px 0;
  min-height: 60px;
}
.artwork-picker-empty {
  color: var(--text-muted); font-size: 12px; padding: 8px 0;
}
.artwork-picker-card {
  width: 135px; height: 135px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  overflow: hidden; position: relative;
  cursor: pointer; flex-shrink: 0;
  transition: border-color 0.15s ease;
}
.artwork-picker-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.artwork-picker-card.active {
  border-color: var(--accent);
}
.artwork-picker-card:hover:not(.active) {
  border-color: var(--border-strong);
}
.artwork-delete-btn {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,0.7); color: white;
  border: none; border-radius: 50%;
  font-size: 12px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s ease;
}
.artwork-picker-card:hover .artwork-delete-btn { opacity: 1; }
.artwork-active-badge {
  position: absolute; bottom: 2px; right: 2px;
  width: 16px; height: 16px;
  background: var(--accent); color: white;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}
.artwork-picker-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.artwork-inherited-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.85);
  font-size: 9px; text-align: center;
  padding: 3px 0; letter-spacing: 0.5px;
  text-transform: uppercase;
}

.song-artwork-small {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  flex-shrink: 0; border: 1px solid var(--border-strong);
  background: var(--bg-elevated); cursor: pointer;
  position: relative; overflow: hidden;
  transition: opacity 0.15s ease;
  display: flex; align-items: center; justify-content: center;
}
.song-artwork-small:hover { opacity: 0.85; }

.song-row-art {
  width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
  border: 1px solid var(--border-strong);
}

/* ============================================================
   QUEUE VIEW
   ============================================================ */

.now-playing-card {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
}
.now-playing-art {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--accent-dim); border: 1px solid var(--accent-glow);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.now-playing-info { flex: 1; min-width: 0; }
.now-playing-title {
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-playing-version { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.now-playing-time {
  font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.now-playing-empty { color: var(--text-muted); font-size: 12px; }

.queue-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s ease;
}
.queue-item:hover { background: var(--bg-hover); }
.queue-item.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.queue-item.active .queue-item-title { color: var(--accent); }
.queue-item-num {
  width: 28px; text-align: center; font-size: 11px;
  color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center;
}
.queue-item.active .queue-item-num { color: var(--accent); font-size: 13px; }
.queue-num-play { display: none; }
.queue-item:not(.active):hover .queue-num-text { display: none; }
.queue-item:not(.active):hover .queue-num-play { display: block; }
.queue-item-art {
  width: 32px; height: 32px; border-radius: 4px;
  flex-shrink: 0; border: 1px solid var(--border-strong);
}
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-title {
  font-size: 13px; font-family: var(--font-display); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-item-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.queue-item-duration {
  font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.queue-remove-btn {
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  color: var(--text-muted); opacity: 0; flex-shrink: 0; display: flex; align-items: center;
  transition: opacity 0.15s, color 0.15s; width: 22px;
}
.queue-item:hover .queue-remove-btn { opacity: 1; }
.queue-remove-btn:hover { color: var(--text); }

/* ============================================================
   NOW PLAYING VIEW
   ============================================================ */

.np-tabs {
  display: flex;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.np-tab {
  flex: 1; padding: 12px 16px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.05em; color: var(--text-muted);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.1s ease, border-color 0.1s ease;
}
.np-tab:hover { color: var(--text-primary); }
.np-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.np-panel {
  display: none; flex-direction: column;
  flex: 1; min-height: 0;
}
.np-panel.active { display: flex; }

/* ── Now Playing panel ── */
.np-player-panel {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; min-height: 0;
  gap: clamp(14px, 2.5vh, 28px);
  padding: clamp(16px, 3vh, 32px) 40px;
  max-width: 640px; margin: 0 auto; width: 100%;
  overflow: hidden;
}

.np-artwork-large {
  width: min(300px, 68vw);
  aspect-ratio: 1 / 1;
  flex-shrink: 1; min-height: 0;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}
.np-artwork-large .artwork-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-overlay));
}

.np-track-info { text-align: center; width: 100%; min-width: 0; }
.np-track-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-primary);
}
.np-track-version { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.np-track-context {
  font-size: 11px; color: var(--text-muted); margin-top: 3px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.np-scrubber { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.np-scrubber .scrubber-track { height: 48px; }

.np-controls {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.np-controls .ctrl-btn { width: 40px; height: 40px; }
.np-controls .ctrl-btn svg { width: 18px; height: 18px; }
.np-controls .ctrl-btn.play-pause { width: 58px; height: 58px; }
.np-controls .ctrl-btn.play-pause svg { width: 22px; height: 22px; }

.np-controls-stack {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.np-volume {
  display: flex; align-items: center; gap: 8px; width: 70%; margin-top: 8px;
}
.np-volume .ctrl-btn { width: 36px; height: 36px; flex-shrink: 0; }
.np-volume .volume-slider { flex: 1; }
.np-volume-high { width: 36px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-secondary); }

/* ── Queue panel (inside np view) ── */
#np-panel-queue { overflow: hidden; }
#np-panel-queue .view-body { overflow-y: auto; overflow-x: hidden; flex: 1; }

/* ============================================================
   ADD-SONG / ADD-VERSION MODAL
   ============================================================ */

.add-song-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  animation: panelIn 0.15s ease;
}
.add-song-modal-content {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 24px; width: 480px; max-width: calc(100vw - 32px);
  max-height: 70vh; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.add-song-modal-header {
  display: flex; align-items: center; justify-content: space-between;
}
.add-song-modal-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.add-song-modal-label-row { flex-shrink: 0; }
.version-label-wrap {
  display: flex; align-items: stretch;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.version-label-wrap:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.version-label-prefix {
  padding: 10px 10px 10px 12px;
  font-family: var(--font-mono); font-size: 13px; white-space: nowrap;
  color: var(--accent); border-right: 1px solid var(--border-strong);
  user-select: none; display: flex; align-items: center;
}
.version-label-wrap input {
  flex: 1; background: none; border: none; outline: none;
  padding: 10px 12px; font-family: var(--font-mono); font-size: 13px;
  color: var(--text-primary);
}
.version-label-wrap input::placeholder { color: var(--text-muted); }
.version-file-search-row { flex-shrink: 0; display: flex; }
.version-file-breadcrumb { flex-shrink: 0; gap: 4px; flex-wrap: wrap; }
.add-song-file-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.add-song-file-list::-webkit-scrollbar { width: 4px; }
.add-song-file-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.add-song-file-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.add-song-file-row:hover { background: var(--bg-hover); }
.add-song-file-list .version-folder-row { border-radius: var(--radius-sm); border-bottom: none; }
.add-song-linked-tag {
  font-size: 11px; font-family: var(--font-mono); color: var(--text-muted);
  flex-shrink: 0; padding: 2px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); white-space: nowrap;
}

/* ── ALBUM DOWNLOAD MODAL ────────────────────────────────── */
.album-download-modal-content { max-width: 440px; }
.album-download-field { display: flex; flex-direction: column; gap: 6px; }
.album-download-label {
  font-size: 10px; font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}
.album-download-checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-family: var(--font-mono); color: var(--text-primary);
  accent-color: var(--accent);
}
.album-download-hint {
  font-size: 11px; color: var(--text-muted); padding-left: 22px; margin-top: -10px;
}
.album-download-artwork-format { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.album-download-artwork-format.hidden { display: none; }
.album-download-radio-group {
  display: flex; gap: 16px; font-size: 13px; font-family: var(--font-mono);
  color: var(--text-primary); accent-color: var(--accent);
}
.album-download-notice {
  background: var(--bg-overlay); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 12px; color: var(--text-muted);
}
.album-download-meta-fields { display: flex; flex-direction: column; gap: 10px; }
.album-download-meta-fields.hidden { display: none; }

/* ── DOWNLOAD PROGRESS MODAL ────────────────────────────────── */
.download-progress-content {
  max-width: 360px; align-items: center; text-align: center;
}
.download-progress-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.download-progress-title {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--text-primary);
}
.download-progress-sub { font-size: 12px; color: var(--text-muted); }
.download-progress-bar-wrap {
  width: 100%; height: 3px; background: var(--bg-elevated);
  border-radius: 2px; overflow: hidden; position: relative;
}
.download-progress-bar {
  position: absolute; height: 100%; width: 45%;
  background: var(--accent); border-radius: 2px;
  animation: dl-sweep 1.5s ease-in-out infinite;
}
@keyframes dl-sweep {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.download-progress-hint { font-size: 11px; color: var(--text-muted); }
.album-download-summary {
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 12px;
}

/* ── NOW PLAYING MODE — hide player bar ────────────────────── */
#screen-app.np-active #player-bar { display: none; }

@media (max-width: 768px) {
  /* Remove the player-bar slice from bottom padding when NP is active */
  #screen-app.np-active #main-content { padding-bottom: 56px; }
  /* Artwork smaller on mobile — must be in this block to beat the base rule above */
  .np-artwork-large { width: min(240px, 54vw); }
  /* Volume slider hidden on mobile — users use device volume buttons */
  .np-volume { display: none; }
  /* Now Playing view fills the screen so the player can center vertically */
  #view-now-playing.active { min-height: calc(100svh - 56px); }
  #np-panel-player { flex: 1; justify-content: center; }
  /* Queue remove button and drag handle always visible on touch */
  .queue-remove-btn { opacity: 0.5; }
  .queue-item .drag-handle { opacity: 0.4; }
  /* Download button: icon-only on mobile, full label on desktop */
  .btn-label-desktop { display: none; }
}


/* ============================================================
   SHARING — Share Modal, Enter Code, Sidebar, Banner
   ============================================================ */

/* Share modal — wider + scrollable body */
.share-modal-content {
  max-height: 80vh;
  width: 500px;
}
.share-modal-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Share mode banner — sits above the content-area scroll container */
.share-mode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.share-mode-banner.hidden { display: none; }
.share-banner-sep { color: var(--border); }
.share-permission-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* Share modal — token display */
.share-token-display {
  font-family: 'DM Mono', monospace;
  font-size: 32px;
  letter-spacing: 0.2em;
  color: var(--accent);
  padding: 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-bottom: 12px;
  user-select: all;
}
.share-token-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

/* Share form */
.share-field-group { margin-bottom: 16px; }
.share-field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.share-field-optional { color: var(--text-muted); font-size: 11px; text-transform: none; letter-spacing: 0; }

/* Permission pills */
.share-permission-row {
  display: flex;
  gap: 6px;
}
.share-perm-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.share-perm-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.share-perm-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

/* Granular flags */
.share-flags-group {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
}
.share-flags-group.hidden { display: none; }
.share-flag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  cursor: pointer;
}
.share-flag-row:hover { color: var(--text-primary); }
.share-flag-row input { accent-color: var(--accent); }
.flag-warn {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #ff000020;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Active shares list */
.share-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.share-active-list-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.share-active-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.share-active-row:last-child { border-bottom: none; }
.share-active-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.share-active-actions { display: flex; gap: 6px; flex-shrink: 0; }
.share-active-empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.share-revoked-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-raised);
  color: var(--text-muted);
  border-radius: 3px;
  text-transform: uppercase;
}

/* Share code pill */
.share-code-pill {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 3px 8px;
  border-radius: 4px;
}
.share-perm-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.share-label-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* "Shared with me" sidebar section */
.shared-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 4px;
}
.btn-enter-code {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-enter-code:hover { color: var(--text-primary); border-color: var(--accent); }
.share-membership-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}
.share-perm-icon { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.sidebar-empty-hint { font-size: 12px; color: var(--text-muted); padding: 6px 8px; }

/* Enter code modal — code input large */
.share-code-input {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Share preview card */
.share-preview-card {
  padding: 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.share-preview-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.share-preview-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.share-preview-meta { font-size: 13px; color: var(--text-secondary); }

/* Contribute modal file list */
.contribute-file-list {
  max-height: 300px;
  overflow-y: auto;
}
.contribute-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.contribute-file-row:last-child { border-bottom: none; }
.contribute-file-name { flex: 1; font-size: 13px; color: var(--text-primary); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contribute-file-meta { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* Contribution badge on shared files */
.contribution-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.contribution-adopt-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.contribution-adopt-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Inline rename input — replaces name text in file/folder rows */
.inline-rename-input {
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--text-primary);
  font-size: inherit;
  font-family: inherit;
  padding: 1px 6px;
  outline: none;
  width: 100%;
  min-width: 120px;
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Modal close button — the × in the top-right of any modal header */
.modal-close-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.modal-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-raised);
}

