/* Superkids V1 -- Memory 🃏 (3D flip cards) */
.memory-root { overflow: hidden !important; }
.memory-wrap {
  width: 100%; max-width: 1100px; flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* top row: big 🔊 + pair progress */
.memory-top { display: flex; align-items: center; justify-content: center; gap: 16px; flex: none; }
.memory-say {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--sun); font-size: 36px; line-height: 1;
  box-shadow: 0 7px 0 var(--sun-d), 0 12px 20px rgba(0,0,0,.14);
  transition: transform .1s, box-shadow .1s;
}
.memory-say:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--sun-d); }
.memory-dots {
  display: flex; gap: 10px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.75);
  box-shadow: 0 5px 0 rgba(108,92,231,.22);
}
.memory-dot {
  width: 48px; height: 48px; border-radius: 50%;
  background: #e8e5fb; box-shadow: inset 0 4px 0 rgba(0,0,0,.08);
  display: grid; place-items: center; font-size: 30px; line-height: 1;
}
.memory-dot::after { content: '?'; color: #b9b2ef; font-weight: 800; font-size: 26px; }
.memory-dot.on { background: #c9f7e6; box-shadow: 0 0 0 4px var(--mint) inset; animation: memory-boing .55s cubic-bezier(.34,1.56,.64,1); }
.memory-dot.on::after { content: attr(data-emoji); color: inherit; font-size: 30px; }

/* grid */
.memory-grid {
  --mem-w: 120px; --mem-h: 146px; --mem-gap: 14px;
  flex: 1; min-height: 0; width: 100%;
  display: grid; justify-content: center; align-content: center;
  gap: var(--mem-gap);
  padding-bottom: 10px; /* room for the card bottom shadow */
}

/* one card */
.memory-card {
  position: relative; width: var(--mem-w); height: var(--mem-h);
  padding: 0; background: none; border-radius: 22px;
  perspective: 900px;
  animation: memory-deal .5s backwards cubic-bezier(.34,1.56,.64,1);
  transition: transform .12s;
}
.memory-card:active:not(.memory-up) { transform: translateY(6px) scale(.97); }
.memory-inner {
  position: absolute; inset: 0; display: block;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.34,1.4,.64,1);
}
.memory-card.memory-up .memory-inner { transform: rotateY(180deg); }
.memory-card.memory-nope .memory-inner { animation: memory-nope .25s ease-in-out; }

.memory-back, .memory-face {
  position: absolute; inset: 0; border-radius: 22px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
}
.memory-back {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.0) 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 12px, transparent 12px 24px),
    radial-gradient(circle at 20% 15%, #a29bfe, transparent 55%),
    radial-gradient(circle at 85% 90%, #FF6B9D, transparent 55%),
    linear-gradient(150deg, #8c7cff, #6C5CE7 55%, #e2487c);
  border: 5px solid #fff;
  box-shadow: 0 8px 0 #4a3cb8, 0 14px 22px rgba(0,0,0,.18);
}
.memory-q {
  width: 58%; aspect-ratio: 1; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  font-size: calc(var(--mem-w) * .32); line-height: 1;
  box-shadow: 0 6px 0 rgba(0,0,0,.15), inset 0 -5px 0 #f0edff;
  animation: memory-twinkle 2.6s ease-in-out infinite;
}
.memory-card:nth-child(2n) .memory-q { animation-delay: -1.3s; }

.memory-face {
  transform: rotateY(180deg);
  background: #fff; border: 5px solid #fff;
  box-shadow: 0 8px 0 #d6d1f5, 0 14px 22px rgba(0,0,0,.16);
  justify-content: flex-start; padding: 6px 6px 0;
}
.memory-pic {
  position: relative; display: block; width: 100%; flex: 1; min-height: 0;
  border-radius: 15px; overflow: hidden; background: #f3f1ff;
}
.memory-pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.memory-emo { display: none; position: absolute; inset: 0; place-items: center; font-style: normal; font-size: calc(var(--mem-w) * .5); }
.memory-noimg .memory-pic img { display: none; }
.memory-noimg .memory-emo { display: grid; }
.memory-word {
  flex: none; padding: 2px 0 4px;
  font-weight: 800; color: var(--ink); line-height: 1.1;
  font-size: clamp(16px, calc(var(--mem-w) * .16), 30px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* matched: pop + green glow */
.memory-card.memory-match { animation: memory-boing .6s cubic-bezier(.34,1.56,.64,1); }
.memory-card.memory-match .memory-face {
  border-color: var(--mint);
  box-shadow: 0 8px 0 var(--mint-d), 0 0 0 5px rgba(0,184,148,.35), 0 0 28px 6px rgba(0,184,148,.55);
}
.memory-card.memory-match .memory-word { color: var(--mint-d); }
.memory-done .memory-card { animation: memory-hop .7s cubic-bezier(.34,1.56,.64,1) both; }
.memory-done .memory-card:nth-child(2n) { animation-delay: .1s; }
.memory-done .memory-card:nth-child(3n) { animation-delay: .2s; }

@keyframes memory-deal { from { transform: translateY(40px) rotate(-8deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes memory-boing { 0% { transform: scale(1); } 35% { transform: scale(1.15); } 65% { transform: scale(.95); } 100% { transform: scale(1); } }
@keyframes memory-hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-22px) rotate(-3deg); } }
@keyframes memory-nope { 0%,100% { transform: rotateY(180deg); } 30% { transform: rotateY(180deg) rotate(-4deg); } 70% { transform: rotateY(180deg) rotate(4deg); } }
@keyframes memory-twinkle { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(8deg); } }

@media (max-width: 600px) {
  .memory-wrap { gap: 10px; }
  .memory-dot { width: 40px; height: 40px; font-size: 24px; }
  .memory-dot.on::after { font-size: 24px; }
  .memory-back, .memory-face, .memory-card { border-radius: 18px; }
}

/* 🧠 Memory Lab button (Laravel Kid Mode activities) */
.memory-lab-btn {
  min-height: 72px; padding: 0 20px 0 14px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(150deg, #A55EEA, #6C5CE7); color: #fff;
  box-shadow: 0 7px 0 #4b3bb8, 0 12px 20px rgba(0,0,0,.16), inset 0 4px 0 rgba(255,255,255,.25);
  transition: transform .1s, box-shadow .1s;
  animation: memory-lab-wiggle 3.2s ease-in-out 1.2s infinite;
}
.memory-lab-btn .e { font-size: 38px; line-height: 1; }
.memory-lab-btn .t { font-size: 22px; font-weight: 800; white-space: nowrap; }
.memory-lab-btn:active { transform: translateY(6px); box-shadow: 0 1px 0 #4b3bb8; }
@keyframes memory-lab-wiggle { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-5deg) scale(1.05); } 95% { transform: rotate(5deg) scale(1.05); } }
@media (max-width: 600px) {
  .memory-top { gap: 10px; flex-wrap: wrap; }
  .memory-lab-btn .t { font-size: 18px; }
}
