/* Mobile First */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #DEAA79;
    text-align: center;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

h1 {
    color: #659287;
    margin-bottom: 20px;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Informações do Jogo */

.game-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.game-info p {
    color: #659287;
    font-size: 1rem;
    margin: 5px 0;
    font-weight: bold;
}

.game-info span {
    color: #FFE6A9;
    background: #659287;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* Botão Novo Jogo*/

.new-game-btn {
    background: linear-gradient(45deg, #659287, #7BA68C);
    color: #FFE6A9;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(101, 146, 135, 0.3);
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(101, 146, 135, 0.4);
}

/* Tabuleiro */

#gameBoard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 8px;
    max-width: 320px;
    width: 100%;
    margin: 0 auto;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);

    box-sizing: border-box;
    position: relative;
    left: 0;
    right: 0;
}

/* Cards */

.card {
    width: 100%;
    aspect-ratio: 1;
    min-height: 65px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    animation: matchFound 0.8s ease;
}

@keyframes matchFound {
    0% {
        transform: scale(1) rotateY(180deg);
    }

    25% {
        transform: scale(1.15) rotateY(180deg);
    }

    50% {
        transform: scale(1.1) rotateY(180deg);
    }

    75% {
        transform: scale(1.05) rotateY(180deg);
    }

    100% {
        transform: scale(1) rotateY(180deg);
    }
}

.card_front,
.card_back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: #FFE6A9;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    backface-visibility: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.card_front {
    background: linear-gradient(135deg, #659287, #7BA68C);
    transform: rotateY(180deg);
}

.card_back {
    background: linear-gradient(135deg, #B1C29E, #9AB89A);
}

.card:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.card.flipped:hover {
    transform: rotateY(180deg) scale(1.05) translateY(-3px);
}

.card.matched {
    pointer-events: none;
}

.card.matched .card_front,
.card.matched .card_back {
    border-color: #FFE6A9;
    box-shadow: 0 4px 15px rgba(255, 230, 169, 0.4);
}

/* Mensagens */

.loading-message {
    color: #659287;
    font-size: 1.1rem;
    margin-top: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Tela de Vitória */

.victory-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.victory-content {
    background: linear-gradient(135deg, #FFE6A9, #F5D982);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 350px;
    animation: victoryAppear 0.5s ease;
}

@keyframes victoryAppear {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.victory-content h2 {
    color: #659287;
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.victory-content p {
    color: #659287;
    font-size: 1.2rem;
    margin-bottom: 25px;
    font-weight: bold;
}

.play-again-btn {
    background: linear-gradient(45deg, #659287, #7BA68C);
    color: #FFE6A9;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(101, 146, 135, 0.3);
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(101, 146, 135, 0.5);
}

/* Tablet */

@media (min-width: 768px) {
    body {
        padding: 25px;
    }

    h1 {
        font-size: 2.2rem;
        margin-bottom: 25px;
    }

    .game-info {
        padding: 20px;
        margin-bottom: 25px;
    }

    .game-info p {
        font-size: 1.1rem;
    }

    #gameBoard {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 12px;
        max-width: 520px;
        padding: 20px;
    }

    .card {
        min-height: 85px;
    }

    .card_front,
    .card_back {
        border-radius: 12px;
        font-size: clamp(1.5rem, 3vw, 2.2rem);
        border: 3px solid rgba(255, 255, 255, 0.2);
    }
}

/* Desktop */

@media (min-width: 1024px) {
    body {
        padding: 30px;
        padding-left: 30px;
        padding-right: 30px;
    }

    h1 {
        font-size: 2.8rem;
        margin-bottom: 30px;
    }

    .game-info {
        padding: 25px;
        margin-bottom: 30px;
    }

    .game-info p {
        font-size: 1.2rem;
    }

    #gameBoard {
        gap: 15px;
        max-width: 600px;
        margin: 0 auto;
        display: grid;
        justify-content: center;
        align-content: center;
        box-sizing: border-box;
        position: static;
        left: auto;
        right: auto;
        padding: 25px;
    }

    .card {
        min-height: 100px;
    }

    .card_front,
    .card_back {
        border-radius: 15px;
        font-size: clamp(1.8rem, 2.5vw, 2.5rem);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .victory-content {
        max-width: 450px;
        padding: 50px;
    }
}

/* Desktop Maior */

@media (min-width: 1440px) {
    #gameBoard {
        max-width: 700px;
        gap: 18px;
        box-sizing: border-box;
        position: relative;
        left: 0;
        right: 0;
        padding-left: 15px;
        padding-right: 15px;
    }

    .card {
        min-height: 120px;
    }

    .card_front,
    .card_back {
        font-size: 2.8rem;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    }
}