/* =========================================================================
   DESKTOP-ONLY NODES — base hide rules (OUTSIDE any media query)
   These additive DOM nodes default to hidden so the mobile layout is
   byte-for-byte unchanged. They are revealed only inside the >=1024px
   desktop-shell block at the very bottom of this file.
   ========================================================================= */
#desktop-sidebar { display: none; }
#desktop-page-title { display: none; }
.song-list-head { display: none; }
.toolbar-title { display: none; }
.song-list-row .col-artist,
.song-list-row .col-plays,
.song-list-row .col-size { display: none; }

/* =========================================================================
   DESKTOP / TABLET adjustments
   ========================================================================= */
@media (min-width: 600px) {
    .toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .toolbar button,
    .toolbar > input { width: auto; }
    .toolbar .search-field { flex: 1; min-width: 240px; }
    .toolbar .song-list-toggle { width: auto; }

    #queue-overlay, #modal-overlay, #error-modal-overlay, #action-sheet-overlay { align-items: center; }

    #queue-panel, #action-sheet, .modal {
        max-width: 500px;
        max-height: 80vh;
        border-radius: var(--radius-xl);
        animation: fadeIn 0.22s var(--ease-out);
    }

    .sheet-handle { display: none; }

    .modal-actions button { flex: none; padding: 10px 20px; }
}

@media (min-width: 900px) {
    body {
        max-width: none;
    }

    #app-main { padding: 20px 32px; }

    /* Song rows: full desktop layout */
    .song-row {
        grid-template-columns: 50px 1fr 140px 60px 90px 90px;
        grid-template-rows: auto;
        gap: 10px;
        padding: 8px 14px;
    }

    /* CSV rows carry a leading checkbox column */
    .song-row:has(> input[type="checkbox"]) {
        grid-template-columns: 28px 50px 1fr 140px 60px 90px 90px;
    }

    .song-row:hover { background: var(--surface-2); }
    .song-row > input[type="checkbox"] { grid-row: auto; grid-column: auto; }

    .song-thumb {
        grid-row: auto;
        grid-column: auto;
        width: 50px;
        height: 38px;
        border-radius: var(--radius-sm);
    }

    .song-info { grid-row: auto; grid-column: auto; }
    .song-row > .song-artist { display: block; }
    .song-duration { display: block; color: var(--text-3); text-align: center; }

    .song-badge-col { grid-row: auto; grid-column: auto; text-align: center; }

    .song-actions {
        grid-row: auto;
        grid-column: auto;
        justify-content: flex-end;
        padding-top: 0;
    }

    .song-duration-mobile { display: none; }

    /* Tables: standard layout */
    thead { display: table-header-group; }

    tbody tr {
        display: table-row;
        padding: 0;
        margin: 0;
        background: transparent;
        border-radius: 0;
    }

    td {
        display: table-cell;
        padding: 10px 14px;
        border-bottom: 1px solid rgba(255,255,255,0.04);
        font-size: 0.85rem;
    }

    td::before { display: none; }
    td[data-label=""] { padding-top: 10px; margin-top: 0; border-top: none; }

    th {
        padding: 10px 14px;
        background: var(--surface);
        color: var(--text-3);
        font-weight: 600;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border-bottom: 1px solid rgba(255,255,255,0.04);
        text-align: left;
    }

    .queue-drag-handle { display: flex; }

    /* Bigger player artwork on desktop */
    #vinyl-stage { max-width: 420px; }
    #player-content { padding: 16px 40px 32px; max-width: 640px; margin: 0 auto; }
}

