:root {
  --fond: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f0ebe1;
  --texte: #1d2430;
  --texte-2: #5a6372;
  --bord: #ddd5c7;
  --primaire: #1f4e79;
  --primaire-texte: #ffffff;
  --ocre: #b8661c;
  --vert: #2e7d4f;
  --rouge: #b3261e;
  --jaune: #8a6d00;
  --accent-fond: rgba(184, 102, 28, 0.10);
  --vert-fond: rgba(46, 125, 79, 0.12);
  --rouge-fond: rgba(179, 38, 30, 0.10);
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.06);
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #14181f; --surface: #1c222b; --surface-2: #232a35; --texte: #e8ebf0; --texte-2: #a6afbd;
    --bord: #313a47; --primaire: #6ea8e0; --primaire-texte: #0d1520; --ocre: #e09a55; --vert: #5cc08a;
    --rouge: #ef7d74; --jaune: #e1c35a; --accent-fond: rgba(224, 154, 85, 0.14); --vert-fond: rgba(92, 192, 138, 0.14); --rouge-fond: rgba(239, 125, 116, 0.14);
  }
}
:root[data-theme="dark"] {
  --fond: #14181f; --surface: #1c222b; --surface-2: #232a35; --texte: #e8ebf0; --texte-2: #a6afbd;
  --bord: #313a47; --primaire: #6ea8e0; --primaire-texte: #0d1520; --ocre: #e09a55; --vert: #5cc08a;
  --rouge: #ef7d74; --jaune: #e1c35a; --accent-fond: rgba(224, 154, 85, 0.14); --vert-fond: rgba(92, 192, 138, 0.14); --rouge-fond: rgba(239, 125, 116, 0.14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font-family: var(--police); font-size: 16px; line-height: 1.6; }
a { color: var(--primaire); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 1.4em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }

/* En-tête */
.entete { background: var(--surface); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 10; }
.entete-int { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texte); font-weight: 700; }
.logo-marque { width: 34px; height: 34px; border-radius: 8px; background: var(--primaire); color: var(--primaire-texte); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; }
.logo small { display: block; font-weight: 500; color: var(--texte-2); font-size: 0.75rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { text-decoration: none; color: var(--texte-2); padding: 6px 10px; border-radius: 8px; font-size: 0.92rem; }
.nav a.actif, .nav a:hover { background: var(--surface-2); color: var(--texte); }
.outils-entete { display: flex; gap: 6px; align-items: center; }
.outils-entete select, .outils-entete button { font: inherit; font-size: 0.85rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); }
@media (max-width: 760px) { .entete { position: static; } .nav { margin-left: 0; width: 100%; } .nav a { padding: 4px 8px; } }
.bandeau-hors-ligne { display: none; background: var(--accent-fond); color: var(--texte); text-align: center; padding: 6px 16px; font-size: 0.9rem; }
.bandeau-hors-ligne.visible { display: block; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.fil { font-size: 0.88rem; color: var(--texte-2); margin-bottom: 8px; }
.fil a { color: var(--texte-2); }

/* Cartes et grilles */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grille-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.hero { display: grid; gap: 20px; grid-template-columns: 1.4fr 1fr; align-items: center; padding: 24px; }
.hero h1 { font-size: 2rem; }
.hero p.chapo { font-size: 1.1rem; color: var(--texte-2); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding: 18px; } .hero h1 { font-size: 1.6rem; } }
.cycle { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 10px 0; }
.cycle li { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; }
.cycle li b { color: var(--ocre); margin-right: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--primaire); background: var(--primaire); color: var(--primaire-texte); cursor: pointer; text-decoration: none; }
.btn.secondaire { background: transparent; color: var(--primaire); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.petit { padding: 5px 10px; font-size: 0.88rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.pastille { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--texte-2); }
.pastille.ok { background: var(--vert-fond); color: var(--vert); }
.pastille.verrou { background: var(--surface-2); color: var(--texte-2); }
.pastille.cours { background: var(--accent-fond); color: var(--ocre); }
.pastille.rouge { background: var(--rouge-fond); color: var(--rouge); }
.niveau { font-size: 0.78rem; color: var(--texte-2); }

/* Domaines et modules */
.domaine { margin-top: 26px; }
.domaine-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 2px solid var(--bord); padding-bottom: 6px; }
.domaine-tete h2 { margin: 0; }
.domaine-tete p { margin: 4px 0 0; color: var(--texte-2); width: 100%; }
.module-carte { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--texte); }
.module-carte .id { font-size: 0.8rem; font-weight: 700; color: var(--ocre); }
.module-carte h3 { margin: 0; font-size: 1rem; }
.module-carte .produit { font-size: 0.88rem; color: var(--texte-2); }
.module-carte .pied { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.module-carte.verrouille { opacity: 0.7; }

/* Leçon */
.etapes { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 18px; padding: 0; list-style: none; }
.etapes li a, .etapes li span { display: block; padding: 6px 12px; border-radius: 8px; font-size: 0.88rem; text-decoration: none; border: 1px solid var(--bord); color: var(--texte-2); background: var(--surface); }
.etapes li a.courant { background: var(--primaire); color: var(--primaire-texte); border-color: var(--primaire); }
.etapes li a.fait { border-color: var(--vert); color: var(--vert); }
.etapes li span { opacity: 0.5; }
.section-theorie { margin-bottom: 18px; }
.section-theorie.a-etudier { border-left: 4px solid var(--ocre); }
.section-theorie.maitrisee { border-left: 4px solid var(--vert); }
.section-theorie h3 { margin-top: 0; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.encadre { background: var(--accent-fond); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.formule { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; text-align: center; background: var(--surface-2); padding: 8px; border-radius: 8px; }
.tableau { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 0.94rem; display: block; overflow-x: auto; }
.tableau th, .tableau td { border: 1px solid var(--bord); padding: 6px 10px; text-align: left; vertical-align: top; }
.tableau th { background: var(--surface-2); }
pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 0.9rem; }
code { font-family: ui-monospace, Consolas, monospace; }
figure.schema { margin: 14px 0; background: var(--surface-2); border-radius: 8px; padding: 10px; }
figure.schema figcaption { font-size: 0.85rem; color: var(--texte-2); text-align: center; }
.schema .trait { fill: none; stroke: var(--texte); stroke-width: 2; }
.schema .accent { fill: var(--accent-fond); stroke: var(--ocre); stroke-width: 2; }
.schema .pointille { stroke-dasharray: 5 4; stroke: var(--texte-2); }
.schema .txt { fill: var(--texte); font-size: 14px; font-family: var(--police); }
.schema .txt.petit { font-size: 12px; fill: var(--texte-2); }
ol.regles li { margin-bottom: 4px; }

/* Questions */
.question { margin-bottom: 16px; }
.question p.enonce { font-weight: 600; margin: 0 0 8px; }
.choix { display: grid; gap: 6px; }
.choix label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 8px; cursor: pointer; background: var(--surface); }
.choix label:hover { background: var(--surface-2); }
.choix input { margin-top: 4px; }
.retour { margin-top: 6px; font-size: 0.92rem; padding: 6px 10px; border-radius: 6px; }
.retour.ok { background: var(--vert-fond); color: var(--vert); }
.retour.ko { background: var(--rouge-fond); color: var(--rouge); }
.score { font-size: 1.3rem; font-weight: 700; }

/* Listes à cocher */
.coche { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--bord); }
.coche:last-child { border-bottom: none; }
.coche input { margin-top: 5px; width: 18px; height: 18px; }
details.corrige { margin-top: 6px; }
details.corrige summary { cursor: pointer; color: var(--primaire); font-size: 0.9rem; }

