/* =========================================================================
   ESPACE FORMATION — Coaching SaaS à forte personnalité
   Palette : crème chaude + indigo nuit + accent corail + menthe profonde + or
   Display arrondi (Fredoka) · sans nette (Manrope)
   ========================================================================= */

:root {
  --ink:        #241a3b;
  --ink-soft:   #4a3f66;
  --muted:      #8b83a3;

  --cream:      #fff6ee;
  --cream-2:    #fdeede;
  --card:       #ffffff;
  --card-2:     #fffaf4;
  --line:       #efe4d6;
  --line-strong:#e4d6c4;

  --coral:      #ff6a5b;
  --coral-deep: #ef4a44;
  --coral-tint: #ffe7e2;
  --mint:       #12b886;
  --mint-deep:  #0c8f6a;
  --mint-tint:  #d8f5e9;
  --gold:       #ffb43d;
  --gold-tint:  #fff0d2;
  --indigo:     #6c5ce7;
  --indigo-tint:#eae7ff;

  --sh-sm:  0 2px 6px rgba(52,28,74,.06);
  --sh-md:  0 10px 26px -12px rgba(52,28,74,.28), 0 3px 8px -4px rgba(255,140,90,.14);
  --sh-lg:  0 26px 60px -22px rgba(52,28,74,.36), 0 8px 20px -10px rgba(255,120,90,.18);
  --sh-coral: 0 14px 30px -12px rgba(255,90,77,.5);
  --sh-mint:  0 14px 30px -12px rgba(18,184,134,.42);

  --radius:   20px;
  --radius-sm:13px;
  --radius-pill: 999px;

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(60% 55% at 8% -8%,  rgba(255,180,61,.30), transparent 60%),
    radial-gradient(52% 48% at 100% 0%, rgba(255,106,91,.24), transparent 62%),
    radial-gradient(60% 60% at 100% 100%, rgba(18,184,134,.16), transparent 60%),
    radial-gradient(70% 60% at -10% 110%, rgba(108,92,231,.14), transparent 60%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

h1, h2, h3, .brand, .kpi-value, .skill-val, .level {
  font-family: "Fredoka", "Manrope", sans-serif;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}

h1 {
  font-size: clamp(1.7rem, 5.2vw, 2.4rem);
  line-height: 1.08;
  margin: 4px 0 14px;
  font-weight: 600;
}
h2 { font-size: 1.16rem; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }
strong { font-weight: 700; color: var(--ink); }

a {
  color: var(--coral-deep);
  text-decoration: none;
  font-weight: 600;
  transition: color .18s var(--ease);
}
a:hover { color: var(--coral); text-decoration: underline; text-underline-offset: 3px; }

.muted { color: var(--muted); font-weight: 500; }
.error {
  color: var(--coral-deep);
  font-weight: 600;
  background: var(--coral-tint);
  border: 1px solid rgba(239,74,68,.22);
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
}

.up, .down { font-size: .82em; font-weight: 800; padding: 1px 7px; border-radius: var(--radius-pill); margin-left: 4px; }
.up   { color: var(--mint-deep);  background: var(--mint-tint); }
.down { color: var(--coral-deep); background: var(--coral-tint); }

main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 26px 18px 80px;
  animation: rise .5s var(--ease) both;
}

main > * { animation: rise .55s var(--ease) both; }
main > *:nth-child(1) { animation-delay: .02s; }
main > *:nth-child(2) { animation-delay: .09s; }
main > *:nth-child(3) { animation-delay: .16s; }
main > *:nth-child(4) { animation-delay: .23s; }
main > *:nth-child(5) { animation-delay: .30s; }
main > *:nth-child(6) { animation-delay: .37s; }
main > *:nth-child(7) { animation-delay: .44s; }
main > *:nth-child(8) { animation-delay: .51s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop {
  0%   { opacity: 0; transform: translateY(10px) scale(.94); }
  70%  { transform: translateY(0) scale(1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

header, header.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 11px clamp(14px, 4vw, 26px);
  background: rgba(255,250,244,.82);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 20px -16px rgba(52,28,74,.5);
}
header::-webkit-scrollbar { display: none; }

.brand {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 1.16rem;
  color: var(--ink);
  padding-right: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 8px;
  background: radial-gradient(circle at 30% 30%, var(--gold), var(--coral) 70%);
  box-shadow: var(--sh-coral);
  flex: none;
}

header a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
header a:hover {
  color: var(--ink);
  background: var(--cream-2);
  text-decoration: none;
  transform: translateY(-1px);
}
header a.logout, header a[href="/logout"] {
  color: var(--coral-deep);
  background: var(--coral-tint);
}
header a.logout:hover, header a[href="/logout"]:hover {
  color: #fff;
  background: var(--coral);
}
.spacer { flex: 1 1 auto; min-width: 8px; }

.hero {
  position: relative;
  padding: 26px 26px 24px;
  margin-bottom: 20px;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(135deg, #2c2050 0%, #3a2668 46%, #5a2f6e 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--sh-lg);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 80% at 88% -20%, rgba(255,180,61,.55), transparent 60%),
    radial-gradient(46% 70% at 108% 120%, rgba(255,106,91,.5), transparent 60%),
    radial-gradient(40% 60% at -10% 120%, rgba(18,184,134,.35), transparent 60%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin: 0 0 8px; text-shadow: 0 2px 12px rgba(20,8,40,.3); }
.level-line { color: rgba(255,255,255,.9); font-weight: 600; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.level {
  font-family: "Fredoka", sans-serif;
  color: #241a3b;
  background: linear-gradient(120deg, #ffd873, var(--gold));
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(255,180,61,.7);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  position: relative;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--sh-md);
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
  animation: pop .55s var(--ease) both;
}
.kpi:nth-child(1) { animation-delay: .12s; }
.kpi:nth-child(2) { animation-delay: .2s; }
.kpi:nth-child(3) { animation-delay: .28s; }
.kpi:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }

.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--coral), var(--gold));
}
.kpi:nth-child(2)::before { background: linear-gradient(90deg, var(--mint), #4fd6a8); }
.kpi:nth-child(3)::before { background: linear-gradient(90deg, var(--indigo), #9d8bff); }

.kpi-value {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.kpi-unit { font-size: .42em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-label {
  margin-top: 7px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  margin-bottom: 18px;
  box-shadow: var(--sh-md);
  overflow-x: auto;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.card:hover { box-shadow: var(--sh-lg); }
.card > *:last-child { margin-bottom: 0; }

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: .92rem;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-family: "Fredoka", sans-serif;
  font-weight: 500;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--card-2);
}
tr:last-child td { border-bottom: none; }
tbody tr, table tr { transition: background .16s var(--ease); }

.card > table td strong { font-family: "Fredoka", sans-serif; font-size: 1.15rem; color: var(--ink); }

h1 + .muted { margin-top: -6px; }
tr.me td {
  background: linear-gradient(90deg, var(--gold-tint), var(--coral-tint));
  font-weight: 800;
  color: var(--ink);
  position: relative;
}
tr.me td:first-child {
  border-left: 4px solid var(--coral);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
tr.me td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  color: var(--coral-deep);
  font-family: "Fredoka", sans-serif;
}
tr.me td:first-child::before { content: "★ "; color: var(--gold); }
tr:hover:not(.me) td { background: var(--cream-2); }

.skill { margin-bottom: 14px; }
.skill:last-child { margin-bottom: 0; }
.skill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .9rem;
  margin-bottom: 6px;
}
.skill-name { font-weight: 600; color: var(--ink-soft); }
.skill-val { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1rem; color: var(--ink); }

.bar-track {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(52,28,74,.14);
}
.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transform-origin: left center;
  animation: grow 1s var(--ease) both;
  animation-delay: .35s;
  position: relative;
}
.bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.35), transparent 55%);
}
.bar-fill.good { background: linear-gradient(90deg, var(--mint-deep), #35d69f); box-shadow: var(--sh-mint); }
.bar-fill.mid  { background: linear-gradient(90deg, #f59f2e, var(--gold)); box-shadow: 0 10px 22px -10px rgba(255,180,61,.6); }
.bar-fill.bad  { background: linear-gradient(90deg, var(--coral-deep), #ff8a7d); box-shadow: var(--sh-coral); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Fredoka", sans-serif;
  font-weight: 500;
  font-size: .74rem;
  line-height: 1;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--indigo-tint);
  color: var(--indigo);
  vertical-align: middle;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.win {
  background: var(--mint-tint);
  color: var(--mint-deep);
  border-color: rgba(12,143,106,.18);
}
.badge.win::before { content: "✓"; font-weight: 700; }
.badge.err {
  background: var(--coral-tint);
  color: var(--coral-deep);
  border-color: rgba(239,74,68,.18);
}

.priority {
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff8f2, #fff);
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.priority:last-child { margin-bottom: 0; }
.priority:hover { transform: translateX(3px); box-shadow: var(--sh-sm); }
.priority strong { font-size: .98rem; }
/* Toute la ligne est cliquable quand une leçon correspond à l'erreur */
a.priority-clickable { display: flex; color: inherit; text-decoration: none; cursor: pointer; }
a.priority-clickable:hover { text-decoration: none; border-left-color: var(--ink); }
.lesson-link {
  margin-left: auto;
  font-size: .82rem;
  background: var(--ink);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.lesson-link:hover { background: var(--coral); color: #fff; text-decoration: none; transform: translateY(-1px); }
.priority-fix {
  flex-basis: 100%;
  font-size: .86rem;
  color: var(--ink-soft);
  background: var(--cream-2);
  border-radius: 10px;
  padding: 8px 11px;
  margin-top: 2px;
}

.strength {
  font-size: .95rem;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--mint-tint);
  border-left: 4px solid var(--mint);
  margin-bottom: 10px;
}
.strength:last-child { margin-bottom: 0; }
.strength .muted { font-style: italic; }

.lesson-desc {
  background: linear-gradient(135deg, var(--indigo-tint), #f4f1ff);
  border-color: rgba(108,92,231,.18);
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.card.do    { border-left: 5px solid var(--mint); }
.card.dont  { border-left: 5px solid var(--coral); }
.card.do h2::before,
.card.dont h2::before {
  font-family: "Fredoka", sans-serif;
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 8px;
  margin-right: 8px;
  font-size: .9rem;
  vertical-align: -6px;
}
.card.do h2::before   { content: "✓"; background: var(--mint-tint); color: var(--mint-deep); }
.card.dont h2::before { content: "✕"; background: var(--coral-tint); color: var(--coral-deep); }

.card ul { margin: 0; padding: 0; list-style: none; }
.card ul li {
  position: relative;
  padding: 7px 0 7px 28px;
  border-bottom: 1px dashed var(--line);
  font-size: .95rem;
  color: var(--ink-soft);
}
.card ul li:last-child { border-bottom: none; }
.card.do ul li::before,
.card.dont ul li::before {
  position: absolute;
  left: 4px; top: 7px;
  font-weight: 800;
  font-family: "Fredoka", sans-serif;
}
.card.do ul li::before   { content: "✓"; color: var(--mint-deep); }
.card.dont ul li::before { content: "✕"; color: var(--coral-deep); }
.card:not(.do):not(.dont) ul li::before {
  content: "";
  position: absolute;
  left: 6px; top: 15px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.card.note {
  background: var(--cream-2);
  border-style: dashed;
  box-shadow: none;
}

.card h2 a { color: var(--ink); }
.card h2 a:hover { color: var(--coral-deep); }

main > p > a[href="/lecons"] {
  display: inline-flex;
  align-items: center;
  font-size: .88rem;
  color: var(--ink-soft);
}
main > p > a[href="/lecons"]:hover { color: var(--coral-deep); }

label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  color: var(--ink);
  margin: 12px 0 6px;
}
input {
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
input::placeholder { color: var(--muted); }
input:focus {
  outline: none;
  border-color: var(--coral);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,106,91,.16);
}

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: #fff;
  cursor: pointer;
  padding: 13px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, var(--coral), var(--coral-deep));
  box-shadow: var(--sh-coral);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 20px 38px -14px rgba(255,90,77,.62); }
.btn:active { transform: translateY(0); }

.login-card {
  max-width: 380px;
  margin: 8vh auto 0;
  padding: 30px 26px;
  box-shadow: var(--sh-lg);
  border: 1px solid var(--line);
}
.login-card h1 { text-align: center; font-size: 1.7rem; margin-bottom: 6px; }
.login-card h1::before {
  content: "";
  display: block;
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: radial-gradient(circle at 32% 30%, var(--gold), var(--coral) 72%);
  box-shadow: var(--sh-coral);
}
.login-card form { margin-top: 4px; }

@media (max-width: 620px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { padding: 15px 16px; }
  .kpi-value { font-size: 2.3rem; }
  .hero { padding: 22px 18px; }
  main { padding: 20px 14px 70px; }
  .card { padding: 17px 15px; }
  .lesson-link { margin-left: 0; }
}

@media (min-width: 621px) and (max-width: 820px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}

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

a:focus-visible, .btn:focus-visible, input:focus-visible, button:focus-visible {
  outline: 3px solid var(--indigo);
  outline-offset: 2px;
  border-radius: 6px;
}

/* =========================================================================
   BOUTON BASCULE DE THÈME (clair / sombre)
   ========================================================================= */
.theme-toggle {
  flex: none;
  width: 36px; height: 36px;
  margin-right: 2px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  transition: transform .16s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px) rotate(-8deg); background: var(--cream-2); box-shadow: var(--sh-sm); }
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: inline; }

/* =========================================================================
   MODE SOMBRE — surcharge des variables + valeurs codées en dur
   (le thème est posé sur <html data-theme="..."> par le script anti-flash)
   ========================================================================= */
:root[data-theme="dark"] {
  --ink:        #f3eefb;
  --ink-soft:   #cec5e6;
  --muted:      #9c92b8;

  --cream:      #131019;
  --cream-2:    #211a30;
  --card:       #1b1526;
  --card-2:     #221a34;
  --line:       #342a4b;
  --line-strong:#40345a;

  --coral:      #ff7b6d;
  --coral-deep: #ff6055;
  --coral-tint: rgba(255,106,91,.17);
  --mint:       #1fd39c;
  --mint-deep:  #35e0ad;
  --mint-tint:  rgba(25,200,150,.16);
  --gold:       #ffc25c;
  --gold-tint:  rgba(255,180,61,.16);
  --indigo:     #a394ff;
  --indigo-tint:rgba(120,104,240,.22);

  --sh-sm:  0 2px 8px rgba(0,0,0,.55);
  --sh-md:  0 14px 32px -14px rgba(0,0,0,.72), 0 3px 8px -4px rgba(0,0,0,.55);
  --sh-lg:  0 30px 66px -24px rgba(0,0,0,.82), 0 8px 22px -12px rgba(0,0,0,.6);
  --sh-coral: 0 14px 30px -12px rgba(255,90,77,.4);
  --sh-mint:  0 14px 30px -12px rgba(31,211,156,.34);
}

:root[data-theme="dark"] body {
  background-image:
    radial-gradient(60% 55% at 8% -8%,  rgba(255,180,61,.14), transparent 60%),
    radial-gradient(52% 48% at 100% 0%, rgba(255,106,91,.13), transparent 62%),
    radial-gradient(60% 60% at 100% 100%, rgba(25,200,150,.12), transparent 60%),
    radial-gradient(70% 60% at -10% 110%, rgba(120,104,240,.16), transparent 60%);
}
:root[data-theme="dark"] body::before { opacity: .7; }

:root[data-theme="dark"] header,
:root[data-theme="dark"] header.appbar {
  background: rgba(19,16,25,.82);
  box-shadow: 0 10px 26px -18px #000;
}

/* la carte "hero" est déjà un dégradé violet sombre : superbe dans les 2 thèmes */

:root[data-theme="dark"] .priority {
  background: linear-gradient(180deg, var(--card-2), var(--card));
}
:root[data-theme="dark"] .lesson-desc {
  background: linear-gradient(135deg, rgba(120,104,240,.22), rgba(120,104,240,.08));
  border-color: rgba(120,104,240,.28);
}
:root[data-theme="dark"] input:focus { background: var(--card); }

/* le chip "Voir la leçon" utilise --ink (sombre) + texte blanc en clair :
   en sombre --ink devient clair -> on repasse sur un accent lisible */
:root[data-theme="dark"] .lesson-link { background: var(--indigo); color: #14101d; }
:root[data-theme="dark"] .lesson-link:hover { background: var(--coral); color: #14101d; }
:root[data-theme="dark"] .card h2 a:hover { color: var(--coral); }

/* ligne "moi" du classement : un halo plus marqué sur fond sombre */
:root[data-theme="dark"] tr.me td {
  background: linear-gradient(90deg, rgba(255,180,61,.22), rgba(255,106,91,.20));
  color: var(--ink);
}
:root[data-theme="dark"] tr.me td:last-child { color: var(--coral); }
:root[data-theme="dark"] tr:hover:not(.me) td { background: var(--cream-2); }

/* =========================================================================
   LEÇONS — paliers de formation (Niveau 2 · Approfondissement / 3 · Expert)
   + exemples contextualisés bon/mauvais
   ========================================================================= */
.card.level { border-left: 5px solid var(--indigo); }
.card.level-3 { border-left-color: var(--gold); }
.card.level h2 { align-items: center; }
.level-tag {
  display: inline-block;
  font-family: "Fredoka", sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(120deg, var(--indigo), #9d8bff);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-right: 8px;
  vertical-align: 2px;
}
.card.level-3 .level-tag { background: linear-gradient(120deg, #f59f2e, var(--gold)); color: #241a3b; }

.example {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border: 1px solid var(--line);
}
.example-bon     { background: var(--mint-tint);  border-color: rgba(12,143,106,.16); }
.example-mauvais { background: var(--coral-tint); border-color: rgba(239,74,68,.16); }
.ex-ctx { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); margin: 6px 0 3px; }
.ex-text { margin: 3px 0 0; font-size: .93rem; color: var(--ink-soft); }

.card.videos { border-left: 5px solid var(--coral); }
.video-item { margin-bottom: 16px; }
.video-item:last-child { margin-bottom: 0; }
.video-titre { font-family: "Fredoka", sans-serif; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.card.videos video { width: 100%; border-radius: var(--radius-sm); background: #000; display: block; max-height: 460px; }
.video-embed { position: relative; padding-top: 56.25%; border-radius: var(--radius-sm); overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* =========================================================================
   QUIZ — questionnaire interactif (feedback immédiat + score, client-side)
   ========================================================================= */
.card.quiz { border-left: 5px solid var(--indigo); }
.quiz-score {
  font-family: "Fredoka", sans-serif;
  background: var(--indigo-tint);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.quiz-q { margin: 16px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.quiz-q:first-of-type { border-top: none; }
.quiz-question { font-weight: 700; color: var(--ink); display: flex; gap: 9px; align-items: baseline; margin: 0 0 4px; }
.quiz-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 23px; height: 23px; border-radius: 50%;
  background: var(--indigo); color: #fff;
  font-family: "Fredoka", sans-serif; font-size: .8rem; flex: none;
}
.quiz-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.quiz-opt {
  text-align: left; font: inherit; color: var(--ink);
  background: var(--card-2);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.quiz-opt:not(:disabled):hover { border-color: var(--indigo); transform: translateX(2px); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.ok { background: var(--mint-tint); border-color: var(--mint); color: var(--mint-deep); font-weight: 700; }
.quiz-opt.ko { background: var(--coral-tint); border-color: var(--coral); color: var(--coral-deep); }
.quiz-exp { margin-top: 10px; padding: 10px 13px; border-radius: var(--radius-sm); font-size: .92rem; color: var(--ink); }
.exp-ok { background: var(--mint-tint); }
.exp-ko { background: var(--coral-tint); }
.quiz-reset { width: auto; margin-top: 16px; }
