/* =========================================================
   Dico+ Inspire 1 — enveloppe v1 (docs/enveloppe-v1.md)
   Charte : charte-graphique.md (Inspire 1 NE). Police : Ubuntu.
   Mobile d'abord ; adaptations en @container sur #app.
========================================================= */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --ink:     #231f20;
  --ink-2:   #404041;
  --ink-3:   #939598;   /* traits et éléments graphiques (3:1) */
  --ink-muted: #6d6e71; /* petits textes secondaires (5,1:1 sur blanc — retours PY v2) */
  --line:    #e6e7e8;
  --paper:   #ffffff;
  --paper-2: #f6f0eb;   /* beige chaud HFLE, repris du POC (Pierre-Yves, 26/09) */

  --masc:  #7570b3;
  --fem:   #71bf44;
  --plur:  #f7941d;
  --alert: #ed1c24;
  --alert-pale: #fde3e4;
  --ok:    #3ba936;
  --ok-pale: #e6f4df;
  --ok-text:    #2e7d32;   /* vert et rouge foncés pour le texte (≥ 4,5:1) ; --ok / --alert restent pour les aplats */
  --alert-text: #c62828;
  --masc-band:  #726db1;   /* bandeaux de genre à texte blanc assombris à 4,6:1 */
  --fem-band:   #4c822d;

  --font: 'Ubuntu', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-card: 24px;
  --r-ctl:  12px;
  --r-pill: 999px;

  --t-fast: .15s ease;
  --t-card: .32s cubic-bezier(.4, 0, .2, 1);
  --t-pop:  .45s cubic-bezier(.34, 1.56, .64, 1);
}

/* Gamme neutre (hors unité) puis les quatre gammes du livre, par unité.
   Le sélecteur d'attribut sert à #app comme aux pastilles de la Home. */
