/* =====================================================================
   Cap Bac STI2D — interface v5 « Abysse sobre »
   Chargée en dernier : elle remplace l'habillage des couches précédentes.
   Principes : surfaces plates, filets de 1 px, une seule couleur d'accent,
   la couleur de matière seulement en repère (pastille, soulignement).
   ===================================================================== */
:root {
  --bg: #0f1115;
  --bg-side: #121419;
  --s1: #15181e;
  --s2: #1a1e25;
  --s3: #20252e;
  --s4: #283040;
  --bd: #252a33;
  --bd2: #313845;
  --t1: #e8ebf1;
  --t2: #b3bbc9;
  --t3: #7e8798;
  --t4: #5d6575;
  --ac: #8db7ff;
  --ac-weak: rgba(141, 183, 255, .12);
  --ok: #6fcf97;
  --ko: #f08a8a;
  --warn: #e6c36a;
  --r: 8px;
  --r-sm: 6px;
  --top: 56px;
  --side-w: 272px;
  --read: 860px;
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --num: var(--font-sans);
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", monospace;
  /* anciennes variables ramenées vers la nouvelle palette */
  --backdrop: var(--bg); --ground: var(--bg); --sunken: var(--s1); --raised: var(--s1); --card: var(--s2);
  --hover: var(--s3); --line: var(--bd); --fg: var(--t1); --dim: var(--t2); --faint: var(--t3); --strong: var(--t3);
  --accent: var(--ac); --lift: none;
  color-scheme: dark;
}
/* couleurs de matières, désaturées */
body[data-page="sin"], body[data-page="i2d"], body[data-page="ee"], body[data-page="ac"], body[data-page="itec"] { --mat: #e0a971; }
body[data-page="maths-tc"] { --mat: #8db7ff; }
body[data-page="maths-spe"] { --mat: #b19cf0; }
body[data-page="pc"] { --mat: #6cc9d6; }
body[data-page="ang"] { --mat: #90b4e8; }
body[data-page="lvb"] { --mat: #e89a86; }
body[data-page="philo"] { --mat: #d9a1c4; }
body[data-page="hg"] { --mat: #d5c07f; }
body[data-page="emc"], body[data-page="methode"], body[data-page="eps"], body[data-page="training"], body[data-page="programme"] { --mat: #8cc7a6; }
body[data-page="index"] { --mat: var(--ac); }

html { scroll-padding-top: calc(var(--top) + 64px); background: var(--bg); }
html body {
  background: var(--bg);
  color: var(--t1);
  font: 15px/1.65 var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
::selection { background: rgba(141, 183, 255, .28); }
a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ac) !important; outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: #2b313c transparent; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--t1); letter-spacing: -.01em; }
b, strong { font-weight: 600; color: var(--t1); }
.small { font-size: 13px; } .muted { color: var(--t3); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- squelette ---------- */
html body .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 0; padding: 0; min-height: 100vh; }
html body .main {
  background: none; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none;
  padding: 0 clamp(20px, 4vw, 56px) 96px; max-width: none; margin: 0; min-height: 100vh; width: auto;
}
.main > :not(.topbar) { max-width: var(--read); margin-left: auto; margin-right: auto; }
body[data-page="index"] .main > :not(.topbar), body[data-page="training"] .main > :not(.topbar) { max-width: 1120px; }
.reveal, .reveal.in { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ---------- barre latérale ---------- */
html body .side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  background: var(--bg-side); border: 0; border-right: 1px solid var(--bd); border-radius: 0; box-shadow: none;
  padding: 0; display: flex; flex-direction: column;
}
.sb-top { padding: 16px 14px 10px; display: grid; gap: 12px; position: sticky; top: 0; background: var(--bg-side); z-index: 2; }
.sb-brand { display: flex; align-items: center; gap: 10px; color: var(--t1); font-weight: 600; font-size: 14.5px; padding: 2px 4px; }
.sb-brand:hover { text-decoration: none; }
.sb-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--s3); border: 1px solid var(--bd2); display: grid; place-items: center; }
.sb-mark svg { width: 16px; height: 16px; }
.sb-brand small { display: block; color: var(--t3); font-weight: 400; font-size: 12px; margin-top: -2px; }
.sb-search {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 8px 0 10px; cursor: pointer;
  background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r-sm); color: var(--t3); font: inherit; font-size: 13px; text-align: left;
}
.sb-search:hover { border-color: var(--bd2); color: var(--t2); }
.sb-search span { flex: 1; }
kbd, .kbd { font: 500 11px var(--font-sans); color: var(--t3); background: var(--s2); border: 1px solid var(--bd); border-bottom-width: 1px; border-radius: 4px; padding: 1px 5px; box-shadow: none; }
.sb-body { padding: 4px 8px 16px; flex: 1; }
.sb-nav { display: grid; gap: 1px; margin-bottom: 14px; }
.sb-item, .sb-subject > summary {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 5px 8px; border-radius: var(--r-sm);
  color: var(--t2); font-size: 13.5px; font-weight: 500; cursor: pointer; list-style: none; user-select: none;
}
.sb-item:hover, .sb-subject > summary:hover { background: var(--s2); color: var(--t1); text-decoration: none; }
.sb-item.on { background: var(--s3); color: var(--t1); }
.sb-item svg.i { color: var(--t3); }
.sb-item.on svg.i { color: var(--t1); }
.sb-label { color: var(--t4); font-size: 11.5px; font-weight: 600; padding: 14px 8px 6px; }
.sb-subject > summary::-webkit-details-marker { display: none; }
.sb-subject > summary .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin: 0 4px; }
.sb-subject > summary .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-subject > summary .ct { color: var(--t4); font: 500 11.5px var(--num); }
.sb-subject > summary .chev { width: 14px; height: 14px; color: var(--t4); transition: transform .15s; }
.sb-subject[open] > summary .chev { transform: rotate(90deg); }
.sb-subject.here > summary { color: var(--t1); }
.sb-chapters { list-style: none; margin: 2px 0 8px 19px; padding: 0 0 0 10px; border-left: 1px solid var(--bd); }
.sb-chapters a {
  display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border-radius: var(--r-sm);
  color: var(--t3); font-size: 13px; line-height: 1.4;
}
.sb-chapters a:hover { color: var(--t1); background: var(--s2); text-decoration: none; }
.sb-chapters a .n { flex: none; min-width: 22px; font: 500 11px var(--num); color: var(--t4); }
.sb-chapters a.active { color: var(--t1); background: var(--s3); }
.sb-chapters a.active .n { color: var(--mat); }
.sb-chapters li.done a .n { color: var(--ok); }
.sb-chapters li.done a .n::before { content: "✓"; display: inline-block; width: 0; overflow: visible; margin-left: -12px; margin-right: 12px; font-family: var(--font-sans); }
.sb-foot { padding: 10px 12px 14px; border-top: 1px solid var(--bd); display: flex; gap: 4px; position: sticky; bottom: 0; background: var(--bg-side); }
.sb-tool {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: var(--r-sm);
  background: none; border: 1px solid transparent; color: var(--t3); font: inherit; font-size: 12.5px; cursor: pointer;
}
.sb-tool:hover { background: var(--s2); color: var(--t1); }
.sb-tool.on { background: var(--ac-weak); color: var(--ac); }

/* ---------- barre supérieure ---------- */
html body .topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; gap: 12px;
  margin: 0 calc(-1 * clamp(20px, 4vw, 56px)) 0; padding: 0 clamp(20px, 4vw, 56px);
  background: rgba(15, 17, 21, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 0; border-bottom: 1px solid var(--bd); border-radius: 0; box-shadow: none; max-width: none;
}
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; font-size: 13.5px; color: var(--t3); white-space: nowrap; overflow: hidden; }
.crumb a { color: var(--t3); }
.crumb a:hover { color: var(--t1); text-decoration: none; }
.crumb .sep { width: 14px; height: 14px; color: var(--t4); flex: none; }
.crumb b, .crumb .cur { color: var(--t1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumb .num { font: 500 12px var(--num); color: var(--t3); margin-right: 2px; }
html body .top-search {
  display: inline-flex; align-items: center; gap: 10px; height: 34px; width: 280px; padding: 0 8px 0 10px; margin: 0;
  background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r-sm); color: var(--t3); font: inherit; font-size: 13px; cursor: pointer; box-shadow: none;
}
html body .top-search:hover { border-color: var(--bd2); color: var(--t2); }
html body .top-search span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .top-search::before { content: none; }
.top-hub { display: none !important; }
.top-pager { display: flex; gap: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; color: var(--t3); cursor: pointer; padding: 0;
}
.icon-btn:hover:not(:disabled) { background: var(--s2); color: var(--t1); text-decoration: none; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.top-menu { display: none; }
html body .menu-btn { display: none !important; }

/* ---------- boutons ---------- */
html body .btn, html body .button-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; margin: 0;
  background: var(--s2); border: 1px solid var(--bd2); border-radius: var(--r-sm); color: var(--t2);
  font: 500 13px var(--font-sans); line-height: 1; cursor: pointer; box-shadow: none; text-decoration: none; transform: none; white-space: nowrap;
}
html body .btn:hover, html body .button-secondary:hover { background: var(--s3); color: var(--t1); border-color: var(--bd2); text-decoration: none; transform: none; }
html body .btn.on { background: var(--ac-weak); border-color: rgba(141, 183, 255, .35); color: var(--ac); }
html body .button-primary {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--t1); color: #0f1115; border: 1px solid var(--t1); font: 600 13.5px var(--font-sans); box-shadow: none; transform: none;
}
html body .button-primary:hover { background: #fff; text-decoration: none; transform: none; box-shadow: none; }
html body .button-primary span { display: none; }

/* ---------- textes génériques ---------- */
html body .eyebrow, .hero-copy .eyebrow {
  display: block; color: var(--t3); font: 500 12.5px var(--font-sans); letter-spacing: 0; text-transform: none; margin: 0 0 6px;
}
.eyebrow i { display: none; }
html body .lead { color: var(--t2); font-size: 15.5px; line-height: 1.65; max-width: 68ch; }
html body .chip {
  display: inline-flex; align-items: center; gap: 5px; height: auto; padding: 0; margin: 0; background: none; border: 0; border-radius: 0;
  color: var(--t3); font: 400 12.5px var(--font-sans); letter-spacing: 0;
}
.fiche-meta { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 4px; }
.fiche-meta .chip + .chip::before { content: "·"; margin-right: 9px; color: var(--t4); }
.legend { display: none !important; }

/* ---------- en-tête de matière ---------- */
html body .hero, html body .page-head {
  background: none; border: 0; border-radius: 0; box-shadow: none; padding: 40px 0 8px; margin: 0 auto 8px; display: block;
}
html body .hero h1, html body .page-head h1 {
  font: 600 30px/1.2 var(--font-head); letter-spacing: -.02em; margin: 0 0 10px; color: var(--t1);
  background: none; -webkit-text-fill-color: currentColor;
}
html body .hero h1 em, html body .page-head h1 em { font-style: normal; color: var(--t1); }
html body .hero .eyebrow, html body .page-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; }
html body .hero .eyebrow::before, html body .page-head .eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mat); }
.subject-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; color: var(--t3); font-size: 13px; }
.subject-stats b { color: var(--t2); font-weight: 500; }
html body .chapter-nav { display: none !important; }

/* ---------- chapitre ---------- */
html body .fiche, html body section.fiche {
  background: none; border: 0; border-radius: 0; box-shadow: none; padding: 32px 0 0; margin: 24px auto 0;
  border-top: 1px solid var(--bd); position: relative;
}
html body .fiche::before, html body .fiche::after { content: none; }
html body .fiche-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 20px; margin: 0 0 22px; }
html body .fiche-num {
  grid-column: 1; width: auto; height: auto; min-width: 0; padding: 0; margin: 0 0 6px; display: block; place-items: initial;
  background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--mat); font: 500 12.5px var(--num); letter-spacing: .02em;
}
html body .fiche-head > div:not(.fiche-num):not(.head-actions) { grid-column: 1; }
html body .fiche h2 { font: 600 28px/1.22 var(--font-head); letter-spacing: -.02em; margin: 0; color: var(--t1); }
html body .fiche h2::before { content: none; }
.head-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; align-self: start; }
html body .fiche-head .btn.master { margin: 0; }
html body .btn.master::before, html body .btn.bookmark::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
html body .btn.master { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E"); }
html body .btn.master.on { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); background: rgba(111, 207, 151, .1); border-color: rgba(111, 207, 151, .35); color: var(--ok); }
html body .btn.bookmark { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 3.5h12v17l-6-4-6 4z'/%3E%3C/svg%3E"); }
html body .btn.bookmark.on { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 3.5h12v17l-6-4-6 4z'/%3E%3C/svg%3E"); }
html body .chapter-actions { display: none !important; }

/* l'essentiel */
html body .flash30 {
  background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px 20px; margin: 0 0 8px;
  font-size: 15px; line-height: 1.7; color: var(--t2); box-shadow: none;
}
html body .flash30 > b:first-child { display: block; color: var(--t3); font: 500 12.5px var(--font-sans); letter-spacing: 0; text-transform: none; margin-bottom: 6px; }
html body .flash30 ul { margin: 4px 0 0; padding-left: 18px; }
html body .flash30 li { margin: 3px 0; }
html body .flash30 li::marker { color: var(--t4); }

/* onglets */
html body .tabs {
  position: sticky; top: var(--top); z-index: 20; display: flex; flex-wrap: nowrap; gap: 22px; overflow-x: auto;
  margin: 26px 0 24px; padding: 0; background: var(--bg); border: 0; border-bottom: 1px solid var(--bd); border-radius: 0; box-shadow: none;
}
html body .tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0; margin: 0;
  background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--t3); font: 500 13.5px var(--font-sans); white-space: nowrap; flex: none;
}
html body .tab:hover { color: var(--t1); background: none; }
html body .tab.on { color: var(--t1); background: none; border: 0; box-shadow: none; }
html body .tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--t1); }
html body .tab small { background: none; color: var(--t4); font: 500 11.5px var(--num); padding: 0; min-width: 0; }
html body .tab span { display: none; }
html body .panel { padding: 0; animation: ui-fade .14s ease-out; }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }

