/* =========== CSS Variables for Theming =========== */
:root {
    --bg-primary: #F7F9FC; /* Very light, almost white blue */
    --bg-hero: #EDF2F7;
    --bg-secondary: #FFFFFF;
    --brand-primary: #00A8FF; /* A more vibrant, electric blue */
    --brand-secondary: #0077B6;
    --text-primary: #02182B; /* Darker, richer navy */
    --text-secondary: #4A5568;
    --border-color: #E2E8F0;
}

/* Basic Reset and Font */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    opacity: 0; /* Initially hide body content */
    animation: fadeIn 0.5s ease-in-out forwards;
    animation-delay: 1.5s; /* Match new JS timeout */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* FULL SCREEN BACKDROP (TRANSPARENT GLASS) */
.auth-screen {
    position: fixed;
    inset: 0;

    background: rgba(247, 249, 252, 0.6); /* Use light background color with opacity */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    display: flex;
    justify-content: center;
    align-items: center;

    z-index: 5000;
    padding: 20px;
}

.auth-screen.hidden {
    display: none;
}

/* CLEAN WHITE CARD */
.auth-card {
    width: 100%;
    max-width: 380px;

    background: var(--bg-secondary); /* Solid white background */
    border-radius: 16px;
    padding: 35px;

    text-align: center;

    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); /* Softer, more professional shadow */
}

/* CLOSE (X) BUTTON */
.auth-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 30px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* TITLE */
.auth-card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 700;
}

/* INPUT FIELDS */
.auth-card input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;

    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary); /* Light grey background for input */

    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.auth-card input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 8px hsla(202, 100%, 50%, 0.2);
}

/* MAIN BUTTON (NO ANIMATION) */
#auth-button {
    width: 100%;
    padding: 14px;
    margin-top: 12px;

    background: var(--brand-primary);
    color: white;
    font-size: 16px;

    border: none;
    border-radius: 10px;
    
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#auth-button:hover {
    background: var(--brand-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px hsla(202, 100%, 50%, 0.6);
}

/* TOGGLE TEXT */
.auth-toggle {
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-toggle span {
    color: var(--brand-primary);
    cursor: pointer;
    font-weight: 600;
}

/* GOOGLE SIGN-IN BUTTON */
.google-btn {
    margin-top: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    width: 100%;
    padding: 12px;

    background: #ffffff;
    color: #000;

    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.15);

    cursor: pointer;
    font-weight: 600;
}

.google-btn img {
    width: 22px;
}

/* =========== All Games Screen Styles =========== */
.all-games-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 99; /* Below header (100) but above main content */
    overflow-y: auto; /* Allow scrolling if content is long */
    padding-top: 100px; /* Space for the sticky header */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    visibility: hidden;
}

.all-games-screen:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.all-games-screen.hidden {
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
}

.all-games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.all-games-header h2 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
}

.all-games-close {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.all-games-close:hover {
    color: var(--text-primary);
}

.all-games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
/* =========== Preloader Styles =========== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
    transition: 0.5s ease;
}


/* New Pixel-Inspired Arc Animation */
.loader-gear {
    width: 60px;
    height: 60px;
    position: relative;
    animation: spin 1.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.loader-gear::before,
.loader-gear::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent; /* 3px border */
}

.loader-gear::before {
    border-top-color: var(--brand-primary);
    animation: arc-anim-1 1.5s ease-in-out infinite;
}

.loader-gear::after {
    border-bottom-color: var(--brand-primary);
    border-left-color: var(--brand-primary);
    animation: arc-anim-2 1.5s ease-in-out infinite;
}

/* Keyframe Animations for Loader */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes arc-anim-1 {
    0% { transform: rotate(0deg); opacity: 1; }
    50% { transform: rotate(180deg); opacity: 0.5; }
    100% { transform: rotate(360deg); opacity: 1; }
}

@keyframes arc-anim-2 {
    0% { transform: rotate(0deg); opacity: 0.5; }
    50% { transform: rotate(180deg); opacity: 1; }
    100% { transform: rotate(360deg); opacity: 0.5; }
}

/* Fade in for main content after load */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* =========== Header / Navigation Styles =========== */
header {
    background-color: rgba(255, 255, 255, 0.7); /* Glassmorphism effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
}
.logo:hover {
    /* Subtle glow for the logo */
    text-shadow: 0 0 15px hsla(202, 100%, 50%, 0.5);
    transition: text-shadow 0.3s ease;
}

.hamburger-menu {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

.hamburger-menu.is-active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}
.hamburger-menu.is-active span:nth-child(2) {
    opacity: 0;
}
.hamburger-menu.is-active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

.mobile-nav {
    display: none; /* Hidden on desktop */
}

.mobile-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    font-weight: 600;
    transition: color 0.4s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--brand-primary);
    transition: width 0.4s ease;
}

.nav-links a:hover {
    color: var(--brand-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-buttons button,
.mobile-auth-buttons button {
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color) !important; /* Add border for better visibility */
}

.btn-login:hover {
    background-color: hsla(210, 28%, 97%, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px hsla(212, 89%, 10%, 0.2); /* Subtle shadow glow */
}
.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 3px;
}

.logo-favicon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    display: none;
}

