@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root { color-scheme: dark; font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif; background: #171719; color: #f3f0e9; font-synthesis: none; --muted: #a8a4a1; --gold: #e6ae73; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 80% 5%, #302832 0, transparent 40%), #171719; }
button { font: inherit; }
.game-shell { width: min(100%, 620px); height: 100svh; min-height: 100svh; margin: auto; padding: max(22px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.topline, footer { display: flex; align-items: center; justify-content: space-between; font: 10px 'DM Mono', monospace; letter-spacing: .09em; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #aaa6a2; text-decoration: none; }
.mark { color: var(--gold); font-size: 19px; }
.collection-label { color: #777371; font-size: 9px; }
.game { width: 100%; max-width: 470px; margin: clamp(22px, 5vh, 48px) auto 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.game-heading { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { color: #d9a871; margin: 0 0 7px; letter-spacing: .02em; font-size: 12px; }
h1 { margin: 0; font-size: clamp(34px, 9vw, 48px); line-height: 1; letter-spacing: -.065em; font-weight: 600; }
h1 span { color: var(--gold); }
.reset-button { flex: 0 0 auto; width: 43px; height: 43px; border: 1px solid #464047; border-radius: 50%; display: grid; place-items: center; color: #d4cdc5; background: #242226; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.reset-button:active { transform: scale(.94); }
.reset-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.instructions { margin: 14px 0 13px; color: var(--muted); font-size: 13px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #898480; font: 9px 'DM Mono', monospace; letter-spacing: .1em; }
.settings-row select { min-width: 76px; min-height: 34px; padding: 0 25px 0 11px; border: 1px solid #464047; border-radius: 9px; background: #242226; color: #f3f0e9; font: 12px 'DM Mono', monospace; letter-spacing: .03em; }
.settings-row select:focus-visible { outline: 3px solid #e6ae73; outline-offset: 2px; }
.scoreboard { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #38343a; border-radius: 13px; background: #211f22; margin-bottom: 13px; padding: 11px 0; }
.score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.score + .score { border-left: 1px solid #39343a; }
.score-label { color: #898480; font: 9px 'DM Mono', monospace; letter-spacing: .1em; }
.score strong { font-size: 17px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.score small { color: #817b79; font-size: 12px; font-weight: 400; }
.board-frame { flex: 1; min-height: 0; padding: 7px; border: 1px solid #3b363b; border-radius: 16px; background: #100f11; box-shadow: 0 12px 38px #0004; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.board { height: 100%; max-height: 100%; max-width: 100%; width: auto; aspect-ratio: 4 / var(--rows, 6); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 7px; }
.tile { position: relative; min-width: 0; padding: 0; aspect-ratio: 1 / 1; border: 1px solid #3a363b; border-radius: 10px; overflow: hidden; background: #222024; color: #f3f0e9; cursor: pointer; perspective: 500px; -webkit-tap-highlight-color: transparent; }
.tile-inner { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .32s cubic-bezier(.2,.75,.25,1); transform-style: preserve-3d; }
.tile-face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.tile-back { background: linear-gradient(145deg, #29252c, #1d1b1e); }
.tile-back::before { content: '✳'; color: #d6a46f; font-size: clamp(17px, 5vw, 25px); opacity: .72; }
.tile-front { transform: rotateY(180deg); background: linear-gradient(145deg, #f1e6d6, #d9c8af); }
.tile-emoji { font-size: clamp(30px, 9vw, 47px); line-height: 1; filter: drop-shadow(0 3px 2px #38230c2e); }
.tile.is-open .tile-inner, .tile.is-matched .tile-inner { transform: rotateY(180deg); }
.tile.is-matched { border-color: #7c9e7d; box-shadow: inset 0 0 0 1px #7c9e7d66; cursor: default; }
.tile.is-matched .tile-front { background: linear-gradient(145deg, #d9e4ce, #b8c8ad); }
.tile:focus-visible, .reset-button:focus-visible { outline: 3px solid #e6ae73; outline-offset: 2px; }
.message { min-height: 30px; padding-top: 12px; color: #aaa5a2; text-align: center; font-size: 12px; }
.message.is-win { color: #d9b17f; font-size: 14px; }
footer { margin-top: auto; padding-top: 22px; color: #777371; font-size: 9px; letter-spacing: .04em; }
.offline { color: #aaa6a2; display: flex; align-items: center; gap: 7px; }
.offline i { width: 6px; height: 6px; border-radius: 50%; background: #9dc49f; box-shadow: 0 0 9px #9dc49f66; }
@media (max-height: 700px) { .game { margin-top: 14px; } .instructions { margin: 8px 0 10px; } .settings-row { margin-bottom: 7px; } .board { gap: 5px; } .board-frame { padding: 5px; } footer { padding-top: 12px; } }
@media (max-width: 360px) { .game-shell { padding-left: 14px; padding-right: 14px; } .board { gap: 5px; } .board-frame { padding: 5px; } .tile { border-radius: 8px; } .tile-emoji { font-size: 29px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
