html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #fff url('../img/geometry2.png');
    /* Background pattern from Subtle Patterns */
    font-family: 'Coda', cursive;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

h1 {
    font-family: 'Open Sans', sans-serif;
    font-weight: 300;
}

/*
 * Styles for the deck of cards
 */

.deck {
    width: 660px;
    height: 680px;
    background: linear-gradient(160deg, #02ccba 0%, #aa7ecd 100%);
    padding: 32px;
    border-radius: 10px;
    box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.5);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 3em;
}

.deck .card {
    height: 125px;
    width: 125px;
    background: #2e3d49;
    font-size: 0;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 5px 2px 20px 0 rgba(46, 61, 73, 0.5);
}

.deck .card.open {
    transform: rotateY(0);
    background: #02b3e4;
    cursor: default;
}

.deck .card.show {
    font-size: 33px;
}

.deck .card.match {
    cursor: default;
    background: #02ccba;
    font-size: 33px;
    animation: match-shake 0.5s;
}

.deck .card.nomatch {
    transition: 100ms linear;
    background: #f08080;
    border-radius: 0;
    animation: shake 0.5s;

}

/*
 * No Match shake animation. From https://www.w3schools.com/howto/howto_css_shake_image.asp
 */

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

/*
 * Match shake animation
 */

@keyframes match-shake {

    0%,
    100% {
        transform: translate(0, 2px);
    }

    10%,
    40%,
    70% {
        transform: translate(0, -3px);
    }

    20%,
    50%,
    80% {
        transform: translate(0, 0px);
    }

    30%,
    60%,
    90% {
        transform: translate(0, 3px);
    }
}


/*
 * Styles for the Score Panel
 */

.score-panel {
    text-align: left;
    width: 345px;
    margin-bottom: 10px;
}

.score-panel .stars {
    margin: 0;
    padding: 0;
    display: inline-block;
    margin: 0 5px 0 0;
}

.score-panel .stars li {
    list-style: none;
    display: inline-block;
}

.score-panel .restart {
    float: right;
    cursor: pointer;
}

.score-panel .timer {
    float: right;
    margin-left: 20px;
}

.show-minutes::after {
    content: ":"
}

/*
 * Game Over Modal
 */

.modal-container {
    display: none;
    width: 100%;
    max-height: 846px;
    background: #000;
    opacity: 0.9;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.modal-info {
    position: relative;
    width: 300px;
    padding: 10px;
    background: #fff;
    margin: auto;
    left: 0;
    right: 0;
    box-sizing: border-box;
    border: dashed 1px #888;
    border-radius: 8px;
}

.modal-info h1 {
    text-align: center;
    font-weight: bold;
}

.modal-btns {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.modal-close-btn,
.modal-replay-btn {
    height: auto;
    font-weight: bolder;
    letter-spacing: 0.5px;
    background: #fff;
    border-radius: 5px;
    padding: 10px;
}

.modal-close-btn {
    margin-right: 15px;
    border: 2px solid #828be2;
}

.modal-close-btn:hover {
    background: #828be2;
    color: #fff;
}

.modal-close-btn:active {
    transform: translateY(5px);
}

.modal-replay-btn {
    margin-left: 15px;
    border: 2px solid #79ce79;
}

.modal-replay-btn:hover {
    background: #79ce79;
    color: #fff;
}

.modal-replay-btn:active {
    transform: translateY(5px);
}