/* ============================================================
   Fiches illustrées — coloré, imagé, facile à apprendre.
   Palette de "tons" (red…pink) : chaque section / carte reçoit
   .tone-<nom> qui définit --t (couleur vive), --t-soft (fond pastel)
   et --t-mid. Les fonds pastel sont calculés avec color-mix sur la
   couleur de carte : ils s'adaptent donc seuls au mode sombre.
   ============================================================ */

:root {
  --v-font: "Space Grotesk", "Segoe UI", -apple-system, sans-serif;
  --v-emoji-font: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --c-red: #d93a40; --c-orange: #d24d05; --c-amber: #f2b100; --c-green: #178a54; --c-teal: #0b8a7c;
  --c-blue: #3556c8; --c-indigo: #6448c4; --c-purple: #9a3aa9; --c-pink: #c02f86;
  --v-shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 14px 30px -16px rgba(20, 22, 26, .28);
}

[class*="tone-"] {
  --t-ink: #fff;
  --t-soft: color-mix(in srgb, var(--t) 11%, var(--bg-card));
  --t-mid: color-mix(in srgb, var(--t) 24%, var(--bg-card));
  --t-line: color-mix(in srgb, var(--t) 45%, var(--bg-card));
  --t-text: var(--t);
}
/* Mode sombre : le texte coloré est éclairci pour rester lisible sur fond sombre. */
:root[data-theme="dark"] [class*="tone-"] { --t-text: color-mix(in srgb, var(--t) 52%, #fff); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [class*="tone-"] { --t-text: color-mix(in srgb, var(--t) 52%, #fff); }
}
.tone-red { --t: var(--c-red); }
.tone-orange { --t: var(--c-orange); }
.tone-amber { --t: var(--c-amber); --t-ink: #3b2a00; --t-text: color-mix(in srgb, var(--c-amber) 40%, #3b2a00); }
.tone-green { --t: var(--c-green); }
.tone-teal { --t: var(--c-teal); }
.tone-blue { --t: var(--c-blue); }
.tone-indigo { --t: var(--c-indigo); }
.tone-purple { --t: var(--c-purple); }
.tone-pink { --t: var(--c-pink); }

main#app.wide { max-width: 1180px; }

.v-fiche { color: var(--text); display: flex; flex-direction: column; gap: 20px; }
.v-emoji { font-family: var(--v-emoji-font); font-style: normal; line-height: 1; }

/* ---------- Bandeau héros ---------- */
.v-hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 28px 30px 24px; color: var(--t-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.28), transparent 46%),
    linear-gradient(135deg, var(--t), color-mix(in srgb, var(--t) 62%, #14161c));
  box-shadow: 0 22px 44px -22px var(--t);
}
.v-hero-art { position: absolute; inset: 0; pointer-events: none; }
.v-art { position: absolute; opacity: .2; filter: saturate(1.1); }
.v-art:nth-child(1) { font-size: 5.2rem; right: 4%; top: 6%; transform: rotate(12deg); }
.v-art:nth-child(2) { font-size: 3.4rem; right: 22%; top: -2%; transform: rotate(-14deg); }
.v-art:nth-child(3) { font-size: 4.4rem; right: 12%; bottom: -8%; transform: rotate(-8deg); }
.v-art:nth-child(4) { font-size: 2.8rem; right: 34%; bottom: 8%; transform: rotate(18deg); }
.v-art:nth-child(5) { font-size: 3rem; right: 1%; bottom: 40%; transform: rotate(-20deg); }
.v-hero-main { position: relative; display: flex; align-items: center; gap: 20px; }
.v-hero-stamp {
  width: 84px; height: 84px; border-radius: 26px; flex-shrink: 0; background: rgba(255,255,255,.96);
  display: flex; align-items: center; justify-content: center; font-size: 2.9rem;
  box-shadow: 0 10px 22px -8px rgba(0,0,0,.35); transform: rotate(-6deg);
}
.v-eyebrow { display: inline-block; font-family: var(--v-font); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; margin-bottom: 6px; }
.v-hero h1 { margin: 0; font-family: var(--v-font); font-size: 2.15rem; line-height: 1.12; letter-spacing: -.02em; overflow-wrap: break-word; hyphens: auto; }
.v-tagline { margin: 8px 0 0; font-size: 1rem; opacity: .92; max-width: 62ch; }
.v-facts { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 22px; }
.v-fact { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.28); border-radius: 16px; padding: 11px 14px; backdrop-filter: blur(4px); }
.v-fact .v-emoji { font-size: 1.7rem; }
.v-fact strong { display: block; font-family: var(--v-font); font-size: 1.25rem; line-height: 1.1; }
.v-fact span span, .v-fact div > span { font-size: .78rem; opacity: .92; display: block; line-height: 1.3; }

/* ---------- Grille & sections ---------- */
.v-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; align-items: start; }
.v-section { grid-column: span 12; min-width: 0; } /* élément de grille : peut rétrécir (formules et tableaux défilent dans leur cadre) */
.v-section.span-6 { grid-column: span 6; }
.v-section.span-4 { grid-column: span 4; }
.v-section.span-8 { grid-column: span 8; }
.v-section:not(.is-bare) {
  border-radius: 22px; overflow: hidden; background: var(--t-soft); border: 2px solid var(--t-line); box-shadow: var(--v-shadow);
}
.v-section-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--t); color: var(--t-ink); }
.v-sticker {
  width: 50px; height: 50px; border-radius: 16px; flex-shrink: 0; background: rgba(255,255,255,.96); font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px -6px rgba(0,0,0,.4); transform: rotate(-5deg);
}
.v-num { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.v-section-head h3 { margin: 0; font-family: var(--v-font); font-size: 1.16rem; line-height: 1.2; }
.v-sub { margin: 2px 0 0; font-size: .82rem; opacity: .92; }
.v-section-titles { flex: 1; min-width: 0; }
.v-pages {
  flex-shrink: 0; align-self: flex-start; font-size: .7rem; font-weight: 700; white-space: nowrap;
  padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.22); opacity: .9;
}
.v-pages-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.v-pages-foot .v-pages { background: var(--t-soft); color: var(--text-muted, inherit); border: 1px solid var(--t-line); }
.v-body { padding: 18px 20px 20px; }
.v-section.is-bare .v-body { padding: 0; }

