/* ===========================
   ESTILOS GENERALES
   =========================== */
body {
  font-family: 'Montserrat', 'Segoe UI', sans-serif;
  background: #fffbe6;
  color: #4e342e;
  margin: 0;
  min-height: 100vh;
}

main {
  padding: 24px 8px 32px 8px;
  max-width: 1200px;
  margin: 0 auto;
}

section {
  margin-bottom: 40px;
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.08);
  border: 2px solid #ffe082;
  animation: fadeIn 0.6s;
}

h1,
h2,
h3 {
  color: #b8860b;
  font-family: 'Montserrat', sans-serif;
  margin-bottom: 12px;
}

ul {
  margin: 0 0 0 22px;
  padding: 0;
}

.curiosidades {
  margin-top: 18px;
  padding: 14px 16px;
  background: #fff8e1;
  border-left: 4px solid #ffd700;
  border-radius: 8px;
  color: #795548;
  font-size: 1.08em;
  box-shadow: 0 1px 4px rgba(212, 175, 55, 0.08);
}

/* ===========================
     CONTADOR FLOTANTE
     =========================== */
#contador-flotante {
  position: fixed;
  top: 18px;
  right: 18px;
  background: #fffde7;
  color: #b8860b;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 1.15em;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.11);
  border: 2px solid #d4af37;
  letter-spacing: 0.5px;
}

/* ===========================
     BOTONES
     =========================== */
button {
  margin: 8px 4px 8px 0;
  padding: 10px 18px;
  border: none;
  background: #ffe082;
  border-radius: 7px;
  cursor: pointer;
  font-size: 1em;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  color: #4e342e;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.10);
  transition: background 0.2s, transform 0.1s;
}

button:hover:not(:disabled) {
  background: #ffd54f;
  transform: scale(1.04);
}

button:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ===========================
     MAPA
     =========================== */
#mapa.mapa-pequeño {
  height: 300px;
  transition: height 0.3s;
  margin-top: 10px;
  border: 2px solid #b8860b;
  border-radius: 8px;
}

#mapa.mapa-grande {
  height: 500px;
}

/* ===========================
     ZONA DE EXCAVACIÓN
     =========================== */
#zona-juego {
  display: grid;
  grid-template-columns: repeat(5, 60px);
  gap: 12px;
  margin: 24px 0;
  justify-content: center;
}

.bloque {
  width: 60px;
  height: 60px;
  background: #d7ccc8;
  border: 2px solid #b8860b;
  cursor: pointer;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 2px 6px rgba(94, 64, 55, 0.13);
  animation: fadeIn 0.3s;
}

.bloque:hover:not(.excavado) {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.18);
}

.bloque.excavado {
  background: #fffde7;
  cursor: default;
  box-shadow: none;
  border: 2px solid #ffd700;
}

/* ===========================
     CARTAS "RASCA Y GANA"
     =========================== */
#cartas-container {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 28px;
  justify-content: center;
}

.carta {
  width: 140px;
  height: 200px;
  background: #d4af37;
  border: 3px solid #d4af37;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.16), 0 1.5px 5px rgba(0, 0, 0, 0.06);
  transition: transform 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  user-select: none;
  animation: fadeIn 0.3s;
}

.carta:not(.revelada)::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  background: url('../public/img/carta-rascar.png') center center no-repeat;
  background-size: 80% 80%;
  z-index: 2;
  opacity: 0.96;
  transition: opacity 0.2s;
}

/* Oculta el contenido curioso mientras no está rascada */
.carta .contenido-curioso {
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.2s;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Al rascar, muestra el contenido y oculta el fondo */
.carta.revelada {
  background: #fffbe6;
  color: #4e342e;
  border: 3px solid #b8860b;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.22);
  cursor: default;
  overflow-y: auto;
}

.carta.revelada .contenido-curioso {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
  height: 100%;
  box-sizing: border-box;
}

.carta.revelada::before {
  content: "";
  display: none;
}

.carta .info-extra {
  display: block;
  margin-top: 10px;
  font-size: 0.95em;
  color: #8d6e63;
  background: #fff8e1;
  border-radius: 6px;
  padding: 6px 4px;
  border: 1px solid #ffe082;
}

.carta {
  position: relative;
  width: 200px;
  height: 280px;
  background-size: cover;
  background-position: center;
  border: 2px solid #d4af37;
  border-radius: 10px;
  margin: 10px;
  padding: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.contenido-carta {
  position: absolute;
  color: white;
  font-weight: bold;
  font-size: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 8px;
}


/* ===========================
     RESULTADO DE RASCA
     =========================== */
#resultado-rasca {
  margin-top: 18px;
  font-style: italic;
  text-align: center;
  min-height: 24px;
  color: #b8860b;
  font-size: 1.1em;
}

/* ===========================
     QUIZ
     =========================== */
.pregunta {
  margin-bottom: 28px;
  padding: 18px 16px;
  background: #fff;
  border-radius: 10px;
  border-left: 5px solid #d4af37;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.06);
  animation: fadeIn 0.4s;
}

.pregunta p {
  font-weight: bold;
  margin-bottom: 12px;
  color: #b8860b;
}

.pregunta button {
  display: block;
  width: 100%;
  margin: 6px 0;
  text-align: left;
  background: #fffbe6;
  border: 1px solid #ffe082;
  color: #4e342e;
  transition: background 0.18s, color 0.18s;
}

.pregunta button:hover:not(:disabled) {
  background: #ffe082;
  color: #b8860b;
}

.pregunta button:disabled {
  background: #f9fbe7;
  color: #bbb;
}

.pregunta button.correcta {
  background: #cddc39;
  color: #33691e;
  font-weight: bold;
  border: 2px solid #b8860b;
}

/* ===========================
     ANIMACIONES
     =========================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
     RESPONSIVE DESIGN
     =========================== */
@media (max-width: 900px) {
  main {
    padding: 18px 4vw 24px 4vw;
    max-width: 98vw;
  }

  section {
    padding: 16px 8px;
    margin-bottom: 28px;
  }

  #zona-juego {
    grid-template-columns: repeat(5, 48px);
    gap: 8px;
  }

  .bloque {
    width: 48px;
    height: 48px;
  }

  #cartas-container {
    gap: 10px;
  }

  .carta {
    width: 150px;
    height: 210px;
    font-size: 0.93em;
  }
}

@media (max-width: 600px) {
  #contador-flotante {
    top: 8px;
    right: 8px;
    padding: 8px 12px;
    font-size: 0.98em;
  }

  main {
    padding: 8px 2vw 18px 2vw;
    max-width: 100vw;
  }

  section {
    padding: 10px 2px;
    margin-bottom: 18px;
    border-radius: 8px;
  }

  h1,
  h2,
  h3 {
    font-size: 1.15em;
    margin-bottom: 7px;
  }

  #zona-juego {
    grid-template-columns: repeat(5, 32px);
    gap: 6px;
    margin: 12px 0;
  }

  .bloque {
    width: 32px;
    height: 32px;
  }

  #cartas-container {
    gap: 6px;
  }

  .carta {
    font-size: 0.8em;
  }

  .carta .contenido-curioso {
    padding: 2px;
  }

  button {
    font-size: 0.95em;
    padding: 8px 10px;
    border-radius: 6px;
  }

  .curiosidades {
    font-size: 0.99em;
    padding: 8px 5px;
    border-radius: 5px;
  }
}

@media (max-width: 400px) {
  .carta {
    font-size: 0.7em;
  }
}