/* ============================================================
   stylesexos.css — Palette cartoon MathsPrime
   Partagé par toutes les pages d'exercices
   ============================================================ */

/* --- Variables --- */
:root {
    --bg:         #fef9ec;
    --card:       #ffffff;
    --blue:       #3a9fd6;
    --blue-dk:    #1e7ab8;
    --green:      #3db85a;
    --green-dk:   #2a9444;
    --orange:     #f59120;
    --orange-dk:  #d4720a;
    --yellow:     #f5c842;
    --yellow-dk:  #d4a820;
    --text:       #2e2518;
    --text-muted: #7a6e62;
    --text-head:  #1a2d6b;
    --border:     #ddd0b8;
}

/* --- Base --- */
body {
    font-family: 'Nunito', Arial, sans-serif;
    text-align: center;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

/* --- Header / Brand pill --- */
.site-header {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    background: var(--bg);
}
.site-header::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(26,111,207,0.3), transparent);
    pointer-events: none;
}
.header-content {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    padding: 0 24px;
    box-sizing: border-box;
}
.brand-pill {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #0891B2 0%, #1E40AF 100%);
    border: 2px solid #f0c040;
    border-radius: 999px;
    padding: 8px 28px 8px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.brand-pill:hover {
    box-shadow: 0 6px 28px rgba(240,192,64,0.25);
    transform: translateY(-2px);
}
.logo {
    height: clamp(36px, 5.5vw, 52px);
    width: clamp(36px, 5.5vw, 52px);
    border-radius: 50%;
    display: block;
    object-fit: cover;
    background: #1a6fcf;
    flex-shrink: 0;
    border: 2px solid #f0c040;
}
.title {
    font-family: 'Nunito', 'Poppins', sans-serif;
    font-weight: 900;
    font-size: clamp(1.9rem, 5.2vw, 3.4rem);
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1;
    background: linear-gradient(135deg, #f8d96a 0%, #f0c040 45%, #c89020 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

/* --- Exercise box --- */
.exercise-box {
    padding: 24px 20px;
    border: 2.5px solid var(--border);
    border-radius: 20px;
    margin: 36px auto;
    max-width: 600px;
    width: 90%;
    background: var(--card);
    color: var(--text);
    position: relative;
    box-shadow: 0 6px 0 var(--border);
}
.exercise-box p {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-head);
}

/* --- Inputs --- */
input {
    padding: 10px 12px;
    font-size: 16px;
    width: 140px;
    margin: 6px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', Arial, sans-serif;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}
/* Input pleine largeur (binomiale, CL…) centré */
input[type="text"].wide,
.exercise-box input[type="text"]:not(.answer-unit-row input),
.exercise-box input[type="number"] {
    display: block;
    margin: 10px auto;
}
input:focus { border-color: var(--blue); }

/* --- Choice buttons (QCM) --- */
.choice-button {
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 800;
    margin: 6px auto;
    display: block;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    border: 2.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-family: 'Nunito', Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--border);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    text-align: left;
}
.choice-button:hover {
    background: #eef6fd;
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--border);
}
.choice-button.selected {
    background: var(--blue);
    color: white;
    border-color: var(--blue-dk);
    box-shadow: 0 3px 0 var(--blue-dk);
    transform: translateY(0);
}

/* --- Buttons --- */
button {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    margin: 8px 4px;
    border-radius: 12px;
    border: none;
    background: var(--blue);
    color: white;
    font-family: 'Nunito', Arial, sans-serif;
    box-shadow: 0 4px 0 var(--blue-dk);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button.minus {
    padding: 8px 12px;
    font-size: 18px;
    width: 42px;
    background: var(--border);
    color: var(--text);
    box-shadow: 0 4px 0 #c0b49e;
}
button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--blue-dk); }
button.minus:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #c0b49e; }

.help-button {
    padding: 10px 18px;
    font-size: 15px;
    cursor: pointer;
    margin: 8px 4px;
    border-radius: 12px;
    border: none;
    background: var(--yellow);
    color: var(--text);
    font-weight: 800;
    font-family: 'Nunito', Arial, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 0 var(--yellow-dk);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.help-button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--yellow-dk); }

