/* =========================================================
   Réviser les biotechnologies en PSTL1 — feuille de style commune
   (utilisée par l'accueil ET par toutes les mini-applis)
   ========================================================= */
:root {
  --bg: #f2f6f5;
  --surface: #ffffff;
  --text: #1d2a2a;
  --muted: #5b6b6b;
  --border: #d9e3e1;
  --accent: #0f7c6e;        /* vert biotech */
  --accent-soft: #e2f3f0;
  --conv: #2f6fd1;          /* rubrique Conversions */
  --conv-soft: #e4effc;
  --grand: #b4561b;         /* rubrique Grandeurs */
  --grand-soft: #ffece0;
  --ok: #1e8a4c;
  --ok-soft: #e4f5ea;
  --ko: #c0392b;
  --ko-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
/* mode sombre */
:root[data-theme="dark"] {
    --bg: #121817; --surface: #1b2322; --text: #e6eeec; --muted: #9fb0ad;
    --border: #2c3836; --accent: #4cc3b1; --accent-soft: #1d3330;
    --conv: #7aa7f0; --conv-soft: #1d2a40; --grand: #f0a06a; --grand-soft: #3a281b;
    --ok: #5fd08f; --ok-soft: #173123; --ko: #f08a7e; --ko-soft: #3b1e1b;
    --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121817; --surface: #1b2322; --text: #e6eeec; --muted: #9fb0ad;
    --border: #2c3836; --accent: #4cc3b1; --accent-soft: #1d3330;
    --conv: #7aa7f0; --conv-soft: #1d2a40; --grand: #f0a06a; --grand-soft: #3a281b;
    --ok: #5fd08f; --ok-soft: #173123; --ko: #f08a7e; --ko-soft: #3b1e1b;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- En-tête ---------- */
.site-header {
  background: var(--accent);
  color: #fff;
  padding: 28px 0 24px;
}
.site-header h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2; }
.site-header p { margin: 6px 0 0; opacity: .9; }
.site-header a { color: #fff; }
.back-link { display: inline-block; margin-bottom: 8px; font-size: .95rem; text-decoration: none; opacity: .9; }
.back-link:hover { text-decoration: underline; }

main.wrap { padding-top: 28px; padding-bottom: 48px; }
h2 { font-size: 1.35rem; margin: 0 0 12px; }

/* ---------- Bloc d'introduction ---------- */
.intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.intro p { margin: 0 0 10px; }
.intro ul { margin: 6px 0 10px; padding-left: 1.2em; }
.intro li { margin: 4px 0; }
.intro .source { font-size: .9rem; color: var(--muted); margin: 12px 0 0; }

/* ---------- Rubriques ---------- */
.rubrique { margin-bottom: 36px; }
.rubrique-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.rubrique-head .badge {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.5rem; flex: none;
}
.rubrique-head h2 { margin: 0; }
.rubrique > p { margin: 0 0 16px; color: var(--muted); }
.rubrique.conversions .badge { background: var(--conv-soft); }
.rubrique.grandeurs  .badge { background: var(--grand-soft); }

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 140px; padding: 16px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center; text-decoration: none; color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.app-tile .icon { font-size: 2.4rem; line-height: 1; }
.app-tile .label { font-weight: 600; font-size: .98rem; }
.app-tile .level { font-size: .85rem; color: var(--muted); }
a.app-tile:hover, a.app-tile:focus-visible { transform: translateY(-2px); border-color: var(--accent); outline: none; }
.conversions a.app-tile:hover { border-color: var(--conv); }
.grandeurs  a.app-tile:hover { border-color: var(--grand); }
.app-tile.soon { border-style: dashed; color: var(--muted); box-shadow: none; }
.app-tile.soon .icon { opacity: .45; }

.site-footer { color: var(--muted); font-size: .9rem; text-align: center; padding: 0 0 28px; }

/* =========================================================
   Composants des mini-applis
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.consigne { color: var(--muted); margin-top: 0; }
.question { font-size: 1.15rem; font-weight: 600; margin: 0 0 14px; }

input[type="text"], input[type="number"], select {
  font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  max-width: 100%;
}
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; border: 0;
  background: var(--accent); color: #fff;
}
.btn.secondary { background: var(--accent-soft); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Feedback */
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 10px; border-left: 5px solid; }
.feedback:empty { display: none; }
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.ko { background: var(--ko-soft); border-color: var(--ko); }
.feedback .titre { font-weight: 700; margin-bottom: 4px; }
.feedback.ok .titre { color: var(--ok); }
.feedback.ko .titre { color: var(--ko); }
.feedback .explication { margin-top: 6px; }

/* Temps de lecture */
.lecture { margin-top: 10px; font-size: .9rem; color: var(--muted); }
.lecture .barre { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.lecture .barre span { display: block; height: 100%; width: 100%; background: var(--ko); transition: width linear; }

.score { font-weight: 600; }

/* Bilan de fin d'exercice (commun à toutes les mini-applis) */
.bilan-titre { margin: 4px 0 6px; }
.bilan-score { font-size: 1.05rem; color: var(--muted); }
.bilan-score .nb { font-size: 2.2rem; font-weight: 800; color: var(--text); margin-right: 4px; }
.bilan-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; margin: 14px 0; }
.bilan-col { border-radius: 12px; padding: 12px 16px; border-left: 5px solid; min-width: 0; }
.bilan-col.ok { background: var(--ok-soft); border-color: var(--ok); }
.bilan-col.ko { background: var(--ko-soft); border-color: var(--ko); }
.bilan-col h3, .bilan-travail h3 { margin: 0 0 8px; font-size: 1.05rem; }
.bilan-col ul, .bilan-travail ul { margin: 0; padding-left: 1.1em; }
.bilan-col li, .bilan-travail li { margin: 8px 0; overflow-wrap: anywhere; }
.bilan-col .vide { margin: 0; color: var(--muted); }
.bilan-col .detail, .bilan-travail .detail { font-size: .92rem; color: var(--muted); margin-top: 2px; }
.bilan-travail { background: var(--grand-soft); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.bilan-travail .fois { color: var(--muted); font-size: .9rem; }
.bilan-col sub, .bilan-travail sub { font-style: normal; }
.maths { font-family: "Cambria Math", Cambria, "Times New Roman", serif; font-size: 1.1em; }
.maths sub { font-style: normal; }

/* Fractions écrites « haut / bas » */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.15; margin: 0 .15em; font-size: .95em; }
.frac > span { padding: 0 .25em; white-space: nowrap; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; }
.eq { white-space: nowrap; }

/* =========================================================
   Utilisation sur téléphone (écrans tactiles)
   ========================================================= */
button, .btn, a.app-tile, .w, .back-link { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn { min-height: 44px; }
.textes button, .modes button { min-height: 44px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: -10px; padding-right: 10px; }
select { min-height: 44px; font-size: max(16px, 1em); }   /* 16 px mini : évite le zoom automatique sur iPhone */
@media (hover: none) { a.app-tile:hover { transform: none; } .w:hover { background: transparent; } }
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header { padding: 14px 0 16px; }
  .site-header h1 { font-size: 1.45rem; }
  .site-header p { font-size: .95rem; }
  main.wrap { padding-top: 16px; padding-bottom: 32px; }
  .intro, .card { padding: 16px 14px; }
  .intro { margin-bottom: 24px; }
  .rubrique { margin-bottom: 28px; }
  .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .app-tile { min-height: 120px; padding: 12px 8px; }
  .app-tile .icon { font-size: 2rem; }
  .app-tile .label { font-size: .95rem; }
  .row > .btn { flex: 1 1 auto; }
}

/* =========================================================
   ACCUEIL v2 : fond blanc, bandeau illustré, rubriques pastel
   Palette pastel des rubriques (une par rubrique) :
   bleu = Conversions · peche = Grandeurs · menthe, lavande, jaune = suivantes
   ========================================================= */
:root {
  --ban-haut: #e3f4f1; --ban-bas: #f6fbfa; --ban-joint: #d2e9e4;
  --ban-paillasse: #c9d5d3; --ban-paillasse-bord: #aebfbc; --blanc: #ffffff;
}
:root[data-theme="dark"] { --ban-haut: #1c3330; --ban-bas: #20302d; --ban-joint: #2a403c; --ban-paillasse: #3a4a48; --ban-paillasse-bord: #4b5d5a; --blanc: #1b2322; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ban-haut: #1c3330; --ban-bas: #20302d; --ban-joint: #2a403c; --ban-paillasse: #3a4a48; --ban-paillasse-bord: #4b5d5a; --blanc: #1b2322; } }

.theme-bleu    { --r-fond: #e4effc; --r-bord: #c5dbf6; --r-fonce: #2f62b5; }
.theme-peche   { --r-fond: #ffece0; --r-bord: #f8d2b8; --r-fonce: #b4561b; }
.theme-menthe  { --r-fond: #e0f5ec; --r-bord: #bfe6d4; --r-fonce: #1f7a55; }
.theme-lavande { --r-fond: #eeeafb; --r-bord: #d6cff3; --r-fonce: #5a48a8; }
.theme-jaune   { --r-fond: #fff6d6; --r-bord: #f3e2a2; --r-fonce: #8a6a00; }
:root[data-theme="dark"] .rubrique { --r-fond: color-mix(in srgb, var(--r-fonce) 22%, #1b2322); --r-bord: color-mix(in srgb, var(--r-fonce) 45%, #1b2322); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rubrique { --r-fond: color-mix(in srgb, var(--r-fonce) 22%, #1b2322); --r-bord: color-mix(in srgb, var(--r-fonce) 45%, #1b2322); } }

.accueil .site-header { padding: 26px 0 20px; }
.bandeau { height: clamp(150px, 21.7vw, 280px); overflow: hidden; border-bottom: 1px solid var(--border); background: var(--ban-bas); }
.bandeau svg { display: block; width: 100%; height: 100%; }

.accueil .intro { box-shadow: none; border-color: var(--border); }

.accueil .rubrique-head { gap: 14px; margin-bottom: 8px; }
.accueil .rubrique-head .badge { width: 56px; height: 56px; border-radius: 16px; background: var(--r-fond); border: 2px solid var(--r-bord); color: var(--r-fonce); padding: 6px; }
.accueil .rubrique-head .badge svg { width: 100%; height: 100%; }
.accueil .rubrique-head .numero { display: block; font-size: .9rem; font-weight: 600; color: var(--r-fonce); }
.accueil .rubrique-desc { margin: 0 0 16px; color: var(--muted); }

.accueil .app-tile { background: var(--r-fond); border: 2px solid var(--r-bord); box-shadow: none; }
.accueil .app-tile .icon { width: 64px; height: 64px; border-radius: 50%; background: var(--blanc); display: grid; place-items: center; font-size: 2rem; }
.accueil .app-tile .level { color: var(--r-fonce); font-weight: 600; }
.accueil a.app-tile:hover, .accueil a.app-tile:focus-visible { border-color: var(--r-fonce); transform: translateY(-2px); }
.accueil .app-tile.soon { background: var(--blanc); border: 2px dashed var(--r-bord); }
.accueil .app-tile.soon .icon { background: var(--r-fond); }
@media (max-width: 600px) {
  .accueil .rubrique-head .badge { width: 48px; height: 48px; }
  .accueil .app-tile .icon { width: 54px; height: 54px; font-size: 1.7rem; }
}
.site-header { background: #0f7c6e; }

/* Bandeau illustré de chaque rubrique */
.rub-bandeau { height: clamp(110px, 15vw, 170px); border-radius: 16px; overflow: hidden; border: 2px solid var(--r-bord); margin-bottom: 14px; background: var(--r-fond); }
.rub-bandeau img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
.accueil .rubrique { margin-bottom: 44px; }

/* Chaque rubrique dans un encadré (fond de page légèrement teinté pour le faire ressortir) */
.accueil .intro { box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
.accueil .rubrique { background: var(--surface); border: 2px solid var(--r-bord); border-radius: 20px; padding: 18px 22px 22px; box-shadow: 0 2px 12px rgba(0, 0, 0, .05); margin-bottom: 28px; overflow: hidden; }
.accueil .rub-bandeau { margin: -18px -22px 16px; border: 0; border-bottom: 2px solid var(--r-bord); border-radius: 0; }
@media (max-width: 600px) {
  .accueil .rubrique { padding: 14px 14px 16px; border-radius: 16px; }
  .accueil .rub-bandeau { margin: -14px -14px 14px; }
}

/* =========================================================
   Mini-applis de la rubrique Conversions (styles communs)
   ========================================================= */
.progression { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .95rem; color: var(--muted); margin-bottom: 8px; }
.jauge { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 18px; }
.jauge span { display: block; height: 100%; width: 0; background: var(--conv); transition: width .3s; }
.contexte { font-size: .95rem; color: var(--muted); margin: 0 0 4px; }
.enonce { font-size: clamp(1.2rem, 4.5vw, 1.45rem); margin: 0 0 10px; }
.badge-sci { display: inline-block; margin: 0 0 12px; padding: 4px 10px; border-radius: 999px; background: var(--conv-soft); color: var(--conv); font-weight: 600; font-size: .92rem; }
.saisie { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 8px; font-size: 1.3rem; margin-bottom: 6px; }
.saisie #mant, .saisie .mant { width: 8.5em; font-size: 1.2rem; text-align: right; }
.saisie .fois { padding-top: 14px; white-space: nowrap; }
.saisie .exp-zone { display: inline-flex; gap: 4px; align-items: center; margin-top: -6px; }
.saisie #exp, .saisie .exp { width: 3.6em; font-size: 1rem; text-align: center; padding: 8px 6px; }
.saisie .pm { font: inherit; font-size: 1rem; min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.saisie .unite-cible { padding-top: 14px; font-weight: 700; }
.aide-saisie { font-size: .9rem; color: var(--muted); margin: 0 0 14px; }
.indice { margin-top: 6px; }
.feedback sup, .enonce sup, .bilan sup { font-size: .7em; }
@media (max-width: 600px) { .saisie #mant, .saisie .mant { width: 7em; } }
/* saisie compacte : valeur × 10^n et unité sur une seule ligne */
.saisie { font-size: 1.15rem; gap: 6px; align-items: flex-start; }
.saisie .fois, .saisie .unite-cible { padding-top: 12px; white-space: nowrap; }
@media (max-width: 600px) {
  .saisie #mant, .saisie .mant { width: 5.6em; font-size: 1.1rem; padding: 10px 8px; }
  .saisie #exp, .saisie .exp { width: 2.9em; }
  .saisie .pm { min-width: 40px; }
}

/* Nom de code et envoi des résultats */
.nom-de-code { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; font-size: .98rem; }
.nom-de-code label { display: block; margin-bottom: 6px; }
.nom-de-code input { width: 12em; }
.nom-de-code .aide { font-size: .88rem; color: var(--muted); margin: 6px 0 0; }
.nom-de-code .lien { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
.accueil .nom-de-code { margin: -12px 0 28px; border: 1px solid var(--border); background: var(--surface); }
.envoi-statut { margin: 0 0 14px; font-weight: 600; }
.envoi-statut:empty { display: none; }
/* Code de résultats et carnet */
.envoi-statut { font-weight: 400; }
.boite-code { border: 2px dashed var(--accent); border-radius: 12px; padding: 12px 14px; background: var(--accent-soft); }
.boite-code .titre-code { font-weight: 700; margin-bottom: 4px; }
.boite-code .aide { font-size: .92rem; margin: 0 0 8px; }
.boite-code textarea { width: 100%; font: 13px/1.4 ui-monospace, Consolas, monospace; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; overflow-wrap: anywhere; margin-bottom: 8px; }
.carnet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 28px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.carnet h2 { font-size: 1.15rem; }
.carnet ul { margin: 0 0 12px; padding-left: 1.2em; }
.carnet .aide { color: var(--muted); font-size: .92rem; }
.carnet .btn.secondary { margin-top: 10px; }
.accueil .nom-de-code { margin: -12px 0 14px; }
.site-footer a { color: var(--muted); }
.nom-de-code .aide.refus { color: var(--ko); background: var(--ko-soft); border-radius: 8px; padding: 8px 10px; }
.nom-de-code .aide.refus strong { color: inherit; }
.nom-de-code .propose { margin-top: 8px; color: var(--text); }
.carnet .lien-cr { display: inline-block; margin: 0 0 14px; text-decoration: none; }
