body {
  font-family: 'Arial', sans-serif;
  background-color: #ece6e6;
  margin: 0;
  min-height: 100vh;
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 20px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); /* Responsive column sizing */
  gap: 10px;
  justify-content: center;
  align-content: center;
  padding: 0 10px;
  width: 100%;
  max-width: 600px; /* Limit max size for desktop */
}

.card {
  aspect-ratio: 1 / 1; /* Keep square shape */
  background-color: #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(14px, 4vw, 28px); /* Responsive font size */
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  position: relative;
  perspective: 1000px;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
}

.card.flip .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-front {
  background-color: #eee;
  transform: rotateY(180deg);
}

.card-back {
  background-color: #607d8b;
  color: white;
}

#status {
  margin-top: 20px;
  font-size: 20px;
}

/* Mobile adjustments */
@media (max-width: 500px) {
  #game-board {
    gap: 6px; /* Reduce spacing */
  }
  .card {
    font-size: clamp(12px, 5vw, 24px); /* Slightly bigger on very small screens */
  }
}
