@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&display=swap');

:root {
    --color-pulse: var(--color-pulse, #ff2d55);
    --color-pulse-rgb: var(--color-pulse-rgb, 255, 45, 85);
}

body {
    background-color: #020408;
    color: #f3f4f6;
    overflow-x: hidden;
    font-family: 'Outfit', sans-serif;
}

body.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* Layout overrides */
body.force-mobile-layout aside {
    display: flex !important;
    width: calc(100% - 40px) !important;
    max-width: 380px !important;
    height: 65px !important;
    top: 75px !important;
    right: 20px !important;
    left: auto !important;
    flex-direction: row !important;
    border: 1px solid rgba(var(--color-pulse-rgb), 0.3) !important;
    border-radius: 20px !important;
    background: rgba(10, 12, 18, 0.95) !important;
    backdrop-filter: blur(25px) !important;
    padding: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
}

body.force-mobile-layout aside .p-8,
body.force-mobile-layout #clockContainer {
    display: none !important;
}

body.force-mobile-layout nav {
    flex-direction: row !important;
    margin-top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    justify-content: flex-start !important;
    align-items: center !important;
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    touch-action: pan-x !important;
    overscroll-behavior-y: none !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 10px !important;
    gap: 8px !important;
}

body.force-mobile-layout .nav-btn {
    padding: 0 !important;
    width: 75px !important;
    flex: 0 0 auto !important;
    scroll-snap-align: center !important;
    flex-direction: column !important;
    gap: 6px !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

body.force-mobile-layout .nav-btn span {
    display: block !important;
    font-size: 8px !important;
    font-weight: 800 !important;
}

body.force-mobile-layout header {
    left: 0 !important;
}

body.force-mobile-layout #mainContent {
    padding-left: 0 !important;
    margin-top: 80px !important;
}

/* Force PC layout disables mobile nav */
body.force-pc-layout aside {
    width: 5rem !important;
    max-width: none !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    flex-direction: column !important;
    border-radius: 0 !important;
}

body.force-pc-layout aside:hover {
    width: 20rem !important;
}

body.force-pc-layout nav {
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body.force-pc-layout .nav-btn {
    width: 100% !important;
    flex-direction: row !important;
    padding: 1rem 1.75rem !important;
    justify-content: flex-start !important;
    height: auto !important;
}

body.force-pc-layout .nav-btn span {
    display: inline-block !important;
    font-size: 11px !important;
}

body.force-pc-layout header {
    left: 5rem !important;
}

body.force-pc-layout #mainContent {
    padding-left: 5rem !important;
    margin-top: 0 !important;
}



/* Preloader */
/* Premium Cinematic Preloader */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #020408;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--color-pulse);
    border-right-color: var(--color-pulse);
    animation: spin-smooth 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    position: relative;
    box-shadow: 0 0 30px rgba(var(--color-pulse-rgb), 0.2);
}

.loader-ring::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: #3b82f6;
    animation: spin-smooth 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite reverse;
}

.loader-text {
    margin-top: 30px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    color: white;
    animation: pulse-text 2s infinite;
}

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

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(var(--color-pulse-rgb), 0.5);
    }
}

/* Liquid Glass Typography */
.liquid-glass {
    background: none;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2),
        0 0 20px rgba(255, 255, 255, 0.1),
        0 0 40px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    line-height: 1;
    letter-spacing: -0.04em;
    pointer-events: none;
    mix-blend-mode: hard-light;
}

.background-card-number,
.background-card-number-top10 {
    font-family: 'Orbitron', 'Outfit', sans-serif;
    font-weight: 900;
    font-style: normal;
    letter-spacing: -0.05em;
    color: rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 14px rgba(var(--color-pulse-rgb), 0.1);
    transition: color 0.35s ease, text-shadow 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.background-card-number {
    font-size: clamp(70px, 6vw, 95px);
}

.background-card-number-top10 {
    font-size: clamp(110px, 8vw, 150px);
}

.group:hover .background-card-number,
.top10-card:hover .background-card-number-top10 {
    color: rgba(var(--color-pulse-rgb), 0.24);
    text-shadow: 0 0 30px rgba(var(--color-pulse-rgb), 0.45),
        0 0 20px rgba(255, 255, 255, 0.12);
    transform: translateX(1px) scale(1.02);
}

.background-card-number-top10 {
    text-shadow: 0 0 18px rgba(var(--color-pulse-rgb), 0.12);
}

.group:hover .background-card-number-top10 {
    color: rgba(var(--color-pulse-rgb), 0.26);
    text-shadow: 0 0 36px rgba(var(--color-pulse-rgb), 0.5),
        0 0 24px rgba(255, 255, 255, 0.15);
}

/* Responsive Title Scaling Logic */
.slider-title {
    font-size: var(--title-size, 5rem);
    font-weight: 800;
    text-transform: uppercase;
    transition: font-size 0.3s ease;
}

/* Components */
.sidebar-link.active {
    color: var(--color-pulse);
    background: rgba(var(--color-pulse-rgb), 0.05);
    border-right: 3px solid var(--color-pulse);
}

#pageInfoSidebar {
    transition: width 0.3s ease, background-color 0.3s ease, transform 0.25s ease;
    width: 0;
    overflow: hidden;
    background: rgba(10, 12, 18, 0.95);
    transform: translateX(-100%);
    pointer-events: none;
}

#pageInfoSidebar.open,
#pageInfoSidebar.expanded {
    width: 220px;
    transform: translateX(0);
    pointer-events: auto;
}

#pageInfoSidebarInner {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#pageInfoSidebarInner.visible {
    opacity: 1;
    pointer-events: auto;
}

#pageInfoSidebar nav button span,
#modalSidebar nav button span {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

#pageInfoSidebar nav button:hover span,
#modalSidebar nav button:hover span {
    opacity: 1;
    transform: translateX(0);
}

#pageInfoFloatingSidebarToggle,
#pageInfoOverlaySidebarButton,
#pageInfoSidebarToggle,
#modalSidebarToggle {
    background: linear-gradient(135deg, var(--color-pulse), #ec4899);
    border-color: rgba(var(--color-pulse-rgb), 0.35);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(var(--color-pulse-rgb), 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    z-index: 1001;
}

#pageInfoFloatingSidebarToggle:hover,
#pageInfoOverlaySidebarButton:hover,
#modalSidebarToggle:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 16px 36px rgba(var(--color-pulse-rgb), 0.55);
}

#pageInfoFloatingSidebarToggle {
    animation: float 2.5s ease-in-out infinite;
    opacity: 0.95;
}

#pageInfoOverlaySidebarButton {
    opacity: 0.95;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes desktoppop {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-4px) scale(1.02);
    }

    75% {
        transform: translateY(0) scale(1);
    }
}

#pageInfoSidebarToggle,
#modalSidebarToggle {
    animation: desktoppop 3.2s ease-in-out infinite;
    z-index: 1002;
}

#pageInfoSidebarWrapper {
    z-index: 410;
}

#pageInfoCard {
    position: relative;
    z-index: 430;
    /* keep item card above sliding sidebar */
    transition: transform 0.25s ease;
}

#pageInfoCard .search-bar,
#pageInfoCard input[type="search"],
#pageInfoCard #pageInfoSearch {
    position: relative;
    z-index: 440;
}

#modalSidebar {
    z-index: 405;
}

#modal .search-bar,
#modal input[type="search"],
#modal .modal-search {
    position: relative;
    z-index: 420;
}

@media (max-width: 1024px) {
    #pageInfoSidebarWrapper {
        display: none;
    }

    #pageInfoSidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        max-width: 80vw;
        transform: translateX(-100%);
        border-radius: 0 0 0 0;
    }

    #pageInfoSidebar.open {
        width: 75vw;
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.55);
    }

    #pageInfoSidebarInner {
        position: relative;
        width: 100%;
        overflow-y: auto;
        max-height: 100vh;
    }

    #pageInfoOverlaySidebarButton,
    #pageInfoFloatingSidebarToggle {
        bottom: 6rem;
        top: auto;
        right: 1rem;
        left: auto;
        position: fixed;
    }
}


#pageInfoOverlaySidebarButton:hover {
    opacity: 1;
}

#pageInfoSidebar.expanded,
#pageInfoSidebar.open {
    width: 220px;
}

#modalSidebar {
    width: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

#modal.with-sidebar {
    padding-left: 220px;
    transition: padding-left 0.25s ease;
}

#modal.with-sidebar>.relative {
    transform: translateX(0);
}

#modalSidebar.open {
    width: 220px;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

#modalSidebarInner {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#modalSidebar.open #modalSidebarInner {
    opacity: 1;
    pointer-events: auto;
}

#modalSidebarBackdrop {
    pointer-events: none;
}

#modalSidebarBackdrop.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    #pageInfoSidebarWrapper {
        display: none;
    }

    #pageInfoSidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        max-width: 80vw;
        transform: translateX(-100%);
        border-radius: 0 0 0 0;
    }

    #pageInfoSidebar.open {
        width: 75vw;
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.55);
    }

    #pageInfoSidebarInner {
        position: relative;
        width: 100%;
        max-height: 100vh;
        overflow-y: auto;
        padding: 1rem;
    }

    #pageInfoOverlaySidebarButton,
    #pageInfoFloatingSidebarToggle {
        bottom: 6rem;
        top: auto;
        right: 1rem;
        left: auto;
        position: fixed;
    }

    #modalSidebar {
        width: 0;
        transform: translateX(-100%);
        opacity: 0;
        max-height: 100vh;
    }

    #modalSidebar.open {
        width: 80vw;
        transform: translateX(0);
        opacity: 1;
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.6);
        max-height: 90vh;
    }

    #modalSidebarInner {
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        padding: 1rem;
    }

    #modalSidebarToggle {
        animation: float 2s ease-in-out infinite;
    }

    #mBackBtn {
        z-index: 280;
    }
}

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

.hide-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#calendarGrid,
#calDayContent {
    overscroll-behavior: contain;
}

/* Rating Stars Animation */
.star-box i {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.star-box i:hover {
    transform: scale(1.3);
    color: #fbbf24;
}

.star-box i.active {
    color: #fbbf24;
}

/* Refined Transparent Frost */
/* Liquid Pill Search Bar */
.glass-search {
    background: rgba(255, 255, 255, 0.02) !important;
    backdrop-filter: blur(25px) saturate(210%) contrast(110%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(210%) contrast(110%) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 9999px !important;
    /* Full Pill Shape */
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.7);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#searchBar.active .glass-search {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(var(--color-pulse-rgb), 0.5) !important;
    transform: scale(1.02);
}

#searchBar.neural-diff-active {
    max-width: 240px !important;
}

#searchBar.neural-diff-active .glass-search {
    transform: scale(0.94) !important;
    border-color: rgba(34, 197, 94, 0.7) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

#searchBar.neural-diff-active .glass-search .fa-search,
#searchBar.neural-diff-active .glass-search #clearSearch {
    opacity: 0.8;
}

/* Fix Search Icon & X Button Visibility */
.search-icon-fixed {
    color: white !important;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.8));
}

#clearSearch {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#clearSearch:hover {
    background: var(--color-pulse);
    color: white;
    border-color: var(--color-pulse);
    box-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.4);
    transform: translateY(-50%) rotate(90deg) scale(1.1);
}

/* Person Modal Scrolling */
#personModal {
    scrollbar-width: thin;
    scrollbar-color: var(--color-pulse) rgba(255, 255, 255, 0.05);
}

/* Global Loaders */
.page-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--color-pulse-rgb), 0.1);
    border-top-color: var(--color-pulse);
    border-radius: 50%;
    animation: spin-loader 1s linear infinite;
}

