/* stylelint-disable no-descending-specificity */
:root {
    color-scheme: light dark;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Layout */
    --radius: 1rem;

    /* Lumina-inspired large rounded corners */
    --radius-sm: 0.75rem;
    --radius-full: 9999px;
    --player-bar-height-desktop: 90px;
    --player-bar-height-mobile: 130px;

    /* Animations & Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --transition: var(--transition-normal);

    /* Fallback */

    /* Shadows (layered for depth) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-glow: 0 0 15px var(--highlight-rgb);
    --cover-filter: blur(50px) brightness(0.4);
}

:root[data-theme='monochrome'] {
    color-scheme: dark;

    --background: #000;
    --foreground: #fafafa;
    --card: #111;
    --card-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #111;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --border: #27272a;
    --input: #27272a;
    --ring: #fafafa;
    --highlight: #fff;
    --highlight-rgb: 255, 255, 255;
    --active-highlight: var(--highlight);
    --explicit-badge: #fafafa;
}

:root[data-theme='dark'] {
    color-scheme: dark;

    --background: #09090b;
    --foreground: #fafafa;
    --card: #111113;
    --card-foreground: #fafafa;
    --primary: #6366f1;
    --primary-foreground: #fff;
    --secondary: #18181b;
    --secondary-foreground: #fafafa;
    --muted: #18181b;
    --muted-foreground: #71717a;
    --border: rgba(255, 255, 255, 0.06);
    --input: #18181b;
    --ring: #6366f1;
    --highlight: #6366f1;
    --highlight-rgb: 99, 102, 241;
    --active-highlight: #6366f1;
    --explicit-badge: #750a0a;
}

:root[data-theme='ocean'] {
    color-scheme: dark;

    --background: #0c1821;
    --foreground: #e0f4ff;
    --card: #1b2838;
    --card-foreground: #e0f4ff;
    --primary: #06b6d4;
    --primary-foreground: #0c1821;
    --secondary: #1e3a52;
    --secondary-foreground: #e0f4ff;
    --muted: #1e3a52;
    --muted-foreground: #94c5e0;
    --border: #1e3a52;
    --input: #1e3a52;
    --ring: #06b6d4;
    --highlight: #06b6d4;
    --highlight-rgb: 6, 182, 212;
    --active-highlight: #06b6d4;
    --explicit-badge: #f43f5e;
}

:root[data-theme='purple'] {
    color-scheme: dark;

    --background: #0f0514;
    --foreground: #f3e8ff;
    --card: #1e0a2e;
    --card-foreground: #f3e8ff;
    --primary: #a855f7;
    --primary-foreground: #fff;
    --secondary: #2d1545;
    --secondary-foreground: #f3e8ff;
    --muted: #2d1545;
    --muted-foreground: #c4b5fd;
    --border: #2d1545;
    --input: #2d1545;
    --ring: #a855f7;
    --highlight: #a855f7;
    --highlight-rgb: 168, 85, 247;
    --active-highlight: #a855f7;
    --explicit-badge: #ec4899;
}

:root[data-theme='forest'] {
    color-scheme: dark;

    --background: #0a1409;
    --foreground: #e8f5e9;
    --card: #1a2e1a;
    --card-foreground: #e8f5e9;
    --primary: #22c55e;
    --primary-foreground: #0a1409;
    --secondary: #2d4a2d;
    --secondary-foreground: #e8f5e9;
    --muted: #2d4a2d;
    --muted-foreground: #86efac;
    --border: #2d4a2d;
    --input: #2d4a2d;
    --ring: #22c55e;
    --highlight: #22c55e;
    --highlight-rgb: 34, 197, 94;
    --active-highlight: #22c55e;
    --explicit-badge: #f59e0b;
}

:root[data-theme='mocha'] {
    color-scheme: dark;

    --background: #1e1e2e;
    --foreground: #cdd6f4;
    --card: #313244;
    --card-foreground: #9399b2;
    --primary: #89b4fa;
    --primary-foreground: #313244;
    --secondary: #45475a;
    --secondary-foreground: #9399b2;
    --muted: #313244;
    --muted-foreground: #a6adc8;
    --border: #313244;
    --input: #45475a;
    --ring: #89b4fa;
    --highlight: #89b4fa;
    --highlight-rgb: #b4befe;
    --active-highlight: #b4befe;
    --explicit-badge: #f9e2af;
}

:root[data-theme='machiatto'] {
    color-scheme: dark;

    --background: #24273a;
    --foreground: #cad3f5;
    --card: #363a4f;
    --card-foreground: #939ab7;
    --primary: #8aadf4;
    --primary-foreground: #363a4f;
    --secondary: #494d64;
    --secondary-foreground: #6e738d;
    --muted: #363a4f;
    --muted-foreground: #a5adcb;
    --border: #363a4f;
    --input: #494d64;
    --ring: #8aadf4;
    --highlight: #8aadf4;
    --highlight-rgb: #b7bdf8;
    --active-highlight: #b7bdf8;
    --explicit-badge: #eed49f;
}

:root[data-theme='frappe'] {
    color-scheme: dark;

    --background: #303446;
    --foreground: #c6d0f5;
    --card: #414559;
    --card-foreground: #949cbb;
    --primary: #8caaee;
    --primary-foreground: #313244;
    --secondary: #51576d;
    --secondary-foreground: #a5adce;
    --muted: #414559;
    --muted-foreground: #a5adce;
    --border: #414559;
    --input: #45475a;
    --ring: #8caaee;
    --highlight: #8caaee;
    --highlight-rgb: #babbf1;
    --active-highlight: #babbf1;
    --explicit-badge: #e5c890;
}

:root[data-theme='latte'] {
    color-scheme: light;

    --background: #eff1f5;
    --foreground: #4c4f69;
    --card: #ccd0da;
    --card-foreground: #7c7f93;
    --primary: #1e66f5;
    --primary-foreground: #ccd0da;
    --secondary: #bcc0cc;
    --secondary-foreground: #9ca0b0;
    --muted: #ccd0da;
    --muted-foreground: #6c6f85;
    --border: #ccd0da;
    --input: #bcc0cc;
    --ring: #1e66f5;
    --highlight: #1e66f5;
    --highlight-rgb: #7287fd;
    --active-highlight: #7287fd;
    --explicit-badge: #df8e1d;
}

:root[data-theme='light'] {
    color-scheme: light;

    --background: #fff;
    --foreground: #000;
    --card: #f4f4f5;
    --card-foreground: #000;
    --primary: #2563eb;
    --primary-foreground: #fff;
    --secondary: #e4e4e7;
    --secondary-foreground: #000;
    --muted: #e4e4e7;
    --muted-foreground: #62626a;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #2563eb;
    --highlight: #2563eb;
    --highlight-rgb: 37, 99, 235;
    --active-highlight: var(--highlight);
    --explicit-badge: #f58a8a;
    --cover-filter: blur(50px) brightness(1.6) opacity(0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    overflow: hidden;
    max-width: 100%;
    overscroll-behavior-y: contain;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: 'DM Sans', Inter, sans-serif;
    overflow: hidden;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
    height: 100%;
    position: fixed;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    letter-spacing: -0.01em;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, [contenteditable="true"], .copyable, pre, code {
    -webkit-user-select: text;
    user-select: text;
}


/* Lumina ambient glow effects */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
}

body::before {
    top: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    background: #7c3aed;
    filter: blur(100px);
}

body::after {
    bottom: -120px;
    left: -120px;
    width: 400px;
    height: 400px;
    background: #6366f1;
    filter: blur(100px);
}

img {
    max-width: 100%;
    display: block;
    background-color: var(--muted);
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

.text-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.text-link:hover {
    color: var(--highlight);
}

kbd {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    box-shadow: 0 2px 4px rgb(0, 0, 0, 0.1);
}

.app-container {
    display: grid;
    height: 100vh;
    height: 100dvh;
    max-width: 100%;
    overflow-x: hidden;
    grid-template:
        'sidebar main' 1fr
        'player player' auto / 210px 1fr;
}

.sidebar {
    grid-area: sidebar;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    position: relative;
}

:root[data-theme='light'] .sidebar {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-nav.main {
    flex: 1;
}

.main-content {
    grid-area: main;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    padding: var(--spacing-xl);
    scroll-behavior: auto;
    position: relative;
    z-index: 1;

    /* Add padding when now-playing-bar is visible to prevent overlap */
    padding-bottom: var(--spacing-xl) !important;
}

/* Add extra padding when now-playing-bar is visible (desktop) */
body:has(.now-playing-bar.npb-visible) .main-content {
    padding-bottom: calc(var(--player-bar-height-desktop) + 30px) !important;
}

/* Hide now-playing-bar when queue panel is open (all screen sizes) */
body:has(#side-panel.active[data-view="queue"]) .now-playing-bar {
    display: none !important;
}

#page-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    min-height: 500px;
    z-index: 0;
    background-size: cover;
    background-position: center 20%;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;

    /* Fade out at the bottom — Apple Music style gradient */
    mask-image: linear-gradient(to bottom, rgb(0, 0, 0, 1) 0%, rgb(0, 0, 0, 0.7) 50%, rgb(0, 0, 0, 0) 100%);

    /* Heavy blur + darken */
    filter: blur(60px) brightness(0.45) saturate(1.3);
    pointer-events: none;
    transform: scale(1.2);
}

#page-background.active {
    opacity: 1;
}

/* Light mode adjustments */
:root[data-theme='light'] #page-background {
    mask-image: linear-gradient(to bottom, rgb(0, 0, 0, 1) 0%, rgb(0, 0, 0, 0) 100%);
}

.now-playing-bar {
    grid-area: player;
    padding: var(--spacing-sm) var(--spacing-md);
    display: grid;
    grid-template-columns: 1fr 0.9fr 1fr;
    align-items: center;
    gap: var(--spacing-sm);
    z-index: 2100;

    /* Floating bar overrides */
    width: calc(96% - 190px) !important;
    left: calc(190px + 2%);
    bottom: 15px !important;
    border-radius: 1.5rem;

    /* Lumina large rounded */
    position: fixed !important;
    background-color: rgba(9, 9, 11, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);

    /* Lumina deep shadow */
    transition: all var(--transition-normal) var(--ease-out-back);
    height: var(--player-bar-height-desktop);
}

/* Slide-up entrance animation */
@keyframes npb-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.now-playing-bar.npb-visible {
    display: grid !important;
    animation: npb-slide-up 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

:root[data-theme='light'] .now-playing-bar {
    background-color: color-mix(in srgb, var(--card) 80%, transparent);
    border-color: rgb(0, 0, 0, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.sidebar-logo .app-logo {
    height: 88px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
}

/* Text-based logo */
.app-logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    line-height: 1;
}

.logo-tunes {
    font-family: 'Tiny5', cursive;
    font-size: 2.4rem;
    font-weight: 400;
    color: var(--foreground);
    letter-spacing: 0.05em;
    line-height: 1;
}

.logo-byline {
    font-family: 'Cinzel', serif;
    font-size: 0.55rem;
    font-weight: 400;
    color: var(--muted-foreground);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    line-height: 1;
    margin-top: 2px;
}

.sidebar-logo span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#sidebar-toggle {
    padding: 0;
    flex-shrink: 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
    cursor: pointer;
}

.search-bar svg.search-icon {
    width: 20px;
    height: 20px;
}

.sidebar-nav .nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--foreground);
    transform: translateX(4px);

    /* Slide effect */
}

.sidebar-nav .nav-item a.active {
    background-color: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

.sidebar-nav .nav-item a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0, 0, 0, 0.5);
    z-index: 2150;
    backdrop-filter: blur(2px);
}

.main-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    gap: var(--spacing-md);
    position: relative;
    z-index: 1000;
}

.main-header.on-home {
    justify-content: flex-start;
}

.navigation-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Mobile back button - positioned at body level to float above all overlays */
.mobile-back-btn {
    display: none;
    position: fixed;
    top: 18px;
    right: 1rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: var(--foreground);
    cursor: pointer;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    aspect-ratio: 1;
    z-index: 99999;
}

/* Show mobile back button when fullscreen or side panel is open (any screen size) */
body:has(#side-panel.active) .mobile-back-btn,
body.fullscreen-open .mobile-back-btn {
    display: flex !important;
}

/* On mobile: Always show back button except on home/search pages */
@media (max-width: 768px) {
    .mobile-back-btn {
        display: flex !important;
    }
    
    /* Hide on home page (unless fullscreen or side panel is open) */
    body:not(.fullscreen-open):not(:has(#side-panel.active)) .mobile-back-btn.on-home {
        display: none !important;
    }
    
    /* Always show when fullscreen or lyrics panel is open */
    body.fullscreen-open .mobile-back-btn,
    body:has(#side-panel.active) .mobile-back-btn {
        display: flex !important;
    }
}

.mobile-back-btn:hover {
    background: var(--secondary);
}

/* When back button is inlined into the header (explore page), strip float behavior */
.mobile-back-btn.inline-back {
    position: static !important;
    z-index: auto !important;
    top: auto !important;
    right: auto !important;
    flex-shrink: 0;
}

/* On explore page (mobile): search bar fills remaining header space beside inline back btn */
@media (max-width: 768px) {
    body.on-explore-page .main-header .search-bar {
        flex: 1;
        width: auto;
        max-width: none;
    }
}

/* Hide search bar on non-search pages */
.main-header.search-hidden .search-bar {
    display: none !important;
}

.main-header.search-hidden {
    justify-content: flex-start;
}

.nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);

    /* Glass style */
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast);
    box-shadow: none;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--foreground);
    transform: scale(1.05);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Page reload button */
.page-reload-btn {
    flex-shrink: 0;
}

/* Push reload button to right edge when search bar is hidden */
.main-header.search-hidden .page-reload-btn {
    margin-left: auto;
}

.page-reload-btn.reloading svg {
    animation: spin-reload 0.8s linear infinite;
}

@keyframes spin-reload {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pull-to-refresh indicator */
#pull-to-refresh-indicator {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: hidden;
    transition: height 0.15s ease;
}
#pull-to-refresh-indicator.pulling {
    display: flex;
}
#pull-to-refresh-indicator.refreshing .ptr-spinner {
    animation: spin-reload 0.7s linear infinite;
}
#pull-to-refresh-indicator .ptr-spinner {
    opacity: 0.6;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
#pull-to-refresh-indicator.threshold .ptr-spinner {
    opacity: 1;
    transform: rotate(180deg);
}

.hamburger-menu {
    display: none;
    background: transparent;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background-color var(--transition);
}

.hamburger-menu:hover {
    background-color: var(--secondary);
}

.search-bar {
    width: 80%;
    max-width: calc(100% - 72px);
}

.search-bar input {
    font-size: 1rem;
    transition:
        box-shadow var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

/* Shared search bar styles */
.search-bar,
.track-list-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar svg.search-icon,
.track-list-search-container svg.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
}

.search-bar input,
.track-list-search-input {
    width: 100%;
    padding: 0.85rem 2.5rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    color: var(--foreground);
    font-weight: 500;
    letter-spacing: -0.01em;
    transition:
        box-shadow var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.search-bar input:focus,
.track-list-search-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background-color: rgba(255, 255, 255, 0.06);
}

.search-clear-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    line-height: 1;
    z-index: 1;
}

body.has-page-background .search-bar input {
    background-color: var(--background);
}

