/* Reset default styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#preload-images {
    display: none;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    background-color: transparent;
    animation: backgroundFade 70s infinite linear;
    opacity: 1;
}

body.loaded {
    opacity: 1;
}

@keyframes backgroundFade {

    0%,
    4.5% {
        background-image: url("../images/space_centre.jpg");
    }

    9.5%,
    14% {
        background-image: url("../images/science_facility.jpg");
    }

    19%,
    23.5% {
        background-image: url("../images/mystic-zone.jpg");
    }

    28.5%,
    33% {
        background-image: url("../images/abandoned_park.jpg");
    }

    38%,
    42.5% {
        background-image: url("../images/defenders_base.jpg");
    }

    47.5%,
    52% {
        background-image: url("../images/villains_den.jpg");
    }

    57%,
    61.5% {
        background-image: url("../images/beach_club.jpg");
    }

    66.5%,
    71% {
        background-image: url("../images/stadium.jpg");
    }

    76%,
    80.5% {
        background-image: url("../images/theatre.jpg");
    }

    85.5%,
    90% {
        background-image: url("../images/ancient_ruins.jpg");
    }

    95%,
    100% {
        background-image: url("../images/space_centre.jpg");
    }
}

#animation {
    position: fixed;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 50px;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: spinDown 3s ease-in-out forwards;
    opacity: 0;
    z-index: 9999;
}

@keyframes spinDown {
    0% {
        top: -100px;
        transform: translateX(-50%) rotate(0deg);
        opacity: 0;
    }

    45% {
        top: 50%;
        transform: translateX(-50%) rotate(360deg);
        opacity: 1;
    }

    55% {
        top: 50%;
        transform: translateX(-50%) rotate(360deg);
        opacity: 1;
    }

    100% {
        top: -100px;
        transform: translateX(-50%) rotate(0deg);
        opacity: 0;
    }
}



html {
    width: 100%;
    height: 100%;
    background: transparent;
    font-family: Arial, Helvetica, sans-serif;
}


.game {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.controls {
    display: flex;



    gap: 10px;
    margin-bottom: 10px;
    margin-top: 1px;
    flex-grow: 1;

}


button {
    background: transparent;
    color: #FFF;
    border-radius: 5px;
    padding: 10px 20px;
    border: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18pt;
}

.restart-button {
    display: flex;
    justify-content: center;
    background: #282A3A;
    color: #FFF;

    border-radius: 5px;
    padding: 10px 10px;
    border: 10px;
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14pt;
}

.stats {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    border-radius: 5px;
    background-color: #282A3A;
    padding: 10px 20px;
    border: 0;
    font-size: 14pt;
    flex-grow: 1;

}



.board-container {
    position: relative;
    align-items: center;
}

.board,
.win {
    border-radius: 5px;
    box-shadow: 0 25px 50px rgb(33 33 33 / 25%);
    background-color: rgba(255, 255, 255, 0.5);
    transition: transform .6s cubic-bezier(0.4, 0.0, 0.2, 1);
    backface-visibility: hidden;
}

.board {
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(4, auto);
    transform-style: preserve-3d;
    grid-gap: 3px;
}

.board-container.flipped .board {
    transform: rotateY(180deg) rotateZ(50deg);
}

.board-container.flipped .win {
    transform: rotateY(0) rotateZ(0);
}

.card {
    position: relative;
    width: 80px;
    height: 80px;
    cursor: pointer;
    perspective: 1000px;
}

.disabled {
    color: #757575;
}

.card-front,
.card-back {
    position: absolute;
    border-radius: 5px;
    width: 100%;
    height: 100%;
    background: #282A3A;
    transition: transform .6s cubic-bezier(0.4, 0.0, 0.2, 1);
    backface-visibility: hidden;
}

.card-back {
    transform: rotateY(180deg) rotateZ(50deg);
    font-size: 28pt;
    user-select: none;
    line-height: 80px;
    background: #FDF8E6;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}


.card.flipped .card-front {
    transform: rotateY(180deg) rotateZ(50deg);
}

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

.win {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    transform: rotateY(180deg) rotateZ(50deg);
}

.win-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 21pt;
    color: #282A3A;
}

.highlight {
    color: #000000
}

/* Style the Square Buy now button */
.button-container {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.button-wrapper {
    flex: 1;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.button {
    display: inline-block;
    font-size: 3px;
    line-height: 5px;
    height: 5px;
    color: #ffffff;
    min-width: 5px;
    background-color: #000000;
    text-align: center;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
    border-radius: 1px;

    /* Remove underline */
    text-decoration: none;

    /* Animation */
    animation-name: pulsate;
    animation-duration: 2s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

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

    50% {
        transform: scale(1.1);
    }

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

/* Media query for small screen sizes */
@media (max-width: 400px) {
    .game {
        margin-top: 30%;
    }

    .controls {
        flex-direction: column;
        margin-top: 40px;
    }

    .stats {
        flex-direction: column;
        align-items: center;

    }

    .restart-button {
        flex-direction: column;
        align-items: center;
        margin-bottom: 100px;
    }


}