:root {
            --accent-color: #22d3ee;
            --accent-color-2: #2dd4bf;
            --album-art-gradient: conic-gradient(from 0deg, #434343, #000000, #434343);
            --mobile-keyboard-offset: 0px;
            --mobile-keyboard-lift: 0px;
        }

        body {
            font-family: 'Inter', sans-serif;
            overflow: hidden; 
            background-color: #050505; 
            color: white;
            overscroll-behavior: none; 
        }

        /* --- Minimal Scrollbars --- */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
        .custom-scrollbar::-webkit-scrollbar { width: 4px; }
        .desktop-auth-button { display: none; }
        @media (min-width: 768px) { .desktop-auth-button:not(.hidden) { display: inline-flex; } }

        .accent-panel { border: 1px solid color-mix(in srgb, var(--accent-color) 20%, transparent); background: color-mix(in srgb, var(--accent-color) 10%, transparent); }

        .beta-label { display: inline-flex; align-items: center; height: 1.25rem; padding: 0 0.45rem; border-radius: 9999px; border: 1px solid color-mix(in srgb, var(--accent-color) 45%, transparent); background: color-mix(in srgb, var(--accent-color) 12%, transparent); color: var(--accent-color); font-size: 0.62rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }


        /* --- Professional Equalizer Deck & Sliders --- */
        .eq-bands {
            display: grid;
            grid-template-columns: repeat(10, minmax(46px, 1fr));
            gap: 0.5rem;
            align-items: end;
            overflow-x: auto;
            padding: 1.1rem 0.75rem 0.85rem;
            border-radius: 1.25rem;
            background: rgba(10, 10, 14, 0.6);
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.5);
        }
        .eq-band {
            min-width: 46px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.55rem;
            color: white;
            user-select: none;
        }
        .eq-value {
            font-size: 0.66rem;
            font-weight: 900;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            color: var(--accent-color);
            white-space: nowrap;
            text-shadow: 0 0 10px color-mix(in srgb, var(--accent-color) 45%, transparent);
            letter-spacing: -0.02em;
        }
        .eq-slider-container {
            position: relative;
            height: 150px;
            width: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .eq-zero-line {
            position: absolute;
            top: 50%;
            left: 4px;
            right: 4px;
            height: 1px;
            background: rgba(255, 255, 255, 0.22);
            pointer-events: none;
            z-index: 1;
        }
        .eq-slider {
            writing-mode: vertical-lr;
            direction: rtl;
            width: 22px;
            height: 150px;
            background: transparent;
            cursor: pointer;
            accent-color: var(--accent-color);
            position: relative;
            z-index: 2;
            -webkit-appearance: slider-vertical;
        }
        .eq-label {
            font-size: 0.72rem;
            font-weight: 900;
            color: rgba(255, 255, 255, 0.9);
            line-height: 1;
        }
        .eq-sublabel {
            font-size: 0.56rem;
            font-weight: 700;
            color: rgba(255, 255, 255, 0.45);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            margin-top: 0.2rem;
            line-height: 1;
        }
        .eq-preset-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.35rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.72rem;
            font-weight: 700;
            white-space: nowrap;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.05);
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            user-select: none;
        }
        .eq-preset-chip:hover {
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
            border-color: rgba(255, 255, 255, 0.2);
            transform: translateY(-1px);
        }
        .eq-preset-chip.active {
            background: var(--accent-color);
            color: #000;
            font-weight: 900;
            border-color: var(--accent-color);
            box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-color) 40%, transparent);
        }

        /* --- Universal Glass & Blur System --- */
        .glass-panel {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.08);
            transform: translateZ(0);
            backface-visibility: hidden;
        }

        /* Player Bar, User Menu, Navigation, Modals & Dropdown Rich Blurs */
        header.glass-panel,
        #mobile-nav,
        #player-card,
        #info-island,
        #queue-preview-pill,
        #queue-expandable-area,
        #queue-wrapper,
        #queue-blur-bg,
        #profile-dropdown,
        #profile-modal .glass-panel,
        #playlist-modal .glass-panel,
        #playlist-selector-modal .glass-panel,
        #equalizer-modal .glass-panel,
        #spotify-modal .glass-panel,
        #context-menu,
        .search-blur-bg {
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            background: rgba(18, 18, 24, 0.85);
        }

        #profile-dropdown {
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            background: rgba(16, 16, 22, 0.9);
            box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
        }

        #player-card {
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            background: rgba(14, 14, 18, 0.88);
            border: 1px solid rgba(255, 255, 255, 0.12);
            box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
        }

        /* --- Advanced Marquee Engine --- */
        .marquee-container { width: 100%; overflow: hidden; display: flex; align-items: center; }
        .marquee-container.is-overflowing {
            mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
            -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
        }
        .marquee-text { display: inline-block; white-space: nowrap; transform: translateZ(0); }
        .marquee-text.is-overflowing { animation: js-slide-text var(--scroll-dur, 5s) linear infinite alternate; }
        .hover-pause:hover .marquee-text { animation-play-state: paused !important; }
        
        @keyframes js-slide-text {
            0%, 15% { transform: translateX(0); }
            85%, 100% { transform: translateX(var(--scroll-dist)); }
        }

        /* --- Unified Song Pill --- */
        .song-pill {
            display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; padding-right: 1rem;
            background: rgba(18, 18, 22, 0.85);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 1rem; cursor: pointer;
            transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, background-color 0.2s ease;
            user-select: none;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2), 0 2px 4px -1px rgba(0,0,0,0.1);
            transform: translateZ(0);
            backface-visibility: hidden;
            contain: layout style;
        }
        .song-pill:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(26, 26, 32, 0.9); }
        .song-pill img { width: 3rem; height: 3rem; border-radius: 0.75rem; object-fit: cover; flex-shrink: 0; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1); }
        .song-pill-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }

        /* --- Main & Horizontal Scroll Performance Logic --- */
        #main-container {
            height: 100dvh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-y: contain;
            contain: layout paint;
            transform: translateZ(0);
        }

        #view-home > section,
        #view-library > section {
            content-visibility: auto;
            contain-intrinsic-size: auto 280px;
        }

        body.is-scrolling .marquee-text {
            animation-play-state: paused !important;
        }
        body.is-scrolling * {
            pointer-events: none !important;
        }
        body.is-scrolling #main-container,
        body.is-scrolling .horizontal-scroll,
        body.is-scrolling #player-footer {
            pointer-events: auto !important;
        }

        .horizontal-scroll {
            display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem;
            scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; padding-left: 2rem; padding-right: 2rem;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-x: contain;
            contain: layout paint;
            transform: translateZ(0);
        }
        .horizontal-scroll::-webkit-scrollbar { display: none; }
        .scroll-card {
            flex-shrink: 0;
            flex-basis: calc((100% - (2 * 1rem)) / 2.5);
            min-width: 0;
            user-select: none;
            transform: translateZ(0);
            backface-visibility: hidden;
            contain: layout style;
            transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.22s ease;
        }
        @media (min-width: 768px) { .scroll-card { flex-basis: calc((100% - (4 * 1rem)) / 4.5); } }
        @media (min-width: 1024px) { .scroll-card { flex-basis: calc((100% - (6 * 1rem)) / 6.5); } }

        .scroll-card:hover {
            transform: translateY(-4px);
        }

        .scroll-card img,
        .for-you-card img,
        .discover-card img {
            transform: translateZ(0);
            backface-visibility: hidden;
            transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        }

        /* --- Horizontal Scrolling Localized Edge Blurs --- */
        .row-blur-left {
            position: absolute; left: 0; top: -6px; bottom: -6px; width: 38px; z-index: 10; pointer-events: none;
            backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            mask-image: linear-gradient(to right, black 25%, transparent 100%);
            -webkit-mask-image: linear-gradient(to right, black 25%, transparent 100%);
            transform: translateZ(0);
        }
        .row-blur-right {
            position: absolute; right: 0; top: -6px; bottom: -6px; width: 38px; z-index: 10; pointer-events: none;
            backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            mask-image: linear-gradient(to left, black 25%, transparent 100%);
            -webkit-mask-image: linear-gradient(to left, black 25%, transparent 100%);
            transform: translateZ(0);
        }

        /* --- Search Bar & Smooth Dropdown --- */
        .search-input {
            background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 9999px; padding: 0.6rem 1rem 0.6rem 2.5rem; width: 100%; color: white; transition: all 0.3s;
        }
        .search-input:focus { outline: none; border-color: var(--accent-color); background: rgba(255, 255, 255, 0.08); }
        .search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
        .mobile-search-cancel { display: none; }
        
        .search-dropdown-wrapper { position: absolute; top: 100%; left: -20px; right: -20px; padding: 20px; pointer-events: none; z-index: 100; visibility: hidden; }
        .search-blur-bg {
            inset: 0; border-radius: 2rem; position: absolute; background: rgba(10, 10, 10, 0.6); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); pointer-events: none;
            mask-image: radial-gradient(ellipse at top, black 50%, transparent 90%); -webkit-mask-image: radial-gradient(ellipse at top, black 50%, transparent 90%); opacity: 0; transition: opacity 0.3s;
        }
        .search-results-content {
            position: relative; z-index: 10; background: transparent; border-radius: 1.5rem; max-height: 50vh; overflow: hidden; display: flex; flex-direction: column; gap: 0.25rem;
            opacity: 0; transform: translateY(-10px); transition: all 0.3s ease;
        }
        .search-dropdown-wrapper.active { pointer-events: auto; visibility: visible; }
        .search-dropdown-wrapper.active .search-blur-bg { opacity: 1; }
        .search-dropdown-wrapper.active .search-results-content { opacity: 1; transform: translateY(0); padding: 0.5rem; }

        /* Keep topbar controls clickable even with click-through positioner wrapper. */
        #search-wrapper,
        #search-shell,
        #search-shell > .relative.flex-1.flex.items-center {
            pointer-events: auto;
        }

        /* --- Player Components --- */
        #seek-bar-container { position: relative; width: 100%; height: 60px; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s; touch-action: none; }
        #seek-bar-container.disabled { opacity: 0.3; pointer-events: none; }
        #seek-bar-track { position: absolute; height: 2px; width: 100%; background-color: rgba(255, 255, 255, 0.15); border-radius: 3px; top: 50%; transform: translateY(-50%); clip-path: inset(0 0 0 0%); transition: height 0.2s; pointer-events: none; }
        #visualizer-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; clip-path: inset(0 100% 0 0); }
        input[type="range"]#seek-bar { -webkit-appearance: none; appearance: none; position: absolute; left: 0; width: 100%; background: transparent; outline: none; margin: 0; padding: 0; z-index: 2; cursor: pointer; height: 20px; top: 50%; transform: translateY(-50%); }
        input[type="range"]#seek-bar::-webkit-slider-runnable-track { width: 100%; height: 2px; background: transparent; }
        input[type="range"]#seek-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; background: #fff; border-radius: 50%; cursor: pointer; box-shadow: 0 0 10px rgba(0,0,0,0.5); transition: transform 0.1s; margin-top: -5px; }
        input[type="range"]#seek-bar:disabled::-webkit-slider-thumb { display: none; }
        input[type="range"]#seek-bar::-webkit-slider-thumb:hover { transform: scale(1.5); }
        
        #seek-tooltip { position: absolute; top: -35px; background: rgba(0, 0, 0, 0.9); color: white; font-size: 11px; font-family: monospace; padding: 4px 8px; border-radius: 4px; pointer-events: none; opacity: 0; transform: translateX(-50%) translateY(10px); transition: opacity 0.2s ease, transform 0.2s ease; z-index: 20; border: 1px solid rgba(255, 255, 255, 0.1); white-space: nowrap; }
        #seek-tooltip.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

        #album-art-glow { position: absolute; inset: -6px; z-index: -1; background: var(--album-art-gradient); filter: blur(15px); opacity: 0.8; animation: spin 8s linear infinite; border-radius: 50%; will-change: transform; }
        @keyframes spin { from { --angle: 0deg; } to { --angle: 360deg; } }
        button.active-state { color: var(--accent-color); }
        #background-playing { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.5s ease, background 1.5s ease; }

        /* --- Desktop Queue Expansion Logic --- */
        #queue-blur-bg { 
            position: absolute; inset: -40px; border-radius: 3rem; z-index: 0;
            background: transparent; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); pointer-events: none; opacity: 0; transition: opacity 0.4s;
            mask-image: radial-gradient(ellipse at center bottom, black 40%, transparent 80%);
            -webkit-mask-image: radial-gradient(ellipse at center bottom, black 40%, transparent 80%);
        }
        #player-active-area { position: relative; width: 100%; display: flex; flex-direction: column; z-index: 20; }
        #queue-expandable-area { transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; max-height: 0; opacity: 0; overflow: hidden; width: 100%; display: flex; flex-direction: column; }
        #queue-preview-slot { transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; max-height: 0; opacity: 0; overflow: hidden; width: 100%; }

        /* Preview State */
        #queue-wrapper.preview-expanded #queue-blur-bg { opacity: 1; }
        #queue-wrapper.preview-expanded #queue-preview-slot { max-height: 100px; opacity: 1; margin-top: 0.5rem; }
        
        /* Desktop Expanded State */
        #queue-wrapper.queue-expanded #queue-blur-bg { opacity: 1; }
        #queue-wrapper.queue-expanded #queue-expandable-area { max-height: 500px; opacity: 1; pointer-events: auto; }
        #queue-wrapper.queue-expanded #queue-preview-slot { opacity: 0; position: absolute; pointer-events: none; }
        #queue-wrapper.queue-expanded #queue-full-content { opacity: 1; position: relative; pointer-events: auto; transition-delay: 0.1s; }
        #queue-wrapper.queue-expanded #btn-expand-queue { transform: rotate(180deg); color: white; opacity: 1; width: 2rem; }

        /* Morph Animation */
        #queue-wrapper.track-swap-out #info-island { transform: translateY(-20px); opacity: 0; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
        #queue-wrapper.track-swap-out #up-next-label { opacity: 0; transition: opacity 0.2s; }
        #queue-wrapper.track-swap-out #queue-preview-pill { transform: translateY(-70px); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

        #queue-full-content { opacity: 0; transition: opacity 0.3s; pointer-events: none; display: flex; flex-direction: column; flex: 1; min-height: 0; }
        #queue-tabs { position: relative; z-index: 20; }

        /* Modal Overlay */
        #playlist-modal, #playlist-selector-modal, #profile-modal { transition: opacity 0.3s ease; }
        #playlist-modal.hidden, #playlist-selector-modal.hidden, #profile-modal.hidden { opacity: 0; pointer-events: none; }
        .line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }

        /* ================================================== */
        /* MODE-BASED UI */
        /* ================================================== */
        html[data-ui-mode="desktop"] #mobile-nav { display: none !important; }
        html[data-ui-mode="desktop"] .mobile-collapse-btn,
        html[data-ui-mode="desktop"] .mobile-queue-btn { display: none !important; }

        html[data-ui-mode="mobile"] #header-account {
            display: none !important;
        }

        html[data-ui-mode="mobile"] #main-container {
            padding-top: calc(78px + env(safe-area-inset-top));
            padding-bottom: calc(204px + env(safe-area-inset-bottom));
        }

        html[data-ui-mode="mobile"] header {
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            border-radius: 0 !important;
            border-left: 0 !important;
            border-right: 0 !important;
            border-top: 0 !important;
            padding-top: calc(10px + env(safe-area-inset-top));
            padding-bottom: 10px;
            justify-content: center !important;
            transition: transform 0.24s ease, opacity 0.2s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open header {
            transform: translateY(calc(-100% - env(safe-area-inset-top) - 8px));
            opacity: 0;
            pointer-events: none;
        }

        html[data-ui-mode="mobile"] #app-logo {
            margin: 0 auto;
            width: auto !important;
        }

        html[data-ui-mode="mobile"] #search-positioner {
            position: fixed !important;
            top: auto !important;
            bottom: calc(8px + env(safe-area-inset-bottom)) !important;
            left: 10px !important;
            right: 10px !important;
            z-index: 135;
            padding: 0 !important;
            pointer-events: none;
            transition: bottom 0.24s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open {
            overflow: hidden;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #main-container {
            overscroll-behavior-y: contain;
        }

        html[data-ui-mode="mobile"] #search-wrapper {
            position: relative !important;
            left: auto !important;
            right: auto !important;
            top: auto !important;
            bottom: auto !important;
            width: 100%;
            opacity: 0;
            transform: scaleX(0.24);
            transform-origin: center bottom;
            pointer-events: none !important;
            transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
        }

        html[data-ui-mode="mobile"] #search-shell {
            width: 56px;
            margin: 0 auto;
            border-radius: 9999px;
            background: rgba(18, 18, 18, 0.92);
            border: 1px solid rgba(255, 255, 255, 0.16);
            overflow: hidden;
            pointer-events: auto;
            transition: width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-shell {
            width: 100%;
            background: rgba(18, 18, 18, 0.97);
        }

        html[data-ui-mode="mobile"] #search-shell .hidden.md\:flex {
            display: none !important;
        }

        html[data-ui-mode="mobile"] #search-shell > .relative.flex-1.flex.items-center {
            width: 56px;
            flex: none;
            min-width: 56px;
            transition: width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-shell > .relative.flex-1.flex.items-center {
            width: 100%;
            flex: 1;
        }

        html[data-ui-mode="mobile"] #search-input {
            width: 0;
            opacity: 0;
            pointer-events: none;
            border-color: transparent;
            background: transparent;
            padding-right: 0;
            padding-left: 2rem;
            transition: width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease, padding 0.28s ease, border-color 0.2s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-input {
            width: 100%;
            opacity: 1;
            pointer-events: auto;
            border-color: rgba(255, 255, 255, 0.18);
            background: rgba(255, 255, 255, 0.06);
            padding-left: 2.3rem;
            padding-right: 3.2rem;
        }

        html[data-ui-mode="mobile"] #search-wrapper .search-icon {
            left: 50%;
            transform: translate(-50%, -50%);
            color: #ffffff;
            transition: left 0.25s ease, transform 0.25s ease, color 0.2s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-wrapper .search-icon {
            left: 0.8rem;
            transform: translateY(-50%);
            color: #9ca3af;
        }

        html[data-ui-mode="mobile"] .mobile-search-cancel {
            display: none;
            position: absolute;
            right: 0.5rem;
            top: 50%;
            transform: translateY(-50%);
            color: #e5e7eb;
            font-size: 0.72rem;
            font-weight: 700;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open .mobile-search-cancel {
            display: inline-block;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-wrapper {
            opacity: 1;
            transform: scaleX(1);
            pointer-events: auto !important;
        }

        html[data-ui-mode="mobile"] #search-dropdown {
            top: auto;
            bottom: calc(100% + 8px);
            left: 0;
            right: 0;
            padding: 0;
        }

        html[data-ui-mode="mobile"] #search-dropdown .search-blur-bg {
            border-radius: 1rem;
            background: rgba(10, 10, 10, 0.88);
            mask-image: none;
            -webkit-mask-image: none;
        }

        html[data-ui-mode="mobile"] #search-dropdown .search-results-content {
            max-height: min(46dvh, 340px);
            overflow-y: auto;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(12, 12, 12, 0.8);
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-dropdown .search-results-content {
            max-height: min(24dvh, 180px);
        }

        html[data-ui-mode="mobile"] #mobile-nav {
            display: grid !important;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            align-items: center;
            height: auto;
            padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            background: linear-gradient(180deg, rgba(8, 8, 8, 0.86), rgba(8, 8, 8, 0.96));
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            z-index: 120;
            transition: transform 0.24s ease, opacity 0.24s ease;
        }

        html[data-ui-mode="mobile"] #mobile-nav button {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            color: #9ca3af;
            border-radius: 12px;
            padding: 6px 0;
            transition: color 0.2s ease, background-color 0.2s ease, opacity 0.24s ease, transform 0.24s ease;
        }

        html[data-ui-mode="mobile"] #mobile-nav button.active {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.08);
        }

        html[data-ui-mode="mobile"] #mobile-nav .mobile-nav-label {
            font-size: 10px;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            font-weight: 700;
            line-height: 1;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #mobile-nav {
            transform: translateY(0);
            opacity: 1;
            pointer-events: auto;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #mobile-nav button[data-nav]:not([data-nav="search"]) {
            opacity: 0;
            transform: translateY(42px);
            pointer-events: none;
        }

        html[data-ui-mode="mobile"] body.mobile-player-open #mobile-nav {
            transform: translateY(120%);
            opacity: 0;
            pointer-events: none;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #search-shell {
            width: 100%;
        }

        html[data-ui-mode="mobile"] #player-footer {
            left: 8px !important;
            right: 8px !important;
            bottom: calc(82px + env(safe-area-inset-bottom)) !important;
            gap: 0.75rem;
            align-items: stretch;
            z-index: 150;
            transition: bottom 0.24s ease, transform 0.24s ease, opacity 0.24s ease;
        }

        html[data-ui-mode="mobile"] body.mobile-search-open #player-footer {
            bottom: calc(188px + env(safe-area-inset-bottom) + var(--mobile-keyboard-lift)) !important;
            transform: translateY(0) !important;
            opacity: 1 !important;
            pointer-events: auto;
        }

        html[data-ui-mode="mobile"] #queue-anchor {
            width: 100%;
            height: auto;
            pointer-events: auto;
        }

        html[data-ui-mode="mobile"] #queue-wrapper {
            position: relative;
            right: auto;
            bottom: auto;
            width: 100%;
        }

        html[data-ui-mode="mobile"] #queue-preview-slot,
        html[data-ui-mode="mobile"] #queue-expandable-area,
        html[data-ui-mode="mobile"] #btn-expand-queue,
        html[data-ui-mode="mobile"] #player-card .w-24.hidden.md\:block {
            display: none !important;
        }

        html[data-ui-mode="mobile"] #player-card {
            display: none;
        }

        html[data-ui-mode="mobile"] #info-island {
            border-radius: 1rem;
            padding: 0.5rem 0.75rem;
            background: rgba(18, 18, 18, 0.92);
            border: 1px solid rgba(255, 255, 255, 0.14);
        }

        html[data-ui-mode="mobile"] #album-art-wrapper {
            width: 44px;
            height: 44px;
            border-radius: 12px;
        }

        html[data-ui-mode="mobile"] #curr-art-img {
            border-radius: 10px;
        }

        html[data-ui-mode="mobile"] #info-island button[onclick*="player.togglePlay"] {
            display: flex !important;
        }

        html[data-ui-mode="mobile"] .mobile-player-header {
            display: none;
        }

        @media (max-height: 700px) {
            html[data-ui-mode="mobile"] body.mobile-player-open #album-art-wrapper {
                width: min(62vw, 260px);
                height: min(62vw, 260px);
                margin-top: 10px;
            }
        }

