/* Concept : un grand-livre de révision. Chaque matière est un intercalaire coloré,
   chaque chapitre une feuille de journal : bleu = débit, rouge = crédit, jaune = surligneur. */
:root {
  --bg: #f4f6fb;
  --paper: #ffffff;
  --paper-2: #eef2f9;
  --ink: #16203a;
  --ink-2: #4f5a73;
  --ink-3: #7c869c;
  --line: #d8dfeb;
  --line-2: #c3cddf;
  --debit: #1d58d4;
  --debit-bg: #e6eefc;
  --credit: #cc2f3d;
  --credit-bg: #fde9eb;
  --marker: #ffe25c;
  --marker-ink: #3a2f00;
  --ok: #18804a;
  --ok-bg: #e2f5ea;
  --ko: #c42b3a;
  --ko-bg: #fde8ea;
  --warn: #9a5b00;
  --warn-bg: #fff2d6;
  --margin-red: #f2a3aa;
  --shadow: 0 1px 2px rgba(22, 32, 58, .06), 0 6px 20px -12px rgba(22, 32, 58, .25);
  --c-edc: #2443c2;
  --c-cejm: #0b8573;
  --c-af: #7537cc;
  --c-cge: #c8511f;
  --c-ang: #b82a6f;
  --c-math: #b98700;
  --c-p1: #2443c2;
  --c-p2: #0a78a8;
  --c-p3: #b0471c;
  --c-p4: #2c7f3a;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --top-h: 60px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1320; --paper: #161d2e; --paper-2: #1d2639; --ink: #e9edf6; --ink-2: #b4bdd0; --ink-3: #8690a8;
    --line: #2a3550; --line-2: #3a4766; --debit: #7aa6ff; --debit-bg: #1a2a4f; --credit: #ff7b86; --credit-bg: #47202a;
    --marker: #b39a1f; --marker-ink: #fffbe6; --ok: #5fd197; --ok-bg: #143826; --ko: #ff7b86; --ko-bg: #44202a;
    --warn: #f3bf5f; --warn-bg: #3d2f12; --margin-red: #6b2e36; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
    --c-edc: #7d97ff; --c-cejm: #3fd1b8; --c-af: #b48bff; --c-cge: #ff9466; --c-ang: #ff7ab8; --c-math: #f2c84b;
    --c-p1: #7d97ff; --c-p2: #4cc2f0; --c-p3: #ff9466; --c-p4: #6ad37c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1320; --paper: #161d2e; --paper-2: #1d2639; --ink: #e9edf6; --ink-2: #b4bdd0; --ink-3: #8690a8;
  --line: #2a3550; --line-2: #3a4766; --debit: #7aa6ff; --debit-bg: #1a2a4f; --credit: #ff7b86; --credit-bg: #47202a;
  --marker: #b39a1f; --marker-ink: #fffbe6; --ok: #5fd197; --ok-bg: #143826; --ko: #ff7b86; --ko-bg: #44202a;
  --warn: #f3bf5f; --warn-bg: #3d2f12; --margin-red: #6b2e36; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  --c-edc: #7d97ff; --c-cejm: #3fd1b8; --c-af: #b48bff; --c-cge: #ff9466; --c-ang: #ff7ab8; --c-math: #f2c84b;
  --c-p1: #7d97ff; --c-p2: #4cc2f0; --c-p3: #ff9466; --c-p4: #6ad37c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6; font-weight: 350;
}
img { max-width: 100%; height: auto; }
a { color: var(--debit); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--debit); outline-offset: 2px; border-radius: 4px; }
#view:focus, #view:focus-visible { outline: none; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); font-weight: 650; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
strong { font-weight: 600; }
kbd {
  display: inline-block; font-family: var(--font-body); font-size: .82em; font-weight: 500;
  padding: .05em .5em; border-radius: 6px; border: 1px solid var(--line-2);
  border-bottom-width: 3px; background: var(--paper); color: var(--ink); white-space: nowrap;
}
.num, td.n, .tab-n { font-variant-numeric: tabular-nums; }

/* Surligneur : le geste signature du site */
mark.hl {
  color: inherit; padding: 0 .12em; border-radius: 3px;
  background-image: linear-gradient(100deg, transparent 0 .2em, color-mix(in srgb, var(--marker) 78%, transparent) .25em calc(100% - .25em), transparent calc(100% - .2em));
  background-repeat: no-repeat; background-size: 100% 78%; background-position: 0 70%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  .anim mark.hl { background-size: 0% 78%; transition: background-size .7s cubic-bezier(.3,.7,.2,1); }
  .anim.on mark.hl { background-size: 100% 78%; }
}

/* ---------- Structure ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; gap: 10px; height: var(--top-h);
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-family: var(--font-display); font-weight: 800; font-size: .95rem; letter-spacing: -.04em;
}
.brand-mark i { font-style: normal; color: var(--marker); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.05; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .72rem; color: var(--ink-3); letter-spacing: 0; }
.search { position: relative; flex: 1; max-width: 560px; margin-inline: auto; min-width: 0; }
.search input {
  width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--paper);
  padding: 0 14px 0 40px; font-size: .95rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--debit); box-shadow: 0 0 0 4px var(--debit-bg); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); max-height: min(70vh, 520px); overflow: auto; padding: 6px; z-index: 60;
}
.sr-group { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px 4px; }
.sr-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.sr-item:hover, .sr-item.act { background: var(--paper-2); }
.sr-item .dot { width: 10px; height: 10px; border-radius: 3px; margin-top: 7px; flex-shrink: 0; }
.sr-item b { font-weight: 550; display: block; font-size: .94rem; }
.sr-item span { font-size: .8rem; color: var(--ink-2); display: block; line-height: 1.35; }
.sr-empty { padding: 14px; color: var(--ink-2); font-size: .9rem; }
.top-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  height: 40px; min-width: 40px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: .85rem; font-weight: 500;
}
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.reset { color: var(--credit); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.sidebar { display: none; }
.main { min-width: 0; padding: 22px 16px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom, 0px)); }
.page { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.page.wide { max-width: 1080px; }

@media (min-width: 1024px) {
  .layout { grid-template-columns: 272px minmax(0, 1fr); }
  .sidebar {
    display: block; position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); align-self: start;
    height: calc(100vh - var(--top-h) - env(safe-area-inset-top, 0px)); overflow: auto; padding: 18px 12px 30px 16px;
    border-right: 1px solid var(--line);
  }
  .main { padding: 30px 32px 60px; }
  .bottomnav { display: none !important; }
  .only-mobile { display: none !important; }
}
@media (max-width: 1023px) { .only-desktop { display: none !important; } }
@media (max-width: 640px) {
  .brand-name { display: none; }
  .icon-btn .lbl { display: none; }
  .topbar { gap: 8px; }
}

/* Sidebar : intercalaires */
.side-sub { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink);
  font-weight: 450; font-size: .93rem;
}
.side-link:hover { background: var(--paper-2); }
.side-link.act { background: var(--paper); box-shadow: var(--shadow); font-weight: 600; }
.side-link .sw { width: 6px; height: 22px; border-radius: 3px; flex-shrink: 0; }
.side-chaps { display: flex; flex-direction: column; margin: 2px 0 8px 18px; border-left: 2px solid var(--line); padding-left: 8px; }
.side-group { font-size: .72rem; font-weight: 600; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; padding: 8px 8px 2px; }
.side-chap { display: block; padding: 5px 8px; border-radius: 8px; font-size: .84rem; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side-chap:hover { background: var(--paper-2); color: var(--ink); }
.side-chap.act { color: var(--ink); background: var(--paper-2); font-weight: 550; }
.side-chap .ck { color: var(--ok); font-weight: 700; margin-left: 4px; }
.side-sep { height: 1px; background: var(--line); margin: 12px 6px; }

/* Bottom nav mobile */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: .7rem; font-weight: 500; background: none; border: 0; }
.bn-item svg { width: 22px; height: 22px; }
.bn-item.act { color: var(--ink); background: var(--paper-2); }

