/* =====================================================================
   Carreaux — thème « Cahier » (clair, papier Seyès, stylo bleu, surligneur)
   et « Tableau » (sombre, ardoise verte, craie).
   Mouvement : rapide (< 300 ms), ease-out pour entrer/sortir,
   ease-in-out pour ce qui glisse d'un endroit à un autre.
   ===================================================================== */

/* ---------- Polices (locales, licence OFL) ---------- */
@font-face {
  font-family: "Atkinson Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/atkinson-next.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/atkinson-next-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "Kalam"; font-weight: 400; font-display: swap; src: url("fonts/kalam-400.woff2") format("woff2"); }
@font-face { font-family: "Kalam"; font-weight: 700; font-display: swap; src: url("fonts/kalam-700.woff2") format("woff2"); }

/* Nombre animable (anneau de maîtrise qui se remplit) */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }

/* ---------- Couleurs ---------- */
:root {
  --paper: #F7F9FE;           /* feuille de fond */
  --sheet: #FFFFFF;           /* cartes */
  --field: #F3F6FD;           /* champs, zones grisées */
  --grid-1: #E6ECFA;          /* lignes fines Seyès */
  --grid-2: #CCD8F3;          /* lignes fortes Seyès */
  --ink: #1C2333;
  --muted: #5B6480;
  --line: #DCE3F2;
  --primary: #2340C8;         /* stylo bleu */
  --primary-deep: #16298F;
  --primary-ink: #FFFFFF;
  --margin: #E0434E;          /* marge rouge du cahier */
  --hl: #FFE14A;              /* surligneur fluo */
  --hl-ink: #1C2333;
  --ok: #0F7F51;
  --bad: #CC2F3B;
  --accent: #C2410C;
  --lift: 0 1px 0 rgba(28, 35, 51, .05), 0 10px 28px -20px rgba(35, 64, 200, .35);
  color-scheme: light;

  /* anciens noms gardés pour les gabarits */
  --bg: var(--paper); --card: var(--sheet); --grid: var(--grid-1);
  --radius: 14px; --shadow: var(--lift);

  --font: "Atkinson Next", "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Kalam", "Segoe Print", "Bradley Hand", cursive;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.645, .045, .355, 1);
  --t-fast: 120ms; --t: 180ms; --t-slow: 260ms;
  interpolate-size: allow-keywords;
}
:root[data-theme="dark"] {
  --paper: #1F2B27; --sheet: #26342F; --field: #2C3B36;
  --grid-1: rgba(255, 255, 255, .035); --grid-2: rgba(255, 255, 255, .075);
  --ink: #EDF1EA; --muted: #A7B6AE; --line: #3A4C46;
  --primary: #8FB4FF; --primary-deep: #5A7FCC; --primary-ink: #0E1A15;
  --margin: #FF7A7A; --hl: rgba(245, 213, 71, .38); --hl-ink: #FFF8D6;
  --ok: #7FD8A6; --bad: #FF8A80; --accent: #FFB067;
  --lift: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -22px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1F2B27; --sheet: #26342F; --field: #2C3B36;
    --grid-1: rgba(255, 255, 255, .035); --grid-2: rgba(255, 255, 255, .075);
    --ink: #EDF1EA; --muted: #A7B6AE; --line: #3A4C46;
    --primary: #8FB4FF; --primary-deep: #5A7FCC; --primary-ink: #0E1A15;
    --margin: #FF7A7A; --hl: rgba(245, 213, 71, .38); --hl-ink: #FFF8D6;
    --ok: #7FD8A6; --bad: #FF8A80; --accent: #FFB067;
    --lift: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -22px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 400 16px/1.55 var(--font); color: var(--ink);
  background-color: var(--paper);
  /* Papier Seyès : grands carreaux + 3 lignes fines entre chaque */
  background-image:
    linear-gradient(90deg, var(--grid-2) 1px, transparent 1px),
    linear-gradient(var(--grid-2) 1px, transparent 1px),
    linear-gradient(var(--grid-1) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 8px 8px;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Marge rouge du cahier, sur grand écran */
@media (min-width: 1120px) {
  body::before { content: ""; position: fixed; top: 0; bottom: 0; left: calc(50% - 530px); width: 2px;
    background: var(--margin); opacity: .4; pointer-events: none; }
}
::selection { background: var(--hl); color: var(--hl-ink); }

h1, h2, h3 { text-wrap: balance; color: var(--ink); }
h1 { font-size: clamp(1.55rem, 1.1rem + 1.6vw, 2.15rem); line-height: 1.12; font-weight: 800; letter-spacing: -.025em; margin: .15em 0 .45em; }
h2 { font-size: 1.2rem; line-height: 1.25; font-weight: 750; letter-spacing: -.012em; margin: 1.9em 0 .65em; }
h3 { font-size: 1.05rem; font-weight: 700; margin: .3em 0; }
p { text-wrap: pretty; }
hr { border: 0; border-top: 1.5px dashed var(--line); margin: 1em 0; }
strong { font-weight: 700; }
pre { white-space: pre-wrap; font-size: .9em; background: var(--field); padding: 14px; border-radius: 10px; }
kbd { font: 700 .68rem/1 var(--font); min-width: 1.6em; display: inline-grid; place-items: center; padding: 3px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--sheet); margin-left: 6px; }
@media (hover: none) { kbd { display: none !important; } }

.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke-width: 2; }

a { color: var(--primary); text-decoration: none; }
/* Liens texte : le trait se dessine de gauche à droite au survol */
a:not([class]), .link {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  transition: background-size var(--t) var(--ease-out), color var(--t) ease;
}
@media (hover: hover) and (pointer: fine) {
  a:not([class]):hover, .link:hover { background-size: 100% 1.5px; }
}

