:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f0f4ff;
  --text: #162033;
  --muted: #5f6b84;
  --primary: #355cde;
  --primary-dark: #2446b8;
  --secondary: #e9eefc;
  --border: #dbe3f2;
  --shadow: 0 12px 32px rgba(21, 34, 66, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container: 1000px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  color: var(--text);
  line-height: 1.7;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  width: min(var(--container), calc(100% - 2rem));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.site-title {
  margin: 0;
  font-size: 1.8rem;
  color: var(--primary);
  font-weight: 800;
}

.site-subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem;
  background: var(--secondary);
  color: var(--primary);
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: 0.2s ease;
}

.back-link:hover {
  background: #dde6ff;
  transform: translateY(-1px);
}

/* Hero */
.hero {
  padding: 3rem 0 2rem;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.hero-card h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  color: var(--text);
}

.hero-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.tag {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(53, 92, 222, 0.1);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Main */
main.container {
  padding-bottom: 3rem;
}

.section {
  margin-bottom: 2.3rem;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Cards / boxes */
.lesson-box,
.example-box,
.exercise-box,
.video-box,
.tip-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.lesson-box h3,
.example-box h3,
.exercise-box h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  color: var(--primary);
  font-size: 1.2rem;
}

.lesson-box p,
.example-box p,
.exercise-box p,
.video-box p,
.tip-box p {
  margin: 0.6rem 0;
}

/* Code */
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 14px;
  overflow-x: auto;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 1rem 0;
}

code {
  font-family: Consolas, Monaco, "Courier New", monospace;
}

/* Video */
.video-box iframe {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 16px;
  margin-top: 1rem;
  display: block;
}

/* Special blocks */
.example-box {
  background: #f8fbff;
  border-left: 6px solid var(--primary);
}

.tip-box {
  background: #fffdf4;
  border-left: 6px solid #f2c94c;
}

/* Footer nav */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.2rem;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #dde6ff;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero-card {
    padding: 1.4rem;
  }

  .section h2 {
    font-size: 1.6rem;
  }

  .footer-nav {
    flex-direction: column;
  }

  .btn,
  .back-link {
    width: 100%;
    height: auto;
    min-height: 52px;
    flex: none;
    text-align: center;
  }
}

/* ===== AJOUTS POUR MATH & LISTES ===== */

.math {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  margin: 0 0.1rem;
  background: var(--surface-soft);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-weight: 700;
  white-space: nowrap;
}

.lesson-box ul,
.lesson-box ol,
.exercise-box ul,
.exercise-box ol {
  margin: 0.8rem 0 0.2rem;
  padding-left: 1.4rem;
}

.lesson-box li,
.exercise-box li {
  margin-bottom: 0.45rem;
}

/* ===== AJOUTS POUR INTERVALLES, TABLEAUX ET VIDÉO ===== */

.lesson-box h4,
.example-box h4 {
  margin: 1.25rem 0 0.55rem;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.lesson-box .tip-box {
  margin-top: 1.2rem;
  margin-bottom: 0;
  box-shadow: none;
}

.lesson-box > svg,
.example-box > svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.lesson-box table,
.example-box table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.lesson-box th,
.lesson-box td,
.example-box th,
.example-box td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.lesson-box th,
.example-box th {
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

#video {
  scroll-margin-top: 7rem;
}

#video .video-box {
  overflow: hidden;
}

#video .video-box iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 16px;
  background: #0f172a;
}

@media (max-width: 768px) {
  .lesson-box,
  .example-box,
  .exercise-box,
  .video-box,
  .tip-box {
    padding: 1rem;
  }

  .lesson-box th,
  .lesson-box td,
  .example-box th,
  .example-box td {
    padding: 0.55rem;
    font-size: 0.9rem;
  }

  .lesson-box > svg,
  .example-box > svg {
    min-width: 560px;
  }
}

/* Les formules MathJax sont aussi rendues en SVG : elles ne doivent jamais
   hériter des dimensions prévues pour les grandes figures pédagogiques. */