/* Recommendation polish */
.for-you-card {
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.for-you-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 24% 12%, rgba(34, 211, 238, 0.25), transparent 34%);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.for-you-card:hover::after { opacity: 1; }

/* Smoother mobile player sheet with queue support */
html[data-ui-mode="mobile"] #player-footer {
    transition: transform 0.48s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.32s ease, bottom 0.24s ease;
    will-change: transform, opacity;
}

/* Instant loading feedback */
#info-island.is-loading #p-title,
#info-island.is-loading #p-artist {
    opacity: 0.92;
}

#album-art-wrapper.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background:
        linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.22) 45%, transparent 72%),
        rgba(0,0,0,0.18);
    transform: translateX(-100%);
    animation: album-loading-sheen 1.15s ease-in-out infinite;
}

#album-art-wrapper.is-loading::before {
    content: 'Loading';
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 4;
    height: 4px;
    border-radius: 9999px;
    overflow: hidden;
    color: transparent;
    background: linear-gradient(90deg, rgba(34,211,238,0.25), rgba(34,211,238,0.95), rgba(34,211,238,0.25));
    background-size: 220% 100%;
    animation: album-loading-bar 1.05s ease-in-out infinite;
}

@keyframes album-loading-sheen {
    to { transform: translateX(100%); }
}

