:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #0ea5e9;
    --accent-hover: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-border: 1px solid rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.05) 0%, transparent 25%);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-color);
    filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.3));
}

/* Hero Section */
.hero {
    padding: 2rem 0;
    text-align: center;
}

.hero-content {
    display: flex;
    gap: 20px;
    height: 360px;
    /* Increased height */
}

/* Banner Carousel */
.banner-carousel {
    position: relative;
    height: 100%;
    width: 66%;
    /* Approx 2/3 width */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.carousel-track-container {
    height: 100%;
    position: relative;
    overflow: hidden;
}

.carousel-track {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    cursor: pointer;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-description {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 60px 30px 30px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.4) 60%, transparent 100%);
    color: #fff;
    z-index: 5;
    pointer-events: none;
}

.banner-description h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.banner-description p {
    font-size: 1.1rem;
    color: #f1f5f9;
    max-width: 700px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
    font-weight: 500;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 1rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel-btn:hover {
    background: #fff;
    color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn--left {
    left: 20px;
}

.carousel-btn--right {
    right: 20px;
}

.carousel-nav {
    display: flex;
    justify-content: center;
    padding: 10px 0;
    position: absolute;
    bottom: 20px;
    width: 100%;
    z-index: 10;
}

.carousel-indicator {
    border: none;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    margin: 0 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.carousel-indicator.current-slide {
    background: var(--accent-color);
    transform: scale(1.2);
    background: #fff;
}

.is-hidden {
    display: none;
}

/* Top Games Grid */
.top-games-grid {
    width: 34%;
    /* Remaining width */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    height: 100%;
}

.top-game-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.top-game-item:hover {
    transform: translateY(-3px);
}

.top-game-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-game-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    pointer-events: none;
}

/* Categories */
.categories-section {
    margin-bottom: 2rem;
}

.categories-wrapper {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.category-btn {
    background-color: #fff;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-btn:hover,
.category-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

/* Games Grid */
.games-section {
    padding-bottom: 4rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* Smaller cards */
    gap: 1rem;
}

.game-card {
    background-color: var(--card-bg);
    border: var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 20px rgba(14, 165, 233, 0.1);
}

.game-icon-wrapper {
    width: 100%;
    height: 220px;
    /* Taller preview to better showcase artwork */
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.game-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.05);
}

.game-info {
    padding: 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.game-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-meta i {
    color: var(--accent-color);
    filter: drop-shadow(0 0 2px rgba(14, 165, 233, 0.3));
}

.play-btn {
    display: block;
    text-align: center;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-top: auto;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.game-card:hover .play-btn {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* Sorting Controls */
.sorting-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    gap: 15px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 20px;
    padding: 5px 10px;
    border: 1px solid transparent;
    box-shadow: none;
    transition: all 0.3s ease;
    width: 40px;
    overflow: hidden;
    cursor: pointer;
}

.search-box.expanded {
    width: 240px;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: default;
}

.search-box input {
    border: none;
    outline: none;
    padding: 0;
    font-family: var(--font-family);
    color: var(--text-primary);
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    background: transparent;
}

.search-box.expanded input {
    width: 180px;
    opacity: 1;
    padding: 5px;
    margin-right: 5px;
}

.search-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.search-btn:hover {
    color: var(--accent-color);
}

.sort-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.sort-btn:hover,
.sort-btn.active {
    color: var(--accent-color);
}

/* Loading */
.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 3rem;
    font-size: 2rem;
    color: var(--accent-color);
}

/* Footer */
.footer {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: var(--glass-border);
    margin-top: auto;
    backdrop-filter: blur(12px);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    /* Mobile: Hide top games grid, show only banner */
    .hero-content {
        flex-direction: column;
        height: auto;
    }

    .banner-carousel {
        width: 100%;
        height: 300px;
    }

    .top-games-grid {
        display: none;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1.5rem;
    }

    .game-icon-wrapper {
        height: 180px;
        /* Give mobile cards more vertical room for imagery */
    }

    .game-info {
        padding: 0.8rem;
    }

    /* Mobile Categories */
    .categories-wrapper {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .categories-wrapper::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }

    .category-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}