/* ── Player Bar ── */
:root { --player-height: 0px; }
body.player-active { --player-height: 68px; }
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 68px; z-index: 99;
  background: linear-gradient(180deg, rgba(22,22,32,0.97), rgba(12,12,18,0.98));
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,.06); display: none; align-items: center; gap: 14px; padding: 0 20px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.5);
}
.player-bar::before {
  content: ''; position: absolute; top: -1px; left: 0; height: 2px;
  width: var(--player-progress, 0%); background: var(--accent); transition: width .15s linear;
}
body.player-active .player-bar { display: flex; }
.player-bar .player-img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--bg-elevated); cursor: pointer; transition: box-shadow .2s; }
.player-bar .player-img:hover { box-shadow: 0 0 16px rgba(162,230,64,.15); }
.player-bar .player-text { min-width: 0; flex: 1; cursor: pointer; }
.player-bar .player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .player-artist-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.player-bar .player-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.player-controls button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition); }
.player-controls button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.player-controls .player-play-btn { width: 42px; height: 42px; color: #000; background: var(--accent); border-radius: 50%; }
.player-controls .player-play-btn:hover { box-shadow: 0 0 16px var(--accent-glow); transform: scale(1.05); background: var(--accent); color: #000; }
.player-progress-wrap { flex: 1 1 0; display: flex; align-items: center; gap: 8px; min-width: 100px; max-width: 600px; }
.player-progress-bar { flex: 1; height: 24px; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; touch-action: manipulation; display: flex; align-items: center; }
.player-progress-bar::after { content: ''; position: absolute; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.player-progress-bar:hover::after { height: 6px; }
.player-progress-fill { position: absolute; left: 0; height: 4px; top: 50%; transform: translateY(-50%); background: var(--accent); border-radius: 2px; width: 0%; transition: width .1s linear; z-index: 1; pointer-events: none; }
.player-time { font-size: 10px; color: var(--text-dim); flex-shrink: 0; min-width: 32px; text-align: center; }
.player-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.player-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition); }
.player-actions button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.player-actions .player-vol-wrap { display: flex; align-items: center; gap: 4px; }
.player-actions .player-vol { width: 80px; height: 4px; accent-color: var(--accent); cursor: pointer; }
/* ── Full Player ── */
.full-player-backdrop { display: none; }
.full-player {
  position: fixed; inset: 0; z-index: 201; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(28,28,40,0.99) 0%, rgba(10,10,16,0.99) 100%);
  transform: translateY(100%); transition: transform .35s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.full-player.open { transform: translateY(0); }
.fp-drag-handle { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin: 10px auto 0; flex-shrink: 0; }
.fp-player-side { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; overflow: hidden; }
.fp-queue-side { display: none; flex-direction: column; border-left: 1px solid var(--border); background: rgba(10,10,16,0.6); }
.fp-queue-side .panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; flex-shrink: 0; }
.fp-queue-side .queue-list { flex: 1; overflow-y: auto; padding: 8px; }
.fp-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; flex-shrink: 0; }
.fp-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition); }
.fp-header button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.fp-header .fp-source { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.fp-art-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 32px; min-height: 0; overflow: hidden; }
.fp-art { width: 100%; max-width: 340px; aspect-ratio: 1; border-radius: 14px; object-fit: cover; box-shadow: 0 12px 48px rgba(0,0,0,.6); background: var(--bg-elevated); user-select: none; -webkit-user-drag: none; }
.fp-art.swiping { transition: none; }
.fp-art.swipe-out-left { transition: transform .25s ease, opacity .25s ease; transform: translateX(-120%) scale(.9); opacity: 0; }
.fp-art.swipe-out-right { transition: transform .25s ease, opacity .25s ease; transform: translateX(120%) scale(.9); opacity: 0; }
.fp-art.swipe-in { transition: transform .3s ease, opacity .3s ease; transform: translateX(0); opacity: 1; }
.fp-info { width: 100%; padding: 24px 32px 0; text-align: center; flex-shrink: 0; }
.fp-title { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.fp-artist { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-progress { width: 100%; padding: 20px 32px 0; flex-shrink: 0; }
.fp-progress-bar { width: 100%; height: 24px; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; touch-action: manipulation; display: flex; align-items: center; }
.fp-progress-bar::after { content: ''; position: absolute; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.fp-progress-bar:hover::after { height: 6px; }
.fp-progress-fill { position: absolute; left: 0; height: 4px; top: 50%; transform: translateY(-50%); background: var(--accent); border-radius: 2px; width: 0%; transition: width .1s linear; z-index: 1; pointer-events: none; }
.fp-times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-dim); }
.fp-controls { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 20px 0; flex-shrink: 0; }
.fp-controls button { background: none; border: none; color: var(--text); cursor: pointer; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition); }
.fp-controls button:hover { background: rgba(255,255,255,.05); }
.fp-controls button svg { width: 28px; height: 28px; }
.fp-controls .fp-play-btn { width: 64px; height: 64px; background: var(--accent); color: #000; border-radius: 50%; }
.fp-controls .fp-play-btn:hover { box-shadow: 0 0 24px var(--accent-glow); transform: scale(1.05); background: var(--accent); color: #000; }
.fp-controls .fp-play-btn svg { width: 32px; height: 32px; }
.fp-mode-btn { position: relative; }
.fp-mode-btn.active { color: var(--accent) !important; }
.fp-mode-btn svg { width: 20px; height: 20px; }
.fp-repeat-badge { position: absolute; top: 2px; right: 2px; font-size: 8px; font-weight: 700; color: var(--accent); display: none; }
.fp-mode-btn.active .fp-repeat-badge { display: block; }
.fp-actions { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 0 32px 24px; flex-shrink: 0; width: 100%; }
.fp-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition); }
.fp-actions button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.fp-vol-wrap { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 200px; }
.fp-vol-wrap svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.fp-vol { flex: 1; height: 4px; accent-color: var(--accent); cursor: pointer; }
.fp-cast-vol { display: flex; align-items: center; gap: 10px; padding: 0 24px; margin-top: 8px; width: 100%; box-sizing: border-box; }
.fp-cast-vol svg { flex-shrink: 0; color: var(--accent); }
.fp-cast-vol .fp-vol { flex: 1; }

