
/* ============================================================
   MEMORY GAME — LAYOUT + STYLING
============================================================ */

.memory-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

/* Difficulty Buttons */
.difficulty-select {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.difficulty-btn {
  padding: 10px 20px;
  background: var(--dark-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.difficulty-btn:hover {
  background: #1a3a63;
  transform: translateY(-2px);
}

/* Scoreboard */
.scoreboard {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
  font-size: 20px;
  font-weight: bold;
  color: var(--dark-blue);
}

/* ============================================================
   GRID — Expand width so Medium + Hard cards match Easy size
============================================================ */

.memory-grid {
  display: grid;
  gap: 16px;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.4s ease;
  margin: 0 auto;
}

/* Easy (4 columns) */
.pairs-6 {
  grid-template-columns: repeat(4, 1fr);
  max-width: 500px;
}

/* Medium (4 columns) — enough width for Easy-sized cards */
.pairs-8 {
  grid-template-columns: repeat(4, 1fr);
  max-width: 1500px; /* increased more than before */
}

/* Hard (6 columns) — enough width for Easy-sized cards */
.pairs-12 {
  grid-template-columns: repeat(6, 1fr);
  max-width: 2200px; /* increased more than before */
}

/* Mobile adjustments */
@media (max-width: 900px) {
  .pairs-6  { grid-template-columns: repeat(2, 1fr); max-width: 600px; }
  .pairs-8  { grid-template-columns: repeat(3, 1fr); max-width: 900px; }
  .pairs-12 { grid-template-columns: repeat(4, 1fr); max-width: 1200px; }
}

@media (max-width: 600px) {
  .pairs-6,
  .pairs-8,
  .pairs-12 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 500px;
  }
}

/* ============================================================
   CARD
============================================================ */

.card {
  width: 125px;
  aspect-ratio: 1 / 1;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  cursor: pointer;
}

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

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

/* Back of card */
.card-back {
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card-back img {
  width: 70%;
  height: auto;
  opacity: 0.9;
}

/* Front of card */
.card-front {
  background: white;
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.card-front img {
  width: 90%;
  height: auto;
  object-fit: contain;
}

/* ============================================================
   WIN SCREEN
============================================================ */

.win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 999;
}

.win-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.win-box {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  transform: scale(0.7);
  animation: popIn 0.45s ease forwards;
}

@keyframes popIn {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

.win-box h2 {
  font-size: 32px;
  color: var(--dark-blue);
  margin-bottom: 20px;
}

.win-stats {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--dark-blue);
}

.new-record {
  color: var(--accent-lime);
  font-weight: bold;
  margin-bottom: 10px;
}

.play-again-btn {
  padding: 12px 24px;
  background: var(--dark-blue);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.play-again-btn:hover {
  background: #1a3a63;
  transform: translateY(-2px);
}