/* --- Feedback & progress --- */
.result {
    margin-top: 14px;
    font-weight: 900;
    font-size: 26px;
    overflow-x:auto; 
    max-width:100%;
}
.progress-container {
    width: 80%;
    max-width: 300px;
    height: 14px;
    background: var(--border);
    border-radius: 10px;
    margin: 12px auto;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width .5s ease, background .5s ease;
}
.progress-bar.red    { background: var(--green); }
.progress-bar.orange { background: var(--green); }
.progress-bar.green  { background: var(--green); }

/* --- XP display --- */
.xp-display {
    background: linear-gradient(135deg, #0891B2 0%, #1E40AF 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 14px;
    margin: 14px auto;
    max-width: 300px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 4px 0 #0e6a8a;
}
.inactive-label {
    font-size: 13px;
    color: #f5c842;
    margin-bottom: 6px;
    font-weight: 800;
}
.xp-display i { margin-right: 8px; color: #f5c842; }
.xp-line { margin-bottom: 6px; display: flex; align-items: center; justify-content: center; }
.arrow-icon { width: 1em; height: 1em; margin-left: 8px; animation: arrowBounce .5s ease-in-out 2; }
@keyframes arrowBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
.coin-line { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.coin-icon { width: 1.2em; height: 1.2em; margin-right: 8px; vertical-align: middle; transition: transform .6s ease-in-out; }
.coin-icon.spin { animation: coinSpin .6s ease-in-out; }
@keyframes coinSpin { 0%{transform:rotateY(0)} 100%{transform:rotateY(360deg)} }
.streak-info { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 4px; }

.xp-warning {
    background: #fff8e6;
    border: 2px solid var(--orange);
    color: var(--orange-dk);
    padding: 10px 15px;
    border-radius: 12px;
    margin: 10px auto;
    max-width: 300px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

/* --- Retour button --- */
.retour-container { margin-bottom: 40px; }
.button-retour {
    display: inline-block;
    padding: 12px 24px;
    font-size: 20px;
    border-radius: 50px;
    background: var(--blue);
    color: white;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 4px 0 var(--blue-dk);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.button-retour:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--blue-dk);
}

/* --- Help popup --- */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    color: var(--text);
    padding: 24px;
    border-radius: 18px;
    border: 2.5px solid var(--border);
    box-shadow: 0 6px 0 var(--border);
    max-width: 90%;
    width: 340px;
    z-index: 1000;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    text-align: left;
}
.close-button {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 900;
    transition: color 0.2s, transform 0.2s;
}
.close-button:hover { color: #e54530; transform: rotate(90deg); }
.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(50,40,20,0.45);
    z-index: 999;
}

/* --- Mode éval toggle --- */
.eval-toggle-container {
    text-align: center;
    margin: 10px auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.eval-toggle-label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-head);
    margin-right: 6px;
}
.eval-toggle {
    position: relative;
    width: 56px;
    height: 28px;
    background-color: var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.eval-toggle.active { background-color: var(--green); }
.eval-toggle-circle {
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.eval-toggle.active .eval-toggle-circle { transform: translateX(28px); }
.eval-mode-banner {
    background: var(--green);
    color: white;
    padding: 10px;
    margin: -24px -20px 20px -20px;
    border-radius: 18px 18px 0 0;
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    display: none;
}
.eval-mode-banner.active { display: block; }
.eval-toggle-close {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-muted);
    cursor: pointer;
    margin-right: 6px;
    transition: color 0.2s;
}
.eval-toggle-close:hover { color: var(--text-head); }

/* --- Responsive --- */
@media (max-width: 767px) {
    .exercise-box { margin: 20px 10px; width: 95%; }
}
@media (max-width: 768px) {
    .site-header { padding: 10px 12px; }
    .brand-pill { padding: 6px 20px 6px 8px; gap: 10px; }
}
@media (max-width: 480px) {
    .site-header { padding: 8px 8px; }
    .brand-pill { padding: 5px 16px 5px 6px; gap: 8px; }
}

/* ============================================================
   Styles spécifiques — pages fractions (canvas, symbol buttons)
   ============================================================ */

#fraction-exercice {
    font-size: 32px;
    margin-bottom: 20px;
    display: block;
    color: var(--text-head);
    font-weight: 800;
    line-height: 1.5;
}

#fraction-visual {
    display: none;
    margin: 0;
    border: 2px solid var(--border);
    border-radius: 12px;
    max-width: 100%;
}

