
/* Style for the main heading */
h1 {
  margin-bottom: 2em;
  font-size: 2em;
}

/* General body styles */
body {
  background: #FFFA8D;
  text-align: center;
}


/* Grid layout for tiles (Updated for 16 tiles) */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 2em);
  grid-template-rows: repeat(4, 2em);
  gap: .4em;
  justify-content: center;
  margin-bottom: 2em;
}

/* Style for each tile */
.tile {
  width: 2em;
  height: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.5s ease-in-out;
  transform-style: preserve-3d;
  position: relative;
  border-radius: .5em;
}

.tile:hover {
  transform: scale(1.05);
}

/* Style for the visible side of the tile */
.tile .front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: .5em;
  transform: rotateY(180deg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Style for the hidden side (the back) */
.tile .back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: .5em;
  
}

/* Style for flipped tiles */
.tile.flipped {
  transform: rotateY(180deg);
}

/* Style for matched tiles */
.tile.matched .front{
  pointer-events: none;
}

.tile.matched .front{
  background-color: rgb(28, 81, 19);
  color: greenyellow;
}

/* small screen responsive design */
@media screen and (max-width: 480px) {
  h1 {
      font-size: 40px;
  }
  .grid {
      grid-template-columns: repeat(4, 4.375em);
      grid-template-rows: repeat(4, 4.375em);
  }
  .tile {
      width: 3.5em;
      height: 3.5em;
      font-size: 1.25em;
  }
}

/* medium screen responsive design */
@media screen and (min-width: 481px) and (max-width: 768px) {
  h1 {
      font-size: 50px;
  }
  .grid {
      grid-template-columns: repeat(4, 8em);
      grid-template-rows: repeat(4, 8em);
  }
  .tile {
      width: 4em;
      height: 4em;
      font-size: 2em;
  }
}

/* Adjustments for larger screens if needed */
@media screen and (min-width: 769px) {
  .grid {
      grid-template-columns: repeat(4, 8em);
      grid-template-rows: repeat(4, 8em);
  }
  .tile {
      width: 4em;
      height: 4em;
      font-size: 2em;
  }
}