@keyframes spin-loader {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Hierarchy Status Colors */
.status-watching {
    border-left: 4px solid #3b82f6;
}

.status-plan {
    border-left: 4px solid #94a3b8;
}

.status-finished {
    border-left: 4px solid #22c55e;
}

/* Android TV / Large Screen Support */
@media (min-width: 1920px) {
    .slider-title {
        --title-size: 8rem;
    }
}

/* Ensure search icon stands out on frosted background */
.fa-search {
    opacity: 0.8 !important;
    color: white !important;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 1024px) {
    /* 1. NAVIGATION (STAYS THE SAME) */

    aside {
        width: calc(100% - 40px) !important;
        max-width: 380px !important;
        height: 65px !important;
        top: 75px !important;
        /* Positioned below header & notifications */
        right: 20px !important;
        left: auto !important;
        flex-direction: row !important;
        border: 1px solid rgba(var(--color-pulse-rgb), 0.3) !important;
        border-radius: 20px !important;
        background: rgba(10, 12, 18, 0.95) !important;
        backdrop-filter: blur(25px);
        padding: 0 !important;
        z-index: 100;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }

    aside .p-8,
    #clock {
        display: none !important;
    }

    /* --- BOTTOM NAVIGATION REVOLUTION (SWIPEABLE) --- */
    nav {
        flex-direction: row !important;
        margin-top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        justify-content: flex-start !important;
        align-items: center !important;
        display: flex !important;
        overflow-x: auto !important;

        /* --- CRITICAL FIXES FOR PREMIUM FEEL --- */
        overflow-y: hidden !important;
        touch-action: pan-x !important;
        /* Forces the browser to ONLY accept horizontal swipes */
        overscroll-behavior-y: none !important;
        /* Stops the elastic bounce on the Y axis */
        /* --------------------------------------- */

        scroll-snap-type: x mandatory !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0 10px !important;
        gap: 8px !important;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    /* Hide scrollbar for sleekness */

    .nav-btn {
        padding: 0 !important;
        width: 75px !important;
        /* Fixed width to prevent squishing */
        flex: 0 0 auto !important;
        /* Prevent shrinking */
        scroll-snap-align: center !important;
        flex-direction: column !important;
        gap: 6px !important;
        color: #94a3b8 !important;
        justify-content: center !important;
        opacity: 0.6;
        transition: all 0.3s ease;
    }

    .nav-btn i {
        font-size: 1.2rem !important;
    }

    .nav-btn span {
        display: block !important;
        font-size: 8px !important;
        font-weight: 800;
    }

    .sidebar-link.active {
        background: rgba(var(--color-pulse-rgb), 0.12) !important;
        border-right: none !important;
        border-top: none !important;
        color: white !important;
        opacity: 1;
        transform: scale(1.02) translateY(-1px);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
        border-radius: 999px 0 0 999px;
    }

    .sidebar-link.active i {
        color: var(--color-pulse) !important;
        filter: none;
        text-shadow: none;
        transform: scale(1.05);
    }

    /* --- RESPONSIVE DIFF CARDS (MOBILE FIXES) --- */
    @media (max-width: 768px) {
        .diff-card-new {
            flex-direction: column !important;
            padding: 1rem !important;
            gap: 0.75rem !important;
        }

        .diff-card-new .min-w-0 {
            min-width: 0 !important;
        }

        .diff-card-new img {
            width: 3rem !important;
            height: 4.5rem !important;
        }

        .diff-card-new .gap-x-2 {
            column-gap: 0.5rem !important;
            row-gap: 0.25rem !important;
        }
    }

    /* --- RHYTHM LAB (MOBILE CLEANUP) --- */
    #labCounters {
        display: none !important;
        /* Hides counters on mobile only for a slicker UI */
    }

    /* Make Delta action controls always visible on mobile */
    @media (max-width: 768px) {

        #neuralDiffOverlay .sticky,
        #neuralDiffOverlay .sticky .relative {
            position: sticky !important;
            bottom: 0 !important;
            left: 0 !important;
            right: 0 !important;
            z-index: 40 !important;
        }

        #neuralDiffOverlay .sticky button {
            min-width: 45% !important;
            font-size: 11px !important;
            display: inline-flex !important;
        }

        #neuralDiffOverlay .sticky .flex-col {
            flex-direction: column !important;
        }

        .mobile-day-card {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            border-radius: 28px;
            background: rgba(10, 12, 18, 0.92);
        }

        .mobile-day-poster {
            width: 100%;
            min-height: 10rem;
            background-size: cover;
            background-position: center;
        }

        .mobile-day-placeholder {
            min-height: 10rem;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 1rem;
        }
    }

    /* --- MASTERPIECES MOBILE OVERHAUL --- */
    #view-masterpieces {
        padding: 20px !important;
        padding-top: 90px !important;
    }

    #view-masterpieces h2.liquid-glass {
        font-size: 2.5rem !important;
        line-height: 1.1;
        margin-bottom: 20px !important;
    }

    /* Swipeable Tabs Container */
    #view-masterpieces .flex.bg-\[\#0a0c12\] {
        width: 100% !important;
        padding: 8px !important;
        justify-content: flex-start !important;
    }

    /* Force Grid adjustment for Crowned/Ranked */
    #mpContainer .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Ranking Limit Buttons Mobile */
    #mpContainer .flex.gap-4.mb-12 {
        gap: 8px !important;
        margin-bottom: 20px !important;
    }

    #mpContainer .flex.gap-4.mb-12 button {
        padding: 12px 16px !important;
        font-size: 9px !important;
    }

    @media (max-width: 1024px) {

        /* --- TOP-RIGHT FLOATING MENU --- */
        @media (max-width: 1024px) {
            #sidebar-toggle {
                /* Move from bottom-left to top-right */
                bottom: auto !important;
                left: auto !important;
                top: 85px !important;
                /* Positioned below the notification icon */
                right: 20px !important;

                /* Slicker mobile look */
                width: 48px !important;
                height: 48px !important;
                background: rgba(10, 12, 18, 0.8) !important;
                border: 1px solid rgba(var(--color-pulse-rgb), 0.3) !important;
                backdrop-filter: blur(10px);
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            }

            /* Horizontal Nav Logic */
            nav {
                flex-direction: row !important;
                margin-top: 0 !important;
                width: 100% !important;
                height: 100% !important;
                justify-content: flex-start !important;
                align-items: center !important;
                display: flex !important;
                overflow-x: auto !important;
                scroll-snap-type: x mandatory !important;
                scroll-behavior: smooth !important;
                -webkit-overflow-scrolling: touch !important;
                padding: 0 10px !important;
                gap: 12px !important;
            }

            nav::-webkit-scrollbar {
                display: none;
            }
        }

        .nav-btn {
            flex: 0 0 auto !important;
            /* Prevents squishing */
            scroll-snap-align: start;
            width: 70px;
        }

        /* The Scroll Hint Sign - Refined Animated Indicator */
        .scroll-indicator-hint {
            position: absolute;
            bottom: 85px;
            /* Sits above the navigation bar */
            left: 50%;
            transform: translateX(-50%) translateY(10px);
            z-index: 200;
            display: none;
            align-items: center;
            gap: 12px;
            padding: 10px 22px;
            background: rgba(10, 12, 18, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(var(--color-pulse-rgb), 0.5);
            border-radius: 100px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(var(--color-pulse-rgb), 0.2);
            pointer-events: none;
            transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            opacity: 0;
        }

        .scroll-indicator-hint i {
            color: var(--color-pulse);
            font-size: 18px;
            filter: drop-shadow(0 0 8px rgba(var(--color-pulse-rgb), 0.8));
            animation: hintSwipeMotion 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
        }

        .scroll-indicator-hint span {
            font-size: 10px;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 3px;
            color: white;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
        }

        @keyframes hintSwipeMotion {
            0% {
                transform: translateX(20px) scale(1);
                opacity: 0;
            }

            20% {
                opacity: 1;
            }

            80% {
                opacity: 1;
            }

            100% {
                transform: translateX(-30px) scale(0.8);
                opacity: 0;
            }
        }

        /* --- LAB COUNTER REMOVAL (MOBILE ONLY) --- */
        .lab-stats-container,
        #labCounters {
            display: none !important;
        }
    }

    /* 2. HERO SLIDER (75% HEIGHT & TEXT FIX) */
    #view-home>div:first-child {
        height: 60vh !important;
        /* Shorter vertical height */
        min-height: 400px !important;
        overflow: hidden;
    }

    #heroSlider {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0;
        left: 0;
    }

    #heroSlider img {
        object-fit: cover !important;
        height: 100% !important;
        width: 100% !important;
        opacity: 0.7;
        /* Dimmed slightly for text readability */
    }

    /* Slider Text Overlay */
    #view-home .bottom-32 {
        position: absolute !important;
        bottom: 80px !important;
        /* Sits above the hero bottom */
        left: 0 !important;
        padding: 0 20px !important;
        background: none !important;
        z-index: 20;
    }



    /* 3. COLLAPSIBLE SEARCH BAR (CSS ONLY) */
    header {
        left: 0 !important;
        padding: 10px 15px !important;
        background: transparent !important;
        z-index: 50;
    }

    /* 3. REFINED COLLAPSIBLE SEARCH BAR (NO OVERLAP) */
    header {
        left: 0 !important;
        padding: 15px !important;
        background: transparent !important;
        z-index: 50;
        display: flex !important;
        justify-content: flex-start !important;
        /* Forces search to the left */
        align-items: center !important;
    }

    /* Glass Search Container */
    header .max-w-xl {
        width: 48px !important;
        /* Perfect circle for icon */
        height: 48px !important;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        background: rgba(255, 255, 255, 0.08) !important;
        /* Translucent Glass */
        backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 24px;
        overflow: hidden;
        margin-left: 0 !important;
        position: relative;
    }

    /* Expand when clicked/focused */
    header .max-w-xl:focus-within {
        width: 90% !important;
        background: rgba(30, 30, 30, 0.7) !important;
        /* Semi-transparent dark glass */
        border-color: rgba(var(--color-pulse-rgb), 0.5);
        overflow: visible !important;
        /* <--- ADD THIS LINE */
    }

    /* Search Icon Positioning (Prevents Overlap) */
    header .fa-search {
        position: absolute;
        left: 16px !important;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        pointer-events: none;
    }

    header input {
        opacity: 0;
        width: 100%;
        height: 100%;
        transition: opacity 0.3s;
        padding-left: 50px !important;
        /* Massive padding to clear the icon */
        background: transparent !important;
        color: white !important;
        font-size: 14px !important;
    }

    header .max-w-xl:focus-within input {
        opacity: 1;
    }

    /* Fix for the 'X' button inside the search */
    header button[onclick*="searchInput.value = ''"] {
        position: absolute;
        right: 12px !important;
        top: 50%;
        transform: translateY(-50%);
        padding: 5px !important;
    }

    /* 4. RECOMMENDATIONS (STAYS THE SAME - SMOOTH SLIDE) */
    .hide-scroll {
        display: flex !important;
        overflow-x: auto !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        gap: 12px !important;
        padding: 0 20px 20px 20px !important;
    }

    .hide-scroll>div {
        flex: 0 0 42% !important;
        scroll-snap-align: start !important;
    }

    /* 5. GLOBAL FIXES */
    main {
        padding-left: 0 !important;
        padding-bottom: 90px !important;
    }

    .breadcrumb {
        display: none !important;
    }

    #homeCounters {
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 0 20px !important;
    }
}

