/* Plateforme QCM — Initiation à Linux */
:root {
  --fond: #f4f2ee;
  --carte: #ffffff;
  --encre: #1d2330;
  --encre-2: #5a6272;
  --ligne: #e3dfd8;
  --accent: #e95420;        /* orange Ubuntu */
  --accent-fonce: #c2410c;
  --accent-pale: #fdeee7;
  --terminal: #2c001e;      /* aubergine Ubuntu */
  --vert: #15803d;
  --vert-pale: #e7f5ec;
  --rouge: #b91c1c;
  --rouge-pale: #fdecec;
  --ambre: #b45309;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(29,35,48,.06), 0 4px 16px rgba(29,35,48,.06);
  --mono: ui-monospace, "SFMono-Regular", "Ubuntu Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--fond); color: var(--encre);
  font: 16px/1.55 "Ubuntu", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
a { color: var(--accent-fonce); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* En-tête */
.entete { background: var(--terminal); color: #fff; position: sticky; top: 0; z-index: 20; }
.entete-in { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: .95rem; min-width: 0; }
.marque span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt { font-family: var(--mono); background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.lien-discret { color: #f3d6e4; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.lien-discret:hover { color: #fff; text-decoration: underline; }

.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 16px 48px; }
.pied { text-align: center; color: var(--encre-2); font-size: .82rem; padding: 18px 16px 24px; }

/* Cartes, textes */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 24px; }
.carte-etroite { max-width: 680px; margin: 0 auto; }
.surtitre { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--accent-fonce); margin: 0 0 .5em; }
.meta { color: var(--encre-2); margin: 0 0 1.2em; }
.aide { color: var(--encre-2); font-size: .88rem; }
.chapo { font-size: 1.1rem; color: var(--encre-2); max-width: 46ch; }

/* Alertes */
.alerte { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-size: .95rem; border: 1px solid; }
.alerte-erreur { background: var(--rouge-pale); border-color: #f5c2c2; color: var(--rouge); }
.alerte-succes { background: var(--vert-pale); border-color: #b9e2c6; color: var(--vert); }
.alerte-info { background: var(--accent-pale); border-color: #f7c9b4; color: var(--accent-fonce); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-principal { background: var(--accent); color: #fff; }
.btn-principal:hover { background: var(--accent-fonce); }
.btn-sec { background: #fff; color: var(--encre); border-color: var(--ligne); }
.btn-sec:hover:not(:disabled) { border-color: var(--encre-2); }
.btn-terminer { background: var(--terminal); color: #fff; }
.btn-terminer:hover { background: #4a0a35; }
.btn-grand { width: 100%; padding: 15px; font-size: 1.05rem; }
.btn-mini { font: inherit; font-size: .8rem; padding: 5px 9px; border-radius: 7px; border: 1px solid var(--ligne); background: #fff; cursor: pointer; }
.btn-mini.danger { color: var(--rouge); }
.btn-mini:hover { border-color: var(--encre-2); }

/* Formulaires */
.formulaire { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
label small { font-weight: 400; color: var(--encre-2); }
input:not([type=radio]):not([type=checkbox]) { font: inherit; font-weight: 400; padding: 11px 12px; border: 1px solid var(--ligne); border-radius: 9px; background: #fff; width: 100%; color: var(--encre); }
input:focus-visible, button:focus-visible { outline: 3px solid rgba(233,84,32,.35); outline-offset: 1px; border-color: var(--accent); }
.ligne2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.case { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 8px 0 16px; }
.case input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Accueil */
.accueil { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: start; }
.accueil-intro { padding-top: 12px; }
.faits { list-style: none; padding: 0; margin: 28px 0; display: flex; gap: 12px; flex-wrap: wrap; }
.faits li { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 12px 18px; display: grid; min-width: 104px; }
.fait-n { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; color: var(--accent-fonce); line-height: 1.1; }
.faits li span:last-child { color: var(--encre-2); font-size: .85rem; }
.chapitres { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.chapitres li { display: flex; gap: 12px; align-items: baseline; color: var(--encre-2); }
.chapitres span { font-family: var(--mono); font-size: .8rem; background: var(--terminal); color: #fff; padding: 2px 8px; border-radius: 5px; flex: none; }
.onglets { display: grid; grid-template-columns: 1fr 1fr; background: var(--fond); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.onglet { font: inherit; font-weight: 600; border: 0; background: transparent; padding: 10px; border-radius: 8px; cursor: pointer; color: var(--encre-2); }
.onglet.actif { background: #fff; color: var(--encre); box-shadow: var(--ombre); }

.consignes { padding-left: 1.2em; margin: 0 0 20px; display: grid; gap: 8px; }

/* Examen */
.examen { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.panneau { position: sticky; top: 84px; }
.panneau .meta { margin-bottom: 14px; font-weight: 600; color: var(--encre); }
.panneau .meta span { font-family: var(--mono); font-weight: 400; color: var(--encre-2); font-size: .85rem; }
.progression p { margin: 6px 0 14px; font-size: .88rem; color: var(--encre-2); }
.progression-barre { height: 6px; background: var(--fond); border-radius: 99px; overflow: hidden; }
.progression-barre span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.grille { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
.case-q { font: 600 .82rem/1 var(--mono); padding: 8px 0; border-radius: 7px; border: 1px solid var(--ligne); background: #fff; cursor: pointer; color: var(--encre-2); }
.case-q.repondue { background: var(--terminal); border-color: var(--terminal); color: #fff; }
.case-q.courante { outline: 2px solid var(--accent); outline-offset: 1px; }
.etat-sauvegarde { font-size: .8rem; color: var(--encre-2); margin: 0 0 12px; min-height: 1.2em; }
.etat-sauvegarde.ok { color: var(--vert); }
.etat-sauvegarde.ko { color: var(--rouge); }
.panneau .btn-terminer { width: 100%; }

.question { margin: 0 0 16px; border: 1px solid var(--ligne); min-width: 0; }
.js .question { display: none; }
.js .question.visible { display: block; animation: apparait .18s ease-out; }
@keyframes apparait { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.q-num { font-family: var(--mono); color: var(--accent-fonce); font-weight: 700; margin: 0 0 8px; font-size: .9rem; }
.q-num span { color: var(--encre-2); font-weight: 400; }
.q-enonce { font-size: clamp(1.1rem, 2.2vw, 1.35rem); font-weight: 600; margin-bottom: 20px; }
.choix { display: grid; gap: 10px; }
.option { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1.5px solid var(--ligne); border-radius: 10px; cursor: pointer; font-weight: 400; font-size: 1rem; transition: border-color .12s, background .12s; }
.option:hover { border-color: #cfc8bd; background: #fcfbf9; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-l { flex: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font: 700 .85rem var(--mono); background: var(--fond); color: var(--encre-2); }
.option-t { padding-top: 2px; overflow-wrap: anywhere; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); }
.option:has(input:checked) .option-l { background: var(--accent); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid rgba(233,84,32,.35); }
.q-nav { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--ligne); }
.lien-effacer { color: var(--encre-2); font-weight: 400; }

/* Chronomètre */
.chrono { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); padding: 6px 12px; border-radius: 10px; }
.chrono-lib { font-size: .78rem; color: #f3d6e4; }
.chrono-val { font: 700 1.35rem/1 var(--mono); letter-spacing: .03em; min-width: 4.2ch; text-align: right; }
.chrono.alerte5 { background: var(--ambre); border-color: var(--ambre); }
.chrono.alerte1 { background: var(--rouge); border-color: var(--rouge); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .75; } }

/* Modale */
.modale { position: fixed; inset: 0; background: rgba(29,35,48,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modale-boite { max-width: 460px; width: 100%; }
.modale-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

/* Résultat */
.resultat { text-align: center; }
.note-bloc { position: relative; width: 210px; height: 210px; margin: 12px auto 4px; }
.anneau { width: 100%; height: 100%; }
.anneau circle { fill: none; stroke-width: 10; }
.anneau-fond { stroke: var(--fond); }
.anneau-val { stroke-linecap: round; transition: stroke-dasharray 1s; }
.admis .anneau-val { stroke: var(--vert); }
.ajourne .anneau-val { stroke: var(--accent); }
.note-txt { position: absolute; inset: 0; display: grid; place-content: center; }
.note-val { font: 700 3.1rem/1 var(--mono); letter-spacing: -.03em; }
.note-sur { color: var(--encre-2); font-family: var(--mono); }
.mention { font-weight: 700; font-size: 1.1rem; margin: 4px 0 20px; }
.recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.recap div { background: var(--fond); border-radius: 10px; padding: 12px 8px; }
.recap dt { font-size: .78rem; color: var(--encre-2); }
.recap dd { margin: 4px 0 0; font-weight: 700; font-family: var(--mono); }

/* Admin */
.admin-tete { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.stats { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stats li { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 14px; font-size: .82rem; color: var(--encre-2); display: grid; }
.stats span { font: 700 1.5rem/1.2 var(--mono); color: var(--encre); }
.recherche { display: flex; gap: 10px; margin: 18px 0 14px; }
.tableau-wrap { padding: 0; overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th, .tableau td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--ligne); white-space: nowrap; }
.tableau th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-2); background: #faf9f6; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.note-cell { font-family: var(--mono); font-weight: 700; }
.note-cell.admis { color: var(--vert); }
.note-cell.ajourne { color: var(--rouge); }
.actions { display: flex; gap: 6px; }
.vide { text-align: center !important; color: var(--encre-2); padding: 28px !important; }
.pastille { font-size: .78rem; padding: 3px 8px; border-radius: 99px; background: var(--fond); color: var(--encre-2); }
.pastille.ok { background: var(--vert-pale); color: var(--vert); }
.pastille.cours { background: var(--accent-pale); color: var(--accent-fonce); }

/* Responsive */
@media (max-width: 900px) {
  .accueil { grid-template-columns: 1fr; gap: 24px; }
  .examen { grid-template-columns: 1fr; }
  .panneau { position: static; order: 2; }
  .grille { grid-template-columns: repeat(10, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .page { padding-top: 20px; }
  .carte { padding: 18px; }
  .ligne2 { grid-template-columns: 1fr; }
  .marque span:last-child { display: none; }
  .chrono-lib { display: none; }
  .grille { grid-template-columns: repeat(6, 1fr); }
  .recap { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .q-nav .btn { flex: 1; }
}