:where(#app, [data-unite]) {
  --u-main: var(--ink);
  --u-vive: var(--ink-3);
  --u-mid:  var(--ink-2);
  --u-soft: var(--ink-3);
  --u-pale: var(--line);
}
[data-unite="u1"], [data-unite="u5"] { --u-main: #00517e; --u-vive: #1dbecf; --u-mid: #0088b6; --u-soft: #547a8c; --u-pale: #8dd4df; }
[data-unite="u2"], [data-unite="u6"] { --u-main: #007355; --u-vive: #a6ce38; --u-mid: #129976; --u-soft: #70866c; --u-pale: #c8df88; }
[data-unite="u3"], [data-unite="u7"] { --u-main: #5c2d91; --u-vive: #c981b7; --u-mid: #915ca5; --u-soft: #897580; --u-pale: #dbafd2; }
[data-unite="u4"], [data-unite="u8"] { --u-main: #ef4023; --u-vive: #fdb913; --u-mid: #f7941d; --u-soft: #8b7c56; --u-pale: #ffd27c; }
:where(#app, [data-unite]) {
  --u-tint:  color-mix(in srgb, var(--u-pale) 30%, var(--paper));
  --u-tint2: color-mix(in srgb, var(--u-pale) 55%, var(--paper));
}

/* Tailles fluides sur la largeur du conteneur (#app) */
#app {
  --fs-word:  clamp(30px, 9cqi, 44px);
  --fs-title: clamp(24px, 6.5cqi, 34px);
  --fs-h2:    clamp(18px, 4.6cqi, 22px);
  --fs-body:  clamp(16px, 4cqi, 18px);
  --fs-small: 14px;
  --fs-badge: 13px;   /* petits corps fixes : numéros de cercles, pastilles, badges */
  --fs-xs:    12px;
  --fs-brand: clamp(42px, 13cqi, 48px);   /* « Dico+ » sur la Home */
  --sp-1: clamp(6px, 1.5cqi, 8px);
  --sp-2: clamp(10px, 2.5cqi, 14px);
  --sp-3: clamp(16px, 4cqi, 24px);
  --sp-4: clamp(24px, 6cqi, 36px);
  --sp-5: clamp(32px, 8cqi, 56px);
  --gutter: 16px;
  --col: 100%;
  --card-max: 520px;
}

/* ── Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; -webkit-text-size-adjust: 100%; }
/* Le conteneur requêtable est <body> : les règles @container s'appliquent aux
   descendants du conteneur, donc à #app (qui porte les jetons). */
body { container-type: inline-size; container-name: app; }
html, body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Pendant le jeu : pas de barres de défilement au passage de la carte
   (classe posée sur <html> par setView / showWelcome). */
html.is-playing, html.is-playing body { overflow: clip; }

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

button, input, select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img { display: block; max-width: 100%; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
select {
  appearance: none;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23404041' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4,6 8,10 12,6'/%3E%3C/svg%3E") no-repeat right 14px center / 14px;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) { select:hover { border-color: var(--ink-3); } }

/* ── Boutons ─────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  border-radius: var(--r-ctl);
  font-size: var(--fs-body); font-weight: 500; line-height: 1.2;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-primary { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .btn-primary:hover { background: var(--ink-2); } }
.btn-secondary { background: var(--paper); color: var(--ink); border: 1px solid var(--ink-3); }
@media (hover: hover) { .btn-secondary:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-2); } }
.btn-primary:active, .btn-secondary:active { transform: translateY(1px); }
.btn-primary[disabled], .btn-secondary[disabled] { opacity: .45; }
.btn-secondary svg, .btn-primary svg { width: 20px; height: 20px; flex: 0 0 auto; }

/* ── Cercle numéroté (l'ouverture d'unité du livre) ────────── */
.u-circle {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}

/* ── En-tête ─────────────────────────────────────────────── */
#app-header {
  position: sticky; top: 0; z-index: 100;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 8px;
  background: var(--paper);
}
html.is-playing #app-header { background: transparent; }

#header-bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }

#home-btn {
  width: 44px; height: 44px; margin-left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--ink);
}
@media (hover: hover) { #home-btn:hover { background: var(--paper-2); color: var(--ink); } }
#home-btn svg { width: 18px; height: 18px; fill: currentColor; }

#breadcrumb-nav { position: relative; display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.breadcrumb__item {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 6px; border-radius: 8px;
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) { .breadcrumb__item:hover { background: var(--paper-2); color: var(--ink); } }
.breadcrumb__item.is-active { color: var(--ink); font-weight: 700; }
.breadcrumb__sep { color: var(--ink-3); font-size: var(--fs-small); }
/* Le crumb d'unité : le mot « Unité » puis le cercle numéroté de l'en-tête du livre (Pascal, 25/09) */
.breadcrumb__item--unite { gap: 5px; color: var(--ink-2); }
.breadcrumb__unite-circle {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--u-vive); color: var(--u-main);
  font-size: var(--fs-badge); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}
.breadcrumb__item--unite.is-active { color: var(--u-main); font-weight: 700; }
.breadcrumb__item--unite.is-active .breadcrumb__unite-circle { background: var(--u-main); border-color: var(--u-main); color: var(--paper); }
@media (hover: hover) { .breadcrumb__item--unite:hover .breadcrumb__unite-circle { background: var(--u-main); border-color: var(--u-main); color: var(--paper); } }

/* Plein écran + langue : un seul bloc, collé à droite à toutes les largeurs (Pascal, 17/11) */
#header-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
#lang-selector { position: relative; }
#lang-btn {
  min-width: 56px; height: 44px; padding: 0 8px 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  font-size: var(--fs-small); font-weight: 700; letter-spacing: .04em; color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
#lang-btn svg { width: 12px; height: 12px; color: var(--ink-2); }
@media (hover: hover) { #lang-btn:hover { border-color: var(--ink-3); background: var(--paper-2); } }
#bc-menu.bc-menu--lang { left: auto !important; right: 0; min-width: 170px; }
.bc-menu__item.lang-menu__item { justify-content: flex-start; align-items: center; gap: 12px; }
.lang-menu__code { width: 24px; font-weight: 700; letter-spacing: .04em; }

.header-icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--ink-2);
}
.header-icon-btn svg { width: 20px; height: 20px; }
@media (hover: hover) { .header-icon-btn:hover { background: var(--paper-2); color: var(--ink); } }
#fullscreen-btn .fs-off, #fullscreen-btn.is-on .fs-on { display: none; }
#fullscreen-btn.is-on .fs-off { display: block; }

#lesson-title { display: none; }

/* Ligne vue + mode */
#header-row-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
#header-row-controls.is-game { justify-content: center; }
#header-row-controls.is-game #view-toggle { display: none; }

#view-toggle { display: flex; gap: 6px; flex: 1; }
.view-toggle__btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
}
.view-toggle__btn.is-active { background: var(--paper-2); color: var(--ink); border-color: var(--ink); }
.view-toggle__icon { width: 15px; height: 15px; }

#mode-toggle {
  display: flex; flex-shrink: 0;
  border: 1px solid var(--ink-3); border-radius: var(--r-ctl); overflow: hidden;
}
.mode-toggle__btn {
  width: 48px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.mode-toggle__btn + .mode-toggle__btn { border-left: 1px solid var(--line); }
@media (hover: hover) { .mode-toggle__btn:hover { background: var(--paper-2); color: var(--ink); } }
.mode-toggle__btn svg { width: 18px; height: 18px; fill: currentColor; }
.mode-toggle__btn.is-active { background: var(--ink); color: var(--paper); }
#mode-toggle.is-hidden-in-list { display: none; }

/* Recherche + filtres (vue liste) */
#list-controls { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#list-search-wrap { position: relative; display: flex; align-items: center; }
#list-search-icon { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
#list-search-input {
  width: 100%; min-height: 46px; padding: 10px 40px 10px 42px;
  border: 1px solid transparent; border-radius: var(--r-ctl);
  background: var(--paper-2); font-size: var(--fs-body);
  transition: border-color var(--t-fast), background var(--t-fast);
}
#list-search-input::placeholder { color: var(--ink-muted); }
#list-search-input:focus { outline: none; border-color: var(--ink); background: var(--paper); }
#list-search-input::-webkit-search-cancel-button { display: none; }
#list-search-clear {
  position: absolute; right: 1px; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
}
@media (hover: hover) { #list-search-clear:hover { background: var(--line); } }
#list-search-clear svg { width: 12px; height: 12px; }

#list-filters-row { display: flex; gap: 8px; }
.list-filter-dropdown { position: relative; flex: 1; }
.list-filter-dropdown summary {
  list-style: none; cursor: pointer; text-align: center;
  min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); white-space: nowrap;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.list-filter-dropdown summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .list-filter-dropdown summary:hover { border-color: var(--ink-3); } }
