/* Quiz FEC772 — feuille de style (aucune dépendance externe) */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --ink: #17202c;
  --muted: #5d6b7c;
  --line: #d8dfe9;
  --acc: #0b4a83;
  --acc-2: #1667b4;
  --acc-soft: #e5eef9;
  --ok: #157a3c;
  --ok-soft: #e6f5ea;
  --ko: #b3261e;
  --ko-soft: #fbeceb;
  --mid: #9a6400;
  --mid-soft: #fff4dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --surface: #171e27; --surface-2: #1e2732; --ink: #e7edf4; --muted: #9aa8b8; --line: #2c3846;
    --acc: #6fb0f2; --acc-2: #8cc2f7; --acc-soft: #1b2b3e; --ok: #5fd08a; --ok-soft: #15301f; --ko: #ff8a80; --ko-soft: #3a1d1b;
    --mid: #f2c060; --mid-soft: #3a2f14; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
button { font: inherit; color: inherit; }
code { background: var(--surface-2); padding: 0 4px; border-radius: 4px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; font-weight: 700; padding: 4px; border-radius: 8px; }
.brand small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.brand:hover { background: var(--surface-2); }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--acc); color: #fff; font-weight: 800; }
.topinfo { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; white-space: nowrap; }
.topinfo:empty { display: none; }
@media (max-width: 420px) { .brand small { display: none; } }
[hidden] { display: none !important; }

/* ---------- Menu des rubriques ---------- */
.topbar { flex-wrap: wrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { position: relative; padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: .93rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--acc-soft); color: var(--acc); }
.nav a.live::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; vertical-align: 2px; border-radius: 50%; background: var(--mid); }
@media (max-width: 700px) {
  .topbar { padding: 8px 12px 6px; row-gap: 6px; }
  .brand { flex: 1; }
  .topinfo { order: 2; }
  .nav { order: 3; width: 100%; margin: 0; }
  .nav a { flex: 1; text-align: center; padding: 6px 2px; font-size: .88rem; }
}
.container { max-width: 880px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 16px 30px; }

