/* ================================================
   SITE SPÉ MATHS TERMINALE — Feuille de style v2
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Fira+Code:wght@400;500&display=swap');

/* ────────────────────────────────────────────────
   Variables
──────────────────────────────────────────────── */
:root {
  --primary:        #1565C0;
  --primary-dark:   #0D47A1;
  --primary-light:  #E3F2FD;
  --accent:         #FF6F00;
  --accent-light:   #FFF3E0;

  /* Boîtes de contenu */
  --def-bg:  #E8F5E9; --def-bd:  #2E7D32; --def-tx:  #1B5E20;
  --prop-bg: #E3F2FD; --prop-bd: #1565C0; --prop-tx: #0D47A1;
  --meth-bg: #FFF8E1; --meth-bd: #F9A825; --meth-tx: #5D4037;
  --ex-bg:   #FFF3E0; --ex-bd:   #E65100; --ex-tx:   #BF360C;
  --exo-bg:  #F3E5F5; --exo-bd:  #6A1B9A; --exo-tx:  #4A148C;
  --cor-bg:  #E0F2F1; --cor-bd:  #00695C; --cor-tx:  #004D40;
  --warn-bg: #FFEBEE; --warn-bd: #B71C1C; --warn-tx: #B71C1C;
  --tip-bg:  #FFFDE7; --tip-bd:  #F57F17; --tip-tx:  #5D4037;

  /* Base */
  --text:      #1a1a2e;
  --text-sec:  #64748b;
  --bg:        #F0F4FB;
  --card-bg:   #FFFFFF;
  --border:    #DDE4F0;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 2px 16px rgba(21,101,192,.10);
  --shadow-lg: 0 8px 32px rgba(21,101,192,.18);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ────── Dark mode ────── */
[data-theme="dark"] {
  --primary:       #5B8DF6;
  --primary-dark:  #3B6FE0;
  --primary-light: #1a2744;
  --accent:        #FFB74D;
  --def-bg:  #1a2a1a; --def-bd:  #4CAF50;
  --prop-bg: #162035; --prop-bd: #5B8DF6;
  --meth-bg: #2a2415; --meth-bd: #FFC107;
  --ex-bg:   #2a1b10; --ex-bd:   #FF7043;
  --exo-bg:  #20152a; --exo-bd:  #AB47BC;
  --cor-bg:  #102020; --cor-bd:  #26A69A;
  --warn-bg: #2a1010; --warn-bd: #EF5350;
  --tip-bg:  #2a2510; --tip-bd:  #FFD54F;
  --text:      #E2E8F0;
  --text-sec:  #94A3B8;
  --bg:        #0F172A;
  --card-bg:   #1E293B;
  --border:    #334155;
  --shadow:    0 2px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
}

/* ────────────────────────────────────────────────
   Reset & Base
──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  transition: background .3s var(--ease), color .3s var(--ease);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Sélection de texte ── */
::selection { background: var(--primary); color: #fff; }

/* ────────────────────────────────────────────────
   Barre de progression de lecture
──────────────────────────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #42A5F5, #7C4DFF, #FF6D00);
  z-index: 9999;
  transition: width .1s linear;
}

/* ────────────────────────────────────────────────
   Typography
──────────────────────────────────────────────── */
h1, h2, h3, h4, h5 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.2rem; }
h2 {
  font-size: 1.6rem; margin: 2.5rem 0 1rem;
  color: var(--primary-dark);
  padding-bottom: .5rem;
  border-bottom: 3px solid var(--primary-light);
  display: flex; align-items: center; gap: .5rem;
}
[data-theme="dark"] h2 { color: var(--primary); }
h3 { font-size: 1.2rem; margin: 1.8rem 0 .6rem; color: var(--primary); }
h4 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; color: var(--text); }
p  { margin-bottom: .9rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: .9rem; }
li { margin-bottom: .3rem; }

code:not(.py) {
  font-family: 'Fira Code', monospace;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: .1em .4em; border-radius: 4px; font-size: .88em;
}
[data-theme="dark"] code:not(.py) {
  background: #1E3A5F;
  color: #90CAF9;
}

/* ────────────────────────────────────────────────
   Navbar
──────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(13, 71, 161, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  height: 58px;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.navbar .logo {
  font-size: 1.15rem; font-weight: 900;
  letter-spacing: -.5px; white-space: nowrap;
  display: flex; align-items: center; gap: .4rem;
}
.navbar .logo span { color: #FFD54F; }
.navbar .logo a { color: inherit; display: flex; align-items: center; gap: .4rem; }

.nav-links {
  display: flex; gap: .25rem;
  flex-wrap: wrap; flex: 1;
  justify-content: flex-end;
}
.nav-links a {
  color: rgba(255,255,255,.75);
  font-size: .78rem; font-weight: 500;
  padding: .3rem .55rem;
  border-radius: 6px;
  transition: background .2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
}
.nav-links a.active {
  background: rgba(255,255,255,.22);
  font-weight: 600;
}

/* ── Boutons navbar droite ── */
.navbar-actions {
  display: flex; align-items: center; gap: .5rem; margin-left: .5rem;
}

/* Bouton dark mode */
#dark-toggle {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease);
  flex-shrink: 0;
}
#dark-toggle:hover { background: rgba(255,255,255,.28); }

/* ── Hamburger (mobile) ── */
#nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none;
  cursor: pointer; padding: .4rem; margin-left: auto;
}
#nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
#nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#nav-toggle.open span:nth-child(2) { opacity: 0; }
#nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ────────────────────────────────────────────────
   Page Layout
──────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* ── Fade-in au scroll ── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ────────────────────────────────────────────────
   Chapter Header
──────────────────────────────────────────────── */
.chapter-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1976D2 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 2.8rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

/* Cercles décoratifs */
.chapter-header::before,
.chapter-header::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
.chapter-header::before {
  width: 300px; height: 300px;
  right: -80px; top: -100px;
}
.chapter-header::after {
  width: 180px; height: 180px;
  right: 100px; bottom: -80px;
}

.chapter-header .num {
  font-size: .8rem; text-transform: uppercase;
  letter-spacing: 2.5px; opacity: .75;
  font-weight: 600; margin-bottom: .4rem;
}
.chapter-header h1 {
  font-size: 2.4rem; margin: 0 0 .6rem;
  font-weight: 900; letter-spacing: -.5px;
  position: relative;
}
.chapter-header .tagline {
  font-size: 1rem; opacity: .85;
  max-width: 600px; line-height: 1.6;
  position: relative;
}

/* ────────────────────────────────────────────────
   TOC (Sommaire)
──────────────────────────────────────────────── */
.toc {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.2rem 1.6rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  transition: background .3s, border-color .3s;
}
.toc h3 {
  color: var(--primary);
  margin-top: 0; margin-bottom: .7rem;
  font-size: .95rem; text-transform: uppercase;
  letter-spacing: 1px;
}
.toc ol { margin: 0; counter-reset: toc-item; }
.toc > ol > li {
  counter-increment: toc-item;
  margin-bottom: .25rem; font-size: .9rem;
  font-weight: 600;
}
.toc a { color: var(--primary); font-weight: 500; }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* ────────────────────────────────────────────────
   Boîtes de contenu
──────────────────────────────────────────────── */
.definition, .propriete, .methode, .exemple,
.exercice, .corrige, .attention, .astuce, .synthese-box {
  border-left: 5px solid;
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem 1.1rem 1.4rem;
  margin: 1.3rem 0;
  position: relative;
  transition: background .3s, border-color .3s;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

/* Labels des boîtes */
.definition::before, .propriete::before, .methode::before,
.exemple::before, .exercice::before, .corrige::before,
.attention::before, .astuce::before {
  display: block;
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.8px;
  margin-bottom: .55rem;
  font-family: 'Inter', sans-serif;
}

.definition  { background: var(--def-bg);  border-color: var(--def-bd);  color: var(--text); }
.definition::before  { content: "📘 Définition";  color: var(--def-bd);  }

.propriete   { background: var(--prop-bg); border-color: var(--prop-bd); color: var(--text); }
.propriete::before   { content: "📐 Propriété";  color: var(--prop-bd); }

.methode     { background: var(--meth-bg); border-color: var(--meth-bd); color: var(--text); }
.methode::before     { content: "🔧 Méthode";    color: var(--meth-bd); }

.exemple     { background: var(--ex-bg);   border-color: var(--ex-bd);   color: var(--text); }
.exemple::before     { content: "✏️ Exemple";    color: var(--ex-bd);   }

.exercice    { background: var(--exo-bg);  border-color: var(--exo-bd);  color: var(--text); }
.exercice::before    { content: "🎯 Exercice";   color: var(--exo-bd);  }

.corrige     { background: var(--cor-bg);  border-color: var(--cor-bd);  color: var(--text); }
.corrige::before     { content: "✅ Corrigé";    color: var(--cor-bd);  }

.attention   { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--text); }
.attention::before   { content: "⚠️ À retenir";  color: var(--warn-bd); }

.astuce      { background: var(--tip-bg);  border-color: var(--tip-bd);  color: var(--text); }
.astuce::before      { content: "💡 Astuce";     color: var(--tip-bd);  }

/* Titre optionnel dans une boîte */
.definition b.titre, .propriete b.titre, .exemple b.titre,
.exercice b.titre, .corrige b.titre {
  display: block; font-size: 1rem; margin-bottom: .4rem;
}