.list-filter-dropdown[open] summary { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }
.list-filter-dropdown__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  width: max(100%, min(340px, 100cqi - 2 * var(--gutter)));   /* plus large que le bouton : les thèmes sont parfois longs */
  max-height: min(60vh, 420px); overflow: hidden auto; overscroll-behavior: contain;
  padding: 6px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  box-shadow: 0 10px 30px rgba(35, 31, 32, .14);
}
.list-filter-dropdown__opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 10px; border-radius: 8px;
  font-size: var(--fs-small); line-height: 1.3; cursor: pointer;
}
/* Même grammaire que les menus du fil (bc-menu) : libellé, puis compteur gris à droite */
.list-filter-dropdown__label { flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 4px; }
.list-filter-dropdown__count { flex: 0 0 auto; margin-left: 8px; font-size: var(--fs-xs); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
#list-filter-tags .list-filter-dropdown__panel { left: auto; right: 0; }
#list-filter-unites .list-filter-dropdown__panel { width: max-content; min-width: 100%; }   /* « Unité ① … 57 » : la largeur du contenu suffit */
@media (hover: hover) { .list-filter-dropdown__opt:hover { background: var(--paper-2); } }
.list-filter-dropdown__opt input { width: 18px; height: 18px; accent-color: var(--ink); flex-shrink: 0; }

/* ── Progression + stats ─────────────────────────────────── */
#session-progress { padding: 6px var(--gutter) 12px; }
#progress-track { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; }
.progress-seg { flex: 1; background: var(--line); transition: background .3s ease; }
.progress-seg--learned { background: var(--ok); }
.progress-seg--review  { background: var(--alert); }

#stats-row { display: flex; gap: 8px; margin-top: 10px; }
.stat-card {
  flex: 1; padding: 8px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  transition: border-color var(--t-fast), background var(--t-fast);
}
@media (hover: hover) { .stat-card:hover { border-color: var(--ink); background: var(--paper-2); } }
.stat-card--static { cursor: default; }
@media (hover: hover) { .stat-card--static:hover { border-color: var(--line); background: transparent; } }
.stat-card__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-card__label { margin-top: 4px; font-size: var(--fs-xs); color: var(--ink-muted); }

/* ── Contenu ─────────────────────────────────────────────── */
#main-content {
  flex: 1; display: flex; flex-direction: column;
  width: 100%; max-width: var(--col); margin: 0 auto;
  padding-bottom: 24px;
}
#app:has(#app-bottom-bar:not(.u-hidden)) #main-content { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* ── Home ────────────────────────────────────────────────── */
#view-home { flex: 1; display: flex; justify-content: center; padding: var(--sp-2) var(--gutter) var(--sp-3); }
#home-content { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
#home-brand { text-align: center; margin: var(--sp-1) 0 var(--sp-1); }
#home-welcome { font-size: var(--fs-body); color: var(--ink-2); }
#home-title { font-size: var(--fs-brand); letter-spacing: -0.04em; }
#home-title strong { font-weight: 600; opacity: 90%; }
#home-edition { display: block; width: min(280px, 75%); height: auto; margin: var(--sp-2) auto 0; }   /* logo Inspire 2e édition (temporaire, 26/09) */
#home-choose-label { font-weight: 600; margin-bottom: calc(-1 * var(--sp-3) + var(--sp-2)); }
/* Liste déroulante des leçons : un bloc par unité (cercle + leçons dans la couleur), quatre colonnes, dans le flux */
.home-lesson-dd { width: 100%; max-width: 360px; }
.home-lesson-dd summary {
  list-style: none; cursor: pointer;
  padding: 12px 40px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23404041' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4,6 8,10 12,6'/%3E%3C/svg%3E") no-repeat right 14px center / 14px;
  color: var(--ink-2); transition: border-color var(--t-fast);
}
.home-lesson-dd summary::-webkit-details-marker { display: none; }
.home-lesson-dd[open] summary { border-color: var(--ink); color: var(--ink); }
@media (hover: hover) { .home-lesson-dd summary:hover { border-color: var(--ink); color: var(--ink); } }
.home-lesson-dd__panel {
  margin-top: 6px; padding: 10px 8px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--paper);
}
.hl-unit { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.hl-unit__num {
  align-self: center; width: 26px; height: 26px; margin-bottom: 2px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--u-main); color: var(--paper); font-size: var(--fs-badge); font-weight: 700; font-variant-numeric: tabular-nums;
}
.hl-lesson {
  min-height: 32px; padding: 4px 2px; border-radius: 8px;
  background: var(--u-tint); color: var(--u-main);
  font-size: clamp(12px, 3.8cqi, 14px); font-weight: 500; white-space: nowrap;   /* « Lektion 12 » tient à 320 px */
  transition: background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) { .hl-lesson:hover { background: var(--u-tint2); } }