#fraction-display {
    font-size: 22px;
    margin-top: 12px;
    min-height: 36px;
    color: var(--text-head);
    font-weight: 800;
}

.symbol-button {
    padding: 8px 12px;
    font-size: 15px;
    min-width: 42px;
    margin: 5px;
    background: var(--border);
    color: var(--text);
    box-shadow: 0 3px 0 #c0b49e;
}
.symbol-button:hover {
    background: #c8bca8;
    box-shadow: 0 5px 0 #c0b49e;
}

@media (max-width: 767px) {
    .symbol-button {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 36px;
        margin: 4px;
    }
    #fraction-visual {
        max-width: 100%;
        height: auto;
    }
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}
* { box-sizing: border-box; }

/* ============================================================
   Styles spécifiques — pages géométrie/angles (select, canvas)
   ============================================================ */

select {
    padding: 10px 12px;
    font-size: 16px;
    width: 220px;
    margin: 6px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', Arial, sans-serif;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6e62' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
select:focus { border-color: var(--blue); }

#angle-exercice {
    font-size: 22px;
    margin-bottom: 16px;
    display: block;
    color: var(--text-head);
    font-weight: 800;
    line-height: 1.5;
}

#angle-visual {
    display: block;
    margin: 16px auto;
    border-radius: 12px;
    max-width: 100%;
}

@media (max-width: 767px) {
    select {
        font-size: 14px;
        padding: 8px 10px;
        width: 90%;
    }
}

/* ============================================================
   Styles spécifiques — pages avec énoncé #question et preview LaTeX
   ============================================================ */

#question {
    font-size: 22px;
    margin-bottom: 14px;
    line-height: 1.6;
    color: var(--text-head);
    font-weight: 800;
}

#latex-preview {
    margin: 10px auto;
    font-size: 20px;
    min-height: 30px;
    color: var(--text-head);
    font-weight: 700;
}

/* ============================================================
   Styles spécifiques — pages cercle/géométrie avec unités
   ============================================================ */

#circle-exercice {
    font-size: 22px;
    margin-bottom: 16px;
    display: block;
    line-height: 1.5;
    color: var(--text-head);
    font-weight: 800;
}

#circle-visual {
    display: none;
    margin: 16px auto !important;
    border-radius: 12px;
    max-width: 100%;
}

/* Ligne input + select d'unité côte à côte */
.answer-unit-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.answer-unit-row input[type="text"] {
    width: 140px;
}
.answer-unit-row select#userUnit {
    width: 90px;
}

/* Checkbox groups */
.checkbox-group {
    margin: 10px 0;
    text-align: left;
    display: inline-block;
}
.checkbox-group label {
    margin-left: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
}

/* Boutons symboles maths (π, √…) */
.math-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}
.math-btn {
    padding: 8px 14px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid var(--blue);
    background: var(--card);
    color: var(--blue);
    font-weight: 800;
    font-family: 'Nunito', Arial, sans-serif;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.math-btn:hover {
    background: var(--blue);
    color: white;
    transform: translateY(-2px);
}

/* Aperçu réponse */
#preview {
    min-height: 28px;
    margin: 10px auto;
    font-size: 18px;
    color: var(--text-head);
    font-weight: 700;
    padding: 6px 10px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: var(--bg);
    max-width: 300px;
}

/* ============================================================
   Styles spécifiques — pages exp/ln
   ============================================================ */

#exp-ln-exercice {
    font-size: 28px;
    margin-bottom: 20px;
    display: block;
    color: var(--text-head);
    font-weight: 800;
    line-height: 1.5;
}

/* ============================================================
   Styles spécifiques — pages équations
   ============================================================ */

.equation-type {
    font-size: 14px;
    color: var(--blue);
    font-weight: 800;
    margin-bottom: 10px;
}

.probleme-box {
    background: #fef6e4;
    border-left: 4px solid var(--orange);
    padding: 14px 16px;
    margin: 14px 0;
    text-align: left;
    border-radius: 0 12px 12px 0;
    font-weight: 700;
    color: var(--text);
}

.math {
    display: block;
    font-size: 18px;
    margin: 10px 0;
}

