/* monelec : feuille de style. Police et esprit repris de formelec. */

@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(/static/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(/static/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* monelec : tablette d'abord (cibles de 44 px au moins), même charte que formelec. */
:root {
  --bg: #f6f7f8; --surface: #ffffff; --ink: #1d2328; --quiet: #5b6570; --line: #dfe3e7;
  --brand: #0B6E99; --brand-ink: #08506f; --brand-tint: #e3f1f7;
  --ok: #1f8a46; --ok-tint: #e4f4ea;
  --wait: #c97a00; --wait-tint: #fff3dc;
  --danger: #c62828;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121518; --surface: #1b1f23; --ink: #e7e9eb; --quiet: #a2abb4; --line: #323840;
    --brand: #3aa3d1; --brand-ink: #8fd0ec; --brand-tint: #15303d;
    --ok: #4cc27a; --ok-tint: #173323; --wait: #f0a634; --wait-tint: #3a2c12;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121518; --surface: #1b1f23; --ink: #e7e9eb; --quiet: #a2abb4; --line: #323840;
  --brand: #3aa3d1; --brand-ink: #8fd0ec; --brand-tint: #15303d;
  --ok: #4cc27a; --ok-tint: #173323; --wait: #f0a634; --wait-tint: #3a2c12;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 "Atkinson Hyperlegible", system-ui, sans-serif; }
a { color: var(--brand-ink); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .7em; }
img, svg { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
.quiet { color: var(--quiet); }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; color: var(--quiet); margin-bottom: .3em; }
.lead { font-size: 1.15rem; color: var(--quiet); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.page-head { padding-top: 28px; padding-bottom: 32px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 44px; border: 0; border-radius: 10px; padding: .55em 1.1em; background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.small { min-height: 40px; padding: .35em .9em; font-size: .92rem; }
.btn.ghost { background: transparent; color: var(--brand-ink); box-shadow: inset 0 0 0 2px var(--brand); }
.btn.deux { background: var(--wait); }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); text-decoration: underline; cursor: pointer; min-height: 32px; }
.btn-link.danger { color: var(--danger); }
.chip { display: inline-block; padding: .15em .65em; border-radius: 999px; font-size: .8rem; background: var(--brand-tint); color: var(--brand-ink); white-space: nowrap; }
.chip.ok { background: var(--ok-tint); color: var(--ok); }
.chip.lock { background: var(--line); color: var(--quiet); }
.chip.soon { background: transparent; border: 1px dashed var(--line); color: var(--quiet); }
.note { background: var(--wait-tint); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.note p { margin: 0; }
.note.ok { background: var(--ok-tint); }
.note.err { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.tp-code { display: inline-block; font-weight: 700; font-size: .85rem; padding: .1em .55em; border-radius: 6px; background: var(--brand); color: #fff; white-space: nowrap; }
.tp-code.papier { background: var(--line); color: var(--quiet); }

/* En-tête */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.main-nav { display: flex; gap: 16px; }
.main-nav a { color: var(--ink); font-weight: 700; text-decoration: none; font-size: .95rem; }
.account { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: .92rem; }
.account form { margin: 0; }
.site-footer { padding: 28px 0 40px; }

/* Connexion simulée */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.account-card { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; min-height: 64px; }
.account-card:hover { border-color: var(--brand); }
.account-name { font-weight: 700; }

/* Accueil élève */
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 16px 0 32px; }
.carte-tp { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.carte-tp:hover { border-color: var(--brand); }
.carte-tp.papier { background: transparent; box-shadow: none; border-style: dashed; }
.carte-titre { font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.carte-tp .btn { margin-top: auto; }
.mini-barre { display: block; width: 100%; max-width: 260px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.mini-barre span { display: block; height: 100%; width: var(--p); background: var(--ok); }
.attente-txt { color: var(--wait); }
.archive { padding-left: 1.2em; }

/* Barre du TP */
.tp-bar { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tp-bar-inner { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.retour { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: 2rem; line-height: 1; text-decoration: none; color: var(--ink); background: var(--bg); flex: none; }
.tp-bar-titre { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.sauve { font-size: .85rem; padding: .3em .7em; border-radius: 999px; white-space: nowrap; background: var(--ok-tint); color: var(--ok); }
.sauve[data-etat="cours"] { background: var(--brand-tint); color: var(--brand-ink); }
.sauve[data-etat="hors"], .sauve[data-etat="err"] { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); color: var(--danger); font-weight: 700; }
.frise { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.frise li { flex: 1; height: 10px; border-radius: 3px; background: var(--line); position: relative; }
.frise li a { position: absolute; inset: -10px 0; }
.frise .f-signee { background: var(--ok); }
.frise .f-attente { background: var(--wait); }
.frise .f-en_cours { background: var(--brand); }
.frise.petite li { height: 6px; }
.frise.petite { margin: 8px 0 16px; }

/* Page du TP */
.tp-page, .tp-bar .wrap { max-width: 1400px; }
.tp-page { padding-top: 20px; padding-bottom: 40px; }
.ressources { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; }
.ressources summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.partie { margin-top: 28px; }
.partie-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.partie-head h2 { margin: 0; }
.fonction { flex-basis: 100%; margin: 2px 0 0; padding: 2px 0 2px 10px; border-left: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); color: var(--ink); }
.fonction strong { color: var(--brand-ink); font-weight: 600; }
.etape { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; overflow: hidden; overflow: clip; }
.etape-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.etape-head h3 { margin: 0; flex: 1; }
.etape-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--line); color: var(--quiet); font-weight: 700; flex: none; }
.etape-en_cours { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.etape-en_cours .etape-num { background: var(--brand); color: #fff; }
.etape-attente { border: 2px solid var(--wait); }
.etape-attente .etape-num { background: var(--wait); color: #fff; }
.etape-signee .etape-num { background: var(--ok); color: #fff; }
.etape-fermee { opacity: .6; background: transparent; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; white-space: nowrap; }
.b-signee { background: var(--ok-tint); color: var(--ok); }
.b-attente { background: var(--wait-tint); color: var(--wait); }
.b-cours { background: var(--brand-tint); color: var(--brand-ink); }
.b-fermee { background: var(--line); color: var(--quiet); }
.etape-corps { padding: 0 16px 8px; }
details.etape-corps > summary { cursor: pointer; color: var(--brand-ink); min-height: 36px; padding: 4px 0; }
.competences { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.competences li { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--quiet); }
.competences b { color: var(--brand-ink); }
.consigne { background: var(--brand-tint); border-radius: 8px; padding: 10px 14px; }
.retirer-sig { margin: 4px 0 0; text-align: right; font-size: .85rem; }
.consigne.securite { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); font-weight: 600; border-left: 4px solid var(--danger); }
.consigne.securite::before { content: "⚠ Sécurité : "; font-weight: 800; }
.etape-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px dashed var(--line); background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
.pied-titre { flex: 1; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .85rem; }
.pied-msg { flex-basis: 100%; margin: 0; color: var(--danger); font-weight: 700; }
.pied-msg:empty { display: none; }
.tampon { display: flex; align-items: center; gap: 10px; margin: 0 16px 14px; padding: 8px 12px; border: 2px solid var(--ok); color: var(--ok); border-radius: 10px; width: fit-content; background: var(--ok-tint); }
.tampon strong { color: var(--ink); }

/* Questions */
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.etape-corps > .q:first-child, .consigne + .q { border-top: 0; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.q-num { font-weight: 700; color: var(--brand-ink); white-space: nowrap; min-width: 3.2em; }
.q-enonce { margin: 0; flex: 1; font-weight: 700; }
textarea, input[type=text], input[type=password], input[type=number], input:not([type]), select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .55em .75em; min-height: 44px; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); }
textarea[readonly], input[readonly] { background: transparent; border-style: dashed; }
.choix { display: flex; flex-wrap: wrap; gap: 10px; }
.choix-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 700; }
.choix-item input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.choix-item.coche { border-color: var(--brand); background: var(--brand-tint); }
.q-choix .choix-item:has(input:disabled) { cursor: default; }
.valeur { display: flex; gap: 8px; max-width: 320px; }
.tableau-wrap { overflow-x: auto; }
.tableau { border-collapse: collapse; width: 100%; }
.tableau th, .tableau td { border: 1px solid var(--line); padding: 4px; text-align: left; }
.tableau th { background: var(--bg); font-size: .9rem; padding: 8px; }
.tableau td.pre { padding: 8px 10px; font-weight: 700; background: var(--bg); }
.tableau td input[type=text] { width: 100%; min-width: 14em; }
.tableau .col-case { width: 5.5em; }
.tableau td input[type=text] { border: 0; background: transparent; }
.tableau .col-case { width: 7em; text-align: center; }
.tableau input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--ok); }
.q-img { display: block; max-height: 260px; margin-bottom: 10px; }
.img-manque { display: grid; place-items: center; min-height: 120px; max-width: 420px; border: 2px dashed var(--line); border-radius: 10px; color: var(--quiet); font-size: .9rem; margin-bottom: 10px; padding: 10px; text-align: center; }

/* Zones à colorier */
/* Repérage : l'image sur toute la largeur, les couleurs au-dessus, en colonnes. */
.rep { display: flex; flex-direction: column; gap: 12px; }
.rep .palette, .rep .legende { order: -1; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.palette .palette-aide { grid-column: 1 / -1; margin: 0; }
.palette .pal { min-height: 40px; padding: 4px 10px; gap: 8px; }
.palette .pal .sw { width: 20px; height: 20px; }
.palette .pal .sw-fil { height: 7px; }
.palette .pal .small { font-size: .78rem; }
.palette-aide { font-size: .82rem; color: var(--quiet); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pal { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; line-height: 1.2; }
.pal.actif { border-color: var(--pc, var(--ink)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, var(--ink)) 30%, transparent); }
.sw { width: 26px; height: 26px; border-radius: 6px; flex: none; border: 3px solid var(--pc, var(--quiet)); display: inline-block; vertical-align: middle; margin-right: 4px; }
.sw-fil { border: 0; height: 8px; border-radius: 4px; background: var(--pc); }
.gomme .sw { border-style: dashed; }
.palette.secoue { animation: secoue .35s; }
@keyframes secoue { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.legende { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--quiet); }
.legende .sw { width: 18px; height: 18px; border-width: 2px; }
.legende .sw-fil { height: 6px; }
.rep-fig { position: relative; background: #fff; border-radius: 10px; border: 1px solid var(--line); padding: 0; width: 100%; }
.rep-fig img, .rep-fig svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rep-fig img { object-fit: contain; }
.z { cursor: pointer; -webkit-tap-highlight-color: transparent; vector-effect: non-scaling-stroke; }
.z.cadre { fill: transparent; stroke: rgb(0 0 0 / .12); stroke-width: 2; stroke-dasharray: 6 6; pointer-events: none; }
.rep-fig svg:not(.ro) { cursor: pointer; }
.z.cadre.vise { fill: rgb(255 200 0 / .18); }
.z.fil { fill: none; stroke: transparent; stroke-width: 24; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; }
.z.cadre[data-c=""]:hover { stroke: rgb(0 0 0 / .35); }
.z.fil[data-c=""]:hover { stroke: rgb(0 0 0 / .08); }
.z.cadre[data-c]:not([data-c=""]) { stroke-width: 5; stroke-dasharray: none; }
.z.fil[data-c]:not([data-c=""]) { stroke-width: 12; stroke-opacity: .55; }
.z[data-c="bleu"] { stroke: #1f6fd1; } .z[data-c="violet"] { stroke: #8e3fc7; } .z[data-c="vert"] { stroke: #1f9d48; }
.z[data-c="marron"] { stroke: #8b4513; } .z[data-c="noir"] { stroke: #222222; } .z[data-c="rouge"] { stroke: #e0262b; } .z[data-c="orange"] { stroke: #ef7d00; } .z[data-c="jaune"] { stroke: #e2b100; }
/* Jaune = surligneur : le repère reste lisible (fond translucide, trait fin). */
.z.cadre[data-c="jaune"]:not([data-c=""]) { fill: rgb(240 200 0 / .45); stroke-width: 2; }
svg.ro .z { cursor: default; }
svg.ro .z.cadre[data-c=""] { stroke: none; }

/* Fenêtres */
.dlg { border: 0; border-radius: 16px; padding: 24px; box-shadow: 0 10px 40px rgb(0 0 0 / .25); background: var(--surface); color: var(--ink); max-width: min(92vw, 420px); }
.dlg::backdrop { background: rgb(0 0 0 / .45); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dlg-texte { font-size: 1.1rem; font-weight: 700; }
.code-form { text-align: center; }
.code-points { display: flex; justify-content: center; gap: 12px; margin: 12px 0 16px; }
.code-points span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--quiet); }
.code-points span.plein { background: var(--ink); border-color: var(--ink); }
.pave { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; }
.pave button { height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.pave button.ok { background: var(--brand); color: #fff; border: 0; font-size: 1.1rem; }
.code-msg { min-height: 1.5em; color: var(--danger); font-weight: 700; margin: 12px 0 4px; }
.form-code { display: grid; gap: 12px; max-width: 320px; }
.form-code label { display: grid; gap: 4px; font-weight: 700; }

/* Grille du prof */
.prof-page { padding-top: 24px; padding-bottom: 32px; }
.prof-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.relire { display: flex; align-items: center; gap: 10px; margin: 0; }
.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }
.onglets { display: flex; gap: 6px; }
.onglet { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.onglet.actif { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filtre { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .92rem; }
.filtre select { width: auto; }
.bascule input { width: 22px; height: 22px; accent-color: var(--brand); }
.grille-zone { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
body.avec-panneau .grille-zone { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
.grille { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grille th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--quiet); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.grille td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grille tr:last-child td { border-bottom: 0; }
.grille .l-attente td { background: var(--wait-tint); }
.grille .l-attente td:first-child { box-shadow: inset 4px 0 0 var(--wait); }
.grille .l-papier td, .grille .l-sans td, .grille .l-pas_ouvert td { color: var(--quiet); }
.c-ou { min-width: 220px; }
.c-ou .ou { display: block; font-weight: 700; }
.c-ou .ou-partie { display: block; }
.c-ou .mini-barre { margin-top: 6px; max-width: 220px; }
.c-actions .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
body.avec-panneau .c-actions .actions { flex-direction: column; align-items: stretch; }
body.avec-panneau .c-attente { font-size: .9rem; }
input:disabled { opacity: 1; }
.attente-pastille { display: inline-block; font-weight: 700; color: var(--wait); white-space: nowrap; }
.vide { text-align: center; padding: 24px; }
.sr-col { font-size: 0; }
.panneau { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.panneau-head { display: flex; justify-content: space-between; gap: 10px; }
.panneau-head h2 { margin: 0; }
.fermer { width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--bg); color: var(--ink); font-size: 1.6rem; cursor: pointer; flex: none; }
.panneau .rep-fig { max-width: 260px !important; }
.panneau-actions { position: sticky; bottom: -16px; background: var(--surface); padding: 12px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.panneau-actions .btn { width: 100%; }
.panneau-retirer { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.panneau-retirer .tampon { margin: 0 0 8px; }

@media (max-width: 900px) {
  body.avec-panneau .grille-zone { grid-template-columns: 1fr; }
  .panneau { position: fixed; inset: auto 0 0 0; max-height: 75vh; border-radius: 16px 16px 0 0; z-index: 10; }
  .grille thead { display: none; }
  .grille, .grille tbody, .grille tr, .grille td { display: block; }
  .grille tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .grille td { border: 0; padding: 4px 12px; }
  .c-actions .actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .palette { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Étiquettes à glisser */
.etq { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) { .etq { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; } }
.etq .q-img { margin: 0; }
.etq-reserve { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; margin-bottom: 10px; border: 2px dashed var(--line); border-radius: 12px; }
.etq-nom { touch-action: none; user-select: none; -webkit-user-select: none; font: inherit; font-weight: 600; padding: 10px 14px; min-height: 44px; border-radius: 10px; border: 2px solid var(--brand); background: var(--brand-tint); color: var(--brand-ink); cursor: grab; }
.etq-nom:disabled { cursor: default; border-color: var(--line); background: transparent; color: inherit; padding: 6px 4px; min-height: 0; border: 0; font-weight: 400; }
.etq-nom.choisi { background: var(--brand); color: #fff; box-shadow: 0 0 0 3px var(--brand-tint); }
.etq-nom.etq-parti { opacity: .35; }
.etq-fantome { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -60%) rotate(-2deg); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.etq-table { max-width: 520px; }
.etq-table td.etq-case { height: 56px; padding: 4px 8px; }
.etape-en_cours .etq-case:empty::after { content: "Dépose un nom ici"; color: var(--quiet); font-size: .85rem; }
.etq-case.survol { background: var(--brand-tint); outline: 2px solid var(--brand); outline-offset: -2px; }
.apercus { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; }
.apercus select { width: auto; max-width: 100%; min-height: 40px; }

/* Photos et PDF joints */
.fich-liste { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.fich-liste:empty { display: none; }
.fich-item { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.fich-item img { display: block; width: 160px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.fich-pdf { display: flex; align-items: center; gap: 8px; width: 160px; min-height: 120px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; word-break: break-word; font-size: .85rem; }
.fich-ico { flex: none; font-weight: 800; font-size: .8rem; color: #fff; background: #c0392b; border-radius: 6px; padding: 8px 6px; }
.fich-ajout { cursor: pointer; }
.fich-msg { margin: 6px 0 0; }

/* Éditeur de TP */
.ed-liste .ed-table { max-width: none; margin-bottom: 28px; }
.ed-actions { white-space: nowrap; text-align: right; }
.btn.small { min-height: 36px; padding: .35em .8em; font-size: .9rem; }
.ed-convertir { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ed-nouveau { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.ed-nouveau label { display: flex; min-width: 140px; flex-direction: column; gap: 4px; font-weight: 700; font-size: .9rem; }
.ed-nouveau .ed-large { flex: 1; min-width: 240px; }
.ed-bar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.ed-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 60px; padding-top: 6px; padding-bottom: 6px; }
.ed-bar-titre { flex: 1; min-width: 160px; }
.ed-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; padding-bottom: 60px; }
@media (min-width: 1000px) { .ed-page { grid-template-columns: minmax(0, 1fr) 240px; } .ed-cote { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; } }
.ed-racine { min-width: 0; }
.ed-cote h2 { font-size: 1rem; margin-top: 0; }
.ed-versions { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; }
.ed-versions .actuelle { border-left: 3px solid var(--brand); padding-left: 8px; }
.ed-bloc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.ed-bloc h2 { margin: 0 0 10px; font-size: 1.2rem; }
.ed-partie { border-left: 4px solid var(--brand); }
.ed-zones { outline: none; }
.ed-zones [hidden] { display: none !important; }
.ed-zones-barre { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ed-zones-barre .btn.actif { background: var(--brand); color: #fff; }
.ed-zones-barre .btn:disabled { opacity: .35; cursor: default; }
.ed-zones-aide { margin: 0 0 8px; }
.ed-zones-fig { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ed-zones-svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; cursor: crosshair; }
.edz { vector-effect: non-scaling-stroke; }
.edz.cadre { fill: rgb(31 111 209 / .06); stroke: #1f6fd1; stroke-width: 2; stroke-dasharray: 6 4; }
.edz.fil { fill: none; stroke: #e0262b; stroke-width: 4; stroke-opacity: .6; stroke-linecap: round; stroke-linejoin: round; }
.edz.choisi { stroke: #ef7d00; stroke-width: 3; stroke-dasharray: none; fill: rgb(239 125 0 / .12); }
.edz.fil.choisi { fill: none; stroke-width: 6; }
.edz.encours { fill: none; stroke: #ef7d00; stroke-width: 2; stroke-dasharray: 4 3; }
.edz-poignee { fill: #fff; stroke: #ef7d00; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: move; }
.edz-point { fill: #ef7d00; }
.edz-guide { stroke: #ef7d00; stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.edz-nom { fill: #1f6fd1; font-weight: 700; pointer-events: none; }
.edz-nom.fil { fill: #c62828; }
.ed-zones-nom.vide { visibility: hidden; }
.ed-zones-nom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; font-weight: 600; font-size: .9rem; }
.ed-zones-nom input { width: 14em; }
.ed-zones-nom .danger { color: var(--danger); font-weight: 600; }
.ed-inserer { display: flex; align-items: center; gap: 8px; margin: -6px 0; }
.ed-inserer::before, .ed-inserer::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.ed-plus { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--brand); background: var(--surface); color: var(--brand); font-size: 1.2rem; font-weight: 700; line-height: 1; cursor: pointer; opacity: .55; }
.ed-plus:hover, .ed-plus:focus-visible { opacity: 1; background: var(--brand); color: #fff; }
.ed-plan { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 6px; }
.ed-plan-carte { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .85rem; cursor: grab; touch-action: none; user-select: none; transition: transform .12s; }
.ed-plan-carte.glisse { transition: none; box-shadow: 0 6px 18px rgb(0 0 0 / .18); border-color: var(--brand); position: relative; z-index: 2; cursor: grabbing; }
.ed-plan-poignee { color: var(--quiet); }
.ed-total { font-weight: 700; font-size: .85rem; margin: 4px 0 6px; }
.ed-plan-comp { display: block; font-size: .75rem; color: var(--brand-ink); font-weight: 700; margin-top: 2px; }
.ed-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.ed-champ { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.ed-champ > span { font-weight: 700; font-size: .85rem; }
.ed-champ input, .ed-champ textarea, .ed-champ select { width: 100%; max-width: 100%; }
.ed-case { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: .9rem; }
.ed-case input { width: 20px; height: 20px; }
.ed-ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-ligne select { flex: 1; min-width: 160px; }
.ed-img img { max-height: 160px; max-width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; }
.ed-etape { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; background: var(--bg); }
.ed-etape-tete { display: flex; align-items: flex-start; gap: 10px; }
.ed-etape-tete > .ed-champ, .ed-etape-tete > h2 { flex: 1; }
.ed-etape-tete .etape-num { margin-top: 26px; flex: none; }
.ed-outils { display: flex; gap: 4px; flex: none; margin-left: auto; }
.ed-etape-tete .ed-outils { margin-top: 22px; }
.ed-mini { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; }
.ed-mini:disabled { opacity: .35; cursor: default; }
.ed-mini.danger { color: var(--danger); }
.ed-questions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.ed-q { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ed-q-tete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 6px; }
.ed-q-tete > strong { align-self: center; }
.ed-q-tete .ed-champ { margin: 0; flex: 1; min-width: 200px; }
.ed-q-tete .ed-outils { align-self: center; }
.ed-signature { margin: 8px 0 0; text-align: right; }
.note.err { background: var(--danger-tint, #fde8e8); }

/* Choix sur image */
.choix-img { gap: 14px; }
.choix-carte { flex-direction: column; align-items: center; justify-content: flex-end; padding: 38px 14px 12px; min-width: 130px; position: relative; }
.choix-carte img { display: block; max-height: 220px; max-width: 240px; }
.choix-carte input { position: absolute; top: 10px; left: 10px; }
.choix-lettre { font-weight: 800; }

/* ---- Positionnement de compétence (NE, R, O, VC, VF) : cases de couleur ---- */
/* Titre de l'étape sur 70 % de la largeur ; compétences et pastille se partagent le reste. */
.etape-head { flex-wrap: wrap; }
.etape-head h3 { flex: 0 1 auto; max-width: 70%; margin-right: auto; }
.etape-head .competences { order: 9; flex: 0 1 auto; min-width: 0; margin: 0; gap: 4px; justify-content: flex-end; }
.etape-head .competences li { padding: 2px 7px; font-size: .75rem; }
@media (max-width: 600px) { .etape-head h3 { max-width: none; flex-basis: calc(100% - 60px); } .etape-head .competences { flex-basis: 100%; justify-content: flex-start; } }
.niv-carre { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 7px; border: 0; padding: 0; background: var(--niv); opacity: .35;
  color: #fff; font: 800 .72rem/1 inherit; letter-spacing: .02em; vertical-align: middle; }
.niv-carre.coche, .niv-carre.plein, .niv-carre[aria-pressed="true"] { opacity: 1; }
.niv-carre.coche::after, .niv-carre[aria-pressed="true"]::after {
  content: ""; width: 42%; height: 24%; border: solid #fff; border-width: 0 0 3px 3px; transform: translateY(-15%) rotate(-45deg);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / .35)); }
.niv-carre.niv-VC.coche::after, .niv-carre.niv-VC[aria-pressed="true"]::after { border-color: #2f4a0e; filter: none; }
/* NE garde son texte : la coche passe dessous. */
.niv-carre.niv-NE.coche, .niv-carre.niv-NE[aria-pressed="true"] { flex-direction: column; gap: 1px; font-size: .55rem; padding-bottom: 2px; }
.niv-carre.niv-NE.coche::after, .niv-carre.niv-NE[aria-pressed="true"]::after { width: 38%; height: 18%; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.niv-carre.petit.niv-NE.coche { font-size: .45rem; }
.niv-choix.niv-NE[aria-pressed="true"] { font-size: .75rem; gap: 3px; }
.niv-carre.petit { width: 22px; height: 22px; border-radius: 5px; font-size: .58rem; }
.niv-ligne { display: inline-flex; gap: 4px; margin-bottom: 4px; }
.niv-nom { font-size: .82rem; color: var(--quiet); margin-right: 10px; }
.niveaux { display: flex; justify-content: center; gap: 10px; margin: 12px 0; }
.niveaux[hidden], .dlg .btn[hidden], .prof-alerte[hidden] { display: none !important; }
.niv-choix { width: 52px; height: 52px; border-radius: 10px; cursor: pointer; font-size: .85rem; }
.niv-choix:hover { opacity: .7; }
.niv-choix[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.niv-choix[aria-pressed="true"]:hover { opacity: 1; }

/* ---- Synthèse par compétences ---- */
.semaines { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.synthese-zone { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.synthese-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.synthese-table th, .synthese-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.synthese-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--quiet); background: var(--bg); position: sticky; top: 0; }
.synthese-table .c-comp { text-align: center; }
.synthese-table tr.l-premiere td { border-top: 2px solid var(--line); }
.synthese-table tr.l-cumul td { background: var(--bg); font-weight: 600; }
.tp-code.cumul { background: var(--ink); color: var(--surface); }
.synthese-table .c-comp .niv-carre { cursor: help; width: 26px; height: 26px; }
.synthese-table .c-synth { text-align: center; }
/* Moyenne, ton sur ton : plus foncée sur les teintes claires, plus claire sur les foncées. */
.niv-moy { display: inline-block; min-width: 52px; padding: 4px 8px; border-radius: 7px; background: var(--niv); cursor: help;
  font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--niv) 50%, #fff); }
.niv-moy.niv-O, .niv-moy.niv-VC { color: color-mix(in srgb, var(--niv) 55%, #000); }
.legende { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }

/* ---- Repères à placer sur une image ---- */
.plc { display: flex; flex-direction: column; gap: 12px; }
.plc .palette-aide { margin: 0; }
/* Liste sous l'image, en colonnes (autant qu'il en tient). */
.plc-liste { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.plc-liste ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.plc-liste li { display: flex; align-items: center; gap: 10px; }
.plc-rep { touch-action: none; user-select: none; -webkit-user-select: none; display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; border: 2px solid #fff; background: var(--brand); color: #fff;
  font: 800 .95rem/1 inherit; box-shadow: 0 1px 4px rgb(0 0 0 / .35); cursor: grab; }
.plc-rep:disabled { cursor: default; }
.plc-source.place { background: var(--surface); color: var(--brand-ink); border-color: var(--brand); box-shadow: none; }
.plc-rep.choisi { outline: 3px solid var(--wait); outline-offset: 2px; }
.plc-fig { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.plc-fig img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.plc-fig.vise, .plc-fig.survol { outline: 3px dashed var(--brand); outline-offset: -3px; cursor: crosshair; }
.plc-pose { position: absolute; transform: translate(-50%, -50%); }
.plc-pose.parti { opacity: .3; }
.plc-fantome { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.15); }

/* ---- Largeur d'affichage des images (éditeur et page de l'élève) ---- */
.q-img.q-img-taille { max-height: none; max-width: 100%; height: auto; }
.ed-taille { margin-top: 6px; }
.ed-taille-img { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.ed-taille-img img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; user-select: none; }
.ed-taille-img.auto img { width: auto; max-height: 160px; max-width: 100%; }
.ed-poignee { position: absolute; right: -8px; bottom: -8px; width: 22px; height: 22px; border-radius: 6px; background: var(--brand); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / .35); cursor: nwse-resize; touch-action: none; }
.ed-poignee::after { content: ""; position: absolute; inset: 5px; border: solid #fff; border-width: 0 2px 2px 0; }
.ed-taille .ed-ligne { margin-top: 10px; align-items: center; }
.ed-img .ed-taille-img:not(.auto) img { max-height: none; max-width: 100%; margin-top: 0; }
.ed-secu { border-left: 4px solid var(--danger); padding-left: 10px; }
.ed-secu span { color: var(--danger); font-weight: 700; }
.consigne.securite + .consigne { margin-top: 8px; }
/* Retours à la ligne et alinéas saisis dans l'éditeur, conservés à l'affichage. */
.consigne, .fonction, .q-enonce, .tp-intro p { white-space: pre-wrap; }
.etape-img { margin: 10px 0 4px; max-height: 340px; max-width: 100%; }
/* Étiquettes à glisser sur l'image : des noms au lieu de numéros, déplacés (pas copiés) depuis la liste. */
.plc-noms .plc-rep { border-radius: 8px; padding: 0 10px; height: 30px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.plc-noms .plc-liste { min-height: 56px; }
.plc-noms .plc-liste ul { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.plc-noms .plc-liste li .plc-rep { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.plc-noms .plc-liste li.place { display: none; }
/* Repères et étiquettes à placer : la liste au-dessus de l'image. */
.plc .plc-fig, .plc .img-manque { order: 2; }
/* PDF de présentation, en haut du TP */
.presentation { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; }
.presentation summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.pdf-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0; }
.pdf-zoom { min-width: 3.5em; text-align: center; font-size: .9rem; }
.pdf-pages { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-height: 80vh; overflow: auto; background: var(--bg); border-radius: 8px; padding: 6px; }
.pdf-page { flex: none; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .2); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.presentation:fullscreen { padding: 12px; overflow: hidden; display: flex; flex-direction: column; }
.presentation:fullscreen .pdf-pages { max-height: none; flex: 1; }
.presentation:-webkit-full-screen { padding: 12px; overflow: hidden; display: flex; flex-direction: column; }
.presentation:-webkit-full-screen .pdf-pages { max-height: none; flex: 1; }

/* Objectif principal du TP : mis en valeur ; ceux des parties (.fonction) plus discrets. */
.tp-intro .objectif { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: var(--radius); padding: 12px 16px; font-size: 1.06rem; box-shadow: var(--shadow); }
.tp-intro .objectif strong { color: var(--brand-ink); }

/* Version imprimable des TP (/prof/imprimer) : enregistrée en PDF par le navigateur. */
.ed-titre { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
body.imprimer { background: #fff; color: #1d2328; max-width: 1000px; margin: 0 auto; padding: 16px; color-scheme: light; }
.imp-barre { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0 16px; }
.imp-tp + .imp-tp { margin-top: 32px; }
.imp-tete h1 { margin: 6px 0 10px; }
.imp-eleve { margin: 12px 0; font-size: .95rem; }
.imp-ressources ul { padding-left: 18px; }
.imp-ressources li { margin: 4px 0; break-inside: avoid; }
.imp-ressources .small { white-space: pre-wrap; }
.imp-etape { box-shadow: none; }
.imp-etape .etape-head .competences li { font-size: .75rem; }
.imp-eval { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; border-top: 1px dashed #c5ccd3; padding: 10px 16px 14px; }
.imp-niveaux { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.imp-niv { display: inline-flex; align-items: center; gap: 5px; }
.imp-lib { font-weight: 700; font-size: .85rem; margin-right: 6px; }
.imp-sig { display: flex; align-items: center; gap: 8px; }
.imp-case { display: inline-block; width: 150px; height: 46px; border: 1px solid #8a949e; border-radius: 6px; }
@media print {
  @page { size: A4; margin: 12mm; }
  .imp-barre { display: none; }
  body.imprimer { padding: 0; max-width: none; font-size: 11pt; }
  .imp-tp { break-before: page; }
  .imp-tp:first-of-type { break-before: auto; }
  .imp-etape { break-inside: auto; }
  .imp-eval, .q, .consigne, .q-img, .etape-head { break-inside: avoid; }
  .niv-carre, .consigne, .chip, .tp-code, .etape-num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Bouton « revenir en haut » du TP, visible après un écran de défilement. */
.haut { position: fixed; right: 18px; bottom: 18px; z-index: 9; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgb(0 0 0 / .25); cursor: pointer; display: grid; place-items: center; }
.haut[hidden] { display: none; }
.haut:hover { background: var(--brand-ink); }
@media print { .haut { display: none; } }

/* Zoom dans les images des questions (static/js/zoom.js). */
.rep-fig { overflow: hidden; }
.zoom-contenu { transform-origin: 0 0; }
.rep-fig .zoom-contenu { position: absolute; inset: 0; }
.plc-fig .zoom-contenu { position: relative; }
.plc-fig .zoom-contenu .plc-pose { transform: translate(-50%, -50%) scale(calc(1 / var(--zs, 1))); }
.rep-fig, .plc-fig { touch-action: pan-x pan-y; }
.rep-fig.zoome, .plc-fig.zoome { touch-action: none; cursor: grab; }
.rep-fig.deplace, .plc-fig.deplace { cursor: grabbing; }
.zoom-btns { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.zoom-btns button { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: rgb(255 255 255 / .92); color: #1d2328; font: 700 1.1rem/1 inherit; cursor: pointer; box-shadow: 0 1px 4px rgb(0 0 0 / .15); }
.zoom-btns button[data-z="un"] { font-size: .8rem; }
.zoom-btns button[hidden] { display: none; }
.zoom-btns button:hover { background: #fff; border-color: var(--brand); }
@media print { .zoom-btns { display: none; } }
.ed-zones-copie { margin-top: 8px; }
.ed-zones-fig { position: relative; }
.ed-zones-fig.zoome { cursor: grab; }
/* Éditeur : parties et étapes repliables (accordéons). */
.ed-plis { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ed-plis .ed-case { margin: 0 0 0 6px; }
.ed-plier { flex: none; display: inline-flex; align-items: center; gap: 8px; min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; cursor: pointer; color: var(--ink, inherit); }
.ed-plier:hover { border-color: var(--brand); }
.ed-chevron { display: inline-block; transition: transform .15s; font-size: .9rem; }
.ed-plier[aria-expanded="true"] .ed-chevron { transform: rotate(90deg); }
.ed-etape-tete > .ed-plier { margin-top: 22px; }
.ed-partie > .ed-etape-tete > .ed-plier { margin-top: 0; }
.ed-partie > .ed-etape-tete { align-items: center; }
.ed-partie.ed-ferme > .ed-etape-tete h2 { margin: 0; }
.ed-resume-partie { display: block; font-size: .95rem; font-weight: 600; color: var(--quiet); margin-top: 2px; }
.ed-etape.ed-ferme > :not(.ed-etape-tete) { display: none; }
.ed-etape.ed-ferme > .ed-etape-tete .ed-champ { margin-bottom: 0; }
.ed-compte { flex: none; margin-top: 32px; white-space: nowrap; }
.ed-ferme { cursor: default; }
/* Couleur de fil dans la palette et la légende : un trait entre deux bornes. */
.sw-trait { flex: none; width: 30px; height: 12px; display: inline-block; vertical-align: middle; margin-right: 4px; overflow: visible; }
.sw-trait line { stroke: var(--pc, #555); stroke-width: 4; stroke-linecap: round; }
.sw-trait circle { fill: var(--pc, #555); }
.legende .sw-trait { width: 24px; }