/* Better contrast for UI elements over colorful background */
body.has-page-background .track-item {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.has-page-background .track-item:hover {
    background-color: var(--track-hover-bg, var(--secondary));
    transform: scale(1.005);
}

.search-history {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(17, 17, 19, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    border-radius: 0 0 1rem 1rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    margin-top: -1px;
    animation: slide-up var(--transition-fast) var(--ease-out-back);
    transform-origin: top;
}

.search-history-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background var(--transition);
    border-radius: 0.5rem;
}

.search-history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-history-item .history-icon {
    color: var(--muted-foreground);
    opacity: 0.5;
    flex-shrink: 0;
}

.search-history-item .query-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-history-item .delete-history-btn {
    padding: 4px;
    color: var(--muted-foreground);
    opacity: 0.5;
    transition: opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-history-item .delete-history-btn:hover {
    opacity: 1;
    color: #ef4444;
}

.search-history-clear-all {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--primary);
    cursor: pointer;
    border-top: 1px solid var(--border);
    transition: background var(--transition);
}

.search-history-clear-all:hover {
    background: var(--secondary);
}

input[type='search']::-webkit-search-cancel-button {
    appearance: none;
    display: none;
}

.page {
    display: none;
    position: relative;
    z-index: 1;
}

.page.active {
    display: block;
    animation: fade-in-slide-up var(--transition-normal) var(--ease-out-back);
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-in-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.02);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Admin Tab Indicators ────────────────────────────── */
.admin-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-radius: 2px;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes heart-beat {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2);
    }

    50% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.content-section {
    margin-bottom: var(--spacing-2xl);
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    gap: 0.75rem;
}

.section-header-row .section-title {
    margin-bottom: 0;
}

/* Custom Sort Dropdown */
.custom-sort-dropdown {
    position: relative;
    z-index: 10;
}

.sort-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 0.65rem;
    border-radius: 2rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.sort-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--foreground);
}

.sort-trigger svg {
    opacity: 0.5;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.custom-sort-dropdown.open .sort-trigger {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--foreground);
}

.custom-sort-dropdown.open .sort-trigger svg {
    transform: rotate(180deg);
    opacity: 0.8;
}

.sort-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    background: rgba(20, 20, 24, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.3rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transition: all 0.18s ease;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.custom-sort-dropdown.open .sort-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.sort-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted-foreground);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sort-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--foreground);
}

.sort-option.active {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.06);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: var(--spacing-lg);
    letter-spacing: -0.04em;
}

.search-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: var(--spacing-md);
    border-bottom: none;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

.search-tabs::-webkit-scrollbar {
    display: none;
}

.search-tab {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.45rem 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.01em;
    border-bottom: none;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
    transition:
        color var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast),
        border-color var(--transition-fast);
    position: relative;
}

.search-tab:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.search-tab:active {
    transform: scale(0.95);
}

.search-tab.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.18);
}

.search-tab-content {
    display: none;
}

.search-tab-content.active {
    display: block;
    animation: fade-in-slide-up 0.4s var(--ease-out-back);
}

/* ===== PREMIUM LIBRARY ===== */

.library-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(6,6,10,0.95) 0%, rgba(10,10,14,0.85) 100%);
    backdrop-filter: blur(40px) saturate(2);
    -webkit-backdrop-filter: blur(40px) saturate(2);
    padding: 0.75rem 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 32px rgba(0,0,0,0.3);
}

.library-toolbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    padding-top: 0.15rem;
}

.library-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 0;
    background: linear-gradient(135deg, #fff 40%, rgba(255,255,255,0.55));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.library-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.library-icon-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.25s ease;
}
.library-icon-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.16);
    box-shadow: 0 0 16px rgba(255,255,255,0.04);
}
.library-icon-btn:active {
    transform: scale(0.9);
}

.library-icon-btn-sm {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.library-icon-btn-sm:hover {
    color: var(--foreground);
    background: rgba(255,255,255,0.07);
}
.library-icon-btn-sm .material-symbols-rounded {
    font-size: 18px;
}

.library-create-wrapper {
    position: relative;
}

.library-create-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 0.35rem;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    animation: fade-in-slide-up 0.15s ease;
}

.library-create-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: none;
    border: none;
    color: var(--foreground);
    padding: 0.55rem 0.75rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background var(--transition-fast);
}
.library-create-option:hover {
    background: rgba(255,255,255,0.08);
}
.library-create-option .material-symbols-rounded {
    font-size: 20px;
    color: var(--muted-foreground);
}

/* --- Filters row (chips + sort/view) --- */
.library-filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    padding-bottom: 0.5rem;
    margin-bottom: 0.15rem;
}

.library-filters {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    mask-image: linear-gradient(to right, transparent 0%, black 4%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 92%, transparent 100%);
    padding: 0 0.35rem;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
}
.library-filters::-webkit-scrollbar { display: none; }

.library-chip {
    background: none;
    border: 1px solid transparent;
    color: rgba(255,255,255,0.38);
    padding: 0.4rem 0.95rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.01em;
    position: relative;
    transition: all 0.25s ease;
}
.library-chip:hover { color: rgba(255,255,255,0.72); background: rgba(255,255,255,0.05); }
.library-chip:active { transform: scale(0.94); }
.library-chip.active {
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(255,255,255,0.13), rgba(255,255,255,0.06));
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 0 14px rgba(255,255,255,0.03), inset 0 1px 0 rgba(255,255,255,0.08);
}
.library-chip.active::after { display: none; }

/* --- Search bar --- */
.library-search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    animation: fade-in-slide-up 0.2s ease;
    transition: box-shadow var(--transition-fast, 0.2s ease), border-color var(--transition-fast, 0.2s ease), background-color var(--transition-fast, 0.2s ease);
}
.library-search-bar:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background-color: rgba(255, 255, 255, 0.06);
}
.library-search-icon { 
    font-size: 20px; 
    color: var(--muted-foreground);
    flex-shrink: 0;
}
.library-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: 0;
    width: 100%;
}
.library-search-bar input::placeholder { 
    color: var(--muted-foreground);
    font-weight: 400;
}

/* --- Sort bar (inline with filters) --- */
.library-toolbar-bottom {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.library-sort-wrapper { position: relative; }

.library-sort-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 0.4rem;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.library-sort-trigger:hover { color: var(--foreground); background: rgba(255,255,255,0.06); }

.library-sort-dropdown {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 0.35rem;
    min-width: 150px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    animation: fade-in-slide-up 0.15s ease;
}

.library-sort-option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--foreground);
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    text-align: left;
    transition: background var(--transition-fast);
}
.library-sort-option:hover { background: rgba(255,255,255,0.08); }
.library-sort-option.active { color: var(--highlight, #1db954); }

/* --- List-view rows --- */
.library-list-view {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.35rem 0.5rem;
}

.library-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.6rem;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    position: relative;
}
.library-row:hover { background: rgba(255,255,255,0.045); box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.library-row:active { transform: scale(0.985); }

.library-row-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
    box-shadow: 0 3px 14px rgba(0,0,0,0.25);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.library-row:hover .library-row-thumb {
    box-shadow: 0 5px 20px rgba(0,0,0,0.35);
    transform: scale(1.02);
}
.library-row-thumb.artist-thumb {
    border-radius: 50%;
}
.library-row-thumb.folder-thumb {
    border-radius: 12px;
}

.library-row-info {
    flex: 1;
    min-width: 0;
    gap: 0.12rem;
    display: flex;
    flex-direction: column;
}

.library-row-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.library-row-subtitle {
    font-size: 0.74rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    opacity: 0.75;
}

/* --- Grid-view --- */
.library-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.85rem;
    animation: dl-fade-in 0.25s ease;
}
.library-grid-view .library-row {
    flex-direction: column;
    align-items: stretch;
    padding: 0.6rem;
    text-align: center;
    gap: 0.5rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.library-grid-view .library-row:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.library-grid-view .library-row-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.library-grid-view .library-row-thumb.artist-thumb {
    border-radius: 50%;
}
.library-grid-view .library-row-info {
    text-align: center;
}
.library-grid-view .library-row-title {
    font-size: 0.82rem;
}
.library-grid-view .library-row-subtitle {
    font-size: 0.7rem;
}
.library-grid-view .library-row-chevron {
    display: none;
}
.library-grid-view .library-row--pinned {
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

/* --- Sub-views --- */
.library-subview {
    animation: fade-in-slide-up 0.25s ease;
}
.library-subview-header {
    --subview-accent: #a78bfa;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.85rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--card) 60%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    margin: 0 0 0.65rem;
}

.library-subview-header .library-back-btn {
    color: var(--subview-accent);
    background: color-mix(in srgb, var(--subview-accent) 8%, transparent);
    border-radius: 12px;
    width: 38px;
    height: 38px;
    transition: all 0.25s ease;
}
.library-subview-header .library-back-btn:hover {
    background: color-mix(in srgb, var(--subview-accent) 15%, transparent);
    box-shadow: 0 0 14px color-mix(in srgb, var(--subview-accent) 10%, transparent);
}
.library-subview-header .library-back-btn:active {
    transform: scale(0.9);
}

.subview-title-group {
    flex: 1;
    min-width: 0;
}

.library-subview-header .subview-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.2;
    background: linear-gradient(135deg, #fff 50%, rgba(255,255,255,0.65));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.library-subview-header .subview-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--subview-accent);
    opacity: 0.85;
    margin: 0.2rem 0 0;
    letter-spacing: 0;
    text-transform: lowercase;
}

.subview-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.library-subview-header .library-action-btn {
    color: var(--subview-accent);
    background: color-mix(in srgb, var(--subview-accent) 8%, transparent);
    border: none;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}
.library-subview-header .library-action-btn:hover {
    background: color-mix(in srgb, var(--subview-accent) 15%, transparent);
    box-shadow: 0 0 14px color-mix(in srgb, var(--subview-accent) 10%, transparent);
}
.library-subview-header .library-action-btn:active {
    transform: scale(0.9);
}

.library-back-btn {
    background: none;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--transition-fast);
}
.library-back-btn:hover { background: rgba(255,255,255,0.07); }

.library-action-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--foreground);
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.library-action-btn:hover { background: rgba(255,255,255,0.15); }
.library-action-btn:active { transform: scale(0.92); }

/* --- Pinned section header --- */
.library-pinned-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
    padding: 0.6rem 0.25rem 0.25rem;
}

/* --- Empty state --- */
.library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    gap: 0.6rem;
}
.library-empty .material-symbols-rounded { font-size: 48px; color: var(--muted-foreground); }
.library-empty p { color: var(--muted-foreground); font-size: 0.85rem; max-width: 260px; }

@media (max-width: 768px) {
    .library-toolbar { padding: 0.5rem 0.75rem 0; }
    .library-title { font-size: 1.3rem; }
    .library-grid-view { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; }
    .dl-detail-cover-lg { width: 150px; height: 150px; }
    .dl-detail-hero-title { font-size: 1.15rem; }
}

/* Search Top Result Card - Lumina glass style */
.search-top-result {
    display: flex !important;
    align-items: center !important;
    gap: 1.25rem !important;
    padding: 1.25rem !important;
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1.25rem !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    margin-bottom: 1.5rem !important;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.search-top-result:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.search-top-result img {
    border-radius: 1rem !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Mixed search results (tracks + albums interleaved) */
.search-mixed-results {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-mixed-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-mixed-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-mixed-cover {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search-mixed-info {
    flex: 1;
    min-width: 0;
}

.search-mixed-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.search-mixed-subtitle {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-mixed-type-label {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.search-type-track {
    color: var(--highlight);
    background: rgba(var(--highlight-rgb), 0.1);
    border-color: rgba(var(--highlight-rgb), 0.2);
}

.search-type-album {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.search-type-artist {
    color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.2);
}

.search-type-playlist {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.2);
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.settings-tab {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    padding: var(--spacing-sm) var(--spacing-lg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition:
        color var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast);
    position: relative;
}

.settings-tab:hover {
    color: var(--foreground);
    background-color: rgb(var(--highlight-rgb), 0.05);
}

.settings-tab:active {
    transform: translateY(1px);
}

.settings-tab.active {
    color: var(--foreground);
    border-bottom-color: var(--highlight);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: fade-in-slide-up 0.4s var(--ease-out-back);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

/* ===== NEW HOME PAGE LAYOUT ===== */
/* ===== HOME PAGE ===== */

/* Shortcuts Grid */
.home-shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 0.5rem;
}
.home-shortcut-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    height: 56px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.home-shortcut-card:active { background: rgba(255,255,255,0.12); }
.home-shortcut-art {
    width: 56px;
    height: 56px;
    object-fit: cover;
    flex-shrink: 0;
}
.home-shortcut-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.3rem;
}
.home-shortcut-icon.liked { background: linear-gradient(135deg, #7c3aed, #c026d3); color: #fff; }
.home-shortcut-icon.recent { background: linear-gradient(135deg, #0ea5e9, #06b6d4); color: #fff; }
.home-shortcut-icon.downloads { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.home-shortcut-label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.5rem;
}

.home-section {
    margin-bottom: 2rem;
}

.home-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.home-section-header .section-title {
    margin-bottom: 0;
}

/* Horizontal scroll row */
.home-scroll-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.home-scroll-row::-webkit-scrollbar {
    display: none;
}

/* Home scroll cards — BIG */
.home-scroll-row > .card {
    flex: 0 0 auto;
    width: 52vw;
    max-width: 240px;
    scroll-snap-align: start;
}

.home-scroll-row > .card .card-image-wrapper {
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.home-scroll-row > .card .card-image {
    border-radius: 0.75rem;
}

.home-scroll-row > .card .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

.home-scroll-row > .card .card-subtitle {
    font-size: 0.72rem;
    opacity: 0.6;
    line-height: 1.3;
}

.home-scroll-row > .card.artist {
    width: 42vw;
    max-width: 200px;
}

/* Songs card */
.home-songs-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 0.75rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

#home-recommended-songs {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#home-recommended-songs::-webkit-scrollbar {
    width: 6px;
}

#home-recommended-songs::-webkit-scrollbar-track {
    background: transparent;
}

#home-recommended-songs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#home-recommended-songs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .home-scroll-row > .card {
        width: 52vw;
        max-width: none;
    }
    .home-scroll-row > .card.artist {
        width: 42vw;
        max-width: none;
    }
}
/* ===== END HOME PAGE LAYOUT ===== */

.card {
    display: block;
    background: none;
    padding: 0;
    border-radius: 0.75rem;
    transition: transform 0.2s ease;
    position: relative;
    border: none;
}

.card:hover {
    background: none;
    transform: scale(1.03);
    box-shadow: none;
    border-color: transparent;
}

/* Card Image wrapper */
.card-image-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.2s ease;
    aspect-ratio: 1;
}

.card:hover .card-image-wrapper {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.75rem;
    transition: none;
}

.card:hover .card-image {
    transform: none;
}

/* Hide all card overlay buttons globally */
.card-like-btn,
.card-menu-btn,
.card-play-btn,
.edit-playlist-btn,
.delete-playlist-btn {
    display: none !important;
}

.card-collage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    overflow: hidden;
    padding: 0;
}

.card-collage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

.card-collage.items-3 img:first-child {
    grid-row: span 2;
    height: 100%;
}

.card-collage.items-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.card.artist .card-image-wrapper {
    border-radius: 50%;
}

.card.artist .card-image {
    border-radius: 50%;
}

.card-image-wrapper .explicit-badge {
    display: none !important;
}

.card-info {
    text-align: center;
    padding: 0 2px;
}

.card-title {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    letter-spacing: -0.01em;
    opacity: 0.7;
}

.heart-icon {
    transition:
        transform 0.2s ease,
        color 0.2s ease;
}

.like-btn:hover .heart-icon {
    color: #ef4444;
}

.heart-icon.filled {
    color: #ef4444;
    fill: #ef4444;
    stroke: #ef4444;
    animation: heart-beat 0.4s var(--ease-elastic);
}

.track-item:hover .like-btn {
    opacity: 1;
}

.like-btn.active .heart-icon {
    color: #ef4444;
    fill: #ef4444;
}

.explicit-badge {
    display: none !important;
}

.quality-hires {
    border: 1px solid var(--secondary);
    color: var(--muted-foreground);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
    line-height: 1;
}

.track-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#home-recommended-songs,
#playlist-detail-recommended {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 2px var(--spacing-xl);
}

/* Artist popular tracks - fixed height, scrollable */
#artist-detail-tracks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#artist-detail-tracks::-webkit-scrollbar {
    width: 4px;
}

#artist-detail-tracks::-webkit-scrollbar-track {
    background: transparent;
}

#artist-detail-tracks::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

#playlist-detail-recommended .track-item {
    grid-template-columns: 40px 1fr 80px 90px;
}