/* ============================================================
   Styles spécifiques — #enonce (exoDP, exoEqDiff…)
   ============================================================ */

#enonce {
    font-size: 22px;
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--text-head);
    font-weight: 800;
}

/* textarea (exoEqDiff) */
textarea {
    padding: 10px 12px;
    font-size: 16px;
    width: 90%;
    max-width: 400px;
    margin: 14px auto 6px auto;
    display: block;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', Arial, sans-serif;
    font-weight: 700;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}
textarea:focus { border-color: var(--blue); }

/* ============================================================
   Styles spécifiques — tableau (exoFct)
   ============================================================ */

#tableau {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin: 14px auto;
    border-radius: 10px;
}
#tableau table {
    border-collapse: collapse;
    margin: 0 auto;
    font-weight: 700;
}
#tableau td, #tableau th {
    border: 2px solid var(--border);
    padding: 8px 14px;
    text-align: center;
    color: var(--text);
}
#tableau th {
    background: var(--bg);
    color: var(--text-head);
    font-weight: 900;
}

/* ============================================================
   Styles spécifiques — radio (exoFct2nde)
   ============================================================ */

.radio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 12px 0;
    text-align: center;
    gap: 6px;
}
.radio-container label {
    margin: 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
}
.radio-container input[type="radio"] {
    width: auto;
    margin: 0 6px 0 0;
    display: inline;
    accent-color: var(--blue);
}

/* ============================================================
   Styles spécifiques — solution détaillée (exoFraction, exoFraction_5e)
   ============================================================ */

#solution {
    margin-top: 14px;
    font-size: 20px;
    color: var(--text);
    line-height: 1.7;
    font-weight: 700;
}
#solution .math {
    font-size: 22px;
    vertical-align: middle;
    display: inline-block;
    padding: 0 5px;
}
.step {
    margin: 8px 0;
    display: block;
}
@media (max-width: 767px) {
    #solution { font-size: 18px; }
    #solution .math { font-size: 20px; }
}

/* ============================================================
   Styles spécifiques — géométrie lycée (contexte, données, vecteurs)
   ============================================================ */

.contexte-box {
    background: #eef6fb;
    border-left: 4px solid var(--blue);
    padding: 14px 16px;
    margin: 14px 0;
    text-align: left;
    border-radius: 0 12px 12px 0;
    font-weight: 700;
    color: var(--text);
}

.donnees-box {
    background: var(--card);
    border: 2.5px solid var(--border);
    padding: 14px 16px;
    margin: 14px auto;
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--border);
    text-align: left;
    max-width: 400px;
}

.stat-item {
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--text);
}
.donnees-box .stat-item:last-child { border-bottom: none; }

.stat-label {
    font-weight: 900;
    color: var(--text-head);
}

.vecteur-display {
    display: inline-block;
    background: var(--blue);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 3px 0 var(--blue-dk);
}

/* ============================================================
   Styles spécifiques — bouton ±∞ (exoInter)
   ============================================================ */

.plusinf {
    padding: 8px 14px;
    font-size: 14px;
    width: 70px;
}

/* ============================================================
   Styles spécifiques — exoLA (fractions HTML inline)
   ============================================================ */

#exercice-text {
    font-size: 22px;
    font-weight: 800;
    margin: 16px 0;
    color: var(--text-head);
    line-height: 1.6;
}

.fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    font-size: .85em;
    line-height: 1;
}
.fraction .numerator,
.fraction .denominator { display: block; }
.fraction .numerator { border-bottom: 2px solid var(--text); padding-bottom: 2px; }
.fraction .denominator { font-size: .9em; padding-top: 2px; }

/* ============================================================
   Styles spécifiques — exoLim (tableau d'aide, highlight)
   ============================================================ */

#limit-exercice {
    font-size: 28px;
    margin-bottom: 20px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    color: var(--text-head);
    font-weight: 800;
}

.help-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin: 4px 0;
    gap: 10px;
}
.help-row .label { color: var(--text-muted); flex: 1; font-weight: 700; }
.help-row .value { color: var(--orange-dk); font-weight: 900; text-align: right; }

.help-highlight {
    background: #eef6fb;
    border-left: 3px solid var(--blue);
    padding: 6px 10px;
    border-radius: 0 8px 8px 0;
    margin: 6px 0;
    font-weight: 700;
}

