.flip { 
    display: grid; 
    width: 60vh;
    gap: 1rem; 
    margin: 1rem; 
    padding: 1rem; 
}

.card {
    position: relative; 
    transition: transform 0.4s ease-in-out; 
    transform-style: preserve-3d; 
    cursor: pointer; 
    aspect-ratio: 2 / 3; 
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; 
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1vh;
    color: white;
    user-select: none;
}

.front {
    background: #36405E; 
}

.back {
    background: #C1C4CD;
    transform: rotateY(180deg); 
}

.card img {
    width: 80%;
    object-fit: cover;
}


/* 맞은 카드 효과 */
.card.matched {
    animation: matchEffect 0.5s ease-out;
}

@keyframes matchEffect {
    0% {
        box-shadow: 0 0 0px yellow;
    }
    50% {
        box-shadow: 0 0 20px yellow;
    }
    100% {
        box-shadow: 0 0 0px yellow;
    }
}

/* 틀린 카드 효과 */
.card.mismatch {
    animation: mismatchEffect 0.5s ease-out;
}

@keyframes mismatchEffect {
    0% {
        box-shadow: 0 0 0px red;
    }
    50% {
        box-shadow: 0 0 20px red;
    }
    0% {
        box-shadow: 0 0 0px red;
    }
}