.hmg-game{max-width:900px;margin:1.5rem auto;font-family:inherit}.hmg-status{display:flex;gap:1rem;justify-content:space-between;flex-wrap:wrap;margin-bottom:1rem;font-size:1.05rem}.hmg-board{display:grid;grid-template-columns:repeat(var(--hmg-cols),minmax(0,1fr));gap:clamp(5px,1.5vw,12px)}.hmg-card{padding:0;border:0;background:none;cursor:pointer;aspect-ratio:1;perspective:800px;min-width:0}.hmg-card-inner{display:block;position:relative;width:100%;height:100%;transform-style:preserve-3d;transition:transform .3s}.hmg-card.is-flipped .hmg-card-inner{transform:rotateY(180deg)}.hmg-card img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:8px;backface-visibility:hidden;box-shadow:0 2px 5px #0002}.hmg-card-front{transform:rotateY(180deg)}.hmg-card.is-matched{cursor:default}.hmg-card:focus-visible{outline:3px solid #4169e1;outline-offset:3px;border-radius:8px}.hmg-finish{text-align:center;padding:1.2rem;margin-top:1.25rem;border:2px solid currentColor;border-radius:10px}.hmg-finish[hidden]{display:none}.hmg-actions{text-align:center;margin-top:1rem}.hmg-restart{cursor:pointer;padding:.65rem 1.2rem;border-radius:7px;border:1px solid #555;background:#fff;color:#222;font:inherit}.hmg-restart:hover{background:#eee}@media(max-width:600px){.hmg-board{grid-template-columns:repeat(min(4,var(--hmg-cols)),minmax(0,1fr))}.hmg-status{font-size:.9rem;gap:.5rem}}@media(prefers-reduced-motion:reduce){.hmg-card-inner{transition:none}}

/* Completion dialog overlays the cards without changing the page layout. */
.hmg-board-wrap{position:relative}
.hmg-finish{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;margin:0;border:0;border-radius:10px;background:rgba(20,12,36,.36);text-align:center}
.hmg-finish[hidden]{display:none}
.hmg-finish-box{width:min(100%,360px);max-height:100%;overflow:auto;box-sizing:border-box;padding:22px 20px;background:#fff;color:#282033;border:2px solid #7c3aed;border-radius:14px;box-shadow:0 12px 38px #0005}
.hmg-finish-box h3{margin:0 0 10px;font-size:1.35rem;line-height:1.3}
.hmg-finish-box p{margin:8px 0}
.hmg-finish-box .hmg-restart{margin-top:10px}
.hmg-card.is-match-highlight .hmg-card-inner{outline:4px solid #9333ea;outline-offset:-4px;border-radius:8px;box-shadow:0 0 0 3px #9333ea88}
.hmg-card.is-match-dimmed .hmg-card-inner{filter:grayscale(1);opacity:.3;transition:transform .3s,filter .3s,opacity .3s}
@media(max-width:480px){.hmg-finish-box{padding:14px 12px}.hmg-finish-box h3{font-size:1.1rem}}