.hl-lesson.is-current { background: var(--u-main); color: var(--paper); }
.hl-lesson.is-empty { opacity: .4; }

/* Les 8 unités : les cercles d'ouverture du livre, dans leur couleur */
#home-units { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 360px; }
.home-unit-btn {
  aspect-ratio: 1; border-radius: 50%;
  background: var(--paper); color: var(--ink);
  font-size: clamp(24px, 7cqi, 32px); font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 7px var(--ink-3), 0 0 0 2px transparent;   /* anneau double, comme le numéro du bandeau d'unité */
  transition: transform .12s ease, box-shadow .12s ease;
}
@media (hover: hover) { .home-unit-btn:hover { transform: translateY(-2px); } }
.home-unit-btn.is-empty { opacity: .35; }
.home-unit-btn:focus-visible { outline-color: var(--ink); }

#home-footer { position: relative; display: flex; gap: 12px; width: 100%; max-width: 360px; margin-top: var(--sp-1); }
#home-footer .btn-secondary { flex: 1; }
#home-reviser-btn[disabled] { opacity: .45; }

/* ── Page unité : ouverture d'unité du livre ─────────────── */
#view-unite { display: flex; flex-direction: column; }
#unite-hero {
  position: relative;
  padding: var(--sp-4) var(--gutter) var(--sp-4);
  padding-right: calc(var(--gutter) + 88px);
  background: var(--ink); color: var(--paper);
}
#unite-num {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: 72px; height: 72px; font-size: 38px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 7px var(--ink-3);
}
#unite-title { font-size: var(--fs-small); font-weight: 500; opacity: .85; }
#unite-question { margin-top: 6px; font-size: var(--fs-title); font-weight: 700; line-height: 1.15; text-wrap: balance; }
#unite-question:empty { display: none; }

#unite-content { padding: var(--sp-2) var(--gutter) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
#unite-lecons { display: flex; flex-direction: column; }
/* Leçons en lignes : le cartouche « LEÇON N » de S'entraîner (numéro sur carré vif) */
.unite-lecon-btn {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left; font-size: var(--fs-body); font-weight: 500;
  transition: background var(--t-fast);
}
@media (hover: hover) { .unite-lecon-btn:hover { background: var(--paper-2); } }
.unite-lecon-btn__title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.unite-lecon-btn__themes { font-size: var(--fs-small); font-weight: 400; color: var(--ink-2); }
.unite-lecon-btn__num {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-3); color: var(--ink);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.unite-lecon-btn__count { flex: 0 0 auto; font-size: var(--fs-small); font-weight: 400; color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#unite-actions { display: flex; gap: 12px; }
#unite-actions .btn-secondary { flex: 1; min-width: 0; padding-inline: 10px; line-height: 1.2; text-wrap: balance; }   /* libellés complets (« S’entraîner sur l’unité 2 ») : retour à la ligne équilibré plutôt que débordement */
#unite-reviser-btn[disabled] { opacity: .45; }

/* ── Écran leçon ─────────────────────────────────────────── */
#view-welcome { flex: 1; display: flex; justify-content: center; padding: var(--sp-3) var(--gutter) var(--sp-4); }
#welcome-content { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; }

#welcome-themes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: var(--sp-2) 0 var(--sp-1) 0; }
.welcome-theme-pill {
  min-height: 34px; padding: 4px 12px; border-radius: var(--r-ctl);
  font-size: var(--fs-badge); font-weight: 600;
  letter-spacing: -0.02em;
  border: 2px solid transparent;
  transition: transform .1s, background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.welcome-theme-pill:active { transform: scale(.96); }
.welcome-theme-pill.is-on  { background: var(--paper-2); color: var(--ink); border-color: var(--ink); }
.welcome-theme-pill.is-off { color: var(--ink-muted); border-color: var(--ink-3); border-style: dashed; }
@media (hover: hover) { .welcome-theme-pill.is-off:hover { color: var(--ink-2); } }

#welcome-title { font-size: var(--fs-title); font-weight: 700; margin-top: 0; }
#welcome-subtitle { font-size: var(--fs-body); color: var(--ink-2); line-height: 1.5; }
#welcome-subtitle strong { color: var(--ink); font-weight: 700; }

#welcome-modes { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: var(--sp-1); }
.welcome-mode-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--paper); text-align: left;
  transition: border-color var(--t-fast), background var(--t-fast);
}
@media (hover: hover) { .welcome-mode-btn:hover { border-color: var(--ink); background: var(--paper-2); } }
.welcome-mode-btn:active, .welcome-mode-btn.is-selected { border-color: var(--ink); background: var(--paper-2); }
.welcome-mode-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-2); color: var(--ink);
  transition: background var(--t-fast), color var(--t-fast);
}
.welcome-mode-btn.is-selected .welcome-mode-icon { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .welcome-mode-btn:hover .welcome-mode-icon { background: var(--ink); color: var(--paper); } }
.welcome-mode-icon svg { width: 20px; height: 20px; fill: currentColor; }
.welcome-mode-text { display: flex; flex-direction: column; min-width: 0; }
.welcome-mode-label { font-size: var(--fs-h2); font-weight: 700; line-height: 1.2; }
.welcome-mode-desc { font-size: var(--fs-small); color: var(--ink-2); }
/* Essai (Pascal + Pierre-Yves, 26/09) : boutons réduits à Texte / Audio / Image — retirer cette règle pour remettre les sous-phrases */
.welcome-mode-desc { display: none; }

