@import url('https://fonts.googleapis.com/css2?family=Roboto, sans-serif');

body {
    font-family: 'Roboto', 'Segoe UI', 'Arial', sans-serif;
    background-color: #fff; /* Fondo blanco como en la imagen */
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Cambiar para que ocupe todo el ancho */
    padding: 0; /* Quitar padding para que header/footer ocupen todo */
    margin: 0;
    min-height: 100vh;
}

/* .main-content-with-yachana definido en yachana-styles.css */

header {
    text-align: center;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
}

header p {
    font-size: 1.1rem;
    color: #6c757d;
}

/* ====================================================== */
/* ==           ESTILOS PARA BANNER PROMOCIONAL        == */
/* ====================================================== */

.promo-banner {
    width: 100%;
    max-width: 1200px;
    margin: -1.5rem auto 2rem auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* ====================================================== */
/* ==        OPTIMIZACIÓN MÓVIL (MANTIENE PC INTACTO)  == */
/* ====================================================== */

/* Corregir posición del banner en móviles (compensa cambios PC) */
@media (max-width: 767px) {
    .promo-banner {
        margin: 0.5rem auto 1.5rem auto; /* Posición normal en móvil */
        max-width: 95%; /* Mejor ajuste en móvil */
    }

    /* Optimizaciones adicionales para móviles */
    .main-content-with-yachana {
        padding: 0.5rem;
    }

    /* Títulos de header más pequeños en móvil */
    #main-header h1 {
        font-size: 2rem !important;
        margin: -60px 0 0 0; /* Menos subida que PC */
    }

    /* Simulador grid más compacto en móvil */
    .simulator-grid {
        padding: 0.5rem;
        gap: 1rem;
    }

    /* Botones más pequeños en móvil sin afectar PC */
    .simulator-btn {
        padding: 1rem 1.5rem;
        min-width: auto;
    }
}

/* Optimización para pantallas muy pequeñas */
@media (max-width: 480px) {
    /* Banner aún más compacto */
    .promo-banner {
        margin: 0.2rem auto 1rem auto;
        max-width: 98%;
    }

    /* Títulos aún más pequeños */
    #main-header h1 {
        font-size: 1.8rem !important;
        margin: -50px 0 0 0;
    }

    /* Grid ultra compacto */
    .simulator-grid {
        padding: 0.2rem;
        gap: 0.8rem;
    }
}

.promo-content {
    display: flex;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
}

.promo-image {
    flex-shrink: 0;
}

.promo-image a {
    display: block;
    transition: transform 0.3s ease;
}

.promo-image a:hover {
    transform: scale(1.05);
}

.promo-image img {
    width: 350px;
    height: 250px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: box-shadow 0.3s ease;
}

.promo-image img:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.25);
}

.promo-text {
    flex: 1;
    color: white;
    text-align: center;
}

.promo-text h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.promo-text h3 {
    font-size: 1.2rem;
    margin: 0 0 1rem 0;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
}

.promo-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    opacity: 0.95;
}

.promo-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.promo-features span {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.promo-cta {
    flex-shrink: 0;
}

.cta-button {
    background: #ffffff;
    color: #667eea;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.cta-button:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .promo-content {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .promo-image img {
        width: 250px;
        height: 150px;
    }

    .promo-text h2 {
        font-size: 1.5rem;
    }

    .promo-features {
        justify-content: center;
    }

    .promo-features span {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

.simulator-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
        "ug espol unemi"
        "agraria institutos materias";
    gap: 1.5rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

/* Asignar cada botón a su área específica */
.simulator-grid .simulator-btn:nth-child(1) { grid-area: ug; }
.simulator-grid .simulator-btn:nth-child(2) { grid-area: espol; }
.simulator-grid .simulator-btn:nth-child(3) { grid-area: unemi; }
.simulator-grid .simulator-btn:nth-child(4) { grid-area: agraria; }
.simulator-grid .simulator-btn:nth-child(5) { grid-area: institutos; }
.simulator-grid .simulator-btn:nth-child(6) { grid-area: materias; }

/* Responsivo: en móviles mostrar botones en columna tipo hamburguesa */
@media (max-width: 767px) {
    .simulator-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "ug"
            "espol"
            "unemi"
            "agraria"
            "institutos"
            "materias";
        max-width: 400px;
        padding: 0;
        gap: 0.8rem;
    }
}

.espol-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.simulator-btn {
    min-width: 200px;
}

.simulator-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.simulator-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(220, 53, 69, 0.2);
}

