body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f7bfeb;
    margin: 0;
    font-family: sans-serif;
}

h1 {
    font-size: 2rem;
    color: #f0439a; 
    margin: 0;
    padding: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 1.1rem;
    color: #52163c; 
    margin: 0;
    padding-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.memory-game {
    display: grid;
    gap: 10px;
    perspective: 1000px;
    width: 90vw;
    max-width: 640px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.memory-card {
    width: 100%;
    padding-top: 100%; /* Mantém a proporção 1:1 */
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    cursor: pointer;
}

.memory-card.flip {
    transform: rotateY(180deg);
}

.memory-card .front-face,
.memory-card .back-face {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    border-radius: 5px;
}

.memory-card .front-face {
    background-image: url(img/images.jpg);
}

.memory-card .back-face {
    background-color: #f0439a;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(180deg);
    color: #52163c;
    font-size: 3em;
}

.memory-card .back-face img {
    width: 70%;
    height: auto;
}

/* Ajustes para telas pequenas (celulares) */
@media (max-width: 768px) {
    .memory-game {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }
}

@media (min-width: 1024px) {
    .memory-game {
        grid-template-columns: repeat(4, 1fr);
    }

    .memory-card {
        padding-top: 70%;
    }

    h1 {
        font-size: 3.5rem;
    }

    h2 {
        font-size: 1.7rem;
    }
}
