/* =========================================================
   FicheDirecte — feuille de style
   Même univers que les fiches : papier ligné crème, marge rouge,
   Patrick Hand (titres), Caveat (stylo bleu), Nunito (texte).
   ========================================================= */

:root {
  --papier: #fffdf7;
  --papier-2: #f7f3e8;
  --ligne: #e4ecf6;
  --marge: #e8a0a0;
  --encre: #23262b;
  --encre-2: #5d6470;
  --encre-3: #8b919b;
  --stylo: #2f5fd0;
  --couv: #22375a;
  --couv-2: #1b2c49;
  --couv-texte: #f3efe4;
  --couv-doux: rgba(243, 239, 228, .62);

  /* codes couleur des fiches */
  --def: #3b6fd6;   --def-bg: #e8effd;
  --form: #2f9e6b;  --form-bg: #e5f6ee;
  --meth: #7c5cc4;  --meth-bg: #efeafb;
  --ex: #d9822b;    --ex-bg: #fdf1e3;
  --piege: #d64545; --piege-bg: #fde8e8;
  --secu: #b89200;  --secu-bg: #fff6d1;

  --f-titre: "Patrick Hand", "Comic Sans MS", cursive;
  --f-stylo: "Caveat", "Segoe Script", cursive;
  --f-texte: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --pas: 32px;               /* écart entre deux lignes du cahier */
  --marge-x: 72px;           /* position de la marge rouge */
  --couv-l: 300px;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(35, 38, 43, .06), 0 6px 18px -6px rgba(35, 38, 43, .16);
  --ombre-haute: 0 2px 4px rgba(35, 38, 43, .06), 0 18px 40px -12px rgba(35, 38, 43, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
body {
  margin: 0;
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.5;
  color: var(--encre);
  background: var(--papier);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.ic { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evitement { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--encre); color: #fff; padding: 8px 14px; border-radius: 8px; }
.evitement:focus { top: 12px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--stylo) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
kbd {
  font-family: var(--f-texte); font-size: .78em; font-weight: 700;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .85;
}

/* ---------- Mise en page générale ---------- */
.app { display: grid; grid-template-columns: var(--couv-l) 1fr; min-height: 100vh; }

/* ---------- Couverture (sommaire de gauche) ---------- */
.couverture {
  position: sticky; top: 0; height: 100vh; z-index: 20;
  color: var(--couv-texte);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.018) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.05) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--couv) 0%, var(--couv-2) 100%);
  box-shadow: inset -10px 0 18px -12px rgba(0,0,0,.5);
}
.couverture__interieur {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 36px 22px 24px;
  display: flex; flex-direction: column; gap: 26px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.couverture__fermer { display: none; }

/* étiquette collée sur la couverture */
.etiquette {
  display: block; text-decoration: none; color: var(--encre);
  background: var(--papier);
  border-radius: 12px;
  padding: 14px 16px 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 8px 18px -8px rgba(0,0,0,.55);
  position: relative;
  transform: rotate(-1.2deg);
  transition: transform .4s var(--ease);
}
.etiquette::before { /* liseré intérieur, comme une vraie étiquette */
  content: ""; position: absolute; inset: 5px; border-radius: 8px;
  border: 1.5px solid #c9d5e8; pointer-events: none;
}
.etiquette:hover { transform: rotate(0deg) scale(1.015); }
.marque-accent { color: var(--stylo); }
.barre-mobile .marque-accent { color: #9cc0ff; }
.etiquette__titre {
  display: block; font-family: var(--f-titre); font-size: 25px; line-height: 1.1;
  text-align: center; margin-bottom: 8px;
}
.etiquette__ligne {
  display: flex; align-items: baseline; gap: 8px;
  border-bottom: 1.5px dotted #b8c3d4; padding: 2px 4px 0;
  min-height: 30px;
}
.etiquette__ligne em {
  font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--encre-3);
}
.etiquette__ligne span {
  font-family: var(--f-stylo); font-size: 22px; font-weight: 700; color: var(--stylo);
  line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.etiquette__ligne span.attente { color: #b8c3d4; }
.ecrit { animation: ecrire .55s var(--ease) both; }
@keyframes ecrire { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* les trois étapes */
.etapes { display: flex; flex-direction: column; gap: 22px; }
.etape__titre {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; font-family: var(--f-titre); font-weight: 400; font-size: 21px;
  color: var(--couv-texte);
}
.etape__num {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.6px solid currentColor; font-size: 16px; line-height: 1;
}
.etape--inactive .etape__titre { color: var(--couv-doux); }
.etape__vide { margin: 0; font-family: var(--f-stylo); font-size: 19px; color: var(--couv-doux); padding-left: 36px; }

.onglets { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.onglet {
  position: relative; cursor: pointer;
  padding: 10px 8px; border-radius: 10px;
  border: 1.5px solid rgba(243,239,228,.22);
  background: rgba(255,255,255,.04);
  color: var(--couv-texte);
  font-family: var(--f-titre); font-size: 20px; line-height: 1.1;
  transition: background .2s, border-color .2s, transform .2s var(--ease), color .2s;
}
.onglet small { display: block; font-family: var(--f-texte); font-size: 11px; letter-spacing: .04em; color: var(--couv-doux); margin-top: 2px; }
.onglet:hover { background: rgba(255,255,255,.1); border-color: rgba(243,239,228,.45); }
.onglet:active { transform: scale(.97); }
.onglet[aria-pressed="true"] {
  background: var(--papier); color: var(--encre); border-color: var(--papier);
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.6);
}
.onglet[aria-pressed="true"] small { color: var(--encre-2); }

.matieres { display: flex; flex-direction: column; gap: 8px; }
.matiere {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 1.5px solid rgba(243,239,228,.22); background: rgba(255,255,255,.04);
  color: var(--couv-texte);
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.matiere:hover { background: rgba(255,255,255,.1); border-color: rgba(243,239,228,.45); }
.matiere:active { transform: scale(.98); }
.matiere__ic {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: rgba(255,255,255,.1);
}
.matiere__ic .ic { width: 22px; height: 22px; }
.matiere__nom { font-family: var(--f-titre); font-size: 20px; line-height: 1.1; display: block; }
.matiere__info { font-size: 12.5px; color: var(--couv-doux); display: block; }
.matiere[aria-current="page"] { background: var(--papier); color: var(--encre); border-color: var(--papier); box-shadow: 0 6px 14px -6px rgba(0,0,0,.6); }
.matiere[aria-current="page"] .matiere__ic { background: var(--def-bg); color: var(--def); }
.matiere[aria-current="page"] .matiere__info { color: var(--encre-2); }
.matiere.bientot .matiere__info { font-family: var(--f-stylo); font-size: 16px; }

.couverture__pied { margin: auto 0 0; font-size: 12px; color: var(--couv-doux); }

/* reliure à spirale entre la couverture et la page */
.spirale {
  position: absolute; top: 0; bottom: 0; right: -17px; width: 34px; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='30' viewBox='0 0 34 30'%3E%3Cdefs%3E%3ClinearGradient id='m' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f4f5f7'/%3E%3Cstop offset='.45' stop-color='%23a9afb8'/%3E%3Cstop offset='1' stop-color='%236c727c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='9' cy='17' r='3.2' fill='%23101a2c'/%3E%3Ccircle cx='26' cy='17' r='3.2' fill='%23d9d4c6'/%3E%3Cpath d='M9 18C8 6 26 5 26 18' fill='none' stroke='%23000' stroke-opacity='.25' stroke-width='3.6' stroke-linecap='round' transform='translate(1 1.5)'/%3E%3Cpath d='M9 18C8 6 26 5 26 18' fill='none' stroke='url(%23m)' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 34px 30px;
  background-repeat: repeat-y;
  background-position: 0 6px;
  z-index: 3;
}

/* ---------- La page (papier ligné) ---------- */
.page {
  position: relative; min-width: 0; outline: none;
  background-color: var(--papier);
  background-image:
    linear-gradient(90deg, transparent calc(var(--marge-x) - 1px), var(--marge) calc(var(--marge-x) - 1px), var(--marge) calc(var(--marge-x) + 1px), transparent calc(var(--marge-x) + 1px)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--pas) - 1.5px), var(--ligne) calc(var(--pas) - 1.5px) var(--pas));
  background-position: 0 0, 0 14px;
  padding: 44px clamp(20px, 4vw, 56px) 64px calc(var(--marge-x) + clamp(22px, 3vw, 44px));
}
/* la date du jour, au stylo, posée sur la première ligne et soulignée en rouge */
.page::before {
  content: attr(data-date);
  position: absolute; top: 15px; right: clamp(20px, 4vw, 56px);
  font-family: var(--f-stylo); font-weight: 500; font-size: 27px; line-height: 32px;
  color: var(--stylo); white-space: nowrap; pointer-events: none;
  text-decoration: underline; text-decoration-color: var(--marge);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
  animation: ecrire .9s .15s var(--ease) both;
}
.vue { max-width: 1180px; animation: tourner .45s var(--ease) both; }
@keyframes tourner { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* en-tête façon fiche */
.entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.entete__surtitre {
  margin: 0 0 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--encre-2);
}
.entete h1, .accueil h1 {
  margin: 0; font-family: var(--f-titre); font-weight: 400;
  font-size: clamp(34px, 5vw, 50px); line-height: 1.05; letter-spacing: -.005em;
}
.souligne { position: relative; display: inline-block; }
.souligne svg { position: absolute; left: -2%; bottom: -10px; width: 104%; height: 14px; overflow: visible; }
.souligne path { fill: none; stroke: var(--stylo); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: trait 1s .25s var(--ease) forwards; opacity: .85; }
@keyframes trait { to { stroke-dashoffset: 0; } }
.entete__question { margin: 10px 0 0; font-family: var(--f-stylo); font-size: clamp(22px, 2.6vw, 27px); font-weight: 500; color: var(--stylo); line-height: 1.15; }
.entete__droite { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 30px; } /* laisse la place à la date */

/* boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  border: 1.6px solid var(--encre); background: var(--papier); color: var(--encre);
  transition: transform .18s var(--ease), box-shadow .18s, background .18s, color .18s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--encre); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn--plein { background: var(--encre); color: var(--papier); }
.btn--plein:hover { box-shadow: 0 3px 0 color-mix(in srgb, var(--encre) 45%, var(--papier)); }
.btn--petit { min-height: 36px; padding: 6px 13px; font-size: 13.5px; }
.btn--fantome { border-color: transparent; background: transparent; }
.btn--fantome:hover { background: rgba(35,38,43,.06); box-shadow: none; }

/* anneau de progression */
.progres { display: flex; align-items: center; gap: 12px; background: var(--papier); border: 1.5px solid #e6e1d4; border-radius: 16px; padding: 8px 16px 8px 8px; }
.progres svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.progres circle { fill: none; stroke-width: 6; }
.progres .fond { stroke: #ece7da; }
.progres .plein { stroke: var(--form); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.progres__txt { line-height: 1.15; }
.progres__txt strong { font-family: var(--f-titre); font-weight: 400; font-size: 24px; display: block; }
.progres__txt span { font-size: 12.5px; color: var(--encre-2); }

/* outils : recherche + filtres */
.outils {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 0 calc(-1 * clamp(20px, 4vw, 56px)) 18px -12px;
  padding: 12px clamp(20px, 4vw, 56px) 12px 12px;
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.outils.colle { border-bottom-color: #ece6d8; box-shadow: 0 10px 20px -18px rgba(0,0,0,.4); }
.recherche { position: relative; flex: 1 1 280px; max-width: 440px; }
.recherche .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--encre-3); width: 19px; height: 19px; }
.recherche input {
  width: 100%; height: 46px; padding: 0 44px 0 42px;
  border-radius: 999px; border: 1.6px solid #ddd6c6; background: #fff;
  font: inherit; font-size: 15px; color: var(--encre);
  transition: border-color .2s, box-shadow .2s;
}
.recherche input::placeholder { color: var(--encre-3); }
.recherche input:focus { outline: none; border-color: var(--stylo); box-shadow: 0 0 0 4px color-mix(in srgb, var(--stylo) 16%, transparent); }
.recherche kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--encre-3); pointer-events: none; }
.recherche input:focus ~ kbd, .recherche input:not(:placeholder-shown) ~ kbd { display: none; }
.recherche__effacer { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 6px; border-radius: 50%; cursor: pointer; color: var(--encre-2); display: none; }
.recherche input:not(:placeholder-shown) ~ .recherche__effacer { display: grid; }
.recherche__effacer .ic { position: static; transform: none; width: 18px; height: 18px; }

.outils { flex-wrap: nowrap; }
.recherche { flex: 0 0 340px; }
.filtres {
  display: flex; flex-wrap: nowrap; gap: 8px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; scrollbar-width: none; padding: 4px 24px 4px 2px; margin: -4px 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.filtres::-webkit-scrollbar { display: none; }
.puce { flex: none; white-space: nowrap; }
.puce {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1.5px solid #ddd6c6; background: #fff; font-size: 13.5px; font-weight: 700; color: var(--encre-2);
  transition: all .18s var(--ease);
}
.puce:hover { border-color: var(--encre-3); color: var(--encre); }
.puce[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }
.puce i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--encre-3)); }
.puce b { font-weight: 800; opacity: .55; }

/* couleurs des thèmes */
[data-c="gris"]   { --c: #7a818c; --c-bg: #eef0f2; }
[data-c="rouge"]  { --c: #d64545; --c-bg: #fde8e8; }
[data-c="bleu"]   { --c: #3b6fd6; --c-bg: #e8effd; }
[data-c="vert"]   { --c: #2f9e6b; --c-bg: #e5f6ee; }
[data-c="violet"] { --c: #7c5cc4; --c-bg: #efeafb; }
[data-c="orange"] { --c: #d9822b; --c-bg: #fdf1e3; }

/* sections de thème */
.theme { margin-top: 30px; }
.theme__titre {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; font-family: var(--f-titre); font-weight: 400; font-size: 28px; line-height: 1.1;
}
.theme__num { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--c); color: var(--c); display: grid; place-items: center; font-size: 20px; flex: none; }
.theme__nb { font-family: var(--f-stylo); font-size: 21px; color: var(--encre-3); }

/* ---------- Fiches : petite vignette + titre ---------- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 6px 18px; }
.fiche {
  display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0;
  padding: 8px 10px 8px 8px; border: 0; border-radius: 12px; background: transparent;
  text-align: left; cursor: pointer; color: inherit;
  transition: background .2s;
  animation: apparaitre .45s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 20) * 25ms);
}
@keyframes apparaitre { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fiche:hover { background: color-mix(in srgb, var(--c, #7a818c) 9%, transparent); }
.fiche__vignette {
  position: relative; flex: none; width: 62px; aspect-ratio: 210 / 297; overflow: hidden;
  border-radius: 3px; background: var(--papier);
  box-shadow: 0 0 0 1px rgba(35,38,43,.08), 0 3px 8px -3px rgba(35,38,43,.28);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.fiche__vignette::before { /* coin de couleur du thème */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); z-index: 1;
}
.fiche__vignette img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.fiche:hover .fiche__vignette { transform: translateY(-2px) rotate(-2deg) scale(1.05); box-shadow: 0 0 0 1px rgba(35,38,43,.08), 0 10px 18px -6px rgba(35,38,43,.35); }
.fiche__vignette--vide { display: grid; place-items: center; font-family: var(--f-titre); font-size: 26px; color: var(--c);
  background: var(--papier) repeating-linear-gradient(180deg, transparent 0 9px, var(--ligne) 9px 10px); }
.fiche__texte { display: flex; flex-direction: column; min-width: 0; }
.fiche__num { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.fiche__titre { font-family: var(--f-titre); font-size: 20px; line-height: 1.15; }
.fiche__indice { font-size: 12.5px; color: var(--encre-2); margin-top: 2px; }
mark { background: linear-gradient(transparent 45%, #fff3a3 45%); color: inherit; padding: 0 1px; }
.pastille {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--encre); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}

/* état vide / bientôt */
.vide {
  max-width: 560px; margin: 36px 0; padding: 26px 28px 24px;
  background: #fff7b8; border-radius: 4px; box-shadow: var(--ombre-haute);
  transform: rotate(-1deg); position: relative;
}
.vide::before { content: ""; position: absolute; top: -12px; left: 50%; width: 110px; height: 26px; transform: translateX(-50%) rotate(2deg); background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.05); }
.vide h2 { margin: 0 0 6px; font-family: var(--f-titre); font-weight: 400; font-size: 30px; }
.vide p { margin: 0; font-family: var(--f-stylo); font-size: 23px; line-height: 1.25; color: #5b5320; }
.aucun { padding: 30px 0; font-family: var(--f-stylo); font-size: 26px; color: var(--encre-2); }

/* ---------- Accueil ---------- */
.accueil__intro { position: relative; max-width: 760px; }
.accueil__fleche { position: absolute; left: -96px; top: 74px; width: 90px; height: 46px; color: var(--stylo); transform: rotate(-8deg); opacity: .85; }
.reprendre {
  display: flex; align-items: center; gap: 16px; margin: 30px 0 8px; max-width: 640px;
  padding: 12px 18px 12px 12px; border-radius: 16px; text-decoration: none; cursor: pointer; text-align: left; width: 100%;
  background: #fff; border: 1.5px solid #e6e1d4; box-shadow: var(--ombre);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.reprendre:hover { transform: translateY(-2px); box-shadow: var(--ombre-haute); }
.reprendre img { width: 64px; height: 64px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid #ece7db; }
.reprendre small { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-3); }
.reprendre strong { font-family: var(--f-titre); font-weight: 400; font-size: 22px; line-height: 1.1; display: block; }
.reprendre .ic { margin-left: auto; color: var(--encre-3); }

.bloc { margin-top: 44px; }
.bloc__titre { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-family: var(--f-titre); font-weight: 400; font-size: 28px; }

.cahiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 22px; }
.cahier-carte {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 210px; padding: 20px 20px 18px 34px; border-radius: 6px 14px 14px 6px;
  text-decoration: none; color: var(--couv-texte); cursor: pointer; border: 0; text-align: left;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, var(--k, var(--couv)) 0%, color-mix(in srgb, var(--k, var(--couv)) 75%, #000) 100%);
  box-shadow: var(--ombre-haute);
  transition: transform .35s var(--ease), box-shadow .35s;
}
.cahier-carte::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 10px;
  background: radial-gradient(circle at 5px 50%, rgba(0,0,0,.45) 2.6px, transparent 3px) 0 0 / 10px 18px repeat-y; }
.cahier-carte:hover { transform: translateY(-5px) rotate(-.8deg); }
.cahier-carte__etiquette { background: var(--papier); color: var(--encre); border-radius: 8px; padding: 10px 12px; box-shadow: 0 6px 12px -6px rgba(0,0,0,.5); }
.cahier-carte__etiquette small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-3); }
.cahier-carte__etiquette strong { font-family: var(--f-titre); font-weight: 400; font-size: 24px; line-height: 1.05; display: block; }
.cahier-carte__bas { display: flex; align-items: center; justify-content: space-between; font-family: var(--f-stylo); font-size: 22px; }
.cahier-carte__bas .ic { width: 22px; height: 22px; }

.legende { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.code { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1.5px solid #ece7db; }
.code__badge { flex: none; font-size: 12px; font-weight: 800; padding: 3px 11px; border-radius: 999px; border: 1.6px solid var(--k); color: var(--k); background: var(--kb); }
.code p { margin: 0; font-size: 14px; color: var(--encre-2); line-height: 1.35; }

.conseils { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 760px; }
.conseils li { display: flex; gap: 14px; align-items: baseline; font-size: 16px; line-height: var(--pas); }
.conseils li b { font-family: var(--f-stylo); font-size: 26px; color: var(--stylo); flex: none; width: 20px; }

.pied-page { margin-top: 56px; font-size: 13px; color: var(--encre-3); }

/* ---------- Visionneuse ---------- */
.visionneuse {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: #fff; overflow: hidden;
}
.visionneuse::backdrop { background: rgba(17, 22, 32, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.visionneuse[open] { display: flex; flex-direction: column; animation: ouvrir .3s var(--ease); }
@keyframes ouvrir { from { opacity: 0; } to { opacity: 1; } }
.vis-barre {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(17,22,32,.6); border-bottom: 1px solid rgba(255,255,255,.08);
}
.vis-titre { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vis-titre .pastille { background: #fff; color: var(--encre); }
.vis-titre__haut { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vis-titre h2 { margin: 0; font-family: var(--f-titre); font-weight: 400; font-size: 23px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vis-titre > div { min-width: 0; }
.vis-outils { display: flex; align-items: center; gap: 6px; flex: none; }
.vis-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; min-width: 40px; padding: 0 10px; border-radius: 10px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.08); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px;
  transition: background .2s;
}
.vis-btn:hover { background: rgba(255,255,255,.18); }
.vis-btn--texte { padding: 0 14px; background: #fff; color: var(--encre); }
.vis-btn--texte:hover { background: #e9ecf1; }
.vis-zoom { display: flex; align-items: center; background: rgba(255,255,255,.08); border-radius: 10px; margin-right: 4px; }
.vis-zoom .vis-btn { background: transparent; }
.vis-zoom__val { border: 0; background: none; color: #fff; font-weight: 700; font-size: 13px; width: 54px; cursor: pointer; font-variant-numeric: tabular-nums; }
.vis-scene { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 26px 16px 90px; -webkit-overflow-scrolling: touch; }
.vis-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; width: max-content; min-width: 100%; }
.vis-page {
  position: relative; width: calc(var(--fit, 860px) * var(--zoom, 1)); max-width: none;
  aspect-ratio: var(--ratio, 0.707); background: var(--papier);
  border-radius: 4px; box-shadow: 0 20px 50px -18px rgba(0,0,0,.7);
  overflow: hidden; flex: none;
}
.vis-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.vis-page:not(.rendue)::after { /* papier qui « charge » */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%) -100% 0 / 60% 100% no-repeat,
              repeating-linear-gradient(180deg, transparent 0 25px, var(--ligne) 25px 27px);
  animation: chargement 1.3s infinite;
}
@keyframes chargement { to { background-position: 200% 0, 0 0; } }
.vis-page__num { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--encre-3); z-index: 1; }
.vis-erreur { max-width: 460px; margin: 10vh auto; text-align: center; background: var(--papier); color: var(--encre); padding: 28px; border-radius: 16px; }
.vis-erreur h3 { margin: 0 0 6px; font-family: var(--f-titre); font-weight: 400; font-size: 28px; }
.vis-erreur p { margin: 0 0 18px; color: var(--encre-2); }
.vis-erreur div { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.vis-nav {
  position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 2;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(50vw - 24px);
  height: 46px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.94); color: var(--encre); font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); transition: transform .2s var(--ease), opacity .2s;
}
.vis-nav:hover { transform: translateY(-2px); }
.vis-nav[hidden] { display: none; }
.vis-nav--prec { left: 18px; }
.vis-nav--suiv { right: 18px; }
.vis-nav__txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Aperçu « version téléphone » ---------- */
.btn-tel {
  position: fixed; right: 22px; bottom: 22px; z-index: 25;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  height: 44px; padding: 0 18px 0 14px; border-radius: 999px; border: 0;
  background: var(--encre); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.55);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.btn-tel:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(0,0,0,.6); }
.dans-cadre .btn-tel { display: none; }
.telephone {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; overflow: hidden;
}
.telephone::backdrop { background: rgba(17, 22, 32, .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.telephone[open] { display: flex; flex-direction: column; align-items: center; animation: ouvrir .3s var(--ease); }
.tel-scene { flex: 1; width: 100%; display: grid; place-items: center; min-height: 0; }
.tel-cadre {
  position: relative; width: 414px; height: 868px; /* écran 390 × 844 + bordure */
  padding: 12px; border-radius: 54px; background: #111418;
  box-shadow: 0 0 0 2px #2b3038, 0 40px 80px -20px rgba(0,0,0,.8);
  transform-origin: center; flex: none;
}
.tel-ecran { width: 390px; height: 844px; border-radius: 42px; overflow: hidden; display: flex; flex-direction: column; background: var(--couv); }
.tel-statut { position: relative; flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0; color: #fff; font-size: 14px; font-weight: 700; }
.tel-statut i { display: flex; gap: 5px; align-items: center; }
.tel-statut i::before { content: ""; width: 17px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, #fff 75%, rgba(255,255,255,.35) 75%); box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.tel-encoche { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 104px; height: 28px; border-radius: 20px; background: #111418; }
.tel-ecran iframe { flex: 1; width: 390px; border: 0; background: var(--papier); display: block; }
.dans-cadre, .dans-cadre body { scrollbar-width: none; }
.dans-cadre::-webkit-scrollbar { display: none; }
.tel-barre { display: flex; align-items: center; gap: 10px; padding: 12px 16px 18px; color: rgba(255,255,255,.7); font-size: 13px; }
.tel-barre span { margin-right: 8px; }
.tel-btn { height: 38px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; background: rgba(255,255,255,.12); color: #fff; }
.tel-btn:hover { background: rgba(255,255,255,.2); }
.tel-btn--plein { background: #fff; color: var(--encre); }
.tel-btn--plein:hover { background: #e9ecf1; }

/* message éphémère */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 1000;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--encre); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: 14px; box-shadow: var(--ombre-haute);
  transition: all .3s var(--ease);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.visionneuse ~ .toast { z-index: 2147483647; }

/* ---------- Barre du haut (téléphone) ---------- */
.barre-mobile { display: none; }

@media (max-width: 1100px) {
  :root { --couv-l: 270px; }
  .couverture__interieur { padding-left: 20px; padding-right: 30px; }
}

@media (max-width: 860px) {
  :root { --marge-x: 34px; --pas: 30px; }
  .app { display: block; }
  .barre-mobile {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    height: 58px; padding: 0 12px; padding-top: env(safe-area-inset-top);
    background: var(--couv); color: var(--couv-texte);
    box-shadow: 0 6px 16px -10px rgba(0,0,0,.5);
  }
  .barre-mobile__menu { border: 0; background: rgba(255,255,255,.1); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: inherit; }
  .barre-mobile__marque { font-family: var(--f-titre); font-size: 22px; text-decoration: none; white-space: nowrap; }
  .barre-mobile__choix {
    margin-left: auto; border: 0; cursor: pointer; max-width: 46vw;
    background: var(--papier); color: var(--encre); border-radius: 999px; padding: 6px 13px;
    font-family: var(--f-stylo); font-weight: 700; font-size: 18px; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .couverture {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: min(86vw, 330px);
    transform: translateX(-105%); transition: transform .35s var(--ease); z-index: 50;
  }
  .couverture.ouverte { transform: none; box-shadow: 20px 0 40px rgba(0,0,0,.35); }
  .couverture__interieur { padding: 22px 34px 22px 20px; }
  .couverture__fermer { display: grid; place-items: center; position: absolute; right: 26px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; z-index: 4; }
  .etiquette { margin-top: 30px; }
  .voile { position: fixed; inset: 0; background: rgba(17,22,32,.45); z-index: 40; backdrop-filter: blur(2px); }
  .page { padding: 58px 16px 48px calc(var(--marge-x) + 14px); }
  .page::before { top: 15px; right: 16px; font-size: 24px; line-height: 30px; }
  .outils { top: 58px; margin-left: -10px; margin-right: -16px; padding-left: 10px; padding-right: 0; flex-wrap: wrap; gap: 10px; }
  .recherche { flex: 1 1 100%; max-width: none; margin-right: 16px; }
  .recherche input { height: 44px; }
  .filtres { flex-basis: 100%; }
  .accueil__fleche { display: none; }
  .entete { margin-bottom: 18px; }
  .entete__droite { width: 100%; margin-top: 0; }
  .btn-tel { display: none; }
  .fiche__vignette { width: 54px; }
  .fiche__titre { font-size: 19px; }
  .vis-barre { padding: 10px 12px; gap: 10px; }
  .vis-titre .pastille { display: none; }
  #vis-lien, .vis-zoom__val { display: none; }
  .vis-zoom { margin-right: 0; }
  .vis-zoom .vis-btn { min-width: 36px; padding: 0 6px; }
  .vis-btn--texte span { display: none; }
  .vis-btn--texte { padding: 0 10px; }
  .vis-scene { padding: 14px 10px 90px; }
  .vis-nav { height: 42px; padding: 0 12px; font-size: 13px; }
  .vis-nav--prec { left: 10px; } .vis-nav--suiv { right: 10px; }
}

@media (max-width: 420px) {
  .recherche { flex-basis: 100%; max-width: none; }
  .btn { padding: 8px 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .souligne path { stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}

@media print {
  .couverture, .barre-mobile, .outils, .fiche__pied .btn { display: none !important; }
  .app { display: block; }
}