/* titres et texte de cours */
html body .fiche h3, html body .fiche .panel > h3 {
  font: 600 18px/1.35 var(--font-head); color: var(--t1); margin: 34px 0 12px; padding: 0; border: 0; letter-spacing: -.01em;
}
html body .fiche h3::before { content: none; display: none; }
html body .fiche h4 { font: 600 15px var(--font-head); margin: 20px 0 8px; }
.fiche p, .fiche li { color: var(--t2); }
.fiche p { margin: 10px 0; }
.fiche ul, .fiche ol { padding-left: 20px; }
.fiche li { margin: 4px 0; }
.fiche li::marker { color: var(--t4); }
.fiche hr { border: 0; border-top: 1px solid var(--bd); margin: 28px 0; }

/* « comprendre » */
html body .pedagogy {
  background: none; border: 0; border-left: 0; border-radius: 0; padding: 0; margin: 26px 0;
}
html body .pedagogy .eyebrow { margin-bottom: 4px; }
html body .pedagogy h3 { margin-top: 0 !important; }
html body .pedagogy p { color: var(--t2); font-size: 15px; line-height: 1.75; }
html body .learning-goal { border-top: 1px solid var(--bd); padding-top: 10px; color: var(--t3) !important; font-size: 14px; }

/* encadrés */
html body .box, html body .fiche .box {
  background: var(--s1); border: 1px solid var(--bd); border-left: 1px solid var(--bd); border-radius: var(--r);
  padding: 16px 18px; margin: 14px 0; font-size: 14.5px; line-height: 1.7; box-shadow: none;
}
html body .box > .tag, html body .box .tag {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--t1);
  font: 600 13px var(--font-sans); letter-spacing: 0; text-transform: none;
}
html body .box > .tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--k, var(--t3)); flex: none; }
html body .box.def { --k: #8db7ff; } html body .box.prop { --k: #b19cf0; } html body .box.methode { --k: #6fcf97; }
html body .box.tip { --k: #e6c36a; } html body .box.piege { --k: #f08a8a; } html body .box.redac { --k: #d9a1c4; } html body .box.cours { --k: #6cc9d6; }
html body .box.tip, html body .box.piege { background: var(--s1); }
html body .box.piege { border-color: rgba(240, 138, 138, .22); }
html body .box p:last-child { margin-bottom: 0; }
html body .box p:first-of-type { margin-top: 0; }
html body .grid2, html body .fiche .grid2 { gap: 12px; }
html body .grid2 > .box, html body .grid3 > .box { margin: 0; }

/* étapes numérotées */
html body ol.steps > li { padding-left: 30px; margin: 8px 0; }
html body ol.steps > li::before {
  width: 20px; height: 20px; top: 2px; border-radius: 5px; background: var(--s3); color: var(--t2);
  font: 500 11.5px/20px var(--num); box-shadow: none; display: block; text-align: center;
}
.six-l { color: var(--t3) !important; background: none !important; border: 0 !important; font: 500 12px var(--font-sans) !important; padding: 0 !important; display: block; }

/* formules */
html body .formules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 16px 0; }
html body .fx, html body .fiche .fx {
  background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: none; padding: 14px 16px 18px;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; text-align: left; font-size: 17px; min-width: 0;
}
html body .fx > small, html body .fx small:first-child, html body .fx > .small {
  color: var(--t3); font: 500 12px var(--font-sans); letter-spacing: 0; text-transform: none; text-align: left; margin: 0;
}
html body .fx > .f { color: var(--t1); text-align: center; align-self: center; max-width: 100%; overflow-x: auto; }
html body .fx .katex { color: var(--t1); }

/* figures, tableaux, code */
html body figure { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); padding: 14px; margin: 18px 0; box-shadow: none; }
html body figcaption { color: var(--t3); font-size: 13px; margin-top: 8px; text-align: center; }
html body table { border-collapse: collapse; width: 100%; font-size: 14px; }
html body th { color: var(--t3); font-weight: 500; font-size: 12.5px; text-align: left; background: none; border-bottom: 1px solid var(--bd2); padding: 8px 10px; text-transform: none; letter-spacing: 0; }
html body td { border-bottom: 1px solid var(--bd); padding: 8px 10px; color: var(--t2); background: none; }
html body .tscroll { border: 1px solid var(--bd); border-radius: var(--r); overflow-x: auto; }
html body .tscroll table { margin: 0; }
html body pre, html body code { font-family: var(--font-mono); }
html body pre { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); padding: 14px 16px; font-size: 13px; color: var(--t2); box-shadow: none; }
html body blockquote { background: none; border: 0; border-left: 2px solid var(--bd2); border-radius: 0; padding: 2px 0 2px 16px; color: var(--t2); }
html body .timeline::before { background: var(--bd2); width: 1px; left: 9px; }
html body .timeline > div::before { width: 7px; height: 7px; left: -20px; top: 9px; box-shadow: 0 0 0 3px var(--bg); background: var(--mat); }

