*{box-sizing:border-box}body[data-game=memory]{margin:0;background:radial-gradient(ellipse at 12% 10%,#e7edda,transparent 50%),#faf6ec;color:#375648;font-family:system-ui,'Yu Gothic',sans-serif}body[data-game=memory] main{max-width:1100px;padding:18px 24px 40px;margin:auto}body[data-game=memory] button,body[data-game=memory] select{font:inherit;color:inherit;min-height:46px;border:1px solid #d0d9c4;border-radius:14px;background:#fffdf4;padding:10px 15px;cursor:pointer}body[data-game=memory] button:disabled{opacity:1;cursor:default}body[data-game=memory] button:focus-visible,body[data-game=memory] summary:focus-visible{outline:3px solid #c29951;outline-offset:4px}.memory-header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:12px 0 20px}.memory-header h1{margin:4px 0}.memory-header p{font-size:14px;color:#78836c;line-height:1.8;margin:8px 0}.memory-top-controls{display:flex;gap:8px;flex-shrink:0}.memory-top-controls button{font-size:12px!important;white-space:nowrap}.memory-worlds h2{font-size:12px;font-weight:500;color:#7a856c;margin:10px 0}.memory-theme-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.memory-theme-tabs button{display:flex;align-items:center;gap:13px;padding:8px 17px!important;background:#fffdf5!important;font-size:14px;font-weight:700}.memory-theme-tabs img{width:52px;height:52px;object-fit:contain}.memory-theme-tabs button[aria-pressed=true]{border:2px solid #86a477;background:#edf2df!important;padding:7px 16px!important}.memory-difficulty{display:flex;justify-content:space-between;gap:16px;align-items:center;margin:15px 0}.memory-difficulty>span{font-size:12px;color:#7a856c}.memory-difficulty>div{display:flex;gap:8px}.memory-difficulty button{font-size:12px!important;min-width:75px;min-height:42px!important}.memory-difficulty button[aria-pressed=true]{background:#52795d!important;color:#fffef1!important;border-color:#52795d}.memory-play-layout{display:grid;grid-template-columns:minmax(0,1fr) 235px;gap:20px;align-items:start}.memory-table{background:#eeefdf;border:6px solid #fffef6;border-radius:29px;padding:20px;box-shadow:0 10px 30px #47664010}.memory-status{display:flex;align-items:center;justify-content:space-between;gap:15px;min-height:38px;font-size:14px;line-height:1.7}.memory-status strong{font-size:13px;white-space:nowrap;background:#fffdf4;padding:6px 12px;border-radius:20px;color:#60764f}.memory-table>progress{appearance:none;display:block;width:100%;height:7px;border:0;background:#dae1c9;border-radius:20px;overflow:hidden;margin:12px 0 20px}.memory-table>progress::-webkit-progress-bar{background:#dae1c9}.memory-table>progress::-webkit-progress-value{background:#8eae75;border-radius:20px}.board{--memory-cols:3;display:grid;grid-template-columns:repeat(var(--memory-cols),minmax(0,1fr));gap:14px;margin:0!important;max-width:none!important}.board[data-pairs="4"],.board[data-pairs="6"]{--memory-cols:4}body[data-game=memory] .memory-card{position:relative;aspect-ratio:1;min-width:0;min-height:0;border:0;padding:0;background:none;perspective:900px;transform:none!important;box-shadow:none;touch-action:manipulation}.card-inner{display:block;width:100%;height:100%;position:relative;transform-style:preserve-3d;transition:transform .42s cubic-bezier(.2,.7,.25,1)}.memory-card.open .card-inner{transform:rotateY(180deg)}.card-back,.card-front{position:absolute;inset:0;border:3px solid #fffdf5;border-radius:20px;backface-visibility:hidden;box-shadow:0 4px 0 #7d9b7526,0 5px 12px #354c3712;overflow:hidden;display:flex;align-items:center;justify-content:center;flex-direction:column}.card-back{background:radial-gradient(circle at 20% 20%,#bdd0a7 0 1px,transparent 2px) 0 0/14px 14px,linear-gradient(145deg,#9eb68c,#769875);color:#fffbed}.card-back:before{content:'';position:absolute;inset:9px;border:1px solid #edf2d785;border-radius:13px}.card-flower{font-size:clamp(35px,4vw,57px);color:#f9f0c9;text-shadow:0 2px 0 #6f885647}.card-number{position:absolute;left:15px;top:13px;font-size:11px;opacity:.95}.card-front{transform:rotateY(180deg);background:radial-gradient(ellipse at 50% 45%,#eaf0d9,#fffdf3 76%);padding:9px}.card-front img{width:89%;height:76%;object-fit:contain;pointer-events:none;filter:drop-shadow(0 3px 3px #48633c12)}.card-name{font-size:13px;font-weight:700;line-height:1.6;color:#4c6948}.pair-check{display:none;position:absolute;right:8px;top:7px;border-radius:50%;width:22px;height:22px;line-height:22px;background:#769b65;color:white;font-size:13px}.memory-card.matched .pair-check{display:block}.memory-card.matched .card-front{border-color:#a2bd7c;background:radial-gradient(ellipse,#f9f9e6,#e6edd5)}.memory-card.last-match .card-front img{animation:pair-found .45s ease-out}.memory-play-controls{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:19px}.memory-play-controls button{font-size:13px!important;min-width:155px}.memory-play-controls #nextPair{background:#577d60;color:#fffdf1}.memory-sidebar{display:grid;gap:15px}.memory-panel{padding:20px;background:#fffdf3;border:1px solid #d9e0ca;border-radius:22px}.memory-panel h2{font-size:14px;margin:0 0 14px}.memory-panel p{font-size:12px;color:#7b896f;line-height:1.85}.turn-panel{text-align:center}.turn-panel>strong{display:block;font-size:14px;margin:10px 0}#turnBadge{display:grid;place-items:center;width:56px;height:56px;margin:auto;background:#e9edd7;border:3px solid #f7f7e9;border-radius:50%;font-size:25px;color:#83975f}#turnBadge[data-player="0"]{background:#f1dbc6;color:#a97851}#turnBadge[data-player="1"]{background:#d6e7e6;color:#4a8886}.pair-gallery{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.pair-gallery>span{display:grid;place-items:center;aspect-ratio:1;border-radius:13px;background:#f0f1e3;border:1px solid #e2e7d2;min-width:0}.pair-gallery img{width:90%;height:90%;object-fit:contain}.empty-pair{font-size:23px;color:#c1cbae}.memory-win{margin-top:18px;padding:24px;background:linear-gradient(135deg,#f9e9bb,#e8eed6);border:2px solid #d1bd81;border-radius:22px;text-align:center}.memory-win h2{font-size:23px;margin:6px 0}.memory-win p{font-size:13px;line-height:1.8}.memory-win button{background:#597b56!important;color:#fff!important}.win-flower{font-size:42px;color:#af9770}.memory-book{margin-top:24px;background:#fffdf4;border:1px solid #d9ddc9;border-radius:22px;padding:19px 22px}.memory-book summary{cursor:pointer;font-weight:700;font-size:16px}.memory-book summary strong{float:right;font-size:13px;border-radius:20px;background:#e7eddb;padding:4px 10px}.memory-book p{font-size:12px;color:#7d876e}.memory-book h3{font-size:13px;margin:20px 0 10px}.memory-book h3 small{margin-left:9px;color:#83966f}.memory-collection-row{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px}.collection-card{border:1px dashed #d5dcc7;border-radius:15px;background:#f2f2e7;display:flex;align-items:center;flex-direction:column;padding:8px;gap:6px;font-size:11px;color:#8b9778}.collection-card.earned{background:#fffdf2;border-style:solid;color:#54704e}.collection-card img,.collection-card .unknown{width:70px;height:70px;object-fit:contain}.collection-card .unknown{display:grid;place-items:center;font-size:29px;color:#c0c6aa}.memory-settings{margin-top:22px;border-top:1px solid #d4ddc5;padding-top:16px}.memory-settings summary{cursor:pointer;font-size:13px}.memory-settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;margin:16px 0}.memory-settings label{font-size:12px;display:flex;flex-direction:column;gap:8px}.memory-settings select{width:100%;font-size:12px!important}.memory-settings button{font-size:11px!important}body[data-game=memory] footer{display:flex;justify-content:space-between;gap:20px;font-size:11px;line-height:1.8;color:#839173;margin:22px 0}body[data-game=memory] [hidden]{display:none!important}body[data-memory-theme=ocean] .memory-table{background:#dfedeb}body[data-memory-theme=ocean] .card-back{background:radial-gradient(circle at 30% 30%,#d9f2ed 0 1px,transparent 2px) 0 0/15px 15px,linear-gradient(140deg,#9fc9c5,#6b9faa)}body[data-memory-theme=food] .memory-table{background:#f0e8d5}body[data-memory-theme=food] .card-back{background:radial-gradient(circle at 30% 30%,#fff1dc 0 1px,transparent 2px) 0 0/15px 15px,linear-gradient(140deg,#d2b596,#b99476)}@keyframes pair-found{50%{transform:scale(1.09) rotate(-3deg)}}
@media(max-width:800px){body[data-game=memory] main{padding:14px 12px 35px}.memory-play-layout{grid-template-columns:1fr}.memory-sidebar{grid-template-columns:1fr 1fr}.memory-panel{padding:15px}.turn-panel{text-align:left;display:grid;grid-template-columns:45px 1fr;gap:8px}.turn-panel #turnBadge{width:44px;height:44px;grid-row:1/3}.turn-panel>strong{margin:0;font-size:13px}.turn-panel p{margin:0;grid-column:2;font-size:11px}.pair-gallery{grid-template-columns:repeat(6,1fr)}.pair-gallery img{max-height:45px}.pair-gallery .empty-pair{font-size:15px}.memory-header{align-items:start}.memory-top-controls{flex-direction:column}.memory-theme-tabs button{padding:8px!important;gap:8px;font-size:12px}.memory-theme-tabs img{width:42px;height:42px}.memory-table{padding:15px}.memory-settings-grid{grid-template-columns:1fr}.memory-status{font-size:13px}.memory-collection-row{gap:7px}.collection-card img,.collection-card .unknown{width:50px;height:50px}}
@media(max-width:500px){.memory-header{display:block;margin-bottom:12px}.memory-header p{font-size:12px}.memory-top-controls{flex-direction:row;margin-top:9px}.memory-theme-tabs{gap:6px}.memory-theme-tabs button{flex-direction:column;gap:4px;padding:6px!important;font-size:11px}.memory-theme-tabs button[aria-pressed=true]{padding:5px!important}.memory-theme-tabs img{width:43px;height:43px}.memory-difficulty{gap:8px;flex-wrap:wrap}.memory-difficulty button{min-width:65px;padding:8px 12px!important}.memory-table{border-width:4px;border-radius:21px;padding:10px}.memory-status{gap:8px;font-size:12px;min-height:47px}.memory-status strong{font-size:11px;padding:5px 8px}.board{gap:8px}.card-back,.card-front{border-width:2px;border-radius:14px}.card-front{padding:4px}.card-name{font-size:11px}.board[data-pairs="6"] .card-name,.board[data-pairs="4"] .card-name{font-size:9px}.card-back:before{inset:6px;border-radius:10px}.card-number{left:10px;top:8px;font-size:9px}.pair-check{width:16px;height:16px;line-height:16px;font-size:10px;top:4px;right:4px}.memory-card{aspect-ratio:.85!important}.memory-play-controls button{min-width:135px;font-size:12px!important}.memory-sidebar{grid-template-columns:1fr}.turn-panel p{font-size:12px}.pair-gallery>span{max-height:56px}.memory-collection-row{grid-template-columns:repeat(3,1fr)}.memory-book{padding:16px}.memory-book summary{font-size:14px}body[data-game=memory] footer{flex-direction:column;gap:6px}}
@media(prefers-reduced-motion:reduce){.card-inner{transition:none}.memory-card.last-match .card-front img{animation:none}}

.album-reset{margin-top:22px;border-top:1px solid #d7dfcc;padding-top:18px}.album-reset>button{min-height:48px;border:1px solid #bda98e;color:#745741;background:#fff9ef}.album-reset section{margin-top:12px;padding:16px;border:2px solid #d2b78d;border-radius:16px;background:#fff8e8}.album-reset section button{min-height:48px;margin:5px;padding:10px 16px}#confirmAlbumReset{background:#8c6448;color:white}#albumResetStatus{font-weight:700;color:#456f50}.album-reset [hidden]{display:none!important}
