body {
    font-family: Arial;
    text-align: center;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    margin: 0;
    color: white;
}

div {
    background: rgba(228, 22, 22, 0.95);
    color: #222;
    margin: 20px auto;
    padding: 20px;
    width: 70%;
    border-radius: 14px;
}

hr {
    width: 70%;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.4);
   
}

#popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background-color: rgba(0, 0, 0, 0.6);

    display:flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.popup-box {
    background: white;
    padding: 30px;
    width: 300px;
    border-radius: 14px;

    animation: popupAnim 0.5s ease, fadeIn 0.5 ease;
}

@keyframes popupAnim {
    from {
        transform: scale(0.4);
        opacity: 0;
    }
    to{
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

button {
    padding: 10px 15px;
    background: linear-gradient(135deg, #ff6a00, #ee0979);
    color: white;
    border: none;
    border-radius: 8px;
    margin: 5px;
    transition: transform 0.2 ease, opacity 0.2 ease;
}

button:hover {
    opacity: 0.85;
    cursor: pointer;
}

button:active {
    transform: scale(0.96);
}

#gameBoard {
    display: grid;
    grid-template-columns: repeat(4, 70px);
    gap: 40px;
    justify-content: center;
    margin-top: 15px;
    background: transparent;
    width: auto;
    padding: 10px;
}

.card {
    width: 50px;
    height: 50px;
    background: linear-gradient(135 deg, #ff6a00, #ee0979);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    border-radius: 20px;
    cursor: pointer;
    transition: transfrom 0.2s ease, background-color 0.3s ease;
    transform-style: preserve-3d;
}

.card:hover {
    transform: scale(1.08);
}

.card.flipped {
    background: white;
    color: #222;
}

.card.matched {
    background: linear-gradient(135deg, #00c853, #64dd17);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0,255,0,0.6);
}

.card.flip-anim {
    animation: flipAnim 0.5s ease;
}

@keyframes flipAnim {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

.card.wrong {
    animation: shake 0.3s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    50% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-5px);
    }
    100% {
        transform: translateX(0);
    }
}

#gameStatus {
    font-size: 16px;
    color: #444;
    font-weight: bold;
}

#winPopup {
    position:fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background-color: rgba(0, 0, 0, 0.6);

    display: flex;
    justify-content: center;
    align-items: center;

    z-index: 9999;
}

#winPopup .popup-box {
    border: 3px solid gold;
    background: #111;
    color: white;
}

#finalMoves,
#finalTime,
#rating {
    font-weight: bold;
}

#rating {
    font-size: 18px;
    color: gold;
    margin-top: 10px;
}

@media (max-width: 700px) {
    div {
        width: 90%;
    }

    #gameBoard {
        grid-template-columns: repeat(4, 60px);
    }

    .card {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
}