/* exercices */
html body details.exo { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); margin: 12px 0; box-shadow: none; }
html body details.exo > summary { padding: 14px 16px; font-size: 14.5px; font-weight: 500; color: var(--t1); line-height: 1.5; }
html body details.exo > summary:hover { background: var(--s2); }
html body details.exo > summary::before {
  content: ""; width: 14px; height: 14px; flex: none; background: var(--t3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
html body details.exo > .exo-body, html body details.exo > div { border-top: 1px solid var(--bd); padding: 6px 18px 18px; }
.exercise-question { color: var(--t1) !important; }

/* QCM */
html body .tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
html body .qcm .qq { background: none; border: 0; border-top: 1px solid var(--bd); border-radius: 0; padding: 18px 0 6px; margin: 0; }
html body .qcm .qq:first-of-type { border-top: 0; }
html body .qt { color: var(--t1); font-size: 15px; margin: 0 0 12px; }
html body .qt b { color: var(--t3); font: 500 13px var(--num); margin-right: 4px; }
html body .qo { display: grid; gap: 8px; }
html body .qopt {
  background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); padding: 11px 14px; color: var(--t2);
  font: 400 14.5px/1.55 var(--font-sans); text-align: left; cursor: pointer; transition: border-color .12s, background .12s;
}
html body .qopt:hover:not(:disabled) { border-color: var(--bd2); background: var(--s2); color: var(--t1); }
html body .qopt.good { border-color: rgba(111, 207, 151, .55); background: rgba(111, 207, 151, .08); color: var(--t1); opacity: 1; }
html body .qopt.bad { border-color: rgba(240, 138, 138, .55); background: rgba(240, 138, 138, .07); color: var(--t1); opacity: 1; }
html body .answered .qopt:not(.good):not(.bad) { opacity: .5; }
html body .qe { color: var(--t2); font-size: 14px; margin-top: 10px; padding: 0; background: none; border: 0; }
html body .qe:empty { display: none; }

/* flashcards */
html body .deck { max-width: 620px; }
html body .deck-top { color: var(--t3); font: 500 12.5px var(--font-sans); }
html body .fc-face { border-radius: 10px; border: 1px solid var(--bd2); background: var(--s1); box-shadow: none; color: var(--t1); font-size: 17px; }
html body .fc-front { background: var(--s1); }
html body .fc-back { background: var(--s2); border-color: var(--bd2); }
html body .fc-front::before, html body .fc-back::before { color: var(--t3); font: 500 12px var(--font-sans); letter-spacing: 0; text-transform: none; }
html body .fc-front::before { content: "Question"; } html body .fc-back::before { content: "Réponse"; }
html body .fc[data-state="ok"] .fc-front { box-shadow: inset 0 -2px 0 rgba(111, 207, 151, .6); }
html body .fc[data-state="ko"] .fc-front { box-shadow: inset 0 -2px 0 rgba(240, 138, 138, .6); }
html body .deck-btns .ok { color: var(--ok); } html body .deck-btns .ko { color: var(--ko); }

/* vocabulaire */
html body table.voc td:first-child { color: var(--t1); font-weight: 600; }

/* ---------- simulations ---------- */
html body .viz-card, html body .viz-v4, html body .viz {
  background: var(--s1); border: 1px solid var(--bd); border-radius: 10px; box-shadow: none; padding: 16px; margin: 18px 0;
}
html body .viz-head, html body .lab-header { border: 0; padding: 0; margin: 0 0 12px; background: none; }
html body .viz-head b, html body .lab-header b { font: 600 15px var(--font-head); color: var(--t1); }
html body .viz-badge, html body .lab-header > span:first-child {
  background: none; border: 0; padding: 0; color: var(--t3); font: 500 12px var(--font-sans); letter-spacing: 0; text-transform: none; box-shadow: none;
}
html body .lab-dot { display: none; }
html body .viz-stage, html body .lab-stage { background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: none; }
html body .viz-ro, html body .lab-metrics > div { background: var(--s2); border: 1px solid var(--bd); border-radius: var(--r-sm); box-shadow: none; }
html body .lab-prompt, html body .lab-explain { background: none; border: 0; border-left: 2px solid var(--bd2); border-radius: 0; padding: 2px 0 2px 12px; color: var(--t2); }
html body .viz-sl input[type=range], html body .lab-controls input[type=range] { accent-color: var(--ac); }
input[type=range] { accent-color: var(--ac); }
html body .bit-switch { background: var(--s2); border-color: var(--bd2); box-shadow: none; }
html body .bit-switch.active { background: var(--ac-weak); border-color: rgba(141, 183, 255, .5); }

/* ---------- bas de chapitre : suite et liens ---------- */
.ch-end { margin: 48px 0 0; padding-top: 24px; border-top: 1px solid var(--bd); }
.ch-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ch-pager a, .rel-list a {
  display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--bd); border-radius: var(--r); color: var(--t1); background: none; min-width: 0;
}
.ch-pager a:hover, .rel-list a:hover { border-color: var(--bd2); background: var(--s1); text-decoration: none; }
.ch-pager small, .rel-list small { color: var(--t3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.ch-pager span, .rel-list span { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pager .next { text-align: right; } .ch-pager .next small { justify-content: flex-end; }
.ch-pager .ghost { border: 0; pointer-events: none; }
.rel { margin-top: 30px; }
.rel h4 { font: 500 13px var(--font-sans); color: var(--t3); margin: 0 0 10px; }
.rel-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rel-list a span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.rel-list .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- recherche globale ---------- */
html body .palette { background: rgba(8, 9, 12, .6); backdrop-filter: blur(2px); align-items: flex-start; }
html body .pal-box {
  width: min(640px, calc(100vw - 32px)); margin-top: 12vh; background: var(--s1); border: 1px solid var(--bd2); border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55); overflow: hidden; padding: 0;
}
html body .pal-box input { width: 100%; height: 52px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--bd); border-radius: 0; background: none; color: var(--t1); font: 15px var(--font-sans); outline: none; box-shadow: none; }
html body .pal-res { max-height: 56vh; overflow: auto; padding: 6px; }
html body .pal-res a { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: var(--r-sm); color: var(--t2); border: 0; background: none; }
html body .pal-res a.sel, html body .pal-res a:hover { background: var(--s3); color: var(--t1); text-decoration: none; }
html body .pal-res .num { min-width: 52px; height: auto; padding: 0; background: none !important; color: var(--t3); font: 500 11.5px var(--num); display: block; text-align: left; border-radius: 0; }
html body .pal-res b { font-weight: 500; color: var(--t1); display: block; }
html body .pal-res small { color: var(--t3); font-size: 12px; }
html body .pal-foot { border-top: 1px solid var(--bd); padding: 10px 16px; color: var(--t3); font-size: 12px; background: none; display: flex; gap: 16px; }

/* ---------- calculatrice ---------- */
html body .calc { background: var(--s1); border: 1px solid var(--bd2); border-radius: 12px; box-shadow: 0 24px 64px rgba(0, 0, 0, .55); }
html body .calc-out { color: var(--t1); }
html body .calc-keys button { background: var(--s2); border-color: var(--bd); border-radius: var(--r-sm); font-weight: 500; }
html body .calc-keys [data-k="="] { background: var(--t1); color: var(--bg); border-color: var(--t1); }
html body .flash-banner { background: var(--s2); border: 1px solid var(--bd2); color: var(--t1); border-radius: var(--r); box-shadow: 0 12px 32px rgba(0, 0, 0, .4); }

/* ---------- entraînement ---------- */
html body .training-toolbar { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: none; }
html body .train-card { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: none; }
html body .training-toolbar select, html body .training-toolbar input, html body select {
  background: var(--s2); border: 1px solid var(--bd2); border-radius: var(--r-sm); color: var(--t1); font: inherit; font-size: 13.5px; height: 32px; padding: 0 8px;
}

/* ---------- hub ---------- */
html body .hub-tabs { display: none !important; }
.h-head { padding: 44px 0 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.h-head h1 { font: 600 30px/1.2 var(--font-head); letter-spacing: -.02em; margin: 4px 0 0; }
.h-head p { margin: 0; color: var(--t3); font-size: 13.5px; }
.h-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.h-sec { margin: 0 0 36px; }
.h-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.h-sec-head h2, .h-sec > h2 { font: 600 15px var(--font-head); margin: 0 0 10px; color: var(--t1); letter-spacing: 0; }
.h-sec-head h2 { margin: 0; }
.h-sec-head a { font-size: 13px; color: var(--t3); }
.h-sec-head a:hover { color: var(--t1); }
.h-resume {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 18px 20px; border: 1px solid var(--bd); border-radius: 10px; background: var(--s1); color: var(--t1); margin-bottom: 36px;
}
.h-resume:hover { border-color: var(--bd2); text-decoration: none; background: var(--s2); }
.h-resume .k { color: var(--t3); font-size: 12.5px; display: block; }
.h-resume .t { display: block; font: 600 17px/1.35 var(--font-head); margin-top: 2px; }
.h-resume .m { display: block; color: var(--t3); font-size: 13px; margin-top: 2px; }
.h-resume .n { width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center; background: var(--s3); color: var(--mat); font: 500 12px var(--num); }
.h-resume .go { display: inline-flex; align-items: center; gap: 6px; color: var(--t2); font-size: 13.5px; }
.h-group { margin: 0 0 22px; }
.h-group-label { color: var(--t4); font-size: 12px; font-weight: 600; margin: 0 0 4px; }
.h-list { border-top: 1px solid var(--bd); }
.h-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) 120px 44px 16px; align-items: center; gap: 14px;
  padding: 12px 6px; border-bottom: 1px solid var(--bd); color: var(--t1);
}
.h-row:hover { background: var(--s1); text-decoration: none; }
.h-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.h-row .nm { font-weight: 500; font-size: 14.5px; min-width: 0; }
.h-row .nm small { display: block; color: var(--t3); font-weight: 400; font-size: 12.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-row .progress { height: 3px; background: var(--s3); border-radius: 3px; overflow: hidden; border: 0; margin: 0; }
.h-row .progress i { display: block; height: 100%; width: 0; background: var(--c); border-radius: 3px; }
.h-row [data-subject-status] { color: var(--t3); font: 500 12px var(--num); text-align: right; }
.h-row svg.i { color: var(--t4); }
.h-row:hover svg.i { color: var(--t2); }
.h-side .h-sec { padding: 0; }
.h-card { border: 1px solid var(--bd); border-radius: 10px; padding: 16px 18px; background: var(--s1); }
.h-progress { display: flex; align-items: baseline; gap: 8px; }
.h-progress b { font: 600 28px var(--font-head); letter-spacing: -.02em; }
.h-progress span { color: var(--t3); font-size: 13px; }
.h-bar { height: 4px; background: var(--s3); border-radius: 4px; margin: 12px 0 14px; overflow: hidden; }
.h-bar i { display: block; height: 100%; width: 0; background: var(--ac); border-radius: 4px; }
.h-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; color: var(--t3); }
.h-kv b { color: var(--t1); font: 500 13px var(--num); text-align: right; }
.h-dates { display: grid; gap: 0; border-top: 1px solid var(--bd); }
.h-date { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--bd); }
.h-date b { font-weight: 500; font-size: 14px; }
.h-date small { color: var(--t3); font-size: 12.5px; grid-column: 1; }
.h-date span { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--t2); font: 500 12.5px var(--num); }
html body [data-today] { display: grid; border-top: 1px solid var(--bd); }
html body .today-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 10px 2px;
  border: 0; border-bottom: 1px solid var(--bd); border-radius: 0; background: none; color: var(--t1); font-size: 13.5px; line-height: 1.4;
}
html body .today-item:hover { background: var(--s1); text-decoration: none; }
html body .today-item .num { background: none !important; color: var(--t3); font: 500 11.5px var(--num); padding: 0; min-width: 0; height: auto; display: block; border-radius: 0; text-align: left; }
html body .today-item small { display: block; color: var(--t3); font-size: 12px; margin-top: 2px; }
html body [data-due-list] p, html body [data-favorites] p, html body [data-history] p { color: var(--t3); font-size: 13.5px; }

