:root{--mm-bg:#17122b;--mm-panel:#241b42;--mm-line:#584b84;--mm-text:#fbf8ff;--mm-muted:#c5b9e4;--mm-accent:#ffcf70;--mm-pink:#ff84b7}
*{box-sizing:border-box}.memory-page section{margin-bottom:10px}.memory-page{min-height:calc(100vh - 67px);padding:30px 16px 58px;background:radial-gradient(circle at 50% 0,#49306f,var(--mm-bg) 57%);color:var(--mm-text);font-family:system-ui,sans-serif}.memory-wrap{width:min(900px,100%);margin:auto}.memory-header{display:flex;align-items:end;justify-content:space-between;gap:14px;margin-bottom:18px}.memory-eyebrow{display:block;color:var(--mm-accent);font-size:11px;font-weight:800;letter-spacing:.2em}.memory-header h1{margin:5px 0;color:#fff;font-size:clamp(30px,7vw,52px);letter-spacing:.12em}.memory-header p{margin:0;color:var(--mm-muted);line-height:1.7}.memory-back{padding:9px 12px;border:1px solid var(--mm-line);border-radius:8px;color:var(--mm-text);font-size:12px;white-space:nowrap}.memory-layout{display:grid;grid-template-columns:minmax(300px,620px) 220px;gap:18px;align-items:start}.memory-play,.memory-side{border:1px solid var(--mm-line);border-radius:8px;background:#241b42e8;box-shadow:0 20px 55px #08051366}.memory-play{padding:clamp(12px,3vw,24px)}.memory-score-row{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:14px;text-align:center}.memory-score-row div{padding:8px;border:1px solid var(--mm-line);border-radius:8px;background:#17102d}.memory-score-row span{color:var(--mm-muted);font-size:11px}.memory-score-row strong{display:block;margin-top:2px;color:var(--mm-accent);font-size:24px}.memory-board{display:grid;grid-template-columns:repeat(4,1fr);gap:clamp(7px,1.5vw,12px);width:100%;aspect-ratio:1}.memory-card{position:relative;min-width:0;aspect-ratio:1;border:0;border-radius:8px;background:transparent;cursor:pointer;perspective:700px;touch-action:manipulation}.memory-card:focus-visible{outline:3px solid #fff;outline-offset:3px}.memory-card-inner{position:absolute;inset:0;transition:transform .38s;transform-style:preserve-3d}.memory-card.flipped .memory-card-inner,.memory-card.matched .memory-card-inner{transform:rotateY(180deg)}.memory-face{position:absolute;inset:0;display:grid;place-items:center;border-radius:8px;backface-visibility:hidden;box-shadow:0 7px 14px #08051366}.memory-back-face{border:2px solid #a996d9;background:repeating-linear-gradient(45deg,#33245d 0,#33245d 8px,#423171 8px,#423171 16px)}.memory-back-face:after{content:'?';display:grid;place-items:center;width:42%;height:42%;border:2px solid #d6c8f4;border-radius:50%;color:#d6c8f4;font-size:clamp(18px,4vw,30px);font-weight:800}.memory-front{transform:rotateY(180deg);border:2px solid #ffe2a4;background:linear-gradient(145deg,#fff8e7,#ffd991);color:#312044;font-size:clamp(28px,8vw,58px)}.memory-card.matched .memory-front{border-color:#8ff1ca;box-shadow:0 0 0 3px #8ff1ca66,0 0 24px #8ff1ca88;animation:mm-match .5s ease-out}.memory-card.mismatch .memory-card-inner{animation:mm-shake .38s ease-in-out}.memory-message{min-height:25px;margin:14px 0 0;color:var(--mm-muted);font-weight:700;text-align:center}.memory-side{display:flex;flex-direction:column;gap:11px;padding:14px}.memory-panel{padding:12px;border:1px solid var(--mm-line);border-radius:8px;background:#17102d}.memory-panel h2{margin:0 0 8px;color:var(--mm-muted);font-size:11px;letter-spacing:.14em}.memory-panel ol{margin:0;padding-left:1.25em;color:var(--mm-muted);font-size:12px;line-height:1.8}.memory-panel p{margin:9px 0 0;color:var(--mm-muted);font-size:12px;line-height:1.7}.memory-panel b{color:var(--mm-text)}.memory-button{width:100%;min-height:40px;padding:8px;border:1px solid var(--mm-line);border-radius:8px;background:#33245d;color:var(--mm-text);font:700 12px inherit;cursor:pointer}.memory-button:hover,.memory-button:focus-visible{border-color:var(--mm-accent);outline:none}.memory-primary{border-color:var(--mm-accent);background:var(--mm-accent);color:#2b1839}.memory-sound>div{display:grid;grid-template-columns:1fr 1fr;gap:7px}.memory-button[aria-pressed=false]{opacity:.6;color:var(--mm-muted)}.memory-note{margin:17px 0 0;color:#c0b1dc;font-size:11px;text-align:center}.memory-overlay{position:fixed;inset:0;z-index:500;display:none;place-items:center;padding:20px;background:#100b1cdd}.memory-overlay.show{display:grid}.memory-result{width:min(390px,100%);padding:28px;border:1px solid var(--mm-accent);border-radius:8px;background:var(--mm-panel);text-align:center;box-shadow:0 20px 70px #0009}.memory-result h2{margin:6px 0;color:var(--mm-accent);font-size:32px}.memory-result p{color:var(--mm-muted);line-height:1.7}.memory-result .memory-button{width:auto;min-width:170px}@keyframes mm-match{50%{transform:scale(1.08)} }@keyframes mm-shake{25%{transform:rotateY(180deg) translateX(-5px)}75%{transform:rotateY(180deg) translateX(5px)}}
@media(max-width:720px){.memory-page{padding:20px 9px 42px}.memory-header{align-items:flex-start}.memory-layout{display:block}.memory-side{display:grid;grid-template-columns:1fr 1fr;margin-top:11px}.memory-side .memory-actions,.memory-side .memory-help{grid-column:1/-1}.memory-header p{font-size:13px}.memory-back{font-size:11px}.memory-board{gap:7px}}
.memory-score-row{grid-template-columns:repeat(4,1fr)}.memory-score-row strong{font-size:clamp(16px,3vw,24px)}.memory-board{aspect-ratio:auto}.memory-board[data-pairs="16"],.memory-board[data-pairs="20"],.memory-board[data-pairs="26"]{grid-template-columns:repeat(8,1fr)}.memory-level-list{display:grid;gap:6px}.memory-level .memory-button{min-height:34px;padding:6px;text-align:left}.memory-level .memory-button.active{border-color:var(--mm-accent);color:var(--mm-accent)}.memory-sound label{display:block;margin-top:9px;color:var(--mm-muted);font-size:11px}.memory-sound input{width:100%;accent-color:var(--mm-accent)}.memory-back-face{position:absolute}.memory-back-face:after{position:absolute;top:50%;left:50%;width:42%;height:42%;transform:translate(-50%,-50%);margin:0}.memory-front{line-height:1}
@media(max-width:720px){.memory-side .memory-actions,.memory-side .memory-level,.memory-side .memory-help{grid-column:1/-1}.memory-board[data-pairs="16"],.memory-board[data-pairs="20"],.memory-board[data-pairs="26"]{grid-template-columns:repeat(6,1fr)}.memory-front{font-size:clamp(18px,6vw,38px)}}
.memory-back-face:after{content:""}.memory-back-face:before{content:"?";position:absolute;top:50%;left:50%;z-index:1;transform:translate(-50%,-48%);color:#d6c8f4;font-size:clamp(18px,4vw,30px);font-weight:800;line-height:1}
@media(min-width:721px){.memory-back-face:before{font-size:clamp(16px,2.8vw,24px);font-weight:600}}
