/* ==========================================================================
   JOGO DA MEMÓRIA DO HARDWARE — ESTILOS HOLOGRÁFICOS & TABULEIRO 3D (v5.0)
   100% SVG, Grid Responsivo, Efeito de Virada 3D e Duelo 2P
   ========================================================================== */

:root {
  --mem-bg: #050811;
  --mem-surface: #0a1120;
  --mem-surface-soft: #131f37;
  --mem-line: rgba(255, 255, 255, 0.14);
  --mem-text: #f8fafc;
  --mem-text-muted: #94a3b8;
  --mem-neon-cyan: #38bdf8;
  --mem-neon-purple: #a855f7;
  --mem-neon-green: #10b981;
  --mem-neon-gold: #f59e0b;
}

body.memoria-app-body {
  background-color: var(--mem-bg);
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(16, 185, 129, 0.1) 0%, transparent 60%),
    radial-gradient(circle at 85% 85%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    linear-gradient(to bottom, #04060c, #090e1a);
  color: var(--mem-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ==========================================================================
   HUD / BARRA DE STATUS SUPERIOR DO JOGO
   ========================================================================== */
.memoria-hud-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hud-stat-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid var(--mem-line);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hud-stat-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mem-text-muted);
}

.hud-stat-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffffff;
  margin-top: 0.15rem;
}

/* HUD de Duelo 2P */
.duelo-hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.6);
  border: 1.5px solid var(--mem-line);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.duelo-player-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.duelo-player-chip.p1-active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.duelo-player-chip.p2-active {
  background: rgba(244, 114, 182, 0.2);
  border-color: #f472b6;
  box-shadow: 0 0 15px rgba(244, 114, 182, 0.4);
}

.duelo-turn-indicator {
  font-weight: 900;
  font-size: 0.95rem;
  color: #facc15;
}

/* ==========================================================================
   TABULEIRO & CARTAS 3D DO JOGO DA MEMÓRIA
   ========================================================================== */
.memory-board-grid {
  display: grid;
  gap: 0.85rem;
  margin: 0 auto 1.5rem auto;
  justify-content: center;
}

.grid-easy {
  grid-template-columns: repeat(4, minmax(80px, 140px));
}

.grid-medium {
  grid-template-columns: repeat(4, minmax(80px, 140px));
}

.grid-hard {
  grid-template-columns: repeat(6, minmax(70px, 120px));
}

@media (max-width: 680px) {
  .grid-hard {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* A Carta 3D */
.memory-card-3d {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
}

.card-inner-box {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 12px;
}

.memory-card-3d.is-flipped .card-inner-box,
.memory-card-3d.is-matched .card-inner-box {
  transform: rotateY(180deg);
}

.memory-card-3d.is-matched .card-face-front {
  border-color: #10b981 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6), inset 0 0 15px rgba(16, 185, 129, 0.2);
  animation: matchGlowPulse 1.5s infinite alternate;
}

/* Lados da Carta */
.card-face {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  box-sizing: border-box;
}

/* Verso (Fechada) */
.card-face-back {
  background: linear-gradient(145deg, #0f172a, #070b14);
  border: 2px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  color: var(--mem-neon-cyan);
}

.card-face-back:hover {
  border-color: var(--mem-neon-cyan);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
}

/* Frente (Aberta) */
.card-face-front {
  background: #090e1a;
  border: 2px solid var(--mem-neon-purple);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  transform: rotateY(180deg);
  text-align: center;
}

.card-title-text {
  font-size: 0.74rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.35rem;
  line-height: 1.2;
}

/* Galeria do Catálogo */
.cat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.cat-card-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid var(--mem-line);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  transition: all 0.2s ease;
}

.cat-card-box:hover {
  border-color: var(--mem-neon-cyan);
  transform: translateY(-3px);
}

@keyframes matchGlowPulse {
  0% { transform: rotateY(180deg) scale(1); filter: drop-shadow(0 0 10px #10b981); }
  100% { transform: rotateY(180deg) scale(1.02); filter: drop-shadow(0 0 20px #34d399); }
}