body {
    font-family: Arial, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
}
.header {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.timer {
    font-size: 1.2em;
    font-weight: bold;
}
.progress-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 5px;
}
.progress-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #ccc;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}
.progress-step.active {
    background-color: #3498db;
}
.question-card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}
.template {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 9/16 = 0.5625 */
    overflow: auto;
}
.template .content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.question-title {
    background-color: #607d8b;
    color: white;
    padding: 10px;
    margin: -20px -20px 20px -20px;
    border-radius: 5px 5px 0 0;
    display: flex;
    justify-content: space-between;
}
.option {
    padding: 10px;
    margin: 5px 0;
    background-color: #ecf0f1;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.option.selected {
    background-color: #3498db;
    color: white;
}
.option input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
}
.question-note {
    font-style: italic;
    text-align: center;
    margin-top: 20px;
}
.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}
button {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
button:hover {
    background-color: #2980b9;
}
button.prev {
    background-color: #95a5a6;
}
.custom-input {
    width: 98%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
}
.feedback {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    min-height: 42px;
    box-sizing: border-box;
    background-color: transparent;
}
.feedback.correct {
    background-color: #dff0d8;
    color: #3c763d;
}
.feedback.incorrect {
    background-color: #f2dede;
    color: #a94442;
}
/* feedback-off : état par défaut, invisible, réserve l'espace */
.feedback-off {
    visibility: hidden !important;
    background-color: transparent !important;
    color: transparent !important;
}
.hidden {
    display: none !important;
}

/* --- POPUP ---- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-iframe {
    width: 80%;
    height: 80%;
    border: none;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 10px 15px;
    background: red;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


/* --- barre de progression ----*/
.progress-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #ccc;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer; /* Affiche la main au survol pour indiquer cliquable */
    transition: background-color 0.3s ease;
}

.progress-step.active {
    background-color: #3498db !important; /* Priorité sur les autres couleurs */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Ajout d'une bordure pour les étapes répondues */
.progress-step[style*="background-color"] {
    border: 2px solid white;
}

.correction-btn {
    margin-left: 10px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
}


.correction-btn:hover {
    background-color: #c0392b;
}



/* ---- POPUP SCORE ---- */

/* Styles pour le popup de score */
.score-popup-content {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
}

.score-display {
    font-size: 5em;
    font-weight: bold;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-percentage {
    font-size: 0.4em;
    opacity: 0.7;
    margin-top: 5px;
}

.score-message {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 20px;
}

.score-details {
    font-size: 1.1em;
    margin-bottom: 30px;
}


/* Couleurs selon le score */
.excellent {
    color: #27ae60;
}

.good {
    color: #2980b9;
}

.fair {
    color: #f39c12;
}

.poor {
    color: #e74c3c;
}

.close-score-btn {
    padding: 10px 30px;
    font-size: 1.2em;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.close-score-btn:hover {
    background-color: #2980b9;
}

/* Bouton pour afficher le score */
.show-score-btn {
    padding: 10px 20px;
    background-color: #9b59b6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: auto;
}

.show-score-btn:hover {
    background-color: #8e44ad;
}

/* Ajouter dans votre CSS */
.option input {
    /*flex-grow: 1;*/
    cursor: pointer;
}

/* Badge affichant la taille du viewport (en haut à droite) */
#viewport-size {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    pointer-events: none;
}

@media (max-width: 480px) {
    #viewport-size { font-size: 11px; top: 6px; right: 6px; padding: 5px 8px; }
}

/* --- Règles responsives sélectives --- */
/* Ajustements pour tablettes et mobiles */
@media (max-width: 900px) {
    body {
        max-width: 100%;
        padding: 12px;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }
    .header h1 {
        font-size: 1.2em;
    }
    .timer {
        font-size: 1em;
    }
    .progress-bar {
        justify-content: flex-start;
        overflow-x: auto;
        gap: 6px;
        padding: 6px 0;
    }
    .question-card {
        padding: 14px;
    }
    .actions {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    button {
        width: 100%;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .progress-step { width: 24px; height: 24px; }
    .timer { font-size: 0.95em; }
    .score-display { font-size: 3.5em; }
    .score-popup-content { padding: 20px; }
}

/* Small utility: reduce large fixed paddings on very small screens */
@media (max-width: 360px) {
    .header { padding: 8px; }
    .question-card { padding: 10px; }
    .option { padding: 8px; }
}

/* === FIXES POUR LE PLAYER ÉLÈVE (QCU 16:9 & LATEX) === */

/* ============================================
   PROTECTION DE KATEX
   NE PAS interférer avec le layout natif de KaTeX
   ============================================ */

/* Exception cruciale pour KaTeX : il nécessite content-box pour ses calculs précis */
.katex,
.katex * {
    box-sizing: content-box !important;
}

/* Cacher le MathML (accessibilité déjà gérée autrement) */
.katex-mathml {
    display: none !important;
}

/* Forcer katex-display à rester inline-block */
.katex-display {
    display: inline-block !important;
    margin: 0 !important;
}

/* Fix pour les formules LaTeX - le wrapper doit être inline-block */
.latex-wrapper {
    display: inline-block !important;
    vertical-align: middle;
}

/* Style de base pour KaTeX */
.qcu-question .katex,
.qcu-option .katex {
    font-size: 1.1em;
    vertical-align: middle;
}

/* Mode Question 16:9 (quand media-zone est masquée) */
.qcu-question.expanded-question {
    aspect-ratio: 16 / 9 !important;
    width: 100% !important;
    
    /* Flexbox configuré pour imiter un flux de texte centré */
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-content: center !important;
    align-items: center !important;
    
    text-align: center !important;
    font-size: 24px !important;
    min-height: auto !important;
    
    /* Styles visuels */
    padding: 20px !important;
    background: #f8f9fa !important;
    border-left: 4px solid #3498db !important;
    border-radius: 8px !important;
    margin-bottom: 20px !important;
    line-height: 1.6 !important;
    color: #2c3e50 !important;
}