* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: url(../img/background.jpg) no-repeat center center fixed;
  background-size: cover;
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

main {
  width: 95%;
  max-width: 900px;
  text-align: center;
}

button {
  background: linear-gradient(135deg, #00bcd4, #0097a7);
  border: none;
  color: white;
  padding: 10px 20px;
  font-size: 1.1em;
  margin: 5px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

button:hover {
  background: linear-gradient(135deg, #0097a7, #007c91);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}


.animate__animated {
  --animate-duration: 0.6s;
}


/* ************* PANELES ************* */
.panel {
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}

.panel.visible {
  display: block;
}

h1, h2 {
  margin-bottom: 15px;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.4);
}

.menu-botones {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ************* TABLERO ************* */

#juego {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 15px;
  padding: 20px;
}


.tablero {
  max-width: 600px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  justify-items: center;
  perspective: 1000px;
}

.carta {
  width: 80px;
  height: 110px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s, box-shadow 0.3s;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.carta:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}


.carta div {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden;
  top: 0;
  left: 0;
}

.carta .reverso {
  background-color: #ffffff;
  border: 2px solid #000000;
  background-image: url('../img/icono.ico');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
  transform: rotateY(0deg);
  z-index: 2;
  transition: opacity 0.3s ease;
}

.carta.girada .reverso {
  opacity: 0;
}

.carta .frente {
  background-size: cover;
  background-position: center;
  transform: rotateY(180deg);
  z-index: 1;
  border: 2px solid #000000;
  border-radius: 10px;
}

.carta.girada {
  transform: rotateY(180deg);
}

.carta.acertada {
  transform: rotateY(180deg);
  filter: brightness(1.2) saturate(1.4);
  animation: brillar 1s ease;
}

@keyframes brillar {
  0% { box-shadow: 0 0 0px rgb(255, 255, 255); }
  50% { box-shadow: 0 0 25px rgb(255, 255, 255); }
  100% { box-shadow: 0 0 0px rgb(255, 255, 255); }
}

/* ************* HUD ************* */
.hud {
  display: flex;
  justify-content: space-around;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 15px;
  font-weight: bold;
}

/* ************* MODALES ************* */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 10;
}

.modal.oculto {
  display: none;
}

.modal-content {
  background: #222;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  width: 90%;
  max-width: 400px;
}

/* ************* RANKING ************* */
.podio {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: 20px auto;
  gap: 15px;
}

.podio div {
  background: gold;
  color: #000;
  width: 80px;
  border-radius: 8px 8px 0 0;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
}

.podio .oro {
  height: 150px;
  background: linear-gradient(180deg, #ffd700, #ffcc00);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.podio .plata {
  height: 120px;
  background: linear-gradient(180deg, #dcdcdc, #c0c0c0);
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}

.podio .bronce {
  height: 100px;
  background: linear-gradient(180deg, #cd7f32, #b87333);
  box-shadow: 0 0 10px rgba(205, 127, 50, 0.6);
}


#listaRanking {
  list-style: none;
  margin-top: 20px;
}

#listaRanking li {
  background: rgba(255,255,255,0.1);
  margin: 5px auto;
  padding: 8px;
  border-radius: 8px;
  width: 80%;
}

/* ************* INPUT ************* */
input[type="text"] {
  padding: 10px;
  border-radius: 8px;
  border: none;
  width: 80%;
  max-width: 300px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 1em;
}


@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ************* RESPONSIVE ************* */
@media (max-width: 700px) {
  .tablero {
    grid-template-columns: repeat(4, 1fr);
  }

  .carta {
    width: 70px;
    height: 90px;
  }
}