* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  min-height: 100vh;
  font-family: "Orbitron", sans-serif;
  background: url("../assets/images/background.jpg") no-repeat center center
    fixed;
  background-size: cover;
  color: white;
  position: relative;
}

.container {
  text-align: center;
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 56.25rem;
  margin: 2.5rem auto;
}

.container h1 {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 1.25rem rgba(0, 150, 255, 0.6);
}

.main-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

.main-menu.hidden {
  display: none;
}

.level-selection {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #7a1c71, #4a148c);
  border-radius: 1.25rem;
  box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.3);
}

.level-selection label {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1.5625rem;
  border-radius: 3.125rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.level-selection label:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
  box-shadow: 0 0 0.625rem #fff;
}

.level-selection input[type="radio"] {
  margin-right: 0.5rem;
  accent-color: #00c6ff;
}

.button {
  background: linear-gradient(45deg, #007bff, #00c6ff);
  border: none;
  border-radius: 3.125rem;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 1.25rem rgba(0, 150, 255, 0.5);
  font-size: 1.2rem;
  font-weight: bold;
  padding: 1em 2em;
  margin: 1em;
  font-family: "Orbitron", sans-serif;
}

.button-seletion {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.button-seletion button {
  max-width: 150px;
  width: 100%;
}

.button:hover,
.start-button:hover {
  transform: scale(1);
  box-shadow: 0 0 2.1875rem rgba(0, 150, 255, 0.9);
}

.retry-button {
  background: #ffffff;
  color: #000000;
  box-shadow: none;
}

.card {
  width: 100%;
  aspect-ratio: 2 / 1.8;
  perspective: 62.5rem;
  cursor: pointer;
  position: relative;
}

.card div {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 0.625rem;
  display: flex;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
  transition: transform 0.6s;
}

.front-side img,
.back-side img {
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: contain;
  border-radius: 0.625rem;
  box-sizing: content-box;
}

.back-side {
  transform: rotateY(180deg);
}

.card.flipped .front-side {
  transform: rotateY(180deg);
}

.card.flipped .back-side {
  transform: rotateY(0deg);
}

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

.card-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}

.card-container.grid-small {
  grid-template-columns: repeat(4, 1fr);
  max-width: 70%;
  margin: 0 auto;
  opacity: 0.9;
}

.card-container.grid-wide {
  grid-template-columns: repeat(6, 1fr);
  max-width: 90%;
  margin: 0 auto;
}

.game-info {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
}

.game-info p {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.625rem 1.5625rem;
  border-radius: 0.625rem;
  font-weight: bold;
  min-width: 5rem;
  text-align: center;
  letter-spacing: 0.0625rem;
}

.game-info p span {
  color: #00c6ff;
  font-size: 1.3rem;
}

.matched,
.time-up {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

@keyframes flash {
  0%,
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 40px #00ff00;
  }

  50% {
    transform: scale(1.2);
    box-shadow: 0 0 50px #00ff00;
  }
}

.unmatched {
  animation: shake 0.5s ease-in-out 1;
  box-shadow: 0 0 50px #d60101;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  50% {
    transform: translateX(10px);
  }

  75% {
    transform: translateX(-10px);
  }
}

.play-again-button {
  text-decoration: none;
}

.error-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10;
}

.error-screen h1 {
  font-size: 2rem;
}

.win-screen,
.lose-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(54, 13, 105, 0.85);
  backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 2rem 3rem;
  border-radius: 1rem;
  text-align: center;
  z-index: 20;
  max-width: 90%;
  width: 400px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 2rem rgba(255, 0, 255, 0.5);
  transition: all 0.3s ease;
}

.win-screen h1,
.lose-screen h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: white;
}

.win-screen p,
.lose-screen p {
  font-size: 1.2rem;
  margin: 0.5rem 0;
  color: #00c6ff;
  font-weight: bold;
}

.win-screen .win-stats {
  color: #347ecc;
  font-size: 1.1rem;
}

.hidden {
  display: none;
}

.matched,
.time-up {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.restart-button,
.main-menu-button {
  padding: 1em 1em;
  margin: 1.5em;
  border-radius: 999px;
  margin-bottom: 20px;
  font-size: 1.2rem;
}

/*Responsive*/
.win-screen h1 {
  color: #fe3efe;
}

.lose-screen h1 {
  color: #ffffff;
}

.win-minion-gif {
  width: 200px;
  max-width: 80%;
  margin: 1rem auto;
  display: block;
}

@media (max-width: 600px) {
  .container h1 {
    font-size: 2.5rem;
    margin: 0.5em;
  }

  .level-selection label {
    padding: 1em 2em;
  }

  .card-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
  }

  .card-container.grid-wide {
    grid-template-columns: repeat(4, 1fr);
  }

  .game-info {
    display: grid;
    grid-template-columns: repeat(2, 2fr);

    gap: 0.625rem;
    font-size: 1rem;
  }

  .main-menu {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }

  .win-screen,
  .lose-screen {
    width: 90%;
    padding: 1.5rem;
    min-height: 180px;
  }

  .win-screen h1,
  .lose-screen h1 {
    font-size: 1.8rem;
  }

  .win-screen p,
  .lose-screen p {
    font-size: 1rem;
  }

  .card-container.grid-small {
    grid-template-columns: repeat(4, 1fr);
    max-width: 100%;
    margin: 0 auto;
  }

  .restart-button,
  .main-menu-button {
    padding: 0.9em 1em;
    font-size: 0.85rem;
    width: auto;
  }
}

@media (max-width: 400px) {
  .card-container {
    grid-template-columns: 1fr;
  }

  main .win-screen {
    min-width: 90%;
    padding: 1.25rem;
  }

  .win-screen,
  .lose-screen {
    width: 95%;
    padding: 1rem;
    min-height: 160px;
  }

  .win-screen h1,
  .lose-screen h1 {
    font-size: 1.5rem;
  }

  .win-screen p,
  .lose-screen p {
    font-size: 0.95rem;
  }
}
