/* 
 * CRITICAL DESIGN SYSTEM - ORBTES AESTHETIC 
 * "Legendary" Gaming Platform Vibe
 */

:root {
    /* Color Palette */
    --bg-deep: #030712;
    /* The Void */
    --bg-surface: #0B0F19;
    /* Surface Card */
    --bg-glass: rgba(15, 23, 42, 0.6);
    /* Glass */

    --primary-glow: #6366f1;
    /* Indigo */
    --primary-accent: #8b5cf6;
    /* Violet */
    --secondary-accent: #06b6d4;
    /* Cyan */

    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Inter', sans-serif;
}

/* --- Base --- */
html {
    overflow-x: hidden;
    /* Device Safe Area Settings for Notches, Curved Edges & Chins (iOS/Huawei/MIUI) */
    --sa-top: env(safe-area-inset-top, 0px);
    --sa-bottom: env(safe-area-inset-bottom, 0px);
    --sa-left: env(safe-area-inset-left, 0px);
    --sa-right: env(safe-area-inset-right, 0px);
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums; /* Critical for unified numbers */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
    min-height: 100vh;
    min-width: 320px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Universal OS safe area handling */
    padding-top: var(--sa-top);
    padding-bottom: var(--sa-bottom);
    padding-left: var(--sa-left);
    padding-right: var(--sa-right);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    color: white;
}

/* Global Standardized Page Headers */
.page-heading-container {
    padding-top: 2rem;
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

@media (min-width: 768px) {
    .page-heading-container {
        padding-top: 3.5rem;
        padding-bottom: 2.5rem;
        margin-bottom: 3.5rem;
    }
}

.page-heading {
    font-size: clamp(2.5rem, 5vw, 3rem);
    font-family: var(--font-heading);
    font-weight: 900;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    /* Legendary Solid Neon Text */
    color: #f8fafc;
    /* Snappy, Sharp Layered Glow */
    text-shadow:
        0 0 5px rgba(255, 255, 255, 0.5),
        0 0 15px rgba(99, 102, 241, 0.4),
        0 0 25px rgba(6, 182, 212, 0.2);
    margin: 0;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

a {
    transition: all 0.3s ease;
}

/* --- Components: Cards (Glassmorphism 2.0) --- */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* --- Components: Buttons (Neon Glows & Minimum Touch Targets) --- */
button,
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    /* Essential Minimum Mobile Touch Target */
}

.btn-legendary {
    background: linear-gradient(135deg, var(--primary-glow), var(--primary-accent));
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-legendary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.btn-outline:hover {
    border-color: var(--secondary-accent);
    color: var(--secondary-accent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* --- Animations --- */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

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

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

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s infinite;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(3, 7, 18, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    padding-bottom: calc(1rem + var(--sa-bottom));
    /* Add safe area to mobile nav */
    justify-content: space-around;
    z-index: 50;
}

.mobile-nav-item {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    gap: 0.25rem;
}

.mobile-nav-item.active {
    color: var(--secondary-accent);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

@media (max-width: 953px) {
    .mobile-nav {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }

    body {
        padding-bottom: calc(80px + var(--sa-bottom));
        /* Space for mobile nav + chin */
    }
}

/* --- Premium Global Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(3, 7, 18, 0.5); /* Very subtle deep background */
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.8), rgba(139, 92, 246, 0.8));
}

/* Specific thinner scrollbar for internal containers (like modals) */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.6), rgba(139, 92, 246, 0.6));
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, rgba(99, 102, 241, 1), rgba(139, 92, 246, 1));
}

/* --- Bracket Grid Visualization --- */
.bracket-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    overflow-x: auto;
    padding: 2rem 0;
}

.match-pair {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.match-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
}