/* --- MOBILE OPTIMIZATION (MOBILE ONLY) --- */
@media (max-width: 768px) {

    /* 1. BOTTOM NAVIGATION BAR */
    aside {
        width: 100% !important;
        height: 75px !important;
        top: auto !important;
        bottom: 0 !important;
        flex-direction: row !important;
        border-right: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(2, 4, 8, 0.95) !important;
        backdrop-filter: blur(25px);
        padding: 0 !important;
        z-index: 100;
    }

    aside .p-8,
    #clock {
        display: none !important;
    }

    nav {
        flex-direction: row !important;
        margin-top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        justify-content: space-around !important;
        align-items: center !important;
        display: flex !important;
    }

    .nav-btn {
        padding: 0 !important;
        width: 20% !important;
        flex-direction: column !important;
        gap: 4px !important;
        color: #94a3b8 !important;
        justify-content: center !important;
    }

    .nav-btn i {
        font-size: 1.2rem !important;
    }

    .nav-btn span {
        display: block !important;
        font-size: 8px !important;
        font-weight: 800;
    }

    .sidebar-link.active {
        background: rgba(var(--color-pulse-rgb), 0.12) !important;
        border-right: none !important;
        border-top: none !important;
        color: white !important;
        border-left-color: var(--color-pulse) !important;
        border-left-width: 3px !important;
        border-radius: 999px 0 0 999px;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    }

    /* 2. HERO SLIDER (70% HEIGHT & OVERLAY) */
    #view-home>div:first-child {
        height: 70vh !important;
        /* Fixed proportional height */
        min-height: 450px !important;
        position: relative !important;
        overflow: hidden;
    }

    #heroSlider {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0;
        left: 0;
    }

    #heroSlider img {
        object-fit: cover !important;
        height: 100% !important;
        width: 100% !important;
    }

    #view-home .bottom-32 {
        position: absolute !important;
        bottom: 40px !important;
        left: 0 !important;
        padding: 0 20px !important;
        background: linear-gradient(to top, #020408 30%, transparent) !important;
        width: 100%;
        z-index: 20;
    }

    .slider-title {
        font-size: 2rem !important;
        margin-bottom: 10px !important;
    }

    #heroInfoBtn,
    #heroTrailerBtn {
        flex: 1 !important;
        padding: 14px 0 !important;
        font-size: 10px !important;
    }

    /* 3. STATIC BENTO GRID COUNTERS (NO SLIDING) */
    #homeCounters {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        padding: 20px 15px !important;
        margin-top: 0 !important;
        overflow-x: hidden !important;
    }

    #homeCounters>div {
        height: 80px !important;
        background: rgba(255, 255, 255, 0.04) !important;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 18px !important;
    }

    /* 4. COLLAPSIBLE LEFT SEARCH BAR */
    header {
        left: 0 !important;
        padding: 15px !important;
        background: transparent !important;
        z-index: 50;
        justify-content: flex-start !important;
    }

    header .max-w-xl {
        width: 48px !important;
        height: 48px !important;
        transition: all 0.4s ease;
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(15px);
        border-radius: 24px;
        margin-left: 0 !important;
    }

    header .max-w-xl:focus-within {
        width: 90% !important;
        background: rgba(10, 10, 10, 0.9) !important;
    }

    header input {
        opacity: 0;
        padding-left: 45px !important;
    }

    header .max-w-xl:focus-within input {
        opacity: 1;
    }

    header .fa-search {
        left: 16px !important;
        position: absolute;
    }

    /* 5. SMOOTH SLIDING RECOMMENDATIONS */
    .hide-scroll {
        display: flex !important;
        overflow-x: auto !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        gap: 12px !important;
        padding: 0 20px 20px 20px !important;
    }

    .hide-scroll>div {
        flex: 0 0 42% !important;
        scroll-snap-align: start !important;
    }

    /* LAYOUT REPAIR */
    main {
        padding-left: 0 !important;
        padding-bottom: 90px !important;
    }

    .breadcrumb {
        display: none !important;
    }
}

/* --- PHENOMENAL DISCOVER PAGE (MOBILE) --- */

#searchHeader {
    font-size: 24px !important;
    /* Smaller, cleaner header on mobile */
    letter-spacing: -1px !important;
    margin-bottom: 0 !important;
    display: block !important;
    width: 100%;
}

/* Horizontal Filter Strip */
#view-search .flex.flex-wrap.gap-4 {
    display: flex !important;
    flex-wrap: nowrap !important;
    /* Force single row */
    overflow-x: auto !important;
    /* Allow side-scrolling filters */
    padding-bottom: 5px;
    width: 100%;
    gap: 8px !important;
    scrollbar-width: none;
}

#view-search .flex.flex-wrap.gap-4::-webkit-scrollbar {
    display: none;
}

/* Pill-Style Select Boxes */
#view-search select {
    flex: 0 0 auto !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 50px !important;
    /* Rounder "Pill" look */
    padding: 8px 15px !important;
    font-size: 9px !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    min-width: 100px;
}

/* --- SEARCH LAYOUT UTILITIES (DESKTOP LIST VIEW) --- */
#searchGrid.list-view {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

.list-item-premium {
    transform-origin: center left;
    will-change: transform, background-color;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.list-item-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(var(--color-pulse-rgb), 0.3);
    transform: translateX(10px);
}

.list-item-premium img {
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.list-item-premium:hover img {
    transform: scale(1.08);
}

.layout-btn.active {
    background: var(--color-pulse) !important;
    color: white !important;
    box-shadow: 0 10px 20px rgba(var(--color-pulse-rgb), 0.3) !important;
}

.layout-btn.active i {
    color: white !important;
}

/* --- PHENOMENAL DISCOVER PAGE (MOBILE ONLY) --- */
@media (max-width: 768px) {
    #searchHeader {
        font-size: 32px !important;
        letter-spacing: -1px !important;
        margin-bottom: 0 !important;
        display: block !important;
        width: 100%;
    }

    /* Hide the complex layout selector on mobile to save space */
    #layoutSelector {
        display: none !important;
    }

    /* Horizontal Filter Strip */
    #view-search .flex.flex-wrap.gap-4 {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 5px;
        width: 100%;
        gap: 8px !important;
        scrollbar-width: none;
    }

    #view-search .flex.flex-wrap.gap-4::-webkit-scrollbar {
        display: none;
    }

    /* Pill-Style Select Boxes */
    #view-search select {
        flex: 0 0 auto !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 50px !important;
        padding: 10px 18px !important;
        font-size: 10px !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        min-width: 110px;
    }

    /* Optimized Grid for Mobile Discovery */
    #searchGrid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        margin-top: 30px !important;
    }

    #searchGrid .group {
        background: rgba(255, 255, 255, 0.02);
        border-radius: 20px;
        overflow: hidden;
        transition: transform 0.2s;
    }

    #searchGrid .group:active {
        transform: scale(0.95);
    }

    #searchGrid .aspect-\[2\/3\] {
        border-radius: 18px !important;
        margin-bottom: 8px !important;
    }

    /* Load More Button Mobile */
    #btnDiscoverLoadMore {
        width: 100% !important;
        background: var(--color-pulse) !important;
        color: white !important;
        border: none !important;
        border-radius: 18px !important;
        padding: 18px !important;
        font-size: 11px !important;
        box-shadow: 0 10px 30px rgba(var(--color-pulse-rgb), 0.2);
    }
}

/* Load More Button - Center & App Style */
#btnDiscoverLoadMore {
    width: 90% !important;
    background: var(--color-pulse) !important;
    color: white !important;
    border: none !important;
    border-radius: 15px !important;
    padding: 18px !important;
    font-size: 11px !important;
    box-shadow: 0 10px 20px rgba(var(--color-pulse-rgb), 0.2);
}

/* --- MY LIST ELITE REDESIGN --- */
.library-action-bar {
    background: rgba(10, 12, 18, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lib-btn {
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    background: transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lib-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.lib-btn i {
    font-size: 14px;
}

.lib-btn.danger:hover {
    background: rgba(var(--color-pulse-rgb), 0.1);
    color: var(--color-pulse);
}

.lib-btn.primary {
    background: var(--color-pulse);
    color: white;
    box-shadow: 0 4px 15px rgba(var(--color-pulse-rgb), 0.3);
}

.lib-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-pulse-rgb), 0.4);
}

.lib-section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: white;
    margin-bottom: 24px;
}

.lib-section-title::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-pulse);
    box-shadow: 0 0 10px var(--color-pulse);
}

.lib-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent);
}

.lib-card-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lib-card-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(var(--color-pulse-rgb), 0.3);
    transform: translateX(8px);
}

@media (max-width: 768px) {
    .library-action-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .lib-btn span {
        display: none;
    }

    /* Show only icons on mobile for secondary buttons */
    .lib-btn.primary span {
        display: inline;
    }

    /* Keep text for Random Picker */
    .lib-card-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .lib-card-row img {
        width: 100%;
        height: 180px;
        object-fit: cover;
    }

    .lib-card-row .stats {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .lib-card-row .stats .text-right {
        text-align: left !important;
    }
}

/* --- LOCAL SMART SEARCH UI --- */
.local-search-wrapper {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.local-search-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
}

.local-search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(var(--color-pulse-rgb), 0.5);
    box-shadow: 0 0 20px rgba(var(--color-pulse-rgb), 0.1);
}

@media (max-width: 768px) {

    /* Mobile: Search bar takes full width on its own row */
    .mobile-full-search {
        width: 100% !important;
        order: 99;
        /* Pushes to bottom of the flex container */
        margin-top: 10px;
    }
}

@keyframes wave-slide {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.animate-wave-slide {
    animation: wave-slide 4s linear infinite;
}

/* --- GLOBAL NETWORK LOADER --- */
#globalLoader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-pulse);
    z-index: 99999;
    transition: width 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 15px var(--color-pulse), 0 0 5px var(--color-pulse);
    pointer-events: none;
    opacity: 0;
    width: 0%;
}

/* From Uiverse.io by Pradeepsaranbishnoi */
/* The loader container */
.loader {
    width: 200px;
    height: 200px;
    perspective: 200px;
}


/* The dot */
.dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    margin-top: -60px;
    margin-left: -60px;
    border-radius: 100px;
    border: 40px outset var(--color-pulse);
    transform-origin: 50% 50%;
    transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    background-color: transparent;
    animation: dot1 1000ms cubic-bezier(.49, .06, .43, .85) infinite;
}

.dot:nth-child(2) {
    width: 140px;
    height: 140px;
    margin-top: -70px;
    margin-left: -70px;
    border-width: 30px;
    border-color: #ffffff;
    animation-name: dot2;
    animation-delay: 75ms;
    box-shadow: inset 0 0 15px 0 rgba(0, 0, 0, 0.1);
    transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
}

.dot:nth-child(3) {
    width: 160px;
    height: 160px;
    margin-top: -80px;
    margin-left: -80px;
    border-width: 20px;
    border-color: #eb012c;
    animation-name: dot3;
    animation-delay: 150ms;
    box-shadow: inset 0 0 15px 0 rgba(0, 0, 0, 0.1);
    transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
}

@keyframes dot1 {
    0% {
        border-color: #80162a;
        /* Deep Dark Red */
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }

    50% {
        border-color: var(--color-pulse);
        /* Signature Pulse Red */
        transform: rotateX(20deg) rotateY(20deg) rotateZ(50deg) translateZ(0px);
    }

    100% {
        border-color: #ffffff;
        /* Pure White */
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }
}

@keyframes dot2 {
    0% {
        border-color: #ffffff;
        box-shadow: inset 0 0 15px 0 rgba(255, 255, 255, 0.4);
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }

    50% {
        border-color: #ff8a9f;
        /* Soft Frosted Pink/Red */
        box-shadow: inset 0 0 15px 0 rgba(var(--color-pulse-rgb), 0.4);
        transform: rotateX(20deg) rotateY(20deg) rotateZ(50deg) translateZ(0px);
    }

    100% {
        border-color: var(--color-pulse);
        box-shadow: inset 0 0 15px 0 rgba(var(--color-pulse-rgb), 0.8);
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }
}