/* Mobile queue polish: bigger touch targets, drag handle on right, more breathing room */
@media (max-width: 899px) {
    .queue-item:hover { background: transparent; }
    .queue-drag-handle { opacity: 0.6; padding: 10px 8px; }
    .queue-item .queue-drag-handle { opacity: 0.6; }
    .queue-drag-handle svg { width: 20px; height: 20px; }

    .sheet-handle { width: 44px; height: 5px; margin: 10px auto 2px; }

    #queue-panel { max-height: 88vh; }

    .queue-header { padding: 6px 18px 14px; }
    .queue-header-top h3 { font-size: 1.25rem; }
    .queue-header-top .modal-close {
        width: 40px; height: 40px; min-width: 40px; min-height: 40px;
        border-radius: 50%;
        background: var(--surface-2);
    }
    .queue-header-meta { font-size: 0.82rem; margin-top: 4px; }
    .queue-header-actions { margin-top: 14px; gap: 10px; }
    .queue-action-btn {
        min-height: 40px;
        padding: 8px 16px;
        font-size: 0.88rem;
        flex: 1;
        justify-content: center;
    }

    .queue-item {
        padding: 12px 6px 12px 14px;
        gap: 14px;
        margin: 2px 6px;
    }

    .queue-thumb,
    .queue-thumb-placeholder {
        width: 52px;
        height: 52px;
        border-radius: 10px;
    }

    .queue-item-title { font-size: 0.96rem; }
    .queue-item-sub { font-size: 0.78rem; margin-top: 4px; }

    .queue-item-actions { gap: 2px; }

    .queue-remove-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        opacity: 0.8;
        color: var(--text-2);
    }
    .queue-remove-btn svg { width: 16px; height: 16px; }

    .queue-item.now-playing {
        background: linear-gradient(90deg, rgba(20,184,166,0.22), rgba(20,184,166,0.04));
        box-shadow: inset 2px 0 0 0 var(--accent);
    }

    .queue-now-tag {
        padding: 5px 10px;
        font-size: 0.62rem;
    }

    .queue-empty { padding: 72px 20px 48px; }
    .queue-empty-icon { width: 84px; height: 84px; }
    .queue-empty-icon svg { width: 52px; height: 52px; }
    .queue-empty-title { font-size: 1.1rem; }
    .queue-empty-sub { font-size: 0.9rem; }
}

/* =========================================================================
   SMALL-PHONE & SHORT-VIEWPORT POLISH
   Tighten the player overlay so controls don't get pushed off-screen.
   ========================================================================= */
@media (max-width: 360px) {
    #player-content { padding: 8px 14px 18px; }
    #player-song-info { margin-bottom: 14px; padding: 0 4px; }
    .ctrl-btn { width: 48px; height: 48px; min-height: 48px; }
    #player-controls { gap: 6px; margin-bottom: 14px; }
    #player-extra-controls { padding: 0 8px; }
    #player-extra-controls .icon-btn { width: 42px; height: 42px; min-width: 42px; min-height: 42px; }
    #mini-player-content { gap: 8px; }
}

@media (max-height: 640px) {
    #vinyl-stage { max-height: 38vh; max-width: 38vh; }
    #player-artwork-wrap { padding: 8px 0; }
    #player-song-info { margin-bottom: 12px; }
    #player-progress { margin-bottom: 10px; }
    #player-controls { margin-bottom: 12px; }
}

/* =========================================================================
   LANDSCAPE: 2-column player layout for short, wide viewports.
   Artwork (or lyrics) on the left, info + controls stacked on the right.
   ========================================================================= */
@media (orientation: landscape) and (max-height: 500px) {
    #player-content {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
        column-gap: 20px;
        padding: 6px 16px 12px;
        overflow: hidden;
        align-content: start;
    }
    #player-header {
        grid-column: 1 / -1;
        padding: 4px 0;
    }
    #player-artwork-wrap {
        grid-column: 1;
        grid-row: 2 / span 4;
        padding: 0;
        align-self: stretch;
        min-height: 0;
    }
    #vinyl-stage {
        width: auto;
        height: 100%;
        max-height: 100%;
        max-width: 100%;
        aspect-ratio: 1;
    }
    #lyrics-panel { grid-column: 1; grid-row: 2 / span 4; }
    #player-song-info {
        grid-column: 2;
        grid-row: 2;
        margin: 0 0 8px;
        padding: 0;
        text-align: left;
    }
    #player-progress {
        grid-column: 2;
        grid-row: 3;
        padding: 0;
        margin: 0 0 4px;
    }
    #player-controls {
        grid-column: 2;
        grid-row: 4;
        margin: 0 0 6px;
        gap: 6px;
    }
    #player-extra-controls {
        grid-column: 2;
        grid-row: 5;
        margin: 0;
        padding: 0;
    }
    .ctrl-btn { width: 44px; height: 44px; min-height: 44px; }
    .ctrl-btn.primary { width: 56px; height: 56px; min-height: 56px; }
}