/* ---------- Accueil ---------- */
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 8px 0 6px; letter-spacing: -.01em; }
.hero p { margin: 0 0 18px; color: var(--muted); max-width: 640px; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modes.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) { .modes, .modes.three { grid-template-columns: 1fr; } }
.sect { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
a.mode-card { color: inherit; text-decoration: none; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease; }
.mode-card:hover, .mode-card:focus-visible { border-color: var(--acc-2); transform: translateY(-2px); outline: none; }
.mode-icon { font-size: 1.6rem; }
.mode-title { font-weight: 750; font-size: 1.12rem; }
.mode-desc { color: var(--muted); font-size: .93rem; }
.card-stat { font-size: .84rem; margin-top: 4px; }
.mode-go { margin-top: auto; padding-top: 8px; color: var(--acc); font-weight: 700; }
.bank { margin-top: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.bank h2 { font-size: 1.05rem; margin: 0 0 10px; }
.bank-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bank-grid div { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.bank-grid b { display: block; font-size: 1.5rem; color: var(--acc); }
.bank-grid span { font-size: .84rem; color: var(--muted); }
@media (max-width: 560px) { .bank-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- En-tête de test ---------- */
.run-head { margin-bottom: 14px; }
.run-title { font-weight: 750; font-size: 1.05rem; }
.run-progress { color: var(--muted); font-size: .92rem; margin: 2px 0 8px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--acc-2); transition: width .3s ease; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pal { min-width: 34px; height: 32px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .85rem; font-weight: 600; }
.pal.done { background: var(--acc-soft); border-color: var(--acc-2); }
.pal.cur { outline: 2px solid var(--acc); outline-offset: 1px; }

/* ---------- Carte de question ---------- */
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font-size: .76rem; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.chip.type { background: var(--acc-soft); color: var(--acc); }
.chip.soft { font-weight: 500; }
.chip:empty { display: none; }
.chip.pts { background: var(--mid-soft); color: var(--mid); }
.q { font-size: 1.12rem; line-height: 1.45; margin: 4px 0 14px; }
.prompt, .context { line-height: 1.6; }
.context p, .prompt p { margin: 6px 0; }
.context ol.ops { padding-left: 22px; margin: 6px 0; }
.context ul { padding-left: 20px; }
.hint { color: var(--muted); font-size: .88rem; }

.opts { display: grid; gap: 8px; }
.opts.tf { grid-template-columns: 1fr 1fr; }
.opts.small { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.opt { display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 11px 13px; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; line-height: 1.4; }
.opt:hover:not([disabled]) { border-color: var(--acc-2); background: var(--acc-soft); }
.opt .letter { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); font-weight: 700; font-size: .82rem; }
.opt .letter:empty { display: none; }
.opt.sel { border-color: var(--acc); background: var(--acc-soft); }
.opt.good { border-color: var(--ok); background: var(--ok-soft); }
.opt.bad { border-color: var(--ko); background: var(--ko-soft); }
.opt[disabled] { cursor: default; }
.opts.tf .opt { justify-content: center; font-weight: 700; padding: 14px; }

/* ---------- Saisie numérique ---------- */
.ans-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
input.num { width: 220px; max-width: 100%; padding: 10px 12px; font-size: 1.05rem; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
input.num:focus { outline: none; border-color: var(--acc-2); box-shadow: 0 0 0 3px var(--acc-soft); }
input.num[disabled] { background: var(--surface-2); }
.unit { font-weight: 700; color: var(--muted); }
.dec-hint { font-size: .78rem; color: var(--muted); }

.parts { margin-top: 12px; display: grid; gap: 10px; }
.part { border-top: 1px dashed var(--line); padding-top: 10px; }
.part-label { font-weight: 650; }

/* ---------- Tableaux de données ---------- */
.table-wrap { overflow-x: auto; margin: 8px 0 10px; }
table.data { border-collapse: collapse; min-width: 60%; font-size: .93rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
table.data th { background: var(--surface-2); font-weight: 650; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.tot td { font-weight: 700; background: var(--surface-2); }

/* ---------- Rétroaction ---------- */
.feedback { margin-top: 12px; border-radius: 11px; padding: 11px 14px; border-left: 4px solid; }
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.ko { background: var(--ko-soft); border-color: var(--ko); }
.feedback.mid { background: var(--mid-soft); border-color: var(--mid); }
.fb-title { font-weight: 750; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.ko .fb-title { color: var(--ko); }
.feedback.mid .fb-title { color: var(--mid); }
.fb-line { margin: 4px 0; }
.fb-expl { margin-top: 6px; color: var(--ink); }
.feedback.summary { margin-top: 16px; }

/* ---------- Boutons ---------- */
.actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.actions.center { justify-content: center; }
.btn { border: 0; border-radius: 11px; padding: 11px 20px; font-weight: 700; cursor: pointer; display: inline-block; text-decoration: none; color: inherit; }
.btn.primary { background: var(--acc); color: #fff; margin-left: auto; }
.btn.primary:hover { background: var(--acc-2); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--line); }
.btn.ghost:hover:not([disabled]) { border-color: var(--acc-2); }
.btn[disabled] { opacity: .45; cursor: default; }
.actions.center .btn.primary { margin-left: 0; }
.msg { color: var(--ko); font-weight: 600; min-height: 1.2em; margin: 8px 0 0; }

/* ---------- Résultats ---------- */
.result { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.score-ring { --p: 0; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--acc-2) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.score-ring b { font-size: 2rem; line-height: 1; }
.score-ring span { color: var(--muted); font-size: .9rem; }
.result-txt { flex: 1 1 280px; }
.result-txt h1 { font-size: 1.3rem; margin: 0 0 4px; }
.result-txt .big { font-size: 1.08rem; font-weight: 650; margin: 0 0 4px; }
.breakdown { display: grid; gap: 6px; margin-top: 10px; }
.breakdown div { display: flex; justify-content: space-between; background: var(--surface-2); border-radius: 9px; padding: 7px 11px; }
.themes, .recap { margin-top: 22px; }
.themes h2, .recap h2 { font-size: 1.08rem; margin: 0 0 10px; }
.trow { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 10px; margin: 6px 0; }
.trow b { text-align: right; }
.tbar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.tbar span { display: block; height: 100%; border-radius: 99px; }
.tbar .hi { background: var(--ok); } .tbar .md { background: var(--mid); } .tbar .lo { background: var(--ko); }
details.rc { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid; border-radius: 10px; margin: 8px 0; }
details.rc.ok { border-left-color: var(--ok); } details.rc.ko { border-left-color: var(--ko); } details.rc.mid { border-left-color: var(--mid); }
details.rc summary { display: flex; gap: 8px; align-items: baseline; padding: 10px 12px; cursor: pointer; list-style: none; }
details.rc summary::-webkit-details-marker { display: none; }
.rc-icon { font-weight: 800; width: 18px; }
.rc.ok .rc-icon { color: var(--ok); } .rc.ko .rc-icon { color: var(--ko); } .rc.mid .rc-icon { color: var(--mid); }
.rc-n { color: var(--muted); }
.rc-t { flex: 1; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rc-p { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-body { padding: 0 14px 14px; }

@media (max-width: 560px) {
  .item { padding: 14px; }
  .opts.tf { grid-template-columns: 1fr; }
  .trow { grid-template-columns: 105px 1fr 48px; font-size: .9rem; }
  .score-ring { width: 124px; height: 124px; } .score-ring > div { width: 96px; height: 96px; }
  .actions .btn { flex: 1 1 auto; }
}

/* ================= Rubriques de révision ================= */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.page-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 6px 0 4px; letter-spacing: -.01em; }
.page-head p { margin: 0; max-width: 620px; }
.page-head .btn { padding: 8px 14px; font-size: .9rem; }
@media (max-width: 560px) { .page-head .btn { display: none; } }

/* Onglets des fiches */
.tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.tab { display: flex; flex-direction: column; gap: 1px; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--surface); color: inherit; text-decoration: none; line-height: 1.25; }
.tab:hover { border-color: var(--acc-2); }
.tab b { color: var(--acc); }
.tab span { font-size: .78rem; color: var(--muted); }
.tab.on { border-color: var(--acc); background: var(--acc-soft); }
@media (max-width: 760px) { .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Fiche */
.fiche + .fiche { margin-top: 34px; }
.fiche-head { background: var(--acc); color: #fff; border-radius: var(--radius); padding: 16px 18px; scroll-margin-top: 130px; }
.fiche { scroll-margin-top: 130px; }
.fiche-head .kicker { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.fiche-head h2 { margin: 2px 0 0; font-size: 1.3rem; line-height: 1.3; }
@media (prefers-color-scheme: dark) { .fiche-head { background: var(--acc-soft); color: var(--ink); } .fiche-head .kicker { color: var(--acc); opacity: 1; } }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.toc-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: .84rem; cursor: pointer; color: var(--acc); font-weight: 600; }
.toc-btn:hover { border-color: var(--acc-2); background: var(--acc-soft); }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 12px;
  box-shadow: var(--shadow); scroll-margin-top: 130px; line-height: 1.6; }
.sheet h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--acc); }
.sheet p { margin: 8px 0; }
.sheet ul, .sheet ol { padding-left: 22px; margin: 8px 0; }
.sheet li { margin: 3px 0; }
.sheet table.data { width: 100%; min-width: 440px; }
.sheet .f, .sheet .ex, .sheet .warn { border-left: 4px solid; border-radius: 8px; padding: 9px 13px; margin: 10px 0; }
.sheet .f { background: var(--acc-soft); border-color: var(--acc); font-variant-numeric: tabular-nums; }
.sheet .ex { background: var(--ok-soft); border-color: var(--ok); }
.sheet .warn { background: var(--mid-soft); border-color: var(--mid); }
.sheet .ex::before { content: "Exemple du cours"; display: block; font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); margin-bottom: 2px; }
.sheet .warn::before { content: "Attention"; display: block; font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--mid); margin-bottom: 2px; }
.fiche-nav { margin-top: 20px; }

/* Recherche et filtres */
.tools { margin-bottom: 6px; }
.searchbox { position: relative; display: flex; align-items: center; }
.searchbox svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.searchbox input { width: 100%; padding: 12px 40px 12px 40px; font-size: 1rem; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); -webkit-appearance: none; appearance: none; }
.searchbox input:focus { outline: none; border-color: var(--acc-2); box-shadow: 0 0 0 3px var(--acc-soft); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox .clear { position: absolute; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-2);
  color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.searchbox input:placeholder-shown + .clear { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.fchip { border: 1.5px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 99px; cursor: pointer; font-size: .86rem; font-weight: 650; color: var(--muted); }
.fchip:hover { border-color: var(--acc-2); }
.fchip.on { background: var(--acc); border-color: var(--acc); color: #fff; }
@media (prefers-color-scheme: dark) { .fchip.on { color: #0f141b; } }
.count { margin: 6px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Formulaire */
.fgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 6px; margin-top: 12px; box-shadow: var(--shadow); }
.fgroup h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.08rem; margin: 0 0 4px; color: var(--acc); }
.frow { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.fgroup h2 + .frow { border-top: 0; }
.fname { font-weight: 650; line-height: 1.4; }
.fx { background: var(--acc-soft); border-left: 3px solid var(--acc); border-radius: 6px; padding: 6px 11px; font-variant-numeric: tabular-nums; line-height: 1.55; }
.fex { font-size: .88rem; color: var(--muted); margin-top: 5px; }
.fex b { color: var(--ok); }
@media (max-width: 620px) { .frow { grid-template-columns: 1fr; } .fgroup { padding: 12px 14px 4px; } }

/* Glossaire */
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 2px; }
.letters button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--acc); }
.letters button:hover:not([disabled]) { background: var(--acc-soft); }
.letters button[disabled] { opacity: .3; cursor: default; }
.gletter { scroll-margin-top: 130px; }
.gletter h2 { font-size: 1.3rem; color: var(--acc); margin: 20px 0 6px; padding-bottom: 2px; border-bottom: 2px solid var(--acc-soft); }
.gentry { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; margin: 7px 0; }
.gterm { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.gterm abbr { font-weight: 800; color: var(--acc); text-decoration: none; font-size: 1.05rem; }
.gname { font-weight: 650; }
.gterm .chip { margin-left: auto; }
.gdef { margin-top: 3px; font-size: .95rem; line-height: 1.55; }

/* ================= Impression ================= */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f1f3f6; --ink: #111; --muted: #444; --line: #c9d0da;
    --acc: #0b4a83; --acc-2: #1667b4; --acc-soft: #e9f0f8; --ok: #157a3c; --ok-soft: #eaf5ec; --ko: #b3261e; --ko-soft: #fbeceb;
    --mid: #8a5a00; --mid-soft: #fdf2d8; --shadow: none;
  }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .foot, .tabs, .toc, .tools, .page-head .btn, .fiche-nav, .actions, .palette { display: none !important; }
  .container { max-width: none; padding: 0; }
  .fiche-head { background: #fff !important; color: var(--acc) !important; border: 2px solid var(--acc); }
  .fiche + .fiche { break-before: page; margin-top: 0; }
  .sheet, .fgroup, .item { box-shadow: none; }
  .gentry, .frow, .sheet .f, .sheet .ex, .sheet .warn, .sheet tr, .sheet li { break-inside: avoid; }
  .sheet h3, .fgroup h2, .gletter h2, .fiche-head { break-after: avoid; }
  .table-wrap { overflow: visible; }
  .sheet table.data { min-width: 0; }
  details.rc { break-inside: avoid; }
  details.rc .rc-body { display: block; }
}
@media screen and (max-width: 560px) {
  .sheet { padding: 14px 12px; }
  .sheet table.data { min-width: 0; font-size: .8rem; }
  .sheet table.data th, .sheet table.data td { padding: 4px 6px; }
}

/* ================= Ajouts : exemples, sélection des cours, tableaux, exercices, jeu, aide-mémoire ================= */
/* Exemples avec énoncé */
.sheet .ex::before { content: none; }
.ex-t { font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); margin-bottom: 4px; }
.sheet .ex p.en, .sheet .ex p.so { margin: 4px 0; }
.sheet .ex p.so { border-top: 1px dashed color-mix(in srgb, var(--ok) 45%, transparent); padding-top: 6px; margin-top: 6px; }
.sheet .ex ol.ops { margin: 4px 0; padding-left: 22px; }
.sheet .ex table.data { min-width: 0; margin: 6px 0; background: var(--surface); }
.fex-en { color: var(--ink); }
.fex-so { margin-top: 2px; }
.fex b { color: var(--ok); }

/* Sélection des cours */
.coursesel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.coursesel.compact { padding: 10px 14px; margin: 10px 0 0; }
.cs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.coursesel .filters { margin: 8px 0 0; }
.cs-name { font-weight: 500; }
@media (max-width: 760px) { .cs-name { display: none; } }

/* Tableaux à remplir */
table.fill { min-width: 100%; font-size: .9rem; }
table.fill th[scope="row"] { text-align: left; font-weight: 600; background: var(--surface); white-space: normal; min-width: 170px; }
table.fill tr.tot th[scope="row"], table.fill tr.tot td { background: var(--surface-2); font-weight: 700; }
table.fill tr.grp th { text-align: center; background: var(--acc-soft); color: var(--acc); font-size: .8rem; }
table.fill td { padding: 3px 4px; vertical-align: middle; }
table.fill td.given { color: var(--muted); padding: 5px 8px; }
table.fill td.blank { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 7px); }
table.fill input.cell { width: 100%; min-width: 92px; padding: 6px 7px; font-size: .92rem; text-align: right; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
table.fill input.cell:focus { outline: none; border-color: var(--acc-2); box-shadow: 0 0 0 2px var(--acc-soft); }
table.fill.wide th[scope="row"] { position: sticky; left: 0; z-index: 1; min-width: 150px; box-shadow: 1px 0 0 var(--line); }
table.fill.wide input.cell { min-width: 80px; }
table.fill td.c-ok { background: var(--ok-soft); }
table.fill td.c-ko { background: var(--ko-soft); }
table.fill .c-user { display: block; }
table.fill td.c-ko .c-user { color: var(--ko); text-decoration: line-through; text-decoration-thickness: 1px; }
table.fill .c-ans { display: block; font-weight: 700; color: var(--ok); font-size: .86rem; }
.context table.data { min-width: 0; }

/* Exercer une formule */
.fname { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.try { border: 1.5px solid var(--acc-2); color: var(--acc); background: var(--surface); border-radius: 99px; padding: 3px 11px; font-size: .8rem; font-weight: 700; cursor: pointer; }
.try:hover { background: var(--acc-soft); }
.prac { margin-top: 10px; border: 1.5px solid var(--acc-2); border-radius: 12px; padding: 12px 14px; background: var(--surface); box-shadow: var(--shadow); }
.prac-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.prac-head .muted { margin-left: auto; }
.prac .x { border: 0; background: var(--surface-2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.prac .actions { margin-top: 10px; }
.prac .msg { margin: 4px 0 0; }
@media (max-width: 620px) { .prac-head { flex-wrap: wrap; } .prac-head .muted { margin-left: 0; order: 3; width: 100%; } .prac-head .x { margin-left: auto; } }

/* Jeu du glossaire */
.game-cta { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; background: var(--acc-soft); border: 1.5px solid var(--acc-2);
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 14px; }
.game-cta:hover { border-color: var(--acc); }
.game-cta > span:nth-child(2) { display: flex; flex-direction: column; }
.gc-icon { font-size: 1.6rem; }
.gc-go { margin-left: auto; font-weight: 700; color: var(--acc); white-space: nowrap; }
.match { margin-top: 12px; }
.m-bank { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; align-items: center; padding: 10px 12px;
  background: var(--surface); border: 1.5px dashed var(--acc-2); border-radius: 12px; box-shadow: var(--shadow); }
@media (max-width: 700px) { .m-bank { top: 92px; } }
.m-chip { touch-action: none; user-select: none; -webkit-user-select: none; border: 1.5px solid var(--acc); background: var(--acc-soft); color: var(--acc);
  border-radius: 9px; padding: 7px 12px; font-weight: 750; cursor: grab; line-height: 1.25; text-align: left; }
.m-chip.sel { background: var(--acc); color: #fff; box-shadow: 0 0 0 3px var(--acc-soft); }
@media (prefers-color-scheme: dark) { .m-chip.sel { color: #0f141b; } }
.m-chip.dragging { opacity: .35; }
.m-chip[disabled] { cursor: default; }
.m-chip.ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -60%) rotate(-2deg); box-shadow: 0 8px 22px rgba(0, 0, 0, .25); opacity: .95; }
.m-defs { display: grid; gap: 10px; margin-top: 12px; }
.m-def { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px 14px; align-items: start; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.m-def.target:hover, .m-def.over { border-color: var(--acc-2); background: var(--acc-soft); }
.m-def.ok { border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.m-def.ko { border-color: var(--ko); background: var(--ko-soft); cursor: default; }
.m-slot { min-height: 38px; border: 1.5px dashed var(--line); border-radius: 9px; display: flex; align-items: center; padding: 3px; }
.m-def.ok .m-slot, .m-def.ko .m-slot { border-style: solid; }
.m-ph { color: var(--muted); font-size: .82rem; padding: 0 8px; }
.m-text { line-height: 1.55; font-size: .95rem; }
.mask { color: var(--muted); letter-spacing: -.1em; }
.m-corr { grid-column: 1 / -1; font-size: .9rem; }
.m-def.ok .m-corr { color: var(--ok); } .m-def.ko .m-corr { color: var(--ko); }
.m-corr b { color: var(--ink); }
.m-score { font-size: 1.02rem; }
@media (max-width: 620px) { .m-def { grid-template-columns: 1fr; } }

/* Aide-mémoire */
.aide-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 4px 0 6px; }
.aide-actions .btn.primary { margin-left: 0; }
.aide-actions a.small { color: var(--acc); }
.aide-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 14px; }
.aide-pages figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
.aide-pages img { display: block; width: 100%; height: auto; border-radius: 4px; background: #fff; }
.aide-pages figcaption { font-size: .85rem; color: var(--muted); text-align: center; padding-top: 6px; }
@media (max-width: 700px) { .aide-pages { grid-template-columns: 1fr; } }

/* Menu : libellé court sur téléphone */
.l-short { display: none; }
@media (max-width: 700px) { .l-long { display: none; } .l-short { display: inline; } }

@media print {
  .prac-slot, .try, .game-cta, .coursesel { display: none !important; }
  table.fill.wide th[scope="row"] { position: static; }
}
.parts { grid-template-columns: minmax(0, 1fr); }
.part, .item, .context, .prompt { min-width: 0; }
table.fill.wide input.cell { min-width: 72px; padding: 6px 5px; }
table.fill.wide th[scope="row"] { min-width: 132px; }
table.fill.wide th, table.fill.wide td { font-size: .86rem; }
.scroll-hint { display: none; font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
@media (max-width: 760px) { .scroll-hint { display: block; } }
/* tableaux très larges (tableau des transactions) : on élargit la page quand il y en a un */
.container:has(table.fill.wide) { max-width: 1440px; }
table.fill.wide thead th { white-space: normal; line-height: 1.2; vertical-align: bottom; }
table.fill.wide input.cell { min-width: 64px; }
table.fill th[scope="row"][title] { cursor: help; }
table.fill th[scope="row"] .row-tip { display: block; font-weight: 400; font-size: .76rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
table.fill.wide th[scope="row"] { min-width: 200px; max-width: 240px; }
table.fill.wide thead th { font-size: .74rem; padding: 4px 5px; hyphens: auto; -webkit-hyphens: auto; }
table.fill.wide input.cell { min-width: 56px; }
table.fill.wide th[scope="row"] { min-width: 190px; max-width: 220px; }
@media (max-width: 760px) { table.fill.wide th[scope="row"] { min-width: 132px; max-width: 150px; } table.fill th[scope="row"] .row-tip { font-size: .7rem; } }
.aide-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; }
