* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f0e4d7;
    font-family: Arial, sans-serif;
}

h1 {
    margin-bottom: 1rem;
    color: #5c4742;
}

.game-info {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #7d655f;
}

.memory-game {
    width: 640px;
    height: 640px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1rem;
    perspective: 1000px;
}

.memory-card {
    width: 150px;
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.memory-card.flip {
    transform: rotateY(180deg);
}

.front-face,
.back-face {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 10px;
    backface-visibility: hidden; /* Hides the back of the element when flipped */
}

.front-face {
    transform: rotateY(180deg);
    background-color: #fff;
}

.front-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.back-face {
    background: #a9cce3 url('https://www.transparenttextures.com/patterns/cubes.png');
    border: 5px solid #fff;
}

#win-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

#win-message h2 {
    font-size: 2.5rem;
    color: #d9534f;
    margin-bottom: 10px;
}

#restart-button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1rem;
    color: #fff;
    background-color: #5cb85c;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restart-button:hover {
    background-color: #4cae4c;
}

.hidden {
    display: none;
}