/* Memory Duel: glass cards with a lattice back and coloured geometric faces */
.m-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }

.m-scores { display: flex; gap: var(--sp-2); justify-content: center; }
.m-score {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 4px var(--sp-3); border-radius: var(--r-full);
  background: var(--c-surface); border: 1px solid var(--c-border);
  font-size: var(--fs-sm); color: var(--c-text-muted);
}
.m-score.active { color: var(--c-text); }
.m-score.p0.active { border-color: var(--c-p0); box-shadow: 0 0 12px var(--c-p0-glow); }
.m-score.p1.active { border-color: var(--c-p1); box-shadow: 0 0 12px var(--c-p1-glow); }
.m-score-dot { width: 10px; height: 10px; border-radius: 50%; }
.m-score.p0 .m-score-dot { background: var(--c-p0); }
.m-score.p1 .m-score-dot { background: var(--c-p1); box-shadow: inset 0 0 0 3px var(--c-surface); }
.m-you { font-weight: 700; color: var(--c-text); }

.m-grid {
  width: min(100%, 380px, calc((100dvh - 290px) * 0.6667));
  min-width: 232px;
  aspect-ratio: 4 / 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  perspective: 900px;
}

.m-card {
  position: relative; padding: 0; border: 0; background: none; cursor: pointer;
  min-width: 44px; min-height: 44px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.m-card:disabled { cursor: default; }
.m-card:focus-visible { outline: 3px solid var(--c-border-focus); outline-offset: 2px; border-radius: 12px; }

.m-inner {
  position: absolute; inset: 0; display: block;
  transform-style: preserve-3d;
  transition: transform var(--dur-flip) var(--ease-flip);
}
.m-card.up .m-inner, .m-card.matched .m-inner { transform: rotateY(180deg); }

.m-back, .m-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-md), var(--shadow-inner);
}
.m-back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 9px),
    linear-gradient(150deg, #3b3f8f, #1c2658 70%);
}
.m-face {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)), #17213c;
  backdrop-filter: blur(6px);
}
.m-card.matched .m-face { opacity: 0.95; }
.m-card.own0 .m-face { box-shadow: 0 0 0 2px var(--c-p0), 0 0 16px var(--c-p0-glow); }
.m-card.own1 .m-face { box-shadow: 0 0 0 2px var(--c-p1), 0 0 16px var(--c-p1-glow); }
.m-card.miss .m-face { box-shadow: 0 0 0 2px var(--c-danger); }

.m-sym { width: 66%; height: 66%; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)); }
.sym-circle { color: #f472b6; } .sym-triangle { color: #fb923c; } .sym-square { color: #60a5fa; }
.sym-diamond { color: #a78bfa; } .sym-hexagon { color: #34d399; } .sym-star { color: #facc15; }
.sym-crescent { color: #e2e8f0; } .sym-plus { color: #f87171; } .sym-ring { color: #22d3ee; }
.sym-spiral { color: #c084fc; } .sym-bars { color: #4ade80; } .sym-cross { color: #fb7185; }

@media (prefers-reduced-motion: reduce) {
  .m-inner { transform: none !important; transition: none; }
  .m-back, .m-face { backface-visibility: visible; -webkit-backface-visibility: visible; }
  .m-face { transform: none; opacity: 0; }
  .m-card.up .m-face, .m-card.matched .m-face { opacity: 1; z-index: 1; }
}