.simulator-btn strong {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.chapter-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 900px;
}

.chapter-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-width: 250px;
}

.chapter-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(220, 53, 69, 0.2);
}

.chapter-btn span {
    font-size: 1.4rem;
    font-weight: bold;
}

.examen-completo-btn {
    background-color: #28a745 !important;
    color: white !important;
}

.examen-completo-btn:hover {
    background-color: #218838 !important;
    box-shadow: 0 8px 15px rgba(40, 167, 69, 0.2);
}

.back-btn {
    margin-top: 2rem;
    padding: 1rem 2rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.back-btn:hover {
    background-color: #0069d9;
}

#activity-container {
    width: 90%;
    max-width: 1100px;
    background-color: transparent;
    box-shadow: none;
    margin-top: 2rem;
    padding: 0;
}

.hidden {
    display: none;
}

/* --- ESTILOS CORREGIDOS PARA EL CUESTIONARIO --- */
.quiz-layout {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    justify-content: center; /* Centra los elementos */
}

.quiz-main {
    background-color: #eef3f9; /* Color de fondo exacto del panel de preguntas */
    padding: 1.5rem 2rem;
    border-radius: 5px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    width: 700px; /* Ancho fijo para centrar */
}

.question-area {
    flex-grow: 1; /* Empuja la navegación hacia abajo */
    margin-left: 300px !important; /* Espacio en blanco en la parte izquierda */
}

.question-header {
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #ddd; /* Línea separadora */
}

.question-header h3 {
    color: #007bff;
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 0 0.25rem 0;
}

.question-status {
    color: #007bff;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

.question-points {
    color: #6c757d;
    font-size: 0.9rem;
}

#question-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.question-image-container {
    margin: 1.5rem 0;
    text-align: center;
}

.question-image-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.options-container .option {
    display: flex;
    align-items: flex-start;
    font-size: 1em;
    line-height: 1.4;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
    cursor: pointer;
}
.options-container input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem; /* Espacio antes de los botones */
}

.quiz-navigation button {
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

#prev-btn, #next-btn {
    background-color: #dc3545;
    color: white;
}
#prev-btn:hover, #next-btn:hover {
    background-color: #c82333;
}

/* Estilo para el botón 'Página anterior' y estados deshabilitados */
#prev-btn:disabled, #next-btn:disabled {
    background-color: #f8f9fa;
    color: #adb5bd; /* Texto gris claro */
    border: 1px solid #dee2e6;
    cursor: not-allowed;
}

.quiz-sidebar {
    width: 490px;
    flex-shrink: 0;
}

.sidebar-block {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.sidebar-block h4 {
    margin: 0 auto 1rem auto;
    width: fit-content;
    font-size: 0.9rem;
    color: #495057;
    font-weight: normal;
    text-align: center !important; /* Centrar títulos explícitamente */
}

.sidebar-block.combined h4:nth-of-type(2) {
    white-space: nowrap;
}

.sidebar-block.combined {
    text-align: center; /* Centra el contenido en el largo de la página */
}

.back-btn.center {
    display: block;
    margin: 1rem auto; /* Centra horizontalmente */
    text-align: center;
}

.back-btn.top {
    display: block;
    margin: 0 auto 1rem auto; /* Centra horizontalmente en la parte superior */
    text-align: center;
}

.agraria-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.materias-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    margin-top: 30px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Grid específico para el menú UNEMI - 2 columnas x 2 filas */
.unemi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 30px auto;
    padding: 0 1rem;
}

