/* memoria.css - estilo para o Jogo da Memória Axé Kids */

/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Comic Sans MS", cursive, sans-serif;
}

body {
  background: linear-gradient(135deg, #f9c74f, #90be6d);
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
}

.btn-voltar {
  display: inline-block;
  margin: 15px 0;
  padding: 10px 18px;
  background: #6a4c93;
  color: white;
  text-decoration: none;
  font-weight: bold;
  border-radius: 10px;
  box-shadow: 0 3px 5px rgba(0,0,0,0.3);
  transition: background 0.3s ease;
}

.btn-voltar:hover,
.btn-voltar:focus {
  background: #553d77;
  outline: none;
}

header {
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 1px 1px 1px #fff;
}

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
}

#jogo-memoria {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tabuleiro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 15px;
}

.carta {
  width: 100%;
  aspect-ratio: 2 / 3;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

.carta > div {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  backface-visibility: hidden;
  transition: transform 0.5s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.frente {
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  border: 3px solid #6a4c93;
  overflow: hidden;
  font-size: 1.1rem;
  user-select: none;
}

.frente img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  pointer-events: none;
}

.verso {
  background: #6a4c93;
  transform: rotateY(180deg);
  border: 3px solid #222;
}

.carta.virada .frente {
  transform: rotateY(0deg);
  z-index: 2;
}

.carta.virada .verso {
  transform: rotateY(180deg);
  z-index: 1;
}

.carta:not(.virada) .frente {
  transform: rotateY(180deg);
  z-index: 1;
}

.carta:not(.virada) .verso {
  transform: rotateY(0deg);
  z-index: 2;
}

.carta.encontrada {
  cursor: default;
  box-shadow: 0 0 15px 4px #f9c74f;
}

.nome-orixa {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 900;
  color: #6a4c93;
  text-shadow: 0 0 5px #fff;
  font-size: 0.85rem;
  user-select: none;
  pointer-events: none;
}

/* Mensagem final */
#mensagem {
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  padding: 10px 12px;
  color: #333;
}

.botoes-final button {
  background: #1982c4;
  color: white;
  border: none;
  padding: 12px 25px;
  margin: 8px;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 4px 6px rgba(0,0,0,0.25);
  transition: background 0.3s ease;
}

.botoes-final button:hover,
.botoes-final button:focus {
  background: #105a8b;
  outline: none;
}

/* Responsividade */
@media (max-width: 480px) {
  #tabuleiro {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    max-width: 100%;
  }

  .carta {
    aspect-ratio: 3 / 4;
  }

  .botoes-final button {
    padding: 10px 18px;
    font-size: 0.9rem;
    margin: 6px 4px;
  }
}
