@charset "utf-8";

html {
    min-height: -webkit-fill-available;
}

body {
    background-image: url("./Image/background.png"), linear-gradient(12.12deg, #83B855 1.7%, #FFE57C 98.73%);
    background-repeat: no-repeat;
    background-size: cover;
}

#game-container {
    max-width: 350px;
    padding: 40px 10px;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
}

h1 {
    color: #e57373;
    font-weight: 700;
    font-size: 2.2em;
}

h3 {
    margin: 0;
    color: #3D3D3D;
    font-size: 20px;
}

#game-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: auto;
    font-size: 20px;
    font-weight: 400;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
    /* justify-content: center; */
    gap: 16px;
    width: 100%;
    /* height: 100%; */
    padding: 32px 0;
    /* margin: 0 auto; */
}

.card {
    aspect-ratio: 1 / 1;
    min-width: 50px;
    width: 25vw;
    max-width: 100px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0px 0px 8px 0px #0000001a;

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-front {
    background: #FFF0D3;
    transform: rotateY(180deg);
}

.card-front img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.card-back {
    background: #FFF0D3;
    background-image: url('Image/card-back.png');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

.card.matched {
    pointer-events: none;
}

.card.animating {
    animation: pop 0.5s ease-in-out;
}

@keyframes pop {
    0% {
        transform: rotateY(180deg) scale(1);
    }

    50% {
        transform: rotateY(180deg) scale(1.15);
    }

    100% {
        transform: rotateY(180deg) scale(1);
    }
}

.card.shake {
    animation: shake 0.4s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0) rotateY(180deg);
    }

    25% {
        transform: translateX(-5px) rotateY(180deg);
    }

    50% {
        transform: translateX(5px) rotateY(180deg);
    }

    75% {
        transform: translateX(-5px) rotateY(180deg);
    }
}

#winPopup {
    position: fixed;
    inset: 0;
    background: #00000099;
    display: flex;
    align-items: center;
    justify-content: center;
}

.failPopup.popup-topImg {
    top: -105px;
}

.winPopup.popup-title-Div,
.failPopup.popup-title-Div {
    justify-content: center;
    margin-bottom: 4px;
}

#winPopup .popup-title,
#failPopup .popup-title {
    margin: 0;
    font-weight: 500;
    font-size: 18px;
    line-height: 150%;
    text-align: center;
    color: #FF6600;
}

.popup-content.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-text {
    font-size: 16px;
    line-height: 150%;
    margin: 0;

    background: transparent;
    text-align: center;
}