.unemi-btn {
    padding: 20px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    text-align: center;
    transition: background-color 0.2s, transform 0.2s;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unemi-btn:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.unemi-btn strong {
    font-size: 1.2em;
    font-weight: 700;
}

.materia-btn {
    padding: 20px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    text-align: center;
    transition: background-color 0.2s, transform 0.2s;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.materia-btn:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.materia-btn strong {
    font-size: 1.2em;
    font-weight: 700;
}

#agraria-menu h1, #agraria-menu p,
#unemi-menu h1, #unemi-menu p,
#materias-menu h1, #materias-menu p {
    text-align: center;
}

#timer {
    font-size: 2.25rem;
    font-weight: bold;
    color: #007bff;
    text-align: center;
    letter-spacing: 2px;
}

#nav-grid {
    display: grid;
    gap: 0.5rem;
}

/* ESPOL: 5 columnas x 4 filas (20 preguntas) - Para capítulos individuales */
#question-grid.espol-grid,
.espol-grid-20 {
    grid-template-columns: repeat(5, auto);
    grid-template-rows: repeat(4, auto);
    justify-content: center;
}

/* ESPOL: 8 columnas x 5 filas (40 preguntas) - Solo para aptitud */
.espol-grid-40 {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(5, 1fr);
    display: grid;
    gap: 3px;
}

/* Tamaño específico para botones de grilla ESPOL (reducido) */
.espol-grid-40 .nav-grid-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.7rem;
}

.espol-grid-40 .nav-grid-btn.current {
    border: 2px solid #000;
    font-weight: 700;
}

.espol-grid-40 .nav-grid-btn.answered {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* UG: 8 columnas x 5 filas (40 preguntas) */
#question-grid.ug-grid {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

/* Materias: 8 columnas x 5 filas (40 preguntas) */
#question-grid.materias-grid {
    grid-template-columns: repeat(8, auto);
    grid-template-rows: repeat(5, auto);
    justify-content: center;
    display: grid;
    gap: 3px;
    margin: 0 auto;
    width: fit-content;
}

/* Botones específicos de navegación para MATERIAS - Tamaño optimizado */
#question-grid.materias-grid .nav-grid-btn {
    min-width: 30px !important;
    min-height: 30px !important;
    width: 30px !important;
    height: 30px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px;
}

#question-grid.materias-grid .nav-grid-btn.current {
    border: 2px solid #000;
    font-weight: 700;
    background-color: #e3f2fd;
}

#question-grid.materias-grid .nav-grid-btn.answered {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

#question-grid.materias-grid .nav-grid-btn:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

/* UNEMI: 9 columnas x 6 filas (54 preguntas) */
#question-grid.unemi-grid {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

/* AGRARIA: 8 columnas x 5 filas (40 preguntas) */
#question-grid.agraria-grid {
    grid-template-columns: repeat(8, auto);
    grid-template-rows: repeat(5, auto);
    justify-content: center;
    display: grid;
    gap: 3px;
    margin: 0 auto;
    width: fit-content;
}

/* Botones específicos de navegación para AGRARIA - Tamaño optimizado */
#question-grid.agraria-grid .nav-grid-btn {
    min-width: 30px !important;
    min-height: 30px !important;
    width: 30px !important;
    height: 30px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px;
}

#question-grid.agraria-grid .nav-grid-btn.current {
    border: 2px solid #000;
    font-weight: 700;
    background-color: #e3f2fd;
}

#question-grid.agraria-grid .nav-grid-btn.answered {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

#question-grid.agraria-grid .nav-grid-btn:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

