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

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial Rounded MT Bold', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 2rem;
}

header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.game-card {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

.game-card h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.game-card p {
    font-size: 0.8rem;
    color: #666;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 80%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.4s ease;
}

.close {
    color: #333;
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #f5576c;
}

#modal-game-title {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game-instructions {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #555;
}

.game-container {
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 400px;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.game-ui {
    margin-top: 1rem;
}

#score-display {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    display: inline-block;
}

.win-message {
    background: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-top: 1rem;
    animation: winBounce 0.5s ease;
}

.win-message h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

#play-again-btn {
    background: white;
    color: #7b2ff7;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#play-again-btn:hover {
    transform: scale(1.1);
}

@keyframes winBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-placeholder {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    margin-top: 1rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-placeholder p {
    font-size: 1.2rem;
    color: #555;
    margin: 0.5rem 0;
}

.placeholder-animation {
    margin-top: 2rem;
}

.bounce {
    font-size: 4rem;
    animation: bounce 1s ease infinite;
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .game-card {
        padding: 0.75rem;
    }
    
    .game-icon {
        font-size: 2.5rem;
    }
    
    .game-card h3 {
        font-size: 0.85rem;
    }
}