/* ── Difficulté des exercices ── */
.diff {
  display: inline-block; font-size: .72rem;
  font-weight: 700; padding: .18rem .6rem;
  border-radius: 20px; margin-bottom: .5rem;
  letter-spacing: .5px;
}
.diff-1 { background: #C8E6C9; color: #1B5E20; }
.diff-2 { background: #FFF9C4; color: #E65100; }
.diff-3 { background: #FFCDD2; color: #B71C1C; }

/* ── Suivi de maîtrise des exercices d'application ── */
.application-assessment-panel {
  background: color-mix(in srgb, var(--primary) 8%, white);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}

.application-assessment-panel h3 {
  margin: 0 0 .35rem;
  font-size: 1.05rem;
}

.application-assessment-panel p {
  margin: 0 0 .8rem;
}

.assessment-legend,
.exercise-assessment {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.assessment-pill,
.assessment-option span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: .34rem .75rem;
  font-size: .78rem;
  font-weight: 750;
}

.exercise-assessment {
  border: 0;
  margin: .75rem 0 .85rem;
  padding: 0;
}

.exercise-assessment legend {
  width: 100%;
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.assessment-option {
  cursor: pointer;
}

.assessment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.assessment-pill.acquired,
.assessment-option.acquired span {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #86EFAC;
}

.assessment-pill.progress,
.assessment-option.progress span {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}

.assessment-pill.missing,
.assessment-option.missing span {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

.assessment-option input:checked + span {
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
  transform: translateY(-1px);
}

.assessment-option input:focus-visible + span {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.application-correction {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
  overflow: hidden;
  border: 1.5px solid rgba(108, 99, 255, .45);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(79, 70, 229, .14);
}

.application-correction:focus-within {
  border-color: #6C63FF;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .12), 0 18px 42px rgba(79, 70, 229, .18);
}

.application-open-editor {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 850;
  padding: .68rem 1rem;
  margin-bottom: .85rem;
}

.application-open-editor:hover {
  background: var(--primary-dark);
}

.application-editor-panel[hidden] {
  display: none;
}

.application-exercise-layout {
  display: grid;
  gap: 1.1rem;
  align-items: start;
}

.application-exercise-statement {
  min-width: 0;
}

.application-variant-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  margin: .75rem 0 1rem;
  padding: .65rem .75rem;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 6%, white);
}

.application-variant-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.application-next-variant {
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 850;
  padding: .52rem .85rem;
}

.application-next-variant:hover {
  background: var(--primary-dark);
}

.application-variant-body {
  min-width: 0;
}

.application-skill-tags {
  display: grid;
  gap: .35rem;
  margin-bottom: .85rem;
  border: 1px solid #D7DDF2;
  border-left: 4px solid #6C63FF;
  border-radius: 10px;
  background: #F8FAFF;
  padding: .75rem .85rem;
}

.application-skill-tags p {
  margin: 0;
  color: #334155;
}

.application-skill-tags strong {
  color: #3730A3;
}

.application-model-correction {
  margin-top: 1rem;
  border: 1px solid #D7DDF2;
  border-radius: 12px;
  background: #F8FAFF;
  overflow: hidden;
}

.application-model-correction summary {
  cursor: pointer;
  color: #3730A3;
  font-weight: 850;
  padding: .75rem .9rem;
}

.application-model-correction[open] summary {
  border-bottom: 1px solid #E1E7F7;
  background: #EEF2FF;
}

.application-model-body {
  display: grid;
  gap: .7rem;
  padding: .85rem .95rem 1rem;
}

.application-model-level {
  width: fit-content;
  border: 1px solid #A7F3D0;
  border-radius: 999px;
  background: #ECFDF5;
  color: #065F46;
  font-size: .78rem;
  font-weight: 850;
  padding: .35rem .65rem;
}

.application-model-body p {
  margin: 0;
}

.application-model-body pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid #D7DDF2;
  border-radius: 10px;
  background: #111827;
  color: #F8FAFC;
  padding: .8rem;
}

.application-model-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86rem;
}

.application-exercise-sidebar {
  min-width: 0;
}

.application-exercise-sidebar .exercise-assessment {
  margin-top: 0;
}

.application-editor-toolbar {
  border-top: 1px solid #E9EAF0;
  background: #F8F9FF;
}

.application-toolbar-quick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .34rem;
  padding: .5rem .75rem;
}

.application-key {
  min-width: 44px;
  height: 34px;
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #F0F1FA 100%);
  box-shadow: 0 2px 0 #B8BDE8, 0 1px 3px rgba(0, 0, 0, .06);
  color: #3730A3;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .82rem;
  font-weight: 800;
  padding: 0 .55rem;
}

.application-key:hover,
.application-symbol-tab:hover {
  border-color: #7C3AED;
  transform: translateY(-1px);
}

.application-formula-open,
.application-symbol-more {
  min-width: 78px;
  color: #4338CA;
}

.application-symbol-panel {
  display: grid;
  gap: .55rem;
  border-top: 1px solid #E1E7F7;
  background: #FFFFFF;
  padding: .65rem .75rem .75rem;
}

.application-symbol-panel[hidden] {
  display: none;
}

.application-symbol-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.application-symbol-tab {
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .78rem;
  font-weight: 850;
  padding: .38rem .7rem;
}

.application-symbol-tab.active {
  border-color: #6C63FF;
  background: #EEF2FF;
  color: #4338CA;
}

.application-symbol-grid {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(64px, max-content));
  gap: .38rem;
}

.application-symbol-grid.active {
  display: grid;
}

.application-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-top: 1px solid #E9EAF0;
  background: #F8F9FF;
  padding: .6rem .9rem;
}

.application-bottom-left,
.application-bottom-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.application-answer {
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  outline: none;
  color: var(--text);
  font-family: Inter, sans-serif;
  font-size: 1rem;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.application-answer:empty::before {
  content: attr(data-placeholder);
  color: #98A2B8;
  pointer-events: none;
}

.application-math-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 .12rem;
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  background: #F8FAFC;
  color: #111827;
  padding: .05rem .35rem;
  vertical-align: middle;
}

.application-math-chip math-field {
  pointer-events: none;
  min-width: 32px;
  border: 0;
  background: transparent;
  font-size: 1rem;
}

.application-inline-formula {
  display: inline-grid;
  align-items: center;
  justify-items: center;
  gap: .16rem;
  margin: 0 .16rem;
  border: 1px solid #C7D2FE;
  border-radius: 10px;
  background: #F8FAFF;
  color: #111827;
  padding: .25rem .32rem;
  vertical-align: middle;
}

.application-inline-formula input {
  width: 68px;
  min-height: 28px;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  background: #fff;
  color: #111827;
  font: 800 .86rem Inter, sans-serif;
  text-align: center;
  padding: .2rem .3rem;
}

.application-inline-formula input:focus {
  outline: 3px solid rgba(108, 99, 255, .16);
  border-color: #6C63FF;
}

.application-inline-fraction {
  grid-template-rows: minmax(28px, auto) 2px minmax(28px, auto);
  min-width: 82px;
}

.inline-fraction-bar {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.application-inline-sqrt {
  grid-template-columns: auto minmax(74px, 1fr);
  align-items: end;
  font-size: 1.55rem;
  font-weight: 850;
}

.application-inline-sqrt input {
  border-top: 2px solid #111827;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.application-inline-power {
  grid-template-columns: minmax(58px, auto) minmax(44px, auto);
  align-items: start;
}

.inline-power-exponent {
  width: 48px;
  min-height: 24px;
  font-size: .76rem;
  transform: translateY(-.38rem);
}

.application-inline-absolute {
  grid-template-columns: auto minmax(68px, auto) auto;
  font-size: 1.45rem;
  font-weight: 850;
}

.application-inline-limit {
  grid-template-columns: auto 42px auto 52px 72px;
  font-weight: 850;
}

.application-inline-limit input,
.application-inline-integral input {
  width: 52px;
}

.inline-limit-expression,
.inline-integral-expression {
  width: 78px !important;
}

.application-inline-integral {
  grid-template-columns: auto 44px 78px auto 42px;
  font-weight: 850;
}

.inline-integral-symbol {
  font-size: 1.8rem;
  line-height: 1;
}

.inline-integral-bounds {
  display: grid;
  gap: .12rem;
}

.inline-integral-bounds input {
  min-height: 22px;
  font-size: .72rem;
}

.application-formula-zone {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: .55rem;
  border-top: 1px solid #E9EAF0;
  background: #FFFFFF;
  padding: .8rem .9rem;
}

.application-formula-zone[hidden] {
  display: none;
}

.application-fml-mathfield {
  width: 100%;
  min-height: 74px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #C7D2FE;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 1.16rem;
  padding: .55rem .7rem;
}

.application-fml-mathfield:focus-within {
  outline: 3px solid rgba(108, 99, 255, .16);
  border-color: #6C63FF;
}

.application-mf-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .4rem;
}

.application-mf-bar button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .82rem;
  font-weight: 850;
  padding: .45rem .7rem;
}

.application-mf-backspace,
.application-formula-cancel {
  background: #E2E8F0;
  color: #334155;
}

.application-formula-choices {
  display: flex;
  flex-wrap: wrap;
  gap: .38rem;
}

.application-formula-choice {
  min-height: 34px;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .78rem;
  font-weight: 850;
  padding: .35rem .7rem;
}

.application-formula-choice.active {
  border-color: #6C63FF;
  background: #EEF2FF;
  color: #4338CA;
}

.application-formula-fields {
  display: grid;
  gap: .25rem;
}

.application-formula-fields label {
  color: #475569;
  font-size: .74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.application-formula-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #C7D2FE;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-family: Inter, sans-serif;
  font-size: .9rem;
  padding: .45rem .65rem;
}

.application-formula-input:focus {
  outline: 3px solid rgba(108, 99, 255, .16);
  border-color: #6C63FF;
}

.application-formula-input[hidden] {
  display: none;
}

.application-graphic-editor {
  width: min(240px, 100%);
  margin: 0 auto;
}

.application-graphic-editor[hidden] {
  display: none !important;
}

.application-graphic-editor input {
  min-height: 34px;
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-family: Inter, sans-serif;
  font-size: .9rem;
  text-align: center;
  padding: .35rem .45rem;
}

.application-graphic-editor input:focus {
  outline: 3px solid rgba(108, 99, 255, .16);
  border-color: #6C63FF;
}