.wrap { position: relative; max-width: 980px; margin: 0 auto; padding: 20px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.narrow { max-width: 560px; margin: 0 auto 12px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.accent { color: var(--accent); }
.eyebrow { margin: 0; color: var(--muted); font-weight: 600; }

/* ---------- Barre du haut + navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px max(16px, calc(50% - 474px));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  view-transition-name: topbar;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.03em; font-size: 1.12rem; color: var(--ink); margin-right: 10px; }
.logo img { transition: transform var(--t-slow) var(--ease-out); }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; view-transition-name: nav; }
.nav a {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 650;
  transition: color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out);
}
.nav a .i { width: 19px; height: 19px; transition: transform var(--t) var(--ease-out); }
.nav a.on { color: var(--ink); font-weight: 750; }
.nav a:active { transform: scale(.96); }
/* Le surligneur sous l'onglet actif (glisse d'une page à l'autre) */
.nav-hl {
  position: absolute; z-index: -1; left: 34px; right: 8px; bottom: 9px; height: .72em;
  background: var(--hl); border-radius: 4px 7px 5px 8px / 7px 4px 8px 5px;
  transform: skewX(-10deg) rotate(-1deg); transform-origin: left center;
  view-transition-name: nav-hl;
}
.swipe .nav-hl { animation: hl-swipe 520ms var(--ease-out) 120ms both; }
@keyframes hl-swipe { from { transform: skewX(-10deg) rotate(-1deg) scaleX(0); } }
/* « Ajouter » : vrai bouton */
.nav a.add-tab { order: 10; margin-left: auto; color: var(--primary-ink); background: var(--primary);
  box-shadow: 0 3px 0 var(--primary-deep); padding: 8px 14px 8px 11px; }
.nav a.add-tab.on { color: var(--primary-ink); }
.top-search { position: relative; display: flex; align-items: center; }
.top-search .i { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.top-search input { width: 170px; padding: 8px 12px 8px 34px; font-size: .92rem; border-radius: 999px;
  transition: width var(--t-slow) var(--ease-out), border-color var(--t) ease, box-shadow var(--t) ease; }
.top-search input:focus { width: 230px; }
.theme-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: none; color: var(--muted); cursor: pointer; transition: color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.theme-btn .i { width: 20px; height: 20px; grid-area: 1 / 1; transition: transform var(--t-slow) var(--ease-out), opacity var(--t) ease; }
.theme-btn .sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="dark"] .theme-btn .sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-btn .moon { opacity: 0; transform: rotate(90deg) scale(.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { opacity: 0; transform: rotate(90deg) scale(.5); }
}
.theme-btn:active { transform: scale(.9); }
.logout { margin: 0; }

@media (hover: hover) and (pointer: fine) {
  .nav a:not(.add-tab):hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .nav a:hover .i { transform: translateY(-1px); }
  .nav a.add-tab:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--primary-deep); }
  .nav a.add-tab:hover .i { transform: rotate(90deg); }
  .theme-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .logo:hover img { transform: rotate(-8deg); }
}
.nav a.add-tab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-deep); }

@media (max-width: 980px) and (min-width: 721px) { .top-search input { width: 120px; } .top-search input:focus { width: 160px; } .nav a { padding: 8px 9px; } }
@media (max-width: 720px) {
  /* pas de flou ni de nom de transition ici : sinon la barre du bas (fixe) se colle à celle du haut */
  .topbar { padding: 8px 14px; background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; view-transition-name: none; }
  .top-search, .logout { display: none; }
  .logo { margin-right: auto; }
  /* Navigation en bas de l'écran, « Ajouter » au milieu */
  .nav {
    position: fixed; z-index: 20; bottom: 0; left: 0; right: 0;
    justify-content: space-around; align-items: flex-end; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--sheet) 90%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
    border-top: 1px solid var(--line);
  }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 4px 2px; font-size: .7rem; font-weight: 650; border-radius: 12px; }
  .nav a .i { width: 22px; height: 22px; }
  .nav-hl { left: 50%; right: auto; bottom: auto; top: 1px; width: 54px; height: 28px; margin-left: -27px;
    border-radius: 999px; transform: none; }
  .swipe .nav-hl { animation-name: hl-pop; }
  @keyframes hl-pop { from { transform: scaleX(.2); opacity: 0; } }
  .nav a.add-tab { order: 0; margin: 0; background: none; box-shadow: none; padding: 0 2px 4px; color: var(--muted); }
  .nav a.add-tab .i { width: 50px; height: 40px; padding: 9px 13px; margin-top: -14px; border-radius: 14px;
    background: var(--primary); color: var(--primary-ink); box-shadow: 0 3px 0 var(--primary-deep);
    transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); }
  .nav a.add-tab:active { transform: none; box-shadow: none; }
  .nav a.add-tab:active .i { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-deep); }
  .nav a.add-tab.on { color: var(--ink); }
}

/* ---------- Boutons ---------- */
.btn {
  --edge: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font: inherit; font-weight: 700; letter-spacing: -.005em; line-height: 1.2; cursor: pointer; text-decoration: none;
  box-shadow: 0 2px 0 var(--edge);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out),
              background-color var(--t) ease, border-color var(--t) ease, color var(--t) ease;
  user-select: none; touch-action: manipulation;
}
.btn .i { width: 18px; height: 18px; transition: transform var(--t) var(--ease-out); }
.btn.primary { --edge: var(--primary-deep); background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 3px 0 var(--edge); }
.btn.big { min-height: 52px; padding: 12px 22px; font-size: 1.06rem; border-radius: 12px; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; border-radius: 9px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .6; cursor: wait; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); box-shadow: 0 3px 0 var(--edge); }
  .btn.primary:hover { border-color: var(--primary); box-shadow: 0 4px 0 var(--edge); }
  .btn:hover .i-go, .btn:hover .i:last-child:not(:first-child) { transform: translateX(2px); }
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 var(--edge); transition-duration: 60ms; }
.btn.primary:active:not(:disabled) { transform: translateY(3px); }

.link { display: inline-flex; align-items: center; gap: 6px; background-color: transparent; border: 0; color: var(--primary);
  font: inherit; font-weight: 650; cursor: pointer; padding: 0; transition: background-size var(--t) var(--ease-out), transform var(--t-fast) var(--ease-out); }
.link .i { width: 16px; height: 16px; }
.link:active { transform: scale(.97); }
.link.danger { color: var(--bad); }
summary.btn { list-style: none; }

/* ---------- Formulaires ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 650; font-size: .93rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  transition: border-color var(--t) ease, box-shadow var(--t) ease, background-color var(--t) ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: var(--sheet);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; }
textarea { resize: vertical; line-height: 1.5; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
legend { font-weight: 700; font-size: .93rem; padding: 0 4px; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }

/* Blocs repliables : s'ouvrent en douceur */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary:not(.btn) { display: flex; align-items: center; gap: 8px; }
details > summary:not(.btn)::after {
  content: ""; width: 7px; height: 7px; margin: 0 4px 3px auto; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .6;
  transform: rotate(45deg); transition: transform var(--t-slow) var(--ease-out);
}
details[open] > summary:not(.btn)::after { transform: translateY(3px) rotate(225deg); }
details::details-content {
  block-size: 0; overflow: clip;
  transition: block-size var(--t-slow) var(--ease-out), content-visibility var(--t-slow) allow-discrete;
}
details[open]::details-content { block-size: auto; }

