/* === Variables Globales (único :root) === */
:root {
  --color-principal: #ff7043;
  --color-secundario: #ffd54f;
  --color-fondo: #fff3e0;
  --color-texto: #333;

  --color-suma: #ba68c8;
  --color-resta: #aed581;
  --color-multiplicacion: #4fc3f7;
  --color-division: #fff176;

  /* colores para operaciones avanzadas (antiguas) */
  --color-factorial: #ffb74d;
  --color-fracciones: #81c784;
  --color-numeros-primos: #64b5f6;
  --color-porcentajes: #ff8a65;
  --color-potencias: #ce93d8;

  /* colores para salas nuevas */
  --color-tablas: #f06292;
  --color-mcm-mcd: #00bcd4;
  --color-raiz-cuadrada: #26a69a;
  --color-geometria: #7986cb;
  --color-ecuaciones: #5c6bc0;
  --color-medidas: #8d6e63;

  /* colores Mundo 1 — Salas nuevas Jul 2026 */
  --color-decimales: #ff6b9d;
  --color-negativos: #546e7a;
  --color-estadistica: #43a047;
  --color-probabilidad: #fb8c00;
  --color-secuencias: #7e57c2;


  /* colores nuevos para modos de salas */
  --color-clasico: #4fc3f7;
  --color-opciones: #66bb6a;
  --color-visual: #ffca28;
  --color-reto: #ab47bc;
  --color-completar: #ef5350;
  --color-enunciado: #26c6da;

  --color-error: #e57373;
  --color-exito: #81c784;

  --border-radius: 20px;
  --fuente: "Fredoka", sans-serif;
}

/* === Reset Básico === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--fuente);
  background-color: var(--color-fondo);
  color: var(--color-texto);
  text-align: center;
  padding-bottom: 3rem;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === MAIN FIJO A 960PX (sin cambios por pantalla) === */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  flex: 1;
}

h1.titulo {
  font-size: 3rem;
  color: var(--color-principal);
  margin: 1rem 0;
}

h2.slogan {
  font-size: 1.8rem; /* ← MÁS GRANDE */
  color: #333; /* ← GRIS OSCURO (más visible) */
  font-weight: 600; /* ← MÁS GRUESO */
  margin-bottom: 1.5rem;
  text-align: center;
  background: none;
  box-shadow: none;
  text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8); /* ← Sombra suave */
}
/* === Logo animado (video MP4) === */
.logo-hero {
  position: absolute;
  top: 1rem;
  left: 1.5rem;
  width: 100px;
  z-index: 10;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: white;
  padding: 0.4rem;
  border: 2px solid #ffd54f;
}

.logo-hero video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* === HERO FIJO A 960PX (sin cambios) === */
#hero {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 2rem auto;
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: #ffe0b2;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
}

.hero-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === Banners (900x150) === */
.banner-placeholder,
.banner-img {
  width: 100%;
  max-width: 900px;
  height: 150px;
  background-color: #eee;
  border: 2px dashed #ccc;
  border-radius: var(--border-radius);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  color: #999;
  margin: 1rem auto;
}

/* === Banners reales csidelvalle.com === */
.banner {
  margin: 1.5rem auto;
  max-width: 900px;
  display: block;
  text-align: center;
}

.banner img {
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: block;
  margin: 0 auto;
}


