/* Palette neutre avant le choix du niveau et pour le choix « Les deux ». */
:root,.theme-neutral {
  --paper:#f6f0e5;
  --ink:#453a30;
  --muted:#786a5b;
  --accent:#765a40;
  --accent-hover:#5c432e;
  --accent-soft:#eee2d2;
  --accent-border:#ac977e;
  --accent-soft-hover:#e5d5c0;
  --on-accent-muted:#e1cfb9;
  --on-accent-soft:#ede0cf;
  --progress-fill:#dec6a3;
  --accent-shadow:#765a4012;
  --focus:#9e6d3f;
  --field-border:#cdbda8;
  --field-bg:#fdfaf5;
  --code-bg:#ece2d4;
  --line:#ded2c2;
  --orange:#986c45;
  --white:#fff;
  --success:#eaf4ec;
  --error:#fff2e8;
}

:root {
  color-scheme:light;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:16px;
}

.theme-1t {
  --paper:#f0f6f1;
  --ink:#1e3934;
  --muted:#60716a;
  --accent:#17564e;
  --accent-hover:#0c3e37;
  --accent-soft:#e8ede2;
  --accent-border:#a1b5a7;
  --accent-soft-hover:#dbe4d3;
  --on-accent-muted:#b9d4ca;
  --on-accent-soft:#d1e0da;
  --progress-fill:#d6e7a0;
  --accent-shadow:#17564e12;
  --focus:#c87540;
  --field-border:#c9d4ca;
  --field-bg:#fbfcf9;
  --code-bg:#e9ece4;
  --line:#dbe1d8;
  --orange:#b3552b;
}

.theme-1eds {
  --paper:#f3f6fa;
  --ink:#25394d;
  --muted:#5c6d80;
  --accent:#285c91;
  --accent-hover:#1d446d;
  --accent-soft:#e8eff8;
  --accent-border:#a7bbd3;
  --accent-soft-hover:#dce7f5;
  --on-accent-muted:#c2d6ee;
  --on-accent-soft:#dbe6f4;
  --progress-fill:#bbd8fa;
  --accent-shadow:#285c9112;
  --focus:#4276ac;
  --field-border:#c4d1e2;
  --field-bg:#fbfcff;
  --code-bg:#e8eef6;
  --line:#d8e1ec;
  --orange:#285c91;
}

.theme-1g {
  --paper:#faf3f4;
  --ink:#3a2024;
  --muted:#7a5f63;
  --accent:#a01f31;
  --accent-hover:#7d1725;
  --accent-soft:#f8e8ea;
  --accent-border:#cfa2a8;
  --accent-soft-hover:#f2d8db;
  --on-accent-muted:#eec3c8;
  --on-accent-soft:#f6dcdf;
  --progress-fill:#f0bfc5;
  --accent-shadow:#a01f3112;
  --focus:#b73545;
  --field-border:#e0c8cb;
  --field-bg:#fdfafb;
  --code-bg:#f6e9eb;
  --line:#ecd9db;
  --orange:#a0522d;
}

* {
  box-sizing:border-box;
}

[hidden] {
  display:none!important;
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  line-height:1.65;
}

button,input,select {
  font:inherit;
}

button,summary,select {
  cursor:pointer;
}

button {
  transition:background .15s,color .15s;
}

a {
  color:inherit;
}

button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible {
  outline:3px solid var(--focus);
  outline-offset:4px;
}

button {
  border:0;
  border-radius:8px;
}

button:disabled {
  opacity:.55;
  cursor:default;
}

p {
  margin:0 0 1rem;
}

h1,h2 {
  margin:0;
}

main,.masthead {
  max-width:1180px;
  margin:auto;
  padding-left:36px;
  padding-right:36px;
}

.masthead {
  min-height:80px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  gap:20px;
}

.install-help {
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  width:calc(100% - 32px);
  max-width:560px;
  max-height:calc(100dvh - 32px);
  padding:0;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 24px 80px #0004;
  line-height:1.55;
  overflow:hidden;
}