/* texte courant / listes / marqueurs */
.v-text, .v-prose p { margin: 0; font-size: .9rem; line-height: 1.6; }
.v-prose { display: flex; flex-direction: column; gap: 9px; }
.v-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; line-height: 1.5; }
.v-list li { position: relative; padding-left: 20px; }
.v-list li::before { content: ""; position: absolute; left: 3px; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: var(--t); box-shadow: 0 0 0 3px var(--t-mid); }
.v-fiche mark.term-mark { background: linear-gradient(transparent 52%, var(--t-mid) 52%); color: inherit; font-weight: 700; padding: 0 2px; border-radius: 3px; }
/* Sur les fonds pleins (bandeaux colorés), le surlignage clair rendait le texte blanc illisible :
   on surligne en foncé (translucide), le texte reste blanc. Ton ambre : encre foncée => surlignage clair. */
.v-fiche :is(.v-hero, .v-section-head, .v-level, .v-side-head, .v-dd-head, .v-tl-when) mark.term-mark {
  background: linear-gradient(transparent 40%, rgba(0, 0, 0, .34) 40%); color: inherit; font-weight: 800; padding: 0 3px; border-radius: 3px;
}
.v-fiche :is(.tone-amber.v-hero, .tone-amber.v-level, .tone-amber .v-section-head, .tone-amber .v-side-head, .tone-amber .v-dd-head, .tone-amber .v-tl-when) mark.term-mark {
  background: linear-gradient(transparent 40%, rgba(255, 255, 255, .5) 40%);
}

