@keyframes changeColor {
    0% { background-color: #197ce7; }
    50% { background-color: #7379f6; }
  }

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    background-color: #f7ffdc;
    overflow: hidden;
    font-family: 'Merriweather';
}
.container {
    box-sizing: border-box;
    padding: 0.8em;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.card {
    flex: 1 1 calc(33.333%);
    perspective: 1000px;
}
.card-inner {
    position: relative;
    width: 100%;
    padding-top: 100%;
    transform-style: preserve-3d;
    transition: transform 1.6s;
}
.card.flipped .card-inner {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    /* font-size: 1rem; */
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: white;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19);
}
.card-front {
    background-color: #197ce7;
    animation: changeColor 6.3s infinite alternate;
    box-sizing: border-box;
}

.card-1 {
    animation-delay: 0s;
}
.card-7 {
    animation-delay: -0.7s;
}
.card-2 {
    animation-delay: -1.4s;
}
.card-8 {
    animation-delay: -2.1s;
}
.card-6 {
    animation-delay: -2.8s;
}
.card-3 {
    animation-delay: -3.5s;
}
.card-5 {
    animation-delay: -4.2s;
}
.card-9 {
    animation-delay: -4.9s;
}
.card-4 {
    animation-delay: -5.6s;
}

.card-back {
    background-color: white;
    transform: rotateY(180deg);
    outline: none;
}
.card-back-title {
    position: absolute;
    bottom: 0.2em;
    font-size: clamp(0.8rem, 2.5vw, 2rem);
    color: white;
    text-shadow: 0px 0px 4px #484848;
}
.card-back.card-back-color {
    background-color: yellow;
    border: 2px #546b17 solid;
    box-sizing: border-box;
}
.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 2px #546b17 solid;
    cursor: pointer;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}

.fullscreen.hidden {
    display: none;
}

.fullscreen img {
    object-fit: cover;
    width: 100%;
    height: 100vw;
    max-height: 100%;
    max-width: 100vh;
    border-radius: 8px;
}