@media (max-width: 1100px) {
    #home-recommended-songs,
    #playlist-detail-recommended {
        grid-template-columns: 1fr;
    }
}

.album-content-layout {
    display: block;
}

.album-content-layout::after {
    content: '';
    display: table;
    clear: both;
}

@media (min-width: 1200px) {
    #album-detail-tracklist {
        float: left;
        width: 55%;
        margin-right: var(--spacing-2xl);
        margin-bottom: var(--spacing-2xl);
    }

    .album-content-layout .content-section {
        /* Default flow to allow wrapping around the float */
        margin-top: 0 !important;
        margin-bottom: var(--spacing-2xl);
    }

    /* Switch to inline-block layout for flow behavior */
    .album-content-layout .content-section .card-grid {
        display: block;
        gap: 0;
    }

    .album-content-layout .content-section .card-grid .card {
        display: inline-block;
        vertical-align: top;
        width: 155px;

        /* Fixed width to ensure consistent flow */
        margin: 0 var(--spacing-md) var(--spacing-md) 0;
        white-space: normal;

        /* Reset in case inherited */
    }

    .album-content-layout .content-section .card-grid .card.compact {
        display: inline-flex;
        vertical-align: top;
        width: 220px;
        margin-right: var(--spacing-sm);
    }

    .album-content-layout .section-title {
        font-size: 1.4rem;
        margin-bottom: var(--spacing-md);
        clear: none;

        /* Allow sitting next to float */
    }
}

.track-list-header {
    display: grid;
    grid-template-columns: 40px 1fr 80px 48px;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    color: var(--muted-foreground);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--spacing-xs);
}

.track-list-header .duration-header {
    justify-self: flex-end;
}

.is-editable .track-list-header .duration-header {
    padding-right: 1.5rem;
}

/* Track Item Standardization */
.track-item {
    display: grid;
    grid-template-columns: 40px 1fr 60px 40px;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 1rem;
    align-items: center;
    transition:
        background-color var(--transition-fast),
        transform var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.track-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: scale(1.005);

    /* Micro interaction */
}

/* Add active state for click feedback */
.track-item:active {
    transform: scale(0.98);
    background-color: rgba(255, 255, 255, 0.08);
}

.track-item.playing {
    background-color: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #6366f1;
    padding-left: calc(var(--spacing-sm) - 3px);
}

.track-item.playing .track-item-details .title {
    color: var(--highlight);
}

.track-item.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.track-item.unavailable .title,
.track-item.unavailable .artist,
.track-item.unavailable .track-item-duration {
    color: var(--muted-foreground);
}

.track-item.dragging {
    opacity: 0.5;
    z-index: 2000;
    pointer-events: auto;
}

.track-number {
    color: var(--muted-foreground);
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-item-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
}

.track-item-cover {
    width: 44px;
    height: 44px;
    background-color: var(--muted);
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.track-item-details {
    min-width: 0;
}

.track-item-details .title {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.track-item-details .artist {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.track-item-duration {
    color: var(--muted-foreground);
    justify-self: flex-end;
    font-variant-numeric: tabular-nums;
}

.track-item-actions {
    justify-self: flex-end;
    display: flex;
    align-items: center;
    min-width: 40px;
    justify-content: flex-end;
    gap: 2px;
}

/* Downloaded tracks delete button */
.track-item .dl-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

.track-item:hover .dl-delete-btn {
    opacity: 1;
}

.track-item .dl-delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
}

.track-item .dl-delete-btn .material-symbols-rounded {
    font-size: 1.1rem;
    color: var(--destructive, #ef4444);
}

/* ── Downloads Sub-View: Premium Redesign ─────────────────────────────── */

/* Stats bar */
.dl-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    background: rgba(255,255,255,0.035);
    border-radius: 12px;
    margin: 0 0 0.85rem;
    border: 1px solid rgba(255,255,255,0.04);
}
.dl-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.76rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.dl-stat .material-symbols-rounded {
    font-size: 0.95rem;
    color: #2dd4bf;
}
.dl-stat-divider {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* Section label for in-progress */
.dl-section-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.6rem;
    padding: 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.dl-section-label .material-symbols-rounded {
    font-size: 1rem;
    color: var(--primary);
}
@keyframes dl-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.dl-pulse {
    animation: dl-pulse 1.5s ease-in-out infinite;
}

/* Tab bar */
.dl-tabs {
    display: flex;
    gap: 0.15rem;
    padding: 0 0.15rem;
    margin-bottom: 0.6rem;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dl-tab {
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    white-space: nowrap;
}
.dl-tab:hover {
    color: var(--foreground);
}
.dl-tab.active {
    color: #2dd4bf;
}
.dl-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background: #2dd4bf;
    border-radius: 2px 2px 0 0;
    animation: dl-tab-in 0.2s ease;
}
@keyframes dl-tab-in {
    from { transform: scaleX(0); opacity: 0; }
    to { transform: scaleX(1); opacity: 1; }
}
.dl-tab-indicator { display: none; }

/* Content panels */
.dl-content-panel {
    display: none;
    min-height: 120px;
}
.dl-content-panel.active {
    display: block;
    animation: dl-fade-in 0.25s ease;
}
@keyframes dl-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Downloaded track item */
.dl-track-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}
.dl-track-item:hover {
    background: rgba(255,255,255,0.045);
}
.dl-track-item-cover {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
}
.dl-track-item-info {
    flex: 1;
    min-width: 0;
}
.dl-track-item-title {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}
.dl-track-item-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.05rem;
}
.dl-track-item-dot {
    width: 2.5px;
    height: 2.5px;
    border-radius: 50%;
    background: var(--muted-foreground);
    opacity: 0.45;
    flex-shrink: 0;
}
.dl-track-item-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}
.dl-track-item-duration {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
    text-align: right;
}
.dl-track-item .dl-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.1s ease;
    color: var(--muted-foreground);
}
.dl-track-item:hover .dl-remove-btn {
    opacity: 0.7;
}
.dl-track-item .dl-remove-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.dl-track-item .dl-remove-btn:active {
    transform: scale(0.9);
}
@media (max-width: 768px) {
    .dl-track-item .dl-remove-btn {
        opacity: 0.7;
    }
}

/* Downloaded album card */
.dl-albums-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    padding: 0.25rem 0;
}
.dl-album-card {
    background: rgba(255,255,255,0.025);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid rgba(255,255,255,0.04);
}
.dl-album-card:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.055);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border-color: rgba(255,255,255,0.08);
}
.dl-album-card:active {
    transform: translateY(-1px) scale(0.98);
}
.dl-album-card-cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: rgba(255,255,255,0.04);
}
.dl-album-card-info {
    padding: 0.6rem 0.7rem 0.7rem;
}
.dl-album-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 0.15rem;
}
.dl-album-card-subtitle {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.85;
}

/* Downloaded artist card */
.dl-artists-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    text-align: center;
    padding: 0.25rem 0;
}
.dl-artist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    padding: 0.7rem 0.35rem;
    border-radius: 16px;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}
.dl-artist-card:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: rgba(255,255,255,0.05);
}
.dl-artist-card:active {
    transform: scale(0.97);
}
.dl-artist-card-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255,255,255,0.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: box-shadow 0.2s ease;
}
.dl-artist-card:hover .dl-artist-card-avatar {
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.dl-artist-card-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}
.dl-artist-card-count {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    opacity: 0.8;
}

/* Empty state */
.dl-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    text-align: center;
    gap: 0.5rem;
}
.dl-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.035);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
}
.dl-empty-icon .material-symbols-rounded {
    font-size: 1.6rem;
    color: var(--muted-foreground);
    opacity: 0.4;
}
.dl-empty-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--foreground);
}
.dl-empty-subtitle {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    max-width: 220px;
    line-height: 1.4;
}

/* ─── Downloaded Detail Sub-view (Premium Hero Layout) ─── */
.dl-detail-overlay {
    animation: dl-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2000 !important; /* Higher than header (1000) */
    padding-top: 88px !important; /* Account for header (44px hamburger + 16px top + 16px bottom + 12px margin) */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 768px) {
    .dl-detail-overlay {
        bottom: 56px !important; /* Above mobile tab bar on mobile */
        padding-top: 88px !important;
    }
}
.dl-detail-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}
.dl-detail-nav-back {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
}
.dl-detail-nav-back:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.dl-detail-nav-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    letter-spacing: -0.01em;
}
.dl-detail-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem 0 1.5rem;
    position: relative;
}
.dl-detail-hero::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--dl-accent, rgba(99,102,241,0.15));
    filter: blur(60px);
    opacity: 0.4;
    pointer-events: none;
}
.dl-detail-cover-lg {
    width: 180px;
    height: 180px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}
.dl-detail-cover-lg:hover {
    transform: scale(1.03);
}
.dl-detail-cover-lg.artist-cover,
.dl-detail-cover--round {
    border-radius: 50%;
}
.dl-detail-hero-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin: 1rem 0 0.25rem;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}
.dl-detail-hero-meta {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    position: relative;
    z-index: 1;
}
.dl-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}
.dl-detail-play-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.3rem;
    border: none;
    border-radius: 24px;
    background: var(--primary, #6366f1);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
    transition: all 0.25s ease;
}
.dl-detail-play-btn:hover { opacity: 0.9; transform: scale(1.03); }
.dl-detail-play-btn:active { transform: scale(0.97); }
.dl-detail-play-btn .material-symbols-rounded { font-size: 18px; }
.dl-detail-delete-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 24px;
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.dl-detail-delete-btn:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); }
.dl-detail-delete-btn:active { transform: scale(0.95); }
.dl-detail-delete-btn .material-symbols-rounded { font-size: 16px; }
.dl-detail-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0 0 0.5rem;
}
.dl-detail-tracks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dl-detail-track-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.dl-detail-track-item:hover {
    background: rgba(255,255,255,0.05);
}
.dl-track-number {
    width: 26px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.3);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.dl-detail-track-cover {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.dl-detail-track-info {
    flex: 1;
    min-width: 0;
}
.dl-detail-track-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dl-detail-track-meta {
    font-size: 0.73rem;
    color: var(--muted-foreground);
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dl-detail-track-duration {
    font-size: 0.73rem;
    color: var(--muted-foreground);
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Delete confirmation modal */
.dl-delete-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.dl-delete-modal-backdrop--visible { opacity: 1; }
.dl-delete-modal {
    background: linear-gradient(135deg, rgba(28,28,34,0.98), rgba(18,18,24,0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 2rem 1.5rem 1.5rem;
    max-width: 320px;
    width: 88%;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.55);
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
}
.dl-delete-modal-backdrop--visible .dl-delete-modal { transform: scale(1); }
.dl-delete-modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
}
.dl-delete-modal-icon .material-symbols-rounded {
    font-size: 28px;
    color: #ef4444;
}
.dl-delete-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.45rem;
    letter-spacing: -0.025em;
}
.dl-delete-modal-text {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.55;
    margin-bottom: 1.5rem;
}
.dl-delete-modal-text strong {
    color: rgba(255,255,255,0.85);
    font-weight: 700;
}
.dl-delete-modal-actions {
    display: flex;
    gap: 0.65rem;
}
.dl-delete-modal-cancel {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}
.dl-delete-modal-cancel:hover { background: rgba(255,255,255,0.1); color: #fff; }
.dl-delete-modal-confirm {
    flex: 1;
    padding: 0.7rem;
    border: none;
    border-radius: 14px;
    background: #ef4444;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(239,68,68,0.3);
}
.dl-delete-modal-confirm:hover { background: #dc2626; transform: scale(1.02); }
.dl-delete-modal-confirm:active { transform: scale(0.97); }

@keyframes dl-slide-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Library row pinned sections (Liked/Downloads/Recent) */
.library-row--pinned {
    padding: 0.8rem 0.7rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.015) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 18px;
    margin-bottom: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    transition: all 0.25s ease;
}
.library-row--pinned:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.035) 100%);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    transform: translateY(-1px);
}
.library-row[data-subview] {
    cursor: pointer;
}
.library-row[data-subview]:active {
    transform: scale(0.985);
    transition: transform 0.1s ease;
}

/* Icon box used by pinned rows */
.library-row-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}
.library-row-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 50%);
    pointer-events: none;
}
.library-row-icon--muted {
    background: rgba(255,255,255,0.06);
    color: var(--muted-foreground);
}
.library-row-icon--muted .material-symbols-rounded {
    font-size: 22px;
}

.library-row-chevron {
    font-size: 1.15rem;
    color: var(--muted-foreground);
    opacity: 0.25;
    transition: opacity 0.25s ease, transform 0.25s ease;
    margin-left: auto;
}
.library-row:hover .library-row-chevron {
    opacity: 0.6;
    transform: translateX(3px);
}

.track-like-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted-foreground);
    opacity: 0.5;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.track-like-btn:hover,
.track-like-btn.active {
    opacity: 1;
}

.track-like-btn.active {
    color: #ef4444 !important;
}

.track-menu-btn {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    z-index: 10;
}

.track-item:hover .track-menu-btn {
    opacity: 1;
    padding: 0.5rem;
    margin: 0;
}

.track-menu-btn:hover {
    background-color: rgb(var(--highlight-rgb), 0.2);
    color: var(--foreground);
}

.track-action-btn.active {
    opacity: 1;
}

.track-action-btn {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    /* Prevent buttons from squishing */
}

.track-action-btn:hover {
    background-color: rgb(var(--highlight-rgb), 0.2);
    color: var(--foreground);
}

/* Editable Playlist Track Items (with remove button) */
.is-editable .track-list-header,
.is-editable .track-item {
    grid-template-columns: 40px 1fr 80px 90px;
}

.detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    position: relative;
    text-align: center;
}

