@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/space-grotesk.woff2') format('woff2');
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('fonts/inter.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

body {
    background-color: #000000;
    /* Pure Space Black */
    overflow-x: hidden;
    color: #ffffff;
}

/* One Canvas App Mode (index.php) */
body:not(.standalone-page) {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.standalone-page {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
    scrollbar-gutter: stable;
}

/* Custom Scrollbar for Standalone Pages - Target both html and body */
html:has(.standalone-page)::-webkit-scrollbar,
.standalone-page::-webkit-scrollbar {
    width: 8px;
}

html:has(.standalone-page)::-webkit-scrollbar-track,
.standalone-page::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

html:has(.standalone-page)::-webkit-scrollbar-thumb,
.standalone-page::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

html:has(.standalone-page)::-webkit-scrollbar-thumb:hover,
.standalone-page::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.6);
    background-clip: padding-box;
}

/* Firefox scrollbar */
html:has(.standalone-page),
.standalone-page {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.3) rgba(0, 0, 0, 0.3);
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    contain: strict;
    touch-action: none;
}

/* App Overlay Window */
.content-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(5, 5, 5, 0.85);
    /* Darker for legibility */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    border-radius: 24px;
    padding: 0;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.content-overlay.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* Integrated Scrollbar for Overlays */
.content-overlay {
    scrollbar-gutter: stable;
    overflow-y: overlay;
    /* Older browsers */
    overflow-y: auto;
}

.content-overlay::-webkit-scrollbar {
    width: 6px;
}

.content-overlay::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 20px;
    /* Keep scrollbar away from the very top/bottom rounded edges */
}

.content-overlay::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    /* Inset look */
    background-clip: padding-box;
}

.content-overlay::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.5);
    background-clip: padding-box;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 243, 255, 0.2);
}

/* Unified Command Bar */
#command-bar {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#command-container {
    background: rgba(10, 10, 10, 0.7);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(0, 243, 255, 0.15);
    border-radius: 999px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8),
        0 0 15px rgba(0, 243, 255, 0.05);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

#command-bar button {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
}

#command-bar button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 243, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#command-bar button:hover::after {
    opacity: 1;
}

@media (max-width: 768px) {
    #command-bar {
        bottom: 2rem;
        width: 95%;
    }

    #command-container {
        padding: 0.4rem;
        border-radius: 20px;
    }
}

.neon-text {
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5), 0 0 20px rgba(0, 243, 255, 0.2);
}

/*
[x] Phase 8: Scrollbar & Layout Polish
    - [x] Refine custom scrollbars in style.css
    - [x] Ensure overlays handle overflow without clipping scrollbars
    - [x] Verify scrollbar alignment on various viewports
*/
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

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

0% {
    left: -40%;
}

100% {
    left: 100%;
}
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #D80828;
    border-radius: 50%;
    opacity: 0.7;
    pointer-events: none;
    animation-iteration-count: infinite;
}

@keyframes moveTop {
    0% {
        transform: translateY(110vh) translateX(-50px) scale(0.5);
        opacity: 0;
    }

    10%,
    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) translateX(50px) scale(1);
        opacity: 0;
    }
}

@keyframes moveBottom {
    0% {
        transform: translateY(-10vh) translateX(50px) scale(0.5);
        opacity: 0;
    }

    10%,
    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) translateX(-50px) scale(1);
        opacity: 0;
    }
}

@keyframes moveLeft {
    0% {
        transform: translateX(110vw) translateY(-50px) scale(0.5);
        opacity: 0;
    }

    10%,
    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(-10vw) translateY(50px) scale(1);
        opacity: 0;
    }
}

@keyframes moveRight {
    0% {
        transform: translateX(-10vw) translateY(50px) scale(0.5);
        opacity: 0;
    }

    10%,
    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(110vw) translateY(-50px) scale(1);
        opacity: 0;
    }
}

/* System Menu Scrollbar & Mobile Fix */
.sys-menu-nav {
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.3) transparent;
}

.sys-menu-nav::-webkit-scrollbar {
    width: 4px;
}

.sys-menu-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sys-menu-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 10px;
}

@media (max-width: 640px) {
    .sys-menu-nav {
        right: 1.5rem;
        left: 1.5rem;
        width: auto;
        top: 6rem;
        max-height: 75vh;
    }
}

/* Clean Branding Loader */
#loader {
    position: fixed;
    inset: 0;
    background: #050505;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.loader-logo-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-logo-glow {
    position: absolute;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle at center, rgba(0, 243, 255, 0.15) 0%, transparent 70%);
    filter: blur(20px);
    z-index: -1;
    animation: branding-glow 3s ease-in-out infinite alternate;
}

@keyframes branding-glow {
    from {
        transform: scale(0.9);
        opacity: 0.5;
    }

    to {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes logo-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(0, 243, 255, 0.2));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(0, 243, 255, 0.4));
    }
}

.animate-logo-pulse {
    animation: logo-pulse 3s ease-in-out infinite;
}

.loader-conduit {
    animation: conduit-flow 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes conduit-flow {
    0% {
        transform: translateX(-100%);
    }

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