/* =========================================================================
   HexaMathica — feuille de style de base (Phase 0)
   Palette « ardoise » (slate) + une couleur d'accent par bloc.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Polices de l'interface — AUTO-HÉBERGÉES (comme OpenDyslexic plus bas).
   Elles arrivaient de fonts.googleapis.com : deux requêtes bloquantes vers un
   tiers, souvent filtrées par le proxy d'un collège (l'interface retombait
   alors sur une police système), et transmettant au passage l'adresse IP
   d'élèves mineurs. Les fichiers sont désormais dans assets/fonts/.

   Ce sont des polices VARIABLES : un seul fichier couvre toute la plage de
   graisses, d'où le « font-weight: 400 700 » plutôt qu'une déclaration par
   graisse. Google servait d'ailleurs le MÊME fichier pour les quatre graisses
   d'Inter — quatre téléchargements pour un seul contenu.

   Les deux sous-ensembles latin / latin-ext suffisent au français ; les blocs
   cyrillique, grec et vietnamien ne sont pas repris. Le navigateur ne charge
   « -ext » que s'il rencontre un caractère de sa plage (unicode-range) : une
   page ordinaire ne télécharge donc que 71 Ko de polices.

   Déclarations placées en TÊTE de fichier volontairement : le chargement des
   polices démarre dès l'analyse des premières lignes, pas après 1900 règles.
   ------------------------------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-var.woff2') format('woff2');
    font-weight: 400 700; font-style: normal; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-var-ext.woff2') format('woff2');
    font-weight: 400 700; font-style: normal; font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-var.woff2') format('woff2');
    font-weight: 500 700; font-style: normal; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-var-ext.woff2') format('woff2');
    font-weight: 500 700; font-style: normal; font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --bg:        var(--slate-100);
    --card:      #ffffff;
    --text:      var(--slate-800);
    --muted:     var(--slate-500);
    --border:    var(--slate-200);
    --primary:   #4f46e5;
    --primary-d: #4338ca;

    /* Accents par bloc */
    --acc-doc-1:     #f59e0b; --acc-doc-2:     #d97706;
    --acc-cours-1:   #10b981; --acc-cours-2:   #059669;
    --acc-cahier-1:  #8b5cf6; --acc-cahier-2:  #7c3aed;
    --acc-estrade-1: #06b6d4; --acc-estrade-2: #0891b2;
    --acc-flash-1:   #facc15; --acc-flash-2:   #eab308;
    --acc-ggb-1:     #34d399; --acc-ggb-2:     #0d9488;
    --acc-alea-1:    #a78bfa; --acc-alea-2:    #7c3aed;

    --radius:   14px;
    --shadow:   0 1px 2px rgba(15,23,42,.06), 0 6px 20px rgba(15,23,42,.06);
    --maxw:     960px;

    --font-sans:    'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

h1, h2, h3, .brand__name, .home__title, .hexmenu text { font-family: var(--font-display); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Barre supérieure --------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 12px 20px;
    background: var(--slate-900); color: #fff;
    transition: margin-top .28s ease, opacity .22s ease;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand__name { font-size: 1.15rem; letter-spacing: .2px; font-weight: 500; }
.brand__name strong { font-weight: 800; }
.logo { display: block; }

/* Téléphone : le nom du site quitte les BANDEAUX, faute de place — le reste de la barre
   (séance, réseau, profil, Déconnexion côté prof ; cloche, prénom, Quitter côté élève)
   déborde sinon de l'écran. Le texte n'est pas supprimé mais rendu invisible à l'œil
   seul : le logo étant `aria-hidden`, il est le seul à nommer le lien pour un lecteur
   d'écran. Deux conditions : écran étroit (portrait) OU écran bas (téléphone couché) —
   la seconde évite que le nom revienne sur les pages passées en paysage imposé.
   La page de connexion (.auth-brand) garde le sien : c'est un titre, pas un bandeau. */
@media (max-width: 620px), (max-height: 500px) and (orientation: landscape) {
    .topbar .brand__name,
    .public-topbar .brand__name,
    .eleve-top__name {
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        border: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%);
    }
}
.topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__user { color: var(--slate-300); font-size: .92rem; }
.inline-form { margin: 0; }

/* ---- Conteneur / pied --------------------------------------------------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 56px; }
/* Pages-outils à deux volets (bodyClass « is-wide », posé par le contrôleur) : la
   colonne de lecture de 960 px convient à du contenu, pas à un éditeur flanqué de son
   aperçu — l'un et l'autre s'y retrouvaient à l'étroit. Aucune page de contenu ne doit
   la prendre : c'est une largeur d'ATELIER, pas de lecture. */
body.is-wide .container { max-width: 1320px; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; }

/* ---- Boutons ------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 16px; border-radius: 10px;
    border: 1px solid transparent; font: inherit; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-d); color: #fff; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn--ghost:hover { background: rgba(255,255,255,.12); }
.btn--block { width: 100%; }

/* ---- Alertes ------------------------------------------------------------ */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; font-size: .94rem; border: 1px solid; }
.alert--error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }

/* ---- Accueil / nid d'abeille ------------------------------------------- */
.home { position: relative; padding-top: 12px; }
.home::before { content: ''; position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%);
    width: 600px; height: 600px; max-width: 96vw; pointer-events: none; z-index: 0;
    background: radial-gradient(circle, rgba(99,102,241,.14), rgba(99,102,241,0) 66%); }
.home > * { position: relative; z-index: 1; }
.home__head { text-align: center; margin-bottom: 30px; }
.home__title { font-size: 2.3rem; font-weight: 700; margin: 0 0 8px; color: var(--slate-900); letter-spacing: -.5px; }
.home__subtitle { margin: 0; color: var(--muted); font-size: 1.02rem; }

.honeycomb {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 230px));
    justify-content: center;
    column-gap: 26px; row-gap: 22px;
    margin: 28px auto 8px;
    padding-bottom: 56px; /* place pour le décalage des hexagones de droite */
}

.hex {
    --hex-w: 230px;
    position: relative;
    width: var(--hex-w);
    height: calc(var(--hex-w) * 1.1547);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    color: #fff;
    transform: translateY(0);
    transition: transform .16s ease, filter .16s ease;
    filter: drop-shadow(0 6px 10px rgba(15,23,42,.18));
}
.honeycomb .hex:nth-child(2n) { transform: translateY(48px); }
.hex:hover { filter: drop-shadow(0 14px 20px rgba(15,23,42,.30)); text-decoration: none; }
.hex:nth-child(odd):hover { transform: translateY(-4px); }
.hex:nth-child(2n):hover  { transform: translateY(44px); }

.hex--doc     { background: linear-gradient(150deg, var(--acc-doc-1), var(--acc-doc-2)); }
.hex--cours   { background: linear-gradient(150deg, var(--acc-cours-1), var(--acc-cours-2)); }
.hex--cahier  { background: linear-gradient(150deg, var(--acc-cahier-1), var(--acc-cahier-2)); }
.hex--estrade { background: linear-gradient(150deg, var(--acc-estrade-1), var(--acc-estrade-2)); }

.hex__inner {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 0 26px; gap: 6px;
}
.hex__icon { width: 38px; height: 38px; opacity: .95; }
.hex__title { font-size: 1.12rem; font-weight: 800; }
.hex__role { font-size: .8rem; opacity: .92; max-width: 16ch; }
.hex__badge {
    margin-top: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
    background: rgba(255,255,255,.22);
}

.home__note { text-align: center; color: var(--muted); font-size: .9rem; max-width: 56ch; margin: 18px auto 0; }

/* Menu d'accueil : hexagone régulier divisé en 6 triangles équilatéraux */
.hexmenu { display: block; width: 100%; max-width: 480px; margin: 6px auto 6px;
    filter: drop-shadow(0 18px 38px rgba(15,23,42,.22)); }
.hexmenu .wedge { cursor: pointer; transform-box: view-box; transform-origin: 220px 220px; transition: transform .2s ease; }
.hexmenu .wedge path { stroke: #fff; stroke-width: 4; stroke-linejoin: round; transition: filter .2s ease; }
.hexmenu .wedge:hover { transform: scale(1.02); }
.hexmenu .wedge:hover path, .hexmenu .wedge:focus-visible path { filter: brightness(1.1); }
.hexmenu .wedge--soon { opacity: .92; }
/* Part ÉTEINTE par l'enseignant (cahier de texte neutralisé, migration 075) : elle garde sa
   place dans l'hexagone mais se voit inactive — gris délavé, texte en retrait, aucune
   réaction au survol. « À venir » (wedge--soon) reste, lui, à sa couleur : il annonce
   quelque chose qui arrive ; celle-ci annonce quelque chose qui ne sert pas. */
.hexmenu .wedge--off { cursor: default; }
.hexmenu .wedge--off path { fill: var(--slate-300, #cbd5e1); }
.hexmenu .wedge--off text { fill: var(--slate-500, #64748b); }
.hexmenu .wedge--off:hover { transform: none; }
.hexmenu .wedge--off:hover path { filter: none; }
.hexmenu .wedge:focus { outline: none; }
.hexmenu .wedge:focus-visible path { filter: brightness(1.1); stroke-width: 6; }
.hexmenu text { fill: #fff; font-weight: 600; font-size: 19px; letter-spacing: .3px; }
.hexmenu a { text-decoration: none; -webkit-tap-highlight-color: transparent; }

/* Parts dépliantes (« Jeux », « Gestion ») : liste qui sort le long de l'arête de la part
   (survol ou clic, cf. app.js).
   Le cadre du SVG (viewBox 440×440, ratio 1:1) sert de repère : les pastilles sont placées
   en % de ce cadre, à ~17 unités en dehors de l'arête, dont elles suivent la pente (chaque
   ligne descend de 37 unités et recule de 20,5 → 8,41 % et 4,66 % de 440).
   « Jeux » longe l'arête haut-gauche vers la gauche, « Gestion » l'arête bas-droite vers la
   droite : deux jeux de coordonnées, une seule mécanique. */
.hexmenu-wrap { position: relative; width: 100%; max-width: 480px; margin: 6px auto; }
.hexmenu-wrap .hexmenu { margin: 0; }
/* La part allumée est celle dont la liste est sortie : l'état vit sur le déclencheur
   (aria-expanded), sinon les DEUX parts dépliantes s'allumeraient ensemble. */
.hexmenu .wedge--menu[aria-expanded="true"] path { filter: brightness(1.1); }
/* Les pastilles « Jeux » sortent vers la GAUCHE, donc par-dessus la colonne du pense-bête
   (.todo, dès 1024 px) : il faut que le menu ouvert passe devant. « .home > * » enferme
   le menu dans un contexte d'empilement, c'est donc lui qu'on remonte. */
.hexmenu-wrap.is-open { z-index: 41; }

.hexfly {
    position: absolute; inset: 0; z-index: 3; margin: 0; padding: 0; list-style: none; pointer-events: none;
    /* Couleur de la part + sens de sortie (les pastilles arrivent depuis l'hexagone). */
    --fly: #db2777; --fly-fonce: #be185d; --fly-ombre: rgba(219,39,119,.34);
    --fly-in: 24px; --fly-dx: -4px;
    /* Position de la PREMIÈRE pastille et pas entre deux pastilles, le long de l'arête.
       Le pas est une variable, et non un nombre écrit en dur, parce que le nombre
       d'entrées change : partials/hexmenu_fly.php le recalcule pour que la DERNIÈRE
       pastille tombe toujours au bout de l'arête, quel qu'en soit le nombre. Avant cela,
       une cinquième entrée sortait du cadre — le module Python n'aurait pas pu entrer
       dans « Jeux & Exercices » sans déborder. */
    --fly-y0: 14.3%; --fly-x0: 79.8%; --fly-py: 8.41%; --fly-px: 4.66%;
}
.hexfly--gestion {
    --fly: #7c3aed; --fly-fonce: #6d28d9; --fly-ombre: rgba(124,58,237,.34);
    --fly-in: -24px; --fly-dx: 4px;
    --fly-y0: 54.6%; --fly-x0: 97.8%;
}
.hexfly__item {
    position: absolute; width: 44%;
    opacity: 0; visibility: hidden; transform: translate(var(--fly-in), -50%) scale(.96);
    transition: opacity .2s ease, transform .26s cubic-bezier(.22,.9,.3,1.2), visibility .26s;
}
.hexfly--jeux .hexfly__item {
    top: calc(var(--fly-y0) + var(--i) * var(--fly-py));
    right: calc(var(--fly-x0) + var(--i) * var(--fly-px));
}
.hexfly--gestion .hexfly__item {
    top: calc(var(--fly-y0) + var(--i) * var(--fly-py));
    left: calc(var(--fly-x0) - var(--i) * var(--fly-px));
}
.hexfly.is-open .hexfly__item {
    opacity: 1; visibility: visible; transform: translate(0, -50%) scale(1);
    transition-delay: calc(var(--i) * 60ms);     /* les pastilles sortent l'une après l'autre */
}
.hexfly__btn {
    pointer-events: auto; display: block; text-align: center; white-space: nowrap;
    padding: 9px 18px; border-radius: 11px; background: var(--fly); color: #fff; text-decoration: none;
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: .2px;
    box-shadow: 0 8px 20px var(--fly-ombre);
    transition: background .15s ease, transform .15s ease;
}
a.hexfly__btn:hover { background: var(--fly-fonce); transform: translateX(var(--fly-dx)); }
a.hexfly__btn:focus-visible { background: var(--fly-fonce); outline: none;
    box-shadow: 0 0 0 3px var(--fly-ombre), 0 8px 20px var(--fly-ombre); }
.hexfly__item--ghost .hexfly__btn { background: rgba(219,39,119,.62); letter-spacing: .22em; cursor: default; }

/* Écran étroit : pas la place pour la diagonale (les pastilles débordent de 181 px à gauche
   du cadre de 480 px) → la liste se pose sous l'hexagone. */
@media (max-width: 900px) {
    .hexfly { position: static; display: none; flex-direction: column; align-items: center;
        gap: 9px; max-width: 300px; margin: 2px auto 8px; }
    .hexfly.is-open { display: flex; }
    .hexfly__item, .hexfly--jeux .hexfly__item, .hexfly--gestion .hexfly__item {
        position: static; width: 100%; opacity: 1; visibility: visible; transform: none; }
    .hexfly.is-open .hexfly__item { transform: none;
        animation: hexfly-in .24s ease both; animation-delay: calc(var(--i) * 55ms); }
}
@keyframes hexfly-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Part « Documents » (accueil élève) : son arête est le HAUT, HORIZONTAL, de l'hexagone. Les deux
   pastilles s'y posent côte à côte, de part et d'autre de l'axe, et montent depuis l'hexagone —
   le chemin de la souris reste dans la part, sans traverser « Jeux & Exercices » (qui, survolée,
   refermerait la liste). Largeur libre : la première porte le nom du professeur.
   Écran étroit : rien de propre, la file générique sous l'hexagone s'applique. */
.hexfly--docs { --fly: #d97706; --fly-fonce: #b45309; --fly-ombre: rgba(217,119,6,.34); --fly-dx: 0px; }
@media (min-width: 901px) {
    .hexfly--docs .hexfly__item { top: 4.2%; width: auto; max-width: 64%;
        transform: translate(0, calc(-50% + 16px)) scale(.96); }
    .hexfly--docs .hexfly__item:nth-child(1) { right: calc(50% + 5px); }
    .hexfly--docs .hexfly__item:nth-child(2) { left: calc(50% + 5px); }
    .hexfly--docs.is-open .hexfly__item { transform: translate(0, -50%) scale(1); }
    .hexfly--docs .hexfly__btn { overflow: hidden; text-overflow: ellipsis; }
}

/* ---- TO DO LIST (pense-bête personnel, accueil enseignant) -------------- */
.todo {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-width: 340px; margin: 0 auto 22px; overflow: hidden;
    font-size: .92rem;
}
/* Écran large : la colonne de gauche (.home__rail — ressources de la séance en cours,
   puis le pense-bête) se cale dans la gouttière GAUCHE, hors du flux — la recherche et le
   menu hexagonal gardent ainsi le centre de la page, exactement comme si elle n'était pas là.
   Le seuil se calcule sur le contenu VISIBLE, pas sur le cadre : le plus large est la
   barre de recherche (520 px), centrée. La colonne occupe 20→300 px ; pour qu'elle ne la
   touche pas il faut (largeur − 520) / 2 > 300, soit environ 1 150 px. On prend 1 200 px,
   ce qui laisse 40 px de respiration.
   En dessous, elle reprend sa place au-dessus du menu, centrée et pleine largeur. */
.home__rail { margin-bottom: 22px; }
@media (min-width: 1200px) {
    .home__rail {
        position: fixed; left: 20px; top: 78px;
        width: 280px; margin: 0; z-index: 40;
        /* Filet de sécurité : deux panneaux pleins ne débordent pas de l'écran. Chacun
           borne d'abord SA propre liste (voir .sres__list et .todo__body), pour que la
           barre de défilement de la colonne reste l'exception. */
        max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin;
    }
    .home__rail .sres, .home__rail .todo { width: 100%; max-width: none; margin: 0 0 12px; }
    .home__rail > :last-child { margin-bottom: 0; }
}

.todo__head { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.todo__toggle {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
    background: none; border: 0; cursor: pointer; color: var(--slate-800);
    font-family: var(--font-display); font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; font-size: .9rem; padding: 12px 8px;
}
.todo__caret {
    width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 7px solid var(--primary); transition: transform .2s ease;
}
.todo.is-collapsed .todo__caret { transform: rotate(-90deg); }
.todo__bell {
    flex: none; background: none; border: 0; cursor: pointer; color: var(--slate-400);
    padding: 8px; margin-right: 4px; border-radius: 8px; display: inline-flex;
}
.todo__bell svg { width: 18px; height: 18px; }
.todo__bell:hover { background: var(--slate-100); color: var(--slate-600); }
.todo__bell.is-on { color: var(--primary); }
.todo__bell.is-denied { color: #dc2626; }
.todo__bell.is-unsupported { display: none; }

.todo__body { padding: 10px 10px 12px; max-height: min(62vh, 520px); overflow: auto; }
.todo.is-collapsed .todo__body { display: none; }

.todo__list { margin: 0; padding: 0 0 0 24px; list-style: decimal; }
.todo__list li::marker { color: var(--slate-400); font-size: .82em; font-weight: 700; }

.todo-item { position: relative; display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.todo-item.is-dragging { opacity: .55; }
.todo-item__grip {
    flex: none; cursor: grab; touch-action: none; background: none; border: 0;
    color: var(--slate-300); padding: 0 1px; font-size: .9rem; line-height: 1;
}
.todo-item__grip:active { cursor: grabbing; }
.todo-item__check { flex: none; width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.todo-item__text {
    flex: 1; min-width: 0; outline: none; border-radius: 5px; padding: 2px 4px;
    word-break: break-word;
}
.todo-item__text:focus { background: var(--slate-100); box-shadow: 0 0 0 1px var(--slate-200) inset; }
.todo-item.is-done .todo-item__text { text-decoration: line-through; color: var(--muted); }

.todo-item__tools { flex: none; display: inline-flex; align-items: center; gap: 1px; }
.todo-item__pin, .todo-item__del {
    background: none; border: 0; cursor: pointer; color: var(--slate-300);
    padding: 2px 3px; font-size: .95rem; line-height: 1; border-radius: 5px;
}
.todo-item__pin:hover { background: var(--slate-100); color: #d97706; }
.todo-item__pin.is-on { color: #f59e0b; }
.todo-item.is-pinned { background: linear-gradient(90deg, rgba(245,158,11,.10), transparent 60%); border-radius: 6px; }
.todo-item__del:hover { background: #fef2f2; color: #dc2626; }

/* Échéance compacte : icône calendrier au repos, date lisible dès qu'elle est posée.
   La largeur de la ligne est FIGÉE, et c'est l'essentiel : dans la colonne de gauche
   (280 px), une ligne ne dispose que de 234 px, dont 98 px déjà pris par ⚑, l'échéance et
   ×. Ouvrir le champ DANS la ligne — ce que faisait le survol — ne laissait qu'une
   trentaine de pixels au libellé, qui tombait à un caractère par ligne et faisait enfler la
   ligne jusqu'à un demi-écran de haut. Le survol ne révèle donc plus que le cadre du champ ;
   c'est le focus, geste délibéré, qui l'ouvre, et il le fait sur SA PROPRE bande sous la
   tâche, où il prend toute la largeur du panneau sans rien retirer au libellé.
   La largeur est portée par le LABEL, pas par le champ : elle reste réservée quand le champ
   s'en détache pour s'ouvrir, sinon ⚑ et × glisseraient à chaque clic. */
.todo-item__date { flex: none; display: inline-flex; align-items: center; width: 20px; }
.todo-item__date.is-set { width: 64px; }
.todo-item__date input[type=date] {
    font: inherit; font-size: .74rem; color: transparent; background: none;
    border: 1px solid transparent; border-radius: 6px; padding: 1px; width: 100%;
    cursor: pointer; color-scheme: light;
    transition: border-color .12s ease, color .12s ease;
}
.todo-item__date input::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
.todo-item__date.is-set input { color: var(--muted); }
.todo-item__date.is-today input { color: #d97706; font-weight: 700; }
.todo-item__date.is-late  input { color: #dc2626; font-weight: 700; }
.todo-item:hover .todo-item__date input { border-color: var(--border); }
.todo-item:hover .todo-item__date:not(.is-set) input { color: var(--muted); }
.todo-item__date input:focus {
    position: absolute; left: 2px; right: 2px; bottom: 3px; z-index: 2; width: auto;
    padding: 2px 6px; color: var(--text); font-weight: 400;
    border-color: var(--primary); background: var(--card);
}
/* La bande n'existe que pendant la saisie — la réserver en permanence coûterait 27 px par
   tâche. Sans :has(), le champ ouvert déborde simplement d'un cran sur la tâche suivante. */
.todo-item:has(.todo-item__date input:focus) { padding-bottom: 27px; }

.todo__add { padding-left: 24px; margin-top: 6px; }
.todo__add-line {
    display: block; min-height: 1.5em; outline: none; padding: 4px 6px;
    border: 1px dashed var(--border); border-radius: 7px; color: var(--text); word-break: break-word;
}
.todo__add-line:focus { border-style: solid; border-color: var(--primary); background: var(--slate-50); }
.todo__add-line:empty::before { content: attr(data-placeholder); color: var(--slate-400); }

/* ---- Ressources de la séance en cours (accueil, colonne de gauche) ------
   Tant qu'une séance tourne, ce qui a été préparé pour elle reste à un clic : une puce
   hexagonale à la couleur du type d'hexagone, le titre juste après. Le panneau reprend le
   cadre de la TO DO LIST — même carte, même graisse — et se pose juste au-dessus d'elle. */
.sres {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-width: 340px; margin: 0 auto 14px; overflow: hidden; font-size: .92rem;
}
.sres__head { display: flex; align-items: center; gap: 10px; padding: 11px 14px 10px;
    border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fff, var(--slate-50)); }
.sres__id { min-width: 0; }
.sres__title { font-family: var(--font-display); font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; font-size: .74rem; color: var(--slate-800); margin: 0; }
.sres__meta { margin: 1px 0 0; font-size: .8rem; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Même point rouge « ça tourne » que le bandeau de séance, même battement (sbar-pulse). */
.sres__rec { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); animation: sbar-pulse 2s infinite; }

.sres__list { list-style: none; margin: 0; padding: 6px; max-height: 38vh; overflow: auto; }
.sres__item { display: flex; align-items: center; gap: 10px; padding: 5px 6px;
    border-radius: 10px; color: var(--slate-700); transition: background .12s ease, color .12s ease; }
.sres__item:hover { background: var(--slate-50); color: var(--slate-900); text-decoration: none; }
.sres__item:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Puce hexagonale : la silhouette des hexagones de « Mes documents » (arêtes plates en
   haut et en bas), réduite à la taille d'une ligne de liste. La couleur vient de --h1/--h2,
   posés plus bas par type ; le repli ardoise garantit qu'un type non prévu ici reste
   visible plutôt que transparent. */
.sres__hex { flex: none; width: 30px; height: 26px; display: grid; place-items: center; color: #fff;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: linear-gradient(150deg, var(--h1, var(--slate-400)), var(--h2, var(--slate-500)));
    transition: transform .14s ease; }
.sres__item:hover .sres__hex { transform: scale(1.09); }
.sres__hex svg { width: 15px; height: 15px; }

.sres__lbl { flex: 1; min-width: 0; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Chevron dessiné au trait, révélé au survol : il annonce l'ouverture sans peser au repos. */
.sres__item::after { content: ''; flex: none; width: 6px; height: 6px; margin-right: 3px;
    border-right: 2px solid var(--slate-400); border-top: 2px solid var(--slate-400);
    opacity: 0; transform: translateX(-3px) rotate(45deg);
    transition: opacity .14s ease, transform .14s ease; }
.sres__item:hover::after { opacity: 1; transform: translateX(0) rotate(45deg); }
/* Figure à construire : le lien principal ouvre la figure, un second mène aux travaux des élèves. */
.sres__li--travaux { display: flex; align-items: center; gap: 2px; }
.sres__li--travaux .sres__item { flex: 1; min-width: 0; }
.sres__travaux { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
    color: var(--slate-500); }
.sres__travaux:hover { background: var(--slate-100); color: var(--primary); }
.sres__travaux svg { width: 17px; height: 17px; }

.sres__more { display: block; padding: 9px 14px; border-top: 1px solid var(--border);
    background: var(--slate-50); color: var(--slate-500); font-size: .8rem; font-weight: 600; }
.sres__more::after { content: ' →'; }
.sres__more:hover { background: var(--slate-100); color: var(--primary); text-decoration: none; }

/* Deux panneaux dans la gouttière : le pense-bête cède de la hauteur à la séance, qui
   n'est là que le temps du cours. */
.sres + .todo .todo__body { max-height: min(34vh, 300px); }

/* Couleur de la puce par type d'hexagone — celles de « Mes documents » (.hm-hex--*).
   Deux types y sont dessinés par un aperçu et n'ont pas de dégradé plein à reprendre :
   « arbre » et « poses » héritent ici de la teinte de leur fond pastel, en soutenu. */
.sres__hex[data-t="lecon"]         { --h1: var(--acc-cours-1); --h2: var(--acc-cours-2); }
.sres__hex[data-t="fichier"]       { --h1: #60a5fa; --h2: #2563eb; }
.sres__hex[data-t="videofile"]     { --h1: #64748b; --h2: #0f172a; }
.sres__hex[data-t="audiofile"]     { --h1: #34d399; --h2: #047857; }
.sres__hex[data-t="lien"]          { --h1: var(--acc-cours-1); --h2: var(--acc-cours-2); }
.sres__hex[data-t="youtube"]       { --h1: #f87171; --h2: #dc2626; }
.sres__hex[data-t="note"]          { --h1: var(--acc-doc-1); --h2: var(--acc-doc-2); }
.sres__hex[data-t="flash"]         { --h1: var(--acc-flash-1); --h2: var(--acc-flash-2); }
.sres__hex[data-t="geogebra"]      { --h1: var(--acc-ggb-1); --h2: var(--acc-ggb-2); }
.sres__hex[data-t="mathalea"]      { --h1: var(--acc-alea-1); --h2: var(--acc-alea-2); }
.sres__hex[data-t="mathsmentales"] { --h1: #93c5fd; --h2: #1e40af; }
.sres__hex[data-t="scratch"]       { --h1: #fbbf24; --h2: #d97706; }
.sres__hex[data-t="html"]          { --h1: #38bdf8; --h2: #0284c7; }
.sres__hex[data-t="barres"]        { --h1: #f472b6; --h2: #db2777; }
.sres__hex[data-t="arbre"]         { --h1: #a3e635; --h2: #4d7c0f; }
.sres__hex[data-t="fonction"]      { --h1: #38bdf8; --h2: #0369a1; }
.sres__hex[data-t="carte"]         { --h1: #fb7185; --h2: #9f1239; }
.sres__hex[data-t="dessin"]        { --h1: #e879f9; --h2: #a21caf; }
.sres__hex[data-t="proba"]         { --h1: #fcd34d; --h2: #b45309; }
.sres__hex[data-t="exercice"]      { --h1: #34d399; --h2: #047857; }
.sres__hex[data-t="poses"]         { --h1: #fdba74; --h2: #ea580c; }
.sres__hex[data-t="ecran"]         { --h1: var(--acc-estrade-1); --h2: var(--acc-estrade-2); }

/* ---- Carte placeholder (espace élève) ---------------------------------- */
.placeholder-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 28px; max-width: 560px; margin: 0 auto; text-align: center;
}
.placeholder-card h2 { margin-top: 0; }

/* ---- Pages d'authentification ------------------------------------------ */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #1e293b, var(--slate-900));
}
.auth-shell { width: 100%; max-width: 400px; }
.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    color: #fff; margin-bottom: 18px;
}
.auth-card {
    background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
    padding: 28px 26px;
}
.auth-title { margin: 0 0 4px; font-size: 1.35rem; color: var(--slate-900); }
.auth-lead { margin: 0 0 20px; color: var(--muted); font-size: .92rem; }
.auth-alt { margin: 18px 0 0; text-align: center; font-size: .9rem; color: var(--muted); }

/* ---- Page d'accueil publique (avant connexion) ------------------------- */
.landing-body {
    display: flex; flex-direction: column; min-height: 100vh; color: #e2e8f0;
    background:
        radial-gradient(1200px 700px at 78% -8%, rgba(79,70,229,.30), transparent 60%),
        radial-gradient(1000px 600px at 6% 8%, rgba(8,145,178,.22), transparent 55%),
        linear-gradient(160deg, #0b1220, var(--slate-900) 55%, #0b1220);
}
.landing-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 18px 28px; position: relative; z-index: 2;
}
.landing-topbar .brand__name { font-weight: 500; }
.landing-teacher {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600;
    color: var(--slate-300); border: 1px solid rgba(148,163,184,.28);
    background: rgba(15,23,42,.35); transition: color .15s, border-color .15s, background .15s;
}
.landing-teacher:hover {
    text-decoration: none; color: #fff;
    border-color: rgba(148,163,184,.55); background: rgba(148,163,184,.14);
}

.landing-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px 24px 36px; }
.landing { position: relative; width: 100%; max-width: 1060px; }
.landing-deco {
    position: absolute; inset: -80px -40px auto -40px; height: 600px;
    width: calc(100% + 80px); opacity: .8; pointer-events: none; z-index: 0;
    -webkit-mask-image: radial-gradient(70% 70% at 50% 35%, #000, transparent 80%);
            mask-image: radial-gradient(70% 70% at 50% 35%, #000, transparent 80%);
}
.landing-grid {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center;
}

.landing-intro { max-width: 560px; }
.landing-eyebrow {
    display: inline-block; font-family: var(--font-display); font-size: .72rem;
    font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: #a5b4fc; padding: 5px 12px; border-radius: 999px;
    background: rgba(99,102,241,.16); border: 1px solid rgba(99,102,241,.32);
}
.landing-headline {
    font-size: clamp(2.1rem, 4.4vw, 3rem); line-height: 1.06; margin: 18px 0 14px;
    color: #fff; letter-spacing: -.02em;
}
.landing-headline span {
    background: linear-gradient(120deg, #38bdf8, #818cf8 55%, #e879f9);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing-sub { color: #cbd5e1; font-size: 1.05rem; margin: 0 0 26px; max-width: 48ch; }

.landing-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.lf { display: flex; align-items: flex-start; gap: 14px; }
.lf__hex {
    flex: 0 0 auto; width: 46px; height: 52px; display: grid; place-items: center;
    color: #fff; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 0 6px 16px rgba(15,23,42,.45);
}
.lf__hex svg { width: 22px; height: 22px; }
.lf--cours  .lf__hex { background: linear-gradient(150deg, var(--acc-cours-1), var(--acc-cours-2)); }
.lf--docs   .lf__hex { background: linear-gradient(150deg, var(--acc-doc-1), var(--acc-doc-2)); }
.lf--cahier .lf__hex { background: linear-gradient(150deg, var(--acc-cahier-1), var(--acc-cahier-2)); }
.lf--memo   .lf__hex { background: linear-gradient(150deg, #f472b6, #db2777); }
.lf__body { display: flex; flex-direction: column; gap: 2px; }
.lf__title { font-family: var(--font-display); font-weight: 600; color: #fff; font-size: 1.02rem; }
.lf__desc { color: #94a3b8; font-size: .9rem; line-height: 1.45; }

/* Cadre de connexion élève */
.landing-login { display: flex; justify-content: center; }
.login-card {
    width: 100%; max-width: 380px; background: var(--card);
    border-radius: 20px; padding: 26px 26px 22px; color: var(--text);
    border: 1px solid rgba(148,163,184,.18);
    box-shadow: 0 24px 60px rgba(2,6,23,.55), 0 2px 8px rgba(2,6,23,.4);
}
.login-card__head { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.login-card__hex {
    flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center;
    background: linear-gradient(150deg, #6366f1, #4338ca);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.login-card__hex .logo { width: 24px; height: 27px; }
.login-card__title { margin: 0; font-size: 1.25rem; color: var(--slate-900); }
.login-card__lead { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }
.login-card__hint { margin: 16px 0 0; font-size: .82rem; color: var(--muted); text-align: center; }

@media (max-width: 860px) {
    .landing-grid { grid-template-columns: 1fr; gap: 30px; }
    .landing-intro { max-width: none; text-align: center; margin: 0 auto; }
    .landing-sub { margin-left: auto; margin-right: auto; }
    .lf { text-align: left; }
    .landing-features { max-width: 480px; margin: 0 auto; }
    .landing-deco { display: none; }
}
@media (max-width: 480px) {
    .landing-topbar { padding: 14px 16px; }
    .landing-teacher span { display: inline; }
    .login-card { padding: 22px 18px 18px; }
}
.landing-footer { text-align: center; color: var(--slate-500); font-size: .82rem; padding: 18px; position: relative; z-index: 1; }

/* ---- Formulaires -------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: .85rem; font-weight: 600; color: var(--slate-700); }
.field__input {
    width: 100%; padding: 11px 12px; font: inherit;
    color: var(--text); color-scheme: light;
    border: 1px solid var(--slate-300); border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.field__input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.18);
}
.field__input--pin { letter-spacing: .5em; text-align: center; font-size: 1.1rem; }
.field__input:disabled { background: var(--slate-100); color: var(--slate-500); cursor: not-allowed; }
.form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---- Avatar (photo de profil ronde, ou initiales) ----------------------- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden; border-radius: 50%; flex: none;
    background: var(--primary); color: #fff;
    font-family: var(--font-display); font-weight: 600; line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--sm { width: 30px; height: 30px; font-size: .78rem; }
.avatar--lg { width: 96px; height: 96px; font-size: 2rem; box-shadow: var(--shadow); }

/* ---- Profil enseignant -------------------------------------------------- */
.profil { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.profil__title { margin: 0; }
.profil-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 22px 24px;
}
.profil-card .card__title { margin: 0 0 16px; font-size: 1.05rem; color: var(--slate-800); }
.avatar-edit { display: flex; align-items: center; gap: 22px; }
.avatar-edit__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.avatar-edit__hint { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.avatar-edit .btn { cursor: pointer; }
.btn--ghost-dark { background: transparent; color: var(--slate-700); border-color: var(--slate-300); }
.btn--ghost-dark:hover { background: var(--slate-100); }

/* Lien profil dans la barre supérieure */
.topbar__profil { display: inline-flex; align-items: center; gap: 9px; color: #fff; }
.topbar__profil:hover { text-decoration: none; }
.topbar__profil:hover .topbar__user { color: #fff; }

/* Règles de robustesse du mot de passe */
.pw-rules {
    list-style: none; margin: -8px 0 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; color: var(--muted);
}
.pw-rules li { position: relative; padding-left: 18px; }
.pw-rules li::before { content: '○'; position: absolute; left: 0; color: var(--slate-400); }
.pw-rules li.is-ok { color: #15803d; }
.pw-rules li.is-ok::before { content: '✓'; color: #15803d; }

/* ---- Pages d'erreur ----------------------------------------------------- */
.error-card { text-align: center; max-width: 420px; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--slate-300); margin: 0; }
.error-card h1 { margin: 4px 0 10px; }
.error-card p { color: var(--muted); margin-bottom: 20px; }

/* ---- Toast (modules à venir) ------------------------------------------- */
.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
    background: var(--slate-900); color: #fff; padding: 12px 18px; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15,23,42,.35); font-size: .92rem; z-index: 50;
    opacity: 0; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive : le nid d'abeille devient une pile de cartes ----------- */
@media (max-width: 600px) {
    .honeycomb { grid-template-columns: 1fr; padding-bottom: 0; }
    .hex, .honeycomb .hex:nth-child(2n) {
        width: 100%; height: auto; min-height: 132px;
        clip-path: none; border-radius: var(--radius); transform: none;
    }
    .hex:hover, .hex:nth-child(odd):hover, .hex:nth-child(2n):hover { transform: none; }
    .hex__inner { position: static; padding: 22px; }
}

/* =========================================================================
   Bloc « Mes documents »
   ========================================================================= */

.btn--light { background: var(--slate-100); color: var(--slate-800); border-color: var(--slate-200); }
.btn--light:hover { background: var(--slate-200); }
.btn--ghost-dark { background: transparent; color: var(--slate-600); border-color: var(--slate-300); }
.btn--ghost-dark:hover { background: var(--slate-100); }
.btn--xs { padding: 4px 10px; font-size: .82rem; }
.linklike { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { text-decoration: underline; }

.docs__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.breadcrumb { font-size: .95rem; color: var(--muted); }
.breadcrumb a { color: var(--slate-700); }
.breadcrumb__sep { margin: 0 6px; color: var(--slate-400); }
.docs__actions { display: flex; gap: 10px; align-items: center; }

.menu { position: relative; }
.menu__list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; min-width: 200px; }
.menu__list button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: inherit; }
.menu__list button:hover { background: var(--slate-100); }

.docs__filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.docs__filters .field__input { width: auto; min-width: 140px; }
.docs__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tagchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--slate-100); color: var(--slate-700); font-size: .85rem; }
.tagchip:hover { text-decoration: none; background: var(--slate-200); }
.tagchip.is-on { background: var(--primary); color: #fff; }
.tagchip__nb { font-size: .72rem; opacity: .7; }
.docs__hint { color: var(--muted); font-size: .88rem; margin: 4px 0 10px; }
.docs__empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* Section vide : hexagone « + » invitant au premier ajout */
.hm-empty { position: absolute; left: 0; top: 0; width: 230px; height: 200px; border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.hm-empty__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-empty__svg polygon { fill: var(--slate-50); stroke: var(--slate-300); stroke-width: 3; stroke-dasharray: 7 8; stroke-linejoin: round; transition: fill .14s ease, stroke .14s ease; }
.hm-empty:hover .hm-empty__svg polygon { fill: #eef2ff; stroke: var(--primary); }
.hm-empty__plus { position: relative; font-size: 2.6rem; font-weight: 300; line-height: 1; color: var(--slate-400); transition: color .14s ease; }
.hm-empty:hover .hm-empty__plus { color: var(--primary); }

/* Glisser-déposer un fichier : hexagones vides aux emplacements libres */
.docs.is-fdrag .hm-empty { display: none; }                 /* remplacé par les fantômes ci-dessous */
.hm-ghost { position: absolute; width: 230px; height: 200px; display: grid; place-items: center; z-index: 6; }
.hm-ghost__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hm-ghost__svg polygon { fill: var(--slate-50); stroke: var(--slate-300); stroke-width: 3; stroke-dasharray: 7 8; stroke-linejoin: round; transition: fill .14s ease, stroke .14s ease; }
.hm-ghost__plus { position: relative; font-size: 2.6rem; font-weight: 300; line-height: 1; color: var(--slate-400); pointer-events: none; transition: color .14s ease; }
.hm-ghost.is-lit { z-index: 7; }
.hm-ghost.is-lit .hm-ghost__svg polygon { fill: #eef2ff; stroke: var(--primary); stroke-dasharray: none; }
.hm-ghost.is-lit .hm-ghost__plus { color: var(--primary); }

/* Canvas + tuiles : pavage hexagonal régulier emboîté (rapport H/W = 2/√3) */
.hm-canvas { position: relative; margin: 0 auto; }
.hm-tile { position: absolute; width: 230px; height: 200px; }
.hm-hex {
    position: relative; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; color: #fff;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    /* pas de scale : on veut désormais un écart de 1 mm entre hexagones (cf. STEP_X/STEP_Y dans documents.js) */
    display: grid; place-items: center; overflow: hidden; transition: filter .12s ease;
}
.hm-tile:hover { z-index: 5; }
.hm-tile:hover .hm-hex { filter: brightness(1.07); }
.hm-tile.is-dragging { z-index: 200; } /* au-dessus du tiroir (100) pour déposer sur l'arborescence */
.hm-tile.is-dragging .hm-hex { filter: brightness(1.1) drop-shadow(0 10px 16px rgba(15,23,42,.4)); }
.hm-hex__in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 14px; text-align: center; }
.hm-hex__in svg { width: 28px; height: 28px; }
.hm-hex__title { font-size: .74rem; font-weight: 700; line-height: 1.12; max-width: 92px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hm-hex__badges { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.hm-hex__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hm-hex__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 9px; font-size: .7rem; font-weight: 700; line-height: 1.1;
    background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Outils au survol d'une tuile : pastille flottante, icônes au trait (jamais d'emojis —
   rendu identique d'un poste à l'autre). Elle entre en fondu + léger glissement plutôt que
   d'apparaître d'un coup, et « visibility » la retire du parcours clavier au repos. */
.hm-tile__tools { position: absolute; top: 9px; left: 50%; z-index: 6; display: flex; gap: 1px; padding: 3px;
    background: rgba(255,255,255,.96); border: 1px solid rgba(15,23,42,.07); border-radius: 999px;
    box-shadow: 0 6px 18px rgba(15,23,42,.22), 0 1px 3px rgba(15,23,42,.14);
    opacity: 0; visibility: hidden; transform: translate(-50%, -5px);
    transition: opacity .14s ease, transform .16s cubic-bezier(.2,.8,.3,1), visibility .16s; }
.hm-tile:hover .hm-tile__tools { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.hm-tile__tools button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none;
    color: var(--slate-500); cursor: pointer; display: grid; place-items: center;
    transition: background .12s ease, color .12s ease, transform .12s ease; }
.hm-tile__tools button svg { width: 15px; height: 15px; display: block; }
.hm-tile__tools button:hover { background: var(--slate-100); color: var(--slate-900); transform: translateY(-1px); }
.hm-tile__tools button:active { transform: scale(.92); }
.hm-tile__tools button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Teinte propre à chaque famille d'action : l'intention se lit avant même l'icône. */
.hm-tile__tools button[data-action="edit"]:hover,
.hm-tile__tools button[data-action="rename"]:hover,
.hm-tile__tools button[data-action="dup"]:hover { background: #e0e7ff; color: var(--primary-d); }
.hm-tile__tools button[data-action="share"]:hover,
.hm-tile__tools button[data-action="ggb-dl"]:hover,
.hm-tile__tools button[data-action="scratch-dl"]:hover,
.hm-tile__tools button[data-action="html-dl"]:hover { background: #dbeafe; color: #1d4ed8; }
.hm-tile__tools button[data-action="eleve"]:hover { background: #d1fae5; color: #047857; }
.hm-tile__tools button[data-action="trash"]:hover { background: #fee2e2; color: #b91c1c; }
.hm-hex--folder  { background: linear-gradient(150deg, #818cf8, #4f46e5); }
.hm-hex--fichier { background: linear-gradient(150deg, #60a5fa, #2563eb); }
.hm-hex--lien    { background: linear-gradient(150deg, var(--acc-cours-1), var(--acc-cours-2)); }
.hm-hex--youtube { background: linear-gradient(150deg, #f87171, #dc2626); }
.hm-hex--note    { background: linear-gradient(150deg, var(--acc-doc-1), var(--acc-doc-2)); }
.hm-hex--flash   { background: linear-gradient(150deg, var(--acc-flash-1), var(--acc-flash-2)); }
/* Questions flash (sans vignette) : pas d'icône, titre plus grand (il est le contenu). */
.hm-hex--flash .hm-hex__ic { display: none; }
.hm-hex--flash .hm-hex__name { font-size: 1.02rem; -webkit-line-clamp: 4; }
.hm-hex--geogebra { background: linear-gradient(150deg, var(--acc-ggb-1), var(--acc-ggb-2)); }
.hm-hex--geogebra .hm-hex__ic svg { width: 46%; height: 46%; }
/* Figure GeoGebra / PDF : pas d'icône (le titre passe par-dessus l'aperçu). Le style
   du titre — centré, noir, surlignage blanc — vient de la règle de base commune. */
.hm-tile[data-type="geogebra"] .hm-hex__ic { display: none; }
.hm-tile[data-type="geogebra"] .hm-hex__name { font-size: .96rem; -webkit-line-clamp: 4; }
.hm-tile[data-pdf-doc] .hm-hex__ic { display: none; }
.hm-tile[data-pdf-doc] .hm-hex__name { font-size: .96rem; -webkit-line-clamp: 4; }
/* Fichier vidéo : hexagone graphite façon salle obscure, remplacé par l'affiche du film dès
   qu'elle est capturée (media.js). La pastille de lecture reste dans les deux cas — c'est
   elle qui dit « ça se regarde » ; elle est placée au-dessus du titre pour ne pas le gêner. */
.hm-hex--videofile { background: linear-gradient(155deg, #64748b, #0f172a); }
.hm-hex--audiofile { background: linear-gradient(155deg, #34d399, #047857); }
.hm-tile[data-video-doc] .hm-hex__ic { display: none; }
.hm-hex__play { position: absolute; top: 27%; left: 50%; transform: translate(-50%, -50%);
    width: 42px; height: 42px; border-radius: 50%; background: rgba(15,23,42,.55);
    border: 2px solid rgba(255,255,255,.92); display: grid; place-items: center;
    pointer-events: none; z-index: 1; transition: background .12s ease, transform .12s ease; }
.hm-hex__play::after { content: ""; margin-left: 3px; width: 0; height: 0;
    border-left: 12px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.hm-tile:hover .hm-hex__play { background: rgba(15,23,42,.78); transform: translate(-50%, -50%) scale(1.08); }
/* Mathaléa : logo MathALÉA (auto-hébergé) en visuel par défaut sur fond violet,
   titre en bandeau bas comme les tuiles à aperçu ; une vignette posée remplace
   le tout (la classe devient hm-hex--img). */
.hm-hex--mathalea {
    background: url('../img/mathalea-logo.svg') center 40% / 46% auto no-repeat,
                linear-gradient(150deg, var(--acc-alea-1), var(--acc-alea-2));
}
.hm-hex--mathalea .hm-hex__ic { display: none; }
/* Programme Scratch (sans vignette) : logo « chat Scratch » (auto-hébergé) sur fond clair —
   le chat est orange, il lui faut un fond clair pour ressortir. Une vignette d'aperçu
   enregistrée le remplace (la classe devient hm-hex--img). */
.hm-hex--scratch {
    background: url('../img/scratch-logo.png') center 44% / 58% auto no-repeat,
                linear-gradient(160deg, #ffffff, #ffe4c4);
}
.hm-hex--scratch .hm-hex__ic { display: none; }
/* Page HTML (sans vignette) : dégradé bleu ciel + icône « code ». */
/* Maths mentales : diaporama d'automatismes (mathsmentales.net) — bleu roi du compte à
   rebours du site, icône « écran + chrono ». */
.hm-hex--mathsmentales { background: linear-gradient(150deg, #93c5fd, #1e40af); }
.hm-hex--mathsmentales .hm-hex__ic svg { width: 46%; height: 46%; }
.hm-hex--html { background: linear-gradient(150deg, #38bdf8, #0284c7); }
.hm-hex--html .hm-hex__ic svg { width: 46%; height: 46%; }
.hm-hex--barres { background: linear-gradient(150deg, #f472b6, #db2777); }
.hm-hex--barres .hm-hex__ic svg { width: 46%; height: 46%; }
/* Schéma en barres : miniature du schéma dessinée en fond d'hexagone (barres-core.js
   depuis le JSON embarqué dans la tuile). Fond rose très clair pour rester lisible. */
.hm-hex--barresbg { background: linear-gradient(150deg, #fdf2f8, #fbcfe8); }
.hm-hex--barresbg .hm-hex__ic { display: none; }
.hm-hex__barres { position: absolute; inset: 14% 15%; display: grid; place-items: center; pointer-events: none; }
.hm-hex__barres svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.hm-hex--barresbg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }
/* Aperçu de la page rendu en fond de l'hexagone (html-embed.js pose l'iframe bac à sable).
   Non interactif : le clic traverse jusqu'à l'hexagone (ouverture de la visionneuse). Les
   dimensions de l'iframe sont posées en ligne — ici on ne gère que le calque et les couches. */
.hm-hex__htmlbg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #fff; z-index: 0; }
.hm-hex--htmlbg .hm-hex__ic { display: none; }
.hm-hex--htmlbg .hm-hex__name,
.hm-hex--htmlbg .hm-hex__pub,
.hm-hex--htmlbg .hm-hex__eleve { z-index: 1; }
.hm-hex__badges .badge { font-size: .6rem; padding: 1px 5px; }

.badge { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--slate-700); color: #fff; }
.badge--soft { background: var(--slate-200); color: var(--slate-700); }
.badge--pub { background: #047857; }
.tagdot { font-size: .72rem; color: var(--primary); }

/* Le pavage est calculé en JS (positions absolues), identique sur tous les écrans. */

/* =========================================================================
   Modales
   ========================================================================= */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow: auto; z-index: 100; }
.modal[hidden] { display: none; }
.modal__box { background: #fff; border-radius: 16px; padding: 22px 24px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(15,23,42,.4); }
.modal__box--sm { max-width: 440px; }
.modal__box--flash { max-width: 820px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__title { margin: 0 0 16px; font-size: 1.2rem; }
.modal__head .modal__title { margin-bottom: 0; }
.modal__x { border: 0; background: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal__foot[hidden] { display: none; }   /* le display:flex ci-dessus l'emporterait sinon sur [hidden] */
.modal__error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.field__hint { font-size: .8rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .field { margin: 14px 0 0; }
/* Un champ masqué (attribut hidden) doit se replier malgré .field { display:flex }. */
.field[hidden] { display: none; }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor__bar { display: flex; align-items: center; justify-content: space-between; }
.editor__src { font-family: var(--font-mono, ui-monospace, monospace); resize: vertical; }
.editor__preview { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 140px; max-height: 320px; overflow: auto; background: var(--slate-50); }

/* ==== Clavier mathématique partagé (js/mathpad.js, présentation type iDroo) ====
   Barre de palettes dépliantes + champ MathLive (la formule se dessine pendant la
   frappe) + zone « Code LaTeX ». La superposition .mp-ov est volontairement distincte
   de .modal : elle passe au-dessus des modales ouvertes (doc-modal, seance-modal…). */
.mp-ov { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: flex-start;
    justify-content: center; padding: 5vh 16px; overflow: auto; z-index: 400; }
.modal__box--mathpad { max-width: 760px; }
.mp-kbd { position: relative; margin-bottom: 12px; }
.mp-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border: 1px solid var(--slate-200);
    border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.mp-tab { min-width: 38px; height: 36px; padding: 0 7px; border: 0; border-radius: 8px; background: none;
    cursor: pointer; font-size: .98rem; color: #52708f; font-family: Georgia, 'Times New Roman', serif;
    display: inline-flex; align-items: center; justify-content: center; flex: 1 1 auto;
    transition: background .12s ease, color .12s ease; }
.mp-tab:hover { background: var(--slate-100); }
.mp-tab.is-on { background: #52708f; color: #fff; }
.mp-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(var(--mp-cols, 8), minmax(44px, 1fr)); gap: 4px;
    padding: 12px; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15,23,42,.2); max-height: 320px; overflow: auto; }
.mp-panel[hidden] { display: none; }
.mp-key { min-height: 40px; padding: 4px 6px; border: 0; border-radius: 8px; background: none;
    cursor: pointer; font-size: 1.05rem; line-height: 1.1; color: #52708f;
    font-family: Georgia, 'Times New Roman', serif;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s ease, color .12s ease; }
.mp-key:hover { background: #eef2ff; color: var(--primary); }
.mp-key:active { transform: translateY(1px); }
.mp-key sup, .mp-key sub { font-size: .62em; }
/* Petite case pointillée des étiquettes (argument à compléter, comme iDroo). */
.mp-key i, .mp-tab i { display: inline-block; width: .55em; height: .55em; margin: 0 1px;
    border: 1px dashed #94a3b8; border-radius: 2px; font-style: normal; }
/* Étiquette empilée (fraction, bornes, accent au-dessus/en-dessous). */
.mp-st { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; gap: 1px; }
.mp-st small { font-size: .62em; line-height: .9; }
.mp-st b { display: block; width: .9em; height: 1px; background: currentColor; }
.mp-field-wrap { margin-bottom: 8px; }
.mathpad__field { display: block; width: 100%; font-size: 1.5rem; padding: 12px 14px;
    border: 1px solid var(--slate-300); border-radius: 12px; background: #fff; }
.mathpad__field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
/* Boutons internes de MathLive (clavier virtuel ⌨ et menu ☰) : superflus, le clavier iDroo suffit. */
.mathpad__field::part(virtual-keyboard-toggle),
.mathpad__field::part(menu-toggle) { display: none; }
/* Aperçu MathJax du mode « code seul » (MathLive indisponible). */
.mp-preview { min-height: 64px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--slate-300); border-radius: 12px; background: #fff; font-size: 1.25rem; padding: 10px; }
.mp-preview__empty { color: var(--slate-400); font-size: .9rem; }
.mp-code-wrap { margin-bottom: 8px; }
.mp-code { display: block; width: 100%; resize: vertical; padding: 8px 10px; border: 1px solid var(--slate-300);
    border-radius: 10px; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .92rem; }
.mp-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mp-bar .mathpad__hint { margin: 0; }
.mp-code-btn.is-on { background: var(--slate-200); }
.mathpad__hint { margin: 10px 0 0; font-size: .82rem; color: var(--muted); }
.mathpad__hint code { background: var(--slate-100); border-radius: 5px; padding: 1px 5px; font-size: .92em; }

.switch { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.copyrow { display: flex; gap: 8px; }
.copyrow .field__input { flex: 1; }

/* ==== Recherche YouTube de l'hexagone « Vidéo » (js/youtube.js) ====
   Barre de recherche + grille de vignettes cliquables + aperçu du lecteur. La liste
   est bornée en hauteur pour que le bas de la modale (métadonnées, Enregistrer)
   reste atteignable sans faire défiler toute la page. */
.yt-bar { display: flex; gap: 8px; }
.yt-bar .field__input { flex: 1 1 auto; min-width: 0; }
.yt-bar .btn { flex: 0 0 auto; }
#dm-yt-status.is-error { color: #b91c1c; }
.yt-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px;
    max-height: 340px; overflow: auto; padding: 4px 2px; margin-top: 4px; }
.yt-results[hidden] { display: none; }
.yt-card { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 1px solid var(--border);
    border-radius: 10px; background: #fff; cursor: pointer; overflow: hidden; text-align: left;
    font: inherit; color: inherit; transition: border-color .12s, box-shadow .12s, transform .12s; }
.yt-card:hover { border-color: var(--primary); box-shadow: 0 6px 16px rgba(15,23,42,.14); transform: translateY(-1px); }
.yt-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.yt-card__th { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--slate-200); }
.yt-card__th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-card__dur { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 4px;
    background: rgba(15,23,42,.82); color: #fff; font-size: .7rem; font-weight: 700; }
.yt-card__info { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px; min-width: 0; }
.yt-card__t { font-size: .82rem; font-weight: 600; line-height: 1.25; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-card__s { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-pick { margin-top: 8px; }
.yt-pick[hidden] { display: none; }
.yt-pick__bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.yt-pick__t { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-pick__bar .linklike { flex: 0 0 auto; font-size: .82rem; }

.viewer-body { margin-top: 8px; }
.viewer-tags { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.embed { position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; }
.embed iframe, .embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed video { background: #000; object-fit: contain; }
.embed--pdf { padding-top: 0; height: 70vh; }
.embed--pdf iframe { position: static; height: 100%; }
/* Visionneuse PDF : modale étendue quasi plein écran pour une lecture maximale.
   La boîte remplit la hauteur (header figé en haut) et l'iframe occupe l'espace restant. */
.modal--pdf { padding: 12px; }
.modal__box--pdf { max-width: 1600px; width: 97vw; padding: 12px 16px; height: calc(100vh - 24px); max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.modal__box--pdf .viewer-body { margin-top: 6px; flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.modal__box--pdf .embed--pdf { flex: 1 1 auto; min-height: 480px; height: auto; border-radius: 6px; }

/* Lecteur d'un fichier audio/vidéo de la bibliothèque (js/media.js). La scène noire prend
   toute la hauteur disponible — une vidéo projetée à la classe ne doit pas être une vignette
   au milieu d'une page blanche — et la barre du bas réunit la fiche technique du fichier, la
   vitesse de lecture (revoir une démonstration au ralenti) et le téléchargement. */
.modal__box--video { max-width: 1400px; width: 96vw; padding: 12px 16px 14px;
    height: calc(100vh - 24px); max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.modal__box--video .viewer-body { margin-top: 8px; flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.vplayer { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; }
/* Hors visionneuse, la scène épouse l'image (pas de bandes noires autour d'une vidéo
   verticale au milieu d'une page claire) ; dans la visionneuse, elle remplit la boîte. */
.vplayer__stage { display: grid; place-items: center; background: #000; border-radius: 10px; overflow: hidden;
    width: fit-content; max-width: 100%; margin: 0 auto; }
/* Hors visionneuse (page élève, partage par lien, bloc de leçon), l'image est bornée à
   l'écran : une vidéo filmée à la verticale ferait sinon défiler la page sur trois hauteurs. */
.vplayer__media { display: block; max-width: 100%; max-height: min(76vh, 760px); }
/* Dans la visionneuse, la boîte a une hauteur définie : la scène prend tout le reste.
   La borne de l'image est exprimée en unités d'écran et NON en pourcentage : dans cette
   chaîne flex → grid, un « max-height: 100% » est résolu contre une hauteur encore
   indéfinie, donc ignoré — une vidéo verticale débordait alors de la scène. Les 170 px
   retranchés couvrent le cadre de la modale (marges, titre, barre du lecteur). */
.modal__box--video .vplayer__stage { flex: 1 1 auto; min-height: 240px; width: auto; }
.modal__box--video .vplayer__media { max-height: calc(100vh - 170px); }
.vplayer__stage--err { background: var(--slate-100); min-height: 0; padding: 28px 24px; }
.vplayer__err { margin: 0; max-width: 52ch; text-align: center; color: var(--slate-700); font-size: .92rem; line-height: 1.55; }
.vplayer__bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vplayer__meta { color: var(--muted); font-size: .82rem; margin-right: auto; }
.vplayer__speed { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--slate-100); }
.vplayer__speed[hidden] { display: none; }
.vplayer__sp { border: 0; background: none; cursor: pointer; padding: 3px 9px; border-radius: 6px;
    font-size: .76rem; font-weight: 600; color: var(--slate-700); font-family: inherit; }
.vplayer__sp:hover { background: rgba(255,255,255,.75); }
.vplayer__sp.is-on { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
/* Piste audio : rien à regarder, la barre de contrôle du navigateur se suffit. La scène
   repasse en bloc — dans une grille aux pistes automatiques, la largeur de 100 % de la
   barre de contrôle se résoudrait à zéro (pourcentage contre une piste indéfinie). */
.vplayer--audio { flex: 0 0 auto; gap: 8px; }
/* margin remis à zéro : une marge « auto » sur l'axe transverse empêche l'étirement dans
   un conteneur flex, et la barre de contrôle retomberait à une largeur nulle. */
.vplayer--audio .vplayer__stage { display: block; background: none; border-radius: 0; min-height: 0; width: auto; margin: 0; }
.vplayer--audio .vplayer__media { width: 100%; }
.etq-actions { display: flex; align-items: center; gap: 12px; }

/* ---- « Déroulé de la journée » (PDF de /aujourdhui, js/journee-pdf.js) ----------------
   .jpdf-* : la modale d'aperçu. .jpdf / .jpdf__* : la feuille composée HORS ÉCRAN puis
   photographiée bloc par bloc — elle n'apparaît jamais telle quelle à l'écran. Sa largeur
   est posée par le JS (182 mm, largeur utile de l'A4) ; les tailles en px sont donc des
   tailles d'impression (1 px = 0,26 mm, 12 px ≈ 9 pt). Couleurs en dur : la feuille est
   blanche quel que soit le thème de l'écran. */
.jpdf-actions { display: flex; align-items: center; gap: 10px; }
.jpdf-statut { margin: 18px 4px; color: var(--muted); font-size: .95rem; }
.jpdf-statut[hidden] { display: none; }
.jpdf-statut.is-error { color: #b91c1c; }
.jpdf { color: #0f172a; font-family: var(--font-sans); font-size: 12.5px; line-height: 1.5; }
.jpdf__bloc { padding: 0 2px 2px; }
.jpdf__tete { padding-bottom: 6px; }
.jpdf__surtitre { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.jpdf__titre { margin: 2px 0 0; font-size: 24px; line-height: 1.2; font-weight: 700; }
.jpdf__sous { margin: 2px 0 12px; color: #475569; }
.jpdf__vide { color: #64748b; font-style: italic; }
.jpdf__sommaire { width: 100%; border-collapse: collapse; font-size: 12px; }
.jpdf__sommaire th { text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #64748b;
    font-weight: 600; padding: 4px 8px; border-bottom: 1.5px solid #0f172a; }
.jpdf__sommaire td { padding: 6px 8px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.jpdf__nowrap { white-space: nowrap; }
.jpdf__pastille { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 11.5px; }
.jpdf__grp { color: #475569; font-size: 11.5px; }
.jpdf__nature { display: inline-block; padding: 0 6px; border: 1px solid #94a3b8; border-radius: 4px; font-size: 10.5px; color: #334155; }
.jpdf__etat { font-size: 10.5px; font-weight: 600; color: #1d4ed8; }
.jpdf__etat--faite { color: #15803d; }
.jpdf__etat--vide { color: #94a3b8; font-weight: 500; font-style: italic; }
.jpdf__muet { color: #94a3b8; }
.jpdf__seance { border: 1px solid #cbd5e1; border-left: 5px solid var(--jp-cl, #cbd5e1); border-radius: 6px; padding: 0 14px 10px; }
.jpdf__band { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 -14px; padding: 7px 14px;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0; border-radius: 0 6px 0 0; }
.jpdf__num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
    background: #0f172a; color: #fff; font-size: 11px; font-weight: 700; }
.jpdf__heure { font-weight: 700; font-variant-numeric: tabular-nums; }
.jpdf__salle { color: #475569; font-size: 11.5px; }
.jpdf__band-fin { margin-left: auto; }
.jpdf__t { margin: 10px 0 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.jpdf__st { color: #475569; margin-top: 1px; }
.jpdf__sec { margin-top: 10px; }
.jpdf__h3 { margin: 0 0 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; font-weight: 700; }
.jpdf__prose { line-height: 1.55; }
.jpdf__prose > :first-child { margin-top: 0; }
.jpdf__prose > :last-child { margin-bottom: 0; }
.jpdf__list { margin: 0; padding-left: 20px; }
.jpdf__list li { margin: 2px 0; }
.jpdf__tag { display: inline-block; padding: 0 5px; border-radius: 3px; background: #f1f5f9; color: #475569; font-size: 10px;
    font-weight: 600; vertical-align: 1px; }
/* Lignes pour écrire à la main là où rien n'est saisi. */
.jpdf__notes { margin-top: 6px; }
.jpdf__notes span { display: block; height: 22px; border-bottom: 1px dotted #94a3b8; }
.share__img { max-width: 100%; border-radius: 10px; }
.share__url { color: var(--muted); font-size: .85rem; word-break: break-all; }
.share__filesize { color: var(--muted); font-size: .85rem; }

/* =========================================================================
   Contenu rendu (Markdown + LaTeX)
   ========================================================================= */
.prose { line-height: 1.65; }
.prose h1, .prose h2, .prose h3 { line-height: 1.25; margin: 1em 0 .4em; }
.prose p { margin: .6em 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: .6em 0; }
.prose ul { list-style: disc outside; }
.prose ol { list-style: decimal outside; }
.prose li { margin: .2em 0; }
.prose code { background: var(--slate-100); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.prose pre { background: var(--slate-900); color: #e2e8f0; padding: 12px; border-radius: 10px; overflow: auto; }
.prose pre code { background: none; color: inherit; }
.prose blockquote { border-left: 3px solid var(--slate-300); margin: .6em 0; padding-left: 12px; color: var(--slate-600); }
.prose img { max-width: 100%; }
.prose a { color: var(--primary, #4f46e5); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.prose a:hover { text-decoration: none; }
.prose--desc { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--slate-600); }

/* Tableaux insérés PARMI le texte (bouton ▦ de la barre de mise en forme, cf. js/rte.js).
   Le sélecteur porte sur « table » et non sur une classe : un tableau inséré au bouton, écrit
   en Markdown (| a | b |) ou collé depuis un tableur a ainsi exactement le même rendu — et,
   .lc-rte étant lui-même .prose, la saisie est identique au rendu final (leçon, espace élève,
   impression, PDF). À ne pas confondre avec le bloc « Tableau » autonome (.lc-table). */
/* Centré, comme les images insérées dans un bloc de texte. */
.prose table { border-collapse: collapse; margin: .8em auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--slate-400, #94a3b8); padding: 6px 10px; vertical-align: top; text-align: left; }
.prose th { background: var(--slate-100); font-weight: 600; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.prose table p { margin: .25em 0; }
.prose table p:first-child { margin-top: 0; }
.prose table p:last-child { margin-bottom: 0; }
/* Une ligne ne se coupe pas entre deux pages / deux colonnes. */
.prose tr, .prose thead { break-inside: avoid; page-break-inside: avoid; }
@media (max-width: 620px) {
    /* Tableau plus large que l'écran : il défile seul, sans pousser la page. */
    .prose table { display: block; overflow-x: auto; }
    /* Sauf en vue impression : la capture PDF (js/cours-pdf.js) reprend les styles de la
       page, et une zone défilante y serait rognée au lieu d'être mise à l'échelle. */
    .lc-print .prose table { display: table; }
    /* Sauf, aussi, s'il porte des flèches de liaison : leur tracé est calculé depuis la
       position mesurée des cellules, qu'un défilement horizontal ferait mentir dès le
       premier geste (js/tableau-core.js). */
    .prose .lc-tablo table { display: table; }
}

/* Surlignage de l'éditeur riche : execCommand('hiliteColor') pose un fond en style
   INLINE (<span style="background-color:…">). Les navigateurs n'impriment pas les fonds
   par défaut → le surlignage disparaissait à l'impression. On force l'impression sur les
   seuls éléments porteurs d'un fond inline, c'est-à-dire exactement ce que l'utilisateur a
   surligné : les fonds décoratifs de la feuille de styles (blocs de code, encadrés, tableaux)
   gardent le comportement par défaut, l'encre n'est pas gaspillée.
   La propriété est héritée : le texte imbriqué dans le surlignage suit.
   <mark> est ajouté pour le cas d'un contenu collé depuis un traitement de texte : son fond
   jaune vient du navigateur, sans style inline, donc le sélecteur d'attribut ne l'attrape pas. */
.prose [style*="background"], .prose mark,
.lc-rte [style*="background"], .lc-rte mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Affichage d'une note : grande police pour la vidéoprojection + curseur de zoom */
.modal__box--note { max-width: 920px; }
.note-zoom { position: sticky; top: -2px; z-index: 2; display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; margin: -4px 0 14px; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 2px 6px rgba(15,23,42,.05); }
.note-zoom__slider { flex: 1; accent-color: var(--primary); cursor: pointer; height: 22px; }
.note-zoom__a { color: var(--muted); font-weight: 700; line-height: 1; }
.note-zoom__a--sm { font-size: .82rem; }
.note-zoom__a--lg { font-size: 1.35rem; }
.note-zoom__val { min-width: 3.4em; text-align: right; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.prose--note { line-height: 1.6; }
.prose--note p { margin: .65em 0; }
.prose--note h1, .prose--note h2, .prose--note h3 { line-height: 1.25; }

/* =========================================================================
   Page publique de partage
   ========================================================================= */
.public-body { background: var(--bg); }
.public-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--slate-900); color: #fff; }
.public-tag { font-size: .82rem; color: var(--slate-300); }
.public-main { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }
.share__head { margin-bottom: 18px; }
.share__title { margin: 0 0 8px; }
.share__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 760px) {
    .grid2, .editor { grid-template-columns: 1fr; }
    .editor__preview { min-height: 90px; }
}

/* =========================================================================
   Bloc « Le Cours »
   ========================================================================= */

/* Classeur (index) */
.lc-index__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.lc-niveaux { display: flex; gap: 6px; flex-wrap: wrap; }
.lc-niveau { padding: 6px 14px; border-radius: 999px; background: var(--slate-100); color: var(--slate-700); font-weight: 600; font-size: .9rem; }
.lc-niveau:hover { text-decoration: none; background: var(--slate-200); }
.lc-niveau.is-on { background: var(--acc-cours-2); color: #fff; }
.lc-index__actions { display: flex; gap: 10px; }

.lc-seq { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; background: #fff; overflow: hidden; }
/* Chapitre visible par les élèves : liseré vert. */
.lc-seq.is-visible { border-color: #16a34a; box-shadow: inset 0 0 0 2px #16a34a; }
.lc-seq.is-visible .lc-seq__head { background: #f0fdf4; border-bottom-color: #bbf7d0; }
/* Œil de visibilité élève. */
.lc-eye { border: 0; background: transparent; cursor: pointer; padding: 2px 4px; font-size: 1.05rem; line-height: 1; border-radius: 6px; filter: grayscale(1); opacity: .55; transition: opacity .12s, filter .12s, background .12s; }
.lc-eye:hover { background: var(--slate-100); opacity: .85; }
.lc-eye.is-on { filter: none; opacity: 1; }
.lc-seq__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--slate-50); border-bottom: 1px solid var(--border); }
/* Menus dépliants : flèche de repli + masquage de la liste quand replié. */
.lc-fold { flex: 0 0 auto; width: 22px; height: 22px; padding: 0; border: 0; background: transparent;
    color: var(--slate-600); font-size: .8rem; line-height: 1; cursor: pointer; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, background .12s; }
.lc-fold:hover { background: var(--slate-200); }
.lc-seq:not(.is-collapsed) .lc-fold { transform: rotate(90deg); }
.lc-seq.is-collapsed .lc-lecons { display: none; }
.lc-seq.is-collapsed .lc-seq__head { border-bottom: 0; }
.lc-seq__title { margin: 0; font-size: 1.05rem; }
.lc-seq__title--muted { color: var(--muted); font-weight: 600; }
.lc-seq__tools { display: flex; gap: 12px; font-size: .85rem; }
.lc-seq__empty { color: var(--muted); padding: 14px 16px; margin: 0; font-size: .9rem; }
.lc-lecons { list-style: none; margin: 0; padding: 0; }
.lc-lecon { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--slate-100); flex-wrap: wrap; cursor: pointer; transition: background .12s; }
.lc-lecon:last-child { border-bottom: 0; }
.lc-lecon:hover { background: #f8fafc; }
/* Leçon masquée aux élèves : titre grisé (l'œil 🚫 signale l'état, les contrôles restent nets). */
.lc-lecon.is-hidden .lc-lecon__title, .lc-lecon.is-hidden .lc-lecon__info { opacity: .5; }
.lc-lecon__title { font-weight: 600; cursor: pointer; }
.lc-lecon:hover .lc-lecon__title:not(.is-editing) { text-decoration: underline; text-underline-offset: 3px; }
.lc-lecon__edit { flex: 0 0 auto; text-decoration: none; font-size: .95rem; line-height: 1; opacity: .65;
    transition: opacity .12s, transform .12s; }
.lc-lecon__edit:hover { opacity: 1; transform: scale(1.15); }
.lc-lecon__info { color: var(--muted); font-size: .82rem; }
.lc-lecon__tools { margin-left: auto; display: flex; gap: 12px; font-size: .85rem; }
.lc-empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* Croix rouge de suppression (devant le titre) */
.lc-del { flex: 0 0 auto; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #ef4444; font-size: 1.2rem; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.lc-del:hover { background: #fee2e2; color: #dc2626; }
/* Titres éditables en place */
.lc-seq__titlewrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lc-seq__title[data-act], .lc-lecon__title[data-act] { cursor: text; border-radius: 4px; }
.lc-seq__title[data-act]:hover, .lc-lecon__title[data-act]:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.lc-seq__title.is-editing, .lc-lecon__title.is-editing { cursor: text; text-decoration: none; background: #fff;
    outline: 2px solid var(--primary); outline-offset: 2px; padding: 0 2px; }
.lc-lecon__title { color: var(--text); }

/* Glisser-déposer (réordonner chapitres / déplacer leçons) */
.lc-drag { flex: 0 0 auto; width: 20px; height: 22px; padding: 0; border: 0; background: transparent;
    color: #94a3b8; cursor: grab; font-size: 1rem; line-height: 1; touch-action: none;
    display: inline-flex; align-items: center; justify-content: center; }
.lc-drag:hover { color: var(--slate-600); }
.lc-drag:active { cursor: grabbing; }
.lc-seq.is-dragging, .lc-lecon.is-dragging { box-sizing: border-box; opacity: .97; background: #fff;
    box-shadow: 0 14px 30px rgba(15,23,42,.18); }
.lc-drop-ph { list-style: none; border: 2px dashed var(--primary); border-radius: 8px;
    background: rgba(79,70,229,.06); margin: 4px 0; box-sizing: border-box; }
body.lc-dragging { user-select: none; cursor: grabbing; }

/* Leçon (affichage écran) */
/* Consultation ET édition d'une leçon : le cours DÉBORDE du gabarit de .container (960px)
   dès que la fenêtre offre la place — tableaux, figures GeoGebra et repères ont besoin de
   largeur, et l'édition doit montrer le bloc à la largeur où il sera lu.
   Marges négatives inférieures à l'espace libre de part et d'autre : rien ne déborde
   horizontalement, et le calcul ne dépend pas de vw (donc pas de l'ascenseur). Même
   technique que .eleve-page--lecon pour la lecture élève. Les modales (.modal, en
   position fixe) et le menu « Dupliquer » (absolu) ne sont pas concernés. */
@media (min-width: 1280px) {
    .lc-show, .lc-edit { margin-inline: -120px; }          /* ≈ 1160px de contenu */
}
.lc-show__bar, .lc-edit__bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.lc-show__title { margin: 6px 0 4px; }
.lc-show__meta { margin: 0; color: var(--muted); font-size: .9rem; }
.lc-show__actions, .lc-edit__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Menu « Dupliquer » : niveaux (accordéon) ▸ chapitres cibles. */
.lc-dup__panel { max-height: min(70vh, 460px); overflow-y: auto; min-width: 250px; padding: 8px; }
.lc-dup__hint { margin: 2px 6px 8px; font-size: 12px; font-weight: 600; color: var(--slate-500); }
.lc-dup__panel .lc-dup__nivbtn { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.lc-dup__caret { display: inline-block; font-size: 11px; color: var(--slate-500); transition: transform .15s ease; }
.lc-dup__niv.is-open > .lc-dup__nivbtn .lc-dup__caret { transform: rotate(90deg); }
.lc-dup__chaps { display: none; margin-bottom: 4px; }
.lc-dup__niv.is-open > .lc-dup__chaps { display: block; }
.lc-dup__panel .lc-dup__chap { padding-left: 32px; font-size: 14px; color: var(--slate-700); }
.lc-dup__panel .lc-dup__chap--none { font-style: italic; color: var(--slate-500); }

.lc-doc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; }
.lc-block { margin: 0 0 18px; }
.lc-block:last-child { margin-bottom: 0; }

/* Encadrés mathématiques */
.encadre { border-left: 4px solid; border-radius: 0 10px 10px 0; padding: 12px 16px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Bloc atteint depuis la recherche élève (#sec-id) : marge d'arrivée + halo. */
.encadre { scroll-margin-top: 90px; }
.encadre:target { box-shadow: 0 0 0 3px rgba(79,70,229,.30); }
.encadre__head { font-weight: 800; margin-bottom: 6px; font-size: .9rem; text-transform: uppercase; letter-spacing: .3px; }
.encadre__body { }
/* Chaque type ne pose que TROIS VARIABLES, jamais les propriétés elles-mêmes : c'est ce
   qui permet à l'enseignant de refaire le code couleur depuis /gestion#encadres — la page
   se contente alors de redéfinir ces variables (views/partials/encadre_couleurs.php).
   La palette d'origine vit ici ET dans lc_encadre_palette() (core/helpers.php), qui sert
   au réglage et à l'estrade : garder les deux en phase. */
/* --enc-texte : couleur de police du CORPS. Une encre sombre teintée du type, pour que le
   code couleur se lise jusque dans le texte sans qu'un paragraphe entier soit en couleur
   vive. Elle est posée sur .encadre : les liens, le code et les formules de .prose gardent
   leurs propres règles, l'héritage ne touche que le texte courant. */
.encadre { border-color: var(--enc-bord, var(--slate-400)); background: var(--enc-fond, transparent);
    color: var(--enc-texte, inherit); }
.encadre__head { color: var(--enc-titre, inherit); }
.encadre--definition { --enc-bord: #2563eb; --enc-fond: #eff6ff; --enc-titre: #1d4ed8; --enc-texte: #1e3a8a; }
.encadre--propriete  { --enc-bord: #059669; --enc-fond: #ecfdf5; --enc-titre: #047857; --enc-texte: #064e3b; }
.encadre--theoreme   { --enc-bord: #7c3aed; --enc-fond: #f5f3ff; --enc-titre: #6d28d9; --enc-texte: #4c1d95; }
.encadre--methode    { --enc-bord: #d97706; --enc-fond: #fffbeb; --enc-titre: #b45309; --enc-texte: #78350f; }
.encadre--remarque   { --enc-bord: #64748b; --enc-fond: #f1f5f9; --enc-titre: #475569; --enc-texte: #1e293b; }
.encadre--exemple    { --enc-bord: #db2777; --enc-fond: #fdf2f8; --enc-titre: #be185d; --enc-texte: #831843; }
.encadre--rappel     { --enc-bord: #0891b2; --enc-fond: #ecfeff; --enc-titre: #0e7490; --enc-texte: #164e63; }
.lc-res__img { max-width: 100%; border-radius: 10px; display: block; margin: 0 auto; }
.lc-res__empty { color: var(--muted); font-style: italic; }

/* ===== Bloc « séparation » : barre horizontale fine, 3 styles + couleur ==========
   Balisage unifié (helper lc_separator) : <div.lc-sep.lc-sep--STYLE> + 3 <span>.
   Les <span> ne servent qu'à l'ornement (masqués pour les autres styles) : balisage
   constant → l'aperçu de l'éditeur bascule de style sans reconstruire le DOM.
   La couleur passe par --sep-color (défaut thème, surchargé en ligne par le choix). */
.lc-sep-block { padding: 6px 0; }
.lc-sep {
    --sep-color: var(--slate-400);
    display: flex; align-items: center; justify-content: center;
    width: 100%; margin: 0; border: 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lc-sep__wing, .lc-sep__gem { display: none; }
/* Style 1 — trait fin net (bouts arrondis, léger fondu aux extrémités pour la finesse) */
.lc-sep--line {
    height: 3px; border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--sep-color) 5%, var(--sep-color) 95%, transparent);
}
/* Style 2 — pointillés ronds réguliers */
.lc-sep--dots {
    height: 6px;
    background: radial-gradient(circle closest-side, var(--sep-color) 92%, transparent) center / 18px 6px repeat-x;
}
/* Style 3 — ornement central : losange encadré de deux ailes en fondu */
.lc-sep--ornament { gap: 14px; }
.lc-sep--ornament .lc-sep__wing {
    display: block; flex: 1 1 0; max-width: 40%; height: 2px; border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--sep-color));
}
.lc-sep--ornament .lc-sep__wing:last-child { background: linear-gradient(90deg, var(--sep-color), transparent); }
.lc-sep--ornament .lc-sep__gem {
    display: block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 2px;
    background: var(--sep-color); transform: rotate(45deg);
}

/* ---- Éditeur du bloc séparation : cartes de style + couleur + aperçu ---- */
.lc-sep-edit { display: flex; flex-direction: column; gap: 16px; }
.lc-sep-styles { display: flex; gap: 10px; flex-wrap: wrap; }
.lc-sep-opt { flex: 1 1 130px; margin: 0; cursor: pointer; }
.lc-sep-opt input { position: absolute; width: 0; height: 0; opacity: 0; }
.lc-sep-opt__card {
    display: flex; flex-direction: column; align-items: center; gap: 11px;
    padding: 16px 12px 11px; border: 1.5px solid var(--border); border-radius: 12px;
    background: #fff; transition: border-color .12s, box-shadow .12s, background .12s;
}
.lc-sep-opt:hover .lc-sep-opt__card { border-color: var(--slate-300); }
.lc-sep-opt input:checked + .lc-sep-opt__card {
    border-color: var(--acc-cours-2); background: #f0fdf9; box-shadow: 0 0 0 3px rgba(16,185,129,.14);
}
.lc-sep-opt input:focus-visible + .lc-sep-opt__card { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.28); }
.lc-sep-opt__demo { display: flex; align-items: center; width: 100%; height: 12px; }
.lc-sep-opt__name { font-size: .82rem; font-weight: 600; color: var(--slate-600); }
.lc-sep-opt input:checked + .lc-sep-opt__card .lc-sep-opt__name { color: var(--acc-cours-2); }

.lc-sep-color { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lc-sep-color__lbl { font-size: .9rem; font-weight: 600; color: var(--slate-700); }
.lc-sep-colorpick { width: 46px; height: 32px; padding: 2px; border: 1px solid var(--slate-300); border-radius: 8px; background: #fff; cursor: pointer; }
.lc-sep-colorpick::-webkit-color-swatch-wrapper { padding: 0; }
.lc-sep-colorpick::-webkit-color-swatch { border: 0; border-radius: 5px; }
.lc-sep-colorpick::-moz-color-swatch { border: 0; border-radius: 5px; }
.lc-sep-swatches { display: flex; gap: 7px; }
.lc-sep-swatch { width: 24px; height: 24px; padding: 0; border: 1px solid rgba(15,23,42,.15); border-radius: 50%; cursor: pointer; transition: transform .1s; }
.lc-sep-swatch:hover { transform: scale(1.12); }
.lc-sep-swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lc-sep-live { padding: 16px 14px; border: 1px dashed var(--slate-300); border-radius: 10px; background: var(--slate-50); }

/* Éditeur de leçon */
.lc-meta { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.lc-meta__titre { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.lc-meta__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lc-meta__row .field__input { width: auto; }
.lc-meta__annee { max-width: 150px; }
.lc-saved { color: #047857; font-size: .85rem; font-weight: 600; }
/* ==========================================================================
   Ajout de blocs dans l'éditeur de leçon : zones d'insertion + catalogue
   ==========================================================================
   Une ZONE (.lc-ins) précède chaque bloc. Au repos elle n'est qu'une gouttière
   de 12 px, invisible ; au survol (ou au focus clavier) elle s'ouvre à 46 px —
   les deux blocs s'écartent — et découvre un filet et un « + ».

   Deux points à ne pas défaire :
   — la zone est le SEUL élément qui grandit ; on ne touche pas aux marges des
     cartes, sinon l'écartement se joue à deux endroits et sautille ;
   — :focus-within autant que :hover, faute de quoi l'insertion au milieu d'une
     leçon serait hors d'atteinte au clavier (le « + » est un vrai bouton, donc
     tabulable, mais il resterait transparent).
   ========================================================================== */

.lc-ins {
    position: relative; height: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: height .18s cubic-bezier(.22, .9, .3, 1);
}
/* Le filet : dégradé vers les bords, pour ne pas trancher la colonne au couteau. */
.lc-ins::before {
    content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
    border-radius: 2px; opacity: 0; transform: scaleX(.55);
    background: linear-gradient(90deg, transparent, var(--acc-cours-1) 14%, var(--acc-cours-1) 86%, transparent);
    transition: opacity .18s ease, transform .22s cubic-bezier(.22, .9, .3, 1);
}
.lc-ins__btn {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border: 1px solid var(--acc-cours-2); border-radius: 50%;
    background: #fff; color: var(--acc-cours-2); cursor: pointer;
    opacity: 0; transform: scale(.55);
    box-shadow: 0 2px 10px rgba(15, 23, 42, .16);
    transition: opacity .16s ease, transform .2s cubic-bezier(.22, .9, .3, 1),
                background .12s ease, color .12s ease;
}
.lc-ins__btn svg { width: 16px; height: 16px; }
.lc-ins__btn:hover { background: var(--acc-cours-2); color: #fff; }
.lc-ins__btn:focus-visible { outline: 2px solid var(--acc-cours-2); outline-offset: 3px; }

.lc-ins:hover, .lc-ins:focus-within, .lc-ins.is-open { height: 46px; }
.lc-ins:hover::before, .lc-ins:focus-within::before, .lc-ins.is-open::before { opacity: 1; transform: none; }
.lc-ins:hover .lc-ins__btn, .lc-ins:focus-within .lc-ins__btn, .lc-ins.is-open .lc-ins__btn { opacity: 1; transform: none; }
/* Pendant un glisser-déposer, les rangs sont faux et l'épaisseur des zones fausserait
   les milieux calculés par onSort : elles disparaissent le temps du tri. */
.lc-sections.is-sorting .lc-ins { display: none; }

/* Barre collante : le point d'ajout toujours visible (fin de leçon). */
.lc-addbar {
    position: sticky; bottom: 0; z-index: 5; margin: 14px 0 0; padding: 10px 14px;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: rgba(255, 255, 255, .96); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.lc-addbar__btn { display: inline-flex; align-items: center; gap: 8px; }
.lc-addbar__btn svg { width: 17px; height: 17px; }
.lc-addbar__hint { color: var(--muted); font-size: .84rem; }

/* ---- Catalogue de blocs (panneau unique, ancré au « + » cliqué) ---------- */
/* Quatre colonnes plutôt que trois : les dix-sept types tiennent alors en six rangées,
   soit un panneau qui s'ouvre entier sur un écran ordinaire. Il défile au besoin — sur un
   portable bas de plafond — mais ce n'est plus le cas courant. */
.lc-bm {
    position: absolute; z-index: 60; width: 420px;
    max-height: min(72vh, 660px); overflow-y: auto;
    padding: 12px 14px 14px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
    animation: lc-bm-in .14s ease-out;
}
@keyframes lc-bm-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.lc-bm__title { margin: 0 0 10px; font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--slate-800); }
.lc-bm__grp {
    margin: 12px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; color: var(--slate-400);
}
.lc-bm__grp:first-of-type { margin-top: 2px; }
.lc-bm__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
/* --bm : la couleur du type, portée en style inline par le catalogue. Les sept encadrés
   reprennent celle de leur rendu (.encadre--*), ce qui les rend reconnaissables sans lire. */
.lc-bm__it {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 10px 6px 8px; min-height: 74px;
    border: 1px solid var(--border); border-radius: 11px; background: #fff;
    cursor: pointer; font: inherit; text-align: center; color: var(--slate-700);
    transition: border-color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.lc-bm__it:hover {
    border-color: var(--bm); background: color-mix(in srgb, var(--bm) 7%, #fff);
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .09);
}
.lc-bm__it:focus-visible { outline: 2px solid var(--bm); outline-offset: 2px; }
.lc-bm__ic { display: inline-flex; color: var(--bm); }
.lc-bm__ic svg { width: 22px; height: 22px; }
.lc-bm__lbl { font-size: .74rem; line-height: 1.25; }

@media (max-width: 520px) {
    .lc-bm { width: min(94vw, 420px); }
    .lc-bm__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lc-addbar__hint { display: none; }
}

.lc-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
.lc-card.is-drag { opacity: .6; outline: 2px dashed var(--acc-cours-2); }
.lc-card.is-hidden { opacity: .55; }
.lc-card__bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--slate-100); background: var(--slate-50); border-radius: var(--radius) var(--radius) 0 0; }
.lc-card__drag { cursor: grab; color: var(--slate-400); touch-action: none; user-select: none; }
.lc-card__type { font-weight: 700; font-size: .82rem; color: var(--slate-600); text-transform: uppercase; letter-spacing: .3px; }
/* Boutons visibilité / duplication / suppression, placés devant le type du bloc. */
.lc-card__vis { border: 0; background: none; cursor: pointer; padding: 3px 6px; border-radius: 6px; font-size: .95rem; line-height: 1; }
.lc-card__vis:hover { background: var(--slate-200); }
.lc-card__dup { border: 0; background: none; cursor: pointer; padding: 3px 6px; border-radius: 6px;
    font-size: 1rem; line-height: 1; color: var(--slate-500); }
.lc-card__dup:hover { background: var(--slate-200); color: var(--primary); }
.lc-card__body { padding: 12px; }
/* Repli / dépliage des blocs */
.lc-card__collapse { border: 0; background: none; cursor: pointer; padding: 2px 4px; font-size: .85rem; line-height: 1; color: var(--slate-600); border-radius: 6px; transition: transform .15s ease; }
.lc-card__collapse:hover { background: var(--slate-200); }
.lc-card.is-collapsed .lc-card__collapse { transform: rotate(-90deg); }
.lc-card.is-collapsed .lc-card__bar { border-bottom: 0; border-radius: var(--radius); }
.lc-card.is-collapsed .lc-card__body { display: none; }
/* Bloc ciblé depuis la consultation (crayon) : surlignage temporaire. */
.lc-card.is-flash { animation: lc-flash 1.6s ease; }
@keyframes lc-flash { 0%, 55% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* Consultation d'une leçon : contrôles enseignant par bloc (colonne à gauche). */
.lc-sec { display: flex; align-items: flex-start; gap: 10px; }
.lc-sec > .lc-block { flex: 1 1 auto; min-width: 0; }
.lc-sec.is-hidden { opacity: .5; }
.lc-sec__tools { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; }
.lc-sec__btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
    border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer;
    font-size: .9rem; line-height: 1; color: var(--slate-600); text-decoration: none;
    transition: background .12s, color .12s, border-color .12s; }
.lc-sec__btn:hover { background: var(--slate-100); }
.lc-sec__btn--del { color: #ef4444; }
.lc-sec__btn--del:hover { background: #fee2e2; border-color: #fecaca; color: #dc2626; }
/* Impression rapide d'un bloc (planche de QR codes, de vignettes ou de bandes à découper). */
.lc-sec__btn--imp:hover { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.lc-sec__ico { width: 15px; height: 15px; display: block; }
.lc-sec__btn.is-busy { pointer-events: none; opacity: .5; }
/* Clone hors écran capturé par cours-qr.js pour les vignettes d'image. Sur une étiquette
   à coller, la légende n'est plus qu'un repère : elle descend d'un cran sous sa taille
   d'écran, pour laisser la figure occuper la vignette. Ne concerne QUE ce clone. */
.lc-vignette .lc-figure__cap { font-size: .62rem; margin-top: 2px; }
/* Clone hors écran des bandes « texte / encadré ». L'encadré perd son fond pastel : tiré à
   30 exemplaires il ne ferait que boire de l'encre, et sa barre de couleur suffit à le
   reconnaître. Le fond doit être posé sur .encadre lui-même — html-to-image recopie le
   style CALCULÉ de l'élément capturé, une règle sur le seul parent ne le suivrait pas. */
.lc-planche .encadre { background: #fff; }
/* ⚠️ Le clone est MESURÉ, puis html-to-image le rejoue dans un foreignObject à cette taille
   exacte. Un bloc de texte n'a ni rembourrage ni bordure : les marges de son premier et de
   son dernier paragraphe s'échappent alors par fusion, la hauteur mesurée les ignore, le
   foreignObject les rétablit — et la dernière ligne sort du cadre, coupée en deux. On les
   retire (flow-root contient au passage celles des structures imbriquées) : la mesure
   redevient exacte, et la bande à découper n'en est que plus serrée. */
.lc-planche > * { display: flow-root; }
.lc-planche > * > :first-child { margin-top: 0; }
.lc-planche > * > :last-child { margin-bottom: 0; }
/* Bouton « Ajouter une ressource » : cible de dépôt de fichier (ajout rapide). */
#rp-add-res { transition: box-shadow .12s ease, transform .12s ease; }
#rp-add-res.is-dropping { transform: scale(1.04); outline: 2px dashed #fff; outline-offset: 3px; box-shadow: 0 0 0 4px rgba(37, 99, 235, .35); }
.lc-sections__head { display: flex; align-items: center; margin-bottom: 10px; }
.lc-expand-all { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 600; color: var(--slate-700); cursor: pointer; user-select: none; }
.lc-expand-all input { width: 16px; height: 16px; cursor: pointer; }
.lc-row { display: flex; gap: 10px; margin-bottom: 10px; }
.lc-row .lc-soustype { width: auto; }
.lc-row .lc-titre { flex: 1; }
.lc-contenu { font-family: var(--font-mono, ui-monospace, monospace); resize: vertical; }
.lc-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.lc-preview { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--slate-50); }
.lc-respick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lc-respick[hidden] { display: none; } /* le display:flex ci-dessus l'emporterait sinon sur [hidden] */
.lc-respick__label { color: var(--slate-700); }
.lc-layout { width: auto; }
.lc-legende { margin-top: 8px; font-style: italic; }

/* Rendu : figure image (simple / texte à gauche / à droite) + légende */
.lc-figure { margin: 0; }
.lc-figure__img { margin: 0; }
.lc-figure__img img { max-width: 100%; border-radius: 10px; display: block; margin: 0 auto; }
.lc-figure__cap { margin: 4px 0 0; font-style: italic; font-size: .85rem; color: var(--muted); text-align: center; }
/* Images insérées dans les blocs de texte / encadrés (et dans l'éditeur, pour un rendu identique) : centrées. */
.lc-block.prose img, .lc-block .prose img, .lc-rte img { display: block; margin: 8px auto; }
.lc-figure--left, .lc-figure--right { display: flex; gap: 16px; align-items: flex-start; }
.lc-figure--left .lc-figure__img, .lc-figure--right .lc-figure__img { flex: 0 0 42%; max-width: 42%; }
.lc-figure--left { flex-direction: row-reverse; }
.lc-figure__text { flex: 1; }
/* Deux images côte à côte : colonnes de largeur égale, quelles que soient les proportions des
   images (min-width:0 empêche une image large de pousser sa voisine hors de la page). Elles se
   calent en haut, chacune avec sa légende ; le texte d'accompagnement éventuel passe à la
   ligne en pleine largeur, sous le couple (flex-basis 100%). */
.lc-figure--duo { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.lc-figure--duo .lc-figure__img { flex: 1 1 0; min-width: 0; }
.lc-figure--duo .lc-figure__text { flex: 1 0 100%; }
/* Texte au-dessus / en dessous : le DOM place toujours la figure AVANT son texte (l'ordre de
   lecture reste le même pour un lecteur d'écran), c'est column-reverse qui remonte le texte. */
.lc-figure--top, .lc-figure--bottom { display: flex; flex-direction: column; gap: 10px; }
.lc-figure--top { flex-direction: column-reverse; }
/* Un dessin est CARRÉ : à pleine largeur il mangerait la page. On le borne, et on le centre
   quand il est seul (les mises en page latérales, elles, le calent déjà dans leur colonne). */
.lc-figure--simple .dessin-view,
.lc-figure--top .dessin-view,
.lc-figure--bottom .dessin-view { max-width: 460px; margin-inline: auto; }

/* Rendu : tableau */
.lc-table { border-collapse: collapse; width: 100%; }
/* Conteneur du tableau : c'est lui qui porte, en padding, la place réservée aux flèches
   (js/tableau-core.js) — les arcs vivent donc dans le flux du bloc et ne peuvent jamais
   déborder sur le bloc précédent. Le padding est écrit en ligne par la mise en page.
   Il enveloppe aussi bien le tableau du bloc « Tableau » qu'un tableau posé au fil du
   texte (js/rte.js), qui porte alors son modèle dans data-fleches. */
.lc-tablo { position: relative; }
.lc-table td { border: 2px solid #000; padding: 8px 10px; vertical-align: top; }
.lc-table td .prose { margin: 0; }
.lc-table__img { max-width: 160px; max-height: 140px; display: block; margin: 0 auto; }

/* Éditeur de tableau */
.lc-table-edit { margin-bottom: 8px; }
.lc-table-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
/* Fusion / scission : outils qui portent sur la cellule SÉLECTIONNÉE, d'où le séparateur,
   l'indice affiché tant qu'aucune cellule n'est choisie et l'état désactivé des boutons. */
.lc-table-tools__sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--border); }
.lc-table-tools__hint { color: var(--muted); font-size: .78rem; font-style: italic; }
.lc-table-tools .btn[disabled] { opacity: .45; cursor: not-allowed; }
.lc-table-ed td.is-active { outline: 2px solid var(--primary); outline-offset: -2px; }
/* Barre de mise en forme partagée du tableau (pilote la cellule focalisée). */
.lc-table-fmt { margin-bottom: 8px; }
.lc-table-fmt .lc-fmt { margin-bottom: 0; }
.lc-table-wrap { overflow-x: auto; }
.lc-table-ed { border-collapse: collapse; width: 100%; }
.lc-table-ed td { border: 2px solid #000; padding: 4px; vertical-align: top; min-width: 120px; }
.lc-cell { position: relative; }
/* Éditeur enrichi de cellule (contenteditable) : plus compact que .lc-rte, sans bordure (la cellule a la sienne). */
.lc-cell .lc-cell__ed { min-height: 1.8em; border: 0; border-radius: 4px; padding: 4px 6px; background: none; }
.lc-cell .lc-cell__ed:focus { box-shadow: none; outline: 1px solid var(--primary); }
.lc-cell__tools { display: flex; gap: 4px; margin-top: 4px; }
.lc-cell__tools button { border: 0; background: var(--slate-100); cursor: pointer; border-radius: 5px; padding: 2px 7px; font-size: .85rem; }
.lc-cell__tools button:hover { background: var(--slate-200); }
.lc-cell--img { display: flex; align-items: flex-start; gap: 4px; }
.lc-cell--img img { max-width: 130px; max-height: 110px; border-radius: 6px; }
.lc-cell--ggb { display: flex; align-items: flex-start; gap: 4px; }
.lc-cell__ggb { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .8rem; color: var(--slate-600); text-align: center; }
.lc-cell__ggb-ic { font-size: 1.5rem; }
.lc-cell__ggb-img { max-width: 150px; max-height: 120px; border-radius: 6px; display: block; }
.lc-cell__rm { border: 0; background: var(--slate-100); cursor: pointer; border-radius: 5px; padding: 1px 6px; }

/* ----------------------------------------------------------------------------
   Flèches de liaison d'un tableau (js/tableau-core.js) — bloc « Tableau » comme
   tableau posé au fil du texte (bouton « ↷ Flèche » de la barre, js/rte.js).
   Une bande par côté utilisé, posée dans le padding réservé par la mise en page.

   L'ASPECT (position, boîte de la bulle, couleurs) est écrit EN LIGNE par le moteur,
   pas ici : l'estrade projette le bloc dans un <foreignObject> rastérisé que cette
   feuille de style n'atteint pas. Ne subsiste ici que l'écran — impression couleur,
   édition, sélection.
   ---------------------------------------------------------------------------- */
.tbf-arc, .tbf-tip, .tbf-bub { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.tbf-bub__c { margin: 0; }
.tbf-bub__c > :first-child { margin-top: 0; }
.tbf-bub__c > :last-child { margin-bottom: 0; }
.tbf-bub__c p { margin: 0; }

/* Édition : la bulle se saisit sur place, la barre de mise en forme du tableau la pilote
   comme une cellule (cf. cours.js → _activeCellEd). */
.tbf-bub--ed { pointer-events: auto; min-width: 42px; cursor: text; }
.tbf-bub--ed .tbf-bub__c { min-height: 1.2em; outline: none; }
.tbf-bub--ed .tbf-bub__c:empty::before { content: attr(data-placeholder); color: var(--muted); }
.tbf-bub--ed.is-sel { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.tbf-band .tbf-hit { pointer-events: stroke; cursor: pointer; }
.tbf-arc.is-sel { stroke-width: 3.4; }

/* Panneau de réglage de la flèche sélectionnée */
.tbf-insp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px;
    padding: 8px 10px; background: var(--slate-100); border: 1px solid var(--border); border-radius: var(--radius); }
.tbf-insp[hidden] { display: none; }
.tbf-insp__t { font-weight: 700; font-size: .85rem; }
.tbf-insp__f { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--slate-600); }
.tbf-insp__f select { font: inherit; padding: 2px 4px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.tbf-insp__sw { display: inline-flex; gap: 3px; }
.tbf-sw { width: 18px; height: 18px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; padding: 0; }
.tbf-sw.is-on { border-color: var(--slate-800, #1e293b); }
.tbf-insp__del { margin-left: auto; }

/* QR code (impression des vidéos ; ressource de type lien externe) */
.lc-qr-block { display: flex; align-items: center; gap: 14px; }
.lc-qr { width: 132px; height: 132px; flex: 0 0 auto; }
.lc-qr svg { width: 100%; height: 100%; }
.lc-qr__cap { margin: 0; font-size: .9rem; }
.lc-qr__url { color: var(--muted); font-size: .8rem; word-break: break-all; }
/* Bloc ressource « lien » : QR cliquable, centré, titre + URL sous le code. */
/* Le titre se lit À DROITE du QR : le code reste carré et compact à gauche, le libellé
   occupe la largeur restante au lieu de forcer un bloc étroit et centré. */
.lc-qr-block--link { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; text-align: left; text-decoration: none; color: inherit; }
.lc-qr-block--link .lc-qr__cap { flex: 1 1 auto; min-width: 0; font-weight: 600; }
/* Exception : dans une case de carte mentale, la boîte est trop étroite pour deux
   colonnes — le libellé repasse sous le code. */
.cmt-node__qr.lc-qr-block--link { flex-direction: column; justify-content: center; gap: 8px; text-align: center; }
.cmt-node__qr.lc-qr-block--link .lc-qr__cap { flex: 0 0 auto; }
.lc-qr-block--link:hover .lc-qr__url,
.lc-qr-block--link:focus-visible .lc-qr__url { text-decoration: underline; }

/* Dupliquer un bloc : choix de la leçon d'arrivée dans l'arborescence du Cours.
   Les enveloppes Niveau / Chapitre réutilisent les styles .evpick-* du sélecteur
   de leçons ; seules les lignes « leçon » sont propres à cette modale. */
#secdup-modal .modal__box--secdup { max-width: min(720px, 96vw); }
.sd-hint { color: var(--slate-600); font-size: .9rem; margin: 0 0 10px; }
.sd-row { display: flex; align-items: center; gap: 8px; width: calc(100% - 12px); text-align: left;
    margin: 3px 0 3px 12px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font: inherit; cursor: pointer; }
.sd-row:hover, .sd-row:focus-visible { background: var(--slate-100); border-color: var(--primary); }
.sd-row__t { flex: 1 1 auto; min-width: 0; font-size: .9rem; color: var(--slate-800); overflow-wrap: anywhere; }
.sd-row__ctx { flex: 0 0 auto; color: var(--muted); font-size: .78rem; }
.sd-row__cur { flex: 0 0 auto; background: var(--slate-100); color: var(--slate-600); border-radius: 999px;
    padding: 2px 8px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

/* Sélecteur de ressource : arborescence dépliante de « Mes documents »
   (dossiers repliables, titres complets, catégorie visible, aperçu à l'œil). */
#respick-modal .modal__box--respick { max-width: min(1040px, 96vw); }
.rp-list { margin: 12px 0 0; padding: 2px; max-height: 66vh; overflow: auto; }
.rp-empty { color: var(--muted); padding: 22px 6px; text-align: center; }
.rp-tree { display: flex; flex-direction: column; gap: 1px; }

/* En-tête de section-séparateur */
.rp-sec__h { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    padding: 12px 8px 4px; }
.rp-tree > .rp-sec__h:first-child { padding-top: 2px; }

/* Icône de catégorie (SVG en filet, façon « Mes documents ») */
.rp-ic { flex: 0 0 auto; width: 20px; height: 20px; color: var(--slate-500); }
.rp-ic--folder { color: var(--primary); }
.rp-ic--geogebra, .rp-ic--mathalea { color: #7c3aed; }
.rp-ic--youtube { color: #dc2626; }

/* Dossier dépliant */
.rp-folder { display: flex; flex-direction: column; }
.rp-fold { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: none;
    cursor: pointer; font: inherit; font-weight: 600; color: var(--slate-700); padding: 9px 10px; border-radius: 9px; }
.rp-fold:hover { background: var(--slate-100); }
.rp-caret { flex: 0 0 auto; width: .8em; color: var(--muted); font-size: .8rem; transition: transform .12s; }
.rp-fold.is-open .rp-caret { transform: rotate(90deg); }
.rp-fold__name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.rp-fold__count { flex: 0 0 auto; font-size: .72rem; color: var(--muted); background: var(--slate-100);
    border-radius: 999px; padding: 1px 9px; }
.rp-children { display: flex; flex-direction: column; gap: 1px; }
.rp-children[hidden] { display: none; } /* le display:flex ci-dessus l'emporterait sinon sur [hidden] */

/* Document (feuille) : icône + titre complet + catégorie + œil (aperçu) */
.rp-item { display: flex; align-items: stretch; gap: 2px; border-radius: 9px; }
.rp-item:hover { background: var(--slate-100); }
.rp-pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 11px; text-align: left;
    border: 0; background: none; cursor: pointer; font: inherit; color: inherit; padding: 9px 6px 9px 10px; border-radius: 9px; }
.rp-item__t { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.rp-item__cat { flex: 0 0 auto; font-size: .7rem; color: var(--slate-600); background: var(--slate-100);
    border: 1px solid var(--slate-200); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.rp-eye { flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 34px; margin-right: 6px; border: 0; background: none; color: var(--slate-400);
    cursor: pointer; border-radius: 8px; transition: background .12s, color .12s; }
.rp-eye__ic { width: 20px; height: 20px; }
.rp-eye:hover { background: var(--slate-200); color: var(--primary); }

/* Pied du sélecteur : destination de la ressource à créer (à gauche), bouton d'ajout (à droite). */
.rp-foot { align-items: center; flex-wrap: wrap; }
.rp-dest { margin-right: auto; display: flex; align-items: center; gap: 9px; min-width: 0; }
.rp-dest__lbl { flex: 0 0 auto; font-size: .85rem; font-weight: 600; color: var(--slate-700); }
.rp-dest .field__input { width: auto; max-width: min(360px, 52vw); padding: 8px 10px; font-size: .88rem; }

/* Visionneuse d'aperçu générique (note / vidéo / lien / fichier) */
#rp-view .modal__box--rpview { max-width: min(900px, 96vw); }
.rpv-body { margin-top: 12px; }
.rpv-body .prose { margin: 0; }
.rp-view__msg { color: var(--muted); padding: 24px 6px; text-align: center; }

/* Barre de mise en forme du texte (éditeur de leçon) */
.lc-fmt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.lc-fmt button[data-fmt] { min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid var(--slate-200); background: #fff; border-radius: 6px; cursor: pointer; font-size: .95rem; line-height: 1; color: var(--slate-700); }
.lc-fmt button[data-fmt]:hover { background: var(--slate-100); }
.lc-fmt .lc-fmt__sel { height: 30px; padding: 0 6px; border: 1px solid var(--slate-200); border-radius: 6px; background: #fff; font-size: .82rem; color: var(--slate-700); }
.lc-fmt .lc-fmt__color { width: 30px; height: 30px; padding: 2px; border: 1px solid var(--slate-200); border-radius: 6px; background: #fff; cursor: pointer; }
.lc-fmt__sep { width: 1px; height: 20px; background: var(--slate-200); margin: 0 4px; }
/* Éditeur de texte enrichi (WYSIWYG) — barre, popovers, zone éditable, source */
.lc-fmt button { min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid var(--slate-200); background: #fff; border-radius: 6px; cursor: pointer; font-size: .95rem; line-height: 1; color: var(--slate-700); }
.lc-fmt button:hover { background: var(--slate-100); }
.lc-fmt__pw { position: relative; display: inline-flex; }
.lc-fmt__pw > button { display: inline-flex; align-items: center; gap: 2px; }
.lc-fmt__pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 24px rgba(15,23,42,.18); padding: 8px; }
.lc-fmt__pop[hidden] { display: none; }
.lc-fmt__swatches { display: grid; grid-template-columns: repeat(6, 22px); gap: 6px; }
.lc-swatch { width: 22px; height: 22px; min-width: 0; padding: 0; border-radius: 5px; border: 1px solid var(--slate-300); cursor: pointer; }
.lc-swatch:hover { transform: scale(1.12); }
.lc-swatch--none { background: #fff; color: var(--slate-400); font-size: .8rem; display: grid; place-items: center; height: 22px; }
.lc-fmt__chars { display: grid; grid-template-columns: repeat(6, 30px); gap: 4px; }
.lc-char { width: 30px; min-width: 0; height: 30px; padding: 0; border: 1px solid var(--slate-200); background: #fff; border-radius: 6px; cursor: pointer; font-size: 1.05rem; }
.lc-char:hover { background: var(--slate-100); }
.lc-fmt__opt { display: block; width: 100%; min-width: 130px; height: auto; text-align: left; border: 0; background: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.lc-fmt__opt:hover { background: var(--slate-100); }
.lc-ink { font-weight: 700; border-bottom: 3px solid #dc2626; line-height: 1; }
.lc-rte { min-height: 92px; border: 1px solid var(--slate-200); border-radius: 8px; padding: 10px 12px; background: #fff; outline: none; line-height: 1.55; }
.lc-rte:focus { border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.lc-rte:empty::before { content: attr(data-placeholder); color: var(--slate-400); pointer-events: none; }
.lc-rte p:first-child { margin-top: 0; }
.lc-rte p:last-child { margin-bottom: 0; }
.lc-math { display: inline-block; }
.lc-math[data-display="1"] { display: block; text-align: center; margin: 6px 0; }
.lc-src { margin-top: 8px; font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, 'Courier New', monospace;
    font-size: .82rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.lc-srcbtn { margin-left: auto; }
.lc-srcbtn.is-on { background: var(--slate-200); }
/* Popover « lien » de la barre WYSIWYG : saisie d'URL + actions. Ouverture vers la
   gauche (right:0) car le contrôle est en fin de barre et le popover est large. */
.lc-fmt__pop--link { left: auto; right: 0; width: 244px; padding: 10px; }
.lc-fmt .lc-link__url { width: 100%; height: 32px; min-width: 0; padding: 0 8px; box-sizing: border-box;
    border: 1px solid var(--slate-200); border-radius: 6px; background: #fff; font-size: .85rem; color: var(--slate-700); }
.lc-fmt .lc-link__url:focus { outline: none; border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.lc-link__row { display: flex; gap: 6px; margin-top: 8px; }
.lc-fmt .lc-link__apply, .lc-fmt .lc-link__remove { height: 30px; min-width: 0; padding: 0 12px; border-radius: 6px; font-size: .82rem; cursor: pointer; }
.lc-fmt .lc-link__apply, .lc-fmt .lc-link__apply:hover { background: var(--primary, #4f46e5); border: 1px solid var(--primary, #4f46e5); color: #fff; }
.lc-fmt .lc-link__apply:hover { filter: brightness(1.06); }
.lc-fmt .lc-link__remove, .lc-fmt .lc-link__remove:hover { background: #fff; border: 1px solid var(--slate-200); color: var(--slate-600); }
.lc-fmt .lc-link__remove:hover { background: var(--slate-100); }

/* Insertion d'un tableau : quadrillage survolé pour choisir lignes × colonnes. */
.lc-tbl__grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.lc-fmt .lc-tbl__cell { width: 18px; height: 18px; min-width: 0; padding: 0; border: 1px solid var(--slate-300); border-radius: 3px; background: #fff; }
.lc-fmt .lc-tbl__cell.is-on { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); }
.lc-tbl__size { margin-top: 8px; font-size: .78rem; color: var(--muted); text-align: center; }
.lc-tbl__opt { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border); font-size: .8rem; color: var(--slate-700); cursor: pointer; }
.lc-tbl__opt input { accent-color: var(--primary, #4f46e5); cursor: pointer; }
/* Rangée d'outils du tableau : sur sa propre ligne (flex-basis 100 %), montrée seulement
   quand le curseur est dans une cellule (cf. js/rte.js → syncTblBar). */
.lc-tblbar { flex: 0 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--slate-200); }
.lc-tblbar[hidden] { display: none; }
.lc-tblbar__lbl { font-size: .78rem; color: var(--muted); }
.lc-fmt .lc-tblbar button { height: 26px; min-width: 26px; font-size: .82rem; }
.lc-fmt .lc-tblbar__del { margin-left: auto; }
.lc-fmt .lc-tblbar__del:hover { background: #fee2e2; border-color: #fca5a5; }
/* Réglages de la flèche sélectionnée (.tbf-insp, posé là par js/tableau-core.js). Hors de
   la rangée « tableau » : celle-ci se referme dès que le curseur passe d'une cellule à une
   bulle, alors que le panneau doit rester ouvert pendant qu'on saisit le « × 3 ». */
.lc-fmt__insp { flex: 0 0 100%; }
.lc-fmt__insp:empty { display: none; }
.lc-fmt__insp .tbf-insp { margin-top: 6px; }

/* =========================================================================
   Illustrations posées AU FIL DU TEXTE d'un bloc (bouton 🖼) — js/rte.js
   L'image porte sa mise en page en style INLINE (largeur en % du bloc, flottement) :
   elle s'affiche donc juste partout, y compris là où cette feuille n'entre pas — image
   rastérisée de l'estrade, capture du PDF. Les règles ci-dessous ne font que l'habiller
   à l'écran et la signaler comme objet dans l'éditeur.
   ========================================================================= */
.lc-imgdoc { border-radius: 8px; }
/* Une illustration ne se coupe jamais entre deux pages (impression) ni deux colonnes. */
.prose .lc-imgdoc, .lc-rte .lc-imgdoc { break-inside: avoid; page-break-inside: avoid; }
/* Bloc portant une illustration FLOTTANTE : il doit la contenir, sinon elle déborde sur le
   bloc suivant dès que le texte est plus court qu'elle. Le contexte de formatage n'est posé
   que là où il y a un flottant (classe ajoutée au rendu par HM.fixDocImages) : appliqué à
   tous les blocs, il supprimerait la fusion des marges et espacerait toute la leçon. */
.lc-hasfloat { display: flow-root; }
/* Dans l'éditeur : objet atomique — survol et sélection le disent, et le clic ouvre les
   réglages dans la barre de mise en forme. flow-root sans condition ici : la zone de saisie
   a déjà une bordure et un rembourrage, la fusion des marges n'y joue donc aucun rôle. */
.lc-rte { display: flow-root; }
.lc-rte .lc-imgdoc { cursor: pointer; box-shadow: 0 0 0 1px transparent; transition: box-shadow .12s ease; }
.lc-rte .lc-imgdoc:hover { box-shadow: 0 0 0 2px rgba(79,70,229,.45); }
.lc-rte .lc-imgdoc.is-sel { box-shadow: 0 0 0 2px var(--primary, #4f46e5); }

/* Réglages de l'image sélectionnée : rangée pleine largeur de la barre de mise en forme,
   au même endroit que ceux d'une flèche de tableau (.tbf-insp). */
.lc-imgi { flex: 0 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--slate-200); }
.lc-imgi[hidden] { display: none; }
.lc-imgi__t { font-weight: 700; font-size: .85rem; }
.lc-imgi__g { display: inline-flex; gap: 3px; }
.lc-fmt .lc-imgi button { height: 26px; min-width: 26px; font-size: .82rem; }
.lc-fmt .lc-imgi button.is-on { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }
.lc-fmt .lc-imgi__del { margin-left: auto; }
.lc-fmt .lc-imgi__del:hover { background: #fee2e2; border-color: #fca5a5; }
/* Écran étroit : une illustration à 25 % d'une colonne de téléphone n'est plus lisible, et
   le texte qui l'habille tombe à deux mots par ligne. On la remet dans le fil, sans
   flottement — le !important est le seul moyen de passer devant le style inline, qui est
   justement ce qui fait tenir la mise en page partout ailleurs. */
@media (max-width: 560px) {
    .prose .lc-imgdoc { float: none !important; width: auto !important; max-width: 100% !important; margin: 10px auto !important; }
}

/* Menu d'insertion d'un schéma (bouton ⚖) : chaque entrée montre le dessin qu'elle produit. */
.lc-fmt__pop[data-popid="sch"] { padding: 6px; }
.lc-sch__menu { display: flex; flex-direction: column; gap: 2px; }
.lc-fmt .lc-sch__opt { display: flex; align-items: center; gap: 12px; width: 100%; height: auto;
    min-width: 320px; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
    text-align: left; cursor: pointer; }
.lc-fmt .lc-sch__opt:hover { background: var(--slate-100); }
.lc-sch__vue { flex: 0 0 92px; display: flex; align-items: center; justify-content: center;
    min-height: 46px; line-height: 0; }
.lc-sch__vue svg { max-width: 100%; height: auto; }
.lc-sch__txt { display: flex; flex-direction: column; gap: 1px; }
.lc-sch__txt b { font-size: .9rem; color: var(--slate-800); }
.lc-sch__txt i { font-style: normal; font-size: .76rem; color: var(--muted); }

/* =========================================================================
   Schémas insérés PARMI le texte (chaîne d'opérations, balance) — js/schema-core.js
   Le schéma est un SVG autonome posé dans le HTML du bloc : il n'a besoin d'AUCUNE de
   ces règles pour s'afficher juste (leçon, élève, impression, PDF, estrade). Elles ne
   font que le poser dans la ligne de texte et le signaler comme objet dans l'éditeur.
   ========================================================================= */
.lc-schema { display: inline-block; vertical-align: middle; line-height: 0; max-width: 100%; }
.lc-schema svg { max-width: 100%; height: auto; vertical-align: middle; }
/* Un schéma ne se coupe jamais entre deux pages / deux colonnes (écran et PDF). */
.prose .lc-schema, .lc-rte .lc-schema { break-inside: avoid; page-break-inside: avoid; }
/* Dans l'éditeur : objet atomique — survol et sélection le disent. */
.lc-rte .lc-schema { border-radius: 10px; box-shadow: 0 0 0 1px transparent; cursor: pointer;
    transition: box-shadow .12s ease; }
.lc-rte .lc-schema:hover { box-shadow: 0 0 0 2px var(--primary, #4f46e5); }

/* ---- Éditeur de schéma (modale, js/schema-core.js) ----
   Superposition distincte de .modal, comme le clavier mathématique : elle doit passer
   au-dessus des modales déjà ouvertes (note de document, séance du cahier de texte). */
.sch-ov { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: flex-start;
    justify-content: center; padding: 4vh 16px; overflow: auto; z-index: 400; }
.modal__box--schema { max-width: 900px; }
.sch-live { display: flex; align-items: center; justify-content: center; min-height: 130px;
    margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--slate-50); overflow: auto; }
.sch-live svg { max-width: 100%; height: auto; }

.sch-form { display: block; }
/* Chaîne : la bande de réglages reprend l'ordre du schéma — valeur, flèche, valeur… */
.sch-strip { display: flex; align-items: stretch; gap: 8px; padding-bottom: 6px; overflow-x: auto; }
.sch-col { flex: 0 0 auto; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.sch-col--node { width: 144px; }
.sch-col--step { width: 158px; background: var(--slate-50); }
.sch-col__t { margin-bottom: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--muted); }
.sch-f { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; }
/* Une flèche = sa rangée de réglages + son nuancier juste en dessous. */
.sch-arrow + .sch-arrow { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--slate-200); }
.sch-arrow.is-off { opacity: .5; }
.sch-in { flex: 1 1 auto; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--slate-200);
    border-radius: 6px; font: inherit; font-size: .88rem; background: #fff; color: var(--slate-800); }
.sch-in:focus { outline: none; border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.sch-in:disabled { background: var(--slate-100); color: var(--muted); }
.sch-in--wide { width: 100%; box-sizing: border-box; }
.sch-in--op { flex: 1 1 40px; }
.sch-rd, .sch-dir, .sch-on { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 1px solid var(--slate-200);
    border-radius: 6px; background: #fff; cursor: pointer; font-size: .9rem; line-height: 1; color: var(--slate-600); }
.sch-rd:hover, .sch-dir:hover, .sch-on:hover { background: var(--slate-100); }
.sch-rd.is-on, .sch-on.is-on { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }
.sch-dir:disabled { background: var(--slate-100); color: var(--slate-300); cursor: default; }
/* Nuancier : une couleur = un rôle (l'aller en bleu, le retour en vert, par exemple).
   Sur UNE seule rangée : la bande de réglages doit rester aussi lisible que le schéma. */
.sch-sw { display: flex; gap: 2px; margin-top: 5px; }
.sch-sw__b { flex: 0 0 auto; width: 15px; height: 15px; padding: 0; border: 2px solid; border-radius: 50%; cursor: pointer; }
.sch-sw__b.is-on { box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--slate-700); }
.sch-side .sch-sw__b { width: 20px; height: 20px; }
.sch-side .sch-sw { gap: 5px; margin-top: 8px; }
.sch-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Balance : les deux plateaux, puis l'état de l'aiguille. */
.sch-bal { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sch-side { padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.sch-side__lbl { display: block; margin-bottom: 5px; font-size: .8rem; font-weight: 600; color: var(--slate-700); }
.sch-etat { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px;
    font-size: .8rem; font-weight: 600; color: var(--slate-700); }
.sch-e, .sch-z { height: 30px; padding: 0 12px; border: 1px solid var(--slate-200); border-radius: 8px;
    background: #fff; cursor: pointer; font-size: .84rem; color: var(--slate-700); }
.sch-e:hover, .sch-z:hover { background: var(--slate-100); }
.sch-e.is-on, .sch-z.is-on { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }

.sch-chars { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 12px;
    padding-top: 10px; border-top: 1px solid var(--border); }
.sch-char { width: 30px; height: 30px; padding: 0; border: 1px solid var(--slate-200); border-radius: 6px;
    background: #fff; cursor: pointer; font-family: Georgia, 'Times New Roman', serif; font-size: .95rem;
    color: var(--slate-700); }
.sch-char:hover { background: var(--slate-100); }
.sch-hint { margin-left: 6px; font-size: .76rem; color: var(--muted); }
.sch-hint code { background: var(--slate-100); padding: 1px 5px; border-radius: 5px; }
.sch-size { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px;
    font-size: .8rem; font-weight: 600; color: var(--slate-700); }
.modal__box--schema .sch-del { margin-right: auto; color: #b91c1c; }
/* Calculs avec priorités : les signes de l'aperçu se cliquent */
.sch-live rect[data-l] { cursor: pointer; outline: none; }
.sch-live rect[data-l]:hover, .sch-live rect[data-l]:focus { fill: rgba(79,70,229,.16); }
.sch-pr__aide { margin: 0 0 10px; font-size: .84rem; color: var(--slate-700); }
.sch-pr { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.sch-pr__ch { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 600; color: var(--slate-700); }
.sch-pr__ch .sch-in { width: 76px; flex: 0 0 auto; }
.sch-pr__ch--calc { flex: 1 1 260px; }
.sch-pr__ch--calc .sch-in { flex: 1 1 auto; width: auto; }
.sch-pr__ch .sch-sw { margin-top: 0; gap: 5px; }
.sch-pr__ch .sch-sw__b { width: 20px; height: 20px; }
.sch-pr__res { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.sch-pr__res:empty { display: none; }
.sch-pr__l { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--slate-700); }
.sch-pr__l .sch-in { width: 84px; flex: 0 0 auto; }
.sch-pr__msg { margin: 8px 0 0; font-size: .82rem; color: #b45309; }
.sch-pr__msg:empty { display: none; }

@media (max-width: 620px) {
    .sch-bal { grid-template-columns: 1fr; }
}

/* =========================================================================
   Opérations posées — js/poses-core.js
   L'opération elle-même est un SVG AUTONOME (couleurs, retenues, traits : tout est en
   attributs de présentation) : rien ici ne la concerne, et c'est ce qui lui permet de
   s'afficher à l'identique en leçon, chez l'élève, à l'impression, dans le PDF, sur
   l'estrade et sur une page de partage. Cette section n'habille que l'ÉDITEUR, la
   visionneuse, le jeton posé au fil du texte et l'aperçu d'hexagone.
   ========================================================================= */

/* ---- Jeton posé au fil du texte (bloc de texte, encadré…) — même contrat que .lc-schema */
.lc-posee { display: inline-block; vertical-align: middle; line-height: 0; max-width: 100%; }
.lc-posee svg { max-width: 100%; height: auto; vertical-align: middle; }
/* Une opération ne se coupe jamais entre deux pages / deux colonnes (écran et PDF). */
.prose .lc-posee, .lc-rte .lc-posee { break-inside: avoid; page-break-inside: avoid; }
/* Dans l'éditeur : objet atomique — survol et sélection le disent. */
.lc-rte .lc-posee { border-radius: 10px; box-shadow: 0 0 0 1px transparent; cursor: pointer;
    transition: box-shadow .12s ease; }
.lc-rte .lc-posee:hover { box-shadow: 0 0 0 2px var(--primary, #4f46e5); }

/* ---- Éditeur : superposition propre, comme celle des schémas (elle doit passer
   au-dessus d'une modale déjà ouverte). */
.pos-ov { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex;
    align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow: auto; z-index: 400; }
.modal__box--poses { max-width: 960px; width: 96vw; }
.pos-host, .pos-ed { display: block; }

/* Choix du type d'opération, et segments de réglage */
.pos-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--slate-50); }
.pos-seg--type { display: flex; width: 100%; margin: 12px 0; }
.pos-seg__b { flex: 1; padding: 7px 12px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer;
    white-space: nowrap; transition: background .12s ease, color .12s ease; }
.pos-seg__b:hover { background: #fff; color: var(--text); }
.pos-seg__b.is-on { background: var(--slate-800); color: #fff; }

/* Les nombres de l'opération */
.pos-nb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.pos-nb__row { display: flex; align-items: center; gap: 8px; }
.pos-nb__lbl { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted); }
.pos-nb__in { width: 9.5rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px;
    background: #fff; color: var(--text); text-align: right;
    font-family: Georgia, 'Times New Roman', serif; font-size: 1.15rem; letter-spacing: .06em; }
.pos-nb__in:focus { outline: none; border-color: var(--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
.pos-nb__in--court { width: 3.4rem; }
.pos-nb__u { margin-right: 6px; font-size: .8rem; color: var(--muted); }

/* Icônes discrètes : ⊕ ajouter un terme, ✕ le retirer, ✎ reprendre la saisie. */
.pos-ic { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px;
    border: 1px solid transparent; border-radius: 8px; background: none; font: inherit;
    font-size: .9rem; line-height: 1; color: var(--muted); cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease; }
.pos-ic:hover { background: var(--slate-100); color: var(--text); }
.pos-ic--del:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.pos-ic--add { font-size: .84rem; font-weight: 600; color: var(--primary, #4f46e5); }
.pos-ic--add:hover { background: rgba(79, 70, 229, .09); color: var(--primary, #4f46e5); }
.pos-note { margin: 10px 0 0; max-width: 68ch; font-size: .76rem; color: var(--muted); }

/* Aperçu : ce que l'on voit est exactement ce qui sera posé. */
.pos-vue { display: flex; align-items: center; justify-content: center; min-height: 190px;
    margin-top: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 12px;
    background: #fff; overflow: auto; }
.pos-vue svg { max-width: 100%; height: auto; }
.pos-hit { cursor: pointer; }
.pos-avert { margin: 8px 0 0; padding: 7px 11px; border-radius: 9px; background: #fef3c7;
    color: #92400e; font-size: .82rem; }

/* Barres de réglage : chiffre choisi, puis options de l'opération. */
.pos-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--slate-50); }
.pos-bar--cell { min-height: 48px; }
.pos-grp { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pos-lbl { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted); }
.pos-btn { padding: 6px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff;
    font: inherit; font-size: .82rem; color: var(--text); cursor: pointer; }
.pos-btn:hover { background: var(--slate-100); }
.pos-btn.is-on { background: var(--slate-800); border-color: var(--slate-800); color: #fff; }
.pos-btn--danger:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.pos-couls { display: flex; align-items: center; gap: 5px; }
.pos-sw { width: 20px; height: 20px; padding: 0; border: 1px solid rgba(15, 23, 42, .18);
    border-radius: 50%; cursor: pointer; transition: transform .12s ease; }
.pos-sw:hover { transform: scale(1.15); }
.pos-sw.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--slate-800); }
.pos-hint { font-size: .82rem; color: var(--muted); }
.pos-msg { margin: 0; padding: 14px; font-size: .9rem; color: var(--muted); text-align: center; }
.modal__box--poses .pos-del { margin-right: auto; color: #b91c1c; }

/* Visionneuse */
.poses-view { display: flex; justify-content: center; padding: 12px; overflow: auto; }
.poses-view svg { max-width: 100%; height: auto; }

/* Aperçu dessiné dans la tuile (cf. Core\Modules : budget d'octets du type). */
.hm-hex--posesbg { background: linear-gradient(150deg, #fff7ed, #fed7aa); }
.hm-hex--posesbg .hm-hex__ic { display: none; }
.hm-hex__poses { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hm-hex__poses svg { width: 70%; height: 70%; }
.hm-hex--posesbg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

@media (max-width: 620px) {
    .pos-seg--type { flex-wrap: wrap; }
    .pos-seg--type .pos-seg__b { flex: 1 0 30%; }
    .pos-nb__in { width: 7.5rem; }
}

/* Export / impression */
.lc-print__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.lc-print__head { margin-bottom: 18px; border-bottom: 2px solid var(--slate-800); padding-bottom: 10px; }
.lc-print__head h1 { margin: 0 0 4px; }
.lc-print__meta { margin: 0; color: var(--muted); }
/* Impression d'une leçon : case « inclure le titre » devant le titre (écran seulement). */
.lc-print__head--check { display: flex; align-items: center; gap: 12px; }
.lc-print__head--check h1 { margin: 0; }
.lc-print__titlecheck input { width: 17px; height: 17px; cursor: pointer; display: block; }
/* Titre exclu de l'impression : grisé à l'écran pour le signaler. */
.lc-print__head.lc-title-off h1 { opacity: .35; }
.lc-doc--print { border: 0; padding: 0; }

/* Vue impression du Cours : page en A4 PORTRAIT, calée sur sa largeur utile
   (210mm − 2×12mm = 186mm) à l'écran ET à l'impression. Cette égalité écran / papier
   est ce qui permet aux figures GeoGebra — dimensionnées en px au moment du rendu
   écran (geogebra.js → inject) — de remplir la largeur de la page imprimée ; elle
   interdit du même coup d'élargir la feuille à l'écran seul, ce serait mentir sur le
   résultat imprimé.
   Portrait : classement des feuilles dans le classeur élève, au prix d'une ligne plus
   courte (186mm au lieu des 277 du paysage essayé fin juillet). Les trois sorties de
   la page sont alignées sur cette géométrie — impression navigateur (@page ci-dessous)
   et les deux boutons PDF (cours-pdf.js → PAGE_W/PAGE_H + orientation).
   186mm ≈ 703px : la feuille tient dans les 720px utiles de .public-main (760px moins
   son padding), inutile d'élargir le gabarit sur cette page. */
.lc-print { width: 186mm; max-width: 100%; margin: 0 auto; }
/* Seules les figures GeoGebra « côte à côte » passent en pleine largeur (applet dessus,
   texte dessous) : l'applet est dimensionnée en px au rendu écran et resterait cantonnée
   à une colonne étroite (~42%). Une figure image, elle, garde sa mise en page côte à côte
   — un <img> se met à l'échelle de sa colonne, et la feuille doit refléter la leçon. */
.lc-print .lc-figure--ggb.lc-figure--left,
.lc-print .lc-figure--ggb.lc-figure--right { display: block; }
.lc-print .lc-figure--ggb .lc-figure__img { flex: none; max-width: 100%; }
.lc-print .lc-figure--ggb .lc-figure__text { margin-top: 10px; }
/* Les blocs réduits à un QR code (vidéo, MathALÉA, PDF joint) ont longtemps porté
   `break-before: avoid`, pour qu'un QR ne tombe pas seul en haut d'une page, détaché de ce
   qu'il illustre. RETIRÉ le 2026-08-07 : dans Chrome, un `avoid` n'est pas une préférence
   mais une contrainte, et surtout il se CHAÎNE — deux QR consécutifs se soudent l'un à
   l'autre puis au bloc qui les précède, et c'est le groupe entier que la mise en page
   déplace.

   Mesuré sur le cahier de 3e (leçon « A) Développer et réduire »), en millimètres :
   REMARQUE 42,9 + QR vidéo 39,7 + QR MathALÉA 34,9 = 117,5 pour 116,7 disponibles en bas de
   page. La chaîne rate de 0,8 mm — et ces 0,8 mm coûtaient 117 mm de blanc, soit 43 % de la
   page, la REMARQUE et ses deux QR filant ensemble à la page suivante. Sur le cahier d'un
   niveau entier, où les leçons s'enchaînent, le défaut se répète à chaque leçon.

   Arbitrage de Sylvain (2026-08-07) : un QR seul en haut d'une page est préférable à une
   demi-page blanche. Les blocs restent insécables (`break-inside: avoid`, @media print) :
   un QR n'est donc jamais coupé en deux, il peut seulement commencer une page. */

/* Écran étroit : la page « papier » (277mm) est rabotée par max-width:100% et deux
   colonnes n'y tiennent plus → visuel dessus, texte dessous. Écran seulement : à
   l'impression la largeur est toujours celle de l'A4. */
@media screen and (max-width: 640px) {
    .lc-print .lc-figure--left,
    .lc-print .lc-figure--right,
    .lc-print .lc-figure--duo { display: block; }
    .lc-print .lc-figure--left .lc-figure__img,
    .lc-print .lc-figure--right .lc-figure__img { flex: none; max-width: 100%; }
    /* Deux images empilées : le même écart qu'entre les deux colonnes, en vertical. */
    .lc-print .lc-figure--duo .lc-figure__img + .lc-figure__img { margin-top: 16px; }
    .lc-print .lc-figure--left .lc-figure__text,
    .lc-print .lc-figure--right .lc-figure__text,
    .lc-print .lc-figure--duo .lc-figure__text { margin-top: 10px; }
}

/* =========================================================================
   « Cahier de cours » — impression de tout un niveau (/cours/niveau/{id}/print)
   Même feuille A4 portrait que l'impression d'une leçon (.lc-print, 186mm de
   large) : page de garde, une page de titre par chapitre, puis une page par
   leçon, enchaînées par des sauts de page forcés.
   Hauteur utile d'une page = 297 − 2×12 = 273mm. Les pages « pleines » sont
   bornées un peu en deçà (262mm) : à la hauteur exacte, le moindre arrondi
   déborde et ajoute une page blanche derrière chaque couverture de chapitre.
   ========================================================================= */
.lc-cahier__count { font-size: .88rem; color: var(--muted); }
/* Décompte de préparation (figures GeoGebra dessinées une par une) : vide = invisible. */
.lc-cahier__status { font-size: .88rem; color: var(--muted); }
.lc-cahier__status:empty { display: none; }
.lc-cahier__status.is-pret { color: var(--acc-cours-2); font-weight: 600; }
[data-cahier-print][disabled] { opacity: .55; cursor: progress; }
.lc-cahier__hint { flex-basis: 100%; margin: 0; font-size: .88rem; color: var(--muted); }
/* Mise en garde sur la destination d'impression : à lire avant de cliquer, donc pas en gris de note. */
.lc-cahier__warn { margin-top: 8px; padding: 8px 12px; border-left: 4px solid var(--acc-doc-1); background: #fffbeb; border-radius: 0 8px 8px 0; color: var(--slate-700); }

/* Fond blanc comme .lc-doc : à l'écran, couverture et pages de chapitre
   se lisent comme du papier posé sur l'ardoise du gabarit. */
.cah-page { min-height: 262mm; display: flex; flex-direction: column; background: #fff; }

/* ---- Sauts de page, selon la mise en page ----
   Les quatre réglages sont portés par des classes de la RACINE .lc-cahier, jamais par le
   balisage : la barre d'outils de l'aperçu peut ainsi les basculer à la volée, sans
   recharger — donc sans redessiner une par une les dizaines de figures GeoGebra du niveau.

   Un saut devant chaque chapitre et chaque leçon (la page de garde ouvre le document,
   elle n'en a pas besoin), puis trois exceptions :
   - .lc-cahier--suite  : les leçons s'enchaînent, plus de saut devant elles ;
   - .lc-cahier--reduit : le titre tient dans un bandeau, la 1re leçon reprend dessous —
     sans quoi le bandeau resterait seul sur sa page et l'option ne servirait à rien ;
   - .lc-cahier--recto  : reliure recto-verso, les ouvertures tombent sur une page de droite.
   Le saut APRÈS une page de titre pleine est explicite : sa hauteur (262mm) laisse
   sinon assez de place pour y attirer le titre de la leçon suivante. */
.cah-chap, .cah-lecon { break-before: page; page-break-before: always; }
.cah-chap { break-after: page; page-break-after: always; }
.lc-cahier--suite .cah-lecon { break-before: auto; page-break-before: auto; }
.lc-cahier--reduit .cah-chap { break-after: auto; page-break-after: auto; }
.lc-cahier--reduit .cah-chap + .cah-lecon { break-before: auto; page-break-before: auto; }
.lc-cahier--recto .cah-chap,
.lc-cahier--recto .cah-somm { break-before: right; page-break-before: right; }
/* Deux leçons qui se suivent : de l'air et un filet, sinon on ne voit pas où l'une finit
   et où l'autre commence. Le filet est posé en BAS de celle qui se termine, et non en
   haut de celle qui commence : quand la coupure de page tombe entre les deux, il reste
   ainsi au pied de la page précédente au lieu de flotter seul en haut de la nouvelle
   (vu sur le cahier de 3e du 07/08). Rayon annulé : .lc-doc arrondit ses coins, ce qui
   recourbait les deux extrémités du trait vers le bas. */
.lc-cahier--suite .cah-lecon:has(+ .cah-lecon) { padding-bottom: 8mm; border-bottom: 1px solid var(--slate-300); border-radius: 0; }
.lc-cahier--suite .cah-lecon + .cah-lecon { margin-top: 10mm; }
.lc-cahier--suite .cah-lecon > .lc-print__head { break-after: avoid; page-break-after: avoid; }

/* Page de garde : bloc de titre centré, nom du professeur en pied de page. */
.cah-cover { justify-content: space-between; text-align: center; }
.cah-cover__body { margin: auto 0; }
.cah-cover__hex { display: block; margin: 0 auto 12mm; }
.cah-cover__title { margin: 0; font-size: 3.2rem; line-height: 1.1; letter-spacing: -.02em; }
.cah-cover__niveau { margin: 12mm 0 0; font-family: var(--font-display); font-size: 2rem; font-weight: 600; }
.cah-cover__annee { margin: 4mm 0 0; color: var(--muted); font-size: 1.05rem; }
.cah-cover__prof { margin: 0; font-size: 1.25rem; font-weight: 600; }

/* Page de titre d'un chapitre : rien d'autre sur la page, centré, en grand. */
.cah-chap { justify-content: center; text-align: center; }
.cah-chap__title { margin: 0; font-size: 2.6rem; line-height: 1.2; }

/* Variante « titre réduit » : la page de titre se resserre en un cadre de 10 cm de haut
   en tête de page. Hauteur minimale et non fixe — un titre à rallonge doit pouvoir
   pousser le cadre plutôt que déborder dessous. Le cadre est nécessaire : sans lui, un
   titre nu se confondrait avec celui de la leçon qui le suit immédiatement. */
.lc-cahier--reduit .cah-chap { min-height: 100mm; margin-bottom: 8mm; padding: 6mm 10mm;
    border: 2px solid var(--slate-700); border-radius: 12px; }
.lc-cahier--reduit .cah-chap__title { font-size: 2.1rem; }

/* Sommaire : toujours présent dans le document, révélé par la classe de racine — la case
   à cocher de la barre d'outils l'affiche donc sans recharger la page. */
/* Le saut de page est porté par .cah-somm seul, et non par la règle de révélation :
   à deux classes, celle-ci ferait jeu égal avec .lc-cahier--recto .cah-somm et,
   déclarée après, lui volerait le « break-before: right » du mode recto-verso. */
.cah-somm { display: none; break-before: page; page-break-before: always; }
.lc-cahier--sommaire .cah-somm { display: flex; justify-content: flex-start; }
/* Tout est dimensionné en em : cours-cahier.js n'a plus qu'à poser une taille de police sur
   .cah-somm pour resserrer l'ensemble d'un bloc quand un niveau très fourni déborderait de
   la page. Des rem ou des mm ne suivraient pas et casseraient l'équilibre en se resserrant. */
.cah-somm__head { margin-bottom: 1.6em; padding-bottom: .7em; border-bottom: 2px solid var(--slate-800); text-align: center; }
.cah-somm__title { margin: 0; font-size: 2em; line-height: 1.15; letter-spacing: -.01em; }
.cah-somm__sub { margin: .45em 0 0; color: var(--muted); font-size: .82em; }
/* Deux colonnes : un niveau ordinaire (une douzaine de chapitres, une quarantaine de leçons)
   tient alors sur une page sans rien resserrer. Un chapitre ne se coupe jamais en deux. */
.cah-somm__cols { columns: 2; column-gap: 11mm; }
.cah-somm__chap { break-inside: avoid; margin: 0 0 1.1em; }
.cah-somm__chaptitle { margin: 0 0 .4em; padding-bottom: .22em; border-bottom: 1px solid var(--slate-300);
    font-family: var(--font-display); font-size: .98em; font-weight: 600; line-height: 1.3; }
.cah-somm__lecons { margin: 0; padding: 0; list-style: none; font-size: .86em; color: var(--slate-700); }
/* Retrait négatif : un titre de leçon trop long se replie sous lui-même, aligné sur le texte
   et non sur la marge — deux colonnes étroites en produisent forcément. */
.cah-somm__lecons li { margin: .22em 0; padding-left: 1.1em; text-indent: -1.1em; line-height: 1.35; }

@media screen {
    /* Le document est un rouleau continu à l'écran : un filet matérialise
       chaque saut de page, sinon on ne sait plus où l'on en est. Le retrait
       n'est posé que sur les leçons — sur une page de chapitre il décalerait
       le titre, qui est centré dans la hauteur de la boîte. */
    .cah-chap, .cah-lecon { border-top: 1px dashed var(--slate-300); margin-top: 12mm; }
    .cah-lecon { padding-top: 12mm; }
    /* Là où les leçons s'enchaînent, plus de saut de page devant elles : le filet
       pointillé annoncerait une coupure qui n'existe pas. Même chose pour la 1re leçon
       d'un chapitre réduit, qui reste sur la page du bandeau. */
    .lc-cahier--suite .cah-lecon + .cah-lecon { border-top: 0; padding-top: 0; }
    .lc-cahier--reduit .cah-chap + .cah-lecon { border-top: 0; margin-top: 6mm; padding-top: 0; }
}

/* ---- Réglages de mise en page : modale du classeur et barre d'outils de l'aperçu ---- */
.cah-opt { margin: 0 0 14px; padding: 0; border: 0; }
.cah-opt__legend { padding: 0; font-size: .85rem; font-weight: 600; color: var(--slate-700); }
.cah-opt__choice { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; cursor: pointer; }
.cah-opt__choice input { margin-top: 3px; }
.cah-opt__choice small { display: block; color: var(--muted); font-size: .82rem; }
.cah-opt__fixe { margin: 0; color: var(--muted); font-size: .82rem; }
/* Liste des chapitres à imprimer : bornée en hauteur, un niveau peut en compter quinze. */
.cah-opt__chaps { max-height: 168px; overflow-y: auto; margin-top: 8px; padding: 6px 10px;
    border: 1px solid var(--border); border-radius: 8px; }
.cah-opt__chaps label { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; font-size: .92rem; }
.cah-opt__chaps label.is-all { margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-weight: 600; }
/* Barre d'outils de l'aperçu : les mêmes réglages, appliqués sans recharger. */
.lc-cahier__opts { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 0; font-size: .9rem; }
.lc-cahier__opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    /* Annule le html,body{height:100%} global : en impression il fige le corps à
       exactement une page ; la moindre marge qui s'en échappe (ex. titre décoché →
       en-tête display:none → marge haute du 1er paragraphe qui remonte jusqu'au body,
       les conteneurs .lc-doc--print/.lc-print/.public-main étant sans padding) fait
       alors déborder d'un poil et ajoute une 2e page blanche. */
    html, body { height: auto; }
    .public-topbar, .footer, .no-print { display: none !important; }
    body { background: #fff; }
    .public-main { max-width: none; padding: 0; }
    .lc-print { width: auto; }
    .lc-block { break-inside: avoid; }
}

/* =========================================================================
   Version à compléter (cours à trous) — page d'impression du Cours
   ========================================================================= */

/* Police OpenDyslexic (auto-hébergée) : lisibilité pour les élèves dyslexiques. */
@font-face { font-family: 'OpenDyslexic'; src: url('../fonts/OpenDyslexic-Regular.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'OpenDyslexic'; src: url('../fonts/OpenDyslexic-Bold.woff') format('woff'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'OpenDyslexic'; src: url('../fonts/OpenDyslexic-Italic.woff') format('woff'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'OpenDyslexic'; src: url('../fonts/OpenDyslexic-BoldItalic.woff') format('woff'); font-weight: 700; font-style: italic; font-display: swap; }

.lc-trous-hint { flex-basis: 100%; margin: 0; font-size: .88rem; color: var(--muted); }
/* display:inline-flex de .btn écrase l'attribut [hidden] : on le rétablit explicitement. */
[data-trous-clear][hidden], .lc-trous-hint[hidden] { display: none; }
/* Témoin d'enregistrement automatique (vide = invisible, pas de trou dans la barre). */
.lc-trous-status { font-size: .88rem; color: var(--muted); }
.lc-trous-status:empty { display: none; }

/* Mode actif : tout le document passe en OpenDyslexic (sauf les formules MathJax, qui
   gardent leur police mathématique) ; interlignage élargi pour l'écriture manuscrite. */
.lc-print.is-trous .lc-doc { font-family: 'OpenDyslexic', var(--font-sans, sans-serif); user-select: none; }
.lc-print.is-trous .lc-doc h1, .lc-print.is-trous .lc-doc h2, .lc-print.is-trous .lc-doc h3 { font-family: 'OpenDyslexic', var(--font-display, sans-serif); }
.lc-print.is-trous .prose { line-height: 2; }

/* Mots et formules cliquables (affordance écran uniquement). */
.lc-print.is-trous .trou-w { cursor: pointer; border-radius: 3px; }
.lc-print.is-trous .trou-w:hover { outline: 2px solid #93c5fd; }
.lc-print.is-trous mjx-container { cursor: pointer; }
.lc-print.is-trous mjx-container:hover { outline: 2px solid #93c5fd; border-radius: 3px; }

/* Tous les rendus « trou » sont conditionnés au mode actif (.is-trous) : le bouton
   « Version originale » retire la classe et le document redevient intact à l'écran
   comme à l'impression, sans perdre les masquages mémorisés dans le DOM. */
/* Mot masqué → cadre vide élargi (l'écriture manuscrite prend plus de place que l'imprimé). */
.lc-print.is-trous .trou-w.is-trou {
    display: inline-block; color: transparent; background: #fff;
    border: 1.5px solid #0f172a; border-radius: 5px;
    padding: .05em .7em; min-width: 3em; margin: 1px 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lc-print.is-trous .trou-w.is-trou * { color: transparent; }
/* Mots masqués adjacents : fusionnés en un seul cadre (le cadre passe sur la série,
   les mots à l'intérieur perdent le leur). word-spacing élargi → place pour écrire. */
.lc-print.is-trous .trou-run {
    display: inline-block; color: transparent; background: #fff;
    border: 1.5px solid #0f172a; border-radius: 5px;
    padding: .05em .7em; margin: 1px 0; word-spacing: .5em;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lc-print.is-trous .trou-run .trou-w.is-trou { display: inline; border: 0; background: none; padding: 0; margin: 0; min-width: 0; }
/* Formule masquée → cadre vide encore plus grand (inline-block : min-width/height
   sans effet sur un élément inline). Formule en display : cadre centré à sa taille. */
.lc-print.is-trous mjx-container.is-trou {
    display: inline-block; border: 1.5px solid #0f172a; border-radius: 5px; background: #fff;
    padding: .2em 1em !important; min-width: 4em; min-height: 1.6em;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lc-print.is-trous mjx-container[display="true"].is-trou { display: block; width: fit-content; margin-left: auto; margin-right: auto; }
.lc-print.is-trous mjx-container.is-trou > * { visibility: hidden; }

/* Zones d'image masquées : rectangles blancs à liseré noir, tracés à la souris (% de l'image). */
.trou-imgbox { position: relative; display: block; width: fit-content; max-width: 100%; margin: 0 auto; }
.lc-print.is-trous .trou-imgbox { cursor: crosshair; touch-action: none; }
.lc-print.is-trous .trou-imgbox img { -webkit-user-drag: none; }
.lc-print.is-trous .trou-rect {
    position: absolute; background: #fff; border: 1.5px solid #0f172a; border-radius: 2px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.lc-print.is-trous .trou-rect:hover { border-color: #dc2626; cursor: pointer; }

/* =========================================================================
   Mes documents — tuiles à fond image, nom en bandeau, +, corbeille, dépôt
   ========================================================================= */

.hm-hex { background-size: cover; background-position: center; background-color: var(--slate-200); }

/* Contenu de la tuile */
.hm-hex__ic { position: absolute; inset: 0; display: grid; place-items: center; }
.hm-hex__ic svg { width: 50px; height: 50px; }
/* Titre : centré au milieu de l'hexagone, noir sur SURLIGNAGE BLANC (contour net + halo doux)
   → lisible sur n'importe quel fond (couleur, image, aperçu). Uniforme pour tous les types. */
.hm-hex__name {
    position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); padding: 0 22px;
    font-size: .88rem; font-weight: 700; line-height: 1.18; text-align: center; color: #0f172a;
    paint-order: stroke fill; -webkit-text-stroke: 3px #fff;
    text-shadow: 0 0 3px #fff, 0 0 7px rgba(255, 255, 255, .8);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; z-index: 1;
}
.hm-hex__pub { position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    width: 10px; height: 10px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }

/* Pastille « visible par les élèves » : masquée par défaut, affichée quand le partage est
   actif. Même œil que l'outil correspondant, sur un jeton clair qui tient sur tous les fonds.
   Placée EN BAS À DROITE, à l'intérieur du polygone : posée en haut à droite, elle tombait
   hors du clip-path de l'hexagone (donc invisible) et passait sous la barre d'outils. */
.hm-hex__eleve { position: absolute; bottom: 14px; right: 52px; z-index: 2; display: none; place-items: center;
    width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.94); color: #15803d;
    box-shadow: 0 1px 4px rgba(15,23,42,.35); }
.hm-hex__eleve svg { width: 13px; height: 13px; display: block; }
.hm-tile[data-eleve="1"] .hm-hex__eleve { display: grid; }
/* Pastille « À construire » : figure GeoGebra dont les élèves reçoivent les outils (migration 077).
   Centrée, assez haut pour ne pas croiser l'œil du partage élève ni les silhouettes du dossier
   partagé (bas de la tuile) ; verte, « Enregistrée », quand l'élève y a déposé son travail. */
.hm-hex__outils { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 2;
    white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: .68rem; font-weight: 800;
    background: rgba(255,255,255,.95); color: #b45309; box-shadow: 0 1px 4px rgba(15,23,42,.3); pointer-events: none; }
.hm-hex__outils.is-fait { background: #059669; color: #fff; }
/* Partage élève actif : l'outil reste allumé même sans survol du bouton. */
.hm-tile[data-eleve="1"] .hm-tile__tools button[data-action="eleve"] { background: #d1fae5; color: #047857; }

/* Hexagones partagés avec les élèves : liseré vert (hexagone vert placé derrière, contenu réduit) */
.hm-tile[data-eleve="1"]::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: #16a34a;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
.hm-tile[data-eleve="1"] .hm-hex { position: relative; z-index: 1; transform: scale(.955); }

/* Dossiers & Notes : pas d'icône, le titre occupe l'hexagone (style commun via la base). */
.hm-tile[data-kind="dossier"] .hm-hex__ic { display: none; }
.hm-tile[data-kind="dossier"] .hm-hex__name { font-size: .95rem; }
.hm-hex--note .hm-hex__ic { display: none; }
.hm-hex--note .hm-hex__name { font-size: 1rem; -webkit-line-clamp: 4; }

/* Tuile « + » d'ajout */
.hm-hex--add { background: var(--slate-100); }
.hm-tile--add:hover .hm-hex--add { background: var(--slate-200); }
.hm-hex__plus { font-size: 3.2rem; font-weight: 300; color: var(--slate-400); line-height: 1; }

/* Cible de dépôt (survol pendant le glisser) */
.hm-tile.is-drop { z-index: 8; }
.hm-tile.is-drop .hm-hex { transform: scale(1.14); filter: brightness(1.12) saturate(1.25); }

/* Corbeille fixe */
.hm-trash { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; align-items: center;
    gap: 4px; border: 0; background: none; cursor: pointer; z-index: 40; transition: transform .12s ease; }
.hm-trash:hover { transform: translateY(-2px); }
.hm-trash__hex { width: 84px; height: 73px; color: #fff; display: grid; place-items: center;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: linear-gradient(150deg, #64748b, #475569); filter: drop-shadow(0 5px 9px rgba(15,23,42,.25)); }
.hm-trash__hex svg { width: 30px; height: 30px; }
.hm-trash__label { font-size: .72rem; color: var(--slate-600); font-weight: 600; }
.hm-trash.is-drop { transform: scale(1.12); }
.hm-trash.is-drop .hm-trash__hex { background: linear-gradient(150deg, #ef4444, #dc2626); }

/* Panier : presse-papier de déplacement (translucide, fixé en bas) */
.docs-panier { position: fixed; left: 0; right: 120px; bottom: 0; z-index: 35;
    display: none; align-items: center; gap: 12px; padding: 10px 16px; min-height: 116px;
    background: rgba(15,23,42,.14); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
    border-top: 2px solid rgba(15,23,42,.18); box-shadow: 0 -6px 18px rgba(15,23,42,.12); }
.docs-panier.is-active, .docs-panier.is-revealed { display: flex; }
.docs-panier.is-drop { background: rgba(37,99,235,.18); border-top-color: var(--primary); }
.docs-panier__label { flex: 0 0 auto; writing-mode: vertical-rl; transform: rotate(180deg);
    font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; color: var(--slate-700); }
.docs-panier__items { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto;
    overflow-y: hidden; padding: 2px 2px 6px; flex: 1 1 auto; }

.hm-mini { flex: 0 0 auto; width: 88px; display: flex; flex-direction: column; align-items: center;
    gap: 3px; cursor: grab; user-select: none; touch-action: none; }
.hm-mini__hex { width: 88px; height: 76px; display: grid; place-items: center; color: #fff;
    background-size: cover; background-position: center; background-color: var(--slate-200);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
.hm-mini__ic svg { width: 34px; height: 34px; }
.hm-mini__name { max-width: 88px; font-size: .68rem; line-height: 1.1; text-align: center;
    color: #0f172a; paint-order: stroke fill; -webkit-text-stroke: 2px #fff;
    text-shadow: 0 0 2px #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-mini.is-dragging { position: fixed; z-index: 210; pointer-events: none; opacity: .96; cursor: grabbing; }
.hm-mini.is-dragging .hm-mini__hex { filter: brightness(1.08) drop-shadow(0 10px 16px rgba(15,23,42,.4)); }

/* Bande de détection au ras du bas : révèle le panier pendant un glisser */
.docs-panier-zone { position: fixed; left: 0; right: 0; bottom: 0; height: 40px; z-index: 34; pointer-events: none; }
.docs-panier-zone.is-drop { background: linear-gradient(180deg, rgba(250,204,21,0), rgba(250,204,21,.55)); }

/* Marge basse pour ne pas masquer la dernière rangée quand le panier est actif */
.docs.has-panier { padding-bottom: 150px; }

/* Modale catégorie : ruche d'hexagones — 5 par rangée, rangées intercalées de 4.
   Le nid d'abeille naît du flux : chaque hexagone fait 1/5 de la ruche, les rangées
   s'emboîtent par marge basse négative, et la 1re tuile d'une rangée décalée (cycle
   9 = 5 + 4) est poussée d'un demi-hexagone — une rangée décalée mesure alors 4,5
   hexagones, soit moins que la ruche : elle se referme d'elle-même après 4 tuiles.
   Robuste à la suppression de tuiles (l'éditeur de cours en retire 4, cf. cours.js) :
   le motif se recalcule sur les éléments restants, et une rangée incomplète reste
   une rangée valable. */
.modal__box--cat { max-width: 580px; }
.cat-head { text-align: center; margin-bottom: 16px; }
.cat-sub { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.cat-hive { --s: 104px; width: calc(var(--s) * 5); margin: 0 auto; display: flex; flex-wrap: wrap;
    padding: 4px 0 12px; }
.cat-hex { position: relative; width: var(--s); height: calc(var(--s) * 1.1547);
    margin: 0 0 calc(var(--s) * -0.2887); display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 6px; border: 0; padding: 0 12px; cursor: pointer; font: inherit; color: #fff;
    background: linear-gradient(160deg, var(--cat1), var(--cat2));
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); /* fin liseré clair entre alvéoles */
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
.cat-hex:nth-child(9n+6) { margin-left: calc(var(--s) / 2); }
.cat-hex:hover, .cat-hex:focus-visible { outline: none; z-index: 1; transform: translateY(-3px) scale(1.045);
    filter: saturate(1.12) brightness(1.06);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9); } /* anneau intérieur épousant l'hexagone */
.cat-hex:active { transform: translateY(-1px); }
.cat-hex__ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.cat-hex__ic svg { width: 18px; height: 18px; }
.cat-hex__lbl { font-size: .72rem; font-weight: 700; letter-spacing: .015em; line-height: 1.15;
    text-align: center; text-shadow: 0 1px 2px rgba(15, 23, 42, .25); }
.modal__foot--center { justify-content: center; }
/* Écran étroit : cinq alvéoles de front deviendraient illisibles (les libellés du type
   « Arbre proba. » n'y tiennent plus). On revient donc à la ruche de 3, motif 3-2-3-2
   (cycle 5 = 3 + 2) — l'ancien décalage est neutralisé avant de reposer le nouveau. */
@media (max-width: 620px) {
    .cat-hive { --s: 28vw; width: calc(var(--s) * 3); }
    .cat-hex:nth-child(9n+6) { margin-left: 0; }
    .cat-hex:nth-child(5n+4) { margin-left: calc(var(--s) / 2); }
}
@media (prefers-reduced-motion: reduce) {
    .cat-hex { transition: none; }
    .cat-hex:hover, .cat-hex:focus-visible { transform: none; }
}

/* Modale corbeille */
.trash-bar { margin-bottom: 8px; }
.trash-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.trash-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 4px; border-bottom: 1px solid var(--slate-100); }
.trash-item__t { overflow: hidden; text-overflow: ellipsis; }
.trash-item__tools { display: flex; gap: 12px; font-size: .85rem; white-space: nowrap; }
.linklike--danger { color: #dc2626; }
.trash-empty { color: var(--muted); padding: 16px; text-align: center; }

/* =========================================================================
   Le Cahier de texte
   ========================================================================= */
.cdt__bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.cdt__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cdt__week { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cdt__range { font-weight: 600; }
/* Grille semaine : une rangée par jour, chaque jour aligné avec ses devoirs (colonne droite). */
.cdt__grid { display: flex; flex-direction: column; gap: 12px; }
.cdt-row { display: flex; gap: 18px; align-items: flex-start; }
.cdt-row__main { flex: 1; min-width: 0; }
.cdt-row__side { width: 290px; flex-shrink: 0; }
.cdt-row__main .cdt-day { margin-bottom: 0; }
.cdt-row__side .cdt-travaux-list { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 12px; }
.cdt-side__rest { margin: 0 0 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.cdt-row--rest .cdt-row__main { display: none; }
.cdt__travaux-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cdt__travaux-head h3 { margin: 0; font-size: 1rem; }

.cdt-day { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; padding: 10px 12px; }
.cdt-day__head { margin: 0 0 8px; font-size: 1rem; }
.cdt-day__head span { color: var(--muted); font-weight: 400; font-size: .85rem; }
.cdt-day__add { border: 1px dashed var(--slate-300); background: none; color: var(--muted); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: .82rem; margin-top: 4px; }
.cdt-day__add:hover { background: var(--slate-50); }

.cdt-slot { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; margin-bottom: 6px; border: 1px solid var(--slate-200); }
.cdt-slot:hover { border-color: var(--slate-400); }
.cdt-slot.is-empty { border-style: dashed; color: var(--muted); }
.cdt-slot.is-done { background: #ecfdf5; border-color: #a7f3d0; }
.cdt-slot.is-planned { background: var(--slate-50); }
.cdt-slot__time { font-weight: 700; font-size: .82rem; color: var(--slate-600); min-width: 92px; }
.cdt-slot__body { flex: 1; min-width: 0; }
.cdt-slot__lecon { font-weight: 600; }
.cdt-slot__meta { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; }
.cdt-slot__empty { color: var(--muted); font-size: .9rem; }
.cdt-slot__share { flex: 0 0 auto; border: 1px solid var(--slate-300); background: #fff; color: var(--slate-600); border-radius: 7px; padding: 3px 8px; font: inherit; font-size: .74rem; cursor: pointer; white-space: nowrap; }
.cdt-slot__share:hover { border-color: var(--slate-400); background: var(--slate-50); }
.cdt-slot__share.is-copied { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }

/* Page publique de consultation d'une séance (vue élève, type PRONOTE). */
.seance-pub__copybar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.seance-pub__head { padding-bottom: 14px; border-bottom: 2px solid var(--slate-200); }
.seance-pub__date { color: var(--muted); font-weight: 600; margin: 0 0 2px; }
.seance-pub__h { margin-left: 8px; font-weight: 400; }
.seance-pub__sec { margin-top: 24px; }
.seance-pub__h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; font-size: .76rem; color: var(--slate-500); margin: 0 0 10px; }
.seance-pub__travaux { margin: 0; padding-left: 20px; }
.seance-pub__travaux li { margin: 3px 0; }
.seance-pub__rien { color: var(--muted); }

/* Ressources épinglées : des TUILES, pas une liste à puces. Elles s'ouvrent vraiment (le
   jeton de la séance sert aussi les fichiers), donc elles doivent se cliquer comme des
   boutons. La puce hexagonale et son jeu de couleurs viennent de la pile de ressources de
   l'accueil enseignant (.sres__hex) : un type d'hexagone garde partout la même teinte. */
.seance-pub__res { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.seance-pub__res-item { border: 1px solid var(--border); border-radius: 12px; background: #fff;
    padding: 9px 10px; gap: 11px; }
a.seance-pub__res-item:hover { border-color: var(--primary); background: var(--slate-50); text-decoration: none; }
a.seance-pub__res-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Sans lien (une leçon du Cours n'a pas de page publique) : lisible, mais pas cliquable. */
span.seance-pub__res-item { color: var(--muted); background: var(--slate-50); cursor: default; }
span.seance-pub__res-item::after { content: none; }
.seance-pub__res-item .sres__lbl { display: block; -webkit-line-clamp: none; }
.seance-pub__res-titre { display: block; font-weight: 600; color: var(--slate-800);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
span.seance-pub__res-item .seance-pub__res-titre { color: var(--slate-600); }
.seance-pub__res-type { display: block; font-size: .76rem; color: var(--muted); }

/* Fil d'Ariane d'une ressource ouverte depuis une séance partagée. */
.share__back { display: inline-block; margin-bottom: 14px; color: var(--muted);
    font-size: .88rem; font-weight: 600; text-decoration: none; }
.share__back:hover { color: var(--primary); }
/* Photos prises au téléphone pendant la séance : mêmes vignettes que côté enseignant
   (.sphoto), en lecture seule. */
.seance-pub__photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.seance-pub__photo { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--slate-50, #f8fafc); }
.seance-pub__photo > a { display: block; aspect-ratio: 4 / 3; }
.seance-pub__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seance-pub__photo figcaption { font-size: .76rem; color: var(--muted); padding: 4px 6px; text-align: center; }

.badge--todo { background: #2563eb; } .badge--collect { background: #d97706; }
.badge--late { background: #dc2626; } .badge--ok { background: #047857; }

.cdt-travaux-list { list-style: none; margin: 0; padding: 0; }
.cdt-travail { border-bottom: 1px solid var(--slate-100); padding: 9px 0; }
.cdt-travail.is-done { opacity: .55; }
.cdt-travail__top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cdt-travail__date { font-size: .8rem; color: var(--muted); }
.cdt-travail__desc { font-size: .92rem; }
.cdt-travail__tools { display: flex; gap: 10px; font-size: .8rem; margin-top: 4px; }
.cdt-empty { color: var(--muted); padding: 10px 0; }

/* Modale séance */
.se-context { color: var(--muted); margin: 0 0 12px; }
.se-pick { margin-top: 6px; }

/* Modale séance « façon builder d'évaluation » (voir /evaluation) : boîte élargie
   sur fond clair, en-tête carte proéminent, deux colonnes déroulé | ressources.
   Réutilise les classes .evbuild__* pour un rendu identique à la page évaluation. */
.modal__box--seance { max-width: 920px; background: var(--bg); }
.se-card { margin-bottom: 16px; }
.se-card .se-context { margin: 0 0 4px; }
.se-card .evbuild__titre { font-size: 1.2rem; }
.se-card .evbuild__meta { align-items: flex-end; }
.se-card .evbuild__meta .field--inline { flex: 1 1 260px; }
/* Bloc « séance supplémentaire » (date, classe, nature, horaire) : il ne s'ouvre QUE pour une
   séance hors emploi du temps — le ✎ d'un créneau tient tout cela de lui et n'a rien à demander.
   La règle [hidden] est INDISPENSABLE : le display:grid de .grid2 l'emporterait sinon sur
   l'attribut, et les quatre champs resteraient affichés (même piège que .se-cols juste dessous). */
.se-supp[hidden] { display: none; }
/* Les deux heures (début, fin) partagent une seule case de la grille, sous un seul intitulé. */
.se-supp__h { display: flex; gap: 6px; }
.se-supp__h .field__input { min-width: 0; }
/* Partie 2 : déroulé pleine largeur. */
.se-deroule { margin-bottom: 18px; }
.se-deroule .dash__h2 { margin-bottom: 8px; }
/* Partie 3 : ressources — à gauche celles de la séance, à droite le sélecteur (comme /evaluation). */
.se-cols { grid-template-columns: 1fr 1.3fr; gap: 16px; }
.se-cols[hidden] { display: none; }               /* prime sur .evbuild__cols { display: grid } */
.se-cols .dash__h2 { margin-bottom: 6px; }
.se-res-hint { margin: 2px 0 6px; }
@media (max-width: 900px) { .se-cols { grid-template-columns: 1fr; } }
/* Pile des ressources (hexagones resserrés pour la modale, cible du glisser-déposer) + arbre défilant. */
.se-stack { min-height: 150px; padding: 4px 0; }
.se-stack .rv-item { width: 168px; height: 146px; }
.se-doc-tree { max-height: 340px; overflow-y: auto; padding-right: 2px; }

/* Classes & élèves */
.cls-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.cls-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cls-card__title { margin: 0 0 8px; font-size: 1.1rem; }
.cls-card__sub { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.cls-card__tools { display: flex; align-items: center; gap: 12px; font-size: .85rem; flex-wrap: wrap; justify-content: flex-end; }
.cls-card__export { white-space: nowrap; }
/* Tableau élèves : sélection (étiquettes) · identité (crayon + croix suppr. + prénom) · une colonne par groupe. */
.eleve-grid-wrap { overflow-x: auto; margin: 10px 0 2px; }
.eleve-grid { border-collapse: collapse; width: 100%; font-size: .9rem; }
.eleve-grid th, .eleve-grid td { padding: 6px 8px; border-bottom: 1px solid var(--slate-100); text-align: left; vertical-align: middle; }
.eleve-grid thead th { font-size: .78rem; color: var(--slate-600); font-weight: 600; border-bottom: 2px solid var(--slate-200); }
.eleve-grid__pick { width: 1%; text-align: center; white-space: nowrap; }
.eleve-grid__pick input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); vertical-align: middle; }
.eleve-grid__nom { min-width: 150px; }
.eleve-grid__empty { color: var(--muted); font-style: italic; }
.eleve__ident { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eleve__nom { font-weight: 600; }
.eleve__email { color: var(--muted); font-size: .82rem; }
/* Dernière connexion, juste après le prénom : renseignement de fond (le prénom reste
   ce qu'on lit en premier), la pastille ambre signalant un compte jamais utilisé. */
.eleve__vu { color: var(--muted); font-size: .76rem; white-space: nowrap; background: var(--slate-100, #f1f5f9); border-radius: 6px; padding: 1px 6px; }
.eleve__vu--jamais { color: #b45309; background: #fef3c7; }
.eleve__del { border: 0; background: none; padding: 0; cursor: pointer; color: #dc2626; font-size: 1rem; line-height: 1; }
.eleve__del:hover { color: #b91c1c; }
.eleve-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* En-tête d'une colonne de groupe : nom + outils (renommer / supprimer). */
.eleve-grid__grp { text-align: center; white-space: nowrap; }
.eleve-grid__grp-nom { display: block; }
.eleve-grid__grp-tools { display: inline-flex; gap: 6px; justify-content: center; font-size: .78rem; margin-top: 2px; }
.eleve-grid__cell { text-align: center; width: 1%; }

/* Colonne « Code PIN » : le code est haché en base, donc illisible ; la colonne ne montre
   que ce qui est passé par l'onglet ouvert, masqué par des astérisques jusqu'à ce que
   l'œil de l'en-tête l'ouvre (cf. js/cahier.js). */
.eleve-grid__pin { width: 1%; white-space: nowrap; }
.pin-cell { display: inline-flex; align-items: center; gap: 4px; }
.pin-cell.is-busy { opacity: .5; pointer-events: none; }
.pin-val { border: 1px dashed transparent; background: none; padding: 2px 6px; border-radius: 6px; cursor: pointer;
           font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; letter-spacing: .14em; color: var(--slate-700); }
.pin-val:hover { border-color: var(--slate-300); background: var(--slate-50); }
.pin-val.is-vide { color: var(--muted); letter-spacing: .1em; }
.pin-input { width: 8ch; padding: 2px 6px; border: 1px solid var(--primary); border-radius: 6px;
             font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; letter-spacing: .14em; }
.pin-roll, .pin-eye { border: 0; background: none; padding: 2px; cursor: pointer; font-size: .95rem; line-height: 1; opacity: .6; }
.pin-roll:hover, .pin-eye:hover, .pin-eye[aria-pressed="true"] { opacity: 1; }

/* Bascule d'appartenance : croix rouge (hors du groupe) ↔ coche verte (dans le groupe). */
.grp-toggle { border: 0; background: none; padding: 4px 6px; cursor: pointer; line-height: 1; font-size: 1.05rem; border-radius: 6px; }
.grp-toggle:hover { background: var(--slate-100); }
.grp-toggle:disabled { opacity: .5; cursor: default; }
.grp-toggle__yes { display: none; color: #16a34a; font-weight: 700; }
.grp-toggle__no { display: inline; color: #dc2626; }
.grp-toggle.is-in .grp-toggle__yes { display: inline; }
.grp-toggle.is-in .grp-toggle__no { display: none; }

/* Semaine type */
.sem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.sem-jour { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.sem-jour h3 { margin: 0 0 8px; font-size: .95rem; }
.sem-creneau { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--slate-100); font-size: .9rem; }
.sem-creneau__tools { display: flex; gap: 8px; }

/* Export */
.export-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exp-seance { margin-bottom: 16px; break-inside: avoid; }
.exp-seance__date { font-size: 1.05rem; margin: 0 0 4px; border-bottom: 1px solid var(--slate-200); padding-bottom: 3px; }
.exp-seance__h { font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: 6px; }
.exp-seance__lecon { margin: 4px 0; }
.exp-travaux-title { margin-top: 22px; border-top: 2px solid var(--slate-800); padding-top: 8px; }
.exp-travaux { line-height: 1.7; }

@media (max-width: 760px) {
    .cdt-row { flex-direction: column; }
    .cdt-row__side { width: 100%; }
    .cdt-row--rest .cdt-row__main { display: none; }
}

/* =========================================================================
   L'Estrade (tableau blanc)
   ========================================================================= */
.est { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); padding: 0 12px; }
.est-tool { width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: #fff; border-radius: 9px; cursor: pointer; font-size: 1.05rem; padding: 0;
    /* appui long = raccourci de l'outil (surligneur) : pas de loupe/callout tactile ni de sélection */
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.est-tool:hover { background: var(--slate-100); }
.est-tool:disabled { opacity: .35; cursor: default; }
.est-tool:disabled:hover { background: none; }
.est-tool.is-on { background: var(--slate-900); color: #fff; border-color: var(--slate-900); }
.est-sep { width: 1px; height: 26px; background: var(--border); margin: 0 3px; }
.est-sep--h { width: 100%; height: 1px; margin: 3px 0; }
#est-color { width: 36px; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; }
/* La pastille d'un <input type=color> est un pseudo-élément propre à chaque moteur :
   sans ces règles, Firefox la peint bord à bord et le cadre blanc arrondi disparaît. */
#est-color::-webkit-color-swatch-wrapper, .est-ink--custom::-webkit-color-swatch-wrapper { padding: 0; }
#est-color::-webkit-color-swatch, .est-ink--custom::-webkit-color-swatch { border: 0; border-radius: 6px; }
#est-color::-moz-color-swatch, .est-ink--custom::-moz-color-swatch { border: 0; border-radius: 6px; }
#est-width { width: 100%; accent-color: var(--primary, #4f46e5); }

/* --- Jeu d'icônes unifié de l'Estrade (sprite views/estrade/_icons.php) ---
   Contour = currentColor (suit la couleur du bouton, blanc quand .is-on) ;
   aplat = --est-ico-accent (lavande), transmise dans le shadow-tree du <use>. */
.est-ico { width: 22px; height: 22px; display: inline-block; vertical-align: -0.16em;
    flex: none; pointer-events: none; overflow: visible; --est-ico-accent: #cbc6f7; }
.est-ico--lg { width: 26px; height: 26px; }
.est-ico--sm { width: 18px; height: 18px; }
/* Sur fond foncé (bouton actif ou tête de dock sombre), l'aplat s'éclaircit. */
.est-tool.is-on .est-ico, .est-theme.is-on .est-ico,
.est-grid-opt.is-on .est-ico { --est-ico-accent: rgba(255,255,255,.5); }
/* Icônes accolées à un libellé (items de menu, boutons texte). */
.est-menu__item .est-ico { margin-right: 9px; vertical-align: -0.22em; }
.est-tool--cap .est-ico { width: 20px; height: 20px; }

.est-stage { position: relative; height: calc(100vh - 130px); min-height: 460px; border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); touch-action: none;
    transition: height .28s ease; }
#est-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

/* Indicateur de position du pointeur : anneau haute-visibilité dessiné par la page (donc visible même
   quand le pilote d'une palette graphique masque le curseur du stylet). Suit le pointeur sur le tableau ;
   son diamètre reflète l'épaisseur du trait pour le crayon/surligneur. Piloté par estrade.js (#est-cursor).
   Double liseré (blanc + noir translucide) autour de l'anneau coloré → lisible sur tout fond. */
#est-cursor { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; display: none; will-change: transform; }
#est-cursor.is-on { display: block; }
#est-cursor > i { position: absolute; left: 0; top: 0; box-sizing: border-box;
    width: var(--c-size, 18px); height: var(--c-size, 18px); transform: translate(-50%, -50%);
    border-radius: 50%; border: 2px solid var(--c-color, #4f46e5);
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.95), 0 0 0 3.5px rgba(0,0,0,.22), inset 0 0 0 1.5px rgba(255,255,255,.9); }
#est-cursor > i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
    margin: -1.5px 0 0 -1.5px; border-radius: 50%; background: var(--c-color, #4f46e5); box-shadow: 0 0 0 1px rgba(255,255,255,.9); }

/* --- Onglet d'escamotage du bandeau supérieur -----------------------------
   Poignée fixée au centre, accrochée sous le bandeau. Un clic replie le bandeau
   (il glisse vers le haut) et le tableau grandit d'autant. La hauteur réelle du
   bandeau est mesurée en JS (--topbar-h) ; 58px sert de repli avant exécution. */
.est-barbtn {
    position: fixed; top: var(--topbar-h, 58px); left: 50%; transform: translateX(-50%);
    z-index: 30; display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 20px; padding: 0; border: 0;
    border-radius: 0 0 11px 11px; background: var(--slate-900); color: #fff; cursor: pointer;
    box-shadow: 0 5px 12px rgba(15, 23, 42, .28);
    transition: top .28s ease, height .16s ease, background .16s ease, box-shadow .16s ease;
}
.est-barbtn:hover { height: 24px; background: var(--slate-700, #334155); box-shadow: 0 7px 16px rgba(15, 23, 42, .32); }
.est-barbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.est-barbtn__chev { width: 20px; height: 20px; --est-ico-accent: rgba(255, 255, 255, .55);
    transition: transform .28s ease; }
.est-barbtn__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }

/* État « bandeau masqué » : le bandeau glisse hors champ, l'onglet remonte, le chevron se retourne. */
body.est-nobar .topbar { margin-top: calc(-1 * var(--topbar-h, 58px)); opacity: 0; pointer-events: none; }
body.est-nobar .est-barbtn { top: 0; }
body.est-nobar .est-barbtn__chev { transform: rotate(180deg); }
/* Le tableau récupère exactement la hauteur libérée (le bas reste en place, le haut monte). */
body.est-nobar .est-stage { height: calc(100vh - 130px + var(--topbar-h, 58px)); }
/* Restauration de l'état au chargement : on coupe les transitions le temps d'appliquer l'état. */
body.est-noanim .topbar, body.est-noanim .est-stage,
body.est-noanim .est-barbtn, body.est-noanim .est-barbtn__chev { transition: none !important; }
.est-textinput { position: absolute; font: 24px system-ui, sans-serif; line-height: 1.3; border: 1px dashed var(--primary); background: rgba(255,255,255,.9); padding: 2px 4px; min-width: 60px; max-width: 82vw; max-height: 72vh; z-index: 5; resize: none; overflow: auto; white-space: pre; }
/* --- Post-it : édition superposée (même papier que l'objet dessiné sur le canvas) --- */
/* z-index > docks (9) : pendant la saisie, l'éditeur doit passer au-dessus des barres d'outils. */
.est-noteedit { position: absolute; z-index: 10; display: flex; flex-direction: column; box-shadow: 0 8px 20px rgba(15,23,42,.28); outline: 1.5px dashed rgba(15,23,42,.35); }
.est-noteedit[hidden] { display: none; }   /* sinon display:flex écrase l'attribut [hidden] */
/* padding posé en ligne par openNoteEdit (NOTE_PAD × zoom) pour coller au rendu canvas */
.est-noteedit textarea { flex: 1; width: 100%; border: 0; background: transparent; resize: none; outline: none; box-sizing: border-box;
    font-family: 'Segoe Print', 'Comic Sans MS', system-ui, sans-serif; line-height: 1.4; color: #1f2937; }
.est-noteedit__bar { position: absolute; right: 5px; bottom: 5px; display: flex; gap: 5px; }
.est-noteedit__bar button { display: inline-flex; align-items: center; justify-content: center; height: 27px; min-width: 30px; padding: 0 7px;
    border: 1px solid rgba(15,23,42,.22); background: rgba(255,255,255,.82); border-radius: 7px; cursor: pointer;
    font: 700 .78rem system-ui, sans-serif; color: var(--slate-700, #334155); }
.est-noteedit__bar button:hover { background: #fff; }
.est-noteedit__bar .est-ico { width: 17px; height: 17px; }
.est-trash { position: absolute; right: 18px; bottom: 18px; width: 60px; height: 60px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; color: #64748b; background: rgba(241,245,249,.78);
    border: 1.5px dashed #cbd5e1; z-index: 6; pointer-events: none; transition: transform .12s ease, background .12s ease, color .12s ease, border-color .12s ease; }
.est-trash.is-hot { background: #fee2e2; border-color: #ef4444; border-style: solid; color: #dc2626; transform: scale(1.18); }
.est:fullscreen .est-trash { right: 26px; bottom: 26px; }

/* --- Docks déplaçables (gauche : outils de base / droite : thèmes) --- */
.est-dock { position: absolute; top: 12px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15,23,42,.16); z-index: 9; user-select: none; }
.est-dock--left { left: 12px; width: 92px; }
.est-dock--right { right: 12px; width: 188px; }
.est-dock__head { display: flex; align-items: center; gap: 6px; padding: 5px 8px; cursor: grab; touch-action: none;
    border-bottom: 1px solid var(--slate-100); color: var(--muted); }
.est-dock__head:active { cursor: grabbing; }
.est-dock__grip { font-size: .85rem; letter-spacing: -1px; }
.est-dock__label { flex: 1; font-size: .78rem; font-weight: 700; color: var(--slate-700, #334155); }
.est-dock__btn { margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); padding: 0 2px; }
.est-dock__body { padding: 6px; max-height: calc(100vh - 200px); overflow-y: auto; }
.est-dock--left .est-dock__body { max-height: none; overflow: visible; }
.est-dock.is-collapsed .est-dock__body { display: none; }
.est-tools--v { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.est-tools--v .est-tool { width: 100%; height: auto; aspect-ratio: 1; font-size: 1.05rem; border-radius: 10px; }
.est-tools--v .est-sep--h { grid-column: 1 / -1; margin: 2px 0; }

/* --- Bouton à sous-menu (Polygone) : petit triangle noir pointant à droite + flyout horizontal --- */
.est-flywrap { position: relative; }
.est-flywrap > .est-tool { width: 100%; }
.est-tool--haschild::after { content: ""; position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
    border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; border-left: 4px solid currentColor;
    opacity: .8; pointer-events: none; }
.est-flyout { position: absolute; top: -1px; left: calc(100% + 9px); z-index: 12;
    display: flex; align-items: center; gap: 4px; padding: 6px; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.22); }
.est-flyout[hidden] { display: none; }
/* petite pointe reliant le flyout au bouton */
.est-flyout::before { content: ""; position: absolute; left: -6px; top: 15px; width: 11px; height: 11px; background: #fff;
    border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.est-tools--v .est-flyout .est-tool { width: 36px; height: 36px; aspect-ratio: auto; flex: none; border-radius: 9px; }
.est-flyout .est-sep { height: 24px; }

/* --- Outils à encre (crayon, surligneur, texte) : pastille de couleur sous l'icône
       + palette dépliée par appui long sur le bouton --- */
.est-tool--ink { position: relative; }
.est-tool--ink .est-ico { transform: translateY(-2px); }
.est-tool--ink::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 4px; height: 4px;
    border-radius: 3px; background: var(--ink-dot, #1e293b); box-shadow: inset 0 0 0 1px rgba(15,23,42,.22);
    pointer-events: none; }
/* Sur bouton actif (fond ardoise), un liseré clair détache la pastille sombre. */
.est-tool--ink.is-on::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.est-flyout--inks { gap: 5px; }
.est-ink { width: 28px; height: 28px; flex: none; padding: 0; border: 1px solid var(--border); border-radius: 50%;
    background: var(--ink, #ffe14d); cursor: pointer; transition: transform .12s; }
.est-ink:hover { transform: scale(1.12); }
.est-ink.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--slate-900); }
.est-ink--custom { border-radius: 8px; padding: 2px; background: #fff; }
.est-flyout__n { width: 48px; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 6px;
    font: inherit; text-align: center; }
.est-dock__settings { margin-top: 6px; }
.est-dock__settings #est-color { height: 28px; }
.est-dock__settings { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; align-items: center; }
/* --- Gomme : elle est ROSE, et rien d'autre ne l'est dans l'interface. On la retrouve du
       coin de l'œil, sans lire les icônes, au milieu d'un cours. Voisine du tracé libre :
       on efface là où l'on vient d'écrire.
   ⚠️ Ce bloc doit rester APRÈS `.est-tool.is-on` : à spécificité égale, c'est l'ordre
   d'écriture qui tranche. --- */
.est-tool--eraser { color: #db2777; --est-ico-accent: #fbcfe8; }
.est-tool--eraser:hover { background: #fdf2f8; border-color: #f9a8d4; }
.est-tool--eraser.is-on { background: #db2777; border-color: #be185d; color: #fff; }
.est-tool--eraser.is-on .est-ico { --est-ico-accent: rgba(255,255,255,.55); }

/* --- Menu contextuel d'un objet (clic droit ou appui long sur le tableau) ---------------
   Posé en `fixed` : le stage rogne ce qui déborde, un menu ouvert près du bord bas y
   serait coupé. estrade.js le remplit et le place (cf. ctxOuvrir). */
.est-ctx { position: fixed; z-index: 60; min-width: 216px; max-width: 280px; padding: 6px;
    max-height: calc(100vh - 20px); overflow-y: auto;
    background: #fff; border: 1px solid var(--border); border-radius: 13px;
    box-shadow: 0 20px 46px rgba(15,23,42,.26); display: flex; flex-direction: column; gap: 1px;
    user-select: none; -webkit-user-select: none; }
.est-ctx[hidden] { display: none; }
.est-ctx__head { padding: 5px 10px 7px; font-size: .74rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted); }
/* 40 px de haut : la cible d'un stylet de TBI, pas celle d'une souris. */
.est-ctx__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px;
    padding: 8px 11px; border: 0; border-radius: 9px; background: none; font: inherit; color: inherit;
    text-align: left; cursor: pointer; }
.est-ctx__item:hover { background: var(--slate-100); }
.est-ctx__item.is-on { background: #eef2ff; color: #4338ca; font-weight: 600; }
.est-ctx__item--danger { color: #dc2626; }
.est-ctx__item--danger:hover { background: #fee2e2; }
.est-ctx__item--danger .est-ico { --est-ico-accent: #fecaca; }
.est-ctx__pad { width: 22px; flex: none; }
.est-ctx__sep { height: 1px; margin: 4px 7px; background: var(--border); }
.est-ctx__inks { display: flex; gap: 6px; padding: 4px 11px 9px; }

/* --- Tableau de l'Estrade (js/estrade-tableau.js, js/estrade-clavier.js) ----------------
   Le tableau lui-même est dessiné sur le canevas. Ici : la barre d'outils posée au-dessus
   du tableau choisi, l'éditeur de case, le clavier tactile et le choix de la taille.
   Cibles de 40 px au moins : c'est le stylet d'un TBI qui les vise. */
.est-tbar { position: absolute; z-index: 11; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
    max-width: calc(100% - 16px); padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 14px 34px -10px rgba(15,23,42,.30), 0 2px 6px rgba(15,23,42,.07);
    user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.est-tbar[hidden] { display: none; }
.est-tbar__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px;
    padding: 0 9px; border: 0; border-radius: 10px; background: none; color: #334155; cursor: pointer;
    font: 600 .86rem/1 inherit; white-space: nowrap; }
.est-tbar__btn:hover { background: var(--slate-100); }
.est-tbar__btn.is-on { background: #eef2ff; color: #4338ca; }
.est-tbar__btn.is-on .est-ico { --est-ico-accent: #c7d2fe; }
.est-tbar__btn--danger { color: #dc2626; }
.est-tbar__btn--danger:hover { background: #fee2e2; }
.est-tbar__btn--danger .est-ico { --est-ico-accent: #fecaca; }
.est-tbar__btn--lbl { padding: 0 12px 0 10px; }
.est-tbar__a { font-weight: 700; font-size: .92rem; }
.est-tbar__a--lg { font-size: 1.15rem; }
.est-tbar__pm { font-size: .8rem; margin-left: 1px; }
.est-tbar__sep { width: 1px; height: 24px; margin: 0 4px; background: var(--border); flex: none; }
.est-tbar__sws { display: flex; align-items: center; gap: 3px; padding: 0 3px; }
.est-tbar__sw { width: 30px; height: 30px; flex: none; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--sw, #fff); box-shadow: inset 0 0 0 1px rgba(15,23,42,.16); transition: transform .1s; }
.est-tbar__sw:hover { transform: scale(1.08); }
.est-tbar__sw.is-on { box-shadow: inset 0 0 0 1px rgba(15,23,42,.16), 0 0 0 2px #fff, 0 0 0 4px #4f46e5; }
.est-tbar__sw--none { background: linear-gradient(135deg, transparent 46%, #ef4444 46%, #ef4444 54%, transparent 54%), #fff; }
.est-tbar__sw--ink { box-shadow: none; }
.est-tbar__sw--ink.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sw); }
.est-tbar__hint { padding: 0 10px 0 6px; font-size: .8rem; font-weight: 600; color: #4338ca; white-space: nowrap; }

/* barre de style du trait (segment, demi-droite, droite) : en haut du tableau blanc,
   même habillage que la barre du tableau (.est-tbar) */
.est-sbar { z-index: 12; flex-wrap: nowrap; }
.est-sbar__lib { padding: 0 6px 0 9px; font: 700 .72rem/1 inherit; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted); white-space: nowrap; }
.est-sbar__wrap { position: relative; display: inline-flex; }
.est-sbar__dot { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(15,23,42,.2); }
.est-sbar__pop { position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%); z-index: 2;
    padding: 10px 12px 12px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 40px -10px rgba(15,23,42,.35); }
.est-sbar__pop::before { content: ""; position: absolute; top: -6px; left: 50%; width: 10px; height: 10px; margin-left: -5px;
    background: #fff; border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.est-sbar__pop[hidden] { display: none; }
.est-sbar__poph { display: block; margin: 0 2px 9px; font: 700 .7rem/1 inherit; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); white-space: nowrap; }
.est-sbar__sws { display: grid; grid-template-columns: repeat(6, 30px); gap: 7px; }
.est-sbar__custom { width: 30px; height: 30px; border-radius: 50%; }
.est-sbar__mks { display: flex; gap: 6px; }
.est-sbar__mk { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 58px; height: 58px;
    padding: 0; border: 1px solid transparent; border-radius: 11px; background: none; color: #334155; cursor: pointer; }
.est-sbar__mk:hover { background: var(--slate-100); }
.est-sbar__mk.is-on { background: #eef2ff; border-color: #a5b4fc; color: #4338ca; }
.est-sbar__mk small { font: 600 .7rem/1 inherit; }
.est-sbar__ep { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 8px; color: #334155; cursor: pointer; }
.est-sbar__ep input[type=range] { width: 110px; accent-color: #4f46e5; cursor: pointer; }
.est-sbar__ep output { min-width: 30px; height: 28px; display: inline-grid; place-items: center; padding: 0 4px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 8px; font: 700 .85rem/1 inherit; color: #0f172a; }
.est-sbar [hidden] { display: none !important; }

/* éditeur posé exactement sur la case (mêmes police, corps et marges que le rendu du canevas) */
.est-tced { position: absolute; z-index: 11; display: flex; align-items: center; box-sizing: border-box;
    background: #fff; border-radius: 3px; cursor: text;
    box-shadow: 0 0 0 2.5px #4f46e5, 0 16px 36px -12px rgba(15,23,42,.45); }
.est-tced__in { flex: 1; min-width: 0; box-sizing: border-box; outline: none; text-align: center; white-space: pre-wrap;
    overflow-wrap: anywhere; line-height: 1.3; color: #0f172a; caret-color: #4f46e5;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif; }
.est-tced .tbm { display: inline-block; padding: 0 .06em; border-radius: 4px; cursor: pointer; }
.est-tced .tbm:hover { background: rgba(79,70,229,.12); }
.est-tced .tbm--brut { font: .7em ui-monospace, Consolas, monospace; color: #64748b; }
.est-tced__kb { position: absolute; right: -15px; bottom: -15px; width: 32px; height: 32px; display: grid; place-items: center;
    padding: 0; border: 0; border-radius: 50%; background: #4f46e5; color: #fff; cursor: pointer;
    box-shadow: 0 6px 14px rgba(79,70,229,.4); }
.est-tced__kb[hidden] { display: none; }

/* clavier tactile : déplaçable par sa poignée, touches de 52 px au plus */
.est-tkb { --k: clamp(36px, 4.4vw, 52px); --g: 6px; position: absolute; z-index: 14; box-sizing: border-box;
    padding: 4px 10px 10px; background: rgba(248,250,252,.97); border: 1px solid #e2e8f0; border-radius: 18px;
    box-shadow: 0 26px 60px -18px rgba(15,23,42,.50), 0 4px 12px rgba(15,23,42,.08);
    user-select: none; -webkit-user-select: none; touch-action: none; }
.est-tkb[hidden] { display: none; }
.tkb-head { position: relative; display: flex; align-items: center; justify-content: center; height: 22px; margin: 0 -4px 4px; cursor: grab; }
.tkb-head:active { cursor: grabbing; }
.tkb-grip { width: 44px; height: 5px; border-radius: 3px; background: #cbd5e1; }
.tkb-x { position: absolute; right: 0; top: -1px; width: 34px; height: 24px; display: grid; place-items: center; padding: 0;
    border: 0; border-radius: 8px; background: none; color: #64748b; cursor: pointer; }
.tkb-x:hover { background: #e2e8f0; }
.tkb-svg { width: 22px; height: 22px; flex: none; }
.tkb-x .tkb-svg { width: 20px; height: 20px; }
.tkb-keys { display: flex; flex-direction: column; gap: var(--g); }
.tkb-row { display: flex; gap: var(--g); }
.tkb-key { width: calc(var(--k) * var(--w, 1) + (var(--w, 1) - 1) * var(--g)); height: var(--k); flex: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0; border: 0; border-radius: 11px;
    background: #fff; color: #0f172a; cursor: pointer; font: 500 1.22rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: 0 1px 0 rgba(15,23,42,.16), inset 0 0 0 1px #e2e8f0; transition: transform .06s, background .1s; }
.tkb-key:hover { background: #f8fafc; }
.tkb-key.is-down { transform: translateY(1px) scale(.97); background: #e0e7ff; }
.tkb-key small { font-size: .7em; margin-left: 1px; }
.tkb-fx { font: italic 600 1.2rem/1 Georgia, "Times New Roman", serif; }
.tkb-fx i { font-size: .82em; margin-left: 1px; }
.tkb-key--op { background: #eef2ff; color: #4338ca; font-weight: 600; }
.tkb-key--mx { background: #f5f3ff; color: #5b21b6; }
.tkb-key--act, .tkb-key--mode { background: #e2e8f0; color: #334155; font-size: .92rem; font-weight: 600; }
.tkb-key--mode.is-on { background: #c7d2fe; color: #3730a3; }
.tkb-key--ok { background: #4f46e5; color: #fff; font-size: .95rem; font-weight: 700; box-shadow: 0 6px 14px -4px rgba(79,70,229,.6); }
.tkb-key--ok:hover { background: #4338ca; }
.tkb-space { display: block; width: 55%; height: 7px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; opacity: .55; }
.tkb-kfrac { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.tkb-kfrac i, .tkb-kpow i, .tkb-ksqrt i { display: block; width: 12px; height: 10px; border: 1.5px dashed currentColor; border-radius: 2px; }
.tkb-kfrac b { display: block; width: 18px; height: 2px; background: currentColor; }
.tkb-kpow { display: inline-flex; align-items: flex-end; }
.tkb-kpow i { width: 13px; height: 14px; }
.tkb-kpow sup i { width: 8px; height: 8px; margin: 0 0 12px 2px; }
.tkb-ksqrt { display: inline-flex; align-items: center; font-size: 1.15rem; }
.tkb-ksqrt i { width: 14px; height: 13px; border-top-style: solid; margin-left: 1px; }
/* compositeur : fraction, puissance, racine écrites dans le clavier lui-même */
.tkb-comp { display: flex; align-items: center; gap: 14px; padding: 6px 4px 12px; margin-bottom: 8px; border-bottom: 1px solid #e2e8f0; }
.tkb-comp[hidden] { display: none; }
.tkb-comp__lib { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tkb-slot { width: 92px; height: 40px; box-sizing: border-box; padding: 0 6px; border: 1.5px solid #cbd5e1; border-radius: 9px;
    background: #fff; color: #0f172a; text-align: center; font: 500 1.25rem/1 system-ui, sans-serif; outline: none; }
.tkb-slot.is-on, .tkb-slot:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.tkb-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; }
.tkb-frac__bar { width: 104px; height: 2.5px; border-radius: 2px; background: #0f172a; }
.tkb-pow { display: inline-flex; align-items: flex-start; padding-top: 12px; }
.tkb-slot--sup { width: 64px; height: 32px; margin: -14px 0 0 4px; font-size: 1rem; }
.tkb-sqrt { display: inline-flex; align-items: center; }
.tkb-sqrt__sign { font-size: 2.1rem; line-height: 1; color: #0f172a; margin-right: 1px; }
.tkb-sqrt .tkb-slot { border-top: 2.5px solid #0f172a; border-radius: 0 0 9px 9px; }
.tkb-comp__acts { display: flex; gap: 6px; margin-left: auto; }
.tkb-comp__btn { height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
    color: #334155; font: 600 .9rem/1 inherit; cursor: pointer; }
.tkb-comp__btn--ok { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.est-tkb.is-comp .tkb-key--mx { opacity: .45; }

/* choix de la taille d'un nouveau tableau (bouton du thème Calculs) */
.est-tpick { position: fixed; z-index: 61; width: 300px; box-sizing: border-box; padding: 14px; background: #fff;
    border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 46px rgba(15,23,42,.26);
    user-select: none; -webkit-user-select: none; }
.est-tpick[hidden] { display: none; }
.est-tpick__head { display: flex; align-items: center; justify-content: space-between; }
.est-tpick__t { font-weight: 700; color: #0f172a; }
.est-tpick__dim { padding: 3px 10px; border-radius: 999px; background: #eef2ff; color: #4338ca; font: 700 .9rem/1.3 inherit; }
.est-tpick__grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 12px 0 8px; touch-action: none; }
.est-tpick__c { aspect-ratio: 1; padding: 0; border: 1px solid #e2e8f0; border-radius: 5px; background: #f8fafc; cursor: pointer; }
.est-tpick__c.is-on { background: #c7d2fe; border-color: #818cf8; }
.est-tpick__hint { margin: 0 0 12px; font-size: .78rem; color: var(--muted); }
.est-tpick__mods { display: grid; gap: 6px; }
.est-tpick__mod { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #1e293b; font: 600 .88rem/1.2 inherit; cursor: pointer; }
.est-tpick__mod:hover { background: var(--slate-100); }
.est-tpick__mod small { font-weight: 600; color: var(--muted); }


/* Les quatre categories du dock droit (Calculs, Geometrie, Objets, Outils) sont en vert
   pastel : elles ne sont pas des outils mais des RAYONS, et se distinguent d'un coup
   d'oeil des boutons blancs qu'elles ouvrent en dessous. */
.est-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.est-theme { aspect-ratio: 1; border: 1px solid #a7e8bd; background: #dcfce7; border-radius: 9px; cursor: pointer;
    font-size: 1.05rem; color: #14532d; --est-ico-accent: #86efac; }
.est-theme:hover { background: #bbf7d0; border-color: #6ee7a4; }
.est-theme.is-on { background: #16a34a; color: #fff; border-color: #15803d; }
.est-theme-tools { margin-top: 8px; min-height: 48px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.est-theme-tools[hidden] { display: none; }
/* Thème « Outils » : #theme-tools reste vide (les boutons vivent dans #outils-tools).
   Sans ceci, sa min-height réserve une bande vide de 56 px sous la rangée des thèmes. */
.est-theme-tools:empty { display: none; }
.est-theme-tools .est-tool { width: 100%; height: auto; aspect-ratio: 1; font-size: 1.15rem; border-radius: 10px; }
.est-theme-tools .field__input { grid-column: 1 / -1; }
.est-theme-tools__soon { color: var(--muted); font-size: .82rem; margin: 4px 0; }

/* --- Préparation d'un écran de séance (migration 078) ----------------------
   /estrade?ecran=ID : on ne travaille pas sur un tableau mais sur UN écran. Le bandeau
   flotte en haut du tableau, entre les deux docks : titre, état d'enregistrement, et le
   bouton qui ramène à la préparation de la séance. */
.est-ecranbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9;
    display: flex; align-items: center; gap: 10px; max-width: calc(100% - 320px);
    padding: 7px 10px 7px 13px; background: #fff; border: 1px solid var(--border); border-radius: 999px;
    box-shadow: 0 10px 28px rgba(15,23,42,.16); }
.est-ecranbar__ic { flex: none; color: var(--acc-estrade-2); }
.est-ecranbar__champ { display: block; }
.est-ecranbar__champ .field__input { width: 220px; height: 32px; padding: 2px 10px; font-weight: 700; }
.est-ecranbar__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.est-ecranbar__ctx { font-size: .8rem; color: var(--muted); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.est-ecranbar__etat { font-size: .76rem; font-weight: 700; color: var(--slate-500); white-space: nowrap; }
.est-ecranbar__etat.is-ok { color: #047857; }
.est-ecranbar__etat.is-ko { color: #b91c1c; }
@media (max-width: 1100px) {
    .est-ecranbar { max-width: calc(100% - 24px); flex-wrap: wrap; border-radius: 16px; }
    .est-ecranbar__ctx { display: none; }
    .est-ecranbar__champ .field__input { width: 150px; }
}

/* Bouton « Écrans de la séance » de la barre du bas : le nombre d'écrans en pastille,
   orange tant que certains ne sont pas encore au tableau. */
/* ⚠️ `.est-tool` pose un display: inline-flex, qui l'emporte sur l'attribut [hidden] —
   sans cette ligne, le bouton « Écrans » reste visible même sans écran à charger. */
.est-tool[hidden], .est-sep[hidden] { display: none; }
.est-tool--ecrans { position: relative; }
.est-tool__badge { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
    display: grid; place-items: center; border-radius: 999px; background: var(--acc-estrade-2); color: #fff;
    font-size: .64rem; font-weight: 800; line-height: 1; }
.est-tool--ecrans.is-attente .est-tool__badge { background: #ea580c; }
/* Planche des écrans : mêmes cartes que le trieur de pages ; celles qui ne sont pas
   encore au tableau se distinguent par un liseré pointillé. */
.ecr-card { cursor: pointer; }
.ecr-card.is-absent { border-style: dashed; }
.ecr-card.is-absent .pgs-card__n { background: var(--slate-400); }

/* --- Barre du bas (menu, pages, zoom, grille, timers, calc) --- */
.est-bottombar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 9;
    display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #fff;
    border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 10px 28px rgba(15,23,42,.16); }
.est-grp { display: inline-flex; align-items: center; gap: 2px; }
.est-ind { min-width: 46px; text-align: center; font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.est-ind--btn { width: auto; padding: 0 8px; }
.est-menu-wrap { position: relative; }
.est-menu { position: absolute; bottom: calc(100% + 8px); left: 0; width: 230px; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.22); padding: 8px; z-index: 12; }
.est-menu__field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.est-menu__item { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; font: inherit;
    padding: 8px 10px; border-radius: 8px; }
.est-menu__item:hover { background: var(--slate-100); }
.est-menu__item--danger { color: #b91c1c; }
.est-layer-menu { left: 50%; transform: translateX(-50%); width: auto; min-width: 200px; white-space: nowrap; }

.est-panel { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: 280px; max-height: calc(100% - 88px); overflow: auto;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(15,23,42,.22); z-index: 11; }
.est-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700; }
.est-panel__x { border: 0; background: none; cursor: pointer; font-size: 1rem; color: var(--muted); }
.est-panel__body { padding: 12px; }
.est-panel--calc { width: 300px; left: auto; right: 16px; top: 12px; transform: scale(.85); transform-origin: top right; max-height: calc(100vh - 24px); overflow-y: auto; overflow-x: hidden; }
.est-panel--calc .est-panel__head { cursor: grab; touch-action: none; user-select: none; }
.est-panel--calc .est-panel__head:active { cursor: grabbing; }

/* Sélecteur de modèle d'émulateur (CASIO / NumWorks) en tête du panneau Calculatrice */
.calc-switch { display: flex; gap: 6px; padding: 10px 12px; }
.calc-switch__btn { flex: 1; padding: 6px 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--slate-50, #f8fafc);
    cursor: pointer; font: inherit; font-weight: 700; font-size: .82rem; line-height: 1.2; color: var(--slate-700, #334155); text-align: center; }
.calc-switch__btn small { display: block; font-weight: 600; font-size: .66rem; color: var(--muted); }
.calc-switch__btn.is-on { background: #15324a; border-color: #15324a; color: #eaf3ef; }
.calc-switch__btn.is-on small { color: #b9d3e6; }

/* Vue NumWorks : simulateur officiel embarqué (iframe WASM) */
.est-panel--calc.is-numworks { width: auto; }
.calc-numworks { padding: 4px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.calc-numworks[hidden] { display: none; }   /* sinon display:flex écrase l'attribut [hidden] */
.calc-numworks__frame { position: relative; width: 368px; height: 720px; border-radius: 6px; overflow: hidden; background: #eef1f4; }
.calc-numworks__frame iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; display: block; }
.calc-numworks__loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.calc-numworks .casio__emu { align-self: stretch; margin-top: 0; }

/* ===================== Panneau « Bloc de cours » (thème Objets) ===================== */
.est-coursblocs { position: absolute; top: 0; right: 0; bottom: 0; width: 33.333%; min-width: 300px;
    display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(15,23,42,.16); z-index: 18; }
.est-coursblocs[hidden] { display: none; }   /* sinon display:flex écrase l'attribut [hidden] */
.est-cb__head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--slate-50); }
.est-cb__back { flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--slate-100);
    cursor: pointer; font-size: 1.05rem; line-height: 1; color: var(--slate-700, #334155); }
.est-cb__back:hover { background: var(--slate-200); }
.est-cb__back[hidden] { display: none; }
.est-cb__title { flex: 1; min-width: 0; font-weight: 700; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-cb__x { flex: 0 0 auto; border: 0; background: none; cursor: pointer; font-size: 1rem; color: var(--muted); }
.est-cb__body { flex: 1; overflow-y: auto; padding: 12px; }
.est-cb__hint { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; background: var(--slate-50); }
.est-cb__hint[hidden] { display: none; }
.est-cb__loading, .est-cb__empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: .9rem; }

/* Niveaux */
.est-cb__niveaux { display: grid; gap: 10px; }
.est-cb__niveau { display: block; width: 100%; text-align: left; padding: 16px 18px; border: 1px solid var(--border);
    border-radius: 12px; background: #fff; cursor: pointer; font: inherit; font-weight: 700; font-size: 1.02rem;
    transition: background .12s, border-color .12s; }
.est-cb__niveau:hover { background: #ecfeff; border-color: var(--acc-cours-2, #06b6d4); }

/* Chapitres (accordéon, repliés par défaut) */
.est-cb__chap { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.est-cb__chaphead { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 12px;
    border: 0; background: var(--slate-50); cursor: pointer; font: inherit; font-weight: 600; }
.est-cb__chaphead:hover { background: var(--slate-100); }
.est-cb__chevron { color: var(--muted); font-size: .8rem; transition: transform .15s; }
.est-cb__chap:not(.is-collapsed) .est-cb__chevron { transform: rotate(90deg); }
.est-cb__chaptitle { flex: 1; min-width: 0; }
.est-cb__count { color: var(--muted); font-size: .74rem; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.est-cb__chap.is-collapsed .est-cb__lecons { display: none; }
.est-cb__lecons { list-style: none; margin: 0; padding: 0; }
.est-cb__lecons li { border-top: 1px solid var(--slate-100); }
.est-cb__lecon { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none;
    cursor: pointer; font: inherit; padding: 9px 12px 9px 28px; }
.est-cb__lecon:hover { background: #f8fafc; }
.est-cb__lecon > span:first-child { flex: 1; min-width: 0; }
.est-cb__lcnb { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.est-cb__noleson { color: var(--muted); font-size: .82rem; padding: 8px 12px 8px 28px; }

/* Blocs de la leçon (cliquer / glisser pour déposer sur le tableau) */
.est-cb__blocks { display: flex; flex-direction: column; gap: 10px; }
.est-cb__block { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 30px 10px 12px;
    background: #fff; cursor: grab; touch-action: none; transition: border-color .12s, box-shadow .12s; }
.est-cb__block:hover { border-color: var(--acc-cours-2, #06b6d4); box-shadow: 0 4px 14px rgba(15,23,42,.10); }
.est-cb__block:active { cursor: grabbing; }
.est-cb__prev { font-size: .9rem; max-height: 230px; overflow: hidden; pointer-events: none; }
.est-cb__prev img { max-width: 100%; height: auto; border-radius: 6px; }
.est-cb__prev table { border-collapse: collapse; }
.est-cb__ggb { color: var(--muted); font-weight: 600; }
.est-cb__grab { position: absolute; top: 8px; right: 8px; color: #cbd5e1; font-size: .9rem; }
.est-cb__ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(8px, 8px);
    background: var(--slate-900, #0f172a); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: .82rem;
    max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 22px rgba(15,23,42,.3); }

/* ===================== Fenêtre Webcam (thème Objets) — flottante, déplaçable, redimensionnable ===================== */
.est-webcam { position: absolute; top: 80px; left: calc(50% - 210px); width: 420px; height: 320px; min-width: 220px; min-height: 160px;
    display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(15,23,42,.28); z-index: 20; overflow: hidden; }
.est-webcam[hidden] { display: none; }
.est-webcam__head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border);
    font-weight: 700; cursor: grab; touch-action: none; user-select: none; }
.est-webcam__head:active { cursor: grabbing; }
.est-webcam__title { flex: 0 0 auto; }
.est-webcam__pick { flex: 1 1 auto; min-width: 0; font: inherit; font-size: .8rem; padding: 2px 4px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.est-webcam__x { flex: 0 0 auto; border: 0; background: none; cursor: pointer; font-size: 1rem; color: var(--muted); line-height: 1; padding: 2px 4px; }
.est-webcam__view { flex: 1 1 auto; min-height: 0; background: #000; }
.est-webcam__view video { width: 100%; height: 100%; object-fit: contain; display: block; }
.est-webcam__shot { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
    border: 0; background: rgba(255,255,255,.92); box-shadow: 0 2px 8px rgba(15,23,42,.35); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.est-webcam__shot:hover { background: #fff; }
.est-webcam__resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none;
    background: linear-gradient(135deg, transparent 50%, var(--border) 50%, var(--border) 64%, transparent 64%, transparent 78%, var(--border) 78%); }

/* ===================== Barre de capture d'écran (flottante) ===================== */
/* Posée où l'enseignant veut et gardée sous la main pendant tout le cours : la source est
   épinglée une fois, les captures suivantes tiennent en un clic. Cibles larges (44 px) —
   au TBI, tout se prend au doigt. */
/* 262 px : la largeur juste nécessaire pour que « Documents » tienne en entier dans son
   segment — en dessous, le mot est rogné et la destination devient illisible. */
.est-capbar { position: absolute; top: 92px; right: 96px; width: 262px; z-index: 21;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(15,23,42,.28); overflow: hidden; }
.est-capbar[hidden] { display: none; }
.est-capbar__head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border);
    font-weight: 700; cursor: grab; touch-action: none; user-select: none; }
.est-capbar__head:active { cursor: grabbing; }
.est-capbar__grip { color: var(--muted); line-height: 1; }
.est-capbar__title { flex: 1 1 auto; }
.est-capbar__x { flex: 0 0 auto; border: 0; background: none; cursor: pointer; color: var(--muted); line-height: 1; padding: 2px 4px; }
.est-capbar__x .est-ico { width: 16px; height: 16px; }

/* Ligne « source » : ce qui est épinglé, et de quoi en changer sans quitter la barre. */
.est-capbar__src { display: flex; align-items: center; gap: 6px; padding: 7px 9px; font-size: .78rem;
    background: var(--slate-100); border-bottom: 1px solid var(--border); }
.est-capbar__src .est-ico { width: 17px; height: 17px; flex: 0 0 auto; color: var(--muted); }
.est-capbar__src.is-live .est-ico { color: #16a34a; }
.est-capbar__srclab { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate-600); }
.est-capbar__src.is-live .est-capbar__srclab { color: var(--slate-900, #0f172a); font-weight: 600; }
.est-capbar__link { flex: 0 0 auto; border: 0; background: none; padding: 0; cursor: pointer; font: inherit;
    color: var(--primary, #4f46e5); text-decoration: underline; }

/* Les quatre modes, en grille : icône au-dessus du mot. */
.est-capbar__modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 9px; }
.est-capbar__mode { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px;
    border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: pointer; font: inherit;
    font-size: .66rem; line-height: 1.1; color: var(--slate-600); }
.est-capbar__mode .est-ico { width: 21px; height: 21px; }
.est-capbar__mode:hover:not(:disabled) { background: var(--slate-100); }
.est-capbar__mode:disabled { opacity: .38; cursor: default; }
.est-capbar__mode.is-busy { border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 2px rgba(99,102,241,.2); }

.est-capbar__row { display: flex; align-items: center; gap: 8px; padding: 0 9px 9px; font-size: .74rem; }
.est-capbar__lab { flex: 0 0 34px; color: var(--muted); }
.est-capbar__seg { flex: 1 1 auto; display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.est-capbar__segbtn { flex: 1 1 0; min-width: 0; padding: 5px 2px; border: 0; border-left: 1px solid var(--border);
    background: #fff; cursor: pointer; font: inherit; font-size: .72rem; color: var(--slate-600); }
.est-capbar__segbtn:first-child { border-left: 0; }
.est-capbar__segbtn:hover { background: var(--slate-100); }
.est-capbar__segbtn.is-on { background: var(--slate-900, #0f172a); color: #fff; font-weight: 600; }

.est-capbar__tip { margin: 0; padding: 7px 9px; border-top: 1px solid var(--border); background: var(--slate-100);
    font-size: .68rem; line-height: 1.35; color: var(--muted); }
.est-capbar__tip kbd { font: inherit; font-weight: 700; background: #fff; border: 1px solid var(--border);
    border-radius: 4px; padding: 0 3px; color: var(--slate-600); }
.est-capbar__ext { display: block; width: 100%; padding: 8px 9px; border: 0; border-top: 1px solid var(--border);
    background: #fff; cursor: pointer; font: inherit; font-size: .72rem; text-align: center; color: var(--primary, #4f46e5); }
.est-capbar__ext:hover { background: var(--slate-100); }
/* Une extension appairée est signalée : sinon rien ne dirait que les images arrivent toutes seules. */
.est-capbar__ext.is-live { color: #16a34a; font-weight: 600; }

/* ===================== Minuteurs (disques) & chronomètres (pastilles) flottants ===================== */
/* Menu déroulant de durées, ouvert vers le haut depuis le bouton ⏱ de la barre du bas */
.est-timer-menu { position: absolute; bottom: calc(100% + 8px); right: 0; width: 196px; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .22); padding: 10px; z-index: 12; }
.est-timer-menu__presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.est-timer-menu__preset { padding: 8px 0; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    cursor: pointer; font: inherit; font-weight: 600; }
.est-timer-menu__preset:hover { background: var(--slate-100); }
.est-timer-menu__custom { display: flex; gap: 6px; margin-top: 8px; }
.est-timer-menu__custom .field__input { width: auto; flex: 1; min-width: 0; }
.est-timer-menu__go { padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    cursor: pointer; font: inherit; font-weight: 600; }
.est-timer-menu__go:hover { background: var(--slate-100); }

.est-grid-menu { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 238px; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .22); padding: 10px; z-index: 12; }
.est-grid-menu__opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.est-grid-opt { padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; line-height: 0; }
.est-grid-opt svg { width: 100%; height: auto; display: block; border-radius: 4px; }
.est-grid-opt:hover { background: var(--slate-100); }
.est-grid-opt.is-on { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99, 102, 241, .25); }
.est-grid-menu__row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--slate-600); }
.est-grid-menu__row input[type=range] { flex: 1; min-width: 0; accent-color: var(--primary, #4f46e5); }
.est-grid-menu__snap { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--slate-600); cursor: pointer; }

/* Minuteur : disque coloré flottant dont l'anneau se vide */
.ec-disk { position: absolute; width: 116px; height: 116px; z-index: 8; user-select: none; touch-action: none; cursor: grab; }
.ec-disk:active { cursor: grabbing; }
.ec-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ec-track { fill: #fff; stroke: #e5e7eb; stroke-width: 8; }
.ec-prog { fill: none; stroke: var(--c); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .4s linear; }
.ec-disk .ec-time { position: absolute; top: 44%; left: 0; right: 0; transform: translateY(-50%); text-align: center;
    font-weight: 800; font-size: 22px; color: var(--slate-900); font-variant-numeric: tabular-nums; pointer-events: none; }
.ec-disk.is-done .ec-prog { stroke: #ef4444; }
.ec-disk.is-done { animation: ec-flash .9s ease-in-out 3; }
@keyframes ec-flash { 50% { filter: drop-shadow(0 0 9px #ef4444); } }

/* Chronomètre : pastille numérique colorée flottante */
.ec-badge { position: absolute; z-index: 8; min-width: 96px; padding: 8px 12px 6px; text-align: center; background: #fff;
    border: 2px solid var(--c); border-radius: 14px; box-shadow: 0 4px 14px rgba(15, 23, 42, .14);
    user-select: none; touch-action: none; cursor: grab; }
.ec-badge:active { cursor: grabbing; }
.ec-badge .ec-time { font-weight: 800; font-size: 24px; line-height: 1.1; color: var(--c); font-variant-numeric: tabular-nums; }

/* Contrôles communs (play/pause, reset, fermer) */
.ec-ctrls { display: flex; justify-content: center; gap: 6px; }
.ec-disk .ec-ctrls { position: absolute; bottom: 18px; left: 0; right: 0; }
.ec-badge .ec-ctrls { margin-top: 4px; }
.ec-b { width: 26px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: #fff;
    cursor: pointer; font-size: 12px; line-height: 1; }
.ec-b:hover { background: var(--slate-100); }
.ec-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; z-index: 2;
    border: 1px solid var(--border); border-radius: 50%; background: #fff; cursor: pointer; font-size: 11px; line-height: 1; }
.ec-x:hover { background: #fee2e2; }
.calc-field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.calc-radios { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 10px; font-size: .88rem; }
.calc-radios__lbl { font-weight: 700; color: var(--muted); width: 100%; font-size: .78rem; }
.calc-radios label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.calc-manual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.calc-manual--eq { grid-template-columns: repeat(4, 1fr); }
#panel-op .btn, #panel-3d .btn { width: 100%; }
.ggb-overlay { position: fixed; inset: 0; z-index: 60; background: #fff; display: flex; flex-direction: column; }
.ggb-overlay[hidden] { display: none; }
.ggb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.ggb-bar__t { font-family: var(--font-display, inherit); font-weight: 700; }
.ggb-bar__actions { display: flex; align-items: center; gap: 8px; }
.ggb-bar__hint { margin-left: auto; color: var(--primary); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.ggb-bar__hint[hidden] { display: none; }
.est-tool--ggb svg { display: block; pointer-events: none; }
.est-tool--icon svg { display: block; pointer-events: none; }
.ggb-frame { flex: 1; min-height: 0; }
/* Calculatrice façon CASIO fx-92+ Spéciale Collège (Classwiz, coloris menthe) */
.casio { background: linear-gradient(168deg, #c4e6d8 0%, #a3d6c4 55%, #95cdba 100%); padding: 11px 12px 12px; }
.casio__brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; color: #15324a; }
.casio__logo { font-weight: 800; letter-spacing: 1.5px; font-size: .98rem; }
.casio__name { font-size: .68rem; color: #2b4a5e; }
.casio__name em { font-style: normal; font-weight: 700; }
.casio__screen { position: relative; background: #c3ccb9; border: 2px solid #2b3b34; border-radius: 4px; padding: 8px 10px; margin-bottom: 9px; box-shadow: inset 0 1px 5px rgba(0,0,0,.28); }
/* Saisie : volontairement grande pour la projection en classe */
.casio__expr { color: #22302a; font-size: 1.55rem; line-height: 1.45; min-height: 2em; text-align: left; word-break: break-word; font-family: var(--font-mono, ui-monospace, monospace); }
.casio__res { color: #14201a; font-size: 2rem; font-weight: 700; font-family: var(--font-mono, ui-monospace, monospace); line-height: 1.15; min-height: 1.5em; display: flex; align-items: center; justify-content: flex-end; text-align: right; overflow-x: auto; }
/* Curseur clignotant + éléments de saisie 2D */
.casio__expr .cx { display: inline; }
.casio__expr .ca { white-space: pre; }
.casio__expr .cc { display: inline-block; width: 2px; height: 1.05em; margin: 0 -1px; background: #14201a; vertical-align: -0.15em; animation: casio-cc 1s steps(1) infinite; }
@keyframes casio-cc { 50% { opacity: 0; } }
.casio__expr .cph { display: inline-block; min-width: .62em; height: 1em; border: 1px dashed rgba(34,48,42,.55); border-radius: 2px; vertical-align: -0.08em; }
/* Fraction empilée (saisie et résultat) */
.cf { display: inline-flex; flex-direction: column; align-items: center; text-align: center; vertical-align: middle; margin: 0 3px; }
.cf__n { display: block; padding: 0 5px 2px; border-bottom: 2px solid currentColor; }
.cf__d { display: block; padding: 2px 5px 0; }
.cfw { display: inline-flex; align-items: center; gap: 1px; }
.casio__res .cf { font-size: .82em; }
/* Bouton vers l'émulateur officiel CASIO (nouvel onglet) */
.casio__emu { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 9px; padding: 8px 12px; border-radius: 9px; background: #15324a; color: #eaf3ef; font-weight: 700; font-size: .82rem; text-decoration: none; box-shadow: 0 2px 0 rgba(20,45,33,.35); }
.casio__emu:hover { background: #1d4664; }
.casio__emu:active { transform: translateY(2px); box-shadow: none; }
/* Bandeau de navigation décoratif */
.casio__deco { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 9px; }
.cd { font-size: .58rem; font-weight: 700; color: #15324a; background: #eaf3ef; border: 1px solid #7fae9e; border-radius: 11px; padding: 3px 8px; text-align: center; }
.cd--sc { padding: 2px 7px; }
.casio__dpad { position: relative; width: 62px; height: 62px; justify-self: center; border-radius: 50%; background: #e7f1ec; border: 1px solid #7fae9e; }
.dp { position: absolute; font-size: .5rem; color: #15324a; padding: 3px; line-height: 1; border: 0; background: transparent; cursor: pointer; border-radius: 4px; }
.dp:hover { color: #2f6df0; }
.dp:active { transform-origin: center; }
.dp--u { top: 2px; left: 50%; transform: translateX(-50%); }
.dp--d { bottom: 2px; left: 50%; transform: translateX(-50%); }
.dp--l { left: 4px; top: 50%; transform: translateY(-50%); }
.dp--r { right: 4px; top: 50%; transform: translateY(-50%); }
.dp--ok { top: 50%; left: 50%; transform: translate(-50%,-50%); width: 24px; height: 24px; font-size: .52rem; font-weight: 800; background: #fff; border: 1px solid #7fae9e; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.dp--ok:hover { border-color: #2f6df0; color: #2f6df0; }
/* Icône « fraction » sur les touches */
.ck__frac { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; line-height: .7; font-size: .7em; }
.ck__frac span:first-child { border-bottom: 1.5px solid currentColor; padding-bottom: 1px; }
.casio__scroll { display: flex; flex-direction: column; gap: 4px; }
/* Pavé */
.casio__pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ck { position: relative; border: 0; border-radius: 9px; padding: 10px 0 8px; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; background: #fff; color: #1a2520; box-shadow: 0 2px 0 rgba(20,45,33,.28); }
.ck:hover { filter: brightness(.97); }
.ck:active { transform: translateY(2px); box-shadow: none; }
.ck--fn { background: #d7e3dd; color: #15324a; font-size: .82rem; font-weight: 600; }
.ck--sci { font-size: .8rem; }
.ck--op { color: #15324a; }
.ck--del, .ck--ac { font-size: .78rem; font-weight: 800; }
.ck--ac { color: #c0392b; }
.ck--eq { background: #2f9e7e; color: #fff; }
.ck--2nd { background: #2f6df0; color: #fff; font-size: .78rem; }
.ck--2nd.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2f6df0; }
.ck__hi { position: absolute; top: 3px; left: 0; right: 0; font-size: .5rem; line-height: 1; color: #2f6df0; font-weight: 700; }
.casio__pad.is-2nd .ck__hi { color: #1746c0; }

.mini { border-bottom: 1px solid var(--slate-100); padding-bottom: 12px; margin-bottom: 12px; }
.mini:last-child { border-bottom: 0; margin-bottom: 0; }
.mini h4 { margin: 0 0 8px; font-size: .9rem; }
.mini-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt-display { font-size: 2.2rem; font-weight: 800; text-align: center; margin-top: 8px; font-variant-numeric: tabular-nums; }
.mini-result { font-weight: 700; }
.mini-groups { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.mini-group { background: var(--slate-100); border-radius: 8px; padding: 5px 10px; font-size: .88rem; }

/* Panneau Mini-outils : un bouton par jeu */
.mini-games { display: flex; flex-direction: column; gap: 8px; }
.mini-game { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer;
    font-weight: 700; font-size: .95rem; color: var(--ink, #0f172a); text-align: left;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.mini-game:hover { transform: translateY(-1px); border-color: var(--brand, #6366f1);
    box-shadow: 0 6px 16px rgba(99, 102, 241, .18); }
.mini-game:active { transform: translateY(0); }
.mini-game__ico { font-size: 1.3rem; line-height: 1; }
.mini-class { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--slate-100); }
.mini-class h4 { margin: 0 0 8px; font-size: .9rem; }
.mini-size { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 10px; font-size: .9rem; color: var(--muted); }
.mini-size input { width: 64px; }

/* ===================== Mini-jeux plein écran (dé 3D, pièce, roue, groupes) ===================== */
.est-game { position: absolute; inset: 0; z-index: 4000; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 28px;
    background: radial-gradient(circle at 50% 38%, rgba(30, 41, 59, .88), rgba(2, 6, 23, .96));
    animation: game-in .25s ease; cursor: pointer; }
.est-game[hidden] { display: none; }
.est-game.is-out { animation: game-out .45s ease forwards; }
.est-game__scene[hidden] { display: none; }
@keyframes game-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes game-out { to { opacity: 0; } }
.est-game__stage { perspective: 1000px; width: 360px; height: 360px;
    display: flex; align-items: center; justify-content: center; }
.est-game__stage[hidden] { display: none; }
.est-game__scene { display: flex; align-items: center; justify-content: center; }
.est-game__result { min-height: .2em; color: #fff; font-family: var(--font-display, inherit);
    font-weight: 800; font-size: clamp(3rem, 11vw, 8rem); line-height: 1; text-align: center;
    letter-spacing: .01em; text-shadow: 0 6px 36px rgba(0, 0, 0, .55); opacity: 0; transform: scale(.5); }
.est-game__result.is-show { animation: result-pop .55s cubic-bezier(.2, 1.5, .4, 1) forwards; }
@keyframes result-pop { to { opacity: 1; transform: scale(1); } }
.est-game__hint { color: rgba(255, 255, 255, .45); font-size: .85rem; letter-spacing: .04em; }
/* Roue : relances après un tirage. Elle reste alors affichée jusqu'à « Fermer » (ou Échap) :
   le fond ne ferme plus rien (`is-sticky`) et l'indice « Cliquez pour fermer » s'efface. */
.est-game.is-sticky { cursor: default; gap: 20px; overflow-y: auto; justify-content: center; justify-content: safe center; }
.est-game.is-sticky .est-game__hint { display: none; }
/* Place réservée (les boutons ne sautent pas à l'arrivée du prénom), taille bornée par la hauteur. */
.est-game.is-sticky .est-game__result { min-height: 1em; font-size: clamp(2.4rem, min(11vw, 12vh), 8rem); }
.est-game__ctrls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.est-game__ctrls[hidden] { display: none; }
.est-game__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; animation: ctrls-in .35s ease both; }
@keyframes ctrls-in { from { opacity: 0; transform: translateY(8px); } }
.est-game__pool { color: rgba(203, 213, 225, .72); font-size: .95rem; font-weight: 600; text-align: center; }
.est-game__link { padding: 0; border: 0; background: none; color: #a5b4fc; font: inherit; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px; }
.est-game__link:hover { color: #c7d2fe; }

/* Dé 3D */
.dice3d { position: relative; width: 150px; height: 150px; transform-style: preserve-3d;
    transition: transform 2.4s cubic-bezier(.16, .7, .2, 1); }
.dice3d__face { position: absolute; width: 150px; height: 150px; box-sizing: border-box;
    background: linear-gradient(135deg, #ffffff, #dbe2ea); border: 2px solid #cbd5e1; border-radius: 20px;
    display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 18px;
    box-shadow: inset 0 0 18px rgba(148, 163, 184, .5); }
.dice3d__pip { width: 27px; height: 27px; border-radius: 50%; align-self: center; justify-self: center;
    background: radial-gradient(circle at 35% 32%, #475569, #0f172a); box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35); }
.dice3d__face--1 { transform: translateZ(75px); }
.dice3d__face--6 { transform: rotateY(180deg) translateZ(75px); }
.dice3d__face--2 { transform: rotateX(90deg) translateZ(75px); }
.dice3d__face--5 { transform: rotateX(-90deg) translateZ(75px); }
.dice3d__face--3 { transform: rotateY(90deg) translateZ(75px); }
.dice3d__face--4 { transform: rotateY(-90deg) translateZ(75px); }

/* Pièce qui tourne et retombe */
.coin3d { position: relative; width: 180px; height: 180px; transform-style: preserve-3d; }
.coin3d.is-toss { animation: coin-toss 2.2s cubic-bezier(.33, 0, .3, 1); }
@keyframes coin-toss { 0% { transform: translateY(20px); } 40% { transform: translateY(-210px); } 100% { transform: translateY(0); } }
.coin3d__spin { position: absolute; inset: 0; transform-style: preserve-3d;
    transition: transform 2.2s cubic-bezier(.2, .72, .2, 1); }
.coin3d__side { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden;
    display: flex; align-items: center; justify-content: center; font-family: var(--font-display, inherit);
    font-weight: 800; font-size: 2.4rem; color: #7c2d12; text-transform: uppercase; letter-spacing: .04em;
    border: 9px solid; box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.coin3d__side--face { background: radial-gradient(circle at 35% 28%, #fef3c7, #f59e0b 70%); border-color: #b45309; }
.coin3d__side--pile { background: radial-gradient(circle at 35% 28%, #fde68a, #d97706 70%); border-color: #92400e;
    transform: rotateX(180deg); }

/* Roue de tirage au sort */
.est-game__scene--wheel { width: 360px; height: 360px; }
.wheel { position: relative; width: 350px; height: 350px; }
.wheel__pointer { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 3;
    width: 0; height: 0; border-left: 17px solid transparent; border-right: 17px solid transparent;
    border-top: 32px solid #ef4444; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5)); }
.wheel__svg { width: 100%; height: 100%; transform: rotate(0deg);
    transition: transform 4.2s cubic-bezier(.1, .72, .12, 1);
    filter: drop-shadow(0 18px 44px rgba(0, 0, 0, .55)); border-radius: 50%;
    box-shadow: 0 0 0 9px #fff, 0 0 0 12px #0f172a; }
.wheel__hub { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2;
    width: 56px; height: 56px; border-radius: 50%; background: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }

/* ============ Panneau PERSISTANT des tirages de classe (groupes, tournoi) ============
   Le dé, la pièce et la roue s'effacent tout seuls ; les groupes et le tournoi, eux, restent
   affichés jusqu'au bouton « Fermer » — on travaille dessus pendant toute la séance. */
.est-game.is-panel { gap: 0; padding: 14px; }
.est-game.is-panel .est-game__hint, .est-game.is-panel .est-game__result { display: none; }
.est-gp { flex: 1 1 auto; width: 100%; min-height: 0; display: flex; flex-direction: column; cursor: default;
    background: linear-gradient(165deg, rgba(41, 54, 78, .97), rgba(11, 17, 32, .98));
    border: 1px solid rgba(148, 163, 184, .22); border-radius: 22px; overflow: hidden;
    box-shadow: 0 34px 90px rgba(0, 0, 0, .55); animation: gp-in .3s cubic-bezier(.2, .9, .3, 1); }
.est-gp[hidden] { display: none; }
@keyframes gp-in { from { opacity: 0; transform: translateY(16px) scale(.99); } }
.est-gp__head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, .16); background: rgba(255, 255, 255, .04); }
.est-gp__ico { width: 28px; height: 28px; color: #e2e8f0; --est-ico-accent: #818cf8; }
.est-gp__title { flex: none; font-family: var(--font-display, inherit); font-weight: 800; font-size: 1.45rem; color: #fff; }
/* Sur une fenêtre étroite, le rappel de classe se tronque plutôt que de pousser les boutons. */
.est-gp__meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: rgba(203, 213, 225, .72); font-size: .95rem; font-weight: 600; }
.est-gp__flag { display: inline-flex; align-items: center; gap: 8px; padding: 5px 15px; border-radius: 999px;
    background: linear-gradient(135deg, #fde68a, #f59e0b); color: #442c05; font-weight: 800; font-size: 1.08rem;
    box-shadow: 0 8px 22px rgba(245, 158, 11, .45); animation: gp-flag .55s cubic-bezier(.2, 1.6, .4, 1); }
.est-gp__flag[hidden] { display: none; }
.est-gp__flag .est-ico { width: 21px; height: 21px; --est-ico-accent: rgba(255, 255, 255, .7); }
@keyframes gp-flag { from { opacity: 0; transform: scale(.55); } }
.est-gp__acts { flex: none; margin-left: auto; display: flex; gap: 10px; }
.est-gp__btn { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 12px; cursor: pointer;
    border: 1px solid rgba(148, 163, 184, .34); background: rgba(255, 255, 255, .06); color: #e2e8f0;
    font-family: inherit; font-weight: 700; font-size: .98rem; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .12s; }
.est-gp__btn[hidden] { display: none; }
.est-gp__btn .est-ico { margin-right: 8px; width: 19px; height: 19px; }
.est-gp__btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(148, 163, 184, .6); }
.est-gp__btn:active { transform: translateY(1px); }
.est-gp__btn--x { border-color: rgba(248, 113, 113, .45); color: #fecaca; }
.est-gp__btn--x:hover { background: rgba(248, 113, 113, .22); border-color: rgba(248, 113, 113, .8); }
.est-gp__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px; position: relative; }
/* Centrage qui ne rogne pas : la ligne flex fait la hauteur du contenu quand il déborde. */
.est-gp__in { min-height: 100%; display: flex; align-items: center; justify-content: center; }
/* Pluie de confettis du sacre (couche éphémère, retirée après l'animation) */
.est-gp__conf { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.est-gp__conf i { position: absolute; top: -18px; width: 9px; height: 15px; border-radius: 2px;
    animation: gp-conf 2.8s cubic-bezier(.35, .55, .5, 1) forwards; }
@keyframes gp-conf { to { transform: translateY(110vh) rotate(760deg); opacity: .12; } }

/* Jeu « Former des groupes » : urne qui mélange puis cartes de groupes */
.groups-stage { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.groups-title { color: #fff; font-family: var(--font-display, inherit); font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.6rem); text-shadow: 0 4px 24px rgba(0, 0, 0, .5); }
/* Urne */
.groups-urn { position: relative; width: 230px; height: 210px; transform-origin: 50% 88%;
    animation: urn-shake .5s ease-in-out infinite; }
@keyframes urn-shake { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.groups-urn__rim { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2;
    width: 200px; height: 30px; border-radius: 50%;
    background: linear-gradient(#fbbf24, #b45309); box-shadow: 0 6px 12px rgba(0, 0, 0, .35); }
.groups-urn__body { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    width: 180px; height: 190px; overflow: hidden;
    background: linear-gradient(135deg, #fcd34d, #d97706 70%); border: 4px solid #b45309;
    border-radius: 28px 28px 90px 90px / 20px 20px 130px 130px;
    box-shadow: inset 0 -14px 24px rgba(0, 0, 0, .25), 0 16px 34px rgba(0, 0, 0, .45); }
.groups-chip { position: absolute; padding: 3px 8px; background: #fff; border-radius: 14px;
    font-size: .72rem; font-weight: 700; color: #0f172a; white-space: nowrap; transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .25); animation: chip-bounce .55s ease-in-out infinite alternate; }
@keyframes chip-bounce { from { transform: translate(-50%, -50%); } to { transform: translate(-50%, -78%); } }
/* Cartes de groupes (couleur du groupe portée par --gc) */
.groups-cards { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 18px; }
.group-card { width: 200px; border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .97);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08); animation: card-pop .5s both; }
@keyframes card-pop { from { opacity: 0; transform: translateY(24px) scale(.9); } to { opacity: 1; transform: none; } }
.group-card__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px;
    background: var(--gc, #60a5fa); color: #0b1120; font-family: var(--font-display, inherit);
    font-weight: 800; font-size: 1.08rem; text-shadow: 0 1px 0 rgba(255, 255, 255, .25); }
.group-card__h b { display: grid; place-items: center; min-width: 26px; height: 24px; padding: 0 7px;
    border-radius: 999px; background: rgba(15, 23, 42, .2); font-size: .82rem; }
.group-card__l { margin: 0; padding: 5px 0 7px; list-style: none; }
.group-card__l li { display: flex; align-items: center; gap: 10px; padding: 6px 14px;
    font-weight: 700; font-size: 1.02rem; color: #1e293b; }
.group-card__l li + li { border-top: 1px solid rgba(148, 163, 184, .22); }
.group-card__k { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
    background: rgba(148, 163, 184, .22); color: #475569; font-size: .74rem; font-weight: 800; }

/* ===================== Tournoi : grille à élimination directe =====================
   Positions calculées en JS (px) puis mise à l'échelle d'un bloc pour tenir dans le panneau :
   .est-brk-wrap porte la taille APRÈS échelle (donc le défilement), .est-brk l'échelle elle-même. */
.est-brk-wrap { position: relative; margin: auto; flex: none; }
.est-brk { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.est-brk__links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.est-brk__col { position: absolute; text-align: center; font-family: var(--font-display, inherit);
    font-weight: 800; font-size: .86rem; letter-spacing: .08em; text-transform: uppercase;
    color: rgba(199, 210, 254, .7); }
.est-brk__m { position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 4px;
    border-radius: 13px; background: rgba(255, 255, 255, .05);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .2); }
.est-brk.is-enter .est-brk__m { animation: brk-in .45s both cubic-bezier(.2, .9, .3, 1); }
@keyframes brk-in { from { opacity: 0; transform: translateY(12px) scale(.93); } }
.est-brk__m.is-pop { animation: brk-pop .45s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes brk-pop { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }
/* Match jouable : c'est là qu'on attend un clic. */
.est-brk__m.is-live { background: rgba(99, 102, 241, .18);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .8), 0 0 0 4px rgba(99, 102, 241, .13);
    animation: brk-live 1.9s ease-in-out infinite; }
@keyframes brk-live { 50% { box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .9), 0 0 0 9px rgba(99, 102, 241, .05); } }
.est-brk__m.is-final { box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .55), 0 0 0 5px rgba(251, 191, 36, .1);
    background: rgba(251, 191, 36, .1); }
.est-brk__s { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 11px;
    border: 0; border-radius: 9px; background: rgba(255, 255, 255, .92); color: #0f172a;
    font-family: inherit; font-weight: 700; font-size: 1.02rem; text-align: left; cursor: pointer;
    transition: background .15s, color .15s, transform .12s, box-shadow .15s; }
.est-brk__nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-brk__m.is-live .est-brk__s:hover { background: #fff; transform: translateX(2px);
    box-shadow: 0 0 0 2px #818cf8, 0 6px 16px rgba(0, 0, 0, .3); }
.est-brk__s.is-win { background: linear-gradient(135deg, #6ee7b7, #10b981); color: #052e1b;
    box-shadow: 0 6px 16px rgba(16, 185, 129, .3); }
.est-brk__s.is-out { background: rgba(255, 255, 255, .11); color: rgba(226, 232, 240, .55);
    text-decoration: line-through; }
.est-brk__s.is-bye, .est-brk__s.is-wait { background: rgba(255, 255, 255, .055); cursor: default;
    color: rgba(148, 163, 184, .7); font-weight: 600; font-style: italic; font-size: .92rem; }
.est-brk__m.is-champ .est-brk__s.is-win { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #422006;
    box-shadow: 0 8px 22px rgba(245, 158, 11, .45); }
.est-brk__s .est-ico { width: 18px; height: 18px; flex: none; --est-ico-accent: rgba(255, 255, 255, .6); }

.est-open-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.est-open-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.est-open-card img { width: 100%; height: 100px; object-fit: cover; display: block; background: #fff; }
.est-open-noimg { height: 100px; display: grid; place-items: center; color: var(--slate-300); font-size: 2rem; background: var(--slate-50); }
.est-open-card__t { padding: 6px 8px; font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-open-card__tools { padding: 0 8px 8px; display: flex; justify-content: space-between; font-size: .82rem; }

/* « Gérer les tableaux » : liste groupée par mois/année (menus dépliants) */
.est-mng { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.est-mng-group { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.est-mng-grouphead { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 12px;
    border: 0; background: var(--slate-50); cursor: pointer; font: inherit; font-weight: 700; }
.est-mng-grouphead:hover { background: var(--slate-100); }
.est-mng-chevron { color: var(--muted); font-size: .8rem; transition: transform .15s; }
.est-mng-group:not(.is-collapsed) .est-mng-chevron { transform: rotate(90deg); }
.est-mng-grouptitle { flex: 1; min-width: 0; }
.est-mng-count { color: var(--muted); font-size: .76rem; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.est-mng-group.is-collapsed .est-mng-items { display: none; }
.est-mng-items { display: flex; flex-direction: column; }
.est-mng-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--slate-100); }
.est-mng-thumb { width: 56px; height: 38px; object-fit: cover; border-radius: 6px; background: #fff; border: 1px solid var(--border); flex: 0 0 auto; }
.est-mng-thumb--none { display: grid; place-items: center; color: var(--slate-300); }
.est-mng-title { flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-mng-tools { display: flex; gap: 4px; flex: 0 0 auto; }
.est-mng-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1; }
.est-mng-btn:hover { background: var(--slate-100); }
.est-mng-btn--danger:hover { background: #fee2e2; border-color: #fecaca; }
.est-mng-btn:disabled { opacity: .5; cursor: default; }

/* --- Capture d'une zone du tableau → hexagone image dans « Mes documents » --- */
.est-tool--cap { width: auto; padding: 0 9px; gap: 1px; font-size: .95rem; }
.est-tool__cap-arrow { color: var(--muted); font-weight: 700; }
.est-capsel { position: absolute; inset: 0; z-index: 40; cursor: crosshair; background: rgba(15,23,42,.08); touch-action: none; }
.est-capsel[hidden] { display: none; }
.est-capsel__rect { position: absolute; border: 2px dashed #2563eb; background: rgba(37,99,235,.10); box-shadow: 0 0 0 9999px rgba(15,23,42,.18); pointer-events: none; }
.est-capsel__rect[hidden] { display: none; }
.est-capsel__hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.86); color: #fff;
    padding: 7px 14px; border-radius: 999px; font-size: .84rem; pointer-events: none; box-shadow: 0 6px 18px rgba(15,23,42,.3); }
.est-capsel__hint kbd { background: rgba(255,255,255,.22); border-radius: 5px; padding: 1px 6px; font: inherit; font-size: .78rem; }

.capdoc__preview { display: block; width: 100%; max-height: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px;
    background: #fff; margin: 4px 0 12px; }
.capdoc__preview[hidden] { display: none; }
.capdoc__lead { margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
.capdoc__tree { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.capdoc__loading { color: var(--muted); text-align: center; padding: 18px 0; font-size: .9rem; margin: 0; }
.capdoc-root, .capdoc-name { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; font: inherit;
    padding: 8px 10px; border-radius: 8px; }
.capdoc-root { font-weight: 600; margin-bottom: 4px; }
.capdoc-root:hover, .capdoc-name:hover { background: var(--slate-100); }
.capdoc-row { display: flex; align-items: center; gap: 2px; }
.capdoc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capdoc-tog { flex: 0 0 auto; width: 26px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: .9rem; }
.capdoc-tog--leaf { cursor: default; color: var(--slate-300); }
.capdoc-chevron { display: inline-block; transition: transform .15s; }
.capdoc-node:not(.is-collapsed) > .capdoc-row .capdoc-chevron { transform: rotate(90deg); }
.capdoc-node.is-collapsed > .capdoc-children { display: none; }
.capdoc-children { margin-left: 16px; border-left: 1px solid var(--slate-100); padding-left: 4px; }
.capdoc-name:disabled, .capdoc-root:disabled { opacity: .5; cursor: default; }

/* ---- Appairage de l'extension de navigateur ---- */
.capext__lead { margin: 0 0 12px; font-size: .9rem; color: var(--slate-600); }
.capext__steps { margin: 0 0 14px; padding-left: 20px; font-size: .86rem; color: var(--muted); }
.capext__steps li { margin: 3px 0; }
/* Grille plutot que flex : les trois elements gardent leur place quoi qu'il arrive.
   En flex, le compte a rebours s'etirait et poussait le bouton a la ligne. */
.capext__codebox { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
    padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--slate-100); }
/* Le code est lu à voix haute ou recopié sur un autre poste : chiffres larges et espacés.
   nowrap est indispensable — l'espace des milliers offre sinon un point de coupure, et le
   code s'affiche sur deux lignes dès que le voisinage se resserre. */
.capext__code { white-space: nowrap; font: 700 1.6rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    letter-spacing: .22em; color: var(--slate-900, #0f172a); }
.capext__timer { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .78rem; color: var(--muted); }
.capext__codebox .btn { white-space: nowrap; }
.capext__h3 { margin: 18px 0 8px; font-size: .92rem; }
.capext__devices { border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.capext__empty { margin: 0; padding: 10px; font-size: .85rem; color: var(--muted); text-align: center; }
.capext__dev { display: flex; align-items: center; gap: 8px; padding: 7px 8px; font-size: .86rem; }
.capext__dev + .capext__dev { border-top: 1px solid var(--slate-100); }
.capext__devname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capext__devseen { flex: 0 0 auto; font-size: .74rem; color: var(--muted); }
.capext__revoke { flex: 0 0 auto; border: 0; background: none; cursor: pointer; font: inherit; font-size: .8rem;
    color: var(--danger, #dc2626); text-decoration: underline; }

/* Menu « déplacer vers une page » : s'ouvre vers le haut depuis l'indicateur i/N pendant un glisser */
.est-grp--pages { position: relative; }
.est-page-menu { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column-reverse; gap: 2px; min-width: 130px; padding: 6px; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.24); z-index: 14; }
.est-page-menu[hidden] { display: none; }
.est-page-menu__item { border: 0; background: none; font: inherit; text-align: left; cursor: default;
    padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.est-page-menu__item.is-hot { background: var(--primary, #4f46e5); color: #fff; }
.est-page-menu__item.is-cur { color: var(--muted); }

/* =========================================================================
   Trieur de pages (clic sur l'indicateur « i/N » de la barre du bas)
   Planche-contact : réordonner par glisser-déposer, insérer une page entre
   deux vignettes, dupliquer, supprimer. Les vignettes sont produites par le
   moteur (js/estrade.js) : ce sont de vraies images du tableau.
   ========================================================================= */
/* L'indicateur devient un bouton : il doit s'annoncer cliquable sans grossir la barre. */
.est-ind--pg { height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 9px;
    background: none; color: inherit; font: inherit; font-size: .82rem; font-weight: 700;
    font-variant-numeric: tabular-nums; cursor: pointer; }
.est-ind--pg:hover { background: var(--slate-100); border-color: var(--border); }

.modal__box--pgs { max-width: 1180px; width: min(96vw, 1180px); padding: 18px 20px 16px;
    display: flex; flex-direction: column; max-height: 90vh; }
.modal__box--pgs .modal__head { gap: 12px; }
.modal__box--pgs .modal__title { flex: 0 0 auto; }
.pgs__count { margin-right: auto; font-size: .8rem; font-weight: 600; color: var(--muted);
    background: var(--slate-100); border: 1px solid var(--border); border-radius: 999px; padding: 2px 11px; }
.pgs__lead { margin: 10px 0 6px; font-size: .86rem; color: var(--muted); }
.pgs__plus { display: inline-grid; place-items: center; width: 17px; height: 17px; vertical-align: -.2em;
    border-radius: 50%; background: var(--primary); color: #fff; font-size: .74rem; font-weight: 700; line-height: 1; }

/* Rangée de vignettes : [fente][page][fente][page]…[fente]. Les fentes servent à
   la fois de bouton « insérer ici » et de repère de dépose pendant un glisser. */
/* Fond propre à la planche : les vignettes blanches s'y détachent, et l'espace libre
   à droite de la dernière page se lit comme un plan de travail, pas comme un trou. */
.pgs__grid { display: flex; flex-wrap: wrap; align-items: stretch; overflow: auto; min-height: 0;
    margin-top: 4px; padding: 2px 10px 10px; background: var(--slate-50);
    border: 1px solid var(--border); border-radius: 12px; }
.pgs__foot { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); justify-content: space-between; }
.pgs__foot .est-ico { margin-right: 8px; vertical-align: -.22em; }

.pgs-slot { position: relative; flex: 0 0 auto; width: 30px; margin: 9px 0; display: grid; place-items: center; }
.pgs-slot::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 50%; width: 4px; margin-left: -2px;
    border-radius: 4px; background: var(--primary); opacity: 0; transform: scaleY(.6); transition: opacity .13s, transform .13s; }
.pgs-slot.is-drop::before { opacity: 1; transform: none; }
.pgs-slot__b { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 50%;
    border: 1px dashed var(--slate-300); background: #fff; color: var(--slate-400); cursor: pointer;
    font-size: .92rem; font-weight: 700; line-height: 1; opacity: .38;
    transition: opacity .14s, background .14s, color .14s, border-color .14s, transform .14s; }
.pgs-slot:hover .pgs-slot__b { opacity: 1; }
.pgs-slot__b:hover, .pgs-slot__b:focus-visible { background: var(--primary); border-color: var(--primary);
    border-style: solid; color: #fff; opacity: 1; transform: scale(1.16); }
.pgs__grid.is-sorting .pgs-slot__b { opacity: 0; pointer-events: none; }

.pgs-card { position: relative; flex: 0 0 auto; width: 214px; margin: 9px 0; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: grab;
    user-select: none; -webkit-user-select: none; touch-action: none;
    box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.06);
    transition: box-shadow .16s, border-color .16s, transform .16s; }
.pgs-card:hover { border-color: var(--slate-300); transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(15,23,42,.09), 0 12px 26px rgba(15,23,42,.13); }
.pgs-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pgs-card.is-current { border-color: var(--acc-estrade-2); box-shadow: 0 0 0 2px var(--acc-estrade-1), 0 8px 22px rgba(6,182,212,.22); }
.pgs-card.is-dragging { opacity: .3; filter: grayscale(1); transform: none; }

.pgs-card__vue { position: relative; aspect-ratio: var(--pgs-ar, 16 / 9); background: #fff;
    border-bottom: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.pgs-card__img { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-drag: none; }
.pgs-card__vide { position: absolute; font-size: .8rem; color: var(--slate-300); font-weight: 600; letter-spacing: .02em; }

.pgs-card__tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.pgs-tool { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.94); color: var(--slate-600);
    box-shadow: 0 2px 6px rgba(15,23,42,.14); }
.pgs-tool:hover { background: #fff; border-color: var(--slate-300); color: var(--slate-900); }
.pgs-tool--danger:hover { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.pgs-tool:disabled { opacity: .35; cursor: default; box-shadow: none; }
.pgs-tool:disabled:hover { background: rgba(255,255,255,.94); border-color: var(--border); color: var(--slate-600); }
.pgs-tool .est-ico { width: 17px; height: 17px; }
/* À la souris, les outils ne se montrent qu'au survol ; au doigt et au stylet (TBI),
   il n'y a pas de survol : ils restent visibles en permanence. */
@media (hover: hover) and (pointer: fine) {
    .pgs-card__tools { opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s; }
    /* :focus-visible et non :focus-within — la carte de la page courante reçoit le focus
       à l'ouverture, ses outils ne doivent pas s'afficher seuls pour autant. */
    .pgs-card:hover .pgs-card__tools,
    .pgs-card:focus-visible .pgs-card__tools,
    .pgs-card__tools:focus-within { opacity: 1; transform: none; }
}

.pgs-card__bar { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: var(--slate-50); }
.pgs-card__n { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px;
    background: var(--slate-900); color: #fff; font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pgs-card.is-current .pgs-card__n { background: var(--acc-estrade-2); }
.pgs-card__lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .76rem; font-weight: 600; color: var(--muted); }
.pgs-card.is-current .pgs-card__lbl { color: var(--acc-estrade-2); }

/* Confirmation de suppression : posée SUR la vignette, plutôt qu'une boîte système —
   en projection plein écran, une boîte de dialogue du navigateur passe mal. */
.pgs-card__ask { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px; padding: 12px; text-align: center;
    background: rgba(15,23,42,.93); color: #fff; }
.pgs-card__ask[hidden] { display: none; }
.pgs-card__ask p { margin: 0; font-size: .84rem; font-weight: 600; }
.pgs-card__ask div { display: flex; gap: 8px; }
.pgs-ask-btn { border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff;
    border-radius: 8px; padding: 5px 12px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.pgs-ask-btn:hover { background: rgba(255,255,255,.24); }
.pgs-ask-btn--yes { background: #ef4444; border-color: #ef4444; }
.pgs-ask-btn--yes:hover { background: #dc2626; }

/* Vignette portée par le pointeur pendant le glisser (hors flux, jamais cliquable). */
.pgs-ghost { position: fixed; left: 0; top: 0; z-index: 200; margin: 0; pointer-events: none; cursor: grabbing;
    opacity: .96; box-shadow: 0 20px 44px rgba(15,23,42,.38); transition: none; }
.pgs-ghost .pgs-card__tools, .pgs-ghost .pgs-card__ask { display: none; }

@media (max-width: 620px) {
    .pgs-card { width: 150px; }
    .pgs-slot { width: 22px; }
}

.est:fullscreen { background: #fff; padding: 0; width: 100vw; max-width: none; margin: 0; }
.est:fullscreen .est-stage { height: 100vh; border: 0; border-radius: 0; }

/* =========================================================================
   Phase 5 — Aujourd'hui, séance pivot, palette Ctrl+K
   ========================================================================= */
/* Titre, interrupteur « visible par mes élèves », date. L'interrupteur est sur la même
   ligne que le titre et la date passe dessous : la grille tient les trois sans que le
   libellé de l'interrupteur ne se fasse écraser par un titre long. */
.dash__head { margin-bottom: 16px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 16px; }
.dash__title { margin: 0; }
.dash__date { margin: 2px 0 0; color: var(--muted); text-transform: capitalize; grid-column: 1 / -1; }

/* ==== Interrupteur à glisser (une case à cocher déguisée) ====
   Le balisage reste <label><input type="checkbox"><span piste><span pouce></span></span>
   <span texte></label> : navigation au clavier, lecteurs d'écran et état coché viennent du
   navigateur, le JavaScript ne fait que porter le changement au serveur. */
.sw { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.sw__box { position: absolute; opacity: 0; width: 0; height: 0; }
.sw__piste {
    flex: none; position: relative; width: 40px; height: 22px; border-radius: 999px;
    background: var(--slate-300, #cbd5e1); transition: background .18s ease;
}
.sw__pouce {
    position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .35); transition: transform .18s ease;
}
.sw__box:checked + .sw__piste { background: var(--primary, #4f46e5); }
.sw__box:checked + .sw__piste .sw__pouce { transform: translateX(18px); }
.sw__box:focus-visible + .sw__piste { outline: 2px solid var(--primary); outline-offset: 2px; }
.sw__box:disabled + .sw__piste { opacity: .55; }
.sw:has(.sw__box:disabled) { cursor: progress; }
.sw__txt { font-size: .88rem; color: var(--muted); }
/* Éteint, le libellé le dit en toutes lettres : le gris d'un interrupteur seul se lit mal
   sur une page qui en compte peu. */
.sw--cdt .sw__box:not(:checked) ~ .sw__txt { color: #b45309; }
.sw--cdt .sw__box:not(:checked) ~ .sw__txt::after { content: ' — cahier masqué'; }
@media (prefers-reduced-motion: reduce) {
    .sw__piste, .sw__pouce { transition: none; }
}
.dash__layout { display: flex; gap: 18px; align-items: flex-start; }
.dash__main { flex: 1; min-width: 0; }
.dash__side { width: 280px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.dash__h2 { font-size: 1.05rem; margin: 0 0 12px; }
/* Navigation par jour de « Mes séances » : les flèches rejouent la liste pour un autre jour
   (?jour=), le reste de la page ne bouge pas. Le libellé garde une largeur fixe pour que les
   flèches ne sautent pas d'un jour à l'autre. */
.dash__daynav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash__daynav .dash__h2 { margin: 0; }
.dash__daynav-tools { display: flex; align-items: center; gap: 6px; }
.dash__dayl { font-weight: 700; color: var(--slate-600); min-width: 10.5em; text-align: center; }
.dash-slot__action { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.dash-slot { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--border); border-left: 6px solid var(--cl, var(--border)); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.dash-slot.is-done { background: #ecfdf5; border-color: #a7f3d0; }
.dash-slot__time { text-align: center; font-weight: 800; color: var(--slate-700); min-width: 54px; line-height: 1.1; }
.dash-slot__time span { font-weight: 500; color: var(--muted); font-size: .8rem; }
.dash-slot__body { flex: 1; min-width: 0; }
.dash-slot__classe { font-weight: 700; }
.dash-slot__lecon { color: var(--slate-600); margin-top: 2px; }
.dash-slot__meta { display: flex; gap: 5px; margin-top: 4px; }
.dash-improv { margin-top: 8px; }
.dash-ramasse { list-style: none; margin: 0; padding: 0; }
.dash-ramasse li { border-bottom: 1px solid var(--slate-100); padding: 9px 0; }
.dash-ramasse__top { display: flex; align-items: center; gap: 8px; }
.dash-ramasse__cl { font-size: .8rem; color: var(--muted); }
.dash-ramasse__desc { font-size: .92rem; margin-top: 3px; }
.dash-ramasse__date { font-size: .8rem; color: var(--muted); }

/* ---- Page « Gestion » (emploi du temps, classes & élèves) ---- */
/* Pleine largeur sur ordinateur (break-out du .container, comme Mes documents). */
.gestion { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); padding: 0 24px 48px; }
.gestion__title { font-size: 1.4rem; margin: 0; }
.gestion__bloc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.gestion__h2 { font-size: 1.05rem; margin: 0; }
.gestion__hint { font-weight: 400; font-size: .82rem; color: var(--muted); }
/* Barre de la semaine type : les deux boutons (grille horaire, + créneau) restent groupés
   à droite du titre, que .cdt__bar écarterait sinon l'un de l'autre. */
.sem-bar__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Éditeur de la grille horaire : une ligne = une sonnerie (début → fin). */
.hrm-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 46vh; overflow-y: auto; }
.hrm-row { display: flex; align-items: center; gap: 8px; }
.hrm-row .field__input { flex: 1 1 0; min-width: 0; }
.hrm-sep { color: var(--muted); font-weight: 700; }
.hrm-vide { color: var(--muted); font-size: .88rem; margin: 10px 0; }
.hrm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.gestion .sem-creneau { position: relative; align-items: flex-start; border-left: 5px solid var(--cl, var(--border)); padding-left: 8px; margin-bottom: 4px; border-bottom: 0; background: var(--slate-50, #f8fafc); border-radius: 0 8px 8px 0; padding-top: 5px; padding-bottom: 5px; padding-right: 6px; }
.gestion .sem-creneau.has-salle { padding-bottom: 22px; }
.sem-creneau__main { min-width: 0; }
.sem-creneau__cl { font-weight: 700; font-size: .85rem; }
.sem-creneau__h { display: block; font-size: .72rem; color: var(--muted); margin-top: 1px; }
.sem-salle { position: absolute; right: 5px; bottom: 4px; color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.4; padding: 1px 8px; border-radius: 999px; max-width: 60%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Case double : semaine A à gauche, semaine B à droite. */
.sem-duo { display: flex; gap: 4px; }
.sem-duo .sem-creneau--half { flex: 1; min-width: 0; }
.sem-duo .sem-creneau--half .sem-creneau__tools { flex-direction: column; gap: 2px; align-items: flex-end; }
.sem-ab { display: inline-block; font-size: .68rem; font-weight: 800; background: var(--slate-800, #1e293b); color: #fff; border-radius: 5px; padding: 1px 6px; vertical-align: 1px; }
.edt__ab { display: inline-block; font-style: normal; font-size: .78rem; font-weight: 800; background: var(--slate-800, #1e293b); color: #fff; border-radius: 6px; padding: 2px 8px; margin-left: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.btn-edit { text-decoration: none; }
.cls-card__foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
/* Étiquette « groupe » là où le cahier de texte affiche la classe. */
.sem-creneau__grp { display: inline-block; font-size: .7rem; font-weight: 700; background: var(--slate-200, #e2e8f0); color: var(--slate-700, #334155); border-radius: 5px; padding: 0 5px; margin-left: 2px; }
.dash-slot__grp { font-weight: 600; }
.edt-case__grp { font-size: .72rem; font-weight: 700; color: var(--slate-700, #334155); }
.exp-seance__grp { font-weight: 600; color: var(--muted); font-size: .85rem; margin-left: 6px; }
.dash__side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dash__side-head .dash__h2 { margin: 0; }

/* Gestion — adaptation téléphone : jours empilés, cartes compactes.
   Le break-out 100vw est annulé (le .container est déjà pleine largeur sur
   mobile, et 100vw + barre de défilement créerait un débordement horizontal). */
@media (max-width: 640px) {
    .gestion { width: auto; max-width: none; margin-left: 0; padding: 0 0 40px; }
    .gestion__bloc { padding: 12px; }
    .gestion .sem-grid { grid-template-columns: 1fr; }
    .gestion .eleve__email { flex-basis: 100%; order: 3; }
    .gestion .cls-card__head { flex-direction: column; }
    .gestion .cls-card__tools { flex-wrap: wrap; justify-content: flex-start; }
}

/* ---- Code couleur des classes (page Gestion) ---- */
.cls-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(15,23,42,.18); margin-right: 8px; }
.cls-palette { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.cls-swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid rgba(15,23,42,.12); cursor: pointer; padding: 0; }
.cls-swatch.is-active { border-color: var(--slate-800, #1e293b); box-shadow: inset 0 0 0 2px #fff; }
.cls-swatch--none { background: #fff; border-style: dashed; color: var(--muted); font-size: .95rem; line-height: 1; }
.cls-palette input[type="color"] { width: 34px; height: 28px; padding: 1px 2px; border: 2px solid rgba(15,23,42,.12); border-radius: 8px; background: #fff; cursor: pointer; }
.cls-palette input[type="color"].is-active { border-color: var(--slate-800, #1e293b); }

/* ---- Emploi du temps de la semaine (façon feuille papier) ---- */
.edt { margin-top: 26px; margin-bottom: 26px; }
.edt__bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
/* Bascule de présentation, en haut à droite du tableau (Planning ↔ EDT). */
.edt__vues { display: inline-flex; margin-left: auto; gap: 2px; padding: 2px; background: var(--slate-100, #f1f5f9); border: 1px solid var(--border); border-radius: 999px; }
.edt__vue { border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 700; color: var(--muted); padding: 4px 14px; border-radius: 999px; cursor: pointer; }
.edt__vue:hover { color: var(--slate-900, #0f172a); }
.edt__vue.is-active { background: #fff; color: var(--slate-900, #0f172a); box-shadow: 0 1px 3px rgba(15,23,42,.16); }
/* Les deux présentations sont rendues dans la page ; la classe portée par #edt décide
   laquelle s'affiche — à l'écran comme sur la feuille, l'autre étant en display:none. */
.edt .edt__vue-edt { display: none; }
.edt.is-vue-edt .edt__vue-planning { display: none; }
.edt.is-vue-edt .edt__vue-edt { display: table; }
.edt__sheet { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; }
.edt__titre { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-weight: 700; font-style: italic; font-size: .95rem; }
.edt-case__date[data-seance] { cursor: pointer; }
.edt-case__date.is-copied { outline: 2px solid #059669; }
.edt__grid { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
/* Sélecteurs d'enfants directs, partout où la grille se décrit : le déroulé d'une séance
   est du HTML rendu, il peut contenir un TABLEAU — sans le « > », la bordure noire, le
   padding nul et la hauteur de 88 px des cases retomberaient sur ses cellules à lui. */
.edt__grid > tbody > tr > th, .edt__grid > tbody > tr > td { border: 1.5px solid var(--slate-800, #1e293b); padding: 0; vertical-align: top; height: 88px; }
.edt__classe { width: 34px; background: var(--cl, #e2e8f0); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.edt__classe span { writing-mode: vertical-rl; transform: rotate(180deg); display: block; margin: auto; font-weight: 800; font-size: .82rem; padding: 6px 2px; white-space: nowrap; }
.edt__classe--extra { background: #f1f5f9; }
.edt__classe--extra span { font-weight: 600; color: var(--slate-600); }
.edt-case { display: block; width: 100%; height: 100%; text-align: center; }
/* En-tête d'une case : la date en pastille à gauche, l'horaire à droite, sur UNE seule
   ligne. Tout ce qui suit accueille le déroulé de la séance quand il est saisi (prévu ou
   fait) — et reste blanc sinon, pour qu'on l'écrive à la main sur la feuille imprimée. */
/* Corps mesurés sur la case IMPRIMÉE (5,4 cm, soit 193 px utiles) : à .62/.56 rem, une
   date sans salle tient toujours sur une ligne, la plus longue comprise.
   flex-wrap : avec une salle en plus (« mercredi 2 septembre » + « 08:00 – 09:00 · S103 »)
   la ligne déborde ; l'horaire passe alors dessous plutôt que de rogner la date — rien
   n'est perdu. Le calage du déroulé mesure cet en-tête, il suit tout seul. */
.edt-case__tete { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; margin: 3px 3px 0; }
.edt-case__date { flex: 0 1 auto; min-width: 0; font-size: .62rem; font-weight: 600; padding: 1px 6px; border-radius: 4px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Horaire (nom de la classe pour les suppléments) : au bout de la ligne d'en-tête, menu
   et insécable — il ne doit jamais pousser la pastille de date sur une deuxième ligne. */
.edt-case__heure { flex: 0 0 auto; margin-left: auto; font-size: .56rem; font-weight: 600; color: var(--slate-700); white-space: nowrap; }
.edt-case__lecon { display: block; font-size: .68rem; font-weight: 700; color: var(--slate-900); margin: 2px 5px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.edt-case__lecon:hover { text-decoration: underline; }
/* Déroulé de la séance : il occupe le reste de la case, rendu comme
   sur la page de la séance (mêmes règles .prose) mais ramené à l'échelle du timbre-poste.
   TOUT y est exprimé en em : js/aujourdhui.js ne règle que la taille de base, et titres,
   listes, images et formules suivent. La taille et le plafond de hauteur sont posés en
   style INLINE par le script, calculés pour la case du PAPIER — la seule qui soit tenue
   de tenir. Les valeurs ci-dessous ne servent que s'il n'a pas tourné. */
.edt-case__deroule { font-size: 7px; line-height: 1.2; text-align: left; color: var(--slate-700);
    padding: 1px 5px 0; overflow: hidden; overflow-wrap: anywhere; }
.edt-case__deroule > :first-child { margin-top: 0; }
.edt-case__deroule > :last-child { margin-bottom: 0; }
.edt-case__deroule p, .edt-case__deroule ul, .edt-case__deroule ol,
.edt-case__deroule blockquote { margin: .25em 0; }
.edt-case__deroule h1, .edt-case__deroule h2, .edt-case__deroule h3,
.edt-case__deroule h4, .edt-case__deroule h5, .edt-case__deroule h6 {
    font-size: 1.05em; font-weight: 700; line-height: 1.2; margin: .35em 0 .1em; }
.edt-case__deroule ul, .edt-case__deroule ol { padding-left: 1.1em; }
.edt-case__deroule li { margin: 0; }
.edt-case__deroule blockquote { padding-left: .5em; border-left-width: 2px; }
.edt-case__deroule pre { padding: .3em; border-radius: .3em; }
.edt-case__deroule code { padding: 0 .2em; border-radius: .2em; }
.edt-case__deroule table { margin: .3em 0; }
.edt-case__deroule th, .edt-case__deroule td { padding: .1em .3em; }
/* Une illustration ne suit pas la taille du texte : on la borne en em pour qu'elle
   rétrécisse elle aussi quand le tâtonnement descend. */
.edt-case__deroule img, .edt-case__deroule svg { max-width: 100%; max-height: 7em; height: auto; }
/* Déroulé PRÉVU (séance pas encore faite) : même place et même échelle que le compte rendu
   — rien de la géométrie de la case ne change, le calage papier de js/aujourdhui.js non plus
   — mais en italique et en encre plus claire, pour lire d'un coup d'œil ce qui est prévu et
   ce qui a été fait. Déclaré APRÈS le bloc ci-dessus : à spécificité égale, c'est sa couleur
   qui l'emporte, et les paragraphes du déroulé en héritent. */
.edt-case__deroule--prevu { color: var(--slate-500, #64748b); font-style: italic; }
.edt-case--today { outline: 3px solid #0ea5e9; outline-offset: -3px; }
.edt-case--done .edt-case__heure::after { content: " ✓"; color: #059669; }
.edt-case--add { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .85rem; }
.edt-case--add:hover { background: #f8fafc; }
.edt-case { position: relative; }
.edt-case__edit { position: absolute; right: 3px; bottom: 2px; background: none; border: 0; cursor: pointer; font-size: .9rem; line-height: 1; padding: 3px 5px; opacity: .3; border-radius: 6px; }
.edt-case__edit:hover { opacity: 1; background: var(--slate-100, #f1f5f9); }
/* Poignee de COPIE (⧉) : on traine une seance sur une autre case pour l'y recopier
   (js/cahier.js). Jumelle du ✎, a l'autre coin. touch-action: none est indispensable —
   sans elle, le doigt fait defiler la page au lieu d'entrainer la seance. */
.edt-case__copy { position: absolute; left: 3px; bottom: 2px; background: none; border: 0; cursor: grab;
    font-size: .82rem; line-height: 1; padding: 3px 5px; opacity: .3; border-radius: 6px; touch-action: none; }
.edt-case__copy:hover { opacity: 1; background: var(--slate-100, #f1f5f9); }
/* Pendant le geste : toutes les cases qui peuvent recevoir la copie s'eclairent (la
   source, rendue deux fois — Planning et EDT —, en est exclue), et celle qu'on survole
   s'allume franchement. Deux classes de plus que .edt-case--today : c'est bien le
   marquage du glisser qui l'emporte le temps du geste. */
.edt.is-copie .edt-case:not(.is-copie-src) { outline: 2px dashed var(--slate-400, #94a3b8); outline-offset: -2px; }
.edt.is-copie .edt-case.is-copie-cible { outline: 3px solid #059669; outline-offset: -3px; background: #ecfdf5; }
.edt-ghost {
    position: fixed; z-index: 90; transform: translate(-50%, -140%); pointer-events: none;
    max-width: 260px; padding: 5px 11px; border-radius: 8px;
    background: var(--primary); color: #fff; font-weight: 600; font-size: .82rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    box-shadow: 0 8px 20px rgba(79,70,229,.4);
}
/* Bandeau de la seance MISE DE COTE par un clic sur ⧉. Il est posé sur le <body> et non
   dans la grille : c'est justement l'etat qui doit rester visible pendant qu'on change de
   semaine (les fleches ◀ ▶ rechargent la page) et pendant qu'on fait defiler. */
.edt-copiebar {
    position: fixed; z-index: 80; left: 50%; bottom: 18px; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px; max-width: min(92vw, 620px);
    padding: 9px 10px 9px 15px; border-radius: 999px;
    background: var(--slate-800, #1e293b); color: #fff; font-size: .84rem; font-weight: 600;
    box-shadow: 0 10px 26px rgba(15,23,42,.35);
}
.edt-copiebar__txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edt-copiebar__btn {
    flex: 0 0 auto; padding: 4px 12px; border: 0; border-radius: 999px; cursor: pointer;
    background: rgba(255,255,255,.16); color: #fff; font: inherit; font-size: .8rem;
}
.edt-copiebar__btn:hover { background: rgba(255,255,255,.3); }

/* ---- Vue « EDT » : jours en colonnes × horaires en lignes ----------------------
   Vraie feuille d'emploi du temps : les séances qui commencent à la même heure sont
   sur la même ligne, d'un jour à l'autre. Même squelette de tableau que la vue
   « Planning » (.edt__grid) et exactement les mêmes cases — d'où si peu de règles ici :
   ne restent que l'en-tête des jours, la colonne des horaires et la case vide. */
.edt-sem > thead > tr > th { border: 1.5px solid var(--slate-800, #1e293b); padding: 2px 4px; }
.edt-sem__tete { font-size: .74rem; font-weight: 800; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.edt-sem__tete.is-today { outline: 3px solid #0ea5e9; outline-offset: -3px; }
/* Colonne des horaires — pendant de .edt__classe (les classes) dans la vue Planning ;
   sa largeur est reprise par js/aujourdhui.js pour calculer la case du papier. */
.edt__heure { width: 54px; background: #f1f5f9; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.edt__heure span { display: block; padding: 4px 2px; font-size: .68rem; font-weight: 800; color: var(--slate-700, #334155); }
.edt__heure--extra span { font-size: .6rem; font-weight: 600; color: var(--slate-600); }
/* Deux séances sur le même créneau (classe dédoublée, remplacement) : la case ne peut
   plus prendre toute la hauteur de la cellule, elles se la partagent. */
.edt-sem .edt__cell:has(.edt-case + .edt-case) .edt-case { height: auto; }
.edt-sem .edt-case + .edt-case { border-top: 1px dashed var(--slate-300, #cbd5e1); }
/* Case vide : le « + » ne se montre qu'au survol (ou au clavier), mais le bouton
   occupe toute la cellule — c'est elle, entière, qui est cliquable. */
.edt-sem__vide { display: block; width: 100%; height: 100%; min-height: 40px; border: 0; background: none; cursor: pointer;
    font: 300 1.5rem/1 inherit; color: var(--muted); opacity: 0; transition: opacity .12s; }
.edt-sem__vide:hover, .edt-sem__vide:focus-visible { opacity: 1; background: var(--slate-50, #f8fafc); }
/* ---- Créneaux libres : les heures de la grille horaire où l'enseignant n'a rien de la
   semaine. Elles sont rendues dans le tableau puis REPLIÉES ; la bascule « Créneaux libres »
   pose .is-libres sur #edt et les déplie — à l'écran comme sur la feuille imprimée, sans
   recharger la page. La colonne des horaires les distingue en italique clair : ce sont des
   heures où il ne se passe rien, elles ne doivent pas peser autant que les autres. */
.edt:not(.is-libres) .edt-sem__libre { display: none; }
.edt-sem__libre > .edt__heure { background: #f8fafc; }
.edt-sem__libre > .edt__heure span { font-weight: 600; font-style: italic; color: var(--muted); }
/* Bascule « Créneaux libres » : propre à la vue EDT (en Planning les lignes sont des
   classes, la notion n'a pas de sens) — d'où le repli hors de cette vue. */
.edt__libres { display: none; border: 1px solid var(--border); background: #fff; font: inherit;
    font-size: .82rem; font-weight: 700; color: var(--muted); padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.edt.is-vue-edt .edt__libres { display: inline-block; }
.edt__libres:hover:not(:disabled) { color: var(--slate-900, #0f172a); }
.edt__libres[aria-pressed="true"] { background: var(--slate-800, #1e293b); border-color: var(--slate-800, #1e293b); color: #fff; }
.edt__libres:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Créneaux d'une autre matière que le cours (migrations 066 et 067) ---------
   Vie de classe, Devoirs faits… : ces créneaux tiennent leur place dans l'emploi du temps
   et dans « Ma semaine », mais ne figurent pas au cahier de texte de la classe. Une teinte
   propre les distingue partout où ils apparaissent — semaine type, séances du jour, les
   deux vues de la semaine — et l'impression la garde (« Ma semaine » sort en couleur).

   UNE variable par nature (.nature--<slug>), et un seul jeu de règles qui la consomme :
   ajouter une nature au catalogue App\Models\Creneau::NATURES ne demande ici que la paire
   de couleurs. --nat-cl teinte la pastille et le sous-titre, --nat-bg le fond de la case.
   Déclarées ICI, après .gestion .sem-creneau et .edt-case : à spécificité égale, c'est la
   dernière règle écrite qui l'emporte. */
.nature--vie_classe    { --nat-cl: #7C3AED; --nat-bg: #faf5ff; }   /* violet */
.nature--devoirs_faits { --nat-cl: #0E7490; --nat-bg: #ecfeff; }   /* cyan   */
.nature-chip { display: inline-block; font-size: .68rem; font-weight: 800; color: #fff;
    background: var(--nat-cl, #7C3AED); border-radius: 5px; padding: 0 6px; vertical-align: 1px;
    white-space: nowrap; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gestion .sem-creneau.is-hors-cahier { background: var(--nat-bg, #f8fafc); }
.edt-case.is-hors-cahier { background: var(--nat-bg, transparent); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.edt-case.is-hors-cahier .edt-case__grp { color: var(--nat-cl, inherit); }

/* Impression de la page « Aujourd'hui » (la seule à contenir .edt) : règles
   statiques — aucune classe posée en JS — pour être fiables quel que soit le
   navigateur et le chemin d'impression (bouton, Ctrl+P, menu). */
@media print {
    body:has(.edt) .topbar, body:has(.edt) .footer, body:has(.edt) .dash__head,
    body:has(.edt) .dash__layout, body:has(.edt) .modal { display: none !important; }
    body:has(.edt), body:has(.edt) .container { max-width: none; width: auto; padding: 0; margin: 0; height: auto; }
    body:has(.edt) .edt { margin: 0; }
    body:has(.edt) .edt__sheet { border: 0; border-radius: 0; padding: 0; overflow: visible; width: 100%; }
    body:has(.edt) .edt__titre { margin: 0 0 3mm; font-size: 11pt; }
    /* Largeur : jamais plus que la zone imprimable (le min-width écran est annulé).
       Hauteur : la grille remplit exactement la page (100vh = page moins marges),
       les hauteurs de lignes se répartissent → toujours une seule page. */
    /* --edt-grille : hauteur de la grille sur la feuille (la page moins le titre). Nommée
       ici parce que la vue s'en sert pour donner à chaque ligne exactement sa part, et
       js/aujourdhui.js pour calculer la case papier — trois calculs, une seule valeur. */
    body:has(.edt) .edt { --edt-grille: calc(100vh - 13mm); }
    body:has(.edt) .edt__grid { min-width: 0 !important; width: 100% !important; max-width: 100% !important; table-layout: fixed; height: var(--edt-grille); }
    body:has(.edt) .edt__grid > tbody > tr > th, body:has(.edt) .edt__grid > tbody > tr > td { height: auto; overflow: hidden; }
    body:has(.edt) .edt-case--today { outline: none; }
    body:has(.edt) .edt-case--add { visibility: hidden; }
    body:has(.edt) .edt-sem__tete.is-today { outline: none; }
    /* Vue « EDT » : mêmes règles de grille que le Planning (elle est aussi un .edt__grid),
       plus sa ligne de jours en tête — dont la hauteur est déclarée avec les autres
       mesures de la feuille dans le <style media="print"> de la vue. */
    body:has(.edt) .edt-sem > thead > tr > th { overflow: hidden; }
    body:has(.edt) .edt-sem__vide { display: none; }
    /* Déroulé de la séance : coupé net à la hauteur de la case, mesurée par
       js/aujourdhui.js (--edt-dl-h). Sans ce plafond, un déroulé fleuve ferait enfler
       sa ligne et pousserait la grille sur une deuxième page. À l'écran, au contraire,
       la ligne s'agrandit et le texte se lit en entier : pas de plafond hors impression. */
    body:has(.edt) .edt-case__deroule { max-height: var(--edt-dl-h, none); }
}

.seance__bar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-size: .9rem; }
.seance__head { margin-bottom: 14px; }
.seance__title { margin: 0 0 4px; }
.seance__meta { margin: 0; color: var(--muted); text-transform: capitalize; }
.seance__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.seance__grid { display: flex; gap: 18px; align-items: flex-start; }
.seance__grid > div:first-child { flex: 1; min-width: 0; }
.seance__res { width: 280px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.seance__h2 { font-size: 1.05rem; margin: 0 0 10px; }
.seance-travaux { line-height: 1.7; }
.seance-docs { list-style: none; padding: 0; margin: 0; }
.seance-docs li { padding: 5px 0; border-bottom: 1px solid var(--slate-100); }
.seance-docs__t { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.seance-docs__travaux { margin-left: 6px; font-size: .8rem; font-weight: 600; }

/* ---- Photos de séance (envoyées depuis un téléphone via le QR code) ------
   Grille souple : la vignette est carrée pour que des clichés portrait et paysage
   composent une planche régulière ; le cliché entier reste atteignable au clic. */
.seance__photos { margin-top: 22px; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px 16px; }
.seance__photoshead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seance__photoshead .seance__h2 { margin: 0; }
.seance__photos .field__hint { margin: 6px 0 12px; }

.sphotos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.sphotos .cdt-empty { grid-column: 1 / -1; margin: 0; }

.sphoto { position: relative; margin: 0; border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; background: var(--slate-100); }
.sphoto__link { display: block; aspect-ratio: 1 / 1; }
.sphoto__link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sphoto__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 8px 5px;
    color: #fff; font-size: .74rem; font-variant-numeric: tabular-nums;
    background: linear-gradient(to top, rgba(15, 23, 42, .72), rgba(15, 23, 42, 0)); }

/* Croix discrète : effacée au repos, franchement rouge dès qu'on approche la vignette. */
.sphoto__del { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    border: 0; border-radius: 50%; font-size: .78rem; line-height: 1;
    background: rgba(15, 23, 42, .45); color: #fff; opacity: .55; transition: opacity .15s, background .15s; }
.sphoto:hover .sphoto__del, .sphoto__del:focus-visible { opacity: 1; }
.sphoto__del:hover { background: #dc2626; opacity: 1; }
.sphoto__del[disabled] { opacity: .35; cursor: default; }

/* Modale du QR code (construite par js/seance-photos.js). Le QR code doit tomber au
   MILIEU de l'écran : les marges automatiques centrent la boîte sans lui interdire de
   défiler si elle dépasse (ce que ferait un align-items: center sur .modal). */
.qrphoto { text-align: center; margin-top: auto; margin-bottom: auto; }
.qrphoto__code { min-height: 240px; display: flex; align-items: center; justify-content: center;
    margin: 4px auto 12px; }
.qrphoto__code svg { width: 240px; height: 240px; max-width: 100%; display: block;
    border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; }
.qrphoto__hint { margin: 0; color: var(--slate-700); font-size: .92rem; }
.qrphoto__etat { margin: 8px 0 0; min-height: 1.2em; font-size: .86rem; color: var(--muted); }
.qrphoto__etat.is-ok { color: #15803d; font-weight: 700; }
.qrphoto__etat.is-off { color: #b91c1c; font-weight: 700; }

.viewer-used { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); }
.viewer-used__h { font-weight: 600; color: var(--slate-700); }

.cmdk { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk[hidden] { display: none; }
.cmdk__box { width: 100%; max-width: 600px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(15,23,42,.4); overflow: hidden; }
.cmdk__input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 16px 18px; font-size: 1.05rem; outline: none; }
.cmdk__results { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.cmdk-item.is-sel { background: var(--slate-100); }
.cmdk-item__ic { font-size: 1.1rem; width: 22px; text-align: center; }
.cmdk-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmdk-item__label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item__sub { font-size: .8rem; color: var(--muted); }
.cmdk-item__type { font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.cmdk-empty { padding: 16px; color: var(--muted); text-align: center; }
.cmdk__hint { padding: 8px 14px; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); }

@media (max-width: 760px) {
    .dash__layout, .seance__grid { flex-direction: column; }
    .dash__side, .seance__res { width: 100%; }
}

/* =========================================================================
   Mes documents — pleine largeur, menu burger, sections titrées
   ========================================================================= */
.docs { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); padding: 0 24px 48px; }
.hm-canvas { margin: 0; }
.docs-section .hm-canvas { min-height: 42px; }

.docs__topbar { display: flex; align-items: center; gap: 14px; padding: 12px 0 8px; flex-wrap: wrap; }
.docs__burger { width: 40px; height: 38px; border: 1px solid var(--border); background: #fff; border-radius: 9px; font-size: 1.2rem; cursor: pointer; line-height: 1; }
.docs__burger:hover { background: var(--slate-100); }
.docs__travaux { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--slate-700);
    font-size: .86rem; font-weight: 600; }
.docs__travaux:hover { background: var(--slate-100); color: var(--primary); text-decoration: none; }
.docs__travaux svg { width: 16px; height: 16px; }
.docs__topbar .breadcrumb { flex: 1; }

.docs-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 90; }
.docs-backdrop[hidden] { display: none; }
.docs-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 304px; max-width: 86vw; background: #fff;
    border-right: 1px solid var(--border); box-shadow: 0 0 40px rgba(15,23,42,.22); z-index: 100;
    transform: translateX(-100%); transition: transform .22s ease; display: flex; flex-direction: column; }
.docs-drawer.is-open { transform: none; }
.docs-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.docs-drawer__body { padding: 14px 16px; overflow: auto; }
.docs-tree { margin-bottom: 18px; }
.tree-root { display: block; font-weight: 600; padding: 4px 0; }
.tree-root.is-on, .docs-tree a.is-on { color: var(--primary); font-weight: 700; }
.tree { list-style: none; margin: 2px 0 2px 4px; padding-left: 12px; border-left: 1px solid var(--slate-200); }
.tree li { padding: 2px 0; }
.tree a { color: var(--slate-700); }
.tree details > summary { cursor: pointer; }
.tree summary { display: list-item; }
/* Cible de dépôt : lien d'arborescence survolé pendant un glisser */
.docs-tree a[data-tree-folder].is-drop { background: rgba(79,70,229,.14); outline: 2px dashed var(--primary);
    outline-offset: 2px; border-radius: 6px; color: var(--primary); }
.docs-filters h4 { margin: 0 0 8px; font-size: .9rem; color: var(--slate-700); }
.docs-filters .field__input { width: 100%; margin-bottom: 8px; }
.docs-filters .btn { margin-bottom: 6px; }
.docs-filters__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.docs-section { margin-bottom: 8px; position: relative; }
.docs-section__head { display: flex; align-items: center; gap: 10px; padding: 9px 8px; margin-bottom: 6px;
    border-bottom: 1px solid var(--slate-200); }
.docs-section__head[data-section-head] { cursor: grab; user-select: none; border-radius: 9px; transition: background .12s ease; }
.docs-section__head[data-section-head]:hover { background: var(--slate-100); }
.docs-section__head.is-dragging-src { opacity: .35; }
.docs-section__grip { display: inline-flex; color: var(--slate-400); }
.docs-section__grip svg { width: 20px; height: 20px; }
.docs-section__title { margin: 0; font-size: 1.18rem; font-weight: 700; color: var(--slate-700); }
.docs-section__head[data-section-head] .docs-section__title { cursor: text; }
.docs-section__head--plain { justify-content: space-between; }
.docs-section__head--plain .docs-section__title { color: var(--slate-500); font-size: 1rem; font-weight: 600; }
.docs-section__edit { font: inherit; font-size: 1.18rem; font-weight: 700; color: var(--slate-700);
    border: 1px solid var(--primary); border-radius: 6px; padding: 1px 8px; outline: none; min-width: 160px; }
.docs-section.is-drop { background: rgba(79,70,229,.07); outline: 2px dashed var(--primary); outline-offset: 3px; border-radius: 10px; }
.docs-section.is-secdrag { opacity: .55; }
.docs-section__grip { cursor: grab; color: var(--slate-400); display: inline-flex; touch-action: none; }
.docs-section__grip svg { width: 18px; height: 18px; }
.docs-section__title[data-sec-id] { cursor: text; }
.docs-section__title[data-sec-id]:hover { text-decoration: underline dotted; }
.docs-section__head--plain .btn--xs { margin-left: auto; }

/* Poignées « + » : ajouter un hexagone dans une cellule voisine libre (chaînes) */
.hm-tile:hover { z-index: 20; }
.hm-tile__adds { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .14s ease; z-index: 21; }
.hm-tile:hover .hm-tile__adds { opacity: 1; }
.hm-add { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: var(--primary);
    color: #fff; font-size: 1.35rem; font-weight: 300; line-height: 1; cursor: pointer; pointer-events: auto;
    box-shadow: 0 2px 5px rgba(15,23,42,.3), 0 6px 16px rgba(79,70,229,.3); display: grid; place-items: center;
    transform: translate(-50%, -50%) scale(.86);
    transition: transform .16s cubic-bezier(.2,.8,.3,1), background .12s ease, box-shadow .14s ease; }
.hm-tile:hover .hm-add { transform: translate(-50%, -50%) scale(1); }
.hm-tile:hover .hm-add:hover { background: var(--primary-d); transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 3px 8px rgba(15,23,42,.34), 0 10px 22px rgba(79,70,229,.4); }
.hm-add.is-blocked { display: none; }
/* Poignées + collées aux 6 arêtes de l'hexagone (boîte 150×130, flat-top) */
.hm-add[data-add-dir="top"]    { left: 50%; top: -6%; }
.hm-add[data-add-dir="bottom"] { left: 50%; top: 106%; }
.hm-add[data-add-dir="tr"]     { left: 90%; top: 20%; }
.hm-add[data-add-dir="br"]     { left: 90%; top: 80%; }
.hm-add[data-add-dir="tl"]     { left: 10%; top: 20%; }
.hm-add[data-add-dir="bl"]     { left: 10%; top: 80%; }

/* Mini-menu d'ajout à côté du titre de section */
.docs-section__head .docs-section__title { margin-right: auto; }
.docs-section__menu { position: relative; }
.docs-section__addbtn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: #fff; color: var(--primary); font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: pointer; }
.docs-section__addbtn:hover { background: var(--slate-100); border-color: var(--slate-300); }
.docs-section__menu .menu__list button { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Glisser une section : fantôme suivant le curseur + repère d'insertion */
.section-ghost { position: fixed; z-index: 300; pointer-events: none; background: #fff; border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(15,23,42,.28); border-radius: 10px; padding: 8px 14px; font-weight: 700;
    color: var(--slate-700); display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.section-ghost svg { width: 18px; height: 18px; color: var(--slate-400); }
.docs-section.is-insert-before::before, .docs-section.is-insert-after::after {
    content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--primary); border-radius: 2px; }
.docs-section.is-insert-before::before { top: -3px; }
.docs-section.is-insert-after::after { bottom: -3px; }

/* Bouton « + » d'insertion contextuelle (au survol immobile entre deux hexagones) */
.hm-insert { position: absolute; z-index: 9; width: 42px; height: 42px; transform: translate(-50%, -50%);
    border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-size: 1.6rem; font-weight: 300;
    line-height: 1; cursor: pointer; display: grid; place-items: center;
    box-shadow: 0 4px 13px rgba(79,70,229,.45); animation: hm-insert-pop .14s ease; }
.hm-insert:hover { filter: brightness(1.08); }
@keyframes hm-insert-pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ====================================================================== */
/* Espace élève — coquille minimaliste, sobre et moderne (consultation).  */
/* ====================================================================== */
.eleve-body { background: var(--slate-50); color: var(--slate-800); }

/* Barre supérieure fine */
.eleve-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px;
    padding: 10px 22px; background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); }
.eleve-top__brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--slate-900); }
.eleve-top__brand svg { width: 26px; height: 26px; }
.eleve-top__name { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; }
.eleve-top__name strong { color: var(--primary); }
.eleve-nav { display: flex; gap: 4px; margin-left: 6px; }
.eleve-nav__link { padding: 7px 14px; border-radius: 999px; text-decoration: none; color: var(--slate-500);
    font-weight: 600; font-size: .9rem; transition: background .15s, color .15s; }
.eleve-nav__link:hover { background: var(--slate-100); color: var(--slate-800); }
.eleve-nav__link.is-on { background: var(--slate-900); color: #fff; }
.eleve-top__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.eleve-top__id { display: flex; flex-direction: column; line-height: 1.05; text-align: right; }
.eleve-top__id strong { font-size: .92rem; color: var(--slate-800); }
.eleve-top__classe { font-size: .74rem; color: var(--muted); }
.eleve-top__out { border: 1px solid var(--border); background: #fff; color: var(--slate-600);
    padding: 9px 15px; border-radius: 9px; font-weight: 600; font-size: .82rem; cursor: pointer; }
.eleve-top__out:hover { background: var(--slate-100); }

/* Cloche d'activation des notifications push (rappels de révision Mémo) */
.eleve-bell { position: relative; width: 40px; height: 40px; border: 1px solid var(--border);
    background: #fff; border-radius: 50%; cursor: pointer; font-size: 1.05rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    transition: background .15s, border-color .15s, transform .1s; }
.eleve-bell:hover { background: var(--slate-100); }
.eleve-bell:active { transform: scale(.92); }
.eleve-bell:disabled { opacity: .4; cursor: default; }
.eleve-bell .eleve-bell__on, .eleve-bell .eleve-bell__off { display: none; }
.eleve-bell.is-on { border-color: var(--primary); background: rgba(99,102,241,.08); }
.eleve-bell.is-on .eleve-bell__on { display: inline; }
.eleve-bell.is-off .eleve-bell__off,
.eleve-bell.is-denied .eleve-bell__off,
.eleve-bell.is-unsupported .eleve-bell__off { display: inline; opacity: .6; }

.eleve-main { max-width: 920px; margin: 0 auto; padding: 30px 22px 70px; }

/* Pages internes */
.eleve-page__head { margin-bottom: 26px; }
.eleve-page__head h1 { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.02em; margin: 0; }
.eleve-page__lead { color: var(--muted); margin: 6px 0 0; }
.eleve-page--reader { max-width: 760px; margin: 0 auto; }
/* Lecture d'une leçon : plus large que les autres pages « lecteur ». La colonne de lecture
   prend d'abord toute la largeur de .eleve-main (876 px utiles), puis DÉBORDE de son
   gabarit par marges négatives dès que la fenêtre offre la place — les marges restent
   inférieures à l'espace libre de part et d'autre, donc aucun débordement horizontal,
   et le calcul ne dépend pas de vw (donc pas de la largeur de l'ascenseur). */
.eleve-page--reader.eleve-page--lecon { max-width: none; }
@media (min-width: 1240px) {
    .eleve-page--reader.eleve-page--lecon { margin-inline: -140px; }   /* ≈ 1156 px de lecture */
}
.eleve-back { display: inline-block; margin-bottom: 18px; color: var(--primary); text-decoration: none; font-weight: 600; font-size: .9rem; }
.eleve-back:hover { text-decoration: underline; }
/* Barre haute de la leçon : retour au Cours + navigation discrète dans le chapitre. */
.eleve-lecon__topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eleve-lecon__topbar .eleve-back { margin-bottom: 18px; }
.eleve-lecon__quicknav { display: flex; gap: 6px; margin-bottom: 18px; }
.eleve-quicknav { color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600;
    padding: 4px 9px; border-radius: 8px; transition: background .14s, color .14s; }
.eleve-quicknav:hover { background: var(--slate-100); color: var(--slate-800); }
.eleve-empty { color: var(--muted); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; }

/* Accueil élève : menu hexagonal central (géométrie partagée avec .hexmenu) */
.eleve-home { max-width: 820px; margin: 0 auto; padding-top: 12px; }

/* Le Cours : sommaire */
.eleve-cours { display: flex; flex-direction: column; gap: 26px; }
.eleve-niv { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.eleve-niv__title { font-family: var(--font-display); font-size: 1.16rem; margin: 0 0 12px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border); }
/* Chapitres : chaque chapitre est un menu dépliant (replié par défaut). */
.eleve-seq { margin-bottom: 4px; border-radius: 10px; }
.eleve-seq:last-child { margin-bottom: 0; }
.eleve-seq__summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 10px; }
.eleve-seq__summary::-webkit-details-marker { display: none; }
.eleve-seq__summary::before { content: '▸'; color: var(--muted); font-size: .78rem; transition: transform .15s ease; }
.eleve-seq[open] > .eleve-seq__summary::before { transform: rotate(90deg); }
.eleve-seq__summary:hover { background: var(--slate-50); }
.eleve-seq__title { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0; }
.eleve-seq__title--plain { text-transform: none; letter-spacing: 0; }
.eleve-seq__count { margin-left: auto; font-size: .72rem; font-weight: 600; color: var(--muted); }
.eleve-lecons { list-style: none; margin: 0; padding: 4px 12px 8px 26px; display: flex; flex-direction: column; gap: 6px; }
.eleve-lecon { display: block; padding: 10px 14px; border-radius: 10px; background: var(--slate-50);
    border: 1px solid var(--border); text-decoration: none; color: var(--slate-800); font-weight: 500; transition: background .14s, transform .14s; }
.eleve-lecon:hover { background: var(--slate-100); transform: translateX(3px); }
/* Leçon affichée mais pas encore ouverte par l'enseignant (année en cours) : grisée + cadenas. */
.eleve-lecon--locked { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--slate-100); border-style: dashed; color: var(--muted); font-weight: 500; cursor: default; }
.eleve-lecon--locked:hover { background: var(--slate-100); transform: none; }
.eleve-lecon__lock { width: 16px; height: 16px; flex: none; opacity: .65; }

/* Années précédentes : chaque niveau dans un dépliant replié. */
.eleve-past-group__title { font-family: var(--font-display); font-size: .95rem; color: var(--muted);
    margin: 30px 0 12px; }
.eleve-past { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.eleve-past__summary { list-style: none; cursor: pointer; padding: 16px 22px; font-family: var(--font-display);
    font-size: 1.05rem; color: var(--slate-800); display: flex; align-items: center; gap: 10px; }
.eleve-past__summary::-webkit-details-marker { display: none; }
.eleve-past__summary::before { content: '▸'; color: var(--muted); transition: transform .15s ease; }
.eleve-past[open] .eleve-past__summary::before { transform: rotate(90deg); }
.eleve-past__summary:hover { background: var(--slate-50); }
.eleve-past__body { padding: 6px 22px 20px; }

/* Le Cours : lecture façon « cahier de cours » */
.eleve-cahier-cours { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 32px 34px; box-shadow: var(--shadow); }
.eleve-lecon__head { margin-bottom: 18px; }
.eleve-lecon__tags { display: flex; gap: 8px; margin-bottom: 8px; }
.eleve-tag { font-size: .72rem; font-weight: 700; color: var(--primary); background: #eef2ff; padding: 3px 9px; border-radius: 999px; }
.eleve-tag--soft { color: var(--slate-600); background: var(--slate-100); }
/* Auteur d'une ressource consultée sur le réseau : la provenance est une information, pas
   un niveau — d'où la teinte neutre, distincte de la pastille bleue du niveau. */
.eleve-tag--auteur { color: var(--slate-600); background: var(--slate-100); font-weight: 600; }
.eleve-lecon__title { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -.02em; margin: 0; }
.eleve-lecon__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.eleve-lecon__nav a { color: var(--primary); text-decoration: none; font-weight: 600; font-size: .9rem;
    max-width: 46%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.eleve-lecon__nav a:hover { background: var(--slate-50); }
.eleve-lecon__next { text-align: right; }

/* Mes documents : même pavage d'hexagones que l'espace prof, mais en lecture seule.
   Pleine largeur (breakout de .eleve-main) pour que les positions coïncident avec le prof. */
.eleve-docs { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); padding: 0 24px 48px; }
.eleve-docs .docs__topbar { padding: 4px 0 8px; }
.eleve-docs .hm-hex { cursor: pointer; }
/* Bascule entre la bibliothèque du professeur et « Mes documents » (views/eleve/_docs_onglets.php). */
.eleve-docs-onglets { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: fit-content;
    max-width: 100%; margin: 6px auto 16px; padding: 4px; background: var(--slate-200); border-radius: 22px; }
.eleve-docs-onglet { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 16px;
    border-radius: 999px; color: var(--slate-600); font-weight: 600; font-size: .92rem; text-decoration: none;
    transition: background .14s ease, color .14s ease; }
.eleve-docs-onglet:hover { color: var(--slate-900); text-decoration: none; }
.eleve-docs-onglet.is-on { background: var(--card); color: #b45309; box-shadow: 0 1px 3px rgba(15,23,42,.14); }
.eleve-docs-onglet svg { width: 17px; height: 17px; flex: none; }
.eleve-docs-onglet__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eleve-docs-onglet__nb { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #d97706;
    color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.eleve-docs--miens .eleve-empty { max-width: 620px; margin: 24px auto 0; line-height: 1.6; }

/* Hexagones non partagés : affichés grisés et anonymes pour combler le pavage,
   sans rien divulguer (ni titre ni aperçu) et sans interaction. */
.eleve-docs .hm-hex--locked {
    cursor: default; color: var(--slate-400);
    background: linear-gradient(150deg, var(--slate-200), var(--slate-300));
}
.eleve-docs .hm-tile:hover .hm-hex--locked { filter: none; }
.hm-hex__lock { position: absolute; inset: 0; display: grid; place-items: center; }
.hm-hex__lock svg { width: 34px; height: 34px; opacity: .55; }

/* Vue d'un document */
.eleve-docview { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); }
.eleve-docview__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.eleve-docview__head h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 0; }
.eleve-docview__img { max-width: 100%; border-radius: 10px; }
.eleve-docview__url { color: var(--muted); font-size: .82rem; word-break: break-all; }
.eleve-docview__file { color: var(--muted); font-size: .82rem; margin-left: 8px; }

/* Cahier de texte : semaine en lecture seule */
.eleve-week { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.eleve-week__nav { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border);
    border-radius: 9px; background: #fff; color: var(--slate-600); text-decoration: none; }
.eleve-week__nav:hover { background: var(--slate-100); }
.eleve-week__range { font-weight: 600; }
.eleve-week__today { margin-left: 4px; color: var(--primary); text-decoration: none; font-size: .85rem; font-weight: 600; }
.eleve-cahier { display: flex; flex-direction: column; gap: 12px; }
.eleve-jour { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.eleve-jour.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.eleve-jour__head { background: var(--slate-50); padding: 9px 16px; font-family: var(--font-display);
    font-weight: 600; border-bottom: 1px solid var(--border); }
.eleve-jour__head span { color: var(--muted); font-weight: 500; font-size: .85rem; }
.eleve-jour__body { display: grid; grid-template-columns: 1fr 280px; gap: 0; }
.eleve-jour__body--seul { grid-template-columns: 1fr; }
.eleve-jour__seances { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.eleve-seance { display: flex; gap: 12px; align-items: baseline; }
.eleve-seance__time { flex: 0 0 86px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.eleve-seance__main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eleve-seance__titre { font-weight: 600; color: var(--slate-800); }
/* Leçon du cours : une pastille cliquable qui mène au contenu du cours. Le cahier de texte
   est la porte d'entrée principale de l'élève vers Le Cours — la leçon doit donc se voir
   comme un bouton, pas comme un simple mot souligné. Sans lien (leçon masquée au classeur,
   séance encore à venir), la même pastille reste lisible mais sourde. */
.eleve-cahier__lecon { display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
    padding: 5px 11px 5px 8px; border: 1px solid var(--border); border-radius: 999px;
    background: #fff; color: var(--slate-800); font-weight: 600; line-height: 1.25;
    text-decoration: none; transition: border-color .12s ease, background .12s ease, color .12s ease; }
.eleve-cahier__lecon svg { flex: none; width: 17px; height: 17px; color: var(--acc-cours-2, var(--primary)); }
.eleve-cahier__lecon > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
a.eleve-cahier__lecon:hover { border-color: var(--primary); background: var(--slate-50); color: var(--primary); text-decoration: none; }
a.eleve-cahier__lecon:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.eleve-cahier__lecon--muet { color: var(--muted); background: var(--slate-50); font-weight: 500; }
.eleve-cahier__lecon--muet svg { color: var(--slate-400); }
.eleve-cahier__vide { color: var(--muted); background: #fff; border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 26px; text-align: center; margin: 0; }
.eleve-jour__body > .eleve-devoirs { border-left: 1px solid var(--border); background: var(--slate-50); }
.eleve-devoirs { list-style: none; margin: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.eleve-devoir { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.eleve-devoir.is-done { opacity: .6; }
.eleve-devoir__top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.eleve-devoir__date { font-size: .74rem; color: var(--muted); }
.eleve-devoir__desc { font-size: .88rem; line-height: 1.45; }
.eleve-reste { margin-top: 22px; }
.eleve-reste__title { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
.eleve-reste .eleve-devoirs { padding: 0; }

/* Barre d'onglets mobile : prend le relais du menu du haut (masqué < 680px). */
.eleve-tabbar { display: none; }

@media (max-width: 680px) {
    .eleve-nav { display: none; }
    .eleve-jour__body { grid-template-columns: 1fr; }
    .eleve-jour__body > .eleve-devoirs { border-left: 0; border-top: 1px solid var(--border); }

    .eleve-tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 30;
        background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .eleve-tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
        gap: 3px; padding: 6px 2px; min-height: 52px; border-radius: 10px;
        text-decoration: none; color: var(--slate-500); font-size: .68rem; font-weight: 600;
        transition: color .15s, background .15s; }
    .eleve-tab svg { width: 22px; height: 22px; }
    .eleve-tab.is-on { color: var(--primary); }
    .eleve-tab:active { background: var(--slate-100); }
    .eleve-main { padding-bottom: 84px; }   /* dégage la place sous le contenu */

    /* Cibles tactiles du bandeau portées à 44px nets sur petit écran. */
    .eleve-bell { width: 44px; height: 44px; }
    .eleve-top__out { padding: 11px 16px; }
}

/* =========================================================================
   Coach (chatbot Mizou) — modale de lancement
   ========================================================================= */
/* Onglet « Coach » du menu : c'est une action (ouvre une modale), légèrement distinguée. */
.eleve-nav__link--coach { color: #0e7490; }
.eleve-nav__link--coach:hover { background: rgba(6,182,212,.12); color: #0e7490; }

/* Modale Coach : compacte et centrée. */
.modal__box--coach { max-width: 420px; text-align: center; }
.coach-modal__body { padding: 4px 6px 2px; }
.coach-modal__avatar { width: 74px; height: 74px; margin: 2px auto 16px; display: grid; place-items: center;
    color: #fff; background: linear-gradient(155deg, #06b6d4, #0e7490);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.coach-modal__avatar svg { width: 34px; height: 34px; }
.coach-modal__lead { margin: 0 0 8px; color: var(--slate-700); line-height: 1.5; }
.coach-modal__note { margin: 0; color: var(--muted); font-size: .82rem; }
.coach-modal__foot { justify-content: center; margin-top: 20px; }
.coach-modal__go { padding: 12px 24px; font-size: 1rem; }

/* =========================================================================
   Espace élève — focus clavier, retour tactile, récompense à la réussite
   ========================================================================= */
/* Anneaux de focus visibles (navigation clavier / lecteur d'écran). */
.eleve-nav__link:focus-visible, .eleve-top__out:focus-visible, .eleve-bell:focus-visible,
.eleve-tab:focus-visible, .eleve-lecon:focus-visible, .eleve-back:focus-visible,
.eleve-week__nav:focus-visible, .coach-modal__go:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
/* Récompense de révision : pastille verte « ✓ » qui apparaît quand l'élève marque
   une carte comme sue (cf. memo-revision.js). Purement décorative, sans interaction. */
.memo-burst {
    position: fixed; left: 50%; top: 42%; z-index: 80; pointer-events: none;
    width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-size: 2.4rem; font-weight: 700;
    background: linear-gradient(155deg, #34d399, #059669);
    box-shadow: 0 12px 34px rgba(5,150,105,.4);
    opacity: 0; transform: translate(-50%, -50%) scale(.4);
    transition: transform .3s cubic-bezier(.2,.9,.3,1.4), opacity .3s ease;
}
.memo-burst.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* Respect de « réduire les animations » : on coupe les déplacements, on garde l'info. */
@media (prefers-reduced-motion: reduce) {
    .eleve-lecon, .eleve-tab, .eleve-bell, .hexmenu .wedge { transition: none; }
    .hexmenu .wedge:hover { transform: none; }
    .hexfly__item { transition: opacity .15s ease, visibility .15s; }
    .hexfly.is-open .hexfly__item { transition-delay: 0s; animation: none; }
    a.hexfly__btn:hover { transform: none; }
    .memo-burst { transition: opacity .2s ease; transform: translate(-50%, -50%) scale(1); }
    .topbar, .est-stage, .est-barbtn, .est-barbtn__chev { transition: none; }
}
/* Pastilles des parts dépliantes : le translate porte aussi le centrage vertical
   (translateY -50 %), on ne le neutralise donc que là où la liste est en absolu (au-delà
   de 900 px). */
@media (prefers-reduced-motion: reduce) and (min-width: 901px) {
    .hexfly__item, .hexfly.is-open .hexfly__item { transform: translate(0, -50%); }
}

/* =========================================================================
   Boutons complémentaires (réponses de révision)
   ========================================================================= */
.btn--danger  { background: #ef4444; color: #fff; }
.btn--danger:hover  { background: #dc2626; color: #fff; }
.btn--success { background: #10b981; color: #fff; }
.btn--success:hover { background: #059669; color: #fff; }

/* =========================================================================
   Accueil — barre de recherche centrée au-dessus de l'hexagone
   ========================================================================= */
/* z-index au-dessus de .hexmenu (les deux sont enfants de .home, mis à z-index:1 par « .home > * ») :
   sinon la liste de résultats, enfermée dans le contexte d'empilement de .home-search, passe SOUS l'hexagone. */
.home-search { position: relative; z-index: 10; max-width: 520px; margin: 4px auto 18px; }
.home-search__input { width: 100%; padding: 13px 18px; border: 1px solid var(--border); border-radius: 999px;
    background: #fff; font: inherit; font-size: 1rem; box-shadow: var(--shadow); outline: none; }
.home-search__input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.16); }
.home-search__results { list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0;
    z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 44px rgba(15,23,42,.22); max-height: 56vh; overflow: auto; }
.home-search__results[hidden] { display: none; }
.home-search__item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.home-search__item.is-sel { background: var(--slate-100); }
.home-search__ic { font-size: 1.1rem; width: 22px; text-align: center; }
.home-search__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-search__label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-search__sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* La pastille de type portait des mots connus d'avance (« Leçon », « Définition »…) ; elle
   porte désormais aussi le nom des catégories d'encadré que l'enseignant s'est créées
   (migration 074), long de 40 caractères s'il le veut. D'où la borne : le libellé du résultat
   garde la place, et c'est le type qui s'abrège. */
.home-search__type { font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px;
    padding: 1px 7px; white-space: nowrap; flex: 0 1 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.home-search__empty { padding: 14px; color: var(--muted); text-align: center; }

/* =========================================================================
   Module Mémo — enseignant (liste paquets + éditeur)
   ========================================================================= */
.memo { max-width: var(--maxw); margin: 0 auto; }
.memo__bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.memo__bar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.memo__title { margin: 0; font-size: 1.6rem; letter-spacing: -.02em; }
.memo__sub { margin: 4px 0 0; color: var(--muted); }
.memo-empty { color: var(--muted); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; }

.memo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.memo-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden; }
.memo-card__main { display: block; padding: 16px 18px; color: inherit; text-decoration: none; flex: 1; }
.memo-card__main:hover { background: var(--slate-50); text-decoration: none; }
.memo-card__title { margin: 0 0 6px; font-size: 1.1rem; }
.memo-card__desc { margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.memo-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.memo-tag { font-size: .72rem; font-weight: 700; color: var(--primary); background: #eef2ff; padding: 3px 9px; border-radius: 999px; }
.memo-card__stats { display: flex; gap: 14px; color: var(--muted); font-size: .82rem; }
.memo-card__tools { padding: 8px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

.memo-assign { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; box-shadow: var(--shadow); }
.memo-assign__title { margin: 0 0 12px; font-size: 1.02rem; }
.memo-assign__list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.memo-assign__chip { display: inline-flex; align-items: center; gap: 6px; background: var(--slate-100); border: 1px solid var(--border);
    border-radius: 999px; padding: 5px 6px 5px 12px; font-size: .88rem; font-weight: 600; }
.memo-assign__chip em { color: var(--muted); font-weight: 400; font-size: .8rem; }
.memo-assign__x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--slate-300); color: #fff; cursor: pointer; line-height: 1; font-size: 1rem; }
.memo-assign__x:hover { background: #ef4444; }
.memo-assign__empty { color: var(--muted); }
.memo-assign__add { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.memo-assign__add .field__input { width: auto; min-width: 150px; }
.memo-assign__all { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; color: var(--slate-600); cursor: pointer; }
.memo-assign__all input { cursor: pointer; margin: 0; }

.memo-cards { display: flex; flex-direction: column; gap: 14px; }
.memo-flash { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; align-items: stretch; }
.memo-flash__main { flex: 1; min-width: 0; }
/* Colonne de déblocage par classe (à droite de chaque flashcard) */
.memo-flash__classes { flex: 0 0 auto; width: 158px; border-left: 1px solid var(--border); background: var(--slate-50);
    padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.memo-flash__classes-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.memo-flash__classes-empty { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.memo-classe-btn { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 1px solid var(--border);
    border-radius: 8px; background: #fff; color: var(--slate-700); font-size: .82rem; font-weight: 600; cursor: pointer;
    transition: background .12s, border-color .12s, color .12s; }
.memo-classe-btn:hover { border-color: var(--primary); }
.memo-classe-btn.is-on { background: #16a34a; border-color: #15803d; color: #fff; }
.memo-classe-btn.is-on:hover { background: #15803d; }
.memo-classe-btn.is-forced { opacity: .92; }
.memo-classe-btn:disabled { cursor: not-allowed; }
.memo-flash__faces { display: grid; grid-template-columns: 1fr 1fr; }
.memo-flash__face { padding: 14px 18px; }
.memo-flash__face + .memo-flash__face { border-left: 1px solid var(--border); }
.memo-flash__tag { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.memo-flash__body { line-height: 1.5; word-break: break-word; }
.memo-flash__tools { padding: 8px 18px; border-top: 1px solid var(--border); display: flex; gap: 14px; justify-content: flex-end; }
.memo-flash__hint { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.memo-flash__hint code { background: var(--slate-100); padding: 1px 5px; border-radius: 5px; }
.memo-ta { font-family: var(--font-mono, ui-monospace, monospace); resize: vertical; }
.memo-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.memo-preview__col { background: var(--slate-50); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 56px; }

/* Image de flashcard (recto/verso) : posée au-dessus du texte. */
.memo-img { display: block; max-width: 100%; max-height: 240px; margin: 0 auto 10px; border-radius: 8px; object-fit: contain; }
.flashcard__text .memo-img { max-height: 200px; }
.memo-img-pick { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.memo-img-pick__preview { position: relative; display: inline-flex; }
.memo-img-pick__preview img { max-height: 64px; max-width: 120px; border: 1px solid var(--border); border-radius: 8px; object-fit: contain; }
.memo-img-pick__x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
    border: none; background: var(--slate-700, #334155); color: #fff; cursor: pointer; font-size: .9rem; line-height: 1; }

/* =========================================================================
   Module Mémo — élève (liste + révision flashcards)
   ========================================================================= */
.eleve-memo__head { margin-bottom: 18px; }
.eleve-memo__title { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.02em; margin: 0; }
.eleve-memo__sub { color: var(--muted); margin: 6px 0 0; }
.eleve-memo__all { margin-bottom: 22px; }
.eleve-memo__done { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; }
.eleve-memo__empty { color: var(--muted); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; }
.eleve-memo__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.eleve-memo__card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.eleve-memo__card-title { margin: 0; font-size: 1.1rem; }
.eleve-memo__card-stat { margin: 0; color: var(--muted); font-size: .9rem; }
.eleve-memo__card-stat strong { color: var(--primary); }
.eleve-memo__card .btn { margin-top: auto; }

/* ---- Redesign carte de paquet + rangée de boîtes de Leitner (Lot 1) ------ */
/* Décor de fond léger, non bloquant (fixé, sous le contenu). */
.eleve-memo { position: relative; }
.eleve-memo::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(1100px 560px at 100% -12%, rgba(79,70,229,.09), transparent 60%),
        radial-gradient(880px 520px at -12% 112%, rgba(16,185,129,.07), transparent 60%);
}
.eleve-memo__card { position: relative; overflow: hidden; padding-top: 20px; transition: transform .15s ease, box-shadow .15s ease; }
.eleve-memo__card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--card-accent, var(--primary)); }
.eleve-memo__card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(15,23,42,.12); }
.eleve-memo__card-top { display: flex; align-items: center; gap: 10px; }
.eleve-memo__card-ic {
    font-size: 1.45rem; width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px;
    background: #eef2ff; background: color-mix(in srgb, var(--card-accent, var(--primary)) 14%, #fff);
}
.eleve-memo__card-top .eleve-memo__card-title { margin: 0; font-size: 1.08rem; }

.eleve-memo__card-boxes { margin-top: 2px; }
.eleve-memo__boxes-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }

/* Rangée de boîtes : code couleur fragile→maîtrisé via --box-hue (0 rouge → 140 vert),
   jauge de remplissage via --box-fill (hauteur). Partagée index + révision. */
.memo-boxes { display: flex; gap: 6px; align-items: flex-end; }
.memo-box { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.memo-box__stack {
    position: relative; width: 100%; height: 44px; border-radius: 7px; overflow: hidden;
    display: flex; align-items: flex-end;
    background: hsl(var(--box-hue, 140) 60% 95%); border: 1px solid hsl(var(--box-hue, 140) 45% 82%);
}
.memo-box__fill {
    display: block; width: 100%; height: var(--box-fill, 0%);
    background: hsl(var(--box-hue, 140) 68% 52%);
    transition: height .4s cubic-bezier(.2, .9, .3, 1.2);
}
.memo-box.is-empty .memo-box__stack { opacity: .55; }
.memo-box.is-current .memo-box__stack { outline: 2px solid hsl(var(--box-hue, 140) 68% 45%); outline-offset: 1px; }
.memo-box__label { font-size: .64rem; font-weight: 700; color: hsl(var(--box-hue, 140) 45% 32%); }
.memo-box__count { font-size: .72rem; font-weight: 700; color: var(--slate-700); }

/* Bandeau joueur : niveau, barre d'XP, série 🔥, maîtrise ⭐. */
.memo-player { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding: 14px 18px;
    border-radius: var(--radius); color: #fff; background: linear-gradient(120deg, #4f46e5, #7c3aed); box-shadow: var(--shadow); }
.memo-player__level { flex: 0 0 auto; text-align: center; }
.memo-player__lvl-num { display: block; font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1; }
.memo-player__lvl-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.memo-player__mid { flex: 1; min-width: 0; }
.memo-player__rang { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .02em; opacity: .92; margin-bottom: 5px; }
.memo-player__xpbar { height: 10px; background: rgba(255, 255, 255, .28); border-radius: 999px; overflow: hidden; }
.memo-player__xpfill { height: 100%; background: #fde047; border-radius: 999px; transition: width .5s cubic-bezier(.2, .9, .3, 1.2); }
.memo-player__xptxt { display: block; font-size: .74rem; margin-top: 4px; opacity: .9; }
.memo-player__stats { display: flex; gap: 12px; flex: 0 0 auto; }
.memo-player__stat { background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 5px 11px; font-size: .9rem; font-weight: 700; white-space: nowrap; }
@media (max-width: 480px) { .memo-player { flex-wrap: wrap; } .memo-player__mid { order: 3; flex-basis: 100%; } }

@media (prefers-reduced-motion: reduce) {
    .eleve-memo__card { transition: none; }
    .eleve-memo__card:hover { transform: none; }
    .memo-box__fill { transition: none; }
    .memo-player__xpfill { transition: none; }
}

.revise { max-width: 560px; margin: 0 auto; }
.revise__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.revise__paquet { color: var(--muted); font-weight: 600; }
.revise__state { text-align: center; }
.revise__progress { height: 7px; background: var(--slate-200); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.revise__bar { height: 100%; width: 0; background: var(--primary); transition: width .25s ease; }
.revise__count { color: var(--muted); font-size: .85rem; margin: 0 0 18px; }

.flashcard { position: relative; width: 100%; min-height: 260px; perspective: 1200px; cursor: pointer; margin-bottom: 14px; }
.flashcard__face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 26px; background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
    backface-visibility: hidden; transition: transform .5s; }
.flashcard__front { transform: rotateY(0deg); }
.flashcard__back { transform: rotateY(180deg); }
.flashcard.is-flipped .flashcard__front { transform: rotateY(-180deg); }
.flashcard.is-flipped .flashcard__back { transform: rotateY(0deg); }
/* Passage à la carte suivante : repli sur le recto sans animation (sinon on voit la réponse suivante). */
.flashcard.no-anim .flashcard__face { transition: none; }
.flashcard__tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.flashcard__text { font-size: calc(1.3rem * var(--flash-scale, 1)); line-height: 1.4; text-align: center; word-break: break-word; }
.revise__hint { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.revise__answers { display: flex; gap: 12px; justify-content: center; }
/* L'attribut [hidden] (display:none via l'UA) est écrasé par le display:flex ci-dessus :
   sans cette règle, les boutons « Je savais / Je ne savais pas » restent visibles dès le recto. */
.revise__answers[hidden] { display: none; }
.revise__answers .btn { flex: 1; max-width: 200px; }
.revise__end-emoji { font-size: 2.4rem; margin: 0; }
.revise__end h2 { margin: 6px 0; }
.revise__end p { color: var(--muted); margin: 0 0 18px; }

/* ---- Révision : bouton son, bandeau de boîtes, récompenses (Lot 1) ------- */
.memo-sound-btn {
    margin-left: auto; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
    border: 1px solid var(--border); background: #fff; font-size: 1.05rem; line-height: 1;
    cursor: pointer; display: grid; place-items: center;
}
.memo-sound-btn.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }

.revise__boxes { margin: 0 auto 14px; max-width: 420px; }
/* Conteneur de la scène 3D (Three.js) — décoratif, canvas aria-hidden. */
.revise__boxes.is-3d { height: 160px; max-width: 520px; }
.memo-3d-canvas { display: block; width: 100%; height: 100%; }

/* Jeton qui « vole » de la carte vers la boîte cible (montée/descente de Leitner). */
.memo-fly {
    position: fixed; z-index: 90; width: 30px; height: 40px; border-radius: 5px; pointer-events: none;
    transform: translate(-50%, -50%);
    background: linear-gradient(155deg, #fff, #e2e8f0); border: 1px solid var(--slate-300);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .25);
}
.memo-fly--down { background: linear-gradient(155deg, #fee2e2, #fecaca); border-color: #fca5a5; }
.memo-confetti { position: fixed; inset: 0; z-index: 85; pointer-events: none; }
.memo-box.is-bump { animation: memoBump .4s ease; }
@keyframes memoBump { 0% { transform: translateY(0); } 30% { transform: translateY(-6px); } 100% { transform: translateY(0); } }

/* Séparation visuelle recto (neutre) / verso (accent) pour la lisibilité. */
.flashcard__back { background: #f5f3ff; border-color: #ddd6fe; }
.flashcard__back .flashcard__tag { color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
    .memo-box.is-bump { animation: none; }
}

/* =========================================================================
   Révision — « table de jeu » immersive (inspiration jeux de cartes type plateau)
   Feutre plein écran + carte physique en relief + boutons tactiles.
   ========================================================================= */
.revise--table { position: relative; color: #e8edf3; }
/* Feutre plein écran derrière tout le contenu. */
.revise--table::before {
    content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background: radial-gradient(150% 130% at 50% -15%, #3d4f63 0%, #27333f 46%, #161d26 100%);
}
/* Grain de feutre discret par-dessus. */
.revise--table::after {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, .015) 0 2px, transparent 2px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 5px);
}

.revise--table [data-state="loading"] { color: #cbd5e1; }
.revise--table .revise__head a.linklike { color: #d3dce6; }
.revise--table .revise__head a.linklike:hover { color: #fff; }
.revise--table .revise__paquet { color: #9fb0c3; }
.revise--table .memo-sound-btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.revise--table .memo-sound-btn.is-on { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(129, 140, 248, .28); }

/* HUD (boîtes + progression) */
.revise--table .revise__hud { max-width: 460px; margin: 0 auto 22px; }
.revise--table .revise__progress { height: 8px; background: rgba(255, 255, 255, .14); }
.revise--table .revise__bar { background: linear-gradient(90deg, #818cf8, #34d399); }
.revise--table .revise__count { color: #cbd5e1; }
.revise--table .revise__hint { color: #9fb0c3; }
/* Étiquettes des boîtes lisibles sur le feutre sombre (repli DOM). */
.revise--table .memo-box__label { color: #e2e8f0; }
.revise--table .memo-box__count { color: #cbd5e1; }

/* Profondeur 3D : la carte est légèrement inclinée sur la table. */
.revise--table [data-state="stage"] { perspective: 1500px; }
.revise--table .flashcard {
    min-height: 320px; max-width: 420px; margin: 0 auto 34px;
    transform: rotateX(7deg); transition: transform .25s ease;
}
.revise--table .flashcard:hover { transform: rotateX(3deg) translateY(-4px); }
/* Ombre portée « au sol » sous la carte. */
.revise--table .flashcard::after {
    content: ""; position: absolute; left: 8%; right: 8%; bottom: -28px; height: 34px; z-index: -1;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), transparent 72%); filter: blur(3px);
}

.revise--table .flashcard__face {
    padding: 0; overflow: hidden; border: none; border-radius: 22px;
    background: #fbfcfe; color: var(--text);
    align-items: stretch; justify-content: flex-start; gap: 0;
    box-shadow: 0 26px 50px -12px rgba(0, 0, 0, .6), 0 8px 0 -2px #cbd5e1, inset 0 0 0 1px rgba(255, 255, 255, .7);
}
/* Bandeau coloré en tête de carte (bleu = question, vert = réponse). */
.revise--table .flashcard__band {
    display: block; width: 100%; padding: 13px 18px; text-align: left;
    font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: #fff;
    background: linear-gradient(120deg, #6366f1, #4f46e5);
}
.revise--table .flashcard__band--answer { background: linear-gradient(120deg, #34d399, #059669); }
/* Corps + tache « aquarelle » derrière le texte. */
.revise--table .flashcard__body {
    position: relative; flex: 1; width: 100%; display: flex; align-items: center; justify-content: center;
    padding: 24px; overflow: hidden;
}
.revise--table .flashcard__blob {
    position: absolute; width: min(240px, 72%); height: min(240px, 72%);
    border-radius: 46% 54% 60% 40% / 50% 40% 60% 50%; filter: blur(2px);
    background: radial-gradient(circle at 40% 35%, rgba(99, 102, 241, .22), rgba(99, 102, 241, .04) 70%);
}
.revise--table .flashcard__blob--answer { background: radial-gradient(circle at 40% 35%, rgba(16, 185, 129, .22), rgba(16, 185, 129, .04) 70%); }
.revise--table .flashcard__text { position: relative; z-index: 1; }
/* Badge « boîte » (cadence) en coin, façon jeton. */
.revise--table .flashcard__badge {
    position: absolute; right: 12px; bottom: 12px; z-index: 2;
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
    background: #1e293b; color: #fff; font-size: .72rem; font-weight: 700; box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}
.revise--table .flashcard__badge:empty { display: none; }

/* Boutons de réponse « tactiles » à relief (s'enfoncent au clic). */
.revise--table .revise__answers { gap: 16px; max-width: 460px; margin: 0 auto; }
.revise--table .ans {
    flex: 1; max-width: 220px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: none; border-radius: 16px; padding: 15px 16px; font: inherit; font-weight: 800; font-size: 1rem; color: #fff;
    cursor: pointer; transition: transform .08s ease, box-shadow .08s ease;
}
.revise--table .ans__ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .25); font-size: .95rem; }
.revise--table .ans--ko { background: linear-gradient(180deg, #f87171, #ef4444); box-shadow: 0 6px 0 #b91c1c, 0 12px 18px rgba(0, 0, 0, .35); }
.revise--table .ans--ok { background: linear-gradient(180deg, #34d399, #10b981); box-shadow: 0 6px 0 #047857, 0 12px 18px rgba(0, 0, 0, .35); }
.revise--table .ans:hover { transform: translateY(-1px); }
.revise--table .ans:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3); }
.revise--table .ans:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Écran de fin : panneau posé sur la table. */
.revise--table .revise__end-card {
    max-width: 420px; margin: 26px auto 0; padding: 30px 26px; border-radius: 22px;
    background: #fbfcfe; color: var(--text); box-shadow: 0 26px 50px -12px rgba(0, 0, 0, .6);
}
.revise--table .revise__end-card h2 { margin: 6px 0; }
.revise--table .revise__end-card p { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .revise--table .flashcard, .revise--table .flashcard:hover { transition: none; }
    .revise--table .ans { transition: none; }
}

/* =========================================================================
   Questions flash (Mes documents) — éditeur, carrousel viewer, envoi Mémo
   ========================================================================= */

/* Éditeur multi-cartes */
.flash-edit__hint { color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }
.flash-edit__hint code { background: var(--slate-100); padding: 1px 5px; border-radius: 5px; }
.flash-edit { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.flash-card-edit { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--slate-50); }
.flash-card-edit__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.flash-card-edit__num { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--slate-600); }
.flash-card-edit__tools { display: flex; gap: 4px; }
.flash-card-edit__btn { border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 7px; width: 28px; height: 28px; line-height: 1; font-size: .85rem; }
.flash-card-edit__btn:hover:not(:disabled) { background: var(--slate-100); }
.flash-card-edit__btn:disabled { opacity: .4; cursor: default; }
.flash-card-edit__grid { gap: 14px; }
.flash-face { margin: 0; }
.flash-face__preview { margin-top: 8px; padding: 8px 10px; background: #fff; border: 1px dashed var(--border); border-radius: 8px; min-height: 36px; font-size: .95rem; }
.flash-face__preview:empty::before { content: "Aperçu…"; color: var(--muted); font-size: .82rem; }

/* Viewer agrandi, fond bleu pastel clair, titre centré et bien lisible */
.modal__box--flash-view { max-width: 1080px; background: #e9f2fd; }
.modal__box--flash-view .modal__head { position: relative; justify-content: center; }
.modal__box--flash-view .modal__title { text-align: center; font-size: 1.4rem; }
.modal__box--flash-view .modal__x { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

/* Carrousel (viewer prof + élève) */
.flash-carousel { max-width: 840px; margin: 0 auto; position: relative; }
.flash-carousel .flashcard { min-height: 440px; }

/* Jauge de minuterie (défilement auto) : fine, bleu foncé, en haut de la carte */
.flash-progress { position: absolute; top: 0; left: 0; right: 0; height: 5px; z-index: 5;
    background: rgba(30, 58, 138, .14); border-radius: 18px 18px 0 0; overflow: hidden;
    opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.flash-progress.is-on { opacity: 1; }
.flash-progress__fill { display: block; height: 100%; width: 0; background: #1e3a8a; }

/* Défilement automatique : colonne de boutons sur le côté gauche */
.flash-autoplay { position: absolute; left: -76px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.flash-autoplay__btn { width: 54px; height: 44px; border-radius: 10px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--slate-700);
    box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.flash-autoplay__btn:hover { background: var(--slate-100); }
.flash-autoplay__btn.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 980px) {
    .flash-autoplay { position: static; transform: none; flex-direction: row; justify-content: center; margin-bottom: 12px; }
}
.flash-carousel .flashcard__text { font-size: calc(1.4rem * var(--flash-scale, 1)); }
.flash-carousel .memo-img { max-height: calc(230px * var(--flash-scale, 1)); }
.flash-zoom { margin-bottom: 14px; }
.flash-carousel__hint { text-align: center; color: var(--muted); font-size: .85rem; margin: 0 0 10px; }
.flash-carousel__nav { display: flex; align-items: center; justify-content: center; gap: 18px; }
.flash-carousel__count { font-weight: 700; color: var(--slate-700); min-width: 64px; text-align: center; }
.flash-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: #fff; cursor: pointer;
    font-size: 1.5rem; line-height: 1; color: var(--slate-700); box-shadow: var(--shadow); }
.flash-nav:hover:not(:disabled) { background: var(--slate-100); }
.flash-nav:disabled { opacity: .35; cursor: default; box-shadow: none; }
.flash-carousel__actions { text-align: center; margin-top: 16px; }
.flash-empty { text-align: center; color: var(--muted); padding: 30px 0; }
/* Glissement à la navigation */
.flash-carousel .flashcard.is-slide-l { animation: flashSlideL .26s ease; }
.flash-carousel .flashcard.is-slide-r { animation: flashSlideR .26s ease; }
@keyframes flashSlideL { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes flashSlideR { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: translateX(0); } }

/* Modale d'envoi vers Mémo */
.flash-memo__scope { display: flex; gap: 18px; margin-bottom: 14px; font-size: .95rem; }
.flash-memo__scope label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* Toast de confirmation */
.flash-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 200;
    background: var(--slate-800); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; font-weight: 600;
    box-shadow: 0 12px 30px rgba(15,23,42,.4); opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
.flash-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 620px) {
    .memo-flash__faces, .memo-preview { grid-template-columns: 1fr; }
    .memo-flash__face + .memo-flash__face { border-left: 0; border-top: 1px solid var(--border); }
    .flash-card-edit__grid { grid-template-columns: 1fr; }
    /* La colonne de déblocage passe sous la carte et ses boutons s'alignent en ligne. */
    .memo-flash { flex-direction: column; }
    .memo-flash__classes { width: auto; border-left: 0; border-top: 1px solid var(--border);
        flex-direction: row; flex-wrap: wrap; align-items: center; }
    .memo-classe-btn { width: auto; }
}

/* =========================================================================
   Mémo Lot B — questions de quiz (éditeur prof), modale, quiz élève, suivi
   ========================================================================= */
/* Questions sous chaque flashcard (éditeur) */
.memo-qs { border-top: 1px dashed var(--border); padding: 10px 18px 14px; background: var(--slate-50); }
.memo-qs__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.memo-qs__title { font-size: .82rem; font-weight: 700; color: var(--slate-600); text-transform: uppercase; letter-spacing: .03em; }
.memo-qs__count { color: var(--muted); font-weight: 600; }
.memo-qs__head .btn--xs { background: #fff; border-color: var(--border); color: var(--primary); }
.memo-qs__head .btn--xs:hover { background: var(--slate-100); }
.memo-qs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.memo-q { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.memo-q__badge { font-size: .66rem; font-weight: 800; color: #fff; background: var(--primary); border-radius: 5px; padding: 2px 6px; }
.memo-q__enonce { flex: 1; min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-q__thumb { height: 28px; width: auto; max-width: 56px; border-radius: 4px; border: 1px solid var(--border); object-fit: cover; flex: none; }
.memo-q__tools { display: flex; gap: 10px; }

/* Modale de question : type + choix */
.qm-type { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.qm-type label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.qm-type__hint { color: var(--muted); font-weight: 400; font-size: .82rem; }
.qm-choices { list-style: none; margin: 8px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qm-choice { display: flex; align-items: center; gap: 10px; }
.qm-choice__ok { width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; }
.qm-choice__txt { flex: 1; }
.qm-choice__del { width: 26px; height: 26px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--slate-200); color: var(--slate-600); cursor: pointer; line-height: 1; font-size: 1.05rem; }
.qm-choice__del:hover { background: #ef4444; color: #fff; }
#qm-add-choice { background: #fff; border-color: var(--border); color: var(--primary); }

/* Bannière de quiz dû (élève) */
.eleve-memo__quiz { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 22px;
    border-radius: var(--radius); text-decoration: none; color: #fff;
    background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: var(--shadow); transition: transform .15s ease; }
.eleve-memo__quiz:hover { transform: translateY(-2px); text-decoration: none; color: #fff; }
.eleve-memo__quiz-ic { font-size: 1.8rem; }
.eleve-memo__quiz strong { display: block; font-size: 1.05rem; }
.eleve-memo__quiz-sub { display: block; font-size: .85rem; opacity: .9; }

/* Quiz élève */
.quiz { max-width: 600px; margin: 0 auto; }
.quiz-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
.quiz-card__type { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.quiz-card__enonce { font-size: 1.2rem; line-height: 1.4; margin-bottom: 16px; }
/* Réponses sur deux colonnes (haut→bas, gauche→droite), mélangées côté serveur. */
.quiz-choices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; align-items: stretch; }
.quiz-choice { display: flex; }
.quiz-choice label { flex: 1; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 12px; cursor: pointer; transition: background .12s, border-color .12s; }
.quiz-choice label:hover { background: var(--slate-50); border-color: var(--slate-300); }
/* État sélectionné net (cohérence visuelle avec la révision). */
.quiz-choice label:has(input:checked) { background: #eef2ff; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, .16); }
.quiz-choice input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }
.quiz-choice__txt { flex: 1; }
@media (max-width: 480px) { .quiz-choices { grid-template-columns: 1fr; } }
.quiz-hint { color: var(--muted); font-size: .85rem; text-align: center; margin: 14px 0 0; }
.quiz-nav { display: flex; justify-content: flex-end; }
.quiz-nav .btn { min-width: 140px; }
.quiz-score { font-size: 1.05rem; color: var(--muted); margin: 4px 0 0; }
/* Note /20 mise en avant sur l'écran de fin. */
.quiz-note { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.quiz-xp { font-weight: 700; color: #059669; margin: 6px 0 14px; }
.quiz-xp.is-neg { color: #dc2626; }

/* Suivi enseignant */
.memo-suivi .suivi-classe { margin-bottom: 28px; }
.suivi-classe__title { font-size: 1.1rem; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.suivi-classe__title span { color: var(--muted); font-weight: 400; font-size: .9rem; margin-left: 6px; }
.suivi-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.suivi-table th, .suivi-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--slate-100); font-size: .92rem; }
.suivi-table th { background: var(--slate-50); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.suivi-table tr:last-child td { border-bottom: 0; }
.suivi-date { color: var(--muted); font-size: .8rem; margin-left: 6px; }
.suivi-none { color: var(--muted); }
.suivi-encours { color: #b45309; font-weight: 700; } /* quiz commencé non terminé */
.suivi-failed { margin-top: 24px; }
.suivi-failed__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.suivi-failed__list li { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.suivi-failed__rate { flex-shrink: 0; font-weight: 700; color: #b91c1c; font-size: .85rem; }
.suivi-failed__q { color: var(--slate-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 620px) {
    .suivi-table { display: block; overflow-x: auto; }
}

/* ---- GeoGebra (figures manipulables) ---- */
/* 100 % de la modale et non 96vw : « vw » compte la barre de défilement verticale, si bien qu'une
   figure plus haute que l'écran (figure à construire, sa consigne et ses boutons) faisait
   apparaître en plus un défilement horizontal de quelques pixels. */
.modal__box--ggb { max-width: 1100px; width: 100%; }
.ggb-editor, .ggb-viewer-applet { width: 100%; min-height: 440px; border-radius: 10px; overflow: hidden;
    background: #f8fafc; border: 1px solid var(--slate-100); }
.ggb-edit__hint { color: var(--muted); font-size: .82rem; margin: 6px 0 8px; }
/* Option « Afficher les outils de construction aux élèves » de la modale de figure. */
.ggb-outils-opt { margin: 6px 0 4px; padding: 10px 14px; border: 1px solid var(--slate-200); border-radius: 10px;
    background: var(--slate-50); }
.ggb-outils-opt .switch { margin: 0; font-weight: 600; }
.ggb-outils-opt .ggb-edit__hint { margin: 4px 0 0; }

/* Figure « à construire » (élève) : consigne, état + deux gestes, puis l'applet avec ses outils
   (views/eleve/_ggb_travail.php, js/ggb-travail.js). */
.ggb-travail__consigne { margin: 0 0 12px; }
.ggb-travail { display: flex; flex-direction: column; gap: 10px; }
.ggb-travail__barre { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.ggb-travail__etat { flex: 1 1 260px; margin: 0; font-size: .9rem; color: var(--muted); }
.ggb-travail__etat.is-modifie { color: #b45309; font-weight: 600; }
.ggb-travail__etat.is-ok { color: #047857; font-weight: 600; }
.ggb-travail__etat.is-erreur { color: #b91c1c; font-weight: 600; }
.ggb-travail__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ggb-travail__actions .btn svg { width: 16px; height: 16px; flex: none; }
.ggb-travail__actions .btn[disabled] { opacity: .5; cursor: not-allowed; }
.ggb-travail.is-occupe { cursor: progress; }
.ggb-view--travail { border: 1px solid var(--slate-200); }
/* Page pleine d'une figure à construire : on trace plus à l'aise que dans la colonne de lecture. */
.eleve-page--reader.eleve-page--travail { max-width: none; }

/* ---- Plein écran (js/plein-ecran.js, views/partials/plein_ecran_btn.php) ----
   La cible (la boîte de la modale, ou l'article d'une page pleine) couvre la fenêtre ; les
   applets GeoGebra qu'elle contient sont redimensionnés en JavaScript à la place libre. */
.modal__box.is-plein-ecran,
.is-plein-ecran[data-plein-ecran-cible] {
    position: fixed; inset: 0; z-index: 120; width: auto; max-width: none; height: auto; margin: 0;
    border: 0; border-radius: 0; box-shadow: none; overflow: auto; padding: 10px 18px 12px; background: #fff;
}
html.has-plein-ecran body { overflow: hidden; }
.modal__plein { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-left: auto; margin-right: 4px;
    border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.modal__plein:hover { background: var(--slate-100); color: var(--slate-800); }
.modal__plein:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.modal__plein svg { width: 18px; height: 18px; }
[data-plein-ecran] svg { flex: none; }
[data-plein-ecran] .plein-ecran__sortir,
[data-plein-ecran][aria-pressed="true"] .plein-ecran__entrer { display: none; }
[data-plein-ecran][aria-pressed="true"] .plein-ecran__sortir { display: inline; }
.ggb-travail__actions [data-plein-ecran] svg { width: 16px; height: 16px; }

/* ---- « Travaux des élèves » (/documents/travaux) ---- */
.trv { padding-bottom: 40px; }
.trv__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.trv__head h1 { margin: 0; font: 700 1.5rem var(--font-display); color: var(--slate-900); }
.trv__sous { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.trv__rien { color: var(--muted); font-size: .88rem; }
.trv-vide { max-width: 680px; padding: 18px 22px; border: 1px dashed var(--border); border-radius: var(--radius);
    background: var(--card); color: var(--slate-700); line-height: 1.55; }
.trv-vide p { margin: 0 0 6px; }
.trv-filtres { display: flex; align-items: flex-end; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 14px; }
.trv-filtres .field { margin: 0; min-width: 220px; }
.trv-maj { margin: 0 0 8px auto; font-size: .8rem; color: var(--muted); }
.trv-consigne { max-width: 860px; margin: 0 0 18px; padding: 8px 14px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--card); }
.trv-consigne summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--slate-700); }
.trv-consigne .prose { margin-top: 8px; }
.trv-classe { margin-bottom: 26px; }
.trv-classe__titre { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px;
    font: 700 1.1rem var(--font-display); color: var(--slate-900); }
.trv-classe__compte { font: 600 .82rem var(--font-body, inherit); color: var(--muted); }
.trv-grille { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.trv-carte__btn { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left;
    border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; cursor: pointer;
    font: inherit; color: inherit; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.trv-carte__btn:hover:not([disabled]) { border-color: var(--primary); box-shadow: 0 6px 18px rgba(15,23,42,.1); transform: translateY(-1px); }
.trv-carte__btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.trv-carte__btn[disabled] { cursor: default; }
.trv-carte__apercu { display: grid; place-items: center; aspect-ratio: 16 / 10; max-width: 100%;
    background: #f8fafc center / contain no-repeat; border-bottom: 1px solid var(--slate-100); color: var(--slate-300); }
.trv-carte__apercu svg { width: 34px; height: 34px; }
.trv-carte__nom { padding: 8px 10px 0; font-weight: 700; color: var(--slate-900); }
.trv-carte__quand { padding: 2px 10px 9px; font-size: .78rem; color: #047857; }
.trv-carte:not(.is-fait) .trv-carte__btn { background: var(--slate-50); border-style: dashed; }
.trv-carte:not(.is-fait) .trv-carte__nom { color: var(--slate-500); }
.trv-carte:not(.is-fait) .trv-carte__quand { color: var(--muted); }
.trv-carte.is-depart .trv-carte__quand { color: #b45309; }
/* Carte qui vient de changer (mise à jour automatique) : un halo bref, pour que l'œil la trouve. */
.trv-carte.is-neuf .trv-carte__btn { animation: trv-neuf 2.4s ease; }
@keyframes trv-neuf { 0%, 40% { box-shadow: 0 0 0 3px rgba(16,185,129,.55); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }
.trv-modal .modal__head { gap: 8px; }
.trv-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.trv-modal .modal__plein { margin-left: 4px; }
.trv-nav__pos { min-width: 52px; text-align: center; font-size: .82rem; color: var(--muted); }
.trv-modal__meta { margin: 8px 0 10px; font-size: .88rem; color: var(--slate-600); }
@media (max-width: 640px) {
    .trv-grille { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .trv-nav .btn { padding: 4px 8px; }
}
.lc-ggb-imgpick { margin-top: 6px; }

/* ---- Mathaléa (exercices interactifs coopmaths.fr) ---- */
.alea-edit__hint { color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }
.alea-edit__empty { color: var(--muted); font-size: .85rem; margin: 2px 0; }
.alea-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.alea-edit__row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
    border-radius: 10px; padding: 7px 10px; background: var(--slate-50); }
.alea-edit__t { flex: 1; font-size: .88rem; }
.alea-edit__del { border: 0; background: none; cursor: pointer; color: var(--slate-600);
    font-size: .85rem; padding: 2px 6px; border-radius: 6px; }
.alea-edit__del:hover { background: var(--slate-100); color: #dc2626; }
.modal__box--alea { max-width: 1100px; width: 96vw; }
.alea-view { width: 100%; border-radius: 10px; overflow: hidden;
    background: #f8fafc; border: 1px solid var(--slate-100); }
.alea-view iframe { display: block; width: 100%; height: min(72vh, 760px); border: 0; }
.alea-view__msg { color: var(--muted); padding: 24px; text-align: center; }
/* Dans une page de cours : cadre un peu plus bas pour rester dans le fil de lecture. */
.alea-view--cours iframe { height: min(64vh, 620px); }

/* ---- Maths mentales (diaporamas mathsmentales.net) ---- */

.mm-edit__hint { color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }
/* L'adresse d'un diaporama est longue et illisible : police à chasse fixe et coupure
   partout, pour qu'elle tienne dans trois lignes sans déborder de la modale. */
.mm-edit__url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .78rem; line-height: 1.4; word-break: break-all; }
.mm-edit { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.mm-edit__empty { color: var(--muted); font-size: .85rem; margin: 2px 0; }
.mm-edit__ko { color: #b91c1c; font-size: .85rem; margin: 2px 0; }
.mm-edit__ok { color: #15803d; font-size: .85rem; font-weight: 600; margin: 2px 0 4px; }
.mm-edit__row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 10px; background: var(--slate-50); }
.mm-edit__n { display: grid; place-items: center; width: 20px; height: 20px; flex: none;
    border-radius: 50%; background: #1e40af; color: #fff; font-size: .72rem; font-weight: 700; }
.mm-edit__t { flex: 1; font-size: .88rem; }

/* Visionneuse : un diaporama d'automatismes se VIDÉOPROJETTE — la fenêtre prend donc
   presque tout l'écran, et le bouton ⛶ pousse le cadre jusqu'au bord (plein écran demandé
   sur le cadre lui-même, d'où les règles :fullscreen ci-dessous). */
.modal__box--mm { max-width: 1600px; width: 97vw; }
.mm-view { width: 100%; border-radius: 10px; overflow: hidden;
    background: #f8fafc; border: 1px solid var(--slate-100); }
.mm-view iframe { display: block; width: 100%; height: min(80vh, 940px); border: 0; }
.mm-view:fullscreen { border: 0; border-radius: 0; background: #fff; }
.mm-view:fullscreen iframe { height: 100vh; }
.mm-view__msg { color: var(--muted); padding: 24px; text-align: center; }
/* Plein cadre : la fenêtre occupe l'écran entier, sans marge ni coin arrondi. C'est le
   repli quand le plein écran natif est refusé (page embarquée, iPad…), et l'étage
   intermédiaire quand il est accordé : dans les deux cas l'entête reste à portée de clic
   pour revenir en arrière ou fermer. */
.modal--plein { padding: 0; }
.modal--plein .modal__box--mm { max-width: none; width: 100vw; min-height: 100vh;
    border-radius: 0; padding: 10px 14px; }
.modal--plein .mm-view iframe { height: calc(100vh - 62px); }

/* Dans une page de cours : cadre plus bas pour rester dans le fil de lecture. */
.mm-view--cours iframe { height: min(66vh, 640px); }

/* ---- Scratch (éditeur TurboWarp auto-hébergé + lecteur élève) ---- */

/* Barre de l'éditeur plein écran (page /documents/scratch/edit). */
.scratch-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: #0f172a; color: #e2e8f0; border-bottom: 1px solid #1e293b; flex-wrap: wrap; }
.scratch-bar .btn--ghost-dark { color: #e2e8f0; border-color: #334155; }
.scratch-bar .btn--ghost-dark:hover { background: #1e293b; }
.scratch-bar__titre { flex: 1 1 220px; min-width: 150px; max-width: 440px;
    background: #1e293b; color: #f8fafc; border: 1px solid #334155; border-radius: 8px;
    padding: 7px 11px; font: inherit; }
.scratch-bar__titre::placeholder { color: #94a3b8; }
.scratch-bar__sel { flex: 0 0 auto; max-width: 200px; background: #1e293b; color: #f8fafc;
    border: 1px solid #334155; border-radius: 8px; padding: 7px 10px; font: inherit; }
.scratch-bar__spacer { flex: 1 1 auto; }
/* Variante « essai libre » élève : titre en clair + badge ambre « rien n'est enregistré ». */
.scratch-bar__name { font-weight: 700; color: #f8fafc; max-width: 34vw; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.scratch-bar__essai { font-size: .78rem; font-weight: 600; color: #fbbf24;
    background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .45);
    border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.scratch-bar__status { font-size: .85rem; color: #94a3b8; min-width: 40px; text-align: right; }
.scratch-bar__status--ok { color: #4ade80; }
.scratch-bar__status--warn { color: #fbbf24; }
.scratch-bar__status--error { color: #f87171; }

/* Lecteur Scratch en lecture seule (consultation élève / aperçu direct). */
.scratch-player { width: 100%; border-radius: 10px; overflow: hidden;
    background: #f8fafc; border: 1px solid var(--slate-100); }
.scratch-player__frame { display: block; width: 100%; height: min(72vh, 720px); border: 0; }
.scratch-player__msg { color: var(--muted); padding: 24px; text-align: center; }
/* Entrée vers l'essai libre (consultation élève, sous le lecteur). */
.scratch-try { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 4px; }
.scratch-try__hint { color: var(--muted); font-size: .85rem; }

/* ---- Page HTML (contenu HTML+JS rendu en iframe sandbox) ---- */
.modal__box--html { max-width: 1280px; width: 96vw; }
.html-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 4px; }
.html-edit__pane { display: flex; flex-direction: column; min-height: 0; }
.html-edit__bar { display: flex; align-items: baseline; gap: 8px; font-size: .78rem; font-weight: 600;
    color: var(--slate-700); margin-bottom: 5px; }
.html-edit__hint { color: var(--muted); font-weight: 400; }
.html-edit__import { margin-left: auto; font-size: .78rem; }
.html-edit__export { font-size: .78rem; }
/* « Télécharger » de la visionneuse : collé à la croix, à droite. .btn pose un display
   explicite, d'où le [hidden] à redire (page vide ou erreur de chargement). */
.html-view__dl { margin-left: auto; margin-right: 10px; gap: 6px; }
.html-view__dl[hidden] { display: none; }
.html-edit__code { flex: 1 1 auto; min-height: 46vh; resize: vertical; white-space: pre; overflow: auto;
    tab-size: 2; -moz-tab-size: 2; font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    font-size: .82rem; line-height: 1.55; color: #e2e8f0; background: #0f172a; border: 1px solid #334155;
    border-radius: 10px; padding: 10px 12px; }
.html-edit__code:focus { outline: none; border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, .25); }
.html-edit__preview { flex: 1 1 auto; min-height: 46vh; border: 1px solid var(--slate-100); border-radius: 10px;
    overflow: hidden; background: #fff; }
.html-view { width: 100%; height: min(76vh, 850px); border-radius: 10px; overflow: hidden;
    background: #fff; border: 1px solid var(--slate-100); }
.html-edit__preview iframe, .html-view iframe, .html-embed__frame { display: block; width: 100%; height: 100%; border: 0; }
.html-view__msg { color: var(--muted); padding: 24px; text-align: center; }
/* Bouton « plein écran » posé par html-embed.js sur chaque rendu (visionneuse, aperçu, élève).
   C'est le CONTENEUR qui passe en plein écran : la page sandboxée n'a aucun droit propre. */
.html-embed { position: relative; }
.html-embed__fs { position: absolute; top: 8px; right: 8px; z-index: 1; display: grid; place-items: center;
    width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 9px;
    background: rgba(255, 255, 255, .92); color: var(--slate-700); cursor: pointer;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .12); transition: background .15s ease, transform .15s ease; }
.html-embed__fs:hover { background: #fff; transform: scale(1.06); }
.html-embed__fs svg { width: 17px; height: 17px; }
.html-embed__fs .html-embed__fs-close { display: none; }
.html-embed.is-fullscreen .html-embed__fs-open { display: none; }
.html-embed.is-fullscreen .html-embed__fs-close { display: block; }
.html-embed:fullscreen { border: 0; border-radius: 0; background: #fff; }
@media (max-width: 760px) {
    .html-edit { grid-template-columns: 1fr; }
    .html-edit__code, .html-edit__preview { min-height: 34vh; }
}

/* ---- Schéma en barres (méthode de Singapour) — éditeur (barres-core.js, préfixe brc-)
   et visionneuse. L'éditeur est schématique : largeurs libres, magnétisme aux frontières
   des étages voisins, palette contextuelle flottante près de la sélection. -------------- */
.modal__box--barres { max-width: 1080px; width: 94vw; }
.barres-view { padding: 10px 4px; overflow-x: auto; }
.barres-view svg { display: block; margin: 0 auto; }
.barres-view__msg { color: var(--muted); padding: 24px; text-align: center; }

.brc-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 4px; }
.brc-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brc-sep { width: 1px; height: 20px; background: var(--slate-100); }
.brc-chip { border: 1px solid var(--border); background: #fff; color: var(--slate-700); font: inherit;
    font-size: .78rem; padding: 4px 10px; border-radius: 99px; cursor: pointer; transition: .15s; }
.brc-chip:hover { border-color: #6366f1; color: #4338ca; background: #eef2ff; }
.brc-chip--action { border-color: #c7d2fe; background: #eef2ff; color: #4338ca; }
.brc-hint { color: var(--muted); font-size: .74rem; margin: 0 2px 8px; line-height: 1.45; }
.brc-stage { position: relative; background: #fff; border: 1px solid var(--slate-100); border-radius: 12px;
    padding: 30px 100px 20px 20px; min-height: 220px; max-height: 56vh; overflow: auto; }

.brc-rowline { position: relative; display: flex; align-items: center; gap: 12px; }
.brc-rowline.has-bt { margin-top: 30px; }
.brc-rowline.has-bb { margin-bottom: 30px; }
.brc-rowlabel { width: 92px; min-height: 22px; flex: none; text-align: right; color: var(--slate-700);
    font-size: .8rem; outline: none; border-radius: 6px; padding: 2px 6px; }
.brc-rowlabel:focus { background: var(--slate-50, #f1f5f9); }
.brc-rowlabel:empty::before { content: 'étiquette'; color: #cbd5e1; }
.brc-cells { position: relative; display: flex; flex: none; height: 48px; align-items: stretch; }

/* flex: none est vital — sans lui un étage plus large que la scène serait COMPRIMÉ par le
   flex, et les largeurs affichées ne seraient plus celles enregistrées (le schéma changerait
   d'aspect entre l'éditeur et l'affichage, et le redimensionnement à la souris déraperait).
   La scène défile (overflow) plutôt que d'écraser le schéma.
   Les cases voisines superposent leur contour (margin-left négatif) : c'est barres-core.js qui
   compense, en donnant à la boîte 2 px de plus que la largeur logique de la case. */
.brc-cell { position: relative; flex: none; height: 48px; border: 2px solid; border-radius: 5px;
    box-sizing: border-box; display: flex; align-items: center; justify-content: center; cursor: grab;
    user-select: none; -webkit-user-select: none; touch-action: none; transition: box-shadow .12s; }
.brc-cell + .brc-cell { margin-left: -2px; }
.brc-cell.is-selected { z-index: 5; box-shadow: 0 0 0 3px rgba(99, 102, 241, .45); }
.brc-cell.is-dragging { opacity: .45; cursor: grabbing; z-index: 6; }
.brc-val { font-weight: 600; font-size: .92rem; pointer-events: none; white-space: nowrap;
    overflow: hidden; max-width: calc(100% - 8px); }
.brc-cell.is-unknown .brc-val { color: #dc2626; font-size: 1.1rem; font-weight: 700; }
.brc-cell.is-hatch::after { content: ''; position: absolute; inset: 0; border-radius: 3px; pointer-events: none;
    background: repeating-linear-gradient(45deg, rgba(15, 23, 42, .16) 0 3px, transparent 3px 9px); }
.brc-cell.is-dashed { border-style: dashed; background: transparent !important; }
.brc-input { width: calc(100% - 10px); border: none; outline: none; background: rgba(255, 255, 255, .85);
    border-radius: 4px; text-align: center; font: inherit; font-weight: 600; font-size: .92rem; }
.brc-c-blue { background: #bfdbfe; border-color: #3b82f6; }
.brc-c-amber { background: #fde68a; border-color: #d97706; }
.brc-c-green { background: #bbf7d0; border-color: #059669; }
.brc-c-rose { background: #fecdd3; border-color: #e11d48; }
.brc-c-violet { background: #ddd6fe; border-color: #7c3aed; }
.brc-c-slate { background: #e2e8f0; border-color: #64748b; }
.brc-kind-brace { border-color: transparent !important; background: transparent !important; }
/* Retrait de 2 px dans la case, comme le SVG statique — décalé d'un demi-contour, la boîte
   étant 2 px plus large que la case (cf. .brc-cell). */
.brc-kind-brace svg { position: absolute; top: 7px; left: 3px; right: 3px; width: calc(100% - 6px); }
.brc-kind-brace .brc-val { position: absolute; top: 22px; font-size: .82rem; color: var(--slate-700); }
.brc-kind-brace.is-unknown .brc-val { color: #dc2626; font-size: .95rem; }

.brc-celldel { position: absolute; top: -8px; right: -8px; z-index: 8; width: 17px; height: 17px;
    border-radius: 50%; border: none; background: #dc2626; color: #fff; font-size: 10px; line-height: 17px;
    text-align: center; padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s; font-family: inherit; }
.brc-cell:hover .brc-celldel { opacity: 1; }
.brc-rhandle { position: absolute; top: 0; bottom: 0; right: -6px; width: 12px; z-index: 7;
    cursor: ew-resize; touch-action: none; }
.brc-rhandle::after { content: ''; position: absolute; top: 14px; bottom: 14px; left: 4px; width: 4px;
    border-radius: 3px; background: #6366f1; opacity: 0; transition: opacity .12s; }
.brc-cell:hover .brc-rhandle::after, .brc-rhandle.is-active::after { opacity: .75; }

.brc-rowctrl { display: flex; gap: 5px; flex: none; opacity: 0; transition: opacity .15s; }
.brc-rowline:hover .brc-rowctrl { opacity: 1; }
.brc-rowctrl button { width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
    font-size: 11px; line-height: 20px; padding: 0; text-align: center; color: #fff; font-family: inherit; }
.brc-rowdup { background: #94a3b8; }
.brc-rowdup:hover { background: #6366f1; }
.brc-rowdel { background: #dc2626; }
.brc-celladd { flex: none; align-self: center; width: 26px; height: 26px; margin-left: 8px;
    border-radius: 50%; border: 1.6px dashed #94a3b8; background: none; color: #94a3b8;
    font-size: 15px; cursor: pointer; opacity: 0; transition: .15s; line-height: 1; }
.brc-rowline:hover .brc-celladd { opacity: 1; }
.brc-celladd:hover { border-color: #6366f1; color: #6366f1; }

.brc-insert { position: relative; height: 20px; }
.brc-insert__plus { position: absolute; left: 116px; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px; border-radius: 50%; border: none; background: #6366f1; color: #fff;
    font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s;
    box-shadow: 0 2px 6px rgba(99, 102, 241, .4); }
.brc-insert:hover .brc-insert__plus { opacity: 1; }
.brc-addrow { margin: 12px 0 0 108px; border: 1.6px dashed #cbd5e1; background: none; color: var(--muted);
    font: inherit; font-size: .78rem; padding: 7px 16px; border-radius: 10px; cursor: pointer; transition: .15s; }
.brc-addrow:hover { border-color: #6366f1; color: #4338ca; background: #eef2ff; }

.brc-hbrace { position: absolute; height: 26px; z-index: 4; }
.brc-hbrace.top { top: -28px; }
.brc-hbrace.bottom { bottom: -28px; }
.brc-hbrace svg { position: absolute; left: 0; width: 100%; }
.brc-hbrace.top svg { bottom: 0; }
.brc-hbrace.bottom svg { top: 0; }
.brc-blab { font-size: .8rem; font-weight: 600; color: var(--slate-700); outline: none; white-space: nowrap; }
.brc-blab.is-unk { color: #dc2626; }
.brc-blab:empty::before { content: '…'; color: #cbd5e1; }
.brc-hbrace .brc-blab { position: absolute; left: 0; width: 100%; text-align: center; }
.brc-hbrace.top .brc-blab { top: -8px; }
.brc-hbrace.bottom .brc-blab { bottom: -8px; }
.brc-bdel { position: absolute; right: -16px; top: 0; width: 15px; height: 15px; border: none;
    border-radius: 50%; background: #dc2626; color: #fff; font-size: 9px; padding: 0; line-height: 15px;
    cursor: pointer; opacity: 0; transition: .12s; }
.brc-hbrace:hover .brc-bdel, .brc-vbrace:hover .brc-bdel { opacity: 1; }
.brc-vbrace { position: absolute; z-index: 4; }
.brc-vbrace svg { position: absolute; left: 0; top: 0; }
.brc-vbrace .brc-blab { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); }
.brc-vbrace .brc-bdel { left: 2px; right: auto; top: -18px; }
.brc-guide { position: absolute; top: 10px; bottom: 10px; width: 0; z-index: 30;
    border-left: 2px dashed #6366f1; pointer-events: none; display: none; }

.brc-ctx { position: fixed; z-index: 1300; background: #fff; border: 1px solid var(--slate-100);
    border-radius: 11px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); padding: 7px 9px;
    display: flex; flex-direction: column; gap: 6px; }
.brc-ctx__line { display: flex; align-items: center; gap: 4px; }
.brc-sw { width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(15, 23, 42, .18);
    cursor: pointer; padding: 0; transition: transform .1s; }
.brc-sw:hover { transform: scale(1.2); }
.brc-cbtn { width: 29px; height: 29px; border: none; background: none; border-radius: 8px; cursor: pointer;
    color: var(--slate-700); display: flex; align-items: center; justify-content: center;
    font-size: .92rem; font-weight: 700; font-family: inherit; padding: 0; }
.brc-cbtn:hover { background: #eef2ff; color: #4338ca; }
.brc-cbtn.is-danger:hover { background: #fee2e2; color: #dc2626; }
.brc-cbtn svg { width: 17px; height: 17px; }
.brc-split { position: fixed; z-index: 1310; background: #fff; border: 1px solid var(--slate-100);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); padding: 7px;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
/* Indispensable : les display:flex / display:grid ci-dessus l'emporteraient sinon sur
   l'attribut [hidden] — les deux panneaux resteraient visibles une fois « fermés ». */
.brc-ctx[hidden], .brc-split[hidden] { display: none; }
.brc-split button { width: 30px; height: 26px; border: 1px solid var(--slate-100); background: #f8fafc;
    border-radius: 7px; cursor: pointer; font: inherit; font-size: .78rem; }
.brc-split button:hover { background: #eef2ff; border-color: #6366f1; color: #4338ca; }
/* Panneau « Schéma en barres » de l'Estrade : large (l'éditeur a besoin de place au tableau)
   et déplaçable par son entête, comme le panneau Calculatrice. */
.est-panel--barres { width: min(680px, calc(100vw - 32px)); }
.est-panel--barres .est-panel__head { cursor: grab; touch-action: none; user-select: none; }
.est-panel--barres .est-panel__head:active { cursor: grabbing; }
.est-panel--barres .brc-stage { max-height: 40vh; }
.est-panel--barres #barres-place { margin-top: 10px; }

/* Éditeur intégré à un bloc de leçon (Le Cours) : scène un peu plus basse que dans la modale. */
.lc-barres-edit { margin: 4px 0 10px; }
.lc-barres-edit .brc-stage { max-height: 44vh; padding-right: 90px; }
/* Rendu du bloc dans la leçon (consultation, élève, impression). */
.lc-block .barres-view { padding: 4px 0; }

/* Bloc GeoGebra du cours : réglages par paliers (mise en page → côté → texte/image) + aperçu en direct */
.lc-ggb-step { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lc-ggb-step[hidden], .lc-ggb-pane[hidden] { display: none; }
.lc-ggb-step__num { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
    background: var(--primary, #4f46e5); color: #fff; }
.lc-ggb-step__field { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lc-ggb-step__label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.lc-ggb-pane { margin-bottom: 10px; }
.lc-ggb-live__label { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 6px 0 4px; }
.lc-ggb-live { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; background: #f8fafc; }
.lc-ggb-live__fig { display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 120px; padding: 16px; border-radius: 8px; background: #fff; border: 1px solid var(--border);
    color: var(--muted); font-weight: 600; }
.lc-ggb-live .lc-figure__text img { max-width: 100%; border-radius: 8px; display: block; }
.lc-ggb-live__empty { color: var(--muted); font-style: italic; font-size: .85rem; }
/* Figure rendue dans une leçon ou la consultation document.
   Le conteneur épouse la hauteur de l'applet : pas de min-height, sinon une bande
   #f8fafc apparaît sous la figure quand l'applet est moins haut que ce min-height.
   La hauteur « plancher » pendant le chargement est portée par le message ci-dessous,
   remplacé par l'applet une fois chargé (donc jamais de bande après rendu). */
.ggb-view { width: 100%; border-radius: 10px; overflow: hidden; background: #f8fafc; }
.ggb-view__msg { color: var(--muted); font-size: .9rem; padding: 24px 16px; min-height: 120px;
    box-sizing: border-box; text-align: center; }
/* Recadrage (écran uniquement, classe no-print) d'une figure GeoGebra : la hauteur à la
   verticale sur le flanc gauche du cadre, la largeur à l'horizontale en dessous. Les deux
   curseurs entourent donc la figure comme les poignées de ses bords bas et droit.
   L'ossature est montée par js/ggb-height.js ; sans lui (élève), rien n'est ajouté. */
.ggb-frame { display: flex; align-items: flex-start; gap: 8px; }
.ggb-frame__main { flex: 1 1 auto; min-width: 0; }
.ggb-vbar { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto;
    padding: 6px 4px; background: var(--slate-100); border-radius: 8px; box-sizing: border-box; }
/* Curseur vertical : un curseur ORDINAIRE tourné d'un quart de tour DANS LE SENS DES AIGUILLES
   (rotate(90deg) : le minimum passe en haut, le maximum en bas). La partie remplie part donc
   du HAUT et descend — elle se lit comme la hauteur du cadre posé juste à côté, qui grandit
   lui aussi vers le bas. Le curseur « vertical » natif (writing-mode /
   -webkit-appearance:slider-vertical) est écarté : les deux mécanismes se contrarient quand
   ils s'appliquent ensemble et le sens obtenu change d'un moteur à l'autre, là où la rotation
   est de la géométrie pure.
   Sa longueur est FIXE — c'est une commande, pas une règle graduée : elle ne suit pas la
   hauteur du cadre. Longueur du curseur = sa largeur avant rotation, donc la hauteur de la
   gouttière et la largeur du curseur doivent rester égales. */
.ggb-vbar__slot { position: relative; flex: 0 0 auto; width: 20px; height: 200px; }
.ggb-vbar__range { position: absolute; top: 50%; left: 50%; width: 200px; margin: 0; padding: 0;
    transform: translate(-50%, -50%) rotate(90deg); }
.ggb-vbar__val { font-size: .72rem; color: var(--slate-600); font-variant-numeric: tabular-nums; }
.ggb-hbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 6px 0 2px;
    padding: 6px 10px; background: var(--slate-100); border-radius: 8px; }
.ggb-hbar__lab { font-size: .8rem; font-weight: 600; color: var(--slate-600); }
.ggb-hbar__range { flex: 1 1 160px; min-width: 120px; }
.ggb-hbar__val { font-size: .8rem; color: var(--slate-600); min-width: 52px; text-align: right; }
/* Mêmes curseurs pour une figure posée dans une cellule de tableau : une colonne est étroite,
   ils s'y font plus discrets (et s'enroulent plutôt que d'élargir la colonne). */
.ggb-frame--cell { gap: 4px; }
.ggb-vbar--cell { padding: 4px 2px; gap: 2px; }
.ggb-vbar--cell .ggb-vbar__slot { width: 16px; height: 120px; }
.ggb-vbar--cell .ggb-vbar__range { width: 120px; }
.ggb-vbar--cell .ggb-vbar__val { font-size: .66rem; }
.ggb-hbar--cell { margin: 4px 0 0; padding: 4px 6px; gap: 3px 6px; }
.ggb-hbar--cell .ggb-hbar__lab { font-size: .7rem; }
.ggb-hbar--cell .ggb-hbar__range { flex: 1 1 80px; min-width: 60px; }
.ggb-hbar--cell .ggb-hbar__val { font-size: .7rem; min-width: 46px; }

/* ===================== Capture d'écran (overlay de rognage rectangle / lasso) ===================== */
.hmcap { position: fixed; inset: 0; z-index: 9999; background: rgba(2, 6, 23, .82);
    display: flex; align-items: center; justify-content: center; }
.hmcap__canvas { max-width: 100vw; max-height: 100vh; width: auto; height: auto;
    cursor: crosshair; touch-action: none; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.hmcap__bar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2;
    display: flex; gap: 8px; align-items: center; background: #0f172a; color: #e2e8f0;
    padding: 8px 10px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
    font: 14px system-ui, -apple-system, sans-serif; }
.hmcap__btn { appearance: none; border: 1px solid #334155; background: #1e293b; color: #e2e8f0;
    padding: 6px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
.hmcap__btn:hover { background: #334155; }
.hmcap__btn.is-on { background: #38bdf8; border-color: #38bdf8; color: #08263a; font-weight: 600; }
.hmcap__btn--primary { background: #22c55e; border-color: #22c55e; color: #062a12; font-weight: 600; }
.hmcap__btn--primary:hover { background: #16a34a; }
.hmcap__hint { opacity: .8; margin-left: 6px; }
/* Décompte de la temporisation : volontairement discret et en haut à droite — il ne doit ni
   masquer ce que l'enseignant est en train de déplier, ni se retrouver DANS la capture. */
.hmcap-count { position: fixed; top: 16px; right: 16px; z-index: 9998; width: 54px; height: 54px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    background: rgba(15,23,42,.88); color: #fff; font: 700 26px/1 system-ui, -apple-system, sans-serif;
    box-shadow: 0 8px 24px rgba(0,0,0,.4); pointer-events: none; }

/* ===================== Photo du téléphone (recadrage + lumière) ===================== */
/* Plein écran plutôt qu'une modale : sur un téléphone, la photo doit occuper toute la
   place disponible, et les poignées de recadrage se prennent au pouce (44 px minimum). */
.hmphoto { position: fixed; inset: 0; z-index: 9999; background: #0b1220; color: #e2e8f0;
    display: flex; flex-direction: column; gap: 6px;
    font: 14px system-ui, -apple-system, sans-serif;
    padding: calc(6px + env(safe-area-inset-top)) 8px calc(6px + env(safe-area-inset-bottom)); }
.hmphoto__hint { margin: 0; text-align: center; font-size: .78rem; opacity: .7; }
.hmphoto__stage { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
/* overflow caché : le voile du recadrage est un box-shadow démesuré, qui déborderait sinon
   sur toute la fenêtre (barre d'outils comprise). Les poignées restent donc EN DEDANS. */
.hmphoto__frame { position: relative; overflow: hidden; touch-action: none;
    user-select: none; -webkit-user-select: none; }
.hmphoto__img { display: block; width: 100%; height: 100%; }

.hmphoto__crop { position: absolute; box-sizing: border-box; cursor: move;
    border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 9999px rgba(2, 6, 23, .62); }
.hmphoto__crop::before, .hmphoto__crop::after { content: ''; position: absolute; pointer-events: none; }
.hmphoto__crop::before { top: 0; bottom: 0; left: 33.33%; right: 33.33%;
    border-left: 1px solid rgba(255, 255, 255, .22); border-right: 1px solid rgba(255, 255, 255, .22); }
.hmphoto__crop::after { left: 0; right: 0; top: 33.33%; bottom: 33.33%;
    border-top: 1px solid rgba(255, 255, 255, .22); border-bottom: 1px solid rgba(255, 255, 255, .22); }

.hmphoto__hdl { position: absolute; width: 44px; height: 44px; }
.hmphoto__hdl::after { content: ''; position: absolute; width: 15px; height: 15px;
    border: 3px solid #38bdf8; border-radius: 2px; }
.hmphoto__hdl--nw { left: 0; top: 0; }
.hmphoto__hdl--ne { right: 0; top: 0; }
.hmphoto__hdl--sw { left: 0; bottom: 0; }
.hmphoto__hdl--se { right: 0; bottom: 0; }
.hmphoto__hdl--nw::after { left: 2px; top: 2px; border-right-color: transparent; border-bottom-color: transparent; }
.hmphoto__hdl--ne::after { right: 2px; top: 2px; border-left-color: transparent; border-bottom-color: transparent; }
.hmphoto__hdl--sw::after { left: 2px; bottom: 2px; border-right-color: transparent; border-top-color: transparent; }
.hmphoto__hdl--se::after { right: 2px; bottom: 2px; border-left-color: transparent; border-top-color: transparent; }

.hmphoto__edge { position: absolute; }
.hmphoto__edge--n { top: 0; left: 44px; right: 44px; height: 24px; cursor: ns-resize; }
.hmphoto__edge--s { bottom: 0; left: 44px; right: 44px; height: 24px; cursor: ns-resize; }
.hmphoto__edge--w { left: 0; top: 44px; bottom: 44px; width: 24px; cursor: ew-resize; }
.hmphoto__edge--e { right: 0; top: 44px; bottom: 44px; width: 24px; cursor: ew-resize; }

.hmphoto__tools { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.hmphoto__slider { display: flex; align-items: center; gap: 10px; padding: 2px 10px;
    background: #111c31; border: 1px solid #1e293b; border-radius: 10px; }
.hmphoto__ic { font-size: 1.1rem; width: 1.3em; text-align: center; }
.hmphoto__slider input[type="range"] { flex: 1 1 auto; min-width: 0; height: 30px; accent-color: #38bdf8; }
.hmphoto__val { flex: 0 0 auto; width: 3em; text-align: right; font-weight: 600; opacity: .75;
    font-variant-numeric: tabular-nums; }
.hmphoto__row { display: flex; gap: 8px; }
.hmphoto__btn { flex: 1 1 auto; min-height: 44px; appearance: none; cursor: pointer; font: inherit;
    border: 1px solid #334155; background: #1e293b; color: #e2e8f0; padding: 8px; border-radius: 10px; }
.hmphoto__btn:hover { background: #334155; }
.hmphoto__btn:disabled { opacity: .55; cursor: default; }
.hmphoto__btn--primary { background: #22c55e; border-color: #22c55e; color: #062a12; font-weight: 700; }
.hmphoto__btn--primary:hover { background: #16a34a; }

/* Téléphone tenu à l'horizontale : la hauteur manque, les outils passent sur le côté. */
@media (orientation: landscape) and (max-height: 560px) {
    .hmphoto { flex-direction: row; gap: 10px; }
    .hmphoto__hint { display: none; }
    .hmphoto__tools { width: 42%; max-width: 300px; justify-content: center; }
}


/* ==== Mon réseau (partage d'hexagones entre enseignants) ==== */

/* Lien + puce dans la barre du haut */
.topbar__reseau { display: inline-flex; align-items: center; gap: 6px; color: #e2e8f0; text-decoration: none;
    font-size: .86rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.topbar__reseau:hover { background: rgba(255, 255, 255, .1); }
.topbar__badge { background: #dc2626; color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700;
    padding: 1px 6px; min-width: 18px; text-align: center; line-height: 1.4; }
@media (max-width: 620px) { .topbar__reseau-lbl { display: none; } }
/* --- Navigation au stylet (js/stylet.js) --------------------------------------------
   Au tableau numérique, on fait défiler la page en la tirant. Le bouton ✋ du bandeau
   arme ce geste pour les stylets que le pilote du TBI présente comme une SOURIS ; un
   stylet reconnu comme tel n'a besoin de rien. */
.topbar__stylet { display: inline-flex; align-items: center; gap: 6px; color: #e2e8f0;
    background: none; border: 1px solid transparent; font: inherit; font-size: .86rem; font-weight: 600;
    padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.topbar__stylet:hover { background: rgba(255, 255, 255, .1); }
.topbar__stylet.is-on { background: #16a34a; border-color: #15803d; color: #fff; }
@media (max-width: 620px) { .topbar__stylet-lbl { display: none; } }

/* Mode armé : la page s'annonce « tirable ». Le curseur de préhension ne descend pas sur
   les liens et les boutons — leur propre curseur l'emporte, ils restent cliquables. */
body.is-stylet { cursor: grab; }
/* Pendant le glissement, plus rien ne se sélectionne ni ne change de curseur : on tire. */
body.is-stylet-drag, body.is-stylet-drag * { cursor: grabbing !important; }
body.is-stylet-drag, body.is-stylet-drag * { user-select: none !important; -webkit-user-select: none !important; }


/* =========================================================================
   Mon réseau — trois sections d'un même écran : Ressources (recherche chez les
   collègues), Le Cours (leurs classeurs publiés), Messagerie (façon WhatsApp).
   Onglets sur ordinateur, menu déroulant sur téléphone.
   ========================================================================= */

/* Largeur : le réseau DÉBORDE du gabarit de .container (960 px) dès que la fenêtre offre la
   place — trois sections à deux volets, des leçons entières à lire. Le débord se fait par des
   marges négatives FIXES, inférieures à l'espace libre de part et d'autre : le calcul ne
   dépend pas de « vw », donc pas de la largeur de l'ascenseur. Un « width: 100vw » sortait
   15 px trop large et posait une barre de défilement horizontale sous toute la page.
   Même technique que .lc-show (cf. « Leçon (affichage écran) » plus haut). */
.reseau.rz { padding: 0 8px 20px;
    /* Hauteur des volets à deux colonnes (messagerie, cours) : une seule valeur, pour que
       la barre d'onglets et le pied de page restent visibles sans faire défiler la page. */
    --rz-h: calc(100vh - 200px); }
/* Les seuils gardent une réserve : une requête média compte la largeur de l'ascenseur, pas
   la mise en page. À 1160 px de fenêtre il reste ~91 px libres de chaque côté (on en prend
   70), à 1300 px ~161 px (on en prend 148, de quoi atteindre les 1200 px des volets). */
@media (min-width: 1160px) { .reseau.rz { margin-inline: -70px; } }    /* ≈ 1045 px de contenu */
@media (min-width: 1300px) { .reseau.rz { margin-inline: -148px; } }   /* ≈ 1200 px, la largeur des volets */

/* ---- Barre d'onglets ---------------------------------------------------- */
.rz-head { display: flex; align-items: center; gap: 16px; max-width: 1200px; margin: 0 auto;
    padding: 4px 2px 10px; }
.rz-head__title { margin: 0; font-family: var(--font-display); font-size: 1.35rem; flex: none; }
.rz-tabs { display: flex; gap: 4px; padding: 4px; background: var(--slate-200); border-radius: 999px; }
.rz-tab { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
    background: none; color: var(--slate-600); font: inherit; font-size: .9rem; font-weight: 600;
    padding: 7px 16px; border-radius: 999px; transition: background .14s ease, color .14s ease; }
.rz-tab:hover { color: var(--slate-900); }
.rz-tab.is-on { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(15,23,42,.14); }
.rz-tab__ic { display: inline-flex; }
.rz-tab__ic svg { width: 17px; height: 17px; }
.rz-tab__nb { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
/* Le burger ne sert que sur téléphone (cf. la requête média en fin de section). */
.rz-burger { display: none; align-items: center; gap: 9px; margin-left: auto; cursor: pointer;
    border: 1px solid var(--border); background: var(--card); border-radius: 10px;
    padding: 8px 13px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--slate-700); }
.rz-burger svg { width: 18px; height: 18px; }

.rz-panes { max-width: 1200px; margin: 0 auto; }

/* ---- Section 3 : messagerie --------------------------------------------- */
.rz-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    height: var(--rz-h); min-height: 480px; max-width: 1200px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; }

/* ---- Panneau gauche : conversations ---- */
.rz-side { display: flex; flex-direction: column; min-height: 0; background: var(--slate-50);
    border-right: 1px solid var(--border); }
.rz-side__head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 16px 10px; }
.rz-side__title { margin: 0; font-size: 1.15rem; }
.rz-new { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--primary); color: #fff; display: grid; place-items: center; transition: background .12s; }
.rz-new:hover { background: var(--primary-d); }
.rz-new svg { width: 18px; height: 18px; }
.rz-search { padding: 0 12px 10px; }
.rz-search__input { width: 100%; border: 1px solid var(--border); border-radius: 999px;
    padding: 8px 14px; font: inherit; font-size: .88rem; background: #fff; }
.rz-search__input:focus { outline: none; border-color: var(--primary); }
.rz-convos { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.rz-convo { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer;
    border-bottom: 1px solid var(--slate-100); transition: background .1s; }
.rz-convo:hover { background: var(--slate-100); }
.rz-convo.is-active { background: #e7ecfb; }
.rz-convo .avatar { flex: none; background: var(--primary); color: #fff; }
.rz-convo__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rz-convo__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rz-convo__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rz-convo__time { flex: none; font-size: .72rem; color: var(--muted); }
.rz-convo__snip { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rz-convo.has-unread .rz-convo__snip { color: var(--slate-700); font-weight: 600; }
.rz-convo__badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: #16a34a; color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.rz-side__empty { padding: 18px 16px; color: var(--muted); font-size: .86rem; line-height: 1.5; }

/* ---- Panneau droit : fil actif ---- */
.rz-main { position: relative; min-height: 0; display: flex; background: var(--slate-100); }
.rz-thread { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
/* Aucune conversation ouverte : le display:flex ci-dessus l'emporterait sinon sur [hidden],
   et le volet droit montrerait un en-tête sans nom et un champ de saisie sans destinataire. */
.rz-thread[hidden] { display: none; }
/* Volet droit vide : on dit pourquoi, plutôt que de laisser un grand rectangle gris. */
.rz-main::before { content: "Choisissez une conversation, ou cliquez sur + pour en commencer une.";
    margin: auto; padding: 24px; max-width: 320px; text-align: center; color: var(--muted); font-size: .92rem; }
.rz-main:has(.rz-thread:not([hidden]))::before { content: none; }
.rz-thread__head { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--border); background: #fff; }
.rz-thread__head .avatar { background: var(--primary); color: #fff; flex: none; }
.rz-thread__name { font-weight: 700; }
.rz-back { display: none; width: 34px; height: 34px; border: 0; background: none; cursor: pointer;
    color: var(--slate-600); place-items: center; margin-left: -6px; }
.rz-back svg { width: 22px; height: 22px; }

.rz-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 8px;
    display: flex; flex-direction: column; gap: 8px; background: var(--slate-100); scroll-behavior: smooth; }
.rz-msgs__loading, .rz-msgs__empty { margin: auto; color: var(--muted); font-size: .9rem; text-align: center; }

/* Bulles de texte */
.rz-msg { max-width: 74%; padding: 7px 11px 5px; border-radius: 12px; position: relative;
    box-shadow: 0 1px 1px rgba(15,23,42,.08); font-size: .92rem; line-height: 1.4; }
.rz-msg--them { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.rz-msg--mine { align-self: flex-end; background: #d7f4c4; border-top-right-radius: 4px; }
.rz-msg__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.rz-msg__time { display: block; text-align: right; margin-top: 2px; font-size: .66rem; color: var(--slate-500); }

/* Cartes d'hexagone dans le fil */
.rz-card { max-width: 78%; background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 11px 12px 9px; box-shadow: 0 1px 2px rgba(15,23,42,.08); display: flex; flex-direction: column; gap: 8px; }
.rz-card--them { align-self: flex-start; border-top-left-radius: 4px; }
.rz-card--mine { align-self: flex-end; border-top-right-radius: 4px; background: #f6fbef; }
.rz-card.is-done { opacity: .92; }
.rz-card__top { display: flex; gap: 11px; align-items: flex-start; }
.rz-card__ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    background: var(--slate-100); color: var(--slate-600); }
.rz-card__ic svg { width: 22px; height: 22px; }
.rz-card__body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rz-card__kicker { font-size: .64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rz-card__title { font-weight: 700; overflow-wrap: anywhere; }
.rz-card__meta { font-size: .78rem; color: var(--muted); }
.rz-card__note { margin: 0; padding-left: 10px; border-left: 3px solid var(--slate-200);
    color: var(--slate-600); font-size: .84rem; font-style: italic; }
.rz-card__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.rz-card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rz-card__statut { font-size: .7rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: #fff; }
.rz-card__statut--en_attente { background: #f59e0b; }
.rz-card__statut--accepte { background: #16a34a; }
.rz-card__statut--refuse { background: var(--slate-500); }

/* Composer */
.rz-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px;
    border-top: 1px solid var(--border); background: #fff; }
.rz-attach, .rz-send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; transition: background .12s, transform .12s; }
.rz-attach { background: var(--slate-100); color: var(--slate-600); }
.rz-attach:hover { background: var(--slate-200); }
.rz-attach svg, .rz-send svg { width: 20px; height: 20px; }
.rz-send { background: var(--primary); color: #fff; }
.rz-send:hover:not(:disabled) { background: var(--primary-d); }
.rz-send:disabled { opacity: .5; cursor: default; }
.rz-input { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 18px; padding: 9px 14px;
    font: inherit; font-size: .92rem; line-height: 1.35; max-height: 140px; background: var(--slate-50); }
.rz-input:focus { outline: none; border-color: var(--primary); background: #fff; }

/* Modales : annuaire (nouvelle conversation) + sélecteur d'hexagone */
.rz-annuaire { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.rz-annuaire__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.rz-annuaire__item:hover { background: var(--slate-100); }
.rz-annuaire__item .avatar { background: var(--primary); color: #fff; }
.rz-annuaire__name { font-weight: 600; }
.rz-picker { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.rz-pick, .rz-picker .rz-pick { list-style: none; margin: 0; padding-left: 0; }
.rz-picker .rz-pick .rz-pick { padding-left: 16px; }
.rz-pick__doc, .rz-pick__foldbtn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
    border: 0; background: none; cursor: pointer; font: inherit; font-size: .88rem; padding: 6px 8px; border-radius: 7px; }
.rz-pick__doc:hover, .rz-pick__foldbtn:hover { background: var(--slate-100); }
.rz-pick__foldbtn { font-weight: 700; }
.rz-pick__ic { flex: none; width: 20px; height: 20px; color: var(--slate-500); }
.rz-pick__ic svg { width: 20px; height: 20px; }
.rz-pick__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rz-picker details > summary { list-style: none; cursor: pointer; }
.rz-picker details > summary::-webkit-details-marker { display: none; }
.rz-pick__empty { color: var(--muted); font-style: italic; font-size: .86rem; padding: 4px 2px; }

@media (max-width: 860px) {
    .reseau.rz { padding: 0 8px 12px; --rz-h: calc(100vh - 170px); }
    .rz-app { grid-template-columns: 1fr; }
    .rz-main { display: none; }
    .rz-app.is-thread .rz-side { display: none; }
    .rz-app.is-thread .rz-main { display: flex; }
    .rz-back { display: grid; }
    .rz-msg, .rz-card { max-width: 86%; }

    /* Les onglets deviennent un menu déroulant sous le burger : trois libellés côte à côte
       ne tiennent pas, et les réduire à leurs seules icônes ferait deviner. */
    .rz-head { gap: 10px; padding-bottom: 8px; position: relative; }
    .rz-head__title { font-size: 1.15rem; }
    .rz-burger { display: inline-flex; }
    .rz-tabs { display: none; position: absolute; right: 0; top: 100%; z-index: 30;
        flex-direction: column; gap: 2px; min-width: 220px; padding: 6px;
        background: var(--card); border: 1px solid var(--border); border-radius: 12px;
        box-shadow: 0 12px 30px rgba(15,23,42,.16); }
    .rz-tabs.is-open { display: flex; }
    .rz-tab { justify-content: flex-start; border-radius: 9px; padding: 10px 12px; }
    .rz-tab.is-on { box-shadow: none; background: var(--slate-100); }
    .rz-tab__nb { margin-left: auto; }
}

/* =========================================================================
   Mon réseau ▸ section 1 — RESSOURCES : recherche d'hexagones chez les collègues.
   ========================================================================= */

.rb { max-width: 1200px; margin: 0 auto; }

/* ---- Barre de recherche (collée en haut pendant le défilement) ---------- */
.rb-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px;
    align-items: center; padding: 12px; margin-bottom: 4px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); }
.rb-search { position: relative; flex: 1 1 320px; min-width: 0; }
.rb-search__ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--slate-400); pointer-events: none; display: flex; }
.rb-search__ic svg { width: 18px; height: 18px; }
.rb-search__input { width: 100%; border: 1px solid var(--border); border-radius: 999px;
    padding: 10px 14px 10px 40px; font: inherit; font-size: .95rem; background: var(--slate-50); }
.rb-search__input:focus { outline: none; border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.rb-filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rb-select { border: 1px solid var(--border); border-radius: 999px; background: var(--slate-50);
    padding: 8px 12px; font: inherit; font-size: .85rem; color: var(--slate-700); cursor: pointer;
    max-width: 220px; }
.rb-select:focus { outline: none; border-color: var(--primary); }

.rb-count { margin: 10px 2px 8px; font-size: .84rem; color: var(--muted); }
.rb-empty, .rb-vide { margin: 26px auto; max-width: 620px; text-align: center; color: var(--muted);
    font-size: .92rem; line-height: 1.65; }
.rb-vide { padding: 26px 22px; background: var(--card); border: 1px dashed var(--border);
    border-radius: var(--radius); }

/* ---- Un résultat -------------------------------------------------------- */
.rb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rb-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.rb-item:hover { border-color: var(--slate-300); box-shadow: var(--shadow); transform: translateY(-1px); }
.rb-item__ic { flex: none; width: 42px; height: 42px; border-radius: 11px; color: #fff;
    display: grid; place-items: center; background: var(--slate-400); }
.rb-item__ic svg { width: 22px; height: 22px; }
.rb-item__main { flex: 1; min-width: 0; }
.rb-item__title { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.rb-item__meta { margin: 2px 0 0; font-size: .78rem; color: var(--muted);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rb-item__auteur { padding: 1px 8px; border-radius: 999px; background: var(--slate-100);
    color: var(--slate-600); font-weight: 600; }
.rb-item__desc { margin: 5px 0 0; font-size: .84rem; color: var(--slate-600); line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rb-item__actions { flex: none; display: flex; gap: 6px; }

.rb-foot { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 18px 0 4px; }
.rb-loading { font-size: .84rem; color: var(--muted); }
/* Le display:inline-flex de .btn l'emporterait sinon sur l'attribut [hidden]. */
.rb-bar .btn[hidden], .rb-foot .btn[hidden] { display: none; }

/* =========================================================================
   Mon réseau ▸ section 2 — LE COURS : classeurs publiés des collègues.
   ========================================================================= */

.rc-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
    height: var(--rz-h); min-height: 480px; max-width: 1200px; margin: 0 auto;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; }

/* ---- Volet gauche : les enseignants ------------------------------------ */
.rc-side { display: flex; flex-direction: column; min-height: 0; background: var(--slate-50);
    border-right: 1px solid var(--border); padding-top: 12px; }
.rc-profs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.rc-prof { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer;
    border-bottom: 1px solid var(--border); }
.rc-prof[hidden] { display: none; }   /* filtre de recherche : le display:flex prime sinon */
.rc-prof:hover { background: var(--slate-100); }
.rc-prof.is-active { background: #e7ecfb; }
.rc-prof .avatar { flex: none; background: var(--primary); color: #fff; }
.rc-prof__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rc-prof__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-prof__meta { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Volet droit : le classeur ------------------------------------------ */
.rc-main { position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--slate-100); }
.rc-intro { margin: auto; padding: 24px; color: var(--muted); font-size: .92rem; text-align: center; }
.rc-classeur { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rc-classeur[hidden] { display: none; }   /* aucun enseignant choisi : le display:flex prime sinon */
.rc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px;
    border-bottom: 1px solid var(--border); background: var(--card); }
.rc-head .avatar { background: var(--primary); color: #fff; flex: none; }
.rc-head__name { font-weight: 700; }
.rc-niveaux { display: flex; flex-wrap: wrap; gap: 5px; margin-left: auto; }
.rc-niveau { border: 1px solid var(--border); background: var(--card); border-radius: 999px;
    padding: 5px 12px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--slate-600); cursor: pointer; }
.rc-niveau:hover { border-color: var(--slate-300); }
.rc-niveau.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rc-niveau__nb { opacity: .7; font-weight: 500; }
.rc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.rc-loading { margin: 26px auto; text-align: center; color: var(--muted); font-size: .9rem; }

/* Chapitres dépliants et leurs leçons. */
.rc-chapitres { display: flex; flex-direction: column; gap: 8px; }
.rc-chap { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rc-chap__head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer;
    font-weight: 700; list-style: none; }
.rc-chap__head::-webkit-details-marker { display: none; }
.rc-chap__head::before { content: "▸"; color: var(--slate-400); transition: transform .15s ease; }
.rc-chap[open] > .rc-chap__head::before { transform: rotate(90deg); }
.rc-chap__titre { min-width: 0; overflow-wrap: anywhere; }
.rc-chap__nb { margin-left: auto; font-size: .76rem; font-weight: 600; color: var(--muted); }
.rc-lecons { list-style: none; margin: 0; padding: 0 0 4px; }
.rc-lecon-li { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0;
    border-top: 1px solid var(--slate-100); }
.rc-lecon-li:hover { background: var(--slate-50); }
.rc-lecon-open { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px;
    border: 0; background: none; cursor: pointer; font: inherit; text-align: left; padding: 10px 14px; }
.rc-lecon__titre { min-width: 0; overflow-wrap: anywhere; }
.rc-lecon__meta { flex: none; font-size: .76rem; color: var(--muted); }
.rc-lecon-li .btn { flex: none; }

/* Bandeau d'après-import : le lien vers la leçon enrichie, sans quitter le réseau. */
.rc-fait { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: .88rem;
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.rc-fait a { color: inherit; font-weight: 700; }

/* ---- Une leçon ouverte -------------------------------------------------- */
/* Lire un cours et parcourir une liste d'enseignants ne demandent pas la même page : dès
   qu'une leçon s'ouvre, la liste s'efface et la leçon prend TOUTE la largeur du volet, à
   peu près celle qu'elle a dans le classeur (~1150 px). Le défilement redevient celui de
   la page : un cours de trois écrans ne se lit pas par une lucarne de 500 px de haut. */
.rc-app.is-lecon { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
.rc-app.is-lecon .rc-side { display: none; }
/* .rc-body garde son « overflow » : la hauteur du volet devenant automatique, il ne défile
   plus verticalement (c'est la page qui s'en charge) mais retient toujours ce qui est trop
   LARGE — un tableau de cours sur un téléphone, par exemple, qui pousserait sinon la page
   entière vers la droite. */
/* L'en-tête (auteur + niveaux) reste sous les yeux pendant la lecture : c'est lui qui
   rappelle chez qui l'on est, et qui permet de changer de niveau sans remonter.
   Le rognage de .rc-app doit tomber : un ancêtre en « overflow: hidden » capture le
   « sticky » et l'en-tête repartait avec le texte. Il n'y a qu'un volet en mode leçon,
   on arrondit donc ses coins directement plutôt que de les rogner. */
.rc-app.is-lecon { overflow: visible; }
.rc-app.is-lecon .rc-main { border-radius: var(--radius); }
.rc-app.is-lecon .rc-head { position: sticky; top: 0; z-index: 4;
    border-radius: var(--radius) var(--radius) 0 0; }

/* .lc-show DÉBORDE volontairement de son gabarit sur la page du Cours (marges négatives
   au-delà de 1280 px, cf. la règle plus haut : tableaux et figures ont besoin de largeur).
   Dans un volet, ce débord n'avait aucune place où aller : il rognait le texte des deux
   côtés et sortait une barre de défilement horizontale. */
.rc-body .lc-show { margin-inline: 0; }

/* Sa barre de sélection (.lc-pickbar) reste la pastille flottante habituelle — elle est
   posée en « fixed » sur la fenêtre, ce qui convient aussi bien ici. */
.rc-lecon .lc-show__bar { margin-bottom: 12px; }
.rc-lecon__back { margin-bottom: 8px; }

@media (max-width: 860px) {
    .rb-bar { padding: 10px; }
    .rb-select { flex: 1 1 140px; max-width: none; }
    .rb-item { flex-wrap: wrap; }
    .rb-item__actions { width: 100%; justify-content: flex-end; }

    .rc-app { grid-template-columns: 1fr; }
    .rc-main { display: none; }
    .rc-app.is-classeur .rc-side { display: none; }
    .rc-app.is-classeur .rc-main { display: flex; }
    .rc-niveaux { margin-left: 0; width: 100%; }
}

/* Modale de rangement : arborescence dépliante des dossiers */
.rxd-item { font-weight: 700; margin: 0 0 2px; }
.rxd-hint { margin: 0 0 10px; color: var(--slate-700); font-size: .88rem; }
.rx-tree { max-height: 320px; overflow-y: auto; border: 1px solid var(--slate-200); border-radius: 10px; padding: 8px; }
.rx-tree button { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: .9rem; padding: 6px 8px; border-radius: 7px; }
.rx-tree button:hover { background: var(--slate-100); }
.rx-tree .rx-tree__root { font-weight: 700; }
.rx-tree ul.tree { list-style: none; margin: 0; padding-left: 16px; }
.rx-tree details > summary { cursor: pointer; }
.rx-tree details > summary > button { display: inline-block; width: calc(100% - 22px); }

/* Même arborescence, employée pour choisir où DUPLIQUER un hexagone : dossiers dessinés
   au trait, branches interdites éteintes (un dossier ne s'accueille pas lui-même) et
   dossier ouvert signalé — c'est la destination que l'on cherche neuf fois sur dix. */
/* inline-flex (et non flex) : dans un <summary>, le bouton doit rester sur la ligne du
   marqueur de dépliage, sinon la flèche se retrouve seule au-dessus du nom du dossier. */
.rx-tree--dup button,
.rx-tree--dup details > summary > button { display: inline-flex; align-items: center; gap: 8px; }
.rx-tree--dup details > summary > button { width: calc(100% - 22px); }
.rx-tree--dup details > summary::marker { color: var(--slate-400); }
.rx-tree--dup + .modal__hint { margin-top: 12px; }
.rx-tree--dup button svg { width: 16px; height: 16px; flex: none; color: var(--slate-400); transition: color .12s ease; }
.rx-tree--dup button:hover svg { color: var(--primary); }
.rx-tree--dup button[disabled] { opacity: .4; cursor: not-allowed; }
.rx-tree--dup button[disabled]:hover { background: none; }
.rx-tree--dup button[disabled]:hover svg { color: var(--slate-400); }
.rx-tree--dup .is-current { background: var(--slate-100); font-weight: 700; }
.rx-tree--dup .is-current::after { content: "dossier ouvert"; margin-left: auto; padding-left: 8px;
    font-size: .72rem; font-weight: 600; color: var(--slate-400); }

/* Modale « Partager » : bloc envoi à un enseignant */
.sm-item { font-weight: 600; margin: 0 0 8px; }
.sm-reseau { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--slate-200); }
.sm-reseau__h { margin: 0 0 8px; font-size: .95rem; }
.sm-feedback { font-size: .86rem; font-weight: 600; margin: 4px 0 8px; }
.sm-feedback.is-ok { color: #15803d; }
.sm-feedback.is-err { color: #b91c1c; }

/* =========================================================================
   Administration (superadmin) : sous-nav, cartes de stats, tableaux, bandeau
   d'impersonation.
   ========================================================================= */

.admin { max-width: var(--maxw); margin: 0 auto; }
.admin__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.admin-nav {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin: 0 0 18px; padding: 6px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.admin-nav__link {
    padding: 8px 14px; border-radius: 10px;
    color: var(--slate-600); font-weight: 600; text-decoration: none;
}
.admin-nav__link:hover { background: var(--slate-100); text-decoration: none; }
.admin-nav__link.is-on { background: var(--primary); color: #fff; }

.admin-stats {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.admin-stat {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.admin-stat__value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.admin-stat__label { color: var(--muted); font-size: .85rem; }
.admin-stat__detail { color: var(--slate-400); font-size: .78rem; }

.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .admin-cols { grid-template-columns: 1fr; } }

.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin-hint { color: var(--muted); font-size: .9rem; margin-top: 0; }
.admin-subtitle { margin: 14px 0 6px; font-size: .95rem; }

.admin-table__wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td {
    padding: 8px 10px; text-align: left; vertical-align: middle;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.admin-table tr.is-blocked td { opacity: .55; }
.admin-table tr.is-blocked td.admin-actions { opacity: 1; }

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-actions--row { padding-top: 4px; }

.btn--sm { padding: 4px 10px; font-size: .82rem; }

.admin-badge {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    background: #eef2ff; color: var(--primary-d);
    font-size: .72rem; font-weight: 700; vertical-align: middle;
}
.admin-badge--off { background: #fee2e2; color: #b91c1c; }

.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-list li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.admin-list__meta { color: var(--slate-400); font-size: .82rem; margin-left: auto; }
.admin-list__empty { color: var(--muted); font-style: italic; }
.admin-list--meta li { display: block; }

.admin-filtres { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.field--inline { flex-direction: column; min-width: 160px; }
.admin-textarea { resize: vertical; min-height: 160px; font-family: inherit; }

/* ---- Page « Maintenance » (/admin/maintenance, js/admin-maintenance.js) ---------------
   Bandeau (mode, alertes, travail en cours), quatre onglets par ancre, page de reprise.
   Tout est préfixé .admin-maint ; les cartes, tableaux, badges et boutons sont ceux de
   l'administration. Pas de règle [hidden] globale dans ce fichier : elle est posée ici, car
   plusieurs de ces blocs ont un display propre qui l'écraserait. Lisible jusqu'à 360 px. */
.admin-maint [hidden] { display: none !important; }
.admin-maint--reprise { max-width: 720px; }
.admin-maint > .profil-card, .admin-maint-banner { margin-bottom: 18px; }
.admin-maint .profil-card .card__title { overflow-wrap: anywhere; }
@media (max-width: 480px) { .admin-maint .profil-card { padding: 16px 14px 18px; } }

/* Bandeau : mode maintenance à côté des alertes (l'un sous l'autre sur écran étroit). */
.admin-maint-banner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-maint-banner > .profil-card { margin: 0; }
@media (max-width: 760px) { .admin-maint-banner { grid-template-columns: minmax(0, 1fr); } }
.admin-maint-mode__etat { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-maint-badge--ok { background: #dcfce7; color: #166534; }

.admin-maint-alertes__liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-maint-alerte { padding: 9px 12px; border-radius: 10px; border: 1px solid; font-size: .9rem; overflow-wrap: anywhere; }
.admin-maint-alerte--alerte { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.admin-maint-alerte--info   { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* Message sous une action (succès, erreur, information). Vide, il se replie sans quitter l'arbre
   d'accessibilité : une zone live passée en display:none n'annonce pas ce qu'on y écrit. */
.admin-maint-fb { margin: 10px 0 0; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px;
    font-size: .92rem; white-space: pre-line; overflow-wrap: anywhere; }
.admin-maint-fb:empty { margin: 0; padding: 0; border: 0; }
.admin-maint-fb[data-maint-fb="haut"]:not(:empty) { margin: 0 0 18px; }
.admin-maint-mode .admin-actions { margin-top: 12px; }
.admin-maint-fb.is-ok   { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.admin-maint-fb.is-err  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.admin-maint-fb.is-info { background: var(--slate-100); color: var(--slate-700); border-color: var(--border); }

.admin-maint-indispo { margin: 8px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #fecaca;
    background: #fef2f2; color: #991b1b; font-size: .92rem; overflow-wrap: anywhere; }

/* Travail en cours ou interrompu. */
.admin-maint-travail { border-left: 5px solid var(--primary); }
.admin-maint-travail__statut { margin: 0 0 4px; font-weight: 700; overflow-wrap: anywhere; }
.admin-maint-travail__statut.is-run  { color: var(--primary-d); }
.admin-maint-travail__statut.is-warn { color: #92400e; }
.admin-maint-travail__statut.is-err  { color: #b91c1c; }
.admin-maint-travail__statut.is-ok   { color: #15803d; }
.admin-maint-travail__meta { margin: 0 0 12px; color: var(--muted); font-size: .85rem; }
.admin-maint-travail__meta:empty { display: none; }
.admin-maint-libelle { margin: 6px 0 0; color: var(--slate-600); font-size: .9rem; overflow-wrap: anywhere; }
.admin-maint-erreur { margin: 12px 0; padding: 10px 12px; border: 1px solid #fecaca; border-radius: 10px;
    background: #fef2f2; color: #991b1b; }
.admin-maint-erreur__msg { margin: 0; font-weight: 700; white-space: pre-line; overflow-wrap: anywhere; }
.admin-maint-erreur__detail { margin: 8px 0 0; padding: 8px; max-height: 220px; overflow: auto; border-radius: 8px;
    background: rgba(255, 255, 255, .7); color: #7f1d1d; white-space: pre-wrap; overflow-wrap: anywhere;
    font: .8rem/1.4 ui-monospace, 'Cascadia Code', Consolas, monospace; }
.admin-maint-erreur__detail:empty { display: none; }

/* Barre de progression (déterminée ou, sans valeur, qui défile). */
.admin-maint-progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 14px;
    border: 0; border-radius: 999px; overflow: hidden; background: var(--slate-200); accent-color: var(--primary); }
.admin-maint-progress::-webkit-progress-bar   { background: var(--slate-200); }
.admin-maint-progress::-webkit-progress-value { background: var(--primary); transition: width .2s ease; }
.admin-maint-progress::-moz-progress-bar      { background: var(--primary); }
.admin-maint-progress:indeterminate { background: linear-gradient(90deg, var(--slate-200) 0, var(--primary) 50%, var(--slate-200) 100%) 0 0 / 200% 100%;
    animation: admin-maint-defile 1.3s linear infinite; }
.admin-maint-progress:indeterminate::-webkit-progress-bar { background: transparent; }
@keyframes admin-maint-defile { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .admin-maint-progress:indeterminate { animation: none; } }

/* Envoi d'une sauvegarde. */
.admin-maint-envoi { display: grid; gap: 6px; justify-items: start; margin: 10px 0 0; }
.admin-maint-envoi .admin-maint-libelle { margin: 0; }

/* Onglets. */
.admin-maint-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; padding: 6px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-maint-tab { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 14px; border: 0; border-radius: 10px; background: transparent;
    color: var(--slate-600); font: inherit; font-weight: 600; cursor: pointer; }
.admin-maint-tab:hover { background: var(--slate-100); }
.admin-maint-tab[aria-selected="true"] { background: var(--primary); color: #fff; }
.admin-maint-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.admin-maint-tab__n { min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: .72rem; font-weight: 700; line-height: 1.6; text-align: center; }
@media (max-width: 560px) { .admin-maint-tab { flex: 1 1 auto; } }

/* Contenu des onglets. */
.admin-maint-callout { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #c7d2fe; border-radius: 12px; background: #eef2ff; }
.admin-maint-callout p { margin: 0 0 10px; }
.admin-maint-callout .admin-hint { margin: 10px 0 0; }
.admin-maint-details { margin-top: 12px; }
.admin-maint-details > summary { cursor: pointer; padding: 4px 0; font-weight: 600; color: var(--slate-700); }
.admin-maint-fichiers { margin: 6px 0 0; padding-left: 18px; max-height: 260px; overflow: auto;
    font-size: .86rem; overflow-wrap: anywhere; }
.admin-maint-nom { color: var(--slate-400); font-size: .75rem; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }
.admin-maint-cellule { white-space: normal !important; overflow-wrap: anywhere; min-width: 14rem; }
.admin-maint-ko { color: #b91c1c; font-weight: 700; }
.admin-maint-stat--alerte { border-color: #fecaca; background: #fef2f2; }
.admin-maint-detail > td { padding: 0 10px 10px; white-space: normal; }

/* Étroit : les tableaux d'ACTIONS (migrations en attente, sauvegardes) s'empilent en fiches — sinon
   les boutons restent hors d'écran, à droite d'une colonne de dates. */
@media (max-width: 560px) {
    .admin-maint-cartes, .admin-maint-cartes tbody, .admin-maint-cartes tr, .admin-maint-cartes td { display: block; }
    .admin-maint-cartes thead { display: none; }
    .admin-maint-cartes tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
    .admin-maint-cartes td { padding: 3px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
    .admin-maint-cartes td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); font-size: .8rem; }
}

.admin-maint-type { background: var(--slate-100); color: var(--slate-700); }
.admin-maint-type--manuel { background: #eef2ff; color: var(--primary-d); }
.admin-maint-type--auto { background: #ecfdf5; color: #047857; }
.admin-maint-type--avant-migration, .admin-maint-type--avant-restauration { background: #fef3c7; color: #92400e; }
.admin-maint-type--importe { background: #f3e8ff; color: #6b21a8; }

/* Santé : listes clé/valeur, extensions, dossiers. */
.admin-maint-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 8px; }
.admin-maint-kv dt { color: var(--muted); font-size: .88rem; }
.admin-maint-kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .admin-maint-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .admin-maint-kv dd { margin-bottom: 8px; }
}
.admin-maint-note { color: var(--muted); font-size: .85rem; }
.admin-maint-ext { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.admin-maint-dossiers { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-maint-ext li, .admin-maint-dossiers li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Bandeau d'impersonation -------------------------------------------- */
.impersonation-banner {
    position: sticky; top: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
    padding: 8px 16px;
    background: #fef3c7; color: #92400e;
    border-bottom: 2px solid #f59e0b;
    font-size: .92rem;
}
.impersonation-banner__btn {
    border: 1px solid #f59e0b; border-radius: 999px;
    background: #fff; color: #92400e;
    padding: 4px 14px; font-weight: 700; cursor: pointer;
}
.impersonation-banner__btn:hover { background: #f59e0b; color: #fff; }

/* ==========================================================================
   Module Évaluations — builder enseignant (/evaluation) + révisions élève
   ========================================================================== */

/* Hexagone « leçon » (vert Cours) — clip-path/nom/icône hérités de .hm-hex. */
.hm-hex--lecon { background: linear-gradient(150deg, #34d399, #059669); }

/* Sous-titre (date d'évaluation) du triangle « À venir » du menu élève. */
.hexmenu .wedge__sub { font-size: 13px; font-weight: 600; opacity: .95; }

/* ---- Bloc « Évaluations à venir » (sidebar /aujourdhui) ------------------ */
.dash__side-head--evals { margin-top: 26px; }
.dash-evals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dash-eval { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.dash-eval__dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---- Builder : en-tête ---------------------------------------------------- */
.evbuild__topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.evbuild__back { font-weight: 600; color: var(--primary); text-decoration: none; }
.evbuild__back:hover { text-decoration: underline; }
.evbuild__saved { opacity: 0; transition: opacity .25s ease; font-weight: 700; color: #047857; }
.evbuild__saved.is-on { opacity: 1; }
.evbuild__card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.evbuild__classe { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--slate-700); margin-bottom: 8px; }
.evbuild__titre { width: 100%; border: 0; border-bottom: 2px solid transparent; font-size: 1.45rem; font-weight: 800;
    color: var(--slate-900); padding: 2px 0 6px; background: none; }
.evbuild__titre:focus { outline: none; border-bottom-color: var(--primary); }
.evbuild__meta { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin: 10px 0; }
.evbuild__actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.evbuild__hint { color: var(--slate-500); font-size: .85rem; margin: 4px 0 12px; }
.modal__hint { color: var(--slate-500); font-size: .85rem; margin: -4px 0 12px; }

/* Bascule « Visible par les élèves » (brouillon ↔ publiée) */
.evbuild__pub { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; padding-bottom: 6px; }
.evbuild__pub input { position: absolute; opacity: 0; pointer-events: none; }
.evbuild__pub-slider { width: 40px; height: 22px; border-radius: 999px; background: var(--slate-300); position: relative; transition: background .15s ease; flex: none; }
.evbuild__pub-slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.evbuild__pub input:checked + .evbuild__pub-slider { background: #047857; }
.evbuild__pub input:checked + .evbuild__pub-slider::after { left: 21px; }
.evbuild__pub input:focus-visible + .evbuild__pub-slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.evbuild__pub-label { font-weight: 700; color: var(--slate-700); }

/* ---- Builder : deux colonnes (programme | sélecteur), empilées < 900 px --- */
.evbuild__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .evbuild__cols { grid-template-columns: 1fr; } }
.evbuild__picker { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.evbuild__tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.evbuild__tab { border-radius: 999px; }
.evbuild__tab.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Pile du programme (petite marge ~0,5 mm entre hexagones) ------------- */
.rv-stack { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rv-item { position: relative; width: 190px; height: 165px; }
.rv-item.is-dragging { z-index: 30; }
.rv-item.is-dragging .hm-hex { filter: brightness(1.1) drop-shadow(0 10px 16px rgba(15,23,42,.4)); }
.rv-item--placeholder { border: 2px dashed var(--primary); border-radius: 14px; background: rgba(79,70,229,.06); height: 60px; margin: 4px 0; width: 190px; }
/* Titre au centre de l'hexagone (partie la plus large), icône remontée. */
.rv-item .hm-hex__ic { inset: 10% 0 64%; }
.rv-item .hm-hex__ic svg { width: 30px; height: 30px; }
.rv-item .hm-hex__name { font-size: .8rem; padding: 0 26px; -webkit-line-clamp: 3; }
.rv-item__grip { position: absolute; top: 50%; left: -6px; transform: translateY(-50%); background: #fff;
    border: 1px solid var(--border); border-radius: 8px; width: 26px; height: 34px; cursor: grab;
    color: var(--slate-500); font-size: .95rem; touch-action: none; z-index: 3; }
.rv-item__grip:active { cursor: grabbing; }
.rv-item__x { position: absolute; top: 14px; right: 4px; background: #fff; border: 1px solid var(--border);
    border-radius: 50%; width: 24px; height: 24px; cursor: pointer; color: #b91c1c; font-size: .8rem; line-height: 1; z-index: 3; }
.rv-item__x:hover { background: #fee2e2; }
.rv-item__stat { position: absolute; bottom: 14px; right: 0; background: #ecfdf5; color: #047857;
    border: 1px solid #a7f3d0; border-radius: 999px; padding: 2px 8px; font-size: .72rem; font-weight: 700; z-index: 3; }
.rv-empty { width: 190px; height: 165px; clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: var(--slate-100); display: grid; place-items: center; color: var(--slate-500);
    font-size: .85rem; font-weight: 600; text-align: center; padding: 0 30px; }
/* `display: grid` l'emporte sur le `display: none` de [hidden] : sans cette ligne, l'hexagone
   « Glissez des ressources ici » restait sous une pile PLEINE, et le glisser-déposer visait
   une zone occupée par un leurre. Le code JS posait pourtant bien l'attribut. */
.rv-empty[hidden] { display: none; }

/* ---- Sélecteur : onglet Cours (niveaux/chapitres dépliants) ---------------- */
.evpick-niveau { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; padding: 0 10px; }
.evpick-niveau > summary { font-weight: 800; padding: 10px 2px; cursor: pointer; color: var(--slate-800); }
.evpick-chapitre { margin: 2px 0 8px 10px; }
.evpick-chapitre > summary { font-weight: 700; padding: 6px 2px; cursor: pointer; color: var(--slate-600); }
.evpick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px;
    margin: 3px 0 3px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    cursor: grab; user-select: none; }
.evpick-row__t { font-size: .88rem; color: var(--slate-800); }
.evpick-row__add, .evpick-hex__add { flex: none; width: 26px; height: 26px; border-radius: 50%;
    border: 1px solid var(--primary); background: #fff; color: var(--primary); font-weight: 800;
    cursor: pointer; line-height: 1; }
.evpick-row__add:hover, .evpick-hex__add:hover { background: var(--primary); color: #fff; }

/* ---- Sélecteur : onglet Documents (fil d'Ariane + chips + hexagones) ------- */
.evpick-bc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 10px; }
.evpick-bc__item { border: 0; background: none; color: var(--primary); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.evpick-bc__item.is-cur { color: var(--slate-700); cursor: default; }
.evpick-bc__sep { color: var(--slate-400); }
.evpick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.evpick-chip { border: 1px solid var(--border); background: var(--slate-100); border-radius: 999px;
    padding: 4px 12px; cursor: pointer; font-weight: 600; color: var(--slate-700); }
.evpick-chip:hover { background: var(--slate-200); }
.evpick-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.evpick-hex { position: relative; width: 128px; height: 111px; cursor: grab; user-select: none; }
.evpick-hex .hm-hex__ic { inset: 10% 0 64%; }
.evpick-hex .hm-hex__ic svg { width: 22px; height: 22px; }
.evpick-hex .hm-hex__name { font-size: .7rem; padding: 0 18px; -webkit-line-clamp: 3; }
.evpick-hex__add { position: absolute; top: 2px; right: 10px; z-index: 3; }
.evpick-empty { color: var(--slate-500); padding: 12px 4px; }
.evpick-ghost { position: fixed; z-index: 400; pointer-events: none; background: var(--slate-800); color: #fff;
    padding: 6px 12px; border-radius: 8px; font-size: .85rem; font-weight: 600;
    box-shadow: 0 10px 18px rgba(15,23,42,.3); opacity: .92; max-width: 240px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.evpick-ghost.is-ok { background: #047857; }

/* ---- Onglet « Estrade » du sélecteur de séance : catalogue d'écrans (migration 078) ----
   Une carte = un écran, montré tel qu'il s'affichera au tableau (aperçu 16:9, dessiné par
   App\Models\EcranModele tant que l'écran n'a pas été ouvert). Un clic pose une copie dans
   la pile de la séance ; on peut aussi glisser la carte pour choisir sa place. */
.se-ecrans { max-height: 430px; }
.ecpick-sec { margin-bottom: 14px; }
.ecpick-sec__t { margin: 6px 0; font-size: .72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .05em; color: var(--slate-500); }
.ecpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 8px; }
.ecpick { position: relative; display: block; width: 100%; padding: 0; text-align: left; cursor: pointer;
    background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; user-select: none;
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.ecpick:hover { border-color: var(--acc-estrade-1); box-shadow: 0 6px 16px rgba(6,182,212,.18); transform: translateY(-1px); }
.ecpick:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ecpick__vue { display: block; aspect-ratio: 16 / 9; background: #f8fafc; border-bottom: 1px solid var(--slate-100); }
.ecpick__img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ecpick__vue--neuf { display: grid; place-items: center; font-size: 1.9rem; font-weight: 300;
    color: var(--acc-estrade-2); background: #ecfeff; }
.ecpick__t { padding: 5px 7px; font-size: .74rem; font-weight: 700; line-height: 1.15; color: var(--slate-800);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ecpick--neuf { border-style: dashed; }
.ecpick__tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px;
    opacity: 0; transition: opacity .12s ease; }
.ecpick:hover .ecpick__tools, .ecpick:focus-within .ecpick__tools { opacity: 1; }
.ecpick__tool { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; font-size: .72rem;
    border: 1px solid var(--border); border-radius: 6px; background: rgba(255,255,255,.96); cursor: pointer; }
.ecpick__tool:hover { background: var(--slate-100); }
.ecpick__tool--danger:hover { background: #fee2e2; }

/* Écran d'Estrade dans la pile de la séance : l'aperçu tient lieu d'icône, le titre passe
   dessous, et l'hexagone entier est un bouton — un clic ouvre l'écran dans l'Estrade. */
.hm-hex--ecran { background: linear-gradient(150deg, var(--acc-estrade-1), var(--acc-estrade-2)); }
.rv-item--ecran .hm-hex { cursor: pointer; }
.rv-item__apercu { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); width: 54%;
    aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border-radius: 3px;
    box-shadow: 0 2px 6px rgba(15,23,42,.35); }
.rv-item--ecran .hm-hex__name { top: auto; bottom: 11px; transform: none; font-size: .74rem;
    padding: 0 30px; -webkit-line-clamp: 2; }

/* ---- Révisions élève (mobile-first) ---------------------------------------- */
.rv-jx { display: inline-block; background: #7c3aed; color: #fff; border-radius: 999px;
    padding: 2px 10px; font-size: .78rem; font-weight: 800; margin-left: 8px; white-space: nowrap; }
.rv-progress { height: 10px; border-radius: 999px; background: var(--slate-200); overflow: hidden;
    margin-top: 10px; max-width: 420px; }
.rv-progress > span { display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #a78bfa, #7c3aed); transition: width .25s ease; }
.rv-head__date { margin: 6px 0 0; color: var(--slate-600); }
.rv-head__desc { margin: 8px 0 0; color: var(--slate-700); }
.rv-head__prog { margin: 6px 0 0; color: var(--slate-500); font-size: .85rem; }

.rv-cards { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.rv-card { display: block; border: 1px solid var(--border); border-radius: 14px; background: #fff;
    padding: 14px 16px; text-decoration: none; color: inherit; }
.rv-card:hover { border-color: var(--primary); }
.rv-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rv-card .rv-jx { margin-left: 0; }
.rv-card__date { color: var(--slate-500); font-size: .85rem; font-weight: 600; }
.rv-card__titre { font-weight: 800; font-size: 1.05rem; margin-top: 6px; color: var(--slate-900); }
.rv-card__prog { color: var(--slate-500); font-size: .82rem; margin-top: 4px; }

.rv-stack--eleve { margin-top: 18px; }
.rv-stack--eleve .rv-item { width: auto; height: auto; margin-top: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rv-stack--eleve .rv-item .hm-hex { width: 176px; height: 153px; text-decoration: none; }
.rv-stack--eleve .rv-item.is-done .hm-hex { filter: saturate(.65) opacity(.85); }
.rv-check { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border);
    border-radius: 999px; background: #fff; color: var(--slate-600); font-weight: 700;
    font-size: .85rem; padding: 6px 14px; cursor: pointer; }
.rv-check__box { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--slate-300);
    display: grid; place-items: center; color: transparent; font-size: .7rem; transition: all .15s ease; }
.rv-check.is-on { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.rv-check.is-on .rv-check__box { border-color: #047857; background: #047857; color: #fff; }

/* ---- Mon réseau : consultation d'un hexagone reçu (modale / pleine page) ---- */
.rxv-hint { color: var(--slate-500); font-size: .9rem; }
.rxv-tree { list-style: none; margin: 8px 0 0; padding: 0; }
.rxv-tree ul { list-style: none; margin: 4px 0 10px; padding-left: 22px; border-left: 2px solid var(--border); }
.rxv-folder__name { font-weight: 700; color: var(--slate-700); }
.rxv-doc { padding: 3px 0; }
.rxv-doc a { color: var(--primary); font-weight: 600; text-decoration: none; }
.rxv-doc a:hover { text-decoration: underline; }
.rxv-type { font-size: .72rem; font-weight: 700; color: var(--slate-500); background: var(--slate-100);
    border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.rxv-empty { color: var(--slate-400); font-style: italic; padding: 2px 0; }

/* ---- Séance en cours : bandeau dans la topbar noire --------------------- */
.sbar { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px; padding: 5px 8px 5px 14px; max-width: 620px; }
.sbar__rec { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; flex: none;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); animation: sbar-pulse 2s infinite; }
@keyframes sbar-pulse { 70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.sbar.is-paused .sbar__rec { background: var(--slate-400, #94a3b8); animation: none; }

.sbar__ctx { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: #fff; }
.sbar__ctx:hover { text-decoration: none; }
.sbar__ctx:hover .sbar__classe { text-decoration: underline; }
.sbar__classe { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbar__horaire { color: var(--slate-300, #cbd5e1); font-size: .84rem; white-space: nowrap; }
.sbar__chrono { font-variant-numeric: tabular-nums; font-weight: 600; color: #e2e8f0;
    background: rgba(0, 0, 0, .28); border-radius: 6px; padding: 2px 8px; font-size: .86rem; }

.sbar__play { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    background: #16a34a; color: #fff; border-radius: 999px; padding: 4px 12px 4px 10px; font-size: .82rem; font-weight: 700; }
.sbar.is-paused .sbar__play { background: var(--slate-600, #475569); }
/* Triangle « lecture » en CSS pur : pas d'emoji, cohérent avec le jeu d'icônes de l'Estrade. */
.sbar__tri { width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #fff; }
.sbar.is-paused .sbar__tri { border-width: 0; width: 8px; height: 9px;
    border-left: 3px solid #fff; border-right: 3px solid #fff; }

.sbar__pause, .sbar__stop { border: 0; cursor: pointer; font: inherit; display: inline-flex;
    align-items: center; gap: 6px; border-radius: 999px; }
.sbar__pause { background: rgba(255, 255, 255, .12); color: #fff; width: 30px; height: 30px;
    justify-content: center; font-size: .68rem; }
.sbar__pause:hover { background: rgba(255, 255, 255, .22); }
.sbar__stop { background: #dc2626; color: #fff; padding: 6px 13px; font-size: .8rem; font-weight: 800; letter-spacing: .5px; }
.sbar__stop:hover { background: #b91c1c; }
.sbar__square { width: 9px; height: 9px; background: #fff; border-radius: 1px; flex: none; }
.sbar__count { color: var(--slate-300, #cbd5e1); font-size: .82rem; white-space: nowrap; }
.sbar__sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Photos depuis un téléphone : le QR code s'affiche au centre de l'écran. */
.sbar__qr { border: 0; cursor: pointer; font: inherit; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 999px;
    background: rgba(255, 255, 255, .12); color: #fff; }
.sbar__qr:hover { background: rgba(255, 255, 255, .22); }

/* Rappel flottant quand l'Estrade escamote la topbar : le STOP reste atteignable. */
.sbar-pill { display: none; position: fixed; top: 8px; right: 14px; z-index: 60;
    align-items: center; gap: 10px; background: var(--slate-900, #0f172a); color: #fff;
    border-radius: 999px; padding: 5px 6px 5px 12px; box-shadow: 0 8px 22px rgba(15, 23, 42, .4); }
body.est-nobar .sbar-pill { display: flex; }
.sbar-pill .sbar__stop { padding: 6px 9px; }

@media (max-width: 900px) {
    .sbar { max-width: none; padding-left: 10px; gap: 8px; }
    .sbar__horaire, .sbar__playlbl, .sbar__count { display: none; }
    .sbar__play { padding: 4px 8px; }
}

/* ---- Bilan de fin de séance -------------------------------------------- */
.bilan__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
.bilan__title { margin: 0; font-size: 1.6rem; }
.bilan__meta { margin: 4px 0 0; color: var(--slate-500); }
.bilan__reel { margin: 0; color: var(--slate-500); font-size: .9rem; white-space: nowrap; }
.bilan__duree { display: inline-block; margin-left: 8px; background: var(--slate-100); color: var(--slate-700);
    border-radius: 999px; padding: 2px 10px; font-weight: 700; }

.bilan__card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.bilan__cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bilan__cardhead .dash__h2 { margin: 0; }
.bilan__tools { display: flex; align-items: center; gap: 8px; }
.bilan__compte { color: var(--slate-500); font-size: .86rem; margin-right: 4px; }
.bilan__h3 { font-size: .95rem; color: var(--slate-500); margin: 20px 0 6px; }

.bilan-grid { list-style: none; margin: 12px 0 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.bilan-res { position: relative; display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--border); border-radius: 11px; padding: 8px 10px; background: var(--slate-50, #f8fafc);
    opacity: .55; transition: opacity .15s ease, border-color .15s ease, background .15s ease; }
.bilan-res.is-on { opacity: 1; background: #fff; border-color: #86efac; }
.bilan-res__pick { flex: none; display: inline-flex; cursor: pointer; }
.bilan-res__cb { position: absolute; opacity: 0; width: 0; height: 0; }
.bilan-res__box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--slate-300, #cbd5e1); background: #fff; }
.bilan-res.is-on .bilan-res__box { background: #16a34a; border-color: #16a34a; }
.bilan-res.is-on .bilan-res__box::after { content: '✓'; color: #fff; font-size: .78rem; font-weight: 800;
    display: block; text-align: center; line-height: 16px; }
.bilan-res__cb:focus-visible + .bilan-res__box { outline: 2px solid var(--primary); outline-offset: 2px; }

.bilan-res__ico { font-size: 1.25rem; flex: none; }
.bilan-res__thumb { width: 58px; height: 40px; object-fit: cover; border-radius: 6px; flex: none;
    border: 1px solid var(--border); background: #fff; }
.bilan-res__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.bilan-res__titre { font-weight: 600; color: var(--slate-700); overflow-wrap: anywhere; }
.bilan-res__titre[contenteditable]:focus { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.bilan-res__usage { color: var(--slate-400, #94a3b8); font-size: .76rem; }
.bilan-res__del { border: 0; background: none; color: var(--slate-400, #94a3b8); cursor: pointer;
    font-size: .95rem; padding: 4px; border-radius: 6px; flex: none; }
.bilan-res__del:hover { color: #dc2626; background: #fee2e2; }

.bilan-devoir { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.bilan-devoir #bl-dev-desc { flex: 1; min-width: 220px; }
.bilan-devoir input[type="date"] { max-width: 175px; }

.bilan__foot { border-top: 1px solid var(--border); padding-top: 16px; }
.bilan__actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.bilan__foot .field__hint { text-align: right; margin-top: 8px; }
/* Bloc de fin de page : le texte de la séance prêt à coller dans PRONOTE. Encadré en
   pointillés pour qu'on voie exactement ce qui partira au presse-papiers. */
.bilan-pn__doc { border: 1px dashed var(--slate-300, #cbd5e1); border-radius: 10px; background: var(--slate-50, #f8fafc);
    padding: 14px 16px; margin-top: 10px; overflow-wrap: anywhere; }
.bilan-pn__doc .prose { margin: 0; }
.bilan-pn__t { margin: 0 0 8px; font-size: 1.05rem; }
.bilan-pn__st { margin: 12px 0 4px; }
.bilan-pn__res { margin: 0; padding-left: 20px; }
.bilan-pn__res li { margin: 3px 0; }
.bilan-pn__k { color: var(--muted); font-size: .8rem; }
.bilan-pn__vide { color: var(--muted); }

/* ---- Modale séance : bascule « Séance informatique » ------------------- */
.se-info-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer;
    border: 1px solid #fde68a; background: #fffbeb; border-radius: 12px; padding: 12px 14px; margin: 6px 0 14px; }
.se-info-toggle:hover { background: #fef9c3; }
.se-info-toggle input { width: 20px; height: 20px; accent-color: #d97706; flex: none; }
.se-info-toggle__ic { font-size: 1.3rem; flex: none; }
.se-info-toggle__txt { display: flex; flex-direction: column; line-height: 1.25; }
.se-info-toggle__txt strong { color: #92400e; }
.se-info-toggle__hint { color: var(--slate-500); font-size: .82rem; }

/* ---- Modale séance : onglet « Exercices » (séance informatique, migrations 101-102) ----
   L'onglet n'est qu'une porte : les exercices se choisissent sur la page plein écran
   /cahier/seance/informatique (bloc .sxa plus bas). Il rappelle ceux qui sont déjà posés. */
/* Quatre onglets dans la colonne du sélecteur : ils se resserrent plutôt que de s'étirer. */
.se-tabs { flex-wrap: wrap; gap: 6px; }
.se-tabs .evbuild__tab { padding: 7px 13px; white-space: nowrap; }
.se-exos__intro { margin: 2px 0 12px; font-size: .86rem; color: var(--slate-600, #475569); line-height: 1.45; }
.se-exos__ouvrir { width: 100%; justify-content: center; }
.se-exos__choisis { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.se-exos__choisis li { font-size: .84rem; padding: 5px 8px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--border); }
.se-exos__choisis .exo-carte__code { margin-right: 6px; }
.se-exos__rien { font-size: .82rem; color: var(--muted); margin: 10px 0 0; }
.se-exo-bilan { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; }
.se-exo-bilan[hidden] { display: none; }
.se-exo-bilan__n { font-size: .82rem; color: var(--muted); }

/* ---- Espace élève : bouton jaune « Séance info » dans le menu ---------- */
/* Lien du menu du haut (à côté de Coach) : jaune, animé, bien visible. */
.eleve-nav__link--seance {
    color: #7c2d12; background: linear-gradient(150deg, #fde047, #f59e0b); font-weight: 800;
    box-shadow: 0 3px 10px rgba(245, 158, 11, .4); animation: si-pulse 2.4s ease-in-out infinite;
}
.eleve-nav__link--seance:hover { color: #7c2d12; filter: brightness(1.05); }
@keyframes si-pulse { 0%, 100% { box-shadow: 0 3px 10px rgba(245, 158, 11, .4); }
    50% { box-shadow: 0 3px 16px rgba(245, 158, 11, .7); } }
/* Onglet mobile « Séance » : pastille jaune pour ressortir dans la tabbar. */
.eleve-tab--seance { color: #b45309; }
.eleve-tab--seance svg { color: #f59e0b; }

.si { width: 100%; }
/* Panneau ouvert : les ressources prennent la place du menu (recherche + hexmenu masqués). */
.eleve-home.is-si-open .eleve-home__search,
.eleve-home.is-si-open .hexmenu-wrap { display: none; }
.eleve-home.is-si-open .si { margin-top: 8px; }

.si-panel { width: 100%; max-width: 1100px; }
.si-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.si-panel__title { margin: 0; font-size: 1.35rem; color: #92400e; }
.si-panel__back { border: 1px solid var(--border); background: #fff; border-radius: 999px;
    padding: 8px 16px; font-weight: 700; color: var(--slate-600); cursor: pointer; }
.si-panel__back:hover { background: var(--slate-50); }

/* Hexagones de la séance : titres CENTRÉS au milieu (pas de bandeau bas), liseré au survol. */
.si-canvas { max-width: 100%; }
.si-canvas .hm-hex__ic { top: -14%; }
.si-canvas .hm-hex__name { font-size: .95rem; }
.si-canvas .hm-hex--img .hm-hex__name { z-index: 1; }
.hm-hex--lecon { background: linear-gradient(150deg, var(--acc-cours-1, #34d399), var(--acc-cours-2, #059669)); }

/* Liseré orange : ressource déjà consultée (hexagone orange placé derrière, contenu réduit). */
.si-tile.is-consulted::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: #ea580c;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
.si-tile.is-consulted .hm-hex { position: relative; z-index: 1; transform: scale(.94); }
.si-tile.is-consulted::after { content: "✓ vu"; position: absolute; z-index: 2; top: 12px; right: 22px;
    font-size: .68rem; font-weight: 800; color: #fff; background: #ea580c; border-radius: 999px; padding: 1px 8px; }

/* Exercices en ligne : code couleur de l'hexagone (SeanceExoResultat::etat). Vert = réussi
   (un énoncé tout juste du premier coup), rouge = essais ratés seulement, gris = pas encore
   tenté — le vert d'origine du type « exercice » est réservé à la réussite. Sélecteurs plus
   précis que .hm-hex--exercice : l'ordre dans la feuille ne compte pas. */
.si-tile[data-etat="afaire"] .hm-hex--exercice { background: linear-gradient(150deg, #94a3b8, #475569); }
.si-tile[data-etat="reussi"] .hm-hex--exercice { background: linear-gradient(150deg, #34d399, #047857); }
.si-tile[data-etat="echoue"] .hm-hex--exercice { background: linear-gradient(150deg, #f87171, #b91c1c); }
.si-tile[data-kind="exercice"] .hm-hex__outils { color: #334155; }
.si-tile[data-etat="reussi"] .hm-hex__outils { color: #047857; }
.si-tile[data-etat="echoue"] .hm-hex__outils { color: #b91c1c; }
/* Le liseré orange « vu » n'a plus rien à dire d'un exercice tenté : sa couleur parle pour lui. */
.si-tile.is-consulted[data-etat="reussi"]::before, .si-tile.is-consulted[data-etat="reussi"]::after,
.si-tile.is-consulted[data-etat="echoue"]::before, .si-tile.is-consulted[data-etat="echoue"]::after { content: none; }
.si-tile.is-consulted[data-etat="reussi"] .hm-hex,
.si-tile.is-consulted[data-etat="echoue"] .hm-hex { transform: none; }

@media (max-width: 640px) {
    .si-panel__title { font-size: 1.15rem; }
}

/* ============================================================================
   Fonction — éditeur (fonction-core.js, préfixe fnc-) et consultation.
   Trois registres reliés : expression littérale, tableau de valeurs, repère.
   Le repère est un SVG reconstruit à chaque changement d'état ; seuls le viseur
   de lecture et l'infobulle d'échelle sont des calques HTML au-dessus (ils ne
   doivent PAS déclencher de nouveau rendu au simple survol).
   ========================================================================= */
.modal__box--fonction { max-width: 1180px; width: 96vw; }

/* Hexagone : dégradé du type + miniature de la courbe en fond (previews()). */
.hm-hex--fonction { background: linear-gradient(150deg, #38bdf8, #0369a1); }
.hm-hex--fonction .hm-hex__ic svg { width: 46%; height: 46%; }
.hm-hex--fonctionbg { background: linear-gradient(150deg, #f0f9ff, #bae6fd); }
.hm-hex--fonctionbg .hm-hex__ic { display: none; }
.hm-hex__fonction { position: absolute; inset: 16% 17%; display: grid; place-items: center; pointer-events: none; }
.hm-hex__fonction svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.hm-hex--fonctionbg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

/* ---- barre d'outils ---- */
.fnc-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 4px; }
.fnc-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fnc-sep { width: 1px; height: 20px; background: var(--slate-100); }
.fnc-chip { border: 1px solid var(--border); background: #fff; color: var(--slate-700); font: inherit;
    font-size: .78rem; padding: 4px 11px; border-radius: 99px; cursor: pointer; transition: .15s; }
.fnc-chip:hover { border-color: #0284c7; color: #0369a1; background: #f0f9ff; }
.fnc-chip b { font-weight: 700; font-style: normal; }
.fnc-modes .fnc-chip.is-on { background: #0369a1; border-color: #0369a1; color: #fff; }
.fnc-vues { font-size: .74rem; color: var(--muted); gap: 10px; }
.fnc-vues__t { font-weight: 600; }
.fnc-vues label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fnc-hint { color: var(--muted); font-size: .74rem; margin: 0 2px 8px; line-height: 1.5; }
.fnc-hint code { background: var(--slate-50, #f1f5f9); border-radius: 4px; padding: 0 3px; }

/* ---- disposition : repère à gauche, registres symboliques à droite ---- */
.fnc-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.fnc-graphwrap { position: relative; min-width: 0; }
.fnc-graph { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.fnc-graph svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.fnc-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fnc-card { border: 1px solid var(--slate-100); border-radius: 12px; padding: 10px 12px 12px; background: #fff; }
.fnc-card__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fnc-card__t { font-size: .78rem; font-weight: 700; color: var(--slate-700); }
.fnc-tag { font-size: .64rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
    background: #e0f2fe; color: #075985; border-radius: 99px; padding: 2px 8px; }
.fnc-tag--der { background: var(--slate-50, #f1f5f9); color: var(--muted); }

/* ---- expression ---- */
.fnc-expr__row { display: flex; align-items: center; gap: 3px; font-size: .95rem; color: var(--slate-700); }
.fnc-expr__nom, .fnc-expr__var { width: 2.1em; border: 1px dashed transparent; background: none; font: inherit;
    font-style: italic; font-weight: 600; text-align: center; border-radius: 5px; padding: 2px 0; color: #0369a1; }
.fnc-expr__var { width: 1.6em; }
.fnc-expr__nom:hover, .fnc-expr__var:hover, .fnc-expr__nom:focus, .fnc-expr__var:focus {
    border-color: #7dd3fc; outline: none; background: #f0f9ff; }
.fnc-expr__in { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
    font: inherit; font-size: .95rem; background: #fff; }
.fnc-expr__in:focus { outline: none; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, .15); }
.fnc-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.fnc-keys button { border: 1px solid var(--slate-100); background: #f8fafc; border-radius: 7px; cursor: pointer;
    font: inherit; font-size: .78rem; min-width: 30px; padding: 3px 7px; color: var(--slate-700); }
.fnc-keys button:hover { background: #f0f9ff; border-color: #0284c7; color: #0369a1; }
.fnc-msg { font-size: .74rem; margin: 7px 0 0; color: var(--muted); }
.fnc-msg--ok { color: #059669; }
.fnc-msg--err { color: #dc2626; }
.fnc-adopt { margin-top: 8px; border: 1px solid #7dd3fc; background: #f0f9ff; color: #0369a1; font: inherit;
    font-size: .76rem; font-weight: 600; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.fnc-adopt:hover { background: #e0f2fe; }

/* ---- curseurs de paramètres (a, b, k… repérés dans l'expression) ---- */
.fnc-params:not(:empty) { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fnc-param { display: flex; align-items: center; gap: 8px; }
.fnc-param__n { width: 1.3em; font-style: italic; font-weight: 700; color: #0369a1; }
.fnc-param input[type="range"] { flex: 1; min-width: 0; accent-color: #0284c7; }
.fnc-param__v { width: 4.4em; border: 1px solid var(--slate-100); border-radius: 6px; padding: 2px 5px;
    font: inherit; font-size: .78rem; text-align: right; }

/* ---- tableau de valeurs (disposition horizontale, convention française) ---- */
/* padding-bottom : Firefox dessine l'ascenseur horizontal PAR-DESSUS le contenu
   (barres en surimpression) — sans cette réserve il barre la ligne f(x).
   Pas de scrollbar-gutter ici : il forcerait dans Chrome un ascenseur classique
   permanent (avec flèches) là où il n'apparaît aujourd'hui qu'au survol. */
.fnc-tabwrap { overflow-x: auto; padding-bottom: 8px; }
table.fnc-tab { border-collapse: collapse; font-size: .82rem; }
table.fnc-tab th { background: var(--slate-50, #f1f5f9); color: var(--slate-700); font-weight: 700;
    padding: 3px 9px; border: 1px solid var(--slate-100); white-space: nowrap; font-style: italic; }
table.fnc-tab td { border: 1px solid var(--slate-100); padding: 0; }
table.fnc-tab td input { width: 4.6em; border: none; background: none; font: inherit; font-size: .82rem;
    text-align: center; padding: 4px 2px; }
table.fnc-tab td input:focus { outline: 2px solid #0284c7; outline-offset: -2px; background: #f0f9ff; }
table.fnc-tab td input.is-derived { color: var(--muted); background: #fafbfc; }
.fnc-cell { position: relative; }
.fnc-cdel { position: absolute; top: -9px; right: -7px; z-index: 3; width: 16px; height: 16px; border: none;
    border-radius: 50%; background: #dc2626; color: #fff; font-size: 9px; line-height: 16px; text-align: center;
    padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s; font-family: inherit; }
.fnc-cell:hover .fnc-cdel, .fnc-cdel:focus { opacity: 1; }
.fnc-tab__addcell { border: none !important; vertical-align: middle; padding-left: 6px !important; }
.fnc-tab__add { width: 24px; height: 24px; border-radius: 50%; border: 1.6px dashed #94a3b8; background: none;
    color: #94a3b8; font-size: 14px; line-height: 1; cursor: pointer; transition: .15s; }
.fnc-tab__add:hover { border-color: #0284c7; color: #0369a1; }
.fnc-gen { margin-top: 9px; font-size: .74rem; color: var(--muted); display: flex; align-items: center;
    gap: 5px; flex-wrap: wrap; }
.fnc-gen input { width: 3.6em; border: 1px solid var(--slate-100); border-radius: 6px; padding: 2px 5px;
    font: inherit; font-size: .76rem; text-align: center; }

/* ---- calques posés sur le repère ---- */
.fnc-read { position: absolute; left: 10px; top: 8px; z-index: 4; pointer-events: none;
    background: rgba(255, 255, 255, .93); border: 1px solid var(--slate-100); border-radius: 8px;
    padding: 3px 9px; font-size: .76rem; font-weight: 600; color: var(--slate-700);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .07); }
.fnc-tip { position: absolute; z-index: 5; pointer-events: none; background: #0f172a; color: #fff;
    border-radius: 7px; padding: 3px 8px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
/* Indispensable : les display:flex / display:grid ci-dessous l'emporteraient sinon sur
   l'attribut [hidden] — les calques resteraient visibles une fois « fermés ». */
.fnc-read[hidden], .fnc-tip[hidden], .fnc-axpanel[hidden] { display: none; }
.fnc-axpanel { position: absolute; right: 8px; top: 8px; z-index: 6; background: #fff;
    border: 1px solid var(--slate-100); border-radius: 11px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
    padding: 9px 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: .74rem;
    color: var(--slate-700); }
.fnc-axpanel label { display: flex; align-items: center; gap: 5px; }
.fnc-axpanel input[type="text"] { width: 4em; border: 1px solid var(--slate-100); border-radius: 6px;
    padding: 2px 5px; font: inherit; font-size: .74rem; text-align: right; }
.fnc-axpanel select { border: 1px solid var(--slate-100); border-radius: 6px; font: inherit; font-size: .74rem; padding: 2px; }
.fnc-axpanel .fnc-chip { grid-column: span 2; justify-self: end; }

/* Poignées d'axe : glisser la flèche (ou l'axe) change l'échelle — l'affordance
   doit être visible au survol, sinon personne ne devine le geste. */
.fnc-graph .fnc-axgrab { cursor: ew-resize; }
.fnc-graph .fnc-axgrab[data-axis="y"] { cursor: ns-resize; }
.fnc-graph .fnc-axgrab:hover .fnc-arrow { stroke: #0284c7; stroke-width: 2.8; }
.fnc-graph .fnc-axgrab:hover line:first-child { stroke: #0284c7; }
.fnc-graph .fnc-pt { cursor: grab; }
.fnc-graph .fnc-pt:active { cursor: grabbing; }
.fnc-graph .fnc-pt:hover .fnc-pt__d { r: 5.8; }
.fnc-graph .fnc-pt__del { opacity: 0; transition: opacity .12s; cursor: pointer; }
.fnc-graph .fnc-pt:hover .fnc-pt__del { opacity: 1; }

/* ---- consultation (visionneuse, espace élève, impression) ---- */
.fnc-view { padding: 6px 2px; }
.fnc-view__msg { color: var(--muted); padding: 24px; text-align: center; }
.fnc-view__expr { font-size: 1.05rem; color: var(--ink, #0f172a); margin: 0 0 10px; }
.fnc-view__f { font-style: italic; font-weight: 700; color: #0369a1; }
.fnc-view__b { font-weight: 600; }
.fnc-badge { font-size: .68rem; font-weight: 700; background: #dcfce7; color: #166534;
    border-radius: 99px; padding: 2px 8px; vertical-align: middle; }
.fnc-badge--approx { background: #fef3c7; color: #92400e; }
.fnc-view__graph { overflow-x: auto; }
.fnc-view__graph svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.fnc-view__tab { margin-top: 12px; overflow-x: auto; }
.fnc-view__tab table { border-collapse: collapse; font-size: .88rem; margin: 0 auto; }
.fnc-view__tab th, .fnc-view__tab td { border: 1px solid var(--slate-100); padding: 5px 12px; text-align: center; }
.fnc-view__tab th { background: var(--slate-50, #f1f5f9); font-style: italic; white-space: nowrap; }

@media (max-width: 900px) {
    .fnc-grid { grid-template-columns: 1fr; }
    .fnc-axpanel { right: 4px; }
}

/* ---- Arbre de calculs ---------------------------------------------------
   Hexagone « arbre », éditeur (préfixe .arc-) et visionneuse. Les connecteurs
   sont dessinés dans le SVG : la CSS ne gère que le châssis. La mise en page
   du SVG étant déterministe (px logiques = px écran), la palette contextuelle
   et la saisie se superposent à la scène sans conversion de coordonnées. */
.hm-hex--arbrebg { background: linear-gradient(150deg, #f7fee7, #d9f99d); }
.hm-hex--arbrebg .hm-hex__ic { display: none; }
.hm-hex__arbre { position: absolute; inset: 15% 16%; display: grid; place-items: center; pointer-events: none; }
.hm-hex__arbre svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.hm-hex--arbrebg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

.modal__box--arbre { max-width: 1080px; width: 94vw; }
.arbre-view { padding: 10px 4px; overflow-x: auto; }
.arbre-view svg { display: block; margin: 0 auto; }
.arbre-view__msg { color: var(--muted); padding: 24px; text-align: center; }

.arc { position: relative; outline: none; }
.arc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 8px; }
.arc-bar .arc-b { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
.arc-bar .arc-b svg { width: 16px; height: 16px; }
.arc-sep { width: 1px; height: 22px; background: var(--line, #e2e8f0); }
.arc-gab { min-height: 34px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; padding: 0 8px; background: #fff; }
.arc-chk { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); }

.arc-stage { position: relative; overflow: auto; max-height: 52vh; padding: 8px;
    background: #fbfdff; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; }
.arc-scene { position: relative; margin: 0 auto; }
.arc-scene svg { display: block; }
.arc-case { cursor: pointer; }
.arc-op { cursor: pointer; }

/* Saisie superposée à la case (coordonnées du modèle = pixels écran). */
.arc-input { position: absolute; z-index: 3; box-sizing: border-box; text-align: center;
    font: 600 17px/1 system-ui, "Segoe UI", sans-serif; color: #0f172a;
    border: 2px solid #2563eb; border-radius: 7px; background: #fff; padding: 0 4px; }

/* Palettes flottantes. La règle [hidden] est INDISPENSABLE : sans elle, le
   display:flex l'emporte sur la feuille par défaut et le panneau reste visible
   malgré l'attribut hidden (piège déjà rencontré sur .brc-ctx). */
.arc-ctx { position: absolute; z-index: 4; display: flex; align-items: center; gap: 2px;
    padding: 4px; background: #fff; border: 1px solid var(--line, #e2e8f0);
    border-radius: 10px; box-shadow: 0 6px 20px rgba(15, 23, 42, .16); }
.arc-ctx[hidden], .arc-split[hidden] { display: none; }
.arc-ctx button { display: grid; place-items: center; width: 34px; height: 34px; border: 0;
    border-radius: 8px; background: transparent; color: #334155; cursor: pointer; }
.arc-ctx button:hover { background: #eff6ff; color: #1d4ed8; }
.arc-ctx button svg { width: 17px; height: 17px; }
.arc-ctx .arc-danger:hover { background: #fef2f2; color: #dc2626; }
.arc-cols { display: flex; gap: 3px; padding: 0 4px; border-left: 1px solid var(--line, #e2e8f0); margin-left: 2px; }
.arc-col { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid; cursor: pointer; padding: 0; }

.arc-split { display: grid; gap: 8px; margin-top: 10px; padding: 10px 12px;
    background: #f8fafc; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; }
.arc-split__t { font-weight: 700; font-size: .92rem; }
.arc-split__s { display: flex; flex-wrap: wrap; gap: 6px; }
.arc-sugg { min-height: 36px; padding: 0 12px; border: 1px solid #bfdbfe; border-radius: 999px;
    background: #eff6ff; color: #1d4ed8; font-weight: 600; cursor: pointer; }
.arc-sugg:hover { background: #dbeafe; }
.arc-split__libre { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.arc-sa, .arc-sb { width: 92px; min-height: 36px; text-align: center; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; padding: 0 8px; }
.arc-so { min-height: 36px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; padding: 0 6px; background: #fff; }

.arc-warn { margin: 8px 0 0; font-size: .88rem; color: #b45309; }
.arc-warn--info { color: var(--muted); }

.lc-arbre-edit { margin: 4px 0 10px; }
.est-panel--arbre { width: min(760px, calc(100vw - 32px)); }
.est-panel--arbre .arc-stage { max-height: 44vh; }

@media (max-width: 720px) {
    .arc-stage { max-height: 44vh; }
    .arc-ctx button { width: 40px; height: 40px; }
    .arc-sa, .arc-sb { width: 76px; }
}
.arc-split__t { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.arc-split__ou { display: inline-flex; gap: 10px; font-weight: 400; font-size: .84rem; color: var(--muted); }
.arc-split__ou label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* Panneau « Fonction » de l'Estrade : plus large que celui des barres — l'éditeur a deux
   colonnes (repère + registres symboliques) et bascule en une seule sous 900 px. */
.est-panel--fonction { width: min(920px, calc(100vw - 32px)); }
.est-panel--fonction .est-panel__head { cursor: grab; touch-action: none; user-select: none; }
.est-panel--fonction .est-panel__head:active { cursor: grabbing; }
.est-panel--fonction .fnc-graph svg { max-height: 34vh; }
.est-panel--fonction .fnc-tabwrap { max-height: 22vh; overflow-y: auto; }
.est-panel--fonction #fonction-place { margin-top: 10px; }

/* Bloc « fonction » d'une leçon : l'éditeur tient dans la carte, la consultation est centrée. */
.lc-fonction-edit { margin: 4px 0 10px; }
.lc-fonction-edit .fnc-graph svg { max-height: 42vh; }
.lc-fonction-edit .fnc-tabwrap { max-height: 26vh; overflow-y: auto; }
.lc-block .fnc-view { padding: 4px 0; }

/* Impression / PDF : la figure ne doit pas se couper entre l'expression, le repère et le
   tableau (le sélecteur .fnc-view est aussi dans SEL_ATOME de cours-pdf.js). */
@media print {
    .fnc-view { break-inside: avoid; page-break-inside: avoid; }
}

/* ==========================================================================
   Carte mentale — moteur carte-core.js (préfixe cmt-) : rendu partagé
   (consultation + éditeur), hexagone, éditeur.
   Deux couches superposées dans le même repère : un <svg> pour les flèches,
   des <div> pour les cases. Le repère est porté par .cmt-world.
   ========================================================================== */

/* Hexagone de « Mes documents » */
.hm-hex--carte { background: linear-gradient(150deg, #fb7185, #9f1239); }
.hm-hex--carte .hm-hex__ic svg { width: 48%; height: 48%; }
.hm-hex--cartebg { background: linear-gradient(150deg, #fff1f2, #fecdd3); }
.hm-hex--cartebg .hm-hex__ic { display: none; }
.hm-hex__carte { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hm-hex__carte svg { width: 84%; height: 84%; }
.hm-hex--cartebg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

.modal__box--carte { max-width: 1240px; width: 96vw; }

/* ---- Repère commun ------------------------------------------------------ */
.cmt-world { position: relative; transform-origin: 0 0; }
.cmt-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cmt-link__hit { pointer-events: stroke; cursor: pointer; }
.cmt-link__lbl { font: 600 11px var(--font-sans); }
.cmt-link.is-sel .cmt-link__line { stroke-width: 3.4; }

/* ---- Case --------------------------------------------------------------- */
.cmt-node {
    position: absolute; box-sizing: border-box; background: #fff;
    border: 2px solid var(--c, #2563eb); border-radius: 13px; padding: 9px 14px;
    color: var(--slate-800); text-align: center; line-height: 1.34;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
}
.cmt-node--rect    { border-radius: 3px; }
.cmt-node--ellipse { border-radius: 50%; padding: 16px 22px; }
.cmt-node--bulle   { border-radius: 20px 20px 20px 5px; }
.cmt-node.is-plein { background: var(--c, #2563eb); border-color: var(--c, #2563eb); color: #fff; }
.cmt-node.is-plein .cmt-node__txt { font-weight: 700; }
.cmt-node--tp { font-size: .76rem; }
.cmt-node--tn { font-size: .92rem; }
.cmt-node--tg { font-size: 1.1rem; }
.cmt-node__body { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.cmt-node__txt { width: 100%; word-break: break-word; outline: none; }
.cmt-node__txt b { font-weight: 700; }
.cmt-node__txt--vide { color: var(--slate-400); font-style: italic; font-size: .78rem; }
.cmt-node.is-plein .cmt-node__txt--vide { color: rgba(255, 255, 255, .75); }
.cmt-node__img { max-width: 100%; max-height: 190px; border-radius: 7px; display: block; }
.cmt-node__tex { font-size: 1.02em; }
/* Lecteur vidéo en miniature : rapport 16/9 fixé d'emblée, donc aucune secousse de
   mise en page quand la vignette arrive ou quand le lecteur remplace l'image. */
.cmt-node__video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 7px;
    overflow: hidden; background: #0f172a; cursor: pointer; }
.cmt-node__vthumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmt-node__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cmt-node__play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 42px; height: 30px; padding: 0; display: grid; place-items: center; cursor: pointer;
    border: none; border-radius: 8px; background: rgba(220, 38, 38, .92); color: #fff;
    font-size: .8rem; line-height: 1; box-shadow: 0 2px 8px rgba(15, 23, 42, .4); }
.cmt-node__video:hover .cmt-node__play { background: #dc2626; transform: translate(-50%, -50%) scale(1.08); }
.cmt-node__res {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
    font-size: .72rem; font-weight: 600; text-decoration: none;
    background: color-mix(in srgb, var(--c, #2563eb) 10%, #fff);
    color: var(--c, #2563eb); border: 1px solid color-mix(in srgb, var(--c, #2563eb) 35%, #fff);
    border-radius: 999px; padding: 2px 9px 2px 6px;
}
.cmt-node.is-plein .cmt-node__res { background: rgba(255, 255, 255, .92); border-color: transparent; }
.cmt-node__resnm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.cmt-node__res:hover { filter: brightness(.94); text-decoration: underline; }

/* Renvoi vers une vidéo à l'IMPRESSION : QR code à la place du lecteur et de la puce
   (carte-core.js, conteneur data-carte-qr). Les classes .lc-qr* sont celles des QR de
   leçon. Le code occupe toute la largeur de la case : la vue réduit ensuite la carte
   entière à la largeur disponible, et un QR trop petit ne se scanne plus. */
.cmt-node__qr { width: 100%; gap: 6px; }
.cmt-node__qr .lc-qr { width: 100%; max-width: 132px; height: auto; aspect-ratio: 1; }
.cmt-node__qr .lc-qr__cap { font-size: .74rem; font-weight: 600; line-height: 1.25; }

/* ---- Consultation ------------------------------------------------------- */
.cmt-view { width: 100%; }
.cmt-fit { position: relative; overflow: hidden; border-radius: 12px; background: #fbfdff; }
.cmt-fit--grid {
    background-image: linear-gradient(#e0edfb 1px, transparent 1px), linear-gradient(90deg, #e0edfb 1px, transparent 1px);
    background-size: 24px 24px;
}
.cmt-scale { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cmt-msg { color: var(--muted); font-size: .85rem; padding: 14px; text-align: center; }

/* ---- Éditeur ------------------------------------------------------------ */
.cmt { display: flex; flex-direction: column; gap: 8px; }
.cmt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmt-grp { display: flex; align-items: center; gap: 5px; }
.cmt-sep { width: 1px; height: 20px; background: var(--slate-200); flex: none; }
.cmt-btn {
    border: 1px solid var(--border); background: #fff; color: var(--slate-700); font: inherit;
    font-size: .78rem; font-weight: 600; border-radius: 8px; padding: 5px 10px; cursor: pointer;
    line-height: 1.4; white-space: nowrap;
}
.cmt-btn:hover { border-color: #e11d48; color: #9f1239; background: #fff1f2; }
.cmt-btn.is-on { background: #9f1239; border-color: #9f1239; color: #fff; }
.cmt-btn--pri { background: #e11d48; border-color: #e11d48; color: #fff; }
.cmt-btn--pri:hover { background: #be123c; border-color: #be123c; color: #fff; }
.cmt-btn--sq { padding: 5px 8px; min-width: 30px; text-align: center; }
.cmt-btn--del:hover { border-color: #dc2626; color: #dc2626; background: #fef2f2; }
.cmt-zoom { gap: 3px; }
.cmt-zoom__v { font-size: .74rem; color: var(--muted); min-width: 46px; text-align: center; }

.cmt-canvas {
    position: relative; height: 60vh; min-height: 380px; overflow: hidden; touch-action: none;
    border: 1px solid var(--border); border-radius: 12px; background-color: #fbfdff;
    background-image: linear-gradient(#e0edfb 1px, transparent 1px), linear-gradient(90deg, #e0edfb 1px, transparent 1px);
    background-size: 24px 24px; cursor: default; outline: none;
}
.cmt-canvas.is-linking { cursor: crosshair; }
.cmt-pane { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* Aperçu de la liaison : dans le repère (donc en coordonnées monde), masqué par défaut.
   La visibilité passe par une CLASSE et non par « hidden » : sur un élément SVG, la
   propriété « hidden » n'existe pas et l'aperçu restait affiché en permanence. */
.cmt-ghost { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; display: none; }
.cmt-ghost.is-on { display: block; }

.cmt-canvas .cmt-node { cursor: grab; user-select: none; -webkit-user-select: none; }
.cmt-canvas .cmt-node.is-edit { cursor: text; user-select: text; -webkit-user-select: text; }
.cmt-node.is-sel { box-shadow: 0 0 0 3px rgba(225, 29, 72, .28), 0 6px 18px rgba(15, 23, 42, .1); }
.cmt-node.is-target { box-shadow: 0 0 0 4px rgba(5, 150, 105, .35); }

/* Points de liaison : révélés au survol, ce sont eux qui amorcent une flèche. */
.cmt-anchor {
    position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #fff;
    border: 2px solid var(--c, #2563eb); opacity: 0; cursor: crosshair;
    transition: opacity .12s ease, transform .12s ease;
}
.cmt-node:hover .cmt-anchor, .cmt-node.is-sel .cmt-anchor { opacity: 1; }
.cmt-anchor:hover { transform: scale(1.5); background: var(--c, #2563eb); }
.cmt-anchor--n { top: -7px;  left: 50%; margin-left: -5.5px; }
.cmt-anchor--s { bottom: -7px; left: 50%; margin-left: -5.5px; }
.cmt-anchor--w { left: -7px;  top: 50%; margin-top: -5.5px; }
.cmt-anchor--e { right: -7px; top: 50%; margin-top: -5.5px; }

/* Croix de suppression : discrète, dans le coin haut droit, révélée au survol. */
.cmt-node__x {
    position: absolute; top: -9px; right: -9px; width: 19px; height: 19px; padding: 0;
    display: grid; place-items: center; border: none; border-radius: 50%;
    background: #ef4444; color: #fff; font-size: 10px; line-height: 1; cursor: pointer;
    opacity: 0; box-shadow: 0 1px 4px rgba(15, 23, 42, .3); transition: opacity .12s ease, transform .12s ease;
}
.cmt-node:hover .cmt-node__x, .cmt-node.is-sel .cmt-node__x { opacity: .88; }
.cmt-node__x:hover { opacity: 1; transform: scale(1.12); }

.cmt-node__grip {
    position: absolute; right: -4px; bottom: -4px; width: 10px; height: 10px; border-radius: 3px;
    background: #fff; border: 2px solid var(--c, #2563eb); opacity: 0; cursor: ew-resize;
}
.cmt-node:hover .cmt-node__grip, .cmt-node.is-sel .cmt-node__grip { opacity: .9; }

/* Barre contextuelle flottante (case ou lien sélectionné) */
.cmt-tools {
    position: absolute; z-index: 5; display: flex; align-items: center; gap: 4px; flex-wrap: nowrap;
    background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 5px 7px;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .16);
}
.cmt-tools[hidden] { display: none; }
.cmt-sw { display: flex; gap: 3px; }
.cmt-sw__b { width: 17px; height: 17px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0; }
.cmt-sw__b.is-on { border-color: var(--slate-800); }
.cmt-sw__b:hover { transform: scale(1.15); }
.cmt-forme, .cmt-fl { display: flex; gap: 3px; }

.cmt-hint { font-size: .72rem; color: var(--muted); line-height: 1.55; margin: 0 2px; }

/* Sélecteur d'image / de ressource */
.cmt-pick { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(15, 23, 42, .3); }
.cmt-pick[hidden] { display: none; }
.cmt-pick__box { width: min(460px, 92%); max-height: 78%; display: flex; flex-direction: column; gap: 8px;
    background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 18px 50px rgba(15, 23, 42, .3); }
.cmt-pick__head { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; }
.cmt-pick__x { border: none; background: none; font-size: 1rem; cursor: pointer; color: var(--muted); }
.cmt-pick__q { border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; font: inherit; font-size: .85rem; }
.cmt-pick__list { overflow: auto; display: flex; flex-direction: column; gap: 3px; min-height: 90px; }
.cmt-pick__it { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; font: inherit; font-size: .82rem;
    border: none; background: none; border-radius: 8px; padding: 7px 9px; cursor: pointer; color: var(--slate-700); }
.cmt-pick__it:hover { background: #fff1f2; color: #9f1239; }
.cmt-pick__ic { flex: none; width: 17px; text-align: center; }
.cmt-pick__nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Arborescence dépliante, calquée sur celle de « Mes documents » */
.cmt-pick__dir > summary { display: flex; align-items: center; gap: 7px; list-style: none; cursor: pointer;
    font-size: .82rem; font-weight: 600; color: var(--slate-700); border-radius: 8px; padding: 7px 9px; }
.cmt-pick__dir > summary::-webkit-details-marker { display: none; }
.cmt-pick__dir > summary::before { content: '▸'; flex: none; width: 10px; color: var(--slate-400); transition: transform .12s ease; }
.cmt-pick__dir[open] > summary::before { transform: rotate(90deg); }
.cmt-pick__dir > summary:hover { background: var(--slate-50, #f8fafc); }
.cmt-pick__nb { flex: none; font-size: .68rem; font-weight: 700; color: var(--muted);
    background: var(--slate-100); border-radius: 999px; padding: 1px 7px; }
/* Le trait vertical marque la profondeur : sans lui, trois niveaux imbriqués se lisent mal. */
.cmt-pick__sub { margin-left: 12px; padding-left: 8px; border-left: 1px solid var(--slate-100); }
.cmt-pick__vide { color: var(--muted); font-size: .8rem; text-align: center; padding: 18px 0; margin: 0; }
.cmt-pick__foot { display: flex; justify-content: flex-end; }

@media (max-width: 720px) {
    .cmt-canvas { height: 52vh; min-height: 300px; }
    .cmt-hint { display: none; }
}
@media print {
    .cmt-fit { overflow: visible; }
    .cmt-fit--grid { background-image: none; }
}

/* --- Math Runner : styles dans css/runner.css (chargée par la seule page du jeu). --- */

/* ==========================================================================
   Dessin — moteur dessin-core.js (préfixe dsn-) : rendu partagé, hexagone, éditeur.
   Tout est exprimé dans un repère CARRÉ de 1000 × 1000 : la mise à l'échelle est
   celle du <svg>, aucune dimension n'est mesurée ni stockée en pixels.
   ========================================================================== */

/* Hexagone de « Mes documents » */
.hm-hex--dessin { background: linear-gradient(150deg, #e879f9, #a21caf); }
.hm-hex--dessin .hm-hex__ic svg { width: 48%; height: 48%; }
.hm-hex--dessinbg { background: linear-gradient(150deg, #fdf4ff, #f5d0fe); }
.hm-hex--dessinbg .hm-hex__ic { display: none; }
.hm-hex__dessin { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hm-hex__dessin svg { width: 78%; height: 78%; }
.hm-hex--dessinbg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

.modal__box--dessin { max-width: 1180px; width: 96vw; }

/* ---- Rendu statique (leçon, élève, visionneuse, impression) -------------- */
.dessin-view { display: block; }
.dsn-svg { display: block; width: 100%; height: auto; border-radius: 10px; }
.dsn-msg { margin: 0; padding: 14px; color: var(--muted); font-size: .9rem; text-align: center; }

/* ---- Éditeur : barre d'outils ------------------------------------------- */
.dsn { display: flex; flex-direction: column; gap: 8px; }
.dsn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--slate-50); border: 1px solid var(--border); border-radius: 12px; }
.dsn-grp { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dsn-grp.is-off { opacity: .35; pointer-events: none; }
.dsn-sep { width: 1px; align-self: stretch; margin: 2px 2px; background: var(--border); }

.dsn-tool, .dsn-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--slate-700);
    cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.dsn-tool svg, .dsn-btn svg { width: 17px; height: 17px; }
.dsn-tool:hover, .dsn-btn:hover { background: var(--slate-100); }
.dsn-tool.is-on { background: var(--slate-800); border-color: var(--slate-800); color: #fff; }
.dsn-btn.is-on { background: #ede9fe; border-color: #a78bfa; color: #5b21b6; }
.dsn-btn--style { width: 38px; }
.dsn-btn--style svg { width: 24px; height: 10px; }
.dsn-btn--danger:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.dsn-tool:disabled, .dsn-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Pastilles de couleur : une bordure sombre marque celle en service (le blanc,
   qui sert de « correcteur », doit rester visible sur fond clair). */
.dsn-sw { width: 20px; height: 20px; padding: 0; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(15, 23, 42, .25); transition: transform .1s, box-shadow .1s; }
.dsn-sw:hover { transform: scale(1.15); }
.dsn-sw.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--slate-800); }
.dsn-cpick { display: grid; place-items: center; }
.dsn-cpick input { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border);
    border-radius: 8px; background: #fff; cursor: pointer; }

.dsn-slider, .dsn-champ { display: flex; align-items: center; gap: 6px; }
.dsn-slider input[type="range"] { width: 96px; accent-color: var(--slate-700); }
.dsn-slider__lbl { font-size: .74rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
/* Pastille d'aperçu : montre l'épaisseur et la couleur réelles avant de tracer. */
.dsn-apercu { display: block; border-radius: 50%; background: var(--slate-800); flex: none; }
.dsn-select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text); font-size: .84rem; }
.dsn-check { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--muted); white-space: nowrap; }

.dsn-hint { margin: 0; font-size: .78rem; color: var(--muted); line-height: 1.45; }

/* ---- Éditeur : la toile -------------------------------------------------- */
.dsn-stagewrap { display: flex; justify-content: center; }
/* Carré strict : la hauteur suit la largeur, et la largeur est bornée par la hauteur
   disponible à l'écran — la toile ne sort jamais de la modale. `touch-action: none`
   est indispensable : sans lui le doigt ferait défiler la page au lieu de dessiner. */
.dsn-stage { position: relative; width: min(100%, 62vh); aspect-ratio: 1 / 1;
    touch-action: none; cursor: crosshair; border-radius: 12px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .1); overflow: hidden; }
.dsn-svg--edit { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 12px; }
/* Le trait en cours doit passer AU-DESSUS de ce qui est déjà tracé, jamais dessous. */
.dsn-l-live { pointer-events: none; }

/* Saisie de l'outil Texte, posée dans le repère de la toile : le point cliqué est la
   LIGNE DE BASE du texte (comme <text y> en SVG) — d'où la remontée d'une hauteur. */
.dsn-txt { position: absolute; transform: translateY(-100%); min-width: 90px; max-width: 70%;
    padding: 1px 4px; border: 1px dashed var(--slate-400); border-radius: 4px;
    background: rgba(255, 255, 255, .92); font-family: var(--font-sans); font-weight: 600; }
.dsn-txt:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

@media (max-width: 720px) {
    .dsn-stage { width: 100%; }
    .dsn-slider input[type="range"] { width: 70px; }
}

/* ---- Bloc « dessin » d'une leçon ---------------------------------------- */
/* Dans une carte de bloc, la toile est plus basse que dans la modale : l'éditeur doit
   cohabiter avec la mise en page, le texte d'accompagnement et la légende. */
.lc-dessin-edit { margin: 4px 0 10px; }
.lc-dessin-edit .dsn-stage { width: min(100%, 44vh); }
.lc-block .dessin-view { padding: 2px 0; }

/* Impression / PDF : le croquis ne doit pas se couper entre deux pages, ni se retrouver
   séparé de son texte (le <svg> est déjà dans le DOM quand cours-pdf.js capture). */
@media print {
    .dessin-view { break-inside: avoid; page-break-inside: avoid; }
}

/* =========================================================================
   Cours de référence (bibliothèque de modèles) — fond bleu pastel
   ========================================================================= */

/* Le fond de page change SUR TOUTE LA SURFACE dès qu'on consulte le classeur de l'enseignant
   de référence (body.is-ref, posé par le contrôleur). C'est le repère principal contre la
   confusion « je crois modifier mon cours » : il est visible en permanence, y compris quand
   on a fait défiler la page loin du bandeau d'avertissement.
   Le dégradé est fixé (background-attachment) pour que la teinte ne « glisse » pas au défilement. */
body.is-ref {
    background: linear-gradient(180deg, #dbeafe 0%, #e8f1fe 34%, #eef4ff 100%) fixed;
}
/* Les surfaces blanches internes (cartes de chapitre, blocs de leçon) sont légèrement
   teintées elles aussi : sur fond bleu, un blanc pur ferait « fenêtre » et rendrait
   l'ensemble plus proche de la page normale, à rebours du but. */
body.is-ref .lc-seq,
body.is-ref .lc-doc { background: #fbfdff; border-color: #bfdbfe; }
body.is-ref .lc-seq__head { background: #eff6ff; border-bottom-color: #bfdbfe; }
body.is-ref .footer { background: transparent; }

/* Rappel de ce qu'on est en train d'importer, en tête de la modale de destination. */
.modal__intro { margin: -8px 0 16px; padding: 7px 11px; border-radius: 8px;
    background: #eff6ff; color: #1e3a8a; font-size: .9rem; font-weight: 600; }
.modal__intro:empty { display: none; }

/* Bandeau d'avertissement, en tête de chaque page de la bibliothèque. */
.lc-refbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin: 0 0 18px; padding: 12px 16px; border: 1px solid #93c5fd; border-left-width: 5px;
    border-radius: var(--radius); background: #eff6ff; color: #1e3a8a; }
.lc-refbar__icon { font-size: 1.5rem; line-height: 1; }
.lc-refbar__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.lc-refbar__txt strong { font-family: var(--font-display); font-size: 1.02rem; }
.lc-refbar__txt span { font-size: .88rem; color: #1d4ed8; }

/* Bouton d'accès depuis le classeur de l'enseignant (page /cours). */
.btn--ref { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.btn--ref:hover { background: #bfdbfe; color: #1e3a8a; text-decoration: none; }

/* Bibliothèque : liste des leçons modèles (pas de renommage, pas de glisser-déposer). */
.lc-seq__title--static { color: var(--slate-800); }
.lc-seq__count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.lc-niveau.is-empty { opacity: .5; }
.lc-niveau__nb { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
    background: rgba(15, 23, 42, .12); font-size: .76rem; font-weight: 700; }
.lc-niveau.is-on .lc-niveau__nb { background: rgba(255, 255, 255, .28); }
.lc-lecon__link { display: flex; align-items: baseline; gap: 10px; flex: 1 1 auto; min-width: 0; color: var(--text); }
.lc-lecon__link:hover { text-decoration: none; }
.lc-lecon__link:hover .lc-lecon__titre { text-decoration: underline; text-underline-offset: 3px; }
.lc-lecon__titre { font-weight: 600; }
.lc-lecon__meta { color: var(--muted); font-size: .82rem; }
.lc-lecon--empty { color: var(--muted); font-size: .9rem; cursor: default; }

/* Consultation d'une leçon modèle : chaque bloc devient sélectionnable. La case et
   l'étiquette de type occupent une gouttière à gauche, pour ne pas empiéter sur le rendu
   du bloc — qui doit rester identique à ce qu'il sera une fois importé. */
.lc-doc--pick { padding-top: 4px; }
.lc-pick { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: start;
    padding: 6px 10px 6px 6px; border: 1px solid transparent; border-radius: 10px; transition: background .12s, border-color .12s; }
.lc-pick:hover { background: rgba(219, 234, 254, .45); }
.lc-pick.is-picked { background: #dbeafe; border-color: #60a5fa; }
.lc-pick__check { display: flex; align-items: center; gap: 7px; padding-top: 10px; cursor: pointer; user-select: none; }
.lc-pick__box { width: 17px; height: 17px; accent-color: #2563eb; cursor: pointer; flex: 0 0 auto; }
.lc-pick__kind { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: #1d4ed8; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.lc-pick__body { min-width: 0; }

/* Barre d'action de la sélection, collée en bas de la fenêtre. */
.lc-pickbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
    display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px;
    background: #1e3a8a; color: #fff; box-shadow: 0 14px 34px rgba(30, 58, 138, .35); }
.lc-pickbar[hidden] { display: none; }
.lc-pickbar__n { font-size: .92rem; }
.lc-pickbar__n strong { font-size: 1.05rem; }
.lc-pickbar .btn--ghost-dark { color: #dbeafe; border-color: rgba(255, 255, 255, .4); }
.lc-pickbar .btn--ghost-dark:hover { background: rgba(255, 255, 255, .14); color: #fff; }

@media (max-width: 760px) {
    .lc-pick { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .lc-pick__check { padding-top: 0; }
    .lc-pickbar { left: 12px; right: 12px; bottom: 12px; transform: none; border-radius: 14px;
        justify-content: space-between; flex-wrap: wrap; }
}

/* =========================================================================
   Arbre de probabilité — moteur proba-core.js (préfixe prb-) : rendu partagé,
   hexagone, éditeur et modale d'édition d'une partie.
   Le dessin est un <svg> autonome à FOND BLANC dont la mise en page est
   recalculée à chaque rendu : rien n'est positionné en CSS, on ne fait ici
   que dimensionner le cadre et habiller l'éditeur.
   ========================================================================== */

/* ---- Hexagone de « Mes documents » -------------------------------------- */
.hm-hex--proba { background: linear-gradient(150deg, #fcd34d, #b45309); }
.hm-hex--proba .hm-hex__ic svg { width: 52%; height: 52%; }
.hm-hex--probabg { background: linear-gradient(150deg, #fffbeb, #fde68a); }
.hm-hex--probabg .hm-hex__ic { display: none; }
.hm-hex__proba { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hm-hex__proba svg { width: 82%; height: 82%; }
.hm-hex--probabg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

/* ---- Rendu partagé (leçon, élève, visionneuse, impression) --------------- */
.modal__box--proba { max-width: 1240px; width: 96vw; }
.proba-view { display: block; }
.prb-svg { display: block; max-width: 100%; height: auto; margin-inline: auto; }
/* L'arbre porte sa taille naturelle (attributs width/height du <svg>) : on le laisse
   RETRECIR s'il deborde, jamais s'etirer — un arbre de deux branches etire sur toute
   la largeur d'une lecon serait illisible, et le papier ne mentirait pas sur l'ecran. */
.prb-msg { margin: 0; padding: 14px; color: var(--muted); font-size: .9rem; text-align: center; }
.prb-hint { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }

/* ---- Éditeur ------------------------------------------------------------ */
.prb-ed { display: block; margin-top: 10px; }
.prb-ed:focus { outline: none; }
.prb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px 12px 0 0; background: var(--slate-50); }
.prb-bar--opts { border-top: 0; border-radius: 0; gap: 14px; }
.prb-grp { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prb-lbl { font-size: .74rem; font-weight: 700; color: var(--muted);
    letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.prb-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text); font-size: .82rem; cursor: pointer; line-height: 1.3; }
.prb-btn:hover:not(:disabled) { background: var(--slate-100); }
.prb-btn.is-on { background: var(--slate-800); border-color: var(--slate-800); color: #fff; }
.prb-btn:disabled { opacity: .35; cursor: not-allowed; }
.prb-btn--sq { width: 32px; padding: 5px 0; text-align: center; }
.prb-btn--danger:hover:not(:disabled) { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.prb-couls { display: flex; align-items: center; gap: 4px; }
.prb-sw { width: 20px; height: 20px; padding: 0; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(15, 23, 42, .25); transition: transform .12s; }
.prb-sw:hover { transform: scale(1.15); }
.prb-sw.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--slate-800); }
.prb-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font-size: .8rem; color: var(--text); }
.prb-champ { display: flex; align-items: center; gap: 6px; }
.prb-champ input[type="range"] { width: 92px; accent-color: var(--slate-700); }
.prb-check { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text); }

/* La scène : l'arbre tel qu'il sera imprimé, sur son fond blanc. */
.prb-stage { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px;
    background: #fff; padding: 10px; overflow: auto; max-height: 62vh; }
.prb-stage .prb-svg { margin: 0 auto; }
.prb-hit { cursor: pointer; }
.prb-hit:hover { fill: rgba(99, 102, 241, .12); }
.prb-warn { margin: 8px 0 0; padding: 7px 10px; border-radius: 8px;
    background: #fef3c7; color: #92400e; font-size: .82rem; }
.prb-warn[hidden] { display: none; }

/* ---- Modale d'édition d'une partie (double-clic) ------------------------- */
/* z-index entre la modale ordinaire (100) et le clavier de formules (400) :
   « ƒ Formule » doit pouvoir s'ouvrir PAR-DESSUS celle-ci. */
.prb-dlg { position: fixed; inset: 0; z-index: 300; background: rgba(15, 23, 42, .45);
    display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow: auto; }
.prb-dlg[hidden] { display: none; }
.prb-dlg__box { background: #fff; border-radius: 16px; padding: 18px 20px; width: 100%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .4); }
.prb-dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prb-dlg__title { margin: 0 0 12px; font-size: 1.05rem; }
.prb-dlg__head .prb-dlg__title { margin-bottom: 0; }
.prb-dlg__x { border: 0; background: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.prb-dlg__ins { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 8px; }
.prb-dlg__in { width: 100%; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.prb-dlg__aide { margin: 6px 0 0; font-size: .78rem; color: var(--muted); }
.prb-dlg__prev { display: flex; align-items: center; gap: 12px; margin: 12px 0;
    min-height: 58px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--slate-50); }
.prb-dlg__svg { display: inline-flex; align-items: center; }
.prb-dlg__svg svg { max-width: 100%; height: auto; }
.prb-dlg__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.prb-dlg__couls { display: flex; gap: 5px; margin-top: 12px; }
.prb-dlg__couls[hidden] { display: none; }
.prb-dlg__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---- Panneau de l'Estrade ------------------------------------------------ */
/* Même éditeur que partout ailleurs, dans un panneau déplaçable ; la scène est
   plafonnée pour que le bouton « Placer sur le tableau » reste toujours visible. */
.est-panel--proba { width: min(880px, calc(100vw - 32px)); }
.est-panel--proba .est-panel__head { cursor: grab; touch-action: none; user-select: none; }
.est-panel--proba .est-panel__head:active { cursor: grabbing; }
.est-panel--proba .prb-stage { max-height: 42vh; }
.est-panel--proba #proba-place { margin-top: 10px; }

@media (max-width: 760px) {
    .prb-bar { gap: 8px; }
    .prb-stage { max-height: none; }
    .est-panel--proba .prb-stage { max-height: 38vh; }
}

/* ---- Impression --------------------------------------------------------- */
/* L'arbre est un objet insécable : on lui interdit d'être coupé par un saut de page,
   et son fond blanc doit être imprimé tel quel (sinon la trame du papier transparaît). */
@media print {
    .proba-view { break-inside: avoid; page-break-inside: avoid; }
    .prb-svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .prb-ed, .prb-bar, .prb-warn, .prb-hint { display: none !important; }
}

/* ==========================================================================
   Exercices en ligne — moteur exo-core.js (préfixe exo-, plus deux sous-espaces
   exm- « modale feuille » et exp- « sélecteur d'exercices »).

   Trois scènes distinctes partagent ce bloc :
     · la BIBLIOTHÈQUE (/exercices)          .exo-biblio, .exo-carte, .exo-themes
     · l'ÉDITEUR d'un exercice               .exo-edit, .exo-q, .exo-var, .exo-zed
     · le RENDU d'une feuille                .exo-feuille, .exo-ex, .exo-item
   Seul le troisième est vu par l'élève : c'est le seul à devoir tenir sur un
   téléphone et à s'imprimer proprement.
   ========================================================================== */

/* ---- Hexagone de « Mes documents » -------------------------------------- */
.hm-hex--exercice { background: linear-gradient(150deg, #34d399, #047857); }
.hm-hex--exercice .hm-hex__ic svg { width: 50%; height: 50%; }
.hm-hex--exercicebg { background: linear-gradient(150deg, #ecfdf5, #a7f3d0); }
.hm-hex--exercicebg .hm-hex__ic { display: none; }
.hm-hex--exercicebg .hm-hex__name { font-size: .84rem; -webkit-line-clamp: 3; }

.modal__box--exo { max-width: 1080px; width: 96vw; }
.modal__box--exo .modal__body { max-height: 74vh; overflow-y: auto; }

/* ==========================================================================
   1. BIBLIOTHÈQUE
   ========================================================================== */

.exo-biblio { display: block; }
.exo-biblio__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.exo-biblio__head h1 { margin: 0; }
.exo-biblio__sub { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

.exo-onglets { display: flex; gap: 4px; margin: 18px 0 12px; border-bottom: 1px solid var(--border); }
.exo-onglet {
    appearance: none; background: none; border: 0; cursor: pointer; font: inherit;
    padding: 9px 16px; color: var(--muted); text-decoration: none;
    border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
}
.exo-onglet:hover { color: var(--text); background: var(--slate-50); }
.exo-onglet.is-on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.exo-onglets--mini { margin: 0 0 10px; }

.exo-filtres { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.exo-filtres__q { flex: 1 1 240px; min-width: 180px; }
.exo-filtres__sel { flex: 0 1 190px; }

.exo-biblio__corps { display: grid; grid-template-columns: 262px minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---- Colonne des thèmes (le référentiel commun) -------------------------- */
.exo-themes {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px; position: sticky; top: 14px; max-height: calc(100vh - 40px); overflow-y: auto;
}
.exo-themes__niv > summary {
    cursor: pointer; font-weight: 600; padding: 7px 6px; border-radius: 8px; list-style: none;
}
.exo-themes__niv > summary::-webkit-details-marker { display: none; }
.exo-themes__niv > summary::before { content: '\25B8\00A0'; color: var(--muted); }
.exo-themes__niv[open] > summary::before { content: '\25BE\00A0'; }
.exo-themes__niv > summary:hover { background: var(--slate-50); }
.exo-themes__dom { margin: 8px 0 3px; padding-left: 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.exo-theme {
    display: flex; align-items: baseline; gap: 7px; padding: 5px 8px; border-radius: 8px;
    text-decoration: none; color: var(--text); font-size: .88rem; line-height: 1.3;
}
.exo-theme:hover { background: var(--slate-50); }
.exo-theme.is-on { background: #eef2ff; color: var(--primary-d); font-weight: 600; }
.exo-theme.is-vide { color: var(--slate-400); }
.exo-theme--tous { font-weight: 600; margin-bottom: 6px; }
.exo-theme__code { flex: 0 0 auto; font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.exo-theme.is-on .exo-theme__code { color: var(--primary); }
.exo-theme__lbl { flex: 1 1 auto; }
.exo-theme__n { flex: 0 0 auto; font-size: .74rem; color: var(--muted); background: var(--slate-100); border-radius: 20px; padding: 1px 7px; }

/* ---- Mur de cartes ------------------------------------------------------- */
.exo-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(276px, 1fr)); gap: 14px; align-content: start; }
/* Compteur et pagination : sur toute la largeur du mur de cartes. */
.exo-liste__compte { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--muted); }
.exo-pager { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 10px 0 4px; }
.exo-pager__lien {
    min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center;
    border: 1px solid var(--border); border-radius: 8px; background: var(--card);
    color: var(--text); text-decoration: none; font-size: .9rem;
}
.exo-pager__lien:hover { border-color: #c7d2fe; background: var(--slate-100); }
.exo-pager__lien.is-on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.exo-pager__trou { color: var(--muted); }
.exo-carte {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 14px 10px; cursor: pointer; position: relative;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.exo-carte:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #c7d2fe; }
.exo-carte__haut { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.exo-carte__code {
    font-size: .7rem; font-weight: 700; letter-spacing: .03em; color: #047857;
    background: #ecfdf5; border-radius: 6px; padding: 2px 6px; white-space: nowrap;
}
.exo-carte__titre { margin: 0; font-size: 1rem; line-height: 1.3; }
.exo-carte__meta { margin: 8px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.exo-carte__auteur { font-style: italic; }
.exo-carte__outils { display: flex; gap: 2px; justify-content: flex-end; margin-top: 8px; }

.exo-ic {
    appearance: none; background: none; border: 0; cursor: pointer; font: inherit; font-size: .95rem;
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1;
}
.exo-ic:hover { background: var(--slate-100); color: var(--text); }
.exo-ic:disabled { opacity: .3; cursor: default; }
.exo-ic:disabled:hover { background: none; }
.exo-ic--danger:hover { background: #fee2e2; color: #dc2626; }

.exo-vide { grid-column: 1 / -1; text-align: center; padding: 46px 20px; color: var(--muted); }
.exo-vide p { margin: 0 0 10px; }
.exo-vide-mini { margin: 4px 0; padding: 12px; font-size: .85rem; color: var(--muted); background: var(--slate-50); border-radius: 10px; }
.exo-msg { margin: 0; padding: 18px; color: var(--muted); font-size: .9rem; text-align: center; }

.exo-corbeille { margin-top: 26px; color: var(--muted); font-size: .88rem; }
.exo-corbeille > summary { cursor: pointer; }
.exo-corbeille__list { list-style: none; margin: 10px 0 0; padding: 0; }
.exo-corbeille__list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }

.exo-check { display: flex; gap: 9px; align-items: flex-start; margin: 8px 0; font-size: .9rem; line-height: 1.4; cursor: pointer; }
.exo-check input { margin-top: 3px; flex: 0 0 auto; }

/* ==========================================================================
   2. ÉDITEUR D'UN EXERCICE
   ========================================================================== */

.exo-edit { display: block; }
.exo-edit__bar {
    position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.exo-edit__back { text-decoration: none; font-size: 1.2rem; color: var(--muted); padding: 0 4px; }
.exo-edit__back:hover { color: var(--text); }
.exo-edit__titre {
    flex: 1 1 240px; min-width: 180px; font: inherit; font-size: 1.06rem; font-weight: 600;
    border: 1px solid transparent; border-radius: 9px; padding: 7px 9px; background: transparent; color: var(--text);
}
.exo-edit__titre:hover { border-color: var(--border); }
.exo-edit__titre:focus { border-color: var(--primary); outline: none; background: #fff; }
.exo-edit__code {
    font-size: .72rem; font-weight: 700; color: #047857; background: #ecfdf5;
    border-radius: 6px; padding: 3px 7px;
}
.exo-edit__sel {
    font: inherit; font-size: .85rem; padding: 6px 8px; border: 1px solid var(--border);
    border-radius: 9px; background: #fff; color: var(--text); max-width: 190px;
}
.exo-edit__partage { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); cursor: pointer; }

.exo-etat { font-size: .8rem; color: var(--muted); min-width: 152px; text-align: right; }
.exo-etat.is-attente { color: #b45309; }
.exo-etat.is-ok { color: #047857; }
.exo-etat.is-ok::before { content: '\2713\00A0'; }
.exo-etat.is-ko { color: #dc2626; font-weight: 600; }

/* L'aperçu est le rendu RÉEL : plus il est large, plus il dit la vérité sur ce que verra
   l'élève. Il prend donc une part fixe et généreuse (560 px), la colonne d'édition gardant
   le reste — soit ~700 px dans le conteneur élargi, de quoi saisir confortablement. */
.exo-edit__corps { display: grid; grid-template-columns: minmax(0, 1fr) 560px; gap: 20px; align-items: start; }
.exo-edit__col { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.exo-edit__apercu {
    position: sticky; top: 78px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 100px); overflow-y: auto;
}
.exo-apercu__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exo-apercu__bar h2 { margin: 0; font-size: 1rem; }
.exo-apercu__hint { margin: 4px 0 12px; font-size: .78rem; color: var(--muted); }
/* Alerte de l'aperçu : un QCU/QCM dont les cases sont calculées peut, selon le tirage,
   n'avoir aucune bonne réponse. Ambre plutôt que rouge — la fiche reste enregistrable,
   c'est un avertissement d'auteur, pas une erreur de saisie. */
.exo-apercu__alerte { margin: 0 0 12px; padding: 9px 12px; border-left: 4px solid #d97706;
    border-radius: 0 8px 8px 0; background: #fffbeb; color: #92400e; font-size: .82rem; line-height: 1.45; }

/* ---- Panneaux repliables ------------------------------------------------ */
.exo-pan { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.exo-pan__head {
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px; cursor: pointer; list-style: none;
}
.exo-pan__head::-webkit-details-marker { display: none; }
.exo-pan__head--static { cursor: default; border-bottom: 1px solid var(--border); }
.exo-pan__t { font-weight: 600; }
.exo-pan__hint { font-size: .8rem; color: var(--muted); }
.exo-pan__hint code, .exo-aide code, .exo-conds code {
    background: var(--slate-100); border-radius: 4px; padding: 1px 4px; font-size: .95em;
}
.exo-pan__n { margin-left: auto; font-size: .76rem; color: var(--muted); background: var(--slate-100); border-radius: 20px; padding: 2px 9px; }
.exo-pan__corps { padding: 0 14px 14px; }
.exo-pan__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* ---- Variables ----------------------------------------------------------- */
.exo-vars { display: flex; flex-direction: column; gap: 7px; }
.exo-var { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; background: var(--slate-50); border-radius: 10px; padding: 7px 8px; }
.exo-var__nom {
    width: 82px; flex: 0 0 auto; font: inherit; font-weight: 700; text-align: center;
    border: 1px solid var(--border); border-radius: 8px; padding: 5px; background: #fff;
}
.exo-var__nom.is-ko { border-color: #dc2626; background: #fef2f2; }
.exo-var__type { flex: 0 0 auto; font: inherit; font-size: .84rem; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.exo-var__params { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex: 1 1 240px; min-width: 0; }
.exo-var__x { flex: 0 0 auto; margin-left: auto; }

.exo-mini { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--muted); }
.exo-mini__l { white-space: nowrap; }
.exo-mini__i { width: 62px; font: inherit; font-size: .84rem; padding: 4px 6px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); }
.exo-mini--l .exo-mini__i { width: 96px; }
.exo-mini--xl { flex: 1 1 180px; }
.exo-mini--xl .exo-mini__i { width: 100%; min-width: 120px; }
.exo-mini--case { gap: 5px; }
.exo-mini__i.is-ko { border-color: #dc2626; background: #fef2f2; }

.exo-conds { margin-top: 14px; }
.exo-conds textarea { font-family: var(--font-sans); font-size: .86rem; resize: vertical; }

/* ---- Cartes de question -------------------------------------------------- */
.exo-pan--questions { padding-bottom: 12px; }
.exo-questions { display: flex; flex-direction: column; }
.exo-q { border-bottom: 1px solid var(--border); }
.exo-q:last-child { border-bottom: 0; }
.exo-q__head { display: flex; align-items: center; gap: 9px; padding: 10px 14px; flex-wrap: wrap; }
.exo-q__drag { color: var(--slate-300); cursor: grab; user-select: none; }
.exo-q__badge { font-size: .74rem; font-weight: 600; border-radius: 20px; padding: 3px 10px; background: var(--slate-100); color: var(--slate-600); }
.exo-q__badge--simple { background: #eef2ff; color: #4338ca; }
.exo-q__badge--qcu { background: #ecfeff; color: #0e7490; }
.exo-q__badge--qcm { background: #f0fdf4; color: #15803d; }
.exo-q__badge--zones { background: #fff7ed; color: #c2410c; }
.exo-q__badge--figures { background: #eff6ff; color: #1d4ed8; }
.exo-q__badge--trous { background: #fdf4ff; color: #a21caf; }

/* ---- Éditeur d'une question « figure variable » -------------------------
   Une ligne par figure : la vignette EST le bouton de choix d'image, puis la suite
   de la consigne et la réponse, puis les outils. Même patron que la liste de choix
   d'un QCM (.exo-choix-l), en plus haut pour loger l'aperçu de l'image. */
.exo-figs { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.exo-figl {
    display: flex; gap: 10px; width: 100%; align-items: flex-start;
    padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--slate-50);
}
.exo-figl__img {
    flex: 0 0 auto; width: 84px; height: 68px; padding: 0; cursor: pointer;
    border: 1px dashed var(--slate-300); border-radius: 8px; background: #fff center/contain no-repeat;
    display: grid; place-items: center; font-size: 1.4rem; color: var(--slate-400);
}
.exo-figl__img:hover { border-color: var(--primary); }
.exo-figl__vide { pointer-events: none; }
.exo-figl__corps { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.exo-figl__rep { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.exo-figl__outils { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 640px) {
    .exo-figl__rep { grid-template-columns: minmax(0, 1fr); }
}
.exo-q__nb { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
.exo-q__nb input { width: 52px; font: inherit; font-size: .84rem; padding: 3px 5px; border: 1px solid var(--border); border-radius: 7px; text-align: center; }
.exo-q__cols { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
.exo-q__cols select {
    font: inherit; font-size: .8rem; padding: 3px 5px; border: 1px solid var(--border);
    border-radius: 7px; background: #fff; color: var(--text);
}
.exo-q__cols.is-off { opacity: .45; }
.exo-q__outils { margin-left: auto; display: flex; gap: 1px; }
.exo-q__corps { padding: 0 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.exo-q.is-plie .exo-q__corps { display: none; }
.exo-q__extra > summary { cursor: pointer; font-size: .84rem; color: var(--muted); padding: 4px 0; }
.exo-q__extra[open] > summary { margin-bottom: 8px; }

.exo-champ { display: block; }
.exo-champ .field__label { display: block; margin-bottom: 5px; }
.exo-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.exo-choix-edit { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.exo-choix-l { display: flex; gap: 8px; align-items: center; width: 100%; }
.exo-choix-l__i { flex: 1 1 auto; min-width: 0; font: inherit; font-size: .9rem; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); }
/* Formule facultative : la bonne réponse peut dépendre du tirage (« mod(n ; 3) = 0 »).
   Volontairement plus étroite et en chasse fixe — c'est du calcul, pas de l'énoncé —
   et discrète tant qu'elle est vide, pour ne pas encombrer le cas courant. */
.exo-choix-l__f { flex: 0 1 12rem; min-width: 6rem; font: inherit; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: .82rem; padding: 7px 9px; border: 1px dashed var(--border); border-radius: 9px; background: #fff; color: var(--muted); }
.exo-choix-l__f:focus, .exo-choix-l__f:not(:placeholder-shown) { border-style: solid; color: var(--text); }
.exo-choix-l__f.is-ko { border-color: var(--danger, #dc2626); background: #fef2f2; }
.exo-choix-l input[type="checkbox"]:disabled, .exo-choix-l input[type="radio"]:disabled { opacity: .45; }

/* ---- Éditeur de zones cliquables ---------------------------------------- */
.exo-zed__bar { display: flex; gap: 8px; margin-bottom: 8px; }
.exo-zed { position: relative; display: block; max-width: 100%; user-select: none; touch-action: none; line-height: 0; }
.exo-zed__img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.exo-zed__z {
    position: absolute; border: 2px dashed #dc2626; background: rgba(220, 38, 38, .12);
    border-radius: 6px; box-sizing: border-box;
}
.exo-zed__z.is-ok { border-color: #047857; border-style: solid; background: rgba(4, 120, 87, .16); }
.exo-zed__z.is-trace { border-color: var(--primary); background: rgba(79, 70, 229, .14); pointer-events: none; }
.exo-zed__n { position: absolute; top: 2px; left: 4px; font-size: .7rem; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); line-height: 1.4; }
.exo-zed__b {
    position: absolute; appearance: none; border: 0; cursor: pointer; font: inherit; font-size: .72rem;
    width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .92); color: var(--slate-700); line-height: 1;
}
.exo-zed__b--ok { right: 23px; top: 2px; }
.exo-zed__b--x { right: 2px; top: 2px; }
.exo-zed__b:hover { background: #fff; }
.exo-zed__b--x:hover { background: #fee2e2; color: #dc2626; }
.exo-zed__hint { margin: 8px 0 0; font-size: .78rem; color: var(--muted); }

/* ---- Ajout d'une question ------------------------------------------------ */
.exo-addq { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 12px 14px 0; }
.exo-addq__lbl { font-size: .82rem; color: var(--muted); }
.exo-addq__b {
    appearance: none; cursor: pointer; font: inherit; font-size: .82rem;
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--slate-50); border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; color: var(--text);
}
.exo-addq__b:hover { background: #eef2ff; border-color: #c7d2fe; color: var(--primary-d); }

/* ---- Sélecteur d'image --------------------------------------------------- */
.exo-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin-top: 12px; }
.exo-img {
    appearance: none; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; padding: 0;
    aspect-ratio: 4 / 3; background-size: cover; background-position: center; position: relative; overflow: hidden;
}
.exo-img:hover { border-color: var(--primary); }
.exo-img__l {
    position: absolute; inset: auto 0 0 0; background: rgba(15, 23, 42, .72); color: #fff;
    font-size: .72rem; padding: 4px 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.exo-aide h3 { margin: 18px 0 6px; font-size: .95rem; }
.exo-aide h3:first-child { margin-top: 0; }
.exo-aide ul { margin: 0 0 8px; padding-left: 20px; font-size: .9rem; line-height: 1.65; }
.exo-aide p { margin: 0 0 8px; font-size: .9rem; }
.exo-aide__note { color: var(--muted); font-size: .84rem !important; }

/* ==========================================================================
   3. MODALE « FEUILLE » ET SÉLECTEUR D'EXERCICES
   ========================================================================== */

.exm-pile { margin: 16px 0; }
.exm-pile__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.exm-liste { display: flex; flex-direction: column; gap: 6px; }
.exm-item { display: flex; gap: 10px; align-items: center; background: var(--slate-50); border-radius: 10px; padding: 8px 10px; }
.exm-item__n { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: .76rem; font-weight: 700; }
.exm-item__corps { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.exm-item__t { display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; font-weight: 500; }
.exm-item__m { font-size: .78rem; color: var(--muted); }
.exm-item__a { font-style: italic; }
.exm-item__s { font-variant-numeric: tabular-nums; }
.exm-item__outils { flex: 0 0 auto; display: flex; gap: 1px; }
.exm-opts { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 0; }
.exm-opts legend { padding: 0 6px; }
.exm-pdf { margin-top: 12px; }
.exm-pdf__hint { margin: 2px 0 10px; font-size: .84rem; line-height: 1.45; color: var(--muted); }
.exm-pdf__btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Un seul état pour les deux boutons : ils partagent le verrou de génération. */
.exm-pdf__etat { font-size: .84rem; color: var(--muted); }
.exm-pdf__etat.is-ok { color: #047857; font-weight: 600; }
.exm-pdf__etat.is-ko { color: #b91c1c; font-weight: 600; }

.exp-filtres { display: flex; gap: 8px; margin-bottom: 10px; }
.exp-filtres input { flex: 1 1 auto; }
.exp-filtres select { flex: 0 0 180px; }
.exp-liste { display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow-y: auto; }
.exp-item { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.exp-item:hover { border-color: #c7d2fe; background: #f8fafc; }
.exp-item.is-deja { opacity: .55; }
.exp-item__corps { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.exp-item__t { display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.exp-item__m { font-size: .78rem; color: var(--muted); }

/* ==========================================================================
   4. RENDU D'UNE FEUILLE — la seule scène vue par l'élève
   ========================================================================== */

.exo-feuille { display: block; }
.exo-feuille__pied { margin-top: 22px; text-align: center; }

.exo-ex { display: block; margin-bottom: 26px; }
.exo-ex + .exo-ex { border-top: 1px solid var(--border); padding-top: 22px; }
.exo-ex__head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.exo-ex__num {
    flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center;
    background: var(--primary); color: #fff; border-radius: 7px; font-size: .82rem; font-weight: 700;
}
/* Variante « intitulé » (data-exo-label) : la pastille s'allonge en « EXERCICE 1 ».
   Même typographie que l'en-tête des encadrés — c'est le même rôle, annoncer la
   nature de ce qui suit. */
.exo-ex__num--lbl {
    width: auto; height: auto; padding: 4px 11px;
    text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.exo-ex__titre { margin: 0; font-size: 1.05rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
/* nowrap : l'intitulé « EXERCICE 1 » prend plus de place que l'ancienne pastille à un
   chiffre, et le code se coupait en deux (« 6N1- » / « 1 ») dès que la ligne serrait. */
.exo-ex__code { font-size: .72rem; font-weight: 700; color: #047857; background: #ecfdf5; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.exo-ex__auteur { font-size: .76rem; color: var(--muted); font-style: italic; }
.exo-ex__consigne { margin: 0 0 12px; }
/* Conteneur de requête : les colonnes ci-dessous se règlent sur la largeur RÉELLE de la
   feuille, pas sur celle de la fenêtre. C'est indispensable ici — la même feuille est
   rendue en pleine page pour l'élève et dans le panneau d'aperçu de l'éditeur, large de
   400 px seulement, où quatre colonnes seraient illisibles. */
.exo-ex__items { display: flex; flex-direction: column; gap: 4px; container-type: inline-size; }

/* Un GROUPE = tous les tirages d'une même question. C'est lui qui porte la mise en
   colonnes (attribut data-cols, 1 à 4) : les questions restent empilées, seules leurs
   répétitions se rangent côte à côte. Les colonnes se remplissent de gauche à droite,
   dans l'ordre du DOM — l'ordre de lecture est donc aussi celui de la tabulation.
   minmax(0, 1fr) plutôt que 1fr : sans lui, un énoncé long élargirait sa colonne. */
.exo-ex__grp { display: grid; gap: 4px 16px; grid-template-columns: minmax(0, 1fr); }
.exo-ex__grp[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.exo-ex__grp[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.exo-ex__grp[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* En colonnes, le champ de saisie ne peut plus imposer ses 132 px. */
.exo-ex__grp:not([data-cols="1"]) .exo-saisie { max-width: 100%; }

/* Repli progressif quand la feuille est étroite. Les sélecteurs gardent la même
   spécificité que les règles ci-dessus (elles portent toutes un [data-cols]), si bien
   que c'est l'ordre du fichier qui tranche : le repli le plus étroit vient en dernier
   et l'emporte. L'impression, elle, rétablit les colonnes demandées (voir plus bas). */
@container (max-width: 860px) {
    .exo-ex__grp[data-cols="3"], .exo-ex__grp[data-cols="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 520px) {
    .exo-ex__grp[data-cols] { grid-template-columns: minmax(0, 1fr); }
}
/* Sauf dans l'aperçu de l'éditeur : large de 400 px, il replierait systématiquement ce
   que l'enseignant vient de choisir, et le sélecteur « 3 colonnes » n'aurait aucun effet
   visible. On y montre donc toujours le nombre demandé — plus serré qu'en vraie page,
   mais c'est bien la mise en page qu'il est en train de régler. Ces sélecteurs portent
   une classe de plus : ils l'emportent sur les replis quel que soit l'ordre. */
.exo-edit__apercu .exo-ex__grp[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.exo-edit__apercu .exo-ex__grp[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.exo-edit__apercu .exo-ex__grp[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.exo-ex__pied { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.exo-ex__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.exo-ex__score.is-ok { color: #047857; }
.exo-ex__score.is-ko { color: #dc2626; }
.exo-ex__score.is-mi { color: #b45309; }
.exo-ex__score.is-vide { color: var(--muted); font-weight: 400; font-size: .85rem; }
/* Séance informatique : vérifier un énoncé incomplet (une question vide y compte fausse). */
.exo-ex__score.is-avert { flex-basis: 100%; color: #b45309; font-weight: 600; font-size: .88rem; }

.exo-item { padding: 9px 10px; border-radius: 10px; border-left: 3px solid transparent; }
.exo-item.is-ok { background: #f0fdf4; border-left-color: #16a34a; }
.exo-item.is-ko { background: #fef2f2; border-left-color: #dc2626; }
.exo-item__head { display: flex; gap: 9px; align-items: baseline; }
.exo-item__num { flex: 0 0 auto; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.exo-item__enonce { flex: 1 1 auto; min-width: 0; }
.exo-item__enonce > p:first-child { margin-top: 0; }
.exo-item__enonce > p:last-child { margin-bottom: 0; }
.exo-item__rep { margin: 6px 0 0 24px; }
.exo-item__etat { margin-left: 24px; font-size: .84rem; color: #b91c1c; }

.exo-saisie {
    font: inherit; font-size: .95rem; width: 132px; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text);
}
.exo-saisie:focus { border-color: var(--primary); outline: 2px solid #c7d2fe; outline-offset: 1px; }
.exo-saisie.is-ok { border-color: #16a34a; background: #f0fdf4; }
.exo-saisie.is-ko { border-color: #dc2626; background: #fef2f2; }
.exo-unite { margin-left: 7px; color: var(--muted); }

.exo-choix { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.exo-choix__item { border-radius: 9px; }
.exo-choix__lab { display: flex; gap: 9px; align-items: flex-start; padding: 6px 9px; cursor: pointer; border-radius: 9px; }
.exo-choix__lab:hover { background: var(--slate-50); }
.exo-choix__box { margin-top: 4px; flex: 0 0 auto; }
.exo-choix__txt { flex: 1 1 auto; min-width: 0; }
.exo-choix__txt > p { margin: 0; }
.exo-choix__item.is-ok { background: #dcfce7; }
.exo-choix__item.is-ko { background: #fee2e2; }
.exo-choix__item.is-manque { background: #fef9c3; outline: 1px dashed #ca8a04; }

.exo-zones { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.exo-zones__img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.exo-zone {
    position: absolute; appearance: none; background: transparent; border: 2px solid transparent;
    border-radius: 6px; cursor: pointer; box-sizing: border-box; padding: 0;
}
.exo-zone:hover { border-color: rgba(79, 70, 229, .55); background: rgba(79, 70, 229, .1); }
.exo-zone:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.exo-zone--ell { border-radius: 50%; }
.exo-zone.is-on { border-color: var(--primary); background: rgba(79, 70, 229, .22); }
.exo-zone.is-ok { border-color: #16a34a; background: rgba(22, 163, 74, .26); }
.exo-zone.is-ko { border-color: #dc2626; background: rgba(220, 38, 38, .24); }
.exo-zone.is-manque { border-color: #ca8a04; border-style: dashed; background: rgba(202, 138, 4, .18); }

/* Figure tirée d'une banque (type « figures ») : elle se pose au-dessus du champ de
   réponse, jamais plus large que la colonne. La bordure la détache du texte sans en
   faire une illustration décorative — c'est l'énoncé qui est dans l'image. */
.exo-fig { margin: 2px 0 8px; }
/* Texte à compléter posé SOUS la figure (cf. buildItem, branche « figures »). */
.exo-fig__suite { margin-top: 6px; }
.exo-fig__suite > p:first-child { margin-top: 0; }
.exo-fig__suite > p:last-child { margin-bottom: 0; }
.exo-fig__img {
    display: block; max-width: 100%; max-height: 320px; height: auto;
    border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
@media print {
    .exo-fig__img { max-height: 70mm; break-inside: avoid; page-break-inside: avoid; }
}

.exo-trou { display: inline-block; }
.exo-trou__inp, .exo-trou__sel {
    font: inherit; font-size: .95em; padding: 2px 7px; margin: 0 2px;
    border: 1px solid var(--slate-400); border-bottom-width: 2px; border-radius: 7px;
    background: #fff; color: var(--text); vertical-align: baseline;
}
.exo-trou__inp:focus, .exo-trou__sel:focus { border-color: var(--primary); outline: 2px solid #c7d2fe; outline-offset: 1px; }
.exo-trou__inp.is-ok, .exo-trou__sel.is-ok { border-color: #16a34a; background: #f0fdf4; }
.exo-trou__inp.is-ko, .exo-trou__sel.is-ko { border-color: #dc2626; background: #fef2f2; }

.exo-lien {
    appearance: none; background: none; border: 0; cursor: pointer; font: inherit; font-size: .84rem;
    color: var(--primary); padding: 4px 0 0 24px; text-align: left;
}
.exo-lien:hover { text-decoration: underline; }
.exo-aide, .exo-corr { margin: 6px 0 0 24px; padding: 9px 12px; border-radius: 9px; font-size: .9rem; }
.exo-aide { background: #fefce8; border-left: 3px solid #eab308; }
.exo-corr { background: #eff6ff; border-left: 3px solid #3b82f6; }
.exo-aide > p:first-child, .exo-corr__c > p:first-child { margin-top: 0; }
.exo-aide > p:last-child, .exo-corr__c > p:last-child { margin-bottom: 0; }
/* La boîte bleue arrivait sans dire ce qu'elle était : elle s'annonce maintenant, et
   elle prend la place du bouton « Indice », devenu sans objet une fois l'énoncé joué. */
.exo-corr__t { font-weight: 600; color: #1d4ed8; margin-bottom: 3px; }
/* « Bravo ! » occupe le même emplacement quand la réponse est juste. Pas de propriété
   display ici : elle empêcherait l'attribut [hidden] de faire son travail. */
.exo-bravo { margin: 6px 0 0 24px; font-size: .88rem; font-weight: 600; color: #047857; }
.exo-bravo::before { content: '\2713\00A0'; }

/* ---- Liste des feuilles côté élève --------------------------------------- */
.exo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.exo-card {
    display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.exo-card:hover { border-color: #6ee7b7; box-shadow: var(--shadow); }
.exo-card__ic {
    flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
    background: linear-gradient(150deg, #34d399, #047857); color: #fff;
}
.exo-card__ic svg { width: 24px; height: 24px; }
.exo-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.exo-card__titre { font-weight: 600; }
.exo-card__meta { font-size: .8rem; color: var(--muted); }

/* ==========================================================================
   5. ADAPTATIONS — écrans étroits et impression
   ========================================================================== */

@media (max-width: 1100px) {
    .exo-biblio__corps { grid-template-columns: 1fr; }
    .exo-themes { position: static; max-height: 320px; }
}
/* L'éditeur se replie plus tôt que la bibliothèque : son aperçu réclamant 560 px, en
   dessous de ce seuil la colonne de saisie tomberait sous 560 px à son tour. Les deux
   volets passent alors l'un sous l'autre, chacun en pleine largeur. */
@media (max-width: 1180px) {
    .exo-edit__corps { grid-template-columns: 1fr; }
    .exo-edit__apercu { position: static; max-height: none; }
}
@media (max-width: 640px) {
    .exo-edit__bar { position: static; }
    .exo-edit__sel { max-width: 100%; flex: 1 1 140px; }
    .exo-etat { text-align: left; min-width: 0; }
    /* Filet pour les navigateurs sans requête de conteneur : sur un téléphone, jamais
       plus d'une colonne — aperçu de l'éditeur compris, où l'exception ci-dessus n'a
       plus lieu d'être (le panneau y occupe toute la largeur). */
    .exo-ex__grp[data-cols] { grid-template-columns: minmax(0, 1fr); }
    .exo-edit__apercu .exo-ex__grp[data-cols] { grid-template-columns: minmax(0, 1fr); }
    .exo-item__rep, .exo-item__etat, .exo-lien, .exo-bravo { margin-left: 0; padding-left: 0; }
    .exo-aide, .exo-corr { margin-left: 0; padding-left: 12px; }
    .exo-saisie { width: 100%; max-width: 220px; }
}

/* À l'impression, une feuille devient un sujet : les commandes disparaissent, les
   champs de saisie restent (ce sont les lignes à remplir au stylo) et un exercice
   ne se coupe pas au milieu d'une page. */
@media print {
    .exo-ex { break-inside: avoid; page-break-inside: avoid; }
    .exo-ex__pied, .exo-feuille__pied, .exo-lien, .exo-corr, .exo-aide, .exo-bravo { display: none !important; }
    .exo-saisie, .exo-trou__inp, .exo-trou__sel { border-color: var(--slate-400) !important; background: #fff !important; }
    .exo-item { background: none !important; border-left-color: transparent !important; break-inside: avoid; page-break-inside: avoid; }
    .exo-zones__img, .exo-card__ic { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    /* La pastille est du blanc sur aplat indigo : sans cela le navigateur laisse tomber
       le fond à l'impression et le numéro — ou l'intitulé « EXERCICE 1 » — sort en blanc
       sur blanc, donc invisible. */
    .exo-ex__num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    /* Une page A4 fait environ 720 px : le repli des colonnes s'y déclencherait alors que
       c'est justement sur le papier qu'elles sont le plus utiles. On rétablit donc le
       nombre demandé — dernières règles du fichier portant sur .exo-ex__grp, à
       spécificité égale elles l'emportent. */
    .exo-ex__grp[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exo-ex__grp[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .exo-ex__grp[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.exo-aide__code { background: var(--slate-50); border-radius: 8px; padding: 10px 12px; line-height: 1.9; }

/* ---- Fractions écrites en clair : !frac{ … }{ … } ------------------------
   Une vraie fraction, en HTML plutôt qu'en LaTeX : c'est le seul moyen d'y loger
   un CHAMP DE SAISIE. MathJax composerait plus finement, mais il avalerait le
   champ — un trou ne peut pas vivre dans une formule.
   Les deux termes sont empilés et centrés ; la barre est la bordure du numérateur,
   elle prend donc la couleur du texte environnant (énoncé noir, correction bleue…). */
.exo-frac {
    display: inline-flex; flex-direction: column; align-items: center;
    vertical-align: middle; margin: 0 .2em; text-align: center; line-height: 1.25;
}
.exo-frac__n { display: block; padding: 0 .38em .1em; border-bottom: 1.6px solid currentColor; }
.exo-frac__d { display: block; padding: .1em .38em 0; }

/* Un trou logé dans une fraction : compact et centré, pour que les deux termes
   gardent la même largeur et que la barre reste lisible.

   Le passage en `block` ne vaut que pour un trou SEUL dans son terme — le cas courant,
   « !frac{[[!u]]}{[[!v]]} ». Un terme COMPOSÉ, lui, doit tenir sur une ligne : dans
   « !frac{[[!p1]] − [[!p0]]}{[[!p0]]} », mettre chaque trou en bloc empilait les deux
   champs et renvoyait le « − » à la ligne, si bien que la fraction sortait sur trois
   étages avant même la barre. D'où `:only-child`, et le `nowrap` qui empêche le terme
   de se replier quand la place manque. */
.exo-frac .exo-trou:only-child { display: block; }
.exo-frac__n, .exo-frac__d { white-space: nowrap; }
.exo-frac .exo-trou__inp, .exo-frac .exo-trou__sel {
    margin: 2px 3px; min-width: 3.4em; text-align: center;
}
/* Deux fractions consécutives séparées par « = » respirent un peu plus. */
.exo-item__enonce .exo-frac { font-size: 1.02em; }

@media print {
    .exo-frac__n { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Sélecteur multiple de chapitres personnels --------------------------
   Un exercice peut appartenir à plusieurs séquences : des cases à cocher, mais
   repliées derrière un bouton qui résume la sélection — le bandeau de l'éditeur
   doit rester sur une ligne. Markup : partials/exo_chapitres.php, comportement :
   HMExoCore.multi(). */
.exo-multi { position: relative; display: inline-block; }
.exo-multi__btn {
    appearance: none; cursor: pointer; font: inherit; font-size: .85rem;
    display: inline-flex; align-items: center; gap: 6px; max-width: 210px;
    padding: 6px 9px; border: 1px solid var(--border); border-radius: 9px;
    background: #fff; color: var(--muted);
}
.exo-multi__btn:hover { border-color: #c7d2fe; }
.exo-multi.is-on .exo-multi__btn { color: var(--text); border-color: #c7d2fe; background: #eef2ff; }
.exo-multi.is-open .exo-multi__btn { border-color: var(--primary); }
.exo-multi__lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exo-multi__car { flex: 0 0 auto; font-size: .7rem; }

.exo-multi__pop {
    position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; min-width: 250px;
    max-height: 320px; overflow-y: auto; padding: 8px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.exo-multi__niv {
    margin: 8px 0 3px; padding-left: 6px; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
}
.exo-multi__niv:first-child { margin-top: 0; }
.exo-multi__opt {
    display: flex; gap: 8px; align-items: flex-start; padding: 5px 7px;
    border-radius: 8px; cursor: pointer; font-size: .88rem; line-height: 1.35;
}
.exo-multi__opt:hover { background: var(--slate-50); }
.exo-multi__opt input { margin-top: 3px; flex: 0 0 auto; }
.exo-multi__vide { margin: 0; padding: 10px; font-size: .84rem; color: var(--muted); }
.exo-multi__pied { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); text-align: right; }

/* Dans une modale, le sélecteur occupe toute la largeur de son champ. */
.field .exo-multi, .field .exo-multi__btn { display: flex; max-width: none; width: 100%; }
.field .exo-multi__btn { justify-content: space-between; padding: 9px 11px; font-size: .92rem; }

/* Pastilles de chapitre sur les cartes de la bibliothèque. */
.exo-carte__chaps { margin: 7px 0 0; display: flex; gap: 5px; flex-wrap: wrap; }
.exo-chip {
    font-size: .74rem; padding: 2px 9px; border-radius: 20px; text-decoration: none;
    background: var(--slate-100); color: var(--slate-600); max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exo-chip:hover { background: #eef2ff; color: var(--primary-d); }

/* ---- Feuille d'exercices dans la mise en page d'impression ---------------
   Sur PAPIER, la feuille n'est plus rendue du tout : seul son QR code subsiste
   (cf. $lcPapier dans views/cours/_section.php). Les règles ci-dessous ne servent
   donc plus que la PROJECTION, qui emprunte la même mise en page (.lc-print) mais
   garde les exercices vivants : on y masque les seules commandes qui n'ont rien à
   faire au tableau (bouton « Vérifier », indices, corrections). */
.lc-print .exo-ex__pied,
.lc-print .exo-lien,
.lc-print .exo-aide,
.lc-print .exo-corr,
.lc-print .exo-bravo,
.lc-print .exo-feuille__pied { display: none; }

/* QR code posé SOUS les exercices (projection) : petite carte secondaire, puisque la
   feuille est là, juste au-dessus. Sur le papier, où il tient lieu de feuille, le QR
   sort en carte pleine (.lc-qr-block seul) comme les autres ressources. */
.exo-qr {
    margin-top: 14px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--slate-50);
    break-inside: avoid; page-break-inside: avoid;
}
.exo-qr .lc-qr { width: 104px; height: 104px; }
.exo-qr__sous { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 2px; }

@media print {
    .exo-qr { background: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==========================================================================
   6. SUJET PAPIER — la feuille recomposée pour le PDF (js/exo-pdf.js)
   ==========================================================================
   Rien de tout ceci n'est jamais visible à l'écran : le conteneur est posé à
   −99999px, photographié bloc par bloc (html-to-image), puis jeté. C'est une
   typographie de SUJET — sérif, filets, cadres numérotés — volontairement
   étrangère à l'habillage de l'application.

   Deux contraintes de capture dictent la structure du balisage, et se
   perdraient facilement en retouchant ces règles :
   — html-to-image ne photographie que la boîte de l'élément qu'on lui donne.
     L'ombre portée du bandeau déborde en bas à droite et l'étiquette
     « Exercice N » déborde vers le haut : d'où les enveloppes __bandeau et
     __cadre, dont le padding loge ce débordement. Les supprimer rognerait
     l'ombre et couperait l'étiquette en deux.
   — les champs de saisie ont été remplacés par des pointillés AVANT capture
     (papierise, dans exo-pdf.js) : les règles ci-dessous habillent .exo-pdf__ligne
     et .exo-pdf__case, pas des <input>.
   ========================================================================== */

.exo-pdf {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 10.5pt; line-height: 1.45; color: #111; background: #fff;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* ---- Bandeau titre ------------------------------------------------------ */
.exo-pdf__bandeau { padding: 0 4px 4px 0; }        /* loge l'ombre portée dans la capture */
/* Gris neutre et non le rose du modèle : demandé par Sylvain le 2026-08-08. Il reste
   assez clair pour que le titre en sérif garde son contraste, à l'écran comme au tirage
   noir et blanc (print-color-adjust: exact est posé sur .exo-pdf). */
.exo-pdf__head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
    border: 1.1px solid #24242e; border-radius: 9px; background: #ededf0;
    padding: 11px 18px; box-shadow: 3px 3px 0 #24242e;
}
.exo-pdf__head-t { font-size: 1.4em; line-height: 1.2; }
.exo-pdf__head-c { font-size: 1.4em; line-height: 1.2; text-align: right; white-space: nowrap; }

/* ---- Un cadre par exercice, étiquette à cheval sur le filet -------------- */
.exo-pdf__cadre { padding-top: .62em; }            /* loge l'étiquette dans la capture */
.exo-pdf__ex {
    position: relative; border: 1px solid #9a9aa2; border-radius: 6px;
    padding: 13px 15px 12px;
}
.exo-pdf__lab {
    position: absolute; top: -.66em; left: 13px; padding: 0 6px;
    background: #fff; font-size: .95em; line-height: 1.2; color: #24242e;
}
/* Ligne d'attaque de secours : le titre de l'exercice, quand il n'a pas de consigne. */
.exo-pdf__amorce { margin: 0 0 9px; }

/* ---- Le rendu d'exo-core, repassé en typographie de sujet ---------------- */
.exo-pdf .exo-ex { margin: 0; }
.exo-pdf .exo-ex__consigne { margin: 0 0 9px; }
.exo-pdf .exo-ex__items { gap: 3px; }
.exo-pdf .exo-ex__grp { gap: 3px 22px; }
.exo-pdf .exo-item { padding: 2px 0; background: none; border-left: 0; border-radius: 0; }
.exo-pdf .exo-item__head { gap: 7px; }
.exo-pdf .exo-item__num { color: #111; font-weight: 400; }
.exo-pdf .exo-item__rep { margin: 4px 0 0 20px; }
.exo-pdf .exo-choix { gap: 1px; }
.exo-pdf .exo-choix__lab { padding: 2px 0; gap: 8px; }
.exo-pdf .exo-unite { color: #111; }
.exo-pdf .exo-zones__img { border-radius: 0; }

/* ---- Ce qui remplace les contrôles de saisie ----------------------------- */
/* La ligne pointillée porte sa largeur en style inline (calquée sur le champ
   d'origine) : un « ……… » de longueur fixe trahirait la réponse attendue. */
.exo-pdf__ligne {
    display: inline-block; border-bottom: 1px dotted #333;
    height: 1.1em; vertical-align: baseline; margin: 0 2px;
}
.exo-pdf__choix { font-size: .88em; color: #444; }
.exo-pdf__case {
    display: inline-block; width: .85em; height: .85em; flex: 0 0 auto;
    border: 1px solid #333; border-radius: 2px; margin-top: .28em;
}
/* Un trou logé dans une fraction garde la mise en colonne du numérateur. */
.exo-pdf .exo-frac .exo-pdf__ligne { display: block; margin: 2px auto; min-width: 3.4em; }
/* Les fractions d'une liste de choix n'héritent pas du grossissement accordé à celles
   des énoncés (.exo-item__enonce .exo-frac) : deux étages de chiffres logés dans une
   seule interligne, ce sont pourtant elles qui en ont le plus besoin sur papier. */
.exo-pdf .exo-choix__txt .exo-frac { font-size: 1.08em; }

/* Titre de sous-section de l'espace élève (« Dans Le Cours » sur la page Exercices). */
.eleve-page__sub2 { margin: 26px 0 10px; font-size: 1.02rem; }
/* Rappel de la leçon d'où vient une feuille d'exercices. */
.exo-card__lecon { font-size: .76rem; color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================================
   Paysage imposé (pages du Cours sur téléphone) — écran de garde
   -------------------------------------------------------------------------
   Le web ne permet PAS d'imposer l'orientation d'un onglet : `screen.orientation.lock()`
   n'existe que sur Android ET exige le plein écran ; iOS ne l'implémente pas du tout.
   L'écran de garde est donc le vrai mécanisme, et il tient en CSS seule pour rester
   debout même si le JS ne se charge pas ; js/orientation.js n'ajoute que le confort
   (tentative de verrouillage natif, blocage du défilement, échappatoire).
   `pointer: coarse` réserve le dispositif aux écrans tactiles : une fenêtre de bureau
   étroite et haute ne doit pas déclencher l'écran de garde.
   ========================================================================= */
.rotate-gate { display: none; }

@media (orientation: portrait) and (max-width: 820px) and (pointer: coarse) {
    .rotate-gate {
        position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
        padding: 24px; text-align: center; overscroll-behavior: contain;
        background: linear-gradient(160deg, #0b1220, var(--slate-900) 60%, #0b1220);
        color: #e2e8f0;
    }
    /* « Continuer quand même » : sans cette sortie, un appareil dont la rotation est
       verrouillée dans ses réglages resterait bloqué sur cet écran. */
    .rotate-gate.is-off { display: none; }

    /* Défilement gelé derrière l'écran de garde (classe posée par js/orientation.js).
       La règle vit DANS le @media, et c'est essentiel : si la classe survivait à une
       rotation — le `change` de matchMedia n'est pas garanti partout — un `overflow:
       hidden` resté sur <html> rendrait la page couchée impossible à faire défiler. */
    html.is-rotate-gated, html.is-rotate-gated body { overflow: hidden; }
}

.rotate-gate__box { max-width: 340px; }
.rotate-gate__ico {
    display: block; width: 84px; height: 84px; margin: 0 auto 18px; color: #38bdf8;
    animation: rotate-gate-tilt 2.4s ease-in-out infinite;
}
.rotate-gate__ico svg { width: 100%; height: 100%; }
.rotate-gate__title { margin: 0 0 8px; font-size: 1.3rem; color: #fff; }
.rotate-gate__lead { margin: 0 0 20px; font-size: .95rem; line-height: 1.5; color: var(--slate-300); }
.rotate-gate__lead strong { color: #fff; }
/* Le bouton naît `hidden` ; js/orientation.js ne le révèle que si le couple
   plein écran + verrouillage est réellement disponible. La règle est nécessaire :
   `.btn` impose `display: inline-flex`, qui l'emporterait sur l'attribut. */
.rotate-gate__go[hidden] { display: none; }
.rotate-gate__note { margin: 18px 0 0; font-size: .78rem; line-height: 1.5; color: var(--slate-400); }
.rotate-gate__skip {
    margin-top: 22px; padding: 8px 14px; background: none; border: 0; cursor: pointer;
    font: inherit; font-size: .78rem; color: var(--slate-400); text-decoration: underline;
}
.rotate-gate__skip:hover { color: var(--slate-300); }
.rotate-gate__go:focus-visible, .rotate-gate__skip:focus-visible {
    outline: 2px solid #38bdf8; outline-offset: 2px;
}

@keyframes rotate-gate-tilt {
    0%, 45%   { transform: rotate(0deg); }
    65%, 100% { transform: rotate(-90deg); }
}
@media (prefers-reduced-motion: reduce) {
    .rotate-gate__ico { animation: none; }
}

/* =========================================================================
   PAGE GESTION — les trois parties en onglets
   La classe « is-tabbed » est posée par cahier.js : sans JavaScript les trois
   parties restent affichées à la suite, et les ancres y mènent par défilement.
   ========================================================================= */
.gestion__head { align-items: flex-end; }
.gestion__tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.gestion__tab {
    padding: 8px 15px; border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent;
    color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.gestion__tab:hover { background: var(--slate-50); color: var(--text); text-decoration: none; }
.gestion__tab.is-on { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }
.gestion__tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.gestion.is-tabbed .gestion__panneau { display: none; }
.gestion.is-tabbed .gestion__panneau.is-on { display: block; }

/* =========================================================================
   PLANS DE CLASSE (onglet #plans)
   La salle est une grille d'unités : une seule variable, --u (pixels par carreau),
   commande toute l'échelle du dessin — tables, places, cadenas et textes suivent.
   js/plans.js la recalcule à chaque rendu et à chaque redimensionnement.
   ========================================================================= */
.plans__bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.plans__pick { display: flex; flex-direction: column; gap: 3px; }
.plans__pick-lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.plans__pick .field__input { min-width: 190px; }
.plans__bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
/* Sans plan ouvert, les actions du plan disparaissent : le display:inline-flex de .btn
   l'emporterait sinon sur l'attribut hidden. */
.plans__bar-actions .btn[hidden] { display: none; }
.plans__etat { font-size: .82rem; color: var(--muted); min-height: 1.2em; }
.plans__etat.is-err { color: #dc2626; font-weight: 600; }

.plans__salle-bar {
    display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end;
    padding: 10px 12px; margin-bottom: 12px;
    background: var(--slate-50); border: 1px solid var(--border); border-radius: 10px;
}
.plans__outil-grp { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.plans__mini { display: flex; flex-direction: column; gap: 2px; font-size: .76rem; color: var(--muted); font-weight: 600; }
.field__input--mini { padding: 4px 8px; font-size: .84rem; min-width: 92px; }

.plans__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.plans__stage { min-width: 0; }
.plans__aide { margin: 10px 0 0; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.plans__print-titre { display: none; }

/* ---- La salle ---------------------------------------------------------- */
.plan-room {
    --u: 24px;
    position: relative; margin: 0 auto;
    width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u));
    border: 1px solid var(--slate-300); border-radius: 12px;
    background:
        repeating-linear-gradient(to right, rgba(148,163,184,.22) 0 1px, transparent 1px var(--u)),
        repeating-linear-gradient(to bottom, rgba(148,163,184,.22) 0 1px, transparent 1px var(--u)),
        linear-gradient(#fbfdff, #f4f7fb);
    touch-action: none;               /* le doigt déplace une table, il ne fait pas défiler */
    /* Débordement VISIBLE, et c'est nécessaire : l'étiquette d'une place déborde de sa table
       quand celle-ci est pivotée (elle reste horizontale pour rester lisible), et la boîte à
       outils d'une table sort par le haut — masquer le débordement les couperait toutes deux
       sur les tables du premier rang. Le fond quadrillé, lui, s'arrête à la bordure. */
    overflow: visible;
}
.plan-room__tableau {
    position: absolute; left: 8%; right: 8%; top: 4px; height: calc(var(--u) * .95);
    display: flex; align-items: center; justify-content: center;
    background: #1f2937; color: #e2e8f0; border-radius: 5px;
    font-family: var(--font-display); font-weight: 700; letter-spacing: .28em;
    font-size: calc(var(--u) * .42); pointer-events: none;
}
.plan-bureau {
    position: absolute;
    left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
    width: calc(var(--bw) * var(--u)); height: calc(var(--bh) * var(--u));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #ede9fe; border: 1px dashed #a78bfa; border-radius: 7px;
    color: #6d28d9; font-weight: 700; font-size: calc(var(--u) * .42);
    /* Le bureau se traine comme une table (meme mecanique de glisser, cf. js/plans.js) :
       il lui faut donc capter le pointeur. user-select bloque la selection du mot pendant
       le geste, qui sinon surligne « Bureau » a chaque deplacement. */
    cursor: grab; user-select: none; -webkit-user-select: none;
}
.plan-bureau__nom { line-height: 1.15; }
.plan-bureau:hover { border-style: solid; }
.plan-bureau.is-drag { cursor: grabbing; opacity: .85; z-index: 6; }

/* ---- Une table --------------------------------------------------------- */
.plan-table {
    position: absolute;
    left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
    width: calc(var(--bw) * var(--u)); height: calc(var(--bh) * var(--u));
    background: #fff; border: 1px solid var(--slate-300); border-radius: 7px;
    box-shadow: 0 1px 2px rgba(15,23,42,.08);
    cursor: grab;
}
.plan-table.is-sel { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.28); z-index: 4; }
.plan-table.is-drag { cursor: grabbing; opacity: .85; z-index: 6; }
/* Repère d'orientation : le liseré épais marque le CÔTÉ REGARDÉ par les élèves.
   Sans lui, une table pivotée de 180° serait indiscernable d'une table droite. */
.plan-table__avant {
    position: absolute; left: 12%; right: 12%; top: -2px; height: 3px;
    background: var(--slate-400); border-radius: 2px;
}
.plan-table[data-r="90"]  .plan-table__avant { left: auto; right: -2px; top: 12%; bottom: 12%; width: 3px; height: auto; }
.plan-table[data-r="180"] .plan-table__avant { top: auto; bottom: -2px; }
.plan-table[data-r="270"] .plan-table__avant { left: -2px; right: auto; top: 12%; bottom: 12%; width: 3px; height: auto; }

.plan-table__tools {
    position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%);
    display: flex; gap: 3px; padding: 3px; z-index: 8;
    background: var(--slate-800); border-radius: 8px; box-shadow: 0 6px 16px rgba(15,23,42,.28);
}
.plan-table__btn {
    border: 0; background: none; color: #fff; cursor: pointer;
    font: inherit; font-size: .85rem; line-height: 1; padding: 5px 7px; border-radius: 5px;
}
.plan-table__btn:hover { background: rgba(255,255,255,.18); }
.plan-table__btn--del:hover { background: #dc2626; }

/* ---- Une place --------------------------------------------------------- */
.plan-seat {
    position: absolute;
    left: calc((var(--sx) - 1.4) * var(--u)); top: calc((var(--sy) - .85) * var(--u));
    width: calc(2.8 * var(--u)); height: calc(1.7 * var(--u));
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 2px;
    background: #fff; border: 1px dashed var(--slate-300); border-radius: 6px;
    font: inherit; font-size: calc(var(--u) * .5); color: var(--slate-400);
    cursor: pointer; overflow: visible; z-index: 2;
}
.plan-seat.is-taken {
    background: linear-gradient(160deg, #eef2ff, #e0e7ff);
    border: 1px solid #a5b4fc; color: var(--slate-800); font-weight: 600;
}
.plan-seat:hover { border-color: var(--primary); }
.plan-seat.is-sel { box-shadow: 0 0 0 2px var(--primary); }
.plan-seat.is-hot { border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,.35); }
/* --fit : facteur de reduction pose par ajusteNoms() (js/plans.js) sur les places dont le
   prenom deborde — un nom trop long retrecit plutot que d'etre coupe. Absent, il vaut 1 ;
   les points de suspension ne servent plus que sous le plancher de lisibilite. */
.plan-seat__nom {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1.1; font-size: calc(var(--u) * .5 * var(--fit, 1));
}
/* Ecriture TETE-BECHE : chaque prenom (et le mot « Bureau ») est ecrit deux fois, la copie
   du dessus retournee d'un demi-tour. Le plan se lit donc sans le retourner, aussi bien
   depuis le tableau que depuis le fond de la salle — c'est la seule facon de servir les
   deux points de vue sur une feuille unique. Les deux lignes encadrent les pictogrammes :
   le contenu reste symetrique, donc centre dans les deux sens. */
.plan-seat__nom--rev, .plan-bureau__nom--rev { transform: rotate(180deg); }
/* Les pictogrammes des caracteristiques vivent DANS la place (seconde ligne) : posés en
   dehors, ils venaient se superposer a la table du rang suivant. */
.plan-seat__traits {
    display: flex; gap: 1px; font-size: calc(var(--u) * .34); line-height: 1.1;
    max-width: 100%; overflow: hidden; pointer-events: none;
}
.plan-seat__lock {
    position: absolute; right: calc(-.28 * var(--u)); top: calc(-.32 * var(--u));
    width: calc(var(--u) * .72); height: calc(var(--u) * .72);
    display: flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--slate-300); border-radius: 50%;
    font-size: calc(var(--u) * .38); line-height: 1; opacity: 0; cursor: pointer;
}
.plan-seat:hover .plan-seat__lock, .plan-seat.is-lock .plan-seat__lock { opacity: 1; }
.plan-seat.is-lock { border-color: #f59e0b; box-shadow: inset 0 0 0 1px #fbbf24; }

/* Fantôme du glisser-déposer : suit le pointeur, ne capte rien. */
.plans__ghost {
    position: fixed; z-index: 90; transform: translate(-50%, -140%);
    padding: 5px 11px; border-radius: 8px; pointer-events: none;
    background: var(--primary); color: #fff; font-weight: 600; font-size: .85rem;
    box-shadow: 0 8px 20px rgba(79,70,229,.4);
}

/* ---- Panneau latéral --------------------------------------------------- */
.plans__side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plans__panel { border: 1px solid var(--border); border-radius: 10px; background: var(--slate-50); padding: 8px 12px 12px; }
.plans__panel-t { cursor: pointer; font-weight: 700; font-size: .92rem; padding: 3px 0; }
.plans__panel[open] .plans__panel-t { margin-bottom: 8px; }
.plans__badge {
    display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
    background: var(--primary); color: #fff; border-radius: 999px;
    font-size: .74rem; font-weight: 700; text-align: center;
}
.plans__vide-msg { color: var(--muted); font-size: .84rem; margin: 6px 0; }

.plans__eleves { display: flex; flex-wrap: wrap; gap: 6px; max-height: 230px; overflow: auto; padding: 2px; border-radius: 8px; }
.plans__eleves.is-hot { outline: 2px dashed #059669; outline-offset: 2px; }
.plans__eleve {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
    padding: 4px 9px; border-radius: 999px; font: inherit; font-size: .86rem;
    background: #fff; border: 1px solid var(--slate-300); color: var(--slate-800);
    touch-action: none;
}
.plans__eleve:hover { border-color: var(--primary); }
.plans__eleve.is-sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.plans__eleve-traits { font-size: .72rem; letter-spacing: -1px; }
.plans__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.plans__rapport { margin-top: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: 8px; font-size: .82rem; }
.plans__rapport ul { margin: 4px 0 0; padding-left: 18px; }
.plans__rapport li { margin: 2px 0; }
.plans__rapport-t { margin: 0; font-weight: 700; color: #b45309; }
.plans__rapport-t--ok { color: #047857; }

.plans__legende { list-style: none; margin: 0 0 10px; padding: 0; font-size: .78rem; color: var(--muted); }
.plans__legende li { margin: 3px 0; }
.plans__legende-ico { margin-right: 4px; }

.plans__traits { display: flex; flex-direction: column; gap: 3px; max-height: 320px; overflow: auto; }
.plans__trait-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.plans__trait-nom { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plans__trait-chips { display: flex; gap: 2px; flex-shrink: 0; }
.plans__trait-chip {
    width: 26px; height: 26px; padding: 0; cursor: pointer; line-height: 1;
    border: 1px solid var(--slate-200); border-radius: 7px; background: #fff;
    font-size: .82rem; filter: grayscale(1); opacity: .5;
}
.plans__trait-chip:hover { border-color: var(--primary); opacity: .85; }
.plans__trait-chip.is-on { filter: none; opacity: 1; border-color: var(--primary); background: #eef2ff; }

.plans__rel-pick { margin: 8px 0; padding: 8px; background: #fff; border: 1px solid var(--primary); border-radius: 8px; }
.plans__rel-consigne { margin: 0 0 6px; font-size: .84rem; font-weight: 600; }
.plans__relations { list-style: none; margin: 8px 0 0; padding: 0; }
.plans__rel { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: .84rem; }
.plans__rel-txt { flex: 1; }
.plans__rel--eloigne .plans__rel-txt { color: #b91c1c; }
.plans__rel--proche .plans__rel-txt { color: #047857; }

/* Une seule colonne : la SALLE reste en tete (c'est l'objet de la page), les panneaux
   passent dessous. Le placement en deux temps (clic sur l'eleve, puis clic sur la place)
   survit au defilement, contrairement au glisser-deposer. */
@media (max-width: 1100px) {
    .plans__grid { grid-template-columns: 1fr; }
    .plans__eleves { max-height: none; }
}
@media (max-width: 700px) {
    .plans__bar-actions { margin-left: 0; }
    .plans__pick .field__input { min-width: 0; width: 100%; }
    .plans__stage { overflow-x: auto; }
}

/* ---- Impression d'un plan ---------------------------------------------
   La classe is-plan-print n'est posée QUE le temps du window.print() déclenché par le
   bouton (js/plans.js) : un Ctrl+P ordinaire imprime la page comme avant. L'échelle de
   la salle est réglée en JS avant l'impression pour tenir dans la largeur d'une page. */
@media print {
    html.is-plan-print .topbar,
    html.is-plan-print .footer,
    html.is-plan-print .todo,
    html.is-plan-print .seance-pill,
    html.is-plan-print .gestion__head,
    html.is-plan-print .plans .cdt__bar,
    html.is-plan-print .plans__bar,
    html.is-plan-print .plans__salle-bar,
    html.is-plan-print .plans__side,
    html.is-plan-print .plans__aide,
    html.is-plan-print .gestion__panneau:not(#plans),
    html.is-plan-print .plan-seat__lock,
    html.is-plan-print .plan-table__tools { display: none !important; }
    html.is-plan-print .gestion__bloc { border: 0; box-shadow: none; padding: 0; margin: 0; }
    html.is-plan-print .plans__grid { display: block; }
    html.is-plan-print .plans__print-titre { display: block; margin: 0 0 10px; font-size: 1.1rem; }
    html.is-plan-print .plan-room { break-inside: avoid; background: #fff; }
    html.is-plan-print .plan-seat.is-taken { background: #eef2ff; }
}

/* =========================================================================
   MODULE « MOTS FLÉCHÉS »
   -------------------------------------------------------------------------
   Un seul dessin de grille sert partout — éditeur, aperçu, partie de l'élève,
   feuille imprimée. C'est pourquoi tout ce qui la concerne (.mf-grille et ses
   cases) est écrit UNE fois, sans variante par surface : ce que l'enseignant
   voit à l'écran est exactement ce qui sortira de l'imprimante.

   Parti pris graphique : on ne dessine que les cases QUI SERVENT. Les cases
   inutilisées restent transparentes plutôt que noires — sur une grille à moitié
   vide, un damier noir vide une cartouche d'encre pour rien, et le contour
   dentelé de la grille se lit de toute façon mieux sans.

   L'accent du module est celui de la part « Jeux & Exercices » du menu
   hexagonal : la couleur suit l'endroit d'où l'on vient.
   ========================================================================= */

:root {
    --mf-acc:   #db2777;   /* accent du module (part « Jeux & Exercices ») */
    --mf-acc-d: #be185d;
    --mf-acc-l: #fce7f3;
    --mf-ok:    #059669;   /* mot trouvé */
    --mf-ok-bg: #d1fae5;
    --mf-ko:    #dc2626;   /* lettre fausse */
    --mf-ko-bg: #fee2e2;
    --mf-trait: #334155;   /* filet des cases */
}

/* Variante compacte des champs, utilisée par les barres d'outils du module. */
.field__input--sm { padding: 5px 8px; font-size: .86rem; }

/* =========================================================================
   1. LA GRILLE  (partagée par toutes les surfaces)
   ========================================================================= */

.mf-grille {
    display: grid;
    gap: 0;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    /* Les aplats des cases doivent SORTIR à l'impression : sans cela, les cases de
       définition ressortent blanches et la grille devient illisible sur papier. */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.mf-case {
    position: relative;
    width: var(--mf-cell, 40px);
    height: var(--mf-cell, 40px);
    box-sizing: border-box;
}

/* Le filet est un OUTLINE tiré vers l'intérieur : deux cases voisines superposent
   exactement leurs traits, ce qu'une bordure ne fait pas (elle doublerait l'épaisseur
   et décalerait la grille d'un pixel à chaque colonne). */
.mf-case--lettre,
.mf-case--def {
    outline: 1.5px solid var(--mf-trait);
    outline-offset: -0.75px;
}
.mf-case--lettre { background: #fff; }
.mf-case--noire  { background: transparent; }

/* ---- Case-lettre -------------------------------------------------------- */
.mf-case__l,
.mf-case__in {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-size: calc(var(--mf-cell, 40px) * .52);
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    text-transform: uppercase;
}
.mf-case__in {
    appearance: none; -webkit-appearance: none;
    border: 0; background: transparent; padding: 0;
    text-align: center; caret-color: var(--mf-acc);
    font-family: var(--font-display);
}
.mf-case__in:focus { outline: none; }
.mf-case__in:read-only { cursor: default; }
.mf-case__l.is-donnee { color: var(--slate-500); }

.mf-case__num {
    position: absolute; top: 1px; left: 3px;
    font-size: calc(var(--mf-cell, 40px) * .26);
    line-height: 1; color: var(--slate-500);
    font-variant-numeric: tabular-nums; pointer-events: none;
}

/* Lettre offerte d'avance par l'enseignant : un fond très pâle suffit à dire
   « celle-ci est donnée », sans crier. */
.mf-case--lettre.is-donnee { background: var(--slate-100); }

/* États de jeu. Le mot courant s'éclaire, la case au clavier davantage ; un mot
   entièrement juste passe au vert et ne bouge plus. */
.mf-case--lettre.is-mot   { background: #fdf2f8; }
.mf-case--lettre.is-actif { background: var(--mf-acc-l); box-shadow: inset 0 0 0 2px var(--mf-acc); }
.mf-case--lettre.is-ok    { background: var(--mf-ok-bg); }
.mf-case--lettre.is-ok .mf-case__in,
.mf-case--lettre.is-ok .mf-case__l { color: var(--mf-ok); }
.mf-case--lettre.is-aide  { background: #fef9c3; }
.mf-case--lettre.is-ko    { background: var(--mf-ko-bg); animation: mf-secousse .3s; }
.mf-case--lettre.is-ko .mf-case__in { color: var(--mf-ko); }

@keyframes mf-secousse {
    0%, 100% { transform: none; }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}
@media (prefers-reduced-motion: reduce) {
    .mf-case--lettre.is-ko { animation: none; }
}

/* ---- Case de définition ------------------------------------------------- */
.mf-case--def {
    background: var(--slate-100);
    display: flex; flex-direction: column;
    overflow: hidden;
}
/* Deux définitions dans la même case (l'horizontale au-dessus, la verticale
   dessous) : c'est ce partage qui resserre une grille de mots fléchés. */
.mf-case--def2 .mf-def + .mf-def { border-top: 1px solid var(--slate-400); }

.mf-def {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: grid; place-items: center;
    padding: 1px 6px 1px 2px;
}
.mf-case--def2 .mf-def { padding: 0 6px 0 2px; }
.mf-def--v { padding-bottom: 6px; }
.mf-case--def2 .mf-def--v { padding-bottom: 5px; }

.mf-def__t {
    display: block; width: 100%; max-height: 100%; overflow: hidden;
    font-size: 9px; line-height: 1.05; text-align: center;
    color: var(--slate-700);
    /* Césure de la langue (la page est en lang="fr") plutôt que coupure brutale :
       « overflow-wrap » ne casse un mot que s'il ne tient pas seul sur une ligne, là où
       « word-break » coupait « polygone » en « polygo / ne » dès la première gêne. */
    hyphens: auto; overflow-wrap: break-word;
}
/* Définition qui ne rentre pas même à la taille plancher : elle est coupée
   proprement, et l'éditeur en tient le compte pour le signaler à l'enseignant. */
.mf-def.is-serre .mf-def__t { text-overflow: ellipsis; }

.mf-def__n {
    font-family: var(--font-display); font-weight: 700;
    font-size: calc(var(--mf-cell, 40px) * .34);
    color: var(--mf-acc-d); line-height: 1;
}
.mf-case--def2 .mf-def__n { font-size: calc(var(--mf-cell, 40px) * .26); }

/* La flèche indique où commence le mot : à droite pour l'horizontale, en bas
   pour la verticale. Elle sort du texte pour rester lisible quelle que soit la
   longueur de la définition. */
.mf-def__fl {
    position: absolute; color: var(--mf-acc);
    font-size: calc(var(--mf-cell, 40px) * .22); line-height: 1; pointer-events: none;
}
.mf-def--h .mf-def__fl { right: 0; top: 50%; transform: translateY(-50%); }
.mf-def--v .mf-def__fl { bottom: -2px; left: 50%; transform: translateX(-50%); }

/* ---- Liste des définitions (mots croisés et fléchés numérotés) ----------- */
.mf-defs {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px 26px; margin: 18px auto 0; max-width: 760px;
}
.mf-defs__t {
    margin: 0 0 6px; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--mf-acc-d); border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.mf-defs__l { list-style: none; margin: 0; padding: 0; }
.mf-defs__i {
    display: flex; gap: 6px; align-items: baseline; padding: 3px 4px;
    font-size: .86rem; line-height: 1.35; border-radius: 6px;
}
.mf-defs__n { flex: 0 0 auto; color: var(--mf-acc-d); font-variant-numeric: tabular-nums; }
.mf-defs__d { flex: 1 1 auto; }
.mf-defs__len { flex: 0 0 auto; color: var(--muted); font-size: .78rem; }
.mf-defs__i.is-ok { color: var(--muted); }
.mf-defs__i.is-ok .mf-defs__d { text-decoration: line-through; }
/* Cliquable seulement là où la grille se remplit : sur papier, ce serait un mensonge. */
[data-mf-jeu] .mf-defs__i { cursor: pointer; }
[data-mf-jeu] .mf-defs__i:hover { background: var(--mf-acc-l); }

/* ---- Miniature (choix entre plusieurs propositions) --------------------- */
.mf-mini { display: grid; gap: 0; width: max-content; }
.mf-mini__c { width: var(--mf-cell, 9px); height: var(--mf-cell, 9px); }
.mf-mini__c--l   { background: #fff; outline: .5px solid var(--slate-400); outline-offset: -.25px; }
.mf-mini__c--def { background: var(--mf-acc); opacity: .55; }

/* ---- Scène (la grille et son cadre) ------------------------------------- */
.mf-scene {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; overflow: auto;
}
.mf-scene__vue:empty { display: none; }
.mf-scene__vide { margin: 40px 0; text-align: center; color: var(--muted); line-height: 1.7; }
.mf-vide-grille, .mf-msg { margin: 0; padding: 18px; color: var(--muted); font-size: .9rem; text-align: center; }

/* =========================================================================
   2. BIBLIOTHÈQUE  (/mots-fleches)
   ========================================================================= */

.mf-biblio__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mf-biblio__head h1 { margin: 0; }
.mf-biblio__sub { margin: 4px 0 0; color: var(--muted); font-size: .92rem; max-width: 60ch; }
.mf-biblio__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mf-onglets { display: flex; gap: 4px; margin: 18px 0 12px; border-bottom: 1px solid var(--border); }
.mf-onglet {
    padding: 9px 16px; color: var(--muted); text-decoration: none;
    border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
}
.mf-onglet:hover { color: var(--text); background: var(--slate-50); text-decoration: none; }
.mf-onglet.is-on { color: var(--mf-acc-d); border-bottom-color: var(--mf-acc); font-weight: 600; }

.mf-filtres { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.mf-filtres__q { flex: 1 1 240px; min-width: 180px; }
.mf-filtres__sel { flex: 0 1 190px; }

.mf-mur { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; align-content: start; }
.mf-carte {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 14px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.mf-carte:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #f9a8d4; }
.mf-carte__haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mf-carte__titre { margin: 0; font-size: 1rem; line-height: 1.3; }
.mf-carte__consigne { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.4; }
.mf-carte__meta { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.mf-carte__auteur { font-style: italic; }
.mf-carte__chiffres { margin: 0; display: flex; gap: 10px; font-size: .84rem; color: var(--muted); }
.mf-carte__chiffres strong { color: var(--text); }
.mf-carte__reste { color: #b45309; }
.mf-carte__outils { display: flex; gap: 2px; justify-content: flex-end; margin-top: auto; padding-top: 6px; }
.mf-chip {
    background: var(--slate-100); border-radius: 20px; padding: 1px 9px; font-size: .76rem; color: var(--slate-600);
}

.mf-etat {
    flex: 0 0 auto; font-size: .7rem; font-weight: 700; letter-spacing: .03em;
    border-radius: 20px; padding: 2px 9px; white-space: nowrap;
    background: var(--slate-100); color: var(--slate-500);
}
.mf-etat--partage { background: #eef2ff; color: var(--primary-d); }
.mf-etat--publie  { background: var(--mf-acc-l); color: var(--mf-acc-d); }

.mf-ic {
    appearance: none; background: none; border: 0; cursor: pointer; font: inherit; font-size: .95rem;
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1;
}
.mf-ic:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.mf-ic--danger:hover { background: var(--mf-ko-bg); color: var(--mf-ko); }

.mf-vide { grid-column: 1 / -1; text-align: center; padding: 46px 20px; color: var(--muted); }
.mf-vide p { margin: 0 0 10px; }

.mf-corbeille { margin-top: 26px; color: var(--muted); font-size: .88rem; }
.mf-corbeille > summary { cursor: pointer; }
.mf-corbeille__list { list-style: none; margin: 10px 0 0; padding: 0; }
.mf-corbeille__list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }

.mf-check { display: flex; gap: 9px; align-items: flex-start; margin: 10px 0; font-size: .9rem; line-height: 1.4; cursor: pointer; }
.mf-check input { margin-top: 3px; flex: 0 0 auto; }
.mf-check--inline { margin: 0; align-items: center; }
.mf-foot__spacer { flex: 1 1 auto; }

.mf-apercu { display: flex; justify-content: center; padding: 6px 0 2px; }
.mf-apercu__meta { margin: 0 0 12px; color: var(--muted); font-size: .85rem; text-align: center; }

/* =========================================================================
   3. ÉDITEUR  (/mots-fleches/{id})
   ========================================================================= */

.mf-edit__bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; margin-bottom: 14px; position: sticky; top: 8px; z-index: 5;
}
.mf-edit__retour {
    width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto;
    border-radius: 8px; color: var(--muted); font-size: 1.1rem; text-decoration: none;
}
.mf-edit__retour:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.mf-edit__titre {
    flex: 1 1 240px; min-width: 180px;
    border: 1px solid transparent; background: transparent; border-radius: 8px;
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
    color: var(--text); padding: 6px 8px;
}
.mf-edit__titre:hover  { border-color: var(--border); }
.mf-edit__titre:focus  { border-color: var(--mf-acc); background: #fff; outline: none; }
.mf-edit__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-edit__actions { display: flex; gap: 6px; margin-left: auto; }

.mf-edit__etat { font-size: .82rem; color: var(--muted); min-width: 8ch; }
.mf-edit__etat.is-ok   { color: var(--mf-ok); }
.mf-edit__etat.is-sale { color: #b45309; }
.mf-edit__etat.is-ko   { color: var(--mf-ko); }

.mf-edit__corps { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---- Volet gauche : les mots ------------------------------------------- */
.mf-mots {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; position: sticky; top: 78px; max-height: calc(100vh - 96px);
    display: flex; flex-direction: column; gap: 10px;
}
.mf-mots__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mf-mots__head h2 { margin: 0; font-size: 1rem; }
.mf-mots__n { font-size: .82rem; color: var(--muted); }
.mf-mots__outils { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-hint { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }

.mf-liste { list-style: none; margin: 0; padding: 0 2px 0 0; overflow-y: auto; flex: 1 1 auto; }
.mf-liste__vide { margin: 20px 4px; font-size: .88rem; color: var(--muted); line-height: 1.6; text-align: center; }

.mf-mot {
    display: flex; gap: 8px; padding: 9px 6px; border-bottom: 1px solid var(--border);
}
.mf-mot:last-child { border-bottom: 0; }
/* Un mot que la composition n'a pas casé : signalé sans être caché — c'est lui qu'on
   raccourcit, ou qu'on retire, avant de recomposer. */
.mf-mot.is-hors { background: #fffbeb; border-left: 3px solid #f59e0b; margin-left: -6px; padding-left: 9px; }

.mf-mot__rang {
    flex: 0 0 20px; text-align: right; color: var(--slate-400);
    font-size: .78rem; padding-top: 7px; font-variant-numeric: tabular-nums;
}
.mf-mot__rang.is-src { color: var(--mf-acc); }
.mf-mot__rang.is-src::after { content: '⤓'; display: block; font-size: .7rem; }
.mf-mot__champs { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mf-mot__l1 { display: flex; align-items: center; gap: 6px; }
.mf-mot__aff {
    flex: 1 1 auto; min-width: 0;
    border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
    font: inherit; font-weight: 600;
}
.mf-mot__aff:focus { border-color: var(--mf-acc); outline: none; }
.mf-mot__norm {
    flex: 0 0 auto; font-size: .7rem; color: var(--slate-500); letter-spacing: .04em;
    font-family: var(--font-display); white-space: nowrap;
}
.mf-mot__norm.is-ko { color: var(--mf-ko); }
.mf-mot__norm.is-long { color: #b45309; }
.mf-mot__x {
    appearance: none; background: none; border: 0; cursor: pointer; color: var(--slate-400);
    width: 24px; height: 24px; border-radius: 6px; flex: 0 0 auto; line-height: 1;
}
.mf-mot__x:hover { background: var(--mf-ko-bg); color: var(--mf-ko); }
.mf-mot__def {
    border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
    font: inherit; font-size: .86rem; resize: vertical; min-height: 42px;
}
.mf-mot__def:focus { border-color: var(--mf-acc); outline: none; }
.mf-mot__court { display: flex; align-items: center; gap: 6px; }
.mf-mot__court[hidden] { display: none; }
.mf-mot__defc {
    flex: 1 1 auto; min-width: 0; border: 1px dashed var(--border); border-radius: 8px;
    padding: 4px 8px; font: inherit; font-size: .8rem;
}
.mf-mot__defc:focus { border-color: var(--mf-acc); border-style: solid; outline: none; }
.mf-mot__cpt { flex: 0 0 auto; font-size: .72rem; color: var(--slate-400); }
.mf-mot__cpt.is-long { color: #b45309; }

/* ---- Volet droit : la composition --------------------------------------- */
.mf-compo { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mf-compo__barre { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Le display:inline-flex de .btn écrase l'attribut [hidden] : on le rétablit, comme
   pour les boutons de la page d'impression du Cours. */
.mf-compo__barre .btn[hidden] { display: none; }

.mf-seg { display: inline-flex; background: var(--slate-100); border-radius: 10px; padding: 3px; gap: 2px; }
.mf-seg__b {
    appearance: none; background: none; border: 0; cursor: pointer; font: inherit;
    font-size: .84rem; padding: 6px 12px; border-radius: 8px; color: var(--muted);
}
.mf-seg__b:hover { color: var(--text); }
.mf-seg__b.is-on { background: #fff; color: var(--mf-acc-d); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.mf-seg--large { margin: 6px 0 12px; }

.mf-pres-aide { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }

.mf-props {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
}
.mf-props__t { margin: 0 0 10px; font-size: .84rem; color: var(--muted); }
.mf-props__l { display: flex; gap: 10px; flex-wrap: wrap; }
.mf-prop {
    appearance: none; cursor: pointer; font: inherit;
    background: var(--slate-50); border: 2px solid var(--border); border-radius: 12px;
    padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 5px;
    min-width: 120px;
}
.mf-prop:hover { border-color: #f9a8d4; }
.mf-prop.is-on { border-color: var(--mf-acc); background: var(--mf-acc-l); }
.mf-prop__mini { display: grid; place-items: center; min-height: 60px; }
.mf-prop__lbl { font-size: .78rem; color: var(--slate-600); font-variant-numeric: tabular-nums; }
.mf-prop.is-on .mf-prop__lbl { color: var(--mf-acc-d); font-weight: 600; }
.mf-prop__reste { font-size: .72rem; color: #b45309; }

.mf-alertes:empty { display: none; }
.mf-alerte {
    margin: 0 0 8px; padding: 9px 12px; border-radius: 10px; font-size: .85rem; line-height: 1.45;
}
.mf-alerte--warn { background: #fffbeb; border-left: 3px solid #f59e0b; color: #92400e; }
.mf-alerte--ko   { background: var(--mf-ko-bg); border-left: 3px solid var(--mf-ko); color: #991b1b; }

.mf-reglages {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.mf-reglages__t {
    margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.mf-reglages__t + .mf-reglages__t, .mf-check + .mf-reglages__t { margin-top: 16px; }
.mf-reglage { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: .9rem; }
.mf-reglage__l { flex: 0 0 auto; }
.mf-reglage input[type="range"] { flex: 1 1 auto; max-width: 220px; accent-color: var(--mf-acc); }
.mf-reglage output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .84rem; }
.mf-reglage__note { margin: 0 0 12px; font-size: .8rem; color: var(--muted); line-height: 1.45; }

/* ---- Fenêtre de récolte -------------------------------------------------- */
.mf-recolte__filtres { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mf-recolte__filtres > * { flex: 1 1 150px; min-width: 130px; }
.mf-recolte__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: .86rem;
}
.mf-recolte__n { color: var(--mf-acc-d); font-weight: 600; }
.mf-recolte__l { max-height: 46vh; overflow-y: auto; padding: 4px 2px; }

.mf-r-item {
    display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px;
    border-radius: 10px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.mf-r-item:hover { background: var(--slate-50); }
.mf-r-item.is-deja { opacity: .5; cursor: default; }
.mf-r-item input { margin-top: 3px; flex: 0 0 auto; }
.mf-r-item__corps { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mf-r-item__mot { font-weight: 600; font-size: .9rem; }
.mf-r-item__n { margin-left: 8px; font-weight: 400; font-size: .74rem; color: var(--muted); }
.mf-r-item__n.is-long { color: #b45309; }
.mf-r-item__def { font-size: .84rem; color: var(--slate-600); line-height: 1.4; }
.mf-r-item__ou  { font-size: .74rem; color: var(--muted); }

.mf-classes { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.mf-classes legend { font-size: .82rem; color: var(--muted); padding: 0 6px; }
.mf-classes[disabled] { opacity: .45; }
.mf-classes .mf-check { margin: 5px 0; }

/* =========================================================================
   4. CÔTÉ ÉLÈVE
   ========================================================================= */

.mf-jeux__l { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mf-jeu {
    display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.mf-jeu:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); border-color: #f9a8d4; }
.mf-jeu.is-fini { border-color: #a7f3d0; background: #f0fdf9; }
.mf-jeu__ic { flex: 0 0 auto; width: 40px; height: 40px; color: var(--mf-acc); }
.mf-jeu__ic svg { width: 100%; height: 100%; }
.mf-jeu.is-fini .mf-jeu__ic { color: var(--mf-ok); }
.mf-jeu__corps { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mf-jeu__t { font-weight: 600; }
.mf-jeu__c { font-size: .84rem; color: var(--slate-600); }
.mf-jeu__meta { font-size: .78rem; color: var(--muted); }
.mf-jeu__jauge { display: block; height: 5px; border-radius: 3px; background: var(--slate-200); overflow: hidden; margin-top: 4px; }
.mf-jeu__jauge-in { display: block; height: 100%; background: var(--mf-acc); border-radius: 3px; }
.mf-jeu.is-fini .mf-jeu__jauge-in { background: var(--mf-ok); }
.mf-jeu__etat { font-size: .78rem; color: var(--muted); }
.mf-jeu__go {
    flex: 0 0 auto; font-size: .8rem; font-weight: 600; color: var(--mf-acc-d);
    background: var(--mf-acc-l); border-radius: 20px; padding: 4px 12px;
}
.mf-jeu.is-fini .mf-jeu__go { color: var(--mf-ok); background: var(--mf-ok-bg); }

/* ---- La partie ---------------------------------------------------------- */
.mf-jeu-page__head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.mf-jeu-page__retour {
    flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center;
    border-radius: 10px; background: var(--card); border: 1px solid var(--border);
    color: var(--muted); text-decoration: none; font-size: 1.1rem;
}
.mf-jeu-page__retour:hover { text-decoration: none; color: var(--text); }
.mf-jeu-page__t h1 { margin: 0; font-size: 1.25rem; }
.mf-jeu-page__c { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }

.mf-hud {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 10px;
}
.mf-hud__score { flex: 1 1 200px; min-width: 160px; }
.mf-hud__chrono { flex: 0 0 auto; text-align: center; }
.mf-hud__n { display: block; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mf-hud__l { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mf-hud__jauge { display: block; height: 6px; border-radius: 3px; background: var(--slate-200); overflow: hidden; margin-top: 6px; }
.mf-hud__jauge-in { display: block; height: 100%; width: 0; background: var(--mf-acc); border-radius: 3px; transition: width .3s ease; }
.mf-hud__b { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.mf-jeu-page__aide { margin: 0 0 12px; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.mf-jeu-page__msg { margin: 10px 0 0; min-height: 1.4em; font-size: .9rem; text-align: center; color: var(--muted); }
.mf-jeu-page__msg.is-ok { color: var(--mf-ok); font-weight: 600; }
.mf-jeu-page__msg.is-ko { color: var(--mf-ko); }
.mf-scene--jeu { display: flex; justify-content: center; }

.mf-fini {
    position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
    background: rgba(15, 23, 42, .55); padding: 20px;
}
.mf-fini[hidden] { display: none; }
.mf-fini__box {
    background: #fff; border-radius: 18px; padding: 28px 32px; text-align: center;
    max-width: 380px; box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
}
.mf-fini__ic { margin: 0; font-size: 2.6rem; line-height: 1; }
.mf-fini__box h2 { margin: 10px 0 6px; }
.mf-fini__d { margin: 0 0 18px; color: var(--muted); }
.mf-fini__b { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* =========================================================================
   5. SUIVI
   ========================================================================= */

.mf-suivi__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.mf-suivi__head h1 { margin: 0; }
.mf-suivi__classe { margin-top: 26px; }
.mf-suivi__t { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.05rem; }
.mf-suivi__scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

.mf-tab { border-collapse: collapse; width: 100%; font-size: .86rem; }
.mf-tab th, .mf-tab td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.mf-tab thead th { background: var(--slate-50); font-size: .78rem; color: var(--muted); font-weight: 600; }
.mf-tab__grille { display: block; color: var(--text); }
.mf-tab__sur { display: block; font-weight: 400; }
.mf-tab__eleve { position: sticky; left: 0; background: var(--card); font-weight: 600; white-space: nowrap; }
.mf-tab thead .mf-tab__eleve { background: var(--slate-50); }
.mf-tab__c.is-fini { background: #f0fdf9; }
.mf-tab__c.is-vide { color: var(--slate-300); }
.mf-tab__rien { color: var(--slate-400); }
.mf-tab__n { display: block; font-variant-numeric: tabular-nums; margin-top: 3px; }
.mf-tab__d { display: block; font-size: .76rem; color: var(--muted); }

.mf-suivi__vides { margin-top: 22px; font-size: .84rem; color: var(--muted); }

.mf-jauge { display: block; width: 76px; height: 5px; border-radius: 3px; background: var(--slate-200); overflow: hidden; }
.mf-jauge__in { display: block; height: 100%; background: var(--mf-acc); border-radius: 3px; }
.mf-tab__c.is-fini .mf-jauge__in { background: var(--mf-ok); }

/* =========================================================================
   6. IMPRESSION
   ========================================================================= */

.mf-print__bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 18px;
}
.mf-print__sep { width: 1px; height: 24px; background: var(--border); }
.mf-print__opt { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--slate-600); }
.mf-print__opt input[type="range"] { accent-color: var(--mf-acc); max-width: 120px; }
.mf-print__note { font-size: .78rem; color: var(--muted); flex-basis: 100%; }
.mf-print__vide { text-align: center; color: var(--muted); padding: 40px 0; }

.mf-feuille { margin: 0 auto 28px; max-width: 186mm; }
.mf-feuille__head { margin-bottom: 16px; }
.mf-feuille__t { margin: 0; font-size: 1.3rem; }
.mf-feuille__c { margin: 4px 0 0; color: var(--slate-600); font-size: .92rem; }
.mf-feuille__ligne { display: flex; gap: 24px; margin-top: 14px; font-size: .88rem; color: var(--slate-600); }
.mf-feuille__champ { display: flex; align-items: baseline; gap: 6px; flex: 1 1 auto; }
.mf-feuille__trait { flex: 1 1 auto; border-bottom: 1px dotted var(--slate-400); min-width: 90px; }
.mf-feuille__trait--court { flex: 0 0 90px; }
.mf-feuille__grille { display: flex; flex-direction: column; align-items: center; }

@media print {
    /* Une feuille par page : l'exemplaire suivant (ou le corrigé) recommence en haut
       d'une page neuve, jamais à cheval sur deux. La DERNIÈRE ne force rien, sous peine
       d'ajouter une page blanche en fin de document. */
    .mf-feuille { break-after: page; page-break-after: always; margin-bottom: 0; max-width: none; }
    .mf-feuille:last-child { break-after: auto; page-break-after: auto; }
    .mf-grille, .mf-defs { break-inside: avoid; }
    .mf-print__bar { display: none !important; }
    /* Les cases-lettres doivent rester franchement blanches : un fond d'état (mot
       trouvé, case active) n'a aucun sens sur le papier — l'élève écrit dessus. */
    .mf-case--lettre { background: #fff !important; }
    .mf-case--lettre.is-donnee { background: #f1f5f9 !important; }
}

/* =========================================================================
   7. ADAPTATIONS AUX PETITS ÉCRANS
   ========================================================================= */

@media (max-width: 1080px) {
    .mf-edit__corps { grid-template-columns: 1fr; }
    .mf-mots { position: static; max-height: none; }
}
@media (max-width: 720px) {
    .mf-edit__bar { position: static; }
    .mf-hud { gap: 12px; }
    .mf-hud__b { width: 100%; margin-left: 0; }
    .mf-scene { padding: 10px; }
    /* Sur téléphone, la grille se parcourt au doigt plutôt que de rétrécir jusqu'à
       l'illisible : elle garde sa taille et son cadre défile. */
    .mf-scene__vue { overflow-x: auto; }
    .mf-defs { grid-template-columns: 1fr; }
}

/* =========================================================================
   DOSSIERS PARTAGÉS ENTRE ENSEIGNANTS (migration 065)
   Un dossier commun à plusieurs professeurs : pastille sur la tuile, bandeau
   d'en-tête quand il est ouvert, liste à cocher dans la modale du dossier.
   ========================================================================= */

/* ---- Modale du dossier : bloc « Dossier partagé » --------------------- */
.fmp { border-top: 1px solid var(--slate-200); margin-top: 14px; padding-top: 10px; }
.fmp[hidden] { display: none; }
.fmp .switch { margin-bottom: 4px; }
.fmp__body { margin-top: 6px; }
.fmp__q { margin: 8px 0 6px; }
/* Liste bornée en hauteur : au-delà d'une poignée de collègues, elle défile plutôt
   que de repousser « Enregistrer » hors de l'écran. */
.fmp__list { list-style: none; margin: 0; padding: 4px; max-height: 190px; overflow-y: auto;
    border: 1px solid var(--slate-200); border-radius: 10px; background: #fff; }
.fmp__list li[hidden] { display: none; }
.fmp__list label { display: flex; align-items: center; gap: 9px; padding: 6px 8px;
    border-radius: 8px; cursor: pointer; font-size: .92rem; }
.fmp__list label:hover { background: var(--slate-100, #f1f5f9); }
.fmp__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmp__compte { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.fmp__vide { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }

/* ---- Bandeau du dossier partagé ouvert -------------------------------- */
.docs-equipe { margin: 0 0 10px; padding: 8px 14px; border-radius: 10px; font-size: .88rem;
    background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.docs-equipe__t { font-weight: 700; margin-right: 6px; }

/* ---- Pastille « partagé entre enseignants » sur la tuile dossier ------
   En bas à GAUCHE, symétrique de l'œil « visible élèves » (bas à droite) : les deux
   peuvent être allumées en même temps sur le même hexagone, et doivent rester dans
   le polygone (cf. le commentaire de .hm-hex__eleve). */
.hm-hex__equipe { position: absolute; bottom: 14px; left: 52px; z-index: 2; display: grid; place-items: center;
    width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.94); color: #4338ca;
    box-shadow: 0 1px 4px rgba(15,23,42,.35); }
.hm-hex__equipe svg { width: 13px; height: 13px; display: block; }

/* Liseré indigo du dossier partagé, posé comme celui du partage élève. Quand les deux
   sont actifs, le vert de l'élève l'emporte : c'est le partage qui expose le plus. */
.hm-tile[data-equipe="1"]::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: #4f46e5;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
.hm-tile[data-equipe="1"] .hm-hex { position: relative; z-index: 1; transform: scale(.955); }

/* ---- Auteur d'une ressource déposée par un collègue -------------------
   Sur la tuile, au-dessus du titre : savoir de qui est la ressource change la portée
   du geste « corbeille », que tout membre peut faire sur celle d'un autre. */
.hm-hex__auteur { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); z-index: 2;
    max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 1px 8px; border-radius: 999px; font-size: .66rem; font-weight: 700;
    background: rgba(238,242,255,.95); color: #3730a3; box-shadow: 0 1px 3px rgba(15,23,42,.28); }

/* =========================================================================
   MODULE PYTHON — l'atelier de programmation (/python et /espace-eleve/python)
   =========================================================================

   Trois volets côte à côte : les leçons, l'éditeur, le résultat. La page occupe
   toute la hauteur de la fenêtre et NE DÉFILE PAS : chaque volet a son propre
   défilement. Un atelier où l'on perd l'éditeur de vue en lisant la console
   n'est pas un atelier.

   Deux points de la feuille demandent de l'attention avant toute retouche :

   1. LES TROIS COUCHES DE L'ÉDITEUR (.pyed__hl, .pyed__marques, .pyed__saisie)
      doivent partager EXACTEMENT police, taille, interligne, marges intérieures
      et gestion des blancs. Une différence d'un demi-pixel et le code coloré se
      décale du texte réellement saisi — l'élève voit alors une coloration qui
      « glisse » ligne après ligne. Toutes les valeurs communes sont posées une
      seule fois, sur .pyed, et héritées.

   2. LA COULEUR DU MODULE est celle de la part « Jeux & Exercices » du menu
      hexagonal (#db2777), comme pour les mots fléchés : un module se reconnaît
      à la couleur de la porte par laquelle on y entre. Elle reste cantonnée au
      chrome ; l'éditeur, lui, garde une palette de code sur fond sombre — c'est
      la convention de tous les environnements de programmation, et un élève qui
      passera un jour à un vrai éditeur ne sera pas dépaysé.
   ========================================================================= */

:root {
    --py-acc:   #db2777;    /* accent du module (part « Jeux & Exercices ») */
    --py-acc-d: #be185d;
    --py-acc-l: #fce7f3;
    --py-fond:  #0f172a;    /* fond de l'éditeur et de la console */
    --py-fond2: #172033;    /* fond de la gouttière */
    --py-trait: #1e293b;
    --py-code:  #e2e8f0;
}

/* La page de l'atelier ne défile pas : elle occupe la fenêtre. Le pied de page
   n'a rien à y faire — il pousserait la grille vers le haut pour rien. */
body.py-body .container { max-width: 1560px; padding-bottom: 10px; }
body.py-body .footer { display: none; }

/* Hauteur : l'atelier va du bas de la barre d'outils au bas de la fenêtre. L'écart
   du haut (--py-haut) n'est PAS une constante : l'espace enseignant et l'espace élève
   n'ont pas la même barre supérieure, et le bandeau d'impersonation en ajoute une
   troisième. C'est donc l'atelier lui-même qui mesure sa position au démarrage et pose
   la variable (cf. caleHauteur, js/python-atelier.js) ; la valeur écrite ici n'est que
   le repli employé avant la première mesure. */
.py {
    display: flex; flex-direction: column; gap: 10px;
    height: calc(100dvh - var(--py-haut, 118px)); min-height: 460px;
}

/* ---- barre d'outils ---------------------------------------------------- */
.py__barre {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 8px 12px; box-shadow: var(--shadow); flex: 0 0 auto;
}
.py__ident { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.py__logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
    background: var(--py-acc); color: #fff; font-weight: 700;
    font-family: var(--font-mono, ui-monospace, monospace); font-size: .9rem;
}
.py__titre {
    flex: 1 1 auto; min-width: 0; max-width: 460px;
    border: 1px solid transparent; border-radius: 8px; padding: 6px 10px;
    font: 600 1.02rem var(--font-display); color: var(--slate-900); background: transparent;
}
.py__titre:hover:not(:disabled) { border-color: var(--border); }
.py__titre:focus { border-color: var(--py-acc); outline: none; background: #fff; }
.py__titre:disabled { color: var(--muted); }

.py__etat { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.py__etat.is-sale { color: #b45309; }
.py__etat.is-ok   { color: #047857; }
.py__etat.is-ko   { color: #b91c1c; font-weight: 600; }

.py__actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.py__go { background: var(--py-acc); }
.py__go:hover { background: var(--py-acc-d); }
.py__go-ico { font-size: .78rem; }
.btn--danger { background: #b91c1c; color: #fff; }
.btn--danger:hover { background: #991b1b; color: #fff; }
.btn--sm { padding: 5px 11px; font-size: .82rem; border-radius: 8px; }

.py__menu { position: relative; }
.py__menu > .btn { border-color: var(--border); color: var(--slate-600); font-size: 1.1rem; padding: 8px 12px; }
.py__menu > .btn:hover { background: var(--slate-100); }
.py__menu-liste {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
    margin: 0; padding: 5px; list-style: none; min-width: 230px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15,23,42,.16);
}
.py__menu-liste button {
    display: block; width: 100%; text-align: left; padding: 8px 10px;
    background: none; border: 0; border-radius: 7px; font: inherit; font-size: .9rem;
    color: var(--slate-700); cursor: pointer;
}
.py__menu-liste button:hover { background: var(--slate-100); }
.py__menu-liste button.is-danger { color: #b91c1c; }
.py__menu-sep { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

/* ---- les trois volets --------------------------------------------------- */
.py__grille {
    flex: 1 1 auto; min-height: 0;
    display: grid; grid-template-columns: 300px minmax(0, 1fr) 380px; gap: 10px;
}
.py__rail, .py__centre, .py__sortie {
    display: flex; flex-direction: column; min-height: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; box-shadow: var(--shadow);
}
.py__centre, .py__sortie { background: var(--py-fond); border-color: #0b1220; }

/* ---- onglets ------------------------------------------------------------ */
.py__onglets {
    display: flex; align-items: stretch; gap: 2px; flex: 0 0 auto;
    border-bottom: 1px solid var(--border); background: var(--slate-50); padding: 0 4px;
    /* Filet de sécurité : sur un rail étroit, mieux vaut faire défiler la barre
       d'onglets que rogner le dernier libellé au milieu d'un mot. */
    overflow-x: auto; scrollbar-width: none;
}
.py__onglets::-webkit-scrollbar { height: 0; }
.py__sortie .py__onglets { background: var(--py-fond2); border-bottom-color: var(--py-trait); }
.py__onglet {
    background: none; border: 0; border-bottom: 2px solid transparent;
    padding: 9px 11px; font: inherit; font-size: .86rem; font-weight: 600;
    color: var(--muted); cursor: pointer; white-space: nowrap;
}
.py__onglet:hover { color: var(--slate-700); }
.py__onglet.is-actif { color: var(--py-acc); border-bottom-color: var(--py-acc); }
.py__sortie .py__onglet { color: #94a3b8; }
.py__sortie .py__onglet:hover { color: #e2e8f0; }
.py__sortie .py__onglet.is-actif { color: #fff; border-bottom-color: var(--py-acc); }
.py__vider {
    margin-left: auto; background: none; border: 0; color: #64748b; cursor: pointer;
    font: inherit; font-size: .78rem; padding: 0 10px;
}
.py__vider:hover { color: #e2e8f0; text-decoration: underline; }
.py__pastille {
    display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px;
    border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 17px;
    text-align: center; background: var(--slate-400); color: #fff;
}
.py__pastille.is-erreur { background: #dc2626; }
.py__pastille.is-alerte { background: #d97706; }

.py__volet { display: none; flex: 1 1 auto; min-height: 0; overflow: auto; }
.py__volet.is-actif { display: block; }
.py__sortie .py__volet.is-actif,
.py__rail  .py__volet.is-actif { display: flex; flex-direction: column; }

.py__volet-tete { padding: 10px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.py__aide { margin: 10px 12px; font-size: .84rem; color: var(--slate-600); line-height: 1.5; }
.py__vide { margin: 16px 12px; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.py__etat-classes { margin: 4px 12px 10px; font-size: .8rem; color: var(--py-acc-d); min-height: 1em; }

/* ---- bibliothèque ------------------------------------------------------- */
.pylist { list-style: none; margin: 0; padding: 6px; }
.pylist__item { display: flex; align-items: center; gap: 6px; }
.pylist__ouvre {
    display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto;
    align-items: center; gap: 0 8px; width: 100%; text-align: left;
    background: none; border: 0; border-radius: 9px; padding: 7px 9px; cursor: pointer; font: inherit;
}
.pylist__ouvre:hover { background: var(--slate-100); }
.pylist__item.is-ouvert .pylist__ouvre { background: var(--py-acc-l); }
.pylist__ico { grid-row: 1 / 3; font-size: .95rem; color: var(--py-acc); font-family: var(--font-mono, monospace); }
.pylist__nom { font-size: .9rem; font-weight: 600; color: var(--slate-800);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pylist__meta { font-size: .74rem; color: var(--muted); }
.pylist__tag { color: var(--py-acc-d); font-weight: 600; }
.pylist--corbeille .pylist__item { padding: 4px 9px; font-size: .84rem; justify-content: space-between; }
.py__corbeille { margin: 8px 12px 14px; font-size: .84rem; color: var(--muted); }
.py__corbeille summary { cursor: pointer; }

.pyclasses { list-style: none; margin: 0 12px; padding: 0; }
.pyclasses__l { display: flex; align-items: center; gap: 9px; padding: 7px 4px; cursor: pointer; font-size: .9rem; }
.pyclasses__l em { color: var(--muted); font-style: normal; font-size: .8rem; }

/* ---- l'éditeur ---------------------------------------------------------
   ⚠️ Les trois couches partagent les valeurs posées ICI, sur .pyed. Ne jamais
   redéfinir police, taille, interligne ou marges sur une seule d'entre elles :
   c'est le seul moyen de garantir qu'elles restent superposées au pixel près. */
.pyed {
    --pyed-pad: 12px;
    flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden;
    background: var(--py-fond); color: var(--py-code);
    font-family: var(--font-mono, ui-monospace, "Cascadia Mono", "Consolas", monospace);
    font-size: 14px; line-height: 21px; tab-size: 4;
}
.pyed__gouttiere {
    flex: 0 0 auto; overflow: hidden; user-select: none;
    padding: var(--pyed-pad) 8px var(--pyed-pad) 12px;
    background: var(--py-fond2); border-right: 1px solid var(--py-trait);
    text-align: right; color: #475569;
}
.pyed__no { display: block; position: relative; }
.pyed__no.is-ici { color: #e2e8f0; }
.pyed__no.a-erreur::after, .pyed__no.a-alerte::after {
    content: ''; position: absolute; left: -7px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px; border-radius: 50%;
}
.pyed__no.a-erreur::after { background: #ef4444; }
.pyed__no.a-alerte::after { background: #f59e0b; }

.pyed__zone { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.pyed__hl, .pyed__saisie, .pyed__marques {
    position: absolute; inset: 0; margin: 0;
    padding: var(--pyed-pad) var(--pyed-pad) 40vh;
    font: inherit; line-height: inherit; letter-spacing: normal;
    white-space: pre; word-wrap: normal; tab-size: inherit;
    border: 0; box-sizing: border-box;
}
.pyed__hl { overflow: hidden; pointer-events: none; z-index: 1; }
.pyed__hl code { font: inherit; background: none; padding: 0; color: inherit; }
.pyed__marques { overflow: visible; pointer-events: none; z-index: 2; padding: 0;
    inset: var(--pyed-pad) auto auto var(--pyed-pad); width: 0; height: 0; }
.pyed__saisie {
    z-index: 3; overflow: auto; resize: none; outline: none;
    background: transparent; color: transparent; caret-color: #f472b6;
}
.pyed__saisie::selection { background: rgba(219,39,119,.30); }
.pyed.is-lecture .pyed__saisie { caret-color: transparent; }

/* Soulignement ondulé, dessiné en dégradé : pas d'image, pas de police
   particulière, et l'épaisseur suit la taille du texte. */
.pyed__marque { position: absolute; pointer-events: none; }
.pyed__marque::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 3px;
    background-image: linear-gradient(135deg, transparent 42%, currentColor 42%, currentColor 58%, transparent 58%),
                      linear-gradient(45deg,  transparent 42%, currentColor 42%, currentColor 58%, transparent 58%);
    background-size: 6px 3px; background-repeat: repeat-x;
}
.pyed__marque.is-erreur { color: #f87171; }
.pyed__marque.is-alerte { color: #fbbf24; }
.pyed__marque.is-info   { color: #60a5fa; }

/* Coloration syntaxique — également employée par l'impression et le didacticiel. */
.tk-cle { color: #f472b6; font-weight: 600; }
.tk-nat { color: #38bdf8; }
.tk-fn  { color: #a5b4fc; }
.tk-txt { color: #86efac; }
.tk-com { color: #64748b; font-style: italic; }
.tk-num { color: #fbbf24; }
.tk-op  { color: #cbd5e1; }
.tk-par { color: #94a3b8; }
.tk-ouvert { background: rgba(239,68,68,.22); border-radius: 3px; }

/* ---- pied de l'éditeur (réglages) --------------------------------------- */
.py__pied {
    flex: 0 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 7px 12px; background: var(--py-fond2); border-top: 1px solid var(--py-trait);
    color: #94a3b8; font-size: .78rem;
}
.py__pos { font-family: var(--font-mono, monospace); }
.py__pied-sep { width: 1px; height: 16px; background: var(--py-trait); }
.py__mode, .py__coche { display: inline-flex; align-items: center; gap: 5px; }
.py__pied select {
    background: #0b1220; color: #e2e8f0; border: 1px solid var(--py-trait);
    border-radius: 6px; padding: 3px 6px; font: inherit; font-size: .78rem;
}
.py__ranger { max-width: 130px; }
.py__coche { cursor: pointer; }

/* ---- console ------------------------------------------------------------ */
.pyconsole {
    flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px;
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px; line-height: 1.55;
    color: #e2e8f0; white-space: pre-wrap; word-break: break-word;
}
.pyconsole:focus { outline: none; }
.pyconsole__l.is-erreur { color: #fca5a5; font-weight: 600; }
.pyconsole__l.is-fin    { color: #64748b; }
.pyconsole__l.is-note   { color: #fbbf24; }
.pyconsole__l.is-entree { color: #67e8f9; }
.pyconsole__saisie { display: flex; align-items: baseline; gap: 0; }
.pyconsole__invite { color: #e2e8f0; white-space: pre-wrap; }
.pyconsole__champ {
    flex: 1 1 auto; min-width: 60px; background: transparent; border: 0;
    border-bottom: 1px solid #67e8f9; color: #67e8f9; font: inherit; outline: none; padding: 0 2px;
}

/* ---- scène de la tortue -------------------------------------------------- */
.pyscene { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pyscene__cadre {
    background: #fff; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
    position: relative; overflow: hidden; line-height: 0;
}
.pyscene__cadre canvas { display: block; }
.pyscene__aide { color: #64748b; font-size: .8rem; text-align: center; margin: 0; }
.pyscene__aide code { color: #86efac; }

/* ---- panneau des erreurs ------------------------------------------------- */
.pydiag { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px; }
.pydiag__resume { margin: 0 2px 8px; font-size: .8rem; color: #94a3b8; }
.pydiag__c {
    background: #172033; border: 1px solid var(--py-trait); border-left: 3px solid #64748b;
    border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.pydiag__c:hover { background: #1c2740; }
.pydiag__c.is-erreur { border-left-color: #ef4444; }
.pydiag__c.is-alerte { border-left-color: #f59e0b; }
.pydiag__h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.pydiag__ligne {
    flex: 0 0 auto; font-family: var(--font-mono, monospace); font-size: .7rem;
    color: #94a3b8; background: #0b1220; padding: 1px 6px; border-radius: 5px;
}
.pydiag__t { margin: 0; font-size: .92rem; font-weight: 600; color: #f1f5f9; line-height: 1.3; }
.pydiag__m { margin: 0 0 6px; font-size: .84rem; color: #cbd5e1; line-height: 1.55; }
.pydiag__conseil { margin: 0; font-size: .84rem; color: #86efac; line-height: 1.5; }
.pydiag__fix {
    margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #0b1220; border-radius: 7px; padding: 6px 8px;
}
.pydiag__fix code {
    flex: 1 1 auto; min-width: 0; font-family: var(--font-mono, monospace); font-size: .78rem;
    color: #86efac; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pydiag__fix .btn { background: var(--py-acc); color: #fff; flex: 0 0 auto; }
.pydiag__fix .btn:hover { background: var(--py-acc-d); }
.pydiag__ok { padding: 14px 12px; color: #94a3b8; font-size: .86rem; line-height: 1.6; }
.pydiag__ok-t { color: #86efac; font-weight: 600; margin: 0 0 6px; }
.pydiag__ok code { color: #38bdf8; }

/* ---- didacticiel --------------------------------------------------------- */
.pytuto { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pytuto__tete { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
    background: var(--card); z-index: 2; }
.pytuto__titre { margin: 0; font: 700 1.05rem var(--font-display); color: var(--slate-900); }
.pytuto__sous { margin: 3px 0 8px; font-size: .8rem; color: var(--muted); }
.pytuto__jauge { height: 5px; border-radius: 999px; background: var(--slate-200); overflow: hidden; }
.pytuto__jauge i { display: block; height: 100%; background: var(--py-acc); border-radius: 999px;
    transition: width .35s ease; }
.pytuto__retour { background: none; border: 0; padding: 0 0 6px; font: inherit; font-size: .8rem;
    color: var(--py-acc); cursor: pointer; }
.pytuto__retour:hover { text-decoration: underline; }

.pytuto__parcours { margin: 14px 14px 4px; font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pytuto__liste { list-style: none; margin: 0; padding: 0 6px; }
.pytuto__ouvre {
    display: grid; grid-template-columns: 20px 1fr; gap: 0 8px; width: 100%; text-align: left;
    background: none; border: 0; border-radius: 9px; padding: 8px 9px; cursor: pointer; font: inherit;
}
.pytuto__ouvre:hover { background: var(--slate-100); }
.pytuto__puce {
    grid-row: 1 / 3; align-self: center; width: 18px; height: 18px; border-radius: 50%;
    border: 1.5px solid var(--slate-300); color: #fff; font-size: .68rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.pytuto__item.is-fini .pytuto__puce { background: #10b981; border-color: #10b981; }
.pytuto__item.is-encours .pytuto__puce { border-color: var(--py-acc); color: var(--py-acc); }
.pytuto__nom { font-size: .9rem; font-weight: 600; color: var(--slate-800); }
.pytuto__meta { font-size: .74rem; color: var(--muted); }

.pytuto__pas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pytuto__pastille {
    width: 23px; height: 23px; border-radius: 7px; border: 1px solid var(--border);
    background: #fff; color: var(--muted); font: inherit; font-size: .74rem; font-weight: 600;
    cursor: pointer;
}
.pytuto__pastille.is-fait { background: #d1fae5; border-color: #6ee7b7; color: #047857; }
.pytuto__pastille.is-ici { background: var(--py-acc); border-color: var(--py-acc); color: #fff; }

.pytuto__corps { padding: 12px 14px 20px; }
.pytuto__etape { margin: 0 0 8px; font: 700 .98rem var(--font-display); color: var(--slate-900); }
.pytuto__texte { font-size: .88rem; color: var(--slate-700); }
.pytuto__texte code { background: var(--slate-100); border-radius: 4px; padding: 1px 5px;
    font-family: var(--font-mono, monospace); font-size: .86em; color: #be185d; }
.pytuto__texte p { margin: .55em 0; }
.pytuto__texte ul, .pytuto__texte ol { margin: .5em 0; padding-left: 1.3em; }

.pytuto__code { margin: 10px 0; }
.pytuto__code pre {
    margin: 0 0 6px; background: var(--py-fond); color: var(--py-code); border-radius: 9px;
    padding: 10px 12px; overflow-x: auto;
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.5;
}
.pytuto__code .btn { background: var(--slate-800); color: #fff; }
.pytuto__code .btn:hover { background: var(--slate-900); color: #fff; }

.pytuto__consigne {
    margin: 12px 0; padding: 10px 12px; border-radius: 9px;
    background: var(--py-acc-l); border-left: 3px solid var(--py-acc);
    font-size: .88rem; color: #831843; line-height: 1.55;
}
.pytuto__consigne p { margin: .3em 0; }
.pytuto__consigne code { background: rgba(255,255,255,.75); border-radius: 4px; padding: 1px 5px; }

.pytuto__verdict { margin: 10px 0; padding: 9px 12px; border-radius: 9px; font-size: .86rem; line-height: 1.5; }
.pytuto__verdict.is-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.pytuto__verdict.is-ko { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.pytuto__indice { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .82rem;
    color: var(--py-acc); cursor: pointer; }
.pytuto__indice:hover { text-decoration: underline; }
.pytuto__indice:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.pytuto__aide { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--slate-100);
    font-size: .84rem; color: var(--slate-700); line-height: 1.5; }
.pytuto__pieds { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pytuto__pieds .btn--primary { background: var(--py-acc); }
.pytuto__pieds .btn--primary:hover { background: var(--py-acc-d); }
.pytuto__pieds .btn--ghost { color: var(--slate-600); border-color: var(--border); }
.pytuto__pieds .btn--ghost:hover { background: var(--slate-100); }

/* ---- suivi des classes ---------------------------------------------------- */
.pysuivi { margin-bottom: 28px; }
.pysuivi__titre { margin: 0 0 4px; font: 700 1.1rem var(--font-display); color: var(--slate-900); }
.pysuivi__t { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pysuivi__t th, .pysuivi__t td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.pysuivi__t th { background: var(--slate-50); font-size: .76rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted); }
.pysuivi__t tr:last-child td { border-bottom: 0; }
.pysuivi__prog { display: inline-block; min-width: 90px; }
.pysuivi__jauge { height: 6px; border-radius: 999px; background: var(--slate-200); overflow: hidden; }
.pysuivi__jauge i { display: block; height: 100%; background: var(--py-acc); }
.pysuivi__prog em { font-style: normal; font-size: .74rem; color: var(--muted); }
.pysuivi__oeuvre { display: inline-flex; align-items: center; gap: 5px; margin: 2px 6px 2px 0;
    padding: 3px 9px; border-radius: 999px; background: var(--slate-100); color: var(--slate-700);
    font-size: .8rem; text-decoration: none; }
.pysuivi__oeuvre:hover { background: var(--py-acc-l); color: var(--py-acc-d); }
.pysuivi__oeuvre.is-rendu { background: #d1fae5; color: #065f46; }
.pysuivi__rien { color: var(--muted); font-size: .82rem; }

/* ---- lecture d'un travail d'élève ---------------------------------------- */
.py--lecture .py__grille { grid-template-columns: minmax(0, 1fr) 420px; }
.py__bandeau {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    border-radius: 10px; padding: 8px 12px; font-size: .86rem; flex: 0 0 auto;
}

/* ---- écrans étroits ------------------------------------------------------- */
@media (max-width: 1180px) {
    .py__grille { grid-template-columns: 260px minmax(0, 1fr) 320px; }
}
@media (max-width: 980px) {
    /* Plus la place de trois colonnes : la page redevient une page qui défile,
       chaque volet prenant une hauteur fixe. Un atelier écrasé en trois colonnes
       de 200 px serait inutilisable — mieux vaut assumer l'empilement. */
    .py { height: auto; }
    .py__grille { grid-template-columns: 1fr; }
    .py__rail { max-height: 420px; }
    .py__centre { height: 60vh; min-height: 340px; }
    .py__sortie { height: 46vh; min-height: 280px; }
    .py--lecture .py__grille { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .py__barre { flex-wrap: wrap; }
    .py__titre { max-width: none; }
    .py__pied { font-size: .72rem; }
}

/* ---- Python : en-têtes de la page de suivi et bandeau de lecture --------- */
.pysuivi-page { padding-bottom: 40px; }
.pysuivi__head { display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pysuivi__head h1 { margin: 0; font: 700 1.5rem var(--font-display); color: var(--slate-900); }
.pysuivi__sous { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.pysuivi__titre small { font-weight: 500; font-size: .8rem; color: var(--muted); margin-left: 6px; }
.pysuivi-filtre { margin-bottom: 14px; }
.pysuivi-q { width: 100%; max-width: 320px; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--border); font: inherit; font-size: .9rem; background: var(--card); }
.pysuivi-q:focus { outline: none; border-color: var(--py-acc); }

.py__titre-fixe { font: 600 .95rem var(--font-display); color: var(--slate-600); }
.py__bandeau-fin { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.py__bandeau .btn--sm { background: var(--py-acc); color: #fff; }
.py__bandeau .btn--sm:hover { background: var(--py-acc-d); color: #fff; }
.py__bandeau .btn--light { background: #fff; color: var(--slate-700); border-color: #fde68a; }
.py__rendu { font-weight: 600; }

/* ---- Python : l'attribut hidden doit gagner -----------------------------
   .btn pose « display: inline-flex » et .py__pastille « display: inline-block ».
   Une déclaration de display l'emporte sur le display:none que le navigateur
   attache à [hidden] : sans cette règle, le bouton « Arrêter » et la pastille
   du compteur d'erreurs restaient visibles alors que le JS les avait masqués.
   Portée limitée au module — le reste du site n'a pas à changer de règles. */
.py [hidden], .py__menu-liste[hidden] { display: none !important; }

/* ---- Python : atelier sans programme ouvert -----------------------------
   Un éditeur vide et muet ne dit pas quoi faire. Tant qu'aucun programme n'est
   ouvert, un panneau se pose par-dessus et donne les deux seules portes
   d'entrée : commencer une leçon, ou créer un programme vide. */
.py__centre { position: relative; }
.py__accueil {
    position: absolute; inset: 0; z-index: 5; display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    padding: 24px; text-align: center; background: var(--py-fond);
}
.py:not(.a-projet) .py__accueil { display: flex; }
.py__accueil h2 { margin: 0; font: 700 1.2rem var(--font-display); color: #f1f5f9; }
.py__accueil p { margin: 0; max-width: 380px; color: #94a3b8; font-size: .9rem; line-height: 1.6; }
.py__accueil .btn--primary { background: var(--py-acc); color: #fff; }
.py__accueil .btn--primary:hover { background: var(--py-acc-d); color: #fff; }
/* Le second bouton est un RECOURS, pas une alternative de même poids : la porte
   recommandée est la leçon. Il reste donc discret sur le fond sombre. */
.py__accueil .btn--light { background: transparent; color: #cbd5e1; border-color: #334155; }
.py__accueil .btn--light:hover { background: #1e293b; color: #f1f5f9; }
.py__accueil-ou { color: #475569; font-size: .8rem; }

/* ---- Python : l'invite de la scène s'efface dès qu'il y a un dessin ------
   Elle dit COMMENT dessiner ; une fois le dessin là, elle ne fait plus que
   prendre la place et pousser la figure vers le haut. :has() est ici un
   confort — les navigateurs qui l'ignorent gardent simplement la phrase. */
.pyscene:has(.pyscene__cadre canvas) .pyscene__aide { display: none; }
.pyscene__cadre:empty { display: none; }

/* Espace élève : la colonne de lecture de 920 px ne convient pas à un atelier. */
body.py-body .eleve-main { max-width: 1560px; padding: 14px 18px 12px; }

/* =========================================================================
   LA GRUE — chantier, pupitre (module Python, onglet « Grue »)
   =========================================================================

   Le chantier est un SVG dont TOUT ce qui bouge est positionné par une
   propriété CSS `transform` posée en JavaScript. C'est ce qui permet de
   l'animer sans rien recalculer : une transition sur `transform` suffit, et
   le bloc porté reçoit exactement la même que le chariot, donc il le suit.

   ⚠️ Ne jamais poser de `transform` en ATTRIBUT SVG sur ces éléments : les
   deux écritures ne se combinent pas, la propriété CSS gagne, et l'attribut
   passerait silencieusement à la trappe.
   ========================================================================= */

.pygrue {
    flex: 1 1 auto; min-height: 0; overflow: auto;
    display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 14px;
}
.pygrue__scene { flex: 0 0 auto; }
.grue { display: block; width: 100%; height: auto; overflow: visible; }

/* ---- le terrain --------------------------------------------------------- */
.grue__case { fill: rgba(148,163,184,.05); stroke: #1e293b; stroke-width: 1; }
.grue__sol { stroke: #334155; stroke-width: 2.5; stroke-linecap: round; }
.grue__num-fond { fill: #1e293b; }
.grue__num { fill: #94a3b8; font: 700 13px var(--font-mono, ui-monospace, monospace); }

/* Le bâtiment à construire, en filigrane. Assez visible pour être un modèle,
   assez discret pour qu'on distingue au premier coup d'œil un vrai bloc d'un
   emplacement encore vide. */
.grue__fantome { opacity: .28; stroke-width: 2; stroke-dasharray: 5 4; }

/* ---- la grue ------------------------------------------------------------ */
.grue__rail { fill: #475569; }
.grue__caisse { fill: #64748b; stroke: #94a3b8; stroke-width: 1.5; }
.grue__roue { fill: #cbd5e1; }
.grue__hublot { fill: #22d3ee; }
.grue__cable { stroke: #94a3b8; stroke-width: 2; }
.grue__poulie { fill: #cbd5e1; }
.grue__doigts { stroke: #cbd5e1; stroke-width: 3; stroke-linecap: round; fill: none; }

/* ---- les blocs ---------------------------------------------------------- */
.grue__bloc { stroke: rgba(15,23,42,.45); stroke-width: 2; }
.grue__bloc.is-porte { filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }

/* ---- consigne et état --------------------------------------------------- */
.pygrue__consigne {
    margin: 0; padding: 7px 10px; border-radius: 8px;
    background: rgba(148,163,184,.10); color: #cbd5e1;
    font-size: .82rem; line-height: 1.45;
}
.pygrue__etat { margin: 0; min-height: 1.2em; font-size: .82rem; color: #94a3b8; }
.pygrue__etat.is-ok { color: #86efac; font-weight: 600; }
.pygrue__etat.is-ko { color: #fca5a5; }

/* ---- le pupitre --------------------------------------------------------- */
.grue-pup { display: flex; flex-direction: column; gap: 7px; }
.grue-pup__cols { display: flex; flex-wrap: wrap; gap: 5px; }
.grue-pup__actions { display: flex; flex-wrap: wrap; gap: 5px; }

.grue-pup__col, .grue-pup__act {
    border: 1px solid #334155; background: #1e293b; color: #e2e8f0;
    border-radius: 8px; font: inherit; font-size: .82rem; font-weight: 600;
    padding: 7px 10px; cursor: pointer;
    transition: background .12s, border-color .12s, transform .1s;
}
.grue-pup__col { min-width: 34px; text-align: center; font-family: var(--font-mono, monospace); }
.grue-pup__col:hover, .grue-pup__act:hover { background: #293548; }
.grue-pup__col:active, .grue-pup__act:active { transform: translateY(1px); }

/* La colonne où se trouve la grue : c'est le repère qui donne leur sens aux
   numéros que le programme utilisera ensuite. */
.grue-pup__col.is-ici { background: var(--py-acc); border-color: var(--py-acc); color: #fff; }

.grue-pup__act { background: #334155; }
.grue-pup__act.is-neutre { background: transparent; color: #94a3b8; }
.grue-pup__act:disabled { opacity: .35; cursor: not-allowed; }
.grue-pup__act:disabled:hover { background: #334155; }
.grue-pup__act.is-neutre:disabled:hover { background: transparent; }

/* Pendant qu'un geste s'exécute, plus rien n'est cliquable : trois clics
   rapides lanceraient trois animations concurrentes sur le même chariot. */
.grue-pup.is-occupe { pointer-events: none; opacity: .75; }

/* Étape À PROGRAMMER : le pupitre reste visible — il rappelle à quoi
   correspond chaque ordre — mais il ne répond plus. Réussir à la main une
   étape dont le sujet est d'écrire le programme n'apprendrait rien. */
.grue-pup.is-verrouille { pointer-events: none; opacity: .4; }
.grue-pup.is-verrouille::after {
    content: 'Cette étape se fait en écrivant le programme.';
    display: block; margin-top: 2px; font-size: .74rem; color: #64748b;
    pointer-events: none;
}

/* =========================================================================
   Atelier « Balance de Roberval » (Estrade → Calculs → résolution d'équation)
   Calque plein écran : la balance se manipule à gauche, la résolution s'écrit
   à droite. Le SVG est produit par js/balance-core.js — la feuille de styles
   ne s'occupe QUE de la mise en page, du survol et de l'inclinaison animée
   (le SVG doit rester lisible sans elle : il est rasterisé pour le tableau).
   ========================================================================= */
.blc-overlay { position: fixed; inset: 0; z-index: 60; background: var(--slate-50, #f8fafc); display: flex; flex-direction: column; }
.blc-overlay[hidden] { display: none; }
.blc-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--border); }
.blc-bar__t { font-family: var(--font-display, inherit); font-weight: 700; }
.blc-bar__hint { color: var(--primary); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.blc-bar__hint[hidden] { display: none; }
.blc-bar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.blc-bar__what { display: flex; align-items: center; gap: 10px; padding-right: 4px; font-size: .82rem; color: var(--muted); }
.blc-bar__what label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.blc-host { flex: 1; min-height: 0; display: flex; }

.blc { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- bandeau d'énoncé ---- */
.blc-setup { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--border); }
.blc-setup__f { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.blc-eqfield { width: 220px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--slate-50, #f8fafc);
    font-family: 'Cambria Math', Cambria, Georgia, serif; font-size: 1.12rem; color: var(--text); }
.blc-eqfield:focus { outline: 0; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.blc-setup__sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.blc-setup__msg { font-size: .82rem; color: var(--muted); }
.blc-setup__msg.is-bad { color: #b91c1c; font-weight: 600; }
.blc-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font: inherit; font-size: .85rem; color: var(--text); }

.blc-btn { padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: pointer;
    font: inherit; font-size: .86rem; font-weight: 600; color: var(--slate-700, #334155); white-space: nowrap;
    transition: background .15s, border-color .15s, transform .08s; }
.blc-btn:hover:not(:disabled) { background: var(--slate-100); border-color: var(--slate-300); }
.blc-btn:active:not(:disabled) { transform: translateY(1px); }
.blc-btn:disabled { opacity: .4; cursor: not-allowed; }
.blc-btn--go { background: var(--primary); border-color: var(--primary); color: #fff; }
.blc-btn--go:hover:not(:disabled) { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.blc-btn--div { padding: 9px 20px; font-size: .95rem; background: #ecfdf5; border-color: #6ee7b7; color: #047857;
    box-shadow: 0 2px 8px rgba(4,120,87,.14); }
.blc-btn--div:hover:not(:disabled) { background: #d1fae5; border-color: #34d399; }
.blc-btn--div[hidden] { display: none; }
.blc-btn--next { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.blc-btn--next:hover:not(:disabled) { background: #e0e7ff; border-color: #a5b4fc; }

/* ---- les deux volets ---- */
.blc-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 30%);
    /* une seule rangee, qui prend toute la hauteur (la requete media plus bas en
       declare deux : les volets passent alors l'un sous l'autre). */
    grid-template-rows: minmax(0, 1fr); }
.blc-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.blc-pane--bal { padding: 10px 18px 14px; }
.blc-pane--steps { border-left: 1px solid var(--border); background: #fff; }

.blc-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.blc-svg { width: 100%; height: 100%; max-height: 100%; overflow: visible; -webkit-user-select: none; user-select: none; }

.blc-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; display: flex; justify-content: center; }
.blc-stepsvg { max-width: 100%; height: auto; align-self: flex-start; }

/* ---- bandeau de conseil ---- */
.blc-hint { margin: 2px 0 10px; min-height: 22px; text-align: center; font-size: .86rem; color: var(--muted); }
.blc-hint b { color: var(--slate-700, #334155); }
.blc-hint .blc-op { color: #dc2626; font-weight: 700; }
.blc-hint .blc-prev { font-family: 'Cambria Math', Cambria, Georgia, serif; font-size: 1.05rem; color: var(--slate-700, #334155); }
.blc-hint.is-bad { color: #b91c1c; font-weight: 600; }

/* ---- casier « ajouter des deux côtés » ---- */
.blc-tray { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 12px; background: #fff; }
.blc-tray__lbl { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.blc-tray__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.blc-chip { padding: 5px 11px; border: 1.5px solid; border-radius: 8px; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700;
    line-height: 1.2; transition: transform .1s, box-shadow .15s; }
.blc-chip:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(15,23,42,.12); }
.blc-chip:active { transform: translateY(0); }
.blc-chip--x { background: #e0e7ff; border-color: #4f46e5; color: #312e81; }
.blc-chip--x i { font-family: 'Cambria Math', Cambria, Georgia, serif; font-style: italic; font-size: 1.15rem; }
.blc-chip--s { background: #fde68a; border-color: #b45309; color: #78350f; }
.blc-chip--m { background: #bae6fd; border-color: #0369a1; color: #0c4a6e; }
.blc-chip--l { background: #ddd6fe; border-color: #6d28d9; color: #4c1d95; }
.blc-chip--k { background: #fecdd3; border-color: #be123c; color: #881337; }

/* Le partage (÷ k) se pose SOUS la balance, centré, au contact de ce qu'il transforme.
   La hauteur est réservée même bouton caché : la balance ne saute pas quand il apparaît. */
.blc-under { display: flex; align-items: center; justify-content: center; min-height: 40px; }

.blc-acts { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.blc-acts__sp { flex: 1; }

/* ---- objets manipulables (dessinés dans le SVG) ---- */
.blc-item { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: transform .16s ease, opacity .22s ease; }
.blc-item:focus { outline: none; }
.blc-item:hover, .blc-item.is-twin, .blc-item:focus-visible { transform: translateY(-4px); }
.blc-item:hover .blc-hl, .blc-item.is-twin .blc-hl, .blc-item:focus-visible .blc-hl { opacity: .32; }
.blc-hl { transition: opacity .16s ease; }
/* L'objet qui s'en va : il monte et s'efface — puis la scène est redessinée. */
.blc-item.is-going { opacity: 0; transform: translateY(-30px) scale(.84); pointer-events: none; }

/* ---- inclinaison : ce qu'on retire d'un seul côté déséquilibre la balance.
   Le fléau pivote, et les plateaux d'une Roberval RESTENT horizontaux : ils ne
   font que monter et descendre — d'où deux animations distinctes. ---- */
.blc-beam, .blc-side { transition: transform .3s cubic-bezier(.34, 1.15, .64, 1); }
.blc.is-heavy-l .blc-beam { transform: rotate(-9deg); }
.blc.is-heavy-l .blc-side--l { transform: translateY(var(--blc-dy, 20px)); }
.blc.is-heavy-l .blc-side--r { transform: translateY(calc(-1 * var(--blc-dy, 20px))); }
.blc.is-heavy-r .blc-beam { transform: rotate(9deg); }
.blc.is-heavy-r .blc-side--r { transform: translateY(var(--blc-dy, 20px)); }
.blc.is-heavy-r .blc-side--l { transform: translateY(calc(-1 * var(--blc-dy, 20px))); }

@media (prefers-reduced-motion: reduce) {
    .blc-beam, .blc-side, .blc-item, .blc-hl { transition: none; }
}

/* ---- écrans étroits : les deux volets l'un sous l'autre ---- */
@media (max-width: 1000px) {
    .blc-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 40%); }
    .blc-pane--steps { border-left: 0; border-top: 1px solid var(--border); }
    .blc-eqfield { width: 170px; }
}

/* ---- Page « Résolution d'équations » (Jeux & Exercices) --------------------
   Le même atelier que dans l'Estrade, mais posé dans une page ordinaire au lieu
   d'un calque plein écran : il lui faut donc une hauteur DÉFINIE, sans quoi
   .blc-stage (flex:1) se réduirait à la taille intrinsèque de son SVG. */
.blc-page { display: flex; flex-direction: column; gap: 14px; }
.blc-page__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.blc-page__ident { flex: 1 1 auto; text-align: center; }
.blc-page__title { margin: 0; font-size: 1.35rem; }
.blc-page__sub { margin: 2px 0 0; color: var(--muted); font-size: .84rem; }
/* Contrepoids du bouton « Retour », pour que le titre reste centré sur la page. */
.blc-page__sp { width: 92px; }
.blc-page__host { display: flex; min-height: 0; height: calc(100vh - 210px); min-height: 520px;
    border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.blc-page__boot { margin: auto; color: var(--muted); font-size: .9rem; }

/* Largeur d'atelier côté élève (le prof passe par body.is-wide) : la colonne de
   lecture de 920 px mettrait la balance et sa résolution à l'étroit. */
body.blc-body .eleve-main { max-width: 1400px; padding-left: 18px; padding-right: 18px; }

@media (max-width: 1000px) {
    .blc-page__host { height: auto; min-height: 0; }
    /* Volets l'un sous l'autre (cf. .blc-main) : chacun a besoin d'une hauteur propre. */
    .blc-page__host .blc-main { min-height: 720px; }
    .blc-page__sp { display: none; }
}



/* =========================================================================
   PROJECTION D'UNE LEÇON — /cours/lecon/{id}/projection
   Écran de vidéoprojecteur : la feuille D'IMPRESSION, agrandie, plus deux
   déroulés (ligne à ligne, générique). Vues : views/cours/projection.php et
   views/layouts/projection.php ; moteur : js/cours-projection.js.

   Deux thèmes, en variables. Ils ne changent JAMAIS la feuille elle-même —
   une page imprimée est blanche, et c'est tout l'intérêt de la projeter : ce
   que la classe voit au tableau est ce que l'élève aura sous les yeux. Seul
   le décor autour, et le fond des deux modes de déroulé, s'assombrissent.
   ========================================================================= */
.pj {
    --pj-bg:     #e7ebf2;   /* décor autour de la feuille           */
    --pj-fg:     #0f172a;   /* texte des lignes projetées           */
    --pj-stage:  #f8fafc;   /* fond des modes ligne / générique     */
    --pj-kick:   #64748b;   /* rappel de contexte au-dessus         */
    --pj-acc:    #10b981;   /* accent « Le Cours »                  */
    --pj-bar:    rgba(15, 23, 42, .94);
    --pj-barfg:  #e2e8f0;
}
.pj[data-theme="ecran"] {
    --pj-bg:    #070c16;
    --pj-fg:    #f1f5f9;
    --pj-stage: #0a1120;
    --pj-kick:  #94a3b8;
    --pj-acc:   #34d399;
    --pj-bar:   rgba(2, 6, 16, .92);
}

body.pj-body { margin: 0; height: 100%; background: #0b1120; overflow: hidden; }
.pj {
    position: fixed; inset: 0; display: flex; flex-direction: column;
    background: var(--pj-bg); color: var(--pj-fg);
    font-family: var(--font-sans);
    transition: background .35s ease;
}
/* Souris immobile : la barre s'efface avec le pointeur. Rien ne doit rester
   entre la classe et le cours. */
.pj.is-idle { cursor: none; }
.pj.is-idle .pj-bar { opacity: 0; transform: translateY(-118%); pointer-events: none; }

/* ---- Barre d'outils flottante ------------------------------------------------
   Posée EN SURIMPRESSION, jamais dans le flux : son escamotage ne doit rien
   remettre en page — les tailles de police des lignes projetées sont calculées
   sur la hauteur de la scène, un reflux les recalculerait toutes en plein cours.
   Les 62 px qu'elle occupe sont réservés une fois pour toutes par .pj-scene. */
.pj-bar {
    position: absolute; z-index: 40; top: 8px; left: 10px; right: 10px; height: 48px;
    display: flex; align-items: center; gap: 14px; padding: 0 8px 0 6px;
    border-radius: 14px; background: var(--pj-bar); color: var(--pj-barfg);
    box-shadow: 0 10px 30px rgba(2, 6, 23, .34);
    backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
    transition: opacity .3s ease, transform .3s ease;
}
.pj-bar__side { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.pj-bar__side--end { justify-content: flex-end; }
.pj-sep { width: 1px; height: 22px; background: rgba(226, 232, 240, .22); margin: 0 2px; }

.pj-ico { width: 19px; height: 19px; display: block; flex: none; }
.pj-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
    border: 0; border-radius: 9px; background: transparent; color: inherit;
    font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: background .14s ease, color .14s ease;
}
.pj-btn:hover { background: rgba(226, 232, 240, .13); }
.pj-btn:focus-visible { outline: 2px solid var(--pj-acc); outline-offset: 2px; }
.pj-btn--icon { padding: 0; width: 34px; justify-content: center; }
.pj-btn--quit { color: #cbd5e1; }
/* Boutons à deux visages (lecture/pause, clair/sombre, plein écran) : les deux
   dessins sont dans le bouton, le CSS montre le bon — rien n'est reconstruit. */
.pj-btn--duo .pj-ico--b { display: none; }
.pj-btn--duo.is-alt .pj-ico--a { display: none; }
.pj-btn--duo.is-alt .pj-ico--b { display: block; }

.pj-ident { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.pj-ident__t { font-family: var(--font-display); font-size: .95rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-ident__m { font-size: .74rem; color: #94a3b8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sélecteur de mode : trois pastilles dans une gouttière, la sélection glisse. */
.pj-modes { display: flex; gap: 2px; padding: 3px; border-radius: 11px;
    background: rgba(148, 163, 184, .14); flex: none; }
.pj-mode {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 13px;
    border: 0; border-radius: 8px; background: transparent; color: #cbd5e1;
    font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .16s ease, color .16s ease;
}
.pj-mode:hover { color: #f8fafc; }
.pj-mode.is-on { background: var(--pj-acc); color: #04201a; box-shadow: 0 2px 8px rgba(16, 185, 129, .3); }
.pj-mode:focus-visible { outline: 2px solid var(--pj-acc); outline-offset: 2px; }

.pj-tools { display: flex; align-items: center; gap: 6px; }
.pj-tools[hidden] { display: none; }
.pj-val { font-size: .78rem; font-variant-numeric: tabular-nums; color: #94a3b8; min-width: 48px; text-align: center; }
.pj-val--count { min-width: 64px; font-size: .84rem; font-weight: 600; color: #e2e8f0; }
/* Le bouton « ajuster » s'allume quand la feuille suit la largeur de l'écran. */
.pj.is-fit #pj-zoom-fit { color: var(--pj-acc); }

.pj-speed { display: inline-flex; align-items: center; gap: 8px; }
.pj-speed__ico { display: flex; color: #94a3b8; }
.pj-speed__ico .pj-ico { width: 20px; height: 20px; }

.pj-range { -webkit-appearance: none; appearance: none; width: 108px; height: 18px;
    background: transparent; cursor: pointer; }
.pj-range--zoom { width: 130px; }
.pj-range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: rgba(148, 163, 184, .38); }
.pj-range::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(148, 163, 184, .38); }
.pj-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
    background: #f8fafc; box-shadow: 0 1px 4px rgba(2, 6, 23, .5); }
.pj-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%;
    background: #f8fafc; box-shadow: 0 1px 4px rgba(2, 6, 23, .5); }
.pj-range:focus-visible { outline: 2px solid var(--pj-acc); outline-offset: 3px; border-radius: 999px; }

/* ---- Rappel des raccourcis ---- */
.pj-help {
    position: absolute; z-index: 41; top: 64px; right: 12px; width: 330px;
    padding: 16px 18px; border-radius: 14px;
    background: var(--pj-bar); color: var(--pj-barfg);
    box-shadow: 0 16px 44px rgba(2, 6, 23, .45);
    backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
}
.pj-help__t { margin: 0 0 10px; font-family: var(--font-display); font-size: .92rem; }
.pj-help__list { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 0; font-size: .82rem; }
.pj-help__list dt { display: flex; gap: 4px; }
.pj-help__list dd { margin: 0; color: #cbd5e1; }
.pj-help kbd {
    display: inline-block; min-width: 20px; padding: 1px 5px; border-radius: 5px;
    border: 1px solid rgba(226, 232, 240, .28); background: rgba(226, 232, 240, .10);
    font: inherit; font-size: .74rem; text-align: center;
}

/* ---- Scène ------------------------------------------------------------------
   Chaque mode réserve lui-même les 62 px de la barre (padding pour le document,
   décalage du haut pour les deux déroulés) : cette place est prise UNE FOIS POUR
   TOUTES, y compris quand la barre s'efface. C'est voulu — un escamotage qui
   remettrait la scène en page recalculerait toutes les tailles de police des
   lignes projetées, en plein cours (cf. commentaire de .pj-bar).
   ⚠️ Un `inset: 0` ne suffirait pas à laisser la barre libre : le bloc conteneur
   d'un enfant absolu est la boîte de PADDING de l'ancêtre, padding compris. */
.pj-scene { position: relative; flex: 1 1 auto; min-height: 0; }

/* ---- Mode Document : la feuille d'impression, à la taille de l'écran ---------
   Elle reste affichée dans TOUS les modes, sous les deux autres : c'est d'elle
   que sont découpées les lignes, et un display:none la priverait de toute mesure
   tout en faisant recharger les applets GeoGebra.
   overflow-y: scroll (et non auto) : l'ascenseur est toujours là, donc la largeur
   utile ne change pas quand le zoom fait grandir la feuille — sans quoi le calcul
   « ajuster à la largeur » oscillerait entre deux valeurs. */
.pj-doc { position: absolute; inset: 0; overflow-y: scroll; overflow-x: auto;
    padding: 74px 24px 56px; scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, .6) transparent; }
.pj-doc::-webkit-scrollbar { width: 12px; height: 12px; }
.pj-doc::-webkit-scrollbar-track { background: transparent; }
.pj-doc::-webkit-scrollbar-thumb { border-radius: 999px; border: 3px solid transparent;
    background: rgba(100, 116, 139, .6); background-clip: content-box; }
.pj-doc::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .9); background-clip: content-box; }

.pj-sheetwrap { position: relative; margin: 0 auto; }
/* La feuille garde ses 186 mm UTILES : 210 mm de large moins 2 × 12 mm de marge,
   comme l'A4 de l'impression. C'est cette égalité qui fait qu'un élève retrouve
   exactement les mêmes retours à la ligne sur sa feuille — on l'agrandit par une
   transformation, on ne la remet jamais en page. */
.pj-sheetwrap > .lc-print {
    position: absolute; top: 0; left: 0; transform-origin: top left;
    width: 210mm; max-width: none; padding: 12mm; margin: 0;
    background: #fff; color: var(--text); border-radius: 3px;
    box-shadow: 0 2px 6px rgba(2, 6, 23, .22), 0 18px 50px rgba(2, 6, 23, .28);
}
.pj[data-theme="ecran"] .pj-sheetwrap > .lc-print { box-shadow: 0 2px 8px rgba(0, 0, 0, .6), 0 24px 60px rgba(0, 0, 0, .5); }
/* Hors mode Document, la feuille disparaît de la vue mais RESTE MESURABLE :
   visibility (et non display) laisse la mise en page en place — c'est d'elle que
   sont découpées les lignes, et un display:none rechargerait les applets. Sans
   cela, l'ascenseur de la feuille dépassait derrière la barre d'outils. */
.pj:not([data-mode="doc"]) .pj-doc { visibility: hidden; }

/* ---- Modes Ligne à ligne et Générique ---------------------------------------
   Posés PAR-DESSUS la feuille, opaques. */
.pj-solo, .pj-gen { position: absolute; inset: 62px 0 0; background: var(--pj-stage); }
.pj-solo[hidden], .pj-gen[hidden] { display: none; }
.pj-solo { display: flex; flex-direction: column; }

/* Boutons de navigation : deux bandes pleine largeur, en haut et en bas. Assez
   grandes pour être visées d'un geste, assez discrètes pour ne pas voler la
   vedette à la ligne projetée. */
.pj-nav {
    position: relative;
    flex: none; display: flex; align-items: center; justify-content: center;
    height: 62px; border: 0; background: transparent; color: var(--pj-kick);
    font: inherit; font-size: .82rem; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.pj-nav:hover { background: rgba(100, 116, 139, .12); color: var(--pj-fg); }
.pj-nav:focus-visible { outline: 2px solid var(--pj-acc); outline-offset: -4px; }
.pj-nav .pj-ico { width: 24px; height: 24px; }
/* L'intitulé ne paraît qu'au survol, et il est SORTI DU FLUX : sinon sa largeur
   décalerait la flèche, qui doit rester exactement au milieu de l'écran. */
.pj-nav__lbl { position: absolute; top: 50%; transform: translateY(-50%);
    opacity: 0; transition: opacity .18s ease; pointer-events: none; }
.pj-nav--prev .pj-nav__lbl { left: calc(50% + 22px); }
.pj-nav--next .pj-nav__lbl { right: calc(50% + 22px); }
.pj-nav:hover .pj-nav__lbl { opacity: 1; }

.pj-stage { position: relative; flex: 1 1 auto; min-height: 0; }

/* ---- Vignette d'une étape (partagée par les deux déroulés) ---- */
.pj-item {
    --pj-ton: var(--pj-acc);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 18px clamp(24px, 5vw, 90px); text-align: center;
}
/* Étiquette d'un encadré (« Définition : », « Remarque : »). Ce n'est PAS un libellé
   d'interface : c'est le mot que l'élève écrit, souligné, avant de recopier la phrase.
   D'où la mise en forme du cahier — souligné, aligné à gauche du texte — et une taille
   à l'échelle de celui-ci, posée par js/cours-projection.js (tailleEtiquette).
   width: 100% cale son bord gauche sur celui de .pj-item__in, dont la largeur est
   exactement la boîte de contenu de la vignette. */
.pj-item__kick {
    flex: none; width: 100%; margin-bottom: .1em; text-align: left;
    color: var(--pj-ton);
    font-family: var(--font-display); font-weight: 700; font-size: 1.4rem;
    text-decoration: underline; text-underline-offset: .16em; text-decoration-thickness: .055em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Banc de mesure de la taille commune : un exemplaire hors écran de chaque ligne, à la
   taille exacte du cadre réel. visibility (et non display) — sans mise en page, rien à
   mesurer. Cf. tailleCommune() dans js/cours-projection.js. */
.pj-mesure { position: absolute; left: -99999px; top: 0; visibility: hidden; pointer-events: none; }
.pj-item__in {
    max-width: 100%; color: var(--pj-fg); line-height: 1.32;
    font-size: 40px;   /* remplacé par la mise à l'échelle de cours-projection.js */
}
.pj-item__in > :first-child { margin-top: 0; }
.pj-item__in > :last-child { margin-bottom: 0; }
.pj-item__in p { margin: 0; }
/* Une puce centrée doit garder sa puce sous les yeux : liste en ligne. */
.pj-item__in ul, .pj-item__in ol { margin: 0; padding-left: 0; list-style-position: inside; }
.pj-item__in li { margin: 0; }
.pj-item__in strong { font-weight: 700; }
.pj-item__in a { color: var(--pj-ton); text-decoration-thickness: 1px; }
.pj-item__in table { margin: 0 auto; }
.pj-item--titre .pj-item__in { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }
.pj-item--titre .pj-item__in h1 { margin: 0; font-size: 1em; line-height: 1.15; }

/* Teintes reprises des encadrés de la leçon : la ligne projetée garde la couleur
   de son cadre, sans en reprendre le fond (illisible en grand). */
.pj-ton--definition { --pj-ton: #3b82f6; }
.pj-ton--propriete  { --pj-ton: #10b981; }
.pj-ton--theoreme   { --pj-ton: #8b5cf6; }
.pj-ton--methode    { --pj-ton: #f59e0b; }
.pj-ton--remarque   { --pj-ton: #94a3b8; }
.pj-ton--exemple    { --pj-ton: #ec4899; }
.pj-ton--rappel     { --pj-ton: #06b6d4; }

/* Bloc visuel (figure, tableau, GeoGebra, vidéo…) : reposé sur une carte blanche
   aux dimensions du papier, puis mis à l'échelle. Blanche dans les deux thèmes —
   un tracé noir sur fond sombre serait invisible. */
.pj-item__carte { flex: 0 1 auto; max-width: 100%; padding: 16px; border-radius: 16px;
    background: #fff; color: var(--text); box-shadow: 0 14px 40px rgba(2, 6, 23, .22); }
.pj[data-theme="ecran"] .pj-item__carte { box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.pj-item__box { position: relative; }
.pj-item__scale { position: absolute; top: 0; left: 0; transform-origin: top left; }
/* Le bloc est recomposé à la largeur UTILE du cours (186 mm), sans les marges de
   la feuille : la carte n'a pas à porter le blanc de l'A4. */
.pj-item__scale.lc-print { width: 186mm; max-width: none; padding: 0; margin: 0;
    background: transparent; box-shadow: none; }
.pj-item__scale .lc-block { margin: 0; }

/* ---- Fondu enchaîné du mode Ligne à ligne ----
   --pj-dir vaut 1 vers l'avant, -1 vers l'arrière : la ligne entre du côté d'où
   l'on vient, et sort de l'autre. */
/* Un ÉCRAN du mode Ligne à ligne : une à trois lignes empilées dans des cases de hauteur
   égale (boutons 1 / 2 / 3 de la barre, hauteur posée en ligne par cours-projection.js).
   Le fondu porte sur le groupe entier, jamais sur chaque ligne — sinon les lignes d'un même
   écran se croiseraient les unes les autres. */
.pj-groupe--solo {
    position: absolute; inset: 0; --pj-dir: 1;
    display: flex; flex-direction: column; justify-content: center;
    opacity: 0; transform: translateY(calc(18px * var(--pj-dir)));
    transition: opacity .38s ease, transform .38s cubic-bezier(.22, .61, .36, 1);
}
.pj-groupe--solo.is-on  { opacity: 1; transform: none; }
.pj-groupe--solo.is-out { opacity: 0; transform: translateY(calc(-18px * var(--pj-dir))); }
.pj-groupe--solo > .pj-item { flex: none; overflow: hidden; }

/* ---- Générique : les lignes montent seules, trois au plus à l'écran ---- */
.pj-gen { overflow: hidden; cursor: pointer; }
/* PAS de fondu aux bords (masque en dégradé retiré le 2026-09-08).
   L'effet « générique de cinéma » délavait le haut et le bas de l'écran : la ligne qui
   arrive et celle qui part — c'est-à-dire deux des trois lignes visibles — passaient sous
   un voile. Or on projette ce texte pour qu'il soit RECOPIÉ : chaque ligne visible doit
   être à pleine encre du premier au dernier instant. Le débordement est simplement coupé
   net par l'overflow de .pj-gen, comme au cinéma. */
.pj-gen__col { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.pj-item--gen { overflow: hidden; }
/* Panneau de fin : fond PLEIN, sans transparence ni flou — même raison que ci-dessus,
   rien de délavé dans ce mode. */
.pj-gen__end {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px;
    background: var(--pj-stage);
}
.pj-gen__end[hidden] { display: none; }
.pj-gen__endt { margin: 0; font-family: var(--font-display); font-size: 1.6rem; color: var(--pj-fg); }
.pj-btn--big { height: 44px; padding: 0 22px; border-radius: 11px;
    background: var(--pj-acc); color: #04201a; font-size: .95rem; }
.pj-btn--big:hover { background: var(--pj-acc); filter: brightness(1.08); }

/* ---- Jauge d'avancement : un filet, en bas, sur toute la largeur ---- */
.pj-progress { flex: none; height: 3px; background: rgba(100, 116, 139, .18); }
.pj-progress__fill { display: block; height: 100%; width: 0;
    background: linear-gradient(90deg, var(--pj-acc), #22d3ee);
    transition: width .25s ease; }

/* ---- Le contenu projeté hérite du thème ----
   Les blocs restent ceux de l'impression : seules les couleurs de texte, qui
   viennent de la feuille de style générale, doivent suivre le fond sombre. */
.pj[data-theme="ecran"] .pj-item__in { color: var(--pj-fg); }
.pj[data-theme="ecran"] .pj-item__in code { background: rgba(148, 163, 184, .18); color: #e2e8f0; }
.pj[data-theme="ecran"] .pj-item__in blockquote { border-left-color: rgba(148, 163, 184, .5); color: #cbd5e1; }
.pj[data-theme="ecran"] .pj-item__in th, .pj[data-theme="ecran"] .pj-item__in td { border-color: rgba(148, 163, 184, .55); }
.pj[data-theme="ecran"] .pj-item__in th { background: rgba(148, 163, 184, .16); }
.pj[data-theme="ecran"] .pj-nav:hover { background: rgba(226, 232, 240, .08); }

/* Écran étroit (portable de l'enseignant, tablette) : la barre se resserre en
   gardant l'essentiel — les modes et les réglages du mode courant. */
/* Les intitulés des trois modes s'effacent bien avant la vraie étroitesse : depuis
   l'ajout du sélecteur 1 / 2 / 3, la barre se chevauchait dès 1280 px — la largeur d'un
   portable d'enseignant. Les icônes et les infobulles suffisent, et la pastille verte dit
   déjà quel mode est actif. */
@media (max-width: 1400px) {
    .pj-mode span { display: none; }
    .pj-mode { padding: 0 10px; }
}
@media (max-width: 900px) {
    .pj-ident, .pj-btn--quit span, .pj-val { display: none; }
    .pj-range { width: 82px; }
    .pj-bar { gap: 8px; }
}
@media (max-width: 620px) {
    .pj-help { left: 12px; width: auto; }
    .pj-nav { height: 52px; }
}

/* Impression depuis la page de projection : elle n'est pas faite pour ça (c'est
   le rôle de /print), mais un Ctrl+P malencontreux ne doit pas sortir une page
   blanche — .pj est en position fixe, donc invisible à l'impression. */
@media print {
    body.pj-body { overflow: visible; background: #fff; }
    .pj { position: static; display: block; }
    .pj-bar, .pj-help, .pj-progress, .pj-solo, .pj-gen { display: none !important; }
    .pj-scene { padding: 0; }
    .pj-doc { position: static; overflow: visible; padding: 0; }
    .pj-sheetwrap { width: auto !important; height: auto !important; }
    .pj-sheetwrap > .lc-print { position: static; transform: none !important;
        width: auto; padding: 0; box-shadow: none; }
}

/* ---- Nombre de lignes à l'écran (1 / 2 / 3), mode Ligne à ligne ----
   Même grammaire que le sélecteur de mode, en plus compact : une gouttière, la
   sélection en pastille d'accent. */
.pj-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px;
    background: rgba(148, 163, 184, .14); }
.pj-seg__b {
    width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent;
    color: #cbd5e1; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
    font-variant-numeric: tabular-nums; transition: background .16s ease, color .16s ease;
}
.pj-seg__b:hover { color: #f8fafc; }
.pj-seg__b.is-on { background: var(--pj-acc); color: #04201a; }
.pj-seg__b:focus-visible { outline: 2px solid var(--pj-acc); outline-offset: 2px; }

/* ---- Curseur « taille du texte » (mode Ligne à ligne) ----
   Deux A de tailles différentes encadrent le curseur, comme la visionneuse de note. */
.pj-aa { color: #94a3b8; font-weight: 700; line-height: 1; }
.pj-aa--sm { font-size: .72rem; }
.pj-aa--lg { font-size: 1.02rem; }
.pj-speed--texte .pj-range { width: 92px; }

/* ---- Générique : reprise en main au glissement ----
   touch-action: none — sinon le navigateur interprète le glissement vertical comme un
   défilement de page et le pointermove n'arrive jamais. */
.pj-gen { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.pj-gen.is-drag { cursor: grabbing; }
/* Pendant la prise en main, le texte suit le doigt à l'image près : aucune transition. */
.pj-gen.is-drag .pj-gen__col { transition: none; }

/* ---- Modale d'une ressource en QR code ----------------------------------------
   La page projette la leçon telle qu'elle s'imprime : une vidéo ou une feuille
   d'exercices y est un QR code — celui que l'élève recopie. Le cliquer ouvre la
   ressource ici, en grand, sans quitter la projection. */
/* Sur cette page, un QR ne part pas dans un nouvel onglet : il s'ouvre ici. Le curseur
   l'annonce, et un halo au survol le distingue d'un simple dessin à recopier. */
.pj a.lc-qr-block { cursor: zoom-in; border-radius: 10px; }
.pj a.lc-qr-block:hover { box-shadow: 0 0 0 3px rgba(16, 185, 129, .38); }
.pj-modal {
    position: absolute; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 26px;
    background: rgba(2, 6, 23, .74);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pj-modal[hidden] { display: none; }
.pj-modal__box {
    display: flex; flex-direction: column; width: min(1180px, 100%); max-height: 100%;
    border-radius: 16px; overflow: hidden; background: #fff; color: var(--text);
    box-shadow: 0 26px 70px rgba(2, 6, 23, .55);
}
.pj-modal__head {
    flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 18px;
    background: var(--slate-900); color: #e2e8f0;
}
.pj-modal__t { flex: 1 1 auto; min-width: 0; margin: 0;
    font-family: var(--font-display); font-size: 1rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-modal__head .pj-btn { color: inherit; }
.pj-modal__body { flex: 1 1 auto; min-height: 0; overflow: auto; background: #fff; }
/* Feuille d'exercices EMPRUNTÉE à la leçon : elle arrive sans les marges du papier, et
   retrouve ici les commandes que .lc-print masque (« Vérifier », « Correction »). */
.pj-modal__body > .exo-feuille { padding: 22px 26px; }
/* Vidéo, MathALÉA, diaporama, PDF : un cadre 16/9 borné à la hauteur de la modale. */
.pj-modal__frame { position: relative; width: 100%; aspect-ratio: 16 / 9;
    max-height: calc(100vh - 190px); background: #000; }
.pj-modal__frame iframe, .pj-modal__frame video {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
/* Repère laissé dans la leçon à la place de la feuille empruntée : aucune trace visible. */
.pj-emprunt { display: none; }

@media (max-width: 620px) {
    .pj-modal { padding: 10px; }
    .pj-modal__frame { max-height: calc(100vh - 140px); }
}

/* =========================================================================
   Code couleur des encadrés — onglet /gestion#encadres
   Sept lignes, trois couleurs chacune, et à côté un VRAI encadré de leçon.
   Les couleurs sont posées en variables sur le <li> : l'aperçu suit tout seul,
   sans une ligne de rendu en JavaScript (cf. js/encadres.js).
   ========================================================================= */
.enc-liste { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.enc-ligne {
    display: grid; grid-template-columns: minmax(330px, 400px) 1fr; gap: 18px; align-items: center;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.enc-ligne__reglages { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Pastille du type, à sa propre couleur de filet : on repère la ligne d'un coup d'œil. */
.enc-ligne__nom {
    flex: 0 0 auto; min-width: 94px; padding: 3px 10px; border-radius: 999px;
    border-left: 4px solid var(--enc-bord); background: var(--enc-fond); color: var(--enc-titre);
    font-family: var(--font-display); font-size: .82rem; font-weight: 700;
}
.enc-champ { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.enc-champ span { font-size: .72rem; color: var(--muted); }
.enc-champ input[type="color"] {
    width: 40px; height: 30px; padding: 2px; border: 1px solid var(--slate-300);
    border-radius: 8px; background: #fff; cursor: pointer;
}
.enc-apercu { margin: 0; }
.enc-apercu .encadre__body p { margin: 0; }
.enc-reglage__etat { font-size: .88rem; color: var(--muted); }
.enc-reglage__etat:empty { display: none; }
.enc-reglage__etat.is-error { color: #b91c1c; }
.enc-reglage__note { margin-top: 14px; }

/* ---- Mes catégories (migration 074) ----
   Mêmes lignes que les sept d'origine, à trois détails près : le nom est un champ (et non
   une pastille figée), une corbeille ferme la ligne, et l'aperçu n'a pas de classe
   .encadre--<clé> — ses couleurs ne viennent que des variables posées en ligne. */
.enc-titre {
    margin: 22px 0 0; font-family: var(--font-display); font-size: .95rem; font-weight: 700;
    color: var(--slate-700, #334155);
}
.enc-titre:first-of-type { margin-top: 16px; }
.enc-ligne__nom--edit {
    min-width: 150px; max-width: 190px; padding: 4px 10px; font-family: var(--font-display);
    font-size: .82rem; font-weight: 700; border: 1px solid var(--slate-300);
    border-left: 4px solid var(--enc-bord); border-radius: 999px;
    background: var(--enc-fond); color: var(--enc-titre);
}
.enc-ligne__nom--edit::placeholder { color: var(--muted); font-weight: 500; }
.enc-ligne__nom--edit:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Troisième colonne de la ligne : la corbeille reste au bout de CE qu'elle supprime,
   même quand la rangée de réglages se replie sur deux lignes. */
.enc-ligne--perso { grid-template-columns: minmax(330px, 400px) 1fr auto; }
.enc-ligne__sup {
    flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
    border: 1px solid var(--slate-300); border-radius: 8px; background: #fff;
    color: var(--slate-500, #64748b); font-size: .9rem; line-height: 1; cursor: pointer;
}
.enc-ligne__sup:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.enc-vide { margin: 10px 0; color: var(--muted); font-size: .88rem; }
#enc-add { margin-top: 4px; }

@media (max-width: 860px) {
    /* Une colonne : le réglage, puis son aperçu dessous. La corbeille remonte au bout de la
       rangée de réglages — seule sur une ligne pleine largeur, elle n'aurait plus de sens. */
    .enc-ligne, .enc-ligne--perso { grid-template-columns: 1fr; gap: 10px; }
    /* Sortie du flux : les deux blocs restants s'empilent, et le bouton se cale dans le
       coin de la ligne au lieu d'occuper une troisième rangée pour lui tout seul. */
    .enc-ligne--perso { position: relative; }
    .enc-ligne--perso .enc-ligne__sup { position: absolute; top: 10px; right: 10px; }
}

/* ---- Historique d'un plan de classe (annuler / rétablir) ----
   Détaché du reste de la boîte à outils par un filet : ce n'est pas un outil de
   dessin de plus, c'est la marche arrière. */
.plans__histo { padding-right: 12px; border-right: 1px solid var(--border); }
.plans__histo .btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ==========================================================================
   Mémo — « Mes cartes » : les paquets que l'ÉLÈVE fabrique lui-même.
   Préfixes : .mc-*  éditeur et bibliothèque · .mcj-* révision et test
              .mep-* modération côté enseignant
   La palette de catégories (.mc-col--*) est définie UNE fois et sert partout :
   pastilles de l'éditeur, liseré des cartes, filtres du test, aperçu du prof.
   ========================================================================== */

/* ---- Palette de catégories ---- */
.mc-col--jaune  { --mc-cat: #eab308; --mc-cat-bg: #fefce8; }
.mc-col--vert   { --mc-cat: #16a34a; --mc-cat-bg: #f0fdf4; }
.mc-col--bleu   { --mc-cat: #2563eb; --mc-cat-bg: #eff6ff; }
.mc-col--violet { --mc-cat: #7c3aed; --mc-cat-bg: #f5f3ff; }
.mc-col--rose   { --mc-cat: #db2777; --mc-cat-bg: #fdf2f8; }
.mc-col--orange { --mc-cat: #ea580c; --mc-cat-bg: #fff7ed; }
.mc-col--rouge  { --mc-cat: #dc2626; --mc-cat-bg: #fef2f2; }
.mc-col--gris   { --mc-cat: #64748b; --mc-cat-bg: #f8fafc; }
.mc-col--none   { --mc-cat: var(--slate-300); --mc-cat-bg: #fff; }

/* ---- En-tête commun ---- */
.mc { max-width: var(--maxw, 920px); margin: 0 auto; }
.mc__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.mc__head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mc__title { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.02em; margin: 6px 0 0; }
.mc__sub { color: var(--muted); margin: 6px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mc-badge { font-size: .74rem; font-weight: 700; color: var(--primary); background: #eef2ff; padding: 3px 10px; border-radius: 999px; }
.mc-count { font-size: .88rem; }
.mc-empty { color: var(--muted); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius);
    padding: 26px; text-align: center; line-height: 1.6; }

/* ---- Onglets « Mes paquets » / « Bibliothèque » ---- */
.mc-tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.mc-tab { border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; padding: 10px 14px;
    border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; }
.mc-tab:hover { color: var(--text); }
.mc-tab.is-on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.mc-tab__n { background: var(--slate-100); color: var(--slate-600); font-size: .74rem; font-weight: 700;
    padding: 1px 8px; border-radius: 999px; }
.mc-tab.is-on .mc-tab__n { background: #eef2ff; color: var(--primary); }

/* ---- Grille de paquets ---- */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.mc-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 9px;
    overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.mc-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--primary); }
.mc-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(15,23,42,.11); }
.mc-card--maths::before    { background: linear-gradient(90deg, #4f46e5, #6366f1); }
.mc-card--francais::before { background: linear-gradient(90deg, #dc2626, #f87171); }
.mc-card--anglais::before  { background: linear-gradient(90deg, #1d4ed8, #60a5fa); }
.mc-card--espagnol::before { background: linear-gradient(90deg, #ea580c, #fbbf24); }
.mc-card--allemand::before { background: linear-gradient(90deg, #111827, #dc2626 55%, #facc15); }
.mc-card--histoire::before { background: linear-gradient(90deg, #a16207, #d97706); }
.mc-card--svt::before      { background: linear-gradient(90deg, #15803d, #4ade80); }
.mc-card--physique::before { background: linear-gradient(90deg, #0e7490, #22d3ee); }
.mc-card--techno::before   { background: linear-gradient(90deg, #475569, #94a3b8); }
.mc-card--arts::before     { background: linear-gradient(90deg, #db2777, #fb923c); }
.mc-card--musique::before  { background: linear-gradient(90deg, #7c3aed, #c084fc); }
.mc-card--emc::before      { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.mc-card__top { display: flex; align-items: center; gap: 11px; margin-top: 4px; }
.mc-card__ic { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.mc-card__id { min-width: 0; }
.mc-card__title { margin: 0; font-size: 1.05rem; line-height: 1.25; word-break: break-word; }
.mc-card__matiere { font-size: .76rem; color: var(--muted); }
.mc-card__desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.mc-card__from { margin: 0; font-size: .8rem; color: var(--muted); }
.mc-card__stats { margin: 0; display: flex; gap: 12px; font-size: .84rem; color: var(--muted); }
.mc-card__best { color: #16a34a; font-weight: 600; }
.mc-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.mc-card__x { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border: 0; border-radius: 50%;
    background: var(--slate-100); color: var(--slate-500); cursor: pointer; line-height: 1; font-size: 1.05rem; opacity: 0; transition: opacity .12s; }
.mc-card:hover .mc-card__x, .mc-card__x:focus-visible { opacity: 1; }
.mc-card__x:hover { background: #ef4444; color: #fff; }

/* Interrupteur de partage à la classe */
.mc-share { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; cursor: pointer;
    background: var(--slate-50); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; align-self: flex-start; }
.mc-share input { width: 16px; height: 16px; margin: 0; accent-color: #16a34a; cursor: pointer; }
.mc-share:has(input:checked) { background: #f0fdf4; border-color: #86efac; color: #166534; font-weight: 600; }

.mc-allbar { margin-top: 18px; text-align: center; }
.mc-biblio__hint { color: var(--muted); font-size: .88rem; background: var(--slate-50); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }

/* ---- Derniers tests ---- */
.mc-tests { margin-top: 26px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.mc-tests__title { margin: 0 0 10px; font-size: .95rem; }
.mc-tests__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mc-test { display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.mc-test__score { font-weight: 700; padding: 2px 10px; border-radius: 999px; min-width: 56px; text-align: center; }
.mc-test--haut  { background: #dcfce7; color: #166534; }
.mc-test--moyen { background: #fef9c3; color: #854d0e; }
.mc-test--bas   { background: #fee2e2; color: #991b1b; }
.mc-test__nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-test__date { color: var(--muted); font-size: .8rem; }

/* ---- Aperçu d'un paquet partagé ---- */
.mc-apercu__meta { color: var(--muted); font-size: .88rem; margin: -8px 0 12px; }
.mc-apercu { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.mc-apercu__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border);
    border: 1px solid var(--border); border-left: 4px solid var(--mc-cat, var(--slate-200)); border-radius: 10px; overflow: hidden; }
.mc-apercu__cell { background: #fff; padding: 9px 12px; font-size: .92rem; line-height: 1.45; word-break: break-word; }

/* ---- Catégories de couleur ---- */
.mc-cats { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 18px; }
.mc-cats__sum { cursor: pointer; font-weight: 600; font-size: .95rem; }
.mc-cats__hint { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: 10px 0 12px; }
.mc-cats__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.mc-cat { display: flex; align-items: center; gap: 9px; }
.mc-cat__input { flex: 1; min-width: 0; }
.mc-swatch { width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto; background: var(--mc-cat, var(--slate-300));
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.12); }
.mc-cats__foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.mc-cats__ok { color: #16a34a; font-size: .85rem; font-weight: 600; }

/* ---- Liste des cartes d'un paquet ---- */
.mc-cartes { display: flex; flex-direction: column; gap: 10px; }
.mc-carte { position: relative; display: flex; align-items: stretch; background: #fff; border: 1px solid var(--border);
    border-left: 5px solid var(--mc-cat, var(--slate-200)); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.mc-carte__num { flex: 0 0 34px; display: flex; align-items: center; justify-content: center; font-size: .8rem;
    font-weight: 700; color: var(--slate-400); background: var(--mc-cat-bg, var(--slate-50)); border-right: 1px solid var(--border); }
.mc-carte__faces { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; }
.mc-carte__face { padding: 12px 16px; min-width: 0; }
.mc-carte__face + .mc-carte__face { border-left: 1px solid var(--border); }
.mc-carte__tag { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.mc-carte__body { line-height: 1.5; word-break: break-word; }
.mc-carte__body img.memo-img { max-height: 150px; }
.mc-carte__tools { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
    gap: 5px; padding: 10px 14px; border-left: 1px solid var(--border); background: var(--slate-50); font-size: .84rem; }
.mc-mv { width: 26px; height: 22px; border: 1px solid var(--border); border-radius: 6px; background: #fff;
    color: var(--slate-600); cursor: pointer; line-height: 1; font-size: .85rem; }
.mc-mv:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Éditeur de carte ---- */
.modal__box--wide { max-width: 900px; }
.mc-faces { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mc-face { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.mc-ta { font-family: inherit; resize: vertical; line-height: 1.5; }

/* Barre d'outils de mise en forme */
.mc-tools { display: flex; flex-wrap: wrap; gap: 3px; background: var(--slate-50); border: 1px solid var(--border);
    border-radius: 9px; padding: 4px; }
.mc-tool { position: relative; display: inline-flex; }
.mc-toolb { min-width: 30px; height: 28px; padding: 0 7px; border: 0; border-radius: 7px; background: none;
    color: var(--slate-700); cursor: pointer; font-size: .92rem; line-height: 1; display: inline-flex;
    align-items: center; justify-content: center; gap: 1px; }
.mc-toolb:hover { background: #eef2ff; color: var(--primary); }
.mc-toolb small { font-size: .72em; }
.mc-toolb--math { font-size: 1.05rem; color: var(--primary); font-weight: 700; }
.mc-toolb__ink { width: 11px; height: 11px; border-radius: 3px; margin-right: 3px;
    background: linear-gradient(135deg, #dc2626, #2563eb); }
.mc-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 150px; background: #fff;
    border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(15,23,42,.18); padding: 5px; }
.mc-menu__item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 10px; border: 0;
    border-radius: 7px; background: none; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.mc-menu__item:hover { background: var(--slate-100); }
.mc-menu__dot { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(15,23,42,.12); }

/* Sélecteur d'image d'une face */
.mc-imgpick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mc-imgpick__prev { position: relative; display: inline-flex; }
.mc-imgpick__prev img { max-height: 54px; max-width: 110px; border-radius: 7px; border: 1px solid var(--border); }
.mc-imgpick__x { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border: 0; border-radius: 50%;
    background: #ef4444; color: #fff; cursor: pointer; line-height: 1; font-size: .85rem; }

.mc-preview { background: var(--slate-50); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-height: 58px; }
.mc-preview__tag { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.mc-preview .memo-img { max-height: 120px; }

/* Choix de la couleur de catégorie */
.mc-colorrow { margin-top: 14px; }
.mc-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.mc-color { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; cursor: pointer;
    background: var(--mc-cat, var(--slate-200)); box-shadow: inset 0 0 0 1px rgba(15,23,42,.12); }
.mc-color.mc-col--none { background: repeating-linear-gradient(45deg, #fff, #fff 5px, var(--slate-200) 5px, var(--slate-200) 10px); }
.mc-color.is-on { border-color: var(--slate-800); transform: scale(1.06); }

/* Palette de caractères spéciaux */
.mc-chars__tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.mc-chars__tab { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 12px;
    font: inherit; font-size: .84rem; cursor: pointer; color: var(--slate-600); }
.mc-chars__tab:hover { border-color: var(--primary); color: var(--primary); }
.mc-chars__tab.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.mc-chars__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; max-height: 40vh; overflow: auto; }
.mc-char { height: 44px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font-size: 1.15rem;
    cursor: pointer; color: var(--text); }
.mc-char:hover { background: #eef2ff; border-color: var(--primary); color: var(--primary); }

@media (max-width: 720px) {
    .mc-faces { grid-template-columns: 1fr; }
    .mc-carte__faces { grid-template-columns: 1fr; }
    .mc-carte__face + .mc-carte__face { border-left: 0; border-top: 1px solid var(--border); }
    .mc-carte__tools { flex-direction: row; align-items: center; }
    .mc-apercu__row { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Réviser / se tester sur ses cartes (.mcj-*)
   ========================================================================== */
.mcj { max-width: 720px; margin: 0 auto; }
.mcj__head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.mcj__titre { flex: 1; font-weight: 600; text-align: center; }
.mcj__state { animation: mcj-in .22s ease; }
@keyframes mcj-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Écran de départ */
.mcj-setup { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.mcj-setup__lead { margin: 0 0 18px; font-size: 1.02rem; }
.mcj-setup__last { color: var(--muted); }
.mcj-setup__count { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.mcj-opt { margin-bottom: 16px; }
.mcj-opt__label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.mcj-seg { display: inline-flex; gap: 4px; background: var(--slate-100); border-radius: 10px; padding: 4px; }
.mcj-seg--wrap { display: flex; flex-wrap: wrap; }
.mcj-segb { border: 0; background: none; font: inherit; font-size: .9rem; padding: 6px 14px; border-radius: 8px;
    cursor: pointer; color: var(--slate-600); }
.mcj-segb:hover { color: var(--text); }
.mcj-segb.is-on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.mcj-segb--col { border-left: 4px solid var(--mc-cat, var(--slate-300)); }
.mcj-setup__go { display: flex; gap: 12px; flex-wrap: wrap; }
.mcj-go { flex: 1; min-width: 190px; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 18px; font-size: 1.02rem; }
.mcj-go small { font-weight: 400; font-size: .8rem; opacity: .78; }

/* Bandeau de progression */
.mcj-hud { margin-bottom: 16px; }
.mcj-bar { height: 7px; background: var(--slate-200); border-radius: 999px; overflow: hidden; }
.mcj-bar__fill { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #4338ca); transition: width .28s ease; }
.mcj-hud__count { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: .85rem; }

/* Feuilletage */
.mcj-card { margin: 0 auto; }
.mcj-hint { text-align: center; color: var(--muted); font-size: .88rem; margin: 12px 0 0; }
.mcj-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.mcj-navb { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; background: #fff;
    font-size: 1.5rem; line-height: 1; color: var(--slate-600); cursor: pointer; }
.mcj-navb:hover { border-color: var(--primary); color: var(--primary); }

/* Test : énoncé et propositions */
.mcj-q { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 16px; }
.mcj-q__tag { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.mcj-q__body { font-size: 1.2rem; line-height: 1.45; word-break: break-word; }
.mcj-q__body .memo-img { max-height: 180px; }
.mcj-choix { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mcj-choixb { text-align: left; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
    font: inherit; cursor: pointer; transition: background .12s, border-color .12s; }
.mcj-choixb:hover:not(:disabled) { background: var(--slate-50); border-color: var(--slate-300); }
.mcj-choixb:disabled { cursor: default; }
.mcj-choixb__txt { line-height: 1.4; word-break: break-word; }
.mcj-choixb__txt .memo-img { max-height: 90px; margin-bottom: 4px; }
.mcj-choixb.is-bonne { background: #dcfce7; border-color: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,.16); }
.mcj-choixb.is-fausse { background: #fee2e2; border-color: #dc2626; }
@media (max-width: 560px) { .mcj-choix { grid-template-columns: 1fr; } }

/* Test : repli en auto-évaluation (paquet trop petit pour fabriquer des propositions) */
.mcj-auto { text-align: center; }
.mcj-auto__rep { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
    margin: 12px 0; font-size: 1.1rem; line-height: 1.45; }
.mcj-auto__juge { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.mcj-verdict { text-align: center; font-weight: 600; margin: 14px 0 0; }
.mcj-verdict.is-ok { color: #16a34a; }
.mcj-verdict.is-ko { color: #dc2626; }
.mcj-next { display: block; margin: 14px auto 0; }

/* Résultat */
.mcj__end { text-align: center; }
.mcj-end__card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px; }
.mcj-end__emoji { font-size: 3rem; margin: 0 0 6px; }
.mcj-end__score { font-size: 1.6rem; font-weight: 700; margin: 6px 0 18px; }
.mcj-end__revoir { text-align: left; margin-bottom: 20px; }
.mcj-end__revoir h3 { font-size: .95rem; margin: 0 0 10px; }
.mcj-end__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 40vh; overflow: auto; }
.mcj-end__item { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border);
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mcj-end__cell { background: #fff; padding: 9px 12px; font-size: .92rem; line-height: 1.4; word-break: break-word; }
.mcj-end__cell--rep { background: #f0fdf4; color: #166534; font-weight: 600; }
.mcj-end__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 560px) { .mcj-end__item { grid-template-columns: 1fr; } }

/* ==========================================================================
   Modération enseignant (.mep-*)
   ========================================================================== */
.mep__classe { font-size: 1.05rem; margin: 26px 0 10px; display: flex; align-items: center; gap: 9px; }
.mep__n { background: var(--slate-100); color: var(--slate-600); font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.mep { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.mep__sum { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; cursor: pointer; }
.mep__titre { font-weight: 600; }
.mep__auteur { color: var(--primary); font-size: .88rem; }
.mep__meta { color: var(--muted); font-size: .82rem; margin-left: auto; }
.mep__x { background: #fff; border-color: var(--border); color: #b91c1c; }
.mep__x:hover { background: #fee2e2; border-color: #fca5a5; }
.mep__desc { color: var(--muted); font-size: .9rem; margin: 0 18px 10px; }
.mep__cartes { display: flex; flex-direction: column; gap: 6px; padding: 0 18px 16px; }
.mep__carte { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border);
    border-left: 4px solid var(--mc-cat, var(--slate-200)); border-radius: 10px; overflow: hidden; }
.mep__face { background: #fff; padding: 9px 12px; font-size: .92rem; line-height: 1.45; word-break: break-word; }
.mep__face .memo-img { max-height: 120px; }
@media (max-width: 640px) { .mep__carte { grid-template-columns: 1fr; } }

/* Entrée « Mes cartes » depuis l'accueil Mémo de l'élève */
.eleve-memo__mine { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 16px;
    border-radius: var(--radius); text-decoration: none; color: #fff;
    background: linear-gradient(135deg, #0ea5e9, #0369a1); box-shadow: var(--shadow); transition: transform .15s ease; }
.eleve-memo__mine:hover { transform: translateY(-2px); text-decoration: none; color: #fff; }
.eleve-memo__mine-ic { font-size: 1.7rem; line-height: 1; }
.eleve-memo__mine strong { display: block; font-size: 1.05rem; }
.eleve-memo__mine-sub { display: block; font-size: .85rem; opacity: .92; }

@media (prefers-reduced-motion: reduce) {
    .mc-card, .mcj__state, .eleve-memo__mine, .mcj-bar__fill { transition: none; animation: none; }
    .mc-card:hover, .eleve-memo__mine:hover { transform: none; }
}

/* ---- Rétablissement de l'attribut [hidden] ----
   Un `display` posé dans une règle de classe l'emporte sur `[hidden]` (qui n'est qu'un
   `display: none` de la feuille du navigateur) : sans ces lignes, la vignette d'image, les
   propositions du test ou le bouton « suivante » restent VISIBLES alors que le code les a
   cachés. Même précaution que .modal__foot[hidden] et .lc-respick[hidden] plus haut. */
.mc-imgpick__prev[hidden] { display: none; }
.mcj-choix[hidden]        { display: none; }
.mcj-auto__juge[hidden]   { display: none; }
.mcj-next[hidden]         { display: none; }
.mcj-auto .btn[hidden]    { display: none; }

/* Le `display: flex` de .mep__sum escamote le triangle d'ouverture du <details> : sans
   repère, rien ne dit que la ligne se déplie sur les cartes du paquet. On le repose. */
.mep__sum { list-style: none; }
.mep__sum::-webkit-details-marker { display: none; }
.mep__sum::before { content: "\25B8"; color: var(--slate-400); font-size: .9rem; }
.mep[open] .mep__sum::before { content: "\25BE"; }

/* =========================================================================
   Module « Automatismes » (menu Jeux & Exercices) — migration 080.
   Préfixe .au-  côté élève et affichage, .auq-/.aus-/.auf- côté enseignant.

   L'accent du module est celui de la part « Jeux & Exercices » du menu
   hexagonal (#db2777), comme les mots fléchés et l'atelier Python : on
   reconnaît la famille avant de lire le titre.

   Trois surfaces partagent le même rendu de question (.au-q) : l'aperçu de
   l'éditeur, le jeu de l'élève et le diaporama. C'est voulu — le moteur qui
   les dessine est unique (js/auto-core.js), et le style doit l'être aussi.
   ========================================================================= */

:root {
    --au-acc:    #db2777;   /* accent du module */
    --au-acc-d:  #be185d;
    --au-acc-l:  #fce7f3;
    --au-ok:     #059669;   /* bonne réponse */
    --au-ok-bg:  #d1fae5;
    --au-ko:     #dc2626;   /* réponse fausse */
    --au-ko-bg:  #fee2e2;
    --au-or:     #f59e0b;   /* étoiles, XP */
    --au-dom:    #94a3b8;   /* couleur du domaine courant (posée en style inline) */
    --au-rang:   #94a3b8;   /* couleur du rang courant */
    --au-fond:   #f8fafc;
}

/* ---------------------------------------------------------------- communs */

.au-titre {
    font-family: var(--font-display);
    font-size: 1.05rem; margin: 26px 0 12px;
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.au-titre__compte { font-weight: 500; color: var(--muted); font-size: .9rem; }
.au-titre .linklike { margin-left: auto; font-size: .85rem; }

.au-vide { color: var(--muted); font-size: .92rem; }
.au-vide--carte {
    background: #fff; border: 1px dashed var(--border); border-radius: var(--radius);
    padding: 22px 20px; text-align: center;
}
.au-vide--carte p { margin: 0 0 8px; }
.au-vide__gestes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.au-muet { color: var(--slate-400); }

.au-onglets { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.au-onglet {
    padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600;
    color: var(--slate-600); background: var(--slate-100); border: 1px solid transparent;
    text-decoration: none; cursor: pointer;
}
.au-onglet:hover { background: var(--slate-200); text-decoration: none; }
.au-onglet.is-on { background: var(--au-acc); color: #fff; border-color: var(--au-acc-d); }
.au-onglets--sm .au-onglet { padding: 5px 11px; font-size: .82rem; }

.au-tag {
    display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72rem;
    background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--slate-200);
}
.au-tag--res { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
/* Question gardée dans la composition mais écartée par le mode (association en
   diaporama) : elle reste lisible et déplaçable, elle est seulement mise en retrait. */
.au-tag--hors { background: #f1f5f9; color: #475569; border-color: #cbd5e1;
                text-transform: none; letter-spacing: 0; }
.au-compo__liste li.est-ecartee { opacity: .55; }
.au-compo__liste li.est-ecartee .au-compo__t { text-decoration: line-through;
                text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.au-tag--cat { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---------------------------------------------------------------- tableau de bord */

.au-board__head, .au-banque__head {
    display: flex; gap: 20px; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; margin-bottom: 18px;
}
.au-board__head h1, .au-banque__head h1 { margin: 0 0 4px; font-size: 1.6rem; }
.au-board__sub, .au-banque__sub { margin: 0; color: var(--muted); font-size: .92rem; max-width: 62ch; }
.au-board__actions, .au-banque__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.au-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.au-kpi {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow);
}
.au-kpi b { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.au-kpi span { font-size: .8rem; color: var(--muted); }
.au-kpi--taux b { color: var(--au-ok); }
.au-kpi--banque b { color: var(--au-acc); }

.au-board__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 8px; }
@media (max-width: 900px) { .au-board__cols { grid-template-columns: 1fr; } }

.au-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.au-liste__i { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.au-liste__lien {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    text-decoration: none; color: inherit;
}
.au-liste__lien:hover { background: var(--slate-50); text-decoration: none; }
.au-liste__mode { font-size: 1.2rem; }
.au-liste__corps { flex: 1; min-width: 0; }
.au-liste__corps b { display: block; font-size: .95rem; }
.au-liste__corps small { color: var(--muted); font-size: .78rem; }
.au-liste__chiffre { text-align: right; }
.au-liste__chiffre b { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.au-liste__chiffre small { color: var(--muted); font-size: .72rem; }
.au-liste--pale .au-liste__i { background: var(--slate-50); border-style: dashed; }

.au-board__gestes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.au-geste {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 12px 14px; border-radius: 12px; cursor: pointer; text-align: left;
    background: #fff; border: 1px solid var(--border);
}
.au-geste:hover { border-color: var(--au-acc); box-shadow: 0 4px 14px rgba(219,39,119,.12); }
.au-geste span { font-size: 1.2rem; }
.au-geste b { font-size: .92rem; }
.au-geste small { color: var(--muted); font-size: .76rem; }

.au-domchips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.au-domchip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
    border-radius: 999px; font-size: .84rem; text-decoration: none; color: var(--slate-700);
    background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--au-dom);
}
.au-domchip:hover { background: var(--slate-50); text-decoration: none; }
.au-domchip b { font-size: .76rem; color: var(--muted); }
.au-domchip.is-off { opacity: .5; }

/* ---------------------------------------------------------------- tableaux */

.au-tab { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff;
          border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.au-tab th {
    text-align: left; padding: 9px 12px; background: var(--slate-50);
    font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--slate-500);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.au-tab td { padding: 9px 12px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.au-tab tr:last-child td { border-bottom: 0; }
.au-tab tr:hover td { background: var(--slate-50); }
.au-tab .is-bas { color: var(--au-ko); font-weight: 600; }
.au-tab__note { font-size: .78rem; color: var(--muted); margin: 6px 2px 0; }
.au-tab__titre { font-weight: 600; text-decoration: none; }
.au-tab__titre:hover { color: var(--au-acc); }
.au-tab td small { display: block; color: var(--muted); font-size: .76rem; }
.au-tab__outils { white-space: nowrap; text-align: right; }
.au-tab--suivi tr.is-muet td { color: var(--slate-400); }
.au-tab__enonce { max-width: 380px; }

.au-mini { display: block; height: 4px; border-radius: 2px; background: var(--slate-200); margin-top: 4px; }
.au-mini i { display: block; height: 100%; border-radius: 2px; background: var(--au-acc); }

.au-mode {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
    border-radius: 999px; font-size: .78rem; font-weight: 600;
    background: var(--slate-100); color: var(--slate-700);
}
.au-mode--seance     { background: #fce7f3; color: #9d174d; }
.au-mode--programme  { background: #ede9fe; color: #5b21b6; }
.au-mode--evaluation { background: #fef3c7; color: #92400e; }
.au-mode--diapo      { background: #cffafe; color: #155e75; }

.au-etat { font-size: .78rem; color: var(--muted); }
.au-etat--on { color: var(--au-ok); font-weight: 600; }
.au-etat--diapo { color: #0891b2; font-weight: 600; }

/* ---------------------------------------------------------------- banque : deux volets */

.au-banque__cols { display: grid; grid-template-columns: 290px 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .au-banque__cols { grid-template-columns: 1fr; } }

.au-rail {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto;
}
.au-rail__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.au-rail__head h2 { margin: 0; font-size: 1rem; font-family: var(--font-display); }
.au-rail__tout {
    display: block; margin: 10px 0; padding: 6px 10px; border-radius: 8px;
    font-size: .86rem; text-decoration: none; color: var(--slate-600); background: var(--slate-50);
}
.au-rail__tout.is-on { background: var(--au-acc-l); color: var(--au-acc-d); font-weight: 600; }
.au-rail__fam {
    margin: 14px 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--au-fam, var(--slate-500)); font-weight: 700;
}
.au-rail__liste { list-style: none; margin: 0; padding: 0; }
.au-rail__liste li { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.au-rail__d {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
    padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--slate-700);
    border-left: 3px solid var(--au-dom); font-size: .86rem;
}
.au-rail__d:hover { background: var(--slate-50); text-decoration: none; }
.au-rail__d.is-on { background: var(--au-acc-l); font-weight: 600; }
.au-rail__d.is-off { opacity: .55; }
.au-rail__nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-rail__n { font-size: .74rem; color: var(--muted); }
.au-rail__outils { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.au-rail__liste li:hover .au-rail__outils { opacity: 1; }
.au-rail__btn { border: 0; background: none; cursor: pointer; font-size: .82rem; color: var(--muted); padding: 2px 4px; }
.au-rail__btn:hover { color: var(--au-acc); }
.au-rail__cat { font-size: .64rem; color: var(--slate-400); }
.au-rail__res { font-size: .68rem; color: #9a3412; }
.au-rail__place { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.au-rail__place h3 { margin: 0 0 4px; font-size: .84rem; }
.au-rail__place p { margin: 0 0 6px; font-size: .78rem; color: var(--muted); }
.au-rail__aide { font-size: .72rem !important; }

.au-filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.au-filtres__q { flex: 1; min-width: 200px; }
.au-mur__compte { font-size: .8rem; color: var(--muted); margin: 0 0 8px; }

.au-cartes {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.au-carte {
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    border-top: 3px solid var(--au-dom); padding: 11px 13px 9px;
    display: flex; flex-direction: column; gap: 8px; min-height: 130px;
}
.au-carte:hover { box-shadow: 0 6px 18px rgba(15,23,42,.08); }
.au-carte.is-reserve { background: linear-gradient(180deg, #fffbeb 0%, #fff 40%); }
.au-carte__tete { display: flex; align-items: center; gap: 7px; font-size: .74rem; }
.au-carte__type {
    font-weight: 700; color: var(--au-acc-d); background: var(--au-acc-l);
    padding: 1px 6px; border-radius: 4px;
}
.au-carte__dom { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-carte__diff { color: var(--slate-400); letter-spacing: -1px; }
.au-carte__enonce { margin: 0; font-size: .9rem; line-height: 1.45; flex: 1; }
/* Vignette de la figure d'une question (Core\AutoFigures, cf. auto_figure()). Une figure
   compacte à hauteur fixe ; une figure en longueur (droite graduée) sur toute la largeur. */
.au-carte__figure { margin: 2px 0 6px; }
.au-carte__figure .au-figure { margin: 0 !important; }
.au-carte__figure .au-figure svg { height: 104px; width: auto; max-width: 100%; }
.au-carte__figure .au-figure--large svg { height: auto; width: 100%; max-height: 70px; }
.au-carte__pied { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.au-carte__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.au-carte__outils { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.au-carte:hover .au-carte__outils, .au-carte:focus-within .au-carte__outils { opacity: 1; }
.au-carte__btn {
    border: 0; background: none; cursor: pointer; font-size: .9rem; padding: 3px 5px;
    border-radius: 6px; color: var(--slate-500);
}
.au-carte__btn:hover { background: var(--slate-100); color: var(--au-acc); }
.au-carte__btn--sup:hover { color: var(--au-ko); }

.au-corbeille { margin-top: 20px; font-size: .86rem; }
.au-corbeille summary { cursor: pointer; color: var(--muted); }
.au-corbeille ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.au-corbeille li {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    background: var(--slate-50); border-radius: 8px;
}
.au-corbeille li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-corbeille li small { color: var(--muted); font-size: .74rem; white-space: nowrap; }

/* ---------------------------------------------------------------- rendu d'une question */

.au-q { display: flex; flex-direction: column; gap: 14px; }
.au-q__enonce { font-size: 1.05rem; line-height: 1.55; }
.au-q__enonce p:first-child { margin-top: 0; }
.au-q__enonce p:last-child { margin-bottom: 0; }
.au-q__image { margin: 0; text-align: center; }
.au-q__image img { max-width: 100%; max-height: 300px; border-radius: 10px; border: 1px solid var(--border); }
.au-q__info { margin: -4px 0 0; font-size: .82rem; color: var(--muted); }
.au-q__bilan { margin: 4px 0 0; font-size: .9rem; font-weight: 600; }

.au-choix { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.au-choix--dense { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 620px) { .au-choix { grid-template-columns: 1fr; } }

.au-choix__item {
    display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer;
    padding: 13px 15px; border-radius: 12px; background: #fff;
    border: 2px solid var(--slate-200); font: inherit; color: inherit;
    transition: transform .08s, border-color .12s, background .12s, box-shadow .12s;
}
.au-choix__item:hover { border-color: var(--au-acc); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(219,39,119,.12); }
.au-choix__item.is-on { border-color: var(--au-acc); background: var(--au-acc-l); }
.au-choix__lettre {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center; font-weight: 700; font-size: .82rem;
    background: var(--slate-100); color: var(--slate-600);
}
.au-choix__item.is-on .au-choix__lettre { background: var(--au-acc); color: #fff; }
.au-choix__t { flex: 1; min-width: 0; font-size: 1rem; }
.au-choix__t p { margin: 0; }

.au-q.is-verrou .au-choix__item { cursor: default; }
.au-q.is-verrou .au-choix__item:hover { transform: none; box-shadow: none; border-color: var(--slate-200); }
.au-choix__item.is-bonne { border-color: var(--au-ok); background: var(--au-ok-bg); }
.au-choix__item.is-bonne .au-choix__lettre { background: var(--au-ok); color: #fff; }
.au-choix__item.is-mauvaise { border-color: var(--au-ko); background: var(--au-ko-bg); }
.au-choix__item.is-mauvaise .au-choix__lettre { background: var(--au-ko); color: #fff; }
.au-choix__item.is-trouvee { box-shadow: 0 0 0 3px rgba(5,150,105,.18); }

/* association ------------------------------------------------------------- */

.au-assoc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.au-assoc__col { display: grid; gap: 8px; align-content: start; }
.au-eti {
    display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
    padding: 11px 13px; border-radius: 10px; background: #fff; font: inherit; color: inherit;
    border: 2px solid var(--slate-200);
    border-left-color: var(--au-paire, var(--slate-200)); border-left-width: 5px;
    transition: border-color .12s, background .12s;
}
.au-eti:hover { border-color: var(--au-acc); }
.au-eti.is-sel { border-color: var(--au-acc); background: var(--au-acc-l); }
.au-eti.is-lie { border-color: var(--au-paire); background: color-mix(in srgb, var(--au-paire) 8%, #fff); }
.au-eti__pastille {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; font-size: .74rem; font-weight: 700; color: #fff;
    background: var(--au-paire, transparent);
}
.au-eti__t { flex: 1; min-width: 0; }
.au-eti__t p { margin: 0; }
.au-q.is-verrou .au-eti { cursor: default; }

/* ---------------------------------------------------------------- éditeur de question */

.modal__box--auq { max-width: 1180px; width: min(96vw, 1180px); }
.auq { display: grid; grid-template-columns: 1fr 380px; gap: 22px; }
@media (max-width: 1000px) { .auq { grid-template-columns: 1fr; } }
.auq__form { display: grid; gap: 14px; align-content: start; }
.auq__ligne { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.auq__ligne > .field { flex: 1; min-width: 160px; }
.auq__ligne--cases { gap: 18px; }

.auq-seg { display: inline-flex; background: var(--slate-100); border-radius: 10px; padding: 3px; gap: 2px; }
.auq-seg__b {
    border: 0; background: none; cursor: pointer; font: inherit; font-size: .85rem;
    padding: 6px 13px; border-radius: 8px; color: var(--slate-600);
}
.auq-seg__b.is-on { background: #fff; color: var(--au-acc-d); font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.12); }

.auq-check { display: flex; align-items: flex-start; gap: 8px; font-size: .86rem; cursor: pointer; }
.auq-check input { margin-top: 3px; }
.auq-check b { display: block; font-size: .88rem; }
.auq-check small { display: block; color: var(--muted); font-size: .76rem; }
.auq-check--chip {
    padding: 5px 11px; border-radius: 999px; background: var(--slate-100); align-items: center;
}
.auq-check--chip small { display: inline; }
.auq-niv { display: flex; gap: 12px; flex-wrap: wrap; }

.auq-duree { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--muted); }

.auq-contenu { display: grid; gap: 8px; }
.auq-contenu__pied { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }

.auq-l { display: flex; align-items: flex-start; gap: 8px; }
.auq-l__ok { flex: 0 0 auto; display: grid; place-items: center; cursor: pointer; padding-top: 8px; position: relative; }
.auq-l__ok input { width: 18px; height: 18px; cursor: pointer; }
.auq-l__ok span { position: absolute; pointer-events: none; opacity: 0; }
.auq-l__fleche { padding-top: 10px; color: var(--muted); }
.auq-l__sup {
    flex: 0 0 auto; border: 0; background: none; cursor: pointer; color: var(--slate-400);
    font-size: .9rem; padding: 8px 4px;
}
.auq-l__sup:hover { color: var(--au-ko); }
.auq-l--assoc { align-items: flex-start; }
.auq-l--assoc .auq-champ { flex: 1; }

.auq-champ { position: relative; display: flex; flex: 1; min-width: 0; }
.auq-champ__t { flex: 1; min-width: 0; resize: none; padding-right: 38px; font-size: .92rem; line-height: 1.35; }
.auq-champ__fx {
    position: absolute; right: 6px; top: 6px; border: 0; background: var(--slate-100);
    border-radius: 6px; cursor: pointer; font-size: .76rem; padding: 3px 7px; color: var(--slate-600);
    font-style: italic; font-weight: 700;
}
.auq-champ__fx:hover { background: var(--au-acc-l); color: var(--au-acc-d); }

.auq-leurres { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--border); }
.auq-leurres__l { display: grid; gap: 6px; margin: 6px 0 8px; }

.auq-img { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; }
.auq-img__vide { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.auq-img__apercu { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.auq-img__apercu img { max-height: 110px; max-width: 220px; border-radius: 8px; border: 1px solid var(--border); }
.auq-img__apercu figcaption { font-size: .78rem; color: var(--muted); }

.auq__apercu {
    background: var(--au-fond); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; position: sticky; top: 0; align-self: start;
}
.auq__apercu h3 { margin: 0 0 12px; font-size: .78rem; text-transform: uppercase;
                  letter-spacing: .05em; color: var(--muted); }
.auq__scene { background: #fff; border-radius: 10px; padding: 16px; min-height: 120px; }
.auq__apercu-vide { color: var(--muted); font-size: .86rem; margin: 0; }
.auq__apercu-note { margin: 10px 0 0; font-size: .8rem; color: #b45309; }

.auv-corr {
    margin-top: 14px; padding: 12px 14px; background: var(--slate-50);
    border-radius: 10px; font-size: .9rem;
}

/* ---------------------------------------------------------------- éditeur de série */

.au-editeur__head {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.au-editeur__retour { font-size: .86rem; text-decoration: none; color: var(--muted); }
.au-editeur__titre { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.au-editeur__nom {
    flex: 1; min-width: 0; border: 0; border-bottom: 2px solid transparent; background: none;
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; padding: 3px 2px;
}
.au-editeur__nom:focus { outline: none; border-bottom-color: var(--au-acc); }
.au-editeur__outils { display: flex; align-items: center; gap: 12px; }
.au-editeur__etat { font-size: .78rem; color: var(--muted); min-width: 92px; text-align: right; }
.au-editeur__etat.is-ok { color: var(--au-ok); }
.au-editeur__etat.is-ko { color: var(--au-ko); }
.au-editeur__aide { margin: 10px 0 16px; font-size: .86rem; color: var(--muted); }

.au-switch { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; cursor: pointer; }
.au-switch input { width: 18px; height: 18px; }

.au-editeur__cols { display: grid; grid-template-columns: 380px 1fr; gap: 26px; align-items: start; }
@media (max-width: 1000px) { .au-editeur__cols { grid-template-columns: 1fr; } }
.au-editeur__col { display: grid; gap: 14px; align-content: start; }
.au-classes { display: flex; gap: 7px; flex-wrap: wrap; }

.au-compo { display: grid; gap: 16px; }
.au-compo__bloc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.au-compo__tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.au-compo__tete h3 { margin: 0; font-size: .95rem; }
.au-compo__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.au-compo__liste li {
    display: flex; align-items: center; gap: 9px; padding: 7px 10px;
    background: var(--slate-50); border-radius: 8px; border-left: 4px solid var(--au-dom);
    font-size: .86rem;
}
.au-compo__liste li.is-tire { opacity: .45; }
.au-compo__poignee { cursor: grab; color: var(--slate-400); user-select: none; }
.au-compo__type { font-size: .68rem; font-weight: 700; color: var(--au-acc-d); }
.au-compo__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-compo__x { border: 0; background: none; cursor: pointer; color: var(--slate-400); padding: 2px 4px; }
.au-compo__x:hover { color: var(--au-ko); }
.au-compo__nb { display: flex; align-items: center; gap: 5px; font-size: .76rem; color: var(--muted); }
.au-compo__nb input { width: 56px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; }
.au-compo__nb select { padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: .76rem; }
.au-compo__vide { color: var(--muted); font-size: .84rem; margin: 6px 0 0; }
.au-compo__bilan { font-size: .8rem; font-weight: 500; }
.au-compo__bilan.is-ok { color: var(--au-ok); }
.au-compo__bilan.is-alerte { color: #b45309; }
.au-compo__bilan.is-ko { color: var(--au-ko); }

/* sélecteur de questions --------------------------------------------------- */

.modal__box--picker { max-width: 860px; width: min(96vw, 860px); }
.ausp-filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ausp-filtres input[type="search"] { flex: 1; min-width: 180px; }
.ausp-liste { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; display: grid; gap: 4px; }
.ausp-attente { color: var(--muted); font-size: .88rem; padding: 14px; text-align: center; }
/* Pourquoi un type manque dans le sélecteur (association en diaporama). */
.ausp-note { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px;
             background: color-mix(in srgb, var(--accent) 8%, transparent);
             border-left: 3px solid var(--accent);
             color: var(--muted); font-size: .84rem; line-height: 1.45; }
.ausp-l { border-left: 4px solid var(--au-dom); border-radius: 8px; background: var(--slate-50); }
.ausp-l label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 11px; cursor: pointer; }
.ausp-l input { margin-top: 3px; }
.ausp-l__corps { flex: 1; min-width: 0; }
.ausp-l__tete { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ausp-l__t { display: block; font-size: .88rem; }
.ausp-compte { margin-right: auto; font-size: .82rem; color: var(--muted); }

.modal__box--apercu { max-width: 820px; width: min(96vw, 820px); }
.ausa-corps { max-height: 70vh; overflow: auto; display: grid; gap: 18px; padding-right: 4px; }
.ausa-q { display: flex; gap: 12px; padding: 14px; background: var(--slate-50); border-radius: 12px; }
.ausa-q > div { flex: 1; min-width: 0; }
.ausa-q__n {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: var(--au-acc); color: #fff; font-weight: 700; font-size: .8rem;
}
.ausa-corr { margin-top: 10px; font-size: .86rem; color: var(--slate-600); }
.ausa-aide { margin: 6px 0 0; font-size: .82rem; color: #b45309; }

/* ---------------------------------------------------------------- suivi */

.au-suivi__filtres { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.au-suivi__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 8px; }
@media (max-width: 900px) { .au-suivi__cols { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- classements (enseignant)
   Les listes de la page élève (.au-classement, .au-podium), mais entières : un trait marque
   l'endroit où s'arrête ce que voient les élèves. */

.au-cls__note { margin: -4px 0 14px; font-size: .84rem; color: var(--muted); max-width: 72ch; }
.au-cls__large { max-width: 760px; }
.au-cls__grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.au-cls__tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.au-cls__tete h2 { margin: 0; font-size: 1.05rem; }
.au-cls__resume { margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.au-podium__coupe {
    display: flex; align-items: center; gap: 10px; margin: 6px 0;
    font-size: .74rem; color: var(--slate-500);
}
.au-podium__coupe::before, .au-podium__coupe::after { content: ""; flex: 1; border-top: 1px dashed var(--slate-300); }

.au-rangpuce {
    display: inline-flex; align-items: center; gap: 4px; font-size: .78rem;
    padding: 1px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--au-rang) 14%, #fff); color: var(--slate-700);
}

.au-faibles { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.au-faibles li {
    display: flex; align-items: center; gap: 10px; font-size: .86rem;
    padding: 7px 10px; background: #fff; border: 1px solid var(--border);
    border-left: 4px solid var(--au-dom); border-radius: 8px;
}
.au-faibles__nom { flex: 0 0 34%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-faibles__barre { flex: 1; height: 7px; border-radius: 4px; background: var(--slate-100); }
.au-faibles__barre i { display: block; height: 100%; border-radius: 4px; background: var(--au-ok); }
.au-faibles__taux { font-weight: 600; min-width: 42px; text-align: right; }
.au-faibles__taux.is-bas { color: var(--au-ko); }
.au-faibles__n { font-size: .74rem; color: var(--muted); min-width: 56px; text-align: right; }

.modal__box--fiche { max-width: 720px; }
.auf-tete {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 14px; border-radius: 12px;
    background: color-mix(in srgb, var(--au-rang) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--au-rang) 28%, #fff);
}
.auf-tete__icone { font-size: 1.9rem; }
.auf-tete__rang { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.auf-tete__xp { font-size: .8rem; color: var(--muted); }
.auf-chiffres { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 16px; }
.auf-chiffres b { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.auf-chiffres span { font-size: .7rem; color: var(--muted); }
.auf-h { margin: 18px 0 8px; font-size: .88rem; }
.auf-dom { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.auf-dom li {
    display: flex; align-items: center; gap: 9px; font-size: .84rem;
    padding: 6px 9px; background: var(--slate-50); border-radius: 8px;
    border-left: 4px solid var(--au-dom);
}
.auf-dom__n { flex: 0 0 38%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auf-dom__e { color: var(--au-or); letter-spacing: -1px; }
.auf-dom__b { flex: 1; height: 6px; border-radius: 3px; background: var(--slate-200); }
.auf-dom__b i { display: block; height: 100%; border-radius: 3px; background: var(--au-ok); }
.auf-dom__t { font-size: .76rem; color: var(--muted); min-width: 70px; text-align: right; }

/* ---------------------------------------------------------------- accueil élève */

.au-eleve { display: block; }

.au-hero {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--au-rang) 20%, #fff) 0%,
        color-mix(in srgb, var(--au-rang) 6%, #fff) 100%);
    border: 1px solid color-mix(in srgb, var(--au-rang) 30%, #fff);
    border-radius: 18px; padding: 20px 22px; display: grid; gap: 12px;
}
.au-hero__rang { display: flex; align-items: center; gap: 14px; }
.au-hero__icone { font-size: 2.4rem; line-height: 1; }
.au-hero__nom { margin: 0; font-family: var(--font-display); font-size: 1.3rem; }
.au-hero__xp { margin: 0; font-size: .9rem; color: var(--slate-600); }
.au-hero__xp b { font-size: 1.1rem; color: var(--au-rang); }
.au-hero__barre { height: 10px; border-radius: 6px; background: rgba(255,255,255,.7); overflow: hidden; }
.au-hero__barre i { display: block; height: 100%; border-radius: 6px; background: var(--au-rang); transition: width .5s; }
.au-hero__reste { margin: 0; font-size: .84rem; color: var(--slate-600); }
.au-hero__chiffres { list-style: none; margin: 4px 0 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; }
.au-hero__chiffres b { display: block; font-family: var(--font-display); font-size: 1.3rem; }
.au-hero__chiffres span { font-size: .74rem; color: var(--slate-600); }

.au-series { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.au-serie {
    background: #fff; border: 1px solid var(--border); border-radius: 14px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 7px;
}
.au-serie--evaluation { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb 0%, #fff 50%); }
.au-serie--programme  { border-color: #ddd6fe; }
.au-serie.is-clos { opacity: .65; }
.au-serie__mode { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.au-serie__titre { margin: 0; font-size: 1.02rem; }
.au-serie__consigne { margin: 0; font-size: .84rem; color: var(--slate-600); }
.au-serie__meta { margin: 0; font-size: .78rem; color: var(--muted); }
.au-serie__score { margin: 0; font-size: .8rem; color: var(--slate-600); }
.au-serie__clos { margin: 0; font-size: .8rem; color: var(--muted); font-style: italic; }
.au-serie__go { margin-top: auto; align-self: flex-start; }

.au-reglages { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.au-famille {
    margin: 18px 0 8px; font-size: .76rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted);
}
.au-domaines { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.au-dom {
    display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit;
    background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--au-dom);
    border-radius: 14px; padding: 14px 15px; transition: transform .1s, box-shadow .12s;
}
.au-dom:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,.1); text-decoration: none; }
.au-dom__icone { font-size: 1.5rem; }
.au-dom__nom { font-weight: 600; font-size: .98rem; }
.au-dom__desc { font-size: .78rem; color: var(--muted); }
.au-dom__etoiles { color: var(--slate-300); letter-spacing: 1px; }
.au-dom__etoiles i { font-style: normal; }
.au-dom__etoiles i.is-on { color: var(--au-or); }
.au-dom__pied { font-size: .74rem; color: var(--muted); margin-top: 2px; }

.au-classement { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.au-classement__note { margin: 10px 0 0; font-size: .76rem; color: var(--muted); }
/* « Ta place » : le chiffre que l'élève vient chercher, au-dessus de la liste. */
.au-classement__moi {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
    margin: 0 0 10px; padding: 9px 13px; border-radius: 10px;
    background: var(--au-acc-l); color: var(--au-acc-d); font-size: .9rem;
}
.au-classement__moi[hidden] { display: none; }   /* le display:flex l'emporterait sinon sur [hidden] */
.au-classement__moi.is-vide { background: var(--slate-50); color: var(--slate-600); font-size: .86rem; }
.au-classement__moi-tete { font-weight: 700; }
.au-classement__moi-place b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.au-podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: p; }
.au-podium__l {
    display: flex; align-items: center; gap: 11px; padding: 7px 11px;
    border-radius: 9px; background: var(--slate-50); font-size: .9rem;
}
.au-podium__l.is-podium { background: linear-gradient(90deg, #fef9c3 0%, var(--slate-50) 60%); }
.au-podium__l.is-moi { background: var(--au-acc-l); font-weight: 600; box-shadow: inset 0 0 0 1px var(--au-acc); }
.au-podium__rang { flex: 0 0 auto; width: 28px; text-align: center; font-weight: 700; color: var(--muted); }
.au-podium__nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-podium__niveau {
    display: block; overflow: hidden; text-overflow: ellipsis;
    font-size: .74rem; font-weight: 500; color: var(--muted);
}
.au-podium__xp { font-variant-numeric: tabular-nums; color: var(--slate-600); }
.au-podium__sep { text-align: center; color: var(--slate-400); }
.au-podium__attente { color: var(--muted); font-size: .86rem; padding: 8px; }
.au-podium--prof .au-podium__l { background: #fff; border: 1px solid var(--border); }

.au-badges {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.au-badge {
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 10px; text-align: center; opacity: .45; filter: grayscale(1);
}
.au-badge.is-on { opacity: 1; filter: none; border-color: var(--au-or); box-shadow: 0 3px 12px rgba(245,158,11,.16); }
.au-badge__icone { display: block; font-size: 1.7rem; }
.au-badge__nom { display: block; font-weight: 600; font-size: .86rem; margin-top: 3px; }
.au-badge__aide { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.au-badges--fiche { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.au-badges--fiche .au-badge__aide { display: none; }

.au-histo { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.au-histo li {
    display: flex; align-items: center; gap: 12px; padding: 7px 11px;
    background: var(--slate-50); border-radius: 8px; font-size: .84rem;
}
.au-histo__quand { color: var(--muted); font-size: .76rem; min-width: 86px; }
.au-histo__quoi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-histo__score { font-weight: 600; font-variant-numeric: tabular-nums; }
.au-histo__xp { color: var(--au-acc); font-size: .78rem; }

/* ---------------------------------------------------------------- écran de jeu */

.au-jeu-body .eleve-main { max-width: none; padding: 0; }

.au-jeu {
    position: relative; min-height: calc(100vh - 62px);
    display: flex; flex-direction: column;
    background:
        radial-gradient(1100px 500px at 10% -8%, rgba(219,39,119,.10), transparent 60%),
        radial-gradient(900px 420px at 92% 0%, rgba(79,70,229,.10), transparent 60%),
        var(--au-fond);
}

.au-jeu__bar {
    display: flex; align-items: center; gap: 14px; padding: 10px 18px;
    background: rgba(255,255,255,.88); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.au-jeu__quit {
    border: 0; background: none; cursor: pointer; font-size: 1.1rem; color: var(--muted);
    padding: 4px 8px; border-radius: 8px;
}
.au-jeu__quit:hover { background: var(--slate-100); color: var(--au-ko); }
.au-jeu__titre { display: flex; flex-direction: column; min-width: 0; }
.au-jeu__nom { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au-jeu__consigne { font-size: .76rem; color: var(--muted); }
.au-jeu__jauge { flex: 1; min-width: 60px; height: 8px; border-radius: 5px; background: var(--slate-200); overflow: hidden; }
.au-jeu__jauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--au-acc), #6366f1); transition: width .35s; }
.au-jeu__compteur { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.au-jeu__xp { font-size: .9rem; font-weight: 700; color: var(--au-acc); white-space: nowrap; }

.au-jeu__chrono { height: 5px; background: var(--slate-200); }
.au-jeu__chrono i { display: block; height: 100%; background: var(--au-ok); transition: width .1s linear; }
.au-jeu__chrono.is-urgent i { background: var(--au-ko); }

.au-jeu__scene {
    flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 26px 18px 12px;
    display: flex; flex-direction: column; gap: 16px; position: relative;
}
.au-jeu__attente, .au-jeu__erreur { color: var(--muted); text-align: center; padding: 40px 0; }
.au-jeu__erreur { color: var(--au-ko); display: grid; gap: 12px; justify-items: center; }

.au-jeu__combo {
    align-self: flex-start; font-size: .86rem; font-weight: 700; color: #b45309;
    background: #fef3c7; border-radius: 999px; padding: 3px 12px;
    animation: au-pop .28s ease-out;
}

.au-jeu .au-q {
    background: #fff; border-radius: 18px; padding: 24px 26px;
    box-shadow: 0 10px 34px rgba(15,23,42,.08); border: 1px solid var(--border);
}
.au-q--entre { animation: au-entre .28s cubic-bezier(.22,.8,.3,1); }
@keyframes au-entre { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes au-pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.au-q.is-envoye { opacity: .85; }

.au-jeu__corr {
    background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--au-acc);
    border-radius: 12px; padding: 14px 16px; font-size: .92rem;
    animation: au-entre .22s ease-out;
}
.au-jeu__aide-txt {
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
    padding: 11px 14px; font-size: .9rem; margin: 0; color: #92400e;
}

.au-jeu__pied {
    position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px;
    justify-content: flex-end; padding: 12px 18px;
    background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
    border-top: 1px solid var(--border);
}
.au-jeu__aide {
    margin-right: auto; border: 1px solid #fde68a; background: #fffbeb; color: #92400e;
    border-radius: 999px; padding: 7px 15px; cursor: pointer; font: inherit; font-size: .86rem;
}
.au-jeu__aide:hover { background: #fef3c7; }
.au-jeu__aide:disabled { opacity: .5; cursor: default; }
.au-jeu__valider, .au-jeu__suite { min-width: 150px; }

.au-flash {
    position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
    gap: 6px; pointer-events: none; z-index: 60; animation: au-flash .95s ease-out forwards;
}
.au-flash__signe {
    width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center;
    font-size: 3rem; color: #fff;
}
.au-flash--ok .au-flash__signe { background: var(--au-ok); box-shadow: 0 0 0 16px rgba(5,150,105,.14); }
.au-flash--ko .au-flash__signe { background: var(--au-ko); box-shadow: 0 0 0 16px rgba(220,38,38,.14); }
.au-flash--neutre .au-flash__signe { background: var(--slate-400); box-shadow: 0 0 0 16px rgba(148,163,184,.14); }
.au-flash__xp { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--au-acc); }
@keyframes au-flash {
    0%   { opacity: 0; transform: scale(.6); }
    18%  { opacity: 1; transform: scale(1); }
    72%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.06) translateY(-14px); }
}

/* écran de fin ------------------------------------------------------------ */

.au-fin {
    position: fixed; inset: 0; z-index: 70; overflow: auto;
    background: rgba(15,23,42,.6); display: flex; align-items: flex-start; justify-content: center;
    padding: 4vh 16px;
}
.au-fin[hidden] { display: none; }
.au-fin__box {
    background: #fff; border-radius: 20px; padding: 26px 28px; width: 100%; max-width: 620px;
    box-shadow: 0 24px 70px rgba(15,23,42,.4); text-align: center;
    animation: au-monte .3s cubic-bezier(.22,.8,.3,1);
}
@keyframes au-monte { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

.au-fin__anneau {
    width: 132px; height: 132px; margin: 0 auto 14px; border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--au-ok) calc(var(--part) * 1%), var(--slate-200) 0);
}
.au-fin__anneau::before {
    content: ''; grid-area: 1/1; width: 104px; height: 104px; border-radius: 50%; background: #fff;
}
.au-fin__score { grid-area: 1/1; font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.au-fin__titre { margin: 0 0 16px; font-size: 1.25rem; }

.au-fin__chiffres { list-style: none; margin: 0 0 18px; padding: 0; display: flex; justify-content: center; gap: 28px; }
.au-fin__chiffres b { display: block; font-family: var(--font-display); font-size: 1.3rem; }
.au-fin__chiffres span { font-size: .74rem; color: var(--muted); }

.au-fin__rang { background: var(--slate-50); border-radius: 14px; padding: 14px; text-align: left; }
.au-fin__rang-tete { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.au-fin__rang-icone { font-size: 1.4rem; }
.au-fin__rang-nom { font-weight: 700; }
.au-fin__rang-total { margin-left: auto; font-size: .84rem; color: var(--muted); }
.au-fin__rang-barre { height: 9px; border-radius: 5px; background: var(--slate-200); overflow: hidden; }
.au-fin__rang-barre i { display: block; height: 100%; border-radius: 5px; transition: width .6s; }
.au-fin__rang-reste { margin: 7px 0 0; font-size: .8rem; color: var(--muted); }

.au-fin__badges { margin-top: 18px; }
.au-fin__badges h3 { margin: 0 0 10px; font-size: .95rem; color: var(--au-or); }
.au-fin__badges ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.au-fin__badges li {
    display: flex; align-items: center; gap: 12px; text-align: left;
    background: linear-gradient(90deg, #fffbeb, #fff); border: 1px solid #fcd34d;
    border-radius: 12px; padding: 10px 14px;
    animation: au-monte .35s both; animation-delay: calc(var(--i) * .12s);
}
.au-fin__badges .au-badge__icone { font-size: 1.6rem; }
.au-fin__badges .au-badge__nom { font-weight: 700; }
.au-fin__badges .au-badge__aide { font-size: .76rem; color: var(--muted); }

.au-fin__detail { margin-top: 18px; text-align: left; }
.au-fin__detail h3 { margin: 0 0 10px; font-size: .95rem; }
.au-fin__detail ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.au-fin__detail li { padding: 9px 12px; border-radius: 10px; background: var(--slate-50); font-size: .88rem; }
.au-fin__detail li.is-juste { background: var(--au-ok-bg); }
.au-fin__detail li.is-faux { background: var(--au-ko-bg); }
.au-fin__corr { margin-top: 6px; font-size: .84rem; color: var(--slate-600); }

.au-fin__actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---------------------------------------------------------------- diaporama */

.au-diapo {
    position: fixed; inset: 0; background: #0b1220; color: #f1f5f9;
    display: flex; flex-direction: column;
}
.au-diapo__bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 18px;
    background: rgba(15,23,42,.85); border-bottom: 1px solid #1e293b;
    transition: opacity .3s, transform .3s;
}
.au-diapo__bar.is-cachee { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.au-diapo__x { color: #94a3b8; text-decoration: none; font-size: 1.1rem; padding: 4px 8px; }
.au-diapo__x:hover { color: #fff; }
.au-diapo__titre { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-diapo__n { color: #94a3b8; font-variant-numeric: tabular-nums; }
.au-diapo__b {
    border: 1px solid #334155; background: #1e293b; color: #e2e8f0; cursor: pointer;
    border-radius: 8px; padding: 6px 13px; font: inherit; font-size: .86rem;
}
.au-diapo__b:hover { background: #334155; }

.au-diapo__chrono { height: 6px; background: #1e293b; }
.au-diapo__chrono i { display: block; height: 100%; background: #22c55e; transition: width .1s linear; }
.au-diapo__chrono.is-urgent i { background: #ef4444; }

.au-diapo__scene {
    flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px;
    padding: 3vh 6vw; overflow: auto;
}
/* Centrer une colonne qui peut déborder est un piège : `center` répartit le trop-plein
   au-dessus ET au-dessous, et la part du haut ne s'atteint plus en faisant défiler — le
   début de l'énoncé passait sous la barre (vu avec une figure de question, mais une image
   plafonnée à 38 vh le faisait tout autant). `safe center` centre quand ça tient, et
   retombe en haut, défilable, quand ça déborde. Sans ce mot-clé, on garde l'ancien. */
@supports (justify-content: safe center) {
    .au-diapo__scene { justify-content: safe center; }
}
.au-diapo__vide { margin: auto; color: #94a3b8; }

.au-q--diapo { gap: 26px; }
.au-q--diapo .au-q__enonce { font-size: clamp(1.4rem, 3.2vw, 2.4rem); line-height: 1.35; }
.au-q--diapo .au-q__image img { max-height: 38vh; border-color: #334155; }
/* Figure de question (Core\AutoFigures). Dimensionnée en em, elle grandirait sans fin avec
   la police du diaporama. Sous l'énoncé, elle faisait déborder la diapositive : un écran
   16:9 a de la place en LARGEUR, pas en hauteur. Une figure compacte se pose donc à côté
   du texte, à hauteur fixe ; une figure en longueur (droite graduée, rectangle plat)
   reste dessous, bornée des deux côtés. Mesuré en 1280 × 720 sur six questions. */
.au-q--diapo .au-figure svg { height: 34vh; width: auto; }
.au-q--diapo .au-figure--large svg { height: auto; max-width: min(100%, 56vw); max-height: 18vh; }
.au-q--diapo .au-q__enonce:has(> .au-figure:not(.au-figure--large)) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 3vw; align-items: start;
}
.au-q--diapo .au-q__enonce:has(> .au-figure:not(.au-figure--large)) > * { grid-column: 1; }
/* Plusieurs paragraphes s'empilent à gauche ; la figure couvre leurs rangées à droite. */
.au-q--diapo .au-q__enonce > .au-figure:not(.au-figure--large) { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
/* Plusieurs programmes Scratch en grille : à 34 vh, leurs blocs tombaient à 8 px en
   1280 × 720, et la scène n'avait pas un pixel de plus en hauteur — les propositions
   occupent le bas. La figure passe donc à DROITE DE TOUT (énoncé, propositions), sur
   presque toute la hauteur : l'énoncé s'efface (display: contents) pour que ses enfants
   rejoignent la grille de la question. Reconnue au modèle que porte la figure : aucune
   migration à régénérer. ⚠️ Ces règles doivent SUIVRE les trois précédentes : même
   spécificité, c'est l'ordre qui tranche. */
.au-q--diapo:has(.au-figure[data-figure*='"programmes"']) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto 1fr;
    column-gap: 3vw; align-items: start;
}
.au-q--diapo:has(.au-figure[data-figure*='"programmes"']) > * { grid-column: 1; }
.au-q--diapo:has(.au-figure[data-figure*='"programmes"']) > .au-q__enonce { display: contents; }
.au-q--diapo .au-q__enonce > .au-figure[data-figure*='"programmes"'] { grid-column: 2; grid-row: 1 / -1; align-self: center; }
.au-q--diapo .au-figure[data-figure*='"programmes"'] svg { height: 66vh; }
/* Suites de motifs : des figures LARGES, mais où l'on COMPTE des carreaux, des allumettes,
   des jetons. Plafonnées à 18 vh comme une droite graduée, elles tombaient à 130 px de haut
   en 1280 × 720. À 26 vh (187 px), la question la plus haute — trois lignes d'énoncé, deux
   rangées de propositions — s'arrête encore à 665 px. Reconnues au modèle, comme les
   programmes Scratch : aucune migration à régénérer. */
.au-q--diapo .au-figure--large[data-figure*='"motifs"'] svg { max-height: 26vh; }
.au-q--diapo .au-q__info { font-size: 1rem; color: #94a3b8; }
.au-q--diapo .au-choix { gap: 16px; }
.au-q--diapo .au-choix__item {
    background: #111c31; border-color: #1e293b; color: #e2e8f0;
    padding: 18px 22px; font-size: clamp(1.05rem, 2.1vw, 1.5rem);
}
.au-q--diapo .au-choix__item:hover { transform: none; box-shadow: none; border-color: #334155; }
.au-q--diapo .au-choix__lettre {
    width: 34px; height: 34px; font-size: 1rem; background: #1e293b; color: #cbd5e1;
}
.au-q--diapo .au-choix__t { font-size: inherit; }
.au-q--diapo .au-choix__item.is-bonne {
    background: rgba(34,197,94,.16); border-color: #22c55e; color: #dcfce7;
}
.au-q--diapo .au-choix__item.is-bonne .au-choix__lettre { background: #22c55e; color: #052e16; }
.au-q--diapo .au-eti {
    background: #111c31; border-color: #1e293b; color: #e2e8f0;
    font-size: clamp(1rem, 1.9vw, 1.35rem); padding: 14px 16px;
}
.au-q--diapo .au-eti:hover { border-color: #334155; }

.au-diapo__dom { margin: 0; text-align: center; color: #64748b; font-size: .9rem; letter-spacing: .04em; }
.au-diapo__corr {
    background: #111c31; border: 1px solid #1e293b; border-left: 4px solid var(--au-acc);
    border-radius: 12px; padding: 16px 20px; font-size: clamp(1rem, 1.8vw, 1.25rem);
    animation: au-entre .25s ease-out;
}

.au-diapo__points { display: flex; gap: 6px; justify-content: center; padding: 10px 18px 16px; flex-wrap: wrap; }
.au-diapo__point {
    width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
    background: #1e293b;
}
.au-diapo__point.is-vu { background: #475569; }
.au-diapo__point.is-on { background: var(--au-acc); transform: scale(1.4); }

/* ---------------------------------------------------------------- téléphone */

@media (max-width: 620px) {
    .au-jeu__bar { gap: 8px; padding: 8px 12px; }
    .au-jeu__titre { display: none; }
    .au-jeu__scene { padding: 16px 12px 8px; }
    .au-jeu .au-q { padding: 18px 16px; border-radius: 14px; }
    .au-jeu__pied { padding: 10px 12px; }
    .au-jeu__valider, .au-jeu__suite { min-width: 0; flex: 1; }
    .au-assoc { grid-template-columns: 1fr; }
    .au-assoc__col--d { border-top: 1px dashed var(--border); padding-top: 10px; }
    .au-hero__chiffres { gap: 14px; }
    .au-fin__chiffres { gap: 16px; }
    .au-board__gestes { grid-template-columns: 1fr; }
}

/* ── [hidden] contre display: flex/grid ──────────────────────────────────────
   Piège classique du projet : une règle « display: flex » (ou grid) l'emporte
   sur le « display: none » que le navigateur applique à [hidden], et l'élément
   reste visible alors que le JavaScript le croit caché. Tout élément de ce
   module qui reçoit un display ET qui est masqué par [hidden] doit donc être
   déclaré ici — vécu sur l'écran de jeu, où le bandeau d'erreur et le pied de
   page s'affichaient dès l'ouverture de la première question. */
.au-q[hidden],
.au-jeu__erreur[hidden],
.au-jeu__pied[hidden],
.auq-img__vide[hidden],
.auq-img__apercu[hidden],
.auq-check[hidden],
.au-assoc[hidden],
.au-choix[hidden] { display: none; }

/* Les boutons du pied de jeu sont des .btn, donc « display: inline-flex » :
   même piège, et il se voyait tout de suite — « Valider » et « Continuer »
   s'affichaient côte à côte sur chaque question.

   La règle reste BORNÉE aux écrans du module : « .btn[hidden] » sans préfixe
   corrigerait sans doute d'autres pages, mais changerait le comportement de
   tout le site depuis un lot qui ne parle que d'automatismes. */
.au-jeu .btn[hidden],
.au-eleve .btn[hidden],
.au-banque .btn[hidden],
.au-editeur .btn[hidden],
.au-diapo .btn[hidden],
.modal__box--auq .btn[hidden],
.modal__box--picker .btn[hidden],
.modal__box--fiche .btn[hidden] { display: none; }

/* =========================================================================
   Automatismes — lot 2 : examen blanc et tirage adapté (migration 082).
   ========================================================================= */

/* ---------------------------------------------------------------- mode « examen » */

.au-mode--examen { background: #ffe4e6; color: #9f1239; }
.au-serie--examen { border-color: #fda4af; background: linear-gradient(180deg, #fff1f2 0%, #fff 50%); }

/* Plan de l'épreuve : une ligne par famille du programme, comme un sommaire de sujet. */
.au-compo__bloc--plan { border-left: 4px solid var(--au-acc); }
.au-plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.au-plan li {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    background: var(--slate-50); border-radius: 8px;
    border-left: 4px solid var(--au-fam, var(--slate-300)); font-size: .86rem;
}
.au-plan__nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-plan__total { margin: 10px 0 0; font-size: .84rem; font-weight: 600; }
.au-plan__total.is-ok { color: var(--au-ok); }
.au-plan__total.is-ko { color: var(--au-ko); }

/* Compte à rebours de TOUTE l'épreuve : plus épais que celui d'une question, parce
   qu'on le surveille pendant vingt minutes et non pendant trente secondes. */
.au-jeu__chrono--global { height: 8px; }
.au-jeu__chrono--global i { background: var(--au-acc); }
.au-jeu__chrono--global.is-urgent i { background: var(--au-ko); animation: au-pulse 1s infinite; }
@keyframes au-pulse { 50% { opacity: .55; } }

/* ---------------------------------------------------------------- tirage adapté */

/* Pastilles des cartes de domaine : ce qui attend l'élève. Elles rendent VISIBLE le
   tirage adapté — sans elles, il serait une magie invisible, et l'élève ne saurait pas
   pourquoi ce sont ces questions-là qui reviennent. */
.au-dom__att { display: flex; gap: 5px; flex-wrap: wrap; margin: 2px 0 1px; }
.au-pill {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    font-size: .7rem; font-weight: 700; letter-spacing: .01em;
}
.au-pill--revoir { background: var(--au-ko-bg); color: #991b1b; }
.au-pill--neuf   { background: #e0e7ff; color: #3730a3; }

.au-reglages__note {
    margin: -6px 0 14px; font-size: .8rem; color: var(--muted); max-width: 62ch;
}

/* Clé d'association révélée au tableau. */
.au-diapo__cle {
    margin: 0 0 10px; font-family: var(--font-display); letter-spacing: .06em;
    color: #a5b4fc;
}

/* ---------------------------------------------------------------- feuille d'examen */

.auex { max-width: 210mm; margin: 0 auto; padding: 16px; }

.auex__barre {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    padding: 10px 12px; margin-bottom: 18px;
    background: var(--slate-100); border-radius: 12px;
}
.auex__sep { flex: 1; }

.auex__feuille { background: #fff; padding: 14mm 12mm; border-radius: 4px; }
.auex__feuille--saut { margin-top: 24px; }

.auex__tete {
    display: flex; gap: 18px; align-items: flex-start; justify-content: space-between;
    padding-bottom: 10px; border-bottom: 2px solid var(--slate-800);
}
.auex__ligne { margin: 0 0 6px; font-size: .92rem; }
.auex__trait {
    display: inline-block; min-width: 210px; border-bottom: 1px dotted var(--slate-500);
    vertical-align: baseline;
}
.auex__trait--court { min-width: 90px; }
.auex__cartouche { text-align: right; display: grid; gap: 6px; }
.auex__sujet {
    display: inline-block; padding: 2px 12px; border: 2px solid var(--slate-800);
    border-radius: 6px; font-family: var(--font-display); font-weight: 700;
}
.auex__note { font-size: 1.05rem; }

.auex__titre { margin: 14px 0 6px; font-size: 1.3rem; }
.auex__consigne {
    margin: 0 0 18px; font-size: .9rem; color: var(--slate-600);
    padding: 8px 12px; background: var(--slate-50); border-radius: 8px;
}

/* Numérotation par COMPTEUR, et non par la puce native de <ol> : un <li> passé en
   « display: flex » (pour poser la case de réponse à droite) perd son marqueur dans
   tous les navigateurs. Le compteur redonne le numéro, et permet au passage de le
   composer comme sur un vrai sujet. */
.auex__questions { margin: 0; padding-left: 0; display: grid; gap: 16px;
                   list-style: none; counter-reset: auex; }
.auex__q { display: flex; gap: 12px; align-items: flex-start; break-inside: avoid; }
.auex__q::before {
    counter-increment: auex; content: counter(auex) ".";
    flex: 0 0 auto; width: 24px; padding-top: 2px;
    font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.auex__q-corps { flex: 1; min-width: 0; }
.auex__q-rep { flex: 0 0 auto; width: 92px; text-align: center; }
.auex__q-rep span { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; }
.auex__q-rep i { display: block; height: 34px; border: 1px solid var(--slate-400); border-radius: 6px; }

/* Sur le papier, une proposition est une case à cocher, pas un bouton : ni ombre, ni
   couleur de survol, et un trait fin qui supporte la photocopie. */
.auex .au-q { gap: 10px; }
.auex .au-q__enonce { font-size: .98rem; }
.auex .au-choix { gap: 7px; }
.auex .au-choix__item {
    border-width: 1px; border-color: var(--slate-400); padding: 7px 10px;
    box-shadow: none; transform: none;
}
.auex .au-choix__lettre { background: transparent; border: 1px solid var(--slate-400); color: var(--slate-700); }
.auex .au-q__image img { max-height: 180px; }
.auex .au-eti { border-width: 1px; border-left-width: 1px; border-color: var(--slate-400); padding: 7px 10px; }
.auex .au-eti__pastille { background: transparent; border: 1px solid var(--slate-400); color: var(--slate-700); }
.au-assoc__papier {
    margin: 8px 0 0; font-family: var(--font-display); letter-spacing: .08em;
    font-size: .95rem;
}

.auex__corrige { margin: 0; padding-left: 0; display: grid; gap: 14px;
                 list-style: none; counter-reset: auexc; }
.auex__c { break-inside: avoid; display: grid; grid-template-columns: 24px 1fr auto; gap: 4px 12px; }
.auex__c::before {
    counter-increment: auexc; content: counter(auexc) ".";
    grid-row: 1 / span 3; font-family: var(--font-display); font-weight: 700;
}
.auex__c-rep { grid-column: 3; grid-row: 1; }
.auex__c-rappel, .auex__c-expl { grid-column: 2; }
.auex__c-rep {
    margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    color: var(--au-ok);
}
.auex__c-rappel { font-size: .85rem; color: var(--slate-600); }
.auex__c-expl { font-size: .85rem; color: var(--slate-500); margin-top: 3px; }

@media print {
    /* La barre d'outils ne s'imprime pas, et la feuille prend toute la page. */
    .auex__barre { display: none; }
    .auex { max-width: none; padding: 0; }
    /* Une petite marge intérieure en plus de celle du navigateur. Volontairement PAS
       de règle @page : elle est globale, et elle changerait les marges de toutes les
       autres impressions du site (le Cours, les grilles, les étiquettes). */
    .auex__feuille { padding: 4mm 2mm; border-radius: 0; }
    .auex__feuille--saut { margin-top: 0; break-before: page; }
    /* Le noir et blanc : on retire les aplats qui mangent l'encre et brouillent la
       photocopie, et on garde les filets. */
    .auex .au-choix__item, .auex .au-eti { background: #fff; }
    .auex__consigne { background: #fff; border: 1px solid var(--slate-400); }
    .auex__c-rep { color: #000; }
}
.au-mur__coupe { color: #b45309; }

/* =========================================================================
   Automatismes — les tests que l'élève se donne (migration 104) : test flash,
   examen blanc, « Se tester » sur un programme.
   ========================================================================= */

/* Tuile de programme : « Réviser » et « Se tester » côte à côte, en bas de la carte. */
.au-serie__actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.au-serie__actions .au-serie__go { margin-top: 0; }

.au-tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 6px; }
.au-test {
    background: #fff; border: 1px solid var(--border); border-radius: 14px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 7px;
}
.au-test--flash { border-color: #bae6fd; background: linear-gradient(180deg, #f0f9ff 0%, #fff 50%); }
.au-test--blanc { border-color: #fda4af; background: linear-gradient(180deg, #fff1f2 0%, #fff 50%); }
.au-test__go { margin-top: auto; align-self: flex-start; }

/* Un test commencé, à reprendre : son chronomètre tourne pendant qu'on lit. */
.au-test-encours {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 0 0 10px; padding: 9px 12px; border-radius: 12px;
    background: #fffbeb; border: 1px solid #fcd34d; font-size: .88rem;
}
.au-test-encours__txt { flex: 1; min-width: 200px; }

/* La colonne d'une liste .au-histo ne s'élargit plus à la longueur d'un titre : un test flash
   sur neuf domaines tient sur une ligne et finit en « … » (sans cela, la page débordait sur
   téléphone — défaut latent de toutes les listes .au-histo, invisible avec des titres courts). */
.au-histo { grid-template-columns: minmax(0, 1fr); }
.au-histo__tag { display: inline-block; width: 1.4em; text-align: center; }
.au-histo__taux { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--slate-600); font-size: .8rem; }
.au-histo__taux.is-bas { color: #b91c1c; }
@media (max-width: 520px) {
    /* Sur téléphone, le nom du test passe sur sa propre ligne, au-dessus des chiffres. */
    .au-histo--tests li { flex-wrap: wrap; row-gap: 2px; }
    .au-histo--tests .au-histo__quoi { flex: 1 0 100%; order: -1; white-space: normal; }
}

/* Le choix des domaines d'un test flash. */
.modal__box--domaines { max-width: 760px; max-height: 90vh; display: flex; flex-direction: column; }
/* La fenêtre tient dans l'écran : seule la liste des domaines défile, le pied reste en bas. */
.au-choix-dom { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.au-choix-dom__corps { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.modal__box--domaines .btn[hidden] { display: none; }
.au-choix-dom__aide { margin: 10px 0 14px; font-size: .88rem; color: var(--slate-600); }
.au-choix-dom__fam { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.au-choix-dom__fam legend {
    padding: 0; margin: 0 0 6px; font-size: .76rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.au-choix-dom__fam legend label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.au-choix-dom__liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.au-choix-dom__dom {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 7px 10px; border: 1px solid var(--border); border-left: 4px solid var(--au-dom, var(--border));
    border-radius: 10px; font-size: .86rem; background: #fff;
}
.au-choix-dom__dom:has(input:checked) { background: var(--au-acc-l); border-color: var(--au-acc); border-left-color: var(--au-dom, var(--au-acc)); }
.au-choix-dom__pied { flex: 0 0 auto; align-items: center; margin-top: 12px; }
.au-choix-dom__compte { margin-right: auto; font-size: .86rem; color: var(--slate-600); }

/* L'accueil d'un test, sur l'écran de jeu : rien ne part avant le clic. */
.au-intro {
    width: 100%; max-width: 560px; margin: 3vh auto 0; padding: 26px 26px 22px; text-align: center;
    background: #fff; border: 1px solid var(--border); border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15,23,42,.08);
}
.au-intro[hidden] { display: none; }
.au-intro__icone { display: block; font-size: 2.2rem; }
.au-intro__titre { margin: 6px 0 4px; font-family: var(--font-display); font-size: 1.3rem; }
.au-intro__domaines { margin: 0 0 6px; font-size: .86rem; color: var(--slate-600); }
.au-intro__chiffres { list-style: none; display: flex; justify-content: center; gap: 30px; margin: 14px 0; padding: 0; }
.au-intro__chiffres b { display: block; font-family: var(--font-display); font-size: 1.6rem; }
.au-intro__chiffres span { font-size: .78rem; color: var(--muted); }
.au-intro__regles {
    display: grid; gap: 4px; max-width: 46ch; margin: 0 auto 16px; padding-left: 20px;
    text-align: left; font-size: .86rem; color: var(--slate-600);
}
.au-intro__encours { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: #fffbeb; font-size: .88rem; }
.au-intro__go { min-width: 220px; justify-content: center; }
.au-intro__msg { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--au-ko-bg); color: #991b1b; font-size: .9rem; }
.au-intro__msg[hidden] { display: none; }
.au-intro__vide { color: var(--muted); }

/* La correction d'un test : une question que le temps n'a pas laissé atteindre. */
.au-fin__detail li.is-vide { background: #fff; border: 1px dashed var(--border); }
.au-fin__vide {
    display: inline-block; margin-bottom: 4px; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}

/* Suivi enseignant : les tests de la classe, et le détail de l'un d'eux. */
.au-tab--tests td { vertical-align: middle; }
.au-tab__sous {
    display: block; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .76rem; color: var(--muted);
}
.aut-resume { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 4px; padding: 0; list-style: none; }
.aut-resume b { display: block; font-family: var(--font-display); font-size: 1.2rem; }
.aut-resume span { font-size: .76rem; color: var(--muted); }
.aut-detail { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.aut-detail li { padding: 9px 12px; border-radius: 10px; background: var(--slate-50); font-size: .88rem; }
.aut-detail li.is-juste { background: var(--au-ok-bg); }
.aut-detail li.is-faux { background: var(--au-ko-bg); }
.aut-detail li.is-vide { background: #fff; border: 1px dashed var(--border); }
.aut-detail__tete { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: .74rem; color: var(--muted); }
.aut-detail__etat { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.aut-detail__corr { margin-top: 6px; font-size: .84rem; color: var(--slate-600); }

/* =========================================================================
   Automatismes — l'accueil élève, refondu (/espace-eleve/automatismes).

   Une page qu'un élève de 11 ans doit lire sans effort : un bandeau de rang
   vivant, un sommaire collant qui mène aux six blocs, des réglages en
   boutons (tout se voit, rien ne se cherche), un filtre par thème, et des
   cartes de domaine compactes — la jauge dit où l'on en est, la description
   tient en deux lignes (en entier au survol). Rien n'a été retiré.

   Toutes les règles sont BORNÉES à .au-eleve : plusieurs classes (.au-serie,
   .au-dom, .au-titre, .au-podium…) servent aussi aux pages enseignant.
   ========================================================================= */

.au-eleve {
    --ae-ombre:   0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --ae-ombre-h: 0 2px 4px rgba(15, 23, 42, .06), 0 16px 34px rgba(15, 23, 42, .13);
    --ae-rayon:   18px;
    --ae-haut:    65px;   /* bord bas de la barre .eleve-top, sous lequel colle le sommaire —
                             suivi au défilement par auto-accueil.js (la barre s'en va après
                             le premier écran : voir le commentaire du script) */
}
.au-eleve .au-page { margin-bottom: 18px; }

/* ---- Bandeau de rang : un dégradé profond (rose → violet → indigo), texte blanc lisible
        partout (contraste ≥ 6:1), la médaille porte la couleur du rang. ---- */
.au-eleve .au-hero {
    position: relative; overflow: hidden; color: #fff; border: 0;
    border-radius: 22px; padding: 22px 24px; display: grid; gap: 16px;
    background:
        radial-gradient(110% 130% at 100% 0%, rgba(255, 255, 255, .16) 0%, transparent 55%),
        linear-gradient(135deg, #be185d 0%, #7e22ce 55%, #4338ca 100%);
    box-shadow: 0 16px 36px rgba(109, 40, 217, .25);
}
.au-eleve .au-hero__rang { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.au-eleve .au-hero__medaille {
    flex: none; width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem; line-height: 1;
    background: #fff; box-shadow: 0 0 0 4px var(--au-rang), 0 8px 18px rgba(15, 23, 42, .3);
}
.au-eleve .au-hero__id { flex: 1; min-width: 140px; }
.au-eleve .au-hero__sur {
    margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: rgba(255, 255, 255, .85);
}
.au-eleve .au-hero__nom {
    margin: 2px 0 0; font-family: var(--font-display); font-size: 1.65rem;
    font-weight: 700; line-height: 1.1; letter-spacing: -.01em;
}
.au-eleve .au-hero__xp {
    margin: 0; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22);
    font-size: .95rem; font-weight: 600; color: #fff;
}
.au-eleve .au-hero__xp b { font-family: var(--font-display); font-size: 1.35rem; color: #fff; }
.au-eleve .au-hero__barre { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.au-eleve .au-hero__barre i {
    display: block; height: 100%; border-radius: 999px; transition: width .6s;
    background: linear-gradient(90deg, #fde68a, #fbbf24); box-shadow: 0 0 14px rgba(251, 191, 36, .55);
}
.au-eleve .au-hero__reste { margin: 7px 0 0; font-size: .9rem; color: rgba(255, 255, 255, .92); }
.au-eleve .au-hero__reste b { color: #fff; }
.au-eleve .au-hero__chiffres {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.au-eleve .au-hero__chiffres li {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 9px; align-items: center;
    padding: 10px 12px; border-radius: 14px;
    background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .18);
}
.au-eleve .au-hero__ico { grid-row: span 2; font-size: 1.35rem; }
.au-eleve .au-hero__chiffres b { display: block; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.1; }
.au-eleve .au-hero__chiffres span:last-child { font-size: .76rem; color: rgba(255, 255, 255, .9); }

/* ---- Sommaire collant : six pastilles, défilables du doigt sur téléphone. Il ne prend son
        fond qu'une fois collé (.is-colle, posé par auto-accueil.js) : à sa place naturelle,
        ce fond couperait l'ombre du bandeau de rang. ---- */
.au-eleve .au-sommaire {
    position: sticky; top: var(--ae-haut); z-index: 15;
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    margin: 14px -6px 0; padding: 10px 6px;
    transition: background-color .15s, box-shadow .15s;
}
.au-eleve .au-sommaire.is-colle {
    background: color-mix(in srgb, var(--slate-50) 96%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 14px -12px rgba(15, 23, 42, .35);
}
.au-eleve .au-sommaire::-webkit-scrollbar { display: none; }
.au-eleve .au-sommaire a {
    flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
    color: var(--slate-700); font-weight: 600; font-size: .88rem; text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: background .15s, color .15s, border-color .15s;
}
.au-eleve .au-sommaire a:hover { background: var(--slate-100); border-color: var(--slate-300); }
.au-eleve .au-sommaire a.is-on { background: var(--slate-900); border-color: var(--slate-900); color: #fff; }
.au-eleve .au-sommaire__n {
    font-size: .72rem; padding: 1px 7px; border-radius: 999px;
    background: var(--slate-100); color: var(--slate-600);
}
.au-eleve .au-sommaire a.is-on .au-sommaire__n { background: rgba(255, 255, 255, .2); color: #fff; }
.au-eleve .au-sommaire__n--alerte { background: #fef3c7; color: #92400e; }

/* ---- Blocs et titres ---- */
.au-eleve .au-bloc { margin-top: 26px; scroll-margin-top: calc(var(--ae-haut) + 70px); }
.au-eleve .au-titre { margin: 0 0 14px; font-size: 1.3rem; align-items: center; letter-spacing: -.01em; }
.au-eleve .au-titre__ico {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
    background: #fff; border: 1px solid var(--border); font-size: 1.1rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.au-eleve .au-titre__compte {
    padding: 2px 9px; border-radius: 999px; background: var(--slate-100);
    font-size: .82rem; font-weight: 700; color: var(--slate-600);
}
.au-eleve .au-sous-titre { margin: 22px 0 10px; font-size: 1.02rem; }
.au-eleve .au-astuce {
    display: flex; gap: 10px; align-items: flex-start; max-width: none;
    margin: 0 0 14px; padding: 10px 14px; border-radius: 12px;
    background: #eef2ff; color: #3730a3; font-size: .88rem; line-height: 1.45;
}

/* ---- À faire : une bande de couleur par mode, des pastilles d'information. ---- */
.au-eleve .au-series { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.au-eleve .au-serie {
    --au-mode: #6366f1;
    position: relative; overflow: hidden; gap: 9px;
    padding: 16px 18px 16px 22px; border: 1px solid var(--border); border-radius: var(--ae-rayon);
    background: #fff; box-shadow: var(--ae-ombre);
}
.au-eleve .au-serie::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--au-mode); }
.au-eleve .au-serie--seance     { --au-mode: #0ea5e9; }
.au-eleve .au-serie--programme  { --au-mode: #8b5cf6; }
.au-eleve .au-serie--evaluation { --au-mode: #f59e0b; }
.au-eleve .au-serie--examen     { --au-mode: #f43f5e; }
.au-eleve .au-serie__mode {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: .74rem; letter-spacing: .05em;
    background: color-mix(in srgb, var(--au-mode) 13%, #fff);
    color: color-mix(in srgb, var(--au-mode) 65%, #0f172a);
}
.au-eleve .au-serie__titre { font-family: var(--font-display); font-size: 1.12rem; line-height: 1.25; }
.au-eleve .au-serie__consigne { font-size: .88rem; color: var(--slate-600); }
.au-eleve .au-serie__meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.au-eleve .au-serie__meta li {
    padding: 3px 10px; border-radius: 999px; background: var(--slate-100);
    font-size: .78rem; color: var(--slate-600);
}
.au-eleve .au-serie__scores {
    display: grid; gap: 2px; padding: 8px 11px; border-radius: 11px;
    background: var(--slate-50); font-size: .82rem; color: var(--slate-600);
}
.au-eleve .au-serie__scores p { margin: 0; }
.au-eleve .au-serie__scores b { color: var(--slate-900); }
.au-eleve .au-serie__actions { padding-top: 4px; }
.au-eleve .au-serie.is-clos { opacity: .7; }

/* ---- M'entraîner : réglages en boutons, filtre par thème, cartes de domaine ---- */
.au-eleve .au-reglages {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px;
    margin: 0 0 12px; padding: 12px 16px; border-radius: 16px;
    background: #fff; border: 1px solid var(--border); box-shadow: var(--ae-ombre);
}
.au-eleve .au-seg { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.au-eleve .au-seg__lib { margin-right: 6px; font-size: .84rem; font-weight: 700; color: var(--slate-600); }
.au-eleve .au-seg label { position: relative; cursor: pointer; }
.au-eleve .au-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.au-eleve .au-seg label span {
    display: inline-block; padding: 7px 15px; border-radius: 999px;
    background: var(--slate-100); color: var(--slate-700); font-weight: 600; font-size: .9rem;
    transition: background .15s, color .15s, box-shadow .15s;
}
.au-eleve .au-seg label:hover span { background: var(--slate-200); }
.au-eleve .au-seg input:checked + span { background: var(--au-acc); color: #fff; box-shadow: 0 4px 12px rgba(219, 39, 119, .3); }
.au-eleve .au-seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--au-acc) 45%, transparent); outline-offset: 2px; }

.au-eleve .au-filtres { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 4px; }
.au-eleve .au-filtre {
    --au-fam: var(--slate-400);
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border);
    background: #fff; color: var(--slate-700); font: inherit; font-weight: 600; font-size: .86rem;
    transition: background .15s, color .15s, border-color .15s;
}
.au-eleve .au-filtre::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--au-fam); }
.au-eleve .au-filtre[data-au-filtre=""]::before { display: none; }
.au-eleve .au-filtre span { font-size: .74rem; color: var(--muted); }
.au-eleve .au-filtre:hover { border-color: var(--slate-300); background: var(--slate-50); }
.au-eleve .au-filtre.is-on { background: var(--slate-900); border-color: var(--slate-900); color: #fff; }
.au-eleve .au-filtre.is-on span { color: rgba(255, 255, 255, .75); }

.au-eleve .au-famille-bloc[hidden] { display: none; }
.au-eleve .au-famille { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: .8rem; color: var(--slate-600); }
.au-eleve .au-famille::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--au-fam, var(--slate-400)); }

.au-eleve .au-domaines { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.au-eleve .au-dom {
    gap: 7px; padding: 13px 14px 12px; border-radius: 16px;
    border: 1px solid var(--border); border-top: 4px solid var(--au-dom);
    background: #fff; box-shadow: var(--ae-ombre); transition: transform .12s, box-shadow .15s;
}
.au-eleve .au-dom:hover { transform: translateY(-3px); box-shadow: var(--ae-ombre-h); }
.au-eleve .au-dom:focus-visible { outline: 3px solid color-mix(in srgb, var(--au-dom) 55%, transparent); outline-offset: 2px; }
.au-eleve .au-dom__tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.au-eleve .au-dom__icone {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    font-size: 1.3rem; background: color-mix(in srgb, var(--au-dom) 14%, #fff);
}
.au-eleve .au-dom__etoiles { font-size: 1.05rem; letter-spacing: 1px; }
.au-eleve .au-dom__nom { font-weight: 700; font-size: 1rem; line-height: 1.25; color: var(--slate-900); }
.au-eleve .au-dom__desc {
    font-size: .78rem; line-height: 1.35; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.au-eleve .au-dom__jauge { margin-top: auto; height: 6px; border-radius: 999px; background: var(--slate-100); overflow: hidden; }
.au-eleve .au-dom__jauge i { display: block; height: 100%; border-radius: 999px; background: var(--au-dom); }
.au-eleve .au-dom__pied { margin-top: 0; font-size: .76rem; color: var(--slate-600); }
.au-eleve .au-dom__pied b { color: var(--slate-900); }
.au-eleve .au-dom__att { margin: 0; }

/* ---- Me tester ---- */
.au-eleve .au-tests { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.au-eleve .au-test { gap: 9px; padding: 18px; border-radius: var(--ae-rayon); box-shadow: var(--ae-ombre); }
.au-eleve .au-test__ico { font-size: 1.9rem; line-height: 1; }
.au-eleve .au-test .au-serie__mode { --au-mode: #0284c7; }
.au-eleve .au-test--blanc .au-serie__mode { --au-mode: #e11d48; }
.au-eleve .au-test--flash { background: linear-gradient(160deg, #e0f2fe 0%, #fff 55%); border-color: #bae6fd; }
.au-eleve .au-test--blanc { background: linear-gradient(160deg, #ffe4e6 0%, #fff 55%); border-color: #fecdd3; }
.au-eleve .au-test-encours { border-radius: 14px; padding: 10px 14px; box-shadow: var(--ae-ombre); }
.au-eleve .au-test-encours__ico { font-size: 1.2rem; }

/* ---- Classement, badges, historique ---- */
.au-eleve .au-classement { padding: 16px 18px; border-radius: var(--ae-rayon); box-shadow: var(--ae-ombre); }
.au-eleve .au-podium { gap: 6px; }
.au-eleve .au-podium__l { padding: 9px 13px; border-radius: 12px; font-size: .95rem; }
.au-eleve .au-podium__l.is-podium .au-podium__rang { font-size: 1.15rem; }

.au-eleve .au-badges { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
/* Un badge à gagner reste LISIBLE : seule son icône est éteinte — la ligne qui dit comment
   l'obtenir est justement ce que l'élève doit pouvoir lire (le voile d'origine la noyait). */
.au-eleve .au-badge { position: relative; padding: 14px 10px 12px; border-radius: 16px; box-shadow: var(--ae-ombre); opacity: 1; filter: none; }
.au-eleve .au-badge.is-on { background: linear-gradient(180deg, #fffbeb 0%, #fff 70%); }
.au-eleve .au-badge__icone { font-size: 1.9rem; }
.au-eleve .au-badge:not(.is-on) { background: var(--slate-50); box-shadow: none; border-style: dashed; }
.au-eleve .au-badge:not(.is-on) .au-badge__icone { filter: grayscale(1); opacity: .4; }
.au-eleve .au-badge:not(.is-on) .au-badge__nom { color: var(--slate-600); }
.au-eleve .au-badge__verrou { position: absolute; top: 7px; right: 9px; font-size: .78rem; }

.au-eleve .au-histo { gap: 6px; }
.au-eleve .au-histo li { padding: 9px 13px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }

@media (max-width: 680px) {
    .au-eleve .au-page h1 { font-size: 1.45rem; }
    .au-eleve .au-hero { padding: 18px 16px; border-radius: 18px; gap: 14px; }
    .au-eleve .au-hero__rang { flex-wrap: nowrap; gap: 12px; }
    .au-eleve .au-hero__medaille { width: 52px; height: 52px; font-size: 1.6rem; }
    .au-eleve .au-hero__id { min-width: 0; }
    .au-eleve .au-hero__nom { font-size: 1.35rem; overflow-wrap: anywhere; }
    .au-eleve .au-hero__xp { padding: 5px 10px; font-size: .8rem; }
    .au-eleve .au-hero__xp b { font-size: 1.1rem; }
    .au-eleve .au-hero__chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    /* Les deux bandes défilantes vont d'un bord à l'autre de l'écran : elles reprennent la
       gouttière de .eleve-main (22 px). */
    .au-eleve .au-sommaire { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
    .au-eleve .au-titre { font-size: 1.15rem; }
    .au-eleve .au-reglages { flex-direction: column; align-items: stretch; gap: 10px; }
    /* L'intitulé au-dessus de ses boutons : « Simple · Jusqu'à moyen · Tout » tient alors
       sur une ligne, au lieu de laisser « Tout » seul sur la suivante. */
    .au-eleve .au-seg__lib { flex: 0 0 100%; margin: 0 0 1px; }
    /* Sept thèmes sur cinq lignes, c'était un écran entier : une bande qui défile du doigt. */
    .au-eleve .au-filtres {
        flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
        margin-left: -22px; margin-right: -22px; padding: 2px 22px 6px;
    }
    .au-eleve .au-filtres::-webkit-scrollbar { display: none; }
    .au-eleve .au-filtre { flex: none; }
    .au-eleve .au-domaines { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .au-eleve .au-dom { padding: 11px 11px 10px; }
    .au-eleve .au-dom__icone { width: 34px; height: 34px; font-size: 1.1rem; }
    .au-eleve .au-dom__nom { font-size: .92rem; }
    .au-eleve .au-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Exercices en ligne d'une séance informatique (migration 101)
   ========================================================================== */

/* ---- Page élève : un exercice par page (views/eleve/seance_exercice.php) ---- */
.sxe-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.sxe-nav__p { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px;
    padding: 0 8px; border-radius: 999px; border: 2px solid var(--border); background: #fff;
    color: var(--slate-600, #475569); font-weight: 800; font-size: .9rem; text-decoration: none; }
.sxe-nav__p:hover { border-color: #94a3b8; }
/* Même code couleur que les hexagones du panneau : vert réussi, rouge pas encore réussi. */
.sxe-nav__p.is-reussi { border-color: #059669; background: #059669; color: #fff; }
.sxe-nav__p.is-echoue { border-color: #dc2626; background: #dc2626; color: #fff; }
.sxe-nav__p.is-on { box-shadow: 0 0 0 3px rgba(15, 23, 42, .25); transform: scale(1.08); }
.sxe-rang { margin: 0 0 8px; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sxe-hote .exo-ex { margin: 0; }
.sxe-bilan { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 14px 0 0;
    padding: 10px 14px; border-radius: 10px; background: var(--slate-100, #f1f5f9);
    color: var(--slate-600, #475569); font-size: .9rem; }
.sxe-bilan__t { flex: 1 1 260px; margin: 0; }
.sxe-bilan .btn { flex: none; }
.sxe-bilan.is-ok { background: #ecfdf5; color: #065f46; box-shadow: inset 4px 0 0 #059669; }
.sxe-bilan.is-rate { background: #fef2f2; color: #991b1b; box-shadow: inset 4px 0 0 #dc2626; }
.sxe-bilan.is-erreur { background: #fef2f2; color: #991b1b; }
.sxe-pied { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---- Page enseignant : bilan élèves × exercices (views/cahier/exercices_bilan.php) ---- */
.sxb__live { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: .82rem; font-weight: 700; color: #047857; }
.sxb__live.is-calme { color: var(--muted); font-weight: 600; }   /* hors créneau : relu quand même */
.sxb__point { width: 9px; height: 9px; border-radius: 50%; background: #10b981; animation: sxb-pouls 1.6s ease-in-out infinite; }
@keyframes sxb-pouls { 0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .55); } 50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } }
.sxb__resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.sxb__chiffre { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 12px; background: #fff; font-size: 1rem; color: var(--slate-500); }
.sxb__chiffre strong { font-size: 1.5rem; line-height: 1.1; color: var(--slate-800); }
.sxb__chiffre span { font-size: .78rem; }
.sxb__chiffre strong small { font-size: .6em; font-weight: 600; color: var(--slate-500); }
.sxb__scroll { overflow-x: auto; }
.sxb-table { border-collapse: separate; border-spacing: 3px; font-size: .88rem; }
.sxb-table th { font-weight: 700; }
.sxb-table__el { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 4px 12px 4px 4px; white-space: nowrap; }
.sxb-table__ex, .sxb-table__tot { padding: 2px 4px; text-align: center; vertical-align: bottom; min-width: 46px; }
.sxb-table__ex.is-retire { opacity: .55; }
.sxb-table__n { display: block; font-size: .95rem; color: var(--slate-800); }
.sxb-table__code { display: block; font-size: .64rem; font-weight: 700; color: #047857; white-space: nowrap; }
.sxb-table__tot { color: var(--slate-800); }
.sxb-table tr.is-absent .sxb-table__el { color: var(--muted); font-weight: 500; }
.sxb-c { display: table-cell; text-align: center; padding: 6px 4px; border-radius: 8px; font-weight: 800;
    font-variant-numeric: tabular-nums; min-width: 46px; }
.sxb-c__sur { font-weight: 500; font-size: .78em; opacity: .75; }
.sxb-c--vide { color: var(--slate-300, #cbd5e1); background: #f8fafc; }
/* Même code que l'hexagone de l'élève : vert = exercice réussi, rouge = essais ratés seulement. */
.sxb-c--ok { background: #d1fae5; color: #065f46; }
.sxb-c--ko { background: #fee2e2; color: #991b1b; }
.sxb-c--tot { background: #eef2ff; color: #3730a3; }
.sxb-c--pied { background: transparent; color: var(--slate-600, #475569); font-size: .8rem; }
.sxb__legende { margin: 12px 0 0; font-size: .8rem; color: var(--muted); line-height: 1.8; }

/* Réponses d'un élève au survol d'une case tentée (js/exo-bilan-reponses.js, migration 111). */
.sxb-c[data-ex] { cursor: pointer; }
.sxb-c[data-ex]:hover, .sxb-c[data-ex]:focus-visible, .sxb-c.is-vue { outline: 2px solid #334155; outline-offset: 1px; }
.sxr { position: fixed; z-index: 1200; display: flex; flex-direction: column; max-height: calc(100vh - 24px);
    background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 48px rgba(15, 23, 42, .25); }
.sxr[hidden] { display: none; }   /* sinon display:flex l'emporte sur [hidden] */
.sxr__tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.sxr__titre { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sxr__qui { font-size: 1rem; color: var(--slate-800); }
.sxr__quoi { font-size: .8rem; color: var(--muted); }
.sxr__x { flex: none; border: 0; background: transparent; font-size: 1rem; line-height: 1; padding: 4px 6px; border-radius: 6px;
    color: var(--slate-500); cursor: pointer; }
.sxr__x:hover { background: var(--slate-100); }
.sxr__resume { margin: 0; padding: 0 14px 8px; font-size: .82rem; font-weight: 700; color: var(--slate-600); }
.sxr__resume.is-ok { color: #047857; }
.sxr__resume.is-ko { color: #b91c1c; }
.sxr__essais { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.sxr__essais:empty { display: none; }
.sxr__essai { border: 1px solid; border-radius: 999px; padding: 3px 10px; background: #fff; font: inherit;
    font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.sxr__essai.is-ok { border-color: #6ee7b7; color: #047857; }
.sxr__essai.is-ko { border-color: #fca5a5; color: #b91c1c; }
.sxr__essai.is-on.is-ok { background: #059669; border-color: #059669; color: #fff; }
.sxr__essai.is-on.is-ko { background: #dc2626; border-color: #dc2626; color: #fff; }
.sxr__corps { overflow: auto; padding: 12px 14px 14px; }
.sxr__note { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: .82rem; }
/* Dans la bulle : le titre est déjà dans l'en-tête ; on garde les réponses de l'élève, leur
   marquage juste/faux et la réponse attendue, sans les encouragements ni le corrigé détaillé. */
.sxr .exo-ex { margin: 0; }
.sxr .exo-ex__head, .sxr .exo-bravo, .sxr .exo-corr { display: none !important; }
.sxr .exo-ex__pied { margin-top: 10px; }
.sxb__legende .sxb-c { display: inline-block; padding: 1px 8px; margin-left: 4px; font-size: .75rem; }
.sxb-exos { margin: 8px 0 0; padding-left: 1.6em; display: grid; gap: 6px; }
.sxb-exos li { font-size: .9rem; }
.sxb-exos li.is-retire { color: var(--muted); }
.sxb-exos .exo-carte__code { margin-right: 6px; }
@media print {
    .sxb .bilan__card { border: 0; padding: 0; }
    .sxb-c { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.seance__exo-bilan { margin-top: 10px; }

/* ==========================================================================
   Préparation des exercices d'une séance informatique — /cahier/seance/informatique
   (views/cahier/informatique.php, js/seance-exos.js, migration 102).
   Présentation reprise de MathALÉA, que les enseignants connaissent : bibliothèque en
   arbre sur fond gris à gauche (titres orange, « + » / « × »), exercices au centre sous
   un titre bleu souligné et une barre d'icônes orange, panneau « Paramètres » à droite.
   ========================================================================== */
body.is-full .container { max-width: none; padding: 16px 20px 40px; }
.sxa { --sxa-orange: #ea580c; --sxa-orange-l: #fff1e8; --sxa-bleu: #1d5f8f; --sxa-gris: #f3f4f6;
    display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 0 24px; align-items: start; }
.sxa.is-param { grid-template-columns: 330px minmax(0, 1fr) 300px; }

/* ---- Bibliothèque ---- */
.sxa-biblio { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
    background: var(--sxa-gris); border-radius: 12px; padding: 14px 10px 16px 14px; }
.sxa-biblio__titre { margin: 0 0 10px; font-size: 1.35rem; font-weight: 800; color: var(--sxa-bleu); }
.sxa-biblio__q { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 8px 10px; font: inherit; font-size: .88rem;
    border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sxa-biblio__q:focus { outline: 2px solid var(--sxa-orange); outline-offset: 0; border-color: transparent; }
.sxa-niv__t, .sxa-th__t { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 6px;
    background: none; font: inherit; text-align: left; cursor: pointer; }
.sxa-niv__t { font-size: 1.02rem; font-weight: 800; color: var(--sxa-orange); }
.sxa-niv__t > span:first-child, .sxa-th__t > span:first-child { flex: 1 1 auto; min-width: 0; }
.sxa-niv__t[aria-expanded="true"] { background: #e7e9ee; }
.sxa-niv__t:hover, .sxa-th__t:hover { background: #e7e9ee; }
.sxa-bascule { flex: none; width: 18px; text-align: center; font-size: 1.15rem; font-weight: 700; line-height: 1; color: var(--sxa-orange); }
.sxa-bascule::before { content: "+"; }
[aria-expanded="true"] > .sxa-bascule::before { content: "×"; }
.sxa-niv__corps { padding: 2px 0 6px 8px; }
.sxa-domaine { margin: 10px 0 2px 6px; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--slate-500); }
.sxa-th__t { font-size: .9rem; color: #c2410c; }
.sxa-th__t strong { font-weight: 800; }
.sxa-th__n { flex: none; min-width: 22px; padding: 0 6px; border-radius: 999px; background: #fff; font-size: .7rem; font-weight: 700;
    color: var(--slate-500); text-align: center; line-height: 1.6; }
.sxa-liste { padding: 2px 0 6px 12px; }
.sxa-ex { position: relative; display: flex; align-items: flex-start; gap: 4px; padding: 2px 2px 2px 10px; border-left: 3px solid transparent; }
.sxa-ex.is-pose { border-left-color: #22c55e; }
.sxa-ex.is-pose::before { content: ""; position: absolute; left: -14px; top: 7px; width: 9px; height: 9px; border-radius: 2px; background: var(--sxa-orange); }
.sxa-ex__t { flex: 1 1 auto; min-width: 0; padding: 2px 0; border: 0; background: none; font: inherit; font-size: .86rem;
    line-height: 1.35; text-align: left; color: var(--slate-800); cursor: pointer; }
.sxa-ex__t strong { font-weight: 800; }
.sxa-ex__t:hover { color: var(--sxa-bleu); text-decoration: underline; }
.sxa-ex__act { flex: none; width: 22px; height: 22px; margin-top: 1px; border: 0; border-radius: 5px; background: none;
    font-size: 1.15rem; font-weight: 700; line-height: 1; color: var(--sxa-orange); cursor: pointer; }
.sxa-ex__act:hover { background: var(--sxa-orange-l); }
.sxa-attente { margin: 4px 0 4px 10px; font-size: .8rem; color: var(--muted); }
.sxa-plus { margin: 6px 0 4px 10px; padding: 3px 10px; border: 1px dashed #cbd5e1; border-radius: 6px; background: #fff;
    font: inherit; font-size: .78rem; color: var(--slate-600, #475569); cursor: pointer; }
.sxa-resultats { padding-top: 2px; }
.sxa-resultats .sxa-ex { padding-left: 10px; }

/* ---- Exercices de la séance ---- */
.sxa-centre { min-width: 0; padding-bottom: 30px; }
.sxa-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 2px 0 14px; }
.sxa-tete__titre { margin: 0; font-size: 1.45rem; }
.sxa-tete__meta { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.sxa-tete__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sxa-alerte { margin: 0 0 12px; padding: 8px 12px; border: 1px solid #fed7aa; border-radius: 10px; background: #fff7ed;
    color: #9a3412; font-size: .88rem; }
.sxa-aide { margin: 0; padding: 26px 22px; border: 2px dashed var(--border); border-radius: 14px; text-align: center;
    color: var(--muted); line-height: 1.5; }
.sxa-exo { margin-bottom: 18px; padding: 4px 6px 8px; border-radius: 10px; scroll-margin-top: 12px; }
.sxa-exo.is-flash { animation: sxa-flash 1.4s ease-out; }
@keyframes sxa-flash { from { background: #fff1e8; } to { background: transparent; } }
.sxa-exo__tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    padding-bottom: 3px; border-bottom: 2px solid var(--sxa-bleu); }
.sxa-exo.is-choisi .sxa-exo__tete { border-bottom-color: var(--sxa-orange); }
.sxa-exo__titre { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.22rem; font-weight: 500; line-height: 1.3; color: var(--sxa-bleu); }
.sxa-exo__mot, .sxa-exo__code { font-weight: 800; }
.sxa-exo__outils { display: flex; gap: 2px; flex: none; }
.sxa-outil { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
    border: 0; border-radius: 8px; background: none; color: var(--sxa-orange); cursor: pointer; }
.sxa-outil svg { width: 22px; height: 22px; }
.sxa-outil:hover { background: var(--sxa-orange-l); }
.sxa-outil.is-on { background: var(--sxa-orange); color: #fff; }
.sxa-outil:disabled { opacity: .28; background: none; cursor: default; }
.sxa-exo__reglages { margin: 6px 0 2px; font-size: .8rem; color: var(--muted); }
/* Le titre est déjà dans la barre bleue : l'en-tête du moteur ferait doublon. */
.sxa-exo__corps .exo-ex__head { display: none; }
.sxa-exo__corps .exo-ex { margin-bottom: 0; }

/* ---- Paramètres ---- */
.sxa-param { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
    background: var(--sxa-gris); border-radius: 12px; padding: 14px 16px 16px; }
.sxa-param[hidden] { display: none; }
.sxa-param__tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sxa-param__titre { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--sxa-bleu); }
.sxa-param__x { border: 0; background: none; font-size: 1.1rem; color: #dc2626; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.sxa-param__x:hover { background: #fee2e2; }
.sxa-param__ex { margin: 4px 0 14px; font-size: .84rem; color: var(--slate-600, #475569); }
.sxa-param__ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.sxa-champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sxa-champ__l { font-size: .8rem; color: var(--slate-500); }
.sxa-champ__i { width: 100%; box-sizing: border-box; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--sxa-orange);
    border-radius: 4px; background: #fff; font: inherit; }
.sxa-champ__i:focus { outline: 2px solid var(--sxa-orange); outline-offset: 0; }
.sxa-serie { display: flex; gap: 4px; }
.sxa-serie__de { flex: none; padding: 0 8px; border: 1px solid var(--sxa-orange); border-radius: 4px; background: #fff; cursor: pointer; }
.sxa-param__aide { margin: 8px 0 12px; font-size: .76rem; line-height: 1.45; color: var(--muted); }
.sxa-coche { display: flex; align-items: flex-start; gap: 8px; margin: 9px 0; font-size: .88rem; cursor: pointer; }
.sxa-coche input { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--sxa-orange); }
.sxa-param__etat { min-height: 1em; margin: 12px 0 0; font-size: .78rem; color: #047857; }

@media (max-width: 1180px) {
    .sxa.is-param { grid-template-columns: 300px minmax(0, 1fr); }
    .sxa.is-param .sxa-param { grid-column: 2; grid-row: 1; position: static; max-height: none; margin-bottom: 16px; }
    .sxa.is-param .sxa-centre { grid-column: 2; }
    .sxa.is-param .sxa-biblio { grid-row: 1 / span 2; }
}
@media (max-width: 760px) {
    .sxa-exo__tete { flex-wrap: wrap; }
    .sxa, .sxa.is-param { grid-template-columns: minmax(0, 1fr); }
    .sxa-biblio { position: static; max-height: 45vh; margin-bottom: 16px; }
    .sxa.is-param .sxa-param, .sxa.is-param .sxa-centre { grid-column: 1; }
}

/* ==========================================================================
   Fiches d'exercices PDF — /exercices/fiche/{id} (views/exercices/fiche.php,
   js/fiche-editeur.js, js/fiche-mep.js, migration 105).
   L'onglet « Exercices » reprend la présentation de la séance informatique (.sxa :
   arbre gris, titres bleus soulignés, icônes orange) ; l'onglet « Mise en page » met
   les réglages du document devant l'aperçu page à page — qui EST le PDF.
   ========================================================================== */
.fpe { --fpe-orange: #ea580c; --fpe-bleu: #1d5f8f; --fpe-haut: 76px; }

/* ---- Barre supérieure (collante) ---- */
.fpe-barre { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
    margin: 0 0 14px; padding: 8px 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06); }
.fpe-retour { text-decoration: none; font-size: 1.25rem; line-height: 1; color: var(--muted); padding: 4px 6px; border-radius: 8px; }
.fpe-retour:hover { color: var(--text); background: var(--slate-100); }
.fpe-titre { flex: 1 1 200px; min-width: 150px; font: inherit; font-size: 1.12rem; font-weight: 700; color: var(--fpe-bleu);
    border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; background: transparent; }
.fpe-titre:hover { border-color: var(--border); }
.fpe-titre:focus { outline: none; border-color: var(--fpe-orange); background: #fff; }
.fpe-onglets { display: flex; gap: 3px; padding: 3px; background: var(--slate-100); border-radius: 10px; }
.fpe-onglet { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: .9rem; font-weight: 600; color: var(--slate-600); cursor: pointer; white-space: nowrap; }
.fpe-onglet:hover { color: var(--text); }
.fpe-onglet.is-on { background: #fff; color: var(--fpe-orange); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.fpe-onglet__n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    background: var(--slate-400); color: #fff; font-size: .72rem; font-weight: 700; }
.fpe-onglet.is-on .fpe-onglet__n { background: var(--fpe-orange); }
.fpe-onglet__c { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--slate-200); color: var(--slate-700);
    font-size: .72rem; text-align: center; }
.fpe-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.fpe-act { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: .85rem; font-weight: 600; color: var(--fpe-orange); cursor: pointer; white-space: nowrap; }
.fpe-act:hover { background: #fff1e8; }
.fpe-act svg { width: 18px; height: 18px; flex: none; }
.fpe-act--sel { cursor: default; }
.fpe-act--sel select { font: inherit; font-size: .84rem; padding: 2px 4px; border: 1px solid #fdba74; border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; }
.fpe-etat { min-width: 110px; font-size: .78rem; color: var(--muted); text-align: right; }
.fpe-etat.is-attente { color: #b45309; }
.fpe-etat.is-ok { color: #047857; }
.fpe-etat.is-ok::before { content: '✓ '; }
.fpe-etat.is-ko { color: #dc2626; font-weight: 600; }
.fpe-progres { margin: -4px 0 12px; padding: 8px 12px; border: 1px solid #fed7aa; border-radius: 10px; background: #fff7ed;
    color: #9a3412; font-size: .88rem; }
.fpe-progres::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
    border: 2px solid #fdba74; border-top-color: var(--fpe-orange); border-radius: 50%; animation: fpe-tourne .8s linear infinite; }
@keyframes fpe-tourne { to { transform: rotate(360deg); } }

/* ---- Onglet « Exercices » : la grille .sxa, calée sous la barre ---- */
.fpe .sxa-biblio, .fpe .sxa-param { top: var(--fpe-haut); max-height: calc(100vh - var(--fpe-haut) - 12px); }
.fpe-exo .sxa-exo__titre { cursor: pointer; }
.fpe-exo.is-cache { opacity: .55; }
.fpe-exo.is-cache .sxa-exo__tete { border-bottom-style: dashed; }
.fpe-exo.is-ko .sxa-exo__nom { color: #dc2626; }
.fpe-exo .exo-choix__item.is-sol { background: #dcfce7; }
.fpe-exo .exo-zone.is-sol { border-color: #16a34a; background: rgba(22, 163, 74, .22); }
.fpe-champ { margin-bottom: 12px; }
.fpe-p-qs { margin-bottom: 10px; }
.fpe-qs__tete { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fpe-qs__aide { margin: 2px 0 6px; }
.fpe-q { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0;
    border-bottom: 1px solid #e5e7eb; font-size: .82rem; line-height: 1.35; }
.fpe-q input { width: 16px; height: 16px; margin: 0; accent-color: var(--fpe-orange); }
.fpe-q.is-off .fpe-q__t { color: var(--slate-400); }
.fpe-q__type { font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--fpe-orange); }
.fpe-spin { display: inline-flex; align-items: stretch; border: 1px solid #fdba74; border-radius: 6px; overflow: hidden; background: #fff; }
.fpe-spin__b { width: 22px; border: 0; background: #fff; color: var(--fpe-orange); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.fpe-spin__b:hover { background: #fff1e8; }
.fpe-spin__v { min-width: 24px; padding: 2px 0; text-align: center; font-variant-numeric: tabular-nums; border-left: 1px solid #fed7aa; border-right: 1px solid #fed7aa; }
.fpe-lien { padding: 0; border: 0; background: none; font: inherit; font-size: .8rem; color: var(--fpe-orange); text-decoration: underline; cursor: pointer; }
.fpe-lien:disabled { opacity: .5; cursor: default; }

/* ---- Onglet « Mise en page » ---- */
.fpe-mep { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 0 22px; align-items: start; }
.fpe-mep[hidden], .fpe-vue[hidden] { display: none; }
.fpe-reglages { position: sticky; top: var(--fpe-haut); max-height: calc(100vh - var(--fpe-haut) - 12px); overflow-y: auto;
    padding: 14px 14px 18px; background: #f3f4f6; border-radius: 12px; }
.fpe-reglages__titre { margin: 0 0 8px; font-size: 1.15rem; font-weight: 800; color: var(--fpe-bleu); }
.fpe-reglages__reset { margin-top: 12px; }
.fpe-grp { border-top: 1px solid #e2e5ea; }
.fpe-grp__t { padding: 9px 2px; list-style: none; cursor: pointer; font-size: .72rem; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--slate-500); }
.fpe-grp__t::-webkit-details-marker { display: none; }
.fpe-grp__t::before { content: '▸'; display: inline-block; width: 14px; color: var(--fpe-orange); }
.fpe-grp[open] > .fpe-grp__t::before { content: '▾'; }
.fpe-grp[open] { padding-bottom: 6px; }
.fpe-r { display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: center; gap: 4px 10px; margin: 0 0 9px; font-size: .86rem; }
.fpe-r--chk, .fpe-r--txt, .fpe-r--area, .fpe-r--couleurs { grid-template-columns: minmax(0, 1fr); }
.fpe-r--txt .fpe-r__l, .fpe-r--area .fpe-r__l, .fpe-r--couleurs .fpe-r__l { font-size: .8rem; color: var(--slate-500); }
.fpe-r__i { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid #fdba74; border-radius: 6px; background: #fff;
    font: inherit; font-size: .86rem; color: var(--text); }
.fpe-r__i:focus { outline: 2px solid var(--fpe-orange); outline-offset: 0; }
.fpe-r__i--area { min-height: 64px; resize: vertical; }
.fpe-r__chk { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; line-height: 1.35; }
.fpe-r__chk input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--fpe-orange); }
.fpe-r__aide { grid-column: 1 / -1; margin: 2px 0 0 24px; font-size: .74rem; line-height: 1.4; color: var(--muted); }
.fpe-r--sel .fpe-r__aide, .fpe-r--num .fpe-r__aide { margin-left: 0; }
.fpe-r.is-off { opacity: .42; }
.fpe-r.is-off .fpe-r__chk { cursor: default; }
.fpe-pastilles { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 4px; }
.fpe-pastille { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; }
.fpe-pastille.is-on { box-shadow: 0 0 0 2px var(--fpe-orange); }
.fpe-pastille-libre { width: 32px; height: 26px; padding: 0 2px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; cursor: pointer; }
.fpe-pastille-libre.is-on { outline: 2px solid var(--fpe-orange); }

.fpe-apercu { min-width: 0; }
.fpe-apercu__barre { position: sticky; top: var(--fpe-haut); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    padding: 7px 12px; background: #e5e7eb; border-radius: 10px; font-size: .86rem; }
.fpe-apercu__sel select { margin-left: 6px; padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; font: inherit; font-size: .84rem; }
.fpe-apercu__zoom { display: inline-flex; overflow: hidden; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }
.fpe-zb { padding: 3px 10px; border: 0; background: #fff; font: inherit; font-size: .86rem; cursor: pointer; }
.fpe-zb + .fpe-zb { border-left: 1px solid #e2e8f0; }
.fpe-zb:hover { background: #fff1e8; }
.fpe-zb--v { min-width: 64px; font-variant-numeric: tabular-nums; }
.fpe-apercu__info { margin-left: auto; color: var(--slate-600); }
.fpe-apercu__aide { margin: 8px 2px 10px; font-size: .78rem; color: var(--muted); }
.fpe-apercu__pages { min-height: 60vh; overflow-x: auto; padding: 22px 18px 34px; background: #cfd3da; border-radius: 12px; transition: opacity .15s; }
.fpe-apercu__pages.is-calcul { opacity: .55; }
.fpe-apercu__pages > .fp-doc { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.fpe-apercu__vide { margin: 0; padding: 60px 20px; text-align: center; color: #475569; }
.fpe-feuille { position: relative; flex: none; background: #fff; box-shadow: 0 3px 14px rgba(15, 23, 42, .22); }
.fpe-feuille > .fp-page { position: absolute; left: 0; top: 0; }
.fpe-feuille.is-blanche { opacity: .6; }
.fpe-feuille__n { position: absolute; left: 0; bottom: -20px; font-size: .72rem; color: #475569; }
/* Titre, sous-titre, ligne d'en-tête et pied de page : modifiables sur l'aperçu. */
.fpe-feuille [data-champ] { min-width: 4em; border-radius: 2px; outline: 1px dashed transparent; outline-offset: 2px; cursor: text; }
.fpe-feuille [data-champ]:hover { outline-color: #fb923c; }
.fpe-feuille [data-champ]:focus { outline: 1.5px solid var(--fpe-orange); background: #fff7ed; }
.fpe-feuille [data-champ]:empty::before { content: attr(data-placeholder); color: #b8bcc4; font-style: italic; font-weight: 400; }
.fpe-feuille .fp-tete__titre[data-champ]::after { content: ' ✎'; font-size: .5em; color: #fb923c; vertical-align: super; }

/* ---- Modale de dépôt dans « Mes documents » ---- */
.fpe-d-quoi { margin: 10px 0 6px; padding: 0; border: 0; }
.fpe-d-remp { margin: 4px 0 8px; padding: 8px 10px; border-radius: 10px; background: #fff7ed; }
.fpe-d-dossier { margin: 8px 0 12px; transition: opacity .15s; }
.fpe-d-dossier.is-off { opacity: .45; pointer-events: none; }
.fpe-d-arbre { max-height: 260px; }
.fpe-d-arbre .is-sel { background: #fff1e8; color: #9a3412; font-weight: 700; }
.fpe-d-arbre .is-sel svg { color: var(--primary); }
.fpe-d-nouveau { display: flex; gap: 8px; margin-top: 8px; }
.fpe-d-nouveau .field__input { flex: 1 1 auto; }
.fpe-d-choix { margin: 6px 0 0; font-size: .84rem; color: var(--muted); }
.fpe-d-etat { min-height: 1.2em; margin: 8px 0 0; font-size: .88rem; color: #9a3412; }
.fpe-d-etat.is-ok { color: #047857; }
.fpe-d-etat.is-ko { color: #dc2626; font-weight: 600; }
.fpe-d-etat a { margin-left: 4px; }

@media (max-width: 1180px) {
    .fpe-mep { grid-template-columns: 290px minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .fpe-barre { position: static; }
    .fpe { --fpe-haut: 12px; }
    .fpe-mep { grid-template-columns: minmax(0, 1fr); }
    .fpe-reglages { position: static; max-height: 46vh; margin-bottom: 14px; }
    .fpe-apercu__barre { position: static; }
    .fpe-actions { margin-left: 0; }
}

/* ==========================================================================
   Pages de la fiche (.fp) — composées par js/fiche-mep.js, aux dimensions du papier.
   Tout est en mm / pt / em : l'écran et le PDF sont la même page. Les variables
   (--fp-police, --fp-taille, --fp-c…) sont posées sur la racine par habille().
   ========================================================================== */
.fp { --fp-police: 'Times New Roman', Times, serif; --fp-taille: 11pt; --fp-il: 1.35; --fp-mots: 0; --fp-c: #1d5f8f;
    --fp-encre: #c62828; --fp-espq: .6em; --fp-espex: 1.6em; --fp-marge: 14mm; color: #111; }
.fp-page, .fp-maitre { font-family: var(--fp-police); font-size: var(--fp-taille); line-height: var(--fp-il); word-spacing: var(--fp-mots);
    color: #111; font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; text-align: left; }
.fp-page { position: relative; box-sizing: border-box; overflow: hidden; background: #fff; }
.fp-page__in { box-sizing: border-box; display: flex; flex-direction: column; height: 100%; padding: var(--fp-marge); }
.fp-corps { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(var(--fp-ncol, 1), minmax(0, 1fr)); column-gap: 8mm; }
.fp-col { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.fp[data-sep="1"] .fp-col + .fp-col { margin-left: -4mm; padding-left: 4mm; border-left: .5pt solid #9ca3af; }
.fp-reduit { overflow: hidden; }
.fp-u { min-width: 0; }

/* ---- Pied de page ---- */
.fp-pied { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 8mm; margin-top: 3mm; padding-top: 1.5mm;
    border-top: .5pt solid #d1d5db; font-size: 8pt; line-height: 1.25; color: #6b7280; word-spacing: normal; }
.fp-pied__t { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fp-pied__n { flex: none; white-space: nowrap; }

/* ---- En-tête de la première page ---- */
.fp-tete { position: relative; flex: none; margin-bottom: 5mm; }
.fp-tete__ligne { display: flex; align-items: center; gap: 5mm; }
.fp-tete__bloc { flex: 1 1 auto; min-width: 0; }
.fp-tete__titre { margin: 0; font-size: 1.65em; font-weight: 700; line-height: 1.2; color: #111; }
/* Les titres de la fiche suivent la police du document, pas celle des titres du site. */
.fp h1, .fp h2, .fp h3, .fp h4 { font-family: inherit; letter-spacing: normal; }
.fp-tete__sous { margin: .15em 0 0; font-size: 1.05em; color: #374151; }
.fp-tete__info { margin: .2em 0 0; font-size: .9em; color: #4b5563; }
.fp-tete__version { display: inline-block; margin-bottom: 1.5mm; padding: .3mm 2.5mm; border: .7pt solid currentColor; border-radius: 1.5mm;
    font-size: 9pt; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.fp-tete__qr { flex: none; width: 19mm; margin: 0; text-align: center; font-size: 6.5pt; line-height: 1.2; color: #6b7280; }
.fp-tete__qr svg { display: block; width: 19mm; height: 19mm; }
.fp-tete--epure .fp-tete__bloc, .fp-tete--eleve .fp-tete__bloc, .fp-tete--evaluation .fp-tete__bloc { text-align: center; }
.fp-tete--epure .fp-tete__ligne, .fp-tete--eleve .fp-tete__ligne, .fp-tete--evaluation .fp-tete__ligne { padding-bottom: 2.5mm; border-bottom: .8pt solid #111; }
.fp-tete--encadre .fp-tete__ligne { padding: 3mm 4mm; border: 1pt solid #111; border-radius: 1.5mm; background: #f4f5f7; box-shadow: 1.2mm 1.2mm 0 #cfd3da; }
.fp-tete--bandeau .fp-tete__ligne { padding: 3.5mm 5mm; border-radius: 2mm; background: var(--fp-c); color: #fff; }
.fp-tete--bandeau .fp-tete__titre, .fp-tete--bandeau .fp-tete__sous, .fp-tete--bandeau .fp-tete__info, .fp-tete--bandeau .fp-tete__qr { color: #fff; }
.fp-ident { display: flex; flex-wrap: wrap; gap: 2mm 6mm; margin-bottom: 3.5mm; font-size: .92em; }
.fp-ident__c { display: flex; flex: 1 1 28mm; align-items: baseline; gap: 1.5mm; }
.fp-ident__l { font-weight: 700; white-space: nowrap; }
.fp-ident__v { flex: 1 1 auto; min-width: 12mm; height: 1em; border-bottom: .6pt dotted #111; }
.fp-eval { display: grid; grid-template-columns: minmax(0, 1fr) 36mm; gap: 4mm; margin-bottom: 4mm; }
.fp-eval .fp-ident { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 3mm; }
.fp-eval__app { min-height: 11mm; padding: 1.5mm 2.5mm; border: .6pt solid #9ca3af; border-radius: 1.5mm; font-size: .85em; color: #4b5563; }
.fp-eval__note { display: flex; flex-direction: column; justify-content: space-between; padding: 2mm 3mm; border: 1pt solid #111; border-radius: 2mm; }
.fp-eval__nl { font-size: .85em; font-weight: 700; }
.fp-eval__nv { font-size: 1.3em; font-weight: 700; text-align: right; }

/* ---- Exercices ---- */
.fp-ex { position: relative; display: flow-root; margin-top: var(--fp-espex); }
.fp-col > .fp-ex:first-child, .fp-ex--suite { margin-top: 0; }
.fp-ex__tete { display: flex; flex-wrap: wrap; align-items: center; gap: 1mm 2.5mm; margin-bottom: .45em; line-height: 1.25; color: var(--fp-c); }
.fp-ex__lab { font-weight: 700; white-space: nowrap; }
.fp-ex__titre { min-width: 0; }
.fp-ex__code { padding: 0 1.2mm; border: .5pt solid #9ca3af; border-radius: 1mm; font-size: .78em; font-weight: 700; color: #6b7280; white-space: nowrap; }
.fp-ex__droite { display: inline-flex; align-items: center; gap: 3mm; margin-left: auto; }
.fp-ex__pts { font-size: .85em; color: #374151; white-space: nowrap; }
.fp-ex__qr { float: right; width: 13mm; height: 13mm; margin: 0 0 1.5mm 3mm; }
.fp-ex__qr svg { display: block; width: 100%; height: 100%; }
.fp-consigne { margin-bottom: .45em; }
.fp-consigne > .exo-ex__consigne { margin: 0; }
.fp-consigne--fusion { margin-top: .5em; font-weight: 600; }
.fp-col > .fp-ex:first-child > .fp-consigne--fusion:first-child { margin-top: 0; }
.fp-row { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 6mm; align-items: start; }
.fp-row[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fp-row[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fp-row[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fp-row + .fp-row { margin-top: var(--fp-espq); }

/* Styles d'exercice */
.fp[data-style-ex="souligne"] .fp-ex__tete { padding-bottom: .6mm; border-bottom: 1pt solid var(--fp-c); }
.fp[data-style-ex="souligne"] .fp-ex__lab { font-size: 1.08em; }
.fp[data-style-ex="encadre"] .fp-ex:not(.fp-ex--fusion):not(.fp-ex--cle) { padding: 4.5mm 4mm 3mm; border: .8pt solid var(--fp-c); border-radius: 2mm;
    margin-top: calc(var(--fp-espex) + .7em); }
.fp[data-style-ex="encadre"] .fp-col > .fp-ex:first-child { margin-top: .75em; }
.fp[data-style-ex="encadre"] .fp-ex__tete, .fp-ex__suite { position: absolute; left: 3mm; top: 0; max-width: calc(100% - 6mm); margin: 0;
    padding: 0 2mm; background: #fff; transform: translateY(-50%); }
.fp[data-style-ex="encadre"] .fp-ex__droite { margin-left: 2mm; }
.fp-ex__suite { font-size: .8em; font-style: italic; color: var(--fp-c); }
.fp[data-style-ex="bandeau"] .fp-ex__tete { padding-bottom: .8mm; border-bottom: .6pt solid var(--fp-c); }
.fp[data-style-ex="bandeau"] .fp-ex__lab { padding: .5mm 2.5mm; border-radius: 1mm; background: var(--fp-c); color: #fff; }
.fp[data-style-ex="bandeau"] .fp-ex__titre { font-weight: 600; }
.fp[data-style-ex="pastille"] .fp-ex__lab { display: inline-grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 50%;
    background: var(--fp-c); color: #fff; font-size: .95em; line-height: 1; }
.fp[data-style-ex="pastille"] .fp-ex__titre { font-weight: 700; color: #111; }
.fp[data-style-ex="pastille"][data-pos-titre="marge"] .fp-ex:not(.fp-ex--fusion) { padding-left: 9mm; }
.fp[data-style-ex="pastille"][data-pos-titre="marge"] .fp-ex__lab { position: absolute; left: 0; top: -.15em; }
.fp[data-style-ex="simple"] .fp-ex__lab::after { content: '.'; }
.fp[data-style-ex="simple"] .fp-ex__titre { font-style: italic; color: #111; }

/* Énoncés : le moteur commun, mis au régime du papier */
.fp .prose { line-height: inherit; }
.fp .prose p { margin: 0 0 .3em; }
.fp .prose p:last-child { margin-bottom: 0; }
.fp .prose ul, .fp .prose ol { margin: .2em 0; }
.fp .exo-ex { margin: 0; padding: 0; border: 0; }
.fp .exo-item { min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.fp .exo-item__head { display: flex; align-items: baseline; gap: .45em; }
.fp .exo-item__num { flex: none; color: inherit; font-weight: 400; font-variant-numeric: tabular-nums; }
.fp[data-num-gras="1"] .exo-item__num { font-weight: 700; }
.fp .exo-item__num.is-vide { display: none; }
.fp .exo-item__rep { margin: .3em 0 0 1.5em; }
.fp .exo-choix { gap: .12em; }
/* Propositions « côte à côte » (défaut) : une fiche de QCM tient en deux fois moins de place. */
.fp[data-choix="ligne"] .exo-choix { flex-direction: row; flex-wrap: wrap; gap: .15em 1.8em; }
.fp .exo-choix__item, .fp .exo-choix__item.is-sol { background: none; outline: 0; }
.fp .exo-choix__lab { align-items: baseline; gap: .5em; padding: .05em 0; cursor: default; }
.fp .exo-choix__item.is-sol .exo-choix__txt { color: var(--fp-encre); font-weight: 600; }
.fp .exo-unite { margin-left: .25em; color: inherit; }
.fp .exo-trou { display: inline; }
.fp .exo-fig { margin: .2em 0 .4em; }
.fp .exo-fig__img { max-height: 62mm; border: 0; border-radius: 0; }
.fp .exo-zones__img { border-radius: 0; }
.fp .exo-zone { cursor: default; }
.fp .exo-zone.fp-zone-sol { border: .7mm solid var(--fp-encre); background: transparent; }
.fp .exo-corr { margin: .35em 0 .2em 1.5em; padding: .2em 0 .2em .7em; border: 0; border-left: 1.5pt solid var(--fp-encre); border-radius: 0;
    background: none; font-size: .92em; }
.fp .exo-corr__t { margin-bottom: .1em; font-size: .9em; font-weight: 700; color: var(--fp-encre); }
.fp-case { display: inline-block; flex: none; box-sizing: border-box; width: .8em; height: .8em; border: .7pt solid #111; border-radius: .1em; vertical-align: -.05em; }
.fp-case.is-coche { border-color: var(--fp-encre); background: var(--fp-encre); box-shadow: inset 0 0 0 .14em #fff; }
.fp-blanc { display: inline-block; min-width: 3em; height: 1.05em; margin: 0 .15em; border-bottom: .8pt dotted #222; vertical-align: -.25em; }
.fp-blanc--rep { min-width: 7em; }
.fp .exo-frac .fp-blanc { min-width: 1.8em; margin: .1em .1em; }
.fp-choix { font-size: .85em; color: #4b5563; }
.fp-rep { padding: 0 .15em; font-weight: 700; color: var(--fp-encre); }
.fp-bout { white-space: nowrap; }

/* Zones de réponse */
.fp-lignes { margin-top: .6em; }
.fp-lignes[data-type="pointilles"] { background-image: radial-gradient(circle at 50% calc(100% - 1.5px), #444 0 .55px, transparent .85px);
    background-size: 1.6mm 8mm; }
.fp-lignes[data-type="lignes"] { background-image: repeating-linear-gradient(to bottom, transparent 0 calc(8mm - .6pt), #9ca3af calc(8mm - .6pt) 8mm); }
.fp-lignes[data-type="seyes"] { border-left: .8pt solid rgba(220, 38, 38, .55);
    background-image: repeating-linear-gradient(to right, rgba(124, 58, 237, .32) 0 .35pt, transparent .35pt 8mm),
        repeating-linear-gradient(to bottom, rgba(37, 99, 235, .5) 0 .45pt, transparent .45pt 8mm),
        repeating-linear-gradient(to bottom, rgba(96, 165, 250, .32) 0 .3pt, transparent .3pt 2mm); }
.fp-lignes[data-type="carreaux"] { border: .35pt solid #c7cdd6;
    background-image: repeating-linear-gradient(to right, #c7cdd6 0 .35pt, transparent .35pt 5mm),
        repeating-linear-gradient(to bottom, #c7cdd6 0 .35pt, transparent .35pt 5mm); }
.fp-lignes[data-type="cadre"] { border: .7pt solid #6b7280; border-radius: 1.5mm; }

/* Corrigé « minimal » : les réponses seules, en ligne */
.fp-cle { display: flex; flex-wrap: wrap; gap: .25em 1.6em; }
.fp-cle + .fp-cle { margin-top: .25em; }
.fp-cle__it { display: inline-flex; align-items: baseline; gap: .35em; white-space: nowrap; }
.fp-cle__n { font-weight: 700; }
.fp-cle__r { font-weight: 600; color: var(--fp-encre); }
.fp-cle__r .exo-choix__txt, .fp-cle__r .exo-choix__txt p { display: inline; margin: 0; }

/* « Course aux nombres » */
.fp-can { border: .8pt solid #111; }
.fp-can__l { display: grid; grid-template-columns: 9mm minmax(0, 1fr) 32mm; border-top: .6pt solid #6b7280; }
.fp-can__l--tete { border-top: 0; background: #f1f2f4; font-size: .9em; font-weight: 700; }
.fp-can__l > .fp-can__n, .fp-can__l > .fp-can__e, .fp-can__l > .fp-can__r { padding: 1.4mm 2mm; }
.fp-can__n { border-right: .6pt solid #6b7280; font-weight: 700; text-align: center; }
.fp-can__r { border-left: .6pt solid #6b7280; }
.fp-can__r.is-sans { background: repeating-linear-gradient(45deg, #fff 0 2mm, #eef0f2 2mm 2.6mm); }
.fp-can__l--consigne { display: block; padding: 1mm 2mm; background: #fafafa; font-style: italic; }
.fp-can__e .exo-item__rep { margin-left: 0; }

/* ---- Page de garde ---- */
.fp-garde { display: flex; flex-direction: column; gap: 5mm; height: 100%; }
.fp-garde > .fp-tete__version { align-self: flex-end; }
.fp-garde__titre { margin: 16mm 0 0; font-size: 2.3em; line-height: 1.15; text-align: center; color: var(--fp-c); }
.fp-garde__sous { margin: 0; font-size: 1.3em; text-align: center; color: #374151; }
.fp-garde__info { margin: 0; text-align: center; color: #4b5563; }
.fp-garde__duree { margin: 0; font-weight: 700; text-align: center; }
.fp-garde__ident { margin-top: 6mm; padding: 4mm 5mm; border: .8pt solid #111; border-radius: 2mm; }
.fp-garde__ident .fp-ident { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm 8mm; margin: 0; }
.fp-bareme { width: 100%; border-collapse: collapse; font-size: .95em; }
.fp-bareme th, .fp-bareme td { padding: 1.5mm 2.5mm; border: .6pt solid #6b7280; text-align: left; }
.fp-bareme th { background: #f1f2f4; }
.fp-bareme__pts { width: 32mm; white-space: nowrap; text-align: right !important; }
.fp-bareme__tot td { font-weight: 700; }
.fp-garde__cadres { display: grid; grid-template-columns: 42mm minmax(0, 1fr); gap: 5mm; }
.fp-garde__note { display: flex; flex-direction: column; justify-content: space-between; min-height: 26mm; padding: 2mm 3mm; border: 1pt solid #111; border-radius: 2mm; }
.fp-garde__note strong { font-size: 1.4em; text-align: right; }
.fp-garde__app { min-height: 26mm; padding: 2mm 3mm; border: .8pt solid #6b7280; border-radius: 2mm; font-size: .9em; color: #4b5563; }
.fp-garde__consignes { padding: 1mm 0 1mm 4mm; border-left: 2pt solid var(--fp-c); }
.fp-garde__consignes p { margin: 0 0 .3em; }
.fp-garde__ct { font-weight: 700; }
.fp-garde__qr { margin: auto auto 0; font-size: 8pt; text-align: center; color: #6b7280; }
.fp-garde__qr svg { display: block; width: 26mm; height: 26mm; margin: 0 auto 1mm; }

/* ==========================================================================
   Version en ligne d'une fiche (/fiche/{jeton}) — cible des QR codes.
   ========================================================================== */
.fpub { max-width: 880px; margin: 0 auto; }
.fpub__tete { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.fpub__sur { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fpub__titre { margin: 4px 0 6px; }
.fpub__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--muted); }
.fpub__version { padding: 1px 10px; border: 1px solid #fed7aa; border-radius: 999px; background: #fff7ed; font-weight: 700; color: #ea580c; }
.fpub__aide { margin: 8px 0 0; font-size: .9rem; }
.fpub__versions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fpub__v { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: .86rem; color: var(--text); text-decoration: none; }
.fpub__v.is-on { border-color: #ea580c; background: #ea580c; color: #fff; }

/* ==========================================================================
   Mes fiches PDF — /exercices/fiches (views/exercices/fiches.php)
   ========================================================================== */
.fpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.fpl-carte { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card); transition: box-shadow .15s, border-color .15s; }
.fpl-carte:hover { border-color: #fdba74; box-shadow: var(--shadow); }
.fpl-carte__haut { display: flex; align-items: flex-start; gap: 12px; }
.fpl-carte__ic { flex: none; display: grid; place-items: center; width: 40px; height: 48px; border-radius: 6px;
    background: linear-gradient(160deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa; color: #ea580c; font-size: 1.2rem; }
.fpl-carte__titre { margin: 0; font-size: 1rem; line-height: 1.3; }
.fpl-carte__titre a { color: var(--text); text-decoration: none; }
.fpl-carte__titre a:hover { color: #ea580c; text-decoration: underline; }
.fpl-carte__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.fpl-carte__depot { margin: 0; font-size: .8rem; color: var(--slate-600); }
.fpl-carte__depot a { color: inherit; }
.fpl-carte__outils { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 4px; }
.fpl-carte__outils .btn { margin-right: auto; }
.fpl-vide { grid-column: 1 / -1; padding: 46px 20px; text-align: center; color: var(--muted); }
.fpl-vide p { margin: 0 0 12px; }
.exo-biblio__btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* =========================================================================
   Estrade — raccourcis clavier (pastille, souffleur, fiche d'aide)
   ========================================================================= */
/* Pastille éphémère « C · Crayon » : en haut du tableau, ne prend aucun clic. */
.est-kbdflash { position: absolute; top: 14px; left: 50%; z-index: 14; display: inline-flex; align-items: center; gap: 9px;
    padding: 6px 13px 6px 7px; border-radius: 999px; background: rgba(15, 23, 42, .88); color: #fff;
    font: 600 .86rem/1 Inter, system-ui, sans-serif; letter-spacing: .01em; pointer-events: none;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .28); opacity: 0; transform: translate(-50%, -6px) scale(.97);
    transition: opacity .16s ease, transform .16s ease; }
.est-kbdflash.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.est-kbdflash kbd, .est-souffle kbd, .est-kbd kbd, .est-menu__kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 7px;
    border-radius: 7px; font: 700 .78rem/1 Inter, system-ui, sans-serif; white-space: nowrap; }
.est-kbdflash kbd { background: #fff; color: var(--slate-900); box-shadow: inset 0 -2px 0 var(--slate-300); }

/* Souffleur : bulle posée contre le bouton qu'on vient d'utiliser à la souris. */
.est-souffle { position: fixed; z-index: 70; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px;
    border-radius: 11px; background: var(--slate-900); color: #fff; font: 500 .82rem/1.2 Inter, system-ui, sans-serif;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .32); cursor: pointer; opacity: 0; transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease; max-width: 280px; }
.est-souffle[hidden] { display: none; }
.est-souffle.is-on { opacity: 1; transform: none; }
.est-souffle.is-droite.is-on { transform: none; }
.est-souffle::before { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px;
    background: inherit; transform: rotate(45deg); }
.est-souffle.is-droite::before { left: -5px; top: 50%; bottom: auto; margin: -5px 0 0; }
.est-souffle__t { color: #a5b4fc; font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.est-souffle kbd { background: #fff; color: var(--slate-900); box-shadow: inset 0 -2px 0 var(--slate-300); }

/* Entrée du menu ☰ : la touche à droite du libellé. */
.est-menu__item .est-menu__kbd { float: right; min-width: 22px; height: 20px; padding: 0 6px; margin-top: 1px;
    background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--border); font-size: .72rem; }

/* Fiche des raccourcis */
.est-kbd__box { max-width: 980px; width: min(96vw, 980px); padding: 20px 24px 18px; }
.est-kbd .modal__title { display: inline-flex; align-items: center; gap: 10px; }
.est-kbd .modal__title .est-ico { width: 26px; height: 26px; }
.est-kbd .modal__x .est-ico { width: 20px; height: 20px; }
.est-kbd__lead { margin: 6px 0 14px; font-size: .86rem; color: var(--muted); }
.est-kbd__grid { columns: 3 260px; column-gap: 18px; }
.est-kbd__sec { break-inside: avoid; margin: 0 0 14px; padding: 12px 14px 8px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--slate-50); }
.est-kbd__sec h3 { margin: 0 0 8px; font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--slate-500); }
.est-kbd__sec ul { list-style: none; margin: 0; padding: 0; }
.est-kbd__sec li { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: .86rem; color: var(--slate-700); }
.est-kbd__sec li + li { border-top: 1px dashed var(--slate-200); }
.est-kbd kbd { flex: none; min-width: 30px; background: #fff; color: var(--slate-800); border: 1px solid var(--slate-300);
    box-shadow: inset 0 -2px 0 var(--slate-200); }
.est-kbd__donne { flex: none; width: 22px; text-align: center; font: 600 1.05rem 'Cambria Math', Georgia, serif; color: var(--primary); }
.est-kbd__sec--saisie { background: #eef2ff; border-color: #c7d2fe; }
.est-kbd__note { margin: 6px 0 2px; font-size: .78rem; color: var(--slate-500); }

/* =========================================================================
   Estrade — menu « Fond » : papiers, réseaux, repère, apparence
   ========================================================================= */
.est-grid-menu { width: 312px; padding: 12px; max-height: min(80vh, 620px); overflow-y: auto; }
.est-grid-menu__sec { margin: 12px 2px 7px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--slate-500); }
.est-grid-menu__sec:first-child { margin-top: 0; }
.est-grid-menu__opts { gap: 6px; }
.est-grid-opt { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 4px 4px 5px; line-height: 1.1;
    transition: background .12s ease, border-color .12s ease, box-shadow .12s ease; }
.est-grid-opt svg { background: #fff; }
.est-grid-opt span { display: block; font-size: .64rem; font-weight: 600; color: var(--slate-600); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-grid-opt.is-on { background: #eef2ff; }
.est-grid-opt.is-on span { color: #4338ca; }
.est-grid-menu__val { min-width: 26px; text-align: right; font-size: .76rem; font-weight: 700; color: var(--slate-700);
    font-variant-numeric: tabular-nums; }
.est-grid-menu__row[hidden] { display: none; }
.est-grid-menu__sel { margin-left: auto; height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font: inherit; font-weight: 700; color: var(--slate-800); cursor: pointer; }

/* Interrupteurs d'apparence : une ligne cliquable, pastille à droite. */
.est-switch { display: flex; align-items: center; gap: 11px; width: 100%; margin-top: 6px; padding: 8px 10px; text-align: left;
    border: 1px solid var(--border); border-radius: 11px; background: #fff; cursor: pointer; font: inherit; color: var(--slate-800);
    transition: background .12s ease, border-color .12s ease; }
.est-switch:hover { background: var(--slate-50); }
.est-switch > .est-ico { width: 24px; height: 24px; color: var(--slate-700); }
.est-switch__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.est-switch__txt b { font-size: .84rem; font-weight: 700; }
.est-switch__txt small { font-size: .7rem; color: var(--slate-500); line-height: 1.25; }
.est-switch__ui { position: relative; flex: none; width: 36px; height: 21px; border-radius: 999px; background: var(--slate-300);
    transition: background .16s ease; }
.est-switch__ui::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .16s ease; }
.est-switch.is-on { border-color: #c7d2fe; background: #eef2ff; }
.est-switch.is-on .est-switch__ui { background: var(--primary); }
.est-switch.is-on .est-switch__ui::after { transform: translateX(15px); }
.est-kbdflash.is-seul { padding-left: 13px; }

/* =========================================================================
   Estrade — tableau sombre : l'interface suit l'ardoise
   (le canevas, lui, est peint par estrade.js — cf. FOND_NUIT et craie())
   ========================================================================= */
.est.is-nuit { --est-nuit-surf: #1e2935; --est-nuit-surf2: #263445; --est-nuit-hover: #2f3f53; --est-nuit-bord: #34465b;
    --est-nuit-txt: #e2e8f0; --est-nuit-muted: #94a3b8; }
.est.is-nuit .est-stage { background: #17212b; border-color: #0d141b; }
.est.is-nuit .est-dock, .est.is-nuit .est-bottombar, .est.is-nuit .est-menu, .est.is-nuit .est-grid-menu,
.est.is-nuit .est-timer-menu, .est.is-nuit .est-flyout, .est.is-nuit .est-ctx, .est.is-nuit .est-tbar,
.est.is-nuit .est-ecranbar, .est.is-nuit .est-perso, .est.is-nuit .est-sbar__pop {
    background: var(--est-nuit-surf); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.est.is-nuit .est-flyout::before, .est.is-nuit .est-sbar__pop::before { background: var(--est-nuit-surf); border-color: var(--est-nuit-bord); }
.est.is-nuit .est-tool { background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt);
    --est-ico-accent: rgba(165, 180, 252, .32); }
.est.is-nuit .est-tool:hover { background: var(--est-nuit-hover); }
.est.is-nuit .est-tool.is-on { background: #e2e8f0; border-color: #e2e8f0; color: #0f172a; }
.est.is-nuit .est-tool.is-on .est-ico { --est-ico-accent: #a5b4fc; }
.est.is-nuit .est-tool--eraser { color: #f472b6; --est-ico-accent: rgba(244, 114, 182, .3); }
.est.is-nuit .est-tool--eraser.is-on { background: #db2777; border-color: #db2777; color: #fff; }
.est.is-nuit .est-sep { background: var(--est-nuit-bord); }
.est.is-nuit .est-dock__head { border-bottom-color: var(--est-nuit-bord); color: var(--est-nuit-muted); }
.est.is-nuit .est-dock__label, .est.is-nuit .est-ind { color: var(--est-nuit-txt); }
.est.is-nuit .est-dock__btn { color: var(--est-nuit-muted); }
.est.is-nuit .est-theme { background: rgba(22, 163, 74, .16); border-color: rgba(74, 222, 128, .32); color: #bbf7d0;
    --est-ico-accent: rgba(134, 239, 172, .35); }
.est.is-nuit .est-theme:hover { background: rgba(22, 163, 74, .28); }
.est.is-nuit .est-theme.is-on { background: #16a34a; border-color: #16a34a; color: #fff; }
.est.is-nuit #est-color, .est.is-nuit .est-ink--custom { background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); }
.est.is-nuit .est-menu__item, .est.is-nuit .est-ctx__item { color: var(--est-nuit-txt); }
.est.is-nuit .est-menu__item:hover, .est.is-nuit .est-ctx__item:hover { background: var(--est-nuit-hover); }
.est.is-nuit .est-menu__field, .est.is-nuit .est-ctx__head, .est.is-nuit .est-grid-menu__sec,
.est.is-nuit .est-grid-menu__row, .est.is-nuit .est-grid-menu__snap { color: var(--est-nuit-muted); }
.est.is-nuit .est-ctx__sep { background: var(--est-nuit-bord); }
.est.is-nuit .est-grid-opt { background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); }
.est.is-nuit .est-grid-opt span { color: var(--est-nuit-muted); }
.est.is-nuit .est-grid-opt.is-on { border-color: #818cf8; box-shadow: 0 0 0 2px rgba(129, 140, 248, .35); }
.est.is-nuit .est-grid-opt.is-on span { color: #c7d2fe; }
.est.is-nuit .est-grid-menu__val { color: var(--est-nuit-txt); }
.est.is-nuit .est-grid-menu__sel, .est.is-nuit .est-menu .field__input, .est.is-nuit .est-timer-menu .field__input {
    background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt); }
.est.is-nuit .est-switch { background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt); }
.est.is-nuit .est-switch:hover { background: var(--est-nuit-hover); }
.est.is-nuit .est-switch > .est-ico { color: var(--est-nuit-txt); --est-ico-accent: rgba(165, 180, 252, .35); }
.est.is-nuit .est-switch__txt small { color: var(--est-nuit-muted); }
.est.is-nuit .est-switch.is-on { background: rgba(99, 102, 241, .2); border-color: rgba(129, 140, 248, .55); }
.est.is-nuit .est-switch__ui { background: #475569; }
.est.is-nuit .est-trash { background: rgba(30, 41, 59, .72); border-color: #475569; color: #94a3b8; }
.est.is-nuit .est-textinput { background: rgba(23, 33, 43, .94); border-color: #a5b4fc; }
.est.is-nuit .est-timer-menu__preset, .est.is-nuit .est-timer-menu__go { background: var(--est-nuit-surf2); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt); }
.est.is-nuit .est-tbar__btn { color: var(--est-nuit-txt); }
.est.is-nuit .est-tbar__btn:hover { background: var(--est-nuit-hover); }

/* =========================================================================
   Estrade — contours francs : barres et fenêtres bien détachées en projection
   ========================================================================= */
.est.is-contours { --est-contour: #0f172a; }
.est.is-contours.is-nuit { --est-contour: #e2e8f0; }
.est.is-contours .est-dock, .est.is-contours .est-bottombar, .est.is-contours .est-panel, .est.is-contours .est-menu,
.est.is-contours .est-grid-menu, .est.is-contours .est-timer-menu, .est.is-contours .est-ctx, .est.is-contours .est-flyout,
.est.is-contours .est-tbar, .est.is-contours .est-ecranbar, .est.is-contours .est-perso, .est.is-contours .est-coursblocs {
    border: 2px solid var(--est-contour); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 14px 32px rgba(15, 23, 42, .3); }
.est.is-contours .est-tool { border-color: color-mix(in srgb, var(--est-contour) 38%, transparent); }

/* =========================================================================
   Estrade — générateurs du thème Calculs (js/estrade-gen.js)
   ========================================================================= */
/* Rayons du dock droit : un intitulé discret au-dessus de chaque famille d'outils. */
.est-theme-tools__lab { grid-column: 1 / -1; margin: 7px 2px -1px; font-size: .6rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--slate-400); line-height: 1.2; }
.est-theme-tools__lab:first-child { margin-top: 0; }
.est.is-nuit .est-theme-tools__lab { color: #64748b; }

/* Le panneau : en-tête qu'on attrape, aperçu collé en haut, réglages qui défilent, action en pied. */
.est-panel--gen { width: min(480px, calc(100% - 32px)); top: 56px; max-height: calc(100% - 96px); overflow: hidden;
    display: flex; flex-direction: column; }
.est-panel--gen[hidden] { display: none; }
.est-panel--gen .est-panel__head { cursor: grab; touch-action: none; user-select: none; padding: 11px 14px; }
.est-panel--gen .est-panel__head:active { cursor: grabbing; }
.gen-head { display: inline-flex; align-items: center; gap: 9px; font-size: .98rem; }
.gen-head .est-ico { width: 22px; height: 22px; color: var(--slate-800); }
.est-panel--gen .est-panel__x .est-ico { width: 18px; height: 18px; }
.est-panel--gen .est-panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 16px 12px; }
.gen-apercu { position: sticky; top: 0; z-index: 2; display: grid; place-items: center; min-height: 118px; margin: 0 -16px 2px;
    padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid var(--border);
    background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1.2px); background-size: 14px 14px; }
.gen-apercu svg { display: block; max-width: 100%; height: auto; }
.gen-actions { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); background: #fff;
    border-radius: 0 0 var(--radius) var(--radius); }
.gen-actions__aide { flex: 1; font-size: .72rem; color: var(--muted); line-height: 1.3; }

.gen-sec { margin: 14px 0 7px; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-500); }
.gen-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.gen-row > .gen-f { flex: 1 1 0; min-width: 72px; }
.gen-f { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
.gen-f__l { font-size: .74rem; font-weight: 600; color: var(--slate-600); }
.gen-f__aide, .gen-aide { font-size: .72rem; color: var(--muted); line-height: 1.4; margin: 2px 0 6px; }
.gen-in { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff;
    font: inherit; font-size: .9rem; color: var(--slate-800); box-sizing: border-box; transition: border-color .12s, box-shadow .12s; }
.gen-in:focus { outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.gen-sel { cursor: pointer; padding-right: 4px; }
.gen-range { width: 100%; height: 34px; margin: 0; accent-color: var(--primary); }

/* Choix exclusifs : une rangée de segments, celui qui est pris se détache. */
.gen-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; margin: 0 0 8px; background: var(--slate-100); border-radius: 10px; }
.gen-seg__b { flex: 1 1 auto; min-height: 30px; padding: 4px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer;
    font: inherit; font-size: .8rem; font-weight: 600; color: var(--slate-600); white-space: nowrap; transition: background .12s, color .12s; }
.gen-seg__b:hover { color: var(--slate-900); }
.gen-seg__b.is-on { background: #fff; color: #4338ca; box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.gen-seg__b:focus-visible { outline: 2px solid #818cf8; outline-offset: 1px; }

/* Interrupteur */
.gen-sw { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 2px 12px 8px 0; font-size: .82rem; font-weight: 600;
    color: var(--slate-700); cursor: pointer; user-select: none; }
.gen-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gen-sw__ui { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--slate-300); transition: background .15s; }
.gen-sw__ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .15s; }
.gen-sw input:checked + .gen-sw__ui { background: var(--primary); }
.gen-sw input:checked + .gen-sw__ui::after { transform: translateX(14px); }
.gen-sw input:focus-visible + .gen-sw__ui { box-shadow: 0 0 0 3px rgba(99, 102, 241, .3); }

/* Nuancier */
.gen-col { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px auto; }
.gen-col__b { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--c); cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .15); transition: transform .12s; }
.gen-col__b:hover { transform: scale(1.12); }
.gen-col__b.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }

/* Listes de données (catégories, nombres, conversions) */
.gen-data { display: flex; flex-direction: column; gap: 5px; }
.gen-data__r { display: grid; grid-template-columns: 1fr 96px 30px; gap: 6px; align-items: center; }
.gen-data--simple .gen-data__r { grid-template-columns: 1fr 30px; }
.gen-data__r--h, .gen-conv--h { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--slate-400); }
.gen-conv { display: grid; grid-template-columns: 1fr 82px 92px 30px; gap: 6px; align-items: center; margin-bottom: 5px; }
.gen-x { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--slate-400); font-size: 1.25rem;
    line-height: 1; cursor: pointer; }
.gen-x:hover { background: #fee2e2; color: #dc2626; }
.gen-plus { align-self: flex-start; margin-top: 3px; padding: 6px 12px; border: 1px dashed #a5b4fc; border-radius: 9px; background: #eef2ff;
    color: #4338ca; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.gen-plus:hover { background: #e0e7ff; }
.gen-plus:disabled { opacity: .45; cursor: default; }
.gen-total { margin: 8px 0 0; padding: 7px 10px; border-radius: 8px; background: var(--slate-50); font-size: .78rem; font-weight: 600; color: var(--slate-600); }

/* Fraction : numérateur et dénominateur de part et d'autre d'un vrai trait de fraction. */
.gen-frac { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px 0 4px; }
.gen-frac .gen-f { align-items: center; margin: 0; }
.gen-frac__barre { width: 172px; height: 3px; margin: 6px 0; border-radius: 2px; background: var(--slate-800); }
.gen-cpt { display: inline-flex; align-items: center; gap: 6px; }
.gen-cpt .gen-in { width: 72px; height: 42px; text-align: center; font-size: 1.2rem; font-weight: 700; }
.gen-cpt__b { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 11px; background: #fff; font-size: 1.3rem;
    font-weight: 600; color: var(--slate-700); cursor: pointer; touch-action: manipulation; }
.gen-cpt__b:hover { background: var(--slate-100); }
.gen-err { margin: 0; color: var(--muted); font-size: .85rem; }

/* =========================================================================
   Estrade — barres d'outils personnelles
   ========================================================================= */
.est-perso { position: absolute; z-index: 9; display: flex; align-items: center; gap: 3px; padding: 5px 5px 5px 3px;
    background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
    user-select: none; -webkit-user-select: none; transition: box-shadow .15s ease, outline-color .15s ease; outline: 2px dashed transparent; outline-offset: 3px; }
.est-perso.is-v { flex-direction: column; padding: 3px 5px 5px; }
.est-perso.is-teinte { border-color: color-mix(in srgb, var(--perso) 55%, #fff); background: color-mix(in srgb, var(--perso) 6%, #fff);
    box-shadow: 0 10px 26px color-mix(in srgb, var(--perso) 20%, rgba(15, 23, 42, .1)); }
.est-perso.is-cible { outline-color: var(--primary); }
.est-perso.is-deplace { box-shadow: 0 18px 40px rgba(15, 23, 42, .28); }
.est-perso__grip { flex: none; width: 13px; height: 34px; border-radius: 6px; cursor: grab; touch-action: none;
    background-image: radial-gradient(circle, var(--perso, #94a3b8) 1.3px, transparent 1.6px); background-size: 6px 6px; background-position: center;
    opacity: .8; }
.est-perso__grip:hover { opacity: 1; background-color: rgba(148, 163, 184, .14); }
.est-perso.is-v .est-perso__grip { width: 34px; height: 13px; }
.est-perso.is-deplace .est-perso__grip { cursor: grabbing; }
.est-perso__outils { display: flex; gap: 3px; }
.est-perso.is-v .est-perso__outils { flex-direction: column; }
.est-perso__b { width: 42px; height: 42px; border-radius: 11px; touch-action: none; }
.est-perso__b .est-ico { width: 23px; height: 23px; }
.est-perso__b.is-glisse { opacity: .3; }
.est-perso__b[hidden] { display: none; }
.est-perso__menu { flex: none; display: grid; place-items: center; width: 22px; height: 34px; padding: 0; border: 0; border-radius: 7px;
    background: none; color: var(--slate-400); cursor: pointer; }
.est-perso__menu:hover { background: var(--slate-100); color: var(--slate-700); }
.est-perso__menu .est-ico { width: 18px; height: 18px; }
.est-perso.is-v .est-perso__menu { width: 34px; height: 20px; }

/* Le fantôme qui suit le pointeur pendant qu'on glisse un outil */
.est-perso-fantome { position: fixed; left: 0; top: 0; z-index: 200; width: 42px; height: 42px; display: grid; place-items: center;
    background: #fff; border: 1.5px solid var(--slate-300); border-radius: 11px; color: var(--slate-800);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .3); pointer-events: none; transition: border-color .12s, opacity .12s; }
.est-perso-fantome .est-ico { width: 23px; height: 23px; }
.est-perso-fantome.is-ok { border-color: var(--primary); box-shadow: 0 14px 30px rgba(79, 70, 229, .35); }
.est-perso-fantome.is-retrait { opacity: .6; border-color: #fca5a5; }
.est-perso-fantome.is-retrait::after { content: "−"; position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%;
    display: grid; place-items: center; background: #dc2626; color: #fff; font: 700 14px/1 system-ui, sans-serif; }
/* Pendant le glisser : une consigne en haut du tableau */
.est.is-perso-glisse .est-stage::after { content: "Lâchez sur le tableau pour créer une barre, ou sur une barre pour l’y ajouter";
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 15; padding: 8px 14px; border-radius: 999px;
    background: var(--primary); color: #fff; font: 600 .82rem/1.2 Inter, system-ui, sans-serif; white-space: nowrap;
    box-shadow: 0 10px 26px rgba(79, 70, 229, .35); pointer-events: none; }

/* Réglages d'une barre */
.est-perso__pop { position: absolute; z-index: 13; width: 244px; padding: 10px; background: #fff; border: 1px solid var(--border);
    border-radius: 13px; box-shadow: 0 16px 36px rgba(15, 23, 42, .24); }
.est-perso__pop-h { margin: 2px 2px 6px; font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-500); }
.est-perso__seg { display: flex; gap: 3px; padding: 3px; margin-bottom: 10px; background: var(--slate-100); border-radius: 10px; }
.est-perso__seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; border-radius: 8px;
    background: none; font: inherit; font-size: .8rem; font-weight: 600; color: var(--slate-600); cursor: pointer; }
.est-perso__seg button .est-ico { width: 18px; height: 18px; }
.est-perso__seg button[data-o="v"] .est-ico { transform: rotate(90deg); }
.est-perso__seg button.is-on { background: #fff; color: #4338ca; box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.est-perso__cols { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 2px 10px; }
.est-perso__cols button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--c); cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .18); }
.est-perso__cols button.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--slate-800); }
.est-perso__aide { margin: 0 2px 10px; font-size: .72rem; line-height: 1.4; color: var(--muted); }
.est-perso__suppr { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none;
    font: inherit; font-size: .84rem; font-weight: 600; color: #dc2626; cursor: pointer; }
.est-perso__suppr:hover { background: #fee2e2; }
.est-perso__suppr .est-ico { width: 18px; height: 18px; --est-ico-accent: #fecaca; }

/* Fenêtre « Mes barres d'outils » */
.est-persom__box { max-width: 640px; padding: 20px 24px 22px; }
.est-persom .modal__title { display: inline-flex; align-items: center; gap: 10px; }
.est-persom .modal__title .est-ico { width: 26px; height: 26px; }
.est-persom .modal__x .est-ico { width: 20px; height: 20px; }
.est-persom__lead { margin: 8px 0 4px; font-size: .88rem; line-height: 1.5; color: var(--slate-600); }
.est-persom__h { display: flex; align-items: center; gap: 8px; margin: 18px 0 9px; font-size: .7rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--slate-500); }
.est-persom__n { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px;
    background: var(--slate-100); color: var(--slate-700); font-size: .72rem; letter-spacing: 0; }
.est-persom__modeles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.est-persom__modele { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 11px 12px; text-align: left;
    border: 1px solid var(--border); border-left: 4px solid var(--perso); border-radius: 12px; background: #fff; cursor: pointer;
    font: inherit; color: var(--slate-800); transition: border-color .12s, box-shadow .12s, transform .12s; }
.est-persom__modele:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.est-persom__modele b { font-size: .9rem; }
.est-persom__ics { display: flex; flex-wrap: wrap; gap: 4px; }
.est-persom__ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--slate-50);
    border: 1px solid var(--slate-200); color: var(--slate-700); }
.est-persom__ic .est-ico { width: 17px; height: 17px; }
.est-persom__docks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.est-persom__docks .est-switch { margin-top: 0; }
.est-persom__note { margin: 8px 0 0; font-size: .76rem; color: var(--muted); }
.est-persom__liste { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.est-persom__liste li { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border: 1px solid var(--border);
    border-left: 4px solid var(--perso); border-radius: 11px; }
.est-persom__liste .est-persom__ics { flex: 1; }
.est-persom__x { flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px;
    background: none; color: var(--slate-500); cursor: pointer; }
.est-persom__x:hover { background: #fee2e2; color: #dc2626; }
.est-persom__x .est-ico { width: 18px; height: 18px; }
.est-persom__vide { margin: 0; font-size: .84rem; color: var(--muted); }
@media (max-width: 560px) { .est-persom__modeles, .est-persom__docks { grid-template-columns: 1fr; } }

/* Tableau sombre et contours francs */
.est.is-nuit .est-perso.is-teinte { background: color-mix(in srgb, var(--perso) 14%, #1e2935); border-color: color-mix(in srgb, var(--perso) 60%, #1e2935); }
.est.is-nuit .est-perso__menu { color: #94a3b8; }
.est.is-nuit .est-perso__menu:hover { background: #2f3f53; color: #e2e8f0; }
.est.is-nuit .est-perso__pop-h, .est.is-nuit .est-perso__aide { color: #94a3b8; }
.est.is-nuit .est-perso__seg { background: #263445; }
.est.is-nuit .est-perso__seg button { color: #cbd5e1; }
.est.is-nuit .est-perso__seg button.is-on { background: #e2e8f0; color: #0f172a; }
.est.is-contours .est-perso__pop { border: 2px solid var(--est-contour); }
.est.is-nuit .est-perso__pop { background: var(--est-nuit-surf); border-color: var(--est-nuit-bord); color: var(--est-nuit-txt); box-shadow: 0 16px 36px rgba(0, 0, 0, .5); }
/* Rayons du dock droit : des boutons un peu moins hauts que larges — treize outils de Calculs
 tiennent ainsi sans faire défiler le dock sur un écran de portable. */
.est-theme-tools .est-tool { aspect-ratio: auto; height: 46px; }
.est.is-nuit .est-kbdflash { background: rgba(241, 245, 249, .95); color: #0f172a; box-shadow: 0 10px 26px rgba(0, 0, 0, .45); }
.est.is-nuit .est-kbdflash kbd { background: #0f172a; color: #fff; box-shadow: none; }
/* Glisser un outil au doigt hors des menus (vers une barre personnelle) : le dock de gauche et la
 barre du bas ne défilent pas, le navigateur n'a donc rien à y faire du geste. */
#dock-left .est-tool, .est-bottombar .est-tool { touch-action: none; }

/* =========================================================================
   Cadenas (migration 106) — moteur js/cadenas-core.js, éditeur js/cadenas.js
   Une scène en perspective : le cadenas flotte, s'incline sous le pointeur, et son
   relief vient de trois plans empilés (face avant + deux tranches en translateZ).
   Les tambours des molettes sont de vrais cylindres CSS 3D.
   ========================================================================= */
.hm-hex--cadenas { background: linear-gradient(150deg, #fde68a 0%, #d4a234 46%, #7a4f0b 100%); }
.hm-hex--cadenas .hm-hex__ic svg { width: 54%; height: 54%; }

.cdn {
    --m1: #fff4c2; --m2: #e7b744; --m3: #a8741a; --m4: #5b3b07; --grav: rgba(84, 52, 4, .6);
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
    width: 100%; padding: 4px 2px 10px; -webkit-user-select: none; user-select: none;
}
.cdn[data-theme="argent"] { --m1: #ffffff; --m2: #d5dbe3; --m3: #8e9aaa; --m4: #4a5565; --grav: rgba(40, 48, 60, .55); }
.cdn[data-theme="cuivre"] { --m1: #ffd9bd; --m2: #dd8048; --m3: #9a4a1f; --m4: #582509; --grav: rgba(80, 30, 5, .6); }
.cdn[data-theme="rouge"]  { --m1: #ffb4b4; --m2: #ef4444; --m3: #a51c1c; --m4: #5a0a0a; --grav: rgba(70, 0, 0, .55); }
.cdn[data-theme="bleu"]   { --m1: #bad8ff; --m2: #3b82f6; --m3: #1e4fb0; --m4: #0c2459; --grav: rgba(8, 22, 66, .6); }
.cdn[data-theme="vert"]   { --m1: #bff6d3; --m2: #22c55e; --m3: #15803d; --m4: #0a4321; --grav: rgba(4, 50, 22, .6); }
.cdn[data-theme="violet"] { --m1: #e7d1ff; --m2: #a855f7; --m3: #6d28d9; --m4: #36126f; --grav: rgba(40, 10, 80, .6); }
.cdn[data-theme="noir"]   { --m1: #8b95a5; --m2: #3b4352; --m3: #1c222c; --m4: #07090d; --grav: rgba(255, 255, 255, .32); }
.cdn-vide { color: var(--slate-500); font-style: italic; }

/* --- Énigme ------------------------------------------------------------- */
.cdn-enonce {
    width: 100%; max-width: 760px; display: flex; gap: 14px; align-items: flex-start;
    padding: 14px 18px; border-radius: 16px; background: linear-gradient(180deg, #fffef8, #fff8e7);
    border: 1px solid #f3e1ad; box-shadow: 0 8px 20px -14px rgba(120, 80, 0, .45);
    -webkit-user-select: text; user-select: text;
}
.cdn-enonce__img { max-width: 40%; max-height: 260px; border-radius: 10px; object-fit: contain; cursor: zoom-in; }
.cdn-enonce__txt { flex: 1; min-width: 0; font-size: 1.04rem; }
.cdn-enonce__txt > :first-child { margin-top: 0; }
.cdn-enonce__txt > :last-child { margin-bottom: 0; }
@media (max-width: 560px) {
    .cdn-enonce { flex-direction: column; }
    .cdn-enonce__img { max-width: 100%; }
}

/* --- Scène 3D ------------------------------------------------------------- */
.cdn-scene {
    position: relative; width: 100%; display: flex; flex-direction: column; align-items: center;
    perspective: 1100px; padding: 10px 0 0;
}
/* align-items: flex-start est VITAL : étiré à la hauteur de .cdn-flotte (que le JS règle d'après
   la hauteur du cadenas), le cadenas se mesurait lui-même rétréci à chaque recalcul — vécu :
   1 px de haut après l'ouverture. */
.cdn-flotte { display: flex; align-items: flex-start; justify-content: center; transform-style: preserve-3d; animation: cdn-flotte 6s ease-in-out infinite; }
.cdn.is-anim-k .cdn-flotte { transition: height .7s cubic-bezier(.2, .9, .3, 1.1); }
/* L'anse ouverte monte d'un quart de sa hauteur : de l'air au-dessus, pour qu'elle ne morde
   pas sur l'énigme. */
.cdn-scene { transition: padding-top .5s ease; }
.cdn.is-open .cdn-scene { padding-top: 38px; }
@keyframes cdn-flotte { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.cdn-sol {
    width: 58%; max-width: 300px; height: 22px; margin-top: 4px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(15, 23, 42, .32), rgba(15, 23, 42, 0));
    animation: cdn-ombre 6s ease-in-out infinite;
}
@keyframes cdn-ombre { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.9); opacity: .75; } }
.cdn-lock {
    --k: 1; --rx: 0deg; --ry: 0deg;
    position: relative; display: inline-flex; flex-direction: column; align-items: center; flex: none;
    transform-style: preserve-3d; transform-origin: 50% 0;
    transform: scale(var(--k)) rotateX(var(--rx)) rotateY(var(--ry));
}
.cdn.is-anim-k .cdn-lock { transition: transform .7s cubic-bezier(.2, .9, .3, 1.1); }
.cdn.is-drag, .cdn.is-drag * { cursor: grabbing !important; }

/* L'anse : tube d'acier, derrière le corps (translateZ), jambes enfoncées dans le corps. */
.cdn-anse {
    position: relative; z-index: 0; width: min(58%, 190px); min-width: 100px; aspect-ratio: 120 / 104;
    margin-bottom: -32px; transform: translateZ(-14px); transform-origin: 15% 100%;
    transition: transform .25s ease;
}
.cdn:not(.cdn--reglage):not(.is-open) .cdn-anse { cursor: pointer; }
.cdn:not(.cdn--reglage):not(.is-open) .cdn-anse:hover { transform: translateZ(-14px) translateY(-3px); }
.cdn-anse svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cdn-anse path { fill: none; }
.cdn-anse__t1 { stroke: #3f4753; stroke-width: 19; }
.cdn-anse__t2 { stroke: #8892a0; stroke-width: 15; }
.cdn-anse__t3 { stroke: #c8d0da; stroke-width: 9.5; }
.cdn-anse__t4 { stroke: #fbfdff; stroke-width: 3.2; opacity: .9; }
.cdn-anse.is-tire { animation: cdn-tire .38s ease-out; }
@keyframes cdn-tire {
    0%, 100% { transform: translateZ(-14px) translateY(0); }
    45% { transform: translateZ(-14px) translateY(-8%); }
    70% { transform: translateZ(-14px) translateY(1%); }
}
.cdn.is-open .cdn-anse { animation: cdn-anse-ouvre 1.15s cubic-bezier(.22, .8, .25, 1) forwards; }
.cdn.is-instant .cdn-anse { animation: none; transform: translateZ(-14px) translateY(-26%) rotateY(-150deg); }
@keyframes cdn-anse-ouvre {
    0% { transform: translateZ(-14px); }
    28% { transform: translateZ(-14px) translateY(-32%); }
    40% { transform: translateZ(-14px) translateY(-25%); }
    100% { transform: translateZ(-14px) translateY(-26%) rotateY(-150deg); }
}

/* Le corps : face métallique + deux tranches qui font l'épaisseur quand il s'incline. */
.cdn-corps {
    position: relative; z-index: 1; transform-style: preserve-3d; min-width: 230px;
    padding: 24px 22px 32px; border-radius: 26px 26px 34px 34px;
    background:
        radial-gradient(120% 70% at 28% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%),
        linear-gradient(165deg, var(--m1) 0%, var(--m2) 30%, var(--m3) 78%, var(--m4) 100%);
    box-shadow:
        inset 0 2px 1px rgba(255, 255, 255, .7), inset 0 -5px 12px rgba(0, 0, 0, .3),
        inset 4px 0 8px rgba(255, 255, 255, .16), inset -4px 0 8px rgba(0, 0, 0, .14),
        0 28px 44px -20px rgba(15, 23, 42, .6);
    transition: box-shadow .4s ease;
}
.cdn-corps::before, .cdn-corps::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(165deg, var(--m3), var(--m4));
}
.cdn-corps::before { transform: translateZ(-8px); }
.cdn-corps::after { transform: translateZ(-16px); background: var(--m4); }
.cdn-plaque {
    position: relative; padding: 14px; border-radius: 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .26), rgba(0, 0, 0, .1));
    box-shadow: inset 0 3px 9px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(255, 255, 255, .35), 0 1px 0 rgba(255, 255, 255, .45);
    transition: box-shadow .25s, filter .25s;
}
.cdn-marque {
    position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; pointer-events: none;
    font: 700 .56rem/1 'Space Grotesk', system-ui, sans-serif; letter-spacing: .34em;
    color: var(--grav); text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
}
.cdn-led {
    position: absolute; top: 10px; right: 14px; width: 11px; height: 11px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0 15%, #94a3b8 42%, #475569);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .2); transition: background .2s, box-shadow .2s;
}
.cdn-led[data-n]::after {
    content: attr(data-n) ' s'; position: absolute; right: 16px; top: -3px; white-space: nowrap;
    font: 800 .68rem/1 'Space Grotesk', system-ui, sans-serif; color: #fff;
    background: rgba(146, 64, 14, .9); padding: 3px 6px; border-radius: 999px;
}
.cdn.is-err .cdn-led { background: radial-gradient(circle at 35% 30%, #fff 0 15%, #f87171 42%, #b91c1c); box-shadow: 0 0 12px #ef4444; }
.cdn.is-attente .cdn-led { background: radial-gradient(circle at 35% 30%, #fff 0 15%, #fbbf24 42%, #b45309); animation: cdn-clignote 1s infinite; }
.cdn.is-open .cdn-led { background: radial-gradient(circle at 35% 30%, #fff 0 15%, #4ade80 42%, #15803d); box-shadow: 0 0 14px #22c55e; }
.cdn.is-err .cdn-plaque { box-shadow: inset 0 3px 9px rgba(0, 0, 0, .5), 0 0 0 2px rgba(239, 68, 68, .55), 0 0 20px rgba(239, 68, 68, .4); }
.cdn.is-open .cdn-corps {
    box-shadow:
        inset 0 2px 1px rgba(255, 255, 255, .7), inset 0 -5px 12px rgba(0, 0, 0, .3),
        0 0 0 3px rgba(34, 197, 94, .35), 0 0 46px rgba(34, 197, 94, .45), 0 28px 44px -20px rgba(15, 23, 42, .6);
}
.cdn.is-bloque .cdn-plaque, .cdn.is-bloque .cdn-porte > .cdn-cof { filter: grayscale(.7) brightness(.85); pointer-events: none; }
.cdn.is-faux .cdn-flotte { animation: cdn-secoue .55s ease; }
@keyframes cdn-secoue {
    0%, 100% { transform: none; }
    15% { transform: translateX(-10px) rotateZ(-2.2deg); }
    30% { transform: translateX(9px) rotateZ(1.8deg); }
    45% { transform: translateX(-6px) rotateZ(-1deg); }
    60% { transform: translateX(4px); }
    80% { transform: translateX(-2px); }
}
@keyframes cdn-clignote { 50% { opacity: .45; } }
@keyframes cdn-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes cdn-presse { 0% { transform: translateY(0); } 40% { transform: translateY(3px); } 100% { transform: translateY(0); } }
@keyframes cdn-entre { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cdn-pulse { 0%, 100% { box-shadow: inset 0 0 0 1px #fcd34d, 0 0 0 0 rgba(250, 204, 21, .6); } 60% { box-shadow: inset 0 0 0 1px #fcd34d, 0 0 0 10px rgba(250, 204, 21, 0); } }

/* --- Molettes ----------------------------------------------------------- */
.cdn-molettes { display: flex; gap: 8px; }
.cdn-roue { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.cdn-roue__fl {
    width: 42px; height: 22px; border: 0; border-radius: 8px; padding: 0; display: grid; place-items: center;
    background: rgba(255, 255, 255, .2); color: rgba(255, 255, 255, .95); cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); transition: background .12s, transform .08s;
}
.cdn-roue__fl:hover { background: rgba(255, 255, 255, .34); }
.cdn-roue__fl:active { transform: translateY(1px); }
.cdn-roue__fl svg { width: 15px; height: 15px; }
.cdn-roue__fl--b svg { transform: rotate(180deg); }
.cdn-roue__fen {
    position: relative; width: 48px; height: 134px; overflow: hidden; border-radius: 12px;
    perspective: 520px; cursor: grab; touch-action: none; outline: none; background: #0b1120;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .35);
}
.cdn-roue__fen:focus-visible { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), 0 0 0 3px #fde047; }
.cdn-roue__fen::before {
    content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 25px); height: 50px; z-index: 2; pointer-events: none;
    border-top: 1px solid rgba(253, 230, 138, .35); border-bottom: 1px solid rgba(253, 230, 138, .35);
}
.cdn-roue__fen::after {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .16) 33%, rgba(255, 255, 255, .1) 46%,
        rgba(0, 0, 0, .1) 62%, rgba(0, 0, 0, .84) 100%);
}
.cdn-roue__tambour { position: absolute; left: 0; right: 0; top: calc(50% - 24px); height: 48px; transform-style: preserve-3d; }
.cdn-roue__face {
    position: absolute; left: 0; right: 0; top: 0; display: grid; place-items: center;
    font: 800 1.85rem/1 'Space Grotesk', system-ui, sans-serif; font-variant-numeric: tabular-nums;
    color: #f1f5f9; text-shadow: 0 2px 0 rgba(0, 0, 0, .65);
    background: linear-gradient(180deg, #303a4d, #1d2533 50%, #303a4d);
    border-top: 1px solid rgba(255, 255, 255, .07); backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.cdn--lettres .cdn-roue__face { font-size: 1.6rem; }
.cdn-roue__face.is-on { color: #fde68a; }
.cdn.is-open .cdn-roue__face.is-on { color: #86efac; }

/* --- Digicode ----------------------------------------------------------- */
.cdn-digi { display: flex; flex-direction: column; gap: 10px; width: 236px; outline: none; border-radius: 12px; }
.cdn-digi:focus-visible { box-shadow: 0 0 0 3px #fde047; }
.cdn-digi__ecran {
    height: 48px; padding: 0 12px; border-radius: 10px; overflow: hidden; white-space: nowrap; text-align: right;
    background: linear-gradient(180deg, #9db58a, #c9dcaa); color: #1d2b12;
    box-shadow: inset 0 3px 9px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .4);
    font: 700 1.55rem/48px 'Courier New', Courier, monospace; letter-spacing: .12em;
}
.cdn-digi__cur { display: inline-block; width: 2px; height: 1.2em; margin-left: 2px; vertical-align: -.2em; background: #1d2b12; animation: cdn-clignote 1s steps(1) infinite; }
.cdn-digi__ecran.is-vide .cdn-digi__txt::before { content: '— — — —'; opacity: .35; letter-spacing: .04em; }
.cdn-digi__pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cdn-touche {
    height: 46px; border: 0; border-radius: 11px; cursor: pointer; color: #1e293b;
    font: 700 1.25rem/1 'Space Grotesk', system-ui, sans-serif;
    background: linear-gradient(180deg, #ffffff, #dde3ea);
    box-shadow: 0 4px 0 #94a3b8, 0 7px 12px rgba(0, 0, 0, .28), inset 0 1px 0 #fff;
    transition: transform .06s, box-shadow .06s;
}
.cdn-touche:active, .cdn-touche.is-presse { transform: translateY(3px); box-shadow: 0 1px 0 #94a3b8, 0 2px 5px rgba(0, 0, 0, .25), inset 0 1px 0 #fff; }
.cdn-touche.is-presse { animation: cdn-presse .16s; }
.cdn-touche--ok { grid-column: span 2; color: #fff; font-size: 1rem; letter-spacing: .08em; background: linear-gradient(180deg, #4ade80, #16a34a); box-shadow: 0 4px 0 #166534, 0 7px 12px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .5); }
.cdn-touche--ok:active, .cdn-touche--ok.is-presse { box-shadow: 0 1px 0 #166534; }
.cdn-touche--ok:disabled { filter: grayscale(1); opacity: .5; cursor: default; }
.cdn-touche--x { color: #7f1d1d; background: linear-gradient(180deg, #fee2e2, #fca5a5); box-shadow: 0 4px 0 #dc2626, 0 7px 12px rgba(0, 0, 0, .25), inset 0 1px 0 #fff; }
.cdn-touche--x:active, .cdn-touche--x.is-presse { box-shadow: 0 1px 0 #dc2626; }

/* --- Mot de passe ------------------------------------------------------- */
.cdn-mdp {
    display: flex; align-items: center; gap: 8px; width: min(340px, 74vw); padding: 6px 12px; border-radius: 12px;
    background: #0b1120; box-shadow: inset 0 3px 9px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .35);
}
.cdn-mdp__ic { display: grid; color: #fde68a; }
.cdn-mdp__ic svg { width: 24px; height: 24px; }
.cdn-mdp__champ {
    flex: 1; min-width: 0; border: 0; background: transparent; color: #e2e8f0; outline: none; padding: 9px 4px;
    font: 600 1.15rem/1.2 'Space Grotesk', system-ui, sans-serif; letter-spacing: .03em; caret-color: #fde68a;
    -webkit-user-select: text; user-select: text;
}
.cdn-mdp__champ::placeholder { color: #64748b; }

/* --- Directions --------------------------------------------------------- */
.cdn-dir { display: flex; flex-direction: column; align-items: center; gap: 12px; outline: none; border-radius: 14px; }
.cdn-dir:focus-visible { box-shadow: 0 0 0 3px #fde047; }
.cdn-dir__suite {
    min-height: 34px; width: 236px; display: flex; gap: 4px; overflow-x: auto; padding: 5px 8px; border-radius: 10px;
    background: #0b1120; box-shadow: inset 0 2px 7px rgba(0, 0, 0, .65); scrollbar-width: none;
}
.cdn-dir__suite::-webkit-scrollbar { display: none; }
.cdn-dir__puce { flex: 0 0 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: #1e293b; color: #fde68a; }
.cdn-dir__puce > span { display: grid; }
.cdn-dir__puce svg { width: 16px; height: 16px; }
.cdn-dir__puce.is-new { animation: cdn-pop .25s ease-out; }
.cdn-dir__vide { color: #64748b; font-size: .78rem; line-height: 24px; padding: 0 4px; white-space: nowrap; }
.cdn-dir__pad { perspective: 420px; }
.cdn-dir__croix {
    position: relative; width: 172px; height: 172px; border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, #3b4556, #111827 70%);
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, .22), 0 10px 18px rgba(0, 0, 0, .45);
    transform-style: preserve-3d; transition: transform .17s cubic-bezier(.3, 1.5, .5, 1);
}
.cdn-dir__croix.is-H { transform: rotateX(16deg); }
.cdn-dir__croix.is-B { transform: rotateX(-16deg); }
.cdn-dir__croix.is-G { transform: rotateY(-16deg); }
.cdn-dir__croix.is-D { transform: rotateY(16deg); }
.cdn-dir__b {
    position: absolute; width: 54px; height: 54px; border: 0; border-radius: 14px; padding: 0; display: grid; place-items: center; cursor: pointer;
    color: #1e293b; background: linear-gradient(180deg, #f8fafc, #cbd5e1);
    box-shadow: 0 4px 0 #64748b, 0 7px 12px rgba(0, 0, 0, .4), inset 0 1px 0 #fff; transition: transform .06s, box-shadow .06s;
}
.cdn-dir__b:active { transform: translateY(3px); box-shadow: 0 1px 0 #64748b, 0 2px 4px rgba(0, 0, 0, .35); }
.cdn-dir__b > span { display: grid; }
.cdn-dir__b svg { width: 26px; height: 26px; }
.cdn-dir__b--H { top: 8px; left: calc(50% - 27px); }
.cdn-dir__b--B { bottom: 8px; left: calc(50% - 27px); }
.cdn-dir__b--G { left: 8px; top: calc(50% - 27px); }
.cdn-dir__b--D { right: 8px; top: calc(50% - 27px); }
.cdn-dir__moyeu {
    position: absolute; left: calc(50% - 19px); top: calc(50% - 19px); width: 38px; height: 38px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #cbd5e1, #334155); box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .4);
}

/* --- Couleurs ----------------------------------------------------------- */
.cdn-coul { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cdn-coul__rang { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 360px; perspective: 500px; }
.cdn-pion {
    --pion: #94a3b8; width: 58px; height: 58px; border: 0; padding: 0; border-radius: 50%; cursor: pointer;
    display: grid; place-items: center; background: #111827; transform-style: preserve-3d;
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 255, 255, .35);
}
.cdn-pion:focus-visible { outline: 3px solid #fde047; outline-offset: 3px; }
.cdn-pion__face {
    width: 46px; height: 46px; border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .85) 0 11%, rgba(255, 255, 255, 0) 32%), var(--pion);
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .85) 0 11%, rgba(255, 255, 255, 0) 32%),
                radial-gradient(circle at 50% 62%, var(--pion), color-mix(in srgb, var(--pion) 58%, #000) 96%);
    box-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 7px 12px rgba(0, 0, 0, .45);
}
.cdn-pion.is-eteint .cdn-pion__face { opacity: .5; }
.cdn-pion.is-tourne .cdn-pion__face { animation: cdn-tourne .28s ease-in-out; }
@keyframes cdn-tourne { 50% { transform: rotateY(90deg) scale(.9); } }
.cdn-coul__legende { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 10px; max-width: 340px; font-size: .72rem; font-weight: 600; color: rgba(255, 255, 255, .9); text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }
.cdn-coul__l i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }

/* --- Schéma ------------------------------------------------------------- */
.cdn-sch__zone {
    position: relative; width: 216px; height: 216px; border-radius: 18px; touch-action: none; cursor: crosshair; outline: none;
    background: radial-gradient(circle at 50% 38%, #1e293b, #0b1120);
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 255, 255, .35);
}
.cdn-sch__zone:focus-visible { box-shadow: inset 0 3px 10px rgba(0, 0, 0, .75), 0 0 0 3px #fde047; }
.cdn-sch__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cdn-sch__trace { fill: none; stroke: #38bdf8; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(56, 189, 248, .85)); transition: stroke .2s; }
.cdn-sch__fil { stroke: rgba(56, 189, 248, .55); stroke-width: 6; stroke-linecap: round; opacity: 0; }
.cdn-sch__fil.is-on { opacity: 1; }
.cdn-sch__pt { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; display: grid; place-items: center; pointer-events: none; }
.cdn-sch__pt i {
    width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #94a3b8);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, .2); transition: transform .15s, box-shadow .15s, background .15s;
}
.cdn-sch__pt.is-on i { transform: scale(1.35); background: radial-gradient(circle at 35% 30%, #fff, #38bdf8); box-shadow: 0 0 0 6px rgba(56, 189, 248, .25), 0 0 16px rgba(56, 189, 248, .95); }
.cdn--reglage .cdn-sch__pt.is-on::after { content: attr(data-rang); position: absolute; top: -2px; right: 0; font: 800 .72rem/1 system-ui, sans-serif; color: #fde68a; }
.cdn-sch__zone.is-faux .cdn-sch__trace { stroke: #ef4444; filter: drop-shadow(0 0 6px rgba(239, 68, 68, .85)); }
.cdn-sch__zone.is-faux .cdn-sch__pt.is-on i { background: radial-gradient(circle at 35% 30%, #fff, #ef4444); box-shadow: 0 0 16px rgba(239, 68, 68, .95); }
.cdn.is-open .cdn-sch__trace { stroke: #4ade80; filter: drop-shadow(0 0 6px rgba(74, 222, 128, .9)); }

/* --- Interrupteurs ------------------------------------------------------ */
.cdn-int { display: grid; grid-template-columns: repeat(var(--cdn-n), 50px); gap: 12px 8px; justify-content: center; }
.cdn-bascule {
    display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; padding: 2px; background: none; cursor: pointer;
    color: rgba(255, 255, 255, .92); font: 800 .72rem/1 'Space Grotesk', system-ui, sans-serif; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); border-radius: 10px;
}
.cdn-bascule:focus-visible { outline: 3px solid #fde047; }
.cdn-bascule__led { width: 10px; height: 10px; border-radius: 50%; background: #422006; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8); transition: background .15s, box-shadow .15s; }
.cdn-bascule.is-on .cdn-bascule__led { background: #fde047; box-shadow: 0 0 10px #facc15, inset 0 0 2px #fff; }
.cdn-bascule__socle {
    position: relative; width: 38px; height: 66px; border-radius: 9px; perspective: 200px;
    background: linear-gradient(180deg, #0b1120, #1e293b); box-shadow: inset 0 2px 7px rgba(0, 0, 0, .85), 0 1px 0 rgba(255, 255, 255, .35);
}
.cdn-bascule__levier {
    position: absolute; left: 5px; right: 5px; top: 6px; bottom: 6px; border-radius: 6px;
    background: linear-gradient(180deg, #cbd5e1 0%, #f8fafc 18%, #94a3b8 50%, #64748b 52%, #cbd5e1 100%);
    transform: rotateX(-24deg); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background .2s;
    box-shadow: 0 6px 8px rgba(0, 0, 0, .4);
}
.cdn-bascule.is-on .cdn-bascule__levier {
    transform: rotateX(24deg);
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 48%, #64748b 50%, #f8fafc 82%, #cbd5e1 100%);
    box-shadow: 0 -6px 8px rgba(0, 0, 0, .4);
}
/* Témoin sur le levier : gris en bas quand il est éteint, vert lumineux en haut une fois
   basculé — l'état se lit d'un coup d'œil, même sur un écran projeté. */
.cdn-bascule__levier::before {
    content: ''; position: absolute; left: 5px; right: 5px; bottom: 5px; height: 7px; border-radius: 4px;
    background: #64748b; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); transition: background .2s, box-shadow .2s;
}
.cdn-bascule.is-on .cdn-bascule__levier::before {
    top: 5px; bottom: auto; background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, .9), inset 0 1px 1px rgba(255, 255, 255, .6);
}

/* --- Coffre-fort -------------------------------------------------------- */
.cdn-corps--coffre {
    padding: 16px; border-radius: 20px; min-width: 300px;
    background:
        radial-gradient(circle at 14px 14px, #9ca3af 0 3px, transparent 4px),
        radial-gradient(circle at calc(100% - 14px) 14px, #9ca3af 0 3px, transparent 4px),
        radial-gradient(circle at 14px calc(100% - 14px), #9ca3af 0 3px, transparent 4px),
        radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), #9ca3af 0 3px, transparent 4px),
        linear-gradient(160deg, #4b5563, #1f2937 60%, #0b0f17);
}
.cdn-corps--coffre::before, .cdn-corps--coffre::after { background: #0b0f17; }
.cdn-coffre__interieur {
    position: absolute; inset: 16px; border-radius: 12px; opacity: 0; transition: opacity .4s .2s;
    background: radial-gradient(circle at 50% 45%, #fffbe6 0, #facc15 22%, #b45309 55%, #1c1003 85%);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, .85);
}
.cdn.is-open .cdn-coffre__interieur { opacity: 1; animation: cdn-eclat 2.4s ease-in-out infinite alternate; }
@keyframes cdn-eclat { from { filter: brightness(1); } to { filter: brightness(1.25); } }
.cdn-porte {
    position: relative; padding: 16px 30px 16px 22px; border-radius: 12px; transform-origin: 0 50%; transform-style: preserve-3d;
    background:
        radial-gradient(120% 70% at 25% 0%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
        linear-gradient(165deg, var(--m1), var(--m2) 30%, var(--m3) 80%, var(--m4));
    box-shadow: inset 0 2px 1px rgba(255, 255, 255, .6), inset 0 -4px 10px rgba(0, 0, 0, .35), 0 6px 16px rgba(0, 0, 0, .5);
    transition: transform 1.25s cubic-bezier(.3, .85, .3, 1);
}
.cdn.is-open .cdn-porte { transform: rotateY(-104deg); }
.cdn.is-instant .cdn-porte { transition: none; }
.cdn-porte__charniere {
    position: absolute; left: -7px; top: 16%; height: 68%; width: 10px; border-radius: 4px;
    background: repeating-linear-gradient(180deg, #d1d5db 0 22px, #4b5563 22px 26px);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
}
.cdn-porte__poignee {
    position: absolute; right: 8px; top: calc(50% - 30px); width: 12px; height: 60px; border-radius: 6px;
    background: linear-gradient(90deg, #6b7280, #f3f4f6 40%, #9ca3af); box-shadow: 0 3px 6px rgba(0, 0, 0, .45);
}
.cdn-cof { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cdn-cof__cases { display: flex; gap: 6px; }
.cdn-cof__case {
    min-width: 42px; height: 34px; padding: 0 4px; border-radius: 8px; text-align: center; background: #0b1120; color: #4ade80;
    font: 700 1.2rem/34px 'Courier New', Courier, monospace; box-shadow: inset 0 2px 7px rgba(0, 0, 0, .75);
}
.cdn-cof__case.is-courante { box-shadow: inset 0 2px 7px rgba(0, 0, 0, .75), 0 0 0 2px rgba(74, 222, 128, .55); }
.cdn-cof__case.is-pleine { animation: cdn-pop .25s ease-out; }
.cdn-cof__cadran { position: relative; width: 224px; height: 224px; border-radius: 50%; cursor: grab; touch-action: none; outline: none; }
.cdn-cof__cadran:focus-visible { box-shadow: 0 0 0 3px #fde047; }
.cdn-cof__cadran::after {
    content: ''; position: absolute; inset: 4px; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 46%);
}
.cdn-cof__svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }
.cdn-cof__disque { transform-box: view-box; transform-origin: 0 0; }
.cdn-cof__bord { fill: #111827; stroke: #6b7280; stroke-width: 2; }
.cdn-cof__fond { fill: #e5e7eb; }
.cdn-cof__gr { stroke: #475569; stroke-width: 1.3; }
.cdn-cof__gr.is-maj { stroke: #0f172a; stroke-width: 2.6; }
.cdn-cof__nb { font: 700 13px 'Space Grotesk', system-ui, sans-serif; fill: #0f172a; text-anchor: middle; dominant-baseline: central; }
.cdn-cof__repere { fill: #ef4444; stroke: #7f1d1d; stroke-width: 1; }
.cdn-cof__bouton {
    position: absolute; left: calc(50% - 31px); top: calc(50% - 31px); width: 62px; height: 62px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; z-index: 1;
    background: radial-gradient(circle at 35% 30%, #f8fafc, #94a3b8 55%, #475569);
    box-shadow: 0 4px 0 #334155, 0 9px 14px rgba(0, 0, 0, .5), inset 0 2px 1px rgba(255, 255, 255, .8);
}
.cdn-cof__bouton span { display: block; margin: 11px; height: 40px; border-radius: 50%; background: repeating-conic-gradient(rgba(0, 0, 0, .14) 0 6deg, rgba(255, 255, 255, .14) 6deg 12deg); }
.cdn-cof__bouton.is-presse { animation: cdn-presse .2s; }
.cdn-cof__ctrl { display: flex; align-items: center; gap: 10px; }
.cdn-cof__tour { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(15, 23, 42, .4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.cdn-cof__tour:hover { background: rgba(15, 23, 42, .58); }
.cdn-cof__tour svg { width: 22px; height: 22px; }
.cdn-cof__lecture { min-width: 66px; height: 40px; border-radius: 10px; text-align: center; background: #0b1120; color: #fde68a; font: 800 1.5rem/40px 'Space Grotesk', system-ui, sans-serif; box-shadow: inset 0 2px 7px rgba(0, 0, 0, .75); }
.cdn-cof__entrer { border: 0; border-radius: 999px; padding: 7px 16px; cursor: pointer; color: #fff; font: 700 .85rem/1.2 'Inter', system-ui, sans-serif; background: rgba(15, 23, 42, .5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.cdn-cof__entrer:hover { background: rgba(15, 23, 42, .68); }

/* --- Barre d'actions, messages, indice ---------------------------------- */
.cdn-barre { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.cdn-btn {
    display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer;
    font: 700 .92rem/1.2 'Inter', system-ui, sans-serif; transition: transform .12s, box-shadow .12s, background .12s, filter .12s;
}
.cdn-btn[hidden] { display: none !important; }
.cdn-btn svg { width: 18px; height: 18px; flex: none; }
.cdn-btn--ouvrir { color: #fff; background: linear-gradient(180deg, #6366f1, #4338ca); box-shadow: 0 4px 0 #312e81, 0 9px 18px rgba(67, 56, 202, .35); padding: 10px 24px; font-size: 1rem; }
.cdn-btn--ouvrir:hover { transform: translateY(-1px); }
.cdn-btn--ouvrir:active { transform: translateY(3px); box-shadow: 0 1px 0 #312e81; }
.cdn-btn--ouvrir:disabled { filter: grayscale(.7); opacity: .6; cursor: not-allowed; transform: none; }
.cdn.is-busy .cdn-btn--ouvrir { filter: brightness(1.1); }
.cdn-btn--ghost { background: var(--slate-100); color: var(--slate-700); box-shadow: inset 0 0 0 1px var(--slate-300); }
.cdn-btn--ghost:hover { background: var(--slate-200); }
.cdn-btn--indice { background: #fef3c7; color: #92400e; box-shadow: inset 0 0 0 1px #fcd34d; }
.cdn-btn--indice.is-neuf { animation: cdn-pulse 1.4s 3; }
.cdn-btn--son { width: 40px; height: 40px; padding: 0; justify-content: center; background: var(--slate-100); color: var(--slate-500); }
.cdn-btn--son[aria-pressed="true"] { color: var(--primary); }
.cdn-msg { min-height: 1.35em; margin: 0; text-align: center; font-weight: 600; font-size: .94rem; color: var(--slate-600); }
.cdn-msg--err { color: #b91c1c; }
.cdn-msg--ok { color: #15803d; font-size: 1.05rem; }
.cdn-msg--attente { color: #b45309; }
.cdn-indice { width: 100%; max-width: 560px; padding: 10px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; animation: cdn-entre .3s ease-out; -webkit-user-select: text; user-select: text; }
.cdn-indice__t { display: block; margin-bottom: 2px; font: 800 .72rem/1.2 'Space Grotesk', system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #92400e; }
.cdn-indice__txt > :first-child { margin-top: 0; }
.cdn-indice__txt > :last-child { margin-bottom: 0; }

/* --- Contenus révélés --------------------------------------------------- */
.cdn-tresor { width: 100%; max-width: 780px; -webkit-user-select: text; user-select: text; }
.cdn-tresor__carte {
    position: relative; overflow: hidden; padding: 18px 20px 20px; border-radius: 18px;
    background: linear-gradient(180deg, #fffdf3, #ffffff 60%); border: 1px solid #f1dfa3;
    box-shadow: 0 20px 44px -18px rgba(146, 64, 14, .4), 0 0 0 4px rgba(250, 204, 21, .14);
    animation: cdn-tresor .65s cubic-bezier(.2, 1.15, .3, 1) both;
}
.cdn-tresor__carte::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .85) 50%, transparent 70%);
    transform: translateX(-100%); animation: cdn-reflet 1.3s .35s ease-out forwards;
}
@keyframes cdn-tresor { from { opacity: 0; transform: perspective(900px) rotateX(-20deg) translateY(22px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes cdn-reflet { to { transform: translateX(100%); } }
.cdn-tresor__titre { font: 800 .78rem/1.2 'Space Grotesk', system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase; color: #a16207; }
.cdn-tresor__vide { margin: 10px 0 0; color: var(--slate-600); }
.cdn-item { margin-top: 12px; animation: cdn-entre .45s ease-out both; animation-delay: calc(.2s + var(--i, 0) * .12s); }
.cdn-item .prose > :first-child { margin-top: 0; }
.cdn-item .prose > :last-child { margin-bottom: 0; }
.cdn-lien {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; text-decoration: none;
    background: #eef2ff; color: #3730a3; font-weight: 700; box-shadow: inset 0 0 0 1px #c7d2fe; transition: background .12s, transform .12s;
}
.cdn-lien:hover { background: #e0e7ff; transform: translateY(-1px); }
.cdn-lien__u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: .8rem; color: #6366f1; }
.cdn-image { margin: 0; text-align: center; }
.cdn-image img { max-width: 100%; max-height: 70vh; border-radius: 12px; box-shadow: 0 10px 24px rgba(0, 0, 0, .18); cursor: zoom-in; }
.cdn-image figcaption { margin-top: 6px; font-size: .86rem; color: var(--slate-500); }
.cdn-doc {
    display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; text-decoration: none; color: inherit;
    background: linear-gradient(135deg, #f0fdf4, #ecfeff); box-shadow: inset 0 0 0 1px #a7f3d0; transition: transform .15s, box-shadow .15s;
}
.cdn-doc:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px #6ee7b7, 0 10px 18px -10px rgba(4, 120, 87, .5); }
.cdn-doc__hex {
    flex: none; width: 54px; height: 47px; display: grid; place-items: center; color: #fff; font-size: 1.3rem;
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: linear-gradient(150deg, #34d399, #059669);
}
.cdn-doc--cadenas .cdn-doc__hex { background: linear-gradient(150deg, #fde68a, #b7791f); }
.cdn-doc__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cdn-doc__type { font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #047857; }
.cdn-doc__titre { font-weight: 700; color: var(--slate-800); }
.cdn-doc__go { font-weight: 800; color: #047857; white-space: nowrap; }
.cdn-zoom { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(15, 23, 42, .88); cursor: zoom-out; }
.cdn-zoom img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }
.cdn-confettis { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* Mouvements réduits : rien ne flotte, rien ne tremble, l'anse s'ouvre sans cabriole. */
.cdn--calme .cdn-flotte, .cdn--calme .cdn-sol, .cdn--calme.is-faux .cdn-flotte { animation: none; }
.cdn--calme.is-open .cdn-anse { animation: none; transform: translateZ(-14px) translateY(-26%); }
.cdn--calme .cdn-tresor__carte, .cdn--calme .cdn-item, .cdn--calme .cdn-tresor__carte::before { animation: none; }
.cdn--calme .cdn-porte { transition: none; }

/* --- Éditeur de l'enseignant (js/cadenas.js) ------------------------------ */
.modal__box--cadenas { max-width: 980px; width: 96vw; }
.cdm { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cdm-sec { padding: 14px 0 12px; border-top: 1px solid var(--slate-200); }
.cdm-h { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font: 700 1rem/1.2 'Space Grotesk', system-ui, sans-serif; color: var(--slate-800); }
.cdm-h > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; color: #fff; background: linear-gradient(150deg, #f59e0b, #b45309); }
.cdm-h small { font-weight: 500; color: var(--slate-500); }
.cdm-aide { margin: -2px 0 10px; color: var(--slate-600); font-size: .9rem; }
.cdm-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.cdm-type {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 9px; border-radius: 14px; cursor: pointer;
    border: 1px solid var(--slate-200); background: #fff; color: var(--slate-600); font: 600 .78rem/1.15 'Inter', system-ui, sans-serif;
    transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.cdm-type svg { width: 30px; height: 30px; }
.cdm-type:hover { border-color: #fcd34d; transform: translateY(-2px); }
.cdm-type.is-on { border-color: #d97706; background: linear-gradient(180deg, #fffbeb, #fef3c7); color: #92400e; box-shadow: 0 6px 14px -8px rgba(180, 83, 9, .6); }
.cdm-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 8px; }
.cdm-opts:empty { display: none; }
.cdm-champ { display: flex; flex-direction: column; gap: 4px; }
.cdm-champ--inline .field__input { width: auto; min-width: 90px; }
.cdm-champ--check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: .88rem; color: var(--slate-700); cursor: pointer; }
.cdm-cases { display: flex; gap: 6px; }
.cdm-cases .field__input { width: 74px; }
.cdm-reponses { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; max-width: 520px; }
.cdm-reponse { display: flex; gap: 6px; align-items: center; width: 100%; }
.cdm-x, .cdm-mini { border: 0; border-radius: 8px; padding: 4px 8px; cursor: pointer; background: var(--slate-100); color: var(--slate-600); font-weight: 700; }
.cdm-x:hover, .cdm-mini:hover { background: var(--slate-200); }
.cdm-mini:disabled { opacity: .35; cursor: default; }
.cdm-mini--x:hover { background: #fee2e2; color: #b91c1c; }
.cdm-vivant {
    padding: 14px 8px 6px; border-radius: 18px;
    background: radial-gradient(120% 90% at 50% 0%, #f8fafc, #e2e8f0); box-shadow: inset 0 0 0 1px var(--slate-200);
}
.cdm-code { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #ecfdf5; color: #065f46; font-size: .92rem; box-shadow: inset 0 0 0 1px #a7f3d0; }
.cdm-code strong { font-weight: 800; letter-spacing: .02em; }
.cdm-code.is-vide { background: #fff7ed; color: #9a3412; box-shadow: inset 0 0 0 1px #fed7aa; }
.cdm-pastille { display: inline-block; width: 11px; height: 11px; margin: 0 4px 0 2px; border-radius: 50%; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.cdm-rte { display: flex; flex-direction: column; }
.cdm-img { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.cdm-img__apercu { max-width: 220px; max-height: 140px; border-radius: 10px; object-fit: contain; box-shadow: 0 0 0 1px var(--slate-200); }
.cdm-liste { display: flex; flex-direction: column; gap: 10px; }
.cdm-item { border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--slate-200), 0 4px 10px -8px rgba(15, 23, 42, .3); overflow: hidden; }
.cdm-item__tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px 7px 14px; background: var(--slate-50); border-bottom: 1px solid var(--slate-200); }
.cdm-item__t { font-weight: 700; font-size: .9rem; color: var(--slate-700); }
.cdm-item__outils { display: flex; gap: 4px; }
.cdm-item__corps { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px 12px; }
.cdm-item__corps > .btn { align-self: flex-start; }
.cdm-ajouts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cdm-ajout { border: 1px dashed #d6b46a; border-radius: 999px; padding: 7px 14px; cursor: pointer; background: #fffbeb; color: #92400e; font: 600 .86rem/1.2 'Inter', system-ui, sans-serif; transition: background .12s, transform .12s; }
.cdm-ajout:hover { background: #fef3c7; transform: translateY(-1px); }
.cdm-vide { margin: 0; color: var(--slate-500); font-size: .9rem; }
.cdm-note { margin: 0; font-size: .8rem; color: var(--slate-500); }
.cdm-video { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--slate-600); }
.cdm-video img { width: 120px; border-radius: 8px; }
.cdm-doc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cdm-doc__hex { display: grid; place-items: center; width: 34px; height: 30px; color: #fff; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: linear-gradient(150deg, #34d399, #059669); }
.cdm-doc small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #047857; font-weight: 700; }
.cdm-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; align-items: start; }
.cdm-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.cdm-theme {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; padding: 0;
    box-shadow: 0 0 0 1px var(--slate-300), 0 3px 6px rgba(0, 0, 0, .2); transition: transform .12s, box-shadow .12s;
}
.cdm-theme:hover { transform: scale(1.1); }
.cdm-theme.is-on { box-shadow: 0 0 0 3px #d97706, 0 3px 6px rgba(0, 0, 0, .25); }
.cdm-theme[data-theme="laiton"] { background: linear-gradient(150deg, #fff4c2, #e7b744 45%, #5b3b07); }
.cdm-theme[data-theme="argent"] { background: linear-gradient(150deg, #ffffff, #d5dbe3 45%, #4a5565); }
.cdm-theme[data-theme="cuivre"] { background: linear-gradient(150deg, #ffd9bd, #dd8048 45%, #582509); }
.cdm-theme[data-theme="rouge"]  { background: linear-gradient(150deg, #ffb4b4, #ef4444 45%, #5a0a0a); }
.cdm-theme[data-theme="bleu"]   { background: linear-gradient(150deg, #bad8ff, #3b82f6 45%, #0c2459); }
.cdm-theme[data-theme="vert"]   { background: linear-gradient(150deg, #bff6d3, #22c55e 45%, #0a4321); }
.cdm-theme[data-theme="violet"] { background: linear-gradient(150deg, #e7d1ff, #a855f7 45%, #36126f); }
.cdm-theme[data-theme="noir"]   { background: linear-gradient(150deg, #8b95a5, #3b4352 45%, #07090d); }
.cdm-indice { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: end; margin-top: 12px; }
.cdm-indice > .field__label { grid-column: 1 / -1; }
.cdm-apres { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--slate-600); }
.cdm-voir { margin-right: auto; }
@media (max-width: 640px) { .cdm-indice { grid-template-columns: 1fr; } }

/* Sélecteur d'hexagone et aperçu de l'ouverture : calques au-dessus de la modale. */
.cdm-pick, .cdm-demo { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.cdm-pick__box, .cdm-demo__box { width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(15, 23, 42, .45); }
.cdm-demo__box { width: min(820px, 100%); overflow: auto; }
.cdm-pick__tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cdm-pick__arbre { overflow: auto; min-height: 120px; padding-right: 4px; }
.cdm-pick__dir summary { padding: 6px 4px; cursor: pointer; font-weight: 600; color: var(--slate-700); border-radius: 8px; }
.cdm-pick__dir summary:hover { background: var(--slate-50); }
.cdm-pick__sous { padding-left: 16px; border-left: 2px solid var(--slate-100); margin-left: 8px; }
.cdm-pick__doc { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--slate-800); font-size: .92rem; }
.cdm-pick__doc:hover { background: #ecfdf5; }
.cdm-pick__ty { flex: none; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #047857; }

/* --- Visionneuse de l'enseignant ------------------------------------------ */
.modal__box--cadenas-view { max-width: 980px; width: 96vw; }
.modal__box--cadenas-view .modal__head { gap: 10px; }
.cdv-actions { display: flex; gap: 6px; margin-left: auto; }
.cdv-onglets { display: flex; gap: 6px; margin: 12px 0 4px; border-bottom: 1px solid var(--slate-200); }
.cdv-onglets[hidden] { display: none; }
.cdv-onglet { border: 0; background: none; padding: 8px 14px; cursor: pointer; font: 600 .9rem/1.2 'Inter', system-ui, sans-serif; color: var(--slate-500); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.cdv-onglet.is-on { color: #92400e; border-bottom-color: #d97706; }
.cdv-body { padding-top: 8px; }
.cdv-body:fullscreen { display: flex; flex-direction: column; justify-content: center; overflow: auto; padding: 3vh 4vw; background: radial-gradient(120% 90% at 50% 0%, #fffdf3, #e2e8f0); }
.cdv-body:fullscreen .cdn-enonce { font-size: 1.3rem; max-width: 1100px; }
.cdv-suivi { padding-top: 10px; }
.cdv-suivi__barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cdv-suivi__barre > span { margin-right: auto; color: var(--slate-600); }
.cdv-raz { color: #b91c1c; }
.cdv-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cdv-table th { text-align: left; padding: 6px 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--slate-500); border-bottom: 2px solid var(--slate-200); }
.cdv-table td { padding: 7px 8px; border-bottom: 1px solid var(--slate-100); }
.cdv-table tr.is-ouvert td:first-child { font-weight: 700; color: #15803d; }
.cdv-ferme { color: var(--slate-500); }