@keyframes album-loading-bar {
    0% { background-position: 100% 0; opacity: 0.55; }
    50% { opacity: 1; }
    100% { background-position: -100% 0; opacity: 0.55; }
}

/* Mobile touch UX: remove hover-only behavior and rely on gestures. */
html[data-ui-mode="mobile"] .hover-pause,
html[data-ui-mode="mobile"] .group:hover,
html[data-ui-mode="mobile"] [class*="hover:"] {
    transform: none !important;
}
html[data-ui-mode="mobile"] .group-hover\:opacity-100,
html[data-ui-mode="mobile"] .group-hover\:scale-100,
html[data-ui-mode="mobile"] .group-hover\:scale-105,
html[data-ui-mode="mobile"] .group-hover\:scale-110 {
    opacity: inherit;
    transform: none !important;
}
.queue-drag-handle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 40px;
    margin-right: 0.35rem;
    color: rgba(255,255,255,0.42);
    cursor: grab;
    border-radius: 0.75rem;
}
.queue-drag-handle:active { cursor: grabbing; }
.queue-reorder-row.is-dragging { opacity: 0.55; }
.queue-reorder-row.drag-over { outline: 1px solid var(--accent-color); background: color-mix(in srgb, var(--accent-color) 12%, #121212); }

.liked-songs-art { border-color: color-mix(in srgb, var(--accent-color) 20%, transparent); }
.liked-songs-art:hover { border-color: color-mix(in srgb, var(--accent-color) 60%, transparent); }

.search-results-content.is-updating { opacity: 0.82; }
.search-results-content.is-updating::after { content: 'Updating…'; position: sticky; bottom: 0; display: block; margin: 0.25rem auto 0; width: max-content; border-radius: 9999px; padding: 0.2rem 0.55rem; font-size: 10px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: #001015; background: var(--accent-color); }

.top-result-action { display: inline-flex; align-items: center; justify-content: center; width: 2.35rem; height: 2.35rem; border-radius: 9999px; color: #001015; background: var(--accent-color); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent-color) 24%, transparent); }
.top-result-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Finger-following mobile swipe animations. */
html[data-ui-mode="mobile"] #player-active-area {
    --swipe-x: 0px;
    overflow: visible;
    touch-action: pan-y;
}
html[data-ui-mode="mobile"] #player-active-area #info-island {
    position: relative;
    z-index: 3;
    transform: translate3d(var(--swipe-x), 0, 0);
    will-change: transform;
}
html[data-ui-mode="mobile"] #player-active-area.swiping #info-island {
    transition: none !important;
}
html[data-ui-mode="mobile"] #player-active-area:not(.swiping) #info-island {
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}
html[data-ui-mode="mobile"] .mobile-swipe-preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.18s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
html[data-ui-mode="mobile"] #compact-swipe-prev { transform: translate3d(calc(-100% + var(--swipe-x)), 0, 0); }
html[data-ui-mode="mobile"] #compact-swipe-next { transform: translate3d(calc(100% + var(--swipe-x)), 0, 0); }
html[data-ui-mode="mobile"] #player-active-area.swipe-right #compact-swipe-prev,
html[data-ui-mode="mobile"] #player-active-area.swipe-left #compact-swipe-next { opacity: 1; }
html[data-ui-mode="mobile"] .mobile-swipe-preview-card { height: 100%; }
html[data-ui-mode="mobile"] .mobile-swipe-label {
    position: absolute;
    top: -1.05rem;
    left: 0.75rem;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-color);
}
/* Rebuilt mobile search stack: nav at bottom, now-playing above it, search above now-playing, results above search. */
html[data-ui-mode="mobile"] body.mobile-search-open #player-footer {
    bottom: calc(82px + env(safe-area-inset-bottom)) !important;
    z-index: 170;
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto;
}
html[data-ui-mode="mobile"] body.mobile-search-open #search-positioner {
    bottom: calc(82px + env(safe-area-inset-bottom) + var(--mobile-keyboard-lift)) !important;
    z-index: 240;
    transition: bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