.lesson-box mjx-container svg,
.example-box mjx-container svg,
.mini-card mjx-container svg,
.tip-box mjx-container svg,
.exercise-box mjx-container svg {
  display: inline;
  min-width: 0;
  max-width: none;
  margin: 0;
}

/* ===== VECTEURS, COORDONNÉES ET FIGURES SVG ===== */

#cours,
#exercices,
#video {
  scroll-margin-top: 7rem;
}

.vector-figure {
  margin: 1.25rem auto;
  padding: 1rem;
  max-width: 760px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
}

.vector-figure > svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
  margin-inline: auto;
}

.vector-figure figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.vector-figure .grid-line {
  stroke: #dbe4ee;
  stroke-width: 1;
}

.vector-figure .axis {
  stroke: #173f70;
  stroke-width: 2.4;
}

.vector-figure .construction {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-dasharray: 7 6;
}

.vector-figure .point {
  fill: #173f70;
}

.vector-figure .vector-red {
  fill: none;
  stroke: #c94f4f;
  stroke-width: 4;
}

.vector-figure .vector-blue {
  fill: none;
  stroke: #173f70;
  stroke-width: 4;
}

.vector-figure .label-arrow {
  stroke-width: 1.75;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.vector-figure text,
.vector-figure .figure-label {
  fill: #173f70;
  font: 600 16px Arial, sans-serif;
}

.vector-figure .vector-label,
.vector-figure .figure-label-red {
  fill: #c94f4f;
  font: 700 16px Arial, sans-serif;
}

.single-line-title {
  white-space: nowrap;
  font-size: clamp(1rem, 4.5vw, 1.35rem);
}

.vector-over {
  position: relative;
  display: inline-block;
  margin-left: 0.08em;
  line-height: 1;
}

.vector-over::before {
  content: "→";
  position: absolute;
  left: 50%;
  top: -0.72em;
  transform: translateX(-50%);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
}

mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.2rem;
}

@media (max-width: 768px) {
  .vector-figure {
    margin-inline: 0;
    padding: 0.75rem;
  }

  .vector-figure > svg {
    min-width: 520px;
  }
}

@media (max-width: 420px) {
  .single-line-title {
    font-size: 0.96rem;
    letter-spacing: -0.02em;
  }
}

/* ===== DROITES DU PLAN ===== */

.lesson-box,
.example-box,
.mini-card,
.tip-box,
.exercise-box {
  text-align: left;
}

.lesson-box h3,
.example-box h3,
.mini-card h3,
.exercise-box h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.lesson-box p,
.example-box p,
.mini-card p,
.tip-box p,
.exercise-box p {
  margin: 0.35rem 0;
  line-height: 1.5;
  text-align: left;
  word-spacing: normal;
}

.lesson-box ul,
.tip-box ul {
  margin: 0.35rem 0 0;
  padding-left: 1.35rem;
}

.lesson-box li,
.tip-box li {
  margin: 0.18rem 0;
  line-height: 1.45;
  text-align: left;
  word-spacing: normal;
}

.lesson-box mjx-container,
.example-box mjx-container,
.mini-card mjx-container {
  word-spacing: normal;
}

.formula-box {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border-left: 4px solid #2454d3;
  background: #f8fafc;
  text-align: center;
}

.equation-line {
  margin: 0.6rem 0;
  padding: 0.7rem 1rem;
  overflow-x: auto;
  border-radius: 10px;
  background: #f8fafc;
  text-align: center;
}

.coords {
  white-space: nowrap;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  word-spacing: normal;
}

.method-table-wrapper {
  margin: 0.75rem 0;
  overflow-x: auto;
}

.method-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
}

.method-table th,
.method-table td {
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  text-align: center;
}

.method-table th {
  background: #eaf2ff;
  color: #173e79;
}

.membership-table {
  min-width: 560px;
}

.figure-box {
  margin: 1rem auto;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid #d7e1ef;
  border-radius: 14px;
  background: #fff;
}

.figure-box > svg {
  display: block;
  width: 100%;
  max-width: 700px;
  min-width: 520px;
  height: auto;
  margin: auto;
}