.match-card.winner {
    border-color: var(--secondary-accent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* --- Forms (Orbtes Style) --- */
.input-legendary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}

.input-legendary:focus {
    border-color: var(--primary-glow);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    outline: none;
    background: rgba(255, 255, 255, 0.05);
}

/* Global Scroll Lock for Modals */
.modal-scroll-lock {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Global Animation Kill Switch */
.animations-paused * { animation-play-state: paused !important; transition: none !important; }

/* Premium Metallic Headers (Optimized Global) */
.cyber-header {
    background: linear-gradient(110deg, #e2e8f0 0%, #ffffff 30%, #a5b4fc 70%, #e2e8f0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(165, 180, 252, 0.3);
    animation: metallicShimmer 6s linear infinite;
    transform: translateZ(0);
}
@keyframes metallicShimmer {
    to {
        background-position: 200% center;
    }
}


/* Added from auth.php */
    /* Chrome Auto-fill Glassmorphism Override (Prevents Yellow/White Solid Flash) */
    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s !important;
        -webkit-text-fill-color: white !important;
    }

    /* Force Native Dropdowns to embrace the Dark Mode glass aesthetic */
    select option {
        background-color: #0f172a;
        color: white;
        padding: 10px;
        font-family: inherit;
    }

    .font-handwriting {
        font-family: 'Dancing Script', cursive;
    }

    .font-signature {
        font-family: 'Great Vibes', cursive;
    }

    /* New God-Level Styles */
    .font-formal {
        font-family: 'Merriweather', serif;
    }

    .paper-texture {
        /* Subtle off-white CSS noise texture (#fcfcfc with a faint grain) */
        background-color: #fcfcfc;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    }

    .perspective-\[1000px\] {
        perspective: 1000px;
    }

    .transform-style-3d {
        transform-style: preserve-3d;
    }

    /* Glitch Effect */
    .glitch-text {
        position: relative;
    }

    .glitch-text::before,
    .glitch-text::after {
        content: attr(data-text);
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000;
        opacity: 0.8;
    }

    .glitch-text::before {
        left: 2px;
        text-shadow: -1px 0 #ff00c1;
        clip: rect(44px, 450px, 56px, 0);
        animation: glitch-anim 5s infinite linear alternate-reverse;
    }

    .glitch-text::after {
        left: -2px;
        text-shadow: -1px 0 #00fff9;
        clip: rect(44px, 450px, 56px, 0);
        animation: glitch-anim2 5s infinite linear alternate-reverse;
    }

    @keyframes glitch-anim {
        0% {
            clip: rect(12px, 9999px, 81px, 0);
        }

        5% {
            clip: rect(89px, 9999px, 4px, 0);
        }

        10% {
            clip: rect(46px, 9999px, 12px, 0);
        }

        100% {
            clip: rect(32px, 9999px, 78px, 0);
        }
    }

    /* Warp Lines */
    .warp-lines {
        background: repeating-radial-gradient(circle at center, transparent 0, transparent 20px, rgba(99, 102, 241, 0.2) 21px, transparent 22px);
        animation: warpZoom 0.2s linear infinite;
        transform-origin: center;
    }

    @keyframes warpZoom {
        0% {
            transform: scale(1);
        }

        100% {
            transform: scale(2);
        }
    }

    /* VAR Scan Effect */
    .var-scan-line {
        width: 100%;
        height: 2px;
        background: #ef4444;
        /* Red for VAR */
        box-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
        position: absolute;
        top: 0;
        left: 0;
        animation: var-scan 1.5s ease-in-out infinite alternate;
        z-index: 10;
    }

    @keyframes var-scan {
        0% {
            top: 10%;
            opacity: 0.5;
        }

        100% {
            top: 90%;
            opacity: 1;
        }
    }

    .var-monitor {
        background: repeating-linear-gradient(0deg,
                rgba(0, 0, 0, 0.15),
                rgba(0, 0, 0, 0.15) 1px,
                transparent 1px,
                transparent 2px);
        background-size: 100% 4px;
        animation: monitor-flicker 0.1s infinite;
    }

    @keyframes monitor-flicker {
        0% {
            opacity: 0.95;
        }

        100% {
            opacity: 1;
        }
    }

    /* Trophy God Rays */
    .god-ray {
        position: absolute;
        width: 60px;
        height: 300px;
        background: linear-gradient(to bottom, rgba(255, 215, 0, 0.6), transparent);
        transform-origin: top center;
        filter: blur(8px);
        animation: spin-rays 8s linear infinite;
        top: 50%;
        left: 50%;
        z-index: -1;
    }

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

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

    /* Confetti */
    .confetti-piece {
        position: absolute;
        width: 10px;
        height: 10px;
        background-color: #ffd700;
        animation: confetti-fall 3s linear forwards;
    }

    @keyframes confetti-fall {
        0% {
            transform: translateY(-100vh) rotate(0deg);
            opacity: 1;
        }

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

    /* 3D Trophy Float */
    .trophy-float {
        animation: trophy-bounce 3s ease-in-out infinite;
    }

    @keyframes trophy-bounce {

        0%,
        100% {
            transform: translateY(0) scale(1);
            filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
        }

        50% {
            transform: translateY(-10px) scale(1.05);
            filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8));
        }
    }
