@import url('https://fonts.googleapis.com/css2?family=Sarala:wght@400;700&display=swap');

:root {
    --color-normal: #9FA19F;
    --color-fighting: #FF8000;
    --color-flying: #81B9EF;
    --color-poison: #9141CB;
    --color-ground: #915121;
    --color-rock: #AFA981;
    --color-bug: #91A119;
    --color-ghost: #704170;
    --color-steel: #60A1B8;
    --color-fire: #E62829;
    --color-water: #2980EF;
    --color-grass: #3FA129;
    --color-electric: #FAC000;
    --color-psychic: #EF4179;
    --color-ice: #3DCEF3;
    --color-dragon: #5060E1;
    --color-dark: #624D4E;
    --color-fairy: #EF70EF;
    --main-font: 'Sarala', sans-serif;
}

@keyframes match-animation {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(0, 150, 255, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(0, 150, 255, 1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(0, 150, 255, 0.5);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #c4c4c4;
    font-family: var(--main-font);
}

main {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 1rem;

    width: fit-content;
    margin: auto;
    margin: 2rem auto;
}

.card {
    width: 220px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;

    position: relative;
    perspective: 1000px; /* Needed for 3D effect */
    cursor: pointer;
}

.card > div {
    border-radius: 50%;
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.5s ease-in-out;
    box-shadow: 3px 3px 7px #00000071;
}

.card-back {
    background: linear-gradient(to bottom, #E41F25 49%, #000 49%, #000 51%, #FFF 51%),
    radial-gradient(circle, #FFF 0%, #FFF 15%, transparent 15%);
    border: 4px solid #000;
    transform: rotateY(0);
    display: grid;
    place-items: center;

        .circle {
            background-color: #fff;
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            border: 4px solid #000;
        }
}

.card-front {
    display: flex; 
    justify-content: center;
    align-items: center;
    background-color: #fff; 
    transform: rotateY(180deg); 
    border: 6px solid;

    .cardImg {
        max-width: 90%; 
        max-height: 90%;
        filter: drop-shadow(3px 3px 7px #ffffff85); 
    }
}

.card.flipped .card-front {
    transform: rotateY(0);
}

.card.flipped .card-back {
    transform: rotateY(180deg); 
}

.match {
    filter: grayscale(0.5);
    animation: match-animation 0.5s ease-in-out;
}

#game-finish {
    text-align: center;
    margin: 2rem auto;
    font-size: 1.2rem;
    background-color: #ffffff83;
    padding: 1rem;


    #checks {
        color: #E41F25;
        font-weight: bold;
    }

    #btn {
        background-color: #000;
        color: #fff;
        border: none;
        padding: .5rem;
        border-radius: 15px;
        font-size: 1.15rem;
        font-weight: bold;
        letter-spacing: .115rem;
        cursor: pointer;
        transition: background-color 0.3s ease-in-out;

        &:hover {
            background-color: #E41F25;
        }
    }
}

.hidden {
    display: none;
}

@media screen and (max-width: 425px) {
    main {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        max-width: 160px;
    }
}

@media screen and (max-width: 375px) {
    .card {
        max-width: 120px;
    }
}