/*
Supported Min-Width: 360px; (nexus 5).
*/

html {
    box-sizing: border-box;
}

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

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

body {
    background: #ffffff 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;
}

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

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

.restartBtn {
    display: inline-block;
    float: right;
}

/*
 * Styles for the deck of cards
 */
.deck {
    background: linear-gradient(160deg, #02ccba 0%, #aa7ecd 100%);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px;
    box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.5); 
    margin: 0 0 3em;
}

.deck .card {
    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);
}

/*
 * Styles for the Score Panel
 */
.score-panel .stars {
    padding: 0;
    margin: 0 5px 0 0;
}

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

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

/*
 * Styles for the Endgame Modal
 */
.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9;
    visibility: hidden;
}

.modal.visible {
    visibility: visible;
}

.modal.overlay {
    background-color: rgba(211, 211, 211, 0.5);
    visibility: inherit;
}

.modal.panel {
    border-radius: 10px;
    text-align: center;
    margin: auto;
    z-index: 10;
    background-color: rgba(255, 255, 255, 1);
    visibility: inherit;
}

.modal.panel .stars {
    padding: 0;
    font-size: 25px;
}

.modal.panel .panel-okBtn {
    width: 80%;
    height: 40px;
    font-size: 20px;
    text-transform: uppercase;
    font-weight: 400;
    color: #fff;
    border-radius: 5px;
    background-color: green;
}

.modal.panel .stars li {
    padding: 10px;
    list-style: none;
    display: inline-block;
}


/* game - Mobile */
@media screen and (max-width: 660px) {
    h1 {
        font-size: 40px;
    }

    .score-panel {
        width: 80%;
        max-width: 400px;
        font-size: 26px;
        position: relative;    
    }

    .score-panel .stars {
        position: absolute;
        left: 0;
        top: -12px;
    }

    .score-panel .timer {
        position: absolute;
        left: 3px;
        top: 12px;
    }

    .score-panel .moveCounter {
        position: absolute;
        left: 80px;
    }

    .restartBtn {
        margin-top: -5px;
        padding: 5px 30px 5px 30px;
        border-radius: 10px;
        background-color: #8ff2c9;
    }

    .deck {
        min-width: 350px;
        height: 0;
        width: 96%;      
        padding-top: 5%;
        padding-right: 5%;
        padding-left: 5%;
        padding-bottom: 91%; /* height=width, base on parent's width*/
        /*margin-top: 30px;*/
    }

    .deck .card {
        min-width: 20px;
        width: 24%;
        height: 0;
        margin-bottom: 1%;
        padding-top: 12%;    /* height=width, base on parent's width*/
        padding-bottom: 12%; /* 'padding-top' + 'padding-bottom' = height */
    }

    .deck .card.show {
        font-size: 33px;    
    }
}
/* game -Other */
@media screen and (min-width: 661px) {
    h1 {
        font-size: 60px;
    }

    .score-panel {
        font-size: 25px;
        width: 445px;
        position: relative;
    }

    .score-panel .stars {
        display: inline-block;
    }

    .score-panel .timer {
        display: inline-block;
    }

    .score-panel .timer:before {
        content: " , ";
    }

    .deck {
        /*margin-top: 40px;*/
        width: 660px;
        min-height: 680px;
        padding: 32px;
    }

    .deck .card {
        height: 125px;
        width: 125px;
    }

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

/* modal - mobile */
@media screen and (max-width: 460px) {
    .modal.panel {
        width: 80%;
        height: 0;
        padding: 10px;
        padding-bottom: 90%;
    }

    .modal.panel .stars {
        margin: 10px 0 -10px 0;
        padding: 0;
        font-size: 30px;
    }

    .modal.panel .panel-gratz {
        font-size: 30px;
    }

    .modal.panel .panel-msg {
        font-size: 18px;
    }

    .modal.panel .panel-okBtn {
        width: 80%;
        height: 40px;
        font-size: 20px;
    }

    .modal.panel .stars li {
        padding: 10px;
    } 
}
/* modal - other */
@media screen and (min-width: 461px) {
    .modal.panel {
        width: 80%;
        max-width: 400px;
        height: 500px;
        padding: 10px;
    }

    .modal.panel .panel-gratz {
        font-size: 40px;
        padding: 10px;
        padding-top: 0;
    }

    .modal.panel .panel-msg {
        font-size: 25px;
        padding: 10px;
    }

    .modal.panel .stars {
        margin: 10px;
        padding: 25px 0 0 0;
        font-size: 40px;
    }

    .modal.panel .panel-okBtn {
        width: 80%;
        height: 50px;
        font-size: 35px;
    }

    .modal.panel .stars li {
        padding: 10px;
    }  
}


/* card - animation */
.deck .card.open {
    background: #02b3e4;
    -webkit-animation-name: open;
    -webkit-animation-duration: 200ms;    
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: ease-in;
    cursor: default;
}
@-webkit-keyframes open {
    0% {
        -webkit-transform:rotateY(0deg); 
    }
    100% {
        -webkit-transform:rotateY(180deg); 
    }
}
.deck .card.match {
    background-color: green;
    -webkit-animation-duration: 500ms;    
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: linear; 
    -webkit-animation-name: match;
}
@-webkit-keyframes match {
    0% {
        -webkit-transform:scale(1,1); 
    }
    30% {
        -webkit-transform:scale(1.6,0.5); 
    }
    60% {
        -webkit-transform:scale(0.7,1.2);
    }
    80% {
        -webkit-transform:scale(1.3,0.8);  
    }
    100% {
        -webkit-transform:scale(1,1); 
    }
}
.deck .card.not-match {
    background-color: red;
    -webkit-animation-name: not-match;
    -webkit-animation-duration: 400ms;    
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: linear;
}
@-webkit-keyframes not-match {
    0% {
        -webkit-transform:translate(0,0)rotate(0deg); 
    }
    10% {
        -webkit-transform:translate(-30px,0px)rotate(-15deg);  
    }
    20% {
        -webkit-transform:translate(30px,0px)rotate(15deg);  
    }
    30% {
        -webkit-transform:translate(25px,0px)rotate(12deg); 
    }
    40% {
        -webkit-transform:translate(-25px,0px)rotate(-12deg); 
    }
    50% {
        -webkit-transform:translate(-20px,0px)rotate(-9deg);  
    }
    60% {
        -webkit-transform:translate(20px,0px)rotate(9deg);  
    }
    70% {
        -webkit-transform:translate(15px,0px)rotate(5deg); 
    }
    80% {
        -webkit-transform:translate(-15px,0px)rotate(5deg); 
    }
    90% {
        -webkit-transform:translate(10px,0px)rotate(3deg); 
    }  
    100% {
        -webkit-transform:translate(-10px,0px)rotate(-3deg); 
    }    
}