.install-help[open] { display:flex; }
.install-help-body { padding:28px 28px 20px; overflow:auto; }
.install-help-actions { padding:16px 28px 22px; border-top:1px solid var(--line); }
.install-help-actions form { margin:0; display:flex; flex-wrap:wrap; gap:10px; }
.install-help-actions form button { flex:1 1 140px; width:auto; }
.install-help-body #install-app { margin-top:16px; }
.install-help::backdrop { background:#0008; }
.install-help h2 { margin-top:0; font-size:1.4rem; line-height:1.25; }
.install-help h3 { margin:20px 0 8px; font-size:1rem; }
.install-help ol { margin:0; padding-left:24px; }
.install-help li + li { margin-top:6px; }
.install-help form button { width:100%; }
.install-desktop { color:var(--muted); font-size:.85rem; margin-bottom:0; }
.install-help .ios-share {
  width:18px;
  height:18px;
  margin:0 2px;
  vertical-align:-4px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.install-help #install-status:empty { display:none; }
html:has(.install-help[open]) { overflow:hidden; }

.leave-help {
  box-sizing:border-box;
  width:calc(100% - 32px);
  max-width:480px;
  padding:0;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 24px 80px #0004;
  line-height:1.55;
  overflow:hidden;
}
.leave-help-body { padding:26px 26px 18px; }
.leave-help-actions { padding:14px 26px 20px; border-top:1px solid var(--line); }
.leave-help-actions form { margin:0; display:flex; flex-wrap:wrap; gap:10px; }
.leave-help-actions form button { flex:1 1 160px; width:auto; }
.leave-help::backdrop { background:#0008; }
.leave-help h2 { margin:0 0 10px; font-size:1.3rem; line-height:1.25; }
.leave-help p { margin:0 0 10px; }
.leave-help p:last-child { margin-bottom:0; }
html:has(.leave-help[open]) { overflow:hidden; }

.masthead .teacher-tools {
  padding:0;
  flex-shrink:0;
  margin-left:auto;
}

.masthead .teacher-tools a {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  box-sizing:border-box;
}

.brand {
  display:flex;
  align-items:center;
  gap:9px;
  text-decoration:none;
  font-family:Georgia,serif;
  font-size:36px;
  font-weight:bold;
  letter-spacing:-2px;
}

.brand-dot {
  color:var(--orange);
  align-self:flex-start;
  font-family:"Arial Black","DejaVu Sans",sans-serif;
  font-size:0.52em;
  font-weight:1000;
  -webkit-text-stroke:0.8px currentColor;
  paint-order:stroke fill;
  line-height:1;
  margin-left:-13px;
  margin-top:17px;
}

.brand span:last-child {
  font-family:system-ui,sans-serif;
  font-size:13px;
  font-weight:600;
  letter-spacing:0;
}

.level {
  color:var(--muted);
  font-size:13px;
}

.level-badge {
  display:inline-block;
  min-width:58px;
  padding:2px 8px;
  margin-right:6px;
  border:1px solid var(--accent-border);
  border-radius:5px;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:11px;
  font-weight:600;
  text-align:center;
  white-space:nowrap;
}

.hero {
  display:grid;
  grid-template-columns:minmax(0,1fr) 280px;
  gap:65px;
  align-items:center;
  padding:60px 0 46px;
}

.eyebrow {
  font-size:11px;
  letter-spacing:2px;
  font-weight:700;
  color:var(--muted);
  margin-bottom:16px;
}

h1 {
  font:normal clamp(38px,4.8vw,60px)/1.13 Georgia,"Times New Roman",serif;
  letter-spacing:-1.8px;
}

h1 em {
  font-weight:normal;
  color:var(--accent);
}

.intro {
  max-width:610px;
  color:var(--muted);
  font-size:16px;
  margin:22px 0;
}

.tags {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.tags span {
  padding:5px 10px;
  border:1px solid var(--line);
  border-radius:100px;
  color:var(--muted);
  font-size:11px;
}

.progress-card {
  padding:24px 28px;
  background:var(--accent);
  color:#fff;
  border-radius:16px;
  box-shadow:0 12px 30px var(--accent-shadow);
}

.progress-card .eyebrow {
  color:var(--on-accent-muted);
}

.score {
  font:normal 65px/1 Georgia,serif;
  margin:18px 0 8px;
}

.score-total {
  font-size:25px;
  color:var(--on-accent-muted);
}

.progress-card>p:not(.score) {
  font-size:13px;
}

.progress-card progress {
  width:100%;
  height:6px;
  appearance:none;
  border:0;
  display:block;
  border-radius:10px;
  overflow:hidden;
  background:#ffffff30;
}

.progress-card progress::-webkit-progress-bar {
  background:#ffffff30;
}

.progress-card progress::-webkit-progress-value {
  background:var(--progress-fill);
}

.progress-card progress::-moz-progress-bar {
  background:var(--progress-fill);
}

.progress-card .support-text {
  margin:16px 0 0;
  color:var(--on-accent-soft);
  font-size:12px;
  line-height:1.6;
}

.toolbar {
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:22px 0 10px;
}

.toolbar p {
  font-size:13px;
  margin:0;
  color:var(--muted);
}

.toolbar strong {
  color:var(--ink);
}

.toolbar-actions {
  display:flex;
  gap:16px;
  align-items:center;
  flex-shrink:0;
}

.primary,.secondary {
  padding:11px 17px;
  font-weight:600;
  font-size:13px;
  background:var(--accent);
  color:#fff;
}

.primary:hover,.verify:hover {
  background:var(--accent-hover);
}

.primary span {
  margin-left:12px;
}

.text-button {
  background:transparent;
  color:var(--muted);
  font-size:12px;
  padding:8px 0;
}

.text-button:hover {
  text-decoration:underline;
}

.input-help {
  font-size:12px;
  color:var(--muted);
  margin:0 0 25px;
}

code {
  font-size:12px;
  background:var(--code-bg);
  border-radius:3px;
  padding:2px 4px;
}

.questions {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:20px;
  align-items:start;
  max-width:820px;
  margin:0 auto;
}

.sheet-view .questions {
  grid-template-columns:repeat(2,minmax(0,1fr));
  max-width:none;
}

.view-switch {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:0 0 24px;
}

/* Onglets centrés : ils restent au même endroit quand on passe de la vue
   « Par exercice » (colonne de 892 px) à la fiche complète (1180 px). */
.single-view .view-switch,
.sheet-view .view-switch {
  justify-content:center;
}

.view-switch a,.view-switch button {
  display:inline-flex;
  align-items:center;
  text-decoration:none;
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:8px;
  padding:9px 13px;
  cursor:pointer;
}

.view-switch a:hover,.view-switch button:hover:not(:disabled) {
  background:var(--accent-soft);
}

.view-switch a.text-button {
  border:0;
  padding:8px 0;
  color:var(--muted);
}

.view-switch a[aria-current="page"] {
  color:var(--accent);
  background:var(--accent-soft);
  border-color:var(--accent-border);
}

.question {
  background:var(--white);
  border:1px solid var(--line);
  border-radius:12px;
  padding:26px 28px;
  min-width:0;
  scroll-margin-top:20px;
}

.question.wide {
  grid-column:1/-1;
}

.question-heading {
  display:flex;
  align-items:center;
  gap:13px;
  margin-bottom:24px;
}

.number {
  display:flex;
  align-items:center;
  justify-content:center;
  width:39px;
  height:39px;
  border:1px solid var(--line);
  border-radius:50%;
  font-family:Georgia,serif;
  font-size:17px;
  flex-shrink:0;
}

.topic {
  font-size:9px;
  color:var(--muted);
  font-weight:700;
  letter-spacing:1.3px;
  margin:0 0 2px;
}

h2 {
  font:normal 22px/1.3 Georgia,serif;
  letter-spacing:-.3px;
}

.state {
  margin:0 0 0 auto;
  color:var(--muted);
  white-space:nowrap;
  font-size:10px;
  background:var(--paper);
  border-radius:100px;
  padding:3px 9px;
}

.question>p,.question .events {
  font-size:14px;
}

.answer {
  display:flex;
  align-items:center;
  gap:10px;
  margin:20px 0 18px;
  flex-wrap:wrap;
  font-size:15px;
}

.answer input {
  flex:1;
  min-width:120px;
  width:100%;
}

.answer label {
  white-space:nowrap;
}

/* Un champ sans libellé visible (énoncé qui porte déjà la question). */
.answer label:empty {
  display:none;
}

.answer.sentence {
  gap:8px;
}

.answer.sentence input {
  width:78px;
  flex:1;
  min-width:62px;
}

.answer.sentence select {
  max-width:130px;
}

input,select {
  background:var(--field-bg);
  color:var(--ink);
  border:1px solid var(--field-border);
  border-radius:6px;
  padding:10px 12px;
  font-size:14px;
  min-height:44px;
}

input::placeholder {
  color:var(--muted);
  font-size:12px;
}

input[aria-invalid="true"],select[aria-invalid="true"] {
  border-color:#bc774d;
}

input[aria-invalid="false"],select[aria-invalid="false"] {
  border-color:#5b9272;
}

.actions {
  display:flex;
  gap:20px;
  align-items:center;
}

.verify {
  background:var(--accent);
  color:var(--white);
  font-size:12px;
  padding:9px 17px;
  font-weight:600;
}

.hint-button {
  background:transparent;
  color:var(--muted);
  font-size:12px;
  padding:8px 0;
}

.hint-button:hover {
  color:var(--accent);
}

.hint-button span {
  padding-left:8px;
}

.feedback {
  font-size:13px!important;
  line-height:1.6;
  margin:16px 0 0;
  border-radius:6px;
}

.feedback:empty {
  display:none;
}

#export-status:empty {
  display:none;
}

.feedback:not(:empty) {
  padding:11px 13px;
  background:var(--error);
  color:#8e441e;
}

.question[data-status="correct"] .feedback {
  background:var(--success);
  color:#23573c;
}

.question[data-status="correct"] .number {
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}

.question[data-status="correct"] .state {
  background:var(--success);
  color:#23573c;
}

.question[data-status="incorrect"] .state {
  background:var(--error);
  color:#8e441e;
}

.hint {
  font-size:13px;
  padding:12px 14px;
  border-left:3px solid #c4a259;
  background:#faf7ed;
  margin-top:15px;
  color:#6b572e;
}

.hint strong {
  display:block;
  font-size:10px;
  letter-spacing:1px;
  margin-bottom:5px;
}

.correction {
  margin-top:22px;
  border-top:1px solid var(--line);
  font-size:13px;
}

.correction summary {
  font-size:12px;
  color:var(--muted);
  padding:14px 0 0;
}

.correction>div {
  padding:18px 0 0;
}

.correction-button {
  background:transparent;
  color:var(--accent);
  font-size:12px;
  padding:14px 0 0;
}

.correction-button:disabled {
  opacity:1;
  color:var(--muted);
}

.correction-lock {
  font-size:11px;
  color:var(--muted);
  margin:8px 0 0;
}

.exercise-picker {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:0 0 22px;
  color:var(--muted);
  font-size:12px;
}

.exercise-links {
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.exercise-links a {
  display:flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border:1px solid var(--line);
  border-radius:50%;
  text-decoration:none;
  font-size:12px;
}

.exercise-links a:hover {
  background:var(--accent-soft);
}

.exercise-links a[aria-current="page"] {
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}

.exercise-navigation {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:24px auto 0;
  max-width:820px;
}

.exercise-navigation a {
  border-radius:8px;
  text-decoration:none;
}

.exercise-position,.navigation-boundary {
  font-size:12px;
  color:var(--muted);
}

.correction p:last-child {
  margin-bottom:0;
}

.result {
  font-size:18px;
  font-weight:600;
  color:var(--accent);
}

.math,.formula {
  font-family:Georgia,"Times New Roman",serif;
}

.formula {
  font-size:16px!important;
  margin:18px 0 22px;
}

.fraction {
  display:inline-flex;
  vertical-align:middle;
  flex-direction:column;
  align-items:center;
  line-height:1.3;
  margin:0 5px;
  font-size:.85em;
}

.fraction span:first-child {
  border-bottom:1px solid currentColor;
  padding:0 7px 3px;
}

.fraction span:last-child {
  padding-top:3px;
}

.table-wrap {
  overflow-x:auto;
}

.sign-table {
  border-collapse:collapse;
  text-align:center;
  width:100%;
  min-width:440px;
  margin:18px 0 23px;
  table-layout:fixed;
  font-family:Georgia,serif;
}

.sign-table td,.sign-table th {
  padding:12px 3px;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}

.sign-table th {
  width:65px;
  border-right:1px solid var(--line);
  border-left:1px solid var(--line);
  font-weight:normal;
}

/* Filets verticaux du tableau de signes : un trait de part et d’autre de
   chaque racine (la case « 0 » occupe la même colonne) et un cadre à gauche et
   à droite du tableau. Les cases inutiles sont retirées du tableau quand le
   nombre de zéros change, donc les traits suivent toujours les colonnes
   réellement affichées. */
.sign-table td[data-cellule^="root-"],
.sign-table td[data-cellule^="zero-"] {
  border-left:1px solid var(--line);
  border-right:1px solid var(--line);
}

.sign-table td[data-cellule="start"] {
  border-left:1px solid var(--line);
}

.sign-table td[data-cellule="max"],
.sign-table td[data-cellule="end"] {
  border-right:1px solid var(--line);
}

/* Tableau de variations : filets verticaux de part et d’autre des extremums,
   et cadre à droite du tableau comme pour le tableau de signes. */
.variation-table td.col-valeur {
  border-left:1px solid var(--line);
  border-right:1px solid var(--line);
}

.variation-table td:last-child {
  border-right:1px solid var(--line);
}

.sign-table input {
  width:100%;
  padding:8px 4px;
  text-align:center;
  min-width:0;
}

.sign-table select {
  padding:8px;
  min-width:52px;
}

.sign-table .zero {
  color:var(--muted);
}

.variation-table {
  min-width:600px;
}

.variation-table select {
  min-width:0;
  width:100%;
  padding:8px 2px;
}

.field-help {
  font-size:11px;
  color:var(--muted);
  margin:-9px 0 17px;
}

.help-confirmation {
  margin:16px 0;
  padding:16px;
  border:1px solid var(--accent);
  border-radius:8px;
  background:var(--paper, #fff);
}

.help-confirmation p { margin:0 0 12px; }
.help-confirmation button + button { margin-left:12px; }

.events {
  padding-left:19px;
  margin-top:0;
}

.reminder {
  font-size:12px!important;
  color:var(--muted);
  border-left:2px solid var(--line);
  padding-left:12px;
}

.graph {
  width:100%;
  height:auto;
  display:block;
  margin:18px 0;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--field-bg);
}

.finish {
  margin:40px 0 28px;
  padding:30px;
  background:var(--accent-soft);
  border-radius:12px;
  display:flex;
  align-items:center;
  gap:40px;
  justify-content:space-between;
}

.finish .eyebrow {
  margin-bottom:10px;
}

.finish p:last-child {
  font-size:13px;
  color:var(--muted);
  max-width:620px;
  margin:12px 0 0;
}

.secondary {
  background:transparent;
  color:var(--accent);
  border:1px solid var(--accent-border);
  white-space:nowrap;
}

.secondary:hover {
  background:var(--accent-soft-hover);
}

footer {
  border-top:1px solid var(--line);
  padding:22px 0 30px;
  display:flex;
  gap:20px;
  justify-content:space-between;
  color:var(--muted);
  font-size:10px;
}

footer p {
  margin:0;
}

.notice {
  background:var(--error);
  padding:15px;
  border-radius:8px;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.question-heading>div {
  min-width:0;
  flex:1;
}

.collection-heading {
  padding:32px 0 24px;
}

.collection-heading h1 {
  font-size:32px;
  letter-spacing:-.7px;
}

.collection-heading p {
  color:var(--muted);
  font-size:13px;
  margin:12px 0 0;
}

/* Pages du Coin du prof : les blocs utilisent toute la largeur disponible
   (la limite de 760 px réservée aux pages élèves tronquait les textes). */
.catalogue-view:not(.home-view) .home-guide,
.coin-du-prof .home-guide {
  max-width:none;
}

/* Pages du Coin du prof : textes d'introduction à la taille du texte courant. */
.collection-heading p.texte-courant,
.mode-card p.texte-courant,
.home-guide p.texte-courant {
  font-size:1rem;
  max-width:none;
  text-wrap:pretty;
}

/* Les liens de ces paragraphes suivent la taille du texte qui les entoure. */
.collection-heading p.texte-courant a,
.mode-card p.texte-courant a {
  font-size:inherit;
}

.collection-heading progress {
  width:180px;
  height:5px;
  accent-color:var(--accent);
}

.score-summary {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px 18px;
  margin:0 0 20px;
  padding:12px 16px;
  border:1px solid var(--accent-border);
  border-radius:8px;
  background:var(--accent-soft);
  color:var(--accent);
}

.score-summary p {
  margin:0;
  font-size:13px;
}

.score-summary strong {
  font-size:20px;
}

.score-summary progress {
  width:140px;
  height:6px;
  accent-color:var(--accent);
}

.question[data-correction-penalized="true"] .feedback {
  background:var(--error);
  color:#8e441e;
}

.question[data-correction-penalized="true"] .state {
  background:var(--error);
  color:#8e441e;
}

.data-table,.catalogue-table {
  border-collapse:collapse;
  width:100%;
  margin:18px 0 24px;
  font-size:13px;
}

.data-table th,.data-table td,.catalogue-table th,.catalogue-table td {
  padding:12px;
  border-bottom:1px solid var(--line);
  text-align:left;
}

.data-table th,.catalogue-table thead th {
  font-weight:600;
}

.catalogue-table tbody th {
  font-weight:500;
  border-left:3px solid var(--accent);
  padding-left:16px;
}

/* Page « Sujets de bac 2026 » du kit : filtres par niveau et tri des colonnes. */
.catalogue-filters {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin:0 0 10px;
}

.catalogue-filters .filter-chip {
  font:inherit;
  font-size:12px;
  font-weight:600;
  padding:7px 12px;
  border:1px solid var(--accent-border);
  border-radius:8px;
  background:var(--white);
  color:var(--accent);
  cursor:pointer;
}

.catalogue-filters .filter-chip:hover {
  background:var(--accent-soft-hover);
}

.catalogue-filters .filter-chip[aria-pressed="true"] {
  background:var(--accent);
  border-color:var(--accent);
  color:var(--white);
}

.catalogue-table thead th[data-tri] {
  white-space:nowrap;
}

.catalogue-table thead th[data-tri] button {
  font:inherit;
  font-weight:600;
  color:inherit;
  background:none;
  border:0;
  padding:0;
  cursor:pointer;
}

.catalogue-table thead th[data-tri] button:hover {
  text-decoration:underline;
}

.catalogue-table thead th[data-tri] button::after {
  content:" ↕";
  color:var(--muted);
}

.catalogue-table thead th[aria-sort="ascending"] button::after {
  content:" ▲";
  color:var(--accent);
}

.catalogue-table thead th[aria-sort="descending"] button::after {
  content:" ▼";
  color:var(--accent);
}

.catalogue-actions {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  min-width:280px;
}

.catalogue-actions:has(.catalogue-refs) {
  grid-template-columns:repeat(3,minmax(0,1fr));
  /* Trois boutons dont « Sujet complet », qui doit tenir sur une ligne. */
  min-width:410px;
}

.catalogue-actions.share-actions {
  grid-template-columns:repeat(4,minmax(0,1fr));
  align-items:stretch;
}

.catalogue-actions.share-actions > .primary,
.catalogue-actions.share-actions #subject-latex-link {
  width:150px;
  max-width:100%;
  justify-self:start;
}

#scorm-export .share-actions .primary:disabled {
  opacity:1;
}

.catalogue-actions.share-actions #subject-latex-link {
  white-space:nowrap;
}

.web-link-actions {
  grid-column:span 2;
  display:flex;
  align-items:stretch;
  gap:4px;
  width:max-content;
  justify-self:start;
}

.web-link-actions .primary {
  display:flex;
  flex:0 0 150px;
  align-items:center;
  justify-content:center;
  width:150px;
  min-width:0;
  min-height:48px;
  box-sizing:border-box;
  padding:11px 17px;
}
.web-link-actions .text-button {
  display:flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:flex-start;
  min-width:0;
  min-height:48px;
  box-sizing:border-box;
  padding:8px 2px;
  white-space:nowrap;
}

/* Lien web et QR code à transmettre aux élèves. */
#web-link-share { margin-top:12px; }
#web-link-share label { display:block; font-weight:600; margin-bottom:4px; }
#web-link-output {
  box-sizing:border-box;
  width:100%;
  padding:9px 11px;
  border:1px solid var(--field-border);
  border-radius:8px;
  background:var(--field-bg);
  color:var(--ink);
  font:inherit;
  font-size:.9rem;
}
.web-link-qr { margin:14px 0 0; text-align:center; }
.web-link-qr svg {
  display:block;
  width:168px;
  height:168px;
  margin:0 auto;
  padding:8px;
  border-radius:8px;
  background:#fff;
}
.web-link-qr figcaption { margin-top:6px; color:var(--muted); font-size:.85rem; }

.catalogue-action {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  padding:11px 14px;
  border:1px solid var(--accent-border);
  border-radius:8px;
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
  text-align:center;
  text-decoration:none;
  white-space:nowrap;
  touch-action:manipulation;
}

.catalogue-action:first-child {
  background:var(--accent);
  border-color:var(--accent);
  color:var(--white);
}

.catalogue-action:hover {
  background:var(--accent-soft-hover);
}

.catalogue-action:first-child:hover {
  background:var(--accent-hover);
  border-color:var(--accent-hover);
}

/* Petit lien sous le titre du sujet : personnaliser et imprimer. */
.catalogue-table tbody th .catalogue-shortcut {
  display:block;
  margin-top:4px;
  font-size:12px;
  font-weight:400;
  line-height:1.4;
  color:var(--accent);
  text-decoration:none;
}

.catalogue-table tbody th .catalogue-shortcut:hover {
  text-decoration:underline;
}

.catalogue-view footer {
  margin-top:30px;
}

.training-modes {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));
  gap:20px;
}

