:root {
    --primary-color: #4285F4;
    --success-color: #34A853;
    --error-color: #EA4335;
    --warning-color: #FBBC05;
    --dark-color: #202124;
    --light-color: #f8f9fa;
    --gray-color: #dadce0;
    --progress-bar-color: #6e8efb;
    --streak-color: #FF6D00;
    --timer-color: #28cecf;
    --timer-warning: #ff9966;
    --timer-critical: #ff2400;
    --control-blue: #1976D2;
    --control-red: #F44336;
}

/* ------ Estilos para ocultar elementos de LearnDash ------ */
.ld-progress,
.learndash-wrapper .ld-progress,
#learndash-page-header .ld-progress-bar, 
.learndash .ld-progress-bar,
.ld-breadcrumbs,
.learndash-wrapper .ld-breadcrumbs,
.learndash .ld-breadcrumbs,
#learndash-page-header .ld-breadcrumbs,
.ld-lesson-header,
.ld-topic-header,
.ld-course-status,
#learndash-page-header,
.ld-button[href*="previous"], 
.ld-button[href*="next"], 
.learndash_next_prev_link a,
#learndash_mark_complete_button,
input#btn-complete, 
input#btn-incomplete,
.ld-content-actions,
.learndash-wrapper .ld-content-actions,
.ld-alert-success,
.learndash-topic-completed,
.learndash-wrapper .learndash-topic-completed {
    display: none !important;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: white;
    border-bottom: 3px solid var(--gray-color);
    z-index: 1000;
    margin: 0;
    padding: 0;
}

.progress-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 22px;
    background-color: #cdcdcd;
    border-radius: 50px;
    box-sizing: border-box;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to bottom, #60d3ff, #007acc);
    border-radius: 50px;
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Ajuste de fondo consistente para elementos clave */
.header-bottom, .streak-counter, .edooly-global-instructions, .edooly-global-question {
    background-color: white !important;
}

main {
  margin-top: 50px; 
  padding: 20px;
  padding-bottom: calc(var(--footer-height,72px) + var(--footer-gap,16px)); 
  min-height: calc(100vh - var(--header-height,50px) - var(--footer-height,72px));
  box-sizing: border-box;
}

.header-bottom {
    background-color: white !important;
}

.back-button {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    margin-right: auto;
}

.back-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.back-button svg {
    width: 24px;
    height: 24px;
    fill: var(--dark-color);
}

.container {
    max-width: none;
    margin: 0;
    padding: 0;
    background-color: white;
    box-shadow: none;
    border-radius: 0;
}

.question-header-with-animation {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    margin: 0 auto 25px;
    max-width: 1000px;
    padding: 0 20px;
}

.question-animation {
    flex: 0 0 auto;
}

.question-animation {
    width: 180px !important;
    height: 180px !important;
}

.question-title-bubble {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 500px;
    background-color: var(--dark-color);
    color: white;
    padding: 15px 25px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    align-self: center;
}

.question-title-bubble::after {
    content: "";
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 12px;
    border-style: solid;
    border-color: transparent var(--dark-color) transparent transparent;
}

/* === NUEVO LAYOUT GLOBAL PARA INSTRUCCIONES Y PREGUNTA === */
.edooly-global-question-wrapper {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 30px;
    padding: 0 20px;
    box-sizing: border-box;
}

.edooly-global-instructions {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #6b7280;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    line-height: 1.4;
    text-align: left;
}

.edooly-global-question {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
    text-align: left;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    padding: 15px;
    background: white;
    border-radius: 10px;
}

.question-visualization {
    margin: 0 0 18px 0;
}

/* Respuesta a animaciones y títulos */
@media (max-width: 900px) {
    .question-header-with-animation {
        gap: 20px;
    }
    
    .question-animation {
        width: 150px !important;
        height: 150px !important;
    }
}

@media (max-width: 768px) {
    .question-header-with-animation {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 20px;
    }

    .progress-container {
        width: 200px;
        height: 20px;
    }
    
    .question-title-bubble {
        max-width: 100%;
        text-align: left;
        padding: 15px 20px;
    }
    
    .question-title-bubble::after {
        left: -15px;
        top: 50%;
        transform: translateY(-50%);
        border-color: transparent var(--dark-color) transparent transparent;
    }
    
    .question-animation {
        width: 130px !important;
        height: 130px !important;
    }
}