.detail-header-image {
    width: min(280px, 60vw);
    height: min(280px, 60vw);
    flex-shrink: 0;
    background-color: var(--muted);
    border-radius: 1rem;
    object-fit: cover;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease-in-out, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

/* Subtle glow behind cover art on detail pages */
.detail-header-cover-container::after {
    content: '';
    position: absolute;
    inset: 10%;
    background: var(--primary);
    opacity: 0.08;
    filter: blur(40px);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.detail-header-cover-container:hover::after {
    opacity: 0.15;
}

.detail-header-image:hover {
    transform: scale(1.02);
}

.detail-header-cover-container {
    position: relative;
    flex-shrink: 0;
}

.detail-header-collage {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
    background-color: var(--muted);
    border-radius: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    outline: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-header-collage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
    background-color: var(--muted);
}

.detail-header-image.loading {
    opacity: 0.3;
}

.detail-header-image.artist {
    border-radius: 50%;
    width: min(220px, 50vw);
    height: min(220px, 50vw);
}

.detail-header-info {
    text-align: center;
    width: 100%;
}

.detail-header-info .type {
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.3rem;
}

.detail-header-info .title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow-wrap: break-word;
}

.detail-header-info .title.long-title {
    font-size: 1.4rem;
}

.detail-header-info .title.very-long-title {
    font-size: 1.2rem;
}

/* Artist meta line: "XX% popularity · XX releases · XX top tracks" */
.artist-meta-dot {
    display: inline-block;
    margin: 0 0.4rem;
    opacity: 0.4;
    font-weight: 300;
}
.artist-meta-pop {
    font-weight: 500;
    color: var(--foreground);
}

.artist-bio {
    margin: 0.4rem 0 0 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--muted-foreground);
    opacity: 0.85;
    max-width: 600px;
    font-weight: 300;
}

.detail-header-info .meta {
    color: var(--muted-foreground);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.detail-header-info .meta a {
    color: var(--foreground);
    text-decoration: none;
    transition: color var(--transition);
}

.detail-header-info .meta a:hover {
    color: var(--highlight);
}

.detail-header-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* 3-dot More menu dropdown system */
.detail-more-wrapper {
    position: relative;
}

.detail-more-btn {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.detail-more-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
    transform: scale(1.1);
}

.detail-more-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 180px;
    animation: scale-in var(--transition-fast) var(--ease-out-back);
    transform-origin: top center;
}

.detail-more-dropdown.open {
    display: block;
    transform: translateX(-50%);
}

.detail-more-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: none;
    border: none;
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.detail-more-dropdown button:hover {
    background: var(--secondary);
    transform: translateX(4px);
}

.detail-more-dropdown button.danger {
    color: #ef4444;
}

.detail-more-dropdown button.danger:hover {
    background: rgb(239 68 68 / 0.1);
}

.detail-more-dropdown button svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.detail-more-dropdown .dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0;
}

/* Player bar & fullscreen more menus (open upward) */
.player-more-wrapper {
    position: relative;
}

.player-more-wrapper .detail-more-btn {
    width: 32px;
    height: 32px;
    padding: 0;
}

.player-more-dropdown {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    transform-origin: bottom center !important;
}

.player-more-dropdown.open {
    transform: translateX(-50%) !important;
}

.fs-more-wrapper {
    position: relative;
}

.fs-more-dropdown {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    transform-origin: bottom center !important;
}

.fs-more-dropdown.open {
    transform: translateX(-50%) !important;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    flex: 1;
    max-width: 180px;

    /* Apple Music pill button */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast);
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
}

.btn-primary:active {
    transform: scale(0.96) translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary svg {
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.btn-primary:hover svg {
    transform: scale(1.1);
}

.btn-secondary {
    padding: 0.5rem 1.25rem;
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--foreground);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary.danger {
    background: #ef4444;
    color: #fff;
}

.btn-secondary.danger:hover {
    background: #dc2626;
}

.detail-header-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 180px;
    padding: 0.875rem 1.75rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.detail-header-actions .btn-secondary:hover {
    transform: scale(1.05);
}

.modal-actions .btn-secondary {
    padding: 0.875rem 1.75rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.settings-list {
    max-width: 800px;
}

.settings-group {
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.settings-group .setting-item {
    border-bottom: none;
    padding: 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border);
    gap: var(--spacing-lg);
}

.setting-item .info {
    display: flex;
    flex-direction: column;
}

.setting-item .label {
    font-weight: 500;
}

.setting-item .description {
    font-size: 0.9rem;
    color: var(--muted-foreground);
}

.setting-item select,
.setting-item input[type='number'] {
    background-color: var(--input);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.setting-item input[type='number'] {
    width: 100px;
}

.template-input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    background-color: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.template-input:focus {
    outline: none;
    border-color: var(--ring);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--secondary);
    transition: background-color var(--transition-normal);
    border-radius: 24px;
    box-shadow: inset 0 2px 4px rgb(0, 0, 0, 0.1);

    /* Inner shadow for depth */
}

.slider::before {
    position: absolute;
    content: '';
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: var(--foreground);
    transition: transform var(--transition-spring, 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275));

    /* Spring animation */
    border-radius: 50%;
    box-shadow: 0 2px 4px rgb(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider::before {
    transform: translateX(16px);
    background-color: var(--primary-foreground);
    box-shadow: -2px 2px 4px rgb(0, 0, 0, 0.1);
}

.toggle-switch:hover .slider::before {
    transform: scale(1.1);

    /* Hover scale effect */
}

.toggle-switch:hover input:checked + .slider::before {
    transform: translateX(16px) scale(1.1);
}

.track-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.track-info .cover {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background-color: var(--muted);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.track-info .details {
    min-width: 0;
}

.track-info .details .title {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color var(--transition);
}

.track-info .details .title:hover {
    color: var(--highlight);
}

.track-info .details .album {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-info .details .artist {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition:
        color var(--transition-fast),
        transform var(--transition-fast);
    display: block;
    max-width: 100%;
}

.track-info .details .artist:hover {
    color: var(--highlight);
    transform: translateX(2px);
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.player-controls.waveform-loaded {
    gap: 0.1rem;
    margin-bottom: -0.4rem;
}

.player-controls .buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.player-controls .buttons button {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.player-controls .buttons button:hover {
    transform: scale(1.1);

    /* Pop effect */
}

.player-controls .buttons button:active {
    transform: scale(0.9);
    color: var(--foreground);
    background-color: var(--secondary);
}

@media (hover: hover) {
    .player-controls .buttons button:hover {
        color: var(--foreground);
        background-color: var(--secondary);
    }
}

.player-controls .buttons button.active {
    color: var(--active-highlight);
}

.player-controls .buttons button#repeat-btn.repeat-one::after {
    content: '1';
    position: absolute;
    font-size: 0.5rem;
    font-weight: bold;
}

.player-controls .buttons .play-pause-btn {
    background-color: #fff;
    color: #09090b;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

@media (hover: hover) {
    .player-controls .buttons .play-pause-btn:hover {
        transform: scale(1.05);
        background-color: var(--primary);
        color: var(--primary-foreground);
    }
}

.player-controls .buttons .play-pause-btn:active {
    transform: scale(0.95);
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.player-controls .progress-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    order: -1;
}

.player-controls .progress-container span {
    min-width: 40px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

#current-time {
    text-align: right;
}

.progress-bar,
.volume-bar {
    position: relative;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}

.progress-bar {
    flex-grow: 1;
    height: 6px;
    background-color: var(--secondary);
    border-radius: 3px;
}

.progress-bar:hover {
    height: 8px;
}

.progress-bar .progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    border-radius: 3px;
    transition: background-color 0.2s ease;
    position: relative;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.progress-bar:hover .progress-fill {
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.5);
}

.progress-bar:hover .progress-fill::after,
.progress-bar:active .progress-fill::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-color: #fff;
    border-radius: 50%;
    border: 2px solid #6366f1;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
    box-shadow: 0 2px 4px rgb(0, 0, 0, 0.3);
}

.progress-bar.has-waveform.waveform-loaded {
    height: 28px;
}

.progress-bar.has-waveform.waveform-loaded .progress-fill {
    background-color: var(--primary);
}

.progress-bar.has-waveform.waveform-loaded .progress-fill::after {
    display: none;
}

#waveform-canvas {
    display: none;
}

.volume-controls {
    display: flex;
    justify-content: center !important;
    align-items: flex-end !important;
    gap: 0.5rem !important;
    flex-direction: column !important;
    overflow: hidden;
}

.volume-controls button {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0.25rem;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
    .volume-controls button:hover {
        color: var(--foreground);
        background-color: var(--secondary);
    }
}

.volume-controls button:active {
    color: var(--foreground);
    background-color: var(--secondary);
}

.volume-controls .volume-bar {
    width: 100px;
    height: 4px;
    background-color: var(--secondary);
    border-radius: 2px;
}

.volume-controls .volume-bar:hover {
    height: 6px;
}

.volume-controls .volume-bar .volume-fill {
    width: var(--volume-level, 70%);
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    transition: background-color 0.2s ease;
    position: relative;
    pointer-events: none;
}

.volume-controls .volume-bar:hover .volume-fill {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.volume-controls .volume-bar:hover .volume-fill::after,
.volume-controls .volume-bar:active .volume-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #fff;
    border: 2px solid #6366f1;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.4);
}

/* Sleep Timer Button */
#sleep-timer-btn {
    position: relative;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all var(--transition);
}

#sleep-timer-btn:hover {
    color: var(--highlight);
}

#sleep-timer-btn.active {
    color: var(--primary);
    text-shadow: 0 0 8px rgb(var(--highlight-rgb), 0.5);
}

#sleep-timer-btn svg {
    width: 20px;
    height: 20px;
}

#sleep-timer-btn span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#context-menu,
#sort-menu {
    display: none;
    position: fixed;
    background-color: rgba(17, 17, 19, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    min-width: 160px;
    transform-origin: top left;
    animation: scale-in var(--transition-fast) var(--ease-out-back);
}

#context-menu ul,
#sort-menu ul {
    list-style: none;
}

#context-menu li,
#sort-menu li {
    padding: 0.5rem 0.75rem;
    margin-right: 0;
    cursor: pointer;
    border-radius: 0.5rem;
    transition:
        background-color var(--transition-fast),
        transform var(--transition-fast);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

#sort-menu li.sort-active {
    font-weight: bold;
}

#context-menu li:hover,
#sort-menu li:hover {
    background-color: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
    color: var(--foreground);
}

#queue-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgb(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    animation: fade-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#fullscreen-cover-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    animation: fade-in 0.3s ease;
    overflow: hidden;
    background-color: #000;

    /* Use a CSS variable for the image so we can set it in JS */
    --bg-image: none;

    padding-bottom: 0;
}

/* Album art as full background */
#fullscreen-cover-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(60px) brightness(0.5) saturate(1.4);
    z-index: 0;
    background-image: var(--bg-image);
    transition: background-image 0.5s ease;
    transform: scale(1.3);
}

/* Gradient overlay from bottom for readability */
#fullscreen-cover-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        rgba(0, 0, 0, 0.1) 70%,
        transparent 100%
    );
    z-index: 0;
    pointer-events: none;
}

#visualizer-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.fullscreen-cover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    padding: 2rem 2rem 3rem;
}

#close-fullscreen-cover-btn {
    display: none !important;
}

#close-fullscreen-cover-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.6);
}

/* Big album cover centered */
#fullscreen-cover-image {
    width: min(80vw, 65vh);
    aspect-ratio: 1 / 1;
    border-radius: 1rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    object-fit: contain;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    z-index: 2;
}

/* Small light glass info overlay at bottom */
.fullscreen-track-info {
    text-align: center;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

#fullscreen-track-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.2rem;
    color: #fff;
    overflow-wrap: break-word;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

#fullscreen-track-artist {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    transition:
        color 0.2s,
        text-decoration 0.2s;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

#fullscreen-track-artist:hover {
    color: #93c5fd;
    text-decoration: underline;
    cursor: pointer;
}

#fullscreen-next-track {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    opacity: 0;
}

#fullscreen-next-track.animate-in {
    animation: fade-in 0.5s ease 0.2s forwards;
}

#fullscreen-next-track .label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
    opacity: 0.7;
}

#fullscreen-next-track .value {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
}

.fullscreen-controls {
    width: 100%;
    max-width: 600px;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2;
}

.fullscreen-progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.fullscreen-progress-container .progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s ease;
}

.fullscreen-progress-container .progress-bar:hover {
    height: 6px;
}

.fullscreen-progress-container .progress-fill {
    height: 100%;
    background: var(--fs-progress-gradient, linear-gradient(90deg, #fff, #fff));
    background-size: 200% 100%;
    animation: gradient-shift 3s ease infinite;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease, background 0.3s ease;
    position: relative;
    pointer-events: none;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.fullscreen-progress-container .progress-bar:hover .progress-fill {
    background: var(--fs-progress-gradient, linear-gradient(90deg, #fff, #fff));
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.fullscreen-progress-container .progress-bar:hover .progress-fill::after,
.fullscreen-progress-container .progress-bar:active .progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--fs-progress-color, #fff);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.fullscreen-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
}

.fullscreen-buttons button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform var(--transition-fast),
        background-color var(--transition-fast);
}

.fullscreen-buttons button:hover {
    transform: scale(1.15);
}

.fullscreen-buttons button:active {
    transform: scale(0.9);
}

.fullscreen-buttons #fs-play-pause-btn {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    max-width: 64px;
    max-height: 64px;
    aspect-ratio: 1;
    background: #fff;
    color: #000;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-buttons #fs-play-pause-btn:hover {
    transform: scale(1.08);
    background: #fff;
}

.fullscreen-buttons button.active {
    color: #93c5fd;
}

.fullscreen-volume-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.fs-volume-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

.fs-volume-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.fs-volume-btn.muted {
    color: rgba(255, 255, 255, 0.3);
}

.fs-volume-bar {
    width: 130px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s ease;
}

.fs-volume-bar:hover {
    height: 6px;
}

.fs-volume-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: var(--fs-volume-level, 70%);
    transition: width 0.1s ease;
    position: relative;
    pointer-events: none;
}

.fs-volume-bar:hover .fs-volume-fill {
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

.fs-volume-bar:hover .fs-volume-fill::after,
.fs-volume-bar:active .fs-volume-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .fullscreen-volume-container {
        gap: 0.75rem;
    }

    .fs-volume-bar {
        width: 120px;
    }
}

.fullscreen-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.fullscreen-actions .btn-icon {
    color: rgba(255, 255, 255, 0.6);
}

.fullscreen-actions .btn-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

#queue-modal {
    background-color: rgba(17, 17, 19, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: scale-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#queue-modal-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

#queue-modal-header h3 {
    margin: 0;
}

#queue-modal-header #close-queue-btn {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all var(--transition);
}

#queue-modal-header #clear-queue-btn {
    background-color: transparent;
}

#queue-modal-header #clear-queue-btn:hover,
#queue-modal-header #close-queue-btn:hover {
    background-color: var(--secondary);
    color: var(--foreground);
}

#queue-list {
    overflow-y: auto;
    padding: 0.5rem;
}

