:root { color-scheme: dark; font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; padding: 20px 12px; display: grid; place-items: center; background: #100e1c; color: #fff; }
.game { width: min(100%, 820px); padding: clamp(14px, 3vw, 32px); background: radial-gradient(ellipse at 50% -15%, #57315f, transparent 59%), linear-gradient(150deg,#201329,#111320); border: 1px solid #ffffff12; border-radius: 22px; }
.header, .brand, .actions, .progress-labels, footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header { flex-wrap: wrap; margin-bottom: 20px; }
.brand { justify-content: flex-start; }
.brand-heart { font-size: 36px; line-height: 1; }
h1 { font-size: clamp(26px, 4.5vw, 36px); letter-spacing: -1.2px; line-height: 1.08; margin: 0; font-weight: 900; }
h1 span { color: #ff76b1; }
.brand p { font-size: 12px; color: #b9a4bf; margin: 6px 0 0; }
.actions { gap: 8px; }
.game-button { background: #ffffff12; color: white; border: 1px solid #ffffff28; border-radius: 10px; padding: 10px 13px; cursor: pointer; font-weight: 750; font-size: 12px; font-family: inherit; transition: background .16s, transform .16s; }
.game-button:hover:not(:disabled) { background: #ffffff24; transform: translateY(-1px); }
.game-button.primary { background: #f364a6; color: #2b142a; border-color: #f364a6; }
.game-button.primary:hover { background: #ff86bb; }
.game-button:disabled { opacity: .4; cursor: not-allowed; }
.stats { display: flex; gap: 8px; margin-bottom: 17px; }
.stat { min-width: 0; flex: 1; text-align: center; background: #ffffff0b; border: 1px solid #ffffff15; border-radius: 12px; padding: 11px 5px; }
.stat>span { display: block; color: #b9a8c2; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.stat strong { display: block; font-weight: 850; font-size: clamp(17px, 3.5vw, 25px); font-variant-numeric: tabular-nums; }
.stat strong b { font-weight: inherit; }
.stat small { font-size: 12px; color: #b6a4bd; margin-left: 2px; }
.progress { margin-bottom: 16px; }
.progress-labels { color: #b6a3c2; font-size: 11px; margin-bottom: 8px; }
.streak { color: #ffd28d; font-size: 12px; font-weight: 800; }
.progress-track { background: #ffffff18; height: 7px; border-radius: 10px; overflow: hidden; }
#progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg,#f35b9b,#ffd17a); transition: width .35s; }
.board-wrap { position: relative; isolation: isolate; }
.board { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: clamp(3px,.7vw,7px); width: 100%; }
.tile { aspect-ratio: 1; width: 100%; min-width: 0; background: transparent; border: 0; padding: 0; position: relative; cursor: pointer; border-radius: 9px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; perspective: 650px; }
.tile-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .32s cubic-bezier(.2,.75,.2,1); }
.tile.face-up .tile-inner { transform: rotateY(180deg); }
.tile-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: clamp(4px, 1vw, 9px); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.tile-back { background: linear-gradient(145deg,#4a3657,#30283e); border: 1px solid #ffffff18; box-shadow: inset 0 1px #ffffff17,0 2px 4px #0002; }
.tile-back svg { width: 46%; height: 46%; fill: #b48fab; opacity: .35; }
.tile:hover:not(.face-up) .tile-back { background: #63476b; }
.tile-front { transform: rotateY(180deg); background: linear-gradient(145deg,#fffaff,#e8e1f1); border: 1px solid #fff8; }
.tile-front svg { width: 74%; height: 74%; fill: var(--heart-color); filter: drop-shadow(0 2px 1px #0002); }
.tile.matched .tile-front { background: color-mix(in srgb, var(--heart-color) 16%, #30263c); border-color: color-mix(in srgb,var(--heart-color) 55%,transparent); }
.tile.matched .tile-front svg { opacity: .85; width: 66%; height: 66%; }
.tile:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tile.correct { z-index: 2; animation: heart-correct .8s ease both; }
.tile.correct .tile-front { box-shadow: 0 0 17px var(--heart-color),inset 0 0 12px #ffffff40; }
.effects-layer { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 8; }
.particle { position: absolute; left: 0; top: 0; font-size: var(--size); color: var(--colour); text-shadow: 0 0 8px currentColor; line-height: 1; animation: heart-particle var(--duration) cubic-bezier(.15,.65,.3,1) forwards; animation-delay: var(--delay); opacity: 0; will-change: transform,opacity; }
.effect-label { position: absolute; left: 0; top: 0; font-size: clamp(14px,3vw,22px); font-weight: 1000; white-space: nowrap; pointer-events: none; z-index: 10; animation: heart-label 1.05s ease-out forwards; text-shadow: 0 3px 12px #000b; }
.effect-label.good { color: #fff3ad; }
.ripple { position: absolute; border: 3px solid var(--ripple-color); border-radius: 50%; width: 12px; height: 12px; left: 0; top: 0; transform: translate(-50%,-50%); animation: heart-ripple .65s ease-out forwards; }
.win-cover { position: absolute; inset: 0; border-radius: 12px; background: #140d21e8; backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center; z-index: 15; padding: 15px; }
.win-panel { border-radius: 20px; padding: 28px 22px; background: linear-gradient(140deg,#4b294a,#262037); border: 1px solid #f37bb660; box-shadow: 0 16px 60px #0009; max-width: 340px; width: 100%; text-align: center; }
.trophy { font-size: 58px; }
h2 { font-size: 27px; font-weight: 950; margin: 8px 0; }
.win-panel p { font-size: 13px; color: #d7c0dc; }
.win-stats { margin: 20px 0; }
.record { color: #ffcf86; margin-bottom: 13px; font-size: 13px; }
.play-again { width: 100%; padding: 13px; font-size: 15px; }
footer { flex-wrap: wrap; font-size: 12px; color: #b9a7c5; padding: 17px 0 0; }
[hidden] { display: none !important; }
@keyframes heart-correct { 0%{transform:scale(1)} 25%{transform:scale(1.25)} 48%{transform:scale(.92)} 70%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes heart-particle { 0%{opacity:0;transform:translate(-50%,-50%) scale(.25) rotate(0)} 15%{opacity:1} 75%{opacity:1} 100%{opacity:0;transform:translate(calc(-50% + var(--dx)),calc(-50% + var(--dy))) scale(var(--end-scale)) rotate(var(--rotate))} }
@keyframes heart-label { 0%{opacity:0;transform:translate(-50%,-20%) scale(.6)} 20%{opacity:1;transform:translate(-50%,-65%) scale(1.14)} 60%{opacity:1} 100%{opacity:0;transform:translate(-50%,-170%) scale(1)} }
@keyframes heart-ripple { 0%{opacity:.85;width:12px;height:12px} 100%{opacity:0;width:125px;height:125px} }
@media(max-width:480px) { body{padding:8px 4px} .game{padding:14px 9px} .header{gap:14px} .brand-heart{font-size:28px} .board{gap:3px} .stat{padding:8px 3px} }
@media(prefers-reduced-motion:reduce) { .tile-inner{transition:none} .particle,.effect-label,.ripple{animation-duration:.15s} .tile.correct{animation:none} }