/* Tamaño reducido específico para UNEMI - grillas del quiz */
.unemi-grid .nav-grid-btn,
#nav-grid.unemi-grid .nav-grid-btn {
    min-width: 25px;
    min-height: 25px;
    width: 25px;
    height: 25px;
    padding: 2px;
    font-size: 0.7rem;
}

#nav-grid button, .nav-grid-btn {
    border: 1px solid #ccc;
    background-color: #fff;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
}
#nav-grid button:hover, .nav-grid-btn:hover {
    background-color: #f0f0f0;
}

#nav-grid button.current, .nav-grid-btn.current {
    border: 2px solid #000;
    font-weight: bold;
}

#nav-grid button.answered, .nav-grid-btn.answered {
    background-color: #007bff;
    color: white;
}

#finish-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #28a745;
    border: 1px solid #28a745;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    color: white;
}
#finish-btn:hover {
    background-color: #218838;
}

/* Estilos para los resultados */
.result-correct { color: #28a745; }
.result-incorrect { color: #dc3545; }

/* ====================================================== */
/* ==           ESTILOS PARA MENÚ UG                   == */
/* ====================================================== */

#ug-menu h1, #espol-menu h1, #chapter-selection h1, #espol-fisica-chapters h1, #espol-matematicas-chapters h1, #espol-quimica-chapters h1 {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 1rem;
}

#ug-menu p, #espol-menu p, #espol-fisica-chapters p, #espol-matematicas-chapters p, #espol-quimica-chapters p {
    text-align: center;
    margin-bottom: 2rem;
}

#ug-menu .bloques-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    margin-top: 30px !important;
    max-width: 1100px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: center !important;
}

#ug-menu .start-button {
    padding: 20px !important;
    font-size: 1.1em !important;
    cursor: pointer !important;
    background-color: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    text-align: center !important;
    transition: background-color 0.2s, transform 0.2s !important;
    width: 250px !important;
    flex-shrink: 0 !important;
}

.start-button:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

#ug-menu .start-button strong {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 1.2em !important;
    font-weight: 700 !important;
    text-align: center !important;
}

#ug-menu .start-button span {
    font-size: 1em !important;
    text-align: center !important;
}

/* ====================================================== */
/* ==           ESTILOS PARA MENÚ AGRARIA E INSTITUTOS == */
/* ====================================================== */

#agraria-menu .start-button,
#institutos-menu .start-button {
    padding: 20px !important;
    font-size: 1.1em !important;
    cursor: pointer !important;
    background-color: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    text-align: center !important;
    transition: background-color 0.2s, transform 0.2s !important;
    width: 250px !important;
    flex-shrink: 0 !important;
}

#agraria-menu .start-button:hover,
#institutos-menu .start-button:hover {
    background-color: #c82333 !important;
    transform: translateY(-2px);
}

#agraria-menu .start-button strong,
#institutos-menu .start-button strong {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 1.2em !important;
    font-weight: 700 !important;
    text-align: center !important;
}

#agraria-menu .start-button span,
#institutos-menu .start-button span {
    font-size: 1em !important;
    text-align: center !important;
}

/* ====================================================== */
/* ==           ESTILOS PARA MENÚ ESPOL               == */
/* ====================================================== */

/* Reutilizar .simulator-grid y .simulator-btn existentes */

/* ====================================================== */
/* ==           ESTILOS PARA CAPÍTULOS ESPOL          == */
/* ====================================================== */

.chapter-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.chapter-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-width: 250px;
}

.chapter-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(220, 53, 69, 0.2);
}

.chapter-btn span {
    font-size: 1.4rem;
    font-weight: bold;
}

/* ====================================================== */
/* ==           ESTILOS PARA RESULTADOS               == */
/* ====================================================== */

.results-screen {
    max-width: 900px;
    margin: 50px auto;
    padding: 40px;
    background-color: #fff;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.results-screen h1, .results-screen h2 {
    margin-top: 0;
}

