.memory-header {
  background: rgba(4, 4, 4, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.memory-logo {
  height: 5.6rem;
}

.memory-main {
  padding-top: calc(var(--header-height) + 40px);
}

.memory-hero,
.memory-notes {
  width: min(1180px, calc(100% - 4rem));
  margin: 0 auto;
}

.memory-hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(340px, 1.12fr);
  gap: 2rem;
  align-items: start;
  padding: 4.5rem 0 3rem;
}

.memory-copy {
  display: grid;
  gap: 1rem;
}

.memory-copy h1 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(3.1rem, 7vw, 5.6rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.memory-subline,
.memory-help {
  max-width: 35rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.memory-status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.35rem;
}

.memory-stat,
.memory-note-card {
  padding: 1.25rem 1.25rem 1.3rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow);
}

.memory-stat span {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.memory-stat strong {
  display: block;
  margin-top: 0.55rem;
  font-family: "Archivo Black", sans-serif;
  font-size: 1.7rem;
}

.memory-progress {
  margin-top: 0.9rem;
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.memory-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8f1f 0%, #ff6c0a 100%);
  transition: width 220ms ease;
}

.memory-actions {
  margin-top: 0.25rem;
}

.memory-stage {
  display: grid;
}

.memory-board-shell {
  position: relative;
  width: min(100%, 46rem);
  justify-self: center;
  padding: 1.1rem;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.memory-card {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
}

.memory-card:disabled {
  cursor: default;
}

.memory-card-shell {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    #171717;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.memory-card-shell-face img {
  width: 74%;
  height: 74%;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.26));
}

.memory-card-shell-patch {
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.98), rgba(245, 236, 214, 0.96)),
    #f6edd9;
  border-color: rgba(27, 22, 12, 0.12);
}

.memory-card-image-patch {
  width: 86%;
  height: 86%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.memory-card-shell-text {
  background:
    radial-gradient(circle at top, rgba(255, 143, 31, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    #202020;
}

.memory-card-text {
  color: #ff7a12;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.memory-card-text-white {
  color: #f6f6f2;
}

.memory-card-shell-back {
  background:
    radial-gradient(circle at top, rgba(47, 107, 255, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    #171717;
}

.memory-card-back-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #f6f6f2;
  font-family: "Archivo Black", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.memory-card.is-flipped .memory-card-shell {
  transform: scale(0.985);
}

.memory-card.is-matched .memory-card-shell {
  border-color: rgba(255, 143, 31, 0.48);
  box-shadow:
    inset 0 0 0 1px rgba(255, 143, 31, 0.24),
    0 14px 34px rgba(0, 0, 0, 0.3);
}

.memory-card:hover .memory-card-shell {
  transform: translateY(-2px);
}

.memory-finished {
  position: absolute;
  inset: 1.1rem;
  display: grid;
  place-content: center;
  gap: 0.7rem;
  padding: 2rem;
  border-radius: 24px;
  text-align: center;
  background: rgba(3, 5, 14, 0.68);
  transition: opacity 200ms ease, visibility 200ms ease;
}

.memory-finished.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.memory-finished-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.memory-finished h2 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.memory-finished p {
  margin: 0;
  color: var(--text-muted);
}

.memory-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  padding-bottom: 4rem;
}

.memory-note-card h3 {
  margin: 0.75rem 0 0;
  font-family: "Archivo Black", sans-serif;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.memory-note-card p:last-child {
  margin: 0.65rem 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 980px) {
  .memory-hero {
    grid-template-columns: 1fr;
    padding-top: 2.5rem;
  }

  .memory-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .memory-hero,
  .memory-notes {
    width: min(1180px, calc(100% - 2rem));
  }

  .memory-logo {
    height: 4.8rem;
  }

  .memory-status-row {
    grid-template-columns: 1fr;
  }

  .memory-grid {
    gap: 0.8rem;
  }

  .memory-card-face {
    border-radius: 18px;
  }
}