/* ---------- Cartes, listes, petits éléments ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); padding: 20px; }
a.card, .deck-tile, a.list-row {
  transition: border-color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out), box-shadow var(--t) ease;
}
a.card:active, .deck-tile:active, a.list-row:active { transform: scale(.985); }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 650; }
.flash.ok { background: color-mix(in srgb, var(--ok) 13%, var(--sheet)); color: var(--ok); }
.flash.error { background: color-mix(in srgb, var(--bad) 12%, var(--sheet)); color: var(--bad); }
.flash.info { background: color-mix(in srgb, var(--primary) 10%, var(--sheet)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); }
.flash.info .bar { margin: 10px 0 0; background: color-mix(in srgb, var(--primary) 15%, var(--sheet)); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted); white-space: nowrap; }
.pill.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.pill.new { color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, transparent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; margin-right: 8px; }
.tag { font-size: .8rem; font-weight: 750; color: var(--c); }

.bar { height: 8px; background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.bar.thin { height: 5px; margin: 8px 0 0; }
.bar span { display: block; height: 100%; background: var(--c, var(--ok)); border-radius: 999px; transform-origin: left;
  transition: width 400ms var(--ease-in-out); animation: grow-x 700ms var(--ease-out) 150ms both; }
@keyframes grow-x { from { transform: scaleX(0); } }

.list { padding: 4px 0; }
.list.card { padding: 4px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:last-child { border-bottom: 0; }
.list-row a.grow { color: var(--ink); }
.footer-links { margin-top: 2.4em; text-align: center; }
.footer-links a + a::before { content: ""; }

@media (hover: hover) and (pointer: fine) {
  a.list-row:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
}

/* ---------- Accueil ---------- */
.hero { position: relative; display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding: 26px 26px 26px 46px; overflow: hidden; }
/* marge rouge de la page de cahier */
.hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: 24px; width: 2px; background: var(--margin); opacity: .55; }
.hero h1 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.6rem); margin: .1em 0 .3em; }
.hero p { margin: 0 0 16px; color: var(--muted); }
.welcome h1 { max-width: 18ch; }
.stats { display: flex; gap: 10px; }
.stats > div { background: var(--field); border-radius: 12px; padding: 14px 16px; min-width: 120px; text-align: center; }
.stats strong { display: inline-flex; align-items: center; gap: 5px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats strong .i { width: 22px; height: 22px; color: var(--accent); }
.stats span { display: block; font-size: .8rem; color: var(--muted); }
.goal strong small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.goal .bar span { background: var(--ok); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.exam { border-top: 4px solid var(--c); margin-bottom: 0; }
.exam-top, .exam-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.when { font-size: .8rem; font-weight: 700; color: var(--muted); }
.when.urgent { color: var(--bad); }

.eve-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; color: var(--ink);
  border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--sheet)); }
.eve-banner .big-emoji { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 1rem; }
.eve-banner .big-emoji .i { width: 24px; height: 24px; }

.continue { display: flex; align-items: center; gap: 14px; margin: 14px 0 0; color: var(--ink); border-left: 5px solid var(--c); }
.continue-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); transition: transform var(--t-slow) var(--ease-out); }
.continue-ico .i { width: 22px; height: 22px; }

.fiche-tile { display: flex; flex-direction: column; gap: 4px; border-left: 5px solid var(--c); color: var(--ink); }
.fiche-tile strong { line-height: 1.3; }
.quick, .menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.quick-tile { display: flex; flex-direction: column; gap: 2px; color: var(--ink); padding: 16px; }
.quick-tile > span:first-child { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 11px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); transition: transform var(--t-slow) var(--ease-out); }
.quick-tile > span:first-child .i { width: 21px; height: 21px; }
.quick-tile small { color: var(--muted); }

@media (hover: hover) and (pointer: fine) {
  .continue:hover, .fiche-tile:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); border-left-color: var(--c); }
  .continue:hover .continue-ico { transform: rotate(-45deg); }
  .quick-tile:hover, .eve-banner:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
  .quick-tile:hover > span:first-child { transform: translateY(-2px) rotate(-6deg); }
}