/* Terrain */
.essai { border: 1px solid var(--bord); border-radius: 8px; padding: 12px; margin-bottom: 12px; background: var(--surface); }
.essai textarea, .champ input, .champ textarea, .champ select { width: 100%; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); }
.essai textarea { min-height: 70px; }
.champ { margin-bottom: 10px; }
.champ label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }

/* Vidéos */
.video { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.video:last-child { border-bottom: none; }
.video .meta { font-size: 0.85rem; color: var(--texte-2); }
.video-cadre { grid-column: 1 / -1; position: relative; padding-top: 56.25%; }
.video-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

/* Labos */
.labo-boite { background: var(--surface-2); border: 1px solid var(--bord); border-radius: 10px; padding: 14px; margin: 14px 0; }
.labo-boite h4 { margin: 0 0 8px; }
.labo-boite label { display: block; font-size: 0.9rem; margin-top: 8px; }
.labo-boite input[type="range"] { width: 100%; }
.labo-boite select, .labo-boite input[type="number"] { font: inherit; padding: 4px; border-radius: 6px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); }
.labo-resultat { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; margin-top: 10px; }
.bandes { display: flex; gap: 6px; margin: 10px 0; align-items: center; }
.bandes span { width: 18px; height: 44px; border-radius: 3px; border: 1px solid var(--bord); }
.corps-resistance { background: #d9c7a0; padding: 0 18px; border-radius: 14px; display: flex; gap: 8px; }

/* Tableau de bord */
.barre { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.barre > div { height: 100%; background: var(--vert); }
.chiffres { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.chiffre { text-align: center; }
.chiffre b { display: block; font-size: 1.8rem; color: var(--primaire); }

.certificat { max-width: 760px; margin: 0 auto; text-align: center; border: 6px double var(--ocre); padding: 36px 24px; background: var(--surface); }
.certificat h1 { font-size: 2rem; }
.certificat .code { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }

.pied-page { text-align: center; color: var(--texte-2); font-size: 0.85rem; padding: 20px 16px 40px; }
.discret { color: var(--texte-2); font-size: 0.9rem; }
.tuteur-reponse { margin-top: 12px; }
.tuteur-reponse .carte { margin-bottom: 10px; }
mark { background: var(--accent-fond); color: inherit; padding: 0 2px; }

@media print {
  .entete, .actions, .pied-page, .nav, .etapes { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; }
}

/* ───────── Accueil : bogolan, photos réelles, portraits ───────── */
.accueil-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; background: #2b2118; color: #f3ead9; border-radius: 16px; padding: 28px 28px 60px; position: relative; overflow: hidden; }
.accueil-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: url("../img/bogolan.svg") repeat-x; }
.ah-marque { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; color: #ffffff; }
.ah-marque small { display: block; font-weight: 500; color: #f2c38b; font-size: 0.85rem; }
.accueil-hero h1 { font-size: 2.4rem; line-height: 1.15; margin: 18px 0 12px; color: #ffffff; }
.accueil-hero h1 em { font-style: normal; color: #f2c38b; }
.accueil-hero .chapo { color: #e8d5b5; font-size: 1.05rem; }
.accueil-hero .chapo strong { color: #ffffff; }
.accueil-hero .btn.ocre { background: #d9893a; color: #2b2118; border-color: #d9893a; }
.accueil-hero .btn.clair { background: transparent; color: #f3ead9; border: 1px solid #e8d5b5; }
.ah-photo { margin: 0; }
.ah-photo img { width: 100%; height: auto; display: block; border-radius: 12px; border: 3px solid #d9893a; }
.ah-photo figcaption, .mosaique figcaption { font-size: 0.72rem; margin-top: 4px; line-height: 1.4; }
.ah-photo figcaption, .ah-photo figcaption a { color: #cdbb9c; }
.portraits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 20px 0 8px; }
.portrait { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--texte); font-size: 0.88rem; text-align: center; line-height: 1.3; }
.portrait svg { width: 100%; max-width: 100px; height: auto; transition: transform .15s; }
.portrait:hover svg { transform: translateY(-3px); }
.mosaique { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mosaique figure { margin: 0; }
.mosaique figure:first-child { grid-column: span 2; }
.mosaique figure:first-child img { aspect-ratio: 16 / 7.6; }
.mosaique figure > a { position: relative; display: block; }
.mosaique img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 12px; }
.mosaique .etiquette { position: absolute; left: 10px; bottom: 10px; background: #2b2118; color: #f3ead9; font-size: 0.85rem; padding: 3px 10px; border-radius: 8px; }
.mosaique figcaption { color: var(--texte-2); }
.cycle-carte { margin-top: 20px; }
img.logo-marque { width: 34px; height: 34px; display: block; background: none; }
@media (max-width: 760px) {
  .accueil-hero { grid-template-columns: 1fr; padding: 20px 18px 56px; }
  .accueil-hero h1 { font-size: 1.8rem; }
  .portraits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mosaique { grid-template-columns: 1fr 1fr; }
  .mosaique figure:first-child { grid-column: span 2; }
  .mosaique .etiquette { font-size: 0.75rem; left: 6px; bottom: 6px; padding: 2px 8px; }
}