.queue-track-item {
    display: grid;
    grid-template-columns: 32px 1fr auto auto auto;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    border-radius: var(--radius);
    cursor: grab;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.queue-track-item .queue-like-btn {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
}

.queue-track-item:hover .queue-like-btn {
    opacity: 1;
}

.queue-track-item .queue-like-btn:hover {
    background-color: rgb(var(--highlight-rgb), 0.2);
    color: var(--foreground);
}

.queue-track-item .queue-like-btn.active {
    color: #ef4444;
}

.queue-track-item .queue-like-btn.active svg {
    fill: #ef4444;
    color: #ef4444;
}

.queue-track-item:active {
    cursor: grabbing;
}

.queue-track-item:hover {
    background-color: var(--secondary);
}

.queue-track-item.playing {
    background-color: rgb(var(--highlight-rgb), 0.15);
    border-left: 3px solid var(--highlight);
    padding-left: calc(var(--spacing-sm) - 3px);
}

.queue-track-item .drag-handle {
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.queue-track-item .queue-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    color: var(--foreground);
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.2;
}

.queue-track-item:hover .queue-remove-btn {
    opacity: 1;
}

.queue-track-item .queue-remove-btn:hover {
    background-color: var(--background);
    color: var(--foreground);
}

.queue-track-item .queue-remove-btn svg {
    width: 20px;
    height: 20px;
}

.placeholder-text {
    padding: 2rem 1rem;
    color: var(--muted-foreground);
}

.placeholder-text.loading {
    animation: pulse 1.5s infinite ease-in-out;
}

.skeleton {
    background: linear-gradient(90deg, var(--secondary) 0%, var(--muted) 50%, var(--secondary) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 2s infinite ease-in-out;

    /* Slower, smoother pulse */
    border-radius: var(--radius);
}

.skeleton-track {
    display: grid;
    grid-template-columns: 40px 1fr 80px 48px;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    margin-bottom: 2px;
}

.skeleton-track-number {
    width: 24px;
    height: 20px;
    margin: 0 auto;
}

.skeleton-track-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
}

.skeleton-track-cover {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 4px;
}

.skeleton-track-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.skeleton-track-title {
    height: 16px;
    width: 60%;
    max-width: 200px;
}

.skeleton-track-artist {
    height: 14px;
    width: 40%;
    max-width: 150px;
}

.skeleton-track-duration {
    width: 40px;
    height: 14px;
}

.skeleton-card {
    background-color: var(--card);
    border-radius: var(--radius);
    padding: var(--spacing-md);
}

.skeleton-card-image {
    width: 100%;
    aspect-ratio: 1/1;
    margin-bottom: var(--spacing-md);
    border-radius: calc(var(--radius) - 4px);
}

.skeleton-card.artist .skeleton-card-image {
    border-radius: 50%;
}

.skeleton-card-title {
    height: 18px;
    width: 80%;
    margin-bottom: var(--spacing-xs);
}

.skeleton-card-subtitle {
    height: 14px;
    width: 60%;
}

.skeleton-container {
    width: 100%;
}

#api-instance-list {
    list-style: none;
    margin-bottom: 1rem;
}

#api-instance-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--secondary);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

#api-instance-list li .instance-url {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

#api-instance-list li .controls {
    display: flex;
    gap: 0.5rem;
}

#api-instance-list li button {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition:
        transform var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
}

#api-instance-list li button:hover {
    color: var(--foreground);
    background-color: var(--muted);
    transform: scale(1.15);
}

#api-instance-list li button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.theme-option {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    font-weight: 500;
}

.theme-option:hover {
    border-color: var(--highlight);
    background-color: var(--secondary);
}

.theme-option.active {
    border-color: var(--primary);
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.custom-theme-editor {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--secondary);
    border-radius: var(--radius);
    display: none;
}

.custom-theme-editor.show {
    display: block;
}

.theme-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.theme-color-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-color-input label {
    font-size: 0.9rem;
    color: var(--muted-foreground);
}

.theme-color-input input[type='color'] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.theme-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.about-content {
    padding: 1rem 0;
}

/* New About Page */
.about-page-new {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.about-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.about-app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.about-app-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    margin: 0 0 0.5rem 0;
}

.about-app-name .logo-tunes {
    font-size: 2.8rem;
}

.about-app-name .logo-byline {
    font-size: 0.55rem;
}

.about-tagline {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin: 0;
}

.about-creator {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.about-creator-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.about-creator-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--highlight), #6366f1);
}

.about-creator-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
}

.about-creator-bio {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    margin: 0 0 0.3rem 0;
    line-height: 1.4;
}

.about-creator-location {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    opacity: 0.7;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.about-creator-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.about-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    color: var(--foreground);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.about-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.about-link svg {
    opacity: 0.8;
}

/* Donate section inside About page */
.donate-section {
    margin-top: 1.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    text-align: center;
}

.donate-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.donate-heading {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
}

.donate-story {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--muted-foreground);
    margin: 0;
    text-align: left;
}

.donate-methods {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.donate-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    text-align: left;
}

.donate-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.donate-card-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.donate-card-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
}

.donate-card-subtitle {
    display: block;
    font-size: 0.7rem;
    opacity: 0.5;
}

.donate-card-number {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    position: relative;
    user-select: all;
}

.donate-card-number:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.donate-card-number:active {
    transform: scale(0.98);
}

.donate-number-text {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    letter-spacing: 0.03em;
    word-break: break-all;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.donate-card-number svg {
    opacity: 0.4;
    flex-shrink: 0;
}

.copy-feedback {
    position: absolute;
    right: 0.85rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #4ade80;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.donate-thanks {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

/* ── Contact Dev Page ── */
.contact-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.contact-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.contact-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.contact-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.contact-avatar-glow {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    z-index: 0;
    animation: contact-glow-pulse 3s ease-in-out infinite;
}

@keyframes contact-glow-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

.contact-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.contact-role {
    font-size: 0.82rem;
    color: var(--muted-foreground);
    margin: 0;
    font-weight: 300;
}

.contact-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(12px);
}

.contact-card-icon {
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.contact-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.6rem;
}

.contact-card-desc {
    font-size: 0.82rem;
    color: var(--muted-foreground);
    line-height: 1.6;
    margin: 0;
    font-weight: 300;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    text-decoration: none;
    color: var(--foreground);
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.contact-method:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.contact-method-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-method-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.contact-method-label {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-method-handle {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-method-arrow {
    opacity: 0.3;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.contact-method:hover .contact-method-arrow {
    opacity: 0.7;
    transform: translateX(3px);
}

.contact-cta-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(12px);
}

.contact-cta-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.85rem;
}

.contact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
}

.contact-tag {
    padding: 0.35rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
    opacity: 0.85;
    transition: all 0.2s ease;
}

.contact-tag:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.3);
    opacity: 1;
}

.contact-footer-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    opacity: 0.6;
    margin: 0;
    font-weight: 300;
}

.about-description {
    color: var(--foreground);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.about-features,
.about-tech {
    margin-bottom: 1.5rem;
}

.about-features h4,
.about-tech h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--foreground);
}

.about-features ul {
    list-style: none;
    padding: 0;
}

.about-features li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--foreground);
    line-height: 1.5;
}

.about-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--highlight);
    font-weight: bold;
    transition: transform var(--transition-spring);
}

.about-features li:hover::before {
    transform: scale(1.3) rotate(15deg);
}

.about-features li:hover {
    color: var(--highlight);
    transform: translateX(4px);
    transition:
        transform var(--transition-fast),
        color var(--transition-fast);
}

.about-tech p {
    color: var(--muted-foreground);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.about-links {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-weight: 500;
    transition: all var(--transition);
}

.github-link:hover {
    background-color: var(--secondary);
    border-color: var(--highlight);
    transform: translateY(-2px);
}

.github-link svg {
    flex-shrink: 0;
}

.about-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.about-footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.about-footer .version {
    color: var(--foreground);
    font-weight: 600;
}

.about-footer .license {
    color: var(--muted-foreground);
}

.about-footer .disclaimer {
    color: var(--muted-foreground);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: var(--secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--muted-foreground);
}

#download-notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: bottom 0.3s ease;
}

/* When now-playing bar is visible, push notifications up */
.now-playing-bar.npb-visible ~ #download-notifications,
body:has(.now-playing-bar.npb-visible) #download-notifications {
    bottom: calc(130px + 15px);
}

.download-task {
    background: rgba(17, 17, 19, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    animation: slide-in 0.3s ease;
    min-width: 300px;
}

.download-cancel:hover {
    background: var(--secondary) !important;
    color: var(--foreground) !important;
}

/* ── Notification collapser circle ── */
.download-notif-toggle {
    --dl-glow-rgb: 139, 92, 246;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, rgba(var(--dl-glow-rgb), 0.15), rgba(17, 17, 19, 0.88) 70%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(var(--dl-glow-rgb), 0.45);
    color: rgba(var(--dl-glow-rgb), 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 6px 1px rgba(var(--dl-glow-rgb), 0.5),
        0 0 14px 2px rgba(var(--dl-glow-rgb), 0.25),
        0 0 28px 4px rgba(var(--dl-glow-rgb), 0.1),
        inset 0 0 6px rgba(var(--dl-glow-rgb), 0.12);
    transition: box-shadow 0.4s ease, transform 0.15s ease, border-color 0.4s ease, background 0.4s ease, color 0.4s ease;
    align-self: flex-end;
    flex-shrink: 0;
    position: fixed;
    right: 20px;
    bottom: calc(var(--player-bar-height-desktop) + 20px);
    z-index: 10000;
    animation: collapser-breathe 3s ease-in-out infinite;
}

/* Mobile: adjust position based on now-playing bar visibility */
@media (max-width: 768px) {
    .download-notif-toggle {
        bottom: calc(56px + 12px); /* Above tab bar */
    }
    
    body:has(.now-playing-bar.npb-visible) .download-notif-toggle {
        bottom: calc(56px + 8px + var(--player-bar-height-mobile) + 12px);
    }
}

@keyframes collapser-breathe {
    0%, 100% {
        box-shadow:
            0 0 6px 1px rgba(var(--dl-glow-rgb), 0.5),
            0 0 14px 2px rgba(var(--dl-glow-rgb), 0.25),
            0 0 28px 4px rgba(var(--dl-glow-rgb), 0.1),
            inset 0 0 6px rgba(var(--dl-glow-rgb), 0.12);
    }
    50% {
        box-shadow:
            0 0 8px 2px rgba(var(--dl-glow-rgb), 0.6),
            0 0 18px 4px rgba(var(--dl-glow-rgb), 0.3),
            0 0 34px 6px rgba(var(--dl-glow-rgb), 0.12),
            inset 0 0 8px rgba(var(--dl-glow-rgb), 0.18);
    }
}

.download-notif-toggle:active {
    transform: scale(0.9);
    animation: none;
}

.download-notif-toggle:hover {
    box-shadow:
        0 0 10px 2px rgba(var(--dl-glow-rgb), 0.65),
        0 0 22px 4px rgba(var(--dl-glow-rgb), 0.35),
        0 0 40px 6px rgba(var(--dl-glow-rgb), 0.15),
        inset 0 0 8px rgba(var(--dl-glow-rgb), 0.2);
    border-color: rgba(var(--dl-glow-rgb), 0.6);
    animation: none;
}

.download-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: rgba(var(--dl-glow-rgb), 0.9);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    border: 1.5px solid rgba(17, 17, 19, 0.9);
}

#download-notifications.collapsed .download-task,
#download-notifications.collapsed .bulk-download-notification {
    display: none;
}

/* ── Downloaded album cards (equal sizing in grid) ── */
.dl-album-card {
    min-width: 0;
    width: 100%;
}

.dl-album-card img {
    display: block;
}

#lastfm-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.desktop-only {
    display: flex;
}

#cast-btn {
    position: relative;
}

#cast-btn.available {
    color: var(--highlight);
}

#cast-btn.available::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background-color: var(--highlight);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

#cast-btn.connected {
    color: #10b981;
}

#cast-btn.connected::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

#download-current-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.template-guide {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.template-guide th,
.template-guide td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.template-guide th {
    font-weight: 600;
    background-color: var(--secondary);
}

.template-guide code {
    background-color: var(--secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.offline-notification,
.update-notification {
    position: fixed;
    bottom: 130px;
    right: 20px;
    background: rgba(17, 17, 19, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 350px;
    animation: slide-in 0.3s ease;
}

.offline-notification svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.offline-sync-notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(34, 197, 94, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #000;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    animation: slide-up 0.3s ease forwards;
    pointer-events: none;
}

/* ── Persistent Offline Banner (top of screen) ── */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    background: #b91c1c;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 6px 12px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.offline-banner.visible {
    transform: translateY(0);
    opacity: 1;
}

.offline-banner.hiding {
    transform: translateY(-100%);
    opacity: 0;
}

.offline-banner svg {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* ── "Back Online" Toast (centred pill) ── */
.online-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 100000;
    background: rgba(34, 197, 94, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #000;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.online-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.online-toast.hiding {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
}

.online-toast svg {
    color: #064e3b;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.update-notification {
    flex-direction: column;
    align-items: stretch;
}

.close-shortcuts {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.close-shortcuts:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.shortcuts-content {
    padding: 1rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.shortcut-item:last-child {
    border-bottom: none;
}

#playlist-detail-description,
#mix-detail-description {
    color: var(--muted-foreground);
    font-size: 0.82rem;
    line-height: 1.55;
    opacity: 0.85;
    font-weight: 300;
}

/* Playlist modal inputs - override monospace from .template-input */
#playlist-name-input,
#playlist-cover-input {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
}

#playlist-name-input::placeholder,
#playlist-cover-input::placeholder {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--muted-foreground);
    opacity: 0.6;
}

#playlist-detail-tracklist {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#playlist-detail-tracklist .track-list-header {
    display: grid;
    grid-template-columns: 40px 1fr 80px 48px;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    color: var(--muted-foreground);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--spacing-xs);
}

#playlist-detail-tracklist .track-list-header .duration-header {
    justify-self: flex-end;
}

/* Responsive Design */

@supports (padding-top: env(safe-area-inset-top)) {
    .now-playing-bar {
        padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
    }

    .main-content,
    .sidebar {
        padding-top: max(var(--spacing-md), env(safe-area-inset-top));
    }
}

/* Side Panels (Lyrics & Queue) */
.side-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 600px;
    max-width: 50vw;
    background: rgba(17, 17, 19, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 2050;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s ease;
    box-shadow: none;
}

.side-panel.active {
    transform: translateX(0);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
}

.side-panel[data-view='lyrics'],
.side-panel[data-view='queue'] {
    background: color-mix(in srgb, var(--card) 60%, transparent);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgb(255, 255, 255, 0.1);
}

/* Lyrics panel font */
.side-panel[data-view='lyrics'] .panel-content {
    font-family: 'DM Sans', Inter, sans-serif;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    overflow-y: auto;
}

.side-panel[data-view='lyrics'] .panel-content::-webkit-scrollbar {
    display: none;
}

/* Color bleeding animated background for lyrics */
.side-panel[data-view='lyrics'] {
    --lyrics-color-1: #6366f1;
    --lyrics-color-2: #8b5cf6;
    --lyrics-color-3: #ec4899;
    overflow: hidden;
}

.side-panel[data-view='lyrics']::before {
    content: '';
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 30% 20%, var(--lyrics-color-1), transparent 50%),
        radial-gradient(circle at 70% 60%, var(--lyrics-color-2), transparent 50%),
        radial-gradient(circle at 50% 80%, var(--lyrics-color-3), transparent 50%);
    opacity: 0.35;
    animation: lyrics-color-flow 10s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
    filter: blur(50px);
}

@keyframes lyrics-color-flow {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    33% { transform: translate(-5%, 5%) rotate(3deg) scale(1.05); }
    66% { transform: translate(5%, -3%) rotate(-2deg) scale(0.95); }
    100% { transform: translate(-2%, -5%) rotate(4deg) scale(1.02); }
}