#score-text {
    font-size: 2em;
    font-weight: bold;
    color: #0056b3;
    margin: 20px 0;
}

#feedback-text {
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* ====================================================== */
/* ==           ESTILOS PARA ACADEMIAS                 == */
/* ====================================================== */

#academias-footer {
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid #dee2e6;
    padding-top: 2rem;
}

#academias-footer h2 {
    font-size: 1.5rem;
    color: #495057;
    margin-bottom: 1rem;
}

.academias-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.academias-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.academias-links a:hover {
    color: #0056b3;
}

.academias-links img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ====================================================== */
/* ==           RESPONSIVE DESIGN MEJORADO             == */
/* ====================================================== */

/* Responsive para menús de universidades */
@media (max-width: 767px) {
    /* Menú UG: Usar flexbox para mejor control de tamaño en móvil */
    .bloques-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 15px !important;
        margin-top: 20px !important;
        max-width: 700px !important;
    }

    /* Menú ESPOL: 4 botones en 2x2 (desktop) -> 2x2 (móvil) */
    .espol-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 10px;
        max-width: 500px;
    }

    /* Menú UNEMI: 4 botones en 2x2 (desktop) -> 2x2 (móvil) */
    .unemi-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 15px;
        max-width: 500px;
        padding: 0 0.5rem;
    }

    /* Menú MATERIAS: 9 botones en 3x3 (desktop) -> 3x3 (móvil) pero más compacto */
    .materias-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 8px;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Botones más pequeños en móvil */
    .start-button,
    .unemi-btn,
    .materia-btn {
        padding: 15px 10px;
        font-size: 0.9rem;
        min-height: 70px;
    }

    .start-button strong,
    .unemi-btn strong,
    .materia-btn strong {
        font-size: 1rem;
    }

    .start-button span {
        font-size: 0.85rem;
    }

    /* Títulos más pequeños en móvil */
    #ug-menu h1,
    #espol-menu h1,
    #unemi-menu h1,
    #agraria-menu h1,
    #institutos-menu h1,
    #materias-menu h1 {
        font-size: 2rem !important;
        margin-bottom: 0.5rem;
    }

    #ug-menu p,
    #espol-menu p,
    #unemi-menu p,
    #agraria-menu p,
    #institutos-menu p,
    #materias-menu p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Botón de volver más compacto */
    .back-btn {
        margin-top: 1rem;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Chapter buttons más compactos en móvil */
    .chapter-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-width: 200px;
    }

    .chapter-btn span {
        font-size: 1.1rem;
    }
}

/* Responsive extra pequeño (hasta 480px) */
@media (max-width: 480px) {
    /* Menú UG: Pantallas muy pequeñas */
    .bloques-container {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-top: 15px;
        max-width: 400px;
    }

    /* Menús ESPOL, UNEMI: 1 columna en móvil muy pequeño */
    .espol-grid,
    .unemi-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
        gap: 12px;
        max-width: 350px;
    }

    /* Menú MATERIAS: 2 columnas en móvil muy pequeño */
    .materias-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(5, auto);
        gap: 6px;
        max-width: 400px;
    }

    /* Botones aún más pequeños */
    .start-button,
    .unemi-btn,
    .materia-btn {
        padding: 12px 8px;
        font-size: 0.85rem;
        min-height: 60px;
    }

    .start-button strong,
    .unemi-btn strong,
    .materia-btn strong {
        font-size: 0.95rem;
    }

    /* Títulos aún más pequeños */
    #ug-menu h1,
    #espol-menu h1,
    #unemi-menu h1,
    #agraria-menu h1,
    #institutos-menu h1,
    #materias-menu h1 {
        font-size: 1.5rem !important;
    }

    /* Chapter buttons compactos */
    .chapter-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        min-width: 180px;
    }

    .chapter-btn span {
        font-size: 1rem;
    }
}