/* ============================================================
   Styles spécifiques — exoND (droite numérique SVG, icônes)
   ============================================================ */

#decimal-exercice {
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-head);
    font-weight: 800;
}

#axe-consigne {
    font-size: 22px;
    margin: 10px 0;
    display: none;
    color: var(--text-head);
    font-weight: 800;
}

#axe-container {
    margin: 16px auto;
    width: 100%;
    max-width: 420px;
    display: none;
}

#user-latex {
    font-size: 22px;
    margin-top: 10px;
    color: var(--text-head);
    font-weight: 800;
    display: none;
}

/* SVG droite numérique */
.axis-line { stroke: var(--text); stroke-width: 2; }
.tick       { stroke: var(--text); stroke-width: 1.5; }
.subtick    { stroke: #aaa; stroke-width: 1; }
.tick-label { font-size: 14px; fill: var(--text); text-anchor: middle; }
.cross      { fill: none; stroke: #e54530; stroke-width: 2.5; }

.tip-box {
    background: #fff8e6;
    padding: 12px;
    border: 2px solid var(--yellow);
    border-radius: 10px;
    margin: 10px 0;
    font-style: italic;
    color: var(--orange-dk);
    font-weight: 700;
}

.example-block {
    background: var(--card);
    padding: 12px;
    border-left: 4px solid var(--blue);
    margin: 10px 0;
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 700;
}

/* Icônes catégories */
.icon-axe        { background: #e54530; }
.icon-chiffre    { background: var(--green); }
.icon-nombre     { background: var(--blue); }
.icon-fraction   { background: #8a55cc; }
.icon-comparaison{ background: var(--orange); }

/* ============================================================
   Styles spécifiques — exoNR / exoNR_5e
   ============================================================ */

#relatif-exercice {
    font-size: 28px;
    margin-bottom: 16px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    color: var(--text-head);
    font-weight: 800;
}

/* ============================================================
   Styles spécifiques — exoPower
   ============================================================ */

#power-exercice {
    font-size: 28px;
    margin-bottom: 16px;
    display: block;
    color: var(--text-head);
    font-weight: 800;
    line-height: 1.8;
}
/* Force MathJax3 à hériter la taille du conteneur */
#power-exercice mjx-container { font-size: inherit !important; }
#power-exercice mjx-container svg { font-size: 28px !important; }

.error-message {
    color: var(--green-dk);
    font-size: 14px;
    margin-top: 6px;
    font-weight: 700;
}

/* ============================================================
   Styles spécifiques — exoProbas (.context-box, alias .contexte-box)
   ============================================================ */

.context-box {
    background: #eef6fb;
    border-left: 4px solid var(--blue);
    padding: 14px 16px;
    margin: 14px 0;
    text-align: left;
    border-radius: 0 12px 12px 0;
    font-weight: 700;
    color: var(--text);
}

/* ============================================================
   Styles spécifiques — exoProbasLycee (arbre de probabilités)
   ============================================================ */

.arbre-container {
    margin: 16px auto;
    padding: 18px;
    background: var(--bg);
    border: 2.5px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--border);
    display: block;
    text-align: left;
    max-width: fit-content;
    width: auto;
    overflow-x: auto;
    /* centrage dans exercise-box */
    margin-left: auto;
    margin-right: auto;
}

.arbre-node {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.arbre-branche {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.arbre-ligne {
    width: 70px;
    height: 2px;
    background: var(--blue);
    flex-shrink: 0;
}

.arbre-proba {
    font-size: 13px;
    color: var(--blue);
    font-weight: 800;
    background: white;
    padding: 4px 10px;
    border-radius: 20px;
    border: 2px solid var(--blue);
    white-space: nowrap;
}

.arbre-evenement {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-head);
    background: white;
    padding: 7px 14px;
    border-radius: 10px;
    border: 2px solid var(--border);
    box-shadow: 0 3px 0 var(--border);
    white-space: nowrap;
}

.highlight {
    background: #fff8e6;
    border-color: var(--yellow) !important;
}

/* ============================================================
   Styles spécifiques — exoPyth (fallback message)
   ============================================================ */

.fallback-message {
    display: none;
    color: var(--orange-dk);
    font-weight: 800;
    margin: 16px;
    font-size: 15px;
}

/* ============================================================
   Styles spécifiques — exoQuadri
   ============================================================ */

#quadrilatere-exercice {
    font-size: 22px;
    margin-bottom: 16px;
    display: block;
    color: var(--text-head);
    font-weight: 800;
    line-height: 1.5;
}

/* ============================================================
   Styles spécifiques — exoStats (diagramme canvas, légende)
   ============================================================ */

#diagramme {
    display: block;
    margin: 20px auto 8px;
    width: 320px;
    height: 0;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--border);
    transition: height 0.5s ease;
}
#diagramme.visible {
    height: 320px;
}