.side-panel[data-view='lyrics'] .panel-header,
.side-panel[data-view='lyrics'] .panel-content {
    position: relative;
    z-index: 1;
}

/* Hide the old animated gradient when album art background is active */
.side-panel[data-view='lyrics'].album-bg-active::before {
    display: none;
}

/* panel-content scrolling is handled by am-lyrics component */

/* ── Custom lyrics renderer ── */

.lyrics-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.lyrics-bg {
    position: absolute;
    inset: -20%;
    width: 140%;
    height: 140%;
    background-size: cover;
    background-position: center;
    filter: blur(60px) saturate(1.5);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
}

.lyrics-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.8) 100%);
    z-index: 1;
    pointer-events: none;
}

.lyrics-scroll {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    overflow-y: auto;
    padding: 0 1.5rem 80vh;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lyrics-scroll::-webkit-scrollbar {
    display: none;
}

.lyrics-line {
    font-family: 'Bricolage Grotesque', 'DM Sans', sans-serif;
    font-size: 2rem;
    line-height: 1.6;
    font-weight: 700;
    padding: 0.4rem 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    filter: none !important;
    -webkit-user-select: none;
    user-select: none;
    white-space: pre-wrap;
}

.lyrics-line .word {
    color: rgba(255, 255, 255, 0.5);
}

.lyrics-plain {
    padding: 1.5rem 0;
}

.lyrics-plain p {
    font-family: 'Bricolage Grotesque', 'DM Sans', sans-serif;
    font-size: 2rem;
    line-height: 1.6;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    padding: 0.3rem 0;
}

.side-panel[data-view='lyrics'] .panel-header h3 {
    font-family: 'DM Sans', Inter, sans-serif;
    letter-spacing: -0.02em;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Lyrics panel header - show song info */
.side-panel[data-view='lyrics'] .panel-header {
    justify-content: center;
    border-bottom: none;
    padding: 1rem 1rem 0.5rem;
}

.side-panel[data-view='lyrics'] .panel-header h3 {
    text-align: center;
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 1;
    white-space: normal;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    max-width: 100%;
}

.lyrics-title-song {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 1;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.lyrics-title-artist {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.6;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.lyrics-title-album {
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.4;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.side-panel[data-view='lyrics'] .panel-header .panel-controls {
    position: absolute;
    right: 1rem;
}

.panel-controls {
    display: flex;
    gap: 0.5rem;
}

#close-side-panel-btn {
    display: none !important;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: calc(var(--player-bar-height-desktop) + 2rem);
    scroll-behavior: auto;
}

/* Hide scrollbar in lyrics panel content */
.side-panel[data-view='lyrics'] .panel-content::-webkit-scrollbar,
.side-panel[data-view='lyrics'] .panel-content *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

.side-panel[data-view='lyrics'] .panel-content,
.side-panel[data-view='lyrics'] .panel-content * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* Synced lyrics styling with Apple Music animations */
.synced-line {
    padding: 0.5rem 0;
    font-size: 1.1rem;
    line-height: 1.6;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--muted-foreground);
    opacity: 0.5;
    transform: scale(0.95);
    filter: blur(1.5px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.synced-line.active {
    color: var(--highlight);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    text-shadow: 0 0 20px rgb(var(--highlight-rgb), 0.3);
}

.synced-line.upcoming {
    opacity: 0.7;
    transform: scale(0.98);
    filter: blur(0.8px);
}

.synced-line.past {
    color: var(--highlight);
    opacity: 0.7;
    transform: scale(1);
    filter: blur(0);
}

.lyrics-loading,
.lyrics-error {
    text-align: center;
    padding: 2rem;
    color: var(--muted-foreground);
}

/* Compact Cards (Artist and Album) */
.card.compact {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    min-height: 60px;
    border-radius: 0.75rem;
}

.card.compact .card-image-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.card.artist.compact .card-image-wrapper {
    width: 40px;
    height: 40px;
}

.card.compact .card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card.compact .card-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card.compact .card-subtitle {
    margin: 0;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted-foreground);
}

.card.compact .card-like-btn {
    width: 24px !important;
    height: 24px !important;
    top: 0;
    right: 0;
}

.card.compact:hover .card-like-btn {
    opacity: 1;
}

.card.compact.user-playlist .edit-playlist-btn,
.card.compact.user-playlist .delete-playlist-btn {
    display: none !important;

    /* Hide edit/delete on compact view to prevent covering image */
}

/* Mobile adjustments */

/* Clickable album cover indicator */
.now-playing-bar .cover {
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    pointer-events: auto;
    z-index: 1;
}

.now-playing-bar .cover:hover {
    transform: scale(1.05);
}

.now-playing-bar .cover::after {
    content: '🎵';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity var(--transition);
    font-size: 1.5rem;
}

.now-playing-bar .cover:hover::after {
    opacity: 1;
}

/* Window Controls Overlay */

.now-playing-bar .artist .artist-link {
    cursor: pointer;
    transition: color var(--transition);
}

.now-playing-bar .artist .artist-link:hover {
    color: var(--highlight);
    text-decoration: underline;
}

/* Updated Volume Controls Layout */

.player-actions-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.volume-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Ensure buttons in rows behave correctly */
.player-actions-row button,
.volume-slider-row button {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Show a grey box for images with no source, hiding the broken icon */
img:not([src]),
img[src=''] {
    content: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
    background-color: var(--muted);
}


/* Firebase Settings Styling */
.firebase-settings-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.custom-firebase-config {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

.custom-firebase-config.visible {
    display: flex;
}

.config-help-text {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.firebase-controls-container {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

#toggle-firebase-config-btn {
    width: fit-content;
}

.account-content {
    padding: 1rem 0;
}

.fullscreen-main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2rem 1rem;
    padding-top: 3rem;
    transition:
        flex 0.3s ease,
        padding-right 0.3s ease,
        margin-right 0.3s ease;
    width: 100%;
    max-width: 600px;
}

.fullscreen-lyrics-container {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    max-width: 600px;
    z-index: 10;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    animation: fs-lyrics-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fs-lyrics-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
    .fullscreen-lyrics-container {
        width: 100%;
        max-width: none;
        border-left: none;
    }
}

.fullscreen-lyrics-toggle {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.6rem;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        all 0.2s ease,
        right 0.3s ease;
    opacity: 0.7;
}

.fullscreen-lyrics-toggle:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
}

.fullscreen-lyrics-toggle.active {
    background: #93c5fd;
    color: #000;
    opacity: 1;
    border-color: transparent;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    backdrop-filter: blur(4px);
    background: rgb(0, 0, 0, 0.6);
    transition: opacity var(--transition-normal);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: -1;
}

.modal-content {
    background: rgba(17, 17, 19, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    animation: scale-in 0.2s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.wide {
    max-width: 600px;
}

.modal-content.medium {
    max-width: 500px;
}

.modal-list {
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.modal-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-option:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.modal-option.already-contains {
    opacity: 0.6;
    cursor: default;
}

.modal-option.already-contains:hover {
    background: transparent;
}

.modal-option .checkmark {
    color: var(--highlight);
    flex-shrink: 0;
}

.modal-option:last-child {
    border-bottom: none;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.timer-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timer-option {
    text-align: center;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.timer-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

#playlist-modal {
    animation: fade-in 0.1s ease-in;
}

#playlist-modal .playlist-modal-content {
    border-radius: 20px;
    padding: 1.75rem;
    max-width: 380px;
    background-color: rgba(9, 9, 11, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(168, 85, 247, 0.25);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.15), 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s;
}

#playlist-modal .playlist-modal-content:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 0 28px rgba(168, 85, 247, 0.25), 0 20px 50px rgba(0, 0, 0, 0.5);
}

.playlist-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    text-align: center;
    font-family: inherit;
    color: var(--foreground);
}

.playlist-modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.playlist-modal-input {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--foreground);
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.playlist-modal-input:focus {
    border-color: var(--primary);
    background: var(--secondary);
}

.playlist-modal-input::placeholder {
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--muted-foreground);
}

.playlist-modal-textarea {
    resize: vertical;
    min-height: 60px;
}

.playlist-modal-helper {
    font-size: 0.75rem;
    margin: 0;
    color: var(--muted-foreground);
    line-height: 1.4;
    font-family: inherit;
}

.playlist-modal-link {
    color: var(--primary);
    text-decoration: underline;
    transition: opacity 0.2s;
}

.playlist-modal-link:hover {
    opacity: 0.8;
}

.playlist-modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.playlist-modal-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: transform 0.2s, opacity 0.2s;
}

.playlist-modal-btn-primary {
    flex: 1.5;
}

.playlist-modal-btn:hover {
    transform: translateY(-1px);
}

.playlist-modal-btn:active {
    transform: translateY(0);
}

.playlist-modal-icon {
    font-size: 1.1rem;
    vertical-align: middle;
    margin-right: 0.3rem;
}

/* Delete Playlist Modal */
#delete-playlist-modal {
    animation: fade-in 0.1s ease-in;
}

.delete-modal-content {
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    background-color: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2), 0 20px 50px rgba(0, 0, 0, 0.5);
}

.delete-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    text-align: center;
    font-family: inherit;
    color: var(--foreground);
}

.delete-modal-message {
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-family: inherit;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.delete-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.delete-modal-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    transition: transform 0.2s, opacity 0.2s;
    max-width: 150px;
}

.delete-modal-btn:hover {
    transform: translateY(-1px);
}

.delete-modal-btn:active {
    transform: translateY(0);
}

/* fuck this chud ass shit bro */
.csv-import-progress {
    position: fixed;
    bottom: 120px;
    right: 3%;
    background: rgba(17, 17, 19, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    max-width: 400px;
    min-width: 350px;
    animation: slide-in 0.3s ease;
}

.csv-import-progress .progress-header {
    margin-bottom: 1rem;
}

.csv-import-progress .progress-header h4 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--foreground);
}

.csv-import-progress .progress-warning {
    font-size: 0.85rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.csv-import-progress .progress-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.csv-import-progress .current-track {
    font-size: 0.9rem;
    color: var(--foreground);
    font-weight: 500;
    min-height: 1.2rem;
}

.csv-import-progress .progress-bar {
    width: 100%;
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.csv-import-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--highlight));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.csv-import-progress .progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent 0%, rgb(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.csv-import-progress .progress-text {
    font-size: 0.85rem;
    color: var(--muted-foreground);
    text-align: center;
}

.csv-import-progress .progress-text span {
    font-weight: 600;
    color: var(--foreground);
}

.missing-tracks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.missing-tracks-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: -0.025em;
}

.close-missing-tracks {
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.close-missing-tracks:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.missing-tracks-content {
    padding: 2rem;
}

.missing-tracks-content p {
    margin-bottom: 2rem;
    line-height: 1.7;
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 400;
}

.missing-tracks-list h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.01em;
}

.missing-tracks-list ul {
    list-style: none;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--secondary);
}

.missing-tracks-list li {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    font-family: Inter, sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
}

.missing-tracks-list li:last-child {
    border-bottom: none;
}

.missing-tracks-list li:nth-child(even) {
    background: rgb(255, 255, 255, 0.02);
}

.missing-tracks-actions {
    padding: 1.5rem 2rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.missing-tracks-actions .btn-secondary {
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Default responsive classes */
.mobile-only {
    display: none !important;
}

/* Mobile-specific overrides */
@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* position the cast button on mobile to the bottom right cuz damn shit already cluttered */
    #cast-btn {
        position: absolute !important;
        bottom: 10px !important;
        right: 10px !important;
        z-index: 10 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        width: 24px !important;
        height: 24px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    #cast-btn:hover {
        background: transparent !important;
        transform: none !important;
    }

    #cast-btn svg {
        width: 20px !important;
        height: 20px !important;
    }

    .now-playing-bar .player-controls {
        position: relative !important;
        padding-bottom: 50px !important;
    }

    .player-controls.waveform-loaded {
        gap: 0;
    }
}

/* --- Responsive & Media Queries --- */

@media (min-width: 1440px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1920px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .now-playing-bar {
        grid-template-columns: minmax(150px, 1fr) 0.8fr auto;
        padding: var(--spacing-md);
    }

    .volume-controls {
        display: flex;
    }

    .desktop-only {
        display: flex;
    }
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 160px 1fr;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--spacing-md);
    }

    .detail-header-info .title {
        font-size: 3rem;
    }

    .detail-header-info .title.long-title {
        font-size: 2rem;
    }

    .detail-header-info .title.very-long-title {
        font-size: 1.35rem;
    }

    .main-content {
        padding: var(--spacing-lg);
    }

    .now-playing-bar {
        width: calc(96% - 160px) !important;
        left: calc(160px + 2%);
    }
}

