/* ═══════════════════════════════════════════════════════
   Duolingo-inspired design system
═══════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Brand palette */
  --green:      #6C63FF;
  --green-dk:   #4B44CC;
  --green-lt:   #ECEAFF;
  --blue:       #1CB0F6;
  --blue-dk:    #0499DB;
  --blue-lt:    #DDF4FF;
  --purple:     #CE82FF;
  --purple-dk:  #9C31D4;
  --purple-lt:  #F1E3FF;
  --yellow:     #FFD900;
  --yellow-dk:  #CE9A00;
  --yellow-lt:  #FFF9C4;
  --red:        #FF4B4B;
  --red-dk:     #EA2B2B;
  --red-lt:     #FFEBEB;
  --orange:     #FF9600;
  --orange-dk:  #DB7900;
  --orange-lt:  #FEECCC;

  /* Neutrals */
  --bg:    #FFFCE8;
  --s1:    #FFFFFF;
  --s2:    #F7F7F7;
  --s3:    #EBEBEB;
  --ink:   #3C3C3C;
  --muted: #777777;
  --faint: #AFAFAF;
  --line:  #E5E5E5;
  --line2: #AFAFAF;

  /* Accent = indigo */
  --accent:    var(--green);
  --accent-dk: var(--green-dk);
  --accent-lt: var(--green-lt);

  /* Shadows */
  --sh1: 0 2px 8px rgba(0,0,0,0.08);
  --sh2: 0 4px 16px rgba(0,0,0,0.1);
  --sh3: 0 8px 32px rgba(0,0,0,0.12);

  /* Shape */
  --r:   20px;
  --rmd: 14px;
  --rsm: 10px;

  --hh:  64px;
  --max: 1080px;
  --px:  20px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:    #1a1a1a;
  --s1:    #2a2a2a;
  --s2:    #323232;
  --s3:    #3c3c3c;
  --ink:   #FFFFFF;
  --muted: #AFAFAF;
  --faint: #6a6a6a;
  --line:  rgba(255,255,255,0.1);
  --line2: rgba(255,255,255,0.2);
  --sh1: 0 2px 8px rgba(0,0,0,0.4);
  --sh2: 0 4px 16px rgba(0,0,0,0.4);
  --sh3: 0 8px 32px rgba(0,0,0,0.5);
}

/* ═══════════════════════════════════════════════════════
   Reset
═══════════════════════════════════════════════════════ */

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Nunito, Inter, system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 200ms, color 200ms;
}

body.menu-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; cursor: pointer; }

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

/* ═══════════════════════════════════════════════════════
   Header
═══════════════════════════════════════════════════════ */

.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--hh);
  background: var(--s1);
  border-bottom: 2px solid var(--line);
}

[data-theme="dark"] .site-header {
  background: var(--s1);
  border-bottom-color: var(--line);
}

.site-header__inner {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  height: 100%;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 var(--px);
}

/* Brand */
.brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--green-dk);
  box-shadow: 0 3px 0 var(--green-dk);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.9rem; font-weight: 900;
  flex-shrink: 0;
}

.brand strong {
  font-size: 1.05rem; font-weight: 900; line-height: 1;
  display: block; color: var(--ink);
}
.brand small {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted); display: block; margin-top: 1px;
}

/* Header right */
.header-right { display: flex; align-items: center; gap: 8px; }

.account-link {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 2px solid var(--line); border-radius: 50%;
  background: var(--s1); color: var(--muted);
  transition: border-color 150ms, color 150ms, transform 80ms;
}
.account-link:hover { border-color: var(--green); color: var(--green); }
.account-link:active { transform: translateY(2px); }
.account-link svg { width: 18px; height: 18px; }