/* ---------- Cartes ---------- */
.v-cards { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.v-card { background: var(--bg-card); border-radius: 18px; padding: 14px 16px 16px; border: 2px solid var(--t-line); border-top: 7px solid var(--t); box-shadow: 0 8px 18px -14px var(--t); }
.v-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.v-card-emoji { width: 42px; height: 42px; border-radius: 14px; background: var(--t-mid); font-size: 1.5rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.v-card h4 { margin: 0; font-family: var(--v-font); font-size: .96rem; line-height: 1.25; color: var(--t-text); }
.tone-amber h4 { color: var(--text); }

/* ---------- Étapes ---------- */
.v-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.v-step { position: relative; flex: 1 1 150px; min-width: 140px; background: var(--bg-card); border: 2px solid var(--t-line); border-radius: 18px; padding: 26px 14px 14px; text-align: center; box-shadow: 0 8px 18px -14px var(--t); }
.v-step-num { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--t); color: var(--t-ink); font-family: var(--v-font); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 4px var(--t-soft); }
.v-step-emoji { display: block; font-size: 2.2rem; margin-bottom: 6px; }
.v-step h4 { margin: 0 0 6px; font-family: var(--v-font); font-size: .9rem; color: var(--t-text); }
.tone-amber.v-step h4 { color: var(--text); }
.v-step .v-list { text-align: left; font-size: .8rem; }
.v-step .v-text { font-size: .8rem; text-align: left; }
.v-step-arrow { display: flex; align-items: center; color: var(--text-soft); font-size: 1.4rem; flex: 0 0 auto; }

/* ---------- Cycle ---------- */
.v-cycle { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; justify-content: center; }
.v-cycle-stage { position: relative; flex: 0 1 430px; width: 100%; max-width: 430px; min-width: 300px; aspect-ratio: 1; }
.v-cycle-svg { position: absolute; inset: 0; }
.v-cycle-svg svg { width: 100%; height: 100%; }
.v-cycle-ring { fill: none; stroke: var(--border-strong); stroke-width: .7; stroke-dasharray: 2.2 1.6; }
.v-cycle-arrow { fill: var(--text-soft); }
.v-cycle-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 30%; text-align: center; font-family: var(--v-font); font-weight: 700; font-size: .82rem; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.v-cycle-center .v-emoji { font-size: 2.2rem; }
.v-cycle-node { position: absolute; transform: translate(-50%, -50%); width: 26%; min-width: 84px; padding: 8px 6px 7px; border-radius: 16px; background: var(--bg-card); border: 2px solid var(--t); text-align: center; box-shadow: 0 8px 16px -10px var(--t); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.v-cycle-node .v-emoji { font-size: 1.6rem; }
.v-cycle-label { font-family: var(--v-font); font-weight: 700; font-size: .72rem; line-height: 1.2; }
.v-cycle-badge { position: absolute; top: -10px; left: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--t); color: var(--t-ink); font-size: .7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.v-cycle-legend { flex: 1 1 260px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.v-cycle-legend li { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 12px; background: var(--bg-card); border-left: 5px solid var(--t); font-size: .82rem; }
.v-cycle-legend strong { color: var(--t-text); font-family: var(--v-font); }
.v-cycle-legend li.tone-amber strong { color: var(--text); }

/* ---------- Comparatif ---------- */
.v-compare { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 14px; position: relative; }
.v-compare:has(.v-vs) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
.v-vs { align-self: center; width: 46px; height: 46px; border-radius: 50%; background: var(--text); color: var(--bg-card); font-family: var(--v-font); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px -6px rgba(0,0,0,.5); }
.v-side { background: var(--bg-card); border-radius: 18px; border: 2px solid var(--t); overflow: hidden; }
.v-side-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--t); color: var(--t-ink); }
.v-side-head .v-emoji { font-size: 1.5rem; }
.v-side-head h4 { margin: 0; font-family: var(--v-font); font-size: .96rem; }
.v-side .v-list, .v-side .v-text { padding: 14px 16px 16px; }

/* ---------- Tableau ---------- */
.v-table-wrap { overflow-x: auto; border-radius: 16px; border: 2px solid var(--t-line); background: var(--bg-card); }
.v-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.v-table th, .v-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); line-height: 1.45; }
.v-table thead th { background: var(--t); color: var(--t-ink); font-family: var(--v-font); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; border: 0; }
.v-table tbody th { background: var(--t-mid); color: var(--text); font-weight: 700; width: 24%; }
.v-table tbody tr:nth-child(even) td { background: var(--t-soft); }
.v-table tbody tr:last-child > * { border-bottom: 0; }

/* KaTeX : le MathML caché (lecteurs d'écran) est en position absolue ; sans ancêtre positionné il élargit la page
   quand la formule est dans un tableau à défilement horizontal. */
.katex { position: relative; }