@media (max-width: 768px) {
    .player-controls .progress-container {
        order: -1;
        max-width: none;
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    #fullscreen-cover-overlay {
        padding-bottom: 0;
    }

    #fullscreen-cover-image {
        width: min(85vw, 45vh);
        aspect-ratio: 1 / 1;
        margin-top: 4rem;
        margin-bottom: 1rem;
    }

    .fullscreen-main-view {
        padding-top: 3rem;
        padding-bottom: 0.5rem;
    }

    #fullscreen-track-title {
        font-size: 1.2rem;
    }

    #fullscreen-track-artist {
        font-size: 0.9rem;
    }

    .fullscreen-buttons {
        gap: 2rem;
    }

    .fullscreen-buttons #fs-play-pause-btn {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        max-width: 56px;
        max-height: 56px;
    }

    .app-container {
        grid-template:
            'header' auto
            'main' 1fr
            'player' auto / 1fr;
        height: 100vh;
        height: 100dvh;
    }

    .main-content {
        padding: var(--spacing-md) 0.5rem;
        grid-area: main;
    }

    .main-header {
        grid-area: header;
        margin-bottom: var(--spacing-md);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 2200;
        transition:
            transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
            box-shadow 0.3s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 0 0 20px rgb(0, 0, 0, 0.5);
    }

    .hamburger-menu {
        display: block;
    }

    #sidebar-overlay.is-visible {
        display: block;
    }

    .search-bar {
        max-width: calc(100% - 72px);
    }

    .content-section {
        margin-bottom: var(--spacing-xl);
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-md);
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--spacing-md);
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
        padding-bottom: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .detail-header-image {
        width: min(220px, 55vw);
        height: min(220px, 55vw);
    }

    .detail-header-image.artist {
        width: min(180px, 45vw);
        height: min(180px, 45vw);
    }

    .detail-header-collage {
        width: min(220px, 55vw);
        height: min(220px, 55vw);
    }

    .detail-header-info {
        width: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .detail-header-info .title {
        font-size: 1.3rem;
        line-height: 1.2;
    }

    .detail-header-info .title.long-title {
        font-size: 1.15rem;
    }

    .detail-header-info .title.very-long-title {
        font-size: 1rem;
    }

    .detail-header-info .meta {
        font-size: 0.8rem;
        gap: 0.3rem;
        margin-top: 0.25em;
    }

    .detail-header-actions {
        width: 100%;
        margin-top: 0.5em;
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }

    .detail-header-actions .btn-primary,
    .detail-header-actions .btn-secondary {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        max-width: 44px;
        padding: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        flex-grow: 0;
        flex-basis: 44px;
        aspect-ratio: 1;
    }

    .detail-header-actions .btn-primary span,
    .detail-header-actions .btn-secondary span {
        display: none;
    }

    .now-playing-bar {
        grid-template:
            'track controls' auto
            'progress progress' auto / 1fr auto;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) var(--spacing-md);
        height: var(--player-bar-height-mobile);
        border-radius: 1.5rem;
    }

    .now-playing-bar .track-info {
        grid-area: track;
        min-width: 0;
    }

    .track-info {
        gap: var(--spacing-sm);
    }

    .track-info .cover {
        width: 48px;
        height: 48px;
    }

    .track-info .details {
        min-width: 0;
        flex: 1;
    }

    .track-info .details .title {
        font-size: 0.9rem;
    }

    .track-info .details .artist {
        font-size: 0.75rem;
    }

    .now-playing-bar .volume-controls {
        grid-area: controls;
        display: flex;
        gap: 0.25rem;
        justify-content: flex-end;
    }

    .now-playing-bar .player-controls {
        grid-area: progress;
        width: 100%;
    }

    .player-controls .buttons {
        gap: var(--spacing-md);
    }

    .player-controls .buttons button {
        width: 28px;
        height: 28px;
    }

    .player-controls .buttons .play-pause-btn {
        width: 32px;
        height: 32px;
    }

    .desktop-only {
        display: none !important;
    }

    .volume-controls button:not(.desktop-only) {
        display: flex;
    }

    #download-notifications {
        bottom: calc(56px + 12px); /* 56px (tab bar height) + 12px spacing */
        right: 12px;
        left: auto;
        max-width: calc(100vw - 24px);
        transition: bottom 0.3s ease;
    }

    /* When now-playing bar is visible on mobile, push notifications up */
    body:has(.now-playing-bar.npb-visible) #download-notifications {
        bottom: calc(56px + 8px + var(--player-bar-height-mobile) + 12px);
    }

    .track-menu-btn {
        opacity: 1;
    }

    .dl-delete-btn {
        opacity: 1 !important;
    }

    .about-links {
        flex-direction: column;
    }

    .github-link {
        width: 100%;
        justify-content: center;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .setting-item .info {
        width: 100%;
    }

    .template-input {
        max-width: none;
        font-size: 0.85rem;
    }

    .track-item {
        grid-template-columns: 36px 1fr auto auto;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .track-item-info {
        gap: var(--spacing-sm);
        min-width: 0;
        overflow: hidden;
    }

    .track-item-cover {
        width: 36px;
        height: 36px;
    }

    .track-item-details {
        min-width: 0;
        overflow: hidden;
    }

    .track-item-duration {
        text-align: right;
        white-space: nowrap;
    }

    .track-menu-btn svg {
        width: 18px;
        height: 18px;
    }

    .track-action-btn {
        padding: 0.25rem;
    }

    .queue-track-item {
        grid-template-columns: 24px 1fr 40px 32px 32px;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .queue-track-item .drag-handle {
        width: 24px;
    }

    .queue-track-item .drag-handle svg {
        width: 14px;
        height: 14px;
    }

    .queue-track-item .track-item-cover {
        width: 36px;
        height: 36px;
    }

    .queue-track-item .queue-like-btn,
    .queue-track-item .queue-remove-btn {
        padding: 0.5rem;
        width: 32px;
        height: 32px;
    }

    .sidebar-nav .nav-item a {
        padding: 1rem 0.75rem;
    }

    .offline-notification,
    .update-notification {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 10px;
    }

    .side-panel {
        width: 100vw;
        max-width: 100vw;
        bottom: 0;
    }

    /* Lyrics panel fullscreen on mobile (like Apple Music) */
    .side-panel[data-view='lyrics'] {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: 100vw;
        z-index: 9999;
        border-left: none;
        border-radius: 0;
        background: rgba(9, 9, 11, 0.95);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
    }

    .side-panel[data-view='lyrics'] .panel-content {
        padding-bottom: 2rem;
    }

    .panel-content {
        padding-bottom: calc(var(--player-bar-height-mobile) + 2rem);
    }

    .synced-line {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: -0.02em;
    }

    .synced-line.active {
        font-size: 1.05rem;
        font-weight: 800;
    }

    .karaoke-title {
        font-size: 1.5rem;
    }

    .karaoke-artist {
        font-size: 1rem;
    }

    .karaoke-line {
        font-size: 1.25rem;
    }

    .karaoke-line.active {
        font-size: 1.75rem;
    }

    .fullscreen-cover-content {
        flex-direction: column;
        padding: 1rem 1.5rem 2rem;
    }

    .csv-import-progress {
        bottom: 145px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: 0;
    }

    .missing-tracks-modal {
        width: 95%;
        max-height: 90vh;
        margin: 1rem;
    }

    .missing-tracks-header,
    .missing-tracks-content,
    .missing-tracks-actions {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .missing-tracks-header {
        padding-top: 1.5rem;
        padding-bottom: 1rem;
    }

    .missing-tracks-content {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .missing-tracks-actions {
        padding-top: 1rem;
        padding-bottom: 1.5rem;
    }

    .missing-tracks-list ul {
        max-height: 250px;
    }

    .missing-tracks-header h3 {
        font-size: 1.25rem;
    }

    .missing-tracks-content p {
        font-size: 0.95rem;
    }

    .missing-tracks-list li {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }

    .mobile-only {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--spacing-sm);
    }

    .section-title {
        font-size: 1.25rem;
    }

    .detail-header-info .title {
        font-size: 1.25rem;
    }

    .detail-header-info .title.long-title {
        font-size: 1.1rem;
    }

    .detail-header-info .title.very-long-title {
        font-size: 0.9rem;
    }

    .search-tab {
        padding: 0.4rem 0.85rem;
        font-size: 0.72rem;
    }

    .player-controls .buttons {
        gap: 0.25rem;
    }

    .player-controls .buttons button {
        width: 24px;
        height: 24px;
    }

    .player-controls .buttons button svg {
        width: 16px;
        height: 16px;
    }

    .player-controls .buttons .play-pause-btn {
        width: 28px;
        height: 28px;
    }

    .player-controls .buttons .play-pause-btn svg {
        width: 18px;
        height: 18px;
    }

    .volume-controls button {
        padding: 0.25rem;
        min-width: 28px;
        min-height: 28px;
    }

    .volume-controls button svg {
        width: 16px;
        height: 16px;
    }

    .track-item {
        grid-template-columns: 32px 1fr 40px auto;
        gap: 0.375rem;
        padding: var(--spacing-xs);
    }

    .track-number {
        width: 32px;
    }

    .track-item-cover {
        width: 32px;
        height: 32px;
    }

    .track-item-details .title {
        font-size: 0.85rem;
    }

    .track-item-details .artist {
        font-size: 0.75rem;
    }

    .track-item-duration {
        font-size: 0.75rem;
    }

    .track-menu-btn {
        padding: 0.25rem;
    }

    .track-menu-btn svg {
        width: 16px;
        height: 16px;
    }

    .queue-track-item {
        grid-template-columns: 20px 1fr 36px 32px 32px;
        gap: 0.375rem;
        padding: 0.5rem;
    }

    .queue-track-item .drag-handle {
        width: 20px;
    }

    .queue-track-item .track-item-cover {
        width: 32px;
        height: 32px;
    }

    .queue-track-item .queue-like-btn,
    .queue-track-item .queue-remove-btn {
        width: 32px;
        height: 32px;
    }

    [data-track-actions-mode='inline'] .track-actions-inline .track-action-btn:not([data-action='play-next']) {
        display: none;
    }

    .player-actions-row {
        gap: 0.25rem;
    }
}

@media (max-width: 360px) {
    .player-controls .buttons {
        justify-content: space-between;
        width: 100%;
    }

    #shuffle-btn,
    #repeat-btn {
        display: none;
    }
}

/* stylelint-disable-next-line media-feature-name-value-no-unknown */
@media (display-mode: window-controls-overlay) {
    .app-container {
        margin-top: env(titlebar-area-height, 0);
    }

    .main-header {
        -webkit-app-region: drag;
    }

    .main-header * {
        -webkit-app-region: no-drag;
    }

    .sidebar {
        padding-top: max(1.5rem, env(titlebar-area-height, 0));
    }
}


@media (hover: none) {
    .track-menu-btn {
        opacity: 1;
    }

    .dl-delete-btn {
        opacity: 1 !important;
    }

    .track-actions-inline {
        opacity: 1;
    }

    .queue-track-item .queue-remove-btn {
        opacity: 1;
    }

}

@media (hover: none) and (pointer: coarse) {
    .main-content {
        padding: var(--spacing-sm) 0.5rem;
        grid-area: main;
    }

    .progress-bar:not(.waveform-loaded),
    .volume-bar {
        height: 8px;
    }

    .progress-bar .progress-fill::after,
    .volume-bar .volume-fill::after {
        content: '';
        position: absolute;
        right: -8px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        background-color: var(--highlight);
        border-radius: 50%;
        box-shadow: 0 2px 6px rgb(0, 0, 0, 0.3);
    }

    button {
        min-height: 36px;
        min-width: 36px;
    }

    .track-item {
        grid-template-columns: 32px 1fr 32px auto;
    }

    .player-controls .buttons button {
        min-height: 36px;
        min-width: 36px;
    }

    .card:hover {
        transform: none !important;
    }

}

body:has(#fullscreen-cover-overlay:not([style*='display: none'])) .now-playing-bar {
    display: none !important;
}

@media (max-width: 768px) {
    .now-playing-bar {
        width: 96% !important;
        left: 2%;
    }
}

/* Custom Tooltip */
#custom-tooltip {
    position: fixed;
    background: rgba(17, 17, 19, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--card-foreground);
    padding: 0.5rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.1s ease;
    white-space: nowrap;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 769px) {
    body.sidebar-collapsed .app-container {
        grid-template-columns: 80px 1fr;
    }

    body.sidebar-collapsed .sidebar-logo span {
        display: none;
    }

    body.sidebar-collapsed .sidebar-nav span {
        display: none;
    }

    body.sidebar-collapsed .sidebar-logo {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }

    body.sidebar-collapsed .sidebar-nav .nav-item a {
        justify-content: center;
        padding: 0.75rem 0;
    }

    body.sidebar-collapsed .now-playing-bar {
        width: calc(96% - 80px) !important;
        left: calc(80px + 2%);
    }

    body.sidebar-collapsed #sidebar-toggle {
        margin-left: 0 !important;
    }
}

/* Track page removed - tracks now play directly */

.tracker-modal .track-item.loading {
    opacity: 0.7;
    pointer-events: none;
}

.tracker-modal .track-item.loading .track-number {
    color: var(--highlight);
}

@media (max-width: 768px) {
    .tracker-modal .modal-content {
        height: 90vh !important;
        max-height: 90vh !important;
        padding: 1rem !important;
    }

    .tracker-modal .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem !important;
    }

    .tracker-modal .detail-header-image {
        width: 80px !important;
        height: 80px !important;
    }

    .tracker-modal .detail-header-info .title {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem;
    }

    .tracker-modal .detail-header-info .meta {
        max-height: 60px;
        overflow-y: auto;
        display: block;
        font-size: 0.85rem;
    }

    .tracker-modal .detail-header-actions .btn-secondary {
        width: auto !important;
        height: auto !important;
        padding: 0.5rem 1.5rem !important;
        border-radius: 2rem !important;
    }

    #tracker-filters {
        padding: 0 0 0.5rem !important;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .tracker-modal .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }

    .tracker-modal .detail-header-image {
        width: 100px !important;
        height: 100px !important;
    }

    .tracker-modal .detail-header-info .title {
        font-size: 1.5rem !important;
    }

    .tracker-modal .detail-header-info .meta {
        max-height: 80px;
        overflow-y: auto;
        display: block;
    }
}

/* Fullscreen layout shift when side panel is active */
body:has(#side-panel.active) .fullscreen-main-view {
    transition:
        flex 0.3s ease,
        padding-right 0.3s ease,
        margin-right 0.3s ease;
    padding-right: 600px;
}

body:has(#side-panel.active) .fullscreen-lyrics-toggle {
    /* no absolute positioning needed */
}

body:has(#side-panel.active) #close-fullscreen-cover-btn {
    right: calc(600px + 1rem);
}

@media (max-width: 1200px) {
    body:has(#side-panel.active) .fullscreen-main-view {
        padding-right: 50vw;
    }

    body:has(#side-panel.active) .fullscreen-lyrics-toggle {
        /* no absolute positioning needed */
    }

    body:has(#side-panel.active) #close-fullscreen-cover-btn {
        right: calc(50vw + 1rem);
    }
}

@media (max-width: 768px) {
    body:has(#side-panel.active) .fullscreen-main-view {
        padding-right: 0;
    }

    /* Hide fullscreen specific buttons on mobile when panel is open */
    body:has(#side-panel.active) .fullscreen-lyrics-toggle,
    body:has(#side-panel.active) #close-fullscreen-cover-btn {
        display: none;
    }
}

@media (max-width: 480px) {
    .player-controls .buttons {
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .player-controls .buttons button svg {
        width: 25px;
        height: 25px;
    }
}

/* =========================================
   Global Design System Standardization
   ========================================= */

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    border: 2px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* Inputs & Form Elements */
input,
select,
textarea {
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgb(var(--highlight-rgb), 0.2);
}

.modal.active .modal-content {
    animation: pop-in var(--transition-normal) var(--ease-out-back);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border);
}

/* Micro-animations for Interactive Elements */
.nav-item a {
    position: relative;
    overflow: hidden;
}

.nav-item a:active {
    transform: scale(0.97);
}

/* =========================================
   16-Band Equalizer
   ========================================= */

.equalizer-container {
    margin-top: var(--spacing-md);
    padding: var(--spacing-lg);
    background: linear-gradient(145deg, var(--card), rgb(var(--highlight-rgb), 0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 1px rgb(255, 255, 255, 0.05);
}

.equalizer-header {
    margin-bottom: var(--spacing-lg);
}

.equalizer-preset-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.equalizer-preset-row label {
    font-size: 0.9rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.equalizer-preset-row select {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
    padding: 0.5rem 1rem;
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.9rem;
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.equalizer-preset-row select:hover {
    border-color: var(--primary);
}

.equalizer-preset-row select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgb(var(--highlight-rgb), 0.2);
}

#equalizer-reset-btn {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--input);
    border: 1px solid var(--border);
    color: var(--muted-foreground);
    transition: all var(--transition-fast);
}

#equalizer-reset-btn:hover {
    background: var(--card);
    border-color: var(--primary);
    color: var(--foreground);
}

#equalizer-reset-btn svg {
    transition: transform 0.3s ease;
}

#equalizer-reset-btn:hover svg {
    transform: rotate(-45deg);
}

.equalizer-bands {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: var(--spacing-md) 0;
    position: relative;
}

/* Zero line indicator */
.equalizer-bands::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

/* Vertical slider styling */
.eq-slider {
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 8px;
    height: 120px;
    background: transparent;
    cursor: pointer;
    position: relative;
}

