.memory-app {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
  max-width: 100vw;
}
h1 {
  color: #1b805d;
  font-size: clamp(
    1.9rem,
    7vw,
    3.2rem
  ); /*clamp( minimum,   preferred / ideal,   maximum ) */
  margin-bottom: 1rem;
}
.subtitle {
  color: #5f8f8b;
  -webkit-text-stroke: 0.05rem #000000; /* border */
  font-size: clamp(1rem, 4vw, 1.35rem);
  margin-bottom: 1.5rem;
}

/* Moves & Pairs display */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  background: linear-gradient(135deg, #16664c, #b3e7cd);
  color: #e6fffa;
  padding: 1rem;
  border-radius: 20px;
  margin: 0 4rem;
  font-size: 1.3rem;
  font-weight: bold;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

/* THE BOARD – 4×4 grid */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-content: center;
  gap: 1.2rem;
  max-width: 33rem;
  margin: 2rem auto 1.5rem;
  perspective: 1100px; /* nice 3D depth */
}

/* EACH CARD – square, clickable */
.card {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background: repeating-linear-gradient(
    45deg,
    #7dcbbb,
    #7dcbbb 2px,
    #2a9f74 2px,
    #2a9f74 4px
  );
  color: transparent;
  font-size: 3.8rem;
  border: #1b805d;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow:
    0 14px 28px rgba(42, 159, 116, 0.45),
    0 0 0 3px rgba(125, 203, 187, 0.35);
}

/* When flipped → turn around */
.card.flipped {
  background: #f6fffb;
  color: #000000;
  cursor: default;
  transform: rotateY(180deg);
}

.card.matched {
  background: radial-gradient(circle at center, #80d5b0, #1b805d);
  cursor: default;
  transform: rotateY(180deg) scale(1.03);
  box-shadow: 0 12px 35px rgba(95, 211, 188, 0.6);
  animation: happyGlow 1.2s ease-out;
}

/* Reset button – playful */
.play-again {
  padding: 1rem 2.5rem;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #5fd3bc, #c9f2ea);
  color: #2f4f4f;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(95, 211, 188, 0.45);
  transition: all 0.3s;
  margin: 0 4rem;
}

.play-again:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 30px rgba(95, 211, 188, 0.6);
}

/* Win message */
.win-message {
  margin: 2rem 4rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #c9f2ea, #dff4ff);
  color: #2f4f4f;
  font-size: 1.8rem;
  font-weight: bold;
  border-radius: 25px;
  box-shadow: 0 10px 35px rgba(95, 211, 188, 0.45);
  animation: popIn 0.7s ease-out;
}

.win-message.hidden {
  display: none;
}

/* Animations */
@keyframes happyGlow {
  0% {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  }
  50% {
    box-shadow: 0 0 40px #1b805d;
    transform: rotateY(180deg) scale(1.15);
  }
  100% {
    box-shadow: 0 12px 35px rgba(27, 128, 93, 0.7);
    transform: rotateY(180deg) scale(1.08);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  70% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1268px) {
  h1 {
    font-size: 2.8rem;
  }
  .board {
    gap: 0.6rem;
    width: 80%;
    margin: 1rem auto 0.5rem;
  }
  .game-stats {
    gap: 0.5rem;
    margin: 0 3rem 2rem;
    padding: 1rem;
  }
  .play-again {
    margin: 0 3rem;
  }
  .card {
    border-width: 2px;
    border-radius: 10px;
    font-size: 3rem;
  }
}

@media (max-width: 912px) {
  .card {
    font-size: 3.5rem;
  }
}

@media (max-width: 768px) {
  .game-stats {
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem;
    padding: 0.5rem;
  }
  .play-again {
    margin: 2rem;
  }
  .card {
    font-size: 2.5rem;
    margin-bottom: 10px;
  }
}

@media (max-width: 540px) {
  h1 {
    font-size: 2rem;
  }
  .game-stats {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    font-size: 1.1rem;
  }
  .card {
    font-size: 2.3rem;
    padding: 10px;
    margin-bottom: 10px;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 1.68rem;
  }
  .card {
    font-size: 2rem;
  }
}
@media (max-width: 375px) {
  h1 {
    font-size: 1.5rem;
  }
  .card {
    font-size: 1.68rem;
  }
}