/* Tableau de formules façon tableau noir (bloc formula, board des exercices) : sombre dans les deux thèmes. */
.v-board {
  --board-bg: #2f4a40; --board-wood: #8a6a3b; --board-ink: #f4f1e6; --board-chalk: #f2e3a0; --board-line: rgba(244, 241, 230, .32);
  background: var(--board-bg); color: var(--board-ink); border: 7px solid var(--board-wood); border-radius: 12px;
  padding: 14px 18px 18px; box-shadow: inset 0 0 40px rgba(0, 0, 0, .25), 0 6px 18px -10px rgba(0, 0, 0, .5);
  font-size: 1.12rem; line-height: 1.5;
}
/* padding-right : KaTeX décale certains indices de −2 px (.vlist-t2), ce qui ferait apparaître une barre de défilement. */
.v-board-math { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding: 2px 3px 2px 0; }
.v-board-given { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 36px; color: var(--board-chalk); padding: 4px 0 12px; border-bottom: 2px dashed var(--board-line); }
.v-board-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 2px; border-bottom: 1px dashed var(--board-line); }
.v-board.is-two .v-board-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Cellules et données autorisées à rétrécir : une formule trop longue défile dans son cadre au lieu d'élargir la page. */
.v-board-cell, .v-board-given > * { min-width: 0; }
.v-board-row:last-of-type { border-bottom: 0; }
.v-board-head { font-family: var(--v-font, inherit); font-size: .8rem; color: rgba(244, 241, 230, .72); padding: 8px 2px; }
.v-board.is-two .v-board-cell + .v-board-cell { border-left: 1px dashed var(--board-line); padding-left: 14px; }
.v-board-note { display: block; font-size: .8rem; color: rgba(244, 241, 230, .78); margin-top: 2px; }
.v-board-note mark.term-mark { background: rgba(242, 227, 160, .2); color: var(--board-chalk); }
.v-board-result { margin: 12px auto 0; max-width: 520px; text-align: center; color: var(--board-chalk); border: 2px solid var(--board-chalk); border-radius: 8px; padding: 8px 14px; font-size: 1.2rem; }
@media (max-width: 560px) {
  .v-board { padding: 12px 12px 14px; font-size: 1rem; border-width: 5px; }
  .v-board.is-two .v-board-row { grid-template-columns: minmax(0, 1fr); }
  .v-board.is-two .v-board-head { display: none; }
  .v-board.is-two .v-board-cell + .v-board-cell { border-left: 0; padding-left: 0; }
  .v-board.is-two .v-board-cell[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: rgba(244, 241, 230, .6); }
}
@media (max-width: 400px) {
  .v-board { padding: 10px 8px 12px; font-size: .9rem; border-width: 4px; }
  .v-board-given { gap: 4px 18px; }
  .v-board-result { padding: 6px 8px; font-size: 1rem; }
}
@media print {
  .v-board { --board-bg: #fff; --board-ink: #111; --board-chalk: #111; --board-line: #999; --board-wood: #555; box-shadow: none; break-inside: avoid; }
  .v-board-head, .v-board-note { color: #444; }
}

/* ---------- Frise ---------- */
.v-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.v-tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.v-tl-item:last-child { padding-bottom: 0; }
.v-tl-item::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 3px; background: var(--t-line); border-radius: 3px; }
.v-tl-item:last-child::before { display: none; }
.v-tl-dot { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; background: var(--bg-card); border: 3px solid var(--t); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; z-index: 1; }
.v-tl-body { padding-top: 2px; }
.v-tl-when { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--t); color: var(--t-ink); font-family: var(--v-font); font-weight: 700; font-size: .74rem; }
.v-tl-body h4 { margin: 5px 0 1px; font-family: var(--v-font); font-size: .92rem; }
.v-tl-body p { margin: 0; font-size: .84rem; color: var(--text-muted); line-height: 1.5; }

