.tablero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 15px;
  justify-content: center;
  margin-top: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.tarjeta {
  width: 100%;
  aspect-ratio: 1 / 1; 
  perspective: 800px;
  cursor: pointer;
}

.cara {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.frente {
  background-color: #6ae789;
  color: white;
}

.dorso {
  background-color: #ecf0f1;
  transform: rotateY(180deg);
}

.contenedor {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
}

.volteada .contenedor {
  transform: rotateY(180deg);
}

/* --- OVERLAY ELEGANTE --- */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: -1;
}

/* --- TÍTULO ANIMADO --- */
.titulo {
    font-size: 2.8rem;
    color: #fff;
    text-shadow: 0px 4px 12px rgba(0,0,0,0.6);
    margin-bottom: 20px;
    animation: glow 2s infinite alternate;
    text-align: center;
}


/* ANIMACIONES */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes glow {
    0%   { text-shadow: 0px 0px 8px #fff; }
    100% { text-shadow: 0px 0px 20px #c4a0ff; }
}

@media (min-width: 801px) {
  .tablero {
    grid-template-columns: repeat(4, 1fr); 
    max-width: 500px;
  }
}



@media (max-width: 450px) {
  .tablero {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  }
  .cara {
    font-size: 1.4rem;
  }
}

@media (min-width: 451px) and (max-width: 800px) {
  .tablero {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
}

#mensaje-completado {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.contenido-mensaje {
  background-color: white;
  padding: 40px;
  border-radius: 12px;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  animation: aparecer 0.5s ease;
}

.oculto {
  display: none;
}

@keyframes aparecer {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#btn-reiniciar {
  margin-top: 20px;
  padding: 10px 20px;
  font-size: 18px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#btn-reiniciar:hover {
  background-color:#388e3c;
}


.icon.fa-chevron-down {
  display: inline-block;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px); 
  }
}

			#videoFondo {
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				object-fit: cover;
				z-index: -1;
			}

			#imagenFondo {
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				object-fit: cover;
				opacity: 0;
				transition: opacity 2s ease-in;
				z-index: -1; 
			}

			#imagenFondo.visible {
				opacity: 1;
			}

 .starwars {
  position: relative;
  width: 900px;
  height: 610px;
  overflow: hidden;
  background: black;
  perspective: 50px;
  border: 2px solid #444;
  border-radius: 12px;
}

.starwars::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("https://www.transparenttextures.com/patterns/stardust.png");
  background-size: cover;
  z-index: 0;
}

.starwars .crawl {
  position: absolute;
  bottom: -10%;
  width: 80%;
  color: #4afe86;
  font-family: 'Arial Black', sans-serif;
  text-align: center;
  transform-origin: center;
  animation: fadeIn 2s ease-in forwards, crawl 15s ease-in-out forwards;
  z-index: 1;
  opacity: 0;
}

.starwars .crawl h1,
.starwars .crawl h2 {
  text-align: center;
  margin: 0;
}

.starwars .crawl p {
  text-align: justify;
  font-size: 80%;
  line-height: 1.4em;
  margin: 1em;
}

/* Animación de aparición */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Animación de desplazamiento */
@keyframes crawl {
  0% {
    bottom: -100%;
  }
  80% {
    bottom: 0%;
  }
  100% {
    bottom: 0%;
  }
}



.crawl-img {
  display: block;
  margin: 0 auto 20px auto;
  width: 230px; 
  height: auto;
}



.game-container {
  background: rgba(0, 0, 0, 0.4);
  padding: 30px;
  border-radius: 15px;
  max-width: 550px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
  margin: 0 auto;
  overflow: hidden; 
  word-wrap: break-word; 
  overflow-wrap: break-word; 
  hyphens: auto; 
}

#scenario {
  font-size: 18px;
  color: white;
  margin-bottom: 20px;
  line-height: 1.5;
  text-align: justify;
  white-space: normal; 
  word-break: break-word;
}

/* Contenedor */
#options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

#options button {
  font-size: 16px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #0ba325;
  color: white;
  cursor: pointer;

  width: 100%;
  text-align: left;

 
  white-space: normal;         
  word-break: break-word;     
  overflow-wrap: break-word;    
  line-height: 1.4;

  height: auto;                 
  min-height: 45px;             

  text-transform: none;         
}

@media (max-width: 480px) {
  #options button {
    font-size: 14px;
    padding: 12px;
  }
}

#options button:hover {
  box-shadow: 0 0 12px rgb(255, 255, 255);
}



.menu-actividades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.card-actividad {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  height: 90px;
  overflow: hidden;
  transition: height 0.4s ease, box-shadow 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-actividad h3 {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}

.card-actividad p {
  opacity: 0;
  margin-top: 10px;
  color: #f5f5f5;
  line-height: 1.4;
  transition: opacity 0.4s ease;
}

.card-actividad:hover {
  height: 200px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

.card-actividad:hover p {
  opacity: 1;
}

@media (hover: none) {
  .card-actividad {
    height: auto;
  }

  .card-actividad p {
    opacity: 1;
  }
}

.card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: block !important;
}


.btn-cerrar {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: #ff4d4d00;
    color: white;
    font-size: 28px;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 9999;
}

.btn-cerrar:hover {
    background: #008100;
    transform: scale(1.1);
}