#memory-stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 12px; padding: 12px 16px 18px;
  max-width: 560px; width: 100%; margin: 0 auto;
  background: radial-gradient(120% 80% at 50% -10%, #15131c 0%, var(--bg) 60%);
  font-family: var(--fn); user-select: none; -webkit-user-select: none; overflow-y: auto;
}

.mem-hud { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mem-round { font-family: var(--fm); font-size: 11px; color: var(--su); }
.mem-lives { display: flex; gap: 3px; }
.mem-heart { color: var(--ac); font-size: 15px; text-shadow: 0 0 6px var(--glow0); transition: opacity .15s; }
.mem-heart.lost { color: var(--s3); text-shadow: none; opacity: .4; }
.mem-prompt { font-family: var(--ff); font-weight: 700; font-size: 12px; letter-spacing: .8px; text-transform: uppercase; color: var(--am); text-align: center; flex: 1 1 auto; }
.mem-score { font-family: var(--fm); font-weight: 700; font-size: 18px; color: var(--tx); min-width: 40px; text-align: right; }

.mem-grid { display: grid; gap: 9px; flex: 1 1 auto; align-content: start; }
.mem-card {
  position: relative; aspect-ratio: 3 / 2.4; min-height: 64px;
  border: 1px solid var(--bd); border-radius: 12px; cursor: pointer; padding: 0;
  background: linear-gradient(180deg, var(--s1), var(--s2));
  transition: transform .12s ease, border-color .15s, box-shadow .15s;
}
.mem-card:active { transform: scale(.97); }
.mem-back, .mem-front { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; }
.mem-back { font-family: var(--fc); font-weight: 700; font-size: 22px; color: var(--su); }
.mem-front { font-size: 11.5px; line-height: 1.25; color: var(--tx); opacity: 0; }
.mem-front .mem-ic { font-size: 20px; }
.mem-up .mem-back { opacity: 0; }
.mem-up .mem-front { opacity: 1; }
.mem-up { background: linear-gradient(180deg, var(--s2), var(--s3)); border-color: var(--mu); }
.mem-matched { border-color: var(--gn) !important; box-shadow: 0 0 14px rgba(52,211,153,.4); }
.mem-matched .mem-front { color: var(--gn); }
.mem-wrong { border-color: var(--ac) !important; box-shadow: 0 0 14px rgba(192,0,26,.45); }

.mem-toast {
  flex: none; min-height: 0; text-align: center; font-size: 13px; line-height: 1.45;
  color: var(--tx); padding: 0 6px; opacity: 0; max-height: 0; overflow: hidden;
  transition: opacity .2s, max-height .2s;
}
.mem-toast b, .mem-toast strong { color: var(--am); }
.mem-toast.show { opacity: 1; max-height: 90px; }
.mem-toast-good { color: var(--tx); }

.seq-flavor { flex: none; text-align: center; font-size: 13px; font-style: italic; color: var(--mu); min-height: 18px; }
.seq-pads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; flex: 0 0 auto; margin: auto 0; }
.seq-pad {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 22px 12px; min-height: 96px; cursor: pointer; color: var(--tx);
  border: 1px solid var(--bd); border-radius: 16px;
  background: linear-gradient(180deg, var(--s1), var(--s2));
  transition: transform .08s ease, filter .12s ease, box-shadow .12s ease, border-color .12s;
}
.seq-ic { font-size: 26px; line-height: 1; }
.seq-lab { font-family: var(--ff); font-weight: 600; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; }
.seq-pad:active { transform: scale(.97); }
.seq-lit { filter: brightness(1.5); border-color: var(--am) !important; box-shadow: 0 0 22px var(--glow1); }
.seq-tap { filter: brightness(1.25); border-color: var(--mu); }
.seq-bad { border-color: var(--ac) !important; box-shadow: 0 0 18px rgba(192,0,26,.55); animation: seqShake .2s; }
@keyframes seqShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

@media (max-width: 480px) {
  .mem-front { font-size: 11px; }
  .seq-pad { min-height: 84px; padding: 18px 10px; }
}
