/*
 * Mobile player height (must match .player-bar-grid on < lg):
 * meta row + seek + transport + padding + safe area.
 */
:root {
    --app-player-inset-mobile: calc(9rem + env(safe-area-inset-bottom, 0px));
}
body { background: #121212; color: #fff; }
.spotify-green { color: #1DB954; }
.nav-active { background: #282828; }
.track-row:hover { background: #282828; }
.track-row-playing { background: #282828; box-shadow: inset 3px 0 0 #1DB954; }
.track-row--playable { cursor: pointer; -webkit-tap-highlight-color: rgba(255, 255, 255, 0.06); }
@media (hover: none) {
    .track-row--playable:active { background: #282828; }
}
.track-index-slot .track-row-index,
.track-index-slot .track-play--row {
    transition: opacity 0.12s ease;
}
/* Index column: play overlays index in a fixed h-8 w-8 slot (no layout shift). */
.track-index-slot .track-play--row {
    opacity: 0;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .track-row:has(.track-index-slot):hover .track-index-slot .track-row-index {
        opacity: 0;
    }
    .track-row:has(.track-index-slot):hover .track-index-slot .track-play--row {
        opacity: 1;
        pointer-events: auto;
    }
}
.track-index-slot .track-play--row:focus-visible {
    opacity: 1;
    pointer-events: auto;
}
.track-row:has(.track-index-slot .track-play--row:focus-visible) .track-index-slot .track-row-index {
    opacity: 0;
}
.track-row-like {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, color 0.12s ease;
}
.track-row-like--on,
.track-row-like--on:hover {
    opacity: 1;
    pointer-events: auto;
    color: #1DB954;
}
@media (hover: hover) and (pointer: fine) {
    .track-row:hover .track-row-like,
    .home-song-row:hover .track-row-like {
        opacity: 1;
        pointer-events: auto;
    }
}
.track-row-like:focus-visible {
    opacity: 1;
    pointer-events: auto;
}
.search-input {
    background: #242424;
    border: 1px solid #3E3E3E;
}
.search-input:focus {
    border-color: #1DB954;
    outline: none;
}
.playlist-card {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.playlist-card:hover {
    background: #282828;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
#global-search-panel {
    height: calc(100vh - 4rem - var(--app-player-inset-mobile));
    min-height: 0;
    overflow: hidden;
}
#global-search-list {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
@media (min-width: 1024px) {
    #global-search-panel {
        height: calc(100vh - 4rem - 5.25rem);
    }
}
#player-seek, #player-volume {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #4d4d4d;
    border-radius: 2px;
    pointer-events: auto;
}
.player-seek-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 16px;
}
#player-seek-loaded {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
    background: #4d4d4d;
}
#player-seek-loaded .player-seek-buf {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #7a7a7a;
}
#player-seek-loaded .player-seek-played {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    background: #1DB954;
}
#player-seek {
    display: block;
    min-height: 16px;
    margin: -6px 0;
    padding: 6px 0;
    background: transparent;
    background-clip: content-box;
    cursor: pointer;
    position: relative;
    z-index: 2;
}
#player-seek::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
    border-radius: 2px;
}
#player-seek::-moz-range-track {
    height: 4px;
    background: transparent;
    border: 0;
    border-radius: 2px;
}
#player-seek::-moz-range-progress {
    background: transparent;
}
#player-seek::-webkit-slider-thumb, #player-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -4px;
}
#player-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}
#player-seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}
#player-volume {
    width: 6rem;
    min-width: 6rem;
    max-width: 6rem;
    height: 3px;
    flex: 0 0 6rem;
}
#player-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
#player-volume::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}
#lyrics-panel .lyrics-panel-inner {
    position: relative;
    padding: 0;
    height: 100%;
    box-sizing: border-box;
    background: transparent;
    overflow: hidden;
}
#lyrics-paper-host,
#lyrics-wave-canvas,
#lyrics-milk-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
#lyrics-paper-host {
    overflow: hidden;
}
#lyrics-milk-canvas {
    z-index: 0;
    opacity: 0.85;
}
#lyrics-panel .lyrics-panel-header,
#lyrics-read-row,
#lyrics-edit-wrap {
    position: relative;
    z-index: 1;
}
#lyrics-panel .lyrics-panel-header {
    padding: 1rem 1.25rem 0.75rem;
}
#lyrics-edit-wrap {
    padding: 0 1.25rem 0.75rem;
}

#lyrics-mode-switch {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.1);
}

