/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --purple: #A8E6CF;
    --pink: #FFB6C1;
    --orange: #FF8C42;
    --blue: #6C5CE7;
    --bg-color: #FFF9E6;
    --card-bg: #ffffff;
    --text-color: #2D3436;
    --border-color: #ddd;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
}

body {
    font-family: 'Comic Sans MS', 'Fredoka One', 'Arial', sans-serif;
    background: linear-gradient(135deg, #FFF9E6 0%, #E8F5E9 100%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

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

/* Header */
header {
    background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 50%, #FFE66D 100%);
    background-size: 200% 200%;
    animation: rainbow 5s ease infinite;
    color: white;
    padding: 1.2rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 0;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.2);
    animation: bounce 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.5px;
}

.logo h1::before {
    content: '🌟';
    animation: float 3s ease-in-out infinite;
}

nav {
    display: flex;
    gap: 1rem;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
}

nav a:hover,
nav a.active {
    background: rgba(255,255,255,0.2);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 50%, #FFE66D 100%);
    background-size: 200% 200%;
    animation: rainbow 8s ease infinite;
    color: white;
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s linear infinite;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h2 {
    font-size: 3.2rem;
    font-weight: 900;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 8px rgba(0,0,0,0.4), 0 0 30px rgba(255,255,255,0.3);
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.2);
    letter-spacing: 0.5px;
}

.hero .emoji-large {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #FFE66D, #FF8C42);
    color: #2D3436;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-secondary {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #A8E6CF, #88D8A3);
    color: #2D3436;
    box-shadow: 0 4px 15px rgba(168, 230, 207, 0.4);
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.game-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
    min-height: 280px;
    justify-content: space-between;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.game-card:hover::before {
    left: 100%;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

.game-card:active {
    transform: translateY(-5px) scale(0.98);
}

.game-card .game-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    display: inline-block;
    transition: transform 0.3s;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.1));
    flex-shrink: 0;
    line-height: 1;
}

.game-card:hover .game-icon {
    transform: scale(1.2) rotate(5deg);
    animation: bounce 0.6s ease;
}

.game-card .game-name {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #2D3436;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    letter-spacing: -0.5px;
    line-height: 1.3;
    min-height: 3.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
    hyphens: auto;
}

.game-card .game-type {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 1rem;
    text-shadow: 0.5px 0.5px 1px rgba(0,0,0,0.05);
    flex-shrink: 0;
    line-height: 1.2;
}

.game-card .game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    gap: 0.5rem;
    flex-shrink: 0;
    padding-top: 0.5rem;
}

.game-card .game-age {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.game-card .game-difficulty {
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    text-shadow: 0.5px 0.5px 1px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 70px;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Filters */
.filters, .age-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.filter-btn, .age-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
    color: #2D3436;
}

.filter-btn:hover, .age-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active, .age-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transform: scale(1.05);
}

/* Section Headers */
section h2 {
    font-size: 2.8rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 2rem;
    color: #2D3436;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.15), 0 0 20px rgba(255, 107, 107, 0.3);
    position: relative;
    display: inline-block;
    width: 100%;
    letter-spacing: -1px;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4);
    border-radius: 2px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2D3436, #636e72);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card {
    animation: fadeIn 0.5s ease forwards;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }
.game-card:nth-child(6) { animation-delay: 0.6s; }

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero .emoji-large {
        font-size: 3rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .game-card {
        min-height: 260px;
        padding: 1.2rem;
    }
    
    .game-card .game-name {
        font-size: 1.2rem;
        min-height: 3em;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    nav {
        margin-top: 0.5rem;
    }
    
    section h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }
    
    .game-card {
        padding: 1rem;
        min-height: 240px;
    }
    
    .game-card .game-icon {
        font-size: 3.5rem;
        margin-bottom: 0.8rem;
    }
    
    .game-card .game-name {
        font-size: 1.1rem;
        min-height: 2.8em;
        margin-bottom: 0.4rem;
    }
    
    .game-card .game-type {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }
    
    .game-card .game-meta {
        gap: 0.3rem;
        padding-top: 0.3rem;
    }
    
    .game-card .game-age {
        font-size: 0.75rem;
    }
    
    .game-card .game-difficulty {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        min-width: 60px;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
}

