/* Global Styles */

* {
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
}

body {
    perspective: 500px;
}

/* Start Game Styles */

#main {
    width: 100%;
    height: 100vh;
    background-image: linear-gradient(to right, #acb6e5, #74ebd5)
}

#main .overlay {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: rgba(0,0,0,0.5);
}

h2 {
    text-align: center;
    padding-top: 20px;
}

/* Start Results Div */

#results {
    width: 40%;
    height: 40px;
    margin: auto;
    background-color: #fff;
    border: 2px solid black;
    border-radius: 20px;
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 14px;
}

#results p span {
    font-weight: bold;
}

/* End Results Div */

/* Start Memory Div */

#memory-game {
    width: 550px;
    height: 400px;
    margin: 10px auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 20px;
}

#memory-game .single-card {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.4s linear;
    box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
    cursor: pointer;
}

#memory-game .single-card.rotate {
    transform: rotateY(180deg);
}

#memory-game .single-card.flip {
    transform: rotateY(180deg) rotateX(15deg);
}

#memory-game .single-card.animation {
    animation: moving 0.4s linear 0s 1 running;
}

#memory-game .single-card .front {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    background-color: rgb(66, 66, 66);
    z-index: 1;
    backface-visibility: hidden;
}

#memory-game .single-card .front i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 28px;
    padding: 34px 40px;
}

#memory-game .single-card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    background-color: #fff;
    z-index: 2;
    backface-visibility: hidden;
    transform: rotateY(180deg);
}

#memory-game .single-card .back img {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
}

/* End Results Div */

/* Start Button Div */

#button {
    width: 100%;
    height: 50px;
    margin: 20px auto;
    position: relative;
}

#button button {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 40px;
    border: 2px solid #000;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

#button:active {
    transform: scale(0.95);
}

/* End Button Div */

/* Add Media Queries */

@media all and (max-width: 575px) {
    #results {
        width: 80%;
        font-size: 10px;
    }
    #memory-game {
        width: 300px;
        grid-template-columns: repeat(3, 1fr)
    }
}

@media all and (min-width: 576px) and (max-width: 767px) {
    #results {
        width: 60%;
        font-size: 12px;
    }
    #memory-game {
        width: 400px;
        grid-template-columns: repeat(4, 1fr)
    }
}

/* Add Animation */

@keyframes moving {
    0% {
        top: 0px;
        left: 0px;
    }
    25% {
        top: 0px;
        left: 5px;
    }
    50% {
        top: 0px;
        left: -5px;
    }
    75% {
        top: 0px;
        left: 5px;
    }
    100% {
        top: 0px;
        left: 0px;
    }
};