.lyrics-visualizer-mode {
    max-width: 7.5rem;
    height: 1.75rem;
    padding: 0 0.45rem;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

#lyrics-mobile-view-switch {
    display: none;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.1);
}

#lyrics-panel .lyrics-tab {
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
}

#lyrics-panel {
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
#lyrics-read-row {
    --lyrics-video-gap: 1rem;
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
#lyrics-view-wrap {
    position: relative;
    padding-left: 1.25rem;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    background: transparent;
}
#lyrics-view-wrap::before,
#lyrics-view-wrap::after {
    display: none;
}
@media (min-width: 1024px) {
    #lyrics-panel {
        left: 20rem !important;
        right: 0 !important;
    }
}
#lyrics-panel {
    --lyrics-text-color: #e5e5e5;
    --lyrics-bg-color: #121212;
}
#lyrics-panel #lyrics-body {
    color: var(--lyrics-text-color);
    text-align: left;
    padding: 1.5rem 1rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
    background: transparent;
}
#lyrics-panel .lyrics-line {
    cursor: pointer;
    padding: 0.5rem 0.5rem;
    margin: 0.2rem 0;
    transition: color 0.25s ease, transform 0.25s ease;
    font-size: 1.4em;
    color: rgba(255, 255, 255, 0.45);
    transform: scale(1);
    text-align: left;
    border-radius: 0.5rem;
    line-height: 1.4;
    transform-origin: left center;
    background: transparent;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}
#lyrics-panel .lyrics-line.wrap {
    white-space: normal;
    overflow-wrap: break-word;
    max-width: 86%;
}
#lyrics-panel .lyrics-line.nowrap {
    white-space: nowrap;
    overflow: visible;
}
#lyrics-panel .lyrics-line:hover {
    color: rgba(255, 255, 255, 0.8);
}
#lyrics-panel .lyrics-line.active {
    font-weight: 700;
    color: #ffffff;
    transform: scale(1.15);
}
#lyrics-panel .lyrics-line--static {
    cursor: default;
}
#lyrics-panel .lyrics-chapter {
    margin: 0.15rem 0;
}
#lyrics-panel .lyrics-chapter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
#lyrics-panel .lyrics-chapter-row .lyrics-line {
    flex: 1;
    min-width: 0;
    margin: 0.1rem 0;
    overflow: hidden;
    transform: none !important;
}
#lyrics-panel .lyrics-chapter-row .lyrics-line.active {
    transform: none !important;
}
#lyrics-panel .lyrics-chapter-load-btn {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: none;
    border: 0;
    padding: 0.15rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #1DB954;
    cursor: pointer;
    white-space: nowrap;
}
#lyrics-panel .lyrics-chapter-load-btn:hover {
    color: #1ed760;
}
#lyrics-panel .lyrics-chapter-panel {
    padding: 0.25rem 0.5rem 0.75rem 0.75rem;
}
#lyrics-panel .lyrics-chapter-verse {
    text-align: left;
    padding: 0.15rem 0 0.35rem 0.35rem;
}
#lyrics-panel .lyrics-line--verse {
    font-size: 1.05em;
    padding: 0.28rem 0.4rem;
    margin: 0.06rem 0;
    transform-origin: left center;
}
#lyrics-panel .lyrics-line--verse.active {
    transform: scale(1.08);
}
#lyrics-panel p[id$="-hint"] strong {
    opacity: 0.85;
}
#lyrics-panel #lyrics-editor {
    color: var(--lyrics-text-color);
    background-color: rgba(255,255,255,0.05);
}
#lyrics-panel .lrc-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem 0;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
}
#lyrics-panel .lrc-line:hover {
    background-color: rgba(255,255,255,0.05);
}
#lyrics-panel .lrc-timestamp {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: #1DB954;
    background: rgba(29, 185, 84, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    min-width: 4.5rem;
    text-align: center;
}
#lyrics-panel .lrc-timestamp:hover {
    background: rgba(29, 185, 84, 0.25);
}
#lyrics-panel .lrc-ts-adj-btn {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    background: rgba(255,255,255,0.1);
    color: #B3B3B3;
    border: none;
    border-radius: 0.2rem;
    text-align: center;
    cursor: pointer;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
#lyrics-panel .lrc-line:hover .lrc-ts-adj-btn {
    opacity: 1;
}
#lyrics-panel .lrc-ts-adj-btn:hover {
    background: rgba(29, 185, 84, 0.3);
    color: #fff;
}
#lyrics-panel .lrc-shift-btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.08);
    color: #B3B3B3;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}