/* Theme toggle */
.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 2px solid var(--line); border-radius: 50%;
  background: var(--s1); color: var(--muted);
  transition: border-color 150ms, color 150ms;
}
.theme-toggle:hover { border-color: var(--green); color: var(--green); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* Hamburger */
.menu-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 2px solid var(--line); border-radius: var(--rsm);
  background: var(--s1); color: var(--ink);
  position: relative; z-index: 30;
}
.menu-toggle__bar {
  display: block; width: 16px; height: 2px;
  background: currentColor; border-radius: 99px; margin: 2px 0;
  transition: transform 180ms, opacity 180ms;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile nav */
.main-nav {
  position: fixed;
  top: calc(var(--hh) + 8px); left: 12px; right: 12px;
  display: grid; gap: 4px; padding: 8px;
  border: 2px solid var(--line); border-radius: var(--r);
  background: var(--s1); box-shadow: var(--sh3);
  opacity: 0; pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 180ms, transform 180ms;
  z-index: 30;
}
body.menu-open .main-nav { opacity: 1; pointer-events: auto; transform: none; }
.main-nav a {
  display: block; padding: 12px 14px; border-radius: var(--rsm);
  color: var(--muted); font-size: 0.9rem; font-weight: 800;
  transition: background 120ms, color 120ms;
}
.main-nav a:hover { background: var(--s2); color: var(--ink); }

main { outline: none; }

/* ═══════════════════════════════════════════════════════
   Transitions & stagger
═══════════════════════════════════════════════════════ */

.view { animation: view-in 300ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-stagger] > * {
  animation: stagger-in 350ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   Layout helpers
═══════════════════════════════════════════════════════ */

.wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 var(--px);
}

/* Eyebrow */
.eyebrow {
  display: inline-flex; align-items: center; margin: 0;
  color: var(--green); font-size: 1rem; font-weight: 900;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding-top: 20px;
  color: var(--muted); font-size: 0.94rem; font-weight: 800;
  transition: color 140ms;
  -webkit-tap-highlight-color: transparent;
}
.back-link:hover { color: var(--ink); }
.back-link svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 800;
  background: var(--s2); color: var(--muted);
  border: 2px solid var(--line);
  white-space: nowrap;
}
.badge--ok   { background: #D7FFB8;  color: #3A8500;  border-color: #3A8500; }
.badge--warn { background: var(--yellow-lt); color: #1a1a1a; border-color: var(--yellow-dk); }
.badge--tc   { background: var(--blue-lt);   color: var(--blue-dk);   border-color: var(--blue-dk); }
.badge--sp   { background: var(--purple-lt); color: var(--purple-dk); border-color: var(--purple-dk); }

/* ═══════════════════════════════════════════════════════
   Home
═══════════════════════════════════════════════════════ */

.home { min-height: calc(100svh - var(--hh)); display: flex; flex-direction: column; }

.home-intro { padding: 48px var(--px) 32px; }

.home-intro h1 {
  margin: 14px 0 0;
  font-size: clamp(3rem, 14vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.home-intro__sub {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 700;
  line-height: 1.6;
  max-width: 460px;
}

.home-section {
  padding: 8px var(--px) 34px;
}

.home-section + .home-section {
  padding-top: 10px;
  border-top: 2px solid var(--line);
}

.home-section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.home-section__head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  font-weight: 900;
  line-height: 1;
}

.home-card-grid {
  display: grid;
  gap: 12px;
}

/* Level cards — Duolingo 3D press */
.level-nav {
  display: grid; gap: 12px;
  padding: 4px var(--px) 56px;
}

.level-card {
  --c:  #58CC02;
  --cs: #58A700;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 190px;
  padding: 24px 22px 20px;
  border-radius: var(--r);
  background: var(--c);
  border: 2px solid var(--cs);
  box-shadow: 0 6px 0 var(--cs);
  color: #fff;
  text-decoration: none;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1), filter 160ms ease;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  isolation: isolate;
}
/* Gloss overlay */
.level-card::before {
  content: '';
  position: absolute; z-index: 0;
  top: 0; left: 0; right: 0; height: 50%;
  background: rgba(255,255,255,0.12);
  border-radius: var(--r) var(--r) 60% 60%;
  pointer-events: none;
}
.level-card > * { position: relative; z-index: 1; }
.level-card:hover  { filter: brightness(1.04); transform: translateY(-4px) rotate(-0.6deg); box-shadow: 0 10px 0 var(--cs); }
.level-card:active { transform: translateY(6px) rotate(0deg); box-shadow: 0 0 0 var(--cs); }
.level-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.level-card__lbl {
  font-size: 0.75rem; font-weight: 900;
  letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.75;
}

.level-card h2 {
  margin: 10px 0 0;
  font-size: clamp(2.4rem, 10vw, 3.8rem);
  font-weight: 900; line-height: 0.88;
  letter-spacing: 0;
}

.level-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 20px;
}

.level-card__count {
  font-size: 0.92rem; font-weight: 800; opacity: 0.8;
}

.level-card__arrow {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.3);
  transition: transform 200ms;
}
.level-card:hover .level-card__arrow { transform: translateX(3px); }
.level-card__arrow svg { width: 14px; height: 14px; }

.level-card--compact {
  min-height: 164px;
}

.level-card--compact h2 {
  font-size: clamp(2rem, 8vw, 3.1rem);
}

.level-card--bac {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0)),
    var(--c);
}

.home-level-grid .level-card,
.choice-grid .level-card {
  animation:
    stagger-in 350ms cubic-bezier(0.16, 1, 0.3, 1) both,
    card-bob 4.8s ease-in-out infinite;
  animation-delay:
    calc(var(--i, 0) * 55ms),
    calc(650ms + var(--i, 0) * 180ms);
}

.home-level-grid .level-card:hover,
.choice-grid .level-card:hover,
.home-level-grid .level-card:active,
.choice-grid .level-card:active {
  animation-play-state: paused;
}

.level-card--home {
  min-height: 210px;
}

.level-card--choice {
  min-height: 220px;
}

.level-card--choice h2 {
  max-width: 9ch;
  font-size: clamp(2rem, 7vw, 3.2rem);
}

.level-card__spark {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  opacity: 0.72;
  transform: rotate(8deg);
}

.level-card__spark::before,
.level-card__spark::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.72);
  border-radius: 999px;
  box-shadow: 0 12px 0 rgba(255,255,255,0.46), 18px 4px 0 rgba(255,255,255,0.38);
}

.level-card__spark::before {
  width: 24px;
  height: 5px;
  left: 8px;
  top: 12px;
}

.level-card__spark::after {
  width: 5px;
  height: 24px;
  left: 17px;
  top: 3px;
}

@keyframes card-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(0.45deg); }
}

/* ═══════════════════════════════════════════════════════
   Page title
═══════════════════════════════════════════════════════ */

.page-title { padding: 14px 0 28px; }
.page-title h1 {
  margin: 10px 0 0;
  font-size: clamp(2.2rem, 9vw, 4.8rem);
  font-weight: 900; line-height: 0.9;
  letter-spacing: -0.02em;
}
.page-title p {
  margin: 10px 0 0;
  color: var(--muted); font-size: 1.05rem; font-weight: 700;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   Track cards
═══════════════════════════════════════════════════════ */

.track-grid { display: grid; gap: 12px; padding-bottom: 36px; }

.track-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border: 2px solid var(--line); border-radius: var(--r);
  background: var(--s1);
  box-shadow: 0 4px 0 var(--line);
  text-decoration: none; color: inherit;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 150ms;
  -webkit-tap-highlight-color: transparent;
}
.track-card:hover  { border-color: var(--accent); }
.track-card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }

.track-card__icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: var(--rmd);
  background: var(--green-lt);
  border: 2px solid var(--green-dk);
  font-size: 1.1rem; font-weight: 900; color: var(--green-dk);
}

.track-card__body { flex: 1; min-width: 0; }
.track-card__body h2 { margin: 0; font-size: 1.25rem; font-weight: 900; }
.track-card__body p  { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; font-weight: 700; }