/* Drawer matières (mobile) */
.drawer-back { position: fixed; inset: 0; background: rgba(10, 14, 25, .45); z-index: 70; display: flex; align-items: flex-end; }
.drawer {
  width: 100%; max-height: 82vh; overflow: auto; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: no-preference) { .drawer { animation: up .28s cubic-bezier(.2,.8,.2,1); } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.drawer-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 12px; }

/* ---------- Accueil ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 26px; align-items: center; padding-block: 8px 4px; }
.hero h1 { margin-bottom: 10px; }
.hero p.lead { color: var(--ink-2); font-size: 1.04rem; max-width: 46ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 550; font-size: .95rem; text-decoration: none;
  transition: transform .12s ease, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--line-2); }
.btn.small { height: 36px; padding: 0 13px; font-size: .86rem; border-radius: 10px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--credit); border-color: var(--credit); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Carte journal animée de l'accueil */
.jcard { background: var(--paper); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.jcard-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--ink-3); }
.jcard-head b { color: var(--ink); font-weight: 600; font-size: .9rem; }
.jrow { display: grid; grid-template-columns: 70px minmax(0,1fr) 84px 84px; gap: 6px; padding: 9px 16px; border-bottom: 1px dashed var(--line); font-size: .9rem; align-items: center; }
.jrow:last-child { border-bottom: 0; }
.jrow .a { font-weight: 600; font-variant-numeric: tabular-nums; }
.jrow .d { color: var(--debit); text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.jrow .c { color: var(--credit); text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.jrow.cr .a { padding-left: 14px; }
.jcheck { display: flex; justify-content: space-between; padding: 10px 16px; background: var(--ok-bg); color: var(--ok); font-weight: 600; font-size: .86rem; }
@media (prefers-reduced-motion: no-preference) {
  .jcard .jrow, .jcard .jcheck { animation: jin .5s both cubic-bezier(.2,.7,.2,1); }
  .jcard .jrow:nth-child(2) { animation-delay: .25s; } .jcard .jrow:nth-child(3) { animation-delay: .5s; }
  .jcard .jrow:nth-child(4) { animation-delay: .75s; } .jcard .jcheck { animation-delay: 1.05s; }
}
@keyframes jin { from { opacity: 0; transform: translateX(-10px); } }

.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-title p { color: var(--ink-2); font-size: .9rem; }

/* Intercalaires matières */
.tabs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.subj-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px 22px; min-height: 150px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px var(--r-l) var(--r-l) 4px; text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.subj-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--sc); border-radius: 4px 0 0 4px; }
.subj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.subj-card .prio { position: absolute; top: 14px; right: 14px; font-size: .7rem; font-weight: 600; color: var(--sc); background: color-mix(in srgb, var(--sc) 12%, transparent); padding: 3px 8px; border-radius: 20px; }
.subj-card h3 { font-size: 1.2rem; padding-right: 70px; }
.subj-card p { color: var(--ink-2); font-size: .86rem; line-height: 1.45; }
.subj-card .meta { margin-top: auto; display: flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--ink-3); }
.subj-card.big { grid-column: 1 / -1; min-height: 0; }
.bar { height: 6px; border-radius: 4px; background: var(--paper-2); overflow: hidden; flex: 1; }
.bar > i { display: block; height: 100%; background: var(--sc, var(--ok)); border-radius: 4px; transition: width .8s cubic-bezier(.2,.7,.2,1); }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.quick { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; color: var(--ink); }
.quick:hover { border-color: var(--ink-3); }
.quick b { font-weight: 600; }
.quick span { font-size: .82rem; color: var(--ink-2); }

/* ---------- Page matière ---------- */
.subj-head { display: flex; flex-direction: column; gap: 10px; padding-left: 16px; border-left: 7px solid var(--sc); }
.subj-head p { color: var(--ink-2); max-width: 70ch; }
.group-block { display: flex; flex-direction: column; gap: 10px; }
.group-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.group-title .tag { font-family: var(--font-display); font-weight: 800; color: #fff; background: var(--gc); padding: 2px 9px; border-radius: 7px; font-size: .9rem; }
.group-title span.sub { color: var(--ink-2); font-size: .9rem; }
.chap-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 10px; }
.chap-card { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; color: var(--ink); }
.chap-card:hover { border-color: var(--gc, var(--ink-3)); }
.chap-num { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--gc, var(--sc)); min-width: 34px; line-height: 1.1; }
.chap-card b { font-weight: 550; display: block; line-height: 1.3; }
.chap-card small { color: var(--ink-3); font-size: .78rem; display: block; margin-top: 3px; }
.badge { display: inline-block; font-size: .68rem; font-weight: 600; padding: 2px 7px; border-radius: 20px; vertical-align: 2px; margin-left: 4px; }
.badge.compl { background: var(--warn-bg); color: var(--warn); }
.badge.y2 { background: var(--debit-bg); color: var(--debit); }
.badge.done { background: var(--ok-bg); color: var(--ok); }

/* ---------- Page chapitre ---------- */
.crumbs { font-size: .82rem; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.chap-head { display: flex; flex-direction: column; gap: 10px; }
.chap-head .kicker { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--gc); }
.chap-head p.intro { color: var(--ink-2); font-size: 1.02rem; max-width: 68ch; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .76rem; padding: 3px 9px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); }

.ctabs {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); z-index: 30; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 0; background: var(--bg); margin-inline: -4px;
}
.ctabs::-webkit-scrollbar { display: none; }
.ctab {
  flex-shrink: 0; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2);
  font-weight: 500; font-size: .9rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.ctab:hover { color: var(--ink); }