.print-modes {
  grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr));
}

/* Une seule action par carte : le bouton occupe toute la largeur de la carte. */
.print-modes .catalogue-actions {
  grid-template-columns:1fr;
  min-width:0;
}

.print-modes .catalogue-actions > .mode-action {
  width:100%;
  box-sizing:border-box;
  text-align:center;
}

.mode-card {
  display:flex;
  flex-direction:column;
  min-width:0;
  padding:26px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--white);
}

.mode-card h2 {
  margin-bottom:16px;
  font-size:26px;
}

.mode-card p {
  color:var(--muted);
  font-size:14px;
}

/* Carte d'accueil du Coin du prof : texte à la taille courante. */

.mode-card strong {
  color:var(--ink);
}

.mode-action {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  margin-top:auto;
  padding:12px 16px;
  border-radius:8px;
  background:var(--accent);
  color:var(--white);
  text-align:center;
  text-decoration:none;
  font-size:14px;
  font-weight:600;
  touch-action:manipulation;
}

.home-view .mode-action {
  align-self:flex-start;
  max-width:100%;
}

.mode-action:hover {
  background:var(--accent-hover);
}

.latex-action {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  box-sizing:border-box;
  padding:11px 14px;
  border:1px solid var(--accent);
  border-radius:8px;
  background:var(--accent);
  color:#fff;
  font-size:13px;
  font-weight:600;
  text-align:center;
  text-decoration:none;
}