@keyframes dot3 {
    0% {
        border-color: var(--color-pulse);
        box-shadow: inset 0 0 15px 0 rgba(var(--color-pulse-rgb), 0.6);
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }

    50% {
        border-color: #ffffff;
        box-shadow: inset 0 0 15px 0 rgba(255, 255, 255, 0.8);
        transform: rotateX(20deg) rotateY(20deg) rotateZ(50deg) translateZ(0px);
    }

    100% {
        border-color: #80162a;
        box-shadow: inset 0 0 15px 0 rgba(var(--color-pulse-rgb), 0.2);
        transform: rotateX(24deg) rotateY(20deg) rotateZ(0deg) translateZ(-25px);
    }
}

/* New Constructing Text CSS */
.constructing-text {
    margin-top: 40px;
    perspective: 500px;
}

.constructing-text span {
    display: inline-block;
    opacity: 0;
    transform: rotateX(-90deg) scale(0.5);
    animation: constructText 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite alternate;
}

.constructing-text span:nth-child(1) {
    animation-delay: 0.1s;
}

.constructing-text span:nth-child(2) {
    animation-delay: 0.2s;
}

.constructing-text span:nth-child(3) {
    animation-delay: 0.3s;
}

.constructing-text span:nth-child(4) {
    animation-delay: 0.4s;
}

.constructing-text span:nth-child(5) {
    animation-delay: 0.5s;
    color: white;
}

.constructing-text span:nth-child(6) {
    animation-delay: 0.6s;
    color: white;
}

.constructing-text span:nth-child(7) {
    animation-delay: 0.7s;
    color: white;
}

.constructing-text span:nth-child(8) {
    animation-delay: 0.8s;
    color: white;
}

.constructing-text span:nth-child(9) {
    animation-delay: 0.9s;
    color: white;
}

@keyframes constructText {
    0% {
        opacity: 0;
        transform: rotateX(-90deg) rotateY(180deg) scale(0.5) translateZ(-50px);
        filter: blur(4px);
    }

    50% {
        opacity: 1;
        transform: rotateX(0deg) rotateY(0deg) scale(1.2) translateZ(20px);
        filter: blur(0px);
        text-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.8);
    }

    100% {
        opacity: 1;
        transform: rotateX(0deg) rotateY(0deg) scale(1) translateZ(0px);
        filter: blur(0px);
        text-shadow: 0 0 5px rgba(var(--color-pulse-rgb), 0.4);
    }
}

/* --- GLOBAL CUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #020408;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-pulse-rgb), 0.3);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-pulse-rgb), 0.8);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--color-pulse-rgb), 0.5) #020408;
}

/* Hide scrollbar completely only where explicitly requested */
.hide-scroll::-webkit-scrollbar {
    display: none;
}

.hide-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- AMAZING PAGE TRANSITIONS --- */
@keyframes pageEnter {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
        filter: blur(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

.page-transition-enter {
    animation: pageEnter 0.25s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* --- NAV BUTTON HOVER EFFECTS --- */
.nav-btn-effect {
    position: relative;
    overflow: hidden;
}

.nav-btn-effect::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--color-pulse);
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom;
}

.nav-btn-effect:hover::before,
.nav-btn-effect.active::before {
    transform: scaleY(1);
    transform-origin: top;
    box-shadow: 0 0 6px rgba(var(--color-pulse-rgb), 0.25);
}

.nav-btn-effect:hover {
    background: rgba(var(--color-pulse-rgb), 0.05);
    color: white !important;
    transform: translateX(5px);
}

/* Glowing Hover for Section Titles */
.glow-title {
    transition: all 0.3s ease;
    cursor: pointer;
}

.glow-title:hover {
    color: var(--color-pulse);
    text-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.8);
    transform: translateX(5px);
}

@media (max-width: 1024px) {

    /* 1. Dynamic Text Reveal for Active Nav Item */
    .nav-btn span {
        display: none !important;
        /* Hide all text by default */
    }

    .nav-btn.active span {
        display: block !important;
        animation: slideUpFade 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    .nav-btn {
        width: 60px !important;
        /* Shrink inactive items */
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-btn.active {
        width: 80px !important;
        /* Expand active item to fit text */
    }

    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(5px);
        }

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

    /* 2. Floating Swipe Hint Centered Above Nav */
    .scroll-indicator-hint {
        bottom: 85px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        animation: gentlePulse 2s infinite !important;
    }

    @keyframes gentlePulse {

        0%,
        100% {
            opacity: 0.8;
            transform: translateX(-50%) translateY(0);
        }

        50% {
            opacity: 1;
            transform: translateX(-50%) translateY(-3px);
            border-color: var(--color-pulse);
            box-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.3);
        }
    }
}

/* Mobile State: "Collapsed" */
@media (max-width: 768px) {
    #modalSearchWrapper {
        left: 50%;
        transform: translateX(-50%);
    }

    #modalSearchWrapper.expanded {
        width: 85%;
    }

    #modalSearchWrapper.expanded #modalSearchContainer {
        width: 100%;
    }

    #modalSearchWrapper.expanded #modalSearch {
        opacity: 1;
    }
}

/* Hover expansion for PC */
@media (min-width: 1024px) {
    #modalSearchContainer:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(var(--color-pulse-rgb), 0.4);
        width: 350px;
    }
}

@media (max-width: 768px) {
    #mobileInstallLink {
        display: block !important;
    }
}

/* --- SAGA MATRIX: MEMORY CLUSTERS — PREMIUM REDESIGN --- */
.memory-cluster {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    perspective: 800px;
    transform-style: preserve-3d;
}

.memory-cluster::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(135deg, rgba(var(--color-pulse-rgb), 0.4), transparent 40%, rgba(168, 85, 247, 0.3));
    z-index: 0;
    transition: opacity 0.5s ease;
    filter: blur(8px);
}

.memory-cluster img {
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1), filter 0.4s ease, box-shadow 0.4s ease, opacity 0.45s ease;
    transform-origin: 50% 95%; /* bottom-center — pivot point for the poker fan */
}

/* --- SAGA CARD: Premium Container --- */
.saga-selectable-card {
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    contain: layout style;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    border-radius: 32px;
    background: linear-gradient(145deg, rgba(30, 35, 45, 0.4) 0%, rgba(10, 12, 18, 0.8) 100%);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.05);
    padding: 8px; /* Casing padding */
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.saga-selectable-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(var(--color-pulse-rgb), 0.5) 0%, transparent 40%, transparent 60%, rgba(168, 85, 247, 0.5) 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.saga-selectable-card.is-fanned::before {
    opacity: 1;
    box-shadow: inset 0 0 20px rgba(var(--color-pulse-rgb), 0.2);
}

