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

:root {
    --bg-primary: #1a1f2e;
    --bg-secondary: #242b3d;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --accent-blue: #4a9eff;
    --card-red: #e85a5a;
    --card-orange: #f5a623;
    --card-yellow: #f8d56b;
    --card-green: #7ed321;
    --card-teal: #50c8c8;
    --card-blue: #4a90d9;
    --card-purple: #9b59b6;
    --card-pink: #e91e8c;
}

body {
    font-family: 'Lexend', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: 700;
}

.logo span {
    color: var(--accent-blue);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 280px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box input:focus {
    border-color: var(--accent-blue);
}

.toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 48px 64px;
    gap: 48px;
}

.hero-left {
    flex: 1;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.1;
}

.hero-title span {
    color: var(--accent-blue);
}

.hero-desc {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.5;
}

.hero-cards {
    display: flex;
    gap: 24px;
}

.hero-card {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    padding: 16px;
}

.hero-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.hero-card.games {
    background-color: var(--card-red);
}

.hero-card.surprise {
    background-color: var(--card-green);
}

.hero-card.logo-card {
    background-color: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.hero-card.logo-card svg {
    width: 60px;
    height: 60px;
}

/* Category Filter */
.games-section {
    padding: 0 64px 64px;
}

.games-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.category-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: transparent;
    color: var(--text-secondary);
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.category-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
}

.game-tile {
    aspect-ratio: 1;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, filter 0.3s;
    text-align: center;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    word-break: break-word;
    background-size: cover;
    background-position: center;
    position: relative;
}

.game-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-tile:hover::before {
    opacity: 1;
}

.game-tile:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.game-tile-text {
    position: relative;
    z-index: 1;
    padding: 12px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.8));
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.game-tile.hidden {
    display: none;
}

/* Color classes */
.color-0 { background-color: var(--card-red); }
.color-1 { background-color: var(--card-orange); }
.color-2 { background-color: var(--card-yellow); color: #333; }
.color-3 { background-color: var(--card-green); }
.color-4 { background-color: var(--card-teal); }
.color-5 { background-color: var(--card-blue); }
.color-6 { background-color: var(--card-purple); }
.color-7 { background-color: var(--card-pink); }

/* Game Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 32px;
    }

    .hero-left {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-title {
        font-size: 42px;
    }

    .games-section {
        padding: 0 32px 48px;
    }
}

@media (max-width: 640px) {
    header {
        padding: 12px 16px;
    }

    .search-box input {
        width: 160px;
    }

    .hero {
        padding: 24px 16px;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-cards {
        gap: 12px;
    }

    .hero-card {
        width: 100px;
        height: 100px;
        font-size: 14px;
        border-radius: 14px;
    }

    .games-section {
        padding: 0 16px 32px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 12px;
    }

    .game-tile {
        font-size: 11px;
        border-radius: 12px;
    }
}