/* ---------- Niveaux / pyramide ---------- */
.v-levels { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.v-level { width: var(--w, 100%); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 16px; border-radius: 14px; background: var(--t); color: var(--t-ink); text-align: center; box-shadow: 0 8px 16px -12px var(--t); }
.v-level .v-emoji { font-size: 1.35rem; }
.v-level strong { font-family: var(--v-font); font-size: .9rem; }
.v-level span:not(.v-emoji) { font-size: .8rem; opacity: .95; }

/* ---------- Chiffres clés ---------- */
.v-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.v-stat { text-align: center; background: var(--bg-card); border: 2px solid var(--t-line); border-radius: 20px; padding: 16px 12px; box-shadow: 0 8px 18px -14px var(--t); }
.v-stat-emoji { font-size: 2rem; display: block; margin-bottom: 4px; }
.v-stat-value { font-family: var(--v-font); font-size: 1.9rem; font-weight: 800; line-height: 1.1; color: var(--t-text); }
.tone-amber .v-stat-value { color: color-mix(in srgb, var(--t) 70%, var(--text)); }
.v-stat-label { margin-top: 4px; font-size: .8rem; color: var(--text-muted); line-height: 1.35; }

/* ---------- Barres ---------- */
.v-bars { display: flex; flex-direction: column; gap: 11px; }
.v-bar-row { display: grid; grid-template-columns: minmax(90px, 26%) 1fr auto; align-items: center; gap: 12px; font-size: .86rem; }
.v-bar-label { font-weight: 600; }
.v-bar-track { height: 22px; border-radius: 999px; background: var(--t-mid); overflow: hidden; }
.v-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--t), color-mix(in srgb, var(--t) 70%, #fff)); }
.v-bar-value { font-family: var(--v-font); font-weight: 800; min-width: 3.2em; text-align: right; color: var(--t-text); }

/* ---------- Mnémotechnique ---------- */
.v-mnemo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.v-mnemo-word { font-family: var(--v-font); font-weight: 800; font-size: 1.05rem; letter-spacing: .18em; text-transform: uppercase; color: var(--t-text); }
.v-mnemo-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.v-mnemo-tile { width: 132px; padding: 12px 10px 12px; background: var(--bg-card); border: 2px solid var(--t); border-radius: 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 8px 16px -12px var(--t); }
.v-mnemo-letter { width: 54px; height: 54px; border-radius: 16px; background: var(--t); color: var(--t-ink); font-family: var(--v-font); font-weight: 800; font-size: 1.9rem; display: flex; align-items: center; justify-content: center; transform: rotate(-4deg); }
.v-mnemo-tile .v-emoji { font-size: 1.4rem; }
.v-mnemo-meaning { font-size: .8rem; line-height: 1.3; font-weight: 600; }
.v-mnemo-tip { margin: 0; text-align: center; font-size: .86rem; color: var(--text-muted); }

/* ---------- Encadrés ---------- */
.v-callout { display: flex; gap: 14px; align-items: flex-start; padding: 15px 18px; border-radius: 20px; background: var(--t-soft); border: 2px dashed var(--t); }
.v-callout-emoji { font-size: 2rem; }
.v-callout-body { flex: 1; min-width: 0; }
.v-callout strong { display: block; margin-bottom: 4px; font-family: var(--v-font); font-size: .95rem; color: var(--t-text); text-transform: uppercase; letter-spacing: .04em; }
.tone-amber.v-callout strong { color: color-mix(in srgb, var(--t) 60%, var(--text)); }

/* ---------- À faire / à éviter ---------- */
.v-dosdonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.v-dd { background: var(--bg-card); border-radius: 18px; border: 2px solid var(--t); overflow: hidden; }
.v-dd-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--t); color: var(--t-ink); }
.v-dd-head h4 { margin: 0; font-family: var(--v-font); font-size: .92rem; }
.v-dd .v-list { padding: 14px 16px 16px; }