.saga-selectable-card .memory-cluster {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    background: #05070a;
    border: 1px solid rgba(255, 255, 255, 0.04);
    aspect-ratio: 2/3;
    min-height: 0;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

/* --- Hover / Fan Activation --- */
.saga-selectable-card.is-fanned {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(var(--color-pulse-rgb), 0.15);
    border-color: transparent;
    background: transparent; /* Remove outer container on hover */
    padding: 0; /* Collapse padding on hover so cluster fills the space */
}

/* --- Saga Fan Layer --- */
.saga-fan-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

.saga-fan-card {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    object-fit: cover;
    transform-origin: 10% 90%; /* Pinch point: Bottom-left corner */
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.5s ease, opacity 0.5s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Base stacking (resting state) */
.saga-fan-card--0 { z-index: 40; transform: translateY(0) scale(1); opacity: 1; }
.saga-fan-card--1 { z-index: 39; transform: translateY(6px) scale(0.985); opacity: 0.92; }
.saga-fan-card--2 { z-index: 38; transform: translateY(12px) scale(0.96); opacity: 0.86; }
.saga-fan-card--3 { z-index: 37; transform: translateY(18px) scale(0.94); opacity: 0; }
.saga-fan-card--4 { z-index: 36; transform: translateY(20px) scale(0.92); opacity: 0; }
.saga-fan-card--5 { z-index: 35; transform: translateY(20px) scale(0.92); opacity: 0; }
.saga-fan-card--6 { z-index: 34; transform: translateY(20px) scale(0.92); opacity: 0; }
.saga-fan-card--7 { z-index: 33; transform: translateY(20px) scale(0.92); opacity: 0; }

/* Fan out on hover/active */
.saga-selectable-card.is-fanned .saga-fan-card {
    opacity: 1;
    box-shadow: 8px 8px 30px rgba(0,0,0,0.6);
    border-color: rgba(255,255,255,0.2);
}

.saga-selectable-card.is-fanned .saga-fan-card--0 { transform: scale(0.9) rotate(35deg); }
.saga-selectable-card.is-fanned .saga-fan-card--1 { transform: scale(0.9) rotate(25deg); }
.saga-selectable-card.is-fanned .saga-fan-card--2 { transform: scale(0.9) rotate(15deg); }
.saga-selectable-card.is-fanned .saga-fan-card--3 { transform: scale(0.9) rotate(5deg); }
.saga-selectable-card.is-fanned .saga-fan-card--4 { transform: scale(0.9) rotate(-5deg); }
.saga-selectable-card.is-fanned .saga-fan-card--5 { transform: scale(0.9) rotate(-15deg); }
.saga-selectable-card.is-fanned .saga-fan-card--6 { transform: scale(0.9) rotate(-25deg); }
.saga-selectable-card.is-fanned .saga-fan-card--7 { transform: scale(0.9) rotate(-35deg); }

/* --- Typography Overlay --- */
.saga-card-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(5, 7, 10, 0.8) 40%, #05070a 100%);
    z-index: 45;
}

.saga-card-title-box {
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.saga-selectable-card.is-fanned .saga-card-title-box {
    transform: translateY(-8px);
}

.saga-card-title {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #a1a1aa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 15px rgba(0,0,0,0.9);
    margin-bottom: 0.35rem;
    transition: all 0.4s ease;
}

.saga-selectable-card.is-fanned .saga-card-title {
    background: linear-gradient(to right, #ffffff, rgba(var(--color-pulse-rgb), 0.8));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(var(--color-pulse-rgb), 0.5);
}

@media (hover: hover) {
    .saga-selectable-card:hover::before { opacity: 1; box-shadow: inset 0 0 20px rgba(var(--color-pulse-rgb), 0.2); }
    .saga-selectable-card:hover { transform: translateY(-12px) scale(1.02); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(var(--color-pulse-rgb), 0.15); border-color: transparent; background: transparent; padding: 0; }
    .saga-selectable-card:hover .saga-fan-card { opacity: 1; box-shadow: 8px 8px 30px rgba(0,0,0,0.6); border-color: rgba(255,255,255,0.2); }
    .saga-selectable-card:hover .saga-fan-card--0 { transform: scale(0.9) rotate(35deg); }
    .saga-selectable-card:hover .saga-fan-card--1 { transform: scale(0.9) rotate(25deg); }
    .saga-selectable-card:hover .saga-fan-card--2 { transform: scale(0.9) rotate(15deg); }
    .saga-selectable-card:hover .saga-fan-card--3 { transform: scale(0.9) rotate(5deg); }
    .saga-selectable-card:hover .saga-fan-card--4 { transform: scale(0.9) rotate(-5deg); }
    .saga-selectable-card:hover .saga-fan-card--5 { transform: scale(0.9) rotate(-15deg); }
    .saga-selectable-card:hover .saga-fan-card--6 { transform: scale(0.9) rotate(-25deg); }
    .saga-selectable-card:hover .saga-fan-card--7 { transform: scale(0.9) rotate(-35deg); }
    .saga-selectable-card:hover .saga-card-title-box { transform: translateY(-8px); }
    .saga-selectable-card:hover .saga-card-title { background: linear-gradient(to right, #ffffff, rgba(var(--color-pulse-rgb), 0.8)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 0 20px rgba(var(--color-pulse-rgb), 0.5); }
}

.saga-card-subtitle {
    display: flex;
    align-items: center;
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    color: #9ca3af;
    text-transform: uppercase;
}

/* Mobile Interaction Icon */
.mobile-fan-toggle {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.saga-selectable-card.is-fanned .mobile-fan-toggle {
    background: var(--color-pulse);
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.5);
    border-color: rgba(var(--color-pulse-rgb), 0.8);
}

.saga-parts-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.08);
}

.saga-progress-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: rgba(6, 8, 12, 0.64);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 45;
}

.saga-progress-overlay .progress-line {
    width: 100%;
    height: 0.35rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.saga-progress-overlay .progress-line > div {
    height: 100%;
    border-radius: 999px;
}

.saga-progress-overlay .progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-bottom: 0.55rem;
}

/* --- Status Pills --- */
.saga-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.2em;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.saga-status-not-watched {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.saga-status-watching {
    background: rgba(245, 158, 11, 0.14);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.saga-status-completed {
    background: rgba(34, 197, 94, 0.14);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.saga-status-not-watched .memory-cluster::after { box-shadow: 0 0 20px rgba(248, 113, 113, 0.1); }
.saga-status-watching .memory-cluster::after   { box-shadow: 0 0 20px rgba(245, 158, 11, 0.12); }
.saga-status-completed .memory-cluster::after  { box-shadow: 0 0 20px rgba(34, 197, 94, 0.12); }

/* Ensure posters crop correctly */
.memory-cluster img { object-fit: cover !important; width: 100% !important; height: 100% !important; }

/* --- Delete Button: Premium Glow --- */
.saga-delete-btn {
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3), inset 0 0 8px rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1) !important;
}
.saga-delete-btn:hover {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5), inset 0 0 12px rgba(239, 68, 68, 0.15) !important;
    transform: scale(1.15) !important;
}

/* --- Deck layer defaults (non-saga contexts) --- */
.cluster-top {
    position: relative;
    z-index: 30;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cluster-mid {
    position: absolute;
    top: -6px; right: -6px;
    width: 100%; height: 100%;
    z-index: 20; opacity: 0.5;
    transform: scale(0.96);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.cluster-back {
    position: absolute;
    top: -12px; right: -12px;
    width: 100%; height: 100%;
    z-index: 10; opacity: 0.25;
    transform: scale(0.92);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Performance: contain paint to isolate repaints */
.memory-cluster { contain: layout paint; }
#heroSlider { contain: paint; }

/* --- Generic cluster hover (non-saga cards) --- */
.group:hover .cluster-mid {
    transform: translate(10px, -10px) scale(0.96) rotate(1.5deg);
    opacity: 0.7;
    border-color: rgba(var(--color-pulse-rgb), 0.2);
}
.group:hover .cluster-back {
    transform: translate(20px, -20px) scale(0.92) rotate(3deg);
    opacity: 0.4;
    border-color: rgba(var(--color-pulse-rgb), 0.1);
}

/* Old saga-selectable-card cluster hover overrides removed, handled by saga-fan-card */


/* --- SAGA MODAL FIXES --- */

/* 1. The Photo Frame: Zero Stretch */
.saga-backdrop-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    /* Perfect crop, no stretch */
    object-position: center 20%;
}

/* 2. Mobile Button Position Fix */
/* --- SAGA CLOSE BUTTON MOBILE FIX --- */
@media (max-width: 768px) {

    /* Position the Close Button inside the top-right of the poster frame */
    .saga-action-header .close-btn {
        position: absolute !important;
        top: 20px !important;
        /* Safely inside the poster top-right */
        right: 20px !important;
        z-index: 100 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        /* Darker for better contrast on images */
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        width: 44px !important;
        /* Slightly larger touch target for thumbs */
        height: 44px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    /* Keep the other buttons (Toggle/Sync) at the bottom as discussed */
    .action-buttons-wrap {
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 90;
        display: flex;
        gap: 8px;
        background: rgba(10, 12, 18, 0.9);
        padding: 12px 20px;
        border-radius: 30px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        width: fit-content;
        max-width: 90%;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    }
}

/* Ensure the Poster Frame never stretches */
.saga-backdrop-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    /* Perfect photo-frame crop */
    object-position: center 20%;
}

/* Desktop spacing for close button */
@media (min-width: 769px) {
    .saga-action-header .close-btn {
        position: absolute;
        top: 30px;
        right: 30px;
    }
}

/* --- SAGA MODAL CLOSE BUTTON REFINEMENT --- */

/* Desktop / PC Version */
@media (min-width: 769px) {
    .saga-close-btn {
        position: fixed !important;
        top: 60px !important;
        /* Lowered slightly for better visual balance */
        right: 40px !important;
        z-index: 999 !important;
        background: rgba(255, 255, 255, 0.05) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        width: 54px !important;
        height: 54px !important;
        cursor: pointer !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }

    /* Cinematic Hover Effect */
    .saga-close-btn:hover {
        background: var(--color-pulse) !important;
        transform: scale(1.1) rotate(90deg);
        /* Scales up and spins slightly */
        border-color: var(--color-pulse) !important;
        box-shadow: 0 0 25px rgba(var(--color-pulse-rgb), 0.6);
        color: white !important;
    }
}

/* Mobile Version */
@media (max-width: 768px) {
    .saga-close-btn {
        position: absolute !important;
        top: 35px !important;
        /* Lowered slightly to avoid status bar overlap */
        right: 20px !important;
        z-index: 999 !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(15px) !important;
        -webkit-backdrop-filter: blur(15px) !important;
        width: 48px !important;
        height: 48px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        color: white !important;
        /* Massive touch area for easy closing */
        box-shadow: 0 0 0 15px transparent;
    }
}

/* Fix for Actor Banner Biography/Description */
#pBio {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    /* Limits description to 4 lines */
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 100px;
    /* Safety cap */
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* Optional: Expand on hover if you want users to read more */
#pBio:hover {
    -webkit-line-clamp: 12;
    line-clamp: 12;
    max-height: 300px;
    overflow-y: auto;
}

/* Saga Forge Drag & Drop Utilities */
.forge-item {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.forge-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 15px 30px rgba(var(--color-pulse-rgb), 0.3);
    border-color: var(--color-pulse) !important;
    z-index: 100;
}

.forge-item.drag-over {
    border-top: 4px solid var(--color-pulse);
    margin-top: 15px;
}

/* Sizing scales */
.forge-size-main {
    border-left: 4px solid var(--color-pulse);
}

.forge-size-spinoff {
    border-left: 4px solid #3b82f6;
    opacity: 0.8;
    transform: scale(0.95);
    transform-origin: left center;
}

/* Mobile Optimized Saga Cards */
@media (max-width: 768px) {
    #sagaModal .max-w-4xl {
        padding-bottom: 100px;
        /* Space for the fixed buttons */
    }

    #inlineSagaList .flex-col {
        background: rgba(255, 255, 255, 0.02);
        padding: 12px;
        border-radius: 16px;
    }

    /* Prevent text overflow on small screens */
    .truncate-saga-title {
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .saga-card-title {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .saga-card-subtitle {
        font-size: 0.55rem;
    }

    .saga-card-title-overlay {
        padding: 2rem 1rem 1rem 1rem;
    }
    
    .saga-parts-pill {
        font-size: 8px;
        padding: 0.3rem 0.6rem;
    }
    
    .mobile-fan-toggle {
        width: 32px;
        height: 32px;
    }
    
    .mobile-fan-toggle i {
        font-size: 0.6rem;
    }
}

/* Dynamic Shadow for the 'Commit' Button */
#saveSagaBtn {
    box-shadow: 0 10px 30px -10px rgba(34, 197, 94, 0.5);
}

/* Multi-Select Bar Animation Classes */
#multiSelectBar.active {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

/* Custom Checkbox for Grid/List Cards */
.card-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 60;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-checkbox.selected {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.card-checkbox i {
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-checkbox.selected i {
    opacity: 1;
    transform: scale(1);
}

/* Pulse effect when Select Mode is active */
.select-mode-pulse {
    animation: selectPulse 2s infinite;
}

@keyframes selectPulse {

    0%,
    100% {
        box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.2);
    }

    50% {
        box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.6);
    }
}

/* --- MULTI-SELECT MOBILE OPTIMIZATION --- */
@media (max-width: 1024px) {
    #multiSelectBar {
        bottom: 85px !important;
        /* Clears the mobile bottom nav */
        width: 90% !important;
        padding: 12px 20px !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px !important;
    }

    #multiSelectBar .w-px {
        display: none;
        /* Hides dividers on small screens for clean wrap */
    }
}

/* Ensure Saga Cards can securely hold the checkmark */
.saga-selectable-card {
    position: relative;
}

/* --- SAGA MATRIX MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {

    /* Stack the header title and tabs vertically to save width */
    #view-sagamatrix>div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    /* Make the tab container scrollable horizontally if buttons are too wide */
    #view-sagamatrix .flex.bg-\[\#0a0c12\] {
        width: 100%;
        overflow-x: auto;
        padding: 8px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    /* Shrink the posters in the "Memory Cluster" so they don't overlap awkwardly */
    .memory-cluster {
        height: 180px;
        /* Reduced height for mobile */
    }

    .cluster-top {
        width: 100px;
        height: 150px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 30;
    }

    .cluster-mid {
        width: 90px;
        height: 135px;
        left: 35%;
        top: 10px;
        z-index: 20;
        opacity: 0.8;
    }

    .cluster-back {
        width: 80px;
        height: 120px;
        left: 20%;
        top: 20px;
        z-index: 10;
        opacity: 0.6;
    }

    /* Adjust the grid for 2 columns on mobile instead of 1 or 4 */
    #sagaGrid,
    #mySagaGrid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    /* Increase card size on mobile for readable text and poster */
    .saga-selectable-card {
        min-height: 280px;
    }
    
    .memory-cluster {
        height: 240px !important;
        min-height: 240px;
    }

    .saga-card-title {
        font-size: 0.85rem !important;
    }
    .saga-card-subtitle {
        font-size: 0.6rem !important;
    }
    
    /* Make Saga titles readable on small cards */
    .saga-selectable-card .text-\[10px\] {
        font-size: 8px !important;
        padding: 8px !important;
    }

    /* Ensure saga progress overlay doesn't crowd the title on mobile */
    .saga-progress-overlay {
        bottom: 44px !important;
    }
}

#multiSelectBar {
    z-index: 400;
    /* High, but lower than the 500+ used for main Modals and Top Nav */
}

/* Ensure the checkmark is highly visible on mobile cards */
.card-checkbox {
    width: 28px;
    height: 28px;
    background: rgba(10, 12, 18, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.5);
}

/* --- LAPTOP / SMALL SCREEN HEIGHT SCALING (DESKTOP) --- */
@media (min-width: 1024px) and (max-height: 800px) {

    /* Compact the sidebar header padding so the nav has more room */
    #mainSidebar .p-8 {
        padding: 1.5rem !important;
    }

    /* Shrink the top padding on page views so content isn't pushed too far down */
    .page-view {
        padding-top: 6rem !important;
    }

    /* Prevent scrolling from causing page navigation */
    .page-view {
        overscroll-behavior: none !important;
    }

    /* Shrink page view headers for desktop website layout */
    .page-view h2 {
        font-size: 1rem !important;
        line-height: 1.1 !important;
    }

    #view-home .glow-title {
        font-size: 0.85rem !important;
        line-height: 1.15 !important;
    }
}