/* === Botones de operaciones: SIEMPRE EN COLUMNA === */
.operaciones,
.modo-selector {
  display: flex;
  flex-direction: column; /* ← SIEMPRE uno arriba del otro */
  align-items: center;
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.game-btn {
  color: white;
  padding: 1.2rem 2.5rem;
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform 0.3s;
  max-width: 500px;
  width: 100%;
  font-weight: 600;
}

.game-btn:hover {
  transform: scale(1.05);
}

/* Colores por operación */
#btn-suma,
[data-modo="suma"] {
  background-color: var(--color-suma) !important;
}

#btn-resta,
[data-modo="resta"] {
  background-color: var(--color-resta) !important;
}

#btn-multiplica,
[data-modo="multiplicacion"] {
  background-color: var(--color-multiplicacion) !important;
}

#btn-divide,
[data-modo="division"] {
  background-color: var(--color-division) !important;
  color: #333 !important;
}

/* Colores para nuevas operaciones */
#btn-factorial,
[data-modo="factorial"] {
  background-color: var(--color-factorial) !important;
}

#btn-fracciones,
[data-modo="fracciones"] {
  background-color: var(--color-fracciones) !important;
}

#btn-numeros-primos,
[data-modo="numeros-primos"] {
  background-color: var(--color-numeros-primos) !important;
}

#btn-porcentajes,
[data-modo="porcentajes"] {
  background-color: var(--color-porcentajes) !important;
}

#btn-potencias,
[data-modo="potencias"] {
  background-color: var(--color-potencias) !important;
}

/* Colores salas nuevas */
#btn-tablas { background-color: var(--color-tablas) !important; }
#btn-mcm-mcd { background-color: var(--color-mcm-mcd) !important; }
#btn-raiz-cuadrada { background-color: var(--color-raiz-cuadrada) !important; }
#btn-geometria { background-color: var(--color-geometria) !important; }
#btn-ecuaciones { background-color: var(--color-ecuaciones) !important; }
#btn-medidas { background-color: var(--color-medidas) !important; }

/* Botones de modos de sala */
.btn-modo {
  color: #000;
  font-weight: 600;
  border: 2px solid transparent;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn-modo[data-modo="clasico"] {
  background-color: var(--color-clasico);
}
.btn-modo[data-modo="opciones"] {
  background-color: var(--color-opciones);
}
.btn-modo[data-modo="visual"] {
  background-color: var(--color-visual);
}
.btn-modo[data-modo="desafio"] {
  background-color: var(--color-reto);
}
.btn-modo[data-modo="completar"] {
  background-color: var(--color-completar);
}
.btn-modo[data-modo="palabras"] {
  background-color: var(--color-enunciado);
}

.btn-modo:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* === Zona de juego y mapa === */
.zona-juego,
.mapa-zona {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem;
  border-radius: var(--border-radius);
  background-color: #ffffffcc;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.12);
  text-align: center;
}

/* Etiquetas de categoría en el mapa */
.mapa-categoria {
  font-size: 1.1rem;
  font-weight: 600;
  color: #888;
  margin: 1.8rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Texto de saludo en páginas */
.saludo-texto {
  font-size: 1.3rem;
  color: #555;
  margin: 1rem auto;
  max-width: 600px;
}

/* Sección del botón volver al inicio */
.accion-volver {
  margin: 2rem auto;
}

/* Botón de inicio en el mapa */
#btn-inicio {
  background-color: var(--color-principal);
  font-size: 1.4rem;
  padding: 1rem 2.5rem;
}

/* Botones de navegación en salas */
.btn-mapa {
  background-color: #607d8b;
  font-size: 1.4rem;
  padding: 1rem 2.5rem;
}

.btn-inicio-sala {
  background-color: var(--color-principal);
  font-size: 1.4rem;
  padding: 1rem 2.5rem;
}

.modo-selector {
  background-color: #f9f9f9;
  border-radius: var(--border-radius);
  padding: 1.8rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* === Cuadro de juego (juego rápido y salas) === */
#game-area,
#area-juego {
  margin: 2.5rem auto;
  padding: 2.5rem;
  max-width: 850px;
  width: 100%;
  text-align: center;
  background-color: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
}

.pregunta {
  font-size: clamp(2.2rem, 6vw, 4rem); /* ← MÁS GRANDE */
  color: var(--color-principal);
  margin-bottom: 1.8rem;
  font-weight: 700; /* ← MÁS GRUESO */
  line-height: 1.3;
}

/* === Modo visual === */
#visual-area {
  margin: 1.5rem auto;
  min-height: 120px;
  padding: 1.5rem;
  background-color: #f0f0f0;
  border: 2px dashed #ccc;
  border-radius: var(--border-radius);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#visual-area .bloque {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-block;
  background-color: var(--color-suma);
}

#visual-area .palito {
  width: 14px;
  height: 48px;
  border-radius: 6px;
  display: inline-block;
  background-color: var(--color-resta);
}