/* ---------- Matières / cours ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.subject { margin-bottom: 16px; border-left: 5px solid var(--c); }
.subject-head { display: flex; justify-content: space-between; align-items: center; }
.subject-head h2 { margin: 0; display: flex; align-items: center; }
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.deck-tile { display: flex; flex-direction: column; gap: 2px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--field); }
.deck-tile strong { line-height: 1.3; }
.deck-tile .bar span { background: var(--c); }
@media (hover: hover) and (pointer: fine) {
  .deck-tile:hover { border-color: var(--c); background: var(--sheet); }
}
.dropdown { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); width: 280px; z-index: 5; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch input { display: none; }
.swatch span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid transparent; transition: transform var(--t-fast) var(--ease-out); }
.swatch span:active { transform: scale(.9); }
.swatch input:checked + span { border-color: var(--ink); }

/* ---------- Page d'un cours ---------- */
.crumbs { margin: 0 0 6px; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.two-col { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.two-col h2:first-child, .two-col > div > h2:first-child { margin-top: 0; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.kind-switch { display: flex; gap: 6px; background: var(--field); padding: 4px; border-radius: 11px; }
.kind-switch label { flex: 1; flex-direction: row; justify-content: center; align-items: center; padding: 7px; border-radius: 8px; cursor: pointer;
  transition: background-color var(--t) ease, color var(--t) ease, box-shadow var(--t) ease; }
.kind-switch input { display: none; }
.kind-switch label:has(input:checked) { background: var(--sheet); box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--primary); }
.card-row { align-items: flex-start; }
.card-meta { text-align: right; }
.deck-meta { margin-top: -4px; }
.danger-zone { margin-top: 2.4em; }
.danger-zone form { margin-top: 10px; }
.actions-row { margin: 18px 0; }
.actions-row form { margin: 0; }
.more-block { margin-top: 14px; }
.more-block .list { margin-top: 12px; border-top: 1px solid var(--line); }
.add-card { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.add-card h3 { margin: 0; }
.empty { padding: 40px 20px; }
.empty .big-emoji { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 18px;
  background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.empty .big-emoji .i { width: 30px; height: 30px; }

/* Anneau de maîtrise : se remplit à l'arrivée */
.title-ring { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ring { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c, var(--primary)) calc(var(--p) * 1%), color-mix(in srgb, var(--ink) 9%, transparent) 0);
  animation: ring-fill 900ms var(--ease-out) 100ms both; }
@keyframes ring-fill { from { --p: 0; } }
.ring span { width: 42px; height: 42px; border-radius: 50%; background: var(--paper); display: grid; place-items: center;
  font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Onglets Fiche / Carte mentale : trait de surligneur qui glisse */
.tabs { position: relative; display: flex; align-items: center; gap: 4px 18px; margin: 18px 0 12px; flex-wrap: wrap; }
.tab { position: relative; z-index: 1; font: inherit; font-weight: 700; padding: 8px 2px; border: 0; background: none; color: var(--muted);
  cursor: pointer; white-space: nowrap; transition: color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.tab.on { color: var(--ink); box-shadow: inset 0 -.55em 0 var(--hl); }
.tab:active { transform: scale(.96); }
.tab-ind { position: absolute; z-index: 0; left: 0; top: 0; width: 100px; height: .72em; margin-top: 1.55em;
  background: var(--hl); border-radius: 4px 7px 5px 8px / 7px 4px 8px 5px; transform-origin: left; pointer-events: none; }
.tabs.has-ind .tab.on { box-shadow: none; }
.tabs.has-ind .tab-ind { transition: transform 320ms var(--ease-in-out); }
.tabs .link { white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--ink); } }
@media (max-width: 520px) { .tabs .grow { flex-basis: 100%; height: 0; } }

/* ---------- La fiche (page de cahier avec marge rouge) ---------- */
.fiche { position: relative; border-top: 4px solid var(--c); padding: 10px 28px 22px 60px; }
.fiche::before { content: ""; position: absolute; top: 0; bottom: 0; left: 38px; width: 2px; background: var(--margin); opacity: .5; }
.fiche section { padding: 16px 0; border-bottom: 1.5px dashed var(--line); }
.fiche section:last-child { border-bottom: 0; }
.fiche h2 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 800; letter-spacing: -.005em; color: var(--c); }
.resume { font-size: 1.1rem; line-height: 1.6; margin: 0; }
.points { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.points li { position: relative; padding-left: 22px; }
.points li::before { content: ""; position: absolute; left: 3px; top: .6em; width: 8px; height: 8px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.defs { margin: 0; display: grid; gap: 8px; }
.defs div { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 14px; padding: 10px 12px; background: var(--field); border-radius: 10px; }
.defs dt { font-weight: 750; }
.defs dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--c); display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -23px; top: .45em; width: 10px; height: 10px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--c); }
.timeline strong { min-width: 52px; font-variant-numeric: tabular-nums; }
/* Mots-clés surlignés au fluo */
.fiche mark { color: var(--hl-ink); font-weight: 650; padding: 0 .14em; margin: 0 -.04em;
  background: linear-gradient(transparent 14%, var(--hl) 14%, var(--hl) 90%, transparent 90%);
  border-radius: .2em .4em .25em .45em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (max-width: 560px) {
  .fiche { padding: 6px 18px 18px 38px; }
  .fiche::before { left: 22px; }
  .defs div { grid-template-columns: 1fr; gap: 2px; }
}
/* Fiche qui s'écrit en direct */
.live-title { margin-bottom: 12px; }
.appear { animation: line-in 360ms var(--ease-out) both; }
@keyframes line-in { from { opacity: 0; transform: translateY(5px); } }
.writing .fiche section:last-of-type > :last-child > :last-child::after,
.typing::after { content: "▍"; color: var(--primary); animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* Carte mentale */
.mindmap { display: flex; flex-direction: column; align-items: center; padding: 24px; border-top: 4px solid var(--c); }
.mm-root { background: var(--c); color: #fff; font-weight: 800; padding: 12px 22px; border-radius: 999px; text-align: center; max-width: 90%; }
.mm-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; width: 100%; margin-top: 28px; position: relative; }
.mm-branches::before { content: ""; position: absolute; top: -28px; left: 50%; height: 28px; border-left: 2px solid var(--c); }
.mm-branch { border: 1.5px solid color-mix(in srgb, var(--c) 40%, var(--line)); border-radius: 14px; padding: 13px; position: relative; background: var(--sheet); }
.mm-node { font-weight: 800; color: var(--c); margin-bottom: 6px; }
.mm-branch ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: .93rem; }

/* Chat sur le cours */
.chat { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat > strong { display: flex; align-items: center; gap: 8px; }
.chat > strong .i { color: var(--primary); }
.chat .inline-form { margin: 0; }
.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow: auto; }
.chat-log:empty { display: none; }
.msg { margin: 0; padding: 10px 13px; border-radius: 14px; max-width: 85%; white-space: pre-line; animation: msg-in 260ms var(--ease-out) both; }
.msg.me { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 5px; transform-origin: bottom right; }
.msg.bot { align-self: flex-start; background: var(--field); border-bottom-left-radius: 5px; transform-origin: bottom left; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }

/* ---------- Ajouter un cours ---------- */
.add { max-width: 640px; margin: 0 auto; }
.dropzone {
  align-items: center; text-align: center; gap: 3px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: 14px; padding: 28px 16px;
  background: var(--field); font-weight: 400;
  transition: border-color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out);
}
.dropzone:active { transform: scale(.99); }
.dropzone.filled { border-color: var(--primary); border-style: solid; background: color-mix(in srgb, var(--primary) 7%, var(--sheet)); }
.dropzone input { display: none; }
.dz-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 15px;
  background: var(--primary); color: var(--primary-ink); box-shadow: 0 3px 0 var(--primary-deep);
  transition: transform var(--t-slow) var(--ease-out); }
.dz-icon .i { width: 26px; height: 26px; }
.dropzone.filled .dz-icon { transform: translateY(-3px); }
.dropzone strong { font-size: 1.06rem; }
@media (hover: hover) and (pointer: fine) {
  .dropzone:hover { border-color: var(--primary); }
  .dropzone:hover .dz-icon { transform: translateY(-3px); }
}
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.more summary { cursor: pointer; }
.more select { margin-top: 8px; }
.engine { color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.8; }
.engine code { background: var(--sheet); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 5px; vertical-align: 1px; }
.led.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.led.warn { background: var(--accent); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { flex-direction: row; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.mode input { width: auto; }
.mode small { display: block; font-weight: 400; color: var(--muted); }
.mode:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.disabled { opacity: .5; }
.photo { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; }
.help { margin-top: 16px; }
.preview { display: flex; flex-direction: column; gap: 8px; }
.keep { flex-direction: row; align-items: center; gap: 8px; }
.keep input { width: auto; }
.sticky-actions { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 10px; padding: 10px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); }
@media (min-width: 721px) { .sticky-actions { bottom: 12px; } }

/* Analyse en cours : trois lignes qui s'écrivent */
.processing { max-width: 540px; margin: 30px auto; }
.spinner { width: 72px; height: 44px; margin: 12px auto 8px;
  background: linear-gradient(var(--primary), var(--primary)) 0 4px / 0 5px no-repeat,
              linear-gradient(var(--primary), var(--primary)) 0 19px / 0 5px no-repeat,
              linear-gradient(var(--hl), var(--hl)) 0 33px / 0 7px no-repeat;
  border-radius: 3px; animation: write 1.8s var(--ease-in-out) infinite; }
@keyframes write {
  0%   { background-size: 0 5px, 0 5px, 0 7px; opacity: 1; }
  30%  { background-size: 100% 5px, 0 5px, 0 7px; }
  60%  { background-size: 100% 5px, 80% 5px, 0 7px; }
  85%  { background-size: 100% 5px, 80% 5px, 60% 7px; opacity: 1; }
  100% { background-size: 100% 5px, 80% 5px, 60% 7px; opacity: 0; }
}
.bar.progress { max-width: 360px; margin: 16px auto; height: 10px; }
.bar.progress span, [data-questions-banner] .bar span { background: var(--primary); animation: none; }
.speed { border-collapse: collapse; width: 100%; margin: 4px 0; }
.speed th, .speed td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }

