:root { 
    --primary: #4F46E5; 
    --bg: #F3F4F6; 
    --card: #FFFFFF; 
    --text: #1F2937; 
    --success: #10B981; 
    --error: #EF4444; 
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    padding: 20px; 
    max-width: 800px; 
    margin: 0 auto; 
}

.card { 
    background: var(--card); 
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
}

h1, h2 { color: var(--primary); text-align: center; }

select, button { 
    width: 100%; padding: 12px; margin-top: 10px; border: 1px solid #D1D5DB; 
    border-radius: 8px; font-size: 16px; box-sizing: border-box; 
}
button { background-color: var(--primary); color: white; border: none; font-weight: bold; cursor: pointer; transition: 0.3s; }
button:hover { background-color: #4338CA; }
button.btn-secondary { background-color: #6B7280; margin-top: 15px; }
button.btn-secondary:hover { background-color: #4B5563; }

.question-block { 
    margin-bottom: 20px; padding: 15px; border-left: 4px solid var(--primary); 
    background: #F9FAFB; border-radius: 4px; font-size: 1.1em; line-height: 1.8;
}

/* TYPOGRAPHIE MATHÉMATIQUE - Correction des exposants */
sup {
    font-size: 0.65em;
    vertical-align: super;
    line-height: 0;
}

input[type="text"] {
    border: 2px solid #D1D5DB; border-radius: 6px; padding: 4px 8px;
    font-size: inherit; font-family: inherit; outline: none; transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--primary); }

.inline-input-small { width: 45px; text-align: center; }
.inline-input-medium { width: 85px; text-align: center; }
.inline-input-large { width: 130px; text-align: center; }
.inline-input-text { width: 100px; text-align: center; }

/* Champ ultra-réduit spécifique pour taper dans un exposant */
input.input-exposant {
    width: 40px;
    height: 1.5em;
    padding: 0px;
    font-size: 0.9em;
    text-align: center;
    border-radius: 4px;
    margin-left: 2px;
}

.fraction-container { display: inline-flex; align-items: center; vertical-align: middle; }
.fraction { display: inline-flex; flex-direction: column; align-items: center; margin: 0 8px; }
.fraction .num { border-bottom: 2px solid var(--text); width: 100%; text-align: center; padding-bottom: 2px; }
.fraction .den { padding-top: 4px; display: flex; align-items: baseline; }

.hidden { display: none !important; }
.feedback { margin-top: 10px; font-weight: bold; font-size: 0.95em; line-height: 1.4; padding: 5px; border-radius: 4px; }

/* Bilan et Médailles */
.bilan-item { padding: 10px; border-radius: 6px; margin-bottom: 10px; }
.bilan-ok { background-color: #D1FAE5; color: #065F46; }
.bilan-ko { background-color: #FEE2E2; color: #991B1B; }

.medal-container { text-align: center; margin: 20px 0; padding: 20px; border-radius: 12px; background: #FFFBEB; border: 2px solid #FCD34D; }
.medal-emoji { font-size: 5rem; margin-bottom: 10px; display: block; }
.medal-text { font-size: 1.5rem; font-weight: bold; color: #92400E; }
.fail-container { text-align: center; margin: 20px 0; padding: 20px; border-radius: 12px; background: #FEF2F2; border: 2px solid #FECACA; color: #991B1B; font-weight: bold; font-size: 1.2rem; }