.memory-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.mem-card {
  aspect-ratio: 1;
  cursor: pointer;
  perspective: 600px;
  -webkit-tap-highlight-color: transparent;
}

.mem-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  border-radius: 10px;
}

.mem-card.flipped .mem-card-inner,
.mem-card.matched .mem-card-inner {
  transform: rotateY(180deg);
}

.mem-card-front,
.mem-card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mem-card-front {
  background: linear-gradient(135deg, #1c1c2e, #2a2a3e);
  border: 1px solid rgba(108,99,255,0.25);
  font-size: 28px;
  color: rgba(108,99,255,0.4);
  transition: border-color 0.2s;
}

.mem-card:hover:not(.flipped):not(.matched) .mem-card-front {
  border-color: rgba(108,99,255,0.6);
  background: linear-gradient(135deg, #22223e, #2e2e4e);
}

.mem-card-back {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  transform: rotateY(180deg);
  font-size: clamp(20px, 4vw, 36px);
}

.mem-card.matched .mem-card-back {
  background: rgba(0,230,118,0.1);
  border-color: rgba(0,230,118,0.4);
  box-shadow: 0 0 20px rgba(0,230,118,0.2);
}

@keyframes matched-pulse {
  0%   { transform: rotateY(180deg) scale(1); }
  50%  { transform: rotateY(180deg) scale(1.06); }
  100% { transform: rotateY(180deg) scale(1); }
}
.mem-card.matched .mem-card-inner {
  animation: matched-pulse 0.4s ease;
}

.win-title { font-family:var(--font-display); font-size:32px; font-weight:800; color:#fff; margin-bottom:8px; }
.win-sub { font-size:16px; color:var(--text-secondary); margin-bottom:20px; }
.win-btn { padding:12px 32px; background:var(--accent); color:#fff; border:none; border-radius:var(--radius); font-size:15px; font-weight:700; cursor:pointer; font-family:var(--font-display); }
.win-btn:hover { background:#7c73ff; }
