:root {
  --primary-color: #89c4f4;
  --secondary-color: #b7d9f8;
  --accent-color: #ffffff;
  --light-color: #d4e6f9;
  --success-color: #4caf50;
  --error-color: #f44336;
  --text-color: #333333;
  --white: #ffffff;
  --dark-blue: #5d8aa8;
}

/* Estilos del Header mejorado */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 0 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #fff;
  transition: all 0.3s ease;
}

.header:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.logo {
  font-size: 28px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header .navigation ul li {
  float: left;
  position: relative;
}

.header .navigation ul li a {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 22px 20px;
  display: block;
  transition: all 0.3s ease;
}

.header .navigation ul li a:hover {
  background-color: rgba(255, 255, 255, 0.733);
  color: var(--dark-blue);
  transform: translateY(-2px);
}

.header .navigation ul li ul {
  position: absolute;
  right: 0;
  width: 220px;
  background: rgba(255, 255, 255, 0.589);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  display: none;
  overflow: hidden;
}

.header .navigation ul li ul li a {
  color: var(--text-color);
  padding: 12px 20px;
  font-size: 14px;
}

.header .navigation ul li ul li a:hover {
  background-color: var(--light-color);
  color: var(--dark-blue);
}

.header .navigation ul li:hover > ul {
  display: initial;
  animation: fadeIn 0.3s ease-out;
}

#toggle,
.header label {
  display: none;
  cursor: pointer;
}

.menu {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

@media (max-width: 950px) {
  .header label {
    display: initial;
  }

  .header {
    padding: 15px 10%;
  }

  .header .navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    border-radius: 0 0 12px 12px;
  }

  .header .navigation ul li {
    width: 100%;
  }

  .header .navigation ul li a {
    padding: 12px 20px;
    font-size: 18px;
  }

  .header .navigation ul li ul {
    position: relative;
    width: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.1);
  }

  .header .navigation ul li ul li a {
    padding-left: 30px;
    font-size: 16px;
  }

  #toggle:checked ~ .navigation {
    display: block;
    animation: slideDown 0.4s ease-out;
  }
}

/* Estilos del cuerpo y fondo */
body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #d4e6f9, #b7d9f8, #89c4f4);
  margin: 0;
  padding: 0;
  padding-top: 80px;
  min-height: 100vh;
  color: var(--text-color);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

/* Animación de fondo */
@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

@keyframes celebrate {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Contenedor principal */
.contenedor-principal {
  width: 95%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  background-color: rgb(255, 255, 255);
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.contenedor-principal:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.titulo-actividad {
  text-align: center;
  color: var(--dark-blue);
  margin-bottom: 20px;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: clamp(24px, 5vw, 32px);
}

.instrucciones {
  text-align: center;
  margin-bottom: 25px;
  color: var(--text-color);
  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.5;
  padding: 0 10px;
}

/* Sección de información */
.seccion-informacion {
  background-color: var(--light-color);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.seccion-informacion h2 {
  color: var(--dark-blue);
  margin-top: 0;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
}

.ejemplos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .ejemplos {
    grid-template-columns: 1fr;
  }
}

.ejemplo-card {
  background-color: var(--white);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ejemplo-card h3 {
  color: var(--dark-blue);
  margin-top: 0;
}

/* Actividades */
.seccion-actividad {
  margin-bottom: 30px;
}

.actividad-card {
  background-color: var(--light-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.actividad-card h3 {
  color: var(--dark-blue);
  margin-top: 0;
}

.pregunta {
  margin-bottom: 15px;
  padding: 10px;
  background-color: var(--white);
  border-radius: 8px;
}

.opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.opcion {
  background-color: var(--secondary-color);
  border-radius: 6px;
  padding: 8px 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.opcion:hover {
  background-color: var(--primary-color);
}

.opcion.seleccionada {
  background-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--dark-blue);
}

.opcion.correcta {
  background-color: #c8e6c9;
  color: #2e7d32;
}

.opcion.incorrecta {
  background-color: #ffcdd2;
  color: #c62828;
}

/* Actividad de unir frases */
.contenedor-unir-frases {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .contenedor-unir-frases {
    flex-direction: column;
  }
}

.frases-izquierda,
.frases-derecha {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.frase-item {
  background-color: var(--white);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 60px;
  display: flex;
  align-items: center;
  border: 2px solid transparent;
}

.frase-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.frase-item.seleccionada {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-color);
}

.frase-item.emparejada {
  pointer-events: none;
}

.frase-item.correcta {
  border-color: var(--success-color);
  background-color: #e8f5e9;
}

.frase-item.incorrecta {
  border-color: var(--error-color);
  background-color: #ffebee;
}

.numero-frase {
  display: inline-block;
  width: 30px;
  height: 30px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 30px;
  margin-right: 10px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.letra-frase {
  display: inline-block;
  width: 30px;
  height: 30px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  border-radius: 50%;
  text-align: center;
  line-height: 30px;
  margin-right: 10px;
  font-weight: bold;
  transition: all 0.3s ease;
}

/* Colores para los pares emparejados */
.color-par-1 {
  background-color: #e3f2fd !important;
  border-color: #64b5f6 !important;
}
.color-par-1 .numero-frase,
.color-par-1 .letra-frase {
  background-color: #64b5f6 !important;
  color: white !important;
}

.color-par-2 {
  background-color: #f3e5f5 !important;
  border-color: #ba68c8 !important;
}
.color-par-2 .numero-frase,
.color-par-2 .letra-frase {
  background-color: #ba68c8 !important;
  color: white !important;
}

.color-par-3 {
  background-color: #e8f5e8 !important;
  border-color: #66bb6a !important;
}
.color-par-3 .numero-frase,
.color-par-3 .letra-frase {
  background-color: #66bb6a !important;
  color: white !important;
}

.color-par-4 {
  background-color: #fff3e0 !important;
  border-color: #ffb74d !important;
}
.color-par-4 .numero-frase,
.color-par-4 .letra-frase {
  background-color: #ffb74d !important;
  color: white !important;
}

.color-par-5 {
  background-color: #e0f2f1 !important;
  border-color: #4db6ac !important;
}
.color-par-5 .numero-frase,
.color-par-5 .letra-frase {
  background-color: #4db6ac !important;
  color: white !important;
}

.color-par-6 {
  background-color: #fce4ec !important;
  border-color: #f06292 !important;
}
.color-par-6 .numero-frase,
.color-par-6 .letra-frase {
  background-color: #f06292 !important;
  color: white !important;
}

.boton-verificar {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.boton-verificar:hover {
  background-color: var(--dark-blue);
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.boton-verificar:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.boton-reiniciar {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.boton-reiniciar:hover {
  background-color: var(--dark-blue);
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Modal de felicitaciones */
.modal-felicidades {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-felicidades.mostrar {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

.modal-contenido {
  background-color: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  position: relative;
}

.cerrar-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-color);
}

.mensaje-felicidades {
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 600;
  color: var(--dark-blue);
  margin-bottom: 15px;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #f00;
  opacity: 0;
}

/* MEJORAS ESPECÍFICAS PARA MÓVIL */
@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }
}

@media (max-width: 480px) {
  .contenedor-principal {
    width: 98%;
    padding: 15px;
    margin: 10px auto;
  }

  .logo {
    font-size: 20px;
  }

  .titulo-actividad {
    font-size: 22px;
    margin-bottom: 15px;
  }

  .instrucciones {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .opciones {
    flex-direction: column;
  }
}