.track-card__arrow { color: var(--faint); flex-shrink: 0; transition: color 150ms; }
.track-card__arrow svg { width: 16px; height: 16px; display: block; }
.track-card:hover .track-card__arrow { color: var(--accent); }

.bac-track-grid {
  display: grid;
  gap: 12px;
  padding-bottom: 48px;
}

.bac-track-card .track-card__body p {
  max-width: 560px;
}

/* ═══════════════════════════════════════════════════════
   Filter bar
═══════════════════════════════════════════════════════ */

.filter-bar {
  position: sticky; top: var(--hh); z-index: 20;
  padding: 12px 0 16px;
  background: var(--bg);
  display: grid; gap: 10px;
  margin: 0 calc(-1 * var(--px));
  padding-left: var(--px); padding-right: var(--px);
  border-bottom: 2px solid var(--line);
}

.filter-search { position: relative; }

.filter-search input {
  width: 100%; height: 48px;
  padding: 0 14px 0 42px;
  border: 2px solid var(--line); border-radius: var(--rmd);
  background: var(--s1); color: var(--ink);
  font-size: 1rem; font-weight: 700; outline: none;
  transition: border-color 150ms;
}
.filter-search input::placeholder { color: var(--faint); font-weight: 700; }
.filter-search input:focus { border-color: var(--blue); }

.filter-search::before {
  content: ''; position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  border: 2px solid var(--faint); border-radius: 50%;
  pointer-events: none;
}
.filter-search::after {
  content: ''; position: absolute; left: 27px; top: 28px;
  width: 7px; height: 2px;
  background: var(--faint); transform: rotate(45deg);
  pointer-events: none;
}

.filter-tabs {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.ftab {
  flex-shrink: 0;
  height: 40px; padding: 0 18px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--s1); color: var(--muted);
  font-size: 0.9rem; font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 80ms, box-shadow 80ms, border-color 150ms, background 150ms, color 150ms;
}
.ftab:hover { border-color: var(--line2); color: var(--ink); }
.ftab:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.ftab.active {
  background: var(--green); border-color: var(--green-dk);
  color: #fff; box-shadow: 0 3px 0 var(--green-dk);
}
.ftab.active:active { transform: translateY(3px); box-shadow: 0 0 0 var(--green-dk); }

.bac-filter-bar {
  margin-bottom: 20px;
  grid-template-columns: 1fr;
  align-items: end;
}

.bac-filter-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.bac-filter-control select {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 38px 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  outline: none;
}

.bac-filter-control select:focus {
  border-color: var(--blue);
}

.filter-reset {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 80ms, box-shadow 80ms, border-color 150ms, color 150ms;
}

.filter-reset:hover {
  border-color: var(--line2);
  color: var(--ink);
}

.filter-reset:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--line);
}

.bac-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
}

.bac-table-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.bac-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  padding-bottom: 8px;
  margin-bottom: 56px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
  scrollbar-color: var(--blue) var(--s2);
  scrollbar-width: thin;
}

.bac-table-wrap:focus-visible,
.fiche-table-wrap:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.bac-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

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

.bac-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--blue);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: none;
  box-shadow: inset 0 -2px 0 var(--blue-dk);
}

.bac-table tbody tr:last-child td {
  border-bottom: none;
}

.bac-table td {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.bac-table__col--matiere { width: 30%; }
.bac-table__col--centre_examen { width: 44%; }
.bac-table__col--sujet,
.bac-table__col--corrige {
  width: 104px;
  text-align: center;
}

.bac-table__action {
  white-space: nowrap;
}

.bac-table__button {
  --button-shadow: var(--green-dk);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--green);
  border: 2px solid var(--green-dk);
  box-shadow: 0 3px 0 var(--button-shadow);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 150ms ease;
}

.bac-table__button--corrige {
  --button-shadow: var(--orange-dk);
  background: var(--orange);
  border-color: var(--orange-dk);
}

.bac-table__button:hover {
  filter: brightness(1.05);
}

.bac-table__button:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--button-shadow);
}

/* ═══════════════════════════════════════════════════════
   Subject cards
═══════════════════════════════════════════════════════ */

.subject-list { display: grid; gap: 10px; padding-bottom: 48px; margin-top: 16px; }

.subject-card {
  --c: var(--green);
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
  text-decoration: none; color: inherit;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 150ms;
  -webkit-tap-highlight-color: transparent;
}
.subject-card:hover { border-color: var(--c); }
.subject-card:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }

.subject-card__icon {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: var(--rsm);
  border: 2px solid var(--c);
  background: var(--s2);
  color: var(--c); font-size: 0.88rem; font-weight: 900;
}
.subject-card__icon::before {
  content: ''; position: absolute; inset: 0;
  background: var(--c); opacity: 0.1;
}

.subject-card__body { flex: 1; min-width: 0; }
.subject-card__body h3 { margin: 0; font-size: 1.08rem; font-weight: 900; line-height: 1.25; }
.subject-card__meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.subject-card__arr { color: var(--faint); flex-shrink: 0; transition: color 150ms; }
.subject-card__arr svg { width: 14px; height: 14px; display: block; }
.subject-card:hover .subject-card__arr { color: var(--c); }

.empty-state {
  padding: 36px 20px;
  border: 2px dashed var(--line); border-radius: var(--r);
  color: var(--muted); font-size: 0.9rem; font-weight: 700;
  text-align: center; line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════
   Subject banner
═══════════════════════════════════════════════════════ */

.subject-banner {
  --c: var(--green);
  padding: 0 0 24px;
  background: var(--s1);
  border-bottom: 2px solid var(--line);
  position: relative; overflow: hidden;
}
.subject-banner::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--c);
}

.subject-banner__inner {
  display: flex; align-items: flex-start; gap: 18px;
  padding-top: 28px;
}

