.memory-shell {
  position: relative;
  overflow: hidden;
  padding: 30px !important;
  background:
    radial-gradient(circle at 5% 0, rgba(91, 124, 255, 0.16), transparent 34%),
    radial-gradient(
      circle at 95% 100%,
      rgba(244, 114, 182, 0.1),
      transparent 32%
    ),
    linear-gradient(145deg, #111a32, #080e1d) !important;
  border-color: rgba(143, 167, 255, 0.2) !important;
}
.memory-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.025) 42%,
    transparent 62%
  );
  transform: translateX(-100%);
  animation: memoryShellShine 7s ease-in-out infinite;
}
.memory-head {
  position: relative;
  z-index: 2;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.memory-icon {
  width: 58px !important;
  height: 58px !important;
  border-radius: 19px !important;
  background: linear-gradient(145deg, #566ef0, #7b5de8) !important;
  color: #fff !important;
  box-shadow: 0 14px 34px rgba(91, 124, 255, 0.28);
}
.memory-head h3 {
  font-size: 1.75rem !important;
  background: linear-gradient(90deg, #fff, #aebeff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.memory-pill {
  background: rgba(255, 255, 255, 0.055) !important;
  backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}
.memory-pill strong {
  font-size: 1.15rem !important;
}
.memory-board {
  position: relative;
  z-index: 2;
  grid-template-columns: repeat(6, minmax(90px, 1fr)) !important;
  gap: 11px !important;
  margin-top: 22px;
}
.memory-card {
  min-height: 126px !important;
}
.memory-face {
  border-radius: 18px !important;
}
.memory-back {
  background:
    radial-gradient(
      circle at 25% 15%,
      rgba(34, 211, 238, 0.18),
      transparent 34%
    ),
    radial-gradient(
      circle at 80% 90%,
      rgba(244, 114, 182, 0.16),
      transparent 38%
    ),
    linear-gradient(145deg, #172541, #0c1428) !important;
  border-color: rgba(117, 143, 255, 0.24) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  transition:
    filter 0.25s,
    border-color 0.25s;
}
.memory-card:hover .memory-back {
  filter: brightness(1.18);
  border-color: rgba(34, 211, 238, 0.48) !important;
}
.memory-back::before {
  content: "{ }" !important;
  font-size: 1.45rem !important;
  color: #8299ff;
  text-shadow: 0 0 18px rgba(91, 124, 255, 0.65);
}
.memory-back::after {
  border-style: solid !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent);
}
.memory-front {
  background:
    radial-gradient(
      circle at 50% 10%,
      color-mix(in srgb, var(--memory-color), transparent 76%),
      transparent 48%
    ),
    linear-gradient(145deg, #17243d, #0c1528) !important;
  gap: 10px !important;
}
.memory-front i {
  font-size: 1.85rem !important;
}
.memory-front span {
  font-size: 0.69rem !important;
  text-transform: uppercase;
  letter-spacing: 0.075em;
}
.memory-card.matched .memory-front {
  border-color: color-mix(in srgb, var(--memory-color), #42e8a4 50%) !important;
  box-shadow:
    inset 0 0 35px rgba(66, 232, 164, 0.08),
    0 0 22px rgba(66, 232, 164, 0.1) !important;
}
.memory-card.matched {
  animation: matchedBounce 0.48s ease;
}
.memory-progress {
  position: relative;
  z-index: 2;
  height: 7px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
}
.memory-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b7cff, #22d3ee, #42e8a4);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.42);
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.memory-actions {
  position: relative;
  z-index: 2;
  margin-top: 15px !important;
}
.memory-reset {
  background: linear-gradient(
    135deg,
    rgba(91, 124, 255, 0.2),
    rgba(244, 114, 182, 0.1)
  ) !important;
  border-color: rgba(143, 167, 255, 0.3) !important;
  min-height: 46px !important;
  padding-inline: 18px !important;
}
.memory-reset:hover {
  background: linear-gradient(135deg, #5b7cff, #765de8) !important;
  box-shadow: 0 12px 28px rgba(91, 124, 255, 0.23);
}
.memory-confetti {
  position: absolute;
  z-index: 8;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  background: var(--confetti);
  left: 50%;
  top: 45%;
  pointer-events: none;
  animation: memoryConfetti 0.9s ease-out forwards;
}
@keyframes memoryShellShine {
  0%,
  70% {
    transform: translateX(-100%);
  }
  90%,
  100% {
    transform: translateX(100%);
  }
}
@keyframes matchedBounce {
  45% {
    transform: translateY(-7px) scale(1.04);
  }
}
@keyframes memoryConfetti {
  to {
    opacity: 0;
    transform: translate(var(--cx), var(--cy)) rotate(var(--cr));
  }
}
@media (max-width: 1000px) {
  .memory-board {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .memory-card {
    min-height: 112px !important;
  }
}
@media (max-width: 560px) {
  .memory-shell {
    padding: 16px !important;
  }
  .memory-board {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .memory-card {
    min-height: 96px !important;
  }
  .memory-head h3 {
    font-size: 1.45rem !important;
  }
  .memory-icon {
    width: 50px !important;
    height: 50px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .memory-shell::before,
  .memory-card.matched,
  .memory-confetti {
    animation: none !important;
  }
}