/* Ensure invisible scrolling is smooth on PC trackpads */
.hide-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#searchDrop,
#modalSearchDrop {
    display: none !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
}

#searchDrop:not(.hidden),
#modalSearchDrop:not(.hidden) {
    display: block !important;
}

/* --- PREVENT NOTIFICATIONS FROM BLOCKING MOBILE SEARCH --- */
@media (max-width: 1024px) {

    body.search-active-mobile #neuralToast,
    body.search-active-mobile button[onclick="toggleNotifHub()"] {
        display: none !important;
    }
}

#searchDrop button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.4);
}

/* Ensure the dropdown doesn't get too wide on mobile */
#searchDrop {
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: none;
}

#searchDrop::-webkit-scrollbar {
    display: none;
}



/* --- FLOATING QUICK ADD BUTTON --- */
.quick-add-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(2, 4, 8, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 40;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-5px);
}

.selectable-card:hover .quick-add-btn {
    opacity: 1;
    transform: translateY(0);
}

.quick-add-btn:hover {
    background: var(--color-pulse);
    border-color: var(--color-pulse);
    box-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.5);
}

/* On mobile, keep it slightly visible so users know it's there */
@media (max-width: 768px) {
    .quick-add-btn {
        opacity: 0.8;
        transform: none;
    }
}

/* --- MINIMALIST MOBILE NAV SCROLL --- */
@media (max-width: 768px) {

    /*    /* 1. The Fade Effect on the right side - Improved Frost Mask */
    .nav-edge-mask {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 60px;
        /* Deep frosted gradient that signals more content */
        background: linear-gradient(to right, transparent, rgba(10, 12, 18, 0.95));
        z-index: 10;
        transition: opacity 0.4s ease, width 0.4s ease;
        pointer-events: none;
        border-radius: 0 20px 20px 0;
    }

    .nav-at-end .nav-edge-mask {
        opacity: 0;
        width: 0;
    }

    .nav-at-end .nav-edge-mask {
        opacity: 0;
    }

    /* Small glowing accent at the very edge (Unique & Subtle) */
    .nav-edge-mask::after {
        content: '';
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        width: 2px;
        height: 15px;
        background: var(--color-pulse);
        border-radius: 99px;
        box-shadow: 0 0 10px var(--color-pulse);
        opacity: 0.6;
    }
}

/* --- NEURAL LINK: P2P SYNC STYLES --- */

/* Radar Pulse Background */
.radar-circle {
    animation: radar-expand 6s cubic-bezier(0.1, 0.5, 0.5, 1) infinite;
    opacity: 0;
}

.animation-delay-1000 {
    animation-delay: 3s;
}

@keyframes radar-expand {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }

    50% {
        opacity: 0.15;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Holographic Scanner Line */
@keyframes scan-line {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.animate-scan-line {
    animation: scan-line 3s linear infinite;
    box-shadow: 0 5px 20px rgba(var(--color-pulse-rgb), 0.8);
}

/* --- RESPONSIVE DIFF CARDS --- */
.diff-card-new {
    display: flex;
    flex-direction: column;
    background: rgba(10, 12, 18, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Base setup for the staggered entrance */
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    animation: diffCardEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    will-change: transform, opacity;
}

@keyframes diffCardEnter {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#diffCardsContainer {
    /* Ensures the scrollbar respects the boundaries and adds momentum scrolling on iOS */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* Custom scrollbar for this specific panel to make it look sleek */
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--color-pulse-rgb), 0.5) transparent;
}

/* Desktop Layout */
@media (min-width: 768px) {
    .diff-card-new {
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

.diff-card-new:hover {
    border-color: rgba(var(--color-pulse-rgb), 0.5);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.diff-card-new.deselected {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.98);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Ensure Html5QrcodeScanner internal elements don't look broken */
#qr-reader {
    border: none !important;
}

#qr-reader__scan_region {
    background: black;
}

#qr-reader__dashboard_section_csr button {
    background: var(--color-pulse) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    border: none !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    font-size: 10px !important;
    letter-spacing: 1px !important;
}

/* --- HOLOGRAPHIC SYNC ANIMATION --- */
@keyframes neuralSyncJump {
    0% {
        transform: scale(0) translateX(-150px) translateY(50px) rotate(-15deg);
        opacity: 0;
        filter: blur(5px);
    }

    20% {
        transform: scale(1.3) translateX(0px) translateY(-20px) rotate(0deg);
        opacity: 1;
        filter: blur(0px);
        box-shadow: 0 0 40px rgba(34, 197, 94, 0.8);
    }

    80% {
        transform: scale(1.3) translateX(0px) translateY(-20px) rotate(0deg);
        opacity: 1;
        filter: blur(0px);
        box-shadow: 0 0 40px rgba(34, 197, 94, 0.8);
    }

    100% {
        transform: scale(0) translateX(150px) translateY(50px) rotate(15deg);
        opacity: 0;
        filter: blur(5px);
    }
}

/* --- NETWORK TOPOLOGY TREE --- */
.topology-node {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
}

.topology-node::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0a0c12;
    border: 3px solid #a855f7;
    z-index: 2;
    transition: all 0.3s ease;
}

.topology-node.offline::before {
    border-color: #4b5563;
}

.topology-node.active::before {
    border-color: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.8);
    background: #22c55e;
}

/* --- OVERLAY SCROLL LOCK (OVERSCROLL FIX) --- */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* style.css */
.card-checkbox.hidden {
    display: none !important;
}

/* Smart Scroll Buttons */
.scroll-btn-smart {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    width: 44px;
    height: 44px;
    background: rgba(10, 12, 18, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

section:hover .scroll-btn-smart.is-active {
    opacity: 1;
    pointer-events: auto;
}

.scroll-btn-smart:hover {
    background: var(--color-pulse);
    border-color: var(--color-pulse);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 20px rgba(var(--color-pulse-rgb), 0.4);
}

.scroll-btn-smart.left {
    left: 10px;
}

.scroll-btn-smart.right {
    right: 10px;
}

/* Hide on mobile where swiping is natural */
@media (max-width: 1024px) {
    .scroll-btn-smart {
        display: none !important;
    }
}

/* --- NEW MODERN SLIDER ANIMATIONS --- */
.hero-item {
    opacity: 0;
    /* This creates a wipe effect from right to left */
    clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
    z-index: 1;
}

.hero-item.active {
    opacity: 1;
    /* Opens up to reveal the full image */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    z-index: 2;
}

/* Orbital ring belt — poster planets with spinning elliptical ring */
.hero-dot-wrapper {
    position: relative;
    width: 65px;
    height: 65px;
    flex-shrink: 0;
}

.hero-dot-wrapper {
    transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.6s ease, filter 0.6s ease;
    will-change: transform, opacity;
}

.hero-dot-wrapper .hero-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        inset -10px -10px 20px rgba(0,0,0,0.8),
        inset 5px 5px 15px rgba(255,255,255,0.4),
        0 0 10px rgba(0,0,0,0.5);
    position: relative;
}

.hero-dot-wrapper .hero-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), transparent 50%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
    z-index: 5;
}

.hero-dot-wrapper .hero-dot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* Outer orbital ring (clockwise) */
.hero-dot-wrapper::before {
    content: '';
    position: absolute;
    inset: -9px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.2);
    transform: rotateX(75deg);
    animation: orbit-ring 5s linear infinite;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.06);
    will-change: transform;
}

/* Inner orbital ring (counter-clockwise, thinner) */
.hero-dot-wrapper::after {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    transform: rotateX(75deg);
    animation: orbit-ring-reverse 7s linear infinite;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}

/* Hover card — logo or poster above planet */
.hero-dot-wrapper .hero-dot-label {
    position: absolute;
    bottom: calc(100% + 18px);
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    border-radius: 20px;
    background: rgba(10, 12, 18, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(28px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    width: max-content;
    max-width: 420px;
}

.hero-dot-wrapper:hover .hero-dot-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Arrow pointing down from card to planet */
.hero-dot-wrapper .hero-dot-label::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: rgba(10, 12, 18, 0.55);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

/* Logo type — wide horizontal with padding */
.hero-dot-label img.logo-type {
    display: block;
    max-width: 380px;
    max-height: 90px;
    object-fit: contain;
    padding: 22px 32px;
}

/* Poster type — compact thumbnail with proper aspect ratio */
.hero-dot-label img.poster-type {
    display: block;
    width: 120px;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 16px;
    margin: 10px;
}

/* Hover: rings speed up, label appears, planet brightens, poster zooms */
.hero-dot-wrapper:hover::before {
    animation-duration: 1.2s;
    border-color: rgba(255, 45, 85, 0.45);
    box-shadow: 0 0 14px rgba(255, 45, 85, 0.2);
}

.hero-dot-wrapper:hover::after {
    animation-duration: 2s;
    border-color: rgba(255, 45, 85, 0.25);
}

.hero-dot-wrapper:hover .hero-dot {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.1);
}

.hero-dot-wrapper:hover .hero-dot img {
    transform: scale(1.15);
}

/* Active: planet glows, rings turn pulse, outer ring fast */
.hero-dot-wrapper.active .hero-dot {
    border-color: rgba(255, 45, 85, 0.65);
    box-shadow: 0 0 50px rgba(255, 45, 85, 0.5), inset 0 0 20px rgba(255, 45, 85, 0.18);
}

.hero-dot-wrapper.active::before {
    border-color: rgba(255, 45, 85, 0.55);
    border-width: 3px;
    animation-duration: 2s;
    box-shadow: 0 0 18px rgba(255, 45, 85, 0.2), 0 0 40px rgba(255, 45, 85, 0.08);
}

.hero-dot-wrapper.active::after {
    border-color: rgba(255, 45, 85, 0.25);
    border-width: 2px;
    animation-duration: 3s;
}

@keyframes orbit-ring {
    to { transform: rotateX(75deg) rotate(360deg); }
}

@keyframes orbit-ring-reverse {
    to { transform: rotateX(75deg) rotate(-360deg); }
}

/* Orbital indicator belt — smooth spring transition gives the 'planets in orbit' sweep */
/* Active planet glows and stands out; the belt slides so it's always centered */
/* No per-dot CSS needed — the translateX belt slide IS the orbital animation */

/* Indicator belt viewport — smooth edge fade */
#heroDotsViewport {
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
    position: relative;
    cursor: grab;
}

#heroDotsViewport::-webkit-scrollbar {
    display: none;
}

/* Subtle ambient glow at center of belt */
#heroDotsViewport::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 85, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

#heroDotsBelt {
    position: relative;
    z-index: 1;
    /* Smooth spring for the orbital sweep — belt slides, planets appear to orbit */
    transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Slick Hover Icons for Slider */
.hero-icon-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-icon-btn:hover {
    transform: translateY(-6px) scale(1.15);
}

/* Snappy Title and Text Transitions */
#heroTitle,
#heroDesc {
    transition: opacity 0.2s ease-out, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Smart Grid Accordion for Counters */
.grid-rows-0 {
    grid-template-rows: 0fr;
}

.grid-rows-\[1fr\] {
    grid-template-rows: 1fr;
}

/* --- OVERRIDE OLD MOBILE HERO BEHAVIOR --- */
/* Search your CSS for the old "#view-home > div:first-child" and replace it with this if necessary, 
   otherwise just pasting this will overwrite the bad legacy styles causing the 95% stretch */
@media (max-width: 1024px) {
    #view-home>div:first-child {
        height: 60vh !important;
        min-height: 400px !important;
        position: relative !important;
        padding-top: 0 !important;
    }
}