#welcome-list-sep { width: 100%; max-width: 280px; border-top: 1px solid var(--line); margin: auto auto 0; padding-top: var(--sp-1); }   /* margin-top auto : le Lexique se ferre en bas de l'écran (Pascal, 25/09) */
#welcome-actions { display: flex; gap: 12px; width: 100%; }
#welcome-actions .btn-secondary { flex: 1; min-width: 0; padding-inline: 10px; line-height: 1.2; text-wrap: balance; }

/* ── Vue liste : des lignes, pas des boîtes ──────────────── */
#view-list { flex: 1; display: flex; flex-direction: column; padding: 4px var(--gutter) var(--sp-3); }

.list-card {
  border-bottom: 1px solid var(--line); border-radius: var(--r-ctl);
  cursor: pointer;
  transition: opacity var(--t-fast), box-shadow var(--t-fast);
}
/* Survol : un encadré plutôt qu'un fond coloré, qui tranchait avec le fond blanc des images (Pascal, 17/11) */
@media (hover: hover) { .list-card:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); } }
.list-card.is-learned { opacity: .4; }
.list-card.is-learned .list-card__word { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.list-card--dim { opacity: .6; }
.list-card--dim:active, .list-card--dim.is-expanded { opacity: .85; }
.list-card--draft { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--paper-2) 8px 10px); }

.list-card__row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px; }   /* 10 px : l'encadré du survol ne frôle pas le texte */
.list-card__body { flex: 1; min-width: 0; }
.list-card__word { font-size: var(--fs-h2); font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.list-card__bigword { font-size: var(--fs-body); }
.list-card__chevron { width: 10px; height: 10px; margin-left: 8px; color: var(--ink-3); vertical-align: middle; transition: transform var(--t-fast); }
.list-card.is-expanded .list-card__chevron { transform: rotate(180deg); }
.list-card__definition { margin-top: 2px; font-size: var(--fs-small); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card__hl { font-weight: 700; text-decoration: underline; text-decoration-color: var(--ink-3); }

.list-card__play-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink-3); color: var(--ink-2);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.list-card__play-btn:active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (hover: hover) { .list-card__play-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); } }
.list-card__play-btn svg { width: 18px; height: 18px; }

.list-card__expand { display: none; gap: 14px; padding: 4px 10px 14px; }
.list-card.is-expanded .list-card__expand { display: flex; }
.list-card__expand-image {
  flex: 0 0 auto; width: min(66%, 270px); aspect-ratio: 3 / 2;   /* 3:2, pas plus haute que l'ancien carré (44 %, 180 px) */
  border-radius: var(--r-ctl); overflow: hidden; background: var(--paper);
  display: flex; align-items: center; justify-content: center; font-size: 56px;
}
.list-card__expand-image img { width: 100%; height: 100%; object-fit: contain; }
.list-card__expand-image .list-card__icon-svg svg { width: 40px; height: 40px; }
.list-card__icon-svg { display: flex; align-items: center; justify-content: center; }
.list-card__expand-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-end; }   /* genre en haut à droite, sous le bouton audio */
.list-card__objectif-tag {
  display: inline-block; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink);
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.4;
}
/* Genre : pastille en haut à droite de la zone de détail, sous le bouton audio (Pascal, 17/11) */
.list-card__genre-band {
  display: none;
  padding: 5px 14px; border-radius: var(--r-pill);
  color: var(--paper); font-size: var(--fs-small); font-weight: 500;
}
.list-card.is-expanded .list-card__genre-band { display: inline-block; }
.list-card__genre-band--masculin { background: var(--masc-band); }
.list-card__genre-band--feminin  { background: var(--fem-band); }

#view-list__footer { padding: var(--sp-3) 0 0; display: flex; justify-content: center; }
#list-restart-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ── Cartes ──────────────────────────────────────────────── */
#view-flip { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 var(--gutter) var(--sp-3); }
#flip-actions, #swipe-hints { display: none; }

#card-stack {
  position: relative;
  width: 100%; max-width: var(--card-max);
  aspect-ratio: 4 / 5;
  max-height: calc(100dvh - 300px);
  min-height: 360px;
  margin: 0 auto var(--sp-3);
}