@media (max-width: 480px) {
    .question-header-with-animation {
        padding: 0 15px;
        gap: 12px;
    }
    
    .question-title-bubble {
        padding: 12px 18px;
    }
    
    .question-animation {
        width: 110px !important;
        height: 110px !important;
    }
    
    .edooly-global-instructions {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .edooly-global-question {
        font-size: 1rem;
        padding: 10px;
    }
}

.button-container {
    text-align: center;
    margin-top: 30px;
}

.verify-button {
    min-width: 250px;
    height: 45px;
    line-height: 45px;
    font-size: 18px;
    padding: 0 24px;
    background: #444;
    color: white;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    border: none;
    border-radius: 30px;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 5px 0 #000, 0 6px 12px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    transform: translateY(0);
    user-select: none;
}

.verify-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 0 #000, 0 7px 15px rgba(0,0,0,0.15) !important;
    background: #444 !important;
}

.verify-button:active {
    transform: translateY(4px) !important;
    box-shadow: 0 1px 0 #000 !important;
}

.verify-button:disabled {
    background: #cccccc !important;
    box-shadow: 0 4px 0 #999999 !important;
    cursor: not-allowed !important;
    transform: translateY(0) !important;
}

.btn {
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 16px;
    min-width: 120px;
    text-align: center;
}

.btn-dark {
    background: #444;
    color: white;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    border: none;
    border-radius: 30px;
    box-shadow: 0 5px 0 #000, 0 6px 12px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    transform: translateY(0);
}

.btn-dark:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 0 #000, 0 7px 15px rgba(0,0,0,0.15) !important;
    background: #444 !important;
}

.btn-dark:active {
    transform: translateY(4px) !important;
    box-shadow: 0 1px 0 #000 !important;
}

.btn-outline {
    background: white;
    color: var(--dark-color);
    border: 1px solid var(--gray-color);
    box-shadow: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}

.btn-outline:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none; /* oculto por defecto */
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--gray-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.modal-icon.success {
    background-color: #28c840;
    border: none;
}

.modal-icon.error {
    background-color: #e74c3c;
    border: none;
}

.modal-icon svg {
    width: 30px;
    height: 30px;
}

.modal-icon.success svg {
    stroke: white;
    stroke-width: 3;
}

.modal-icon.error svg {
    fill: white;
}

.modal-title {
    font-size: 24px;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
    margin-bottom: 10px;
}

.modal-title.success {
    color: var(--success-color);
}

.modal-title.error {
    color: var(--error-color);
}

.modal-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 5px;
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.modal-message {
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 16px;
}

.correct-answer {
    font-weight: 700;
    color: var(--success-color);
    font-size: 18px;
    margin: 15px 0;
}

.modal-footer {
    padding: 20px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--gray-color);
}

/* ======= (Se eliminaron aquí las reglas específicas del modal de explicación
   para moverlas a explanation_modal_styles.css) ======= */

.timeout-modal {
    text-align: center;
    padding: 30px;
}

.timeout-icon {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    background-color: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.timeout-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.timeout-title {
    font-size: 24px;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
    margin-bottom: 15px;
    color: var(--error-color);
}

.timeout-message {
    margin-bottom: 25px;
    line-height: 1.6;
    color: #666;
}

.timeout-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.confirmation-modal {
    text-align: center;
    padding: 30px;
}

.confirmation-image {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.confirmation-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.confirmation-title {
    font-size: 22px;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
    margin-bottom: 15px;
}

.confirmation-message {
    margin-bottom: 25px;
    line-height: 1.6;
}

.confirmation-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.bottom-feedback-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-feedback-modal.active {
    transform: translateY(0);
}

.bottom-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bottom-feedback-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.bottom-feedback-header {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 20px;
}

.bottom-feedback-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.bottom-feedback-icon.success {
    background-color: #28c840;
    border: none;
}

.bottom-feedback-icon.error {
    background-color: #e74c3c;
    border: none;
}

.bottom-feedback-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.bottom-feedback-title {
    font-size: 18px;
    font-weight: 900;
    font-family: 'Nunito', sans-serif;
}

.bottom-feedback-title.success {
    color: var(--success-color);
}

.bottom-feedback-title.error {
    color: var(--error-color);
}

.bottom-feedback-content {
    margin-bottom: 20px;
}

.bottom-feedback-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-color);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #151517;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.loading-screen.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.loading-content h3 {
    font-size: 24px;
    margin-bottom: 20px;
    font-family: 'Nunito', sans-serif;
}

.loading-content {
    width: 200px;
    height: 200px;
}

.sound-toggle {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #2a5bd7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 999;
    transition: all 0.3s ease;
    bottom: 20px;
    right: 20px;
    display: none;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle svg {
    width: 24px;
    height: 24px;
    fill: white;
}

#feedbackIconSvg path {
    stroke-width: 16;
}

#feedbackIconSvg line {
    stroke-width: 16;
}