/* =============================================================
   WIDE-SCREEN PLAYER — three-panel layout (Queue · Player · Lyrics)
   Desktop / large-tablet landscape only. Phones and short viewports
   keep the existing single-column player completely untouched.
   ============================================================= */

/* Hidden on mobile; revealed only inside the wide media query below. */
#player-queue-panel { display: none; }
#lyrics-panel-head { display: none; }

@media (min-width: 1024px) and (min-height: 600px) {
    /* Turn the player into a 3-column grid: queue | player | lyrics.
       Overrides the 900px single-column rule above (later + same specificity). */
    #player-content {
        display: grid;
        grid-template-columns:
            minmax(220px, 320px) minmax(380px, 1fr) minmax(220px, 320px);
        grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
        align-items: center;
        /* Generous gutters between the queue / player / lyrics columns.
           Capped at ~88px and floored at 40px; stays <=51px at the 1024px
           breakpoint so the three min-width columns never overflow. */
        column-gap: clamp(40px, 4.5vw, 88px);
        row-gap: 0;
        max-width: 1480px;
        margin: 0 auto;
        padding: clamp(20px, 4vh, 40px) clamp(24px, 5vw, 64px);
        overflow: hidden;
    }

    /* --- Center column: existing player pieces, in their natural order --- */
    #player-header {
        grid-column: 2; grid-row: 1;
        justify-self: center;
        width: 100%; max-width: 460px;
    }
    #player-artwork-wrap {
        grid-column: 2; grid-row: 2;
        display: flex !important;   /* always visible — never replaced by lyrics here */
        justify-self: center;
        padding: 8px 0;
        min-height: 0;
        width: 100%;
    }
    #player-progress {
        grid-column: 2; grid-row: 3;
        justify-self: center;
        width: 100%; max-width: 460px;
        margin: 6px auto 0;
    }
    #player-song-info {
        grid-column: 2; grid-row: 4;
        justify-self: center;
        width: 100%; max-width: 460px;
        margin: 14px auto 0;
    }
    #player-controls {
        grid-column: 2; grid-row: 5;
        justify-self: center;
        margin: 14px auto 0;
    }
    #player-extra-controls {
        grid-column: 2; grid-row: 6;
        justify-self: center;
        width: 100%; max-width: 340px;
        margin: 12px auto 0;
    }

    #vinyl-stage { max-width: 340px; }

    /* Lyrics are permanently docked on the right, so the toggle is redundant. */
    #btn-lyrics { display: none; }

    /* Defensive: even if the mobile "lyrics replaces artwork" state is set,
       keep the disc visible in the center column on wide screens. */
    #player-content.showing-lyrics #player-artwork-wrap { display: flex !important; }

    /* --- Shared glass chrome for both side rails --- */
    #player-queue-panel,
    #lyrics-panel {
        grid-row: 1 / -1;
        align-self: center;
        height: min(74vh, 560px);
        background: rgba(255, 255, 255, 0.055);
        border: 1px solid rgba(255, 255, 255, 0.09);
        border-radius: 24px;
        backdrop-filter: blur(20px) saturate(1.4);
        -webkit-backdrop-filter: blur(20px) saturate(1.4);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
        overflow: hidden;
    }

    #player-queue-panel {
        grid-column: 1;
        display: flex;
        flex-direction: column;
        padding: 22px 16px;
    }

    #lyrics-panel {
        grid-column: 3;
        /* override base `display:none` and the `.showing-lyrics` toggle */
        display: flex !important;
        flex-direction: column;
        padding: 22px 20px;
        flex: none;          /* base rule sets flex:1; pin to its own height here */
    }

    /* Panel headers ("UP NEXT" / "LYRICS") */
    .side-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 0 6px 14px;
        flex: none;
    }
    #lyrics-panel-head { display: flex; }
    .side-panel-label {
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.55);
    }
    .side-panel-meta {
        font-size: 0.72rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.4);
        white-space: nowrap;
    }

    /* --- Up-next queue list --- */
    #player-queue-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,0.2) transparent;
        -webkit-mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
        mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
    }
    #player-queue-list::-webkit-scrollbar { width: 0; height: 0; }

    .pq-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px;
        border-radius: 14px;
        cursor: pointer;
        transition: background 0.18s ease;
        text-align: left;
    }
    .pq-item:hover { background: rgba(255, 255, 255, 0.07); }
    .pq-item:active { background: rgba(255, 255, 255, 0.12); }
    .pq-item:focus-visible {
        outline: none;
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 0 0 2px rgba(255,255,255,0.18);
    }

    .pq-item.now-playing {
        background: linear-gradient(90deg, rgba(20,184,166,0.18), rgba(20,184,166,0.04));
    }
    .pq-item.now-playing .pq-title { color: var(--accent); }

    .pq-art,
    .pq-art-placeholder {
        width: 46px; height: 46px;
        flex: none;
        border-radius: 10px;
        object-fit: cover;
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    }
    .pq-art-placeholder {
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.5);
    }

    .pq-text { min-width: 0; flex: 1; }
    .pq-title {
        font-size: 0.88rem;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pq-sub {
        font-size: 0.76rem;
        color: rgba(255, 255, 255, 0.5);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 2px;
    }
    .pq-dur {
        flex: none;
        font-size: 0.74rem;
        color: rgba(255, 255, 255, 0.4);
        font-variant-numeric: tabular-nums;
    }
    .pq-empty {
        padding: 26px 12px;
        text-align: center;
        font-size: 0.84rem;
        color: rgba(255, 255, 255, 0.45);
        line-height: 1.5;
    }

    /* --- Lyrics inside the right rail: left-aligned, slightly smaller --- */
    #lyrics-panel #lyrics-list {
        flex: 1;
        padding: 0 4px;
    }
    #lyrics-panel #lyrics-list .lyrics-line {
        text-align: left;
        font-size: 1.05rem;
        padding: 7px 8px;
    }
    #lyrics-panel #lyrics-list .lyrics-line.active { transform: none; }
    #lyrics-panel #lyrics-list .lyrics-line.plain { text-align: left; }
    #lyrics-panel #lyrics-status { padding: 16px 8px; font-size: 0.9rem; }
}