/* ====================================================== */
/* ==           OPTIMIZACIONES MÓVILES ADICIONALES    == */
/* ====================================================== */

/* Menú hamburguesa móvil mejorado */
@media (max-width: 767px) {
    .yachana-header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    .header-top {
        padding: .5rem 0;
        flex-direction: column;
        gap: .5rem;
    }
    
    .header-contact, .header-social {
        justify-content: center;
        gap: .5rem;
    }
    
    .contact-link, .social-link {
        font-size: .8rem;
        padding: .25rem .5rem;
        min-height: 36px;
    }
    
    .header-main {
        padding: .75rem 0;
        position: relative;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #0f172a;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .main-nav.mobile-open {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav li {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .main-nav a {
        padding: .75rem 1rem;
        min-height: 48px;
        border-left: 3px solid transparent;
    }
    
    .main-nav a:hover {
        background: rgba(255,255,255,0.05);
        border-left-color: #38bdf8;
    }
    
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: .5rem;
        border-radius: 8px;
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
        align-items: center;
    }
    
    .mobile-menu-toggle:hover {
        background: rgba(255,255,255,0.1);
    }
    
    .mobile-menu-toggle span {
        width: 20px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: all .3s ease;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Main content móvil */
    .main-content-with-yachana {
        padding: .5rem;
    }
    
    #main-header {
        margin-bottom: 1rem;
    }
    
    #main-header h1 {
        font-size: 2rem !important;
        margin: -60px 0 0 0;
    }
    
    /* Banner móvil */
    .promo-banner {
        margin: 0.5rem auto 1.5rem auto;
        max-width: 95%;
    }
    
    .promo-content {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        gap: 1rem;
    }
    
    .promo-image img {
        width: 250px;
        height: 150px;
    }
    
    .promo-text h2 {
        font-size: 1.5rem;
    }
    
    /* Grid simuladores móvil */
    .simulator-grid {
        padding: 0.5rem;
        gap: 1rem;
    }
    
    .simulator-btn {
        padding: 1rem 1.5rem;
        min-height: 80px;
    }
    
    /* Opciones del quiz móvil */
    .options-container {
        grid-template-columns: 1fr;
        gap: .75rem;
    }
    
    .options-container .option {
        padding: .75rem;
        min-height: 48px;
    }
    
    /* Layout del quiz móvil - UG y otros */
    .quiz-layout {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .quiz-main {
        width: 100% !important;
        max-width: 100%;
        padding: 1rem;
        margin: 0;
    }
    
    .question-area {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0;
        width: 100%;
    }
    
    .quiz-sidebar {
        width: 100% !important;
        max-width: 100%;
        order: -1;
    }
    
    /* Navegación quiz móvil */
    .quiz-navigation {
        margin-top: 1rem;
        gap: .5rem;
        flex-wrap: wrap;
    }
    
    .quiz-navigation button {
        flex: 1;
        max-width: 120px;
        min-height: 44px;
    }
    
    /* Botones táctiles mejorados */
    .simulator-btn,
    .start-button,
    .unemi-btn,
    .materia-btn,
    .chapter-btn,
    .back-btn,
    #finish-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
    }
    
    /* Scroll mejorado */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
}

/* Optimizaciones para móviles muy pequeños */
@media (max-width: 480px) {
    .promo-banner {
        margin: 0.2rem auto 1rem auto;
        max-width: 98%;
    }
    
    .simulator-grid {
        padding: 0.2rem;
        gap: 0.8rem;
    }
    
    #main-header h1 {
        font-size: 1.8rem !important;
        margin: -50px 0 0 0;
    }
    
    .bloques-container {
        flex-direction: column;
        gap: 12px;
        max-width: 400px;
    }
    
    .chapter-btn {
        min-width: 200px;
        padding: 1rem 1.5rem;
    }
}

/* Mejoras de accesibilidad táctil */
button, a, .option, .nav-grid-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Reduce motion para accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}