.application-fraction-editor {
  display: inline-grid;
  grid-template-rows: minmax(34px, auto) 2px minmax(34px, auto);
  align-items: center;
  justify-items: center;
  width: min(180px, 100%);
}

.application-fraction-editor span {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.application-fraction-editor input {
  width: 100%;
}

.application-root-editor {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  align-items: end;
  gap: .25rem;
  font-size: 1.8rem;
  font-weight: 800;
}

.application-root-editor input {
  border-top: 2px solid #111827;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.application-power-editor {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(54px, .65fr);
  align-items: start;
  gap: .25rem;
}

.application-power-exponent {
  min-height: 28px;
  font-size: .78rem;
  transform: translateY(-.42rem);
}

.application-absolute-editor {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr) auto;
  align-items: center;
  gap: .35rem;
  font-size: 1.7rem;
  font-weight: 800;
}

.application-limit-editor {
  display: grid;
  grid-template-columns: auto minmax(42px, .45fr) auto minmax(52px, .55fr) minmax(82px, 1fr);
  align-items: center;
  gap: .28rem;
  font-weight: 850;
}

.application-integral-editor {
  display: grid;
  grid-template-columns: auto minmax(46px, .45fr) minmax(86px, 1fr) auto minmax(42px, .42fr);
  align-items: center;
  gap: .28rem;
  font-weight: 850;
}

.application-integral-editor > span:first-child {
  font-size: 2rem;
  line-height: 1;
}

.application-integral-bounds {
  display: grid;
  gap: .16rem;
}

.application-integral-bounds input {
  min-height: 26px;
  font-size: .76rem;
}

.application-formula-preview {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #C7D2FE;
  border-radius: 10px;
  background: #F8F9FF;
  color: #334155;
  font-size: 1rem;
  padding: .35rem .65rem;
}

.application-formula-actions {
  display: flex;
  gap: .4rem;
}

.application-formula-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .82rem;
  font-weight: 850;
  padding: .45rem .7rem;
}

.application-formula-insert {
  background: #6C63FF;
  color: #fff;
}

.application-formula-insert:disabled {
  background: #C7D2FE;
  cursor: not-allowed;
}

.application-tool-btn,
.application-mode-pill,
.application-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 10px;
  font-family: Inter, sans-serif;
  font-size: .82rem;
  font-weight: 850;
  padding: .35rem .8rem;
}

.application-tool-btn {
  border: 1px solid #C7D2FE;
  background: #EEF2FF;
  color: #4F46E5;
  cursor: pointer;
}

.application-mode-pill {
  background: #F0EDFF;
  color: #6D5DFB;
}

.application-char-info {
  border-radius: 999px;
  background: #EEF0FF;
  color: #8B93AD;
  font-size: .78rem;
  font-weight: 800;
  padding: .35rem .6rem;
}

.application-send-btn {
  border: 0;
  background: #BDB9F4;
  color: #fff;
  cursor: pointer;
}

.application-send-btn:not(:disabled) {
  background: #6C63FF;
}

.application-send-btn:disabled {
  cursor: not-allowed;
}

.application-attachments {
  display: grid;
  gap: .35rem;
}

.application-attachment {
  border: 1px solid #DFE6F5;
  border-radius: 10px;
  background: #FAFBFF;
  margin: 0;
  padding: .55rem;
}

.application-attachment-preview {
  display: grid;
  gap: .5rem;
  border-bottom: 1px solid #E9EAF0;
  background: #F8F9FF;
  padding: .65rem .8rem;
}

.application-attachment-preview[hidden] {
  display: none;
}

.application-attachment-head,
.application-attachment-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.application-attachment-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.application-attachment-remove,
.application-remove-attachments {
  border: 0;
  border-radius: 999px;
  background: #FEE2E2;
  color: #991B1B;
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  padding: .3rem .65rem;
}

.application-attachment-image {
  display: block;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  margin-top: .5rem;
}

.application-scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .78);
  padding: 1rem;
}

.application-scan-modal {
  width: min(720px, 100%);
  overflow: hidden;
  border-radius: 16px;
  background: #111827;
}

.application-scan-modal video {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
}

.application-scan-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  padding: .75rem;
}

.application-scan-actions button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: .55rem .95rem;
}

.application-scan-actions .scan-capture {
  background: var(--primary);
  color: #fff;
}

.application-scan-actions .scan-close {
  background: #E5E7EB;
  color: #111827;
}

.application-feedback {
  display: none;
  border-radius: 10px;
  padding: .75rem .9rem;
  font-size: .9rem;
  line-height: 1.55;
}

.application-feedback.loading,
.application-feedback.success,
.application-feedback.error {
  display: block;
}

.application-feedback.loading {
  background: #EEF2FF;
  color: #3730A3;
}

.application-feedback.success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.application-feedback .ai-correction-html {
  display: grid;
  gap: .55rem;
}

.application-feedback .ai-correction-html h4 {
  margin: .35rem 0 0;
  color: #064E3B;
  font-size: .92rem;
  font-weight: 900;
}

.application-feedback .ai-correction-html p,
.application-feedback .ai-correction-html ul,
.application-feedback .ai-correction-html ol {
  margin: 0;
}

.application-feedback .ai-correction-html ul,
.application-feedback .ai-correction-html ol {
  padding-left: 1.15rem;
}

.application-feedback .ai-correction-html code,
.application-feedback .ai-correction-html pre {
  border-radius: 6px;
  background: rgba(6, 95, 70, .08);
  color: #064E3B;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.application-feedback .ai-correction-html code {
  padding: .08rem .25rem;
}

.application-feedback .ai-correction-html pre {
  overflow-x: auto;
  padding: .65rem;
}

.application-feedback.error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

@media (min-width: 1100px) {
  .application-exercise-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 36%);
  }

  .application-exercise-layout.application-editor-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .application-exercise-layout::before {
    grid-column: 1 / -1;
  }

  .application-exercise-statement {
    grid-column: 1;
  }

  .application-exercise-sidebar {
    grid-column: 2;
    position: sticky;
    top: 5.5rem;
  }

  .application-exercise-layout.application-editor-open .application-exercise-sidebar {
    grid-column: 1;
    position: static;
  }
}