.btn-play-hero, .btn-queue-hero { width: auto; padding: 12px 20px; font-size: 14px; font-weight: 600; border-radius: 12px; cursor: pointer; transition: all var(--transition); font-family: inherit; border: 2px solid var(--border); display: flex; align-items: center; gap: 6px; }
.btn-play-hero { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-play-hero:hover { box-shadow: var(--shadow-glow); }
.btn-queue-hero { background: var(--bg-elevated); color: var(--text-muted); }
.btn-queue-hero:hover { border-color: var(--border-hover); color: var(--text); }
.player-bar.loading .player-progress-fill { width: 100% !important; background: linear-gradient(90deg, var(--accent) 25%, transparent 50%, var(--accent) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }

/* ── Queue Panels ── */
.queue-backdrop { position: fixed; inset: 0; z-index: 249; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.queue-backdrop.open { opacity: 1; pointer-events: auto; }
.queue-panel { position: fixed; left: 0; right: 0; top: 0; height: 70vh; max-height: 600px; z-index: 250; background: var(--bg-card); border-radius: 0 0 20px 20px; transform: translateY(-100%); transition: transform .35s cubic-bezier(.32,.72,0,1); display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.queue-panel.open { transform: translateY(0); }
.fp-queue-panel { position: fixed; left: 0; right: 0; bottom: 0; height: 75vh; max-height: 700px; z-index: 250; background: var(--bg-card); border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .35s cubic-bezier(.32,.72,0,1); display: flex; flex-direction: column; box-shadow: 0 -8px 40px rgba(0,0,0,.5); }
.fp-queue-panel.open { transform: translateY(0); }
.fp-queue-panel .queue-drag-handle { order: -1; margin: 8px auto 0; }
.fp-queue-panel .panel-header { order: 0; }
.queue-drag-handle { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin: 8px auto 0; flex-shrink: 0; }
.queue-list { flex: 1; overflow-y: auto; padding: 8px; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.queue-item:hover { background: rgba(255,255,255,.04); }
.queue-item.now-playing { background: var(--accent-dim); border: 1px solid rgba(162,230,64,.2); }
.queue-item .qi-num { font-size: 12px; color: var(--text-dim); width: 20px; text-align: center; flex-shrink: 0; }
.queue-item.now-playing .qi-num { color: var(--accent); }
.queue-item .qi-img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg-elevated); }
.queue-item .qi-info { min-width: 0; flex: 1; }
.queue-item .qi-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-bpm { font-size: 10px; color: var(--accent); background: var(--bg-elevated); border: 1px solid var(--border); padding: 1px 6px; border-radius: 8px; flex-shrink: 0; white-space: nowrap; }
.queue-item .qi-remove { background: none; border: none; color: var(--text-dim); cursor: pointer; width: 24px; height: 24px; font-size: 16px; display: flex; align-items: center; justify-content: center; border-radius: 50%; opacity: 0; transition: all .15s; flex-shrink: 0; }
.queue-item:hover .qi-remove { opacity: 1; }
.queue-item .qi-remove:hover { color: var(--red); background: rgba(255,255,255,.05); }
.queue-item .qi-drag { cursor: grab; color: var(--text-dim); font-size: 12px; width: 16px; text-align: center; flex-shrink: 0; opacity: 0.4; transition: opacity .15s; user-select: none; }
.queue-item:hover .qi-drag { opacity: 1; }
.queue-item.qi-dragging { opacity: 0.4; }
.queue-item.qi-drag-over { border-top: 2px solid var(--accent); margin-top: -2px; }

/* ── Recommendations ── */
.recs-section { padding: 0 4px 12px; }
.recs-list { display: flex; flex-direction: column; gap: 4px; }
.rec-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: 8px; transition: background .15s; cursor: pointer;
}
.rec-item:hover { background: rgba(255,255,255,.04); }
.rec-item.rec-playing { background: rgba(162,230,64,.08); }
.rec-num { width: 14px; font-size: 10px; color: var(--accent); flex-shrink: 0; text-align: center; }
.rec-img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg-elevated); }
.rec-info { min-width: 0; flex: 1; }
.rec-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rec-add-queue, .rec-add-playlist {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; transition: all .15s;
}
.rec-add-queue:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.rec-add-playlist:hover { background: rgba(255,255,255,.1); }

/* ── Source Badge ── */
.source-badge { font-size: 9px; font-weight: 700; letter-spacing: .5px; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; text-transform: uppercase; line-height: 1.4; }
.source-badge:empty { display: none; }
.prefetch-status { font-size: 9px; color: var(--text-dim); margin-left: 6px; white-space: nowrap; }
.prefetch-status:empty { display: none; }
.prefetch-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 2px; vertical-align: middle; }
.prefetch-dot.loading { background: var(--text-dim); animation: prefetchPulse 1s ease-in-out infinite; }
.prefetch-dot.ready { background: var(--accent); }
@keyframes prefetchPulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
.source-local { background: #22c55e; color: #000; }
.source-navidrome { background: #3b82f6; color: #fff; }
.source-youtube { background: #ef4444; color: #fff; }
.fp-artist-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.playlist-mode-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--accent); color: #000; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.fp-artist-row .source-badge { font-size: 10px; padding: 2px 7px; }
