/* =========================================================================
   Maths Plateforme : système de design (sans dépendance externe)
   Police Lexend (lisibilité), un bleu principal, un orange d'accent.
   ========================================================================= */

:root {
    --encre: #1d2142;
    --encre-2: #555a7a;
    --encre-3: #8a8ea9;
    --fond: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f2f4fa;
    --trait: #e4e7f1;
    --trait-fort: #cfd4e4;

    --primaire: #3a57d6;
    --primaire-fonce: #2c45b4;
    --primaire-clair: #e9eeff;
    --primaire-encre: #23379a;
    --accent: #f27a3f;
    --accent-clair: #fff0e7;
    --succes: #13a05a;
    --succes-clair: #e5f6ed;
    --succes-encre: #0b6b3c;
    --alerte: #d99a00;
    --alerte-clair: #fff6dc;
    --alerte-encre: #8a5b00;
    --danger: #dc3d43;
    --danger-clair: #fdeced;
    --danger-encre: #a1252a;
    --violet: #7a5af5;

    --rayon: 14px;
    --rayon-petit: 9px;
    --ombre: 0 1px 2px rgba(29, 33, 66, .06), 0 4px 14px -6px rgba(29, 33, 66, .12);
    --ombre-forte: 0 12px 32px -12px rgba(29, 33, 66, .28);
    --police: 'Lexend', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --largeur: 1180px;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--police); font-size: 16px; line-height: 1.55; color: var(--encre);
    background: var(--fond); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; color: var(--encre); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); letter-spacing: -.02em; }
