* {
    margin: 0;
    padding: 0;
}

body {
    font-family: sans-serif;
    background-color: black;
    color: white;
    overflow-x: hidden;
    padding: 30px;
    background-image: linear-gradient(130deg, rgb(0, 0, 0), rgb(0, 2, 95));
    height: 100%;
    overflow: hidden;
}

a {
    color: white;
    text-decoration: none;
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: calc(100vh - 60px);
    animation: appear 1s ease-in-out forwards;
}

/* PLACAR */
.control {
    font-size: 2rem;
    width: 500px;
    margin: 0 auto 30px auto;
}

.score {
    display: inline-block;
    margin-bottom: 15px;
    width: 200px;
    height: 50px;
    line-height: 50px;
    border: 2px solid white;
    border-radius: 10px;
    transition: 0.3s;
}

.scoreAnimation {
    animation: scoreAnimation 4s;
}

.score p {
    display: inline-block;
}

#move {
    font-size: 1.6rem;
    font-family: monospace;
}

.mx {
    margin-left: 25px;
    margin-right: 25px;
}

/* ESTRUTURA DO JOGO */
main {
    text-align: center;
}

.container {
    width: 100%;
    height: 350px;
}

.gameAnimation {
    animation: gameAnimation 1s 1.5s ease-in-out forwards;
}

.game>div {
    font-size: 0;
}

.win {
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100%;
    font-size: 3rem;
    animation: result 1s ease-in-out forwards;
}

.square {
    position: relative;
    padding: 0;
    margin: auto;
    width: 100px;
    height: 100px;
    display: inline-block;
    font-size: 1rem;
    cursor: pointer;
}

.mb {
    animation: appear 1.5s ease-in-out forwards;
    border-bottom: 5px solid rgb(131, 131, 131);
}

.ml {
    animation: appear 1.5s ease-in-out;
    border-left: 5px solid rgb(131, 131, 131);
}

.X {
    color: rgb(48, 144, 255);
}

.O {
    color: rgb(52, 255, 52);
}

.piece {
    height: 100%;
    width: 100%;
    font-size: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    animation: pieceAnimation 1s ease-in-out;
}

.winnerAnimation {
    animation: winnerAnimation 0.7s ease-in-out infinite;
}

#restart {
    margin-top: 20px;
    border-radius: 10px;
    background-color: transparent;
    color: white;
    border: 2px solid white;
    padding: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 1s;
}

.restartAnimation {
    animation: restartAnimation 1s ease-in-out infinite alternate-reverse;
}

#restart:hover {
    transform: scale(1.1);
    transition: 1s;
    color: rgb(0, 255, 0);
    border-color: rgb(0, 255, 0);
}

/* FOOTER */
footer {
    margin-top: 50px;
}

/* RESPONSIVIDADE */
@media screen and (max-width:600px) {
    body {
        padding: 0;
    }

    .center {
        height: 100vh;
    }

    .control {
        margin-top: 10px;
        width: 400px;
        font-size: 1.6rem;
        margin: 0 auto 20px auto;
    }

    .score {
        width: 180px;
        height: 40px;
        line-height: 40px;
    }

    #move {
        font-size: 1.4rem;
    }

    .container {
        width: 100%;
        height: 310px;
    }

    .win {
        font-size: 2.3rem;
    }

    #restart {
        margin-top: 40px;
        border-radius: 10px;
        padding: 8px;
        font-size: 0.8rem;
    }

    footer {
        margin-top: 30px;
    }
}

@media screen and (max-width:420px) {
    .score {
        width: 150px;
    }

    .square {
        width: 90px;
        height: 90px;
    }

    .container {
        width: 100%;
        height: 280px;
    }

    #move {
        font-size: 1.2rem;
    }

    .mx {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media screen and (max-width:340px) {
    .score {
        width: 120px;
        font-size: 1.5rem;
    }

    .square {
        width: 75px;
        height: 75px;
    }

    .container {
        width: 100%;
        height: 235px;
    }

    #move {
        font-size: 1.1rem;
    }

    .mx {
        margin-left: 16px;
        margin-right: 16px;
    }

    .piece {
        font-size: 4.5rem;
    }

    .win {
        font-size: 1.8rem;
    }

    footer {
        font-size: .9rem;
    }
}

@media screen and (max-width:290px) {
    .score {
        width: 110px;
        font-size: 1.3rem;
    }

    .square {
        width: 70px;
        height: 70px;
    }

    .container {
        width: 100%;
        height: 220px;
    }

    #move {
        font-size: 1rem;
    }

    .mx {
        margin-left: 14px;
        margin-right: 14px;
    }

    .piece {
        font-size: 4.3rem;
    }

    .win {
        font-size: 1.6rem;
    }
}


/* ANIMAÇÕES */
@keyframes appear {
    0% {
        opacity: 0;
        transform: scale(0, 0);
    }

    100% {
        opacity: 1;
        transform: scale(1, 1);
    }
}

@keyframes result {
    0% {
        opacity: 0;
        transform: scale(0, 0);
    }

    100% {
        opacity: 1;
        transform: scale(1, 1);
    }
}

@keyframes pieceAnimation {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(1.2);
    }

    50% {
        transform: translateX(-50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes winnerAnimation {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes gameAnimation {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: scale(0);
    }
}

@keyframes restartAnimation {
    0% {
        transform: scale(1.2);
        color: white;
        border-color: white;
    }

    100% {
        transform: scale(1);
        color: rgb(0, 255, 0);
        border-color: rgb(0, 255, 0);
    }
}

@keyframes scoreAnimation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}