.logo-favicon.animate {
    display: block;
    animation: faviconRotate 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes faviconRotate {
    0% {
        transform: rotate(0deg) scale(0.8);
        opacity: 0;
    }
    50% {
        opacity: 1;
        transform: rotate(90deg) scale(1);
    }
    100% {
        transform: rotate(180deg) scale(1);
        opacity: 1;
    }
}
.btn-signup {
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 15px -5px hsla(202, 100%, 50%, 0.5);
}

.btn-signup:hover {
    background-color: var(--brand-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px hsla(202, 100%, 50%, 0.8); /* Glowing effect */
}

/* New Logout Button */
.btn-logout {
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 15px -5px hsla(202, 100%, 50%, 0.5);
    display: none; /* Hidden by default */
}

.btn-logout:hover {
    background-color: var(--brand-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px hsla(202, 100%, 50%, 0.8);
}

/* --- Logged-in State --- */
/* When the user is logged in, hide login/signup */
body.logged-in .btn-login,
body.logged-in .btn-signup {
    display: none;
}

/* When the user is logged in, show the logout button */
body.logged-in .btn-logout {
    display: inline-block;
}

/* =========== Hero Section Styles =========== */
.hero {
    background: var(--bg-hero);
    text-align: center;
    padding: 120px 0;
    overflow: hidden;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, hsla(202, 100%, 50%, 0.1), transparent 40%),
                radial-gradient(circle at 90% 80%, hsla(207, 100%, 35%, 0.1), transparent 40%);
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem); /* Responsive font size */
    font-weight: 800;
    color: var(--text-primary);
    animation: slide-up 0.8s ease-out forwards;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin: 15px 0 30px;
    animation: slide-up 0.8s 0.2s ease-out forwards;
    opacity: 0;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 20px -5px var(--brand-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slide-up 0.8s 0.4s ease-out forwards;
    opacity: 0;
}

.btn-primary:hover {
    background-color: var(--brand-secondary);
    transform: translateY(-3px);
    box-shadow: 0 7px 25px -8px hsla(202, 100%, 50%, 0.8); /* Glowing effect */
}


@keyframes slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.section-header {
    display: flex;
    justify-content: center; /* Center the title now */
    align-items: center;
    margin-bottom: 50px;
}

.placeholder-section h2, .about-section h2 {
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
}

.carousel-wrapper {
    position: relative;
}

.carousel-nav {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    /* Pointers-none allows clicking through the container to the cards */
    pointer-events: none; 
    /* Move arrows slightly outside the main container */
    left: -60px;
    width: calc(100% + 120px);
}

.arrow-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all; /* Make sure buttons are clickable */
    transition: all 0.3s ease;
}

.arrow-btn:hover {
    transform: scale(1.1);
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 0 20px -5px hsla(202, 100%, 50%, 0.7); /* Glowing effect */
}

.games-carousel {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 20px; /* For scrollbar visibility if needed */
    scrollbar-width: none; /* Firefox */
}

.games-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}
/* Add this to your game card styles */

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.game-image-wrapper {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.game-info {
    text-align: center;
    width: 100%;
}

.game-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.game-info p {
    font-size: 13px;
    color: #888;
    margin: 0;
}
/* =========== Footer Styles =========== */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
}

.disclaimer {
    font-size: 0.8rem;
    margin-top: 10px;
}

/* =========== On-Scroll Animation Styles =========== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========== Placeholder Section Styles =========== */
.placeholder-section {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding: 100px 0;
}

.placeholder-section p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* =========== About Us Section Styles =========== */
.about-section {
    background-color: var(--bg-secondary);
    padding: 100px 0;
}

.about-section h2 {
    text-align: center;
    margin-bottom: 50px;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.value-card {
    background-color: var(--bg-primary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.value-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
}

.value-card h3 {
    color: var(--brand-primary);
    font-size: 1.3rem;
    margin-bottom: 15px;
}

/* ================================================== */
/* =========== Responsive Media Queries =========== */
/* ================================================== */

@media (max-width: 768px) {
    /* --- Navigation --- */
    .nav-links,
    .nav-buttons {
        display: none; /* Hide desktop nav */
    }

    .hamburger-menu {
        display: flex; /* Show hamburger menu */
    }

    .mobile-nav {
        position: fixed;
        top: 0;
        right: 0;
        left: 0; /* Ensures it spans the full width */
        width: 100%;
        /* New semi-transparent background with blur */
        background-color: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border-color);
        z-index: 99;
        display: flex;
        flex-direction: column;
        gap: 25px; /* Reduced gap for a tighter look */
        padding: 90px 40px 40px; /* Pushes content below the header */
        transform: translateY(-100%); /* Slides down from the top */
        transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    }

    .mobile-nav.is-open {
        transform: translateY(0);
    }

    .mobile-nav a {
        font-size: 1.5rem; /* Slightly smaller font for the new panel size */
        font-weight: 600;
        color: var(--text-primary);
        text-decoration: none;
    }

    .mobile-auth-buttons {
        margin-top: 20px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    /* --- Carousel Arrows --- */
    .carousel-nav {
        left: 0;
        width: 100%;
        padding: 0 10px; /* Bring arrows inside on mobile */
    }

    .arrow-btn {
        width: 40px;
        height: 40px;
        background-color: hsla(0, 0%, 100%, 0.7); /* Make them semi-transparent */
    }

    /* --- All Games Screen --- */
    .all-games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .all-games-grid {
        grid-template-columns: 1fr;
    }
}
