:root {
  --primary-color: #5b6abf;
  --secondary-color: #9c64a6;
  --accent-color: #6a5acd;
  --light-color: #e6e6fa;
  --success-color: #4caf50;
  --error-color: #f44336;
  --text-color: #2c3e50;
  --white: #ffffff;
}

/* Línea blanca para separar el header del contenido */
.content-separator {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: white;
  z-index: 999;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 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);
  transition: all 0.3s ease;
  height: 60px;
}

.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.15);
  transform: translateY(-2px);
}

.header .navigation ul li ul {
  position: absolute;
  right: 0;
  width: 220px;
  background: rgba(255, 255, 255, 0.95);
  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(--primary-color);
}

.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;
  }

  .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;
  }

  #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, #e0f7fa, #d1c4e9, #b3e5fc);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-color);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

/* Contenedor principal */
.main-container {
  padding-top: 100px;
  max-width: 1000px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* 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);
  }
}

/* Título principal */
h1 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 30px;
  margin-top: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 2.5rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 20px 0;
}

.instructions {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
  border-left: 5px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.instructions h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.4rem;
}

.instructions p {
  margin: 8px 0;
  line-height: 1.6;
}

.activity-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 30px;
}

.column {
  width: 48%;
  background-color: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.column h3 {
  color: var(--primary-color);
  text-align: center;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.3rem;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

.item {
  padding: 14px 18px;
  margin: 10px 0;
  cursor: pointer;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.item.selected {
  background-color: #e8f4f8;
  border-color: #3498db;
  font-weight: bold;
  animation: pulse 1.5s infinite;
}

/* Colores diferentes para cada par correcto */
.item.matched-1 {
  background-color: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

.item.matched-2 {
  background-color: #e3f2fd;
  border-color: #2196f3;
  color: #1565c0;
}

.item.matched-3 {
  background-color: #fff3e0;
  border-color: #ff9800;
  color: #ef6c00;
}

.item.matched-4 {
  background-color: #f3e5f5;
  border-color: #9c27b0;
  color: #7b1fa2;
}

.item.matched-5 {
  background-color: #e0f2f1;
  border-color: #009688;
  color: #00695c;
}

.item.matched-6 {
  background-color: #fff8e1;
  border-color: #ffc107;
  color: #ff8f00;
}

.item.matched-7 {
  background-color: #fce4ec;
  border-color: #f589ad;
  color: #f589ad;
}

.item.matched-8 {
  background-color: #e8eaf6;
  border-color: #3f51b5;
  color: #283593;
}

/* Estilos para respuestas incorrectas */
.item.incorrect-match {
  background-color: #ffebee !important;
  border-color: var(--error-color) !important;
  color: #c62828 !important;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.controls {
  text-align: center;
  margin: 35px 0;
}

.buttons-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

#check-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(91, 106, 191, 0.3);
  min-width: 180px;
}

#check-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(91, 106, 191, 0.4);
}

#reset-btn {
  background: linear-gradient(135deg, #6c757d, #495057);
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
  min-width: 180px;
}

#reset-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(108, 117, 125, 0.4);
  background: linear-gradient(135deg, #5a6268, #3d4348);
}

.results {
  text-align: center;
  margin-top: 40px;
  padding: 30px;
  border-radius: 12px;
  display: none;
  background-color: white;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease;
}

.success {
  background-color: #e8f5e9 !important;
  border: 3px solid #4caf50;
}

.error {
  background-color: #ffebee !important;
  border: 3px solid #f44336;
}

.celebration {
  font-size: 2.5rem;
  color: var(--primary-color);
  font-weight: bold;
  margin: 15px 0;
  animation: pulse 1.5s infinite;
}

.score-display {
  font-size: 1.8rem;
  margin: 20px 0;
  font-weight: bold;
  color: var(--text-color);
}

.progress-bar-container {
  width: 100%;
  height: 35px;
  background-color: #ecf0f1;
  border-radius: 20px;
  margin: 25px 0;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  width: 0%;
  transition: width 0.8s ease;
  text-align: center;
  color: white;
  line-height: 35px;
  font-weight: 600;
  font-size: 1rem;
}

#correct-count {
  font-size: 1.2rem;
  margin: 15px 0;
  color: var(--text-color);
}

#feedback-message {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 20px 0;
  padding: 15px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.8);
}

.match-key {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 20px;
  text-align: left;
}

.match-key-item {
  padding: 8px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 3px 0;
}

@media (max-width: 768px) {
  .main-container {
    padding-top: 90px;
    padding-left: 15px;
    padding-right: 15px;
  }

  h1 {
    font-size: 2rem;
  }

  .activity-container {
    flex-direction: column;
    gap: 20px;
  }

  .column {
    width: 100%;
  }

  .buttons-container {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  #check-btn,
  #reset-btn {
    width: 100%;
    max-width: 300px;
  }

  .match-key {
    grid-template-columns: 1fr;
  }
}
