:root {
  --bg: #f6fafb;
  --ink: #14323a;
  --muted: #496169;
  --brand: #0f7c8c;
  --brand-dark: #0a5a67;
  --tint: #e8f5f7;
  --card: #ffffff;
  --line: #d5e3e7;
  --ok: #1b7f4b;
  --ok-bg: #e6f5ec;
  --ko: #b3261e;
  --ko-bg: #fdeceb;
  --mid: #9a6700;
  --mid-bg: #fff4d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 50, 58, 0.06), 0 4px 14px rgba(20, 50, 58, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
h1:focus { outline: none; }
p { margin: 0 0 1em; }
a { color: var(--brand-dark); }

:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(1100px, 100% - 2rem); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 0.6rem 1rem; z-index: 100; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* En-tête */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; }
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); font-size: 0.85rem; line-height: 1.2; }
.brand strong { font-size: 1rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 1.6rem; font-weight: 700; }
.nav { display: flex; gap: 0.1rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); padding: 0.5rem 0.7rem; border-radius: 8px; font-size: 0.93rem; }
.nav a:hover { background: var(--tint); }
.nav a[aria-current="page"] { background: var(--tint); font-weight: 600; }
.nav-toggle { display: none; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 0.5rem 0.9rem; font: inherit; cursor: pointer; }

/* Héros */
.hero { background: linear-gradient(160deg, #0f7c8c 0%, #0a5a67 100%); color: #fff; padding: clamp(3rem, 9vw, 5.5rem) 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 600; opacity: 0.85; margin-bottom: 0.6rem; }
.eyebrow.dark { color: var(--muted); opacity: 1; }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); max-width: 40em; opacity: 0.95; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.5rem 0 1rem; align-items: center; }
.hero .cta-row { margin-bottom: 2rem; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; padding: 0; margin: 0; }
.facts li { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: var(--radius); padding: 0.8rem 1.1rem; display: flex; flex-direction: column; min-width: 150px; }
.facts strong { font-size: 1.15rem; }
.facts span { font-size: 0.85rem; opacity: 0.9; }