/* vues secondaires du hub */
html body .panel-card { background: var(--s1); border: 1px solid var(--bd); border-radius: 10px; padding: 18px 20px; box-shadow: none; margin: 0 0 14px; }
html body .panel-card h3 { font: 600 15px var(--font-head); margin: 0 0 8px; }
html body .panel-card h3::before { content: none; }
html body .panel-card p { color: var(--t2); font-size: 14px; }
html body .section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
html body .section-title h2 { font: 600 15px var(--font-head); margin: 0; letter-spacing: 0; }
html body .section-title span, html body .section-title p { color: var(--t3); font-size: 13px; margin: 0; }
html body .labo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 24px; border-top: 1px solid var(--bd); }
html body .labo-gallery a {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 11px 2px;
  background: none; border: 0; border-bottom: 1px solid var(--bd); border-radius: 0; color: var(--t1); font-size: 14px; box-shadow: none; transform: none;
}
html body .labo-gallery a:hover { background: var(--s1); text-decoration: none; transform: none; }
html body .labo-gallery i { font-style: normal; color: var(--t3); background: none; width: auto; height: auto; border: 0; font-size: 13px; display: block; }
html body .labo-gallery small { display: block; color: var(--t3); font-size: 12px; }
html body .labo-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
html body .timeline-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
html body .date-card { background: var(--s1); border: 1px solid var(--bd); border-radius: 10px; padding: 16px; box-shadow: none; }
html body .date-card small { color: var(--t3); font-size: 12px; letter-spacing: 0; display: block; }
html body .date-card b { display: block; font: 600 16px var(--font-head); margin: 4px 0; }
html body .date-card span { display: block; color: var(--t1); font: 500 20px var(--num); margin: 6px 0 2px; }
html body .ring { display: none; }
html body .footer { color: var(--t4); font-size: 12.5px; text-align: left; border-top: 1px solid var(--bd); padding-top: 18px; margin-top: 64px; }
html body .footer a { color: var(--t3); }
html body .status-line { color: var(--t3); font-size: 13px; }
html body .source-links a, html body .coverage-row { border-color: var(--bd); background: var(--s1); }
html body .path-card, html body .subject-card, html body .stat-cell { background: var(--s1); border-color: var(--bd); box-shadow: none; }

