.memory-board{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;max-width:590px;margin:auto;perspective:1200px}.memory-card{position:relative;padding:0;border:0;background:none;aspect-ratio:1.16;border-radius:21px;perspective:800px;isolation:isolate}.memory-card-inner{display:block;width:100%;height:100%;position:relative;transform-style:preserve-3d;transition:transform .58s cubic-bezier(.2,.75,.25,1);border-radius:inherit}.memory-card.is-open .memory-card-inner{transform:rotateY(180deg)}.memory-face{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:20px}.memory-back{border:2px solid #c7fff0;background:radial-gradient(ellipse at 30% 15%,#63d8c5,transparent 60%),linear-gradient(140deg,#20b5a4,#087a7c);box-shadow:0 5px 0 #056e6c,0 9px 16px #20595122;color:#effff9}.memory-back:before{content:'';position:absolute;inset:9px;border:1px solid #d5fff570;border-radius:13px}.memory-back b{font-size:42px;line-height:1;text-shadow:0 3px 0 #117f73}.memory-back small{font-size:9px;letter-spacing:2px;margin-top:10px;opacity:.85}.memory-front{transform:rotateY(180deg);background:#fffdf2;border:2px solid #a8d9c2;box-shadow:0 5px 0 #c5d9b9,0 8px 16px #20595118;padding:12px;gap:10px}.memory-front small{font-size:10px;letter-spacing:1px;color:#799083}.memory-front strong{font-size:clamp(18px,3vw,29px);overflow-wrap:anywhere}.memory-card.is-matched .memory-front{border-color:#efc56c;background:linear-gradient(140deg,#fffce3,#f5ffec);box-shadow:0 5px 0 #d4bd76}.memory-card.is-matched .memory-front:after{content:'✓';position:absolute;right:9px;top:7px;color:#228c6a;font-size:16px}.memory-card:disabled{cursor:default}.memory-card:not(:disabled):hover .memory-back{filter:brightness(1.07)}.memory-mascot{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;position:relative}.memory-mascot img{width:100%;height:125px;object-fit:contain;filter:drop-shadow(0 8px 8px #286b5120)}.memory-mascot span{font-size:12px;font-weight:700;background:#fff9dc;border-radius:15px;padding:5px 9px;text-align:center}.memory-mascot.cheer img{animation:cheer .65s ease-in-out}.memory-message{text-align:center;min-height:48px;font-size:14px;margin:25px 0 0;color:#3c7462}.memory-note{font-size:11px;text-align:center;color:#7c8e80;margin:12px 0 0}.memory-finish{text-align:center;background:#fff2c9;border:1px solid #eed297;border-radius:20px;padding:20px;margin-top:10px}.memory-finish strong{font-size:23px}.memory-finish p{margin:8px 0 14px;font-size:14px}.memory-finish button{background:#157b64;color:white;border:0;border-radius:12px;padding:12px 24px;font-weight:700;box-shadow:0 4px 0 #0b5547}.memory-spark{position:absolute;left:50%;top:50%;width:18px;height:18px;pointer-events:none;z-index:5;background:#ffdb55;clip-path:polygon(50% 0,62% 36%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 36%);animation:bling 950ms ease-out forwards;animation-delay:var(--delay)}@keyframes bling{0%{opacity:0;transform:translate(-50%,-50%) scale(.2) rotate(0)}25%{opacity:1}100%{opacity:0;transform:translate(var(--x),var(--y)) scale(.65) rotate(150deg)}}@keyframes cheer{35%{transform:translateY(-12px) rotate(-6deg)}70%{transform:translateY(-4px) rotate(5deg)}}/* Illustrated wizard card backs and green success state. */
.memory-board{max-width:480px}.memory-card{aspect-ratio:4/5}.memory-back{border:0;background:#07545a;overflow:hidden;box-shadow:0 5px 0 #064d50,0 9px 16px #20595122}.memory-back:before{display:none}.memory-back img{display:block;width:100%;height:100%;object-fit:cover}.memory-card.is-matched .memory-front{border-color:#49b786;background:linear-gradient(140deg,#e9ffed,#c4f1d8);box-shadow:0 5px 0 #62a98a;color:#165c42}.memory-card.is-matched .memory-front small{color:#3c785c}.memory-card.is-matched .memory-front:after{color:#138350}.memory-card.is-matched .memory-spark{background:#ffdb55}.memory-finish{background:#e0f8e8;border-color:#9ad5ac}.memory-mascot span{background:#e5f8e9}@media(max-width:600px){.memory-card{aspect-ratio:4/5}.memory-back img{border-radius:15px}}

.memory-board{margin:20px auto;gap:14px}.memory-heading{font-size:22px;margin:18px 0 8px}.memory-message{min-height:44px}.memory-card{font:inherit;color:inherit;cursor:pointer}.memory-card:focus-visible{outline:3px solid #efa72d;outline-offset:4px}.memory-stats{font-size:14px;color:#387363}.memory-mascot img{max-height:145px}.memory-mascot .growth-portrait{width:100%}@media(max-width:600px){.memory-board{gap:10px}.memory-front{padding:6px;gap:6px}.memory-front strong{font-size:clamp(14px,4vw,20px)}.memory-front small{font-size:9px}.memory-mascot img{height:auto;max-height:105px}.memory-mascot span{font-size:10px;padding:4px}.memory-face{border-radius:14px}}@media(prefers-reduced-motion:reduce){.memory-card-inner{transition:none}.memory-spark{display:none}.memory-mascot.cheer img{animation:none}}.quiz-card .memory-heading{font-size:24px;margin:12px 0 8px}.memory-board{max-width:360px}.memory-front strong{font-size:clamp(16px,2vw,24px)}

/* Wider cards with measured text sizing; keep the full illustrated back visible. */
.memory-board{max-width:540px;gap:12px}
.memory-card{aspect-ratio:1;min-width:0}
.memory-back{background:#31064d}
.memory-back img{object-fit:contain}
.memory-front{padding:12px 8px;overflow:hidden}
.memory-front strong{display:block;width:100%;min-width:0;font-size:24px;line-height:1.2;text-align:center;overflow-wrap:normal;word-break:normal}
@media(max-width:600px){.memory-board{gap:8px}.memory-front{padding:10px 5px;gap:5px}.memory-front strong{font-size:22px}}

/* Match all card states and keep the mascot within one square grid cell. */
.memory-back,.memory-front,.memory-card.is-matched .memory-front{box-shadow:0 3px 5px rgba(0,0,0,0.5)}
.memory-mascot{aspect-ratio:1;min-height:0;overflow:hidden}
.memory-mascot .growth-portrait{height:100%;min-height:0;display:flex;align-items:center;justify-content:center}
.memory-mascot img{width:100%;height:100%;max-height:100%;object-fit:contain}

.memory-stats{display:none}
.memory-front strong{font-size:20px;line-height:1.25}
.memory-front strong[data-lang="zh"]{white-space:pre-line;word-break:keep-all}
.memory-card.is-returning .memory-card-inner{transition-duration:.18s}
@media(max-width:600px){.memory-front strong{font-size:18px}.memory-front small{font-size:8px;letter-spacing:.5px}}