/* Extra-wide screens (large desktops): open the gutters between the queue /
   player / lyrics columns much further. There's ample horizontal room here, so
   the gap is no longer constrained by the 1024px overflow limit above. */
@media (min-width: 1600px) and (min-height: 600px) {
    #player-content {
        column-gap: clamp(110px, 9.5vw, 190px);
        max-width: 1780px;
    }
}

/* =============================================================
   DESKTOP SHELL (>=1024px)
   A sidebar replaces the bottom nav, the fixed chrome is offset to
   clear it, the content column is centered + capped, and the home
   (Library) screen is redesigned into a search top-bar + tile rails
   + an "All Songs" table. Pure enhancement: below 1024px nothing here
   applies, so the mobile layout is untouched. Deliberately gated on
   width only — kept separate from the height-gated wide-player block
   above (which it must not disturb).
   ============================================================= */
@media (min-width: 1024px) {
    /* --- Reveal the sidebar --- */
    #desktop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 240px;
        display: flex;
        flex-direction: column;
        background: var(--surface-2);
        border-right: 1px solid var(--border);
        padding: 16px 12px;
        z-index: 47;             /* above mini-player (42) + nav (45), below overlays (60) */
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* --- Offset the fixed chrome to clear the 240px sidebar. The bottom nav
           is hidden here, so reclaim the bottom inset it reserved (otherwise a
           dead ~60px strip sits below the content + mini-player). --- */
    #app-main { left: 240px; top: 0; bottom: 0; padding: 28px 40px; }
    body.has-mini-player #app-main { bottom: var(--mini-h); }
    #mini-player { left: max(248px, env(safe-area-inset-left)); bottom: 0; }
    #pull-indicator { left: calc(240px + (100vw - 240px) / 2); }

    /* --- The sidebar replaces the bottom nav --- */
    #bottom-nav { display: none; }

    /* --- Collapse the header into a transparent top-right action cluster.
           Preserves the install / offline buttons with zero JS change; when
           both are hidden the box is empty and invisible. --- */
    #app-header {
        left: auto;
        right: 0;
        width: auto;
        height: auto;
        min-height: 0;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: none;
        padding: 14px 24px;
        z-index: 48;             /* sits above the sidebar so the cluster is clickable */
    }
    #app-header::before { display: none; }
    #app-title, #btn-back, #profile-name-badge { display: none; }

    /* --- Center + cap the content column --- */
    #app-main > .screen,
    #app-main > #desktop-page-title,
    #app-main > #status-bar {
        max-width: 1200px;
        margin-inline: auto;
        width: 100%;
    }

    /* ---------------------------------------------------------------
       Sidebar internals
       --------------------------------------------------------------- */
    #desktop-sidebar .ds-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px 18px;
    }
    #desktop-sidebar .ds-logo {
        flex: none;
        width: 32px;
        height: 32px;
        border-radius: 9px;
        background: var(--accent);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    #desktop-sidebar .ds-brand-name {
        font-size: 1.15rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: var(--text);
    }

    #desktop-sidebar .ds-nav {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    #desktop-sidebar .ds-group { margin-bottom: 12px; }
    #desktop-sidebar .ds-group-label {
        font-size: 0.68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-3);
        padding: 6px 12px 4px;
    }

    /* Sidebar buttons: reset the global accent button + the press-scale. The
       theme toggle reuses .more-item/.more-toggle so its switch is styled for
       free; fold it into the same look here. */
    #desktop-sidebar .ds-item,
    #desktop-sidebar .more-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 0;
        margin: 1px 0;
        padding: 9px 12px;
        background: transparent;
        color: var(--text-2);
        border: none;
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        text-align: left;
        transition: background 0.15s, color 0.15s;
    }
    #desktop-sidebar .ds-item:hover,
    #desktop-sidebar .more-item:hover { background: var(--surface-3); color: var(--text); }
    #desktop-sidebar .ds-item:active,
    #desktop-sidebar .more-item:active { transform: none; }
    #desktop-sidebar .ds-item > svg,
    #desktop-sidebar .more-item > svg { flex: none; width: 20px; height: 20px; color: var(--text-3); }
    #desktop-sidebar .ds-item span {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #desktop-sidebar .ds-item.active { background: rgba(20, 184, 166, 0.12); color: var(--accent); }
    #desktop-sidebar .ds-item.active > svg { color: var(--accent); }

    /* Footer: theme toggle + profile */
    #desktop-sidebar .ds-footer {
        border-top: 1px solid var(--border);
        margin-top: 8px;
        padding-top: 10px;
    }
    #ds-theme-toggle .toggle-switch { margin-left: auto; }
    #desktop-sidebar .ds-profile .ds-avatar {
        flex: none;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.82rem;
        font-weight: 700;
    }
    #desktop-sidebar .ds-profile .ds-profile-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--text);
    }

    /* ---------------------------------------------------------------
       Home (Library) top bar — title | search | My/All toggle, one row
       --------------------------------------------------------------- */
    #song-list .toolbar {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 16px;
        margin-bottom: 22px;
    }
    .toolbar-title {
        display: block;
        font-size: 1.75rem;
        font-weight: 800;
        color: var(--text);
    }
    #song-list .toolbar .search-field {
        max-width: 560px;
        margin-inline: auto;
        width: 100%;
    }
    /* Keep "My Songs" / "All Songs" on one line — the grid's auto toggle column
       can size tight enough to break the text at its space otherwise. */
    #song-list .song-list-toggle .toggle-btn { white-space: nowrap; }

    /* Lightweight in-content title for the non-home screens. :not(:empty)
       means the home screen (which sets it to "") shows nothing. */
    #desktop-page-title:not(:empty) {
        display: block;
        font-size: 1.75rem;
        font-weight: 800;
        color: var(--text);
        margin-bottom: 18px;
    }

    /* ---------------------------------------------------------------
       Tiles (Recently Played / Added) — flat art+title with hover-lift
       --------------------------------------------------------------- */
    #song-list .chip-scroll { margin: 0; gap: 16px; scroll-padding-inline: 0; }
    #song-list .chip-scroll::before,
    #song-list .chip-scroll::after { content: none; }
    #song-list .chip { width: 150px; background: transparent; padding: 0; }
    #song-list .chip:active { transform: none; background: transparent; }
    #song-list .chip-art { transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out); }
    #song-list .chip:hover .chip-art { transform: translateY(-4px); box-shadow: var(--shadow); }

    /* ---------------------------------------------------------------
       "All Songs" grid table. Each row is its own grid; identical fixed
       column tracks (and the matching header row) make every column line
       up across the independent row grids.
       --------------------------------------------------------------- */
    #song-list-content { background: transparent; border-radius: 0; overflow: visible; }

    .song-list-head {
        display: grid;
        grid-template-columns: 48px 1fr 230px 90px 90px;
        column-gap: 14px;
        align-items: center;
        padding: 0 16px 8px;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-3);
        border-bottom: 1px solid var(--border);
        margin-bottom: 2px;
    }
    .song-list-head .r { text-align: right; }
    /* Drop the column header when the library list isn't what's shown:
       YouTube search with no local matches (content hidden), or an empty
       library. Scoped to #song-list-content's OWN empty state so a YouTube
       "no results" empty-state inside .song-list-wrap doesn't hide it. */
    .song-list-wrap:has(> #song-list-content.hidden) .song-list-head,
    .song-list-wrap:has(> #song-list-content > .empty-state) .song-list-head { display: none; }

    .song-list-row {
        position: relative;
        display: grid;
        grid-template-columns: 48px 1fr 230px 90px 90px;
        align-items: center;
        column-gap: 14px;
        padding: 8px 16px;
        min-height: 56px;
    }
    .song-list-row:hover { background: var(--surface-2); }
    .song-list-row .song-list-thumb { width: 40px; height: 40px; }
    .song-list-row .song-list-info { grid-column: 2; min-width: 0; }
    .song-list-row .song-list-meta { display: none; }
    .song-list-row .col-artist,
    .song-list-row .col-plays,
    .song-list-row .col-size {
        display: block;
        font-size: 0.84rem;
        color: var(--text-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-variant-numeric: tabular-nums;
    }
    .song-list-row .col-artist { grid-column: 3; }
    .song-list-row .col-plays { grid-column: 4; text-align: right; }
    .song-list-row .col-size { grid-column: 5; text-align: right; }
    /* Keep the offline dot + hover action button out of the grid flow so a
       row can never wrap to a second line. */
    .song-list-row .offline-dot { position: absolute; left: 50px; top: 8px; margin: 0; }
    .song-list-row .song-icon-btn {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        opacity: 0;
        transition: opacity 0.15s;
    }
    .song-list-row:hover .song-icon-btn { opacity: 1; }
    .song-list-row.now-playing { padding-left: 13px; }   /* 16px - 3px accent border */

    /* Letter headers stay sticky; align with the 16px row gutter. */
    .song-section-header { padding-left: 16px; }
}
