html {
    box-sizing: border-box;
    font-size: 16px;
}

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

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

body {
    font-family: 'Coda', cursive;
}

body,
.congrats-popup,
.start-popup,
.landscape-mode {
    background: #ffffff url(../img/geometry2.png); /* Background pattern from Subtle Patterns */
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    max-width: 1280px;
    margin: auto;
    height: 100%;
}

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

/*
 * Styles for the deck of cards
 */

.deck {
    width: 560px;
    height: 580px;
    background: linear-gradient(160deg, #02ccba 0%, #aa7ecd 100%);
    padding: 2rem;
    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;
}

.card {
    height: 109px;
    width: 109px;
    background: #2e3d49;
    font-size: 0;
    color: #ffffff;
    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);
    transform: rotateY(-180deg);
    transition: all 0.3s;
}

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

.show {
    font-size: 2rem;
}

.match {
    cursor: default;
    background: #02ccba;
    font-size: 2rem;
}

/*
 * when cards don't match
 */
.dont-match {
    background: #d72638;
}

/*
 * Styles for the Score Panel
 */

.score-panel {
    width: 345px;
    display: flex;
    justify-content: space-between;
}

.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;
}

/*
 * remove extra space
 */
.deck,
.score-panel {
    margin: 0;
}

/*
 * Congratulations popup style
 */
.congrats-popup {
    width: 100%;
    height: 100%;
    color: black;
    position: absolute;
    top: 50%;
    left: -100%;
    transform: translate(-50%, -50%);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

}

.title,
.game-name {
    text-transform: capitalize;
    font-size: 2rem;
    color: #17a91d;
}


.score,
.welcome,
.play-info,
.landscape-mode {
    font-size: 1.2rem;
}


/*
 * play again button
 */
.play-again {
    font-size: 1.1rem;
    padding: 0.6rem;
    background: #4caf50;
    outline: none;
    border: none;
    border-radius: 10px;
    color: #fff;
    margin-top: 26.56px;
    cursor: pointer;
}

/*
 * start popup
 */
.start-popup {
    width: 100%;
    height: 100%;
    color: black;
    position: absolute;
    top: 50%;
    left: -100%;
    transform: translate(-50%, -50%);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    line-height: 1.7rem;
}

.my-name {
    color: #03a9f4;
    text-transform: capitalize;
}

.game-name {
    color: #03a9f4;
}

.should-know {
    font-size: 1.1rem;
    padding-left: 1rem;
}

.start {
    font-size: 1.2rem;
    padding: 0.6rem;
    background: #03a9f4;
    outline: none;
    border: none;
    border-radius: 10px;
    color: #fff;
    margin-top: 26.56px;
    cursor: pointer;
    width: 100px;
    text-transform: uppercase;
}

/*
 * to display the popups
 */
.visible {
    left: 50%;
}

/*
 * overflow hidden
 */
.container,
.congrats-popup,
.start-popup {
    overflow: hidden;
}


/*
 * land scape popup
 */
.landscape-mode {
    width: 100%;
    height: 100%;
    color: black;
    position: absolute;
    top: 50%;
    left: -100%;
    transform: translate(-50%, -50%);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}


.mobile {
    font-size: 8rem;
    -webkit-animation: 3s 1s infinite mobile;
    animation: 3s 1s infinite mobile;
}


/*
 * tablets
 */
@media screen and (max-width: 768px) {
    /*
     * remove tapping highlight on IOS devices.
       https://css-tricks.com/snippets/css/remove-gray-highlight-when-tapping-links-in-mobile-safari/
     */
    * {
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }

    .container {
        width: 100%;
    }

    .deck {
        width: 95%;
        height: auto;
    }

    .card {
        width: calc((100% - 36px)/4);
        height: 157.39px;
        margin: 0 12px 12px 0;
    }

    /* remove margin from 4th cards */
    .card:nth-child(4n) {
        margin-right: 0;
    }

    .score-panel {
        font-size: 1.2rem;
    }

    .restart {
        font-size: 1.7rem;
    }

}

/*
 * when mobile users change to landscape mode.
 */
@media (max-width: 850px) and (orientation: landscape) {

    .landscape-mode {
        left: 50%;
    }

    /* IOS */
    @-webkit-keyframes mobile {
        0% {
            -webkit-transform: rotate(-90deg);

        }

        100% {
            -webkit-transform: rotate(0);
        }
    }

    /* others */
    @keyframes mobile {
        0% {
            transform: rotate(-90deg);

        }

        100% {
            transform: rotate(0);
        }
    }

}


/*
 * 689px
 */
@media screen and (max-width: 689px) {
    .card {
        height: 138.63px;
    }
}

/*
 * 635px
 */
@media screen and (max-width: 635px) {
    .card {
        height: 125.81px;
    }
}

/*
 * 580px
 */
@media screen and (max-width: 580px) {
    .card {
        height: 112.75px;
    }
}

/*
 * 527px
 */
@media screen and (max-width: 527px) {
    .card {
        height: 100.16px;
    }
}

/*
 * 478px
 */
@media screen and (max-width: 478px) {
    .card {
        height: 88.52px;
    }
}

/*
 * 440px
 */
@media screen and (max-width: 440px) {
    .card {
        height: 79.5px;
    }
}

/*
 * Mobile L
 */
@media screen and (max-width: 425px) {
    .deck {
        padding: 1.3rem;
        width: 98%;
    }

    .card {
        height: 84.72px;
    }

    .score-panel {
        width: 80%;
        font-size: 1rem;
    }

    .show {
        font-size: 1.4rem;
    }
}

/*
 * Mobile 400px
 */
@media screen and (max-width: 400px) {
    .card {
        height: 78.59px;
    }
}

/*
 * Mobile M
 */
@media screen and (max-width: 375px) {
    .card {
        height: 72.47px;
    }

    .score-panel {
        width: 80%;
        font-size: 0.9rem;
    }

}

/*
 * iPhone 5/SE, to make sure that start button is shown
 */
@media screen and (max-width: 360px) {
    .start-popup {
        height: 120%;
    }

    .game-name,
    .start {
        margin: 0;
    }

    .welcome,
    .play-info {
        margin: 14px 0 0;
    }
}

/*
 * Mobile 342px
 */
@media screen and (max-width: 342px) {
    .card {
        height: 64.39px;
    }
}

/*
 * Mobile S
 */
@media screen and (max-width: 320px) {
    .card {
        height: 59px;
    }

    .show {
        font-size: 1.2rem;
    }

    .restart {
        font-size: 1.5rem;
    }
}