/* --- TOP 10 JUMPING & GLOWING ANIMATION --- */
.top10-card {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.top10-card:hover {
    transform: translateY(-15px) scale(1.03);
}

.top10-card:hover .aspect-\[2\/3\] {
    box-shadow: 0 25px 50px rgba(var(--color-pulse-rgb), 0.3), 0 0 25px rgba(var(--color-pulse-rgb), 0.2);
    border-color: var(--color-pulse) !important;
}

/* --- TITLE GLOW HOVER UTILITY --- */
.glow-hover {
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.group:hover .glow-hover {
    color: var(--color-pulse);
    text-shadow: 0 0 15px rgba(var(--color-pulse-rgb), 0.8);
}

.glow-title {
    transition: all 0.3s ease;
}

.glow-title:hover {
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transform: translateX(5px);
}

@media (min-width: 1024px) {
    #view-home h2 {
        font-size: 1.05rem !important;
        line-height: 1.2 !important;
    }

    #view-home .glow-title {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
    }
}

/* --- BROWSER PERFORMANCE OPTIMIZATIONS --- */
/* (Removed content-visibility as it caused image un-rendering on scroll) */

/* --- HOLOGRAPHIC NEURAL MATRIX CARDS --- */
.matrix-card {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.5s ease,
                box-shadow 0.5s ease;
    will-change: transform;
    contain: layout style;
}

.holo-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    isolation: isolate;
}

/* ═══ AURORA PULSE — cinematic hover effect ═══ */

/* 1 — POSTER LENS FLARE: diagonal light sweep across the image */
.holo-wrapper::before {
    content: '';
    position: absolute;
    inset: -100%;
    width: 300%;
    height: 300%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(var(--color-pulse-rgb), 0.12) 30deg,
        transparent 60deg,
        rgba(59, 130, 246, 0.08) 120deg,
        transparent 180deg,
        rgba(var(--color-pulse-rgb), 0.06) 240deg,
        transparent 300deg
    );
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    animation: auroraSpin 6s linear infinite;
    animation-play-state: paused;
    will-change: transform;
}

.matrix-card:hover .holo-wrapper::before {
    opacity: 1;
    animation-play-state: running;
}

@keyframes auroraSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 2 — CORE BACKLIGHT: pulsing radial glow behind the card */
.matrix-card::before {
    content: '';
    position: absolute;
    inset: -24px;
    border-radius: 42px;
    background: radial-gradient(
        circle at 50% 40%,
        rgba(var(--color-pulse-rgb), 0.5) 0%,
        rgba(59, 130, 246, 0.25) 30%,
        transparent 70%
    );
    opacity: 0;
    z-index: -1;
    filter: blur(35px) brightness(1.4);
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: filter, opacity;
    transform: translateZ(0);
}

.matrix-card:hover::before {
    opacity: 1;
    animation: corePulse 2.5s ease-in-out infinite;
}

@keyframes corePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* 3 — CARD LIFT & BORDER ENERGY */
.matrix-card:hover {
    transform: translateY(-14px) scale(1.06);
    z-index: 50;
    border-color: rgba(var(--color-pulse-rgb), 0.6);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(var(--color-pulse-rgb), 0.15),
        inset 0 0 40px rgba(var(--color-pulse-rgb), 0.04);
}

/* ═══ REDUCED MOTION — kill heavy effects ═══ */
.reduced-motion .matrix-card,
.reduced-motion .matrix-card::before,
.reduced-motion .holo-wrapper::before {
    transition: none !important;
    animation: none !important;
    animation-play-state: paused !important;
}
.reduced-motion .matrix-card::before,
.reduced-motion .holo-wrapper::before {
    opacity: 0 !important;
    display: none;
}
.reduced-motion .matrix-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(var(--color-pulse-rgb), 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.reduced-motion .matrix-card:hover::before,
.reduced-motion .matrix-card:hover .holo-wrapper::before {
    opacity: 0 !important;
    display: none;
}

/* Disable aurora pulse globally */
.no-card-glow .matrix-card::before,
.no-card-glow .holo-wrapper::before {
    opacity: 0 !important;
    display: none !important;
}
.no-card-glow .matrix-card:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border-color: rgba(var(--color-pulse-rgb), 0.4);
}

/* --- BONUS: NEURAL FOCUS MODE --- */
/* Top 10 section ALWAYS dims siblings, even on mobile touch */
#row-top10:has(.group:hover) .group:not(:hover) {
    opacity: 0.2;
    filter: grayscale(100%) blur(2px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Other grids/rows only dim siblings on desktop (where true hover is supported) */
@media (hover: hover) {
    .grid:has(.matrix-card:hover) .matrix-card:not(:hover),
    .hide-scroll:not(#row-top10):has(.group:hover) .group:not(:hover) {
        opacity: 0.2;
        filter: grayscale(100%) blur(2px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Ensure the hovered item stands out perfectly */
.matrix-card:hover,
.hide-scroll .group:hover {
    opacity: 1 !important;
    filter: grayscale(0%) blur(0px) !important;
    z-index: 50;
}

/* Disable neural focus dim */
.no-neural-focus #row-top10:has(.group:hover) .group:not(:hover),
.no-neural-focus .grid:has(.matrix-card:hover) .matrix-card:not(:hover),
.no-neural-focus .hide-scroll:not(#row-top10):has(.group:hover) .group:not(:hover) {
    opacity: 1 !important;
    filter: none !important;
}

/* --- PREMIUM DROPDOWN STYLING --- */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(var(--color-pulse-rgb),0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.2rem;
    padding-right: 3.5rem !important;
    cursor: pointer;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

select:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(var(--color-pulse-rgb), 0.4);
    transform: translateY(-1px);
}

select option {
    background: #0a0c12;
    color: white;
    padding: 15px;
}

/* --- SKELETON LOADING ENGINE --- */
.skeleton {
    background: linear-gradient(90deg, #0a0c12 25%, #161a24 50%, #0a0c12 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite linear;
}

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

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

/* Calendar & Snapshot Hub Styling */
#calendarGrid::-webkit-scrollbar,
#snapshotList::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.day-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-cell:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(var(--color-pulse-rgb), 0.3);
    transform: translateY(-5px);
}

.calendar-poster {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.calendar-poster:hover {
    transform: scale(1.1) rotate(2deg);
    z-index: 50;
}

/* Calendar Type Highlights */
.bg-pulse\/10 {
    background: rgba(var(--color-pulse-rgb), 0.1);
}

.bg-kdrama\/10 {
    background: rgba(34, 197, 94, 0.1);
}

#calendarMonthLabel {
    text-shadow: 0 0 20px rgba(var(--color-pulse-rgb), 0.2);
    position: sticky;
    top: 0;
    z-index: 50;
}

#calendarPageSelect {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: white !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

#calendarPageSelect option {
    background: #090b10;
    color: white;
}

.day-cell {
    animation: slideUp 0.5s ease-out backwards;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.day-cell:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--color-pulse-rgb), 0.4);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

#calendarGrid .day-cell:nth-child(n) {
    animation-delay: calc(0.02s * n);
}

#mainSidebar.collapsed button#calendarTrigger,
body.sidebar-collapsed #mainSidebar button#calendarTrigger {
    min-width: auto;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    justify-content: center;
}

#mainSidebar.collapsed button#calendarTrigger span,
body.sidebar-collapsed #mainSidebar button#calendarTrigger span {
    display: none !important;
}

@media (min-width: 1024px) {
    #calendarGrid .day-cell {
        min-height: 240px;
    }
}

/* Modal Scroll Lock */
body.modal-open {
    overflow: hidden !important;
    padding-right: 15px;
    /* Prevent layout shift */
}

/* Matrix Column Separators */
@media (min-width: 1024px) {
    #calDayContent>.grid>div {
        border-right: 1px solid rgba(255, 255, 255, 0.05);
        padding-right: 2rem;
    }

    #calDayContent>.grid>div:last-child {
        border-right: none;
    }
}

.poster-loading {
    filter: blur(10px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.poster-loaded {
    filter: blur(0);
    opacity: 1;
}

/* --- OPTIMIZED SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-pulse-rgb), 0.2);
    border-radius: 10px;
    transition: all 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-pulse-rgb), 0.5);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ========================================================= */
/* NEURAL UPGRADES: MOBILE CALENDAR & PERFORMANCE            */
/* ========================================================= */



#clockContainer:hover #clockHoverCard {
    opacity: 1 !important;
    transform: translateX(-50%) translateY(-0.25rem) !important;
}

#clockHoverCard {
    opacity: 0;
    transform: translateX(-50%) translateY(0.5rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

#clockHoverCardInner {
    pointer-events: auto;
}



/* Prevent momentum scrolling from triggering page navigation */
#view-calendar {
    touch-action: pan-y !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
}

#calendarGrid {
    overscroll-behavior: contain !important;
}

/* 2. Instant Lazy Loading Animations (Zero Lag) */
img {
    will-change: transform, opacity, filter;
}

.poster-loading {
    filter: blur(15px);
    opacity: 0;
    transform: scale(1.05);
}

/* ========================================================= */
/* MOBILE SETTINGS MODAL REDESIGN                            */
/* ========================================================= */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    #settingsModal {
        justify-content: center !important;
        align-items: center !important;
        padding: 1rem !important;
    }

    #settingsModal .relative {
        width: 100% !important;
        max-width: 95vw !important;
        max-height: 85vh !important;
        border-radius: 30px !important;
        flex-direction: column !important;
        margin: auto !important;
    }

    #settingsModal .w-full.md\:w-64 {
        width: 100% !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-right: none !important;
        height: auto !important;
        padding: 1rem 1rem !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        gap: 8px !important;
    }

    #settingsModal .settings-tab-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        scroll-snap-align: start !important;
        padding: 0.75rem 1rem !important;
        font-size: 9px !important;
    }

    #settingsModal .flex-1.p-4 {
        width: 100% !important;
        padding: 1.5rem 1rem !important;
        max-height: calc(85vh - 100px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }



    #settingsModal .settings-tab-content > div {
        margin-bottom: 2rem !important;
    }

    #settingsModal h3 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    #settingsModal .h-px {
        margin: 2rem 0 !important;
    }

    #settingsModal select,
    #settingsModal input {
        width: 100% !important;
        max-width: none !important;
    }

    #settingsModal .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    #settingsModal button {
        padding: 0.75rem !important;
        font-size: 9px !important;
    }

    /* Show mobile close button only on mobile */
    #settingsModal .md\:hidden {
        display: flex !important;
    }

    /* Hide desktop close button on mobile */
    #settingsModal .hidden.md\:flex {
        display: none !important;
    }

    /* Make server selector more prominent on mobile */
    #settingsModal .settings-tab-content > div:first-child {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }
}


/* 3. Global Skeleton Base Optimization */
.skeleton {
    background: linear-gradient(90deg, rgba(10, 12, 18, 1) 0%, rgba(30, 35, 45, 1) 50%, rgba(10, 12, 18, 1) 100%);
    background-size: 200% 100%;
    animation: premium-skeleton-pulse 1.2s infinite linear;
}

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

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

