* { -webkit-tap-highlight-color: transparent; }
@font-face {
            font-family: 'Google Sans Flex';
            font-style: normal;
            font-display: swap;
            font-weight: 100 1000;
            src: url('../assets/fonts/GoogleSansFlex-Latin.woff2') format('woff2');
        }

        /* Sleek, flat premium design - Zero GPU overhead */
        :root {
            color-scheme: dark;
            --primary-color: #8c73ff;
            --text-primary: #e6e6e6;
            --text-secondary: #a6a6b8;
            --hover-color: #111111;
            --active-color: #1a1a1a;
            --border-color: #222222;
        }

        @media (prefers-color-scheme: light) {
            :root {
                color-scheme: light; /* Reports light mode compliance to prevent browser algorithmic force-dark/inversion */
            }
        }

        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden; /* Strictly lock viewport scrolling */
        }

        body {
            font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: #000000;
            color: var(--text-primary);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .main-layout {
            display: flex;
            width: 100%;
            height: 100%;
            max-height: 99%;
            gap: 0;
            align-items: stretch;
            overflow: hidden;
        }

        #lyrics-container {
            flex: 0.95 1.25 35vw;
            min-width: 220px;
            height: 100%;
            background-color: #000000;
            border: none;
            border-radius: 0;
            padding: 0;
            box-sizing: border-box;
            position: relative;
            display: none; /* flex when active */
            flex-direction: column;
            align-items: center;
            overflow: hidden;
            scrollbar-width: none;
            -ms-overflow-style: none;
            contain: layout;
        }

        #lyrics-container::-webkit-scrollbar {
            display: none;
            width: 0;
            height: 0;
        }

        .player-container {
            flex: 1 0 auto;
            min-width: clamp(400px, 32vw, 550px);
            height: 100%;
            background-color: #000000;
            border: none;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            justify-content: center;
            flex-shrink: 0;
            padding-right: clamp(2px, 3px, 4px);
            box-sizing: border-box;
        }

        .playlist-panel {
            flex: 1.05 0.75 35vw;
            width: auto;
            min-width: 260px;
            height: 100%;
            background-color: #000000;
            border: none;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
        }
        

        .header {
            padding: 14px 20px;
            background-color: #000000;
            flex-shrink: 0;
        }

        @media (hover: hover) {
            #btn-close-lyrics:hover {
                background: rgba(255,255,255,0.2);
            }
        }

        select {
            width: 100%;
            padding: 11px;
            background-color: #000000;
            color: var(--text-primary);
            border: none;
            border-radius: 6px;
            font-size: 15px;
            font-weight: 500;
            outline: none;
            cursor: pointer;
            appearance: auto;
        }

        select:focus { border: none; outline: none; }
        
        .sync-btn {
            background-color: #000000;
            border: none;
            border-radius: 6px;
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
            outline: none !important;
            -webkit-tap-highlight-color: transparent;
            transition: color 0.2s ease;
        }

        .sync-btn:hover {
            color: var(--primary-color);
            border: none;
        }

        .sync-btn.spinning svg,
        .spin-animation {
            animation: sync-spin 0.8s linear infinite;
            color: var(--primary-color);
        }

        @keyframes sync-spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        
        #search-input {
            width: 100%;
            padding: 11px 36px 11px 11px;
            background-color: #000000;
            color: var(--text-primary);
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-family: inherit;
            outline: none;
            box-sizing: border-box;
        }

        #search-input:focus { border: none; outline: none; }

        .now-playing {
            padding: 0px 0px 0px 0px;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            flex-shrink: 0;
            width: 100%;
            max-width: 680px;
            margin: 0 auto;
            box-sizing: border-box;
        }

        #album-art-container {
            width: auto;
            max-width: 100%;
            cursor: default;
            position: relative;
            margin-bottom: 18px;
            touch-action: manipulation;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #album-art-image {
            width: auto;
            height: auto;
            max-width: min(600px, 85vw);
            max-height: 48vh;
            object-fit: contain;
            border-radius: 8px;
            display: none;
            background-color: transparent;
            cursor: pointer;
        }

        #album-art-container.no-art {
            width: 100%;
            max-width: 340px;
            height: auto;
            min-height: 44px;
            margin: 0 auto 10px auto;
            background: transparent;
            border-radius: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #album-art-container.no-art #album-art-image {
            display: none;
        }

        #album-art-container.no-art #thumb-toggle-hint {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            padding: 6px 10px;
            gap: 6px;
            border-radius: 0;
            background-color: transparent;
            color: var(--text-secondary);
            border: none;
            cursor: pointer;
            width: auto;
            height: auto;
            line-height: normal;
        }

        #album-art-container:not(.no-art) #thumb-toggle-hint {
            display: none;
        }

        #thumb-toggle-hint {
            display: none;
            color: var(--text-secondary);
            font-size: 12px;
            text-align: center;
            padding: 8px 12px;
            cursor: pointer;
            user-select: none;
            align-items: center;
            justify-content: center;
            gap: 6px;
            margin: 0 auto;
            border-radius: 12px;
            line-height: 1;
            transition: background 0.2s, color 0.2s;
        }

        @media (hover: hover) {
            #thumb-toggle-hint:hover {
                background-color: var(--hover-color);
            }
        }

        #thumb-toggle-hint svg {
            width: 16px;
            height: 16px;
            fill: currentColor;
            flex-shrink: 0;
            display: block;
        }

        .title-channel-wrapper {
            width: var(--art-width, 100%);
            max-width: var(--art-width, 500px);
            box-sizing: border-box;
            text-align: center;
        }

        #current-title {
            font-size: clamp(16px, 4.5vw, 20px);
            font-weight: 600;
            margin: 0 0 6px 0;
            white-space: normal;
            word-wrap: break-word;
            overflow-wrap: break-word;
            word-break: break-word;
            width: 100%;
            letter-spacing: 0.2px;
            color: #ffffff;
            text-align: center;
        }

        #current-channel {
            font-size: clamp(13px, 3vw, 15px);
            color: var(--primary-color);
            margin: 0 0 20px 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 100%;
            font-weight: 500;
            text-align: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            transition: color 0.2s ease;
        }

        #current-channel.autoplay-off,
        .now-playing #current-channel.autoplay-off,
        .now-playing.expanded #current-channel.autoplay-off,
        .now-playing:not(.expanded) #current-channel.autoplay-off {
            color: var(--text-primary, #ffffff);
        }

        #lyrics-toggle-hint {
            color: var(--text-secondary);
            font-size: 13px;
            text-align: center;
            padding: 8px 12px;
            margin-top: -12px;
            margin-bottom: 20px;
            cursor: pointer;
            border-radius: 12px;
            transition: background 0.2s, color 0.2s;
        }

        @media (hover: hover) {
            #lyrics-toggle-hint:hover {
                background-color: var(--hover-color);
            }
        }

        #lyrics-toggle-hint svg {
            width: 16px;
            height: 16px;
            fill: currentColor;
            vertical-align: middle;
            margin-right: 6px;
            margin-top: -2px;
        }

        audio { display: none; }

        .progress-container {
            width: var(--art-width, 100%);
            max-width: var(--art-width, 500px);
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
            box-sizing: border-box;
        }

        .time-display {
            font-size: 13px;
            color: var(--text-secondary);
            min-width: 40px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
        }

        .seek-wrap {
            position: relative;
            flex: 1;
            height: 20px;
            display: flex;
            align-items: center;
            cursor: pointer;
        }

        .seek-track {
            position: absolute;
            left: 0;
            right: 0;
            height: 4px;
            background: transparent;
            border-radius: 2px;
            overflow: hidden;
            pointer-events: none;
        }

        .buffer-container {
            position: absolute;
            inset: 0;
            pointer-events: none;
        }

        .buffer-segment {
            position: absolute;
            top: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.4);
            border-radius: 2px;
            pointer-events: none;
        }

        input[type="range"]#seek-bar {
            -webkit-appearance: none;
            appearance: none;
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: transparent;
            border: none;
            margin: 0;
            padding: 0;
            outline: none;
            cursor: pointer;
            z-index: 2;
        }

        input[type="range"]#seek-bar::-webkit-slider-runnable-track {
            height: 4px;
            background: transparent;
        }

        input[type="range"]#seek-bar::-moz-range-track {
            height: 4px;
            background: transparent;
        }

        input[type="range"]#seek-bar::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--primary-color);
            cursor: pointer;
            border: none;
            box-shadow: none;
            margin-top: -4px;
        }

        input[type="range"]#seek-bar::-moz-range-thumb {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--primary-color);
            border: none;
            box-shadow: none;
            cursor: pointer;
        }

        .playback-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: var(--art-width, 100%);
            max-width: var(--art-width, 500px);
            padding: 0 10px;
            margin-bottom: 8px;
            box-sizing: border-box;
            position: relative;
        }

        .control-btn {
            background: transparent;
            border: none;
            color: rgba(255, 255, 255, 0.7);
            cursor: pointer;
            padding: 7px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            touch-action: manipulation;
        }

        .control-btn svg {
            width: 24px;
            height: 24px;
            fill: currentColor;
        }

        @media (hover: hover) {
            .control-btn:hover {
                color: #ffffff;
                background-color: var(--hover-color);
                border-radius: 50%;
            }
        }

        .track-thumb {
            width: 32px;
            height: 32px;
            border-radius: 4px;
            margin-right: 12px;
            object-fit: cover;
            vertical-align: middle;
            flex-shrink: 0;
            background-color: #2a2a2a;
        }

        .control-btn.active-state { color: var(--primary-color); }

        .main-btn {
            background-color: var(--primary-color);
            color: #000000;
            width: 52px;
            height: 52px;
        }
        


        .main-btn svg {
            width: 30px;
            height: 30px;
        }

        .main-btn:hover {
            background-color: var(--primary-color);
            color: #000000;
        }

        /* Virtual Scroller Container Styles */
        .playlist-container {
            flex-grow: 1;
            overflow-y: auto;
            position: relative;
            background-color: #000000;
            height: 100%;
            contain: strict; /* Isolates layout/paint of 1000+ items from rest of page */
            overscroll-behavior-y: contain; /* Prevents pull-to-refresh frame drops */
            -webkit-overflow-scrolling: touch; /* Forces iOS momentum scrolling */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE/Edge */
        }

        /* Desktop layout */
        @media (min-width: 1111px) and (orientation: landscape) {
            .now-playing {
                max-width: 650px;
                width: 100%;
            }
            #album-art-container {
                width: 100%;
                max-width: 650px;
                height: clamp(260px, 56vh, 620px);
                margin-bottom: clamp(8px, 2vh, 18px);
                display: flex;
                justify-content: center;
                align-items: center;
                cursor: default;
            }
            #album-art-container.no-art {
                height: auto;
                margin-bottom: clamp(6px, 1.5vh, 14px);
            }
            #album-art-container.no-art ~ .title-channel-wrapper,
            #album-art-container.no-art ~ .progress-container,
            #album-art-container.no-art ~ .playback-controls {
                width: 100%;
                max-width: min(520px, 35vw);
            }
            #album-art-image {
                width: 100%;
                height: 100%;
                max-width: 650px;
                max-height: 100%;
                object-fit: contain;
                border-radius: 8px;
                cursor: pointer;
            }
            .title-channel-wrapper,
            .progress-container,
            .playback-controls {
                width: var(--art-width, 100%);
                max-width: var(--art-width, 650px);
                min-width: 280px;
            }
            #current-title { font-size: clamp(18px, 2.2vh, 24px); }
            #current-channel {
                font-size: clamp(13px, 1.6vh, 16px);
                margin: 0 0 clamp(4px, 1.5vh, 14px) 0;
            }
            #lyrics-toggle-hint {
                margin-top: 0;
                margin-bottom: clamp(4px, 1.5vh, 14px);
                padding: clamp(4px, 1vh, 8px) 12px;
            }
            .progress-container {
                margin-bottom: clamp(6px, 1.5vh, 16px);
            }
            .main-btn {
                width: clamp(44px, 7vh, 64px);
                height: clamp(44px, 7vh, 64px);
            }
            .main-btn svg {
                width: clamp(22px, 3.5vh, 36px);
                height: clamp(22px, 3.5vh, 36px);
            }

            /* When lyrics container is closed/hidden, shift player 1/3 to the left from center */
            .main-layout:not(:has(#lyrics-container[style*="display: flex"])) .player-container,
            .main-layout:not(:has(#lyrics-container:not([style*="display: none"]))) .player-container {
                align-items: center;
                padding-right: 0;
            }
            .main-layout:not(:has(#lyrics-container[style*="display: flex"])) .now-playing,
            .main-layout:not(:has(#lyrics-container:not([style*="display: none"]))) .now-playing {
                margin-left: max(20px, calc((100% - 650px) / 3));
                margin-right: auto;
            }
        }

        .playlist-container::-webkit-scrollbar {
            display: none;
            width: 0;
            height: 0;
        }

        /* 20px Edge Hit-Test Zone */
        .fast-scroller {
            position: absolute;
            right: 0;
            top: 0;
            bottom: 0;
            width: 20px;
            z-index: 90;
            touch-action: none;
            user-select: none;
            -webkit-user-select: none;
            cursor: pointer;
        }

        .fast-scroll-thumb {
            position: absolute;
            right: 2px;
            width: 4px;
            height: 36px;
            border-radius: 2px;
            background: var(--primary-color, #8c73ff);
            opacity: 0;
            transform: scaleX(0.7);
            transition: opacity 0.15s ease, transform 0.15s ease;
            pointer-events: none;
        }

        .fast-scroller.active .fast-scroll-thumb {
            opacity: 0.9;
            transform: scaleX(1);
        }

        /* Floating Preview Bubble */
        .fast-scroll-bubble {
            position: absolute;
            right: 16px;
            top: 0;
            max-width: min(260px, 65vw);
            padding: 8px 14px;
            border-radius: 12px;
            background: rgba(14, 14, 18, 0.94);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid var(--primary-color, #8c73ff);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 14px color-mix(in srgb, var(--primary-color, #8c73ff) 30%, transparent);
            pointer-events: none;
            opacity: 0;
            transform: translateY(-50%) scale(0.85);
            transform-origin: right center;
            transition: opacity 0.12s cubic-bezier(0.2, 0, 0, 1), transform 0.12s cubic-bezier(0.2, 0, 0, 1);
            z-index: 95;
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .fast-scroll-bubble.active {
            opacity: 1;
            transform: translateY(-50%) scale(1);
        }

        .fast-scroll-badge {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.5px;
            color: var(--text-primary, #e6e6e6);
            text-transform: uppercase;
        }

        .fast-scroll-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--primary-color, #8c73ff);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #track-list {
            list-style: none;
            padding: 0;
            margin: 0;
            position: relative;
        }

        #track-list li {
            position: absolute;
            top: 0;
            left: 0;
            will-change: transform;
            contain: layout paint;
            width: 100%;
            height: 48px; /* Fixed height for virtual scrolling */
            padding: 0 35px 0 16px; /* 35px right padding for a 2px visual gap to the SVG (which starts at 33px from right) */
            box-sizing: border-box;
            cursor: pointer;
            display: flex;
            align-items: center;
            line-height: 48px;
            border: none;
            font-size: 14px;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .track-skeleton {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            display: flex;
            align-items: center;
            padding: 0 16px;
            box-sizing: border-box;
            contain: layout paint;
        }

        .skeleton-text {
            opacity: 0.25;
            animation: skeleton-pulse 1.2s infinite ease-in-out;
        }

        @keyframes skeleton-pulse {
            0%, 100% { opacity: 0.25; }
            50% { opacity: 0.08; }
        }

        .track-thumb {
            width: 36px;
            height: 36px;
            min-width: 36px;
            min-height: 36px;
            border-radius: 6px;
            margin-right: 12px;
            background-color: #222226;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            flex-shrink: 0;
            display: block;
        }

        .yt-link-icon {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 4px;
            text-decoration: none;
            z-index: 2;
        }

        .yt-link-icon:hover {
            color: var(--primary-color);
            background-color: var(--hover-color);
        }

        .yt-link-icon svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
        }

        @media (hover: hover) {
            #track-list li:hover { background-color: var(--hover-color); }
        }

        #track-list li.active {
            background-color: var(--active-color);
            border-left: 3px solid var(--primary-color);
            padding-left: 13px; /* 16px - 3px border */
            color: var(--primary-color);
            font-weight: 600;
        }

        #track-list li.enqueued-flash {
            background-color: color-mix(in srgb, var(--enqueued-color, #8c73ff) 40%, transparent) !important;
            transition: background-color 0.25s ease;
        }

        /* Landscape Layout for <= 1110px (covers all heights, including > 560px) */
        @media (max-width: 1110px) and (orientation: landscape), (max-height: 550px) and (orientation: landscape) {
            .main-layout {
                flex-direction: row;
                max-height: 100%;
                height: 100%;
                overflow: hidden;
            }
            .player-container {
                height: 100%;
                max-height: 100%;
                flex: 0 0 auto;
                min-width: 280px;
                max-width: min(440px, 48vw);
                padding: 4px 10px;
                display: flex;
                justify-content: center;
                align-items: center;
                overflow: hidden;
                box-sizing: border-box;
            }
            .playlist-panel {
                flex: 1 1 auto;
                height: 100%;
                min-width: 240px;
                display: flex;
                overflow: hidden;
            }
            .now-playing:not(.expanded) {
                position: static;
                width: 100%;
                max-width: 100%;
                height: auto;
                background: transparent;
                box-shadow: none;
                border-radius: 0;
                padding: 0;
                flex-direction: column;
                align-items: center;
            }
            .now-playing:not(.expanded) #album-art-container:not(.no-art) {
                width: auto;
                height: auto;
                max-width: 100%;
                max-height: min(42vh, 360px);
                border-radius: 8px;
                margin: 0 auto 4px auto;
                background: transparent;
                display: flex;
                justify-content: center;
                align-items: center;
            }
            .now-playing:not(.expanded) #album-art-image {
                width: auto;
                height: auto;
                max-height: min(42vh, 360px);
                max-width: min(340px, 42vw);
                border-radius: 8px;
                object-fit: contain;
                aspect-ratio: auto;
            }
            .now-playing:not(.expanded) .title-channel-wrapper {
                flex: none;
                width: max(var(--art-width, 100%), 260px);
                max-width: min(340px, 42vw);
                text-align: center;
                margin: 0 auto 1px auto;
            }
            .now-playing:not(.expanded) #current-title {
                font-size: clamp(13px, 2.6vh, 16px);
                text-align: center;
                white-space: normal;
                word-break: break-word;
                line-height: 1.2;
                width: 100%;
                color: #ffffff;
            }
            .now-playing:not(.expanded) #current-channel {
                font-size: clamp(10px, 2vh, 12px);
                text-align: center;
                margin: 1px 0 2px 0;
                width: 100%;
                color: var(--primary-color);
            }
            .now-playing:not(.expanded) #lyrics-toggle-hint {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                font-size: 11px;
                padding: 1px 8px;
                margin: 0 auto 3px auto;
                line-height: 1;
                height: auto;
                border-radius: 6px;
            }
            .now-playing:not(.expanded) #lyrics-toggle-hint svg {
                width: 12px;
                height: 12px;
                margin-right: 4px;
                display: inline-block;
            }
            .now-playing:not(.expanded) .progress-container {
                display: flex;
                width: max(var(--art-width, 100%), 260px);
                max-width: min(340px, 42vw);
                margin: 0 auto 4px auto;
                gap: 8px;
                box-sizing: border-box;
            }
            .now-playing:not(.expanded) .time-display {
                font-size: 11px;
                min-width: 30px;
            }
            .now-playing:not(.expanded) .playback-controls {
                display: flex;
                width: max(var(--art-width, 100%), 260px);
                max-width: min(340px, 42vw);
                justify-content: space-between;
                align-items: center;
                margin: 0 auto;
                padding: 0 4px;
                box-sizing: border-box;
            }
            .now-playing:not(.expanded) .main-btn {
                width: 44px;
                height: 44px;
            }
            .now-playing:not(.expanded) .main-btn svg {
                width: 22px;
                height: 22px;
            }
            .now-playing:not(.expanded) #btn-prev,
            .now-playing:not(.expanded) #btn-next {
                width: 34px;
                height: 34px;
                display: flex;
            }
            .now-playing:not(.expanded) #btn-prev svg,
            .now-playing:not(.expanded) #btn-next svg {
                width: 20px;
                height: 20px;
            }
            .now-playing:not(.expanded) #btn-shuffle,
            .now-playing:not(.expanded) #btn-repeat {
                width: 30px;
                height: 30px;
                display: flex;
            }
            .now-playing:not(.expanded) #btn-shuffle svg,
            .now-playing:not(.expanded) #btn-repeat svg {
                width: 16px;
                height: 16px;
            }
        }

        @media (orientation: portrait) {
            .main-layout {
                max-height: 100%;
                flex-direction: column;
            }
            #lyrics-container {
                position: absolute;
                top: 0; left: 0; right: 0; bottom: 0;
                min-width: 0;
                max-width: 100%;
                border-radius: 0;
                border: none;
                z-index: 100;
            }
            .player-container {
                height: auto;
                max-height: none;
                min-width: 0;
                flex: 0 0 auto;
                border: none;
                justify-content: center;
                align-items: center;
                padding-right: 0;
                overflow: visible;
            }
            .playlist-panel {
                flex: 1;
                width: 100%;
                height: 100%;
                min-width: 0;
                display: flex;
                flex-direction: column;
                overflow: hidden;
                border: none;
            }
        }

        @media (min-width: 751px) and (orientation: portrait) {
            .now-playing:not(.expanded) {
                padding: 14px 20px 18px 20px;
                width: 100%;
                max-width: 540px;
            }
            .now-playing:not(.expanded) #album-art-container {
                width: auto;
                height: auto;
                max-width: 520px;
                max-height: clamp(140px, 44vh, 520px);
                margin-bottom: clamp(6px, 1.8vh, 14px);
            }
            .now-playing:not(.expanded) #album-art-image {
                width: auto;
                height: auto;
                max-width: min(520px, 85vw);
                max-height: clamp(140px, 44vh, 520px);
                object-fit: contain;
                border-radius: 8px;
            }
            .now-playing:not(.expanded) .title-channel-wrapper {
                width: 100%;
                max-width: 480px;
                margin-bottom: clamp(2px, 1vh, 6px);
            }
            .now-playing:not(.expanded) #current-title {
                font-size: clamp(18px, 2.2vh, 24px);
                width: 100%;
                max-width: 100%;
            }
            .now-playing:not(.expanded) #current-channel {
                font-size: clamp(13px, 1.6vh, 16px);
                margin: 0 0 clamp(4px, 1.5vh, 8px) 0;
                width: 100%;
                max-width: 100%;
            }
            .now-playing:not(.expanded) .progress-container {
                margin: clamp(4px, 1.2vh, 8px) 0;
                width: 100%;
                max-width: 480px;
            }
            .now-playing:not(.expanded) .playback-controls {
                gap: 16px;
                margin-top: 4px;
                width: 100%;
                max-width: 480px;
            }
            .now-playing:not(.expanded) .main-btn {
                width: clamp(44px, 6.5vh, 56px);
                height: clamp(44px, 6.5vh, 56px);
            }
            .now-playing:not(.expanded) .main-btn svg {
                width: clamp(22px, 3.2vh, 30px);
                height: clamp(22px, 3.2vh, 30px);
            }
        }

        @media (max-width: 750px) and (orientation: portrait) {
            /* Expandable Pill Player (Default Mini Mode) */
            .now-playing {
                position: fixed;
                bottom: 15px;
                left: 10px;
                right: 10px;
                width: auto;
                max-width: none;
                height: 60px;
                background-color: #1a1a1e;
                border-radius: 30px;
                padding: 0 10px 0 8px;
                box-sizing: border-box;
                z-index: 50;
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 10px;
                border: none;
                box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
                transition: height 0.28s cubic-bezier(0.2, 0, 0, 1),
                            bottom 0.28s cubic-bezier(0.2, 0, 0, 1),
                            border-radius 0.28s cubic-bezier(0.2, 0, 0, 1),
                            background-color 0.28s ease;
                overflow: hidden;
                cursor: pointer;
            }
            
            .now-playing #album-art-container {
                width: 44px;
                height: 44px;
                min-width: 44px;
                min-height: 44px;
                max-width: 44px;
                max-height: 44px;
                margin: 0;
                border-radius: 50%;
                overflow: hidden;
                flex-shrink: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: #222226;
                box-sizing: border-box;
            }
            
            .now-playing #album-art-image {
                border-radius: 50%;
                width: 100%;
                height: 100%;
                aspect-ratio: 1 / 1;
                object-fit: cover;
            }
            
            .now-playing #album-art-container:not(.no-art) #thumb-toggle-hint {
                display: none;
            }
            
            .now-playing:not(.expanded) #thumb-toggle-hint,
            .now-playing:not(.expanded) #album-art-container.no-art #thumb-toggle-hint { 
                font-size: 0;
                padding: 0;
                margin: 0;
                gap: 0;
                width: 100%;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
                line-height: 0;
                border-radius: 50%;
                background: transparent;
                border: none;
                box-sizing: border-box;
            }
            .now-playing:not(.expanded) #thumb-toggle-hint svg,
            .now-playing:not(.expanded) #album-art-container.no-art #thumb-toggle-hint svg {
                margin: 0;
                width: 22px;
                height: 22px;
                display: block;
                flex-shrink: 0;
            }
            
            .now-playing.expanded #thumb-toggle-hint {
                font-size: 13px;
                padding: 8px 12px;
                height: auto;
                flex-direction: row;
                margin-bottom: 16px;
                display: inline-flex;
                background: transparent;
                background-color: transparent;
                border: none;
                color: var(--text-secondary);
            }
            .now-playing.expanded #thumb-toggle-hint svg {
                width: 16px;
                height: 16px;
                display: inline-block;
                margin: 0;
            }
            
            .now-playing .title-channel-wrapper {
                flex: 1;
                width: auto;
                max-width: none;
                text-align: left;
                min-width: 0;
            }
            
            .now-playing #current-title {
                font-size: 14px;
                margin: 0;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                width: auto;
                max-width: 100%;
                text-align: left;
            }
            
            .now-playing #current-channel {
                font-size: 12px;
                margin: 0;
                display: block;
                color: var(--primary-color);
                text-align: left;
            }
            
            /* Hide expanded controls in mini mode */
            .now-playing .progress-container,
            .now-playing #lyrics-toggle-hint {
                display: none;
            }
            
            #btn-shuffle, #btn-repeat {
                width: 30px;
                height: 30px;
            }
            #btn-shuffle svg, #btn-repeat svg {
                width: 20px;
                height: 20px;
            }
            
            .now-playing .playback-controls {
                width: auto;
                max-width: none;
                padding: 0;
                margin: 0;
                display: flex;
                gap: 2px;
                justify-content: flex-end;
                flex-shrink: 0;
            }
            
            /* Make room for the floating pill */
            .playlist-container {
                flex-basis: 100%;
                padding-bottom: 80px; 
            }
            
            /* ---- EXPANDED STATE ---- */
            .now-playing.expanded {
                bottom: 0; left: 0; right: 0;
                height: 100%;
                border-radius: 0;
                padding: 40px 20px;
                flex-direction: column;
                justify-content: center;
                background-color: #000000;
                border-color: transparent;
                cursor: default;
            }
            
            .now-playing.expanded .btn-collapse {
                display: flex !important;
                position: absolute;
                top: 15px;
                left: 15px;
                background: transparent;
                border: none;
                border-radius: 50%;
                color: white;
                width: 40px; height: 40px;
                align-items: center;
                justify-content: center;
                z-index: 2;
                cursor: pointer;
            }
            
            .now-playing.expanded #album-art-container,
            .now-playing.expanded #album-art-container.no-art {
                width: 90%;
                max-width: 450px;
                height: auto;
                max-height: 45vh;
                border-radius: 12px;
                margin-bottom: 30px;
                background: transparent;
                background-color: transparent;
                border: none;
                box-shadow: none;
            }
            
            .now-playing.expanded #album-art-image {
                width: auto;
                height: auto;
                max-width: 100%;
                max-height: 45vh;
                object-fit: contain;
                border-radius: 12px;
            }
            
            .now-playing.expanded .title-channel-wrapper {
                flex: none;
                width: 100%;
                max-width: 100%;
                margin-bottom: 25px;
            }
            
            .now-playing.expanded #current-title {
                font-size: 22px;
                margin-bottom: 5px;
                white-space: normal;
                word-wrap: break-word;
                overflow-wrap: break-word;
                word-break: break-word;
                text-align: center;
                width: 100%;
            }
            
            .now-playing.expanded #current-channel {
                font-size: 16px;
                text-align: center;
                width: 100%;
                color: var(--primary-color);
            }
            
            .now-playing.expanded .progress-container {
                display: flex;
                width: 100%;
                max-width: 100%;
                margin-bottom: 20px;
            }
            
            .now-playing.expanded .playback-controls {
                display: flex;
                width: 100%;
                max-width: 100%;
                justify-content: space-between;
                align-items: center;
                margin-top: 10px;
            }
            
            .now-playing.expanded .main-btn {
                width: 64px;
                height: 64px;
            }
            .now-playing.expanded .main-btn svg {
                width: 32px;
                height: 32px;
            }
            
            .now-playing.expanded #btn-prev,
            .now-playing.expanded #btn-next {
                width: 44px;
                height: 44px;
            }
            .now-playing.expanded #btn-prev svg,
            .now-playing.expanded #btn-next svg {
                width: 26px;
                height: 26px;
            }
            
            .now-playing.expanded #btn-shuffle, 
            .now-playing.expanded #btn-repeat {
                width: 40px;
                height: 40px;
            }
            .now-playing.expanded #btn-shuffle.active-state,
            .now-playing.expanded #btn-repeat.active-state {
                color: var(--primary-color);
            }
            
            .now-playing.expanded #btn-shuffle svg, 
            .now-playing.expanded #btn-repeat svg {
                width: 24px;
                height: 24px;
            }
            
            .now-playing.expanded #lyrics-toggle-hint {
                display: block;
                width: 100%;
                margin-top: 20px;
            }
        }

