*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
}
body {
  background-color: #000;
}
.wrapper {
  padding: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.timer {
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: 1.3em;
}

.game-over {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2;
}
.game-message {
  background-color: #001b0b;
  padding: 1em 1.3em;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
}

.game-over h2 {
  color: #fff;
  text-align: center;
}

.card-container {
  max-width: 610px;
  min-width: 275px;
  justify-content: center;
  display: grid;
  grid-template-columns: repeat(auto-fill, 130px);
  justify-items: center;
  gap: 5px;
}

.card {
  width: 130px;
  height: 100px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s ease;
  cursor: pointer;
}

.card-front,
.card-back {
  border-radius: 3px;
  width: 130px;
  height: 100px;
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.card-front {
  background-color: rgb(1 75 1);
}
.card.flipped {
  transform: rotateY(-180deg);
}

.card-back {
  border: 4px solid #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #a1a1a1;
  transform: rotateY(180deg);
}
.play {
  display: block;
  /* width: 110px; */
  padding: 1em 1.5em;
  border-radius: 0.3em;
  border: 2px solid #fff;
  outline: none;
  background-color: rgb(1, 75, 1);
  color: #fff;
  margin: 1em auto;
  border-radius: 3px;
}
.play:hover {
  border-color: rgb(1, 75, 1);
  background-color: #fff;
  color: rgb(1, 75, 1);
  cursor: pointer;
}
@media (max-width: 500px) {
  .wrapper {
    padding: 0.5em;
  }
  .card-container {
    max-width: 400px;
    grid-template-columns: repeat(auto-fill, 100px);
    gap: 3px;
  }
  .card,
  .card-front,
  .card-back {
    width: 100px;
    height: 70px;
  }
}

@media (max-width: 370px) {
  .wrapper {
    padding: 0;
  }
  .game-message h2 {
    font-size: 0.8em;
  }
  .card-container {
    min-width: 200px;
    grid-template-columns: repeat(auto-fill, 90px);
    gap: 1px;
  }
  .card,
  .card-front,
  .card-back {
    /* background-position: center; */
    width: 90px;
    height: 70px;
  }
}
