.main-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: max(1.5vw, 0.75rem);
}

.image-card-main {
  background-color: transparent;
  width: max(6.75vw, 4rem);
  aspect-ratio: 1;
  perspective: 1000px;
  transition: transform 0.3s;
}

.image-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.image-card-inner img {
  display: block;
  width: 100%;
  height: auto;
}

.main-grid:not(:has(.two-active)) .image-card-main:not(.active):hover {
  transform: scale(1.1);
}
.active {
  transform: scale(1.03);
}

.image-card-main.active .image-card-inner {
  transform: rotateY(180deg);
}

.image-card-front,
.image-card-back {
  border-radius: 0.5rem;
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  user-select: none;
}

.image-card-front {
  background-color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: max(3vw, 2rem);
  color: rgba(0, 0, 0, 0.3);
}

.image-card-back {
  background-color: #2980b9;
  overflow: hidden;
  color: white;
  transform: rotateY(180deg);
}

button {
  background-color: var(--text);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--bg);
  border: 2px solid var(--text);
}

.how-to-play {
  width: min(600px, 80%);
  text-align: center;
  font-size: 1.2rem;
}

.modal {
  /* Appearance */
  width: max(80vw, 20rem);
  aspect-ratio: 2;
  background-color: var(--bg);
  border-radius: 1.5rem;

  /* Positioning */
  position: absolute;
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-box-shadow: 0px 0px 300px 50px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 0px 0px 300px 50px rgba(0, 0, 0, 0.75);
  box-shadow: 0px 0px 300px 50px rgba(0, 0, 0, 0.75);

  /* Other */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-hidden {
  display: none;
}

.modal-text {
  text-align: center;
  font-size: 1.5rem;
  line-height: 1.75rem;
}