.flip-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 7% 6%;
  background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 8px 28px rgba(35, 31, 32, .08);
  cursor: pointer; user-select: none; touch-action: none;
  transition: transform var(--t-card), opacity var(--t-card), border-color .25s ease;
}
.flip-card--top    { z-index: 3; transition: none; }
.flip-card--under1 { z-index: 2; transform: scale(.94) translateY(12px); pointer-events: none; box-shadow: none; }
.flip-card--under2 { z-index: 1; transform: scale(.88) translateY(24px); pointer-events: none; box-shadow: none; }


.flip-card__face-label { font-size: var(--fs-small); color: var(--ink-muted); margin-bottom: 12px; }
.flip-card__word { font-size: var(--fs-word); font-weight: 500; line-height: 1.15; text-align: center; margin-bottom: 8px; overflow-wrap: anywhere; }
.flip-card__definition { font-size: var(--fs-body); color: var(--ink-2); text-align: center; line-height: 1.5; margin-bottom: 16px; max-width: 32ch; }
.flip-card__definition--top { margin-bottom: 20px; }

/* Visuel au format des images (3:2 paysage, 17/11) : pleine largeur de la carte ; il cède de la
   hauteur quand la carte manque de place (min-height: 0), l'image restant entière (contain). */
.flip-card__visual {
  flex: 0 1 auto; min-height: 0; width: 100%; aspect-ratio: 3 / 2;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; overflow: hidden; font-size: clamp(72px, 25cqi, 120px); line-height: 1;
  margin-bottom: 14px;
}
.flip-card__visual.flip-card__visual--large { font-size: clamp(90px, 32cqi, 150px); margin-bottom: 0; }
.flip-card__icon-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; user-select: none; }
/* Verso : la place du bandeau de genre est réservée (il ne recouvre plus le bas du contenu) */
.flip-card.is-verso:has(> .flip-card__genre-band) { padding-bottom: 56px; }
/* Verso du mode Texte (maquette Pascal, 17/11) : traduction en haut, image pleine largeur, Écouter dessous */
.flip-card[data-mode="classique"].is-verso { justify-content: space-evenly; }
.flip-card[data-mode="classique"].is-verso .flip-card__definition--top { margin-bottom: 0; }
.flip-card[data-mode="classique"].is-verso .flip-card__visual { margin-bottom: 0; }
.flip-card__icon-svg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.flip-card__icon-svg svg { width: 100%; height: 100%; max-width: 180px; max-height: 180px; }

.flip-card__audio-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 20px;
  border: 1px solid var(--ink-3); border-radius: var(--r-pill);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.flip-card__audio-btn:active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (hover: hover) { .flip-card__audio-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); } }
.flip-card__audio-btn svg { width: 14px; height: 14px; }

.flip-card__play-trigger {
  width: 96px; height: 96px; border-radius: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-2); color: var(--ink);
  transition: background var(--t-fast), color var(--t-fast);
}
.flip-card__play-trigger:active { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .flip-card__play-trigger:hover { background: var(--ink); color: var(--paper); } }
.flip-card__play-trigger svg { width: 40px; height: 40px; }

.flip-card__flip-btn {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--paper); font-size: var(--fs-xs); color: var(--ink-muted);
  pointer-events: none; white-space: nowrap;
}
.flip-card__flip-btn svg { width: 15px; height: 15px; }
.flip-card__flip-btn span::first-letter { text-transform: uppercase; }

/* Verso : bandeau de genre en pied, mauve / vert de la nouvelle édition */
.flip-card__genre-band {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 0 12px; text-align: center;
  color: var(--paper); font-size: var(--fs-small); font-weight: 500;
  border-bottom-left-radius: inherit; border-bottom-right-radius: inherit;
}
.flip-card__genre-band--masculin { background: var(--masc-band); }
.flip-card__genre-band--feminin  { background: var(--fem-band); }

.flip-card__half { flex: 1 1 50%; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.flip-card__half--bottom { padding-bottom: 34px; }

/* ── Écrans de fin (session, quiz) ───────────────────────── */
.end-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: var(--sp-5) var(--gutter); text-align: center;
}
.end-screen__score { font-size: clamp(56px, 18cqi, 84px); font-weight: 300; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.end-screen__title { font-size: var(--fs-title); font-weight: 700; }
.end-screen__subtitle { font-size: var(--fs-body); color: var(--ink-2); line-height: 1.5; max-width: 30ch; }
.end-screen__actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 300px; margin-top: 12px; }