/* Page cours sur téléphone : « Me tester » toujours visible en bas */
@media (max-width: 720px) {
  .cta-bar { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 9;
    padding: 10px 12px; background: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); justify-content: stretch; }
  .cta-bar > * { flex: 1; }
  .cta-bar:empty { display: none; }
  body:has(.cta-bar:not(:empty)) .wrap { padding-bottom: 84px; }
}

/* ---------- Révision ---------- */
.review { max-width: 640px; margin: 0 auto; }
.session-bar { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; margin-bottom: 12px; }
.session-bar span { display: block; height: 100%; background: var(--c, var(--primary)); border-radius: 999px; view-transition-name: session-fill; }
.review-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.review-top .link { color: var(--muted); }
.review-top > .muted { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flashcard { position: relative; border-top: 4px solid var(--c); min-height: 280px; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; gap: 12px; padding: 32px 22px; view-transition-name: flashcard; }
.flashcard .question { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.5rem); line-height: 1.3; font-weight: 750; letter-spacing: -.015em; margin: 0; white-space: pre-line; text-wrap: balance; }
.answer { width: 100%; font-size: 1.15rem; white-space: pre-line; }
.answer:not([hidden]) { animation: reveal 420ms var(--ease-out) both; }
.answer hr { margin: .6em 0; }
.answer p { margin: .5em 0 0; font-weight: 700; }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.choices { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 10px; }
.choice { position: relative; isolation: isolate; overflow: hidden; font: inherit; text-align: left; padding: 13px 15px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer;
  transition: border-color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.choice kbd { margin: 0 8px 0 0; }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .choice:hover:not(:disabled) { border-color: var(--primary); background: var(--sheet); }
}
/* Bonne réponse : coup de surligneur. Mauvaise : barrée au stylo rouge. */
.choice.right { border-color: var(--ok); font-weight: 700; color: var(--hl-ink); }
.choice.right::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--hl);
  transform-origin: left; animation: swipe-x 420ms var(--ease-out) both; }
.choice.wrong { border-color: var(--bad); color: var(--muted); animation: shake 320ms var(--ease-out); }
.choice .ch { position: relative; }
.choice.wrong .ch::after { content: ""; position: absolute; left: -3px; right: -3px; top: 52%; height: 2px; margin-top: -1px;
  background: var(--bad); border-radius: 2px; transform: rotate(-2deg); transform-origin: left;
  animation: strike 300ms var(--ease-out) 80ms both; }
.choice:disabled:not(.right):not(.wrong) { opacity: .55; transition: opacity var(--t-slow) ease; }
@keyframes swipe-x { from { transform: scaleX(0); } }
@keyframes strike { from { transform: rotate(-2deg) scaleX(0); } }
@keyframes shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }
.choices.vf { flex-direction: row; }
.choices.vf .choice { flex: 1; text-align: center; font-weight: 700; }

.typed { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.typed input { font-size: 1.12rem; text-align: center; padding: 13px 14px; }
.typed .row { justify-content: center; }
.hint { font-weight: 700; font-size: 1.08rem; letter-spacing: .1em; color: var(--accent); margin: 0; animation: line-in 260ms var(--ease-out) both; }
/* Verdict écrit à la main, comme une annotation du prof */
.verdict { margin: 2px 0 0; display: flex; flex-direction: column; align-items: center; gap: 0; font-weight: 700; }
.verdict .stamp { font: 700 1.6rem/1.1 var(--hand); transform: rotate(-3deg); animation: stamp 320ms var(--ease-out) both; }
.verdict .given { font-size: .88rem; font-weight: 500; color: var(--muted); }
@keyframes stamp { from { opacity: 0; transform: rotate(-3deg) scale(1.25); } }
.verdict.ok { color: var(--ok); } .verdict.mid { color: var(--accent); } .verdict.bad { color: var(--bad); }

.explain { width: 100%; text-align: left; margin-top: 6px; }
.explain-text { margin-top: 10px; padding: 13px 14px; border-radius: 11px; background: var(--field); white-space: pre-line; font-size: .96rem;
  border-left: 3px solid var(--hl); animation: line-in 260ms var(--ease-out) both; }
.review-tools { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.review-tools form { margin: 0; }
.fiche-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.toc { border-left: 3px solid var(--c); padding: 6px 0 6px 14px; margin: 6px 0 18px; }
.toc ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 3px; }
.toc a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--c) 50%, transparent); }
.fiche section[id] { scroll-margin-top: 80px; }
.fiche.recall .points li, .fiche.recall .defs dd { filter: blur(6px); cursor: pointer; user-select: none;
  transition: filter 220ms var(--ease-out); }
.fiche.recall .points li.seen, .fiche.recall .defs dd.seen { filter: none; user-select: auto; }
@media (prefers-reduced-motion: reduce) { .fiche.recall .points li, .fiche.recall .defs dd { transition: none; } }
.option-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.option-row form { margin: 0; }
form.inline { display: inline; margin: 0; }
.trash-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
.archived-block summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }
.archived-block .decks { margin-top: 12px; }
.review-top-tools { display: inline-flex; gap: 4px; align-items: center; }
[data-pomodoro] { font-variant-numeric: tabular-nums; }
[data-pomodoro].on { color: var(--primary) !important; }
[data-pomodoro].pause { color: var(--ok) !important; }
.speak { position: absolute; top: 10px; right: 10px; border: 0; background: none; color: var(--muted);
  padding: 8px; border-radius: 10px; cursor: pointer; }
.speak:hover { color: var(--primary); background: var(--field); }
.card-note { width: 100%; text-align: left; display: grid; gap: 4px; }
.card-note label { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
@media (hover: none) { [data-shortcuts-open] { display: none; } }
@media (max-width: 520px) { [data-pomodoro]:not(.on):not(.pause) span { display: none; } }
.card-note textarea { width: 100%; font: inherit; font-size: .94rem; }
dialog.shortcuts { max-width: 420px; width: calc(100% - 32px); border: 0; }
dialog.shortcuts h2 { margin-top: 0; }
dialog.shortcuts::backdrop { background: rgb(0 0 0 / .35); }
dialog.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; }
dialog.shortcuts dd { margin: 0; }
.review-tools .link { color: var(--muted); font-weight: 600; }

