* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
    max-width: 450px;
    width: 100%;
}

h1 {
    margin-bottom: 15px;
    font-size: 24px;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
}

#restart-btn {
    background-color: #ffb703;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    color: #000;
    transition: 0.3s;
}

#restart-btn:hover {
    background-color: #fb8500;
    color: #fff;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
}

.card {
    aspect-ratio: 1;
    background-color: #3a86ff;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transform: scale(1);
    transition: transform 0.5s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card:active {
    transform: scale(0.97);
}

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

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

.card-front {
    background-color: #ffffff;
    transform: rotateY(180deg);
    font-size: 30px;
}

.card-back {
    background: linear-gradient(45deg, #4361ee, #3a0ca3);
}

/* Win Modal Styles */
.win-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.win-message h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #4ade80;
}

.win-message p {
    font-size: 16px;
    margin-bottom: 20px;
}

#play-again-btn {
    background-color: #4ade80;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    color: #000;
}

#play-again-btn:hover {
    background-color: #22c55e;
    color: #fff;
}