.subject-banner__icon {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  width: 68px; height: 68px; flex-shrink: 0;
  border-radius: var(--rmd);
  background: var(--s2);
  border: 2px solid var(--c);
  box-shadow: 0 4px 0 var(--c);
  color: var(--c); font-size: 0.9rem; font-weight: 900;
}
.subject-banner__icon::before {
  content: ''; position: absolute; inset: 0;
  background: var(--c); opacity: 0.08;
}

.subject-banner__body { flex: 1; min-width: 0; }
.subject-banner__body h1 {
  margin: 10px 0 0;
  font-size: clamp(2rem, 8vw, 4.2rem);
  font-weight: 900; line-height: 0.9;
  letter-spacing: -0.02em;
}
.subject-banner__body p {
  margin: 12px 0 0;
  color: var(--muted); font-size: 1.05rem; font-weight: 700;
  line-height: 1.65; max-width: 520px;
}

.subject-meta-row {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 16px var(--px) 0;
  width: min(100%, var(--max)); margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════
   Chapter list
═══════════════════════════════════════════════════════ */

.chapter-section {
  padding: 32px var(--px) 56px;
  width: min(100%, var(--max)); margin: 0 auto;
}

.chapter-section__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.chapter-section__head h2 { margin: 0; font-size: 1.2rem; font-weight: 900; }

.chapter-list { display: grid; gap: 10px; }


.chapter-num {
  display: grid; place-items: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--green-lt);
  border: 2px solid var(--green-dk);
  color: var(--green-dk);
  font-size: 0.74rem; font-weight: 900;
}

.chapter-body { flex: 1; min-width: 0; }
.chapter-body h3 { margin: 0; font-size: 1.08rem; font-weight: 900; line-height: 1.3; }
.chapter-body p  { margin: 5px 0 0; color: var(--muted); font-size: 0.95rem; font-weight: 700; line-height: 1.55; }
.chapter-res { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════
   Footer
═══════════════════════════════════════════════════════ */

.footer {
  padding: 28px var(--px) 48px;
  border-top: 2px solid var(--line);
}
.footer__inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  width: min(100%, var(--max)); margin: 0 auto;
  color: var(--faint); font-size: 0.9rem; font-weight: 700;
}

.footer-links {
  display: flex; gap: 16px;
}
.footer-links a {
  color: var(--faint); font-size: 0.85rem; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
  transition: color 140ms;
}
.footer-links a:hover { color: var(--muted); }

/* ═══════════════════════════════════════════════════════
   Account page
═══════════════════════════════════════════════════════ */

.account-page {
  padding-top: 8px;
  padding-bottom: 64px;
}

.account-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 48px;
}

.account-panel {
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
}

.account-panel--active {
  border-color: var(--green);
  box-shadow: 0 3px 0 var(--green-dk);
}

.account-panel h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 900;
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.account-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s1);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  outline: none;
  cursor: text;
}

.account-form input:focus {
  border-color: var(--blue);
}

.account-form .btn-primary {
  width: 100%;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════
   Legal pages
═══════════════════════════════════════════════════════ */

.legal-page {
  padding-top: 8px; padding-bottom: 64px;
  max-width: 720px;
}
.legal-page h1 {
  margin: 20px 0 8px;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 900; line-height: 1;
}
.legal-date {
  margin: 0 0 36px;
  color: var(--muted); font-size: 0.9rem; font-weight: 700;
}
.legal-page section {
  margin-bottom: 32px;
}
.legal-page h2 {
  margin: 0 0 10px;
  font-size: 1.15rem; font-weight: 900;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.legal-page p {
  margin: 0;
  color: var(--muted); font-size: 1rem; line-height: 1.75; font-weight: 700;
}

/* ═══════════════════════════════════════════════════════
   Chapter item (clickable)
═══════════════════════════════════════════════════════ */

.chapter-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px;
  border: 2px solid var(--line); border-radius: var(--rmd);
  background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
  transition: border-color 150ms, transform 80ms, box-shadow 80ms;
  text-decoration: none; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.chapter-item:hover  { border-color: var(--line2); }
.chapter-item:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.chapter-item--soon  { opacity: 0.6; pointer-events: none; }

/* ═══════════════════════════════════════════════════════
   Fiche de cours
═══════════════════════════════════════════════════════ */

.fiche-banner {
  --c: var(--accent);
  padding: 28px 0 24px;
  background: var(--s1);
  border-bottom: 2px solid var(--line);
  position: relative;
}
.fiche-banner::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--c);
}
.fiche-banner__inner {
  display: flex; align-items: flex-start; gap: 18px;
}
.fiche-banner__icon {
  display: grid; place-items: center;
  width: 60px; height: 60px; flex-shrink: 0;
  border-radius: var(--rmd);
  background: var(--s2);
  border: 2px solid currentColor;
  font-size: 0.9rem; font-weight: 900;
}
.fiche-banner h1 {
  margin: 10px 0 0;
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  font-weight: 900; line-height: 1;
  letter-spacing: -0.02em;
}
.fiche-meta-row {
  display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px;
}

.fiche-body {
  padding: 40px var(--px) 56px;
  display: flex; flex-direction: column; gap: 40px;
}

.fiche-section {
  display: flex; flex-direction: column; gap: 18px;
}
.fiche-section__title {
  margin: 0;
  font-size: 1.25rem; font-weight: 900;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
}
.fiche-section__content {
  display: flex; flex-direction: column; gap: 14px;
  font-size: 1rem; line-height: 1.7;
}
.fiche-section__content p { margin: 0; }
.fiche-section__content ol,
.fiche-section__content ul { margin: 0; padding-left: 1.4em; }
.fiche-section__content strong { color: var(--ink); }

.fiche-subhead {
  margin: 6px 0 2px;
  font-size: 1rem; font-weight: 900; color: var(--muted);
}

