<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <meta name="csrf-token" content="m2OIPgmptSpQmrpF64wECqmNBHJuCAzZzyX2h80u">
    
    <title>Sitemap — Vibplay</title>

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">

    <!-- PWA Manifest & Icons -->
    <link rel="manifest" href="/manifest.json">
    <link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192x192.png">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="theme-color" content="#f97316">

    <!-- Vite Assets -->
    <link rel="preload" as="style" href="https://vibplay.live/build/assets/css/app-BXf1qea9.css" /><link rel="modulepreload" href="https://vibplay.live/build/assets/js/app-BQhcR4AX.js" /><link rel="stylesheet" href="https://vibplay.live/build/assets/css/app-BXf1qea9.css" /><script type="module" src="https://vibplay.live/build/assets/js/app-BQhcR4AX.js"></script>
    <!-- Inline Critical Styles -->
    <style>
        body { font-family: 'Inter', sans-serif; }
        [x-cloak] { display: none !important; }

        /* Scrollbar */
        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: #4b5563; }

        .scrollbar-thin::-webkit-scrollbar { width: 6px; }
        .scrollbar-hide::-webkit-scrollbar { display: none; }
        .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

        /* Gradient Text */
        .gradient-text {
            background: linear-gradient(135deg, #f97316 0%, #9333ea 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        /* Pulse for new artists */
        @keyframes pulse-ring {
            0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
            100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
        }
        .animate-pulse-ring { animation: pulse-ring 2s infinite; }
        #app-main[data-immersive="1"] ~ [x-data^="playerBarComponent"] { display: none !important; }
    </style>

        </head>

<body class="bg-gray-900 text-white min-h-screen">
        

<script>
    // Side menu like YouTube: full menu or a slim rail (remembered), and an over-the-page drawer while watching or on narrow screens.
    window.vpShell = window.vpShell || (() => ({
        pref: (() => { try { return localStorage.getItem('vp-nav') || 'full'; } catch (e) { return 'full'; } })(),
        drawer: false,
        wide: window.innerWidth >= 1280,
        watch: false,
        init() {
            const read = () => { this.watch = document.getElementById('app-main')?.dataset.watch === '1'; };
            read();
            window.addEventListener('resize', () => { this.wide = window.innerWidth >= 1280; });
            window.addEventListener('soft-nav:loaded', () => { read(); this.drawer = false; });
            window.addEventListener('keydown', (e) => { if (e.key === 'Escape') this.drawer = false; });
        },
        get expanded() { return this.drawer || (!this.watch && this.wide && this.pref === 'full'); },
        get asideClass() {
            if (this.drawer) return 'fixed inset-y-0 left-0 z-[60] flex w-64 shadow-2xl';
            if (this.watch) return 'hidden';
            return 'hidden md:flex pt-16 ' + (this.expanded ? 'w-60' : 'w-[76px]');
        },
        toggle() {
            if (this.watch || !this.wide) { this.drawer = !this.drawer; return; }
            this.pref = this.pref === 'full' ? 'mini' : 'full';
            try { localStorage.setItem('vp-nav', this.pref); } catch (e) {}
        },
    }));
</script>

<div x-data="vpShell()" class="flex h-screen overflow-hidden">

    <!-- TOP HEADER -->
    <header class="fixed top-0 left-0 right-0 h-16 bg-black/95 backdrop-blur-xl border-b border-white/5 z-40 flex items-center justify-between gap-2 px-2 sm:px-4">
        <div class="flex items-center gap-1 sm:gap-3 shrink-0">
            <button type="button" @click="toggle()" class="p-2 hover:bg-white/10 rounded-full transition" aria-label="Menu">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M4 6h16M4 12h16M4 18h16"/></svg>
            </button>
            <a href="https://vibplay.live/home" class="flex items-center gap-2">
                <svg width="32" height="32" viewBox="0 0 200 200" class="w-7 h-7 sm:w-8 sm:h-8">
                    <defs>
                        <linearGradient id="grad-header" x1="0%" y1="0%" x2="100%" y2="100%">
                            <stop offset="0%" style="stop-color:#F97316" />
                            <stop offset="100%" style="stop-color:#9333EA" />
                        </linearGradient>
                    </defs>
                    <path d="M 40 30 C 40 20, 50 15, 60 20 L 160 90 C 170 95, 170 105, 160 110 L 60 180 C 50 185, 40 180, 40 170 Z" fill="url(#grad-header)"/>
                    <path d="M 75 60 L 100 130 L 125 60 L 145 60 L 110 150 L 90 150 L 55 60 Z" fill="white" opacity="0.95"/>
                </svg>
                <span class="text-base sm:text-lg font-bold text-white">Vibplay</span>
            </a>
        </div>

        <!-- Search: instant results while typing (full screen on phones) -->
        <style>html.vp-search-open body > div > header { z-index: 90; }</style>
<script>
window.vpInstantSearch = window.vpInstantSearch || function (initial) {
    const KEY = 'vp-recent-searches';
    const memo = new Map();
    const readRecent = () => { try { return JSON.parse(localStorage.getItem(KEY) || '[]').filter((x) => typeof x === 'string').slice(0, 8); } catch (e) { return []; } };
    return {
        q: initial || '', open: false, mobile: false, loading: false, groups: [], active: -1, recent: readRecent(), ctrl: null, timer: null, done: '',
        get term() { return this.q.trim(); },
        get items() {
            if (this.term.length < 2) return this.recent.map((r) => ({ type: 'recent', title: r, url: this.searchUrl(r) }));
            const flat = [];
            this.groups.forEach((g) => g.items.forEach((it) => flat.push(it)));
            flat.push({ type: 'all', title: `See all results for “${this.term}”`, url: this.searchUrl(this.term) });
            return flat;
        },
        indexOf(item) { return this.items.indexOf(item); },
        searchUrl(t) { return '/search?q=' + encodeURIComponent(t); },
        focus() { this.open = true; this.recent = readRecent(); },
        openMobile() { this.mobile = true; this.open = true; this.recent = readRecent(); this.$nextTick(() => this.$refs.input.focus()); document.documentElement.classList.add('overflow-hidden', 'vp-search-open'); },
        close() { this.open = false; this.active = -1; if (this.mobile) { this.mobile = false; document.documentElement.classList.remove('overflow-hidden', 'vp-search-open'); } this.$refs.input?.blur(); },
        changed() {
            this.active = -1; this.open = true;
            clearTimeout(this.timer);
            const t = this.term;
            if (t.length < 2) { this.ctrl?.abort(); this.groups = []; this.loading = false; this.done = ''; return; }
            const key = t.toLowerCase();
            if (memo.has(key)) { this.groups = memo.get(key); this.done = t; this.loading = false; return; }
            this.loading = true;
            this.timer = setTimeout(() => this.fetch(t, key), 160);
        },
        async fetch(t, key) {
            this.ctrl?.abort();
            this.ctrl = new AbortController();
            try {
                const r = await fetch('/api/web/search/instant?q=' + encodeURIComponent(t), { headers: { Accept: 'application/json' }, signal: this.ctrl.signal });
                if (!r.ok) throw new Error(r.status);
                const d = await r.json();
                const groups = d.groups || [];
                memo.set(key, groups);
                if (memo.size > 60) memo.delete(memo.keys().next().value);
                if (this.term.toLowerCase() === key) { this.groups = groups; this.done = t; }
            } catch (e) {
                if (e.name === 'AbortError') return;
                if (this.term.toLowerCase() === key) { this.groups = []; this.done = t; }
            }
            if (this.term.toLowerCase() === key) this.loading = false;
        },
        remember(t) {
            t = (t || '').trim();
            if (t.length < 2) return;
            this.recent = [t, ...readRecent().filter((x) => x.toLowerCase() !== t.toLowerCase())].slice(0, 8);
            try { localStorage.setItem(KEY, JSON.stringify(this.recent)); } catch (e) {}
        },
        forget(t) { this.recent = readRecent().filter((x) => x !== t); try { localStorage.setItem(KEY, JSON.stringify(this.recent)); } catch (e) {} },
        clearRecent() { this.recent = []; try { localStorage.removeItem(KEY); } catch (e) {} },
        go(item) {
            if (!item) return;
            if (item.type === 'recent') { this.q = item.title; this.remember(item.title); }
            else this.remember(this.term);
            const url = item.url;
            this.close();
            window.softNavigate ? window.softNavigate(url) : (location.href = url);
        },
        play(item) { if (item.play) { window.playTrack?.(item.play); this.remember(this.term); } },
        submit() {
            const it = this.items[this.active];
            if (it) return this.go(it);
            if (this.term.length) this.go({ type: 'all', url: this.searchUrl(this.term) });
        },
        move(step) {
            const n = this.items.length;
            if (!n) return;
            this.open = true;
            let a = this.active + step;
            if (a >= n) a = -1;
            if (a < -1) a = n - 1;
            this.active = a;
            this.$nextTick(() => this.$root.querySelector('[data-active="true"]')?.scrollIntoView({ block: 'nearest' }));
        },
    };
};
</script>
<div x-data="vpInstantSearch('')" @keydown.escape.window="open && close()" @click.outside="if (!mobile) { open = false; active = -1 }"
     class="flex-1 min-w-0 flex justify-end md:block md:max-w-2xl mx-1 md:mx-2 lg:mx-4">
    
    <button type="button" @click="openMobile()" class="md:hidden p-2 rounded-full hover:bg-white/10" aria-label="Search">
        <svg class="w-6 h-6" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
    </button>

    <div :class="mobile ? '!flex !fixed left-0 top-0 w-full h-[100dvh] z-[70] bg-gray-950 flex-col' : 'hidden'" class="hidden md:block relative">
        <form action="https://vibplay.live/search" method="GET" role="search" @submit.prevent="submit()" :class="mobile ? 'flex items-center gap-2 p-3 border-b border-white/10' : ''" class="relative">
            <button type="button" x-show="mobile" x-cloak @click="close()" class="p-2 rounded-full hover:bg-white/10 shrink-0" aria-label="Back">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7"/></svg>
            </button>
            <div class="relative flex-1 min-w-0">
                <input x-ref="input" type="text" enterkeyhint="search" name="q" x-model="q" @input="changed()" @focus="focus()" autocomplete="off" spellcheck="false" maxlength="80"
                       @keydown.arrow-down.prevent="move(1)" @keydown.arrow-up.prevent="move(-1)"
                       role="combobox" aria-autocomplete="list" aria-controls="vp-search-results" :aria-expanded="open ? 'true' : 'false'"
                       :aria-activedescendant="active >= 0 ? 'vp-sr-' + active : null"
                       placeholder="Search songs, artists, Vibz, podcasts..." value=""
                       class="w-full bg-white/5 border border-white/10 rounded-full px-5 py-2 pl-11 pr-10 text-white placeholder-gray-400 focus:outline-none focus:border-orange-500 focus:bg-gray-800 transition">
                <svg class="w-5 h-5 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
                <span x-show="loading" x-cloak class="absolute right-10 top-1/2 -translate-y-1/2 w-4 h-4 border-2 border-white/20 border-t-orange-400 rounded-full animate-spin"></span>
                <button type="button" x-show="q.length" x-cloak @click="q = ''; changed(); $refs.input.focus()" class="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-full text-gray-400 hover:text-white hover:bg-white/10" aria-label="Clear search">
                    <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" d="M6 18L18 6M6 6l12 12"/></svg>
                </button>
            </div>
        </form>

        
        <div x-show="open && (items.length || (term.length >= 2 && done === term))" x-cloak id="vp-search-results" role="listbox"
             :class="mobile ? 'flex-1 overflow-y-auto pb-24' : 'absolute left-0 right-0 top-full mt-2 max-h-[70vh] overflow-y-auto rounded-2xl border border-white/10 bg-gray-900 shadow-2xl'"
             class="py-2 text-sm">
            
            <template x-if="term.length < 2 && recent.length">
                <div class="flex items-center justify-between px-4 pt-1 pb-2">
                    <p class="text-xs font-semibold uppercase tracking-wider text-gray-400">Recent searches</p>
                    <button type="button" @click="clearRecent()" class="text-xs text-gray-400 hover:text-white">Clear</button>
                </div>
            </template>
            <template x-if="term.length < 2">
                <div>
                    <template x-for="(it, i) in items" :key="'r' + it.title">
                        <div :id="'vp-sr-' + i" role="option" :aria-selected="active === i ? 'true' : 'false'" :data-active="active === i"
                             class="flex items-center gap-3 px-4 py-2 cursor-pointer" :class="active === i ? 'bg-white/10' : 'hover:bg-white/5'"
                             @mouseenter="active = i" @click="go(it)">
                            <svg class="w-5 h-5 text-gray-500 shrink-0" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
                            <span class="flex-1 truncate" x-text="it.title"></span>
                            <button type="button" @click.stop="forget(it.title)" class="p-1 rounded-full text-gray-500 hover:text-white hover:bg-white/10" aria-label="Remove from recent searches">
                                <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" d="M6 18L18 6M6 6l12 12"/></svg>
                            </button>
                        </div>
                    </template>
                </div>
            </template>

            
            <template x-if="term.length >= 2">
                <div>
                    <template x-for="g in groups" :key="g.key">
                        <div class="pb-1">
                            <div class="flex items-center justify-between px-4 pt-2 pb-1">
                                <p class="text-xs font-semibold uppercase tracking-wider text-gray-400" x-text="g.label"></p>
                                <a :href="searchUrl(term) + '&tab=' + g.tab" @click.prevent="go({ type: 'all', url: searchUrl(term) + '&tab=' + g.tab })" class="text-xs text-gray-400 hover:text-white">See all</a>
                            </div>
                            <template x-for="it in g.items" :key="g.key + it.id">
                                <div :id="'vp-sr-' + indexOf(it)" role="option" :aria-selected="active === indexOf(it) ? 'true' : 'false'" :data-active="active === indexOf(it)"
                                     class="group flex items-center gap-3 px-4 py-1.5 cursor-pointer" :class="active === indexOf(it) ? 'bg-white/10' : 'hover:bg-white/5'"
                                     @mouseenter="active = indexOf(it)" @click="go(it)">
                                    <div class="relative shrink-0 bg-gray-800 overflow-hidden"
                                         :class="it.round ? 'w-10 h-10 rounded-full' : (it.vertical ? 'w-7 h-10 rounded-md' : (it.type === 'video' ? 'w-16 h-9 rounded-md' : 'w-10 h-10 rounded-md'))">
                                        <img x-show="it.image" :src="it.image" alt="" loading="lazy" class="w-full h-full object-cover" onerror="this.style.display='none'">
                                    </div>
                                    <div class="min-w-0 flex-1">
                                        <p class="truncate font-medium" x-text="it.title"></p>
                                        <p class="truncate text-xs text-gray-400" x-text="it.subtitle"></p>
                                    </div>
                                    <button type="button" x-show="it.play" @click.stop="play(it)" class="p-2 rounded-full bg-orange-500 hover:bg-orange-400 text-white shrink-0" :class="active === indexOf(it) ? '' : 'md:opacity-0 md:group-hover:opacity-100'" aria-label="Play">
                                        <svg class="w-4 h-4 ml-0.5" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
                                    </button>
                                </div>
                            </template>
                        </div>
                    </template>
                    <p x-show="!groups.length && done === term && !loading" class="px-4 py-3 text-gray-400">No quick matches for “<span x-text="term"></span>”.</p>
                    <div :id="'vp-sr-' + (items.length - 1)" role="option" :data-active="active === items.length - 1" @mouseenter="active = items.length - 1" @click="go(items[items.length - 1])"
                         class="mx-2 mt-1 flex items-center gap-3 px-3 py-2.5 rounded-xl cursor-pointer text-orange-300 font-semibold" :class="active === items.length - 1 ? 'bg-white/10' : 'hover:bg-white/5'">
                        <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
                        <span class="truncate" x-text="'See all results for “' + term + '”'"></span>
                    </div>
                </div>
            </template>
        </div>
    </div>
</div>

        <!-- Right Actions: Get the app + Studio for everyone, then account -->
        <div class="flex items-center gap-1.5 sm:gap-2 shrink-0">
            <a href="https://vibplay.live/get-app" data-no-soft data-app-link="listener" title="Get the VibPlay app"
               class="flex items-center gap-2 p-2 sm:px-3.5 sm:py-1.5 bg-white/10 hover:bg-white/20 text-white rounded-full text-sm font-medium transition">
                <svg class="w-5 h-5 sm:w-4 sm:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
                <span class="hidden lg:inline">Get the app</span>
            </a>
            <a href="https://vibplay.live/studio/login" data-no-soft title="VibPlay Studio — for artists, creators and podcasters"
               class="flex items-center gap-2 p-2 sm:px-3.5 sm:py-1.5 bg-gradient-to-r from-orange-500 to-purple-600 hover:from-orange-600 hover:to-purple-700 text-white rounded-full text-sm font-medium transition">
                <svg class="w-5 h-5 sm:w-4 sm:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
                <span class="hidden lg:inline">Studio</span>
            </a>
                            <a href="https://vibplay.live/register" class="hidden xl:block px-3 py-1.5 text-sm font-medium text-white hover:text-orange-500 transition">Create account</a>
                <a href="https://vibplay.live/login" class="px-3 sm:px-4 py-1.5 bg-white text-black rounded-full text-sm font-semibold hover:bg-gray-200 transition whitespace-nowrap">Log in</a>
                    </div>
    </header>

    <!-- Drawer backdrop -->
    <div x-show="drawer" x-cloak x-transition.opacity @click="drawer = false" class="fixed inset-0 bg-black/60 z-[55]"></div>

    <!-- SIDE MENU: full / slim rail / drawer -->
    <aside x-cloak :class="asideClass" class="flex-col bg-black h-full shrink-0">
        <div x-show="drawer" class="h-16 flex items-center gap-3 px-4 shrink-0">
            <button type="button" @click="drawer = false" class="p-2 hover:bg-white/10 rounded-full" aria-label="Close menu">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M4 6h16M4 12h16M4 18h16"/></svg>
            </button>
            <a href="https://vibplay.live/home" class="text-lg font-bold">Vibplay</a>
        </div>
        <nav id="app-sidebar-nav" data-soft-swap class="flex-1 px-2 py-2 space-y-0.5 overflow-y-auto scrollbar-hide">
            <a href="https://vibplay.live/home" title="Home"
   x-show="expanded || true"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Home</span>
    </a>
                        <a href="https://vibplay.live/shorts" title="Vibz"
   x-show="expanded || true"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Vibz</span>
    </a>
                        <a href="https://vibplay.live/discover" title="Discover"
   x-show="expanded || true"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Discover</span>
    </a>
            <a href="https://vibplay.live/videos" title="Videos"
   x-show="expanded || true"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664zM21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Videos</span>
    </a>
                                            <a href="https://vibplay.live/podcasts" title="Podcasts"
   x-show="expanded || true"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Podcasts</span>
    </a>
                            
            <div x-show="expanded" class="!my-3 border-t border-white/10"></div>

                            <div x-show="expanded" class="px-3 py-2 text-sm text-gray-300">
                    Sign in to like songs, follow artists and keep your library.
                    <a href="https://vibplay.live/login" class="mt-3 inline-flex items-center gap-2 px-4 py-1.5 rounded-full border border-white/20 text-orange-400 font-medium hover:bg-white/10">Sign in</a>
                </div>
                <div x-show="expanded" class="!my-3 border-t border-white/10"></div>
            
            <p x-show="expanded" class="px-3 pt-1 pb-1 text-base font-semibold">Explore</p>
            <a href="https://vibplay.live/discover/local-pulse" title="Local Pulse"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M17.657 16.657L13.414 20.9a2 2 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0zM15 11a3 3 0 11-6 0 3 3 0 016 0z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Local Pulse</span>
    </a>
            <a href="https://vibplay.live/browse" title="Browse"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h7"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Browse</span>
    </a>
                        <a href="https://vibplay.live/radio" title="Radio"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Radio</span>
    </a>
                                    <a href="https://vibplay.live/channels" title="Channels"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 20h16a1 1 0 001-1V5a1 1 0 00-1-1H4a1 1 0 00-1 1v14a1 1 0 001 1z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Channels</span>
    </a>
                        <a href="https://vibplay.live/live" title="Live"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Live</span>
    </a>
            
            <div x-show="expanded" class="!my-3 border-t border-white/10"></div>
            <p x-show="expanded" class="px-3 pt-1 pb-1 text-base font-semibold">More from Vibplay</p>
                        <a href="https://vibplay.live/live-events" title="Events"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Events</span>
    </a>
                                    <a href="https://vibplay.live/merch" title="Merch"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Merch</span>
    </a>
                        <a href="https://vibplay.live/get-app" title="Get the app"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200" data-no-soft="data-no-soft">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">Get the app</span>
    </a>
            <a href="https://vibplay.live/studio/login" title="VibPlay Studio"
   x-show="expanded || false"
   :class="expanded ? 'flex-row gap-5 px-3 h-10 text-sm' : 'flex-col justify-center gap-1 h-[68px] text-[10px] leading-tight'"
   class="flex items-center w-full rounded-lg transition-colors hover:bg-white/10 text-gray-200" data-no-soft="data-no-soft">
    <svg class="w-6 h-6 shrink-0" fill="none" stroke="currentColor" stroke-width="1.7" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
    <span class="truncate max-w-full" :class="expanded ? 'flex-1' : 'px-1 text-center'">VibPlay Studio</span>
    </a>
        </nav>

            </aside>

    <!-- MAIN CONTENT -->
    <div class="flex-1 flex flex-col overflow-hidden min-w-0">
        
                <main id="app-main" data-soft-swap data-watch="0" data-immersive="0" class="flex-1 overflow-x-hidden pt-16 overflow-y-auto pb-40 md:pb-24">
            <div class="w-full px-4 md:px-6 lg:px-8 py-12 text-white max-w-5xl mx-auto">
    <h1 class="text-4xl font-bold mb-2">Sitemap</h1>
    <p class="text-gray-400 mb-10">A complete overview of all pages on Vibplay</p>

    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">Discover</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/home" class="text-gray-300 hover:text-orange-400 transition text-sm">Home</a></li>
                                                <li><a href="https://vibplay.live/browse" class="text-gray-300 hover:text-orange-400 transition text-sm">Browse</a></li>
                                                <li><a href="https://vibplay.live/browse/charts" class="text-gray-300 hover:text-orange-400 transition text-sm">Charts</a></li>
                                                <li><a href="https://vibplay.live/browse/new-releases" class="text-gray-300 hover:text-orange-400 transition text-sm">New Releases</a></li>
                                                <li><a href="https://vibplay.live/genres" class="text-gray-300 hover:text-orange-400 transition text-sm">Genres</a></li>
                                                <li><a href="https://vibplay.live/search" class="text-gray-300 hover:text-orange-400 transition text-sm">Search</a></li>
                            </ul>
        </div>

        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">Library</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/library" class="text-gray-300 hover:text-orange-400 transition text-sm">My Library</a></li>
                                                <li><a href="https://vibplay.live/library/playlists" class="text-gray-300 hover:text-orange-400 transition text-sm">Playlists</a></li>
                                                <li><a href="https://vibplay.live/library/favorites" class="text-gray-300 hover:text-orange-400 transition text-sm">Favourites</a></li>
                                                <li><a href="https://vibplay.live/library/following" class="text-gray-300 hover:text-orange-400 transition text-sm">Following</a></li>
                                                <li><a href="https://vibplay.live/library/history" class="text-gray-300 hover:text-orange-400 transition text-sm">History</a></li>
                                                <li><a href="https://vibplay.live/library/my-radio" class="text-gray-300 hover:text-orange-400 transition text-sm">My Radio</a></li>
                            </ul>
        </div>

        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">Media</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/radio" class="text-gray-300 hover:text-orange-400 transition text-sm">Radio</a></li>
                                                <li><a href="https://vibplay.live/podcasts" class="text-gray-300 hover:text-orange-400 transition text-sm">Podcasts</a></li>
                                                <li><a href="https://vibplay.live/videos" class="text-gray-300 hover:text-orange-400 transition text-sm">Videos</a></li>
                                                <li><a href="https://vibplay.live/channels" class="text-gray-300 hover:text-orange-400 transition text-sm">Channels</a></li>
                                                <li><a href="https://vibplay.live/live-events" class="text-gray-300 hover:text-orange-400 transition text-sm">Live Events</a></li>
                                                <li><a href="https://vibplay.live/albums" class="text-gray-300 hover:text-orange-400 transition text-sm">Albums</a></li>
                            </ul>
        </div>

        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">For Artists</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/studio/login" class="text-gray-300 hover:text-orange-400 transition text-sm">VibPlay Studio</a></li>
                                                <li><a href="https://vibplay.live/studio/tracks/upload" class="text-gray-300 hover:text-orange-400 transition text-sm">Upload Track</a></li>
                                                <li><a href="https://vibplay.live/studio/analytics" class="text-gray-300 hover:text-orange-400 transition text-sm">Analytics</a></li>
                                                <li><a href="https://vibplay.live/studio/earnings" class="text-gray-300 hover:text-orange-400 transition text-sm">Earnings</a></li>
                                            </ul>
        </div>

        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">Account</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/login" class="text-gray-300 hover:text-orange-400 transition text-sm">Sign In</a></li>
                                                <li><a href="https://vibplay.live/register" class="text-gray-300 hover:text-orange-400 transition text-sm">Create Account</a></li>
                                                                <li><a href="https://vibplay.live/subscriptions" class="text-gray-300 hover:text-orange-400 transition text-sm">Subscription Plans</a></li>
                                                <li><a href="https://vibplay.live/live-events/my-tickets" class="text-gray-300 hover:text-orange-400 transition text-sm">My Tickets</a></li>
                                                <li><a href="https://vibplay.live/merch/cart" class="text-gray-300 hover:text-orange-400 transition text-sm">Merch Cart</a></li>
                            </ul>
        </div>

        
        <div>
            <h2 class="text-lg font-bold text-orange-400 uppercase tracking-wider mb-4">Company</h2>
            <ul class="space-y-2">
                                                <li><a href="https://vibplay.live/about" class="text-gray-300 hover:text-orange-400 transition text-sm">About</a></li>
                                                <li><a href="https://vibplay.live/features" class="text-gray-300 hover:text-orange-400 transition text-sm">Features</a></li>
                                                <li><a href="https://vibplay.live/pricing" class="text-gray-300 hover:text-orange-400 transition text-sm">Pricing</a></li>
                                                                <li><a href="https://vibplay.live/advertise" class="text-gray-300 hover:text-orange-400 transition text-sm">Advertise</a></li>
                                                <li><a href="https://vibplay.live/careers" class="text-gray-300 hover:text-orange-400 transition text-sm">Careers</a></li>
                                                <li><a href="https://vibplay.live/press" class="text-gray-300 hover:text-orange-400 transition text-sm">Press</a></li>
                                                <li><a href="https://vibplay.live/contact" class="text-gray-300 hover:text-orange-400 transition text-sm">Contact</a></li>
                                                <li><a href="https://vibplay.live/help" class="text-gray-300 hover:text-orange-400 transition text-sm">Help Center</a></li>
                                                <li><a href="https://vibplay.live/legal/terms" class="text-gray-300 hover:text-orange-400 transition text-sm">Terms of Service</a></li>
                                                <li><a href="https://vibplay.live/legal/privacy" class="text-gray-300 hover:text-orange-400 transition text-sm">Privacy Policy</a></li>
                                                <li><a href="https://vibplay.live/legal/copyright" class="text-gray-300 hover:text-orange-400 transition text-sm">Copyright</a></li>
                            </ul>
        </div>
    </div>
</div>
        </main>

        <div
    x-data="playerBarComponent()"
    x-show="$store.player.currentTrack"
    x-cloak
    @player-updated.window="$nextTick(() => {})"
    
    class="fixed left-0 right-0 z-50 bottom-[calc(4rem+env(safe-area-inset-bottom))] md:bottom-0"
>
    
    <div x-show="$store.player.ad" x-cloak class="absolute inset-x-0 bottom-0 z-10 h-16 md:h-24 bg-black/98 backdrop-blur-xl border-t border-gray-800">
        <div class="w-full h-1 bg-gray-800">
            <div class="h-full bg-gradient-to-r from-orange-500 to-purple-600 transition-all duration-300 ease-linear"
                 :style="`width:${$store.player.adDuration ? Math.min(100, $store.player.adTime / $store.player.adDuration * 100) : 0}%`"></div>
        </div>
        <div class="flex items-center justify-between gap-4 px-4 h-[calc(100%-4px)]">
            <div class="flex items-center gap-3 min-w-0">
                <span class="px-2 py-0.5 rounded bg-gradient-to-r from-orange-500 to-purple-600 text-[10px] font-bold uppercase tracking-wider text-white">Ad</span>
                <div class="relative shrink-0" x-data="{ open: false, why: null, loading: false }" @keydown.escape.window="open = false">
    <button type="button" class="w-7 h-7 rounded-full flex items-center justify-center text-gray-400 hover:text-white hover:bg-white/10 focus:outline-none focus:ring-2 focus:ring-orange-500"
            aria-label="Why this ad?" :aria-expanded="open"
            @click="open = !open; if (open && !why) { loading = true; why = await $store.player.adWhy(); loading = false }">
        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
    </button>
    <div x-show="open" x-cloak x-transition @click.outside="open = false"
         class="absolute bottom-full left-0 mb-3 w-72 max-w-[85vw] rounded-2xl bg-gray-900 border border-white/10 shadow-2xl p-4 text-left z-20">
        <p class="text-sm font-semibold text-white">Why this ad?</p>
        <p x-show="loading" class="text-xs text-gray-400 mt-2">Loading…</p>
        <ul x-show="why" class="mt-2 space-y-1 text-xs text-gray-300 list-disc list-inside">
            <template x-for="r in (why?.reasons || [])" :key="r"><li x-text="r"></li></template>
        </ul>
        <p x-show="why" class="mt-2 text-[11px] text-gray-500" x-text="why?.about"></p>
        <div class="mt-3 flex flex-col gap-1.5">
            <button type="button" @click="open = false; $store.player.hideAd('ad')" class="text-left text-xs px-3 py-2 rounded-lg bg-white/5 hover:bg-white/10 text-white">Hide this ad</button>
            <button type="button" @click="open = false; $store.player.hideAd('advertiser')" class="text-left text-xs px-3 py-2 rounded-lg bg-white/5 hover:bg-white/10 text-white"
                    x-text="'Hide ads from ' + ($store.player.ad?.advertiser || 'this advertiser')"></button>
            <a href="https://vibplay.live/subscriptions" class="text-xs px-3 py-2 rounded-lg text-orange-400 hover:text-orange-300">Go Premium for no ads</a>
        </div>
    </div>
</div>
                <div class="min-w-0">
                    <p class="text-sm font-medium text-white truncate" x-text="$store.player.ad?.title"></p>
                    <p class="text-xs text-gray-400 truncate" x-text="$store.player.ad?.advertiser ? 'Sponsored by ' + $store.player.ad.advertiser : 'Sponsored'"></p>
                </div>
            </div>
            <div class="flex items-center gap-3 shrink-0">
                <button type="button" @click="$store.player.togglePlay()" class="w-10 h-10 rounded-full bg-white text-black flex items-center justify-center" aria-label="Play or pause ad">
                    <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
                </button>
                <button type="button" x-show="$store.player.ad?.click_url" @click="$store.player.openAd()" class="text-sm text-white/80 hover:text-white underline">Learn more</button>
                <button type="button" @click="$store.player.skipAd()" :disabled="!$store.player.adCanSkip"
                        class="px-4 py-2 rounded-full text-sm font-semibold border border-white/20 text-white disabled:opacity-50"
                        x-text="$store.player.adCanSkip ? 'Skip ad' : ($store.player.ad?.skippable_after > 0 ? 'Skip in ' + Math.max(0, Math.ceil($store.player.ad.skippable_after - $store.player.adTime)) + 's' : 'Ad')"></button>
            </div>
        </div>
    </div>

    
    <div x-show="!expandedPlayer" class="md:hidden px-2 pb-1.5">
        <div class="relative bg-gray-800/95 backdrop-blur-xl rounded-xl overflow-hidden shadow-2xl border border-white/5">
            <div class="flex items-center gap-3 p-2 pr-1">
                <img :src="$store.player.currentTrack?.cover_art_url || '/images/default-cover.jpg'" :alt="$store.player.currentTrack?.title || ''"
                     class="w-12 h-12 rounded-md object-cover flex-shrink-0" @click="expandedPlayer = true">
                <div class="flex-1 min-w-0" @click="expandedPlayer = true">
                    <p class="text-sm font-semibold text-white truncate" x-text="$store.player.currentTrack?.title || 'Unknown'"></p>
                    <p class="text-xs text-gray-400 truncate">
                        <span x-show="$store.player.currentTrack?.is_radio" class="text-red-400 font-bold mr-1">LIVE</span>
                        <span x-text="$store.player.currentTrack?.artist?.stage_name || $store.player.currentTrack?.artist_name || 'Unknown Artist'"></span>
                    </p>
                </div>
                <button type="button" x-show="!$store.player.currentTrack?.is_radio" @click="$store.player.toggleLike($store.player.currentTrack?.id)"
                        class="p-2" :class="$store.player.isLiked ? 'text-pink-500' : 'text-gray-300'" aria-label="Like">
                    <svg class="w-6 h-6" :fill="$store.player.isLiked ? 'currentColor' : 'none'" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
                    </svg>
                </button>
                <button type="button" @click="$store.player.togglePlay()" class="p-2 text-white" :aria-label="$store.player.isPlaying ? 'Pause' : 'Play'">
                    <svg x-show="!$store.player.isPlaying" class="w-7 h-7" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
                    <svg x-show="$store.player.isPlaying" class="w-7 h-7" fill="currentColor" viewBox="0 0 24 24"><path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/></svg>
                </button>
                <button type="button" x-show="!$store.player.currentTrack?.is_radio" @click="$store.player.nextTrack()" class="p-2 text-white" aria-label="Next">
                    <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></svg>
                </button>
            </div>
            <div x-show="!$store.player.currentTrack?.is_radio" class="absolute bottom-0 left-0 right-0 h-[3px] bg-white/10">
                <div class="h-full bg-gradient-to-r from-orange-500 to-purple-600 transition-all duration-150 ease-linear" :style="`width: ${progressPercent}%`"></div>
            </div>
        </div>
    </div>

    
    <div x-show="!expandedPlayer" class="hidden md:block bg-black/98 backdrop-blur-xl border-t border-gray-800 h-24">

        
        <div
            x-show="!$store.player.currentTrack?.is_radio"
            class="w-full h-1 bg-gray-800 cursor-pointer group"
            @click="seekBar($event)"
            @touchstart.prevent="seekBar($event)"
        >
            <div
                class="h-full bg-gradient-to-r from-orange-500 to-purple-600 relative transition-all duration-150 ease-linear"
                :style="`width: ${progressPercent}%`"
            >
                <div class="absolute right-0 top-1/2 -translate-y-1/2 w-3 h-3 bg-white rounded-full opacity-0 group-hover:opacity-100 transition-opacity shadow-lg"></div>
            </div>
        </div>

        
        <div x-show="$store.player.currentTrack?.is_radio" class="w-full h-1 bg-gradient-to-r from-orange-500 to-red-600 relative overflow-hidden">
            <div class="absolute inset-0 bg-white/20 animate-pulse"></div>
            <div class="absolute inset-0 flex items-center justify-center">
                <span class="text-xs font-bold text-white tracking-wider">LIVE</span>
            </div>
        </div>

        
        <div class="flex-1 flex items-center justify-between px-4 pt-2 pb-1 gap-4">

            
            <div class="flex items-center gap-4 flex-1 min-w-0">
                <img
                    :src="$store.player.currentTrack?.cover_art_url || '/images/default-cover.jpg'"
                    :alt="$store.player.currentTrack?.title || 'Unknown Track'"
                    class="w-14 h-14 rounded object-cover flex-shrink-0 cursor-pointer hover:opacity-80 transition shadow-lg"
                    @click="expandedPlayer = true"
                >
                <div class="flex-1 min-w-0">
                    <p
                        class="font-medium text-sm truncate hover:underline cursor-pointer text-white"
                        x-text="$store.player.currentTrack?.title || 'Unknown'"
                        @click="expandedPlayer = true"
                    ></p>
                    <a
                        :href="`/artist/${$store.player.currentTrack?.artist?.slug}`"
                        class="text-xs text-gray-400 truncate hover:text-white hover:underline transition"
                        x-text="$store.player.currentTrack?.artist?.stage_name || 'Unknown Artist'"
                    ></a>
                </div>
                <button
                    @click="$store.player.toggleLike($store.player.currentTrack?.id)"
                    class="hidden md:block transition p-2"
                    :class="$store.player.isLiked ? 'text-red-500' : 'text-gray-400 hover:text-white'"
                >
                    <svg class="w-5 h-5" :fill="$store.player.isLiked ? 'currentColor' : 'none'" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
                    </svg>
                </button>
            </div>

            
            <div class="hidden md:flex flex-col items-center gap-2 flex-1 max-w-2xl">
                <div class="flex items-center gap-4">
                    <button @click="$store.player.toggleShuffle()" class="transition p-2" :class="$store.player.isShuffle ? 'text-green-500' : 'text-gray-400 hover:text-white'">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"/>
                        </svg>
                    </button>

                    <button @click="$store.player.previousTrack()" class="text-white hover:text-orange-500 transition p-2">
                        <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
                            <path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/>
                        </svg>
                    </button>

                    <button
                        @click="$store.player.togglePlay()"
                        class="w-10 h-10 bg-white hover:bg-gray-200 rounded-full flex items-center justify-center text-black transition transform hover:scale-105 shadow-lg"
                    >
                        <svg x-show="!$store.player.isPlaying" class="w-5 h-5 ml-0.5" fill="currentColor" viewBox="0 0 24 24">
                            <path d="M8 5v14l11-7z"/>
                        </svg>
                        <svg x-show="$store.player.isPlaying" class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
                            <path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>
                        </svg>
                    </button>

                    <button @click="$store.player.nextTrack()" class="text-white hover:text-orange-500 transition p-2">
                        <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
                            <path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/>
                        </svg>
                    </button>

                    <button @click="$store.player.cycleRepeat()" class="transition p-2 relative" :class="$store.player.repeatMode !== 'off' ? 'text-green-500' : 'text-gray-400 hover:text-white'">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
                        </svg>
                        <span x-show="$store.player.repeatMode === 'one'" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-[8px] font-bold">1</span>
                    </button>
                </div>

                <div class="flex items-center gap-2 w-full text-xs text-gray-400">
                    <span x-text="currentTimeFormatted">0:00</span>
                    <div class="flex-1 h-1 bg-gray-800 rounded-full"></div>
                    <span x-text="durationFormatted">0:00</span>
                </div>
            </div>

            
            <div class="hidden md:flex items-center gap-2 flex-1 justify-end">
                <button @click="toggleQueue()" class="transition p-2" :class="queueOpen ? 'text-orange-500' : 'text-gray-400 hover:text-white'">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/>
                    </svg>
                </button>

                <div class="flex items-center gap-2 w-32">
                    <button @click="$store.player.toggleMute()" class="text-gray-400 hover:text-white transition p-2">
                        <svg x-show="!$store.player.muted && $store.player.volume > 0.5" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"/>
                        </svg>
                        <svg x-show="!$store.player.muted && $store.player.volume <= 0.5 && $store.player.volume > 0" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"/>
                        </svg>
                        <svg x-show="$store.player.muted || $store.player.volume === 0" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2"/>
                        </svg>
                    </button>
                    <input
                        type="range"
                        min="0"
                        max="100"
                        step="1"
                        :value="$store.player.volume * 100"
                        @input="$store.player.setVolume($event.target.value)"
                        class="w-full h-1 bg-gray-700 rounded-full appearance-none cursor-pointer accent-orange-500"
                    >
                </div>

                <button @click="expandedPlayer = true" class="text-gray-400 hover:text-white transition p-2">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/>
                    </svg>
                </button>
            </div>

            
            <button
                @click="$store.player.togglePlay()"
                class="md:hidden mt-1 w-12 h-12 bg-white rounded-full flex items-center justify-center text-black flex-shrink-0 shadow-lg"
            >
                <svg x-show="!$store.player.isPlaying" class="w-6 h-6 ml-0.5" fill="currentColor" viewBox="0 0 24 24">
                    <path d="M8 5v14l11-7z"/>
                </svg>
                <svg x-show="$store.player.isPlaying" class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
                    <path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>
                </svg>
            </button>
        </div>
    </div>

    
    
    
    
    <div x-show="expandedPlayer" x-transition:enter="transition ease-out duration-300"
         x-transition:enter-start="opacity-0 translate-y-full" x-transition:enter-end="opacity-100 translate-y-0"
         x-transition:leave="transition ease-in duration-200"
         x-transition:leave-start="opacity-100 translate-y-0" x-transition:leave-end="opacity-0 translate-y-full"
         class="fixed inset-0 z-[100] flex flex-col overflow-hidden"
         style="background: linear-gradient(180deg, #0f0f0f 0%, #111 100%);">

        
        <div class="absolute inset-0 overflow-hidden pointer-events-none">
            <img :src="$store.player.currentTrack?.cover_art_url || '/images/default-cover.jpg'"
                 class="w-full h-full object-cover opacity-40 blur-3xl scale-125 transition-all duration-1000"
                 aria-hidden="true">
            <video x-show="canvas && expandedPlayer" x-cloak :src="expandedPlayer ? (canvas?.video_url || '') : ''" muted loop playsinline autoplay
                   class="absolute inset-0 w-full h-full object-cover opacity-25 blur-xl scale-110" aria-hidden="true"></video>
            <div class="absolute inset-0 bg-gradient-to-b from-black/60 via-black/40 to-black/80"></div>
        </div>

        
        <div class="relative flex items-center justify-between px-6 pt-safe pt-4 pb-3 flex-shrink-0">
            <button @click="expandedPlayer = false"
                    class="w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 transition text-white">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M19 9l-7 7-7-7"/>
                </svg>
            </button>

            <div class="text-center">
                <p class="text-xs text-gray-400 font-semibold uppercase tracking-widest">Now Playing</p>
                <p class="text-white text-sm font-medium truncate max-w-[200px]"
                   x-text="$store.player.currentTrack?.album?.title ?? 'Single'"></p>
            </div>

            <div class="flex items-center gap-2">
            <button @click="sheetOpen = true" aria-label="More options for this song" x-show="!$store.player.currentTrack?.is_radio"
                    class="w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 transition text-white">
                <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>
            </button>
            <button @click="toggleQueue()" aria-label="Queue"
                    class="w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 transition"
                    :class="queueOpen ? 'text-orange-400' : 'text-white'">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/>
                </svg>
            </button>
            </div>
        </div>

        
        <div class="relative flex justify-center gap-1 px-6 mb-4 flex-shrink-0">
            <div class="inline-flex bg-white/10 rounded-full p-1">
                <button @click="expandedTab = 'player'"
                        :class="expandedTab === 'player' ? 'bg-white text-black' : 'text-gray-400 hover:text-white'"
                        class="px-5 py-1.5 rounded-full text-sm font-semibold transition-all duration-200">
                    Player
                </button>
                <button @click="expandedTab = 'lyrics'"
                        :class="expandedTab === 'lyrics' ? 'bg-white text-black' : 'text-gray-400 hover:text-white'"
                        class="px-5 py-1.5 rounded-full text-sm font-semibold transition-all duration-200">
                    Lyrics
                </button>
                <button @click="expandedTab = 'info'"
                        :class="expandedTab === 'info' ? 'bg-white text-black' : 'text-gray-400 hover:text-white'"
                        class="px-5 py-1.5 rounded-full text-sm font-semibold transition-all duration-200">
                    Info
                </button>
            </div>
        </div>

        
        <div class="relative flex-1 overflow-hidden">

            
            <div x-show="expandedTab === 'player'" class="h-full flex flex-col px-6 pb-6">

                
                <div class="flex-1 flex items-center justify-center py-4 min-h-0">
                    <div class="relative group" style="max-width: min(90vw, 380px); width: 100%;">
                        <video x-show="canvas" x-cloak :src="expandedPlayer && expandedTab === 'player' ? (canvas?.video_url || '') : ''" :poster="canvas?.poster || ''"
                               muted loop playsinline autoplay aria-label="Song canvas"
                               class="w-full aspect-square rounded-3xl object-cover shadow-[0_40px_80px_rgba(0,0,0,0.6)] ring-1 ring-white/10"></video>
                        <img x-show="!canvas" :src="$store.player.currentTrack?.cover_art_url || '/images/default-cover.jpg'"
                             :alt="$store.player.currentTrack?.title"
                             class="w-full aspect-square rounded-3xl shadow-[0_40px_80px_rgba(0,0,0,0.6)] object-cover transition-all duration-700 ring-1 ring-white/10"
                             :class="$store.player.isPlaying ? 'scale-100' : 'scale-95 opacity-80'"
                             onerror="this.src='/images/default-cover.jpg'">
                        
                        <div class="absolute inset-0 rounded-3xl opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-t from-black/60 to-transparent flex items-end justify-center pb-6">
                            <canvas id="waveform-canvas" class="w-full h-12 opacity-70"></canvas>
                        </div>
                    </div>
                </div>

                
                <div class="flex items-center justify-between mb-5">
                    <div class="flex-1 min-w-0 mr-4">
                        <h1 class="text-2xl font-extrabold text-white truncate leading-tight"
                            x-text="$store.player.currentTrack?.title ?? 'Unknown'"></h1>
                        <a :href="`/artist/${$store.player.currentTrack?.artist?.slug}`"
                           class="text-gray-400 hover:text-orange-400 transition text-base font-medium truncate block"
                           x-text="$store.player.currentTrack?.artist?.stage_name ?? 'Unknown Artist'"></a>
                    </div>
                    <button @click="$store.player.toggleLike($store.player.currentTrack?.id)"
                            class="flex-shrink-0 w-10 h-10 flex items-center justify-center rounded-full transition"
                            :class="$store.player.isLiked ? 'text-pink-500' : 'text-gray-400 hover:text-white'">
                        <svg class="w-6 h-6 transition-transform" :class="$store.player.isLiked ? 'fill-current scale-110' : ''"
                             :fill="$store.player.isLiked ? 'currentColor' : 'none'" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                  d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
                        </svg>
                    </button>
                </div>

                
                <div x-show="!$store.player.currentTrack?.is_radio" class="mb-5">
                    <div class="w-full h-1.5 bg-white/20 rounded-full cursor-pointer group relative"
                         @click="seekBar($event)">
                        <div class="h-full bg-gradient-to-r from-orange-500 to-purple-500 rounded-full transition-all duration-150 relative"
                             :style="`width:${progressPercent}%`">
                            <div class="absolute right-0 top-1/2 -translate-y-1/2 w-4 h-4 bg-white rounded-full shadow-lg
                                        opacity-0 group-hover:opacity-100 transition-opacity -translate-x-1/2"></div>
                        </div>
                    </div>
                    <div class="flex justify-between text-xs text-gray-500 mt-1.5 font-mono">
                        <span x-text="currentTimeFormatted">0:00</span>
                        <span x-text="durationFormatted">0:00</span>
                    </div>
                </div>

                
                <div class="flex items-center justify-between mb-6">
                    <button @click="$store.player.toggleShuffle()"
                            :class="$store.player.isShuffle ? 'text-green-400' : 'text-gray-500 hover:text-white'"
                            class="transition p-2">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                  d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"/>
                        </svg>
                    </button>

                    <button @click="$store.player.previousTrack()" class="text-white hover:text-orange-400 transition p-2">
                        <svg class="w-9 h-9" fill="currentColor" viewBox="0 0 24 24"><path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/></svg>
                    </button>

                    <button @click="$store.player.togglePlay()"
                            class="w-18 h-18 w-[72px] h-[72px] rounded-full flex items-center justify-center shadow-2xl transition-transform hover:scale-105 active:scale-95"
                            style="background: linear-gradient(135deg, #f97316, #9333ea)">
                        <svg x-show="!$store.player.isPlaying" class="w-9 h-9 text-white ml-1 fill-current" viewBox="0 0 24 24">
                            <path d="M8 5v14l11-7z"/>
                        </svg>
                        <svg x-show="$store.player.isPlaying" class="w-9 h-9 text-white fill-current" viewBox="0 0 24 24">
                            <path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>
                        </svg>
                    </button>

                    <button @click="$store.player.nextTrack()" class="text-white hover:text-orange-400 transition p-2">
                        <svg class="w-9 h-9" fill="currentColor" viewBox="0 0 24 24"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></svg>
                    </button>

                    <button @click="$store.player.cycleRepeat()" class="transition p-2 relative"
                            :class="$store.player.repeatMode !== 'off' ? 'text-green-400' : 'text-gray-500 hover:text-white'">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                  d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
                        </svg>
                        <span x-show="$store.player.repeatMode === 'one'"
                              class="absolute top-1 right-1 text-[9px] font-black leading-none">1</span>
                    </button>
                </div>

                
                <div class="flex items-center gap-3">
                    <button @click="$store.player.toggleMute()" class="text-gray-500 hover:text-white transition flex-shrink-0">
                        <svg x-show="!$store.player.muted && $store.player.volume > 0" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"/>
                        </svg>
                        <svg x-show="$store.player.muted || $store.player.volume === 0" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2"/>
                        </svg>
                    </button>
                    <input type="range" min="0" max="100" step="1"
                           :value="$store.player.volume * 100"
                           @input="$store.player.setVolume($event.target.value)"
                           class="flex-1 h-1.5 bg-white/20 rounded-full appearance-none cursor-pointer accent-orange-500">
                    <button @click="window.dispatchEvent(new CustomEvent('show-add-to-playlist-modal', { detail: { trackId: $store.player.currentTrack?.id } }))"
                            class="text-gray-500 hover:text-white transition flex-shrink-0" title="Add to playlist">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                        </svg>
                    </button>
                </div>
            </div>

            
            <div x-show="expandedTab === 'lyrics'"
                 x-data="expandedLyrics()"
                 @player-updated.window="loadLyrics()"
                 :class="lyricsFull ? 'fixed inset-0 z-[130] bg-gradient-to-b from-purple-900 via-gray-950 to-orange-950 px-6 sm:px-16 pt-16' : 'h-full px-6'"
                 class="overflow-y-auto pb-24 scrollbar-hide">
                <div class="sticky top-0 z-10 flex justify-end pt-2" :class="lyricsFull ? 'fixed top-4 right-4' : ''">
                    <button type="button" x-show="timedLines.length || plainLyrics" @click="lyricsFull = !lyricsFull"
                            class="px-3 py-1.5 rounded-full bg-white/10 hover:bg-white/20 text-xs font-semibold text-white"
                            x-text="lyricsFull ? 'Exit full screen' : 'Full screen'"></button>
                </div>

                <div x-show="loading" class="flex items-center justify-center h-full">
                    <div class="text-center">
                        <svg class="animate-spin w-10 h-10 text-purple-500 mx-auto mb-3" fill="none" viewBox="0 0 24 24">
                            <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/>
                            <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.4 0 0 5.4 0 12h4z"/>
                        </svg>
                        <p class="text-gray-500 text-sm">Loading lyrics...</p>
                    </div>
                </div>

                <div x-show="!loading && timedLines.length > 0" class="py-6 space-y-6">
                    <template x-for="(line, i) in timedLines" :key="i">
                        <p @click="$store.player.seekTo(line.time)"
                           class="text-center font-bold leading-relaxed cursor-pointer transition-all duration-500 select-none"
                           x-effect="if (activeLine === i && expandedPlayer && expandedTab === 'lyrics') $el.scrollIntoView({ block: 'center', behavior: 'smooth' })"
                           x-bind:style="lyricsFull ? 'font-size: clamp(1.75rem, 4vw, 3.25rem)' : 'font-size: 1.5rem'"
                           :class="activeLine === i
                               ? 'text-white scale-105'
                               : 'text-gray-600 hover:text-gray-400 scale-100'"
                           x-text="line.text"></p>
                    </template>
                </div>

                <div x-show="!loading && timedLines.length === 0 && plainLyrics"
                     class="py-6">
                    <pre class="text-gray-300 text-lg leading-loose font-sans whitespace-pre-wrap text-center"
                         x-text="plainLyrics"></pre>
                </div>

                <div x-show="!loading && timedLines.length === 0 && !plainLyrics"
                     class="flex flex-col items-center justify-center h-64 text-center">
                    <div class="text-6xl mb-4">🎵</div>
                    <p class="text-gray-500 text-lg font-semibold">No lyrics available</p>
                    <p class="text-gray-600 text-sm mt-1">Lyrics haven't been added for this track yet</p>
                </div>
            </div>

            
            <div x-show="expandedTab === 'info'" class="h-full overflow-y-auto px-6 pb-24 scrollbar-hide py-6 space-y-6">

                
                <div class="bg-white/5 rounded-2xl p-5 flex items-center gap-4">
                    <a :href="`/artist/${$store.player.currentTrack?.artist?.slug}`" class="flex-shrink-0">
                        <img :src="$store.player.currentTrack?.artist?.avatar_url || '/images/default-avatar.jpg'"
                             class="w-16 h-16 rounded-full object-cover ring-2 ring-white/10">
                    </a>
                    <div class="flex-1 min-w-0">
                        <a :href="`/artist/${$store.player.currentTrack?.artist?.slug}`"
                           class="text-white font-bold text-lg hover:text-orange-400 transition truncate block"
                           x-text="$store.player.currentTrack?.artist?.stage_name ?? 'Unknown'"></a>
                        <p class="text-gray-400 text-sm" x-text="($store.player.currentTrack?.artist?.monthly_listeners ?? 0).toLocaleString() + ' monthly listeners'"></p>
                    </div>
                    <a :href="`/artist/${$store.player.currentTrack?.artist?.slug}`"
                       class="flex-shrink-0 px-4 py-2 bg-white/10 hover:bg-white/20 rounded-full text-white text-sm font-semibold transition">
                        View
                    </a>
                </div>

                
                <div class="bg-white/5 rounded-2xl p-5 space-y-4">
                    <h3 class="text-white font-bold text-base mb-4">Track Details</h3>
                    <div class="grid grid-cols-2 gap-4 text-sm">
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">Release</p>
                            <p class="text-white font-medium" x-text="$store.player.currentTrack?.release_date ?? '—'"></p>
                        </div>
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">Genre</p>
                            <p class="text-white font-medium" x-text="$store.player.currentTrack?.genre ?? '—'"></p>
                        </div>
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">Duration</p>
                            <p class="text-white font-medium" x-text="$store.player.formatTime($store.player.duration)"></p>
                        </div>
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">Plays</p>
                            <p class="text-white font-medium" x-text="($store.player.currentTrack?.play_count ?? 0).toLocaleString()"></p>
                        </div>
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">BPM</p>
                            <p class="text-white font-medium" x-text="$store.player.currentTrack?.bpm ?? '—'"></p>
                        </div>
                        <div>
                            <p class="text-gray-500 text-xs uppercase tracking-wider mb-1">Quality</p>
                            <p class="text-white font-medium uppercase" x-text="$store.player.currentTrack?.audio_format ?? 'MP3'"></p>
                        </div>
                    </div>
                </div>

                
                <div class="bg-white/5 rounded-2xl p-5 flex items-center gap-4"
                     x-show="$store.player.currentTrack?.album">
                    <img :src="$store.player.currentTrack?.album?.cover_art_url || '/images/default-cover.jpg'"
                         class="w-16 h-16 rounded-xl object-cover">
                    <div class="flex-1 min-w-0">
                        <p class="text-gray-400 text-xs uppercase tracking-wider mb-1">Album</p>
                        <p class="text-white font-bold truncate" x-text="$store.player.currentTrack?.album?.title"></p>
                        <p class="text-gray-400 text-sm" x-text="$store.player.currentTrack?.album?.release_year"></p>
                    </div>
                    <a :href="`/albums/${$store.player.currentTrack?.album?.slug}`"
                       class="flex-shrink-0 px-4 py-2 bg-white/10 hover:bg-white/20 rounded-full text-white text-sm font-semibold transition">
                        Open
                    </a>
                </div>

                
                <div class="flex gap-3">
                    <button @click="window.dispatchEvent(new CustomEvent('show-add-to-playlist-modal', { detail: { trackId: $store.player.currentTrack?.id } }))"
                            class="flex-1 py-3 bg-white/10 hover:bg-white/20 rounded-2xl text-white text-sm font-semibold transition flex items-center justify-center gap-2">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                        </svg>
                        Add to playlist
                    </button>
                    <button @click="window.shareTrack($store.player.currentTrack)"
                            class="flex-1 py-3 bg-white/10 hover:bg-white/20 rounded-2xl text-white text-sm font-semibold transition flex items-center justify-center gap-2">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/>
                        </svg>
                        Share
                    </button>
                </div>
            </div>

        </div>
    </div>

    
    <div x-show="sheetOpen" x-cloak x-transition.opacity class="fixed inset-0 z-[140] bg-black/70" @click="sheetOpen = false"></div>
    <div x-show="sheetOpen" x-cloak x-transition:enter="transition ease-out duration-200" x-transition:enter-start="translate-y-full" x-transition:enter-end="translate-y-0"
         class="fixed inset-x-0 bottom-0 z-[150] mx-auto max-w-lg rounded-t-3xl bg-gray-900 border-t border-white/10 pb-[calc(1rem+env(safe-area-inset-bottom))] shadow-2xl"
         role="dialog" aria-label="Song options" @keydown.escape.window="sheetOpen = false">
        <div class="flex items-center gap-3 p-4 border-b border-white/10">
            <img :src="$store.player.currentTrack?.cover_art_url || '/images/default-cover.jpg'" alt="" class="w-12 h-12 rounded-lg object-cover">
            <div class="min-w-0"><p class="font-semibold text-white truncate" x-text="$store.player.currentTrack?.title"></p>
                <p class="text-xs text-gray-400 truncate" x-text="$store.player.currentTrack?.artist?.stage_name || $store.player.currentTrack?.artist_name || ''"></p></div>
        </div>
        <div class="py-2 text-white text-sm">
            <button type="button" class="vp-sheet-item" @click="$store.player.toggleLike($store.player.currentTrack?.id); sheetOpen = false">
                <span x-text="$store.player.isLiked ? 'Remove from Liked Songs' : 'Add to Liked Songs'"></span></button>
            <button type="button" class="vp-sheet-item" @click="hideSong()">Hide song</button>
            <button type="button" class="vp-sheet-item" @click="sheetOpen = false; window.shareTrack ? window.shareTrack($store.player.currentTrack) : window.vpShare?.($store.player.currentTrack?.title, '/track/' + ($store.player.currentTrack?.slug || $store.player.currentTrack?.id))">Share</button>
            <button type="button" class="vp-sheet-item" @click="sheetOpen = false; window.dispatchEvent(new CustomEvent('show-add-to-playlist-modal', { detail: { trackId: $store.player.currentTrack?.id } }))">Add to playlist</button>
            <button type="button" class="vp-sheet-item" @click="addCurrentToQueue()">Add to queue</button>
            <button type="button" class="vp-sheet-item" @click="startSongRadio()">Go to song radio</button>
            <a class="vp-sheet-item block" x-show="$store.player.currentTrack?.artist?.slug" :href="`/artist/${$store.player.currentTrack?.artist?.slug}`" @click="sheetOpen = false; expandedPlayer = false">Go to artist</a>
            <div class="px-5 pt-3 pb-1">
                <p class="text-xs uppercase tracking-widest text-gray-400 font-semibold">Sleep timer <span class="normal-case tracking-normal text-orange-300" x-show="sleepLabel" x-text="'· ' + sleepLabel"></span></p>
                <div class="mt-2 flex flex-wrap gap-2">
                    <template x-for="m in [5, 15, 30, 45, 60]" :key="m">
                        <button type="button" @click="setSleep(m)" class="px-3 py-1 rounded-full bg-white/10 hover:bg-white/20 text-xs font-semibold" x-text="m + ' min'"></button>
                    </template>
                    <button type="button" @click="setSleep('end')" class="px-3 py-1 rounded-full bg-white/10 hover:bg-white/20 text-xs font-semibold">End of song</button>
                    <button type="button" x-show="sleepLabel" @click="setSleep(null)" class="px-3 py-1 rounded-full bg-red-500/20 text-red-300 text-xs font-semibold">Turn off</button>
                </div>
            </div>
        </div>
    </div>

    
    <div x-show="queueOpen" x-transition class="fixed inset-0 bg-black/80 z-60" @click="queueOpen = false"></div>
    <div x-show="queueOpen" x-transition:enter="transition ease-out duration-300" x-transition:enter-start="translate-x-full" x-transition:enter-end="translate-x-0" class="fixed right-0 top-0 h-full w-full max-w-md bg-gray-950/95 backdrop-blur-xl border-l border-white/10 shadow-2xl z-70 flex flex-col">
        <div class="p-6 border-b border-white/10 flex items-center justify-between">
            <h3 class="text-xl font-bold text-white">Queue</h3>
            <button @click="queueOpen = false" class="text-gray-400 hover:text-white transition p-2">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
                </svg>
            </button>
        </div>
        <div class="flex-1 overflow-y-auto p-4 space-y-2">
            <p x-show="radioSeed" class="px-1 pb-1 text-xs text-orange-300">Song radio is on — similar songs keep coming.</p>
            <template x-for="(track, index) in $store.player.queue" :key="track.id + ':' + index">
                <div
                    class="flex items-center gap-3 p-3 rounded-lg hover:bg-white/5 transition cursor-pointer"
                    :class="[index === $store.player.currentIndex ? 'bg-white/10 ring-2 ring-purple-500' : '', dragOver === index ? 'border-t-2 border-orange-400' : '']"
                    :draggable="index !== $store.player.currentIndex"
                    @dragstart="dragFrom = index; $event.dataTransfer.effectAllowed = 'move'"
                    @dragover.prevent="dragOver = index"
                    @dragleave="dragOver = null"
                    @drop.prevent="moveQueue(dragFrom, index)"
                    @dragend="dragFrom = null; dragOver = null"
                    @click="playQueueTrack(track, index)"
                >
                    <span x-show="index !== $store.player.currentIndex" class="text-gray-600 cursor-grab hidden sm:block" aria-hidden="true">⋮⋮</span>
                    <div class="relative flex-shrink-0">
                        <img :src="track.cover_art_url || '/images/default-cover.jpg'" class="w-12 h-12 rounded object-cover">
                        <div x-show="index === $store.player.currentIndex && $store.player.isPlaying"
                             class="absolute inset-0 bg-black/50 rounded flex items-center justify-center">
                            <svg class="w-4 h-4 text-purple-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24">
                                <path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>
                            </svg>
                        </div>
                    </div>
                    <div class="flex-1 min-w-0">
                        <p class="text-white font-medium truncate" x-text="track.title"
                           :class="index === $store.player.currentIndex ? 'text-purple-300' : ''"></p>
                        <p class="text-gray-400 text-sm truncate" x-text="track.artist?.stage_name || 'Unknown'"></p>
                    </div>
                    <div class="flex items-center gap-2 flex-shrink-0">
                        <span x-show="track.audio_format && track.audio_format !== 'mp3'"
                              class="text-[10px] text-gray-500 bg-gray-800 px-1.5 py-0.5 rounded uppercase"
                              x-text="track.audio_format"></span>
                        <span class="text-gray-400 text-sm" x-text="$store.player.formatTime(track.duration || 0)"></span>
                        <button type="button" x-show="index !== $store.player.currentIndex" @click.stop="moveQueue(index, index - 1)" :disabled="index <= 0" class="p-1 text-gray-500 hover:text-white" aria-label="Move up">▲</button>
                        <button type="button" x-show="index !== $store.player.currentIndex" @click.stop="removeFromQueue(index)" class="p-1 text-gray-500 hover:text-white" aria-label="Remove from queue">✕</button>
                    </div>
                </div>
            </template>
            <div x-show="$store.player.queue.length === 0" class="text-center py-12 text-gray-500">
                Queue is empty
            </div>
        </div>
    </div>
</div>

<script>
function playerBarComponent() {
    return {
        queueOpen: false,
        expandedPlayer: false,
        expandedTab: 'player',
        // Now playing view (webplus): canvas, full-screen lyrics, context sheet, song radio, sleep timer, queue reorder.
        sheetOpen: false,
        lyricsFull: false,
        canvas: null,
        _canvasFor: null,
        radioSeed: null,
        _radioBusy: false,
        sleepAt: null,
        sleepEnd: false,
        sleepLabel: '',
        _sleepTimer: null,
        dragFrom: null,
        dragOver: null,
        _lastStation: null,

        init() {
            const onUpdate = () => {
                const p = this.$store.player, t = p.currentTrack;
                // Canvas: the song's music video, fetched once per song while the full player is open.
                if (this.expandedPlayer && t && !t.is_radio && t.id !== this._canvasFor) {
                    this._canvasFor = t.id; this.canvas = null;
                    fetch(`/api/tracks/${t.id}/canvas`, { headers: { Accept: 'application/json' }, credentials: 'same-origin' })
                        .then(r => r.ok ? r.json() : null).then(d => { if (this._canvasFor === t.id) this.canvas = d?.canvas || null; }).catch(() => {});
                }
                // Radio stations: remember the last one for "Continue listening".
                const sid = t?.is_radio ? (t.station_id || Number(String(t.id || '').replace('radio-', ''))) : null;
                if (sid && sid !== this._lastStation && document.querySelector('meta[name="user-id"]')) {
                    this._lastStation = sid;
                    window.vpReq?.('/api/me/progress', 'POST', { media_type: 'station', media_id: sid }).catch(() => {});
                }
                // Song radio: top up the queue when two songs are left.
                if (this.radioSeed && p.queue.length - p.currentIndex <= 2) this.extendRadio();
                // Sleep timer "end of song".
                if (this.sleepEnd && p.duration && p.currentTime >= p.duration - 1.2) { this.sleepEnd = false; this.sleepLabel = ''; p.togglePlay(); }
            };
            window.addEventListener('player-updated', onUpdate);
            this.$watch('expandedPlayer', (v) => { if (v) onUpdate(); else this.lyricsFull = false; });
        },

        async hideSong() {
            const t = this.$store.player.currentTrack; this.sheetOpen = false;
            if (!t?.id) return;
            try { await window.vpReq('/api/recommendations/feedback', 'POST', { type: 'track', id: t.id, action: 'not_interested', context: 'player' }); window.toast?.('Hidden — we won’t play it in your recommendations', 'success'); }
            catch (e) { if (e.status === 401) { window.toast?.('Log in to hide songs', 'warning'); return; } }
            this.$store.player.nextTrack();
        },

        addCurrentToQueue() {
            const p = this.$store.player; this.sheetOpen = false;
            if (p.currentTrack) { p.queue.push({ ...p.currentTrack }); window.toast?.('Added to queue', 'success'); }
        },

        async startSongRadio() {
            const p = this.$store.player, t = p.currentTrack; this.sheetOpen = false;
            if (!t?.id) return;
            try {
                const d = await (await fetch(`/api/tracks/${t.id}/song-radio?limit=25&exclude=${t.id}`, { headers: { Accept: 'application/json' }, credentials: 'same-origin' })).json();
                if (!d.tracks?.length) { window.toast?.('No similar songs yet', 'warning'); return; }
                p.queue = p.queue.slice(0, p.currentIndex + 1).concat(d.tracks);
                this.radioSeed = t.id;
                window.toast?.('Song radio: ' + t.title, 'success');
                this.queueOpen = true; this.expandedPlayer = false;
            } catch (_) { window.toast?.('Could not start song radio', 'error'); }
        },

        async extendRadio() {
            if (this._radioBusy || !this.radioSeed) return;
            this._radioBusy = true;
            const p = this.$store.player;
            const seed = p.currentTrack?.id && !p.currentTrack.is_radio ? p.currentTrack.id : this.radioSeed;
            const exclude = p.queue.map(q => q.id).filter(Number.isInteger).slice(-300).join(',');
            try {
                const d = await (await fetch(`/api/tracks/${seed}/song-radio?limit=20&exclude=${exclude}`, { headers: { Accept: 'application/json' }, credentials: 'same-origin' })).json();
                if (d.tracks?.length) p.queue.push(...d.tracks); else this.radioSeed = null;
            } catch (_) {}
            this._radioBusy = false;
        },

        setSleep(m) {
            clearTimeout(this._sleepTimer); this.sleepEnd = false; this.sleepLabel = ''; this.sheetOpen = false;
            if (m === null) { window.toast?.('Sleep timer off', 'info'); return; }
            if (m === 'end') { this.sleepEnd = true; this.sleepLabel = 'end of song'; window.toast?.('Stops at the end of this song', 'success'); return; }
            const until = new Date(Date.now() + m * 60000);
            this.sleepLabel = 'until ' + until.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
            this._sleepTimer = setTimeout(() => { const p = this.$store.player; if (p.isPlaying) p.togglePlay(); this.sleepLabel = ''; }, m * 60000);
            window.toast?.('Sleep timer: ' + m + ' min', 'success');
        },

        moveQueue(from, to) {
            const p = this.$store.player;
            this.dragOver = null;
            if (from === null || to === null || from === to || to < 0 || from === p.currentIndex) return;
            const cur = p.queue[p.currentIndex];
            const q = [...p.queue]; const [item] = q.splice(from, 1); q.splice(to, 0, item);
            p.queue = q; p.currentIndex = q.indexOf(cur);
            p._saveState?.();
        },

        removeFromQueue(i) {
            const p = this.$store.player;
            if (i === p.currentIndex) return;
            const cur = p.queue[p.currentIndex];
            p.queue = p.queue.filter((_, k) => k !== i); p.currentIndex = p.queue.indexOf(cur);
        },

        get progressPercent() {
            const dur = this.$store.player.duration || 0;
            const cur = this.$store.player.currentTime || 0;
            return dur > 0 ? Math.min(100, (cur / dur) * 100) : 0;
        },

        formatTime(seconds) {
            if (!seconds || seconds < 0) return '0:00';
            const mins = Math.floor(seconds / 60);
            const secs = Math.floor(seconds % 60);
            return `${mins}:${secs.toString().padStart(2, '0')}`;
        },

        get currentTimeFormatted() {
            return this.formatTime(this.$store.player.currentTime || 0);
        },

        get durationFormatted() {
            return this.formatTime(this.$store.player.duration || 0);
        },

        seekBar(event) {
            if (this.$store.player.currentTrack?.is_radio) return;
            const dur = this.$store.player.duration;
            if (!dur) return;
            const rect = event.currentTarget.getBoundingClientRect();
            const pointerX = event.touches?.[0]?.clientX ?? event.clientX;
            if (typeof pointerX !== 'number') return;
            const x = pointerX - rect.left;
            const percent = Math.max(0, Math.min(1, x / rect.width));
            this.$store.player.seekTo(percent * dur);
        },

        toggleQueue() {
            this.queueOpen = !this.queueOpen;
            if (this.queueOpen) this.expandedPlayer = false;
        },

        playQueueTrack(track, index) {
            const player = window.Alpine?.store('player');
            if (player?.play) {
                player.currentIndex = index;
                player.play(track);
                this.queueOpen = false;
            }
        }
    };
}

// Lyrics component for the expanded player info tab
function expandedLyrics() {
    return {
        timedLines: [],
        plainLyrics: null,
        loading: false,
        activeLine: -1,
        _rafId: null,
        _trackId: null,

        init() {
            this.loadLyrics();
            const sync = () => {
                const audio = window.Alpine?.store('player')?.getAudio?.();
                if (audio && this.timedLines.length) {
                    const t = audio.currentTime || 0;
                    const i = this.timedLines.findIndex((l, idx) =>
                        t >= l.time && (!this.timedLines[idx + 1] || t < this.timedLines[idx + 1].time)
                    );
                    if (i !== this.activeLine) this.activeLine = i;
                }
                this._rafId = requestAnimationFrame(sync);
            };
            this._rafId = requestAnimationFrame(sync);
        },

        destroy() {
            if (this._rafId) cancelAnimationFrame(this._rafId);
        },

        loadLyrics() {
            const track = window.Alpine?.store('player')?.currentTrack;
            if (!track?.id || track.id === this._trackId) return;
            this._trackId = track.id;
            this.timedLines = [];
            this.plainLyrics = null;
            this.activeLine = -1;

            if (track.lyrics_timestamps?.length) {
                this.timedLines = track.lyrics_timestamps;
                return;
            }
            if (track.lyrics) {
                this.plainLyrics = track.lyrics;
                return;
            }

            this.loading = true;
            fetch(`/api/tracks/${track.id}/lyrics`, { credentials: 'include' })
                .then(r => r.json())
                .then(d => {
                    if (this._trackId !== track.id) return; // a newer song started meanwhile
                    if (d.timed_lyrics?.length) {
                        this.timedLines = d.timed_lyrics;
                    } else if (d.text) {
                        this.plainLyrics = d.text;
                    }
                })
                .catch(() => {})
                .finally(() => { this.loading = false; });
        }
    };
}
</script>

<style>
.vp-sheet-item { display: block; width: 100%; text-align: left; padding: 0.7rem 1.25rem; }
.vp-sheet-item:hover { background: rgba(255,255,255,0.08); }
.pb-safe { padding-bottom: env(safe-area-inset-bottom); }
input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
</style>
        <style>
    html.vp-video-playing [x-data^="playerBarComponent"] { display: none !important; }
    #vp-video-dock video { width: 100%; height: 100%; object-fit: contain; background: #000; position: static; }
</style>
<div id="vp-video-dock" x-data="vpVideoDock()" x-show="open" x-cloak x-transition.opacity
     class="fixed z-[65] right-3 bottom-20 md:right-6 md:bottom-6 rounded-2xl overflow-hidden bg-black shadow-2xl ring-1 ring-white/10"
     :class="vertical ? 'w-40 sm:w-48' : 'w-72 sm:w-80'" role="region" aria-label="Mini player">
    <div class="relative group" :class="vertical ? 'aspect-[9/16]' : 'aspect-video'">
        <div id="vp-dock-slot" x-ignore class="absolute inset-0"></div>
        <button type="button" @click="expand()" class="absolute inset-0 w-full h-full" :aria-label="'Open ' + title"></button>
        <div class="absolute inset-x-0 top-0 flex justify-end gap-1 p-1.5 bg-gradient-to-b from-black/70 to-transparent opacity-100 md:opacity-0 md:group-hover:opacity-100 focus-within:opacity-100 transition">
            <button type="button" @click.stop="expand()" class="p-1.5 rounded-full bg-black/50 hover:bg-black/80" aria-label="Back to the video">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M4 8V4h4M20 8V4h-4M4 16v4h4M20 16v4h-4"/></svg>
            </button>
            <button type="button" @click.stop="close()" class="p-1.5 rounded-full bg-black/50 hover:bg-black/80" aria-label="Close mini player">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" d="M6 18L18 6M6 6l12 12"/></svg>
            </button>
        </div>
        <button type="button" @click.stop="toggle()" class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/60 hover:bg-orange-500 flex items-center justify-center transition"
                :class="paused ? 'opacity-100' : 'opacity-100 md:opacity-0 md:group-hover:opacity-100'" :aria-label="paused ? 'Play' : 'Pause'">
            <svg x-show="paused" class="w-5 h-5 ml-0.5" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
            <svg x-show="!paused" class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M6 4h4v16H6zM14 4h4v16h-4z"/></svg>
        </button>
        <div class="absolute inset-x-0 bottom-0 h-1 bg-white/20"><div class="h-full bg-orange-500" :style="`width:${pct}%`"></div></div>
    </div>
    <div class="px-3 py-2 min-w-0" x-show="!vertical">
        <p class="text-xs font-semibold truncate" x-text="title"></p>
        <p class="text-[11px] text-gray-400 truncate" x-text="channel"></p>
    </div>
</div>
<script>
window.vpVideoDock = window.vpVideoDock || function () {
    return {
        open: false, vertical: false, title: '', channel: '', url: '', id: null, paused: false, pct: 0, v: null, offs: [],
        init() {
            window.vpDock = {
                adopt: (v, meta) => this.adopt(v, meta),
                closeFor: (id) => { if (this.open && this.id === id) this.release(true); },
                close: () => this.close(),
            };
        },
        adopt(v, meta) {
            this.release(false);
            Object.assign(this, { vertical: !!meta.vertical, title: meta.title || '', channel: meta.channel || '', url: meta.url, id: meta.id, open: true, v });
            const wasPlaying = !v.paused;
            // Moving a playing element within the page keeps it playing (and keeps picture-in-picture).
            document.getElementById('vp-dock-slot').appendChild(v);
            v.removeAttribute('class');
            if (wasPlaying && v.paused) v.play().catch(() => {});
            const on = (ev, fn) => { v.addEventListener(ev, fn); this.offs.push(() => v.removeEventListener(ev, fn)); };
            const sync = () => { this.paused = v.paused; this.pct = v.duration ? v.currentTime / v.duration * 100 : 0; };
            on('timeupdate', sync); on('play', sync); on('pause', sync); on('ended', () => { this.paused = true; });
            sync();
        },
        toggle() { if (!this.v) return; this.v.paused ? this.v.play().catch(() => {}) : this.v.pause(); },
        expand() {
            if (!this.v) return;
            const t = Math.floor(this.v.currentTime || 0);
            this.v.dataset.vpHandoff = '1';
            const url = this.url + (this.url.includes('?') ? '&' : '?') + 't=' + t;
            window.softNavigate ? window.softNavigate(url) : (location.href = url);
        },
        close() { this.release(true); },
        /** Removes the docked video. `stop`: it is closed for good (the music comes back). */
        release(stop) {
            const v = this.v;
            this.offs.forEach((f) => f()); this.offs = [];
            this.open = false; this.v = null;
            if (!v) return;
            if (document.pictureInPictureElement === v) document.exitPictureInPicture().catch(() => {});
            const handoff = !!v.dataset.vpHandoff;
            try { v.pause(); } catch (e) {}
            v.remove();
            v.removeAttribute('src'); try { v.load(); } catch (e) {}
            const store = window.Alpine?.store('player');
            if (store?._videoStopped) store._videoStopped(v, stop && !handoff);
            else if (stop && !handoff) store?.videoClosed?.();
        },
    };
};
</script>
        <div
    x-data="addToPlaylistModal()"
    x-show="open"
    x-cloak
    x-on:show-add-to-playlist-modal.window="openModal($event.detail.trackId)"
    @keydown.escape.window="close()"
    class="fixed inset-0 z-[9999] flex items-center justify-center p-4"
>
    
    <div class="absolute inset-0 bg-black/70 backdrop-blur-sm" @click="close()"></div>

    
    <div class="relative bg-gray-900 border border-white/10 rounded-2xl shadow-2xl w-full max-w-sm p-6 z-10">
        <h3 class="text-white font-bold text-lg mb-4">Add to playlist</h3>

        
        <div x-show="loading" class="text-center py-8">
            <svg class="animate-spin w-8 h-8 text-purple-500 mx-auto" fill="none" viewBox="0 0 24 24">
                <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/>
                <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.4 0 0 5.4 0 12h4z"/>
            </svg>
        </div>

        
        <div x-show="!loading" class="space-y-2 max-h-64 overflow-y-auto">
            <template x-for="pl in playlists" :key="pl.id">
                <button
                    @click="addToPlaylist(pl.id)"
                    class="w-full flex items-center gap-3 p-3 rounded-xl hover:bg-white/10 transition text-left"
                    :class="added[pl.id] ? 'ring-2 ring-green-500' : ''"
                >
                    <div class="w-10 h-10 rounded-lg bg-gray-800 overflow-hidden flex-shrink-0">
                        <img x-show="pl.cover_image_url || pl.cover_url" :src="pl.cover_image_url || pl.cover_url" class="w-full h-full object-cover">
                        <div x-show="!pl.cover_image_url && !pl.cover_url" class="w-full h-full flex items-center justify-center text-gray-500">
                            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
                                <path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/>
                            </svg>
                        </div>
                    </div>
                    <div class="flex-1 min-w-0">
                        <p class="text-white font-medium text-sm truncate" x-text="pl.title || pl.name"></p>
                        <p class="text-gray-400 text-xs" x-text="(pl.tracks_count ?? pl.total_tracks ?? 0) + ' songs'"></p>
                    </div>
                    <svg x-show="added[pl.id]" class="w-5 h-5 text-green-400 flex-shrink-0" fill="currentColor" viewBox="0 0 24 24">
                        <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/>
                    </svg>
                </button>
            </template>

            <div x-show="playlists.length === 0 && !loading" class="text-center text-gray-500 py-6 text-sm">
                You don't have any playlists yet.
            </div>
        </div>

        
        <div class="mt-4 pt-4 border-t border-white/10">
            
            <form x-show="naming" x-cloak @submit.prevent="createNew()" class="flex gap-2">
                <input x-ref="newName" x-model="newName" maxlength="200" required placeholder="Playlist name"
                       class="flex-1 min-w-0 px-3 py-2.5 rounded-xl bg-white/10 border border-white/10 text-sm text-white focus:outline-none focus:border-purple-400">
                <button type="submit" :disabled="!newName.trim() || creating" class="px-4 py-2.5 rounded-xl bg-purple-600 hover:bg-purple-500 text-sm font-semibold text-white disabled:opacity-40"
                        x-text="creating ? 'Creating…' : 'Create'">Create</button>
            </form>
            <button x-show="!naming"
                @click="naming = true; $nextTick(() => $refs.newName.focus())"
                class="w-full flex items-center gap-3 p-3 rounded-xl hover:bg-white/10 transition text-left text-purple-400 hover:text-purple-300"
            >
                <div class="w-10 h-10 rounded-lg bg-purple-500/20 flex items-center justify-center flex-shrink-0">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
                    </svg>
                </div>
                <span class="font-medium text-sm">New playlist</span>
            </button>
        </div>

        <button @click="close()" class="absolute top-4 right-4 text-gray-500 hover:text-white transition">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
            </svg>
        </button>
    </div>
</div>


<div
    x-data="trackContextMenu()"
    x-show="open"
    x-cloak
    x-transition:enter="transition ease-out duration-150"
    x-transition:enter-start="opacity-0 scale-95 -translate-y-1"
    x-transition:enter-end="opacity-100 scale-100 translate-y-0"
    x-transition:leave="transition ease-in duration-100"
    x-transition:leave-start="opacity-100 scale-100 translate-y-0"
    x-transition:leave-end="opacity-0 scale-95 -translate-y-1"
    x-on:show-track-menu.window="openMenu($event)"
    @click.outside="close()"
    @keydown.escape.window="close()"
    class="fixed z-[9998] media-menu w-64"
    :style="`top:${y}px; left:${x}px`"
>
    <button @click="action('play')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        Play now
    </button>
    <button @click="action('queue')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/></svg>
        Add to queue
    </button>
    <button @click="action('next')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></svg>
        Play next
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button @click="action('like')" class="menu-item" :class="liked ? 'text-pink-400' : ''">
        <svg class="w-4 h-4 flex-shrink-0" :fill="liked ? 'currentColor' : 'none'" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/></svg>
        <span x-text="liked ? 'Remove from Liked songs' : 'Save to Liked songs'">Save to Liked songs</span>
    </button>
    <button @click="action('playlist')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
        Add to playlist
    </button>
    <button @click="action('album')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2z"/></svg>
        Go to album
    </button>
    <button @click="action('artist')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
        Go to artist
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button @click="action('share')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg>
        Share
    </button>
    <button @click="action('copylink')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/></svg>
        Copy link
    </button>
    <button @click="action('report')" class="menu-item text-red-400">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 21v-4m0 0V5a2 2 0 012-2h6.5l1 1H21l-3 6 3 6h-8.5l-1-1H5a2 2 0 00-2 2zm9-13.5V9"/></svg>
        Report
    </button>
</div>


<div
    x-data="artistContextMenu()"
    x-show="open"
    x-cloak
    x-transition:enter="transition ease-out duration-150"
    x-transition:enter-start="opacity-0 scale-95 -translate-y-1"
    x-transition:enter-end="opacity-100 scale-100 translate-y-0"
    x-transition:leave="transition ease-in duration-100"
    x-transition:leave-start="opacity-100 scale-100 translate-y-0"
    x-transition:leave-end="opacity-0 scale-95 -translate-y-1"
    x-on:show-artist-menu.window="openMenu($event)"
    @click.outside="close()"
    @keydown.escape.window="close()"
    class="fixed z-[9998] media-menu w-64"
    :style="`top:${y}px; left:${x}px`"
>
    <button @click="action('play')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        Play top tracks
    </button>
    <button @click="action('shuffle')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h5l2 3m9 13h-5l-2-3M4 20l6-6m0 0l4-4m2-2l4-4m0 0v5m0-5h-5"/></svg>
        Shuffle play
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button @click="action('follow')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0"/></svg>
        <span x-text="following ? 'Unfollow artist' : 'Follow artist'">Follow artist</span>
    </button>
    <button @click="action('share')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684l6.632 3.316m-6.632-6l6.632-3.316"/></svg>
        Share artist
    </button>
    <button @click="action('open')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 3h7m0 0v7m0-7L10 14"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5h6v2H7v10h10v-4h2v6H5V5z"/></svg>
        Open artist page
    </button>
</div>


<div
    x-data="videoContextMenu()"
    x-show="open"
    x-cloak
    x-transition:enter="transition ease-out duration-150"
    x-transition:enter-start="opacity-0 scale-95 -translate-y-1"
    x-transition:enter-end="opacity-100 scale-100 translate-y-0"
    x-transition:leave="transition ease-in duration-100"
    x-transition:leave-start="opacity-100 scale-100 translate-y-0"
    x-transition:leave-end="opacity-0 scale-95 -translate-y-1"
    x-on:show-video-menu.window="openMenu($event)"
    @click.outside="close()"
    @keydown.escape.window="close()"
    class="fixed z-[9998] media-menu w-64"
    :style="`top:${y}px; left:${x}px`"
>
    <button @click="action('open')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        Open video
    </button>
    <button @click="action('watchLater')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3"/><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
        Save to Watch later
    </button>
    <button @click="action('playlist')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h12M4 12h12M4 18h8M18 9v6m3-3h-6"/></svg>
        Add to playlist
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button @click="action('share')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684l6.632 3.316m-6.632-6l6.632-3.316"/></svg>
        Share video
    </button>
    <button @click="action('copylink')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/></svg>
        Copy video link
    </button>
</div>


<div
    x-data="albumContextMenu()"
    x-show="open"
    x-cloak
    x-transition.opacity.duration.120ms
    x-on:show-album-menu.window="openMenu($event)"
    @click.outside="close()"
    @keydown.escape.window="close()"
    class="fixed z-[9998] media-menu w-64"
    :style="`top:${y}px; left:${x}px`"
>
    <button @click="action('play')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        Play album
    </button>
    <button @click="action('shuffle')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h5l2 3m9 13h-5l-2-3M4 20l6-6m0 0l4-4m2-2l4-4m0 0v5m0-5h-5"/></svg>
        Shuffle play
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button @click="action('save')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"/></svg>
        <span x-text="saved ? 'Remove from library' : 'Save to library'">Save to library</span>
    </button>
    <button @click="action('open')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2z"/></svg>
        Open album
    </button>
    <button x-show="artistSlug" @click="action('artist')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
        Go to artist
    </button>
    <button @click="action('share')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684l6.632 3.316m-6.632-6l6.632-3.316"/></svg>
        Share album
    </button>
</div>


<div
    x-data="playlistContextMenu()"
    x-show="open"
    x-cloak
    x-transition.opacity.duration.120ms
    x-on:show-playlist-menu.window="openMenu($event)"
    @click.outside="close()"
    @keydown.escape.window="close()"
    class="fixed z-[9998] media-menu w-64"
    :style="`top:${y}px; left:${x}px`"
>
    <button @click="action('play')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0 fill-current" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
        Play playlist
    </button>
    <button @click="action('shuffle')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h5l2 3m9 13h-5l-2-3M4 20l6-6m0 0l4-4m2-2l4-4m0 0v5m0-5h-5"/></svg>
        Shuffle play
    </button>
    <div class="border-t border-white/10 my-1"></div>
    <button x-show="!owner" @click="action('save')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"/></svg>
        Save to / remove from library
    </button>
    <button @click="action('open')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/></svg>
        <span x-text="owner ? 'Open and edit' : 'Open playlist'">Open playlist</span>
    </button>
    <button @click="action('share')" class="menu-item">
        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684l6.632 3.316m-6.632-6l6.632-3.316"/></svg>
        Share playlist
    </button>
</div>

<style>
.media-menu { background: rgba(17, 24, 39, .98); backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.1); border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.6); padding: .625rem 0; }
.menu-item { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .625rem 1rem; font-size: .875rem; font-weight: 500; color: #e5e7eb; text-align: left; transition: background-color .15s, color .15s; }
.menu-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-item svg { color: #9ca3af; }
.menu-item:hover svg { color: #fff; }
.menu-item.text-red-400 { color: #f87171; }
</style>

<script>
// ─── Add to Playlist Modal ─────────────────────────────────────────────────
function addToPlaylistModal() {
    return {
        open: false,
        loading: false,
        trackId: null,
        playlists: [],
        added: {},
        naming: false,
        newName: '',
        creating: false,

        openModal(trackId) {
            this.trackId = trackId;
            this.added   = {};
            this.naming  = false;
            this.newName = '';
            this.open    = true;
            this.fetchPlaylists();
        },

        close() { this.open = false; },

        async fetchPlaylists() {
            this.loading = true;
            const { ok, data } = await window.vpApi('/api/playlists/my');
            this.playlists = ok ? (data.playlists || []) : [];
            this.loading = false;
            if (!ok) this.close();
        },

        async addToPlaylist(playlistId) {
            const { ok, data } = await window.vpApi(`/api/playlists/${playlistId}/tracks`, { method: 'POST', body: { track_id: this.trackId } });
            if (ok) {
                this.added[playlistId] = true;
                window.toast?.(data.message || 'Added to playlist', 'success');
            }
        },

        async createNew() {
            const name = this.newName.trim();
            if (!name || this.creating) return;
            this.creating = true;
            const { ok, data } = await window.vpApi('/api/playlists', { method: 'POST', body: { title: name, track_ids: this.trackId ? [this.trackId] : [] } });
            this.creating = false;
            if (!ok || !data.playlist) return;
            this.naming = false;
            this.newName = '';
            this.playlists.unshift(data.playlist);
            if (this.trackId) this.added[data.playlist.id] = true;
            window.toast?.('Playlist created', 'success');
        },
    };
}

// ─── Track Context Menu ────────────────────────────────────────────────────
function trackContextMenu() {
    return {
        open: false,
        trackId: null,
        track: null,
        liked: false,
        x: 0, y: 0,

        openMenu(event) {
            this.trackId = event.detail.trackId;
            this.track   = event.detail.track || null;
            const known = window.vpIsLiked?.(this.trackId);
            this.liked = known === true;
            if (known === undefined && window.vpSignedIn?.() && this.trackId) {
                const id = this.trackId;
                window.vpApi(`/api/web/likes/tracks?ids=${id}`, { quietAuth: true }).then(({ ok, data }) => {
                    if (!ok) return;
                    const v = (data.liked || []).map(Number).includes(Number(id));
                    window.vpLiked?.set(Number(id), v);
                    if (this.trackId === id) this.liked = v;
                });
            }

            // Position near cursor but keep inside viewport
            const vw = window.innerWidth, vh = window.innerHeight;
            const mx = event.detail.x ?? event.clientX ?? vw / 2;
            const my = event.detail.y ?? event.clientY ?? vh / 2;
            this.x = Math.min(mx, vw - 240);
            this.y = Math.min(my, vh - 320);
            this.open = true;
        },

        close() { this.open = false; },

        action(type) {
            this.close();
            const player = window.Alpine?.store('player');
            switch (type) {
                case 'play':
                    if (this.track) window.playTrack(this.track);
                    break;
                case 'queue':
                    if (player && this.track) {
                        player.queue.push(this.track);
                        window.toast?.('Added to queue', 'success');
                    }
                    break;
                case 'next':
                    if (player && this.track) {
                        player.queue.splice(player.currentIndex + 1, 0, this.track);
                        window.toast?.('Will play next', 'success');
                    }
                    break;
                case 'like':
                    if (this.trackId) window.toggleLike(this.trackId, !this.liked);
                    break;
                case 'playlist':
                    window.dispatchEvent(new CustomEvent('show-add-to-playlist-modal', {
                        detail: { trackId: this.trackId }
                    }));
                    break;
                case 'share':
                    window.vpShare(this.track?.title || 'Song', this.track?.slug ? `/tracks/${this.track.slug}` : `/track/${this.trackId}`);
                    break;
                case 'copylink':
                    navigator.clipboard?.writeText(window.location.origin + (this.track?.slug ? `/tracks/${this.track.slug}` : `/track/${this.trackId}`));
                    window.toast?.('Link copied!', 'success');
                    break;
                case 'album': {
                    const a = this.track?.album;
                    if (a?.slug || a?.id) window.location.href = `/albums/${a.slug || a.id}`;
                    else window.toast?.('This song is a single', 'info');
                    break;
                }
                case 'artist': {
                    const ar = this.track?.artist;
                    const key = ar?.slug || ar?.id || this.track?.artist_id;
                    if (key) window.location.href = `/artist/${key}`;
                    break;
                }
                case 'report':
                    window.location.href = (this.track?.slug ? `/tracks/${this.track.slug}` : `/track/${this.trackId}`) + '#report';
                    break;
            }
        },
    };
}

function artistContextMenu() {
    return {
        open: false,
        artistId: null,
        slug: null,
        following: false,
        x: 0, y: 0,
        openMenu(event) {
            this.artistId = event.detail.artistId;
            this.slug = event.detail.slug || null;
            this.following = !!event.detail.following;
            const vw = window.innerWidth, vh = window.innerHeight;
            this.x = Math.min(event.detail.x ?? vw / 2, vw - 240);
            this.y = Math.min(event.detail.y ?? vh / 2, vh - 260);
            this.open = true;
        },
        close() { this.open = false; },
        action(type) {
            this.close();
            if (!this.artistId) return;
            if (type === 'play') window.playArtist?.(this.artistId, false);
            if (type === 'shuffle') window.playArtist?.(this.artistId, true);
            if (type === 'follow') window.setArtistFollow(this.artistId, !this.following).then(r => { if (r) this.following = r.following; });
            if (type === 'open') window.location.href = `/artist/${this.slug || this.artistId}`;
            if (type === 'share') window.vpShare('Artist', `/artist/${this.slug || this.artistId}`);
        }
    };
}

function videoContextMenu() {
    return {
        open: false,
        video: null,
        x: 0, y: 0,
        openMenu(event) {
            this.video = event.detail.video || null;
            const vw = window.innerWidth, vh = window.innerHeight;
            this.x = Math.min(event.detail.x ?? vw / 2, vw - 240);
            this.y = Math.min(event.detail.y ?? vh / 2, vh - 260);
            this.open = true;
        },
        close() { this.open = false; },
        action(type) {
            this.close();
            if (!this.video) return;
            const slug = this.video.slug || this.video.id;
            const url = `${window.location.origin}/videos/${slug}`;
            if (type === 'open') window.location.href = `/videos/${slug}`;
            if (type === 'watchLater') window.videoCardActions?.toggleWatchLater(this.video.id, this.video.title);
            if (type === 'playlist') window.videoCardActions?.addToPlaylist(this.video.id);
            if (type === 'share') {
                if (navigator.share) navigator.share({ title: this.video.title, url });
                else { navigator.clipboard?.writeText(url); window.toast?.('Link copied!', 'success'); }
            }
            if (type === 'copylink') { navigator.clipboard?.writeText(url); window.toast?.('Link copied!', 'success'); }
        }
    };
}

function albumContextMenu() {
    return {
        open: false, albumId: null, slug: null, title: '', artistSlug: null, saved: false, x: 0, y: 0,
        openMenu(event) {
            const d = event.detail;
            Object.assign(this, { albumId: d.albumId, slug: d.slug || null, title: d.title || 'Album', artistSlug: d.artistSlug && d.artistSlug !== '#' ? d.artistSlug : null, saved: !!d.saved });
            this.x = Math.min(d.x ?? window.innerWidth / 2, window.innerWidth - 270);
            this.y = Math.min(d.y ?? window.innerHeight / 2, window.innerHeight - 300);
            this.open = true;
        },
        close() { this.open = false; },
        async action(type) {
            this.close();
            if (!this.albumId) return;
            if (type === 'play') window.playAlbum(this.albumId);
            if (type === 'shuffle') {
                const { ok, data } = await window.vpApi(`/api/albums/${this.albumId}/tracks`);
                const tracks = ok ? (data.tracks || data.data || []) : [];
                if (tracks.length) window.playAll([...tracks].sort(() => Math.random() - 0.5), 0);
                else if (ok) window.toast?.('No songs on this album yet', 'warning');
            }
            if (type === 'save') {
                const v = await window.setAlbumSaved(this.albumId, !this.saved);
                if (v !== null) this.saved = v;
            }
            if (type === 'open') window.location.href = `/albums/${this.slug || this.albumId}`;
            if (type === 'artist' && this.artistSlug) window.location.href = `/artist/${this.artistSlug}`;
            if (type === 'share') window.shareAlbum(this.albumId, this.slug, this.title);
        },
    };
}

function playlistContextMenu() {
    return {
        open: false, playlistId: null, title: '', owner: false, x: 0, y: 0,
        openMenu(event) {
            const d = event.detail;
            Object.assign(this, { playlistId: d.playlistId, title: d.title || 'Playlist', owner: !!d.owner });
            this.x = Math.min(d.x ?? window.innerWidth / 2, window.innerWidth - 270);
            this.y = Math.min(d.y ?? window.innerHeight / 2, window.innerHeight - 260);
            this.open = true;
        },
        close() { this.open = false; },
        action(type) {
            this.close();
            if (!this.playlistId) return;
            if (type === 'play') window.playPlaylist(this.playlistId);
            if (type === 'shuffle') window.playPlaylist(this.playlistId, true);
            if (type === 'save') window.toggleSavePlaylist(this.playlistId);
            if (type === 'open') window.location.href = `/playlist/${this.playlistId}`;
            if (type === 'share') window.sharePlaylist(this.playlistId, this.title);
        },
    };
}

// ─── Share helper  ────────────────────────────────────────────────────────
window.shareTrack = function(track) {
    const url = track.slug ? `/tracks/${track.slug}` : window.location.href;
    if (navigator.share) {
        navigator.share({ title: track.title, url: window.location.origin + url });
    } else {
        navigator.clipboard?.writeText(window.location.origin + url);
        window.toast?.('Link copied!', 'success');
    }
};
</script>
        <!-- MOBILE BOTTOM NAV: the app's tabs (Home, Search, Videos, Library, Profile) -->
        <nav id="app-bottom-nav" data-soft-swap class="fixed bottom-0 left-0 right-0 bg-black/95 backdrop-blur-xl border-t border-gray-800 md:hidden z-50 pb-safe">
            <div class="flex items-stretch h-16">
                <a href="https://vibplay.live/home" class="flex flex-col items-center justify-center gap-0.5 flex-1 h-full text-gray-400">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/></svg>
                    <span class="text-[10px] font-medium">Home</span>
                </a>
                <a href="https://vibplay.live/search" class="flex flex-col items-center justify-center gap-0.5 flex-1 h-full text-gray-400">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
                    <span class="text-[10px] font-medium">Search</span>
                </a>
                <a href="https://vibplay.live/videos" class="flex flex-col items-center justify-center gap-0.5 flex-1 h-full text-gray-400">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
                    <span class="text-[10px] font-medium">Videos</span>
                </a>
                                <a href="https://vibplay.live/login" class="flex flex-col items-center justify-center gap-0.5 flex-1 h-full text-gray-400">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"/></svg>
                    <span class="text-[10px] font-medium">Sign in</span>
                </a>
                <a href="https://vibplay.live/register" class="flex flex-col items-center justify-center gap-0.5 flex-1 h-full text-gray-400">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"/></svg>
                    <span class="text-[10px] font-medium">Join</span>
                </a>
                            </div>
        </nav>
    </div>
</div>


<script>
    // Signed-in calls from the website’s own pages (session + CSRF): vpReq(url, method, body) returns JSON or throws. (window.vpApi in media-actions.js is the older {ok, data} helper.)
    window.vpReq = async function (url, method = 'POST', body = null) {
        const r = await fetch(url, { method, credentials: 'same-origin', body: body ? JSON.stringify(body) : null, headers: {
            Accept: 'application/json', 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest',
            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '' } });
        const data = await r.json().catch(() => ({}));
        if (!r.ok) throw Object.assign(new Error(data.message || ('HTTP ' + r.status)), { status: r.status, data });
        return data;
    };
    window.playPlaylist = async function(playlistId) {
        if (!playlistId) return;
        try {
            const res = await fetch(`/api/playlists/${playlistId}/tracks`);
            if (!res.ok) throw new Error();
            const { tracks } = await res.json();
            if (!tracks?.length) return window.toast?.('Playlist is empty', 'warning');
            window.playAll(tracks, 0);
        } catch (e) {
            window.toast?.('Could not play playlist', 'error');
        }
    };
</script>


<script>
    window.addEventListener('offline', () => {
        const div = document.createElement('div');
        div.id = 'offline-indicator';
        div.className = 'fixed top-4 left-1/2 -translate-x-1/2 bg-red-600 text-white px-6 py-3 rounded-full shadow-2xl z-[100] flex items-center gap-3';
        div.innerHTML = `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636a9 9 0 010 12.728m0 0l-2.829-2.829m2.829 2.829L21 21M15.536 8.464a5 5 0 010 7.072m0 0l-2.829-2.829m-4.243 2.829a4.978 4.978 0 01-1.414-2.83m-1.414 5.658a9 9 0 01-2.167-9.238m7.824 2.167a1 1 0 111.414 1.414m-1.414-1.414L3 3m8.293 8.293l1.414 1.414"/></svg><span class="font-medium">You're offline</span>`;
        document.body.appendChild(div);
    });

    window.addEventListener('online', () => {
        document.getElementById('offline-indicator')?.remove();
    });
</script>

    <script src="https://accounts.google.com/gsi/client" defer></script>

<script>
(function () {
    const CLIENT_ID = "755426506500-6nnpu2uskctdanqsk87p7f0tskatpri9.apps.googleusercontent.com";

    window.handleGoogleOneTapResponse = window.handleGoogleOneTapResponse || function (response) {
        const form = document.createElement('form');
        form.method = 'POST';
        form.action = "https:\/\/vibplay.live\/auth\/google\/one-tap";
        const csrf = document.createElement('input');
        csrf.type = 'hidden';
        csrf.name = '_token';
        csrf.value = "m2OIPgmptSpQmrpF64wECqmNBHJuCAzZzyX2h80u";
        form.appendChild(csrf);
        const cred = document.createElement('input');
        cred.type = 'hidden';
        cred.name = 'credential';
        cred.value = response.credential;
        form.appendChild(cred);
        document.body.appendChild(form);
        form.submit();
    };

    function dismissedRecently() {
        const t = localStorage.getItem('google_one_tap_dismissed');
        if (!t) return false;
        return (Date.now() - parseInt(t, 10)) < 24 * 60 * 60 * 1000;
    }

    function tryInit() {
        if (window.__vibplayGoogleOneTapInit) return;
        if (!window.google?.accounts?.id) return;

        window.__vibplayGoogleOneTapInit = true;

        google.accounts.id.initialize({
            client_id: CLIENT_ID,
            callback: window.handleGoogleOneTapResponse,
            auto_select: false,
            cancel_on_tap_outside: false,
        });

        google.accounts.id.prompt();
    }

    window.addEventListener('load', function () {
        if (window.__vibplayGoogleOneTapSchedule) return;
        window.__vibplayGoogleOneTapSchedule = true;
        if (!CLIENT_ID || dismissedRecently()) return;

        const poll = setInterval(function () {
            if (!window.google?.accounts?.id) return;
            clearInterval(poll);
            setTimeout(tryInit, 400);
        }, 50);

        setTimeout(function () { clearInterval(poll); }, 15000);
    });
})();
</script>




</body>
</html>