body {
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  font-family: sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

/* Inherit box-sizing for all elements */
*, *::before, *::after {
  box-sizing: inherit;
}

/* Default: Standard vertical cards = 3 per row */
.card-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  justify-items: center;
}

/* Default: Horizontal MAP cards = 2 per row */
.map-card-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 24px 6px;
  justify-items: center;
  background-color: #eaeaea;
}

/* Large screen (≥1600px) */
@media (min-width: 1200px) {
  .card-container {
    grid-template-columns: repeat(5, 1fr);
  }

  .map-card-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Small screens (≤768px) */
@media (max-width: 720px) {
  .card-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-card-container {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* Card base styles */
.card {
  width: 100%;
  aspect-ratio: 63 / 88;
  -webkit-aspect-ratio: 63 / 88;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

.map-card {
  aspect-ratio: 88 / 63;
  -webkit-aspect-ratio: 88 / 63;
}

/* Flip animation */
.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.9s;
  -webkit-transition: -webkit-transform 0.9s;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  cursor: pointer;
  will-change: transform;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

/* Front and back */
.card-front,
.card-back {
  position: absolute;
  width: 99%;
  height: 99%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 2px solid #ccc;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-front img,
.card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-front {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}