#viewExplanation.btn-outline,
#cancelExit.btn-outline,
#tryAgainButton.btn-outline {
    color: #666 !important;
    border: 1px solid #ddd !important;
    background-color: white !important;
    transition: color 0.2s ease !important;
}

#viewExplanation.btn-outline:hover,
#cancelExit.btn-outline:hover,
#tryAgainButton.btn-outline:hover {
    color: #666 !important;
    border-color: #ddd !important;
    background-color: #f8f9fa !important;
    transform: translateY(-1px);
}

#viewExplanation.btn-outline:hover span,
#cancelExit.btn-outline:hover span,
#tryAgainButton.btn-outline:hover span {
    color: inherit !important;
}

.mobile-controls-panel {
    display: flex;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    gap: 0;
}

.mobile-controls-toggle {
    width: 30px;
    height: 110px;
    background-color: #28cecf;
    border-radius: 0 15px 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    transition: all 0.4s cubic-bezier(0.68,-0.55,0.265,1.55);
    position: relative;
    z-index: 999;
}

.mobile-controls-toggle.active {
    transform: translateX(-100%);
    opacity: 0;
}

.mobile-controls-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-controls-container {
    position: fixed;
    left: -280px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0,0,0,0.8);
    border-radius: 0 15px 15px 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all .3s ease;
    z-index: 998;
}

.mobile-controls-container.active {
    left: 0;
    animation: slideInControls 0.4s cubic-bezier(0.68,-0.55,0.265,1.55) forwards;
}

.mobile-controls-container:not(.active) {
    animation: slideOutControls 0.4s cubic-bezier(0.68,-0.55,0.265,1.55) forwards;
}

.mobile-control-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--control-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-control-button svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.mobile-control-button.active {
    background-color: var(--control-red);
}