.grades { margin-top: 14px; }
.grades:not([hidden]) > p { animation: line-in 240ms var(--ease-out) both; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { --edge: var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 12px 6px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--sheet); box-shadow: 0 3px 0 var(--edge);
  font: inherit; font-weight: 750; cursor: pointer; color: var(--ink);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), border-color var(--t) ease, background-color var(--t) ease; }
.grades:not([hidden]) .grade { animation: rise 300ms var(--ease-out) both; }
.grades:not([hidden]) .grade:nth-child(2) { animation-delay: 35ms; }
.grades:not([hidden]) .grade:nth-child(3) { animation-delay: 70ms; }
.grades:not([hidden]) .grade:nth-child(4) { animation-delay: 105ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.grade small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.grade kbd { margin: 5px 0 0; }
.grade.g0 { color: var(--bad); } .grade.g1 { color: var(--accent); } .grade.g2 { color: var(--primary); } .grade.g3 { color: var(--ok); }
.grade.suggested { --edge: color-mix(in srgb, currentColor 55%, var(--line)); border-color: currentColor;
  background: color-mix(in srgb, currentColor 8%, var(--sheet)); }
@media (hover: hover) and (pointer: fine) {
  .grade:hover { border-color: currentColor; transform: translateY(-1px); box-shadow: 0 4px 0 var(--edge); }
}
.grade:active { transform: translateY(3px); box-shadow: 0 0 0 var(--edge); transition-duration: 60ms; }

.done { max-width: 520px; margin: 40px auto; }
.done .big-emoji { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto; border-radius: 20px;
  background: var(--hl); color: var(--hl-ink); animation: pop 520ms var(--ease-out) both; }
.done .big-emoji .i { width: 34px; height: 34px; }
@keyframes pop { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 60% { transform: scale(1.06) rotate(3deg); opacity: 1; } }
.big-emoji { font-size: 3rem; }
.recap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
.recap div { background: var(--field); border-radius: 12px; padding: 12px 6px; animation: rise 320ms var(--ease-out) both; }
.recap div:nth-child(2) { animation-delay: 50ms; } .recap div:nth-child(3) { animation-delay: 100ms; } .recap div:nth-child(4) { animation-delay: 150ms; }
.recap strong { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.recap span { font-size: .78rem; color: var(--muted); }
.recap .ok strong { color: var(--ok); } .recap .bad strong { color: var(--bad); }
@media (max-width: 480px) { .recap { grid-template-columns: repeat(2, 1fr); } .grade-row { gap: 6px; } .grade { padding: 10px 2px 8px; font-size: .92rem; } }

/* ---------- Connexion ---------- */
.auth { max-width: 390px; margin: 8vh auto 0; text-align: center; }
.auth .card { text-align: left; margin: 18px 0; }
.auth h1 { margin-bottom: 0; }

/* ---------- Interros, examen blanc ---------- */
.checks { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.check { flex-direction: row; align-items: center; font-weight: 400; gap: 8px; }
.check input { width: auto; }
.exam-actions { margin-top: 12px; }
.mock-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 70px; z-index: 4; margin-bottom: 12px; }
.mock-head h1 { margin: 0; font-size: 1.2rem; }
.timer { font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer.urgent { color: var(--bad); animation: blink 1s steps(1) infinite; }
.mock-q { margin-bottom: 10px; border: 1px solid var(--line); }
.mock-q legend { font-weight: 700; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.mock-choices { display: flex; flex-direction: column; gap: 6px; clear: both; }
.mock-choice { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: border-color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.mock-choice:active { transform: scale(.99); }
.mock-choice input { width: auto; }
.mock-choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mock-q input[type=text] { clear: both; }
.mock-score { max-width: 480px; margin: 10px auto 0; }
/* Note à l'encre, comme sur une copie corrigée */
.note { font: 700 4rem/1 var(--hand); display: inline-block; transform: rotate(-4deg); margin: 6px 0; animation: stamp 420ms var(--ease-out) 150ms both; }
.note small { font-size: 1.5rem; color: inherit; opacity: .8; }
.note.good { color: var(--ok); } .note.mid { color: var(--accent); } .note.bad { color: var(--bad); }
.verdict-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 1rem var(--hand); flex: none; }
.verdict-dot.juste { background: color-mix(in srgb, var(--ok) 16%, var(--sheet)); color: var(--ok); }
.verdict-dot.presque { background: color-mix(in srgb, var(--accent) 16%, var(--sheet)); color: var(--accent); }
.verdict-dot.faux { background: color-mix(in srgb, var(--bad) 16%, var(--sheet)); color: var(--bad); }

/* ---------- À faire, semaine ---------- */
.task-add { flex-wrap: wrap; margin: 0 0 14px; }
.task-add input[name=title] { flex: 2; min-width: 200px; }
.task-add select, .task-add input[type=date] { flex: 1; min-width: 120px; }
.task form { margin: 0; }
.task.late strong { color: var(--bad); }
.task.done .grow { text-decoration: line-through; text-decoration-color: var(--bad); color: var(--muted); }
.check-btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--sheet);
  color: transparent; cursor: pointer; padding: 0; transition: border-color var(--t) ease, background-color var(--t) ease, color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.check-btn .i { width: 16px; height: 16px; stroke-width: 3; }
.check-btn:active { transform: scale(.85); }
.check-btn.on { background: var(--ok); border-color: var(--ok); color: var(--sheet); }
@media (hover: hover) and (pointer: fine) { .check-btn:hover { border-color: var(--ok); color: var(--ok); } .check-btn.on:hover { color: var(--sheet); } }
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.day { display: flex; flex-direction: column; gap: 6px; padding: 14px; min-height: 120px; }
.day.today { border: 2px solid var(--primary); }
.day header { margin-bottom: 2px; text-transform: capitalize; font-weight: 700; }
.ev { display: flex; align-items: center; gap: 7px; font-size: .88rem; padding: 7px 9px; border-radius: 9px; background: var(--field); color: var(--ink);
  transition: background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.ev .i { width: 15px; height: 15px; flex: none; }
a.ev:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { a.ev:hover { background: color-mix(in srgb, var(--primary) 9%, var(--field)); } }
.exam-ev { border-left: 4px solid var(--c); font-weight: 700; }
.eve-ev { color: var(--accent); font-weight: 650; }
.cards-ev { color: var(--muted); }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.steps form { margin: 0 0 4px; }

/* ---------- Stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { text-align: center; padding: 16px; }
.kpi strong { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .85rem; }
.chart { padding: 18px 14px 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar-stack { width: 100%; min-height: 2px; background: color-mix(in srgb, var(--primary) 22%, var(--field)); border-radius: 4px 4px 0 0;
  display: flex; align-items: flex-end; overflow: hidden; transform-origin: bottom; animation: grow-y 600ms var(--ease-out) both; }
@keyframes grow-y { from { transform: scaleY(0); } }
.bar-ok { width: 100%; background: var(--primary); }
.bar-col small { font-size: .68rem; color: var(--muted); height: 1em; }
.forecast .bars { gap: 10px; height: 120px; }
.forecast .bar-stack { background: color-mix(in srgb, var(--primary) 55%, var(--field)); }
.forecast-n { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); min-height: 1.2em; }
.legend { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.ok { background: var(--primary); } .sw.all { background: color-mix(in srgb, var(--primary) 22%, var(--field)); }
.subj-bar { width: 120px; flex: none; margin: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 10px; opacity: .45; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.badge span { font-size: 1.8rem; }
.badge small { color: var(--muted); font-size: .76rem; }
.status-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Les 3 étapes d'un cours ---------- */
.steps-bar { list-style: none; margin: 4px 0 18px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: none; }
.steps-bar li { position: relative; }
.steps-bar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--muted);
  background: var(--sheet); border: 1px solid var(--line);
  transition: border-color var(--t) ease, background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.steps-bar a:active { transform: scale(.98); }
.steps-bar strong { display: block; color: var(--ink); font-size: .95rem; line-height: 1.2; }
.steps-bar small { display: block; font-size: .78rem; line-height: 1.2; }
.steps-bar .n { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%;
  font-weight: 800; font-size: .9rem; border: 2px solid var(--line); color: var(--muted); background: var(--sheet); }
.steps-bar .n .i { width: 16px; height: 16px; stroke-width: 3; }
.steps-bar .is-done .n { background: var(--ok); border-color: var(--ok); color: var(--sheet); }
.steps-bar .is-now a { border-color: var(--primary); box-shadow: 0 2px 0 var(--primary-deep); }
.steps-bar .is-now .n { border-color: var(--primary); background: var(--primary); color: var(--primary-ink);
  animation: pulse-ring 2.4s var(--ease-out) 600ms 2; }
.steps-bar .is-off a { opacity: .55; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
@media (hover: hover) and (pointer: fine) { .steps-bar a:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); } }
@media (max-width: 560px) {
  .steps-bar { gap: 6px; }
  .steps-bar a { flex-direction: column; text-align: center; gap: 5px; padding: 9px 4px; }
  .steps-bar small { display: none; }
}

/* Leçon (Apprendre) et exercices (Appliquer) */
.learn, .apply { max-width: 680px; }
.lesson { padding: 26px 26px 22px; animation: step-in 300ms var(--ease-out) both; }
.lesson.back { animation-name: step-back; }
@keyframes step-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes step-back { from { opacity: 0; transform: translateX(-28px); } }
.lesson h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.85rem); margin: .1em 0 .55em; }
.lesson h2 { font-size: 1rem; color: var(--c, var(--primary)); margin: 1.4em 0 .5em; }
.lesson > .muted.small:first-child { margin: 0; font-weight: 650; }
.lesson .points li::before { background: var(--c, var(--primary)); }
.lesson .resume { font-size: 1.12rem; }
.check { margin-top: 22px; padding: 16px; border-radius: 12px; background: var(--field); border-left: 4px solid var(--hl); }
.check-q { margin: 0 0 10px; }
.check .choices { margin-top: 4px; }
.check .choice { background: var(--sheet); }
.check-a { margin: 10px 0 0; font-weight: 700; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.lesson-nav .btn { min-width: 120px; }
.lesson-nav .btn:disabled { opacity: .4; cursor: default; }
.done-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 6px auto 4px; border-radius: 20px;
  background: var(--hl); color: var(--hl-ink); animation: pop 520ms var(--ease-out) both; }