/* Track */
.eq-slider::-webkit-slider-runnable-track {
    width: 6px;
    height: 100%;
    background: linear-gradient(to top, var(--muted), var(--input));
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.eq-slider::-moz-range-track {
    width: 6px;
    height: 100%;
    background: linear-gradient(to top, var(--muted), var(--input));
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

/* Thumb */
.eq-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(145deg, var(--primary), var(--highlight));
    border-radius: 50%;
    cursor: grab;
    margin-left: -6px;
    box-shadow:
        0 2px 8px rgb(0, 0, 0, 0.3),
        inset 0 1px 2px rgb(255, 255, 255, 0.3);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    border: 2px solid var(--background);
}

.eq-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(145deg, var(--primary), var(--highlight));
    border-radius: 50%;
    cursor: grab;
    box-shadow:
        0 2px 8px rgb(0, 0, 0, 0.3),
        inset 0 1px 2px rgb(255, 255, 255, 0.3);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    border: 2px solid var(--background);
}

.eq-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow:
        0 4px 12px rgb(var(--highlight-rgb), 0.4),
        inset 0 1px 2px rgb(255, 255, 255, 0.3);
}

.eq-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow:
        0 4px 12px rgb(var(--highlight-rgb), 0.4),
        inset 0 1px 2px rgb(255, 255, 255, 0.3);
}

.eq-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.eq-slider::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.eq-slider:focus {
    outline: none;
}

.eq-slider:focus::-webkit-slider-thumb {
    box-shadow:
        0 0 0 4px rgb(var(--highlight-rgb), 0.3),
        0 2px 8px rgb(0, 0, 0, 0.3);
}

.eq-slider:focus::-moz-range-thumb {
    box-shadow:
        0 0 0 4px rgb(var(--highlight-rgb), 0.3),
        0 2px 8px rgb(0, 0, 0, 0.3);
}

.eq-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--foreground);
    min-width: 28px;
    text-align: center;
    padding: 2px 4px;
    background: var(--input);
    border-radius: var(--radius-sm);
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.eq-value.positive {
    color: var(--highlight);
    background: rgb(var(--highlight-rgb), 0.15);
}

.eq-value.negative {
    color: #ef4444;
    background: rgb(239, 68, 68, 0.15);
}

.eq-freq {
    font-size: 0.65rem;
    color: var(--muted-foreground);
    text-align: center;
    white-space: nowrap;
    font-weight: 500;
}

.equalizer-scale {
    display: flex;
    justify-content: space-between;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border);
    margin-top: var(--spacing-sm);
}

.equalizer-scale span {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .equalizer-container {
        padding: var(--spacing-md);
    }

    .equalizer-bands {
        gap: 2px;
        overflow-x: auto;
        padding-bottom: var(--spacing-sm);
        -webkit-overflow-scrolling: touch;
    }

    .eq-band {
        min-width: 36px;
    }

    .eq-slider {
        height: 100px;
    }

    .eq-slider::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
        margin-left: -5px;
    }

    .eq-slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    .eq-freq {
        font-size: 0.55rem;
    }

    .eq-value {
        font-size: 0.6rem;
        min-width: 24px;
    }
}

@media (max-width: 480px) {
    .equalizer-preset-row {
        flex-direction: column;
        align-items: stretch;
    }

    .equalizer-preset-row select {
        max-width: none;
    }

    .equalizer-preset-row label {
        margin-bottom: -0.5rem;
    }

    .eq-slider {
        height: 80px;
    }

    .eq-band {
        min-width: 30px;
    }
}

/* Track List Search */
.track-list-search-container {
    margin: 1rem 0;
}

.track-list-search-input {
    font-size: 0.95rem;
}

/* ========== Home Header Title ========== */
.home-header-title {
    display: none;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1;
    text-align: left;
    flex: 1;
    letter-spacing: -0.02em;
}

.main-header.on-home .home-header-title {
    display: flex;
}

.home-header-title .logo-tunes {
    font-family: 'Tiny5', cursive;
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1;
}

.home-header-title .logo-byline {
    font-family: 'Cinzel', serif;
    font-size: 0.45rem;
    font-weight: 400;
    color: var(--muted-foreground);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    line-height: 1;
    margin-top: 2px;
}

.main-header.on-home .search-bar {
    display: none !important;
}

/* ========== Mobile Bottom Tab Bar ========== */
.mobile-tab-bar {
    display: none;
}


@media (max-width: 768px) {
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        border-radius: 1.25rem 1.25rem 0 0;
        background: rgba(20, 20, 22, 0.25);
        backdrop-filter: blur(30px) saturate(1.8);
        -webkit-backdrop-filter: blur(30px) saturate(1.8);
        border-top: 0.5px solid rgba(255, 255, 255, 0.15);
        z-index: 2100;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-tab-bar .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        height: 100%;
        color: rgba(255, 255, 255, 0.45);
        text-decoration: none;
        gap: 2px;
        transition: color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .mobile-tab-bar .tab-item:active {
        transform: scale(0.92);
    }

    .mobile-tab-bar .tab-item .tab-icon {
        font-size: 24px;
        font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
        transition: font-variation-settings 0.25s ease;
    }

    .mobile-tab-bar .tab-item.active .tab-icon {
        font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    }

    .mobile-tab-bar .tab-item .tab-label {
        font-size: 0.58rem;
        font-weight: 500;
        letter-spacing: 0.02em;
    }

    .mobile-tab-bar .tab-item.active {
        color: var(--highlight, #fff);
    }

    /* Push tab bar up when update bar is visible */
    body.has-update-bar .mobile-tab-bar {
        bottom: 34px;
        transition: bottom 0.5s cubic-bezier(.22,1,.36,1);
    }

    /* Slide-down animation for hiding tab bar */
    @keyframes tab-bar-slide-down {
        from { transform: translateY(0); opacity: 1; }
        to   { transform: translateY(100%); opacity: 0; }
    }

    /* Hide tab bar when fullscreen, lyrics panel, admin, or now-playing is open */
    body.fullscreen-open .mobile-tab-bar,
    body:has(#side-panel.active) .mobile-tab-bar,
    body.hide-tab-bar .mobile-tab-bar {
        animation: tab-bar-slide-down 0.3s ease forwards;
        pointer-events: none;
    }

    /* Also hide update bar when tab bar is hidden */
    body.fullscreen-open .tunes-update-bar,
    body:has(#side-panel.active) .tunes-update-bar,
    body.hide-tab-bar .tunes-update-bar {
        opacity: 0 !important;
        transform: translateY(100%) !important;
        pointer-events: none;
    }

    /* Push now-playing-bar above the tab bar on mobile */
    .now-playing-bar {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 8px) !important;
    }

    body.fullscreen-open .now-playing-bar,
    body.hide-tab-bar .now-playing-bar {
        display: none !important;
    }

    /* Hide now-playing-bar when queue panel is open */
    body:has(#side-panel.active[data-view="queue"]) .now-playing-bar {
        display: none !important;
    }

    .main-content {
        padding-bottom: calc(56px + 16px) !important;
    }

    /* Add extra padding when now-playing-bar is visible to prevent overlap */
    body:has(.now-playing-bar.npb-visible) .main-content {
        padding-bottom: calc(var(--player-bar-height-mobile) + 56px + env(safe-area-inset-bottom, 0px) + 24px) !important;
    }

    /* Also add padding to any page containers that might scroll */
    body:has(.now-playing-bar.npb-visible) .page {
        padding-bottom: calc(var(--player-bar-height-mobile) + 56px + env(safe-area-inset-bottom, 0px) + 24px) !important;
    }
}

:root[data-theme='light'] .mobile-tab-bar {
    background: rgba(255, 255, 255, 0.25);
    border-top-color: rgba(255, 255, 255, 0.4);
}

:root[data-theme='light'] .mobile-tab-bar .tab-item {
    color: rgba(0, 0, 0, 0.4);
}

:root[data-theme='light'] .mobile-tab-bar .tab-item.active {
    color: var(--highlight, #6366f1);
}

/* ── Download sub-view: back button + tabs ───────────── */
.dl-back-to-library {
    width: 36px; height: 36px; min-width: 36px; min-height: 36px;
    border-radius: 50%; border: none; padding: 0;
    background: rgba(255,255,255,0.08); color: var(--foreground);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.6rem;
    transition: background 0.15s ease;
}
.dl-back-to-library:hover { background: rgba(255,255,255,0.14); }

.dl-tabs {
    display: flex;
    gap: 0.35rem;
    position: relative;
    margin: 0 0.5rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 0.3rem;
}

.dl-tab {
    flex: 1;
    background: none; border: none; padding: 0.5rem 0;
    color: rgba(255,255,255,0.4);
    font-size: 0.72rem; font-weight: 700; font-family: inherit;
    text-transform: uppercase; letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    border-radius: 10px;
}
.dl-tab:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.04); }
.dl-tab.active { color: #fff; background: var(--primary, #6366f1); }
.dl-tab.active::after { display: none; }

:root[data-theme='light'] .library-toolbar { background: rgba(255,255,255,0.72); }
:root[data-theme='light'] .library-filters-row { border-bottom-color: rgba(0,0,0,0.06); }
:root[data-theme='light'] .library-chip { color: rgba(0,0,0,0.35); }
:root[data-theme='light'] .library-chip:hover { color: rgba(0,0,0,0.65); }
:root[data-theme='light'] .library-chip.active { color: #000; }

:root[data-theme='light'] .library-subview-header { background: radial-gradient(ellipse at 0% 50%, color-mix(in srgb, var(--subview-accent) 10%, transparent), transparent 60%), rgba(245,245,248,0.92); border-bottom-color: color-mix(in srgb, var(--subview-accent) 8%, rgba(0,0,0,0.04)); }
:root[data-theme='light'] .library-subview-header .library-back-btn { background: color-mix(in srgb, var(--subview-accent) 6%, transparent); }
:root[data-theme='light'] .library-subview-header .library-action-btn { background: color-mix(in srgb, var(--subview-accent) 6%, transparent); }
:root[data-theme='light'] .library-filters { mask-image: linear-gradient(to right, transparent 0%, black 4%, black 92%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 92%, transparent 100%); }
:root[data-theme='light'] .dl-back-to-library { background: rgba(0,0,0,0.06); }
:root[data-theme='light'] .dl-back-to-library:hover { background: rgba(0,0,0,0.1); }
:root[data-theme='light'] .dl-tabs { border-bottom-color: rgba(0,0,0,0.08); }
:root[data-theme='light'] .dl-tab { color: rgba(0,0,0,0.35); }
:root[data-theme='light'] .dl-tab:hover { color: rgba(0,0,0,0.65); }
:root[data-theme='light'] .dl-tab.active { color: #000; }

/* Remove ALL blur effects in light mode */
:root[data-theme='light'] * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ── Account Stats Grid ──────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    --stat-accent: #a78bfa;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 1.1rem 0.5rem 0.9rem;
    background: var(--card);
    border-radius: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* subtle accent glow behind the card */
.stat-card::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle at 50% 30%, var(--stat-accent), transparent 70%);
    opacity: 0.06;
    pointer-events: none;
}

.stat-card-icon {
    font-size: 1.5rem;
    color: var(--stat-accent);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.stat-card-value {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card-label {
    font-size: 0.62rem;
    opacity: 0.4;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ─── Admin Selects (dark-themed custom dropdowns) ─── */
.admin-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color-scheme: dark;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.5rem 2rem 0.5rem 0.7rem;
    color: var(--foreground);
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.45)' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 12px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.admin-select:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background-color: rgba(255, 255, 255, 0.09);
}

.admin-select:focus {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}

.admin-select option {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 0.5rem;
    font-size: 0.82rem;
}

/* ─── Gradient Preset Swatches (dark themed) ─── */
.grad-preset {
    width: 30px !important;
    height: 30px !important;
    border-radius: 10px !important;
    cursor: pointer;
    border: 2px solid transparent !important;
    position: relative;
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.grad-preset::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.grad-preset:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.grad-preset.active {
    border-color: #c084fc !important;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.25), 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Progressive image loading - blur to sharp */
img.loading-blur {
    filter: blur(20px);
    transition: filter 0.3s ease-out;
}
img.loading-blur.loaded {
    filter: blur(0);
}

/* ══════════════════════════════════════════════════════════════════
   NATIVE APP PERFORMANCE OVERRIDES (Android WebView)
   backdrop-filter blur is extremely expensive in WebViews - disable all
   ══════════════════════════════════════════════════════════════════ */
body.native-app * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Give native elements dark glass backgrounds instead of translucent blurred */
body.native-app .sidebar { background: #09090b; }
body.native-app .now-playing-bar { background: rgba(10, 10, 12, 0.95); border: 1px solid rgba(255, 255, 255, 0.06); }
body.native-app .queue-panel, body.native-app .side-panel { background: #09090b; }
body.native-app .context-menu { background: #18181b; }
body.native-app .modal-content { background: #18181b; }
body.native-app .toast-notification { background: #18181b; }
body.native-app .fullscreen-cover-overlay { background: #000; }
body.native-app .mobile-tab-bar { background: rgba(10, 10, 12, 0.92); border-top: 0.5px solid rgba(255, 255, 255, 0.08); }
body.native-app .search-bar { background: rgba(24, 24, 27, 0.9); }
body.native-app .home-section-header { background: transparent; }
body.native-app .notification-area { background: rgba(10, 10, 12, 0.95); }

/* ══════════════════════════════════════════════════════════════════
   UX IMPROVEMENTS
   ══════════════════════════════════════════════════════════════════ */

/* --- Mini player progress line --- */
.npb-progress-line {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--highlight, var(--primary, #a855f7));
    border-radius: 2px 2px 0 0;
    z-index: 10;
    pointer-events: none;
    transition: width 0.25s linear;
}

/* --- Page transitions --- */
.page {
    opacity: 1;
    transition: opacity 0.15s ease;
}
.page:not(.active) {
    opacity: 0;
    pointer-events: none;
}
.page.page-enter {
    opacity: 0;
    animation: page-fade-in 0.18s ease forwards;
}
@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Touch targets: minimum 44x44 on mobile --- */
@media (max-width: 768px) {
    .library-action-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px;
        min-height: 44px;
    }
    .mobile-back-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        max-width: 44px;
        max-height: 44px;
    }
    .dl-remove-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px;
        min-height: 44px;
    }
    .more-btn, .three-dot-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .bottom-nav a, .mobile-tab-bar .tab-item {
        min-height: 44px;
    }
}

/* --- Empty state box --- */
.empty-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    gap: 0.75rem;
}
.empty-state-icon {
    font-size: 3rem;
    opacity: 0.2;
    user-select: none;
}
.empty-state-msg {
    font-size: 0.95rem;
    opacity: 0.5;
    margin: 0;
}
.empty-state-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    background: var(--highlight, var(--primary, #a855f7));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 0.5rem;
    transition: opacity 0.2s, transform 0.2s;
}
.empty-state-cta:hover {
    opacity: 0.85;
    transform: scale(1.04);
}

/* --- Search recent chips (above results) --- */
.search-recent-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0 0.25rem;
    scrollbar-width: none;
}
.search-recent-chips::-webkit-scrollbar { display: none; }
.search-chip {
    flex-shrink: 0;
    padding: 0.35rem 0.8rem;
    border-radius: 2rem;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 0.78rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.search-chip:hover, .search-chip:active {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
}

/* --- Now-playing bar cover: expand animation to fullscreen --- */
.now-playing-bar .cover {
    view-transition-name: npb-cover;
}
#fullscreen-cover-overlay {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#fullscreen-cover-overlay.fs-opening {
    animation: fs-open 0.35s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes fs-open {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Accessibility: prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .page.page-enter {
        animation: none !important;
        opacity: 1 !important;
    }
    #fullscreen-cover-overlay.fs-opening {
        animation: none !important;
    }
}