.latex-action:hover {
  border-color:var(--accent-hover);
  background:var(--accent-hover);
  color:#fff;
}

.home-guide {
  max-width:760px;
  margin:32px 0;
}

.home-guide h2 {
  margin-bottom:16px;
}

.home-guide p {
  color:var(--muted);
  font-size:14px;
}

.setup-view main,.setup-view .masthead {
  max-width:892px;
}

/* Onglets centrés et collés sous l'en-tête sur toutes les pages à barre
   d'onglets : vue d'un sujet, « Choisir un sujet de bac », kit du prof et
   création de série. */
.catalogue-view .view-switch,
.page-navigation {
  justify-content:center;
}

.setup-view .view-switch a,.page-navigation a {
  display:inline-flex;
  align-items:center;
  min-height:44px;
}

.random-launcher {
  margin:0 0 30px;
  padding:24px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--white);
}

.random-launcher>p {
  margin:10px 0 18px;
  color:var(--muted);
  font-size:13px;
}

.random-launcher fieldset {
  min-width:0;
  margin:0 0 18px;
  padding:0;
  border:0;
}

.random-launcher legend {
  margin-bottom:10px;
  font-size:13px;
}

.level-choices {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.level-choices label {
  display:flex;
  align-items:center;
  gap:10px;
  min-height:48px;
  padding:10px 16px;
  border:1px solid var(--accent-border);
  border-radius:8px;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:14px;
  cursor:pointer;
}

.level-choices input {
  width:20px;
  height:20px;
  min-height:0;
  margin:0;
  padding:0;
  accent-color:var(--accent);
}

/* Filtre de fin de ligne : les automatismes traités en seconde. */
.level-choices .filtre-seconde {
  border-style:dashed;
  background:transparent;
  color:var(--muted);
}
.level-choices .filtre-seconde:has(input:checked) {
  border-style:solid;
  background:var(--accent-soft);
  color:var(--accent);
}

.filtre-aide {
  max-width:min(520px,calc(100vw - 32px));
  padding:24px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--white);
  color:var(--ink);
  box-shadow:0 18px 50px rgb(0 0 0 / 25%);
}
.filtre-aide::backdrop {
  background:rgb(0 0 0 / 35%);
}
.filtre-aide h2 {
  margin:0 0 12px;
  font-size:20px;
}
.filtre-aide p {
  margin:0 0 12px;
}
.filtre-aide form {
  margin:0;
}

.random-launcher .primary {
  min-height:48px;
}

.score-rule {
  margin:12px 0 20px;
  color:var(--muted);
  font-size:12px;
}

.random-launcher .score-rule {
  margin-bottom:0;
}

.random-context {
  color:var(--muted);
  font-size:12px;
}

.random-view .question h2 {
  font-size:26px;
}

.exercise-links button {
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  background:transparent;
  color:var(--muted);
  border-radius:50%;
  font-size:12px;
}

