#memory-game{position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:#0c1117;color:#eddfc6;font:14px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;isolation:isolate}
#memory-game::backdrop{background:#080c12}
#memory-game::before{content:'';position:fixed;inset:-6%;z-index:-1;background:linear-gradient(90deg,#080b11d9,#080b1180 35% 65%,#080b11d9),var(--memory-art) center/cover no-repeat;opacity:.52;pointer-events:none}
#memory-game *, .memory-panel *{box-sizing:border-box}
#memory-game [hidden],.memory-panel [hidden]{display:none!important}
#memory-game button,.memory-panel button{font:inherit;min-height:44px;color:inherit;touch-action:manipulation;-webkit-tap-highlight-color:transparent;cursor:pointer}
#memory-game button:focus-visible,.memory-panel button:focus-visible,.memory-panel input:focus-visible,.memory-analytics-table:focus-visible{outline:2px solid #e8c58a;outline-offset:3px}
#memory-game button:disabled,.memory-panel button:disabled{cursor:default}
.memory-shell{height:100%;width:min(100%,580px);margin:auto;display:flex;flex-direction:column;overflow:hidden;background:#11151bea;border-inline:1px solid #615446;box-shadow:0 0 60px #0007}
.memory-head{flex:none;display:flex;justify-content:space-between;align-items:center;min-height:58px;gap:10px;padding:7px 15px;border-bottom:1px solid #705d43;background:#211e25}
.memory-head h1{margin:0;font:600 22px/1.1 ui-serif,Georgia,serif;letter-spacing:.025em;color:#f1dfbe}
.memory-head-actions{display:flex;align-items:center;gap:12px}
#memory-ranking-button{border:0;background:transparent;padding:5px 2px;color:#d1b894;font-size:12px}
#memory-ranking-button:hover{color:#f4deba}
#memory-game .memory-close,.memory-panel .memory-close{flex:none;width:44px;min-height:44px;padding:0;border:1px solid #706047;border-radius:5px;background:#2b2730;color:#ead5b1;font-size:27px;line-height:1}
.memory-counters{flex:none;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:8px 20px 7px;color:#b6a88f}
.memory-counters>div{display:flex;align-items:baseline;gap:10px;min-width:0}
.memory-counters span{font-size:11px}
.memory-counters output{font-size:20px;line-height:1.15;font-weight:600;letter-spacing:.01em;color:#f3ddb3;font-variant-numeric:tabular-nums;white-space:nowrap}
.memory-table{position:relative;flex:1;min-height:0;display:flex;align-items:center;justify-content:center;padding:0 12px;isolation:isolate}
.memory-board{position:relative;flex:none;aspect-ratio:2/3;width:min(100%,calc((100dvh - 158px)*2/3));max-height:100%;isolation:isolate}
.memory-board-art{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:fill;user-select:none;pointer-events:none;border-radius:10px}
.memory-cards{position:absolute;inset:8.5% 4%;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));gap:clamp(4px,1.3vw,7px);perspective:1000px}
#memory-game .memory-card{position:relative;display:block;min-width:0;min-height:0;width:100%;height:100%;padding:0;border:0;border-radius:6px;background:transparent;perspective:650px;user-select:none;outline-offset:1px}
.memory-card-turn{position:absolute;inset:0;display:block;transform-style:preserve-3d;transition:transform .32s cubic-bezier(.2,.65,.25,1);transform:rotateY(0deg);will-change:auto}
.memory-card.is-open .memory-card-turn{transform:rotateY(180deg)}
.memory-card-back,.memory-card-front{position:absolute;inset:0;display:grid;place-items:center;border-radius:5px;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden;box-shadow:0 2px 3px #0009}
.memory-card-back{border:1px solid #8a6f4f;background:#30212a;transform:rotateY(0deg)}
.memory-card-back img{width:100%;height:100%;object-fit:fill;pointer-events:none;user-select:none}
.memory-card-front{transform:rotateY(180deg);border:1px solid #b49361;background:radial-gradient(ellipse at 50% 38%,#303740,#17212c 78%);box-shadow:inset 0 0 0 2px #101721,inset 0 0 0 3px #8a704b55,0 2px 3px #0009}
.memory-card-front::before{content:'';position:absolute;inset:5px;border:1px solid #b99a6245;border-radius:2px;pointer-events:none}
.memory-card-front::after{content:'';position:absolute;inset:0;border-radius:inherit;background:linear-gradient(125deg,#f6d79b0d,transparent 45% 65%,#02070e20);pointer-events:none}
.memory-card-icon{position:relative;width:92%;height:88%;object-fit:contain;pointer-events:none;user-select:none;filter:drop-shadow(0 3px 2px #0008);transition:transform .25s,filter .25s}
.memory-card-icon:not([src]){visibility:hidden}
.memory-card-mark{position:absolute;display:grid;place-items:center;right:4px;bottom:4px;width:17px;height:17px;border:1px solid #9fba8c;border-radius:50%;background:#2b4438;color:#e6e4bf;font:700 12px/1 sans-serif;opacity:0;transform:scale(.65);transition:opacity .2s .15s,transform .25s .15s;z-index:2}
.memory-card.is-matched .memory-card-front{border-color:#8caa7c;background:radial-gradient(ellipse at 50% 38%,#35443b,#1c2b28 80%);box-shadow:inset 0 0 0 2px #16221e,inset 0 0 0 3px #a1b98b55,0 2px 3px #0009}
.memory-card.is-matched .memory-card-icon{transform:scale(.96);filter:drop-shadow(0 2px 2px #0008)}
.memory-card.is-matched .memory-card-mark{opacity:1;transform:scale(1)}
.memory-card.is-pending .memory-card-back{border-color:#e0be85}
@media(hover:hover){.memory-card:not(:disabled):hover .memory-card-turn{transform:translateY(-2px) rotateY(0deg)}.memory-card:not(:disabled):hover .memory-card-back{border-color:#cfab72;box-shadow:0 3px 9px #000a}}
.memory-start-layer{position:absolute;inset:0;display:grid;place-items:center;background:#080b136b;border-radius:10px;z-index:4}
#memory-game .memory-primary,.memory-panel .memory-primary{border:1px solid #c19c64;border-radius:5px;background:#713644;box-shadow:inset 0 1px #e7bf8c24,0 3px 0 #1b1118;color:#fff0cd;padding:11px 22px;font-weight:600}
#memory-start{min-width:148px;max-width:85%;font-size:15px!important;box-shadow:0 4px 25px #000b,inset 0 1px #e7bf8c24!important}
#memory-start:disabled{opacity:.8}
.memory-footer{flex:none;min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:5px 15px 7px;border-top:1px solid #68533d;background:#191a21}
#memory-status{min-width:0;max-height:40px;overflow:auto;margin:0;color:#dfb496;font-size:10px;line-height:1.35;overflow-wrap:anywhere}
#memory-restart{margin-left:auto;flex:none;min-height:44px;padding:6px 0 6px 10px;border:0;background:transparent;color:#c8b595;font-size:11px}
#memory-restart:disabled{opacity:.4}
body.memory-open #scene *{animation-play-state:paused!important}
.memory-panel{width:min(520px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:88dvh;margin:auto;padding:0;border:1px solid #9e7d53;border-top:2px solid #bb985f;border-radius:8px;background:#191b24;color:#e9dac1;box-shadow:0 20px 80px #000c;font:13px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:hidden}
.memory-panel::backdrop{background:#070b12df}
.memory-panel[open]{display:flex;flex-direction:column}
.memory-panel button{padding:9px 13px;border:1px solid #7f654a;border-radius:4px;background:#302934;color:#ecdbbd}
.memory-panel button:hover{background:#44313c}
.memory-panel button:disabled{opacity:.5}
.memory-panel-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:64px;padding:8px 14px;background:#29232d;border-bottom:1px solid #62513f}
.memory-panel-head h2{margin:0;font-size:19px;line-height:1.25;color:#f1dfbd}
.memory-panel-content{min-height:0;padding:16px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#94704e #14161e}
.memory-panel-content>label{display:block;font-size:11px;color:#baab92;margin-bottom:6px}
#memory-ranking-search{display:block;width:100%;min-height:44px;padding:10px 12px;border:1px solid #6e5b43;border-radius:4px;background:#101720;color:#eedfc4;font:inherit;margin-bottom:17px;outline-color:#cfaa71}
.memory-ranking-columns,#memory-ranking-list li{display:grid;grid-template-columns:44px minmax(0,1fr) 105px;align-items:center;gap:8px;padding:11px 7px}
.memory-ranking-columns{font-size:10px;color:#b9a68a;border-bottom:1px solid #665440;padding-top:0}
.memory-ranking-columns>:last-child{text-align:right}
#memory-ranking-list{list-style:none;padding:0;margin:0}
#memory-ranking-list li{min-height:48px;border-bottom:1px solid #ffffff0d}
#memory-ranking-list strong{min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#memory-ranking-list time{font-size:12px;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;color:#edd19b}
.memory-rank{font-size:12px;color:#ac9271}
#memory-ranking-list li.is-self{background:#b3864910;box-shadow:inset 2px 0 #c4a16b}
.memory-panel-status{font-size:11px;color:#cab69a;min-height:17px;overflow-wrap:anywhere;margin:12px 0 0}
.memory-more{display:block;margin:12px auto 0}
#memory-victory{position:relative;width:min(470px,calc(100vw - 24px));background:radial-gradient(ellipse at 50% 25%,#34303a,#141b24 75%);overflow:auto;scrollbar-width:thin;scrollbar-color:#94704e #14161e}
#memory-victory .memory-victory-close{position:absolute;right:10px;top:10px;z-index:2;background:#1d1a24e8}
.memory-victory-image{flex:none;position:relative;width:100%;height:min(45dvh,390px);padding:15px 22px 0;background:radial-gradient(ellipse at 50% 75%,#8d694119,transparent 65%)}
.memory-victory-image img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;pointer-events:none;user-select:none}
.memory-victory-copy{position:relative;flex:none;text-align:center;padding:18px 22px 24px;background:#171b24;border-top:1px solid #8f714d55}
.memory-victory-copy h2{max-width:350px;margin:0 auto 13px;font:600 24px/1.25 ui-serif,Georgia,serif;color:#f2dfbd}
#memory-victory-time{display:block;color:#bda987;font-variant-numeric:tabular-nums;font-size:13px;margin-bottom:20px}
.memory-victory-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:9px}
#memory-analytics{width:min(820px,calc(100vw - 24px))}
.memory-analytics-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:16px}
.memory-analytics-summary>div{padding:11px;border:1px solid #5b4d40;border-radius:4px;background:#20232c;min-width:0}
.memory-analytics-summary span{display:block;font-size:10px;color:#bca98f;overflow-wrap:anywhere}
.memory-analytics-summary strong{display:block;font-size:24px;color:#ecd2a4;font-variant-numeric:tabular-nums;margin-top:5px}
.memory-analytics-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.memory-analytics-table{max-height:45dvh;overflow:auto;overscroll-behavior:contain;margin-top:10px;border:1px solid #514639;border-radius:3px;scrollbar-width:thin;scrollbar-color:#94704e #14161e}
.memory-analytics-table table{min-width:610px;width:100%;border-collapse:collapse;font-size:12px;font-variant-numeric:tabular-nums}
.memory-analytics-table th,.memory-analytics-table td{padding:11px 10px;text-align:right;white-space:nowrap;border-bottom:1px solid #ffffff0e}
.memory-analytics-table th:first-child,.memory-analytics-table td:first-child{text-align:left}
.memory-analytics-table th{position:sticky;top:0;background:#302832;font-size:10px;font-weight:500;color:#d6b68c}
.memory-analytics-table td:first-child{max-width:220px;overflow:hidden;text-overflow:ellipsis}
.memory-analytics-table tr:nth-child(even){background:#ffffff03}
.memory-analytics-table .memory-analytics-empty{text-align:center;padding:25px;color:#bba98e}
@media(min-width:700px){.memory-shell{height:calc(100dvh - 20px);margin-top:10px;border:1px solid #796044;border-radius:9px}.memory-board{width:min(100%,calc((100dvh - 180px)*2/3))}.memory-head{padding-inline:20px}.memory-head h1{font-size:25px}.memory-counters{padding-inline:27px}.memory-footer{padding-inline:22px}}
@media(max-width:360px){.memory-head{min-height:52px;padding:4px 10px}.memory-head h1{font-size:21px}.memory-head-actions{gap:8px}.memory-counters{padding:7px 15px 5px}.memory-counters output{font-size:18px}.memory-counters span{font-size:10px}.memory-counters>div{gap:8px}.memory-table{padding-inline:8px}.memory-board{width:min(100%,calc((100dvh - 145px)*2/3))}.memory-footer{min-height:51px;padding-inline:11px}.memory-card-mark{right:3px;bottom:3px;width:15px;height:15px;font-size:10px}.memory-panel-content{padding:12px}.memory-panel-head{padding:7px 11px}.memory-panel-head h2{font-size:17px}.memory-ranking-columns,#memory-ranking-list li{grid-template-columns:35px minmax(0,1fr) 94px;gap:5px;padding-inline:3px}#memory-ranking-list time{font-size:11px}.memory-victory-copy{padding:16px 15px 20px}.memory-victory-copy h2{font-size:22px}.memory-analytics-summary{gap:6px}.memory-analytics-summary>div{padding:9px 7px}}
@media(max-height:440px) and (min-width:440px){.memory-shell{position:relative;width:min(100%,760px);height:100dvh;margin-top:0;border:0;border-radius:0;display:grid;grid-template-columns:150px minmax(0,1fr);grid-template-rows:96px 1fr 58px}.memory-head{grid-column:1;flex-direction:column;align-items:flex-start;border:0;padding:10px 14px;gap:2px;background:transparent}.memory-head-actions{position:static;gap:4px;z-index:5}.memory-head h1{font-size:24px}.memory-head-actions #memory-ranking-button{margin-right:0;background:#191a23d9;padding:4px 5px;border-radius:3px}.memory-counters{grid-column:1;grid-row:2;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:20px;padding:8px 15px}.memory-counters>div{flex-direction:column;gap:4px}.memory-counters output{font-size:23px}.memory-table{grid-column:2;grid-row:1/4;padding:5px 50px 5px 0}.memory-board{width:min(100%,calc((100dvh - 12px)*2/3))}.memory-cards{gap:3px}.memory-footer{grid-column:1;grid-row:3;min-height:0;border:0;align-self:end;padding:5px 13px;flex-direction:column;gap:1px;background:transparent}.memory-footer #memory-restart{margin:0;padding:5px;min-height:40px}.memory-victory-image{height:42dvh}.memory-victory-copy h2{font-size:20px}.memory-victory-copy{padding:12px 18px}.memory-victory-actions button{padding-block:7px}}
@media(prefers-reduced-motion:reduce){.memory-card-turn,.memory-card-icon,.memory-card-mark{transition:none!important}.memory-card:not(:disabled):hover .memory-card-turn{transform:none}}