@media (max-width: 760px) {
  .application-formula-zone {
    grid-template-columns: 1fr;
  }

  .application-formula-actions,
  .application-bottom-bar {
    flex-wrap: wrap;
  }

  .application-bottom-right {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ────────────────────────────────────────────────
   Fiche synthèse
──────────────────────────────────────────────── */
.synthese {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1565C0 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  margin-top: 2.5rem;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.synthese::before {
  content: '';
  position: absolute;
  width: 250px; height: 250px;
  right: -60px; bottom: -80px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.synthese h2 {
  color: #FFD54F;
  border-color: rgba(255,213,79,.3);
  font-size: 1.4rem;
}
.synthese h3 { color: #90CAF9; margin-top: 1.4rem; font-size: 1.05rem; }
.synthese ul li { margin-bottom: .4rem; }
.synthese ul li::marker { color: #FFD54F; }
.synthese p, .synthese li { color: rgba(255,255,255,.88); }
.synthese .attention,.synthese .attention p,.synthese .attention li,.synthese .attention strong,.synthese .astuce,.synthese .astuce p,.synthese .astuce li,.synthese .definition,.synthese .definition p,.synthese .definition li,.synthese .propriete,.synthese .propriete p,.synthese .propriete li,.synthese .methode,.synthese .methode p,.synthese .methode li { color: var(--text); }
.synthese .item {
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  padding: .8rem 1rem; margin: .7rem 0;
}

/* ────────────────────────────────────────────────
   Bouton corrigé toggle
──────────────────────────────────────────────── */
.btn-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  cursor: pointer;
  background: var(--cor-bd); color: #fff;
  padding: .42rem 1.1rem;
  border-radius: 20px;
  font-size: .82rem; font-weight: 600;
  border: none;
  margin: .6rem 0;
  transition: background .2s var(--ease), transform .1s;
  font-family: 'Inter', sans-serif;
}
.btn-toggle:hover { background: #00897B; transform: translateY(-1px); }
.btn-toggle:active { transform: translateY(0); }

.corrige-content { display: none; margin-top: .8rem; }
.corrige-content.open { display: block; }

/* ────────────────────────────────────────────────
   Étapes numérotées
──────────────────────────────────────────────── */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
  counter-increment: step;
  padding: .55rem .6rem .55rem 3rem;
  position: relative; margin-bottom: .55rem;
  background: rgba(255,255,255,.6);
  border-radius: 8px;
  border: 1px solid var(--border);
}
[data-theme="dark"] .steps li {
  background: rgba(255,255,255,.04);
}
.steps li::before {
  content: counter(step);
  position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
}

/* ────────────────────────────────────────────────
   Index — Hero
──────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0D47A1 0%, #1E88E5 60%, #7C4DFF 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 3.5rem 2rem 3rem;
  margin-bottom: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
/* Décoration hero */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero h1 {
  font-size: 3rem; margin-bottom: .6rem;
  font-weight: 900; letter-spacing: -1px;
  position: relative;
}
.hero h1 span { color: #FFD54F; }
.hero p {
  font-size: 1.15rem; opacity: .9;
  max-width: 580px; margin: 0 auto 1.8rem;
  position: relative;
}
.search-bar {
  display: flex; max-width: 420px; margin: 0 auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  border-radius: 30px; overflow: hidden;
}
.search-bar input {
  flex: 1; padding: .75rem 1.2rem;
  border: none; font-size: 1rem; outline: none;
  font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,.95);
}
.search-bar button {
  background: #FFD54F; color: #1a1a2e;
  border: none; padding: .75rem 1.4rem;
  font-weight: 800; font-size: 1rem;
  cursor: pointer; transition: background .2s;
  font-family: 'Inter', sans-serif;
}
.search-bar button:hover { background: #FFC107; }

/* ── Stats hero ── */
.hero-stats {
  display: flex; justify-content: center; gap: 2rem;
  margin-top: 2rem; flex-wrap: wrap;
  position: relative;
}
.hero-stat {
  text-align: center;
}
.hero-stat strong {
  display: block; font-size: 2rem; font-weight: 900;
  color: #FFD54F; line-height: 1;
}
.hero-stat span { font-size: .85rem; opacity: .8; }

/* ────────────────────────────────────────────────
   Cards Grid (index)
──────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem; margin-top: 2rem;
}
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg);
}
.card-header {
  padding: 1.4rem 1.5rem;
  color: #fff; position: relative; overflow: hidden;
}
.card-header::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}
.card-body { padding: 1.2rem 1.4rem; flex: 1; }
.card-body p { font-size: .88rem; color: var(--text-sec); margin-bottom: .8rem; line-height: 1.65; }
.card-footer { padding: .85rem 1.4rem; border-top: 1px solid var(--border); }
.card .num-ch { font-size: .72rem; opacity: .8; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.card h3 { font-size: 1.05rem; margin: .25rem 0 0; font-weight: 700; }

/* ── Tags ── */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .7rem; }
.tag {
  font-size: .67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  padding: .18rem .55rem; border-radius: 10px;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid rgba(21,101,192,.15);
}
[data-theme="dark"] .tag {
  background: rgba(91,141,246,.15);
  color: var(--primary);
  border-color: rgba(91,141,246,.2);
}

/* ── Couleurs des cartes ── */
.c1  .card-header { background: linear-gradient(135deg,#1565C0,#1E88E5); }
.c2  .card-header { background: linear-gradient(135deg,#00695C,#00ACC1); }
.c3  .card-header { background: linear-gradient(135deg,#6A1B9A,#9C27B0); }
.c4  .card-header { background: linear-gradient(135deg,#BF360C,#EF5350); }
.c5  .card-header { background: linear-gradient(135deg,#01579B,#039BE5); }
.c6  .card-header { background: linear-gradient(135deg,#33691E,#7CB342); }
.c7  .card-header { background: linear-gradient(135deg,#E65100,#FF8F00); }
.c8  .card-header { background: linear-gradient(135deg,#880E4F,#E91E63); }
.c9  .card-header { background: linear-gradient(135deg,#006064,#00ACC1); }
.c10 .card-header { background: linear-gradient(135deg,#263238,#546E7A); }
.c11 .card-header { background: linear-gradient(135deg,#311B92,#673AB7); }
.c12 .card-header { background: linear-gradient(135deg,#1A237E,#3949AB); }

/* ── Bouton principal (cartes) ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--primary); color: #fff;
  padding: .48rem 1.2rem; border-radius: 20px;
  font-size: .83rem; font-weight: 600;
  transition: background .2s var(--ease), transform .15s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(21,101,192,.25);
}
.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(21,101,192,.35);
}

/* ────────────────────────────────────────────────
   Bouton PDF
──────────────────────────────────────────────── */
.btn-pdf {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(135deg, #C62828, #E53935);
  color: #fff;
  border: none; border-radius: 22px;
  padding: .55rem 1.5rem;
  font-size: .88rem; font-weight: 600;
  text-decoration: none;
  margin: .6rem 0 1.4rem;
  box-shadow: 0 3px 12px rgba(211,47,47,.3);
  transition: all .2s var(--ease);
  font-family: 'Inter', sans-serif;
}
.btn-pdf:hover {
  background: linear-gradient(135deg, #B71C1C, #C62828);
  text-decoration: none; color: #fff;
  box-shadow: 0 5px 18px rgba(183,28,28,.4);
  transform: translateY(-2px);
}
.btn-pdf svg { flex-shrink: 0; }

/* ────────────────────────────────────────────────
   Bouton retour
──────────────────────────────────────────────── */
.btn-back {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: .4rem 1rem; border-radius: 20px;
  font-size: .83rem; margin-bottom: 1.5rem;
  transition: all .2s var(--ease);
  font-weight: 500;
}
.btn-back:hover {
  background: var(--primary-light);
  text-decoration: none;
  transform: translateX(-2px);
}

/* ────────────────────────────────────────────────
   Navigation bas de page
──────────────────────────────────────────────── */
.chapter-nav {
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}
.chapter-nav a {
  display: flex; align-items: center; gap: .5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: .75rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600; color: var(--primary);
  font-size: .88rem;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow);
}
.chapter-nav a:hover {
  background: var(--primary-light);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ────────────────────────────────────────────────
   Footer
──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-sec);
  font-size: .83rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ────────────────────────────────────────────────
   Back to top
──────────────────────────────────────────────── */
#back-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 1.1rem; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 3px 14px rgba(21,101,192,.4);
  z-index: 500;
  transition: background .2s, transform .2s, opacity .3s;
  font-family: 'Inter', sans-serif;
}
#back-top.visible { display: flex; }
#back-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ────────────────────────────────────────────────
   Tables
──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th {
  background: var(--primary); color: #fff;
  padding: .65rem 1rem; text-align: left;
  font-size: .85rem; font-weight: 700;
  letter-spacing: .3px;
}
td { padding: .58rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
tr:nth-child(even) td { background: var(--primary-light); }
[data-theme="dark"] tr:nth-child(even) td { background: rgba(91,141,246,.08); }
/* ── Tableau de valeurs remarquables ── */
.tableau-valeurs {
  border-collapse: collapse;
  width: auto; min-width: 340px;
  margin: 1rem auto;
  font-size: .95rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
  border-radius: var(--radius-sm); overflow: hidden;
}
.tableau-valeurs th, .tableau-valeurs td {
  border: 1.5px solid #9FA8DA;
  padding: .58rem .9rem;
  text-align: center; white-space: nowrap;
}
.tableau-valeurs thead th {
  background: #3F51B5; color: #fff;
  font-weight: 700; letter-spacing: .04em;
}
.tableau-valeurs tbody tr:first-child td  { background: #E8EAF6; color: #283593; font-weight: 600; }
.tableau-valeurs tbody tr:last-child  td  { background: #FCE4EC; color: #880E4F; font-weight: 600; }

/* ── Tableau de variations ── */
.tableau-variations { overflow-x: auto; margin: 1rem 0 1.5rem; }
.tableau-variations table {
  border-collapse: separate; border-spacing: 0;
  min-width: 360px; font-size: .95rem;
  background: var(--card-bg);
  border: 2px solid #1565C0;
  border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: 0 2px 10px rgba(21,101,192,.12);
  margin: 0;
}
.tableau-variations th, .tableau-variations td {
  border: 1px solid #90CAF9;
  padding: .48rem .8rem;
  text-align: center; min-width: 58px;
}
.tableau-variations thead th {
  background: #1565C0; color: #fff;
  font-weight: 700; font-size: 1rem;
  border-bottom: 2px solid #0D47A1;
}
.tableau-variations tbody tr:nth-child(1) td { background: #F5F5F5; color: #555; font-size: .9rem; }
.tableau-variations tbody tr:nth-child(2) td { background: var(--card-bg); font-size: 1.15rem; font-weight: 700; }
.tableau-variations .max-val { color: #1565C0; font-weight: 800; }
.tableau-variations .min-val { color: #C62828; font-weight: 800; }
.tableau-variations .pos { color: #2E7D32; font-weight: 700; }
.tableau-variations .neg { color: #C62828; font-weight: 700; }

/* ── tkztab (LaTeX PNG) ── */
.tkztab-wrap { overflow-x: auto; margin: 1rem 0 1.8rem; }
.tkztab {
  border-collapse: collapse; font-size: .97rem;
  background: var(--card-bg);
  border: 2.5px solid #1565C0;
  border-radius: 7px; overflow: hidden;
  box-shadow: 0 3px 12px rgba(21,101,192,.16);
}
.tkztab td { border: 1px solid #90CAF9; text-align: center; min-width: 62px; padding: .1rem .55rem; }
.tkztab .col-label {
  background: #E3F2FD; color: #0D47A1;
  font-weight: 600; text-align: left;
  padding: .45rem 1rem !important;
  white-space: nowrap; font-size: .92rem;
  border-right: 2px solid #1565C0;
}
.tkztab .row-x td { background: #1565C0; color: #fff; font-weight: 700; padding: .5rem .55rem; border-color: #0D47A1; }
.tkztab .row-x .col-label { background: #0D47A1; }
.tkztab .row-sign td { background: #EEF6FF; height: 40px; font-size: 1.1rem; font-weight: 700; border-top: 2.5px solid #1565C0; border-bottom: 2.5px solid #1565C0; }
.tkztab .row-sign .col-label { background: #D4ECFF; }
.tkztab .row-sign .s-pos  { color: #2E7D32; }
.tkztab .row-sign .s-neg  { color: #C62828; }
.tkztab .row-sign .s-zero { color: #555; font-weight: 500; font-size: .88rem; }
.tkztab .row-var td { height: 74px; padding: 0; }
.tkztab .row-var .col-label { padding: .45rem 1rem !important; }
.tkztab .v-top { vertical-align: top; padding-top: 7px !important; color: #1565C0; font-weight: 800; font-size: 1.05rem; }
.tkztab .v-bot { vertical-align: bottom; padding-bottom: 7px !important; color: #C62828; font-weight: 800; font-size: 1.05rem; }
.tkztab .c-arr { padding: 0 !important; overflow: hidden; }
.tkztab .c-arr svg { display: block; width: 100%; height: 74px; min-width: 64px; }

/* ── GeoGebra ── */
.ggb-wrap {
  margin: 1.2rem 0 1.8rem;
  border-radius: var(--radius); overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  background: #fff;
}
.ggb-wrap iframe { display: block; width: 100%; border: none; min-height: 380px; }

/* ────────────────────────────────────────────────
   Python editor (chapitre 15)
──────────────────────────────────────────────── */
code.py {
  background: #1e1e2e; color: #a6e3a1;
  padding: .1em .4em; border-radius: 4px;
  font-size: .9em;
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
}

.py-code {
  display: block;
  width: 100%;
  min-height: 180px;
  margin: .75rem 0 0;
  padding: 1rem 1.1rem;
  resize: vertical;
  border: 1px solid #26324a;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #d8f3dc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), var(--shadow);
  font: 500 .92rem/1.55 'Fira Code', 'SFMono-Regular', Consolas, monospace;
  tab-size: 2;
  outline: none;
}
.py-code:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.18), inset 0 1px 0 rgba(255,255,255,.04);
}

.btn-run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: .7rem 0 .55rem;
  padding: .48rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(21,101,192,.28);
  cursor: pointer;
  font: 700 .86rem/1 'Inter', system-ui, sans-serif;
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn-run:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(21,101,192,.34);
}
.btn-run:active {
  transform: translateY(0);
}

.py-output {
  display: block;
  width: 100%;
  min-height: 90px;
  margin: .35rem 0 1.4rem;
  padding: .95rem 1.1rem;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid #203047;
  border-left: 4px solid #26a69a;
  border-radius: var(--radius-sm);
  background: #0b1220;
  color: #e5eefc;
  box-shadow: var(--shadow);
  font: 500 .9rem/1.55 'Fira Code', 'SFMono-Regular', Consolas, monospace;
}
.py-output:empty::before {
  content: "La sortie du programme apparaitra ici.";
  color: #8ba3c7;
  font-family: 'Inter', system-ui, sans-serif;
}
.py-output.error {
  border-left-color: var(--warn-bd);
  background: #fff1f2;
  color: var(--warn-tx);
}

[data-theme="dark"] .py-code {
  border-color: #334155;
  background: #020617;
}
[data-theme="dark"] .py-output {
  background: #020617;
  border-color: #263449;
  color: #dbeafe;
}
[data-theme="dark"] .py-output.error {
  background: #2a1010;
  color: #fecaca;
}

/* ────────────────────────────────────────────────
   Responsive — Mobile
──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { display: none; position: absolute; }

  .navbar { flex-wrap: wrap; height: auto; padding: .75rem 1rem; }
  .navbar-actions { order: 2; }
  #nav-toggle { display: flex; order: 3; margin-left: .5rem; }

  /* Menu mobile déployé */
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 58px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(13,71,161,.98);
    backdrop-filter: blur(12px);
    padding: .8rem 1rem;
    gap: .2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    z-index: 999;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .nav-links.open a {
    padding: .6rem .9rem;
    font-size: .9rem;
    border-radius: 8px;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 1.65rem; }
  .hero h1 { font-size: 2.1rem; }
  .chapter-header h1 { font-size: 1.8rem; }
  .chapter-header { padding: 2rem 1.5rem; }
  .page-wrapper { padding: 1.5rem 1rem 2rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.2rem; }
  .hero-stat strong { font-size: 1.6rem; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav a { justify-content: center; }
}

/* ────────────────────────────────────────────────
   Print
──────────────────────────────────────────────── */
@media print {
  .navbar, .btn-back, #back-top, .chapter-nav,
  #reading-progress, #dark-toggle, #nav-toggle { display: none !important; }
  .corrige-content { display: block !important; }
  body { background: #fff; color: #000; }
  .chapter-header { box-shadow: none; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ────────────────────────────────────────────────
   Overrides Drupal — intégration thème Spé Maths
──────────────────────────────────────────────── */
#skip-link { display: none; }
.layout-container { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* Messages Drupal */
.messages--status { background: var(--cor-bg); border-left: 5px solid var(--cor-bd); color: var(--cor-tx); padding: .8rem 1.2rem; border-radius: var(--radius-sm); margin: 1rem 0; }
.messages--warning { background: var(--warn-bg); border-left: 5px solid var(--warn-bd); color: var(--warn-tx); padding: .8rem 1.2rem; border-radius: var(--radius-sm); margin: 1rem 0; }
.messages--error { background: var(--warn-bg); border-left: 5px solid var(--warn-bd); color: var(--warn-tx); padding: .8rem 1.2rem; border-radius: var(--radius-sm); margin: 1rem 0; }

/* Node article */
.node--type-chapitre .node__content { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem 3rem; }
.node--type-page .node__content { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem 3rem; }

/* Views liste chapitres */
.view-chapitres .view-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 1.5rem; margin-top: 1.5rem; }

/* Pager */
.pager { text-align: center; margin: 2rem 0; }
.pager__item a { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--card-bg); border: 1px solid var(--border); color: var(--primary); font-weight: 600; margin: 0 2px; transition: all .2s; }
.pager__item--current a, .pager__item a:hover { background: var(--primary); color: #fff; text-decoration: none; }

/* Breadcrumb */
.breadcrumb { font-size: .82rem; padding: .5rem 0 1rem; color: var(--text-sec); }
.breadcrumb a { color: var(--primary); }

.page-exercices-applications .breadcrumb {
  display: none;
}

/* Admin toolbar override */
body.toolbar-fixed .navbar { top: 39px; }
body.toolbar-fixed.toolbar-tray-open .navbar { top: 79px; }

/* ── Navigation utilisateur ──────────────────────────────────────────────── */
.navbar { display: flex; align-items: center; gap: 1rem; }
.nav-user { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

.nav-user-link {
  font-size: .875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-connexion {
  display: inline-block;
  padding: .4rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  transition: opacity .2s;
}
.btn-connexion:hover { opacity: .85; color: #fff; }

.btn-inscription {
  display: inline-block;
  padding: .4rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  transition: all .2s;
}
.btn-inscription:hover { background: var(--primary); color: #fff; }

.btn-deconnexion {
  background: #e53935;
}
.btn-deconnexion:hover { background: #c62828; opacity: 1; }

/* Formulaires connexion / inscription */
.page-user-login .layout-container main,
.page-user-register .layout-container main {
  max-width: 440px;
  margin: 3rem auto;
  padding: 0 1rem;
}

/* ── Programme officiel (BO) sections ────────────────────────────────────── */
.programme-bo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}
@media (max-width: 680px) {
  .programme-bo { grid-template-columns: 1fr; }
}

.programme-bo-capacites,
.programme-bo-demos {
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.programme-bo-capacites {
  background: #fff7ed;
  border: 2px solid #f97316;
}

.programme-bo-demos {
  background: #f0faf8;
  border: 2px solid #0f766e;
}

.programme-bo-capacites h3 {
  color: #c2410c;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 .75rem;
  font-weight: 700;
}

.programme-bo-demos h3 {
  color: #0f766e;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 .75rem;
  font-weight: 700;
}

.programme-bo-capacites ul,
.programme-bo-demos ul {
  margin: 0;
  padding-left: 1.2rem;
  list-style: disc;
}

.programme-bo-capacites li,
.programme-bo-demos li {
  margin-bottom: .4rem;
  line-height: 1.55;
  font-size: .92rem;
}

.programme-bo-demos--none {
  opacity: .75;
}
.programme-bo-none {
  font-style: italic;
  font-size: .88rem;
  color: #374151;
  margin: 0;
}

/* ── En-tête de la section BO avec liens ─────────────────────────────────── */
.programme-bo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px 6px 0 0;
  padding: .6rem 1rem;
  margin-bottom: -.25rem;
  font-size: .82rem;
}

.programme-bo-label {
  font-weight: 600;
  color: #334155;
  letter-spacing: .01em;
}

.programme-bo-links {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.programme-bo-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .65rem;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  background: #fff;
  border: 1px solid #94a3b8;
  color: #0f172a;
  transition: background .15s, border-color .15s;
}
.programme-bo-link:hover {
  background: #e2e8f0;
  border-color: #64748b;
  text-decoration: none;
}
.programme-bo-link--ext {
  border-color: #0284c7;
  color: #0284c7;
}
.programme-bo-link--ext:hover {
  background: #e0f2fe;
}

/* ── Bloc algorithmes BO ──────────────────────────────────────────────────── */
.programme-bo-algos {
  background: #f5f3ff;
  border: 2px solid #7c3aed;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: .5rem;
  grid-column: 1 / -1;   /* pleine largeur sous les deux blocs */
}

.programme-bo-algos h3 {
  color: #5b21b6;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 .75rem;
  font-weight: 700;
}

.programme-bo-algos ul {
  margin: 0;
  padding-left: 1.2rem;
  list-style: disc;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 2rem;
}

.programme-bo-algos li {
  margin-bottom: .3rem;
  line-height: 1.55;
  font-size: .92rem;
  min-width: 220px;
}

/* grille 3 colonnes pour les blocs BO quand algos présent */
.programme-bo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 0 0 2rem;
}

/* ============================================================
   SECTIONS DÉMONSTRATIONS & ALGORITHMES
   ============================================================ */

/* ── En-têtes de section ─────────────────────────────────── */
section#demonstrations,
section#algorithmes {
  margin: 2.5rem 0 1rem;
  padding: 0;
}

section#demonstrations > h2,
section#algorithmes > h2 {
  font-size: 1.35rem;
  font-weight: 800;
  padding-bottom: 0.45rem;
  margin-bottom: 0.4rem;
  border-bottom: 3px solid;
}

section#demonstrations > h2 { border-color: #0f766e; color: #0f766e; }
section#algorithmes > h2    { border-color: #7c3aed; color: #7c3aed; }

.section-intro {
  color: #64748b;
  font-style: italic;
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

/* ── Boîte démonstration ─────────────────────────────────── */
.demonstration {
  border: 1px solid #0d9488;
  border-left: 4px solid #0f766e;
  border-radius: 7px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15,118,110,.1);
}

.demonstration > h3 {
  background: #0f766e;
  color: #fff;
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.demo-enonce {
  background: #f0fdfa;
  border-bottom: 1px solid #99f6e4;
  padding: 0.75rem 1rem;
}

.demo-preuve {
  background: #fff;
  padding: 0.75rem 1rem;
}

.demo-label {
  display: inline-block;
  background: #0d9488;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.1rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.45rem;
  vertical-align: middle;
}

.demo-label--proof { background: #059669; }

.demo-enonce p,  .demo-preuve p,
.demo-enonce ul, .demo-preuve ul,
.demo-enonce ol, .demo-preuve ol {
  margin: 0.4rem 0;
  line-height: 1.75;
}

.demo-enonce ul, .demo-preuve ul,
.demo-enonce ol, .demo-preuve ol {
  padding-left: 1.4rem;
}

/* ── Boîte algorithme ────────────────────────────────────── */
.algorithme {
  border: 1px solid #a78bfa;
  border-left: 4px solid #7c3aed;
  border-radius: 7px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(124,58,237,.1);
}

.algorithme > h3 {
  background: #7c3aed;
  color: #fff;
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.algorithme > p {
  background: #faf5ff;
  color: #4c1d95;
  margin: 0;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #ddd6fe;
  line-height: 1.6;
}

/* ── Bloc de code Python ─────────────────────────────────── */
.algo-code {
  background: #1e1b2e;
  color: #e2e8f0;
  margin: 0;
  padding: 1rem 1.2rem;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.83rem;
  line-height: 1.65;
  overflow-x: auto;
  border-radius: 0 0 5px 5px;
  tab-size: 4;
  -moz-tab-size: 4;
}

.algo-code code {
  background: none;
  color: inherit;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  white-space: pre;
}

/* ── Animations algo ─────────────────────────────────────── */
.algo-anim {
  background: #0f172a;
  border-top: 1px solid #1e293b;
  padding: 0.75rem 1rem 0.5rem;
}
.anim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.anim-title {
  color: #64748b;
  font-size: 0.78rem;
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.03em;
}
.anim-btns { display: flex; gap: 0.4rem; }
.anim-canvas {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: #0f172a;
}
.anim-info {
  color: #475569;
  font-size: 0.75rem;
  font-family: 'Fira Code', monospace;
  text-align: center;
  margin-top: 0.4rem;
  min-height: 1.2em;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .demo-enonce,
  .demo-preuve,
  .algorithme > p {
    padding: 0.6rem 0.75rem;
  }
  .algo-code {
    font-size: 0.78rem;
    padding: 0.75rem;
  }
}

/* ── Région highlighted (messages flash Drupal) ───────────── */
.highlighted {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Masquer les onglets de navigation dans highlighted (local tasks) */
.highlighted #block-spemath-primary-local-tasks {
  display: none;
}

/* Messages de statut */
.highlighted .messages {
  margin: 1rem 0 0;
  padding: .85rem 1.2rem .85rem 1rem;
  border-radius: 8px;
  border-left: 4px solid;
  font-size: .95rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}

.highlighted .messages--status {
  background: #f0fdf4;
  border-color: #16a34a;
  color: #15803d;
}

.highlighted .messages--warning {
  background: #fffbeb;
  border-color: #d97706;
  color: #92400e;
}

.highlighted .messages--error {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

.highlighted .messages__list {
  margin: 0; padding: 0; list-style: none;
}

/* Icônes automatiques */
.highlighted .messages--status::before { content: '✓ '; font-weight: 700; }
.highlighted .messages--warning::before { content: '⚠ '; font-weight: 700; }
.highlighted .messages--error::before   { content: '✕ '; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   PAGE CONTACT
   ═══════════════════════════════════════════════════════════════════════ */

.contact-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.contact-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}
.contact-hero-icon { font-size: 3rem; margin-bottom: .75rem; }
.contact-hero h1   { font-size: 2rem; font-weight: 800; margin: 0 0 .5rem; color: var(--text); }
.contact-hero p    { font-size: 1.05rem; color: var(--text-sec); max-width: 520px; margin: 0 auto; }

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
  margin-top: 2rem;
}
@media (max-width: 720px) {
  .contact-layout { grid-template-columns: 1fr; }
}

.contact-card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
  border: 1px solid var(--border);
}
.contact-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: var(--text);
}

/* ── Formulaire Drupal stylisé ── */
.spemath-contact-form .form-item {
  margin-bottom: 1.25rem;
}
.spemath-contact-form label {
  display: block;
  font-size: .87rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: .4rem;
}
.spemath-contact-form input[type="text"],
.spemath-contact-form input[type="email"],
.spemath-contact-form select,
.spemath-contact-form textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
}
.spemath-contact-form input:focus,
.spemath-contact-form select:focus,
.spemath-contact-form textarea:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21,101,192,.1);
}
.spemath-contact-form textarea { resize: vertical; min-height: 130px; }
.spemath-contact-form .form-required { color: #e53935; margin-left: 2px; }

.btn-contact-submit,
.spemath-contact-form [type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .8rem 1.5rem;
  background: linear-gradient(135deg, #1565C0, #0d47a1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .18s, transform .12s, box-shadow .18s;
  box-shadow: 0 4px 14px rgba(21,101,192,.3);
  margin-top: .5rem;
}
.btn-contact-submit:hover,
.spemath-contact-form [type="submit"]:hover {
  opacity: .92;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(21,101,192,.38);
}

/* ── Barre latérale ── */
.contact-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-info-block {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
}
.contact-info-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: .1rem; }
.contact-info-block strong { display: block; font-size: .92rem; font-weight: 700; color: var(--text); margin-bottom: .2rem; }
.contact-info-block p { font-size: .82rem; color: var(--text-sec); margin: 0 0 .4rem; line-height: 1.5; }
.contact-faq-link {
  font-size: .82rem;
  font-weight: 650;
  color: #1565C0;
  text-decoration: none;
}
.contact-faq-link:hover { text-decoration: underline; }

/* footer links */
.footer-links { margin-top: .4rem; }
.footer-links a { color: rgba(255,255,255,.65); text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════
   PAGE FAQ
   ═══════════════════════════════════════════════════════════════════════ */

.faq-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.faq-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.faq-hero h1 { font-size: 2rem; font-weight: 800; margin: 0 0 .5rem; color: var(--text); }
.faq-hero p  { font-size: 1.05rem; color: var(--text-sec); }

/* ── Filtres catégories ── */
.faq-categories {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.faq-cat {
  padding: .42rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-sec);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.faq-cat:hover   { border-color: #1565C0; color: #1565C0; }
.faq-cat.active  { background: #1565C0; color: #fff; border-color: #1565C0; }

/* ── Items accordéon ── */
.faq-list { display: flex; flex-direction: column; gap: .6rem; }

.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow .18s;
}
.faq-item:has([aria-expanded="true"]) {
  box-shadow: 0 4px 18px rgba(21,101,192,.1);
  border-color: rgba(21,101,192,.3);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .97rem;
  font-weight: 650;
  color: var(--text);
  text-align: left;
}
.faq-question:hover { color: #1565C0; }
.faq-question[aria-expanded="true"] { color: #1565C0; }

.faq-chevron {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: #aaa;
  transition: transform .22s ease;
}
.faq-question[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
  color: #1565C0;
}

.faq-answer {
  padding: 0 1.25rem 1.15rem;
  font-size: .9rem;
  color: var(--text-sec);
  line-height: 1.7;
}
.faq-answer p  { margin: 0 0 .6rem; }
.faq-answer ul { padding-left: 1.2rem; margin: .3rem 0 .6rem; }
.faq-answer li { margin-bottom: .25rem; }
.faq-answer a  { color: #1565C0; font-weight: 650; }
.faq-answer strong { color: var(--text); }

/* ── CTA bas de page ── */
.faq-cta {
  text-align: center;
  margin-top: 2.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, #e8f0fe, #f0f4ff);
  border-radius: 18px;
}
.faq-cta p { font-size: 1rem; color: var(--text-sec); margin: 0 0 1rem; }
.faq-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: .65rem 1.5rem;
  background: #1565C0;
  color: #fff;
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: opacity .18s, transform .12s;
  box-shadow: 0 4px 14px rgba(21,101,192,.28);
}
.faq-cta-btn:hover { opacity: .9; transform: translateY(-1px); color: #fff; }

/* ── Modale de confirmation OCR ─────────────────────────────────────────── */
#ocr-confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: fadeInOverlay .15s ease;
}
@keyframes fadeInOverlay { from { opacity: 0 } to { opacity: 1 } }

.ocr-modal-box {
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 620px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUpModal .2s ease;
}
@keyframes slideUpModal { from { transform: translateY(24px); opacity: 0 } to { transform: none; opacity: 1 } }

.ocr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem .8rem;
  border-bottom: 1px solid var(--border, #e5e9f0);
}
.ocr-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #1a1a2e);
}
.ocr-modal-title em {
  color: var(--accent, #1565C0);
  font-style: normal;
}
.ocr-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-sec, #666);
  padding: .2rem .4rem;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s;
}
.ocr-modal-close:hover { background: var(--surface2, #f0f4ff); }

.ocr-modal-hint {
  font-size: .85rem;
  color: var(--text-sec, #666);
  margin: .7rem 1.4rem .3rem;
}

.ocr-modal-textarea {
  flex: 1;
  margin: 0 1rem .8rem;
  padding: .9rem 1rem;
  border: 1.5px solid var(--border, #dde3ee);
  border-radius: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .82rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 180px;
  max-height: 340px;
  background: var(--surface2, #f8faff);
  color: var(--text, #1a1a2e);
  transition: border-color .2s;
}
.ocr-modal-textarea:focus {
  outline: none;
  border-color: var(--accent, #1565C0);
  background: #fff;
}

.ocr-modal-actions {
  display: flex;
  gap: .7rem;
  justify-content: flex-end;
  padding: .8rem 1.2rem 1.2rem;
  border-top: 1px solid var(--border, #e5e9f0);
}
.ocr-modal-cancel {
  padding: .55rem 1.2rem;
  border: 1.5px solid var(--border, #dde3ee);
  border-radius: 10px;
  background: none;
  color: var(--text-sec, #666);
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.ocr-modal-cancel:hover { background: var(--surface2, #f0f4ff); }

.ocr-modal-confirm {
  padding: .55rem 1.4rem;
  border: none;
  border-radius: 10px;
  background: var(--accent, #1565C0);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 4px 14px rgba(21,101,192,.3);
}
.ocr-modal-confirm:hover { opacity: .88; transform: translateY(-1px); }

[data-theme="dark"] .ocr-modal-box { background: #1e2235; }
[data-theme="dark"] .ocr-modal-textarea { background: #161929; color: #e8eaf6; border-color: #333a55; }
[data-theme="dark"] .ocr-modal-textarea:focus { background: #1a1f35; border-color: #5c8df6; }

@media (max-width: 600px) {
  .ocr-modal-box { border-radius: 14px 14px 0 0; max-height: 90vh; align-self: flex-end; }
  #ocr-confirm-modal { align-items: flex-end; padding: 0; }
}

/* ── Modale de choix de scan (webcam / QR) ──────────────────────────────── */
#scan-choice-modal, #qr-scan-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: fadeInOverlay .15s ease;
}
.scan-choice-box, .qr-modal-box {
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  width: 100%;
  max-width: 480px;
  animation: slideUpModal .2s ease;
  overflow: hidden;
}
.scan-choice-header, .qr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem .9rem;
  border-bottom: 1px solid var(--border, #e5e9f0);
}
.scan-choice-title, .qr-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #1a1a2e);
}
.scan-choice-close, .qr-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-sec, #666);
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background .15s;
}
.scan-choice-close:hover, .qr-modal-close:hover { background: var(--surface2, #f0f4ff); }

.scan-choice-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.2rem;
}
.scan-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.3rem 1rem;
  border: 2px solid var(--border, #dde3ee);
  border-radius: 14px;
  background: var(--surface2, #f8faff);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .1s;
  text-align: center;
}
.scan-choice-btn:hover {
  border-color: var(--accent, #1565C0);
  background: #eef4ff;
  transform: translateY(-2px);
}
.scan-choice-icon { font-size: 2rem; line-height: 1; }
.scan-choice-btn strong { font-size: .95rem; color: var(--text, #1a1a2e); }
.scan-choice-btn span { font-size: .78rem; color: var(--text-sec, #666); line-height: 1.3; }

/* QR code modal */
.qr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.4rem 1.2rem 1.6rem;
  text-align: center;
}
.qr-modal-img {
  border-radius: 12px;
  border: 3px solid var(--accent, #1565C0);
  display: block;
}
.qr-modal-hint {
  font-size: .87rem;
  color: var(--text-sec, #555);
  line-height: 1.7;
  margin: 0;
}
.qr-modal-status {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-sec, #555);
  margin: 0;
}

[data-theme="dark"] .scan-choice-box,
[data-theme="dark"] .qr-modal-box { background: #1e2235; }
[data-theme="dark"] .scan-choice-btn { background: #161929; border-color: #333a55; }
[data-theme="dark"] .scan-choice-btn:hover { background: #1a1f35; border-color: #5c8df6; }

@media (max-width: 480px) {
  .scan-choice-options { grid-template-columns: 1fr; }
  .scan-choice-box, .qr-modal-box { border-radius: 14px 14px 0 0; align-self: flex-end; }
  #scan-choice-modal, #qr-scan-modal { align-items: flex-end; padding: 0; }
}

/* ── Outil de recadrage graphique ───────────────────────────────────────── */
#crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  animation: fadeInOverlay .15s ease;
}
.crop-box {
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  animation: slideUpModal .18s ease;
}
.crop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.2rem;
  border-bottom: 1px solid var(--border, #e5e9f0);
  flex-shrink: 0;
}
.crop-title { font-weight: 700; font-size: .95rem; color: var(--text, #1a1a2e); }
.crop-header-actions { display: flex; align-items: center; gap: .6rem; }
.crop-btn-reset {
  font-size: .78rem;
  padding: .3rem .8rem;
  border: 1.5px solid var(--border, #dde3ee);
  border-radius: 8px;
  background: none;
  color: var(--text-sec, #555);
  cursor: pointer;
  transition: background .15s;
}
.crop-btn-reset:hover { background: var(--surface2, #f0f4ff); }
.crop-close {
  background: none; border: none; font-size: 1rem;
  cursor: pointer; color: var(--text-sec, #666);
  padding: .2rem .4rem; border-radius: 6px;
  transition: background .15s;
}
.crop-close:hover { background: var(--surface2, #f0f4ff); }

.crop-canvas-wrap {
  position: relative;
  overflow: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  padding: 16px;
  min-height: 0;
}
#crop-canvas {
  display: block;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
}
.crop-canvas-container {
  position: relative;
  display: inline-block;
  line-height: 0;
}
#crop-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  touch-action: none;
}
.crop-hint-text {
  text-align: center;
  font-size: .8rem;
  color: var(--text-sec, #666);
  margin: .5rem 0 0;
  padding: 0 1rem;
  flex-shrink: 0;
}
.crop-hint-text strong { color: #3b82f6; }

.crop-footer {
  display: flex;
  gap: .7rem;
  justify-content: flex-end;
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--border, #e5e9f0);
  flex-shrink: 0;
}
.crop-btn-cancel {
  padding: .55rem 1.1rem;
  border: 1.5px solid var(--border, #dde3ee);
  border-radius: 10px;
  background: none;
  color: var(--text-sec, #666);
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s;
}
.crop-btn-cancel:hover { background: var(--surface2, #f0f4ff); }
.crop-btn-confirm {
  padding: .55rem 1.4rem;
  border: none;
  border-radius: 10px;
  background: var(--accent, #1565C0);
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(21,101,192,.3);
  transition: opacity .15s, transform .1s;
}
.crop-btn-confirm:hover { opacity: .88; transform: translateY(-1px); }

[data-theme="dark"] .crop-box { background: #1e2235; }
[data-theme="dark"] .crop-canvas-wrap { background: #0a0c14; }

@media (max-width: 600px) {
  .crop-box { border-radius: 14px 14px 0 0; max-height: 95vh; align-self: flex-end; }
  #crop-modal { align-items: flex-end; padding: 0; }
  .crop-canvas-wrap { padding: 8px; }
}

/* ── Bouton Indice dans les exercices ───────────────────────────────── */
.btn-application-hint {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .35rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: opacity .15s, transform .1s;
}
.btn-application-hint:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.btn-application-hint:disabled { opacity: .5; cursor: not-allowed; }
.btn-application-hint.active { filter: brightness(.88); box-shadow: inset 0 2px 5px rgba(0,0,0,.2); }

/* ── Panneau d'indice ───────────────────────────────────────────────── */
.application-hint-panel {
  margin-top: .9rem;
  border-left: 4px solid #f59e0b;
  border-radius: 0 10px 10px 0;
  background: #fffbeb;
  padding: .85rem 1rem;
  font-size: .88rem;
  line-height: 1.6;
  animation: fadeInOverlay .2s ease;
}
.hint-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
  font-size: .9rem;
}
.hint-icon { font-size: 1.1rem; }
.hint-header strong { flex: 1; }
.hint-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9a7a1a;
  font-size: .85rem;
  padding: .15rem .35rem;
  border-radius: 4px;
  transition: background .12s;
}
.hint-close:hover { background: rgba(0,0,0,.07); }
.hint-body { color: #44330a; }
.hint-loading { color: #92680a; font-style: italic; }
.hint-error { color: #b45309; }

[data-theme="dark"] .application-hint-panel {
  background: #2d2410;
  border-color: #d97706;
}
[data-theme="dark"] .hint-body { color: #fde68a; }
[data-theme="dark"] .hint-loading,
[data-theme="dark"] .hint-error { color: #fbbf24; }

/* ── Bouton Tuteur IA ─────────────────────────────────────────────────── */
.btn-application-tutor {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .35rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: opacity .15s, transform .15s, box-shadow .15s;
}
.btn-application-tutor:hover { opacity: .88; transform: translateY(-1px); }
.btn-application-tutor.active {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .35);
  filter: brightness(.9);
}

/* ── Tiroir Tuteur IA ─────────────────────────────────────────────────── */
.application-tutor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 46vw;
  min-width: 360px;
  max-width: 700px;
  height: 100vh;
  background: #fff;
  box-shadow: -6px 0 32px rgba(0, 0, 0, .16);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 10px));
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.application-tutor-drawer.open {
  transform: translateX(0);
}
.application-tutor-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  flex-shrink: 0;
  gap: .5rem;
}
.tutor-drawer-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tutor-drawer-title {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.tutor-drawer-exercise-label {
  font-size: .72rem;
  opacity: .82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.tutor-drawer-close {
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: .3rem .55rem;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s;
}
.tutor-drawer-close:hover { background: rgba(255, 255, 255, .28); }
.application-tutor-iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

/* Mobile : tiroir depuis le bas */
@media (max-width: 680px) {
  .application-tutor-drawer {
    width: 100vw;
    max-width: none;
    top: auto;
    bottom: 0;
    right: 0;
    height: 88vh;
    transform: translateY(calc(100% + 10px));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 32px rgba(0, 0, 0, .18);
  }
  .application-tutor-drawer.open {
    transform: translateY(0);
  }
}

[data-theme="dark"] .application-tutor-drawer {
  background: #1e1e2e;
  box-shadow: -6px 0 32px rgba(0, 0, 0, .5);
}

/* ============================================================
   REDESIGN ÉDITEUR — nouveau design (2025)
   ============================================================ */

/* Toggle button — style rectangle avec icône */
.application-open-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-radius: 12px !important;
  font-size: .92rem !important;
  padding: .75rem 1.2rem !important;
  letter-spacing: .01em;
}

/* Labels de section */
.application-section-label {
  padding: .7rem .95rem .35rem;
  color: #1E3A5F;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: #fff;
}

/* ── Suivi de compétence ── */
.exercise-assessment {
  border: 0 !important;
  border-bottom: 1px solid #E9EAF0 !important;
  margin: 0 !important;
  padding: .7rem .95rem .9rem !important;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.exercise-assessment legend {
  width: 100%;
  margin-bottom: .6rem;
  color: #1E3A5F;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.exercise-assessment legend::after {
  content: 'ℹ';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid #94A3B8;
  border-radius: 50%;
  color: #94A3B8;
  font-size: .65rem;
  font-style: normal;
  cursor: help;
}

/* Les labels d'option en grille 3 colonnes */
.exercise-assessment .assessment-option {
  flex: 0 0 auto;
}

.exercise-assessment {
  flex-direction: row !important;
  flex-wrap: nowrap;
  gap: .55rem;
}

.assessment-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1rem !important;
  border-radius: 12px !important;
  min-height: 48px !important;
  font-size: .82rem !important;
  font-weight: 700 !important;
  white-space: nowrap;
  transition: all .14s ease;
}

.assessment-option.acquired span { background: #DCFCE7; color: #166534; border: 1.5px solid #86EFAC; }
.assessment-option.progress span { background: #FEF3C7; color: #92400E; border: 1.5px solid #FCD34D; }
.assessment-option.missing  span { background: #FEE2E2; color: #991B1B; border: 1.5px solid #FCA5A5; }

.assessment-option.acquired  input:checked + span { background: #16A34A; color: #fff; border-color: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,.2); transform: translateY(-1px); }
.assessment-option.progress  input:checked + span { background: #D97706; color: #fff; border-color: #D97706; box-shadow: 0 0 0 3px rgba(217,119,6,.2);  transform: translateY(-1px); }
.assessment-option.missing   input:checked + span { background: #DC2626; color: #fff; border-color: #DC2626; box-shadow: 0 0 0 3px rgba(220,38,38,.2);   transform: translateY(-1px); }

/* Icônes via ::before */
.assessment-option.acquired  span::before { content: '✓'; font-weight: 900; }
.assessment-option.progress  span::before { content: '⏳'; font-size: .85em; }
.assessment-option.missing   span::before { content: '✕'; font-weight: 900; }

/* ── Zone de réponse ── */
.application-answer {
  border-bottom: 1px solid #E9EAF0;
  min-height: 160px !important;
}

/* ── Barre d'outils mathématiques redesignée ── */
.application-symbol-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: .28rem;
  overflow-x: auto;
  padding: .55rem .75rem .5rem !important;
  background: #fff;
  border-bottom: 1px solid #E9EAF0 !important;
  scrollbar-width: none;
}
.application-symbol-tabs::-webkit-scrollbar { display: none; }

.application-symbol-tab {
  flex-shrink: 0;
  border: 1.5px solid #E2E8F0 !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #64748B !important;
  font-size: .76rem !important;
  font-weight: 700 !important;
  padding: .32rem .62rem !important;
  margin-right: 0 !important;
  transition: border-color .12s, background .12s, color .12s;
}
.application-symbol-tab:hover {
  border-color: #6C63FF !important;
  transform: none !important;
  background: #F5F3FF !important;
  color: #4F46E5 !important;
}
.application-symbol-tab.active {
  border-color: #4F46E5 !important;
  background: #4F46E5 !important;
  color: #fff !important;
}

/* Panel de symboles — toujours visible quand ouvert */
.application-symbol-panel--open,
.application-symbol-panel--open[hidden] {
  display: grid !important;
}

/* ── Section Documents joints ── */
.application-docs-section {
  border-top: 1px solid #E9EAF0;
  background: #fff;
  padding-bottom: .9rem;
}

.application-docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .45rem;
  padding: .4rem .9rem 0;
}

@media (max-width: 680px) {
  .application-docs-grid { grid-template-columns: 1fr; }
}

.application-doc-btn {
  display: flex !important;
  align-items: center;
  gap: .55rem;
  padding: .65rem .7rem !important;
  border: 1.5px solid #E2E8F0 !important;
  border-radius: 12px !important;
  background: #FAFBFF !important;
  color: #334155 !important;
  cursor: pointer;
  font-family: Inter, sans-serif;
  text-align: left;
  min-height: auto !important;
  transition: border-color .12s, background .12s;
}
.application-doc-btn:hover {
  border-color: #6C63FF !important;
  background: #F0EDFF !important;
}

.doc-btn-icon { font-size: 1.15rem; flex-shrink: 0; }

.doc-btn-body {
  display: flex;
  flex-direction: column;
  gap: .08rem;
}
.doc-btn-body strong { color: #1E293B; font-size: .8rem; font-weight: 750; display: block; }
.doc-btn-body small  { color: #94A3B8; font-size: .72rem; font-weight: 500; }

.application-docs-formats {
  padding: .45rem .9rem 0;
  color: #94A3B8;
  font-size: .72rem;
  margin: 0;
  line-height: 1.4;
}

/* ── Barre du bas redesignée ── */
.application-bottom-bar {
  border-top: 1px solid #E9EAF0 !important;
  background: #F8F9FF !important;
  padding: .6rem .9rem !important;
}

/* Bouton Effacer tout */
.application-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border: 0;
  background: transparent;
  color: #EF4444;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .82rem;
  font-weight: 750;
  padding: .3rem .5rem;
  border-radius: 8px;
  transition: background .12s;
}
.application-clear-btn:hover { background: #FEE2E2; }

/* Bouton envoyer — vert */
.application-send-btn:not(:disabled) {
  background: #16A34A !important;
  color: #fff !important;
}
.application-send-btn:not(:disabled):hover {
  background: #15803D !important;
}

/* Bouton Corriger exercice — vert (primary action) */
.btn-application-correction:not(:disabled) {
  background: #16A34A !important;
  border: 0 !important;
}
.btn-application-correction:not(:disabled):hover {
  background: #15803D !important;
}

/* ── Layout 2 colonnes : éditeur + sidebar ── */
.application-editor-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 276px;
  gap: 1.1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .application-editor-with-sidebar {
    grid-template-columns: 1fr;
  }
  .application-editor-sidebar { display: none; }
}

.application-editor-main {
  min-width: 0;
}

/* ── Sidebar ── */
.application-editor-sidebar {
  display: grid;
  gap: .85rem;
  position: sticky;
  top: 1rem;
}

.editor-sidebar-card {
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  background: #fff;
  padding: .85rem .95rem;
}

.editor-sidebar-card-label {
  color: #1E3A5F;
  font-size: .67rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}

.editor-sidebar-hint {
  color: #64748B;
  font-size: .8rem;
  margin: 0 0 .7rem;
  line-height: 1.5;
}

.editor-sidebar-symbols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .3rem;
}

.editor-symbol-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8F9FF;
  font-size: .95rem;
  cursor: default;
  padding: .3rem;
}

.editor-shortcuts { display: grid; gap: .5rem; margin-top: .1rem; }

.editor-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
}

.shortcut-keys { display: flex; align-items: center; gap: .18rem; }

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  border: 1px solid #CBD5E1;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #F1F5F9;
  color: #334155;
  font-family: Inter, sans-serif;
  font-size: .72rem;
  font-weight: 750;
  padding: 0 .35rem;
}

.editor-shortcut > span:last-child { color: #475569; }

.editor-sidebar-btn {
  width: 100%;
  margin-top: .75rem;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  color: #4F46E5;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: .78rem;
  font-weight: 750;
  padding: .45rem .7rem;
  text-align: center;
  transition: background .12s;
}
.editor-sidebar-btn:hover { background: #F5F3FF; }


/* ═══════════════════════════════════════════════════════════════
   FICHE DE SYNTHÈSE — Correctifs de contraste globaux
   La carte .synthese a un fond bleu foncé → tout texte = blanc.
   Les boîtes colorées imbriquées → fond clair + texte sombre.
   ═══════════════════════════════════════════════════════════════ */

/* 1. Tables dans la carte sombre : texte blanc sur fond sombre */
.synthese table td,
.synthese table th { color: rgba(255,255,255,.9); }

/* 2. Lignes paires : remplace le fond clair (#E3F2FD) par un voile blanc
      sur le bleu foncé — blanc sur bleu foncé = lisible */
.synthese tr:nth-child(even) td { background: rgba(255,255,255,.12) !important; }
[data-theme=dark] .synthese tr:nth-child(even) td { background: rgba(255,255,255,.08) !important; }

/* 3. Boîtes colorées imbriquées dans la synthèse : texte sombre
      (elles ont leur propre fond clair, donc le texte doit être sombre) */
.synthese .attention,
.synthese .astuce,
.synthese .definition,
.synthese .propriete,
.synthese .methode,
.synthese .exemple { color: var(--text) !important; }

.synthese .attention p, .synthese .attention li,
.synthese .attention strong, .synthese .attention em,
.synthese .attention span, .synthese .attention b,
.synthese .astuce p, .synthese .astuce li,
.synthese .astuce strong, .synthese .astuce em,
.synthese .definition p, .synthese .definition li,
.synthese .definition strong,
.synthese .propriete p, .synthese .propriete li,
.synthese .propriete strong,
.synthese .methode p, .synthese .methode li,
.synthese .methode strong,
.synthese .exemple p, .synthese .exemple li,
.synthese .exemple strong { color: var(--text) !important; }

/* 4. Classe .item dans la synthèse : fond semi-transparent, texte blanc */
.synthese .item { color: rgba(255,255,255,.9); }

/* 5. Tableau spécial tableau-valeurs dans la synthèse */
.synthese .tableau-valeurs td,
.synthese .tableau-valeurs th { color: rgba(255,255,255,.9); }
.synthese .tableau-valeurs tbody tr:first-child td,
.synthese .tableau-valeurs tbody tr:last-child td {
  color: rgba(255,255,255,.9) !important;
  background: rgba(255,255,255,.15) !important;
}