#visual-area .grupo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#visual-area .bolita {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-block;
  margin: 0 4px;
  background-color: var(--color-division);
}

/* === Formularios / inputs === */
#respuesta,
#resp {
  padding: 1.2rem 1.6rem;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  border: 2px solid #ccc;
  border-radius: var(--border-radius);
  width: 85%;
  max-width: 420px;
  margin: 0.8rem auto;
  display: block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* === Botones en área de juego === */
#area-juego button {
  background-color: var(--color-principal);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 1.3rem 1.8rem;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  font-weight: 700;
  margin: 0.6rem auto;
  cursor: pointer;
  min-width: 90px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 14px rgba(255, 112, 67, 0.2);
  transition: all 0.25s ease;
  width: 85%;
  max-width: 420px;
}

#area-juego button:hover {
  background-color: #e65100;
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(255, 112, 67, 0.28);
}

/* === Modo Opciones === */
#area-juego .opts,
#area-juego > div:not(.pregunta):not(#feedback):not(#visual-area):not(#timer) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

#area-juego .opts button,
#area-juego > div button {
  width: auto;
  padding: 1rem 1.2rem;
  font-size: clamp(1.4rem, 4.8vw, 2rem);
  min-width: 80px;
  min-height: 80px;
  margin: 0;
}

/* === Feedback === */
#feedback {
  margin-top: 1.5rem;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  min-height: 2.5rem;
  transition: all 0.3s ease;
  font-weight: bold;
  line-height: 1.5;
}

.correcto {
  color: var(--color-exito);
}
.incorrecto {
  color: var(--color-error);
}

.shake {
  animation: shake 0.4s;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-10px);
  }
  40%,
  80% {
    transform: translateX(10px);
  }
}

/* === YouTube === */
.youtube-section {
  max-width: 520px;
  margin: 2.5rem auto;
  display: flex;
  justify-content: center;
}

.youtube-video {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
}

/* === Decoraciones Laterales - AJUSTADAS === */
.decoracion-izquierda,
.decoracion-derecha {
  position: fixed;
  top: 50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.95;
  transform: translateY(-50%);
  border: 4px solid #ffd54f;
  border-radius: var(--border-radius); /* ← BORDES REDONDEADOS IGUAL AL SITIO */
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 180px;
  height: 320px;
}

/* Posición segura */
.decoracion-izquierda {
  left: calc((100vw - 960px) / 2 - 200px);
}

.decoracion-derecha {
  right: calc((100vw - 960px) / 2 - 200px);
}

/* Videos llenan contenedor */
.decoracion-izquierda video,
.decoracion-derecha video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.flotando {
  animation: flotar 3.5s ease-in-out infinite;
}
@keyframes flotar {
  0%,
  100% {
    transform: translateY(-50%) translateY(0);
  }
  50% {
    transform: translateY(-50%) translateY(-12px);
  }
}

/* Escalado por pantalla */
@media (min-width: 1025px) and (max-width: 1440px) {
  .decoracion-izquierda,
  .decoracion-derecha {
    width: 190px;
    height: 338px;
  }
  .decoracion-izquierda {
    left: calc((100vw - 960px) / 2 - 210px);
  }
  .decoracion-derecha {
    right: calc((100vw - 960px) / 2 - 210px);
  }
}

@media (min-width: 1441px) and (max-width: 1920px) {
  .decoracion-izquierda,
  .decoracion-derecha {
    width: 220px;
    height: 391px;
  }
  .decoracion-izquierda {
    left: calc((100vw - 960px) / 2 - 240px);
  }
  .decoracion-derecha {
    right: calc((100vw - 960px) / 2 - 240px);
  }
}

@media (min-width: 1921px) {
  .decoracion-izquierda,
  .decoracion-derecha {
    width: 260px;
    height: 462px;
  }
  .decoracion-izquierda {
    left: calc((100vw - 960px) / 2 - 280px);
  }
  .decoracion-derecha {
    right: calc((100vw - 960px) / 2 - 280px);
  }
}