/* ── Barre du bas ────────────────────────────────────────── */
#app-bottom-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--col); z-index: 200;
  display: flex; gap: 0;
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-bar__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 72px; padding: 10px 8px;
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2);
  transition: color var(--t-fast), background var(--t-fast);
}
@media (hover: hover) { .bottom-bar__btn:hover { background: var(--paper-2); color: var(--ink); } }
.bottom-bar__btn.is-active { color: var(--ink); }
.bottom-bar__btn[disabled] { opacity: .45; }
.bottom-bar__btn svg { width: 26px; height: 26px; fill: currentColor; }
.bottom-bar__action svg, #bottom-btn-discover svg { fill: none; }   /* pictos en trait : le fill de la barre ne s'applique pas */
.bottom-bar__action--reject { color: var(--alert-text); }
.bottom-bar__action--accept { color: var(--ok-text); }
@media (hover: hover) { .bottom-bar__action--accept:hover { background: var(--ok); color: var(--paper); } }
@media (hover: hover) { .bottom-bar__action--reject:hover { background: var(--alert); color: var(--paper); } }
.bottom-bar__sep { width: 1px; background: var(--line); margin: 12px 0; }

/* ── Menus du fil d'ariane ───────────────────────────────── */
#bc-menu {
  position: absolute; top: calc(100% + 6px); z-index: 60; min-width: 190px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 60vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  box-shadow: 0 10px 30px rgba(35, 31, 32, .14);
}
.bc-menu__item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  min-height: 44px; padding: 8px 10px; border-radius: 8px;
  text-align: left; font-size: var(--fs-small); white-space: nowrap;
}
@media (hover: hover) { .bc-menu__item:hover { background: var(--paper-2); color: var(--ink); } }
.bc-menu__item.is-current { font-weight: 700; }
.bc-menu__item.is-empty { opacity: .45; }
.bc-menu__count { font-size: var(--fs-xs); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
#bc-menu.bc-menu--up { top: auto; bottom: calc(100% + 6px); }
/* Variantes (Pascal, 25/09) : unités = grille de cercles colorés, leçons = puces teintées (styles .hl-lesson de la Home) */
#bc-menu.bc-menu--units { display: grid; grid-template-columns: repeat(4, 44px); gap: 8px; min-width: 0; padding: 10px; }
.bc-menu__unit {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--u-main); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 3px var(--u-main), inset 0 0 0 5px var(--u-vive), 0 0 0 2px transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
@media (hover: hover) { .bc-menu__unit:hover { transform: translateY(-2px); } }
.bc-menu__unit.is-current { background: var(--u-main); color: var(--paper); }
.bc-menu__unit.is-empty { opacity: .35; }
#bc-menu.bc-menu--lessons { min-width: 180px; gap: 4px; }
.bc-menu__lesson { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 6px 10px; text-align: left; }
.bc-menu__lesson .bc-menu__count { color: inherit; opacity: .7; }   /* Home › Réviser : le menu s'ouvre au-dessus du bouton */

/* ── DEV ─────────────────────────────────────────────────── */
.dev-toggle {
  margin-top: var(--sp-3); padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px dashed var(--ink-3); color: var(--ink-3); font-size: var(--fs-xs);
}
@media (hover: hover) { .dev-toggle:hover { color: var(--ink); } }

/* Pied de la Home : logo Hachette FLE → mentions légales, ferré en bas quand la place le permet */
#home-credits {
  margin-top: auto; padding-top: var(--sp-4);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--ink-3); font-size: var(--fs-xs); text-decoration: none;
}
#home-credits img { height: 34px; width: auto; }
@media (hover: hover) { #home-credits:hover span { text-decoration: underline; color: var(--ink); } }
.dev-toggle.is-on { border-style: solid; border-color: var(--alert); color: var(--alert); }

/* ── Utilitaires ─────────────────────────────────────────── */
.u-hidden { display: none !important; }
.u-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* =========================================================
   Largeurs de conteneur
========================================================= */
/* Écran étroit (le sélecteur de langue est sur tous les écrans) : le mot « Unité » et le crumb inerte
   « Inspire 1 » s'effacent, ainsi que le séparateur qui se retrouverait en tête du fil */
@container app (max-width: 520px) {
  .breadcrumb__unite-word,
  #breadcrumb-methode,
  #breadcrumb-methode + .breadcrumb__sep,
  #breadcrumb-unite.u-hidden + .breadcrumb__sep,
  #breadcrumb-unite.u-hidden ~ #breadcrumb-lecon.u-hidden + .breadcrumb__sep { display: none; }
}

@container app (min-width: 600px) {
  #app { --gutter: 24px; --col: 560px; }
  #app-header { padding-left: max(24px, calc((100% - var(--col)) / 2)); padding-right: max(24px, calc((100% - var(--col)) / 2)); }
  #session-progress { max-width: var(--col); margin: 0 auto; width: 100%; }
}

@container app (min-width: 900px) {
  #app { --col: 720px; --card-max: 520px; }   /* fond gris abandonné (Pascal, 25/09) : effets bizarres */
  /* En-tête pleine largeur : fil d'ariane | modes | drapeaux */
  #app-header {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 24px;
    padding: 10px 32px; border-bottom: 1px solid var(--line);
    background: var(--paper);
  }
  html.is-playing #app-header { background: var(--paper); }
  #header-bar { display: contents; }
  #home-btn { grid-column: 1; grid-row: 1; justify-self: start; margin-left: 0; }
  #breadcrumb-nav { grid-column: 1; grid-row: 1; margin-left: 44px; }
  #home-btn.u-hidden + #breadcrumb-nav { margin-left: 0; }
  #header-row-controls { grid-column: 2; grid-row: 1; margin-top: 0; }
  #header-tools { grid-column: 3; grid-row: 1; justify-self: end; }
  /* Recherche et filtres : toujours un cran sous l'en-tête, à la largeur de la colonne (Pascal, 26/09 :
     élément ergonomique fort, appelé à s'étoffer ; en grande résolution la hauteur ne manque pas) */
  #list-controls { grid-column: 1 / -1; grid-row: 2; margin-top: 10px; flex-direction: row; align-items: center; width: 100%; max-width: var(--col); justify-self: center; }
  #list-search-wrap { flex: 1; }
  #list-filters-row { flex: 0 0 auto; }
  .list-filter-dropdown { min-width: 120px; }

  #main-content {
    background: var(--paper); margin-top: 24px; margin-bottom: 24px;
    border-radius: var(--r-card);
    padding-bottom: 24px; flex: 0 1 auto;
  }
  /* Le filet enferme plus qu'il ne libère (Pascal, 25/09) : gardé sur la page unité seulement */
  #app:has(#view-unite:not(.u-hidden)) #main-content { border: 1px solid var(--line); }
  #app:has(#app-bottom-bar:not(.u-hidden)) #main-content { padding-bottom: 110px; }
  #unite-hero { border-radius: var(--r-card) var(--r-card) 0 0; }
  #session-progress { max-width: var(--col); margin: 0 auto; width: 100%; padding-top: 16px; }
  #app-bottom-bar { bottom: 24px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
  #card-stack { max-height: calc(100dvh - 340px); }
}