#lyrics-panel .lrc-shift-btn:hover {
    background: rgba(29, 185, 84, 0.25);
    color: #fff;
}
#lyrics-panel .lrc-text {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--lyrics-text-color);
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    outline: none;
}
#lyrics-panel .lrc-text:focus {
    background: rgba(255,255,255,0.08);
    border-radius: 0.25rem;
}
#lyrics-panel .lrc-delete-btn {
    opacity: 0;
    color: #B3B3B3;
    cursor: pointer;
    padding: 0.25rem;
    transition: opacity 0.15s ease, color 0.15s ease;
}
#lyrics-panel .lrc-line:hover .lrc-delete-btn {
    opacity: 1;
}
#lyrics-panel .lrc-delete-btn:hover {
    color: #ff4444;
}
/* Insert-gap between LRC lines: full-width clickable area */
#lrc-lines-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
#lyrics-panel .lrc-insert-gap {
    height: 0.25rem;
    cursor: pointer;
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 0.375rem 0;
    margin: -0.1875rem 0;
    background-clip: content-box;
}
#lyrics-panel .lrc-insert-gap::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(29, 185, 84, 0);
    transform: scaleX(0);
    transition: background-color 0.15s ease, transform 0.15s ease;
    z-index: 1;
    pointer-events: none;
}
#lyrics-panel .lrc-insert-gap::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    border-radius: 50%;
    background: rgba(29, 185, 84, 0.2);
    color: #1DB954;
    font-size: 0.65rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 2;
    pointer-events: none;
}
#lyrics-panel .lrc-insert-gap:hover::before {
    background: rgba(29, 185, 84, 0.25);
    transform: scaleX(1);
}
#lyrics-panel .lrc-insert-gap:hover::after {
    opacity: 1;
}
#lyrics-panel .lrc-insert-gap:active::after {
    background: rgba(29, 185, 84, 0.4);
    color: #fff;
}
#lrc-lines-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
/* Use CSS variables set by JS so colors adapt to dark/light backgrounds */
#lyrics-panel .lyrics-line {
    color: var(--lyrics-line-dim-color, rgba(255,255,255,0.45)) !important;
}
#lyrics-panel .lyrics-line:hover {
    color: var(--lyrics-line-hover-color, rgba(255,255,255,0.75)) !important;
}
#lyrics-panel .lyrics-line.active {
    color: var(--lyrics-text-color, #ffffff) !important;
}
#lyrics-panel #lyrics-edit-disabled {
    color: var(--lyrics-text-color);
}
#lyrics-panel #lyrics-title {
    color: var(--lyrics-text-color);
}
#lyrics-view-wrap,
#lyrics-edit-wrap {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
#lyrics-read-row {
    --lyrics-video-gap: 1rem;
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
#lyrics-read-row.hidden {
    display: none;
}
#lyrics-read-row:has(#lyrics-video-pane:not(.hidden)) #lyrics-view-wrap {
    height: 100%;
    margin-right: calc(40% + (2 * var(--lyrics-video-gap)));
    z-index: 1;
}
#lyrics-video-pane:not(.hidden) {
    position: absolute;
    top: 0;
    right: var(--lyrics-video-gap);
    bottom: 0;
    width: 40%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    cursor: default;
}
#lyrics-video-pane.is-loaded {
    background: transparent;
    cursor: default;
}
#lyrics-video-pane .lyrics-video-stack {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
}
#lyrics-video-pane .lyrics-video-load,
#lyrics-video-pane .lyrics-video-el {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
#lyrics-video-pane .lyrics-video-load {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: #2a2a2a;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
#lyrics-video-pane.is-loaded .lyrics-video-load {
    display: none;
}
#lyrics-video-pane .lyrics-video-load:hover {
    background: #333;
}
#lyrics-video-pane .lyrics-video-el.hidden {
    display: none;
}
#lyrics-video-pane .lyrics-video-el {
    z-index: 2;
    display: block;
    object-fit: contain;
    background: #000;
    pointer-events: none;
    overflow: hidden;
}
#lyrics-video-pane .lyrics-video-hide {
    display: none;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 4;
    border: 0;
    border-radius: 9999px;
    padding: 0.35rem 0.75rem;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}
