:root{background:#edf0fa;color:#59627f}body{background:radial-gradient(ellipse at 20% 10%,#fffaf1,transparent 60%),linear-gradient(#e8effb,#f4eafa);min-height:100svh}.memory-shell{max-width:960px}.memory-shell h1{color:#68618e}.memory-shell .status{color:#8b83a2}.memory-board{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(5,minmax(88px,1fr));gap:15px;max-width:740px;margin:26px auto 0}.memory-card{display:block;position:relative;width:100%;min-width:0;min-height:88px;padding:0;border:0;border-radius:15px;background:transparent;perspective:850px;cursor:pointer;touch-action:manipulation}.memory-inner{display:block;position:relative;width:100%;height:100%;min-height:88px;transform-style:preserve-3d;transition:transform .45s cubic-bezier(.2,.7,.3,1)}.memory-card.flipped .memory-inner{transform:rotateY(180deg)}.memory-back,.memory-front{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border:2px solid #fff;border-radius:15px;backface-visibility:hidden;-webkit-backface-visibility:hidden;box-shadow:0 5px #aaa8d0,0 8px 14px #68618e15}.memory-back{background:radial-gradient(circle at 15% 20%,#ffffff60 0 4px,transparent 5px),radial-gradient(circle at 85% 80%,#ffffff60 0 4px,transparent 5px),linear-gradient(135deg,#b4c6e7,#c3afd9);font:800 38px/1 system-ui;color:#ffffffde;text-shadow:0 2px #8b87b7}.memory-back::after{content:'';position:absolute;inset:7px;border:1px dashed #ffffff80;border-radius:10px}.memory-front{transform:rotateY(180deg);background:linear-gradient(140deg,#fffefa,#f3edfc);padding:12px;color:#666080;font:800 clamp(16px,2.7vw,24px)/1.25 system-ui,'Microsoft YaHei',sans-serif;text-align:center;overflow-wrap:anywhere;overflow:auto;scrollbar-width:none}.memory-front.zh{background:linear-gradient(135deg,#fff9e5,#ffedc9);color:#8b7044}.memory-card.wrong .memory-front{border-color:#d98185;background:#fff0ee}.memory-card.paired .memory-front{border-color:#8abf9f;background:#e9f8eb}.memory-card.vanished{visibility:hidden;opacity:0;transform:scale(.65);transition:opacity .25s,transform .25s,visibility 0s .25s;pointer-events:none}.memory-card:focus-visible{outline:3px solid #8276b5;outline-offset:5px}.memory-empty{min-height:88px;border-radius:15px;border:1px dashed #c4b9db70;background:#ffffff22}.finish-dialog{text-align:center}.finish-dialog .game-picker{max-width:200px;margin:20px auto 0}.memory-shell .game-picker{color:#72638f;border-color:#c4b7db;background:linear-gradient(#fff,#f1eafa);box-shadow:0 3px #c3b4d7}.memory-shell .current-round strong{color:#8270a0}@media(max-width:600px){.memory-shell{padding:18px 10px}.memory-board{gap:10px 8px;margin-top:20px;grid-template-rows:repeat(5,minmax(76px,1fr))}.memory-card,.memory-inner,.memory-empty{min-height:76px}.memory-back,.memory-front{border-radius:12px}.memory-front{padding:7px;font-size:clamp(13px,3.7vw,19px)}.memory-back{font-size:31px}}@media(prefers-reduced-motion:reduce){.memory-inner,.memory-card.vanished{transition:none}}

.memory-voice-controls{position:absolute;top:0;left:0;display:flex;gap:6px;align-items:center}.memory-voice-button{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 9px;border:1px solid #b8b0d4;border-radius:999px;background:linear-gradient(#f8f5ff,#e0d9f1);color:#6e5e91;font:700 12px/1 system-ui,'Microsoft YaHei',sans-serif;cursor:pointer;box-shadow:0 2px #c7bddb}.memory-voice-button::before{content:'';width:7px;height:7px;border-radius:50%;background:#85aa89;box-shadow:0 0 0 2px #ffffff80}.memory-voice-button[aria-checked=false]{background:#eeedf3;border-color:#d1cddc;color:#97909f;box-shadow:0 2px #d9d5e1}.memory-voice-button[aria-checked=false]::before{background:#b4acbf}.memory-voice-button:focus-visible{outline:3px solid #8276b5;outline-offset:3px}@media(max-width:600px){.memory-voice-controls{gap:4px}.memory-voice-button{height:30px;padding:0 7px;font-size:11px}.memory-shell header{padding-top:43px}}

.memory-voice-button::before{display:none}.memory-speaker{width:15px;height:15px;flex:none}.memory-speaker .speaker-muted{display:none}.memory-voice-button[aria-checked=false] .speaker-waves{display:none}.memory-voice-button[aria-checked=false] .speaker-muted{display:block}

/* Wider library selector with a compact root tab. */
.game-topbar #primaryPicker{flex:0 0 86px;min-width:86px;padding-left:6px;padding-right:6px;font-size:12px}
.game-topbar #secondaryPicker{flex:1 1 250px;min-width:180px}
@media(max-width:600px){.game-topbar #primaryPicker{flex:0 0 58px;min-width:58px;font-size:11px}.game-topbar #secondaryPicker{flex:1 1 auto;min-width:118px}}

/* Match the root tab width to the level control. */
.game-topbar #primaryPicker{flex:0 0 116px;min-width:116px}
@media(max-width:600px){.game-topbar #primaryPicker{flex:0 0 86px;min-width:86px}}
