.life-app .life-game-card.life-memory-game-card {
  background: radial-gradient(ellipse at 18% 50%, #913ca35c, transparent 64%), #31163c;
  border-color: #c779cf;
}

.life-memory-emblem {
  font-size: clamp(3.25rem, 15vw, 5.5rem);
  line-height: 1;
  transform: rotate(-13deg);
  filter: drop-shadow(0 7px 10px #14091eaa);
}

.life-memory-stage {
  display: grid;
  gap: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 492px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(8px, 3vw, 18px);
  border: 1px solid #865393;
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 8%, #573066 0%, transparent 57%), #251330;
  color: #fff2ff;
  text-align: center;
}

.life-memory-stage p, .life-memory-stage h2 { margin: 0; }
.life-memory-description { font-size: 16px; font-weight: 650; }
.life-memory-rules { color: #e4c8e9; font-size: 12px; line-height: 1.6; }
.life-memory-error { margin: 0 auto; color: #ffb7cc; text-align: center; font-size: 13px; }
.life-memory-error:empty { display: none; }

.life-memory-info, .life-memory-rewards {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #9e61ad;
  border-radius: 14px;
  background: #4b245a;
}

.life-memory-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.3;
}

.life-memory-label .life-icon { flex: none; width: 20px; height: 20px; }
.life-memory-portrait { position: relative; display: grid; place-items: center; height: 148px; isolation: isolate; }
.life-memory-portrait .life-character { width: 148px; height: 148px; object-fit: contain; }
.life-memory-decoration { position: absolute; bottom: 4%; left: 58%; font-size: 42px; filter: drop-shadow(0 4px 6px #12061eaa); }
.life-memory-result { color: #ffcef5; font-size: clamp(22px, 6vw, 34px); text-transform: uppercase; }
.life-memory-total { font-weight: 750; }
.life-memory-rewards { animation: life-memory-enter .35s ease-out both; }

.life-memory-hud { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.life-memory-timer {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: 104px;
  padding: 6px 12px;
  border: 1px solid #bc81d1;
  border-radius: 999px;
  background: #3b204a;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.life-memory-timer.urgent {
  color: #ffaccd;
  border-color: #f779a7;
  animation: life-memory-pulse .85s ease-in-out infinite alternate;
}

.life-memory-hud > div {
  padding: 6px;
  border: 1px solid #865298;
  border-radius: 12px;
  background: #452351;
  color: #e4c6eb;
  font-size: 12px;
}

.life-memory-hud b { display: block; color: #fff3ff; font-size: 16px; line-height: 1.25; }
.life-memory-instruction { color: #f8cbf5; font-size: 17px; font-weight: 750; }
.life-memory-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(3px, 1vw, 6px);
  touch-action: manipulation;
  animation: life-memory-enter .25s ease-out both;
}

.life-memory-cell {
  position: relative;
  display: grid;
  place-items: stretch;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #a867b8;
  border-radius: clamp(6px, 2vw, 11px);
  background: linear-gradient(145deg, #683785, #432257);
  perspective: 260px;
}

.life-memory-cell:disabled { opacity: 1; cursor: default; }
.life-memory-cell:focus-visible { outline: 2px solid #ffd2fd; outline-offset: 2px; z-index: 1; }
.life-memory-cell.open { background: linear-gradient(145deg, #653b77, #301d42); }
.life-memory-tile { position: relative; display: block; transform-style: preserve-3d; transition: transform .28s ease-in-out; }
.life-memory-cell.open .life-memory-tile { transform: rotateY(180deg); }
.life-memory-back, .life-memory-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  font-size: clamp(15px, 7vw, 38px);
  line-height: 1;
}

.life-memory-back img { width: 65%; height: auto; aspect-ratio: 1; border-radius: 50%; }
.life-memory-face { transform: rotateY(180deg); }
.life-memory-face.raspberry::before {
  content: '';
  width: 58%;
  aspect-ratio: 1;
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 35% 29%, #ff92b9 0 11%, #e93374 14% 23%, transparent 25%),
    radial-gradient(circle at 67% 33%, #ff76a6 0 13%, #c91f52 15% 23%, transparent 25%),
    radial-gradient(circle at 48% 55%, #f96d99 0 14%, #d32160 15% 24%, transparent 26%),
    radial-gradient(circle at 28% 57%, #e64882 0 14%, #9d1548 15% 24%, transparent 26%),
    radial-gradient(circle at 70% 64%, #e94c83 0 15%, #ad174e 16% 23%, transparent 25%),
    radial-gradient(circle at 47% 83%, #df3e72 0 12%, #a01749 14% 19%, transparent 21%);
}

.life-memory-face.pomegranate::before {
  content: '';
  width: 50%;
  aspect-ratio: 1;
  border-radius: 48% 48% 44% 44%;
  background: radial-gradient(circle at 28% 26%, #ffb0bb, #ef586e 24%, #b7184b 70%, #7b103b);
}

.life-memory-face.pomegranate::after {
  content: '';
  position: absolute;
  top: 14%;
  left: 42%;
  width: 16%;
  height: 16%;
  clip-path: polygon(0 0, 32% 31%, 50% 0, 67% 31%, 100% 0, 80% 100%, 20% 100%);
  background: #ed6378;
}

.life-memory-cell.matched { border-color: #f49acb; background: #63305f; animation: life-memory-match .32s ease-out; }
.life-memory-cell.matched::after {
  content: '✦';
  position: absolute;
  top: 1px;
  right: 3px;
  color: #ffe0fa;
  font-size: 11px;
  animation: life-memory-star .46s ease-out both;
  pointer-events: none;
}

.life-memory-cell.mismatch { border-color: #f48db2; animation: life-memory-shake .23s .18s ease-out; }
.life-memory-finish { justify-self: center; }
.life-memory-confetti { position: absolute; inset: 0; z-index: -1; color: #ffd1f0; pointer-events: none; }
.life-memory-confetti i {
  position: absolute;
  top: 8%;
  left: 14%;
  font-style: normal;
  animation: life-memory-confetti 1.4s ease-out both;
}

.life-memory-confetti i:nth-child(3n) { left: 28%; top: 44%; color: #fca5af; }
.life-memory-confetti i:nth-child(3n + 2) { left: 82%; top: 22%; color: #fbd390; }
.life-memory-confetti i:nth-child(even) { transform: rotate(28deg); animation-delay: .22s; }
.life-memory-confetti i:nth-child(n + 7) { margin-left: 20px; margin-top: 26px; animation-delay: .4s; }

@keyframes life-memory-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes life-memory-pulse { to { transform: scale(1.06); } }
@keyframes life-memory-match { 45% { transform: translateY(-4px); } }
@keyframes life-memory-star { from { opacity: 1; } to { opacity: 0; transform: translateY(-7px); } }
@keyframes life-memory-shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes life-memory-confetti {
  from { opacity: 0; translate: 0 -16px; }
  20% { opacity: 1; }
  to { opacity: 0; translate: 0 90px; rotate: 160deg; }
}

@media (prefers-reduced-motion: reduce) {
  .life-memory-stage *, .life-memory-stage *::after { animation: none !important; transition: none !important; }
  .life-memory-confetti, .life-memory-cell.matched::after { display: none; }
}