.ctab.act { background: var(--paper); border-color: var(--line); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.ctab .cnt { font-size: .72rem; color: var(--ink-3); font-weight: 500; }
@media (prefers-reduced-motion: no-preference) { .tab-pane { animation: fadein .3s ease both; } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* Feuille de cours : marge rouge façon copie de compta */
.sheet {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px 20px 26px 30px; position: relative;
  display: flex; flex-direction: column; gap: 16px;
}
.sheet::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--margin-red); opacity: .7; }
.sheet > h2 { display: flex; gap: 10px; align-items: baseline; }
.sheet > h2 .sn { font-size: .95rem; color: var(--gc); font-weight: 800; }
@media (max-width: 560px) { .sheet { padding: 18px 14px 20px 24px; } .sheet::before { left: 11px; } }
.sheet p { max-width: 70ch; }
.lst { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.lst li::marker { color: var(--gc, var(--ink-3)); }

.call { border-radius: var(--r-m); padding: 12px 14px 12px 14px; font-size: .95rem; display: flex; gap: 10px; align-items: flex-start; }
.call .ic { flex-shrink: 0; font-family: var(--font-display); font-weight: 800; font-size: .74rem; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; margin-top: 2px; }
.call.rule { background: var(--debit-bg); }
.call.rule .ic { background: var(--debit); color: var(--paper); }
.call.piege { background: var(--credit-bg); }
.call.piege .ic { background: var(--credit); color: var(--paper); }
.call.astuce { background: var(--warn-bg); }
.call.astuce .ic { background: var(--warn); color: var(--paper); }
.call.note { background: var(--paper-2); }
.call.note .ic { background: var(--ink-2); color: var(--paper); }
.call > div { min-width: 0; }

.ex { border: 1px dashed var(--line-2); border-radius: var(--r-m); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ex > b { font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.defbox { border-left: 4px solid var(--gc, var(--ink)); padding: 6px 12px; background: var(--paper-2); border-radius: 0 var(--r-s) var(--r-s) 0; }
.defbox b { font-family: var(--font-display); font-weight: 700; }

.formula { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border-radius: var(--r-m); background: var(--paper-2); text-align: center; }
.formula .f { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.05rem, 3vw, 1.3rem); font-variant-numeric: tabular-nums; }
.formula .l { font-size: .82rem; color: var(--ink-2); }

.tbl-wrap { overflow-x: auto; border-radius: var(--r-m); border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 420px; }
.tbl th { text-align: left; font-weight: 600; font-size: .8rem; background: var(--paper-2); color: var(--ink-2); padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { font-weight: 500; }
.tbl-cap { font-size: .8rem; color: var(--ink-3); margin-top: 6px; }

/* Journal */
.journal { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.journal-wrap { overflow-x: auto; }
.journal table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 440px; }
.journal th { font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 7px 10px; background: var(--paper-2); text-align: left; border-bottom: 1px solid var(--line); }
.journal th.d { color: var(--debit); text-align: right; } .journal th.c { color: var(--credit); text-align: right; }
.journal td { padding: 7px 10px; border-bottom: 1px dashed var(--line); }
.journal td.acc { font-weight: 600; font-variant-numeric: tabular-nums; width: 84px; }
.journal td.d { text-align: right; color: var(--debit); font-weight: 600; font-variant-numeric: tabular-nums; width: 108px; white-space: nowrap; }
.journal td.c { text-align: right; color: var(--credit); font-weight: 600; font-variant-numeric: tabular-nums; width: 108px; white-space: nowrap; }
.journal tr.cr td.lab { padding-left: 26px; }
.journal tr.tot td { border-top: 2px solid var(--line-2); border-bottom: 0; font-weight: 600; background: var(--paper-2); }
.journal .jdate { padding: 7px 10px; font-size: .8rem; color: var(--ink-2); background: var(--paper-2); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.journal .jnote { padding: 8px 10px; font-size: .84rem; color: var(--ink-2); border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .journal table { min-width: 0; font-size: .8rem; }
  .journal th { padding: 6px 5px; font-size: .64rem; letter-spacing: .02em; }
  .journal td { padding: 6px 5px; }
  .journal td.acc { width: 52px; }
  .journal td.d, .journal td.c { width: auto; }
  .journal tr.cr td.lab { padding-left: 12px; }
  table.tbl { font-size: .82rem; }
  .tbl td, .tbl th { padding: 7px 7px; }
}
.dc { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; border-radius: 5px; font-size: .78em; font-weight: 700; vertical-align: .05em; color: #fff; }
.dc.d { background: var(--debit); } .dc.c { background: var(--credit); }

/* Comptes en T */
.taccs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.tacc { font-size: .86rem; }
.tacc .tn { text-align: center; font-weight: 650; padding-bottom: 4px; border-bottom: 2px solid var(--ink); font-family: var(--font-display); }
.tacc .tb { display: grid; grid-template-columns: 1fr 1fr; }
.tacc .tb > div { padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; min-height: 60px; }
.tacc .tb > div:first-child { border-right: 2px solid var(--ink); }
.tacc .tl { display: flex; justify-content: space-between; gap: 6px; }
.tacc .tl span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.tacc .td .tl span:last-child { color: var(--debit); } .tacc .tc .tl span:last-child { color: var(--credit); }
.tacc .th { display: flex; justify-content: space-between; font-size: .7rem; color: var(--ink-3); font-weight: 600; padding: 2px 8px; }
.tacc .ts { text-align: center; font-size: .78rem; color: var(--ink-2); margin-top: 4px; }

/* Flux */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.flow .fs { flex: 1 1 120px; min-width: 0; background: var(--paper-2); border-radius: var(--r-m); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); }
.flow .fs b { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.flow .fs span { font-size: .78rem; color: var(--ink-2); line-height: 1.35; }
.flow .fa { display: grid; place-items: center; width: 26px; color: var(--ink-3); flex-shrink: 0; font-weight: 700; }
.flow.v { flex-direction: column; }
.flow.v .fa { width: auto; height: 22px; }
.flow.v .fs { flex: 0 0 auto; }
@media (max-width: 560px) { .flow:not(.keep) { flex-direction: column; } .flow:not(.keep) .fs { flex: 0 0 auto; } .flow:not(.keep) .fa { width: auto; height: 20px; transform: rotate(90deg); } }

/* Arbre de décision */
.tree { display: flex; flex-direction: column; gap: 8px; }
.tq { background: var(--ink); color: var(--paper); border-radius: var(--r-m); padding: 9px 12px; font-weight: 550; font-size: .92rem; align-self: flex-start; max-width: 100%; }
.tbr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-left: 14px; border-left: 2px solid var(--line-2); margin-left: 12px; }
.tbr > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tlab { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tlab.y { color: var(--ok); } .tlab.n { color: var(--credit); }
.tleaf { border-radius: var(--r-m); padding: 8px 11px; font-size: .88rem; font-weight: 500; }
.tleaf.ok { background: var(--ok-bg); color: var(--ok); } .tleaf.ko { background: var(--ko-bg); color: var(--ko); } .tleaf.mid { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 560px) { .tbr { grid-template-columns: 1fr; } }

/* Comparaison */
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.cmp > div { border-radius: var(--r-m); padding: 13px 14px; border: 1px solid var(--line); border-top: 5px solid var(--kc, var(--ink)); background: var(--paper); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmp h4 { font-size: 1rem; }
.cmp ul { margin: 0; padding-left: 1.1em; font-size: .9rem; display: flex; flex-direction: column; gap: 3px; }

/* Cascade (barres) */
.casc { display: flex; flex-direction: column; gap: 5px; }
.crow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 100px; gap: 10px; align-items: center; font-size: .9rem; }
.crow .cl { min-width: 0; }
.crow .cb { height: 14px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.crow .cb i { display: block; height: 100%; border-radius: 4px; background: var(--ink-3); }
.crow.m .cb i { background: var(--credit); } .crow.p .cb i { background: var(--ok); } .crow.t .cb i { background: var(--debit); }
.crow .cv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crow.m .cv { color: var(--credit); } .crow.t { font-weight: 600; } .crow.t .cl { font-weight: 650; }
.crow.t { border-top: 1px solid var(--line); padding-top: 5px; }
@media (max-width: 520px) { .crow { grid-template-columns: minmax(0,1fr) 92px; } .crow .cb { display: none; } }

/* Frise */
.tl { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.tli { position: relative; padding: 4px 0 12px; }
.tli::before { content: ""; position: absolute; left: -21px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 3px solid var(--gc, var(--ink)); }
.tli b { display: block; font-weight: 650; font-size: .92rem; }
.tli span { font-size: .88rem; color: var(--ink-2); }

/* Bilan visuel */
.bilan { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid var(--ink); border-radius: var(--r-s); overflow: hidden; }
.bilan .bh { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: center; padding: 5px; background: var(--ink); color: var(--paper); }
.bilan .bc { display: flex; flex-direction: column; }
.bilan .bc + .bc { border-left: 2px solid var(--ink); }
.bblock { display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; font-size: .84rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); min-height: 38px; }
.bblock:last-child { border-bottom: 0; }
.bblock b { font-weight: 600; } .bblock span { font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--ink-2); }
.bk1 { background: var(--debit-bg); } .bk2 { background: var(--ok-bg); } .bk3 { background: var(--warn-bg); } .bk4 { background: var(--credit-bg); } .bk5 { background: var(--paper-2); }

/* Cartes simples */
.minicards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.minicard { border-radius: var(--r-m); background: var(--paper-2); padding: 12px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); }
.minicard b { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--gc, var(--ink)); line-height: 1.1; }
.minicard span { font-size: .84rem; color: var(--ink-2); line-height: 1.4; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: flex; flex-direction: column; gap: 8px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; align-items: start; }
.steps li::before { content: counter(st); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--gc, var(--ink)); color: #fff; font-family: var(--font-display); }

/* NumWorks */
.nw { border-radius: var(--r-l); border: 2px solid #f5b300; background: color-mix(in srgb, #f5b300 9%, var(--paper)); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.nw-h { display: flex; align-items: center; gap: 10px; }
.nw-h .scr { width: 34px; height: 26px; border-radius: 5px; background: #fff; border: 3px solid #f5b300; position: relative; flex-shrink: 0; }
.nw-h .scr::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 4px; height: 3px; background: #f5b300; border-radius: 2px; }
.nw-h b { font-weight: 650; } .nw-h span { font-size: .8rem; color: var(--ink-2); }
.nw ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 5px; font-size: .92rem; }

.figure { display: flex; flex-direction: column; gap: 6px; }
.figure img { border-radius: var(--r-m); border: 1px solid var(--line); background: #fff; }
.figure span { font-size: .8rem; color: var(--ink-3); }

/* ---------- Fiche ---------- */
.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.fbox { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fbox.full { grid-column: 1 / -1; }
.fbox h3 { display: flex; align-items: center; gap: 8px; }
.fbox h3 i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; font-style: normal; }
.fbox ul { margin: 0; padding-left: 1.15em; display: flex; flex-direction: column; gap: 5px; font-size: .94rem; }
.fbox.memo { background: var(--warn-bg); border-color: transparent; }
.fbox.memo p { font-family: var(--font-display); font-weight: 650; font-size: 1.08rem; color: var(--warn); }
.acc-list { display: flex; flex-direction: column; gap: 4px; }
.acc-row { display: grid; grid-template-columns: 70px minmax(0,1fr) auto; gap: 10px; align-items: center; font-size: .9rem; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.acc-row:last-child { border-bottom: 0; }
.acc-row b { font-variant-numeric: tabular-nums; font-weight: 650; }
.sens { font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.sens.D { background: var(--debit-bg); color: var(--debit); } .sens.C { background: var(--credit-bg); color: var(--credit); } .sens.X { background: var(--paper-2); color: var(--ink-2); }
.print-row { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Définitions / Lexique ---------- */
.defs { display: flex; flex-direction: column; }
.defs .drow { display: grid; grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr); gap: 16px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.defs .drow b { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.defs .drow small { display: block; font-family: var(--font-body); font-weight: 450; color: var(--ink-3); font-size: .74rem; margin-top: 2px; }
.defs .drow p { font-size: .94rem; }
@media (max-width: 520px) { .defs .drow { grid-template-columns: 1fr; gap: 3px; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input[type=search] { height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); padding: 0 10px; min-width: 0; }
.filters input[type=search] { flex: 1 1 200px; }
.count { font-size: .82rem; color: var(--ink-3); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: .84rem; font-weight: 500; color: var(--ink-2); }
.seg button.act { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- QCM ---------- */
.qcm { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.qcm-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .85rem; color: var(--ink-3); }
.qcm-prog { height: 6px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.qcm-prog i { display: block; height: 100%; background: var(--gc, var(--ink)); transition: width .4s; }
.qcm-q { font-size: 1.08rem; font-weight: 550; line-height: 1.45; }
.qcm-from { font-size: .76rem; color: var(--ink-3); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-2);
  background: var(--paper); font-size: .95rem; line-height: 1.4; transition: border-color .12s, background .12s, transform .12s;
}
.opt:hover:not([disabled]) { border-color: var(--ink-3); }
.opt .L { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--paper-2); font-weight: 650; font-size: .82rem; }
.opt.good { border-color: var(--ok); background: var(--ok-bg); } .opt.good .L { background: var(--ok); color: #fff; }
.opt.bad { border-color: var(--ko); background: var(--ko-bg); } .opt.bad .L { background: var(--ko); color: #fff; }
.opt[disabled] { cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  .opt.bad { animation: shake .35s; } .opt.good { animation: pop .3s; }
}
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pop { 50% { transform: scale(1.015); } }
.expl { border-radius: 12px; padding: 12px 14px; font-size: .92rem; }
.expl.good { background: var(--ok-bg); } .expl.bad { background: var(--ko-bg); }
.expl b.v { display: block; margin-bottom: 3px; }
.expl.good b.v { color: var(--ok); } .expl.bad b.v { color: var(--ko); }
.qcm-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.score { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ring { --p: 0; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--rc, var(--ok)) calc(var(--p) * 1%), var(--paper-2) 0); }
.ring > div { width: 80px; height: 80px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.review { display: flex; flex-direction: column; gap: 10px; }
.review .rv { border-left: 4px solid var(--ko); padding: 6px 12px; background: var(--paper-2); border-radius: 0 8px 8px 0; font-size: .9rem; display: flex; flex-direction: column; gap: 3px; }
.review .rv.ok { border-color: var(--ok); }

/* ---------- Exercices ---------- */
.exo { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.exo-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.exo-h .ty { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gc, var(--ink-3)); }
.exo-h h3 { margin-top: 2px; }
.exo .enonce { font-size: .95rem; display: flex; flex-direction: column; gap: 10px; }
.exo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.feedback { border-radius: 12px; padding: 10px 14px; font-weight: 550; font-size: .92rem; }
.feedback.good { background: var(--ok-bg); color: var(--ok); } .feedback.bad { background: var(--ko-bg); color: var(--ko); } .feedback.mid { background: var(--warn-bg); color: var(--warn); }
.solution { border-top: 2px dashed var(--line-2); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.solution > b.st { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); }

.cls-item { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cls-item:last-child { border-bottom: 0; }
.cls-item .it { font-size: .95rem; }
.cls-item .ex-note { font-size: .84rem; color: var(--ink-2); }
.cls-item.good .it::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.cls-item.bad .it::before { content: "✗ "; color: var(--ko); font-weight: 700; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { border: 1.5px solid var(--line-2); background: var(--paper); border-radius: 10px; padding: 6px 12px; font-size: .86rem; font-weight: 500; }
.choice.sel { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.choice.right { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.choice.wrong { border-color: var(--ko); background: var(--ko-bg); color: var(--ko); }

.fields { display: flex; flex-direction: column; gap: 10px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 10px; align-items: center; }
.field label { font-size: .93rem; }
.field .inp { position: relative; }
.field input { width: 100%; height: 42px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--paper); padding: 0 34px 0 12px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.field .u { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: .85rem; pointer-events: none; }
.field.good input { border-color: var(--ok); background: var(--ok-bg); } .field.bad input { border-color: var(--ko); background: var(--ko-bg); }
.field .ans { grid-column: 1 / -1; font-size: .84rem; color: var(--ko); margin-top: -4px; }
@media (max-width: 520px) { .field { grid-template-columns: 1fr; gap: 4px; } }

.jin-wrap { overflow-x: auto; }
.jin { width: 100%; border-collapse: collapse; min-width: 520px; font-size: .9rem; }
.jin th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; text-align: left; padding: 6px 6px; }
.jin th.d { color: var(--debit); } .jin th.c { color: var(--credit); }
.jin td { padding: 4px 4px; }
.jin input { width: 100%; height: 40px; border-radius: 9px; border: 1.5px solid var(--line-2); background: var(--paper); padding: 0 8px; font-variant-numeric: tabular-nums; }
.jin input.acc { font-weight: 650; }
.jin input.amt { text-align: right; }
.jin .lab { font-size: .84rem; color: var(--ink-2); padding-left: 6px; min-width: 120px; }
.jin tr.good input { border-color: var(--ok); background: var(--ok-bg); } .jin tr.bad input { border-color: var(--ko); background: var(--ko-bg); }
.jin .tot td { font-weight: 600; font-variant-numeric: tabular-nums; padding: 8px 8px; text-align: right; }
.jin .rm { background: none; border: 0; color: var(--ink-3); font-size: 1.1rem; padding: 0 6px; }
.hint-accs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .8rem; color: var(--ink-2); align-items: center; }
.hint-accs span { background: var(--paper-2); padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }

.order-list { display: flex; flex-direction: column; gap: 6px; }
.ord { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--paper); }
.ord .n { font-weight: 700; color: var(--ink-3); width: 20px; font-variant-numeric: tabular-nums; }
.ord .tx { flex: 1; min-width: 0; font-size: .93rem; }
.ord button { border: 1px solid var(--line-2); background: var(--paper-2); border-radius: 8px; width: 34px; height: 32px; }
.ord.good { border-color: var(--ok); background: var(--ok-bg); } .ord.bad { border-color: var(--ko); background: var(--ko-bg); }

.match-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.match-row select { width: 100%; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--paper); padding: 4px 8px; }
.match-row.good select { border-color: var(--ok); background: var(--ok-bg); } .match-row.bad select { border-color: var(--ko); background: var(--ko-bg); }
@media (max-width: 520px) { .match-row { grid-template-columns: 1fr; gap: 4px; } }
.cloze { line-height: 2.3; font-size: .97rem; }
.cloze select { border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--paper); padding: 3px 6px; font-weight: 550; max-width: 100%; }
.cloze select.good { border-color: var(--ok); background: var(--ok-bg); } .cloze select.bad { border-color: var(--ko); background: var(--ko-bg); }

/* Flashcards */
.flash { perspective: 1200px; }
.fcard { position: relative; height: 230px; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3,.7,.2,1); cursor: pointer; }
.fcard.flip { transform: rotateY(180deg); }
.fface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 22px; gap: 8px; overflow: auto; }
.fface.back { transform: rotateY(180deg); background: var(--paper-2); }
.fface b { font-family: var(--font-display); font-size: 1.45rem; font-weight: 750; }
.fface small { color: var(--ink-3); font-size: .78rem; }
.fface p { font-size: .98rem; }
@media (prefers-reduced-motion: reduce) { .fcard { transition: none; } }

/* Modal / toast */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(10, 14, 25, .5); display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); background: var(--paper); border-radius: var(--r-l); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.modal p { color: var(--ink-2); font-size: .94rem; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 95; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 500; box-shadow: var(--shadow); }
@media (min-width: 1024px) { .toast { bottom: 28px; } }

.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--paper); text-decoration: none; color: var(--ink); max-width: 48%; min-width: 0; }
.pager a.nx { margin-left: auto; text-align: right; }
.pager small { color: var(--ink-3); font-size: .76rem; }
.pager b { font-weight: 550; font-size: .9rem; }
@media (max-width: 520px) { .pager a { max-width: 100%; flex: 1 1 100%; } }
.empty { padding: 20px; border: 1px dashed var(--line-2); border-radius: var(--r-l); color: var(--ink-2); text-align: center; }
.ctx { background: var(--paper-2); border-radius: var(--r-l); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ctx h3 { font-size: 1rem; }
.part-label { font-family: var(--font-display); font-weight: 800; font-size: .95rem; color: var(--gc, var(--ink)); }


/* Schémas maison : graphique SVG, carré magique, SWOT */
svg.chart { width: 100%; max-width: 420px; height: auto; color: var(--ink-2); display: block; margin: 0 auto; font-family: var(--font-body); }
.square { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: relative; }
.sq-c { border-radius: var(--r-m); padding: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); background: var(--paper-2); }
.sq-c b { font-family: var(--font-display); font-weight: 700; }
.sq-c span { font-size: .84rem; color: var(--ink-2); }
.sq-c.a { border-top: 4px solid var(--ok); } .sq-c.b { border-top: 4px solid var(--debit); } .sq-c.c { border-top: 4px solid var(--warn); } .sq-c.d { border-top: 4px solid var(--credit); }
.sq-mid { grid-column: 1 / -1; font-size: .84rem; color: var(--ink-2); text-align: center; }
.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 460px; }
.sw { border-radius: var(--r-m); padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.sw b { font-family: var(--font-display); font-weight: 750; font-size: 1.02rem; }
.sw span { font-size: .78rem; opacity: .85; }
.sw.s { background: var(--ok-bg); color: var(--ok); } .sw.w { background: var(--warn-bg); color: var(--warn); }
.sw.o { background: var(--debit-bg); color: var(--debit); } .sw.t { background: var(--credit-bg); color: var(--credit); }

/* Formulaire CA3 simplifié */
.ca3 { display: flex; flex-direction: column; gap: 10px; }
.ca3-part { border: 1px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; background: var(--paper); }
.ca3-h { background: var(--ink); color: var(--paper); font-weight: 600; font-size: .82rem; padding: 6px 10px; letter-spacing: .02em; }
.ca3-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ca3-cols > div { display: flex; flex-direction: column; padding: 8px 10px 10px; gap: 3px; border-top: 1px solid var(--line); }
.ca3-cols > div + div { border-left: 1px solid var(--line); }
.ca3-cols b { font-size: .82rem; font-weight: 650; margin-bottom: 2px; }
.ca3-cols span { display: flex; gap: 8px; align-items: baseline; font-size: .86rem; }
.ca3-cols i { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: center; border-radius: 5px; padding: 0 4px; background: var(--paper-2); font-size: .78rem; }
.ca3-cols .brute i, .ca3-cols .cre i { background: var(--credit-bg); color: var(--credit); }
.ca3-cols .ded i, .ca3-cols .res i { background: var(--debit-bg); color: var(--debit); }
@media (max-width: 480px) { .ca3-cols > div + div { border-left: 0; } }

@media print {
  .topbar, .sidebar, .bottomnav, .ctabs, .print-row, .pager, .crumbs, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; } .layout { display: block; }
  .fbox, .sheet { break-inside: avoid; border-color: #bbb; }
}

/* E-mail modèle (anglais) */
.mail { border: 1px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; background: var(--paper); font-size: .9rem; }
.mail .mh { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--paper-2); border-bottom: 1px solid var(--line); font-size: .82rem; overflow-wrap: anywhere; }
.mail .mh b { color: var(--ink-3); font-weight: 600; margin-right: 4px; }
.mail .mb { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.mail .tag { margin: 0; padding: 6px 10px 6px 12px; border-left: 4px solid var(--c-ang); border-radius: 0 var(--r-s) var(--r-s) 0; background: color-mix(in srgb, var(--c-ang) 8%, transparent); }
.mail .t2 { border-left-color: var(--c-p2); background: color-mix(in srgb, var(--c-p2) 8%, transparent); }
.mail .t3 { border-left-color: var(--ink-3); background: transparent; border-left-style: dashed; color: var(--ink-3); }
.mail .t4 { border-left-color: var(--c-p3); background: color-mix(in srgb, var(--c-p3) 8%, transparent); }
.mail .t5 { border-left-color: var(--c-p4); background: color-mix(in srgb, var(--c-p4) 8%, transparent); }
.mail .t6 { border-left-color: var(--ink); background: transparent; }

/* Code Python */
pre.code { margin: 0; padding: 12px 14px; background: var(--ink); color: var(--paper); border-radius: var(--r-m); overflow-x: auto; font-size: .88rem; line-height: 1.5; }
pre.code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }

@media (max-width: 560px) { .minicard b { font-size: 1rem; } }

/* =========================================================
   V2 · repères visuels, niveaux de QCM, onglet Examen, animations
   ========================================================= */
svg.i { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.18em; }

/* Encadrés avec icône */
.call .ic { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; letter-spacing: .01em; padding: 3px 8px 3px 6px; }
.call .ic svg.i { width: 15px; height: 15px; }
.call.mini { display: inline-flex; padding: 0; background: none; }
.ex > b { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: .86rem; color: var(--ink-2); font-weight: 650; }
.ex > b svg.i { color: var(--gc, var(--ink-3)); }
.formula { position: relative; }
.formula .fi { position: absolute; left: 10px; top: 8px; color: var(--debit); opacity: .55; }
.formula .fi svg.i { width: 18px; height: 18px; }
.nw-h .scr { display: grid; place-items: center; color: #b78400; background: #fff; }
.nw-h .scr::after { display: none; }
.nw-h .scr svg.i { width: 18px; height: 18px; }

/* Sigles */
abbr.ab { text-decoration: none; border-bottom: 1.5px dotted color-mix(in srgb, currentColor 55%, transparent); cursor: help; }
abbr.ab:focus-visible { outline: 2px solid var(--debit); outline-offset: 2px; border-radius: 3px; }
.abtip { position: fixed; z-index: 200; max-width: min(280px, calc(100vw - 16px)); background: var(--ink); color: var(--paper); padding: 8px 11px; border-radius: 10px; font-size: .82rem; line-height: 1.4; box-shadow: 0 10px 30px -8px rgba(0,0,0,.45); pointer-events: none; }
.abtip b { display: block; font-family: var(--font-display); font-weight: 800; color: var(--marker); margin-bottom: 1px; }
@media (prefers-reduced-motion: no-preference) { .abtip:not([hidden]) { animation: tipin .15s ease-out; } }
@keyframes tipin { from { opacity: 0; transform: translateY(4px); } }

/* Signes fiscaux */
.fx { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 2px; border-radius: 20px; font-size: .8rem; font-weight: 650; white-space: nowrap; vertical-align: 1px; }
.fx b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; color: #fff; }
.fx.rei { background: var(--credit-bg); color: var(--credit); } .fx.rei b { background: var(--credit); }
.fx.ded { background: var(--ok-bg); color: var(--ok); } .fx.ded b { background: var(--ok); }
.fx.raf { background: var(--paper-2); color: var(--ink-2); } .fx.raf b { background: var(--ink-3); }

/* Étoiles de niveau */
.stars { display: inline-flex; gap: 1px; vertical-align: -2px; }
.stars .st svg.i { width: 15px; height: 15px; color: var(--line-2); }
.stars .st.on svg.i { color: #f0a500; fill: #f6b81e; }

/* Navigation : icônes de matières et de processus */
.sico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; color: var(--sc); background: color-mix(in srgb, var(--sc) 13%, transparent); }
.sico svg.i { width: 17px; height: 17px; }
.side-link.act .sico { background: var(--sc); color: var(--paper); }
.side-group { display: flex; align-items: center; gap: 6px; }
.side-group svg.i { width: 14px; height: 14px; }
.sbig { width: 42px; height: 42px; border-radius: 13px; display: inline-grid; place-items: center; color: var(--sc); background: color-mix(in srgb, var(--sc) 13%, transparent); }
.sbig svg.i { width: 24px; height: 24px; }
.subj-card .sbig { margin-bottom: 4px; }
.subj-head h1 { display: flex; align-items: center; gap: 12px; }
.gico { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; background: var(--gc); align-self: center; }
.gico svg.i { width: 18px; height: 18px; }
.chap-head .kicker { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chap-head .kic { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; background: var(--gc); }
.chap-head .kic svg.i { width: 18px; height: 18px; }
.ctab { display: inline-flex; align-items: center; gap: 6px; }
.ctab svg.i { width: 16px; height: 16px; opacity: .7; }
.ctab.act svg.i { opacity: 1; color: var(--gc); }
.ctab.xt { color: var(--ink); }
.ctab.xt:not(.act) { background: color-mix(in srgb, var(--marker) 30%, transparent); }

/* Repères visuels (accueil) */
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.lg { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); font-size: .86rem; color: var(--ink-2); }
.lg-s { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lg-i { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--debit-bg); color: var(--debit); }
.lg-i.nwi { background: color-mix(in srgb, #f5b300 15%, transparent); color: #b78400; }
@media (max-width: 420px) { .lg { grid-template-columns: 1fr; gap: 6px; } }

/* QCM v2 */
.qcm { position: relative; overflow: hidden; }
.qcm:focus { outline: none; }
.qcm-help { display: flex; gap: 8px; align-items: flex-start; font-size: .86rem; color: var(--ink-2); background: var(--paper-2); border-radius: var(--r-m); padding: 10px 12px; }
.qcm-help svg.i { color: #f0a500; margin-top: 2px; }
.lvl { display: flex; flex-wrap: wrap; gap: 6px; }
.lvl button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: 30px; padding: 6px 12px; font-size: .84rem; font-weight: 550; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.lvl button:hover:not([disabled]) { border-color: var(--ink-3); }
.lvl button.act { border-color: var(--gc); background: color-mix(in srgb, var(--gc) 10%, var(--paper)); color: var(--ink); box-shadow: 0 0 0 1px var(--gc) inset; }
.lvl button[disabled] { opacity: .4; cursor: not-allowed; }
.lvl button svg.i { width: 16px; height: 16px; }
.qcm-top .sc { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; color: var(--ok); }
.qcm-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-3); }
.qcm-meta .lvn { font-weight: 600; color: var(--ink-2); }
.qcm-from { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; background: var(--paper-2); }
.expl .v { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.expl .v > svg.i { width: 26px; height: 26px; padding: 4px; border-radius: 50%; color: #fff; }
.expl.good .v > svg.i { background: var(--ok); } .expl.bad .v > svg.i { background: var(--ko); }
.expl .v b { font-size: 1rem; }
.expl.good .v b { color: var(--ok); } .expl.bad .v b { color: var(--ko); }
.expl .ga { font-weight: 600; color: var(--ink); }
.lvup, .lvdn { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 650; padding: 3px 9px; border-radius: 20px; }
.lvup { background: #fff2c2; color: #8a5a00; } .lvdn { background: var(--paper-2); color: var(--ink-2); }
.steps-e { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; line-height: 1.5; color: var(--ink); }
.steps-e .el.st { position: relative; padding-left: 18px; }
.steps-e .el.st::before { content: ""; position: absolute; left: 4px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--gc, var(--ink-3)); transform: rotate(45deg); }
.steps-e .el.pg { display: flex; gap: 6px; align-items: flex-start; color: var(--credit); margin-top: 2px; }
.steps-e .el.pg svg.i { margin-top: 3px; }
.rappel { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.rp-t { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; padding: 10px 12px; border: 0; background: var(--paper-2); color: var(--ink); font-size: .9rem; cursor: pointer; }
.rp-t svg.i { color: var(--gc, var(--debit)); }
.rp-t .chev { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .2s; }
.rp-t.open .chev { transform: rotate(-135deg); }
.rp-b { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); background: var(--paper); }
.qcm .nx { display: inline-flex; align-items: center; gap: 6px; }
.bylvl { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; font-size: .86rem; font-weight: 600; }
.review .rvh { display: flex; align-items: center; gap: 6px; }
.review .rvh > svg.i { color: var(--ko); } .review .rv.ok .rvh > svg.i { color: var(--ok); }
.review .steps-e { color: var(--ink-2); font-size: .86rem; }
.again svg.i, .btn svg.i { width: 17px; height: 17px; }
.btn { gap: 6px; }

/* Petite gerbe sur une bonne réponse + confettis à 100 % */
.burst { position: fixed; width: 0; height: 0; z-index: 150; pointer-events: none; }
.burst i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: burst .6s ease-out forwards; transform: rotate(var(--a)) translateX(0); }
.burst i:nth-child(3n) { background: var(--marker); } .burst i:nth-child(3n+1) { background: var(--debit); }
@keyframes burst { to { transform: rotate(var(--a)) translateX(46px); opacity: 0; } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall 1.8s cubic-bezier(.3,.6,.4,1) forwards; }
@keyframes fall { to { transform: translate(var(--x), 420px) rotate(var(--r)); opacity: 0; } }

/* Onglet Examen */
.exam { display: flex; flex-direction: column; gap: 16px; }
.xbox { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.xbox h3 { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; }
.xbox h3 svg.i { width: 30px; height: 30px; padding: 6px; border-radius: 10px; }
.xbox.method h3 svg.i { background: var(--debit-bg); color: var(--debit); }
.xbox.ask h3 svg.i { background: color-mix(in srgb, var(--marker) 40%, transparent); color: var(--marker-ink); }
.xbox.trap h3 svg.i { background: var(--credit-bg); color: var(--credit); }
.xsub { font-size: .84rem; color: var(--ink-3); margin-top: -6px; }
.xsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.xsteps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 12px; }
.xsteps li:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.xsteps li > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; background: var(--debit); color: #fff; position: relative; z-index: 1; }
.xsteps li > div { padding-top: 6px; font-size: .95rem; }
.asks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.askc { text-align: left; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; color: var(--ink); font-size: .92rem; transition: border-color .2s, transform .2s; }
.askc .aq { font-family: var(--font-display); font-weight: 700; font-size: 1rem; position: relative; padding-left: 14px; }
.askc .aq::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px; border-radius: 3px; background: var(--marker); }
.askc .aa { display: grid; grid-template-rows: 0fr; overflow: hidden; color: var(--ink-2); transition: grid-template-rows .3s ease; }
.askc .aa > * { min-height: 0; }
.askc .aa { display: block; max-height: 0; }
.askc.open .aa { max-height: 400px; transition: max-height .35s ease; }
.askc .aa b { display: block; color: var(--ok); font-size: .8rem; margin-bottom: 2px; }
.askc::after { content: "Voir ce qu'on attend"; font-size: .76rem; color: var(--ink-3); }
.askc.open::after { content: "Masquer"; }
.askc.open { border-color: var(--ok); background: var(--paper); }
.traps { display: flex; flex-direction: column; gap: 10px; }
.trapc { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--credit-bg); border-left: 4px solid var(--credit); }
.trapc .tn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--paper); color: var(--credit); }
.trapc b { display: block; font-family: var(--font-display); font-weight: 700; margin-bottom: 2px; }
.trapc p { font-size: .92rem; color: var(--ink); }

/* Lexique et cartes */
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg.big button { padding: 9px 14px; font-size: .9rem; }
.lexbox { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 4px 14px; }
.lexbox .drow b { display: block; }
.lexbox .drow b svg.i { margin-right: 6px; color: var(--credit); }
.filters select[hidden] { display: none; }
.fhead { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--ink-3); margin-bottom: 6px; }
.fstat { display: inline-flex; gap: 10px; }
.fstat b { display: inline-flex; align-items: center; gap: 3px; } .fstat .ok { color: var(--ok); } .fstat .ko { color: var(--warn); }
.fprog { height: 5px; border-radius: 4px; background: var(--paper-2); overflow: hidden; margin-bottom: 12px; }
.fprog i { display: block; height: 100%; background: var(--gc, var(--debit)); transition: width .3s; }
.fface small { display: inline-flex; align-items: center; gap: 5px; }
.fhint { font-size: .8rem; color: var(--ink-3); margin-top: auto; }
.flink { font-size: .82rem; margin-top: auto; }
.fdone { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fcard { height: 280px; }
@media (max-width: 520px) { .fcard { height: 340px; } }

/* Mise en valeur d'une partie de cours ouverte depuis un QCM */
.sheet.flash { box-shadow: 0 0 0 3px var(--marker), var(--shadow); transition: box-shadow .4s; }

/* ---------- Animations (désactivées si l'utilisateur réduit les mouvements) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .page { animation: pagein .38s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes pagein { from { opacity: 0; transform: translateY(10px); } }
  .anim > * { opacity: 0; transform: translateY(12px); transition: opacity .45s ease, transform .5s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 55ms); }
  .anim.on > * { opacity: 1; transform: none; }
  .anim .casc .cb i { transform: scaleX(0); transform-origin: left; transition: transform .9s cubic-bezier(.2,.7,.2,1) .2s; }
  .anim.on .casc .cb i { transform: scaleX(1); }
  .anim .bilan .bblock { transform: scaleY(.6); opacity: 0; transform-origin: bottom; transition: transform .6s cubic-bezier(.2,.7,.2,1), opacity .5s; }
  .anim.on .bilan .bblock { transform: none; opacity: 1; }
  .anim .journal tbody tr { opacity: 0; transform: translateX(-8px); transition: opacity .4s, transform .4s; }
  .anim.on .journal tbody tr { opacity: 1; transform: none; }
  .anim.on .journal tbody tr:nth-child(2) { transition-delay: .1s; } .anim.on .journal tbody tr:nth-child(3) { transition-delay: .2s; }
  .anim.on .journal tbody tr:nth-child(4) { transition-delay: .3s; } .anim.on .journal tbody tr:nth-child(5) { transition-delay: .4s; } .anim.on .journal tbody tr:nth-child(n+6) { transition-delay: .5s; }
  .anim .flow .fs { opacity: 0; transform: scale(.94); transition: opacity .4s, transform .4s; }
  .anim.on .flow .fs { opacity: 1; transform: none; }
  .anim.on .flow .fs:nth-child(3) { transition-delay: .12s; } .anim.on .flow .fs:nth-child(5) { transition-delay: .24s; } .anim.on .flow .fs:nth-child(7) { transition-delay: .36s; } .anim.on .flow .fs:nth-child(9) { transition-delay: .48s; } .anim.on .flow .fs:nth-child(n+11) { transition-delay: .6s; }
  .opt { animation: optin .35s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
  @keyframes optin { from { opacity: 0; transform: translateY(8px); } }
  .qcm-q { animation: fadein .3s ease both; }
  .expl, .rappel { animation: fadein .3s ease both; }
  .xsteps li, .trapc { animation: fadein .4s ease both; animation-delay: calc(var(--i, 0) * 70ms); }
  .lvup { animation: pop .5s; }
}
/* Version ordinateur : relief et réactions au survol */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .opt { transition: transform .15s, border-color .15s, background .15s, box-shadow .15s; }
  .opt:hover:not([disabled]) { transform: translateX(4px); box-shadow: var(--shadow); }
  .chap-card, .quick, .lg, .askc, .exo { transition: transform .2s, box-shadow .2s, border-color .2s; }
  .chap-card:hover, .quick:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
  .askc:hover { transform: translateY(-2px); border-color: var(--marker); }
  .subj-card { transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s; }
  .subj-card:hover { transform: translateY(-4px) rotate(-.3deg); }
  .subj-card:hover .sbig { transform: scale(1.08) rotate(-6deg); }
  .sbig, .sico { transition: transform .25s cubic-bezier(.2,.7,.2,1), background .2s, color .2s; }
  .side-link:hover .sico { transform: scale(1.08); }
  .sheet { transition: box-shadow .25s; }
  .sheet:hover { box-shadow: var(--shadow); }
  .fcard:hover { transform: translateY(-3px); } .fcard.flip:hover { transform: rotateY(180deg) translateY(-3px); }
}