/* 4. Fix Track On Radar Hover Transition */
.fa-radar,
.fa-satellite-dish {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

button:hover .fa-radar,
button:hover .fa-satellite-dish {
    transform: scale(1.2) rotate(15deg);
}

/* =========================================================== */
/* CALENDAR SCROLL LOCK & MOBILE ITEM LIMIT                     */
/* =========================================================== */

/* All screens: items always in a column, no horizontal overflow */
.cal-items-list {
    flex-direction: column !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Individual items: never overflow container horizontally */
.day-cell .group\/calitem,
.day-cell .group\/global {
    overflow: hidden !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 0 !important;
}

/* Mobile: cap to ~2 visible items, rest scrolls vertically */
@media (max-width: 768px) {
    .day-cell {
        max-height: none !important;
        min-height: 220px !important;
    }

    .cal-items-list {
        max-height: 160px !important;
    }

    /* Compact padding on mobile */
    .day-cell .group\/calitem,
    .day-cell .group\/global {
        padding: 6px 8px !important;
    }

    /* Smaller poster on mobile */
    .day-cell .group\/calitem img,
    .day-cell .group\/global img {
        width: 32px !important;
        height: 44px !important;
    }
}

/* =========================================================== */
/* MOBILE SEARCH RESULTS: LARGER TOUCH TARGETS & FULL WIDTH     */
/* =========================================================== */
@media (max-width: 640px) {
    #calendarSearchResults > div {
        padding: 14px 16px !important;
        gap: 12px !important;
    }
    #calendarSearchResults img,
    #calendarSearchResults .w-8.h-12 {
        width: 40px !important;
        height: 56px !important;
    }
    #calendarSearchResults .text-\[10px\] {
        font-size: 12px !important;
    }
    #calendarSearchResults .text-\[8px\] {
        font-size: 10px !important;
    }
    #calendarSearchResults i.fa-plus {
        font-size: 14px !important;
    }
}

/* =========================================================== */
/* CALENDAR ITEM TITLE: FULL WRAP ON MOBILE                     */
/* =========================================================== */
@media (max-width: 1024px) {
    /* Remove truncation so the full title is readable */
    .day-cell .group\/calitem .min-w-0 div:first-child,
    .day-cell .group\/global .min-w-0 div:first-child {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        word-break: break-word !important;
        line-height: 1.3 !important;
    }
}
/* =========================================================== */
/* MODAL STAGGER ANIMATIONS & GLASSMORPHISM                     */
/* =========================================================== */

/* Hero section entrance — sweeps up with scale and blur-to-sharp */
@keyframes modalHeroReveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.97);
        filter: blur(6px);
    }
    60% {
        opacity: 1;
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* Content cards — rise up with subtle scale */
@keyframes modalRevealUp {
    0% {
        opacity: 0;
        transform: translateY(28px) scale(0.98);
        filter: blur(4px);
    }
    50% {
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* Sidebar entrance — slides from the right */
@keyframes modalRevealRight {
    0% {
        opacity: 0;
        transform: translateX(30px) scale(0.97);
        filter: blur(3px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0px);
    }
}

.modal-stagger-1 { animation: modalHeroReveal  0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.05s; }
.modal-stagger-2 { animation: modalRevealUp    0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.12s; }
.modal-stagger-3 { animation: modalRevealUp    0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.18s; }
.modal-stagger-4 { animation: modalRevealUp    0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.24s; }
.modal-stagger-5 { animation: modalRevealUp    0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.30s; }
.modal-stagger-6 { animation: modalRevealRight 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; animation-delay: 0.20s; }

/* Dynamic Color Extraction Variable Override */
:root {
  --modal-extracted-color: var(--color-pulse);
  --modal-extracted-color-rgb: var(--color-pulse-rgb);
}

/* Update Modal Specific Glowing Classes to use Dynamic Color */
#modal .bg-pulse { background-color: var(--modal-extracted-color) !important; }
#modal .text-pulse { color: var(--modal-extracted-color) !important; }
#modal .border-pulse { border-color: var(--modal-extracted-color) !important; }
#modal .bg-pulse\/10 { background-color: rgba(var(--modal-extracted-color-rgb), 0.1) !important; }
#modal .bg-pulse\/20 { background-color: rgba(var(--modal-extracted-color-rgb), 0.2) !important; }
#modal .bg-pulse\/30 { background-color: rgba(var(--modal-extracted-color-rgb), 0.3) !important; }
#modal .border-pulse\/20 { border-color: rgba(var(--modal-extracted-color-rgb), 0.2) !important; }
#modal .border-pulse\/30 { border-color: rgba(var(--modal-extracted-color-rgb), 0.3) !important; }
#modal .shadow-pulse\/30 { box-shadow: 0 10px 30px rgba(var(--modal-extracted-color-rgb), 0.3) !important; }
#modal .shadow-pulse\/40 { box-shadow: 0 10px 40px rgba(var(--modal-extracted-color-rgb), 0.4) !important; }
#modal .hover\:text-pulse:hover { color: var(--modal-extracted-color) !important; }
#modal .hover\:border-pulse:hover { border-color: var(--modal-extracted-color) !important; }

/* Modal Stagger Container Fix */
#modalContent { overflow-x: hidden; }

/* --- PREMIUM WATCH BUTTON --- */
.premium-watch-btn {
    position: relative;
    padding: 2px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    border: none;
    cursor: pointer;
    outline: none;
    transform: perspective(1000px) rotateX(0deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    width: 100%;
    min-width: 180px;
}

@media (min-width: 1024px) {
    .premium-watch-btn {
        width: auto;
    }
}

.premium-watch-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(45deg, #ff2d55, #f59e0b, #3b82f6, #ff2d55);
    background-size: 300% 300%;
    animation: gradientMove 4s ease infinite;
    opacity: 0.8;
    z-index: 0;
    transition: opacity 0.3s ease;
}

.premium-watch-btn .btn-glow {
    position: absolute;
    inset: -5px;
    background: linear-gradient(45deg, #ff2d55, #f59e0b, #3b82f6, #ff2d55);
    background-size: 300% 300%;
    animation: gradientMove 4s ease infinite;
    filter: blur(20px);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s ease;
}

.premium-watch-btn .btn-content {
    position: relative;
    background: rgba(10, 12, 18, 0.9);
    border-radius: 18px;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    z-index: 1;
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: white;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.premium-watch-btn .btn-icon {
    font-size: 16px;
    background: linear-gradient(135deg, #ff2d55, #f59e0b);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(255, 45, 85, 0.4));
    transition: transform 0.3s ease;
}

.premium-watch-btn:hover {
    transform: perspective(1000px) translateY(-4px) scale(1.02);
}

.premium-watch-btn:hover .btn-glow {
    opacity: 0.6;
}

.premium-watch-btn:hover .btn-content {
    background: rgba(10, 12, 18, 0.7);
}

.premium-watch-btn:hover .btn-icon {
    transform: scale(1.2) rotate(5deg);
}

.premium-watch-btn:active {
    transform: translateY(2px) scale(0.98);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- INLINE TRAILER PLAYER --- */
#trailerModal {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#trailerModal > div {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#modal,
#sagaModal {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    will-change: transform, opacity;
}

#modal {
    z-index: 100 !important;
}

#sagaModal {
    z-index: 120 !important;
}

#modal:not(.hidden),
#sagaModal:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

/* Performance: contain layout for off-screen sections */
.page-view {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.32s ease, transform 0.32s ease;
    will-change: transform, opacity;
}

.page-view:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    contain: layout style;
}

/* Smooth scrolling for the whole app */
html {
    scroll-behavior: smooth;
}

/* GPU acceleration for animations */
.animate-in,
.hover\\:scale-105:hover,
.group-hover\\:scale-110:hover .group-hover\\:scale-110 {
    will-change: transform;
}

/* Image decode hint */
img[decoding="async"] {
    image-rendering: auto;
}

/* Prevent layout shifts from lazy images */
img[loading="lazy"] {
    min-height: 1px;
}

/* Smooth transitions on interactive elements */
button, a, .cursor-pointer {
    -webkit-tap-highlight-color: transparent;
}

/* ============================
   Neural Dust — cursor particle trail
   ============================ */
#neuralDustCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.6;
}

/* ============================
   Personal Timeline (Calendar)
   ============================ */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-pulse), rgba(255,255,255,0.05));
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-pulse);
    border: 2px solid #020408;
    box-shadow: 0 0 12px rgba(var(--color-pulse-rgb), 0.5);
}
.timeline-item:last-child::before { display: none; }

/* Radar Pulse glow */
@keyframes radarGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(var(--color-pulse-rgb), 0.3); }
    50% { box-shadow: 0 0 16px rgba(var(--color-pulse-rgb), 0.8); }
}
.radar-pulse-dot {
    animation: radarGlow 2s ease-in-out infinite;
}

/* ============================
   Shuffle Mode animation
   ============================ */
@keyframes shuffleSpin {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    50% { transform: rotate(180deg) scale(0.6); opacity: 0.3; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}
.shuffle-active {
    animation: shuffleSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================
   Saga Web - radial graph
   ============================ */
#sagaWebCanvas {
    width: 100%;
    height: 200px;
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
}

/* ============================
   Deadzone pulse
   ============================ */
@keyframes deadzonePulse {
    0%, 100% { border-color: rgba(239, 68, 68, 0.2); }
    50% { border-color: rgba(239, 68, 68, 0.6); }
}
.deadzone-card {
    animation: deadzonePulse 3s ease-in-out infinite;
}

/* ============================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================ */
@media (max-width: 1023px) {
    * {
        /* Reduce heavy painting operations on mobile while retaining acceptable aesthetic */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
    }
    
    /* Re-enable critical shadows selectively where needed */
    .shadow-lg, .shadow-xl, .shadow-2xl, .shadow-md {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Fake the glass look with semi-transparent backgrounds instead of expensive blurs */
    .backdrop-blur-md, .backdrop-blur-xl, .backdrop-blur-2xl, .backdrop-blur-3xl, .bg-dark\/90, .bg-dark\/80 {
        background-color: rgba(10, 12, 18, 0.95) !important;
    }
}


/* Magnificent Sidebar Active Indicators */
.sidebar-link {
    border-left-width: 3px;
    border-left-color: transparent;
}

.sidebar-link.active {
    border-left-color: var(--color-pulse) !important;
    background: rgba(var(--color-pulse-rgb), 0.12) !important;
    color: white !important;
    text-shadow: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    border-radius: 999px 0 0 999px;
}

/* --- HOVER PREVIEW CARD --- */
.hover-preview-card {
    animation: previewFadeIn 0.2s ease-out;
    transform-origin: top left;
}

@keyframes previewFadeIn {
    from { opacity: 0; transform: translateY(4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Neon text effects for preview card */
.neon-text-pulse {
    text-shadow: 0 0 7px rgba(255, 45, 85, 0.8), 0 0 14px rgba(255, 45, 85, 0.4);
}

.neon-text-green {
    text-shadow: 0 0 7px rgba(34, 197, 94, 0.8), 0 0 14px rgba(34, 197, 94, 0.4);
}

.neon-text-blue {
    text-shadow: 0 0 7px rgba(59, 130, 246, 0.8), 0 0 14px rgba(59, 130, 246, 0.4);
}

.neon-text-purple {
    text-shadow: 0 0 7px rgba(168, 85, 247, 0.8), 0 0 14px rgba(168, 85, 247, 0.4);
}

.neon-text-amber {
    text-shadow: 0 0 7px rgba(245, 158, 11, 0.8), 0 0 14px rgba(245, 158, 11, 0.4);
}

.neon-text-sky {
    text-shadow: 0 0 7px rgba(14, 165, 233, 0.8), 0 0 14px rgba(14, 165, 233, 0.4);
}

/* Hover preview backdrop blur intensity */
#hoverPreview {
    will-change: transform, opacity;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Disable insights backdrop images */
.no-backdrop-images .insights-card-bg {
    display: none !important;
}

.sidebar-link.active i {
    color: var(--color-pulse) !important;
    filter: none;
    transform: scale(1.05);
}

/* Hover preview synopsis glow — soft luminance for readability on dark bg */
.glow-synopsis {
    text-shadow: 0 0 6px rgba(255,255,255,0.12), 0 0 12px rgba(255,45,85,0.08);
}