/* ---------- mobile ---------- */
@media (max-width: 1100px) {
  .h-cols { grid-template-columns: 1fr; gap: 8px; }
  .rel-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  html body .shell { display: block; }
  html body .side {
    position: fixed; z-index: 80; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100vh; transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: none;
  }
  html body.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgba(5, 6, 8, .55); }
  .top-menu { display: inline-grid; margin-left: -6px; }
  html body .top-search { width: 36px; padding: 0; justify-content: center; }
  html body .top-search span, html body .top-search kbd { display: none; }
  html body .top-search::after { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--search) center / contain no-repeat; mask: var(--search) center / contain no-repeat; }
  html body .main { padding: 0 18px 80px; }
  html body .topbar { margin: 0 -18px; padding: 0 18px; }
  html body .fiche h2 { font-size: 23px; }
  html body .hero h1, .h-head h1 { font-size: 25px; }
  html body .fiche-head { grid-template-columns: 1fr; }
  .head-actions { grid-column: 1; grid-row: auto; margin-top: 10px; }
  .h-row { grid-template-columns: 10px minmax(0, 1fr) 44px 16px; }
  .h-row .progress { display: none; }
  .rel-list, .ch-pager, html body .labo-intro { grid-template-columns: 1fr; }
  .top-pager { display: none; }
}
:root { --search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4'/%3E%3C/svg%3E"); }
@media (prefers-reduced-motion: reduce) { html body .panel { animation: none; } .sb-subject > summary .chev { transition: none; } }

/* ---------- impression ---------- */
@media print {
  html body { background: #fff; color: #111; font-size: 11pt; }
  html body .side, html body .topbar, .ch-end, .head-actions { display: none !important; }
  html body .shell { display: block; }
  html body .fiche { border-top: 0; }
  html body .fiche h2, html body .fiche h3, html body b { color: #111; }
  html body .fiche p, html body .fiche li { color: #222; }
  html body .box, html body .fx, html body .flash30, html body figure, html body details.exo { background: #fff; border-color: #bbb; }
}

/* --- ajustements v5.1 --- */
html body .fiche-meta .chip { font: 400 12.5px var(--font-sans); padding: 0; color: var(--t3) !important; background: none; border: 0; }
html body .sb-foot .btn.sb-tool { flex: 1 1 0; min-width: 0; height: 32px; padding: 0 6px; gap: 6px; background: none; border: 1px solid transparent; color: var(--t3); font-size: 12.5px; font-weight: 500; }
html body .sb-foot .btn.sb-tool:hover { background: var(--s2); color: var(--t1); border-color: transparent; }
html body .sb-foot .btn.sb-tool.on { background: var(--ac-weak); color: var(--ac); }
html body .sb-foot .btn.sb-tool span { overflow: hidden; text-overflow: ellipsis; }
.h-timer output { display: block; font: 600 26px var(--font-head); letter-spacing: -.01em; color: var(--t1); }
.h-timer p { color: var(--t3); font-size: 13.5px; margin: 6px 0 12px; }
html body .fiche-num, .h-resume .n, .crumb .num, .sb-chapters a .n, html body .today-item .num, html body .pal-res .num { font-weight: 600; letter-spacing: .01em; }
.h-date span, .h-kv b, .h-row [data-subject-status], .sb-subject > summary .ct { font-weight: 500; }
html body .fiche-num.only-n::before { content: "Chapitre "; }
html body .top-search::before { content: none !important; display: none; }
@media (max-width: 860px) { html body .top-search::after { content: none; display: none; } html body .top-search { min-width: 36px; height: 36px; } }
html body .fx .katex { white-space: nowrap; }
html body .fx { overflow-x: auto; scrollbar-width: thin; }
.tabs { scrollbar-width: none; }
@media (max-width: 860px) { html body .tabs { -webkit-mask: linear-gradient(90deg, #000 85%, transparent); mask: linear-gradient(90deg, #000 85%, transparent); } }
/* plus aucune capitale forcée */
html body *:not(kbd), html body *::before, html body *::after { text-transform: none; }
html body .viz-badge, html body .lab-header > span:first-of-type { letter-spacing: .01em; }
/* vues du hub : rythme régulier */
body[data-page="index"] .hero .eyebrow::before { display: none; }
body[data-page="index"] .hub-view .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 14px; }
body[data-page="index"] .hub-view .grid2 > .panel-card, body[data-page="index"] .hub-view .timeline-dates + .panel-card ~ .panel-card { margin: 0; }
body[data-page="index"] .hub-view .timeline-dates { margin-bottom: 14px; }
body[data-page="index"] .hub-view > .panel-card, body[data-page="index"] .hub-view > section.panel-card { margin-bottom: 14px; }
@media (max-width: 860px) { body[data-page="index"] .hub-view .grid2 { grid-template-columns: 1fr; } }
body[data-page="index"] .hub-view .grid2 > .panel-card { grid-column: auto !important; display: flex; flex-direction: column; }
body[data-page="index"] .hub-view .panel-card > :last-child { margin-bottom: 0; }
body[data-page="index"] .hub-view .timeline-dates ~ .panel-card { margin: 0 0 14px !important; }
.status-line:empty { display: none; }
html body .training-toolbar { padding: 16px 18px; gap: 14px; align-items: flex-end; }
html body .training-toolbar input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--ac); }
html body .training-toolbar label:has(input[type="checkbox"]) { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; height: 32px; font-size: 13px; color: var(--t2); cursor: pointer; }
html body .button-primary { height: 32px; padding: 0 16px; border-radius: var(--r-sm); background: var(--ac); color: #0b0d11; border: 0; font: 600 13.5px var(--font-sans); cursor: pointer; box-shadow: none; }
html body .button-primary:hover { filter: brightness(1.08); }
html body .trainer-message { color: var(--t3); font-size: 13.5px; }
html body .h-resume .m, html body .today-item small { font-family: var(--font-sans); font-size: 12.5px; white-space: normal; line-height: 1.4; }
html body .sb-foot { padding: 8px 8px 12px; gap: 2px; }
html body .sb-foot .btn.sb-tool { padding: 0 4px; gap: 5px; font-size: 12px; }
html body .sb-foot .btn.sb-tool span { overflow: visible; }

/* =====================================================================
   Fiche d'une page : tout le chapitre visible d'un coup d'œil
   ===================================================================== */
body.has-ch .main > :not(.topbar) { max-width: 1200px; }
body.has-ch .main > .hero, body.has-ch .main > .page-head { display: none; }
body.has-ch .fiche, body.has-ch section.fiche { border-top: 0; padding-top: 26px; margin-top: 0; }
body.has-ch .fiche-head { margin-bottom: 4px; }
body.has-ch .fiche h2 { font-size: 26px; }
body.has-ch .tabs { margin: 14px 0 18px; }

.panel.sheet { columns: 2 380px; column-gap: 26px; font-size: 14.5px; line-height: 1.6; }
.panel.sheet > * { break-inside: avoid; margin-top: 0 !important; margin-bottom: 14px !important; }
.panel.sheet > .recall, .panel.sheet > .recall-go { column-span: all; }

/* blocs de la fiche */
.panel.sheet .flash30 { background: var(--s2); border-color: var(--bd2); padding: 14px 16px; font-size: 14.5px; line-height: 1.6; color: var(--t1); }
.panel.sheet .flash30 > b:first-child { color: var(--mat); font-weight: 600; }
.panel.sheet .flash30 li { margin: 4px 0; }
.panel.sheet .pedagogy { border: 1px solid var(--bd); border-radius: var(--r); padding: 14px 16px; }
.panel.sheet .pedagogy h3 { font-size: 15.5px; margin: 0 0 6px !important; }
.panel.sheet .pedagogy p { font-size: 14.5px; line-height: 1.6; margin: 6px 0; }
.panel.sheet .learning-goal { font-size: 13px; margin-bottom: 0 !important; padding-top: 8px; }
.panel.sheet h3 { font-size: 15.5px; margin: 0 0 8px; }
.panel.sheet p, .panel.sheet li { font-size: 14.5px; line-height: 1.6; }
.panel.sheet .box { padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.panel.sheet .box ul, .panel.sheet .box ol { margin: 0; padding-left: 18px; }
.panel.sheet .box li { margin: 3px 0; }
/* figure + formules : empilées dans la colonne */
.panel.sheet .grid2, .panel.sheet .grid3 { display: block !important; }
.panel.sheet .grid2 > *, .panel.sheet .grid3 > * { margin: 0 0 10px !important; }
.panel.sheet .grid2 > :last-child, .panel.sheet .grid3 > :last-child { margin-bottom: 0 !important; }
.panel.sheet figure { padding: 10px; }
.panel.sheet figure svg, .panel.sheet figure img { display: block; max-height: 210px; width: 100%; margin: 0 auto; }
.panel.sheet figcaption { font-size: 12.5px; margin-top: 6px; }
.panel.sheet .formules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; margin: 0; }
.panel.sheet .fx { padding: 8px 10px 10px; gap: 4px; font-size: 15px; }
.panel.sheet .fx > small { font-size: 11.5px; }
.panel.sheet .fx .katex-display { margin: 2px 0; }
.panel.sheet .tscroll { font-size: 13px; }
.panel.sheet td, .panel.sheet th { padding: 6px 8px; }
.panel.sheet details.exo { margin: 0; }

/* « Teste-toi » */
.recall { border: 1px solid var(--bd); border-radius: var(--r); background: var(--s1); padding: 14px 16px 10px; }
.recall-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.recall-head b { color: var(--t1); font: 600 14.5px var(--font-head); }
.recall-head span { color: var(--t3); font-size: 13px; }
.recall ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; counter-reset: rq; }
.recall li { border-top: 1px solid var(--bd); padding: 8px 0; margin: 0; counter-increment: rq; }
.recall-q { all: unset; display: flex; gap: 10px; width: 100%; cursor: pointer; color: var(--t1); font-size: 14px; line-height: 1.5; box-sizing: border-box; }
.recall-q::before { content: counter(rq); flex: none; width: 20px; height: 20px; border-radius: 5px; background: var(--s3); color: var(--t3); font: 500 11.5px/20px var(--num); text-align: center; margin-top: 1px; }
.recall-q:hover { color: var(--ac); }
.recall-q:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 4px; }
.recall-a { display: none; margin: 6px 0 2px 30px; color: var(--ok); font-size: 14px; line-height: 1.5; }
.recall li.open .recall-a { display: block; }
.recall li.open .recall-q::before { background: rgba(111, 207, 151, .15); color: var(--ok); }
.recall-go { display: flex; flex-wrap: wrap; gap: 8px; }
.recall-go:empty { display: none; }

@media (max-width: 860px) {
  .panel.sheet { columns: 1; }
  .recall ol { grid-template-columns: 1fr; }
}
@media (min-width: 1700px) { body.has-ch .main > :not(.topbar) { max-width: 1480px; } .panel.sheet { columns: 3 360px; } }

/* impression : la fiche tient sur une feuille A4 */
@media print {
  @page { size: A4; margin: 10mm; }
  body.has-ch .tabs, body.has-ch .panel:not(.sheet), .recall-go, .ch-end { display: none !important; }
  .panel.sheet { display: block !important; columns: 2; column-gap: 7mm; font-size: 9pt; line-height: 1.4; }
  .panel.sheet p, .panel.sheet li, .panel.sheet .box, .panel.sheet .flash30, .panel.sheet .pedagogy p { font-size: 9pt !important; line-height: 1.4 !important; }
  .panel.sheet > * { margin-bottom: 3mm !important; }
  .panel.sheet figure svg { max-height: 45mm; }
  .recall-a { display: block !important; color: #333 !important; }
  .recall-q::before { background: #eee !important; }
  body.has-ch .fiche h2 { font-size: 15pt; }
}
.recall-go .btn.more { border-color: color-mix(in srgb, var(--mat) 45%, var(--bd2)); }
.tab[hidden], .recall-go .btn[hidden] { display: none !important; }
.recall-q > span { flex: 1; min-width: 0; }
.panel.sheet .fx { padding: 6px 10px 8px; gap: 0; }
.panel.sheet .fx .katex-display { margin: 0 !important; }
.panel.sheet .fx > .f { font-size: 16px; line-height: 1.3; }
.panel.sheet .formules { gap: 6px; }
.panel.sheet > h3 { break-after: avoid; break-after: avoid-column; margin-bottom: 8px !important; }
/* mise en page de référence pour l'ajustement (indépendante de l'écran) */
html body .panel.sheet.fit-ref { columns: 2 380px !important; }
html body .panel.sheet.fit-ref .recall ol { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
html body .panel.sheet.fit-ref .formules { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
html body .fx .katex-html, html body .fx .katex .base { white-space: nowrap; }
@media (max-width: 860px) {
  html body .panel.sheet:not(.fit-ref) .formules { grid-template-columns: 1fr !important; }
}
html body .box > .tag, html body .box .tag { display: block; }
html body .box > .tag::before { display: inline-block; vertical-align: 1px; margin-right: 8px; }
/* impression : le chapitre affiché, sa fiche, une feuille A4 */
@media print {
  html body.has-ch .fiche.focus-hidden, html body.has-ch section.fiche.focus-hidden { display: none !important; }
  html body.has-ch .fiche, html body.has-ch section.fiche { break-before: auto !important; page-break-before: auto !important; padding: 0 !important; margin: 0 !important; }
  html body.has-ch .panel:not(.sheet), html body.has-ch .ch-end, html body.has-ch .footer, html body.has-ch .main > .hero, html body.has-ch .head-actions { display: none !important; }
  html body.has-ch .panel.sheet { display: block !important; }
  html body.has-ch .panel::before { content: none !important; display: none !important; }
  html body.has-ch .main { padding: 0 !important; }
  html body.has-ch .main > :not(.topbar) { max-width: none !important; }
  html body.has-ch .fiche-head { margin-bottom: 3mm; }
  html body.has-ch .fiche-num { background: none !important; padding: 0 !important; }
  .panel.sheet .flash30, .panel.sheet .pedagogy, .panel.sheet .box, .panel.sheet .fx, .panel.sheet figure, .recall { background: #fff !important; border: 0.3mm solid #bbb !important; padding: 2.5mm 3mm !important; }
  .panel.sheet, .panel.sheet * { color: #111 !important; }
  .panel.sheet .flash30 > b:first-child, .recall-head b { color: #111 !important; }
  .panel.sheet figure svg { max-height: 40mm !important; }
  .panel.sheet .fx > .f { font-size: 11pt !important; }
  .recall-head span { display: none; }
  .recall li { padding: 1mm 0; }
  .recall-a { margin-left: 6mm; font-size: 8.5pt; }
  .recall ol { grid-template-columns: 1fr 1fr !important; }
}
@media print { html body.has-ch .panel, html body.has-ch .panel.sheet { break-before: auto !important; page-break-before: auto !important; padding: 0 !important; } }
@media print {
  html, html body { background: #fff !important; }
  html body .m[data-tex], html body .math-inline, html body .fx > .f, html body .tscroll, html body .flash30, html body .fx { overflow: visible !important; scrollbar-width: none !important; }
  html body ol.steps > li::before { background: #eee !important; color: #111 !important; }
  .panel.sheet { font-size: 10pt !important; }
  .panel.sheet p, .panel.sheet li, .panel.sheet .box, .panel.sheet .flash30, .panel.sheet .pedagogy p { font-size: 10pt !important; line-height: 1.42 !important; }
}
/* impression plus dense : une fiche = une feuille */
@media print {
  @page { size: A4; margin: 8mm 9mm; }
  :root, html { color-scheme: light !important; background: #fff !important; }
  .panel.sheet { column-gap: 6mm !important; }
  .panel.sheet p, .panel.sheet li, .panel.sheet .box, .panel.sheet .flash30, .panel.sheet .pedagogy p, .panel.sheet td, .panel.sheet th { font-size: 9.4pt !important; line-height: 1.36 !important; }
  .panel.sheet > * { margin-bottom: 2.5mm !important; }
  .panel.sheet .flash30, .panel.sheet .pedagogy, .panel.sheet .box, .panel.sheet .fx, .panel.sheet figure, .recall { padding: 2mm 2.5mm !important; }
  .panel.sheet figure svg, .panel.sheet figure img { max-height: 34mm !important; }
  .panel.sheet h3 { font-size: 11pt !important; margin-bottom: 1.5mm !important; }
  .panel.sheet .fx > .f { font-size: 10.5pt !important; }
  html body.has-ch .fiche h2 { font-size: 14pt !important; }
  html body.has-ch .fiche-head { margin-bottom: 2mm !important; }
  .recall li { padding: 0.8mm 0 !important; }
  .recall-q { font-size: 9.4pt !important; }
}
.panel.sheet .fx > .f { font-size: 18px; } .panel.sheet .fx { padding: 8px 12px 10px; gap: 2px; }

/* =====================================================================
   Explications : formules cliquables, fenêtre « Comprendre », onglet « Pas à pas »
   ===================================================================== */
html body .fx.xp-has { position: relative; cursor: pointer; transition: border-color .12s, background .12s; }
html body .fx.xp-has:hover { border-color: color-mix(in srgb, var(--ac) 55%, var(--bd2)); background: var(--s2); }
html body .fx.xp-has:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
.xp-hint { position: absolute; top: 7px; right: 8px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--bd2); color: var(--t3); font: 600 11px/16px var(--font-sans); text-align: center; }
.fx.xp-has:hover .xp-hint { color: var(--ac); border-color: var(--ac); }
.recall-go .btn:first-child { border-color: color-mix(in srgb, var(--ac) 45%, var(--bd2)); color: var(--t1); }

.xp-modal { position: fixed; inset: 0; z-index: 120; background: rgba(6, 7, 10, .62); display: grid; place-items: start center; padding: 6vh 16px 16px; overflow-y: auto; }
.xp-modal[hidden] { display: none; }
body.xp-open { overflow: hidden; }
.xp-card { width: min(760px, 100%); background: var(--s1); border: 1px solid var(--bd2); border-radius: 12px; padding: 18px 22px 22px; box-shadow: 0 24px 64px rgba(0, 0, 0, .5); }
.xp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.xp-head small { color: var(--t3); font-size: 12.5px; }
.xp-head h3 { margin: 2px 0 0; font: 600 18px var(--font-head); color: var(--t1); }
.xp-close { font-size: 20px; line-height: 1; }
.xp-formula { text-align: center; padding: 14px 8px; margin: 12px 0 4px; border-radius: 10px; background: var(--s2); font-size: 22px; color: var(--t1); overflow-x: auto; }
.xp-say { color: var(--t1); font-size: 15.5px; line-height: 1.6; margin: 12px 0; }
.xp-card h4, .xp-tab h4 { font: 600 13px var(--font-sans); color: var(--t3); margin: 18px 0 8px; letter-spacing: .01em; }
.xp-vars { width: 100%; border-collapse: collapse; font-size: 14px; }
.xp-vars th { font-size: 12px; color: var(--t3); font-weight: 500; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--bd2); }
.xp-vars td { padding: 8px; border-bottom: 1px solid var(--bd); vertical-align: top; color: var(--t2); }
.xp-vars td.sym { width: 60px; font-size: 17px; color: var(--t1); text-align: center; }
.xp-vars td b { color: var(--t1); font-weight: 600; }
.xp-vars td small { display: block; color: var(--t3); font-size: 12.5px; margin-top: 2px; }
.xp-ex { border-left: 2px solid var(--mat); padding: 2px 0 2px 14px; }
.xp-ctx { color: var(--t2); margin: 6px 0; line-height: 1.6; }
.xp-steps { margin: 8px 0; padding-left: 22px; }
.xp-steps li { margin: 5px 0; color: var(--t2); line-height: 1.6; }
.xp-steps li::marker { color: var(--t3); font-size: 12.5px; }
.xp-res { margin: 8px 0 2px; padding: 8px 12px; border-radius: 8px; background: rgba(111, 207, 151, .09); color: var(--t1); }
.xp-trap { margin: 10px 0; padding: 8px 12px; border-radius: 8px; background: rgba(240, 138, 138, .08); border: 1px solid rgba(240, 138, 138, .2); color: var(--t2); font-size: 14px; line-height: 1.55; }
.xp-trap b { color: #f08a8a; font-weight: 600; margin-right: 6px; }
.xp-q { border-top: 1px solid var(--bd); padding: 10px 0 6px; }
.xp-q > p { margin: 0 0 8px; color: var(--t1); line-height: 1.6; display: flex; gap: 10px; }
.xp-qn { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--s3); color: var(--t2); font: 600 12px/22px var(--font-sans); text-align: center; margin-top: 1px; }
.xp-show { height: 30px; font-size: 13px; margin-left: 32px; }
.xp-a { margin: 8px 0 4px 32px; padding: 10px 14px; border-radius: 8px; background: rgba(111, 207, 151, .07); border: 1px solid rgba(111, 207, 151, .18); }
.xp-a ol { margin: 0; padding-left: 18px; } .xp-a li, .xp-a p { color: var(--t2); margin: 4px 0; line-height: 1.6; }

.xp-tab { max-width: 860px; }
.xp-intro { color: var(--t3); font-size: 14px; margin: 0 0 18px; }
.xp-sit, .xp-fx { border: 1px solid var(--bd); border-radius: var(--r); background: var(--s1); padding: 16px 18px; margin: 0 0 14px; }
.xp-sit > h3 { display: flex; align-items: center; gap: 10px; font: 600 16px var(--font-head) !important; margin: 0 0 8px !important; }
.xp-n { flex: none; width: 24px; height: 24px; border-radius: 7px; background: color-mix(in srgb, var(--mat) 22%, transparent); color: var(--mat); font: 600 12.5px/24px var(--font-sans); text-align: center; }
.xp-part { font: 600 17px var(--font-head) !important; margin: 28px 0 12px !important; }
.xp-fx > header small { color: var(--t3); font-size: 12.5px; }
.xp-fx .xp-formula { margin: 8px 0 0; }
@media (max-width: 860px) {
  .xp-card { padding: 14px 14px 18px; } .xp-modal { padding-top: 10px; }
  .xp-vars thead { display: none; } .xp-vars tr { display: grid; grid-template-columns: 52px 1fr; } .xp-vars td { border: 0; padding: 4px 6px; } .xp-vars td.sym { grid-row: span 3; }
  .xp-vars tr { border-bottom: 1px solid var(--bd); padding: 6px 0; } .xp-vars td:nth-child(3)::before { content: "Unité : "; color: var(--t3); } .xp-vars td:nth-child(4):not(:empty)::before { content: "Typique : "; color: var(--t3); }
}
@media print { .xp-modal, .xp-hint { display: none !important; } }