.axis { stroke: #475569; stroke-width: 2; }
.grid { stroke: #dbe4f0; stroke-width: 1; }
.line-blue { fill: none; stroke: #2454d3; stroke-width: 4; }
.line-orange { fill: none; stroke: #dc6b34; stroke-width: 3; }
.helper { stroke: #64748b; stroke-width: 2; stroke-dasharray: 7 6; }
.point { fill: #173e79; }
.label { fill: #173e79; font: 700 17px Inter, Arial, sans-serif; }
.accent-label { fill: #b45309; font: 700 16px Inter, Arial, sans-serif; }

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mini-card {
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}

mjx-container[display="true"] {
  margin: 0.35rem 0;
}

@media (max-width: 700px) {
  .two-columns {
    grid-template-columns: 1fr;
  }

  .figure-box > svg {
    min-width: 480px;
  }

  .method-table th,
  .method-table td {
    padding: 0.6rem;
  }

  .lesson-box p,
  .example-box p,
  .mini-card p,
  .tip-box p,
  .exercise-box p {
    line-height: 1.45;
  }
}

/* Corrigés repliables, réutilisables dans les cours de seconde. */
.exercise-correction{margin-top:1.2rem;border-top:1px solid var(--border);padding-top:1rem}
.exercise-correction summary{cursor:pointer;font-weight:700;color:var(--primary-dark);padding:.4rem 0}
.exercise-correction summary:focus-visible{outline:3px solid var(--primary);outline-offset:4px}
.exercise-correction li{margin:.65rem 0;line-height:1.6}
/* Ensembles : styles de la page centralisés et débordements contenus. */
.ensembles-page .ensembles-scroll{max-width:100%;overflow-x:auto;margin:1.2rem 0;overscroll-behavior-x:contain}
.ensembles-page .ensembles-number-line{min-width:620px;width:100%;height:auto;display:block}
.ensembles-page .ensembles-table{width:100%;min-width:480px;border-collapse:collapse;margin-top:1rem}
.ensembles-page .ensembles-table th,.ensembles-page .ensembles-table td{padding:.6rem;border:1px solid #cbd5e1;text-align:left}
.ensembles-page .ensembles-table th{background:#173e79;color:white}
.ensembles-page .lesson-box,.ensembles-page .example-box,.ensembles-page .exercise-box,.ensembles-page .tip-box{min-width:0;overflow-wrap:anywhere}
.ensembles-page .math{max-width:100%;white-space:normal;overflow-wrap:anywhere}


/* Vecteurs : styles auparavant intégrés dans le HTML. */

.vecteurs-page .vector-figure {
  margin: 1.25rem auto;
  padding: 1rem;
  max-width: 760px;
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
}
.vecteurs-page .vector-figure > svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
}
.vecteurs-page .vector-figure figcaption {
  margin-top: 0.75rem;
  color: #475569;
  font-size: 0.95rem;
}
.vecteurs-page .grid-line { stroke: #dbe4ee; stroke-width: 1; }
.vecteurs-page .axis { stroke: #173f70; stroke-width: 2.4; }
.vecteurs-page .construction { fill: none; stroke: #94a3b8; stroke-width: 2; stroke-dasharray: 7 6; }
.vecteurs-page .vector-red { fill: none; stroke: #c94f4f; stroke-width: 4; }
.vecteurs-page .vector-blue { fill: none; stroke: #173f70; stroke-width: 4; }
.vecteurs-page .label-arrow { stroke-width: 1.5; }
.vecteurs-page .point { fill: #173f70; }
.vecteurs-page .figure-label { fill: #173f70; font: 600 16px Arial, sans-serif; }
.vecteurs-page .figure-label-red { fill: #c94f4f; font: 700 16px Arial, sans-serif; }
.vecteurs-page .single-line-title {
  white-space: nowrap;
  font-size: clamp(1rem, 4.5vw, 1.35rem);
}
.vecteurs-page .vector-over {
  position: relative;
  display: inline-block;
  margin-left: 0.08em;
  line-height: 1;
}
.vecteurs-page .vector-over::before {
  content: "→";
  position: absolute;
  left: 50%;
  top: -0.72em;
  transform: translateX(-50%);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
}

/* Vecteurs : contenir les textes et les formules sans masquer la page. */
.vecteurs-page .header-container > div,
.vecteurs-page .hero-card,
.vecteurs-page .lesson-box,
.vecteurs-page .example-box,
.vecteurs-page .exercise-box,
.vecteurs-page .tip-box {
  min-width: 0;
  overflow-wrap: anywhere;
}

.vecteurs-page .single-line-title {
  white-space: normal;
  line-height: 1.5;
}

/* Une formule reste intacte ; si elle est longue, elle défile localement. */
.vecteurs-page .math {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  vertical-align: middle;
}

.vecteurs-page p.math {
  display: block;
  margin-inline: 0;
}

/* Les corrections contiennent aussi des formules sans enveloppe .math. */
.vecteurs-page mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.25em;
  vertical-align: middle;
}

.vecteurs-page .vector-figure {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 768px) {
  .vecteurs-page .vector-figure {
    margin-inline: 0;
    padding: 0.75rem;
  }
}

/* Correctif V2 : neutraliser les largeurs minimales ajoutées par MathJax. */
.vecteurs-page .vector-formula {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0.75rem 0;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.vecteurs-page mjx-container,
.vecteurs-page mjx-container[display="true"] {
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

.vecteurs-page mjx-container[display="true"] {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: left !important;
}

.vecteurs-page .math {
  box-sizing: border-box;
  max-width: calc(100% - 0.2rem);
}

.vecteurs-page .vector-formula mjx-container {
  margin-block: 0.25rem;
}

.vecteurs-page .vector-figure {
  width: 100%;
  margin-inline: 0;
  box-sizing: border-box;
}

/* Pages de calcul : les expressions textuelles peuvent revenir à la ligne. */
.mobile-course-page .header-container > div,
.mobile-course-page .hero-card,
.mobile-course-page .lesson-box,
.mobile-course-page .example-box,
.mobile-course-page .exercise-box,
.mobile-course-page .tip-box {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mobile-course-page .math {
  box-sizing: border-box;
  min-width: 0;
  max-width: calc(100% - 0.2rem);
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.mobile-course-page p.math {
  display: block;
  margin-inline: 0;
}

.mobile-course-page mjx-container {
  min-width: 0 !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.25em;
}

.mobile-course-page mjx-container[display="true"] {
  display: block;
  width: 100%;
  text-align: left !important;
}

/* Les tableaux de signes gardent leur structure et défilent dans leur cadre. */
.mobile-course-page .latex-sign-table {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.mobile-course-page .latex-sign-table mjx-container {
  width: max-content;
  min-width: 680px !important;
  max-width: none;
  margin: 0 !important;
  overflow: visible;
}


/* Styles propres à fonctions-representation-page */

.fonctions-representation-page .formula-line {display:flex;flex-wrap:wrap;align-items:center;gap:.45rem}
.fonctions-representation-page .method-steps {padding-left:1.4rem}
.fonctions-representation-page .method-steps li+li {margin-top:.5rem}
.fonctions-representation-page .table-wrap {width:100%;overflow-x:auto;margin:1rem 0}
.fonctions-representation-page .value-table {width:100%;min-width:430px;border-collapse:collapse;text-align:center}
.fonctions-representation-page .value-table th, .fonctions-representation-page .value-table td {border:1px solid #cbd5e1;padding:.7rem .55rem}
.fonctions-representation-page .value-table th {background:#eff6ff;color:#1d4ed8}
.fonctions-representation-page .graph-card {margin-top:1rem;padding:.65rem;border:1px solid #dbe4f0;border-radius:16px;background:#fff}
.fonctions-representation-page .graph-card > svg {display:block;width:100%;height:auto;max-height:430px}
.fonctions-representation-page .graph-caption {margin:.65rem .3rem .2rem;color:#475569;font-size:.95rem;text-align:center}
.fonctions-representation-page .note-box {margin-top:1rem;padding:.85rem 1rem;border-left:4px solid #f59e0b;border-radius:8px;background:#fffbeb}
.fonctions-representation-page .comparison-list li+li {margin-top:.65rem}
@media(max-width:640px) {
.fonctions-representation-page .formula-line {gap:.2rem .35rem}
.fonctions-representation-page .graph-card {padding:.25rem;margin-left:-.2rem;margin-right:-.2rem}
.fonctions-representation-page .graph-caption {font-size:.86rem}
.fonctions-representation-page .value-table th, .fonctions-representation-page .value-table td {padding:.55rem .4rem}}
  


/* Styles propres à statistiques-page */

.statistiques-page .stat-table-wrapper {overflow-x:auto;margin:1rem 0}
.statistiques-page .stat-table {width:100%;min-width:560px;border-collapse:collapse;background:#fff}
.statistiques-page .stat-table th, .statistiques-page .stat-table td {padding:.7rem;border:1px solid #cbd5e1;text-align:center}
.statistiques-page .stat-table th {background:#eaf2ff;color:#173e79}
.statistiques-page .formula-box {margin:1rem 0;padding:1rem;border-left:4px solid #2454d3;background:#f8fafc;text-align:center}
.statistiques-page .method-steps {counter-reset:step;list-style:none;padding-left:0}
.statistiques-page .method-steps li {counter-increment:step;margin:.65rem 0;padding-left:2.4rem;position:relative}
.statistiques-page .method-steps li::before {content:counter(step);position:absolute;left:0;top:-.1rem;width:1.7rem;height:1.7rem;border-radius:50%;display:grid;place-items:center;background:#2454d3;color:#fff;font-weight:700}
.statistiques-page .histogram {display:flex;align-items:flex-end;height:190px;margin:1.5rem auto .5rem;padding:0 1rem;border-left:2px solid #475569;border-bottom:2px solid #475569;max-width:620px}
.statistiques-page .hist-bar {position:relative;flex:1;margin:0 1px;background:#7db2f5;border:1px solid #2454d3}
.statistiques-page .hist-bar span {position:absolute;left:50%;transform:translateX(-50%);top:-1.5rem;font-weight:700;color:#173e79}
.statistiques-page .hist-labels {display:grid;grid-template-columns:repeat(5,1fr);max-width:620px;margin:0 auto;text-align:center;font-size:.85rem}
.statistiques-page .comparison-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.statistiques-page .comparison-card {padding:1rem;border:1px solid #cbd5e1;border-radius:12px;background:#fff}
@media(max-width:650px) {
.statistiques-page .comparison-grid {grid-template-columns:1fr}
.statistiques-page .histogram {height:155px;padding:0 .3rem}
.statistiques-page .hist-labels {font-size:.72rem}}
  

.statistiques-page .hist-height-20 { height: 20%; }

.statistiques-page .hist-height-60 { height: 60%; }

.statistiques-page .hist-height-100 { height: 100%; }

.statistiques-page .hist-height-70 { height: 70%; }

.statistiques-page .hist-height-50 { height: 50%; }


/* Styles propres à probabilites-page */

.probabilites-page .prob-table-wrapper {overflow-x:auto;margin:1rem 0}
.probabilites-page .prob-table {width:100%;border-collapse:collapse;min-width:560px;background:#fff}
.probabilites-page .prob-table th, .probabilites-page .prob-table td {border:1px solid #cbd5e1;padding:.75rem;text-align:center}
.probabilites-page .prob-table th {background:#eaf2ff;color:#173e79}
.probabilites-page .formula-box {margin:1rem 0;padding:1rem;border-left:4px solid #2454d3;background:#f8fafc;text-align:center}
.probabilites-page .event-complement {display:inline-block;line-height:1;text-decoration-line:overline;text-decoration-thickness:2px;text-decoration-skip-ink:none}
.probabilites-page .weighted-tree {margin:1.25rem 0;padding:1rem;border:1px solid #d7e1ef;border-radius:14px;background:#fff;overflow-x:auto}
.probabilites-page .weighted-tree > svg {display:block;width:100%;min-width:640px;height:auto}
.probabilites-page .tree-line {stroke:#335f9e;stroke-width:3;fill:none}
.probabilites-page .tree-dot {fill:#2454d3}
.probabilites-page .tree-event {font-size:17px;font-weight:700;fill:#173e79}
.probabilites-page .tree-weight {font-size:15px;font-weight:700;fill:#b45309}
.probabilites-page .tree-result {font-size:14px;fill:#475569}
.probabilites-page .tree-overline {stroke:#173e79;stroke-width:1.8;stroke-linecap:round}
@media(max-width:650px) {
.probabilites-page .weighted-tree {padding:.5rem}
.probabilites-page .weighted-tree > svg {min-width:590px}}
  

/* Contenir les éléments larges dans les trois nouvelles pages. */
.mobile-course-page .formula-box,
.mobile-course-page .table-wrap,
.mobile-course-page .stat-table-wrapper,
.mobile-course-page .prob-table-wrapper,
.mobile-course-page .weighted-tree,
.mobile-course-page .graph-card,
.mobile-course-page .comparison-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.mobile-course-page .formula-box,
.mobile-course-page .table-wrap,
.mobile-course-page .stat-table-wrapper,
.mobile-course-page .prob-table-wrapper {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.fonctions-representation-page .formula-line > * {
  min-width: 0;
  max-width: 100%;
}
.fonctions-representation-page .graph-card {
  margin-inline: 0;
}
/* Seul le dessin principal reçoit les dimensions de la figure. */
.probabilites-page .weighted-tree > svg {
  display: block;
}

/* Vecteurs géométriques : styles de figures externalisés. */

.vecteurs-geometrie-page .vector-figure {
      margin: 1.25rem auto;
      padding: 1rem;
      max-width: 760px;
      overflow-x: auto;
      border: 1px solid #cbd5e1;
      border-radius: 12px;
      background: #f8fafc;
      text-align: center;
    }
.vecteurs-geometrie-page .vector-figure > svg {
      display: block;
      width: 100%;
      min-width: 520px;
      height: auto;
    }
.vecteurs-geometrie-page .vector-figure figcaption {
      margin-top: 0.75rem;
      color: #475569;
      font-size: 0.95rem;
    }
.vecteurs-geometrie-page .vector-figure .point {
      fill: #173f70;
    }
.vecteurs-geometrie-page .vector-figure .construction {
      fill: none;
      stroke: #64748b;
      stroke-width: 2;
    }
.vecteurs-geometrie-page .vector-figure .vector-red {
      fill: none;
      stroke: #c94f4f;
      stroke-width: 4;
    }
.vecteurs-geometrie-page .vector-figure .vector-blue {
      fill: none;
      stroke: #173f70;
      stroke-width: 4;
    }
.vecteurs-geometrie-page .vector-figure .label-arrow {
      stroke-width: 1.5;
    }
.vecteurs-geometrie-page .vector-figure text {
      fill: #173f70;
      font: 600 17px Arial, sans-serif;
    }
.vecteurs-geometrie-page .vector-figure .vector-label {
      fill: #c94f4f;
      font-weight: 700;
    }
  
/* Corrections dépliables : le débordement reste local, jamais sur la page. */
.corrections-mobile-page .exercise-correction {
  display: block;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  overflow-wrap: anywhere;
}
.corrections-mobile-page .exercise-correction p,
.corrections-mobile-page .exercise-correction li,
.corrections-mobile-page .exercise-correction ul,
.corrections-mobile-page .exercise-correction ol {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.corrections-mobile-page .exercise-correction .math {
  min-width: 0;
  max-width: calc(100% - 0.2rem);
  white-space: normal;
  overflow-wrap: anywhere;
}
.corrections-mobile-page .exercise-correction .correction-math {
  display: inline-block;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.25em;
  white-space: nowrap;
  overscroll-behavior-x: contain;
}
/* La formule conserve sa taille naturelle dans son conteneur défilant. */
.corrections-mobile-page .exercise-correction .correction-math mjx-container {
  display: inline-block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: visible !important;
  margin: 0 !important;
}
