* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

header h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #555;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px auto;
    max-width: 400px;
}

.card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    border-radius: 10px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: scale(1.05);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    cursor: default;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    border-radius: 10px;
    top: 0;
    left: 0;
}

.card-front {
    background: rgba(255, 255, 255, 0.9);
}

.card-back {
    transform: rotateY(180deg);
}

/* Hide the question mark when flipped */
.card.flipped .card-front {
    opacity: 0;
    pointer-events: none;
}

/* Show the symbol when flipped */
.card.flipped .card-back {
    opacity: 1;
    pointer-events: auto;
}

/* Hide the symbol when not flipped */
.card:not(.flipped) .card-back {
    opacity: 0;
    pointer-events: none;
}

/* Show the question mark when not flipped */
.card:not(.flipped) .card-front {
    opacity: 1;
    pointer-events: auto;
}

#restartBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.3s;
}

#restartBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Notification styles */
#winNotification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.notification-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.notification-content h2 {
    color: #333;
    margin-bottom: 15px;
}

.notification-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

#closeNotification {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s;
}

#closeNotification:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Force 4x4 grid on all devices */
@media (max-width: 500px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px;
        max-width: 100%;
        padding: 0 10px;
    }
    
    /* Ensure cards maintain square aspect ratio */
    .card {
        aspect-ratio: 1;
        min-height: 60px;
    }
}

/* Ensure proper scaling on very small screens */
@media (max-width: 320px) {
    .game-board {
        gap: 5px;
    }
    
    .card {
        min-height: 50px;
    }
}