:root {
    --card-width: 125px;
    --card-height: 175px;
}

body {
    margin: 0;
    background: url(img/background.png) center;
    background-size: cover;
    color: #5e5447;
    font-family: "Kanit", sans-serif;
    text-shadow: 2px 2px 3px rgb(177, 177, 177);
    min-height: 100vh;
    user-select: none;
}

h1 {
    font-size: 60px;
    text-align: center;
}

#ui-container {
    text-align: center;
}

#ui-container h3 {
    margin: 0;
    display: inline-block;
    font-size: 40px;
    text-align: center;
}

#ui-container h3:first-child {
    margin-right: 40px;
}

#card-container {
    font-size: 0;
    margin: 50px auto;
    width: calc((var(--card-width) + 2vw + 12px) * 4);
}

.card {
    display: inline-block;
    position: relative;
    margin: 1vw;
    width: var(--card-width);
    height: var(--card-height);
    border: 2px solid transparent;
    overflow: hidden;
}

.card-down,
.card-up {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 5px;
    transition-duration: 0.3s;
}

.card-down {
    background-image: url(img/card.png);
    background-position: center;
    background-size: cover;
}

.card-up {
    background-position: center;
    background-size: cover;
    transform: rotateY(180deg);
}

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

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

.image-1 .card-up {
    background-image: url(img/image-1.gif), linear-gradient(#4b4244, #4b4244);
}

.image-2 .card-up {
    background-image: url(img/image-2.gif), linear-gradient(#4b4244, #4b4244);
}

.image-3 .card-up {
    background-image: url(img/image-3.gif), linear-gradient(#4b4244, #4b4244);
}

.image-4 .card-up {
    background-image: url(img/image-4.gif), linear-gradient(#4b4244, #4b4244);
}

.image-5 .card-up {
    background-image: url(img/image-5.gif), linear-gradient(#4b4244, #4b4244);
}

.image-6 .card-up {
    background-image: url(img/image-6.gif), linear-gradient(#4b4244, #4b4244);
}

.glow {
    border: 2px solid transparent;
    transition: border 2s linear, box-shadow 2s linear;
}

@keyframes border-glow {
    from {
        border: 2px solid transparent;
        box-shadow: none;
    }

    80% {
        border-color: #5e5447;
        box-shadow: 0 0 10px #5e5447;
    }
}

.border-glow {
    animation: border-glow 2s;
}

.btn-container {
    display: flex;
    justify-content: center;
}

.reset-btn {
    margin: 0 0 30px 0;
    padding: 20px 40px;
    background-color: #5e5447;
    color: white;
    border: 0;
    border-radius: 10px;
    font-family: "Kanit", sans-serif;
    font-size: 1.5em;
}

.reset-btn:hover {
    cursor: pointer;
    background-color: #534a3d;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    text-align: center;
    font-size: 24px;
    margin: 15% auto;
    padding: 20px;
    border-radius: 12px;
    width: 300px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;

    animation: fadeInUp 0.4s ease forwards;
    transform: translateY(30px);
    opacity: 0;
}

@keyframes fadeInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.new-game-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #5e5447;
    color: white;
    border: none;
    border-radius: 6px;
}

.new-game-btn:hover {
    cursor: pointer;
    background-color: #534a3d;
}