/* Extracted from inline HTML styles */
#btn-close-lyrics {
    position: absolute; 
    top: 15px; 
    right: 15px; 
    background: transparent; 
    border-radius: 50%; 
    border: none; 
    color: white; 
    cursor: pointer; 
    padding: 6px; 
    z-index: 101; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: background 0.2s;
}

#lyrics-content {
    width: 100%; 
    height: 100%; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 16px; 
    padding-bottom: 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    contain: content;
}

#lyrics-content::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#playlist-message {
    text-align: center; 
    color: var(--text-secondary); 
    padding: 20px; 
    display: none;
}

.lyrics-placeholder {
    color: var(--text-secondary); 
    margin: auto;
}

.lyrics-inner {
    position: relative; 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    align-items: center; 
    padding: 30vh 0; 
    contain: layout paint;
}

.lyrics-highlight-layer {
    position: absolute; 
    left: 0; 
    top: 0; 
    width: 100%; 
    background: #000000; 
    color: var(--primary-color); 
    pointer-events: none; 
    display: none; 
    font-size: clamp(14px, 3.5vw, 18px); 
    line-height: 1.5; 
    text-align: center; 
    box-sizing: border-box; 
    padding: 0 10px; 
    z-index: 10;
}

.lyric-line {
    color: var(--text-secondary); 
    font-size: clamp(14px, 3.5vw, 18px); 
    line-height: 1.5; 
    margin: 0; 
    cursor: pointer; 
    width: fit-content; 
    text-align: center; 
    box-sizing: border-box; 
    padding: 0 10px;
}