.lottie-feedback-container {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lottie-feedback-container {
    width: 100%;
    height: 100%;
}

.modal-icon-lottie {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon-lottie {
    width: 100%;
    height: 100%;
}

.bottom-feedback-icon-lottie {
    width: 100%;   
    height: 100%;  
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bottom-feedback-icon-lottie {
    width: 100%;
    height: 100%;
}

@keyframes slideInControls {
    from { 
        left: -280px; 
        opacity: 0.6; 
    }
    to { 
        left: 0; 
        opacity: 1; 
    }
}

@keyframes slideOutControls {
    from { 
        left: 0; 
        opacity: 1; 
    }
    to { 
        left: -280px; 
        opacity: 0.6; 
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease forwards;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes streakPop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes streakFire {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.15) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes timerCollapse {
    from { 
        width: 140px; 
        opacity: 1; 
        transform: translateX(0);
    }
    to { 
        width: 60px; 
        opacity: 0.8; 
        transform: translateX(10px);
    }
}

@keyframes timerExpand {
    from { 
        width: 60px; 
        opacity: 0.8; 
        transform: translateX(10px);
    }
    to { 
        width: 140px; 
        opacity: 1; 
        transform: translateX(0);
    }
}

.timer-right-wrapper.collapsed {
    animation: timerCollapse 0.5s cubic-bezier(0.68,-0.55,0.265,1.55) forwards;
}

.timer-right-wrapper.expanded {
    animation: timerExpand 0.5s cubic-bezier(0.68,-0.55,0.265,1.55) forwards;
}

@media (max-width: 768px) {
    .modal {
        max-width: 90%;
    }
    
    .bottom-feedback-footer {
        flex-direction: column;
    }
    
    .bottom-feedback-footer .btn {
        width: 100%;
    }
    
    .sound-toggle {
        bottom: 20px;
        top: auto;
    }
    
    .loading-content {
        width: 150px;
        height: 150px;
    }
    
    .timeout-modal {
        padding: 20px;
    }
    
    .timeout-icon {
        width: 150px;
        height: 150px;
        margin-bottom: 15px;
    }
    
    .timeout-title {
        font-size: 22px;
    }
    
    .timeout-message {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .timeout-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .timeout-buttons .btn {
        width: 100%;
    }
    
    .mobile-controls-toggle {
        width: 20px;
        height: 90px;
    }
    
    .mobile-controls-container {
        padding: 15px;
        gap: 15px;
    }
    
    .mobile-control-button {
        width: 45px;
        height: 45px;
    }
    
    .mobile-control-button svg {
        width: 24px;
        height: 24px;
    }
    
    .lottie-feedback-container {
        width: 120px;
        height: 120px;
    }
    
    .modal-icon-lottie {
        width: 120px;
        height: 120px;
    }
}

@media (min-width: 769px) {
    .bottom-feedback-modal {
        max-width: 1000px;
        margin: 0 auto;
        padding: 30px 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .feedback-column {
        padding: 0 15px;
    }
    
    .feedback-icon-column {
        flex: 1;
    }
    
    .feedback-content-column {
        flex: 2;
    }
    
    .feedback-buttons-column {
        flex: 1;
    }
    
    .bottom-feedback-header {
        margin-bottom: 0;
        flex: 1;
    }

    .bottom-feedback-content {
        margin-bottom: 0;
        flex: 2;
        text-align: left;
        padding: 0 20px;
    }

    .bottom-feedback-footer {
        justify-content: flex-end;
        padding-top: 0;
        border-top: none;
        flex: 1;
    }

    .bottom-feedback-icon {
        width: 130px;
        height: 130px;
        min-width: 100px;
        margin-right: 20px;
    }

    .bottom-feedback-icon svg {
        width: 70px;
        height: 70px;
    }
    
    .lottie-feedback-container {
        width: 160px;
        height: 160px;
    }
    
    .modal-icon-lottie {
        width: 160px;
        height: 160px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .bottom-feedback-icon {
        width: 130px !important;
        height: 130px !important;
        min-width: 130px;
    }

    .bottom-feedback-icon svg {
        width: 120px !important;
        height: 120px !important;
    }

    .bottom-feedback-title {
        font-size: 18px;
    }

    .bottom-feedback-message {
        font-size: 14px;
    }
    
    .mobile-controls-toggle {
        width: 22px;
        height: 100px;
    }
    
    .mobile-controls-container {
        padding: 18px;
        gap: 18px;
    }
    
    .mobile-control-button {
        width: 50px;
        height: 50px;
    }
    
    .mobile-control-button svg {
        width: 26px;
        height: 26px;
    }
    
    .lottie-feedback-container {
        width: 140px;
        height: 140px;
    }
    
    .modal-icon-lottie {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 1024px) {
    .bottom-feedback-header {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
        text-align: left;
    }

    .bottom-feedback-text {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;
    }

    .bottom-feedback-title {
        margin: 0;
        font-size: 18px;
    }

    .bottom-feedback-message {
        margin-top: 4px;
        font-size: 14px;
        color: #666;
    }
}

@media (min-width: 1025px) {
    .mobile-controls-panel {
        left: 0;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .mobile-controls-toggle {
        display: flex;
    }
    
    .mobile-controls-container {
        left: -280px;
        top: 50%;
        transform: translateY(-50%);
        flex-direction: column;
        background-color: rgba(0,0,0,0.8);
        border-radius: 0 15px 15px 0;
        padding: 20px;
        gap: 20px;
    }
    
    .mobile-controls-container.active {
        left: 0;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 10px 15px;
    }
}

@media (max-width: 320px) {
    .progress-container {
        width: 180px;
        height: 18px;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .header {
        position: relative;
    }
    
    main {
        margin-top: 0;
        padding: 10px;
    }
    
    .mobile-controls-panel {
        top: 10px;
        transform: none;
    }
    
    .mobile-controls-toggle {
        height: 50px;
        border-radius: 0 15px 15px 0;
    }
    
    .mobile-controls-container {
        top: 10px;
        transform: none;
        flex-direction: row;
        border-radius: 0 15px 15px 0;
        padding: 10px;
        gap: 10px;
    }
    
    .mobile-control-button {
        width: 35px;
        height: 35px;
    }
    
    .mobile-control-button svg {
        width: 18px;
        height: 18px;
    }
    
    .button-container {
        margin-top: 15px;
    }
}

.slide-in p:empty {
  display: none;
  margin: 0;
  padding: 0;
}

/* Asegurar que MathJax funcione correctamente en el sistema teach */
.edooly_teach_content_box mjx-container {
    display: inline-block !important;
    margin: 5px 0 !important;
}

.edooly_teach_content_box .MathJax {
    display: inline-block !important;
    margin: 5px 0 !important;
}

/* Estilos para elementos matemáticos dentro del sistema teach */
.edooly_teach_content_box .math {
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

.edooly_teach_content_box .math.display {
    display: block;
    text-align: center;
    margin: 15px 0;
}

/* Scroll personalizado para la caja de contenido teach */
.edooly_teach_content_box::-webkit-scrollbar {
    width: 8px;
}

.edooly_teach_content_box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.edooly_teach_content_box::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.edooly_teach_content_box::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Apartado: estilos específicos y aislados para el modal de explicación
   (incluye ahora el slider/paginador: prev/next, dots, page container y animaciones)
*/

/* Contenedor principal del modal de explicación */
.explanation-modal {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 700px;
    height: 520px; /* altura fija para desktops también (puedes ajustar) */
    max-height: 80vh;
    overflow: hidden; /* ocultamos overflow a nivel de modal; el contenedor interno tiene scroll */
    transform: translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Header: título y botón de cerrar (SVG) */
.explanation-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.explanation-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--dark-color);
}

/* Botón de cerrar en la esquina (círculo con SVG). */
.close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.18s ease, transform 0.12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Nuevo efecto hover: leve oscurecimiento y pequeño escalado */
.close-button:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: scale(1.06);
}

.close-button svg {
    width: 24px;
    height: 24px;
    fill: var(--dark-color);
}

/* Slider / area de contenido: ocupa el espacio disponible y permite scroll interno */
.explanation-body {
    padding: 0;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.explanation-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.explanation-page-container {
    position: relative; /* ya estaba, nos aseguramos */
    width: 100%;
    height: 100%;
    overflow: hidden; /* el scroll será del inner */
    -webkit-overflow-scrolling: touch;
    padding: 0; /* mover padding al inner */
    box-sizing: border-box;
}

.explanation-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    word-break: break-word;
    white-space: normal;
    transition: opacity 260ms ease; /* solo opacity */
    opacity: 1;
    overflow: hidden; /* el scroll lo maneja el inner */
}

/* Cada página individual */
.explanation-page {
    width: 100%;
    box-sizing: border-box;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    word-break: break-word;
    white-space: normal;
    transition: opacity 260ms ease;
    opacity: 1; 
}

/* Navegación (prev/dots/next) situado encima de la línea de separación y centrado */
.explanation-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 12px 16px;
    border-top: 1px solid transparent; /* la línea real visual la maneja el footer si hace falta */
    flex: 0 0 auto;
}

.explanation-nav-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dark-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 8px;
    transition: opacity 0.15s ease, transform 0.12s ease;
}

.explanation-nav-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.explanation-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
    transform: none;
}

/* Dots */
.explanation-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.explanation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d6d6d6; /* gris claro */
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
}

.explanation-dot.active {
    background: #4b5563; /* gris oscuro para el activo */
    transform: scale(1.08);
}

/* Footer interno del modal que contendrá el botón móvil "¡Lo tengo!".
   Por defecto se oculta en desktop; se mostrará solo en mobile (media query). */
.explanation-footer {
    display: none;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid var(--gray-color);
    background: white;
    flex: 0 0 auto;
}

.explanation-footer-inner {
    padding: 14px;
    display: flex;
    gap: 12px;
}

.explanation-footer .btn-dark {
    width: 100%;
    min-width: 0;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 4px 0 #000;
}

.explanation-page-inner {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px; /* antiguas reglas de padding */
    box-sizing: border-box;
}

/* Asegurar márgenes máximos del contenido para evitar overflow horizontal */
.explanation-page-inner p,
.explanation-page-inner ul,
.explanation-page-inner ol,
.explanation-page-inner h1,
.explanation-page-inner h2,
.explanation-page-inner h3,
.explanation-page-inner h4 {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 4px;
    padding-right: 4px;
}

/* Ajustes responsive para pantallas pequeñas (<= 768px)
   - El overlay de explicación se alinea al fondo para que el modal aparezca pegado a la parte inferior.
   - El modal ocupa todo el ancho y tiene altura fija alta.
   - Bordes redondeados solo en la parte superior.
   - Se oculta el SVG de cierre en la esquina y se muestra el footer móvil con el botón "¡Lo tengo!".
*/
@media (max-width: 768px) {
    #explanationModal.modal-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }

    .explanation-modal {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        height: 520px; /* altura fija alta solicitada */
        max-height: none;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
        transform: translateY(0);
    }

    .explanation-header {
        padding: 14px;
    }

    .explanation-page-container {
        padding: 14px 16px 70px; /* espacio inferior para nav/footer */
    }

    .explanation-title {
        font-size: 18px;
    }

    /* Ocultar el botón de cerrar en la esquina en mobile */
    #explanationModal .close-button {
        display: none;
    }

    /* Mostrar footer móvil */
    .explanation-footer {
        display: block;
        position: sticky;
        bottom: 0;
        background: white;
        z-index: 5;
    }

    .explanation-footer-inner {
        padding: 14px;
    }
}

.explanation-slider,
.explanation-page-container,
.explanation-modal {
  overflow-x: hidden; /* evitar scroll horizontal */
}

/* Animaciones suaves para navegacion (si hace falta, pueden ajustarse) */
.explanation-page {
    transition: transform 260ms ease, opacity 260ms ease;
}