:root { --ink: #20283a; --muted: #697286; --paper: #f6f7fb; --line: #e6e8ef; --purple: #8582b5; --green: #6f9276; }
* { box-sizing: border-box; }
body.mini-game-page { min-height: 100vh; margin: 0; padding: 0 18px; display: flex; flex-direction: column; align-items: center; background: var(--paper); color: var(--ink); font-family: 'DM Sans', 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.game-header { width: min(760px, 100%); min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.back-link { color: #596477; font-size: .88rem; font-weight: 700; text-decoration: none; }
.back-link:hover, .text-link:hover { color: var(--green); }
.small-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: 'Manrope', sans-serif; font-size: .93rem; font-weight: 800; }
.small-brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--ink); color: white; font-size: .84rem; letter-spacing: -.08em; padding-right: 2px; }
.memory-main { width: min(760px, 100%); flex: 1; padding: 28px 0 26px; display: flex; flex-direction: column; align-items: center; }
.game-heading { text-align: center; margin-bottom: 19px; }
.game-kicker { color: #7a8798; font-size: .68rem; font-weight: 800; letter-spacing: .14em; }
.game-heading h1 { margin: 9px 0 7px; font-family: 'Manrope', sans-serif; font-size: clamp(2.2rem, 8vw, 2.8rem); line-height: 1.1; letter-spacing: -.065em; }
.game-heading h1 span { color: var(--purple); }
.game-heading p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.memory-stats { width: min(100%, 700px); display: flex; justify-content: space-between; margin: 0 auto 12px; }
.memory-stats > div { display: flex; align-items: baseline; gap: 7px; padding: 9px 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.stat-label { color: var(--muted); font-size: .78rem; }
.memory-stats strong { font-size: .91rem; }
.memory-board { width: min(100%, 700px); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.memory-card { min-width: 0; aspect-ratio: 1; padding: 0; border: 0; background: transparent; cursor: pointer; perspective: 500px; }
.memory-card:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #aaa7d5; outline-offset: 3px; }
.card-inner { position: relative; display: block; width: 100%; height: 100%; border-radius: 13px; transform-style: preserve-3d; transition: transform 260ms ease; }
.memory-card.flipped .card-inner, .memory-card.matched .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; display: grid; place-items: center; border: 1px solid #e0e1ef; border-radius: 13px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card-front { background: #e7e7f3; color: #8582b5; font-family: 'Manrope', sans-serif; font-size: 1.8rem; font-weight: 800; }
.card-back { transform: rotateY(180deg); background: white; font-size: clamp(1.5rem, 6vw, 2.2rem); box-shadow: 0 5px 13px rgba(32, 40, 58, .035); }
.memory-card.matched .card-back { background: #e7f0e6; border-color: #c5d9c6; }
.memory-status { min-height: 24px; margin: 15px 0 12px; color: #596477; text-align: center; font-size: .88rem; }
.primary-button { min-height: 45px; padding: 0 20px; border: 0; border-radius: 11px; background: var(--ink); color: white; font: inherit; font-size: .91rem; font-weight: 800; cursor: pointer; transition: opacity 150ms ease, transform 150ms ease; }
.primary-button:hover { opacity: .9; transform: translateY(-1px); }
.text-link { margin-top: 19px; color: #68758a; font-size: .83rem; font-weight: 700; text-decoration: none; text-align: center; }
.game-footer { width: min(760px, 100%); padding: 19px 0 23px; border-top: 1px solid var(--line); color: #8a91a1; font-size: .79rem; text-align: center; }
@media (max-width: 430px) { .game-header { min-height: 65px; } .memory-main { padding-top: 22px; } .memory-board { gap: 7px; } .card-face, .card-inner { border-radius: 10px; } .card-front { font-size: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { .card-inner { transition: none; } }

@media(max-width:600px){.memory-board{grid-template-columns:repeat(4,minmax(0,1fr));max-width:440px}.memory-stats{max-width:440px}}
