:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #27ae60;
    --text-color: #ecf0f1;
    --card-width: 280px;
    --card-height: 408px;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--primary-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.game-container {
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

h1 {
    margin-bottom: 20px;
}

.controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

select, button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background-color: var(--secondary-color);
    color: var(--text-color);
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

.score {
    font-size: 1.2rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    justify-items: center;
    margin: 0 auto;
}

.card {
    width: 100%;
    height: 0;
    padding-bottom: 145.714%; /* 408/280 aspect ratio */
    background-color: var(--secondary-color);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.card.matched {
    background-color: var(--accent-color);
}

.card .front {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-color: var(--secondary-color);
    transition: opacity 0.3s ease;
}

.card.flipped .front {
    opacity: 1;
}

.card.flipped .back {
    opacity: 0;
}

.card .front img {
    max-width: 90%;
    max-height: 90%;
}

@media (min-width: 768px) {
    .game-board {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
}

@media (min-width: 1024px) {
    .game-board {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}
