/* Appli d'entraînement — mobile d'abord, lisible sur le portable Windows aussi.
   Sobre volontairement : pas de gamification, pas de couleurs criardes. */

:root {
  --fond: #fbfaf7;
  --carte: #ffffff;
  --texte: #17201c;
  --gris: #5d6b64;
  --bord: #dfe3e0;
  --vert: #1f6f4a;
  --vert-clair: #e7f2ec;
  --rouge: #a4262c;
  --rouge-clair: #fbeceb;
  --jaune-clair: #fdf6e3;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141816; --carte: #1d2321; --texte: #e9efeb; --gris: #9aa9a1;
    --bord: #2e3733; --vert: #63c396; --vert-clair: #172b22;
    --rouge: #f08a86; --rouge-clair: #2c1a1a; --jaune-clair: #2a2519;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 0;
}
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }

h1 { font-size: 1.6rem; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.sous { color: var(--gris); font-size: 0.92rem; }
em { color: var(--gris); font-style: normal; font-size: 0.85em; display: block; }

a { color: var(--vert); }
.retour { display: inline-block; margin-bottom: 12px; font-size: 0.92rem; text-decoration: none; }

/* --- cartes d'accueil --- */
.cartes { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 20px 0; }
@media (max-width: 420px) { .cartes { grid-template-columns: 1fr; } }
.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r);
  padding: 18px 16px; text-decoration: none; color: inherit; display: block;
}
.carte:active { transform: scale(0.99); }
.carte .ico { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.carte strong { display: block; font-size: 1.05rem; }
.carte .det { color: var(--gris); font-size: 0.85rem; }

.stats { display: flex; gap: 10px; margin-top: 20px; }
.stats div {
  flex: 1; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r);
  padding: 12px 8px; text-align: center;
}
.stats b { display: block; font-size: 1.3rem; }
.stats span { color: var(--gris); font-size: 0.75rem; }

/* --- listes et boutons --- */
.liste { display: flex; flex-direction: column; gap: 8px; }
.ligne, .carte, button, select, input, textarea { font-family: inherit; font-size: 1rem; }
.ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: var(--carte); color: inherit;
  border: 1px solid var(--bord); border-radius: var(--r); padding: 14px 16px;
  text-decoration: none; cursor: pointer;
}
.ligne.prio { border-left: 4px solid var(--rouge); }
.badge {
  background: var(--vert-clair); color: var(--vert); border-radius: 20px;
  padding: 2px 10px; font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
button.gros {
  display: block; width: 100%; padding: 16px; margin: 18px 0 0;
  background: var(--vert); color: #fff; border: 0; border-radius: var(--r);
  font-size: 1.05rem; font-weight: 600; cursor: pointer;
}
a.gros.lien { text-align: center; text-decoration: none; }
.lien-nu { background: none; border: 0; color: var(--vert); cursor: pointer; padding: 0; font-size: inherit; }

/* --- QCM --- */
.barre { height: 5px; background: var(--bord); border-radius: 3px; margin-bottom: 14px; }
.barre > div { height: 100%; background: var(--vert); border-radius: 3px; transition: width .25s; }
.enonce { font-size: 1.15rem; margin: 6px 0 16px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  text-align: left; padding: 15px 16px; background: var(--carte); color: inherit;
  border: 1.5px solid var(--bord); border-radius: var(--r); cursor: pointer;
}
.option:disabled { cursor: default; opacity: 1; }
.option.juste { border-color: var(--vert); background: var(--vert-clair); font-weight: 600; }
.option.faux { border-color: var(--rouge); background: var(--rouge-clair); }
.retour-info { margin: 16px 0; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--bord); }
.retour-info.ok { background: var(--vert-clair); border-color: var(--vert); }
.retour-info.ko { background: var(--rouge-clair); border-color: var(--rouge); }
.retour-info p { margin: 6px 0 0; font-size: 0.92rem; }
.notes { display: flex; gap: 8px; }
.notes button {
  flex: 1; padding: 14px 4px; background: var(--carte); color: inherit;
  border: 1px solid var(--bord); border-radius: var(--r); cursor: pointer; font-size: 0.9rem;
}
.rates { margin: 0 0 8px; padding-left: 20px; color: var(--gris); font-size: 0.92rem; }

/* --- fiches --- */
.consigne {
  background: var(--jaune-clair); border-left: 3px solid var(--vert);
  padding: 12px 14px; border-radius: 0 var(--r) var(--r) 0; font-size: 0.93rem;
}
.ex { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.q { margin: 14px 0 0; }
.q label { display: block; margin-bottom: 6px; font-size: 0.96rem; }
.q input, .q textarea, .q select {
  width: 100%; padding: 12px; border: 1.5px solid var(--bord); border-radius: 10px;
  background: var(--fond); color: inherit;
}
.q input:disabled, .q textarea:disabled, .q select:disabled { opacity: .75; }
.q.calc {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r);
  padding: 14px; margin-bottom: 10px;
  display: grid; gap: 8px; grid-template-columns: 1fr 1fr; align-items: center;
}
.q.calc .calc-enonce { grid-column: 1 / -1; font-size: 1.1rem; font-weight: 600; }
.q.calc .verdict { grid-column: 1 / -1; }
@media (max-width: 480px) { .q.calc { grid-template-columns: 1fr; } }
.verdict:empty { display: none; }
.verdict { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; border: 1px solid var(--bord); }
.verdict.ok { background: var(--vert-clair); border-color: var(--vert); }
.verdict.ko { background: var(--rouge-clair); border-color: var(--rouge); }
.verdict.info { background: var(--jaune-clair); }
.verdict p { margin: 5px 0 0; }
.pastille { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 20px; font-size: 0.75rem; }
.pastille.ok { background: var(--vert); color: #fff; }
.pastille.ko { background: var(--rouge); color: #fff; }
.bilan { margin-top: 20px; padding: 18px; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r); }
.bilan h2 { margin: 0; font-size: 2rem; }

/* --- tableaux --- */
.scroll-x { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; font-size: 0.9rem; }
th, td { border: 1px solid var(--bord); padding: 7px 12px; text-align: center; white-space: nowrap; }
th { background: var(--vert-clair); }

.alerte { background: var(--jaune-clair); border: 1px solid var(--bord); padding: 12px 14px; border-radius: var(--r); }
.pied { max-width: 720px; margin: 0 auto; padding: 0 16px 28px; color: var(--gris); font-size: 0.85rem; }