/* Ocultar en tablet y móvil */
@media (max-width: 1024px) {
  .decoracion-izquierda,
  .decoracion-derecha {
    display: none !important;
  }
}

/* === Botón Volver arriba === */
#volver-arriba {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--color-principal);
  color: white;
  border: none;
  border-radius: 50%;
  padding: 0.9rem 1.1rem;
  font-size: 1.3rem;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.3s;
  z-index: 99;
}
#volver-arriba:hover {
  background-color: #e64a19;
}

/* === Páginas legales === */
.legal-container {
  display: flex;
  justify-content: center;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

.legal-box {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 2.5rem;
  max-width: 750px;
  width: 100%;
  line-height: 1.7;
  text-align: justify;
  font-size: 1.15rem;
  color: #333;
  border: 1px solid #eee;
}

.legal-box h2 {
  margin: 1.6rem 0 1.1rem 0;
  color: var(--color-principal);
  font-size: 1.45rem;
}

.legal-box h1 {
  color: var(--color-principal);
}

/* === Chatbot educativo === */
#chatbot-container {
  max-width: 520px;
  margin: 2.5rem auto;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  text-align: left;
  display: block;
  border: 2px solid #ffd54f;
}

.chatbot-header {
  background-color: var(--color-principal);
  color: white;
  padding: 0.9rem 1.1rem;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header .chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.chatbot-body {
  padding: 1.5rem;
  font-size: 1.1rem;
  min-height: 180px;
  background-color: #fff;
  line-height: 1.6;
  color: #333;
}

/* Botón dentro del chatbot */
#chatbot-container button {
  background-color: var(--color-principal);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 1.1rem 1.6rem;
  font-size: clamp(1.3rem, 4.5vw, 1.8rem);
  font-weight: 700;
  margin: 0.6rem 0;
  cursor: pointer;
  min-width: 80px;
  min-height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 112, 67, 0.18);
  transition: all 0.25s ease;
  width: auto;
}

#chatbot-container button:hover {
  background-color: #e65100;
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(255, 112, 67, 0.25);
}

/* Ocultar botón de cerrar en index.html */
body > main + section#chatbot-section .chatbot-close,
body > main ~ #chatbot-section .chatbot-close {
  display: none !important;
}

.chatbot-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 0.6rem;
  margin-left: auto;
  display: block;
  text-align: right;
  width: fit-content;
  font-weight: bold;
}

.chatbot-close:hover {
  color: #333;
}

/* === Cuadro "Por y para Akili Indali" === */
.descripcion-personalizada {
  max-width: 900px;
  margin: 2.5rem auto;
  padding: 1.8rem 2.2rem;
  background-color: #fffefb;
  border-radius: var(--border-radius);
  box-shadow: 0 6px 14px rgba(255, 112, 67, 0.08);
  text-align: justify;
  border-top: 3px solid #ffd54f;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.descripcion-personalizada h3 {
  color: var(--color-principal);
  margin-bottom: 0.9rem;
  font-size: 1.45rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.descripcion-personalizada h3::before {
  content: "✨";
  font-size: 1.3rem;
}

.descripcion-personalizada p {
  color: #555;
  line-height: 1.65;
  font-size: 1.18rem;
}

/* === Footer === */
footer {
  background-color: var(--color-principal);
  color: #fffde7;
  padding: 1.1rem;
  font-size: 0.85rem;
  text-align: center;
  margin-top: auto;
  border-top: 2px solid #ff8a65;
}

footer a {
  color: #fff8e1;
  text-decoration: none;
  margin: 0 0.6rem;
}
footer a:hover {
  text-decoration: underline;
}

/* === RESPONSIVE ADICIONAL === */

@media (max-width: 480px) {
  .logo-hero {
    width: 70px;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.2rem;
  }

  h1.titulo {
    font-size: 2.4rem;
  }

  .game-btn {
    padding: 1rem 1.8rem;
    font-size: 1.25rem;
  }

  #area-juego,
  .zona-juego,
  .mapa-zona {
    padding: 1.8rem 1rem;
  }

  .pregunta {
    font-size: clamp(1.5rem, 6vw, 2.6rem);
  }

  #chatbot-container {
    margin: 1.8rem auto;
    max-width: 95%;
  }
}
/* ========================================
   CORRECCIONES RESPONSIVE - NO TOCAR ARRIBA
   ======================================== */