#legende {
    margin-top: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.6s ease;
}
#legende.visible {
    max-height: 200px;
    opacity: 1;
}

#feedback {
    margin: 16px 0 0;
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    overflow-x: auto;
    min-height: 0;
    transition: all 0.4s ease;
}
/* exoStats anime le feedback via .visible - les autres pages l'utilisent directement */
#feedback:empty {
    display: none;
}

.table-wrapper {
    display: flex;
    justify-content: center;
    margin: 10px auto;
    overflow-x: auto;
}
.table-wrapper table {
    border-collapse: collapse;
    min-width: max-content;
}
.table-wrapper th, .table-wrapper td {
    border: 2px solid var(--border);
    padding: 8px 14px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
}
.table-wrapper th {
    background: var(--bg);
    color: var(--text-head);
    font-weight: 900;
}

#tableau-donnees {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* ============================================================
   Styles spécifiques — exoStatsLycee (intervalle visuel)
   ============================================================ */

.intervalle-visual {
    margin: 16px auto;
    padding: 18px;
    background: var(--bg);
    border: 2.5px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--border);
    max-width: 500px;
    position: relative;
}

.intervalle-line {
    height: 38px;
    background: linear-gradient(to right, #e54530 0%, var(--blue) 50%, #e54530 100%);
    border-radius: 20px;
    position: relative;
}

.intervalle-marker {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 50px;
    background: var(--text-head);
    border-radius: 2px;
}

.intervalle-label {
    position: absolute;
    top: 55px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-head);
    transform: translateX(-50%);
}

/* ============================================================
   Styles spécifiques — exoSuites (input somme, opérateurs)
   ============================================================ */

#sommeInput {
    display: block;
    margin: 12px auto;
    text-align: center;
}

.op {
    width: 54px;
    padding: 8px 10px;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

/* ============================================================
   Styles spécifiques — exoTrigo1e (fraction MathJax inline)
   ============================================================ */

.mathjax-container {
    display: inline;
}

.slash {
    padding: 8px 14px;
    font-size: 14px;
    width: 70px;
}

/* ============================================================
   Styles spécifiques — exoProbasLycee (tableau double entrée)
   ============================================================ */

.tableau-container {
    margin: 16px auto;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}
.tableau-container table {
    border-collapse: collapse;
    background: var(--card);
    min-width: max-content;
}
.tableau-container th,
.tableau-container td {
    border: 2px solid var(--blue);
    padding: 10px 18px;
    text-align: center;
    min-width: 80px;
    font-weight: 700;
    font-size: 15px;
}
.tableau-container th {
    background: #eef6fb;
    color: var(--text-head);
    font-weight: 900;
}

/* ============================================================
   Styles spécifiques — programme de calcul (exoCL_5e…)
   ============================================================ */

.program-box {
    background: #eef6fb;
    border: 2.5px solid var(--blue);
    border-radius: 14px;
    padding: 14px 18px;
    margin: 16px auto;
    max-width: 360px;
    text-align: left;
    box-shadow: 0 4px 0 #b8d9ef;
}
.program-box strong {
    display: block;
    color: var(--text-head);
    font-size: 15px;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 0.03em;
}
.program-step {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    margin: 6px 0;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    box-shadow: 0 2px 0 var(--border);
}
.program-step::before {
    content: "▶";
    color: var(--blue);
    font-size: 12px;
    flex-shrink: 0;
}
/* ============================================================
   Styles spécifiques — symbol-buttons (exoFct2nde, intervalles)
   ============================================================ */

.symbol-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 10px auto;
    width: 100%;
    box-sizing: border-box;
}

.mathjax-button {
    display: inline-block;
    pointer-events: none;
}