.done-mark .i { width: 32px; height: 32px; stroke-width: 3; }
.lesson form { margin-top: 14px; }
.live-start { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -4px 0 16px; }
.live-phase { display: flex; align-items: center; margin: -6px 0 12px; }
.fiche section.pending h2::after { content: "  écriture…"; font-weight: 500; color: var(--muted); font-size: .85rem; }

.flashcard.exo { align-items: stretch; text-align: left; justify-content: flex-start; min-height: 0; }
.flashcard.exo .question { text-wrap: pretty; }
.blank { display: inline-block; width: 4.5em; height: 1em; margin: 0 .15em; vertical-align: -.15em;
  border-bottom: 2.5px solid var(--primary); }
.mine { font-weight: 650; }
.mine textarea { margin-top: 4px; }
.corrige:not([hidden]) { animation: reveal 420ms var(--ease-out) both; }
.corrige .answer { font-size: 1.15rem; margin: 4px 0 8px; }
.corrige .given { margin: 0; }
.grade-row.two { grid-template-columns: 1fr 1fr; margin-top: 12px; }

/* Accueil : cours dont une étape reste à faire */
.todo-step { border-left: 4px solid var(--c); }
.step-badge { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.step-badge .i { width: 20px; height: 20px; }
.defs.vocab dt { font-style: italic; }
.defs.formules dt { font-variant-numeric: tabular-nums; }

/* ---------- Dessins : graphes (papier quadrillé, tracé au stylo) et schémas ---------- */
.graph { margin: 16px 0; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; }
.graph-svg { width: 100%; max-width: 420px; height: auto; background: var(--sheet); border: 1px solid var(--line);
  border-radius: 12px; }
.g-grid-minor { stroke: var(--grid-1); stroke-width: 1; }
.g-grid { stroke: var(--grid-2); stroke-width: 1; }
.g-axis { stroke: var(--ink); stroke-width: 1.6; }
.g-arrow { fill: var(--ink); }
.g-tick { font: 600 10px var(--font); fill: var(--muted); }
.g-curve { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1100ms var(--ease-out) 200ms forwards; }
.g-curve.g-c1 { animation-delay: 500ms; } .g-curve.g-c2 { animation-delay: 800ms; } .g-curve.g-c3 { animation-delay: 1100ms; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.g-c0 { stroke: var(--primary); fill: var(--primary); } .g-c1 { stroke: var(--margin); fill: var(--margin); }
.g-c2 { stroke: var(--ok); fill: var(--ok); } .g-c3 { stroke: var(--accent); fill: var(--accent); }
.g-curve.g-c0, .g-curve.g-c1, .g-curve.g-c2, .g-curve.g-c3 { fill: none; }
.g-label { font: 700 15px var(--hand); stroke: var(--sheet); stroke-width: 4px; paint-order: stroke; stroke-linejoin: round;
  opacity: 0; animation: fade-in 300ms ease-out 1100ms forwards; }
text.g-label { stroke: var(--sheet); }  /* halo clair autour du texte, même sur une couleur */
.g-point { fill: var(--margin); stroke: var(--sheet); stroke-width: 2; }
@keyframes fade-in { to { opacity: 1; } }
.g-table { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; background: var(--sheet);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; align-self: center; }
.g-table th, .g-table td { padding: 6px 10px; border: 1px solid var(--line); text-align: center; }
.g-table th { font-weight: 700; text-align: left; white-space: nowrap; background: var(--field); }
.schema { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.schema-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.schema .node { padding: 8px 13px; border-radius: 10px; background: var(--sheet); border: 1.5px solid var(--c, var(--primary));
  font-weight: 650; box-shadow: 0 2px 0 color-mix(in srgb, var(--c, var(--primary)) 35%, transparent);
  animation: rise 300ms var(--ease-out) both; }
.schema .node:nth-of-type(2) { animation-delay: 120ms; } .schema .node:nth-of-type(3) { animation-delay: 240ms; }
.schema .node:nth-of-type(4) { animation-delay: 360ms; } .schema .node:nth-of-type(5) { animation-delay: 480ms; }
.schema-arrow { width: 30px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; }
.schema-arrow path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 500ms var(--ease-out) 250ms forwards; }
.fiche-illus { margin-top: 10px; }
.fiche-illus .graph-svg { max-width: 340px; }
.explain-para { font-size: 1.08rem; line-height: 1.7; margin: 0 0 6px; }
.reexplain { margin: 2px 0 10px; }
.reexplain .explain-text { white-space: pre-line; }
.example { margin: 16px 0; padding: 12px 16px 14px; border-radius: 12px; background: color-mix(in srgb, var(--hl) 22%, var(--sheet));
  border-left: 4px solid var(--hl); }
.example h2 { margin: 0 0 6px !important; color: var(--ink) !important; font-family: var(--hand); font-size: 1.2rem !important; }
.example p { margin: 4px 0; }
.draw-hint { display: flex; align-items: center; gap: 8px; }
.answer .graph { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .g-curve, .schema-arrow path { stroke-dashoffset: 0; } .g-label { opacity: 1; } }

/* Consignes pour l'IA (ajout d'un cours, page du cours) */
.consignes { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--hl) 16%, var(--field)); border: 1px dashed color-mix(in srgb, var(--hl) 70%, var(--line)); }
.consignes > label { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px; font-weight: 700; }
.consignes p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .86rem; font-weight: 650; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  transition: background-color var(--t) ease, border-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--hl); color: var(--hl-ink); border-color: color-mix(in srgb, var(--hl) 60%, var(--ink)); }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--primary); } }
.consignes-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -6px 0 12px; color: var(--muted); }
.consignes-redo { margin-top: 10px; }

