body.memory-open{overflow:hidden}
.memory-launch[hidden]{display:none}
.memory-invite{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:12px;width:calc(100% - 28px);margin:14px;padding:18px 14px;text-align:center;color:var(--green-deep);background:#f4e6bf;border:1px solid #d9bd78;border-radius:5px;box-shadow:0 3px 0 #d9bd7845}
.memory-invite:hover{background:#eed99e;color:var(--green-deep);border-color:#b58c32}
.memory-invite-icon{position:relative;display:flex;align-items:center;justify-content:center;flex:0 0 50px;height:64px;isolation:isolate}
.memory-invite-icon:before,.memory-invite-icon:after{content:'';position:absolute;inset:4px 1px;background:var(--green);border:1px solid #fff8;border-radius:5px;z-index:-1}
.memory-invite-icon:before{transform:rotate(-13deg);background:#41695c}
.memory-invite-icon:after{transform:rotate(5deg)}
.memory-invite-icon .crest{width:37px;height:49px;object-fit:contain}
.memory-invite-copy{display:block;min-width:0;flex:1 1 8rem}
.memory-invite-copy>span{display:block;font-size:.875rem;line-height:1.4}
.memory-invite-copy .memory-invite-kicker{font-size:.7rem;letter-spacing:.1em;font-weight:700;margin-bottom:4px}
.memory-invite-copy strong{display:block;font-family:var(--serif);font-size:1.1rem;font-weight:400;line-height:1.2;margin-bottom:7px}
html.a11y-contrast .memory-invite{background:#fff;color:#000;border:2px solid #000}
.memory-dialog{width:min(960px,calc(100vw - 32px));max-width:960px;max-height:calc(100dvh - 32px);overflow:auto;border:1px solid var(--line);border-radius:8px;background:var(--paper);color:var(--ink);padding:28px;box-shadow:0 20px 90px #102e2955}
.memory-dialog::backdrop{background:#102e29bd}
.memory-header{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:flex-start;gap:20px;background:var(--paper)}
.memory-header h2{font-size:2.2rem;margin-bottom:12px}
.memory-header .eyebrow{margin-bottom:5px}
.memory-close{flex-shrink:0;min-width:44px;min-height:44px;border:1px solid var(--line);border-radius:3px;background:white;font-size:1.6rem;line-height:1}
#memory-instructions{font-size:1rem;margin-bottom:18px;max-width:750px}
.memory-toolbar{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap}
.memory-stats{display:flex;gap:22px;flex-wrap:wrap;font-size:.94rem}
.memory-stats strong{font-variant-numeric:tabular-nums;color:var(--green)}
.memory-stats>span{white-space:nowrap}
.memory-restart{font-size:.875rem;min-height:44px;padding:8px 16px}
.memory-status{padding:12px 0;margin:0;min-height:50px;font-size:.94rem;color:var(--green);font-weight:600}
.memory-board{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.memory-card{position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:1/1;min-width:0;min-height:44px;overflow:hidden;border:2px solid var(--green);border-radius:5px;background:var(--green);color:white;padding:0;isolation:isolate}
.memory-card-back{display:flex;align-items:center;justify-content:center;width:70%;height:70%;border:1px solid #ffffff75;border-radius:50%}
.memory-card-back .crest{display:block;width:66%;height:83%;object-fit:contain}
.memory-card-back[hidden],.memory-card-photo[hidden]{display:none}
.memory-card-photo{display:block;width:100%;height:100%;object-fit:contain;background:#eaf0ed}
.memory-card.is-open{background:#eaf0ed;border-color:#738c7b}
.memory-card.is-matched{opacity:1;border:3px solid #2e7753;cursor:default}
.memory-card-tick{display:none;position:absolute;right:4px;bottom:4px;background:#164d34;color:white;border-radius:50%;width:24px;height:24px;font:700 16px/24px Arial,sans-serif;text-align:center}
.memory-card.is-matched .memory-card-tick{display:block}
.memory-card:hover:not(:disabled):not(.is-open){background:#285b4e}
.memory-keyboard-help{font-size:.875rem;color:var(--muted);margin:16px 0 0}
.memory-won .memory-status{background:var(--green-light);padding:12px;margin-block:12px;border:1px solid var(--green);border-radius:3px}
html.a11y-contrast .memory-card-back{color:white;border-color:white}
html.a11y-contrast .memory-card{background:black;border-color:black}
html.a11y-contrast .memory-card.is-matched{border-color:black}
@media(max-width:640px){.memory-dialog{padding:18px;width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}.memory-header{gap:10px}.memory-header h2{font-size:1.75rem}.memory-header .eyebrow{font-size:.7rem}.memory-board{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.memory-stats{gap:12px;font-size:.875rem}.memory-toolbar{gap:12px}.memory-restart{padding:8px 12px}.memory-status{line-height:1.5}.memory-card-back{font-size:2.3rem}}
@media print{.memory-dialog,.memory-launch{display:none!important}}