/* Definition boxes */
.fiche-def {
  display: flex; flex-direction: column; gap: 0;
  border: 2px solid var(--line); border-radius: var(--rmd);
  overflow: hidden;
}
.fiche-def__item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.fiche-def__item:last-child { border-bottom: none; }
.fiche-def__term {
  font-size: 0.88rem; font-weight: 900;
  color: var(--green); text-transform: uppercase; letter-spacing: 0.04em;
}
.fiche-def__body {
  font-size: 0.97rem; color: var(--ink); line-height: 1.6;
}

/* Alert / "À retenir" box */
.fiche-alert {
  padding: 14px 18px;
  background: var(--yellow-lt);
  border: 2px solid var(--yellow-dk);
  border-radius: var(--rmd);
  color: #1a1a1a;
  font-size: 0.95rem; line-height: 1.65;
}
.fiche-alert strong { color: #1a1a1a; }

/* Literary example */
.fiche-example {
  padding: 18px 20px;
  background: var(--s2);
  border: 2px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--rmd);
}
.fiche-example__label {
  font-size: 0.78rem; font-weight: 900;
  color: var(--green); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 10px;
}
.fiche-example blockquote {
  margin: 0 0 10px;
  padding: 0 0 0 14px;
  border-left: 3px solid var(--line2);
  color: var(--ink); font-style: italic;
  font-size: 1rem; line-height: 1.6;
}
.fiche-example p { margin: 0; font-size: 0.93rem; color: var(--muted); line-height: 1.6; }

/* Table */
.fiche-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border-radius: var(--rmd);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--blue) var(--s2);
  scrollbar-width: thin;
}
.fiche-table {
  width: 100%; min-width: 620px; border-collapse: collapse;
  font-size: 0.92rem; line-height: 1.5;
}
.fiche-table th {
  background: var(--s2);
  padding: 10px 14px;
  text-align: left; font-size: 0.82rem; font-weight: 900;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--line);
}
.fiche-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.fiche-table tbody tr:last-child td { border-bottom: none; }
.fiche-table tbody tr:nth-child(even) td { background: var(--s2); }

/* Steps list */
.fiche-steps {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 100%;
  align-self: stretch; box-sizing: border-box;
  margin: 0; padding: 0; list-style: none;
  counter-reset: fiche-step;
}
.fiche-steps > ol,
.fiche-steps > ul {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 100%;
  margin: 0; padding: 0; list-style: none;
  counter-reset: fiche-step;
}
.fiche-steps li,
.fiche-steps > div {
  position: relative;
  display: block;
  width: 100%; max-width: 100%;
  min-width: 0; box-sizing: border-box;
  padding: 14px 16px 14px 56px;
  background: var(--s1);
  border: 2px solid var(--line); border-radius: var(--rmd);
  font-size: 0.97rem; line-height: 1.6;
  overflow-wrap: break-word;
  counter-increment: fiche-step;
}
.fiche-steps li::before,
.fiche-steps > div::before {
  content: counter(fiche-step);
  position: absolute; left: 16px; top: 15px;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.82rem; font-weight: 900;
}

/* ── Diagrams & Schemas ─────────────────────────────── */

.fiche-diagram {
  margin: 24px 0;
  background: var(--s1);
  border: 2px solid var(--line);
  border-radius: var(--rlg);
  overflow: hidden;
}
.fiche-diagram__label {
  padding: 10px 20px 0;
  font-size: 0.78rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.fiche-diagram__body {
  padding: 18px 20px 20px;
  overflow-x: auto;
}
.fiche-diagram svg {
  display: block; max-width: 100%; height: auto;
}

/* Timeline */
.fiche-timeline {
  display: flex; flex-direction: column; gap: 0;
  padding: 4px 0;
}
.fiche-timeline__item {
  display: grid;
  grid-template-columns: 90px 16px 1fr;
  gap: 0 12px;
  align-items: stretch;
}
.fiche-timeline__year {
  text-align: right;
  padding: 12px 0;
  font-size: 0.82rem; font-weight: 800;
  color: var(--green);
  white-space: nowrap;
  line-height: 1.4;
}
.fiche-timeline__dot {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.fiche-timeline__dot::before {
  content: '';
  width: 12px; height: 12px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--green);
  margin-top: 14px;
}
.fiche-timeline__dot::after {
  content: '';
  flex: 1; width: 2px;
  background: var(--line);
}
.fiche-timeline__item:last-child .fiche-timeline__dot::after { display: none; }
.fiche-timeline__body {
  padding: 10px 0 18px;
}
.fiche-timeline__body strong { display: block; font-size: 0.97rem; color: var(--ink); }
.fiche-timeline__body span { font-size: 0.88rem; color: var(--muted); line-height: 1.5; }

/* Process flow */
.fiche-process {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.fiche-process__step {
  flex: 1; min-width: 120px;
  padding: 12px 14px;
  background: var(--s2);
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  font-size: 0.9rem; font-weight: 700; text-align: center;
  color: var(--ink);
}
.fiche-process__step small {
  display: block; font-size: 0.78rem; font-weight: 400;
  color: var(--muted); margin-top: 4px;
}
.fiche-process__arrow {
  font-size: 1.2rem; color: var(--green); flex-shrink: 0;
  font-weight: 900;
}

/* Concept grid */
.fiche-concept {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.fiche-concept__item {
  padding: 12px 14px;
  background: var(--s2);
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  font-size: 0.88rem;
}
.fiche-concept__item strong {
  display: block; margin-bottom: 4px;
  font-size: 0.9rem; color: var(--ink);
}
.fiche-concept__item span { color: var(--muted); font-size: 0.83rem; }

/* Formula highlight */
.fiche-formula {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 24px; gap: 8px;
  text-align: center;
}
.fiche-formula__eq {
  font-size: 1.3rem; font-weight: 800;
  color: var(--ink); letter-spacing: .02em;
  font-family: 'Courier New', monospace;
}
.fiche-formula__legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  justify-content: center;
  font-size: 0.82rem; color: var(--muted);
}
.fiche-formula__legend span { font-style: italic; }

/* Compare grid */
.fiche-compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.fiche-compare__col {
  background: var(--s2);
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  overflow: hidden;
}
.fiche-compare__head {
  padding: 10px 14px;
  background: var(--s3, var(--line));
  font-weight: 800; font-size: 0.88rem; color: var(--ink);
}
.fiche-compare__body {
  padding: 10px 14px;
  font-size: 0.87rem; color: var(--muted); line-height: 1.6;
}

/* Quiz CTA */
.fiche-quiz-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 26px 28px;
  background: var(--purple);
  border: 2px solid var(--purple-dk);
  border-radius: var(--r);
  box-shadow: 0 6px 0 var(--purple-dk);
}
.fiche-quiz-cta__text {
  display: flex; flex-direction: column; gap: 4px;
}
.fiche-quiz-cta__text strong {
  font-size: 1.35rem; font-weight: 900; color: #fff;
}
.fiche-quiz-cta__text span {
  font-size: 1.05rem; font-weight: 700; color: rgba(255,255,255,0.85);
}

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 22px;
  background: var(--green); border: 2px solid var(--green-dk);
  box-shadow: 0 4px 0 var(--green-dk);
  border-radius: 999px;
  color: #fff; font-size: 0.95rem; font-weight: 900;
  transition: transform 80ms, box-shadow 80ms, filter 120ms;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover  { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--green-dk); }