#lyrics-video-pane.is-loaded .lyrics-video-hide:not(.hidden) {
    display: block;
}
#lyrics-video-pane .lyrics-video-hide:hover {
    background: rgba(0, 0, 0, 0.88);
}
#lyrics-video-pane .lyrics-video-fs {
    display: none;
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    z-index: 4;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
#lyrics-video-pane.is-loaded .lyrics-video-fs:not(.hidden) {
    display: flex;
}
#lyrics-video-pane .lyrics-video-fs:hover {
    background: rgba(0, 0, 0, 0.88);
}
#lyrics-video-stack:fullscreen,
#lyrics-video-stack:-webkit-full-screen {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    background: #000;
    border-radius: 0;
}

@media (max-width: 1023px) {
    #lyrics-panel .lyrics-panel-header {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    #lyrics-panel .lyrics-header-main,
    #lyrics-panel .lyrics-header-controls {
        flex-basis: 100%;
    }
    #lyrics-panel .lyrics-header-controls {
        width: 100%;
        justify-content: space-between;
    }
    #lyrics-panel #lyrics-mode-switch {
        margin-left: auto;
    }
    #lyrics-panel #lyrics-mobile-view-switch:not(.hidden) {
        display: inline-flex;
    }
    #lyrics-panel #lyrics-mobile-view-switch:not(.hidden) + #lyrics-mode-switch {
        margin-left: 0;
    }
    #lyrics-panel .lyrics-tab {
        padding: 0.3rem 0.65rem;
        font-size: 0.7rem;
    }
    #lyrics-panel #lyrics-view-wrap {
        padding-left: 0;
    }
    #lyrics-panel #lyrics-body {
        width: calc(100% - 2rem);
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        text-align: left;
    }
    #lyrics-panel .lyrics-line {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        text-align: left;
        transform-origin: left center;
    }
    #lyrics-panel .lyrics-line.wrap {
        max-width: 100%;
    }
    #lyrics-read-row:has(#lyrics-video-pane:not(.hidden)) #lyrics-view-wrap {
        margin-right: 0;
    }
    #lyrics-read-row #lyrics-video-pane:not(.hidden) {
        display: none;
    }
    #lyrics-read-row.mobile-video-active #lyrics-view-wrap {
        display: none;
    }
    #lyrics-read-row.mobile-video-active #lyrics-video-pane:not(.hidden) {
        position: relative;
        top: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

#player-cover-wrap.no-art #player-cover { display: none; }
#player-cover-wrap.no-art #player-cover-fallback { display: flex; }
#player-cover-fallback { display: none; }
.player-control-btn--active { color: #1DB954 !important; }
.player-control-btn--muted { color: #727272; }

#player-repeat-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
#player-repeat-one-badge {
    position: absolute; bottom: 2px; right: 2px; font-size: 8px; font-weight: 800;
    line-height: 1; color: #121212; background: #1DB954; border-radius: 2px; padding: 0 2px;
    pointer-events: none;
}
/* Playlist 2×2 art: fill each cell, crop to square (overrides img { height: auto } preflight). */
.playlist-art-grid__cell {
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}
.playlist-art-grid__cell > img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
}
/* Home: stats, story carousel and rails (do not rely on Tailwind JIT for JS/home-only utilities). */
#playlist-scroll-root:has(#home-top-playlists) {
    padding-top: 1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
