/* --- CSS Custom Properties for easy theme management --- */
:root {
    --primary-color: #3f51b5;
    --primary-darker: #1a237e;
    --text-color: #333;
    --text-soft: #4a4a4a;
    --background-start: #e0f7fa;
    --background-end: #bbdefb;
    --white: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-stronger: rgba(0, 0, 0, 0.2);
}

/* --- Global Styles & Animated Background --- */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--background-start), var(--background-end));
    background-size: 200% 200%;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    animation: gradientShift 10s ease infinite;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

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

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* --- Top Navigation Bar --- */
.topnav {
    background-color: var(--white);
    box-shadow: 0 4px 15px var(--shadow-color);
    padding: 12px 25px;
    display: flex;
    justify-content: flex-start;
    gap: 35px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topnav .menu-header {
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 45px;
    width: 45px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.topnav .logo-link {
    color: var(--primary-darker);
    font-size: 1.7em;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.3s ease, transform 0.2s ease;
}

.topnav .logo-link:hover {
    color: var(--primary-color);
    transform: scale(1.02);
}

/* --- Animated Hamburger Menu --- */
.topnav .menu-icon {
    display: none;
    cursor: pointer;
    padding: 10px;
}

.topnav .menu-icon .bar {
    width: 28px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* Animate to "X" */
.menu-icon.change .bar:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}
.menu-icon.change .bar:nth-child(2) {
    opacity: 0;
}
.menu-icon.change .bar:nth-child(3) {
    transform: rotate(45deg) translate(-7px, -7px);
}

.topnav .menu-links {
    display: flex;
    transition: transform 0.3s ease-in-out;
    list-style: none;
    margin: 0;
    padding: 0;
}

.topnav a {
    color: var(--text-soft);
    text-align: center;
    padding: 15px 20px;
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.topnav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    transition: width 0.3s ease-out;
}

.topnav a:hover::after, .topnav a.active::after {
    width: 60%;
}

.topnav a:hover {
    color: var(--primary-color);
}

.topnav a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* --- Main Section Cards --- */
.main-sections {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 50px;
    padding: 30px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1300px;
}

.main-sections .main-link {
    text-decoration: none;
    color: inherit;
    flex-basis: 48%;
    max-width: 550px;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 20px;
    position: relative;
}

.main-sections .main-link:hover {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 0 25px 50px var(--shadow-stronger);
}

/* Arrow icon for hover state */
.main-link::after {
    content: '→';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2em;
    color: var(--white);
    background-color: var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.main-link:hover::after {
    opacity: 1;
    transform: scale(1);
}

.games, .blogs {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 20px var(--shadow-color);
    text-align: center;
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

.main-link:hover .games, .main-link:hover .blogs {
    background: var(--white);
}

.games img, .blogs img {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.4s ease;
}

.main-link:hover img {
    transform: scale(1.05);
}

.games h2, .blogs h2 {
    color: var(--primary-color);
    font-size: 2.2em;
    margin: 0;
    letter-spacing: -0.5px;
}

/* --- Footer Styles --- */
footer {
    background-color: var(--primary-darker);
    color: #f0f0f0;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
    box-shadow: 0 -2px 10px var(--shadow-color);
}

/* --- Responsive Layout --- */
@media screen and (max-width: 992px) {
    .main-sections {
        gap: 30px;
        padding: 15px;
    }
    .main-sections .main-link {
        flex-basis: 100%;
        max-width: 600px;
    }
}

@media screen and (max-width: 600px) {
    .topnav {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    .topnav .menu-header {
        width: 100%;
      }
    .topnav .menu-icon {
        display: block;
    }
    .topnav .menu-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px;
        left: 0;
        background-color: var(--white);
        box-shadow: 0 2px 5px var(--shadow-stronger);
        border-radius: 0 0 10px 10px;
    }
    .topnav .menu-links.show {
        display: flex;
    }
    .topnav a {
        padding: 12px 18px;
        text-align: left;
        border-bottom: 1px solid var(--shadow-color);
        border-radius: 0;
        color: var(--text-soft);
    }
    .topnav a:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
    .topnav a.active {
        background-color: rgba(0, 0, 0, 0.1);
    }
    .main-link::after {
        display: none;
    }
}