html[data-ui-mode="mobile"] body.mobile-search-open.has-active-track #search-positioner {
    bottom: calc(164px + env(safe-area-inset-bottom) + var(--mobile-keyboard-lift)) !important;
}
html[data-ui-mode="mobile"] body.mobile-search-open #search-dropdown {
    bottom: calc(100% + 10px);
    z-index: 250;
}
html[data-ui-mode="mobile"] body.mobile-search-open #search-dropdown .search-results-content {
    max-height: min(48dvh, 380px) !important;
    -webkit-overflow-scrolling: touch;
}

.swipe-song {
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: background-color 0.18s ease, border-color 0.18s ease;
    contain: layout paint;
}

/* Rebuilt song-row swipe actions. The row follows the finger; action buttons grow behind it. */
html[data-ui-mode="mobile"] .swipe-song {
    --song-swipe-x: 0px;
    --swipe-scale: 0;
    isolation: isolate;
    overflow: hidden !important;
    transform: translate3d(var(--song-swipe-x), 0, 0) !important;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.18s ease !important;
    will-change: transform;
}
html[data-ui-mode="mobile"] .swipe-song.is-swiping {
    transition: none !important;
}
html[data-ui-mode="mobile"] .swipe-song::before,
html[data-ui-mode="mobile"] .swipe-song::after {
    top: 50% !important;
    z-index: 4 !important;
    pointer-events: none;
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    opacity: 0 !important;
    transform: translateY(-50%) scale(var(--swipe-scale)) !important;
    transition: opacity 0.12s ease, transform 0.12s ease !important;
    color: #001015 !important;
    font-size: 0 !important;
    box-shadow: 0 12px 28px rgba(0,0,0,0.28);
}
html[data-ui-mode="mobile"] .swipe-song::before {
    content: '+' !important;
    left: 14px !important;
    background: var(--accent-color-2);
}
html[data-ui-mode="mobile"] .swipe-song::after {
    content: '▶' !important;
    right: 14px !important;
    background: var(--accent-color);
}
html[data-ui-mode="mobile"] .swipe-song.swipe-show-queue::before,
html[data-ui-mode="mobile"] .swipe-song.swipe-show-next::after,
html[data-ui-mode="mobile"] .swipe-song.swipe-committed-queue::before,
html[data-ui-mode="mobile"] .swipe-song.swipe-committed-next::after {
    opacity: 1 !important;
    font-size: 20px !important;
}
html[data-ui-mode="mobile"] .swipe-song.swipe-show-queue {
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent-color-2) 30%, #121212), #121212 56%) !important;
}
html[data-ui-mode="mobile"] .swipe-song.swipe-show-next {
    background: linear-gradient(270deg, color-mix(in srgb, var(--accent-color) 30%, #121212), #121212 56%) !important;
}
html[data-ui-mode="mobile"] .swipe-song.swipe-committed-next,
html[data-ui-mode="mobile"] .swipe-song.swipe-committed-queue {
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.18s ease !important;
}

/* Official Mobile Expanded Player Layout & Animation */
html[data-ui-mode="mobile"] body.mobile-player-open {
    overflow: hidden !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #mobile-nav {
    transform: translateY(100%) !important;
    pointer-events: none !important;
    transition: transform 0.3s ease !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-footer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 250 !important;
    width: 100dvw !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: calc(10px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom)) !important;
    background: radial-gradient(circle at 50% 8%, color-mix(in srgb, var(--accent-color, #22d3ee) 25%, #16161c), #060608 70%) !important;
    backdrop-filter: blur(28px) !important;
    -webkit-backdrop-filter: blur(28px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    animation: mobile-sheet-slide-up 0.36s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes mobile-sheet-slide-up {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

html[data-ui-mode="mobile"] body.mobile-player-open .mobile-player-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    padding: 0 4px 4px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-active-area {
    order: 1 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #info-island {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: left !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 8px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #album-art-wrapper {
    --album-swipe-x: 0px;
    width: min(65vw, 270px) !important;
    height: min(65vw, 270px) !important;
    margin: 4px auto 6px !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    transform: translate3d(var(--album-swipe-x), 0, 0) !important;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    touch-action: pan-y !important;
    will-change: transform !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #album-art-wrapper.album-swiping {
    transition: none !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #curr-art-img {
    border-radius: 24px !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #info-island .flex-1 {
    width: 100% !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 4px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #p-title {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    line-height: 1.3 !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #p-artist {
    font-size: 0.92rem !important;
    color: #a1a1aa !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #p-like-btn {
    transform: scale(1.3) !important;
    margin: 0 !important;
    padding: 6px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #info-island button[onclick*="player.togglePlay"] {
    display: none !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card {
    order: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card > div:nth-child(2) {
    order: 1 !important;
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
    padding: 0 !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #seek-bar-container {
    height: 44px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #seek-time-row {
    display: flex !important;
    padding: 0 4px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card > div:nth-child(1) {
    order: 2 !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 2px 6px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card > div:nth-child(1) button {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card > div:nth-child(1) #btn-play {
    width: 62px !important;
    height: 62px !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.28) !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #player-card > div:nth-child(3) {
    display: none !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open .mobile-queue-btn {
    order: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 11px 16px !important;
    margin-top: 4px !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #queue-anchor {
    order: 4 !important;
    width: 100% !important;
    height: auto !important;
    flex-shrink: 0 !important;
    margin-bottom: 16px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #queue-wrapper.queue-expanded #queue-expandable-area,
html[data-ui-mode="mobile"] body.mobile-player-open #queue-wrapper.queue-expanded #queue-full-content {
    display: flex !important;
    flex-direction: column !important;
    max-height: 480px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 100% !important;
    border-radius: 20px !important;
    background: rgba(14, 14, 18, 0.94) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
    margin-top: 8px !important;
}

html[data-ui-mode="mobile"] body.mobile-player-open #queue-list,
html[data-ui-mode="mobile"] body.mobile-player-open #history-list {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    max-height: 400px !important;
    padding: 8px 12px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

@media (max-height: 700px) {
    html[data-ui-mode="mobile"] body.mobile-player-open #album-art-wrapper {
        width: min(50vw, 210px) !important;
        height: min(50vw, 210px) !important;
        margin: 2px auto 4px !important;
    }
}
.queue-drag-handle {
    margin-left: auto !important;
    margin-right: 0 !important;
}
.queue-reorder-row .marquee-container {
    min-width: 0;
}