/* Boutons */
.btn { display: inline-block; background: #fff; color: var(--brand-dark); border: 2px solid #fff; padding: 0.7rem 1.3rem; border-radius: 999px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--tint); border-color: var(--tint); }
.btn-ghost { background: transparent; color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); border-color: #fff; }
.section .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.section .btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.section .btn-ghost { background: transparent; color: var(--brand-dark); border-color: var(--brand); }
.section .btn-ghost:hover { background: var(--tint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn[hidden] { display: none; }
.btn.small { padding: 0.45rem 1rem; font-size: 0.9rem; }

/* Sections */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section.alt { background: #eef5f7; }
.intro { color: var(--muted); max-width: 46em; margin-bottom: 1.5rem; }
.note, .meta-line { color: var(--muted); font-size: 0.92rem; }
.meta-line { margin: 0 0 0.6rem; }

.grid { display: grid; gap: 1.2rem; margin-bottom: 1.2rem; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.card p:last-child { margin-bottom: 0; }

.callout { background: var(--tint); border-left: 5px solid var(--brand); border-radius: 10px; padding: 1.1rem 1.4rem; margin: 1.2rem 0; }
.callout p { margin: 0 0 0.6rem; }
.callout p:last-child { margin-bottom: 0; }

.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding-left: 1.6rem; position: relative; margin-bottom: 0.4rem; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.bullets { padding-left: 1.2rem; margin: 0 0 1em; }
.bullets li { margin-bottom: 0.35rem; }
.steps-list { padding-left: 1.4rem; margin: 0 0 1em; }
.steps-list li { margin-bottom: 0.35rem; }

.step { position: relative; padding-top: 2.4rem; }
.num { position: absolute; top: -14px; left: 1.2rem; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; }

/* Modules */
.mod-card { display: flex; flex-direction: column; }
.mod-card .btn { align-self: flex-start; margin-top: auto; }
.mod-card.locked { opacity: 0.85; }
.mod-top { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.num-pill { background: var(--tint); color: var(--brand-dark); font-weight: 700; font-size: 0.78rem; padding: 0.15rem 0.7rem; border-radius: 999px; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; }
.badge-free { background: var(--ok-bg); color: var(--ok); }
.badge-premium { background: var(--mid-bg); color: var(--mid); }
.mini { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 0.4rem 0 0.4rem; }
.bar-track { height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--brand); transition: width 0.3s ease; }

.back { display: inline-block; margin-bottom: 0.8rem; text-decoration: none; font-weight: 600; }
.mod-head { margin-bottom: 1.2rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; border-bottom: 2px solid var(--line); margin-bottom: 1.5rem; }
.tab { padding: 0.6rem 1rem; text-decoration: none; color: var(--ink); border-radius: 10px 10px 0 0; font-weight: 500; }
.tab:hover { background: var(--tint); }
.tab.active { background: var(--brand); color: #fff; }

.fiche { max-width: 780px; }
.fiche-sec { margin: 2rem 0; }
.fiche-sec h2 { font-size: 1.4rem; }
.objectives, .keybox { margin: 1rem 0; }
.keybox { border-left: 5px solid var(--brand); }

.locked-box { max-width: 640px; text-align: center; margin: 1.5rem auto; }

/* Exercices */
.exos { max-width: 820px; }
.exo { margin-bottom: 1.5rem; }
.exo-prompt { color: var(--muted); }
.exo-rows { display: grid; gap: 0.8rem; }
.exo-row { border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; background: #fff; }
.exo-row.ok { border-color: var(--ok); background: var(--ok-bg); }
.exo-row.ko { border-color: var(--ko); background: var(--ko-bg); }
.exo-main { display: flex; gap: 0.8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.exo-main label { flex: 1 1 320px; min-width: 0; font-weight: 500; }
.exo-main select { flex: 0 1 360px; max-width: 100%; font: inherit; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.exo-why { margin: 0.5rem 0 0; font-size: 0.93rem; }
.exo-why[hidden] { display: none; }
.exo-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1rem; }
.exo-msg { margin: 0; font-weight: 600; }
textarea { width: 100%; font: inherit; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); resize: vertical; }
.exo-solution { margin-top: 1rem; }
.exo-solution[hidden] { display: none; }
.model { white-space: pre-wrap; font: inherit; background: var(--tint); border-radius: 10px; padding: 0.9rem 1.1rem; margin: 0 0 1rem; }
.criteria { list-style: none; padding: 0; margin: 0; }
.criteria li { margin-bottom: 0.4rem; }
.criteria label { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.criteria input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; accent-color: var(--brand); flex: none; }

/* Quiz et situations */
.quiz, .scen { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); max-width: 780px; }
.quiz:empty { display: none; }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.8rem; }
.quiz h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.scen-text { font-size: 1.1rem; font-weight: 600; }
.tagline { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; color: var(--muted); font-weight: 700; margin-bottom: 0.3rem; }
.options { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.option { width: 100%; text-align: left; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 0.75rem 1rem; cursor: pointer; }
.option:hover:not(:disabled) { border-color: var(--brand); background: var(--tint); }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.wrong { border-color: var(--ko); background: var(--ko-bg); }
.option.mid { border-color: var(--mid); background: var(--mid-bg); }
.feedback { border-radius: 10px; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.feedback.ok { background: var(--ok-bg); color: #0f4d2d; }
.feedback.ko { background: var(--ko-bg); color: #7a1914; }
.result { text-align: center; }
.result .score { font-size: 3rem; font-weight: 800; color: var(--brand-dark); margin: 0; }
.result .cta-row { justify-content: center; }
.review { text-align: left; margin-top: 1.5rem; }
.review-item { border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.8rem; }
.review-q { font-weight: 600; margin-bottom: 0.3rem; }
.review-why { color: var(--muted); }

/* Glossaire */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: center; margin-bottom: 0.8rem; }
.filters label { font-weight: 600; }
.filters input, .filters select { font: inherit; padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.filters input { flex: 1 1 240px; min-width: 0; }
.count { color: var(--muted); font-size: 0.9rem; }
.glossary { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 0; }
.glossary .entry { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.glossary dt { font-weight: 700; display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; }
.glossary .tag { font-size: 0.72rem; font-weight: 600; color: var(--brand-dark); background: var(--tint); padding: 0.1rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.glossary dd { margin: 0.35rem 0 0; color: var(--muted); }
.empty { grid-column: 1 / -1; color: var(--muted); }

/* Progression */
.overall { margin-bottom: 1.5rem; }
#overall-text { margin: 0.4rem 0 0; font-weight: 600; }
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.ptable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.ptable th, .ptable td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; }
.ptable thead th { background: var(--tint); font-size: 0.9rem; }
.skill-card h3 { font-size: 1rem; }
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li { margin-bottom: 0.5rem; }
.skill-list label { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; font-size: 0.95rem; }
.skill-list input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; accent-color: var(--brand); flex: none; }

/* Liens et pied de page */
.links { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 0.8rem; }
.links li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.2rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; }
.links a { font-weight: 700; }
.links span { color: var(--muted); }
.site-footer { background: var(--ink); color: #cfe1e5; padding: 1.5rem 0; font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.4rem; }
.site-footer a { color: #fff; }

.legal { max-width: 780px; }
.legal h2 { margin-top: 1.8rem; }
.todo { background: #fff4d6; padding: 0 0.3rem; border-radius: 4px; }

/* Mobile */
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); padding: 0.5rem 1rem 1rem; }
  .nav.open { display: flex; }
  .nav a { padding: 0.8rem 0.5rem; }
  .exo-main select { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-fill { transition: none; }
}

/* ===== Extensions v2 ===== */
.page-title { margin-bottom: 1rem; }
.h3 { font-size: 1.1rem; margin: 0 0 0.5em; }
.section.tight { padding-top: 0; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.muted { color: var(--muted); }
.nav a[aria-current="page"] { background: var(--tint); font-weight: 600; }

.callout.warn { background: #fff6e0; border-left-color: #d98a00; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; font-size: 0.85rem; }
.tag { font-size: 0.72rem; font-weight: 600; color: var(--brand-dark); background: var(--tint); padding: 0.15rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.link-card { display: block; text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,50,58,.08), 0 8px 20px rgba(20,50,58,.1); }
.link-card h3 { color: var(--brand-dark); }
.link-card p { margin-bottom: 0; }

.stat { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.2rem; }
.stat strong { font-size: 1.6rem; color: var(--brand-dark); }
.stat span { color: var(--muted); font-size: 0.9rem; }

.back { display: inline-block; margin-bottom: 1rem; font-weight: 600; }
.chip { font: inherit; border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.filters[role="group"] { margin-bottom: 1.2rem; }

.fiche-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1rem; }
.fiche-section h3 { color: var(--brand-dark); }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

.ex-list { list-style: none; counter-reset: ex; padding: 0; margin: 0 0 1.2rem; display: grid; gap: 0.7rem; }
.ex-item { counter-increment: ex; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem 0.9rem 3rem; position: relative; }
.ex-item::before { content: counter(ex); position: absolute; left: 0.9rem; top: 0.9rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--tint); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; }
.ex-item.ok { border-color: var(--ok); background: var(--ok-bg); }
.ex-item.ko { border-color: var(--ko); background: var(--ko-bg); }
.ex-line select { font: inherit; margin: 0.2rem 0.3rem; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
.ex-line > span { display: block; margin-bottom: 0.3rem; }
.ex-fb { margin-top: 0.4rem; font-size: 0.92rem; }
.ex-result { text-align: center; margin-top: 1.2rem; }
.ex-result .score, .quiz .score { font-size: 3rem; font-weight: 800; color: var(--brand-dark); margin: 0; }

.feedback.mid { background: #fff6e0; color: #6b4600; }
.option.wrong { border-color: var(--ko); background: var(--ko-bg); }
.quiz .level { font-size: 1.2rem; font-weight: 700; margin: 0.2rem 0; }
.quiz.result { text-align: center; }
.checks.left { text-align: left; max-width: 34em; margin: 0 auto 1.2rem; }
.review { list-style: none; padding: 0; margin: 0 0 1.2rem; text-align: left; display: grid; gap: 0.7rem; }
.review li { background: var(--ko-bg); border-radius: 10px; padding: 0.7rem 1rem; }
.quiz .filters { margin-bottom: 1rem; }

/* Mobile : les listes déroulantes ne doivent jamais dépasser l'écran */
.filters select, .quiz select { max-width: 100%; min-width: 0; }
.filters { min-width: 0; }
.filters > * { max-width: 100%; }

/* ===== Accès payant ===== */
.auth-slot { display: flex; align-items: center; gap: 0.6rem; margin-left: 0.4rem; }
.nav-account { font-size: 0.95rem; }
.small-btn { padding: 0.4rem 1rem; font-size: 0.9rem; background: var(--brand); border-color: var(--brand); color: #fff; }
.small-btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.tags { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.tag.free { background: var(--ok-bg); color: var(--ok); }
.tag.premium { background: #fff1d6; color: #7a4a00; }
.gate { background: #fff; border: 2px dashed var(--brand); border-radius: var(--radius); padding: 1.3rem; margin-top: 1.2rem; }
.gate h3 { color: var(--brand-dark); }
.price-card .price { font-size: 2.6rem; font-weight: 800; color: var(--brand-dark); margin: 0.2rem 0; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0.8rem 0; font-size: 0.93rem; cursor: pointer; }
.consent input { margin-top: 0.25rem; width: 1.1rem; height: 1.1rem; accent-color: var(--brand); flex: none; }
.form-msg { color: var(--ko); font-weight: 600; min-height: 1.4em; }
.legal-links { margin-top: 0.6rem; font-size: 0.85rem; }
.legal-links a { color: #cfe1e5; }
.legal-links a:hover { color: #fff; }
@media (max-width: 820px) {
  .auth-slot { margin: 0.5rem 0.5rem 0; flex-wrap: wrap; }
}