/* ---------- Liste à pastilles ---------- */
.v-iconlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.v-iconlist li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--bg-card); border: 2px solid var(--t-line); font-size: .86rem; line-height: 1.45; }
.v-iconlist .v-emoji { width: 40px; height: 40px; border-radius: 13px; background: var(--t-mid); font-size: 1.4rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Définitions ---------- */
.v-defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.v-def { background: var(--bg-card); border-radius: 16px; border: 2px solid var(--t-line); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.v-def-term { display: inline-flex; align-items: center; gap: 6px; background: var(--t); color: var(--t-ink); padding: 3px 12px 3px 8px; border-radius: 999px; font-family: var(--v-font); font-weight: 700; font-size: .8rem; }
.v-def-text { font-size: .85rem; line-height: 1.5; }

/* ---------- Mémo express & glossaire ---------- */
.v-memo { border-radius: 22px; padding: 18px 22px 20px; background: #fff3a6; color: #3b2a00; border: 2px solid #f2c200; box-shadow: var(--v-shadow); transform: rotate(-.4deg); }
.v-memo h3 { margin: 0 0 10px; font-family: var(--v-font); font-size: 1.1rem; }
.v-memo ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; line-height: 1.5; }
.v-memo ol li::marker { font-weight: 800; color: #b07d00; }
.v-memo mark.term-mark { background: rgba(242, 178, 0, .45); }
:root[data-theme="dark"] .v-memo { background: #3a3110; color: #ffeaa0; border-color: #7a6414; }
:root[data-theme="dark"] .v-memo ol li::marker { color: #f2c200; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v-memo { background: #3a3110; color: #ffeaa0; border-color: #7a6414; }
  :root:not([data-theme="light"]) .v-memo ol li::marker { color: #f2c200; }
}
.v-glossary { border-radius: 22px; background: var(--bg-card); border: 2px solid var(--border-strong); padding: 16px 20px 20px; }
.v-glossary h3 { margin: 0 0 12px; font-family: var(--v-font); font-size: 1.05rem; }
.v-glossary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 8px 12px; }
.v-gloss { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--t-soft); border-left: 4px solid var(--t); font-size: .8rem; line-height: 1.4; }
.v-gloss strong { color: var(--t-text); font-family: var(--v-font); overflow-wrap: anywhere; }
.tone-amber.v-gloss strong { color: var(--text); }

/* ---------- Mode test : termes clés masqués ---------- */
.v-fiche.is-recall mark.term-mark:not(.is-revealed) {
  color: transparent; background: var(--t-mid); border-radius: 6px; cursor: pointer; user-select: none;
  box-shadow: inset 0 0 0 1px var(--t-line);
}
.v-fiche.is-recall mark.term-mark { cursor: pointer; }


/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .v-grid { grid-template-columns: 1fr; }
  .v-section, .v-section.span-6, .v-section.span-4, .v-section.span-8 { grid-column: 1 / -1; }
  .v-cards { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
  .v-compare, .v-compare:has(.v-vs) { grid-template-columns: 1fr; }
  .v-vs { justify-self: center; }
  .v-dosdonts { grid-template-columns: 1fr; }
  .v-hero { padding: 22px 18px 18px; }
  .v-hero h1 { font-size: 1.6rem; }
  .v-hero-stamp { width: 64px; height: 64px; font-size: 2.2rem; border-radius: 20px; }
  .v-step-arrow { display: none; }
  .v-bar-row { grid-template-columns: 1fr auto; }
  .v-bar-label { grid-column: 1 / -1; }
  .v-bar-track { grid-column: 1; }
}

/* ---------- Impression / PDF ---------- */
@media print {
  @page { margin: 14mm 12mm; }
  main#app.wide { max-width: 100%; }
  .v-fiche, .v-fiche * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Chaque carte / infographie reste entière : jamais coupée au milieu par un saut de page. */
  .v-hero, .v-fact,
  .v-section, .v-card, .v-step,
  .v-cycle, .v-cycle-node,
  .v-compare, .v-side,
  .v-tl-item,
  .v-levels, .v-level,
  .v-stat, .v-bar-row,
  .v-mnemo, .v-mnemo-tile,
  .v-callout,
  .v-dosdonts, .v-dd,
  .v-iconlist li,
  .v-def, .v-gloss,
  .v-memo,
  .v-table-wrap, .v-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Un titre ne reste jamais seul en bas de page, séparé du contenu qui suit. */
  .v-fiche h1, .v-fiche h2, .v-fiche h3, .v-fiche h4,
  .v-section-head, .v-card-head, .v-side-head, .v-dd-head {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Un paragraphe coupé garde au moins 3 lignes de chaque côté du saut de page. */
  .v-fiche p, .v-fiche li {
    orphans: 3;
    widows: 3;
  }

  /* L'en-tête du tableau se répète si le tableau continue sur la page suivante. */
  .v-table thead { display: table-header-group; }

  .v-hero, .v-section:not(.is-bare), .v-memo { box-shadow: none; }
  .v-memo { transform: none; }
  .v-fiche.is-recall mark.term-mark { color: inherit !important; background: none !important; }
}
