/* memory-style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f8;
    height: 95vh;
}

header {
    background-color: #3498db;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-button {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
}

.game-container {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    margin: 0 auto 1.5rem;
    max-width: 500px;
}

.card {
    aspect-ratio: 1;
    background-color: #3498db;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    -webkit-user-select: none;
    user-select: none;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    background-color: #2ecc71;
    cursor: default;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}

.card-front {
    background-color: #3498db;
    transform: rotateY(0deg);
}

.card-back {
    background-color: white;
    transform: rotateY(180deg);
    color: #333;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

#reset-btn {
    background-color: #e74c3c;
}

#reset-btn:hover {
    background-color: #c0392b;
}

@media (max-width: 600px) {
    .board {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .game-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    header {
        flex-direction: column;
        text-align: center;
    }
    
    .back-button {
        margin-top: 0.5rem;
    }
}