h2 { font-size: 1.3rem; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
a { color: var(--primaire); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 3px solid rgba(58, 87, 214, .45); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* -------------------------------------------------------------- en-tête */
.barre {
    position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(160%) blur(8px); border-bottom: 1px solid var(--trait);
}
.barre-interieur {
    max-width: var(--largeur); margin: 0 auto; padding: .7rem 1.25rem;
    display: flex; align-items: center; gap: 1rem;
}
.logo { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; color: var(--encre); }
.logo:hover { text-decoration: none; }
.logo-marque {
    width: 2.1rem; height: 2.1rem; border-radius: 10px; display: grid; place-items: center; color: #fff;
    font-size: 1.15rem; background: linear-gradient(135deg, var(--primaire), var(--violet));
    box-shadow: 0 4px 10px -4px rgba(58, 87, 214, .7);
}
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav a, .nav-bouton {
    display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 10px;
    color: var(--encre-2); font-weight: 500; font-size: .95rem; white-space: nowrap;
}
.nav a:hover, .nav-bouton:hover { background: var(--surface-2); color: var(--encre); text-decoration: none; }
.nav a.actif { background: var(--primaire-clair); color: var(--primaire-encre); }
.nav a.btn-primaire, .nav a.btn-primaire:hover { color: #fff; background: var(--primaire); }
.nav a.btn-primaire:hover { background: var(--primaire-fonce); }
.nav svg { width: 1.1rem; height: 1.1rem; flex: none; }
.utilisateur { display: flex; align-items: center; gap: .6rem; padding-left: .75rem; margin-left: .5rem; border-left: 1px solid var(--trait); }
.avatar {
    width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: var(--accent-clair); color: #b4511f; font-weight: 600; font-size: .85rem;
}
.utilisateur-nom { font-size: .9rem; font-weight: 500; color: var(--encre); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-mobile { display: none; margin-left: auto; }
.menu-mobile summary {
    list-style: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 10px;
    border: 1px solid var(--trait); background: var(--surface); cursor: pointer;
}
.menu-mobile summary::-webkit-details-marker { display: none; }
.menu-mobile[open] .nav-mobile { display: flex; }
.nav-mobile {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: .25rem;
    background: var(--surface); border-bottom: 1px solid var(--trait); box-shadow: var(--ombre-forte); padding: .75rem 1rem 1rem;
}
.nav-mobile a, .nav-mobile .nav-bouton { padding: .75rem .9rem; border-radius: 10px; color: var(--encre); display: flex; align-items: center; gap: .6rem; }
.nav-mobile a:hover { background: var(--surface-2); text-decoration: none; }
.nav-mobile svg { width: 1.15rem; height: 1.15rem; }
@media (max-width: 860px) {
    .nav, .utilisateur { display: none; }
    .menu-mobile { display: block; }
}

/* ------------------------------------------------------------- mise en page */
.page { max-width: var(--largeur); margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.page-etroite { max-width: 760px; }
.page-moyenne { max-width: 980px; }
.entete-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.75rem; }
.entete-page .sous-titre { color: var(--encre-2); margin-top: .35rem; }
.fil { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .88rem; color: var(--encre-3); margin-bottom: .45rem; }
.fil a { color: var(--encre-2); }
.fil svg { width: .9rem; height: .9rem; }
.section { margin-top: 2rem; }
.section-titre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.section-titre h2 { display: flex; align-items: center; gap: .55rem; }
.section-titre h2 svg { width: 1.25rem; height: 1.25rem; color: var(--primaire); }
.pied { border-top: 1px solid var(--trait); color: var(--encre-3); font-size: .85rem; text-align: center; padding: 1.5rem 1rem 2rem; }

.grille { display: grid; gap: 1.1rem; }
.grille-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grille-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.grille-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.colonnes { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 960px) { .colonnes { grid-template-columns: 1fr; } }
.pile { display: flex; flex-direction: column; gap: .75rem; }
.pile-large { display: flex; flex-direction: column; gap: 1.25rem; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.entre { justify-content: space-between; }
.fin { justify-content: flex-end; }
.etire { flex: 1; min-width: 0; }

.texte-doux { color: var(--encre-2); }
.texte-pale { color: var(--encre-3); }
.petit { font-size: .88rem; }
.tres-petit { font-size: .78rem; }
.gras { font-weight: 600; }
.centre { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.25rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.chiffre { font-variant-numeric: tabular-nums; }
.code-acces { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 2rem; font-weight: 700; letter-spacing: .2em; color: var(--primaire); }

/* ---------------------------------------------------------------- cartes */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1.35rem; }
.carte-compacte { padding: 1rem 1.1rem; }
.carte-titre { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.carte-titre h2, .carte-titre h3 { display: flex; align-items: center; gap: .5rem; }
.carte-titre svg { width: 1.15rem; height: 1.15rem; color: var(--primaire); flex: none; }
.carte-lien { display: block; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.carte-lien:hover { text-decoration: none; border-color: #c7d0f3; box-shadow: var(--ombre-forte); transform: translateY(-2px); }
.carte-teinte { background: linear-gradient(135deg, #f3f6ff, #fbf9ff); border-color: #dfe5fb; }
.separateur { border: 0; border-top: 1px solid var(--trait); margin: 1.1rem 0; }

/* Carte de chapitre */
.chapitre-carte { display: flex; flex-direction: column; gap: .6rem; height: 100%; }
.chapitre-carte .numero {
    width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; font-weight: 700;
    background: var(--primaire-clair); color: var(--primaire-encre);
}
.chapitre-carte h3 { font-size: 1.1rem; }
.chapitre-carte .description { color: var(--encre-2); font-size: .92rem; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chapitre-carte .bas { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .7rem;
    border-top: 1px solid var(--trait); color: var(--primaire); font-weight: 600; font-size: .92rem; }
.chapitre-carte .bas svg { width: 1.1rem; height: 1.1rem; }

/* Tuiles de chiffres clés */
.tuile { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1rem 1.15rem; }
.tuile-libelle { display: flex; align-items: center; gap: .45rem; color: var(--encre-2); font-size: .88rem; }
.tuile-libelle svg { width: 1rem; height: 1rem; color: var(--encre-3); }
.tuile-valeur { font-size: 1.75rem; font-weight: 600; margin-top: .25rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tuile-valeur small { font-size: .95rem; color: var(--encre-3); font-weight: 500; }

/* ---------------------------------------------------------------- boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1.05rem;
    border-radius: 11px; font-weight: 600; font-size: .95rem; line-height: 1.2; border: 1px solid transparent;
    transition: background .15s, border-color .15s, box-shadow .15s, color .15s; white-space: nowrap; touch-action: manipulation;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 1.1rem; height: 1.1rem; flex: none; }
.btn-primaire { background: var(--primaire); color: #fff; box-shadow: 0 6px 14px -8px rgba(58, 87, 214, .9); }
.btn-primaire:hover { background: var(--primaire-fonce); }
.btn-secondaire { background: var(--surface); color: var(--encre); border-color: var(--trait-fort); }
.btn-secondaire:hover { background: var(--surface-2); }
.btn-doux { background: var(--primaire-clair); color: var(--primaire-encre); }
.btn-doux:hover { background: #dce4ff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #df6528; }
.btn-danger { background: var(--surface); color: var(--danger-encre); border-color: #f2c4c6; }
.btn-danger:hover { background: var(--danger-clair); }
.btn-lien { padding: .3rem .4rem; color: var(--primaire); font-weight: 500; }
.btn-lien:hover { text-decoration: underline; }
.btn-lien.discret { color: var(--encre-3); }
.btn-lien.discret:hover { color: var(--danger); }
.btn-petit { padding: .42rem .75rem; font-size: .86rem; border-radius: 9px; }
.btn-grand { padding: .85rem 1.4rem; font-size: 1.02rem; border-radius: 13px; }
.btn-plein { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- badges */
.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600; line-height: 1.3; white-space: nowrap; border: 1px solid transparent;
}
.badge svg { width: .85rem; height: .85rem; }
.badge-neutre { background: var(--surface-2); color: var(--encre-2); border-color: var(--trait); }
.badge-bleu { background: var(--primaire-clair); color: var(--primaire-encre); }
.badge-vert { background: var(--succes-clair); color: var(--succes-encre); }
.badge-orange { background: var(--alerte-clair); color: var(--alerte-encre); }
.badge-rouge { background: var(--danger-clair); color: var(--danger-encre); }
.badge-accent { background: var(--accent-clair); color: #a8471a; }
.etoiles { color: #e3a008; letter-spacing: .08em; font-size: .9rem; }

/* --------------------------------------------------------------- formulaires */
.champ { display: flex; flex-direction: column; gap: .35rem; }
.champ label, .libelle { font-weight: 600; font-size: .92rem; color: var(--encre); }
.champ .aide, .aide { color: var(--encre-3); font-size: .84rem; }
.champ .erreur, .erreur { color: var(--danger-encre); font-size: .86rem; }
.saisie, .champ input[type=text], .champ input[type=email], .champ input[type=password], .champ input[type=datetime-local],
.champ input[type=file], .champ select, .champ textarea, .formulaire-auto input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.formulaire-auto select, .formulaire-auto textarea {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--trait-fort); border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.saisie:focus, .champ input:focus, .champ select:focus, .champ textarea:focus,
.formulaire-auto input:focus, .formulaire-auto select:focus, .formulaire-auto textarea:focus {
    outline: none; border-color: var(--primaire); box-shadow: 0 0 0 3px rgba(58, 87, 214, .18);
}
.saisie-code { text-transform: uppercase; letter-spacing: .25em; font-weight: 600; text-align: center; }
.case { display: flex; align-items: flex-start; gap: .55rem; padding: .4rem .2rem; cursor: pointer; }
.case input { width: 1.05rem; height: 1.05rem; margin-top: .2rem; accent-color: var(--primaire); flex: none; }
.liste-cases { max-height: 20rem; overflow-y: auto; border: 1px solid var(--trait); border-radius: 12px; padding: .5rem .8rem; background: #fff; }
.groupe-saisie { display: flex; gap: .5rem; }
.groupe-saisie .saisie { flex: 1; }
.formulaire-auto p, .formulaire-auto > div { margin-bottom: .9rem; }
.formulaire-auto label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.formulaire-auto input[type=checkbox] + label, .formulaire-auto label:has(input[type=checkbox]) { display: inline; font-weight: 500; }
.formulaire-auto .errorlist { list-style: none; padding: 0; margin: .3rem 0; color: var(--danger-encre); font-size: .88rem; }
.formulaire-auto button[type=submit], .formulaire-auto button:not([type]) {
    width: 100%; margin-top: .3rem; padding: .75rem 1rem; border-radius: 11px; background: var(--primaire); color: #fff; font-weight: 600;
}
.formulaire-auto button[type=submit]:hover { background: var(--primaire-fonce); }

/* ---------------------------------------------------------------- tableaux */
.tableau-conteneur { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th {
    text-align: left; font-weight: 600; color: var(--encre-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    padding: .55rem .75rem; border-bottom: 1px solid var(--trait); white-space: nowrap;
}
.tableau td { padding: .75rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover td { background: #fafbff; }
.tableau .nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau .nom { font-weight: 600; color: var(--encre); }
.tableau .sous { display: block; color: var(--encre-3); font-size: .8rem; font-weight: 400; }
.tableau th:first-child, .tableau td:first-child { padding-left: 0; }
.tableau th:last-child, .tableau td:last-child { padding-right: 0; }

/* -------------------------------------------------------------- messages */
.alerte { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; border: 1px solid; font-size: .95rem; }
.alerte svg { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .1rem; }
.alerte-info { background: var(--primaire-clair); border-color: #d2dbfb; color: var(--primaire-encre); }
.alerte-succes { background: var(--succes-clair); border-color: #bfe8d1; color: var(--succes-encre); }
.alerte-alerte { background: var(--alerte-clair); border-color: #f5e0a3; color: var(--alerte-encre); }
.alerte-erreur { background: var(--danger-clair); border-color: #f5c6c8; color: var(--danger-encre); }
.messages { max-width: var(--largeur); margin: 1.25rem auto 0; padding: 0 1.25rem; display: flex; flex-direction: column; gap: .5rem; }

/* États vides */
.vide { text-align: center; padding: 2.5rem 1rem; color: var(--encre-2); }
.vide-icone { width: 3.5rem; height: 3.5rem; border-radius: 16px; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--encre-3); margin-bottom: .9rem; }
.vide-icone svg { width: 1.6rem; height: 1.6rem; }
.vide h3 { margin-bottom: .35rem; }

/* Barre de progression */
.progression { height: .5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progression > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primaire), var(--violet)); border-radius: 999px; }

/* Devoirs (élève) */
.devoir-carte { display: flex; flex-direction: column; gap: .55rem; border-left: 4px solid var(--alerte); }
.devoir-carte.en-retard { border-left-color: var(--danger); }
.devoir-carte h3 { font-size: 1.05rem; }
.date-limite { display: inline-flex; align-items: center; gap: .35rem; color: var(--encre-2); font-size: .9rem; }
.date-limite svg { width: 1rem; height: 1rem; }
.en-retard .date-limite { color: var(--danger-encre); font-weight: 600; }

/* Héros (accueil élève) */
.heros {
    position: relative; overflow: hidden; border-radius: 20px; padding: 1.75rem; color: #fff;
    background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(135deg, #3a57d6 0%, #6a4fe6 100%);
    box-shadow: 0 18px 40px -22px rgba(58, 87, 214, .9);
}
.heros h1 { color: #fff; }
.heros p { color: rgba(255, 255, 255, .85); }
.heros-motif { position: absolute; right: -1rem; bottom: -2.5rem; font-size: 9rem; line-height: 1; opacity: .12; font-weight: 700; pointer-events: none; }
.heros .rejoindre { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.1rem; }
.heros .rejoindre .saisie { max-width: 11rem; background: rgba(255,255,255,.95); border-color: transparent; }
.heros .btn-blanc { background: #fff; color: var(--primaire-encre); }
.heros .btn-blanc:hover { background: #eef1ff; }
.pastille { display: inline-flex; align-items: center; gap: .35rem; background: rgba(255,255,255,.18); color: #fff; padding: .25rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 500; }

/* Onglets de niveau / filtres */
.puces { display: flex; flex-wrap: wrap; gap: .4rem; }
.puce { padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--trait); color: var(--encre-2); font-size: .88rem; font-weight: 500; }
.puce:hover { border-color: var(--primaire); color: var(--primaire); text-decoration: none; }

/* --------------------------------------------------------- connexion */
.connexion { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 2rem 1rem; }
.connexion-carte { width: 100%; max-width: 440px; }
.connexion-entete { text-align: center; margin-bottom: 1.5rem; }
.connexion-entete .logo-marque { width: 3.2rem; height: 3.2rem; font-size: 1.6rem; border-radius: 15px; margin: 0 auto .9rem; }
.btn-google { width: 100%; background: #fff; border: 1px solid var(--trait-fort); color: var(--encre); padding: .75rem 1rem; }
.btn-google:hover { background: var(--surface-2); }
.ou { display: flex; align-items: center; gap: .75rem; color: var(--encre-3); font-size: .85rem; margin: 1.25rem 0; }
.ou::before, .ou::after { content: ''; flex: 1; height: 1px; background: var(--trait); }

/* --------------------------------------------------------- page chapitre */
.chapitre-entete { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.chapitre-entete .numero-grand {
    width: 3.4rem; height: 3.4rem; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--primaire), var(--violet)); flex: none;
}
.onglets {
    display: flex; gap: .3rem; padding: .3rem; background: var(--surface); border: 1px solid var(--trait); border-radius: 14px;
    box-shadow: var(--ombre); position: sticky; top: 4.1rem; z-index: 20; overflow-x: auto; margin-bottom: 1.25rem; scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }
.tab-btn {
    flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .65rem 1rem;
    border-radius: 10px; color: var(--encre-2); font-weight: 600; font-size: .93rem; white-space: nowrap; transition: background .15s, color .15s;
}
.tab-btn svg { width: 1.05rem; height: 1.05rem; }
.tab-btn:hover { background: var(--surface-2); color: var(--encre); }
.tab-btn.active { background: var(--primaire); color: #fff; box-shadow: 0 6px 14px -8px rgba(58, 87, 214, .9); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: apparaitre .3s ease both; }
@keyframes apparaitre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panneau { background: var(--surface); border: 1px solid var(--trait); border-radius: 18px; box-shadow: var(--ombre); padding: clamp(1.1rem, 2.5vw, 2rem); }
.panneau-titre { display: flex; align-items: center; gap: .55rem; margin-bottom: 1.25rem; }
.panneau-titre svg { width: 1.3rem; height: 1.3rem; color: var(--primaire); }
.bloc-exo { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.2rem; position: relative; }
.bloc-exo-tete { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.bloc-exo-tete .titre { font-weight: 600; }
.bloc-probleme { background: #f7f9ff; border: 1px solid #dfe6fb; border-radius: var(--rayon); padding: 1.3rem; }
.option-qcm { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--trait-fort); border-radius: 10px; cursor: pointer; background: #fff; }
.option-qcm:hover { border-color: var(--primaire); }
.option-qcm input { accent-color: var(--primaire); width: 1.05rem; height: 1.05rem; }
.exercise-feedback { display: none; margin-top: .75rem; padding: .7rem .9rem; border-radius: 10px; font-weight: 500; font-size: .95rem; }
.exercise-feedback.correct { display: block; background: var(--succes-clair); color: var(--succes-encre); border: 1px solid #bfe8d1; }
.exercise-feedback.incorrect { display: block; background: var(--danger-clair); color: var(--danger-encre); border: 1px solid #f5c6c8; }
.input-correct { border-color: var(--succes) !important; box-shadow: 0 0 0 3px rgba(19, 160, 90, .18) !important; }
.input-incorrect { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(220, 61, 67, .16) !important; }
.correction-box { display: none; margin-top: .9rem; padding: .9rem 1rem; border-left: 4px solid var(--encre-2); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .95rem; }
.bandeau-devoir { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.1rem;
    border-radius: var(--rayon); background: var(--alerte-clair); border: 1px solid #f3dc97; color: var(--alerte-encre); margin-bottom: 1.25rem; }
.bandeau-devoir strong { color: #6b4500; }

/* Tâche complexe */
.path-container { min-height: 110px; background: var(--surface-2); border: 2px dashed var(--trait-fort); border-radius: 14px; padding: 1rem;
    display: flex; flex-wrap: wrap; gap: .9rem; justify-content: center; align-items: center; }
.path-slot { width: 160px; height: 90px; border: 2px dashed var(--encre-3); border-radius: 12px; display: flex; align-items: center; justify-content: center; transition: background .2s; cursor: pointer; }
.path-slot.drag-over, .path-slot.cible { background: var(--primaire-clair); border-color: var(--primaire); }
.game-card { width: 150px; height: 80px; padding: 0 .5rem; text-align: center; background: #fff; border: 2px solid var(--trait-fort); border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--ombre); cursor: pointer; user-select: none;
    touch-action: manipulation; transition: transform .15s, box-shadow .15s; }
.game-card.selectionnee { border-color: var(--primaire); box-shadow: 0 0 0 4px rgba(58, 87, 214, .25); transform: scale(1.04); }
.game-card.fixe { cursor: default; }
.game-card.card-start { background: var(--succes-clair); border-color: var(--succes); }
.game-card.card-end { background: var(--primaire-clair); border-color: var(--primaire); }
.game-card.juste { border-color: var(--succes); background: #f2fbf6; }
.game-card.faux { border-color: var(--danger); background: #fff5f5; }

/* Aide à la rédaction des cours */
.code-bloc { background: #151935; color: #e6e9ff; font-family: ui-monospace, Menlo, monospace; font-size: .84rem; line-height: 1.6;
    border-radius: 12px; padding: 1rem; overflow-x: auto; white-space: pre-wrap; margin: 0; }

/* Pages d'authentification d'allauth (inscription, mot de passe oublié...) */
.auth-page #contenu { max-width: 480px; margin: 2rem auto 4rem; background: var(--surface); border: 1px solid var(--trait);
    border-radius: 18px; box-shadow: var(--ombre); padding: 2rem; }
.auth-page #contenu h1 { font-size: 1.6rem; margin-bottom: .75rem; }
.auth-page #contenu p { color: var(--encre-2); margin-bottom: .8rem; }
.auth-page #contenu form { margin-top: 1rem; }
.auth-page #contenu form p { margin-bottom: .9rem; }
.auth-page #contenu label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; color: var(--encre); }
.auth-page #contenu input:not([type=checkbox]):not([type=hidden]) {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--trait-fort); border-radius: 10px; background: #fff; }
.auth-page #contenu input:focus { outline: none; border-color: var(--primaire); box-shadow: 0 0 0 3px rgba(58, 87, 214, .18); }
.auth-page #contenu input[type=checkbox] + label { display: inline; font-weight: 500; }
.auth-page #contenu button { width: 100%; padding: .75rem 1rem; border-radius: 11px; background: var(--primaire); color: #fff; font-weight: 600; margin-top: .4rem; }
.auth-page #contenu button:hover { background: var(--primaire-fonce); }
.auth-page #contenu .errorlist { list-style: none; padding: 0; color: var(--danger-encre); font-size: .88rem; margin: .3rem 0; }
.auth-page #contenu hr { border: 0; border-top: 1px solid var(--trait); margin: 1.5rem 0; }

@media (max-width: 640px) {
    .page { padding: 1.25rem 1rem 3rem; }
    .carte { padding: 1.1rem; }
    .tableau-conteneur { margin: 0 -1.1rem; padding: 0 1.1rem; }
    .heros { padding: 1.35rem; }
    .entete-page { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.icone { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }

/* Cartes de classe (professeur) */
.classe-carte { display: flex; flex-direction: column; gap: .5rem; }
.classe-carte h2 { font-size: 1.5rem; margin-top: .3rem; }
.classe-pastille { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; background: var(--accent-clair); color: #c45a26; }
.classe-pastille svg { width: 1.3rem; height: 1.3rem; }
.classe-chiffres { display: flex; flex-wrap: wrap; gap: 1rem; padding-top: .75rem; margin-top: .3rem; border-top: 1px solid var(--trait); color: var(--encre-2); font-size: .9rem; }
.classe-chiffres span { display: inline-flex; align-items: center; gap: .35rem; }
.classe-chiffres svg { width: 1rem; height: 1rem; color: var(--encre-3); }

/* Divers (tableaux de bord professeur) */
.avatar-petit { width: 2rem; height: 2rem; font-size: .75rem; background: var(--primaire-clair); color: var(--primaire-encre); }
.graphique { position: relative; height: 16rem; }
.liste-simple { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.liste-simple li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--trait); }
.liste-simple li:last-child { border-bottom: 0; }
.depot { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.1rem; border: 2px dashed var(--trait-fort); border-radius: 12px;
    background: var(--surface-2); color: var(--encre-2); font-size: .9rem; text-align: center; cursor: pointer; }
.depot:hover { border-color: var(--primaire); color: var(--primaire); }
.depot svg { width: 1.4rem; height: 1.4rem; }
.depot input { font-size: .8rem; max-width: 100%; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .86em; background: var(--surface-2); border: 1px solid var(--trait); padding: .05rem .35rem; border-radius: 6px; }
.avatar-grand { width: 3.4rem; height: 3.4rem; font-size: 1.15rem; background: var(--primaire-clair); color: var(--primaire-encre); }
.carte-succes { background: var(--succes-clair); border-color: #bfe8d1; }
.carte-succes .carte-titre svg { color: var(--succes); }
.liste-cases-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); column-gap: 1rem; }
.case:hover { background: var(--surface-2); border-radius: 8px; }
.aide svg { width: 1rem; height: 1rem; vertical-align: -.15em; color: var(--accent); }
textarea.saisie { resize: vertical; }
.liste-exos { list-style: none; counter-reset: exo; margin: 0; padding: 0; }
.liste-exos li { counter-increment: exo; display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--trait); font-size: .95rem; }
.liste-exos li:last-child { border-bottom: 0; }
.liste-exos li::before { content: counter(exo); width: 1.7rem; height: 1.7rem; border-radius: 8px; display: grid; place-items: center; flex: none;
    background: var(--surface-2); color: var(--encre-2); font-size: .8rem; font-weight: 600; }

/* Page chapitre : compléments */
.bloc-exo-marque { border-left: 4px solid var(--primaire); }
.niveau-difficulte { display: flex; align-items: center; gap: .5rem; margin: 1.5rem 0 .8rem; font-size: 1rem; }
.path-container.reserve { background: #fff; border-color: var(--trait-fort); }
.carte-jeu-titre { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--encre-3); margin-bottom: .2rem; }
.carte-jeu-ligne { font-size: .9rem; color: var(--encre-2); }
.carte-jeu-fleche { margin: 0 .3rem; color: var(--trait-fort); }
.carte-jeu-valeur { font-weight: 700; font-size: 1.1rem; color: var(--primaire); }
.jeu-retour { min-height: 1.8rem; margin-top: 1rem; text-align: center; font-weight: 600; font-size: 1.05rem; }
.jeu-retour.correct { color: var(--succes-encre); }
.jeu-retour.incorrect { color: var(--danger-encre); }
.bandeau-devoir svg { width: 1.1rem; height: 1.1rem; vertical-align: -.2em; }
.bloc-exo .enonce input[type=checkbox] { accent-color: var(--primaire); }
.code-bloc code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.apercu-cours { border: 1px solid var(--trait); border-radius: 12px; padding: 1rem; }
.connexion-entete .logo-marque svg { width: 1.5rem; height: 1.5rem; }
.champ label.case { font-weight: 400; font-size: .94rem; }
.carte-titre .btn svg, .section-titre .btn svg { color: inherit; width: 1.05rem; height: 1.05rem; }
