html.light-mode {
    filter: invert(1) hue-rotate(180deg);
    background-color: white;
}
html.light-mode img, 
html.light-mode video, 
html.light-mode iframe, 
html.light-mode .no-invert {
    filter: invert(1) hue-rotate(180deg);
}
/* Fix muddy text contrast in light mode */
html.light-mode .text-slate-300,
html.light-mode .text-slate-400,
html.light-mode .text-slate-500 {
    color: #d1d1d1 !important; /* Inverts to #2e2e2e crisp dark gray */
}
html.light-mode .text-white {
    color: #ffffff !important; /* Inverts to pure black */
}

/* Global viewport & overflow protection */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Mobile Navigation Architecture */
@media (max-width: 768px) {
    #nav-menu {
        display: none !important;
    }
    #nav-menu.active {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 80px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        background: rgba(8, 14, 30, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(212, 163, 69, 0.3) !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
        padding: 1.5rem 1.5rem calc(2.5rem + env(safe-area-inset-bottom, 0px)) 1.5rem !important;
        gap: 1.5rem !important;
        z-index: 9998 !important;
        box-sizing: border-box !important;
    }
    #nav-menu.active .nav-links {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    #nav-menu.active .nav-links a {
        display: block !important;
        width: 100% !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 1.05rem !important;
        font-weight: 500 !important;
        color: #F8FAFC !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        transition: color 0.15s ease, padding-left 0.15s ease !important;
    }
    #nav-menu.active .nav-links a:hover {
        color: #D4A345 !important;
        padding-left: 0.85rem !important;
    }
    #nav-menu.active #nav-auth-container,
    #nav-menu.active .nav-auth {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 0.85rem !important;
        margin-top: 0.5rem !important;
        padding-top: 1rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    #nav-menu.active .login-link,
    #nav-menu.active .join-link,
    #nav-menu.active #logout-btn {
        display: flex !important;
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.85rem 1rem !important;
        border-radius: 0.5rem !important;
    }
}
