/* ── Now Playing Widget ─────────────────────────────────────────────────── */

#now-playing {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 99998;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.np-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 10px;
    border-radius: 12px;
    cursor: default;
    user-select: none;
    width: 240px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    will-change: transform;
    animation: npSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
}

.np-pill:hover {
    transform: translateY(-2px);
}

body.dark-theme .np-pill:hover {
    transform: translateY(-2px);
}

/* ── Avatar + album art stack ── */
.np-images {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.np-art {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.06);
    filter: grayscale(100%);
}

.np-pill:hover .np-art {
    transition: filter 1s ease;
    filter: grayscale(0%);
}

.np-pill:not(:hover) .np-art {
    filter: grayscale(100%);
    transition: filter 1s ease;
}

body.dark-theme .np-art {
    background: rgba(255, 255, 255, 0.08);
}

.np-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    bottom: -4px;
    right: -4px;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    display: block;
}

body.dark-theme .np-avatar {
    border-color: rgba(18, 18, 18, 0.95);
}

/* ── Text block ── */
.np-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.np-label {
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    margin-bottom: 2px;
}

body.dark-theme .np-label {
    color: #f0f0f0;
}

#now-playing.np-paused .np-label {
    color: var(--text-muted);
}

/* Animated bars */
.np-bars {
    display: flex;
    align-items: flex-end;
    gap: 1.5px;
    height: 8px;
}

.np-bars span {
    display: block;
    width: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transform-origin: bottom;
    animation: npBar 0.9s ease-in-out infinite alternate;
}

body.dark-theme .np-bars span {
    background: #f0f0f0;
}

.np-bars span:nth-child(1) { height: 40%; animation-delay: 0s;    animation-duration: 0.7s; }
.np-bars span:nth-child(2) { height: 80%; animation-delay: 0.15s; animation-duration: 0.9s; }
.np-bars span:nth-child(3) { height: 55%; animation-delay: 0.30s; animation-duration: 0.8s; }
.np-bars span:nth-child(4) { height: 90%; animation-delay: 0.10s; animation-duration: 1.0s; }

@keyframes npBar {
    0%   { transform: scaleY(0.25); }
    100% { transform: scaleY(1); }
}

#now-playing.np-paused .np-bars span {
    animation-play-state: paused;
    transform: scaleY(0.25);
    opacity: 0.3;
}

#now-playing.np-paused .np-bars span {
    background: var(--text-muted);
}

.np-track {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.02rem;
    color: var(--text-primary);
    line-height: 1.35;
}

body.dark-theme .np-track {
    color: #f0f0f0;
}

.np-artist {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    margin-top: 2px;
}

body.dark-theme .np-artist {
    color: #888;
}



/* ── Entry animation ── */
@keyframes npSlideIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Hidden ── */
#now-playing.np-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
}

/* ── Mobile ── */
@media (max-width: 600px) {
    #now-playing {
        bottom: 1rem;
        left: 1rem;
    }
    .np-pill {
        width: 210px;
        padding: 8px 12px 8px 8px;
    }
    .np-art    { width: 34px; height: 34px; }
    .np-images { width: 34px; height: 34px; }
    .np-track  { font-size: 11px; }
    .np-artist { font-size: 9.5px; }
}