/* === TABLETS (768px - 1024px) === */
@media (max-width: 1024px) {
  main {
    max-width: 100%;
    padding: 1rem 1.5rem;
  }

  #hero {
    max-width: 100%;
    margin: 1.5rem auto;
  }

  .banner-placeholder,
  .banner-img,
  .banner img {
    max-width: 100%;
    height: auto;
  }
}

/* === MÓVILES GRANDES (481px - 767px) === */
@media (max-width: 767px) {
  main {
    max-width: 100%;
    padding: 1rem;
  }

  #hero {
    max-width: 100%;
    margin: 1rem auto;
  }

  .logo-hero {
    width: 80px;
    top: 0.8rem;
    left: 1rem;
  }

  h1.titulo {
    font-size: 2.2rem;
  }

  h2.slogan {
    font-size: 1.3rem;
  }

  .game-btn {
    padding: 1.1rem 2rem;
    font-size: 1.3rem;
    max-width: 100%;
  }

  #area-juego,
  #game-area,
  .zona-juego,
  .mapa-zona {
    padding: 1.5rem 1rem;
    max-width: 100%;
  }

  .pregunta {
    font-size: 2rem;
  }

  #respuesta,
  #resp {
    width: 95%;
    font-size: 1.6rem;
  }

  .banner-placeholder,
  .banner-img,
  .banner img {
    max-width: 100%;
    height: auto;
  }

  footer {
    font-size: 0.8rem;
    padding: 1rem 0.5rem;
  }

  .legal-box {
    padding: 1.8rem 1.2rem;
    font-size: 1rem;
  }

  #chatbot-container {
    max-width: 95%;
    margin: 1.5rem auto;
  }

  .descripcion-personalizada {
    padding: 1.5rem 1.2rem;
    font-size: 1.05rem;
  }
}

/* === MÓVILES PEQUEÑOS (320px - 480px) === */
@media (max-width: 480px) {
  body {
    padding-bottom: 2rem;
  }

  main {
    max-width: 100%;
    padding: 0.8rem;
  }

  #hero {
    max-width: 100%;
    margin: 0.8rem auto;
    border-radius: 15px;
  }

  .logo-hero {
    width: 70px;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.2rem;
  }

  h1.titulo {
    font-size: 2rem;
    margin: 0.8rem 0;
  }

  h2.slogan {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .game-btn {
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    max-width: 100%;
  }

  .operaciones,
  .modo-selector {
    gap: 1rem;
    margin: 1.5rem 0;
  }

  #area-juego,
  #game-area,
  .zona-juego,
  .mapa-zona {
    padding: 1.2rem 0.8rem;
    margin: 1.5rem auto;
    max-width: 100%;
  }

  .pregunta {
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
  }

  #respuesta,
  #resp {
    width: 95%;
    font-size: 1.5rem;
    padding: 1rem 1.2rem;
  }

  #area-juego button {
    padding: 1rem 1.3rem;
    font-size: 1.6rem;
    min-height: 70px;
    width: 95%;
  }

  #area-juego .opts button,
  #area-juego > div button {
    padding: 0.9rem 1rem;
    font-size: 1.5rem;
    min-width: 70px;
    min-height: 70px;
  }

  #feedback {
    font-size: 1.2rem;
  }

  .banner-placeholder,
  .banner-img,
  .banner,
  .banner img {
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
  }

  footer {
    font-size: 0.75rem;
    padding: 0.9rem 0.3rem;
  }

  footer a {
    margin: 0 0.3rem;
    display: inline-block;
  }

  .legal-box {
    padding: 1.5rem 1rem;
    font-size: 0.95rem;
  }

  .legal-box h1 {
    font-size: 1.8rem;
  }

  .legal-box h2 {
    font-size: 1.3rem;
  }

  #chatbot-container {
    max-width: 95%;
    margin: 1.2rem auto;
  }

  .chatbot-header {
    font-size: 1rem;
    padding: 0.8rem;
  }

  .chatbot-body {
    padding: 1.2rem;
    font-size: 1rem;
    min-height: 150px;
  }

  #chatbot-container button {
    padding: 0.9rem 1.3rem;
    font-size: 1.4rem;
    min-height: 60px;
  }

  .descripcion-personalizada {
    padding: 1.2rem 1rem;
  }

  .descripcion-personalizada h3 {
    font-size: 1.25rem;
  }

  .descripcion-personalizada p {
    font-size: 1rem;
    line-height: 1.55;
  }

  .youtube-section {
    max-width: 95%;
    margin: 1.5rem auto;
  }

  #visual-area {
    padding: 1rem;
    min-height: 100px;
    gap: 8px;
  }

  #visual-area .bloque {
    width: 35px;
    height: 35px;
  }

  #visual-area .palito {
    width: 12px;
    height: 40px;
  }

  #visual-area .bolita {
    width: 28px;
    height: 28px;
  }

  #volver-arriba {
    bottom: 15px;
    right: 15px;
    padding: 0.8rem 1rem;
    font-size: 1.2rem;
  }
}