/* Matières (page Mes cours) */
.subject-admin { padding: 6px 0 14px; }
.subject-row { border-bottom: 1px solid var(--line); }
.subject-row > summary { padding: 12px 20px; gap: 10px; }
.subject-row > summary .muted { margin-left: auto; }
.subject-admin .subject-row > summary::after { margin: 0 4px 3px 12px; }
.subject-edit { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.subject-admin .inline-form { padding: 0 20px; }
.subject-chip { color: var(--c) !important; font-weight: 700; margin-right: 6px; }
[data-delete-deck] { margin: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 74px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; font-weight: 650;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  box-shadow: 0 14px 34px -14px rgba(20, 28, 60, .35);
  animation: toast-in 300ms var(--ease-out) both; }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--bad); color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-6px) scale(.97); transition: opacity 200ms ease, transform 200ms var(--ease-out); }
.toast-x { display: grid; place-items: center; margin-left: auto; width: 24px; height: 24px; background: none; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer; padding: 0;
  transition: background-color var(--t) ease, transform var(--t-fast) var(--ease-out); }
.toast-x .i { width: 15px; height: 15px; }
.toast-x:active { transform: scale(.88); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
@media (max-width: 720px) {
  .toasts { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }
  .toast { animation-name: toast-up; }
  .toast.out { transform: translateY(8px) scale(.97); }
  @keyframes toast-up { from { opacity: 0; transform: translateY(12px) scale(.97); } }
}

/* ---------- Responsive (listes sur téléphone) ---------- */
@media (max-width: 720px) {
  .wrap { padding: 16px 14px; }
  .list-row { flex-wrap: wrap; padding: 12px 16px; }
  .list-row .grow { flex-basis: calc(100% - 30px); }
  .list-row .nowrap { margin-left: 18px; flex: 1; }
  .card-row .card-meta, .card-row .link { margin-left: auto; }
  .hero { padding: 22px 18px 22px 36px; }
  .hero::before { left: 18px; }
  .stats { width: 100%; }
  .stats > div { flex: 1; min-width: 0; }
}

/* ---------- Transitions entre les pages ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 160ms ease-out both; }
::view-transition-new(root) { animation: vt-in 280ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
::view-transition-group(nav-hl) { animation-duration: 380ms; animation-timing-function: var(--ease-in-out); }
::view-transition-group(session-fill) { animation-duration: 420ms; animation-timing-function: var(--ease-in-out); }
/* La carte de révision sort à gauche, la suivante arrive de la droite */
::view-transition-group(flashcard) { animation-duration: 300ms; animation-timing-function: var(--ease-in-out); }
::view-transition-old(flashcard) { animation: card-out 200ms ease-out both; }
::view-transition-new(flashcard) { animation: card-in 300ms var(--ease-out) 60ms both; }
@keyframes card-out { to { opacity: 0; transform: translateX(-40px) rotate(-1.5deg); } }
@keyframes card-in { from { opacity: 0; transform: translateX(40px) rotate(1.5deg); } }
/* Changement de thème : un cercle s'ouvre depuis le bouton (piloté en JS) */
.theme-vt::view-transition-old(root), .theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-vt .topbar, .theme-vt .nav, .theme-vt .nav-hl, .theme-vt .flashcard, .theme-vt .session-bar span { view-transition-name: none; }

/* ---------- Accessibilité ---------- */
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .01ms !important; }
}

/* ---------- Impression : seulement la fiche, noir sur blanc ---------- */
@media print {
  :root { --paper: #fff; --sheet: #fff; --field: #f4f4f4; --ink: #000; --muted: #444; --line: #ccc; --lift: none; --hl: #fff3a0; }
  body { background: #fff; padding: 0; }
  body::before { display: none; }
  .topbar, .nav, .no-print, .flash, .crumbs, .toasts { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  [data-panel] { display: block !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .fiche { padding-left: 34px; }
  .fiche::before { left: 14px; }
  .fiche section { break-inside: avoid; }
  .mindmap { break-before: page; }
  * { animation: none !important; }
}
.list-row mark { background: var(--hl); color: inherit; padding: 0 1px; border-radius: 3px; }
.explain-text.why > strong:first-child, .why-line > strong { color: var(--primary); margin-right: 2px; }
.why-line { display: inline-block; margin-top: 4px; }