#home-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #282828;
}
.home-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
}
.home-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
@media (min-width: 1024px) {
    .home-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.home-stat {
    border-radius: 0.5rem;
    background: #181818;
    padding: 0.75rem 0.875rem;
    min-width: 0;
}
.home-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #727272;
}
.home-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-top: 0.25rem;
}
.home-stat-meta {
    font-size: 0.6875rem;
    color: #B3B3B3;
    margin-top: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.home-story-track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.home-story-track::-webkit-scrollbar { display: none; }
.home-story-card {
    position: relative;
    flex: 0 0 auto;
    width: min(78vw, 15rem);
    aspect-ratio: 4 / 5;
    scroll-snap-align: start;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    color: #fff;
    background: #282828;
}
.home-story-card:nth-child(5n+1) { background: linear-gradient(160deg, #1DB954 0%, #0b3d22 100%); }
.home-story-card:nth-child(5n+2) { background: linear-gradient(160deg, #8e44ad 0%, #2c0f3d 100%); }
.home-story-card:nth-child(5n+3) { background: linear-gradient(160deg, #e67e22 0%, #3d1f05 100%); }
.home-story-card:nth-child(5n+4) { background: linear-gradient(160deg, #2980b9 0%, #0a2233 100%); }
.home-story-card:nth-child(5n+5) { background: linear-gradient(160deg, #c0392b 0%, #330d09 100%); }
.home-story-card--empty { background: #181818 !important; color: #727272; }
.home-story-kicker {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}
.home-story-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
}
.home-story-meta {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 0.375rem;
}
.home-story-art {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}
.home-story-art img { width: 100%; height: 100%; object-fit: cover; }
.home-story-controls { display: flex; gap: 0.5rem; }
.home-story-btn {
    height: 1.75rem;
    width: 1.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #282828;
    color: #fff;
    font-size: 0.6875rem;
}
.home-story-btn:hover { background: #3E3E3E; }
.home-story-btn:disabled { opacity: 0.35; cursor: default; }
.home-story-dots { display: flex; gap: 0.375rem; margin-top: 0.625rem; }
.home-story-dot {
    height: 0.375rem;
    width: 0.375rem;
    border-radius: 9999px;
    background: #3E3E3E;
    transition: width 0.2s, background 0.2s;
}
.home-story-dot--active { width: 1.25rem; background: #1DB954; }
.home-rail {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.home-rail::-webkit-scrollbar { display: none; }
.home-rail > a {
    flex: 0 0 auto;
    width: 8.5rem;
    scroll-snap-align: start;
    position: relative;
}
.home-rank {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    z-index: 1;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.home-song-count {
    font-size: 0.6875rem;
    color: #727272;
    font-variant-numeric: tabular-nums;
}
.home-song-bar {
    height: 3px;
    border-radius: 9999px;
    background: #282828;
    overflow: hidden;
    margin-top: 0.375rem;
}
.home-song-bar > span {
    display: block;
    height: 100%;
    background: #1DB954;
    border-radius: 9999px;
}
/* ── Playlists: docked sidebar on lg+; slide-over sheet on smaller screens. Downloads + queue: right sheets. ── */
#mobile-nav-backdrop.mobile-sheet-backdrop,
#mobile-dl-backdrop.mobile-sheet-backdrop,
#mobile-queue-backdrop.mobile-sheet-backdrop {
    display: none;
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    z-index: 44;
    background: rgba(0, 0, 0, 0.5);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
@media (max-width: 1023px) {
    #mobile-nav-backdrop.mobile-sheet-backdrop,
    #mobile-dl-backdrop.mobile-sheet-backdrop,
    #mobile-queue-backdrop.mobile-sheet-backdrop {
        bottom: var(--app-player-inset-mobile);
    }
    body.mobile-nav-open #mobile-nav-backdrop { display: block; }
}
@media (min-width: 1024px) {
    #mobile-nav-backdrop.mobile-sheet-backdrop,
    #mobile-dl-backdrop.mobile-sheet-backdrop,
    #mobile-queue-backdrop.mobile-sheet-backdrop {
        bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }
}
body.mobile-dl-open #mobile-dl-backdrop { display: block; }
body.mobile-queue-open #mobile-queue-backdrop { display: block; }

#sidebar-playlists {
    position: fixed;
    z-index: 45;
    top: 4rem;
    left: 0;
    width: min(20rem, 90vw);
    max-width: 90vw;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
    border-right: 1px solid #282828;
}
@media (max-width: 1023px) {
    #sidebar-playlists {
        bottom: var(--app-player-inset-mobile);
    }
    body.mobile-nav-open #sidebar-playlists {
        transform: translateX(0);
    }
}
@media (min-width: 1024px) {
    #sidebar-playlists {
        position: relative;
        top: auto;
        left: auto;
        bottom: auto;
        width: 20rem;
        max-width: none;
        flex-shrink: 0;
        transform: none;
        transition: none;
        box-shadow: none;
        z-index: 45;
        align-self: stretch;
        min-height: 0;
    }
    /* Playlist open/close controls are mobile-only (Tailwind lg:hidden may be missing if app.css is stale). */
    #mobile-open-nav,
    #mobile-close-nav {
        display: none !important;
    }
}

#sidebar-downloads {
    position: fixed;
    z-index: 45;
    top: 4rem;
    right: 0;
    width: min(20rem, 92vw);
    max-width: 92vw;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
    border-left: 1px solid #282828;
}
@media (max-width: 1023px) {
    #sidebar-downloads {
        bottom: var(--app-player-inset-mobile);
    }
    #sidebar-downloads .dl-drawer-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}
@media (min-width: 1024px) {
    #sidebar-downloads {
        bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }
}
body.mobile-dl-open #sidebar-downloads {
    transform: translateX(0);
}

/* Playback queue: same right drawer pattern as downloads */
#sidebar-queue {
    position: fixed;
    z-index: 45;
    top: 4rem;
    right: 0;
    width: min(20rem, 92vw);
    max-width: 92vw;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
    border-left: 1px solid #282828;
}
@media (max-width: 1023px) {
    #sidebar-queue {
        bottom: var(--app-player-inset-mobile);
    }
    #sidebar-queue .queue-drawer-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}
@media (min-width: 1024px) {
    #sidebar-queue {
        bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }
}
body.mobile-queue-open #sidebar-queue {
    transform: translateX(0);
}
#sidebar-queue #queue-list {
    min-height: 0;
}
#sidebar-queue .queue-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: #e5e5e5;
    transition: background-color 0.15s ease;
}
#sidebar-queue .queue-row:hover {
    background-color: #282828;
}
#sidebar-queue .queue-row--current {
    background-color: rgba(29, 185, 84, 0.12);
    color: #fff;
}
#sidebar-queue .queue-row--current .queue-row-title {
    color: #1ed760;
}
#sidebar-queue .queue-thumb-wrap {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.25rem;
    overflow: hidden;
    background-color: #282828;
}
#sidebar-queue .queue-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Player: mobile = no volume, stacked meta + mid; desktop = one row with volume. */
.player-bar-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
        "pb-meta pb-vol"
        "pb-mid pb-mid";
    gap: 0.35rem 0.5rem;
    align-items: center;
    padding: 0.5rem 0.65rem 0.65rem;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    min-height: 5.25rem;
    box-sizing: border-box;
}
@media (max-width: 1023px) {
    .player-bar-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
            "pb-meta"
            "pb-mid";
        gap: 0.5rem 0;
        padding: 0.5rem 0.75rem 0.5rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        min-height: 0;
        background: #000000;
        border-top-color: #1a1a1a;
    }
    .player-bar-grid .pb-mid {
        gap: 0.5rem;
    }
    #player-bar.player-bar-grid {
        background: #000000;
        border-top-color: #1a1a1a;
    }
    .player-bar-grid .pb-vol {
        display: none !important;
    }
    .player-seek-row {
        max-width: none !important;
        margin: 0 !important;
    }
}
.player-bar-grid .pb-meta { grid-area: pb-meta; min-width: 0; }
@media (min-width: 1024px) {
    .player-bar-grid .pb-meta {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }
}
.player-bar-grid .pb-mid {
    grid-area: pb-mid;
    min-width: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.player-bar-grid .pb-vol {
    grid-area: pb-vol;
    min-width: 0;
    max-width: 9.5rem;
    justify-self: end;
}
@media (min-width: 1024px) {
    .player-bar-grid {
        grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 240px);
        grid-template-rows: 1fr;
        grid-template-areas: "pb-meta pb-mid pb-vol";
        gap: 1rem;
        height: 5.25rem;
        min-height: 0;
        padding: 0 1rem env(safe-area-inset-bottom, 0);
        left: 20rem;
    }
    .player-bar-grid .pb-mid {
        align-self: stretch;
        padding: 0.25rem 0;
    }
    .player-bar-grid .pb-vol {
        max-width: none;
        justify-self: stretch;
    }
    #player-bar.player-bar-grid {
        background: #181818;
        border-top-color: #282828;
    }
}
/* Queue: mobile = bottom util row; desktop = next to lyrics in pb-vol */
#btn-queue-desktop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#btn-queue-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (min-width: 1024px) {
    #btn-queue-mobile {
        display: none !important;
    }
}
/* Like: transport row on desktop only (mobile uses #player-like-meta) */
.player-like--desktop {
    display: none;
    align-items: center;
    justify-content: center;
}
@media (min-width: 1024px) {
    .player-like--desktop {
        display: inline-flex;
    }
}

.quality-tier-btn {
    color: #b3b3b3;
    background: #3e3e3e;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.quality-tier-btn:hover {
    color: #fff;
    background: #4a4a4a;
}
.quality-tier-btn--active {
    color: #000;
    background: #1db954;
    border-color: #1db954;
}
.quality-tier-btn--active:hover {
    color: #000;
    background: #1ed760;
}

.settings-sections > .settings-section + .settings-section {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid #3e3e3e;
}

.settings-section .quality-tier-group {
    gap: 0.5rem;
}