/* Une série peut mélanger les niveaux : la pastille garde la couleur de son exercice. */
.exercise-links button.is-1eds {border:1px solid #285c91;color:#285c91;}
.exercise-links button.is-1t {border:1px solid #17564e;color:#17564e;}
.exercise-links button.is-1g {border:1px solid #a01f31;color:#a01f31;}
.exercise-links button.is-1eds[aria-current="step"] {background:#285c91;color:#fff;}
.exercise-links button.is-1t[aria-current="step"] {background:#17564e;color:#fff;}
.exercise-links button.is-1g[aria-current="step"] {background:#a01f31;color:#fff;}

.exercise-links button:hover {
  background:var(--accent-soft);
}

.exercise-links button[aria-current="step"] {
  background:var(--accent);
  color:var(--white);
}

.random-view .exercise-navigation button {
  min-height:44px;
}

.session-history {
  margin:36px 0;
  scroll-margin-top:20px;
}

.session-history>summary {
  padding:14px 0;
  border-top:1px solid var(--line);
  color:var(--ink);
  font-size:16px;
  font-weight:600;
}

.history-shortcut {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  color:var(--accent);
  font-size:13px;
  text-underline-offset:4px;
}

.session-history>p {
  margin:10px 0 18px;
  color:var(--muted);
  font-size:13px;
}

.history-list {
  display:grid;
  gap:12px;
  padding:0;
  list-style:none;
}

.history-item {
  min-width:0;
  padding:16px 18px;
  border:1px solid var(--accent-border);
  border-left:4px solid var(--accent);
  border-radius:8px;
  background:var(--white);
  color:var(--ink);
}

.history-heading {
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  flex-wrap:wrap;
  gap:8px 16px;
}

.history-heading strong {
  color:var(--accent);
  white-space:nowrap;
  font-size:20px;
}

.history-item p {
  margin:8px 0 0;
  color:var(--muted);
  font-size:12px;
}

.history-actions {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}

.history-resume,.history-delete {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:9px 16px;
  border:1px solid var(--accent-border);
  border-radius:8px;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:13px;
  font-weight:600;
  text-decoration:none;
}

.history-delete {
  border-color:var(--line);
  background:var(--white);
  color:#8b3434;
  font-family:inherit;
  cursor:pointer;
}

.history-delete:hover {
  background:#fff3f0;
}

.history-resume:hover {
  background:var(--accent-soft-hover);
}

/* L'en-tête et les onglets gardent la présentation de la fiche complète. */
.single-view main {
  max-width:892px;
}

.single-view .exercise-picker {
  justify-content:flex-start;
  padding-bottom:12px;
}

.single-view .exercise-links a {
  border:0;
}

.single-view .toolbar {
  border:0;
  padding:0 0 16px;
  align-items:flex-start;
  flex-direction:row;
  gap:12px;
}

.single-view .toolbar-actions {
  width:auto;
}

.input-guide {
  color:var(--muted);
  font-size:12px;
  padding-top:8px;
}

.input-guide .input-help {
  max-width:440px;
  margin:10px 0 0;
}

.single-view .question h1 {
  font:normal 28px/1.25 Georgia,"Times New Roman",serif;
  letter-spacing:-.5px;
}

.single-view .question-heading .number,
.single-view .question-heading .topic,
.single-view .question-heading .state {
  display:none;
}

.single-view .question {
  border-radius:8px;
}

.single-view .exercise-navigation {
  margin-top:18px;
}

.single-view footer {
  margin-top:28px;
  border:0;
}

@media(max-width:850px) {
  .catalogue-view .table-wrap {
    overflow:visible;
  }
  .catalogue-table,.catalogue-table tbody {
    display:block;
  }
  .catalogue-table thead {
    display:none;
  }
  .catalogue-table tr,.catalogue-table td,.catalogue-table th {
    display:block;
  }
  .catalogue-table tr {
    padding:18px;
    margin-bottom:16px;
    background:var(--white);
    border:1px solid var(--accent-border);
    border-left:4px solid var(--accent);
    border-radius:10px;
    color:var(--ink);
  }
  .catalogue-table td,.catalogue-table th {
    padding:4px 0;
    border:0;
  }
  .catalogue-table tbody th {
    padding-left:0;
    border-left:0;
    font-size:16px;
    font-weight:600;
  }
  .catalogue-table td:nth-child(3)::after {
    content:" exercices";
  }
  .catalogue-actions {
    min-width:0;
    margin-top:10px;
  }
  /* Cartes empilées : le libellé peut de nouveau passer à la ligne. */
  .catalogue-action {
    white-space:normal;
  }
  .hero {
    gap:28px;
    grid-template-columns:minmax(0,1fr) 240px;
  }
  .question {
    padding:22px;
  }
  .question-heading {
    gap:9px;
  }
  .state {
    padding:3px 6px;
    font-size:9px;
  }
  h2 {
    font-size:20px;
  }
  .toolbar {
    align-items:flex-start;
  }
  .toolbar-actions {
    gap:10px;
  }
  .finish {
    gap:24px;
    flex-direction:column;
    align-items:flex-start;
  }
}

@media(max-width:760px) {
  .catalogue-actions:has(.catalogue-refs) {
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.catalogue-actions.share-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media(max-width:640px) {
  .training-modes {
    grid-template-columns:1fr;
    gap:16px;
  }
  .mode-card {
    padding:22px 20px;
  }
  .single-view .level {
    display:none;
  }
  .sheet-view .questions {
    grid-template-columns:1fr;
  }
  .exercise-picker {
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }
  .exercise-links {
    gap:6px;
    max-width:100%;
  }
  .exercise-links a {
    width:44px;
    height:44px;
  }
  .verify,.hint-button,.correction-button,.text-button {
    min-height:44px;
  }
  .exercise-navigation {
    flex-wrap:wrap;
    gap:10px;
  }
  .exercise-navigation a {
    display:inline-flex;
    align-items:center;
    min-height:44px;
    font-size:11px;
    padding:10px;
  }
  main,.masthead {
    padding-left:18px;
    padding-right:18px;
  }
  .masthead {
    min-height:76px;
    gap:10px;
  }
  .brand span:last-child {
    font-size:10px;
  }
  .level {
    font-size:10px;
    max-width:106px;
    text-align:right;
  }
  .hero {
    grid-template-columns:1fr;
    gap:26px;
    padding:35px 0 28px;
  }
  h1 {
    font-size:44px;
  }
  .intro {
    font-size:14px;
  }
  .progress-card {
    padding:20px 24px;
    display:grid;
    grid-template-columns:1fr auto;
    column-gap:20px;
  }
  .progress-card .eyebrow {
    grid-column:1;
    margin-bottom:8px;
  }
  .progress-card .score {
    grid-column:2;
    grid-row:1/3;
    font-size:46px;
    margin:0;
  }
  .progress-card>p:not(.score) {
    grid-column:1;
    margin-bottom:12px;
  }
  .progress-card progress {
    grid-column:1/-1;
  }
  .progress-card .support-text {
    grid-column:1/-1;
  }
  .toolbar {
    flex-direction:column;
    gap:12px;
    padding-bottom:16px;
  }
  .toolbar-actions {
    width:100%;
    justify-content:space-between;
  }
  .questions {
    grid-template-columns:1fr;
    gap:16px;
  }
  .question.wide {
    grid-column:auto;
  }
  .question {
    padding:23px 20px;
  }
  .question-heading {
    margin-bottom:19px;
  }
  .question h2 {
    font-size:21px;
  }
  .topic {
    font-size:8px;
  }
  .input-help {
    line-height:1.8;
  }
  .finish {
    padding:24px;
    margin-top:28px;
  }
  .secondary {
    white-space:normal;
  }
  footer {
    flex-direction:column;
    gap:8px;
  }
}

@media(max-width:480px) {
  .catalogue-actions {
    grid-template-columns:1fr;
  }
  .catalogue-actions:has(.catalogue-refs) {
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.catalogue-actions.share-actions { grid-template-columns:1fr; }
  .catalogue-actions.share-actions > .primary,
  .catalogue-actions.share-actions #subject-latex-link { width:100%; }
  .catalogue-actions.share-actions #subject-latex-link { grid-column:auto; }
  .web-link-actions {
    grid-column:auto;
    flex-direction:column;
    align-items:stretch;
    width:100%;
    gap:4px;
  }
  .web-link-actions .primary,.web-link-actions .text-button {
    flex:0 0 auto;
    width:100%;
    justify-content:center;
    padding:8px 10px;
  }
  .random-launcher {
    padding:18px;
  }
  .level-choices {
    flex-direction:column;
  }
  .random-launcher .primary {
    width:100%;
  }
}

@media print {
  body {
    background:white;
    font-size:12px;
  }
  main,.masthead {
    max-width:none;
    padding:0;
  }
  .masthead {
    min-height:50px;
  }
  .hero {
    padding:20px 0;
    grid-template-columns:1fr;
  }
  .progress-card,.toolbar,.input-help,.input-guide,.actions,.finish,footer,.feedback,.hint,.state,.exercise-picker,.exercise-navigation,.correction-button,.view-switch {
    display:none;
  }
  .questions {
    display:block;
  }
  .question {
    break-inside:avoid;
    margin:12px 0;
    padding:14px;
    border-radius:0;
  }
  .question-heading {
    margin-bottom:8px;
  }
  .hero .tags {
    display:none;
  }
  h1 {
    font-size:28px;
  }
  .intro {
    font-size:12px;
    margin:12px 0;
  }
  .graph {
    max-width:380px;
  }
  .answer {
    margin:10px 0;
  }
  .correction {
    margin-top:10px;
  }
  input,select {
    background:white;
  }
}

/* Choix de l’export Éléa. */
.scorm-choices {display:grid;gap:8px;max-height:420px;overflow:auto;margin:14px 0;padding:4px;}
.scorm-choice {position:relative;padding:12px;border:1px solid var(--line);border-radius:8px;}
/* Niveau d’un exercice : bleu en 1EDS, vert en 1T, violet en 1G. */
.level-tag {display:inline-block;margin-right:.45em;padding:0 8px;border-radius:999px;font-size:.72rem;font-weight:700;line-height:1.7;letter-spacing:.02em;color:#fff;background:#285c91;}
.level-tag-1t {background:#17564e;}
.level-tag-1g {background:#a01f31;}
.level-tag-neutral {background:var(--muted);}
.scorm-choice.level-1eds {border-left:4px solid #285c91;}
.scorm-choice.level-1t {border-left:4px solid #17564e;}
.scorm-choice.level-1g {border-left:4px solid #a01f31;}
.scorm-choice>label {display:flex;gap:12px;align-items:flex-start;padding-right:44px;cursor:pointer;}
.scorm-preview-toggle>summary {position:absolute;top:4px;right:4px;display:flex;align-items:center;justify-content:center;width:44px;height:44px;cursor:pointer;list-style:none;border-radius:6px;}
.scorm-preview-toggle>summary::-webkit-details-marker {display:none;}
.scorm-preview-toggle>summary:hover {background:var(--accent-soft);}
.scorm-preview-arrow {font-size:24px;line-height:1;transition:transform .15s;}
.scorm-preview-toggle[open] .scorm-preview-arrow {transform:rotate(180deg);}
.scorm-preview {margin-top:12px;padding-top:12px;border-top:1px solid var(--line);overflow-wrap:anywhere;}
.scorm-preview svg {max-width:100%;height:auto;}
.scorm-choice input {flex:0 0 auto;width:20px;height:20px;margin-top:3px;}
#scorm-export .custom-filters {display:grid;gap:12px;margin:12px 0;}
#scorm-export .custom-filters p {margin:0;}
@media(min-width:720px) {#scorm-export .custom-filters {grid-template-columns:repeat(auto-fit,minmax(min(100%,18rem),1fr));}}
/* Menu déroulant : intitulé court sur le bouton, détail dans la liste ouverte. */
.filter-control {position:relative;display:block;}
#scorm-export select.filter-native {position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.filter-trigger {display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;margin-top:8px;padding:12px;font:inherit;text-align:left;color:var(--ink);background:var(--field-bg);border:1px solid var(--field-border);border-radius:6px;}
.filter-value {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.filter-arrow {flex:0 0 auto;font-size:1.1rem;line-height:1;transition:transform .15s;}
.filter-trigger[aria-expanded="true"] .filter-arrow {transform:rotate(180deg);}
.filter-menu {position:absolute;z-index:20;top:calc(100% + 4px);left:0;right:0;max-height:320px;overflow:auto;margin:0;padding:4px;list-style:none;color:var(--ink);background:var(--white);border:1px solid var(--field-border);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.18);}
.filter-menu > li {padding:10px 12px;border-radius:6px;cursor:pointer;}
.filter-menu > li:hover,.filter-menu > li:focus {background:var(--accent-soft);outline:none;}
.filter-menu > li[aria-selected="true"] {font-weight:700;}
/* Code de capacité : intitulé au survol ou au clavier (clic = focus).
   L'infobulle s'ancre sur la carte, pour ne pas déborder de la fenêtre. */
.capacity-code {cursor:help;font-weight:700;border-bottom:1px dotted currentColor;}
.capacity-code::after {content:attr(data-tip);position:absolute;left:0;right:0;top:calc(100% - 4px);z-index:30;padding:8px 10px;font-size:.85rem;font-weight:400;line-height:1.35;text-align:left;white-space:normal;color:#fff;background:#312c25;border-radius:6px;box-shadow:0 6px 16px rgba(0,0,0,.25);opacity:0;visibility:hidden;transition:opacity .12s;pointer-events:none;}
.capacity-code:hover::after,.capacity-code:focus::after {opacity:1;visibility:visible;}
.scorm-capacity {display:flex;flex-wrap:wrap;gap:0 8px;align-items:center;margin:4px 0 0;padding:6px 10px;border:1px solid var(--accent-border);border-radius:6px;background:var(--accent-soft);}
.scorm-capacity code {font-weight:700;}
.scorm-capacity-label {flex:1 1 auto;min-width:0;}
.scorm-capacity .capacity-count {float:none;margin:0;align-self:center;}
#scorm-export select,#scorm-export input[type="text"] {display:block;width:100%;max-width:100%;padding:12px;font:inherit;margin-top:8px;box-sizing:border-box;}
#scorm-export fieldset {border:0;padding:0;margin:20px 0;}
#scorm-export legend {font-weight:700;margin-bottom:10px;}
#export-summary {padding-left:24px;}
#export-summary .scorm-choice {margin:8px 0;}
.scorm-summary-title {display:block;padding-right:44px;}

.author-credit {display:block;position:relative;font-size:12px;line-height:1.5;text-align:center;color:var(--muted);padding:18px 16px;margin:0;border-top:1px solid var(--line);}
.author-credit::before {content:"";position:absolute;top:-2px;left:50%;transform:translateX(-50%);width:96px;height:3px;border-radius:2px;background:linear-gradient(90deg,#285c91,#a01f31,#17564e);}

/* En ligne, laisser KaTeX partager la ligne de base du texte.
   Le défilement est réservé aux formules isolées : un conteneur inline-block
   avec overflow aligne sa boîte plutôt que la ligne de base de la formule. */
[data-latex] {vertical-align:baseline;}
[data-latex]>.katex {font-size:.95em;}
p.formula,p.math {display:block;max-width:100%;overflow-x:auto;overflow-y:hidden;}
.scorm-preview .katex {font-size:.95em;}

/* Tracé d'une droite à partir de deux points, utilisable aussi au clavier. */
.drawing-grid { display: block; width: min(100%, 440px); margin: 1rem auto; color: var(--ink, #243b35); cursor: crosshair; }
.drawing-grid text { font: 14px sans-serif; }
.drawing-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.drawing-tools button { padding: .6rem .9rem; border: 1px solid var(--field-border); border-radius: .4rem; background: var(--field-bg); color: var(--accent); cursor: pointer; }
.drawing-tools button[aria-pressed="true"] { color:var(--paper); background:var(--accent); }
.drawing-tools button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.drawing-status { font-size: .9rem; }

.teacher-modes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.teacher-intro { margin: 1.6rem 0 1.2rem; }
.share-section { margin: 2.5rem 0; }
/* Trait de couleur du niveau, sur toute la largeur, au-dessus du titre. */
.share-section.level-1eds { --level-line: #285c91; }
.share-section.level-1t { --level-line: #17564e; }
.share-section.level-1g { --level-line: #a01f31; }
.share-section[class*="level-"] h2 { padding:.9rem 0 1.1rem; margin:2.5rem 0 0; border-top:3px solid var(--level-line); }
.share-card { border: 1px solid var(--accent, #718c9c); border-left-width: 4px; border-radius: .5rem; padding: 1.25rem; margin: 1rem 0; }
.share-card h3 { margin: 0 0 .5rem; }
.share-card label { display: block; margin: 1rem 0 .5rem; font-size: .9rem; }
.share-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.share-controls input { flex: 1 1 20rem; min-width: 0; width: 100%; padding: .75rem; font: inherit; background:var(--field-bg); color:var(--ink); border:1px solid var(--field-border); border-radius: .35rem; }
@media (max-width: 650px) { .teacher-modes { grid-template-columns: 1fr; } .share-controls input { flex-basis: 100%; } }

.track-label { font-weight: 600; color: var(--accent); }

/* Apparence : le choix système est résolu par theme.js avant l’affichage. */
:root[data-color-theme="dark"] { color-scheme:dark; }
:root[data-color-theme="dark"],
:root[data-color-theme="dark"] body,
:root[data-color-theme="dark"] .theme-neutral,
:root[data-color-theme="dark"] .theme-1eds,
:root[data-color-theme="dark"] .theme-1t,
:root[data-color-theme="dark"] .theme-1g {
  --paper:#111820; --white:#1a2531; --ink:#e3ebf4; --muted:#afbdcd;
  --accent:#9bc5ee; --accent-hover:#bad9f6; --accent-soft:#23364b;
  --accent-border:#536e8c; --accent-soft-hover:#30465e;
  --line:#35485b; --field-bg:#14212e; --field-border:#59718c;
  --code-bg:#25384c; --focus:#b9d9f7; --progress-fill:#88b9e8;
  --success:#193d2e; --error:#442c24; --orange:#e9b38a;
  --on-accent-muted:#25394d; --on-accent-soft:#25394d;
}
:root[data-color-theme="dark"] .theme-1t { --accent:#92d7c8; --accent-hover:#b1e6da; --accent-soft:#1e3834; --accent-border:#527d74; --accent-soft-hover:#294b45; }
:root[data-color-theme="dark"] .theme-neutral { --accent:#e4c29a; --accent-hover:#f0d6b5; --accent-soft:#3b3027; --accent-border:#806c54; --accent-soft-hover:#4d3e31; }
:root[data-color-theme="dark"] .theme-1g { --accent:#ec9aa5; --accent-hover:#f5b6bf; --accent-soft:#3d1f24; --accent-border:#8d4a52; --accent-soft-hover:#4e272d; }
:root[data-color-theme="dark"] .progress-card,
:root[data-color-theme="dark"] .primary,
:root[data-color-theme="dark"] .verify,
:root[data-color-theme="dark"] .mode-action,
:root[data-color-theme="dark"] .catalogue-action:first-child,
:root[data-color-theme="dark"] .exercise-links a[aria-current="page"],
:root[data-color-theme="dark"] .question[data-status="correct"] .number { color:#111820; }
:root[data-color-theme="dark"] .hint { background:#3b3323; color:#f2d69b; }
:root[data-color-theme="dark"] .question[data-status="correct"] .state,
:root[data-color-theme="dark"] .question[data-status="correct"] .feedback { color:#a5e0bb; }
:root[data-color-theme="dark"] .question[data-status="incorrect"] .state,
:root[data-color-theme="dark"] .feedback:not(:empty) { color:#f2ba9f; }
/* Les contrôles et les états doivent suivre la même palette que leur page. */
:root[data-color-theme="dark"] .question[data-correction-penalized="true"] .feedback,
:root[data-color-theme="dark"] .question[data-correction-penalized="true"] .state {
  background:var(--error); color:#f2ba9f;
}
:root[data-color-theme="dark"] .history-delete { color:#f2ba9f; }
:root[data-color-theme="dark"] .history-delete:hover { background:var(--error); }
:root[data-color-theme="dark"] .exercise-links button.is-1eds { --step-accent:#9bc5ee; }
:root[data-color-theme="dark"] .exercise-links button.is-1t { --step-accent:#92d7c8; }
:root[data-color-theme="dark"] .exercise-links button.is-1g { --step-accent:#ec9aa5; }
:root[data-color-theme="dark"] .exercise-links button[class*="is-1"] {
  border-color:var(--step-accent); color:var(--step-accent);
}
:root[data-color-theme="dark"] .exercise-links button[class*="is-1"][aria-current="step"] {
  background:var(--step-accent); color:#111820;
}
/* Les figures conservent un fond clair pour leurs graduations et couleurs fixes. */
:root[data-color-theme="dark"] .graph,
:root[data-color-theme="dark"] .drawing-grid { background:#fbfcff; color:#25394d; }
.theme-switcher { position:fixed; top:14px; right:24px; z-index:1000; }
.theme-toggle { display:grid; place-items:center; width:42px; height:42px; border:1px solid var(--field-border); border-radius:50%; color:var(--ink); background:var(--white); box-shadow:0 2px 10px #0002; }
/* Bouton d’apparence fixé en haut à droite : réserver sa place dans l’en-tête. */
.masthead { padding-right:78px; }
.masthead > * { min-width:0; }
@media print { .theme-switcher { display:none!important; } }

.symbol-buttons { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 12px; }
.symbol-buttons button { min-width:48px; min-height:44px; padding:8px 14px; background:var(--accent-soft); color:var(--ink); border:1px solid var(--accent-border); font-size:18px; }
.symbol-buttons button:hover { background:var(--accent-soft-hover); }

.author-credit .credit-line { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:.25rem .55rem; margin:0 auto; max-width:60rem; }
.author-credit .credit-sep { color:var(--line); }
.author-credit .credit-line a { color:inherit; text-decoration:none; }
.author-credit .credit-line a:hover, .author-credit .credit-line a:focus-visible { text-decoration:underline; }


/* QCM de graphiques et comparaisons de fractions. */
.graph-choices {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin:20px 0;
}
.graph-choice {
  min-width:0;
  margin:0;
}
.graph-choice figcaption {
  font-weight:600;
  margin-bottom:8px;
}
.graph-choice .graph {
  margin:0;
}
.comparison-answer {
  justify-content:flex-start;
  gap:18px;
}
.comparison-answer select {
  width:90px;
  min-width:70px;
  text-align:center;
}
.comparison-answer.big-symbols select {
  width:110px;
  min-width:78px;
  font-size:18px;
  line-height:1.2;
}
@media(max-width:600px) {
  .graph-choices {
    grid-template-columns:minmax(0,1fr);
  }
}
/* Capacités du programme : accordéons capacité → exercices → énoncé */
.capacity {
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--white);
  margin:6px 0;
  padding:0;
}
.capacity > summary {
  cursor:pointer;
  padding:8px 10px;
}
.capacity-row {
  display:inline;
}
.capacity > summary code {
  font-weight:700;
}
.capacity-label {
  margin-left:.35em;
}
.capacity-count {
  float:right;
  margin:0 0 .2em .8em;
  white-space:nowrap;
  color:var(--muted);
  font-size:.78em;
  line-height:1.5;
  background:var(--code-bg);
  border:1px solid var(--line);
  border-radius:999px;
  padding:0 9px;
}
.capacity-empty {
  color:var(--muted);
  font-style:italic;
}
.pick {
  margin-right:.5em;
}
.pick input {
  min-height:0;
  width:1.05em;
  height:1.05em;
  margin:0;
  padding:0;
  vertical-align:-.15em;
  accent-color:var(--accent,#285c91);
}
.selection-bar {
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--accent-soft);
  padding:8px 12px;
  margin:0 0 12px 0;
}
.selection-bar p {
  margin:.2em 0;
}
.selection-bar.is-ready {
  border-color:#17564e;
  background:var(--success);
}
:root[data-color-theme="dark"] .selection-bar.is-ready {
  border-color:#92d7c8;
}
.selection-bar .text-button {
  margin-left:.6em;
}
.capacity-exercises {
  list-style:none;
  margin:0;
  padding:0 12px 10px 12px;
}
.capacity-exercises > li {
  border-top:1px solid var(--line);
  padding:4px 0;
}
.exercise > summary {
  cursor:pointer;
}
.exercise-preview {
  margin:.4em 0 .4em 1em;
  padding-left:.8em;
  border-left:3px solid var(--accent,#285c91);
}
.exercise-preview .question-heading {
  display:none;
}
.exercise-preview p {
  margin:.4em 0;
}
.preview-field {
  display:inline-block;
  min-width:4em;
  border-bottom:1px solid var(--muted);
  color:var(--muted);
  text-align:center;
}
.exercise-link {
  margin:.3em 0 0 1em;
}
:root[data-color-theme="dark"] .latex-action {
  border-color:var(--accent-border);
  background:var(--accent-soft);
  color:var(--ink);
}
:root[data-color-theme="dark"] .latex-action:hover {
  border-color:var(--accent-hover);
  background:var(--accent-hover);
  color:#111820;
}

/* Une impression conserve un fond blanc, même si l’écran est en mode sombre. */
@media print {
  :root[data-color-theme] { color-scheme:light; }
  :root[data-color-theme] body,
  :root[data-color-theme] .theme-neutral,
  :root[data-color-theme] .theme-1eds,
  :root[data-color-theme] .theme-1t,
  :root[data-color-theme] .theme-1g {
    --paper:#fff; --white:#fff; --ink:#111; --muted:#444;
    --accent:#243b35; --accent-soft:#f3f3f3; --line:#aaa;
    --field-bg:#fff; --field-border:#777; --code-bg:#eee;
  }
  .install-help { display:none; }
  html:has(.install-help[open]) { overflow:visible; }
}

/* Fiches PDF déjà compilées : fenêtre ouverte depuis Personnaliser un parcours. */
.fiches-lien { display:inline; margin:0; padding:0; border:0; background:none; font:inherit; font-size:1rem; font-weight:400; color:inherit; text-decoration:underline; cursor:pointer; }
.fiches-lien:hover { text-decoration:none; }
.fiches-dialog { max-width:38rem; border:1px solid #d6cbb8; border-radius:12px; padding:1rem 1.2rem; background:#fffdf8; color:#312c25; }
.fiches-dialog::backdrop { background:rgba(20,16,10,.45); }
.fiches-dialog h2 { font-size:1.1rem; margin:.1rem 0 .5rem; }
.fiches-dialog > p { margin:.2rem 0 .6rem; }
.fiches-dialog ul { margin:.3rem 0 .8rem 1.1rem; padding:0; }
.fiches-dialog li { margin:.25rem 0; }
.fiches-dialog .dialog-actions { display:flex; justify-content:flex-end; margin:.4rem 0 0; }
:root[data-color-theme="dark"] .fiches-dialog { background:#211d18; border-color:#4a4137; color:#efe9df; }

/* Rappel au prof arrivé par l’onglet « Sujets de bac » : l’adresse de la page
   n’est pas le lien à transmettre aux élèves (voir avertissement-lien.js). */
.avertissement-lien { max-width:36rem; border:1px solid var(--accent-border); border-left:6px solid var(--accent); border-radius:12px; padding:1rem 1.2rem 1.1rem; background:#fffdf8; color:#312c25; }
.avertissement-lien::backdrop { background:rgba(20,16,10,.5); }
.avertissement-lien-etiquette { margin:0 0 .2rem; font-size:.72rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--accent); }
.avertissement-lien h2 { margin:.1rem 0 .6rem; font-size:1.15rem; line-height:1.3; }
.avertissement-lien p { margin:.35rem 0; }
.avertissement-lien-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:.6rem; margin-top:.9rem; }
.avertissement-lien-actions form { margin:0; }
:root[data-color-theme="dark"] .avertissement-lien { background:#211d18; border-color:#4a4137; color:#efe9df; }
:root[data-color-theme="dark"] .avertissement-lien-etiquette { color:#9dc3ea; }

/* Graphique agrandi (bouton posé sous les schémas marqués data-zoom). */
.graph-zoom { display:inline-flex; align-items:center; gap:8px; margin:4px 0 12px; padding:8px 14px; border:1px solid var(--line); border-radius:8px; background:var(--field-bg); color:var(--ink); font:inherit; font-size:14px; font-weight:600; cursor:pointer; }
.graph-zoom::before { content:"⌕"; font-size:18px; line-height:1; }
.graph-zoom:hover { border-color:var(--accent); color:var(--accent); }
.graph-dialog { width:min(96vw, 1100px); max-width:min(96vw, 1100px); border:1px solid var(--line); border-radius:12px; padding:14px 16px; background:var(--paper); color:var(--ink); }
.graph-dialog::backdrop { background:rgba(20,16,10,.55); }
.graph-dialog-body svg { display:block; width:100%; height:auto; }
.graph-dialog form { display:flex; justify-content:flex-end; margin:10px 0 0; }

/* Tableau de signes à compléter : un bouton unique « ? » → « + » → « − ». */
.sign-zeros { margin:0 0 14px; }
.sign-toggle { min-width:46px; min-height:40px; padding:4px 10px; border:1px solid var(--field-border); border-radius:8px; background:var(--field-bg); color:var(--ink); font:inherit; font-size:17px; font-weight:700; cursor:pointer; }
.sign-toggle:hover { border-color:var(--accent); color:var(--accent); }
.sign-table .sign-toggle { display:block; margin:2px auto; }

/* --- Exercice d’association (relier deux colonnes) --- */
.relation { margin:10px 0 12px; }
.relation-help, .ordering-help { font-size:14px; color:var(--muted); margin:0 0 8px; }
.relation-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; align-items:start; }
.relation-heading { font-size:13px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin:0 0 6px; }
.relation-items { display:flex; flex-direction:column; gap:8px; }
.relation-item { position:relative; display:flex; align-items:center; justify-content:flex-start; gap:6px; min-height:44px; padding:8px 30px 8px 12px; text-align:left; background:var(--accent-soft); color:var(--ink); border:1px solid var(--accent-border); border-radius:6px; font-size:13px; cursor:pointer; overflow-wrap:anywhere; }
.relation-item:hover { background:var(--accent-soft-hover); }
.relation-item.is-paired { border-color:var(--accent); border-width:2px; }
.relation-item[data-side="right"][style] { border-left:7px solid var(--relation-color); }
.relation-item.is-colored { border-color:var(--relation-color); box-shadow:inset 6px 0 0 var(--relation-color); }
.relation-item[data-side="right"][style].is-paired { border-color:var(--relation-color); }
.relation-item.is-colored .relation-badge { background:var(--relation-color); }
.relation-item[data-side="right"][style] .relation-badge { background:var(--relation-color); }
.relation-item.is-selected { outline:3px solid var(--focus); outline-offset:1px; }
.relation-item .relation-badge { position:absolute; top:6px; right:6px; min-width:20px; height:20px; padding:0 4px; border-radius:10px; background:var(--accent); color:var(--white); font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.relation-status, .ordering-status { font-size:14px; color:var(--muted); margin:8px 0 0; min-height:20px; }

/* --- Exercice de rangement (glisser-déposer) --- */
.ordering { margin:10px 0 12px; }
.ordering-list { list-style:none; display:flex; flex-wrap:wrap; gap:8px; padding:0; margin:0; }
.ordering-token { display:flex; align-items:center; gap:6px; padding:6px 8px 6px 14px; background:var(--accent-soft); border:1px solid var(--accent-border); border-radius:6px; font-size:16px; cursor:grab; }
.ordering-token.is-dragging { opacity:.5; }
.ordering-token.is-target { border-color:var(--focus); border-style:dashed; }
.ordering-moves { display:flex; flex-direction:column; gap:2px; }
.ordering-move { min-width:28px; min-height:20px; padding:0 4px; line-height:1; font-size:12px; background:var(--field-bg); color:var(--ink); border:1px solid var(--field-border); border-radius:4px; cursor:pointer; }
.ordering-move:hover { background:var(--accent-soft-hover); }

/* Bandeau des associations déjà choisies, au-dessus des deux colonnes */
.relation-summary { margin:0 0 10px; }
.relation-summary-title { font-size:13px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin:0 0 6px; }
.relation-summary-empty { font-size:14px; color:var(--muted); margin:0; }
.relation-summary-list { list-style:none; display:flex; gap:6px; padding:0; margin:0; }
.relation-summary-list li { flex:1 1 0; min-width:0; }
.relation-pair { display:inline-flex; width:100%; justify-content:center; align-items:center; gap:6px; padding:5px 8px; background:var(--field-bg); color:var(--ink); border:2px solid var(--relation-color, var(--accent-border)); border-left-width:6px; border-radius:6px; font-size:13px; cursor:pointer; }
.relation-pair:hover { background:var(--accent-soft-hover); }
.relation-pair-number { min-width:18px; height:18px; padding:0 3px; border-radius:9px; background:var(--relation-color, var(--accent)); color:var(--white); font-size:11px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.relation-pair-arrow { color:var(--muted); }
.relation-pair-left, .relation-pair-right { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Page « Références au programme » (professeurs) */
.references-page .fiche-block { margin:0 0 1.8rem; border-left:4px solid var(--accent); padding-left:.8rem; }
.references-page .fiche-block.commun { border-left:0; padding-left:0; }
.references-page .fiche-block.commun h2 { color:var(--ink); }
.references-page .fiche-block h2 { font-size:1.05rem; margin:0 0 .15rem; color:var(--accent); }
.references-page .fiche-block a { color:var(--accent); }
.references-page .cap-code { font-weight:700; color:var(--accent); margin-right:.35rem; }
.references-page .sujet-id { font-family:ui-monospace,monospace; font-size:.78rem; font-weight:400; color:var(--muted); margin-left:.45rem; }
.references-page .fiche-links { margin:0 0 .45rem; font-size:.86rem; color:var(--muted); }
.references-page .fiche-links .text-button { margin-left:.6rem; }
.references-page .sommaire { display:flex; flex-wrap:wrap; gap:.35rem .9rem; font-size:.86rem; margin:0 0 1.2rem; }
.references-page .sommaire-sujets { margin:0 0 1.4rem; }
.references-page .sommaire-sujets>summary { cursor:pointer; margin-bottom:.5rem; color:var(--accent); font-size:.95rem; font-weight:600; }
.references-page .sommaire-groupe { margin:.2rem 0 .5rem 1.1rem; }
.references-page .sommaire-groupe>summary { cursor:pointer; color:var(--ink); font-size:.9rem; font-weight:600; }
.references-page .sommaire-groupe .sommaire { margin:.4rem 0 .2rem; }
.references-page .sommaire-compte { padding:0 .4rem; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:.76rem; font-weight:600; }
.references-page .sujets-groupe { margin:0 0 1.1rem; }
.references-page .sujets-groupe>summary { cursor:pointer; margin:0 0 .7rem; color:var(--accent); font-size:1rem; font-weight:600; }
.references-page .sujets-groupe>summary:hover { text-decoration:underline; }
.references-page .sujets-groupe[open] { margin-bottom:1.6rem; }
.references-page .refs-table { width:100%; border-collapse:collapse; font-size:.88rem; line-height:1.3; }
.references-page .refs-table th, .references-page .refs-table td { padding:.15rem .4rem; text-align:left; vertical-align:top; }
.references-page .refs-table thead th { padding:.2rem .4rem; border-bottom:1px solid var(--accent-border); color:var(--accent); }
.references-page .refs-table tbody tr { border-bottom:1px solid var(--line, #e3ded2); }
.references-page .refs-table th[scope="row"] { white-space:nowrap; width:3.4rem; }
.references-page .refs-table td.niv { width:3.2rem; text-align:center; white-space:nowrap; }
.references-page .capacites-table { font-size:.86rem; }
.references-page .capacites-table th, .references-page .capacites-table td { padding:.08rem .4rem; line-height:1.2; }
.references-page tr.travaillee th, .references-page tr.travaillee td { color:var(--accent); font-weight:700; }
.references-page .hint { border-left-color:var(--accent-border); background:var(--accent-soft); color:var(--ink); font-size:.82rem; padding:.4rem .6rem; margin:.2rem 0 .6rem; }
.references-page .niveaux-list { list-style:none; padding:0; margin:0 0 .8rem; display:flex; flex-wrap:wrap; gap:.35rem 1.5rem; font-size:.88rem; }
.references-page .niveaux-list li strong { color:var(--accent); }
