* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #353346ff 0%, #2a2a3e 50%, #1e1e2e 100%) fixed;
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
  padding: 130px 20px 40px;
}

.top-bar {
  width: 100%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #60a5fa 100%);
  background-size: 200% 200%;
  padding: 25px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  box-shadow: 0 8px 32px rgba(30, 58, 138, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideDown 0.8s ease-out, topBarMove 6s ease-in-out infinite;
  overflow: hidden;
  min-height: 100px;
}

@keyframes slideDown {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes topBarMove {
  0%, 100% { 
    background-position: 0% 50%;
    transform: translateY(0px);
  }
  25% { 
    background-position: 100% 50%;
    transform: translateY(-1px);
  }
  50% { 
    background-position: 0% 100%;
    transform: translateY(0px);
  }
  75% { 
    background-position: 100% 0%;
    transform: translateY(1px);
  }
}

.top-bar h1 {
  font-size: 35px;
  color: #ff8c42;
  font-family: 'Fredoka', sans-serif;
  text-shadow: 0 2px 10px rgba(255, 140, 66, 0.5);
  animation: glowTitle 3s ease-in-out infinite alternate;
  margin: 0;
}

@keyframes glowTitle {
  0% { 
    color: #ff8c42;
    text-shadow: 0 2px 10px rgba(255, 140, 66, 0.5), 0 0 20px rgba(255, 140, 66, 0.3);
  }
  100% { 
    color: #ffab70;
    text-shadow: 0 2px 15px rgba(255, 171, 112, 0.8), 0 0 30px rgba(255, 171, 112, 0.5);
  }
}

.btn-volver-top {
  background: #ff8c42;
  color: white;
  border: none;
  padding: 15px 35px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.2em;
  text-decoration: none;
  font-family: 'Fredoka', sans-serif;
  transition: all 0.3s ease;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
}

.btn-volver-top:hover {
  background: #e67a35;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 140, 66, 0.6);
}

.container { 
  max-width: 1100px; 
  margin: 0 auto; 
}

.page-title { 
  text-align: center; 
  font-size: 2.2em; 
  margin-bottom: 30px; 
  color: #fff;
}

.capitulos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 25px;
  padding: 0;
  margin-top: 30px;
}

.capitulo-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  transition: all 0.4s ease;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}

.capitulo-card:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.capitulo-card:hover .capitulo-numero,
.capitulo-card:hover .capitulo-titulo {
  color: white;
}

.capitulo-numero {
  font-size: 2.5em;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.capitulo-titulo {
  font-size: 1.1em;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.capitulo-estado {
  font-size: 0.85em;
  font-weight: 500;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.1);
}

.capitulo-card.playable {
  background: linear-gradient(135deg, #ff8c42 0%, #ffa062 100%);
  animation: pulse 2s ease-in-out infinite;
}

.capitulo-card.playable .capitulo-numero,
.capitulo-card.playable .capitulo-titulo,
.capitulo-card.playable .capitulo-estado {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4); 
  }
  50% { 
    box-shadow: 0 8px 25px rgba(255, 140, 66, 0.7); 
  }
}

.capitulo-card.completed {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  border: 3px solid #059669;
}

.capitulo-card.completed .capitulo-numero,
.capitulo-card.completed .capitulo-titulo,
.capitulo-card.completed .capitulo-estado {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.capitulo-card.blocked {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.capitulo-card.blocked .capitulo-numero,
.capitulo-card.blocked .capitulo-titulo,
.capitulo-card.blocked .capitulo-estado {
  color: #4b5563;
}

.capitulo-card.blocked:hover {
  transform: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  background: #9ca3af;
}

@media (max-width: 900px) {
  .capitulos-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
  }

  .capitulo-card {
    min-height: 140px;
    padding: 20px;
  }

  .capitulo-numero {
    font-size: 2em;
  }

  .btn-volver-top {
    padding: 12px 25px;
    font-size: 1em;
  }

  .page-title {
    font-size: 1.8em;
  }
}

@media (max-width: 600px) {
  .capitulos-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
  }

  .capitulo-card {
    min-height: 120px;
    padding: 15px;
  }

  .capitulo-numero {
    font-size: 1.8em;
  }

  .capitulo-titulo {
    font-size: 0.95em;
  }

  .top-bar {
    padding: 20px 15px;
    min-height: 90px;
  }

  .top-bar h1 {
    font-size: 28px;
  }
}
