* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f8f8f8;
}

.container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #555;
}

.game-container {
    position: relative;
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 500px;
}

.card {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background-color: #ffffff;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateY(0deg);
    transition: transform 0.5s ease-in-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

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

.front-face {
    background-color: #2980b9;
    transform: rotateY(180deg);
}

.back-face {
    background-color: #ffffff;
    border: 2px solid #2980b9;
}

.emoji {
    font-size: 3rem;
}

.controls-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    background-color: rgba(248, 248, 248, 0.95);
}

.controls-container.hide {
    display: none;
}

button {
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    margin: 10px;
    background-color: #2980b9;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2471a3;
}

#result {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #333;
}

.hide {
    display: none;
}

/* 반응형 디자인 */
@media screen and (max-width: 600px) {
    #game {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .emoji {
        font-size: 2.5rem;
    }
}

@media screen and (max-width: 400px) {
    #game {
        grid-template-columns: repeat(2, 1fr);
    }
}
