.memory-game 
{
    width: 640px;
    height: 640px;
    margin: auto;
    display: flex;
    flex-wrap: wrap;
    perspective: 1000px;
}

.memory-card
{
    width: calc(25% - 10px);
    height: calc(33.333% - 10px);
    margin: 5px;
    position: relative;
    box-shadow: 1px 1px 1px rgba(0,0,0,.3);
    transform: scale(1);
    transform-style: preserve-3d;
    transition: transform .5s;
}

.front-face,
.back-face 
{
    width: 75%;
    height: 75%;
    padding: 20px;
    position: absolute;
    border-radius: 5px;
    background: #89181A;

    backface-visibility: hidden;
}

.memory-card:active 
{
    transform: scale(0.97);
    transition: transform .2s;
}

.memory-card.flip
{
    transform: rotateY(180deg);
}

.front-face 
{
    z-index: 1;
    object-fit: contain;
    background: #89181A;
    transform: rotateY(180deg);
}

.back-face 
{
    z-index: 2;
    background: #89181A;
}

.memory-card.matched .front-face,
.memory-card.matched .back-face {
    background: #218838;
    border: 4px solid #8EF0A7;
}

.memory-card.matched {
    cursor: default;
}

.reset-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #89181A;
    color: #FFFFFF;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

@media (max-width: 480px) 
{
    .memory-game
    {
        width: 94vw;
        gap: 0px;
    }

    .front-face,
    .back-face
    {
        border-radius: 3px;
        padding: 10px;
    }

    .reset-button
    {
        width: 94vw;
        max-width: 320px;
    }
}

.memory-explanation 
{
    text-align: center;
    margin-top: 20px;
    font-size: 1.1em;
    color: #000000;
}