/* === FIX: Evitar overflow horizontal en móviles === */
@media (max-width: 767px) {
  body {
    overflow-x: hidden;
  }

  * {
    max-width: 100%;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}

/* ========================================= */
/* SISTEMA DE RACHAS (STREAKS)               */
/* ========================================= */
.racha-display {
    display: none;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    color: #E65100;
    background: #FFF3E0;
    border: 3px solid #FF9800;
    border-radius: 20px;
    padding: 10px 25px;
    margin: 15px auto;
    width: fit-content;
    box-shadow: 0 4px 10px rgba(255, 152, 0, 0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s ease;
}

.racha-pop {
    animation: popRacha 0.3s ease-in-out;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes popRacha {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: #D84315; }
    100% { transform: scale(1); }
}

/* ========================================= */
/* SISTEMA DE ESTRELLAS DE PROGRESO          */
/* ========================================= */
.estrellas-container {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 5px;
    width: 100%;
}

.estrella {
    width: 20px;
    height: 20px;
    background-color: #ccc; /* Gris/Hueco por defecto */
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    transition: all 0.4s ease;
}

.estrella.llena {
    background-color: #FFD700; /* Dorado */
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
    transform: scale(1.1);
}

/* ========================================= */
/* BARRA DE PROGRESO DE ENERGIA              */
/* ========================================= */
.barra-progreso-container {
    width: 80%;
    height: 18px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 8px auto 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid white;
}

.barra-progreso-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF9800, #4CAF50);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.5s;
}

.barra-progreso-fill.full {
    background: linear-gradient(90deg, #00C853, #64DD17);
    box-shadow: 0 0 10px rgba(0,200,83,0.8);
}

.barra-progreso-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
}
/* Ocultar spinners de input number */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

/* ═══════════════════════════════════════════════════════
   ACCESIBILIDAD & AEO — Contenido solo para crawlers/screen-readers
   Basado en el patrón Bootstrap / WCAG .visually-hidden
   ═══════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════
   UTILIDADES COMPARTIDAS — Clases que reemplazan estilos inline
   ═══════════════════════════════════════════════════════ */

/* Enunciado/pregunta de sala */
.sala-enunciado {
  font-size: 1.3rem;
  color: #555;
  margin: 1rem auto;
  max-width: 600px;
  text-align: center;
}

/* Contenedor centrado con margen vertical */
.sala-center {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

/* Botón de pista/ayuda de sala */
.sala-pista-btn {
  background: #0039cb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1rem;
  margin-top: 0.5rem;
  transition: background 0.2s;
}
.sala-pista-btn:hover {
  background: #1a237e;
}

/* Botón "🍎 Ayudas y Ejemplos" — Explorador */
#btn-ayuda-inyectado {
  background: linear-gradient(135deg, #ff7043 0%, #ff9800 60%, #ffd54f 100%);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(255, 112, 67, 0.55), 0 1px 4px rgba(0,0,0,0.15);
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.25s, box-shadow 0.25s, filter 0.25s;
}
#btn-ayuda-inyectado:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(255, 112, 67, 0.7), 0 2px 6px rgba(0,0,0,0.18);
  filter: brightness(1.08);
}

/* Botones de mapa con color personalizado (Aventurero — salas nuevas) */
.btn-decimales   { background-color: #ff6b9d !important; }
.btn-negativos   { background-color: #546e7a !important; }
.btn-estadistica { background-color: #43a047 !important; }
.btn-probabilidad { background-color: #fb8c00 !important; }
.btn-secuencias  { background-color: #7e57c2 !important; }

/* ═══ ESTILOS PORTAL index.html ═══ */
/* Título del portal */
    .portal-titulo {
      font-size: clamp(1.8rem, 4vw, 2.6rem);
      color: var(--color-principal);
      font-weight: 600;
      margin: 1.5rem 0 0.4rem;
    }
    .portal-subtitulo {
      font-size: 1.1rem;
      color: #666;
      margin-bottom: 2rem;
    }

    /* Grid de 3 mundos */
    .mundos-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 1.5rem;
      max-width: 900px;
      margin: 0 auto 2.5rem;
    }

    /* Tarjeta de mundo */
    .mundo-card {
      border-radius: 20px;
      padding: 2rem 1.5rem;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.8rem;
      cursor: pointer;
      text-decoration: none;
      transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
      border: 3px solid rgba(255,255,255,0.3);
      position: relative;
      overflow: hidden;
    }
    .mundo-card:hover {
      transform: translateY(-10px) scale(1.03);
    }

    /* Brillo interno */
    .mundo-card::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 45%;
      background: linear-gradient(to bottom, rgba(255,255,255,0.18), transparent);
      border-radius: 18px 18px 0 0;
      pointer-events: none;
    }

    /* Explorador — Naranja/crema del sitio original */
    .card-explorador {
      background: linear-gradient(145deg, #ff7043, #e64a19);
      box-shadow: 0 6px 30px rgba(255,112,67,0.4);
      color: #fff;
    }
    .card-explorador:hover { box-shadow: 0 14px 45px rgba(255,112,67,0.6); }

    /* Aventurero — Azul oscuro */
    .card-aventurero {
      background: linear-gradient(145deg, #0f3460, #00b4d8);
      box-shadow: 0 6px 30px rgba(0,180,216,0.35);
      color: #fff;
    }
    .card-aventurero:hover { box-shadow: 0 14px 45px rgba(0,180,216,0.55); }

    /* Maestro — Negro/púrpura/dorado */
    .card-maestro {
      background: linear-gradient(145deg, #1a0030, #7209b7);
      box-shadow: 0 6px 30px rgba(114,9,183,0.4);
      color: #fff;
      border-color: rgba(255,215,0,0.3);
    }
    .card-maestro:hover { box-shadow: 0 14px 45px rgba(255,215,0,0.3), 0 0 0 1px rgba(255,215,0,0.2); }

    /* Contenido de tarjeta */
    .mundo-emoji {
      font-size: 3rem;
      animation: pulso 3s ease-in-out infinite;
      filter: drop-shadow(0 0 10px rgba(255,255,255,0.4));
    }
    @keyframes pulso {
      0%, 100% { transform: scale(1); }
      50%       { transform: scale(1.1); }
    }
    .mundo-nombre {
      font-size: 1.7rem;
      font-weight: 600;
      color: #fff;
      letter-spacing: 1px;
    }
    .mundo-edad {
      font-size: 0.85rem;
      background: rgba(0,0,0,0.2);
      padding: 0.25rem 0.8rem;
      border-radius: 20px;
      color: rgba(255,255,255,0.9);
    }
    .mundo-frase {
      font-size: 0.95rem;
      color: rgba(255,255,255,0.88);
      font-style: italic;
      line-height: 1.4;
    }
    .mundo-salas {
      font-size: 0.78rem;
      color: rgba(255,255,255,0.7);
      line-height: 1.7;
      text-align: center;
    }
    .mundo-btn {
      margin-top: 0.5rem;
      padding: 0.65rem 1.8rem;
      background: rgba(255,255,255,0.18);
      color: #fff;
      font-family: var(--fuente);
      font-size: 1rem;
      font-weight: 600;
      border: 2px solid rgba(255,255,255,0.5);
      border-radius: 50px;
      letter-spacing: 1px;
      transition: background 0.2s, border-color 0.2s;
      display: inline-block;
    }
    .mundo-card:hover .mundo-btn {
      background: rgba(255,255,255,0.32);
      border-color: rgba(255,255,255,1);
    }

    /* YouTube */
    .youtube-section {
      max-width: 520px;
      margin: 1rem auto 2rem;
    }
    .youtube-link {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      background: #fff;
      border: 2px solid #ccc;
      color: #333;
      font-family: var(--fuente);
      font-size: 0.95rem;
      padding: 0.6rem 1.4rem;
      border-radius: 30px;
      text-decoration: none;
      transition: all 0.2s;
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    .youtube-link:hover {
      background: #ff0000;
      border-color: #ff0000;
      color: #fff;
      transform: scale(1.04);
    }
    .youtube-link svg { width: 18px; height: 18px; fill: currentColor; }

    @media (max-width: 640px) {
      .mundos-grid { grid-template-columns: 1fr; }
    }

/* ═══════════════════════════════════════════════════════
   MICRO-UTILIDADES ADICIONALES (2da pasada)
   ═══════════════════════════════════════════════════════ */

/* Toolbar de botones de sala (Arsenal, Modo Clásico, etc.) */
.sala-toolbar {
  display: flex;
  justify-content: flex-end;
  max-width: 600px;
  margin: 0 auto 1rem;
}

/* Margen inferior pequeño */
.mb-05 { margin-bottom: 0.5rem; }
.mb-15 { margin-bottom: 1.5rem; }

/* Tabla de multiplicar — selector de tabla */
.tabla-selector-wrap {
  margin: 1.5rem auto;
  text-align: center;
}
.tabla-selector-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.5rem;
}
.tabla-buttons-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Colores de acento temático por sala Aventurero */
.acento-algebra       { color: #00c853; }
.acento-angulos       { color: #ab47bc; }
.acento-ecuaciones    { color: #3f51b5; }
.acento-estadistica   { color: #43a047; }
.acento-factorial     { color: #e91e63; }
.acento-funciones     { color: #06d6a0; }
.acento-mcm           { color: #26c6da; }
.acento-negativos     { color: #546e7a; }
.acento-potencias     { color: #7c4dff; }
.acento-probabilidad  { color: #fb8c00; }
.acento-raiz          { color: #00bcd4; }
.acento-razones       { color: #ffca28; }
.acento-regla3        { color: #f44336; }

/* Racha highlight Aventurero */
.racha-highlight {
  color: #ffca28;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* ═══════════════════════════════════════════════════════
   CHATBOT DIECITO — Clases de componentes dinámicos
   (Reemplazan todos los estilos inline de los chatbot-matematico.js)
   ═══════════════════════════════════════════════════════ */

/* Input de texto del chatbot */
.chatbot-input-field {
  margin-top: 0.5rem;
  width: calc(100% - 2rem);
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-left: 1rem;
  margin-bottom: 1rem;
  box-sizing: border-box;
  font-size: 0.95rem;
  font-family: inherit;
}
.chatbot-input-field:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.15);
}

/* Botón de cierre del chatbot */
.chatbot-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  transition: opacity 0.2s;
}
.chatbot-close-btn:hover {
  opacity: 0.7;
}

/* Burbuja de eco (pregunta del usuario) */
p.chatbot-eco {
  background: rgba(0, 0, 0, 0.06);
  border-left: 3px solid #7c4dff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-style: italic;
  margin: 0.3rem 0;
}