#track-list li.search-highlight { background-color: var(--hover-color); border: none; outline: none; border-radius: 8px; }

button:focus { outline: none !important; }
.control-btn:focus { outline: none !important; }

/* Settings Backdrop */
#settings-backdrop,
.settings-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    transition: opacity 0.2s ease;
}

/* Settings Modal */
#settings-modal,
.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    background: #121218;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    box-sizing: border-box;
}

#settings-modal::-webkit-scrollbar,
.settings-modal::-webkit-scrollbar {
    width: 6px;
}

#settings-modal::-webkit-scrollbar-thumb,
.settings-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Settings Header & Title */
.settings-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#settings-title,
.settings-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* Settings Close Button */
#btn-close-settings,
.settings-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) {
    #btn-close-settings:hover,
    .settings-close-btn:hover {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.08);
    }
}

/* Settings Section */
.settings-section,
#bt-timeout-container {
    margin-bottom: 18px;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

/* Settings Radio Group & Cards */
.settings-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-radio-card,
.settings-radio-label {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

@media (hover: hover) {
    .settings-radio-card:hover,
    .settings-radio-label:hover {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

.settings-radio-card:has(input[type="radio"]:checked),
.settings-radio-label:has(input[type="radio"]:checked),
.settings-radio-card.active,
.settings-radio-label.active {
    border-color: var(--primary-color, #8c73ff);
    background: rgba(140, 115, 255, 0.08);
}

.settings-radio-card input[type="radio"],
.settings-radio-label input[type="radio"] {
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: var(--primary-color, #8c73ff);
    flex-shrink: 0;
}

.settings-radio-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.settings-radio-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.settings-subtext,
.settings-radio-subtext {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 3px;
}

/* Settings Controls (Select, Input, Action Buttons) */
.settings-timeout-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.settings-select,
#bt-timeout-select {
    width: 100%;
    background: #000000;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.settings-select:focus,
#bt-timeout-select:focus {
    border-color: var(--primary-color, #8c73ff);
    outline: none;
}

.settings-input,
#bt-timeout-custom {
    width: 100%;
    box-sizing: border-box;
    background: #000000;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    margin-top: 8px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.settings-input:focus,
#bt-timeout-custom:focus {
    border-color: var(--primary-color, #8c73ff);
    outline: none;
}

.settings-actions-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.settings-action-btn,
#btn-modal-reload,
#btn-modal-install {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (hover: hover) {
    .settings-action-btn:hover,
    #btn-modal-reload:hover,
    #btn-modal-install:hover {
        background: rgba(255, 255, 255, 0.12);
        border-color: var(--primary-color, #8c73ff);
    }
}

.settings-action-btn:active,
#btn-modal-reload:active,
#btn-modal-install:active {
    background: rgba(255, 255, 255, 0.16);
}

.settings-action-btn:last-child {
    margin-bottom: 0;
}

/* Mode Toast */
#mode-toast,
.mode-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 18, 24, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--primary-color, #8c73ff);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 12px rgba(140, 115, 255, 0.3);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    z-index: 10002;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

#mode-toast-text {
    color: inherit;
    font-weight: inherit;
    font-size: inherit;
}

/* Mobile-Only Dominant-Themed Download Toast */
.download-toast {
    display: none;
}

@media (max-width: 800px) {
    .download-toast {
        position: fixed;
        bottom: 74px;
        left: 50%;
        transform: translateX(-50%);
        background: #141418;
        border: 1px solid var(--primary-color, #8c73ff);
        color: #ffffff;
        padding: 8px 16px;
        border-radius: 24px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.2px;
        z-index: 9999;
        display: flex;
        align-items: center;
        gap: 8px;
        pointer-events: none;
        contain: layout paint;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .download-toast.success {
        border-color: #00ff88;
    }

    #settings-modal,
    .settings-modal {
        width: 92%;
        max-width: 380px;
        padding: 16px;
    }

    .settings-radio-card,
    .settings-radio-label {
        min-height: 44px;
        padding: 12px;
    }

    .settings-action-btn,
    #btn-modal-reload,
    #btn-modal-install {
        min-height: 44px;
        padding: 12px;
    }

    .settings-select,
    #bt-timeout-select,
    .settings-input,
    #bt-timeout-custom {
        min-height: 44px;
    }
}