.quiz-open-btn { /* same as btn-primary */ }
.quiz-open-btn {
  display: inline-flex; align-items: center;
  height: 46px; padding: 0 22px;
  background: #1a1a1a; border: 2px solid #000;
  box-shadow: 0 4px 0 #000;
  border-radius: 999px;
  color: #fff; font-size: 0.95rem; font-weight: 900;
  transition: transform 80ms, box-shadow 80ms, filter 120ms;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.quiz-open-btn:hover  { filter: brightness(1.15); }
.quiz-open-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #000; }

/* Validation des compétences */
.skill-check {
  display: grid;
  gap: 14px;
  padding: 22px;
  background: var(--s1);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 5px 0 var(--line);
}

.skill-check__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.skill-check__head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.25;
}

.skill-check__head span:not(.skill-check__score) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.skill-check__score {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-lt);
  border: 2px solid var(--blue);
  color: var(--blue-dk);
  font-size: 0.86rem;
  font-weight: 900;
}

.skill-check__progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--s2);
  border: 2px solid var(--line);
}

.skill-check__progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 220ms ease;
}

.skill-check__body {
  min-height: 320px;
}

.skill-check__question {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: var(--rmd);
  background: var(--s2);
}

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

.skill-check__meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--s1);
  border: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.skill-check__prompt {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.5;
}

.skill-check__prompt em {
  font-style: normal;
  color: var(--muted);
}

.skill-check__choices {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.skill-check__choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--rsm);
  background: var(--s1);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.45;
  transition: border-color 140ms, background 140ms;
}

.skill-check__choice input {
  flex-shrink: 0;
}

.skill-check__choice.is-selected {
  border-color: var(--purple-dk);
  background: var(--purple-lt);
  color: var(--purple-dk);
}

.skill-check__statement {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 2px solid var(--yellow-dk);
  border-radius: var(--rsm);
  background: var(--yellow-lt);
  color: #1a1a1a;
}

.skill-check__statement span {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.skill-check__statement strong {
  color: #1a1a1a;
  font-size: 1rem;
  line-height: 1.45;
}

.skill-check__bools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skill-check__bool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
  color: var(--ink);
  font-weight: 900;
}

.skill-check__bool.is-selected {
  border-color: var(--purple-dk);
  background: var(--purple-lt);
  color: var(--purple-dk);
}

.skill-check__choice.is-correct,
.skill-check__bool.is-correct {
  border-color: #3A8500 !important;
  background: #D7FFB8 !important;
  color: #2A6200 !important;
}

.skill-check__choice.is-wrong,
.skill-check__bool.is-wrong {
  border-color: var(--red-dk) !important;
  background: var(--red-lt) !important;
  color: var(--red-dk) !important;
}

.skill-check__feedback {
  padding: 12px 14px;
  border-radius: var(--rsm);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.55;
}

.skill-check__feedback--ok {
  background: #D7FFB8;
  color: #2A6200;
  border: 1.5px solid #3A8500;
}

.skill-check__feedback--err {
  background: var(--red-lt);
  color: var(--red-dk);
  border: 1.5px solid var(--red-dk);
}

.skill-check__foot {
  display: flex;
  justify-content: flex-end;
}

.skill-check__result {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.skill-check__result-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.skill-check__result strong {
  color: var(--ink);
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
}

.skill-check__result strong span {
  color: var(--muted);
  font-size: 1.5rem;
}

.skill-check__result p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 800;
}