/* ── Mouvement réduit ────────────────────────────────────── */
/* Téléphone couché (retour Pierre-Yves, 26/09 : en Safari paysage la carte passait sous la barre) :
   la pile se dimensionne sur la hauteur restante, barre du bas compacte, en-tête resserré */
@media (orientation: landscape) and (max-height: 560px) {
  html.is-flip #app { height: 100dvh; min-height: 310px; }
  html.is-flip #main-content { flex: 1 1 auto; min-height: 0; margin-top: 0; margin-bottom: 0; }   /* prime sur le bloc ≥ 900 (flex 0 1 auto, marges) */
  html.is-flip #app-bottom-bar { bottom: 0; border-radius: 0; }
  html.is-flip #app:has(#app-bottom-bar:not(.u-hidden)) #main-content { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  html.is-flip #session-progress { padding: 4px var(--gutter) 6px; padding-top: 4px; }
  html.is-flip #header-row-controls { margin-top: 0; }
  html.is-flip #view-flip { min-height: 0; padding-bottom: var(--sp-1); }
  html.is-flip #card-stack { flex: 1 1 0; min-height: 0; max-height: none; width: auto; max-width: 100%; aspect-ratio: 4 / 5; margin-bottom: 0; }
  html.is-flip .flip-card { padding: 4% 5%; }
  html.is-flip .flip-card__word { font-size: clamp(22px, 6cqi, 32px); margin-bottom: 4px; }
  html.is-flip .flip-card__definition { margin-bottom: 8px; }
  html.is-flip .flip-card__face-label { margin-bottom: 4px; }
  html.is-flip .bottom-bar__btn { flex-direction: row; gap: 8px; min-height: 48px; padding: 6px 8px; }
  html.is-flip .bottom-bar__btn svg { width: 22px; height: 22px; }
}

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

/* ── Là où la couleur de l'unité reste (Pascal, 17/09) : fil d'ariane, page unité, sommaire de la Home ── */
#breadcrumb-lecon.is-active, #breadcrumb-quiz { color: var(--u-main); }
@media (hover: hover) { #breadcrumb-lecon:hover { color: var(--u-main); } }

#unite-hero { background: var(--u-main); }
#unite-num { color: var(--u-main); box-shadow: 0 0 0 4px var(--u-main), 0 0 0 7px var(--u-vive); }
.unite-lecon-btn__num { background: var(--u-vive); }
.unite-lecon-btn__count { color: var(--u-soft); }
.home-unit-btn { color: var(--u-main); box-shadow: inset 0 0 0 4px var(--u-main), inset 0 0 0 7px var(--u-vive), 0 0 0 2px transparent; }
@media (hover: hover) { .home-unit-btn:hover { box-shadow: inset 0 0 0 4px var(--u-main), inset 0 0 0 7px var(--u-vive), 0 0 0 2px var(--u-vive); } }
.u-circle { background: var(--u-main); }
/* Numéro d'unité dans un libellé (crumb « Réviser jusqu'à l'unité ④ ») : cercle coloré, non cliquable en soi */
.u-circle--inline { width: 24px; height: 24px; font-size: var(--fs-badge); margin-left: 2px; }
.breadcrumb__item--quiz { display: inline-flex; align-items: center; gap: 4px; }
.bc-menu__item > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