/* ── Exercices corrigés ─────────────────── */
.fiche-exercises { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.fiche-exercises__title {
  font-size: 1.35rem; font-weight: 900; color: var(--orange);
  margin-bottom: 4px;
}
.exercise-card {
  border: 2px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: var(--s1);
  box-shadow: 0 3px 0 var(--line);
}
.exercise-card__header {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 0;
  background: var(--s1);
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.exercise-card__header:hover {
  background: var(--s2);
}
.exercise-card.is-open .exercise-card__header {
  border-bottom: 2px solid var(--line);
  background: var(--bg);
}
.exercise-card__heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.exercise-card__num {
  font-size: 0.75rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--orange); white-space: nowrap;
}
.exercise-card__title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.35;
}
.exercise-card__difficulty {
  white-space: nowrap;
  color: var(--yellow-dk);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.exercise-card__chevron {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  transition: transform 160ms ease, color 150ms ease;
}
.exercise-card__chevron svg {
  width: 14px;
  height: 14px;
}
.exercise-card.is-open .exercise-card__chevron {
  color: var(--orange);
  transform: rotate(90deg);
}
.exercise-card__panel {
  animation: exSlideDown 180ms ease;
}
.exercise-card__body { padding: 18px 20px 0; }
.exercise-card__actions { padding: 14px 20px 18px; }
.exercise-reveal-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  background: var(--blue); border: 2px solid #0e8fcf;
  box-shadow: 0 4px 0 #0e8fcf; border-radius: 999px;
  color: #fff; font-size: 0.9rem; font-weight: 900;
  transition: transform 80ms, box-shadow 80ms, filter 120ms;
  -webkit-tap-highlight-color: transparent;
}
.exercise-reveal-btn:hover  { filter: brightness(1.1); }
.exercise-reveal-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #0e8fcf; }
.exercise-reveal-btn.is-open {
  background: var(--muted); border-color: #777; box-shadow: 0 4px 0 #777;
}
.exercise-card__corrige {
  margin: 0 20px 18px; padding: 16px 18px;
  background: #f0fff4; border: 2px solid #3a9d00;
  border-radius: 10px;
  animation: exSlideDown 200ms ease;
  color: #1a5200;
}
@keyframes exSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.exercise-card__corrige-label {
  font-size: 0.75rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.06em; color: #3a9d00; margin-bottom: 10px;
}
.exercise-card__corrige p,
.exercise-card__corrige li { font-size: 0.95rem; line-height: 1.6; }
.exercise-card__corrige table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.9rem; }
.exercise-card__corrige th,
.exercise-card__corrige td { border: 1px solid #c3e6cb; padding: 6px 10px; text-align: center; }
.exercise-card__corrige th { background: #d4edda; font-weight: 800; }

@media (max-width: 479px) {
  .exercise-card__header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
  }
  .exercise-card__difficulty {
    grid-column: 1;
  }
  .exercise-card__chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .exercise-card__body   { padding-left: 14px; padding-right: 14px; }
  .exercise-card__actions { padding-left: 14px; padding-right: 14px; }
  .exercise-card__corrige { margin-left: 0; margin-right: 0; border-radius: 0; border-left: none; border-right: none; }
}

.btn-ghost {
  display: inline-flex; align-items: center;
  height: 46px; padding: 0 22px;
  background: transparent; border: 2px solid var(--line);
  border-radius: 999px;
  color: var(--muted); font-size: 0.95rem; font-weight: 900;
  transition: border-color 150ms, color 150ms;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ═══════════════════════════════════════════════════════
   Account modal
═══════════════════════════════════════════════════════ */

.account-modal {
  display: none;
  position: fixed; inset: 0; z-index: 110;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(4px);
}

.account-modal--open { display: flex; }
body.account-open { overflow: hidden; }

.account-modal__box {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 26px 22px 22px;
  border: 2px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  background: var(--s1);
  box-shadow: var(--sh3);
}

.account-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--s2);
  color: var(--muted);
  transition: border-color 150ms, color 150ms;
}

.account-modal__close:hover {
  border-color: var(--red);
  color: var(--red);
}

.account-modal__close svg {
  width: 14px;
  height: 14px;
}

.account-modal__body {
  padding-right: 34px;
}

.account-modal__body h2 {
  margin: 10px 0 0;
  max-width: 360px;
  font-size: clamp(1.55rem, 6vw, 2.15rem);
  line-height: 1;
  font-weight: 900;
}

.account-modal__body p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
}

.account-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.account-modal__link {
  justify-content: center;
  min-width: 150px;
}

/* ═══════════════════════════════════════════════════════
   Quiz modal
═══════════════════════════════════════════════════════ */

.quiz-modal {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 680px) {
  .quiz-modal { align-items: center; padding: 24px; }
}
.quiz-modal--open { display: flex; }
body.quiz-open { overflow: hidden; }

.quiz-modal__box {
  display: flex; flex-direction: column;
  width: 100%; max-width: 680px;
  max-height: 90svh;
  background: var(--s1);
  border: 2px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
  box-shadow: var(--sh3);
}
@media (min-width: 680px) {
  .quiz-modal__box { border-radius: var(--r); }
}

.quiz-modal__head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 2px solid var(--line);
  flex-shrink: 0;
}

.quiz-progress {
  flex: 1; display: flex; align-items: center; gap: 10px;
}
.quiz-progress__bar {
  flex: 1; height: 10px;
  background: var(--line); border-radius: 99px; overflow: hidden;
}
.quiz-progress__fill {
  height: 100%; background: var(--green);
  border-radius: 99px;
  transition: width 300ms ease;
}
.quiz-progress__label {
  font-size: 0.82rem; font-weight: 900; color: var(--muted);
  white-space: nowrap;
}
.quiz-close {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 2px solid var(--line); border-radius: 50%;
  background: var(--s2); color: var(--muted);
  transition: border-color 150ms, color 150ms;
}
.quiz-close:hover { border-color: var(--red); color: var(--red); }
.quiz-close svg { width: 14px; height: 14px; }

.quiz-modal__body {
  flex: 1; overflow-y: auto; padding: 24px 20px;
}

.quiz-question { display: flex; flex-direction: column; gap: 16px; }

.quiz-q-text {
  margin: 0;
  font-size: 1.1rem; font-weight: 900; line-height: 1.5; color: var(--ink);
}

.quiz-score-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  padding: 32px 0; text-align: center;
}
.quiz-score-emoji { font-size: 3.5rem; line-height: 1; }
.quiz-score-result {
  font-size: 3rem; font-weight: 900; line-height: 1; color: var(--ink);
}
.quiz-score-result span { font-size: 1.5rem; color: var(--muted); }
.quiz-score-msg {
  margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--muted);
}

.quiz-q {
  border: 2px solid var(--line); border-radius: var(--rmd);
  padding: 16px 18px;
  transition: border-color 300ms;
}
.quiz-q--missing { border-color: var(--red); animation: shake 350ms ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.quiz-q legend {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 1rem; font-weight: 800; color: var(--ink);
  line-height: 1.5; margin-bottom: 14px;
  padding: 0; float: none; width: 100%;
}
.quiz-q__num {
  display: grid; place-items: center;
  min-width: 28px; height: 28px;
  background: var(--green-lt); border: 2px solid var(--green);
  border-radius: 50%;
  font-size: 0.82rem; font-weight: 900; color: var(--green-dk);
  flex-shrink: 0; margin-top: 1px;
}

.quiz-q__opts {
  display: flex; flex-direction: column; gap: 8px;
}

.quiz-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line); border-radius: var(--rsm);
  cursor: pointer;
  transition: border-color 140ms, background 140ms;
}
.quiz-opt input[type="radio"] { display: none; }
.quiz-opt:has(input:checked),
.quiz-opt--selected {
  border-color: var(--blue);
  background: var(--blue-lt);
}
.quiz-opt:hover:not(:has(input:disabled)) { border-color: var(--line2); }
.quiz-opt--correct { border-color: #3A8500 !important; background: #D7FFB8 !important; color: #2A6200 !important; }
.quiz-opt--wrong   { border-color: var(--red-dk) !important; background: var(--red-lt) !important; color: var(--red-dk) !important; }
.quiz-opt__txt { font-size: 0.95rem; font-weight: 700; line-height: 1.4; }

.quiz-q__feedback {
  margin-top: 12px; padding: 10px 14px;
  border-radius: var(--rsm);
  font-size: 0.9rem; font-weight: 700; line-height: 1.55;
}
.quiz-q__feedback--ok  { background: #D7FFB8; color: #2A6200; border: 1.5px solid #3A8500; }
.quiz-q__feedback--err { background: var(--red-lt); color: var(--red-dk); border: 1.5px solid var(--red-dk); }

.quiz-modal__foot {
  padding: 16px 20px;
  border-top: 2px solid var(--line);
  display: flex; justify-content: flex-end; gap: 12px;
  flex-shrink: 0;
}
.quiz-modal__foot .btn-primary { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════════════
   Reduced motion
═══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════
   Mobile adjustments
═══════════════════════════════════════════════════════ */

@media (max-width: 679px) {
  .bac-table-wrap,
  .fiche-table-wrap {
    margin-inline: calc(var(--px) * -0.25);
    border-radius: var(--rsm);
  }

  .bac-table {
    min-width: 640px;
    font-size: 0.8rem;
  }

  .bac-table th,
  .bac-table td {
    padding: 10px 9px;
  }

  .bac-table th {
    font-size: 0.76rem;
  }

  .bac-table__col--matiere { width: 170px; }
  .bac-table__col--centre_examen { width: 250px; }
  .bac-table__col--sujet { width: 82px; }
  .bac-table__col--corrige { width: 92px; }

  .bac-table td.bac-table__col--centre_examen {
    font-size: 0.76rem;
    line-height: 1.32;
  }

  .bac-table__button {
    min-width: 64px;
    height: 32px;
    padding: 0 10px;
    font-size: 0.76rem;
  }

  .fiche-table {
    min-width: 560px;
    font-size: 0.82rem;
    line-height: 1.42;
  }

  .fiche-table th,
  .fiche-table td {
    min-width: 132px;
    padding: 9px 10px;
  }

  .fiche-table th {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
  }

  .fiche-steps,
  .fiche-steps > ol,
  .fiche-steps > ul {
    gap: 10px;
  }

  .fiche-steps li,
  .fiche-steps > div {
    padding: 12px 12px 12px 48px;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .fiche-steps li::before,
  .fiche-steps > div::before {
    left: 12px;
    top: 12px;
    width: 24px;
    height: 24px;
    font-size: 0.76rem;
  }

  .skill-check {
    padding: 16px;
    gap: 12px;
  }

  .skill-check__head {
    flex-direction: column;
    gap: 10px;
  }

  .skill-check__score {
    min-width: 68px;
    height: 32px;
  }

  .skill-check__body {
    min-height: 360px;
  }

  .skill-check__question {
    padding: 14px;
  }

  .skill-check__prompt {
    font-size: 1rem;
  }

  .skill-check__bools {
    grid-template-columns: 1fr;
  }

  .skill-check__choice,
  .skill-check__statement,
  .skill-check__feedback {
    font-size: 0.88rem;
  }

  .skill-check__foot .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════
   Tablet 680px+
═══════════════════════════════════════════════════════ */

@media (min-width: 680px) {
  :root { --px: 28px; }

  .menu-toggle { display: none; }

  .main-nav {
    position: static; display: flex; align-items: center;
    gap: 4px; padding: 4px; border-radius: var(--rsm);
    background: transparent; border: none;
    box-shadow: none; opacity: 1;
    pointer-events: auto; transform: none;
  }
  .main-nav a {
    padding: 7px 12px; border-radius: 999px;
    font-size: 0.9rem;
  }
  .main-nav a:hover {
    background: var(--s2); color: var(--ink);
  }

  .level-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-card-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-card-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .level-card { min-height: 240px; }
  .level-card--compact { min-height: 190px; }

  .track-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bac-track-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .filter-bar { grid-template-columns: 1fr auto; align-items: start; }
  .bac-filter-bar { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) auto; }

  .subject-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-modal { align-items: center; padding: 24px; }
  .account-modal__box { border-radius: var(--r); }

  .subject-banner__inner { padding-top: 36px; }
}

/* ═══════════════════════════════════════════════════════
   Desktop 1040px+
═══════════════════════════════════════════════════════ */

@media (min-width: 1040px) {
  :root { --px: 44px; }
  .subject-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chapter-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bac-track-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
