/* ==========================================================
   Math ton potentiel — « le cahier de Mélanie » (site)
   Cahier à spirale, petits carreaux, posé sur un tapis de découpe.
   Ordinateur : double page. En dessous de 1100 px : une page à la fois (carnet).
   ========================================================== */

:root {
  --pink: #ff4aa2;
  --blue: #4d73ff;
  --yellow: #ffd93d;
  --violet: #6f46d9;
  --violet-dark: #4b2fa8;
  --teal: #22b3a8;
  --teal-ink: #188e80;
  --red: #d14d65;
  --ink: #151515;
  --muted: #5d5873;
  --paper: #fffdf6;
  --grid: rgba(77, 115, 255, 0.17);
  --margin-line: rgba(255, 74, 162, 0.6);

  /* bureau en chêne miel, un peu plus soutenu */
  --wood: #c19463;
  --wood-seam: rgba(80, 46, 14, 0.34);

  /* largeur du cahier ouvert, et espace libre du bureau de chaque côté */
  --book-w: min(88vw, calc((100vh - 120px) * 1.44), 1360px);
  --side: calc((100vw - var(--book-w)) / 2);

  --font-display: "Bungee", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --font-hand: "Caveat", cursive;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  /* bureau en bois clair, sans image :
     - veinage : bruit SVG étiré à l'horizontale (longues fibres) ;
     - lames : joints horizontaux et léger écart de teinte d'une lame à l'autre ;
     - lumière : un peu plus clair au centre, plus sombre sur les bords. */
  background-color: var(--wood);
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(255, 248, 230, 0.28), transparent 60%, rgba(70, 40, 10, 0.22)),
    linear-gradient(var(--wood-seam) 0 2px, rgba(255, 240, 210, 0.25) 2px 3px, transparent 3px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0 230px, rgba(120, 70, 20, 0.06) 230px 460px, rgba(255, 240, 200, 0.04) 460px 690px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='460'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0035 0.11' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.2 0 0 0 0 0.07 0 0 0 1.15 -0.36'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 230px, 100% 690px, 900px 460px;
  background-attachment: fixed, scroll, scroll, scroll;
  overflow: hidden;
}

a { color: var(--violet); }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }

/* ---------- barre du haut, posée sur le tapis ---------- */
.desk-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  pointer-events: none;
}
.desk-bar > * { pointer-events: auto; }
.desk-brand { display: flex; align-items: center; gap: 0.7rem; color: #fff; text-decoration: none; }
.desk-brand img { height: 44px; background: var(--paper); border-radius: 10px; padding: 3px 6px; }
.desk-brand span { font-family: var(--font-hand); font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--violet-dark); text-shadow: 0 1px 0 rgba(255, 245, 225, 0.6); }
.desk-btn {
  font: 800 0.95rem var(--font-body);
  padding: 0.6rem 1.1rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
}
.desk-btn:active { transform: translateY(4px); box-shadow: none; }
.desk-actions { display: flex; align-items: center; gap: 0.7rem; }

/* bouton du bruit de page : barré quand le son est coupé */
.desk-sound {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font: 800 0.9rem var(--font-body);
  padding: 0.5rem 0.9rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
}
.desk-sound:active { transform: translateY(4px); box-shadow: none; }
.desk-sound svg { width: 20px; height: 20px; }
.desk-sound .waves { display: none; }
.desk-sound[aria-pressed="true"] { background: var(--teal); color: #fff; }
.desk-sound[aria-pressed="true"] .waves { display: inline; }
.desk-sound[aria-pressed="true"] .mute { display: none; }

/* objets posés sur le tapis */
.prop { position: fixed; z-index: 1; pointer-events: none; filter: drop-shadow(4px 6px 4px rgba(0, 0, 0, 0.3)); }
/* positions calculées depuis les bords du cahier (--side) : les objets restent
   au bord du cahier, en partie dessous, quelle que soit la taille de l'écran */
.prop--pencil { left: 3vw; bottom: 6vh; width: 300px; transform: rotate(-24deg); }
.prop--calculator { left: calc(var(--side) - 150px); top: 11vh; width: 160px; transform: rotate(-8deg); }
.prop--eraser { left: calc(var(--side) - 110px); top: 76vh; width: 84px; transform: rotate(14deg); }
/* règle de 30 cm en biais : la moitié haute glisse sous le cahier.
   z-index 0 : le crayon et la gomme restent posés dessus */
.prop--ruler {
  z-index: 0;
  left: calc(var(--side) - 390px);
  top: calc(64vh - 30px);
  width: 700px;
  transform: rotate(-62deg);
  transform-origin: center;
  filter: drop-shadow(3px 4px 3px rgba(60, 35, 10, 0.3));
}
/* compas sous les intercalaires : haut du cahier + 6 % (début des onglets) + hauteur des 7 onglets */
/* bas des intercalaires : haut du cahier + 6 % (début des onglets) + hauteur des 7 onglets */
.prop--protractor,
.prop--compass { --book-h: calc(var(--book-w) / 1.44); --tabs-end: calc(74px + (100vh - 108px - var(--book-h)) / 2 + var(--book-h) * 0.06 + 375px); }
/* rapporteur juste sous les intercalaires, en partie sous le cahier ; le compas posé plus bas */
.prop--protractor {
  z-index: 0;
  right: calc(var(--side) - 175px);
  top: var(--tabs-end);
  width: 220px;
  transform: rotate(-10deg);
  filter: drop-shadow(2px 3px 3px rgba(60, 35, 10, 0.25));
}
.prop--compass {
  right: calc(var(--side) - 128px);
  top: calc(var(--tabs-end) + 120px);
  width: 118px;
  transform: rotate(16deg);
}
/* feuille de brouillon à gauche, en partie sous le cahier ; la règle et la gomme posées dessus */
.prop--sheet {
  z-index: 0;
  left: calc(var(--side) - 215px);
  top: 37vh;
  width: 270px;
  transform: rotate(-7deg);
  filter: drop-shadow(2px 4px 4px rgba(60, 35, 10, 0.22));
}
/* sous-main : centré sous le cahier (même centre que la scène), un peu plus grand que lui ;
   lavande pâle tournant au rose, bandes latérales plus soutenues, couture blanche */
.prop--deskpad {
  --pad-w: calc(var(--book-w) + 2 * clamp(40px, var(--side) * 0.45, 150px));
  --pad-h: calc(var(--book-w) / 1.44 + 76px);
  z-index: 0; /* premier des objets : la feuille, la règle et le rapporteur passent dessus */
  left: calc(50% - var(--pad-w) / 2);
  top: calc(74px + (100vh - 108px) / 2 - var(--pad-h) / 2);
  width: var(--pad-w);
  height: var(--pad-h);
  border-radius: 16px;
  background:
    /* grain du simili-cuir */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0 0.6 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    /* bandes latérales */
    linear-gradient(90deg, #dccdfa 0 7%, rgba(255, 255, 255, 0.55) 7% calc(7% + 2px), transparent calc(7% + 2px) calc(93% - 2px), rgba(255, 255, 255, 0.55) calc(93% - 2px) 93%, #f6cde2 93%),
    /* lumière douce venant de la fenêtre */
    radial-gradient(ellipse 70% 60% at 35% 30%, rgba(255, 255, 255, 0.55), transparent 70%),
    linear-gradient(115deg, #ece4fd 0%, #f6eefb 50%, #fbe6f0 100%);
  box-shadow:
    inset 0 0 0 1px rgba(111, 70, 217, 0.18),
    0 3px 0 #c9b8ee,
    0 12px 26px rgba(60, 35, 10, 0.22);
  filter: none;
}
/* couture tout autour */
.prop--deskpad::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(111, 70, 217, 0.12);
}
/* pages qui défilent (exercices) : le cahier bouge, le sous-main ne le suivrait pas */
body.desk-scroll .prop--deskpad { display: none; }
/* équerre transparente en bas à droite */
.prop--square { right: 1.5vw; bottom: 3vh; width: 300px; transform: rotate(-10deg); filter: drop-shadow(3px 4px 3px rgba(60, 35, 10, 0.25)); }

/* ---------- scène du cahier ---------- */
.stage {
  position: relative;
  z-index: 2; /* le cahier passe au-dessus du crayon et de la gomme */
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 74px 0 34px;
}
.book-wrap {
  position: relative;
  /* deux pages au format 0,72 tenant dans la hauteur de l'écran */
  width: var(--book-w);
}
#book { margin: 0 auto; }

/* ombre portée du cahier sur le tapis */
.book-wrap::before {
  content: "";
  position: absolute;
  inset: 3% 2% -2%;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(22px);
  border-radius: 12px;
  z-index: -1;
  transition: opacity 0.3s;
}
.book-wrap[data-closed="front"]::before { inset: 3% 2% -2% 50%; }
.book-wrap[data-closed="back"]::before { inset: 3% 50% -2% 2%; }

/* ---------- spirale ---------- */
.spiral {
  position: absolute;
  top: 2.5%;
  bottom: 2.5%;
  left: 50%;
  width: 44px;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.spiral span {
  display: block;
  height: 14px;
  border-radius: 8px;
  /* anneau métallique : dégradé chromé */
  background: linear-gradient(180deg, #f4f4f6 0%, #9ea3ad 45%, #5e626c 55%, #c9ccd3 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
}
/* trous de perforation sous les anneaux */
.spiral span::before,
.spiral span::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  margin-top: 3.5px;
  border-radius: 50%;
  background: #2c2c2c;
  opacity: 0.55;
}
.spiral span::before { left: 1px; }
.spiral span::after { right: 1px; }
.spiral span { position: relative; }

/* ---------- intercalaires (remplacent le menu) ---------- */
.tabs {
  position: absolute;
  top: 6%;
  right: 0;
  transform: translateX(100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
  transition: opacity 0.4s;
}
.book-wrap:not([data-closed="false"]) .tabs, .book-wrap:not([data-closed="false"]) .hint { opacity: 0; pointer-events: none; }
.tab {
  --c: var(--violet);
  font: 900 0.92rem var(--font-body);
  color: #fff;
  background: var(--c);
  border: 2.5px solid var(--ink);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  padding: 0.65rem 1.05rem 0.65rem 0.9rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, padding 0.15s;
}
.tab:hover { transform: translateX(4px); }
.tab[aria-current="true"] { padding-left: 1.5rem; }
.tab--pink { --c: var(--pink); }
.tab--blue { --c: var(--blue); }
.tab--yellow { --c: var(--yellow); color: var(--ink); }
.tab--teal { --c: var(--teal); }
.tab--dark { --c: var(--violet-dark); }
.tab--rose { --c: #ff8fc4; color: var(--ink); }

.hint {
  position: absolute;
  bottom: -30px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font: 700 0.85rem var(--font-body);
}

/* ==========================================================
   Pages
   ========================================================== */

.page {
  background-color: var(--paper);
  container-type: size;
  overflow: hidden;
}
.page-inner {
  position: relative;
  height: 100%;
  padding: 7cqh 7cqw 7cqh 17cqw;
  font-size: clamp(11px, 2.85cqw, 18px);
  line-height: 1.55;
  /* petits carreaux 5 × 5 et marge rose */
  background-image:
    linear-gradient(90deg, transparent calc(13cqw - 1px), var(--margin-line) calc(13cqw - 1px), var(--margin-line) calc(13cqw + 1px), transparent calc(13cqw + 1px)),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 4.2cqw 4.2cqw, 4.2cqw 4.2cqw;
}
/* ombre de la reliure, côté spirale */
.page--left .page-inner { box-shadow: inset -26px 0 30px -24px rgba(0, 0, 0, 0.35); }
.page--right .page-inner { box-shadow: inset 26px 0 30px -24px rgba(0, 0, 0, 0.35); }

.page-number {
  position: absolute;
  bottom: 3.5cqh;
  font: 700 1.25em var(--font-hand);
  color: var(--muted);
}
.page--left .page-number { left: 6cqw; }
.page--right .page-number { right: 6cqw; }

.page--right .margin-note { left: 4.5cqw; width: 8cqw; }
.margin-note {
  position: absolute;
  left: 1.5cqw;
  width: 10cqw;
  font: 700 1.05em/1 var(--font-hand);
  color: var(--pink);
  text-align: center;
  transform: rotate(-9deg);
}

.page h1, .page h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  margin: 0 0 0.55em;
}
.page h1 { font-size: 2.6em; }
.page h2 { font-size: 1.75em; }
.page h3 { font-size: 1.05em; font-weight: 900; margin: 0 0 0.2em; }
.page p { margin: 0 0 0.75em; }
.hand { font-family: var(--font-hand); font-weight: 700; color: var(--pink); font-size: 1.45em; line-height: 1.1; }
.muted { color: var(--muted); }

.btn {
  display: inline-block;
  font: 800 0.92em var(--font-body);
  padding: 0.6em 1.1em;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.btn--pink { background: var(--pink); color: #fff; }
.btn--ghost { background: #fff; }
.btn:active { transform: translateY(4px); box-shadow: none; }

/* ---------- couvertures ---------- */
.cover {
  /* violet adouci, carton mat : moins vif que le violet de la marque */
  background: #5f5196;
  /* carton légèrement grainé */
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%, rgba(0, 0, 0, 0.14));
  background-size: 6px 6px, 100% 100%;
  color: #fff;
  display: grid;
  place-items: start center;
  text-align: center;
  container-type: size;
}
.cover-inner { width: 74cqw; display: grid; justify-items: center; gap: 3.5cqh; padding-top: 10cqh; }
.cover-logo { width: 46cqw; background: var(--paper); border-radius: 50%; padding: 4cqw 3cqw 2cqw; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); }
.label {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 4cqh 6cqw;
  text-align: left;
  font-size: clamp(11px, 3cqw, 18px);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
}
.label p {
  margin: 0;
  padding: 0.35em 0 0.15em;
  border-bottom: 1.5px dotted rgba(21, 21, 21, 0.4);
  font-weight: 800;
  color: var(--muted);
}
.label p span { font: 700 1.55em var(--font-hand); color: var(--violet); margin-left: 0.3em; }
.cover-sticker {
  font: 900 clamp(11px, 2.7cqw, 16px) var(--font-body);
  background: var(--yellow);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.5em 1em;
  transform: rotate(-4deg);
}
.cover-open {
  font: 700 clamp(14px, 4cqw, 26px) var(--font-hand);
  color: var(--yellow);
  background: none;
  border: 0;
  cursor: pointer;
}
/* « ouvrir le cahier » bat doucement pour attirer l'œil, jusqu'à la première ouverture du cahier */
.cover:not(.cover--back) .cover-open { animation: cover-pulse 1.8s ease-in-out infinite; }
@keyframes cover-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(var(--pulse, 1.12)); }
}
body.portrait .cover-open { --pulse: 1.2; font-size: clamp(20px, 7.5cqw, 32px); } /* plus grand et plus marqué sur téléphone */
.cover .cover-open:is(:hover, :focus-visible), [data-opened] .cover .cover-open { animation: none; }
@media (prefers-reduced-motion: reduce) { .cover .cover-open { animation: none; } }
.cover--back .cover-inner { gap: 3cqh; padding-top: 22cqh; font-size: clamp(11px, 2.6cqw, 16px); }
.cover--back a { color: var(--yellow); font-weight: 800; }

/* ---------- page de garde : sommaire ---------- */
.toc { list-style: none; padding: 0; margin: 1.2em 0 0; }
.toc li { display: flex; align-items: baseline; gap: 0.4em; padding: 0.42em 0; }
.toc button {
  font: 800 1.08em var(--font-body);
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.toc button:hover { color: var(--violet); text-decoration: underline wavy var(--pink); }
.toc .dots { flex: 1; border-bottom: 2px dotted rgba(21, 21, 21, 0.35); transform: translateY(-0.3em); }
.toc .num { font: 700 1.3em var(--font-hand); color: var(--violet); }

/* ---------- accueil : courbe exponentielle ---------- */
.hero-title .stroke { color: var(--paper); -webkit-text-stroke: 2px var(--ink); text-shadow: 4px 4px 0 var(--pink); white-space: nowrap; }
.graph { position: relative; margin: 1em 0 0.8em; }
.graph svg { width: 100%; height: auto; touch-action: none; display: block; }
.graph-eq { display: flex; justify-content: space-between; font-weight: 800; margin-top: 0.3em; }
.graph-eq output { font: italic 1.15em "Cambria Math", Georgia, serif; }
.vertex { cursor: grab; outline: none; }
.vertex:focus { outline: none; }
.vertex:focus-visible .ring { stroke: #6f46d9; stroke-width: 4; }

/* ---------- présentation : photo, trombone, scotch ---------- */
.polaroid {
  position: relative;
  width: 70cqw;
  margin: 3cqh auto 0;
  background: #fff;
  padding: 3cqw 3cqw 0;
  border: 2px solid rgba(21, 21, 21, 0.15);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  transform: rotate(-3deg);
}
.polaroid img { display: block; width: 100%; aspect-ratio: 4 / 4.4; object-fit: cover; object-position: center 22%; }
.polaroid figcaption { font: 700 1.7em var(--font-hand); text-align: center; padding: 0.3em 0 0.4em; }
.tape {
  position: absolute;
  top: -3cqh;
  left: 50%;
  width: 28cqw;
  height: 5cqh;
  transform: translateX(-50%) rotate(4deg);
  background: rgba(255, 217, 61, 0.7);
  border-left: 2px dashed rgba(255, 255, 255, 0.5);
  border-right: 2px dashed rgba(255, 255, 255, 0.5);
}
.paperclip { position: absolute; top: -5cqh; right: 7cqw; width: 6cqw; transform: rotate(8deg); z-index: 2; }
.stickers { display: flex; flex-wrap: wrap; gap: 0.5em; margin-top: 5cqh; justify-content: center; }
.stickers span {
  font-weight: 900;
  font-size: 0.85em;
  padding: 0.35em 0.8em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  transform: rotate(var(--r, -2deg));
}
.stickers span:nth-child(1) { background: #e9e2ff; }
.stickers span:nth-child(2) { background: #dcf6f3; --r: 3deg; }
.stickers span:nth-child(3) { background: #fff3c4; --r: -1deg; }
.stickers span:nth-child(4) { background: #ffe0ef; --r: 2deg; }

.offer-list { list-style: none; padding: 0; margin: 0.6em 0 0; display: grid; gap: 0.55em; }
.offer-list li { padding-left: 1.3em; position: relative; }
.offer-list li::before { content: "→"; position: absolute; left: 0; color: var(--pink); font-weight: 900; }
.offer-list b { display: block; }

/* ---------- tarifs ---------- */
.price {
  display: flex;
  align-items: center;
  gap: 1em;
  margin: 1em 0 1.2em;
}
.price s { font: 1.7em var(--font-display); color: var(--muted); }
.price strong { font: 2.6em var(--font-display); color: var(--pink); text-shadow: 3px 3px 0 var(--ink); }
/* « * Après crédit d'impôt » */
.star { font-size: 0.5em; vertical-align: super; line-height: 0; margin-left: 0.05em; }
.price .star { text-shadow: 2px 2px 0 var(--ink); }
.price:has(+ .footnote) { margin-bottom: 0.1em; }
.price + .footnote { margin-top: -0.4em; }
.footnote { font-size: 0.82em; color: var(--muted); margin: 0 0 1em; }
.star-note { display: block; font-size: 0.8em; font-weight: 700; }
/* logo de l'agrément, à côté du paragraphe qui en parle */
.sap-logo { float: right; width: 18cqw; height: auto; margin: 0 0 0.4em 0.8em; mix-blend-mode: multiply; /* fond blanc fondu dans le papier */ }
.steps { list-style: none; padding: 0; margin: 0 0 1em; counter-reset: s; display: grid; gap: 0.7em; }
.steps li { counter-increment: s; position: relative; padding-left: 2.4em; }
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: -0.1em;
  width: 1.75em;
  height: 1.75em;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.9em;
  background: var(--teal);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.steps b { display: block; }

/* simulateur sur post-it */
.sim { display: grid; gap: 0.85em; }
.field label, .field legend { display: block; font-weight: 900; margin-bottom: 0.3em; }
.field .value { font-family: var(--font-display); color: var(--violet); margin-left: 0.3em; }
input[type="range"] { width: 100%; accent-color: var(--pink); }
input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  font: 700 0.95em var(--font-body);
  padding: 0.55em 0.75em;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: #fff;
}
textarea { min-height: 7em; resize: none; }
.tiers { display: flex; gap: 3px; margin-top: 0.4em; }
.tiers span { flex: 1; text-align: center; font-size: 0.72em; font-weight: 800; padding: 0.25em 0; border: 2px solid var(--ink); border-radius: 7px; background: #fff; line-height: 1.25; }
.tiers span[data-active="true"] { background: var(--yellow); }
.durations { display: flex; gap: 1em; font-weight: 800; }
fieldset { border: 0; padding: 0; margin: 0; }

.postit {
  position: relative;
  background: var(--yellow);
  padding: 1em 1.2em;
  box-shadow: 0 12px 16px -8px rgba(0, 0, 0, 0.35);
  transform: rotate(1.5deg);
  /* coin corné */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%);
}
.postit::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #e6bf20 50%, transparent 50%);
}
.postit .big { font: 2.4em var(--font-display); line-height: 1; display: block; margin: 0.15em 0; }
.postit .line { display: flex; justify-content: space-between; font-weight: 800; border-bottom: 1.5px dashed rgba(21, 21, 21, 0.3); padding: 0.2em 0; }
.postit small { display: block; margin-top: 0.5em; font-size: 0.78em; }
.postit--pink { background: #ffc4e1; transform: rotate(-2deg); }
.postit--pink::after { background: linear-gradient(135deg, #f19dc6 50%, transparent 50%); }

.postit { transform: rotate(var(--r, 1.5deg)); }
.postit--pink { --r: -2deg; }
.postit--blue { background: #cfdcff; }
.postit--blue::after { background: linear-gradient(135deg, #9fb5f5 50%, transparent 50%); }
.postit + .postit { margin-top: 1.1em; }
.postit .quote { margin: 0 0 0.5em; font-weight: 700; }

/* ---------- services : vidéo chargée au clic ---------- */
.video { margin: 1.1em 0 1em; }
.video-button {
  display: flex;
  align-items: center;
  gap: 0.8em;
  width: 100%;
  padding: 0.8em 1em;
  font: inherit;
  text-align: left;
  color: #fff;
  background: var(--violet);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.video-button b { display: block; }
.video-button small { display: block; font-size: 0.78em; opacity: 0.85; }
.video-play {
  flex: none;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  background: var(--pink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 2l5 3-5 3z' fill='white'/%3E%3C/svg%3E") center / 55% no-repeat;
  border: 2px solid var(--ink);
}
.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 2.5px solid var(--ink); border-radius: 14px; background: #000; }

/* ---------- actualités : coupures de presse scotchées ---------- */
.clipping {
  position: relative;
  background: #fff;
  padding: 1.1em 1.2em 0.9em;
  border: 1.5px solid rgba(21, 21, 21, 0.15);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.14);
  transform: rotate(var(--r, -1deg));
  margin-top: 0.6em;
}
.clipping .tape { top: -1.1em; height: 1.8em; }
.clipping--small { padding: 0.8em 1em 0.6em; }
.clipping--small + .clipping--small { margin-top: 1.2em; }
.clipping h3 { font-size: 1.15em; }
.clipping p { margin-bottom: 0.4em; }
.clipping-date { display: block; font: 700 1.2em var(--font-hand); color: var(--pink); }
.read-more {
  font: 700 1.2em var(--font-hand);
  color: var(--violet);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---------- contact ---------- */
.form { display: grid; gap: 0.7em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7em; }

/* ==========================================================
   Téléphone et tablette : une page à la fois, comme un carnet tenu en main.
   On tourne en glissant le doigt ; les intercalaires deviennent une barre en bas.
   ========================================================== */
body.portrait .desk-bar { padding: 10px 14px; }
body.portrait .desk-brand img { height: 36px; }
body.portrait .desk-brand span { font-size: 1.5rem; }
body.portrait .desk-btn { font-size: 0.85rem; padding: 0.5rem 0.9rem; }
body.portrait .prop { display: none; }

body.portrait .stage { height: 100dvh; padding: 62px 0 76px; }
/* une page au format carnet (0,57) qui tient entre la barre du haut et les onglets */
body.portrait .book-wrap { width: min(92vw, calc((100dvh - 150px) * 0.57), 560px); }
body.portrait .book-wrap::before,
body.portrait .book-wrap[data-closed="front"]::before,
body.portrait .book-wrap[data-closed="back"]::before { inset: 3% 1% -2% 1%; }

/* spirale sur le bord gauche de la page */
body.portrait .spiral { left: 0; width: 30px; }
body.portrait .spiral span { height: 10px; }

/* texte plus grand qu'au prorata : lisible sur téléphone */
body.portrait .page-inner {
  font-size: clamp(13px, 3.9cqw, 17px);
  padding: 6cqh 5cqw 8cqh 15cqw;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.portrait .page--left .page-inner,
body.portrait .page--right .page-inner { box-shadow: inset 22px 0 26px -22px rgba(0, 0, 0, 0.3); }
body.portrait .page--left .page-number { left: auto; right: 6cqw; }
body.portrait .margin-note { display: none; } /* marge trop étroite sur téléphone */
body.portrait .page h1 { font-size: 2.2em; }
body.portrait .polaroid { width: 64cqw; }

.swipe-hint { display: none; }
body.portrait .swipe-hint { display: block; margin-top: -2cqh; font: 700 clamp(12px, 3.6cqw, 16px) var(--font-body); color: rgba(255, 255, 255, 0.85); }

/* intercalaires → barre d'onglets en bas, à portée de pouce */
body.portrait .tabs {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  transform: none;
  flex-direction: row;
  gap: 6px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(21, 21, 21, 0.25);
  backdrop-filter: blur(6px);
}
body.portrait .tab {
  flex: 1;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 0.6rem 0.2rem;
  font-size: 0.8rem;
  text-align: center;
}
body.portrait .tab:hover { transform: none; }
body.portrait .tab[aria-current="true"] { padding-left: 0.85rem; transform: translateY(-4px); }

@media (prefers-reduced-motion: reduce) {
  .tab, .btn { transition: none; }
}

/* portrait : le navigateur garde le défilement vertical, les gestes horizontaux tournent la page */
/* à répéter sur .page-inner : c'est un conteneur de défilement, la règle du parent ne le traverse pas */
body.portrait #book,
body.portrait .page-inner { touch-action: pan-y; }

/* sept intercalaires : en portrait, la barre du bas défile à l'horizontale */
body.portrait .tabs { overflow-x: auto; scrollbar-width: none; padding-top: 14px; }
body.portrait .tab { flex: 0 0 auto; padding: 0.6rem 0.85rem; }
body.portrait .desk-sound { padding: 0.45rem 0.6rem; }
body.portrait .desk-sound span { display: none; }
body.portrait .desk-actions { gap: 0.5rem; }

/* ==========================================================
   Site Laravel : contenu réel du back-office et espace élève
   ========================================================== */
:root {
  --card: #ffffff;
  --border: 2.5px solid var(--ink);
  --press: 0 4px 0 var(--ink);
  --r-sm: 10px;
  --r-md: 14px;
  --grid-strong: rgba(77, 115, 255, 0.16);
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field-error { margin: 0.3em 0 0; color: var(--red); font-weight: 800; font-size: 0.88em; }
.notice { margin: 0.4em 0 0.9em; padding: 0.6em 0.85em; border: 2px solid var(--ink); border-radius: var(--r-md); font-weight: 800; font-size: 0.92em; }
.notice--ok { background: #dcf6f3; }
.notice--error { background: #ffe3e8; }

/* titres : un seul h1 par page, à la taille d'un titre de page du cahier */
.page .h2 { font-size: 1.75em; }
.page .hero-title { font-size: 2.6em; }
body.portrait .page .hero-title { font-size: 2.2em; }

/* page dont le contenu peut s'allonger (listes de l'élève, exercice) : elle défile */
.page-inner--scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

input[type="password"] {
  width: 100%;
  font: 700 0.95em var(--font-body);
  padding: 0.55em 0.75em;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 4px rgba(77, 115, 255, 0.35); }
.btn--blue { background: var(--blue); color: #fff; }
.btn--sm { font-size: 0.82em; padding: 0.45em 0.9em; }
.check { display: flex; gap: 0.5em; align-items: center; font-weight: 700; }

/* ---------- tarifs : adresse et suggestions ---------- */
.sim-address { margin-top: 0.4em; }
.sim-address label { display: block; font-weight: 900; margin-bottom: 0.3em; }
.sim-address-box { position: relative; }
.sim-suggestions {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.3em;
  list-style: none;
  background: var(--card);
  border: var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--press);
  max-height: 14em;
  overflow-y: auto;
}
.sim-suggestions li { padding: 0.45em 0.6em; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 0.92em; }
.sim-suggestions li:hover, .sim-suggestions li[aria-selected="true"] { background: #f4f0ff; }
.sim-address-status { margin: 0.4em 0 0; font-size: 0.82em; color: var(--muted); font-weight: 700; }

/* ---------- actualités et témoignages venus du back-office ---------- */
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.clamp--short { -webkit-line-clamp: 3; }
.clipping .clamp { -webkit-line-clamp: 4; }
.clipping-cover { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; margin-bottom: 0.6em; border: 1.5px solid rgba(21, 21, 21, 0.15); }
a.read-more { text-decoration: none; }
a.read-more:hover { text-decoration: underline wavy var(--pink); }
figure.postit { margin: 0; }
blockquote.quote { margin: 0 0 0.5em; font-weight: 700; }

/* ---------- barre du haut de l'espace élève ---------- */
.desk-actions form { margin: 0; }
button.desk-btn { cursor: pointer; }
.desk-link {
  font: 800 0.9rem var(--font-body);
  padding: 0.5rem 0.9rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
}
body.portrait .desk-link { display: none; } /* repris sur la quatrième de couverture */
body.portrait .desk-btn { white-space: nowrap; }

/* ---------- sommaire de l'élève : les séries ---------- */
.toc--series li { align-items: center; padding: 0.5em 0; border-bottom: 1.5px dashed rgba(21, 21, 21, 0.15); }
.toc--series a { display: grid; color: var(--ink); text-decoration: none; min-width: 0; }
.toc--series a:hover .toc-title { color: var(--violet); text-decoration: underline wavy var(--pink); }
.toc-title { font-weight: 900; font-size: 1.02em; }
.toc-meta { color: var(--muted); font-weight: 700; font-size: 0.8em; }
.toc-meta .late { color: var(--red); }
.toc--series .dots { min-width: 1.5em; }
.score { font: 700 1.5em/1 var(--font-hand); color: var(--teal-ink); white-space: nowrap; }
.score--low { color: var(--pink); }
.score--todo { font: 900 0.72em var(--font-body); color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 0.2em 0.6em; }

/* ---------- fiches à télécharger ---------- */
.files { list-style: none; padding: 0; margin: 0.4em 0 0; }
.files a { display: flex; gap: 0.7em; align-items: flex-start; padding: 0.65em 0; color: var(--ink); text-decoration: none; border-bottom: 1.5px dashed rgba(21, 21, 21, 0.18); }
.files a:hover b { color: var(--violet); text-decoration: underline wavy var(--pink); }
.files small { display: block; color: var(--muted); font-weight: 700; font-size: 0.82em; }
.files .ext { flex: none; font: 0.7em var(--font-display); padding: 0.3em 0.45em; background: var(--red); color: #fff; border-radius: 6px; margin-top: 0.15em; }
.pill { display: inline-block; padding: 0.1em 0.6em; border: 2px solid var(--ink); border-radius: 999px; font-size: 0.75em; font-weight: 900; background: #e9e2ff; margin: 0 0.3em 0.3em 0; }
.pill--teal { background: #dcf6f3; }
.pill--pink { background: #ffe0ef; }
.pill--yellow { background: var(--yellow); }

/* ==========================================================
   Pages fixes : exercice (double page), connexion, mot de passe
   ========================================================== */
body.desk-scroll { overflow: auto; }
.stage--static { height: auto; min-height: 100vh; }
.spread {
  position: relative;
  width: var(--book-w);
  height: calc(var(--book-w) / 1.44);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.spread::before {
  content: "";
  position: absolute;
  inset: 3% 2% -2%;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(22px);
  border-radius: 12px;
  z-index: -1;
}
.spread--single { width: calc(var(--book-w) / 2); grid-template-columns: 1fr; }
.spread--single .spiral { left: 0; }
.back-link { display: inline-block; font-size: 1.3em; text-decoration: none; margin-bottom: 0.3em; }
.exo-head { margin-bottom: 0.4em; }

/* connexion : la couverture du cahier, l'étiquette sert de formulaire */
.cover-inner--login { padding-top: 6cqh; gap: 3cqh; }
.cover-inner--login .cover-logo { width: 28cqw; }
.label.form { display: grid; gap: 0.7em; font-size: clamp(12px, 2.9cqw, 17px); }
.label.form p { border: 0; padding: 0; font-weight: 700; }
.label.form .field label { color: var(--ink); }
.cover-note { margin: 0; font-size: clamp(11px, 2.4cqw, 14px); color: rgba(255, 255, 255, 0.85); }

/* ---------- exercice : page de gauche ---------- */
.exo { margin: 0.6em 0 0; }
.exo-progress { display: flex; gap: 5px; margin: 0.6em 0 1em; }
.exo-progress span { flex: 1; height: 0.8em; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); }
.exo-progress span[data-state="ok"] { background: var(--teal); }
.exo-progress span[data-state="ko"] { background: var(--red); }
.exo-progress span[data-state="current"] { background: var(--yellow); }
.exo-progress span[data-state="pending"] { background: repeating-linear-gradient(45deg, #ffd38a 0 4px, #fff3c4 4px 8px); }
.exo-card { background: var(--card); border: var(--border); border-radius: var(--r-md); box-shadow: var(--press); padding: 1em 1.2em; }
.exo-statement { font-size: 1.05em; font-weight: 700; }
.exo-math { font-size: 1.55em; text-align: center; margin: 0.8em 0 1em; overflow-x: auto; }
/* problème : énoncé rappelé au-dessus de chacune de ses questions */
.exo-problem { margin: -0.2em 0 0.9em; padding: 0.7em 0.9em; border-left: 5px solid var(--violet); border-radius: var(--r-sm); background: rgba(111, 70, 217, 0.07); }
.exo-problem p { margin: 0.35em 0 0; }
.exo-problem-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3em 1em; margin: 0 !important; font-weight: 900; color: var(--violet-dark); }
.exo-problem-step { font-family: var(--font-hand); font-size: 1.3em; font-weight: 700; line-height: 1; color: var(--pink); }
.exo-problem-figure, .exo-problem-image { display: block; width: 100%; max-width: 380px; height: auto; margin: 0.6em auto 0; }
.exo-problem-figure svg { display: block; width: 100%; height: auto; }

/* problème : questions déjà faites, rappelées sous l'énoncé */
.exo-previous { margin: -0.4em 0 0.9em; padding: 0.55em 0.9em 0.6em; border-left: 5px solid var(--teal); border-radius: var(--r-sm); background: rgba(34, 179, 168, 0.08); font-size: 0.92em; }
.exo-previous-title { margin: 0 0 0.25em; font-weight: 900; color: var(--teal-ink); }
.exo-previous ol { margin: 0; padding-left: 1.4em; display: grid; gap: 0.3em; }
.exo-previous li::marker { font-weight: 900; color: var(--teal-ink); }
.exo-previous-q { display: block; }
.exo-previous-a { display: block; font-weight: 800; }
.exo-previous li[data-state="ok"] .exo-previous-mark { color: var(--teal-ink); }
.exo-previous li[data-state="ko"] .exo-previous-mark { color: var(--red); }
.exo-previous s { color: var(--muted); font-weight: 700; }
.exo-answer { display: flex; flex-wrap: wrap; gap: 0.6em; align-items: center; }
.exo-answer label { font-weight: 900; font-size: 1.2em; font-style: italic; font-family: Georgia, serif; }
.exo-answer input { width: 9em; font-size: 1.15em; text-align: center; }
.exo-unit { font-weight: 900; font-size: 1.1em; }
.exo-feedback { margin-top: 1em; border: 2px solid var(--ink); border-radius: var(--r-md); padding: 0.8em 1em; display: none; }
.exo-feedback[data-state] { display: block; }
.exo-feedback[data-state="ok"] { background: #dcf6f3; }
.exo-feedback[data-state="ko"] { background: #ffe3e8; }
.exo-feedback[data-state="hint"] { background: #fff3c4; }
.exo-feedback[data-state="pending"] { background: #fff1dc; }
.exo-checks { list-style: none; padding: 0; margin: 0.4em 0; display: grid; gap: 0.2em; font-weight: 700; }
.exo-checks li[data-ok="1"] { color: var(--teal-ink); }
.exo-checks li[data-ok="0"] { color: var(--red); }
.exo-model-title { margin: 0.5em 0 0; font-weight: 800; }
.exo-drawing { display: grid; gap: 0.5em; justify-items: start; padding: 0.7em 0.9em; border: 2px dashed var(--violet); border-radius: var(--r-sm); background: #f8f5ff; }
.exo-drawing p { margin: 0; font-weight: 700; }
.figures { list-style: none; padding: 0; margin: 0.5em 0 0; display: grid; gap: 0.5em; }
.figures li { display: grid; grid-template-columns: 4.5em 1fr; gap: 0.6em; align-items: start; padding: 0.45em 0.6em; border: 2px solid var(--ink); border-radius: var(--r-sm); background: var(--card); }
.figures li[data-state="ok"] { background: #dcf6f3; }
.figures li[data-state="ko"] { background: #ffe3e8; }
.figures li[data-state="pending"] { background: #fff1dc; }
.figures img { width: 4.5em; height: 4.5em; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid rgba(21, 21, 21, 0.2); }
.figures b, .figures small, .figures .figure-status, .figures .figure-comment { display: block; }
.figures small { color: var(--muted); font-weight: 700; }
.figure-status { font-weight: 800; font-size: 0.9em; }
.figure-comment { font-style: italic; font-size: 0.9em; margin-top: 0.15em; }
.exo-pending-note { margin: 0.3rem auto 0; font-weight: 800; color: #b26a00; }
.exo-recap li[data-state="pending"] { background: #fff1dc; }
.exo-previous li[data-state="pending"] .exo-previous-mark { color: #b26a00; }
.exo-feedback ol { margin: 0.4em 0 0; padding-left: 1.3em; }
.exo-feedback li { margin: 0.25em 0; }
.exo-tools { display: flex; flex-wrap: wrap; gap: 0.6em; margin-top: 1em; }
.exo-end { text-align: center; }
.exo-end .sim-big { font: 2.6em var(--font-display); color: var(--pink); text-shadow: 3px 3px 0 var(--ink); }
.exo-end .exo-tools { justify-content: center; }
.exo-recap { list-style: none; padding: 0; margin: 1em 0; display: grid; gap: 0.4em; text-align: left; }
.exo-recap li { display: flex; justify-content: space-between; gap: 1em; align-items: center; padding: 0.45em 0.7em; border: 2px solid var(--ink); border-radius: var(--r-sm); font-weight: 800; font-size: 0.92em; }
.exo-recap li[data-state="ok"] { background: #dcf6f3; }
.exo-recap li[data-state="ko"] { background: #ffe3e8; }
.exo-recap s { color: var(--red); margin-right: 0.4em; }
.exo-calc-used { display: block; margin-top: 0.4em; font-weight: 800; color: var(--blue); font-size: 0.92em; }
.exo-recap .exo-calc-used { display: inline; margin: 0 0 0 0.5em; font-size: 0.8em; }

/* ---------- exercice : page de droite, brouillon et calculatrice ---------- */
.tools-page { display: flex; flex-direction: column; gap: 0.7em; overflow-y: auto; scrollbar-width: thin; }
.exo-toolbox-bar { display: flex; gap: 0.5em; align-items: center; flex-wrap: wrap; }
.exo-toolbox-bar [aria-expanded="true"] { background: var(--yellow); color: var(--ink); }
.exo-toolbox-note { color: var(--muted); font-weight: 700; font-size: 0.85em; }
.tool-note { margin: 0.4em 0 0; font-size: 0.78em; color: var(--muted); font-weight: 700; }
.tool-row { display: flex; flex-wrap: wrap; gap: 0.35em; align-items: center; margin-bottom: 0.5em; }
.tool-sep { width: 2px; height: 1.3em; background: rgba(21, 21, 21, 0.2); margin: 0 0.15em; }
.chip { font: 800 0.8em var(--font-body); padding: 0.35em 0.75em; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--violet); color: #fff; }
.chip--danger { margin-left: auto; }

/* le brouillon occupe la page : on écrit directement sur les carreaux du cahier */
.scratchpad:not([hidden]) { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 14em; }
.scratchpad canvas, .scratchpad textarea {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  min-height: 10em;
  border: 2px dashed rgba(21, 21, 21, 0.3);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.3);
}
.scratchpad canvas { touch-action: none; cursor: crosshair; }
.scratchpad textarea { font: 600 1em/1.6 var(--font-body); padding: 0.4em 0.6em; resize: none; }
.scratchpad[data-view="draw"] .text-only, .scratchpad[data-view="text"] .draw-only { display: none; }
/* raisonnement : palette de symboles ; polices qui ont les symboles mathématiques en secours */
.scratchpad textarea { font-family: var(--font-body), "Cambria Math", "STIX Two Math", "Segoe UI Symbol", "Noto Sans Math", system-ui, sans-serif; }
.math-keys-cats { margin-bottom: 0.35em; }
.math-keys-row { display: none; gap: 0.3em; }
.math-keys[data-cat="calc"] [data-cat-keys="calc"], .math-keys[data-cat="pow"] [data-cat-keys="pow"], .math-keys[data-cat="geo"] [data-cat-keys="geo"],
.math-keys[data-cat="set"] [data-cat-keys="set"], .math-keys[data-cat="ana"] [data-cat-keys="ana"], .math-keys[data-cat="greek"] [data-cat-keys="greek"] { display: flex; }
.math-key {
  min-width: 2.2em; padding: 0.3em 0.45em; font: 700 0.95em/1.2 "Cambria Math", "STIX Two Math", "Segoe UI Symbol", var(--font-body), system-ui, sans-serif;
  border: 2px solid var(--ink); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: 0 2px 0 var(--ink);
}
.math-key:hover { background: #f4f0ff; }
.math-key:active { transform: translateY(2px); box-shadow: none; }
.math-script[aria-pressed="true"] { background: var(--pink); color: #fff; }
.exo-rich { white-space: pre-line; }
.exo-problem-sketch { background: #fff; border-radius: 6px; padding: 4px; }
.reasoning-preview:not([hidden]) { display: block; margin-top: 0.5em; padding: 0.45em 0.7em; border: 2px solid var(--violet); border-radius: var(--r-sm); background: #f8f5ff; max-height: 12em; overflow: auto; }
.reasoning-preview-label { display: block; font-size: 0.72em; font-weight: 800; color: var(--violet); text-transform: uppercase; letter-spacing: 0.04em; }
.reasoning-preview-body { white-space: pre-wrap; font-weight: 600; line-height: 1.7; }
.reasoning-preview-body .katex { font-size: 1.05em; }
.scratchpad[data-view="draw"] .reasoning-preview { display: none; }
.math-script sup, .math-script sub { font-size: 0.7em; }
/* figure à tracer : bonne figure par-dessus la feuille, et figure corrigée dessinée par l'enseignante */
.exo-solution-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; margin: 0.4em 0; }
.exo-solution-color { color: #ff4aa2; }
.exo-solution { max-width: 100%; }
/* réponse exacte (√, fractions, puissances) : palette et aperçu sous le champ */
.exo-answer-wrap[data-math-field] .exo-answer input { width: 12em; font-family: var(--font-body), "Cambria Math", "STIX Two Math", "Segoe UI Symbol", system-ui, sans-serif; }
.exo-answer-keys { margin-top: 0.6em; }
.exo-answer-keys .math-keys-row { flex-wrap: wrap; }
.exo-answer-preview .reasoning-preview-body .katex { font-size: 1.25em; }

.calculator { flex: none; background: #f4f0ff; border: 2px solid var(--ink); border-radius: var(--r-md); padding: 0.7em; box-shadow: var(--press); }
.calc-display { width: 100%; font: 800 1.15em var(--font-body); text-align: right; padding: 0.45em 0.7em; border: var(--border); border-radius: var(--r-sm); background: #fff; }
.calc-error { min-height: 1.2em; margin: 0.2em 0; color: var(--red); font-weight: 800; font-size: 0.8em; }
.calculator:not([data-error]) .calc-error, .calculator[data-error=""] .calc-error { visibility: hidden; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.3em; }
.calc-key { font: 800 0.95em var(--font-body); padding: 0.4em 0; border: 2px solid var(--ink); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.calc-key:active { transform: translateY(3px); box-shadow: none; }
.calc-key--op { background: #e9e2ff; }
.calc-key--fn { background: #ffe0ef; }
.calc-key--eq { background: var(--pink); color: #fff; grid-row: span 2; }
.calc-key--zero { grid-column: span 4; }
.calc-history { list-style: none; padding: 0; margin: 0.5em 0 0; font-size: 0.82em; color: var(--muted); font-weight: 700; text-align: right; }
.calc-history:empty { display: none; }
.calc-history li:first-child { color: var(--ink); }

/* ---------- pages fixes sur téléphone et tablette : on fait défiler l'écran ---------- */
body.portrait .stage--static { height: auto; min-height: 100dvh; padding: 72px 0 32px; }
body.portrait .spread { width: min(94vw, 600px); height: auto; grid-template-columns: 1fr; gap: 22px; }
body.portrait .spread::before { inset: 1% 1% -1%; }
body.portrait .spread .page { container-type: inline-size; border-left: 10px solid #9ea3ad; }
body.portrait .spread .cover { border-left-color: #4a3f80; padding: 28px 0 34px; }
body.portrait .spread .page-inner { height: auto; min-height: 60dvh; padding: 26px 16px 30px 15cqw; overflow: visible; }
body.portrait .spread .spiral { display: none; }
body.portrait .scratchpad canvas, body.portrait .scratchpad textarea { flex: none; height: 360px; }
body.portrait .cover-inner--login { padding-top: 0; gap: 18px; }
.toc-action { font: 700 1.15em/1.1 var(--font-hand); color: var(--violet); }
.desk-brand img { width: auto; }
/* textes qui dépendent de la mise en page (« page d'en face » / « page suivante ») */
.only-portrait { display: none; }
body.portrait .only-portrait { display: inline; }
body.portrait .only-desktop { display: none; }

/* aperçu d'une série par l'enseignante */
.notice--preview { background: #e9e2ff; }
.exo-peek { margin-top: 1em; border: 2px dashed var(--violet); border-radius: var(--r-md); padding: 0.5em 0.8em; background: #f7f4ff; font-size: 0.92em; }
.exo-peek summary { cursor: pointer; font-weight: 900; color: var(--violet); }
.exo-peek p { margin: 0.5em 0 0.2em; font-weight: 700; }
.exo-peek ol { margin: 0.3em 0 0; padding-left: 1.3em; }

/* ---------- actualités : liste (cahier) et article (double page) ---------- */
.clipping-title { font: 900 1.12em/1.25 var(--font-body); margin: 0 0 0.25em; }
.clipping-thumb { float: right; width: 32%; aspect-ratio: 4 / 3; object-fit: cover; margin: 0 0 0.4em 0.8em; border: 1.5px solid rgba(21, 21, 21, 0.15); }
.clipping::after { content: ""; display: block; clear: both; }
.post-lead { font-weight: 800; color: var(--muted); margin: 0; }
.post-body { line-height: 1.6; }
.post-body > :first-child { margin-top: 0; }
.post-body h2, .post-body h3 { font-family: var(--font-body); font-weight: 900; font-size: 1.15em; margin: 1.1em 0 0.4em; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 0.8em; }
.post-body ul, .post-body ol { padding-left: 1.3em; }
.post-body img { max-width: 100%; height: auto; border: 1.5px solid rgba(21, 21, 21, 0.15); }
.post-body blockquote { margin: 0.8em 0; padding: 0.4em 0.9em; border-left: 4px solid var(--pink); background: rgba(255, 196, 225, 0.35); }
/* titre de coupure : texte courant gras (et non la police des titres de page), deux lignes au plus */
.page .clipping-title { font: 900 1.08em/1.25 var(--font-body); margin: 0 0 0.25em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clipping .clamp--short { -webkit-line-clamp: 2; }
/* rubrique Services, ramassée sur une double page */
.price--compact { margin: 0.5em 0 0.8em; }
.steps--compact { gap: 0.45em; margin-bottom: 0; }
.offer-list--compact { gap: 0.25em; margin-top: 0; }

/* ---------- menu hamburger (téléphone et tablette) ---------- */
.desk-menu-toggle { display: none; }
body.portrait .desk-menu-toggle {
  display: grid;
  place-items: center;
  width: 48px;
  height: 46px;
  padding: 0;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
body.portrait .desk-menu-toggle:active { transform: translateY(4px); box-shadow: none; }
.burger, .burger::before, .burger::after { display: block; width: 22px; height: 3px; border-radius: 2px; background: var(--ink); transition: transform 0.2s, opacity 0.2s; }
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -7px; }
.burger::after { top: 7px; }
/* ouvert : la croix */
[aria-expanded="true"] .burger { background: transparent; }
[aria-expanded="true"] .burger::before { transform: translateY(7px) rotate(45deg); }
[aria-expanded="true"] .burger::after { transform: translateY(-7px) rotate(-45deg); }

body.portrait .desk-actions {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  right: 14px;
  min-width: 230px;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--ink);
}
body.portrait .desk-actions[data-open="true"] { display: flex; }
body.portrait .desk-actions > *,
body.portrait .desk-actions form > button { width: 100%; text-align: center; justify-content: center; }
body.portrait .desk-actions .desk-link { display: block; }
body.portrait .desk-actions .desk-sound span { display: inline; }
body.portrait .desk-actions .desk-btn,
body.portrait .desk-actions .desk-link,
body.portrait .desk-actions .desk-sound { font-size: 0.95rem; padding: 0.65rem 1rem; }
@media (prefers-reduced-motion: reduce) { .burger, .burger::before, .burger::after { transition: none; } }

/* spirale déplacée dans le bloc des pages (cahier.js) : entre les pages posées et la page qui tourne */
.stf__block > .spiral { z-index: 4; }

/* ---------- intercalaires sur ordinateur : la rubrique en cours ressort nettement ----------
   Les onglets glissent sous le bord de la page (z-index -1, sous le cahier) ;
   les autres rubriques restent en retrait et pâlies. */
body:not(.portrait) .tabs { z-index: -1; gap: 6px; }
body:not(.portrait) .tab {
  transform: translateX(-16px);
  padding-left: calc(0.9rem + 16px);
  filter: saturate(0.3) brightness(1.15);
  opacity: 0.82;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.25s, filter 0.25s, box-shadow 0.25s;
}
body:not(.portrait) .tab:hover { transform: translateX(-6px); filter: none; opacity: 1; }
body:not(.portrait) .tab[aria-current="true"] {
  transform: translateX(18px);
  opacity: 1;
  font-size: 1rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  padding-left: calc(0.9rem + 16px);
  filter: none;
  border-width: 3px;
  box-shadow: 5px 5px 0 var(--ink);
}
/* pastille blanche devant la rubrique en cours */
body:not(.portrait) .tab[aria-current="true"]::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.45em;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  vertical-align: 0.05em;
}
@media (prefers-reduced-motion: reduce) { body:not(.portrait) .tab { transition: none; } }

/* ---------- intercalaires : dégradés pastel brillants, liseré violet (d'après les visuels du site) ----------
   Chaque onglet a son dégradé (--g) ; un reflet blanc passe par-dessus, comme sur les étiquettes. */
.tab {
  --g: linear-gradient(90deg, #d9cbff, #ffc6e4);            /* Sommaire, Séries : lavande → rose */
  --tab-line: #5b34d6;
  --tab-ink: #3a1d9e;
  color: var(--tab-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.18) 42%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.12) 100%),
    var(--g);
  border-color: var(--tab-line);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), 3px 3px 0 rgba(43, 22, 120, 0.35);
}
.tab--pink   { --g: linear-gradient(90deg, #b9f0d7, #a8d3f7); }   /* Présentation, Fiches : menthe → ciel */
.tab--blue   { --g: linear-gradient(90deg, #f9a59b, #f8e27c); }   /* Tarifs : corail → jaune */
.tab--yellow { --g: linear-gradient(90deg, #aebcf6, #b6f0cf); color: var(--tab-ink); }   /* Services : pervenche → menthe */
.tab--dark   { --g: linear-gradient(90deg, #e0c8ff, #ffd3b5); }   /* Actualités : lilas → pêche */
.tab--rose   { --g: linear-gradient(90deg, #f8e58b, #c9b1f6); color: var(--tab-ink); }   /* Avis : jaune → lavande */
.tab--teal   { --g: linear-gradient(90deg, #a6ecf3, #f6b9d8); }   /* Contact : turquoise → rose */
.tab--mint   { --g: linear-gradient(90deg, #b6f0cf, #f8e58b); color: var(--tab-ink); }   /* Disponibilités : menthe → jaune */

/* ordinateur : les rubriques en retrait gardent leur couleur, un peu adoucie (le pastel ne supporte pas d'être grisé) */
body:not(.portrait) .tab {
  filter: saturate(0.75) brightness(1.04);
  opacity: 0.85;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 2px 2px 0 rgba(43, 22, 120, 0.25);
}
body:not(.portrait) .tab[aria-current="true"] {
  --tab-line: #4b2fa8;
  color: #2b1678;
  filter: saturate(1.15);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 5px 5px 0 #2b1678;
}
body:not(.portrait) .tab[aria-current="true"]::before { border-color: #4b2fa8; }

/* téléphone : barre du bas, même liseré violet */
body.portrait .tab { border-color: var(--tab-line); }
body.portrait .tab[aria-current="true"] { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 0 4px 0 #2b1678; }

/* mentions légales : texte dense, un peu plus petit */
.page-inner--legal { font-size: clamp(10px, 2.45cqw, 15px); }
.page-inner--legal h3 { margin-top: 0.9em; }
.page-inner--legal p { margin-bottom: 0.55em; }
.page-inner--legal a { overflow-wrap: anywhere; }
body.portrait .page-inner--legal { font-size: clamp(12px, 3.5cqw, 15px); }

/* pied de la première de couverture : SIREN et liens, en bas sans décaler le reste */
.cover { position: relative; }
.cover-footer {
  position: absolute;
  left: 6cqw;
  right: 6cqw;
  bottom: 3.5cqh;
  display: grid;
  gap: 0.5em;
  text-align: center;
  font-size: clamp(10px, 2.3cqw, 14px);
}
.cover-footer p { margin: 0; }
.cover-footer a { color: var(--yellow); font-weight: 800; }
/* petit téléphone : l'indication de glissement laisse la place au pied de couverture */
@media (max-height: 700px) { body.portrait .swipe-hint { display: none; } }
/* connexion : pied de couverture à la suite du formulaire */
.cover-footer-flow { width: 100%; }
.cover-footer-flow .cover-footer { position: static; margin-top: 1cqh; }

/* ---------- brouillon : outils de géométrie ---------- */
.shape-tools { gap: 0.25em; }
.tool-icon {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.tool-icon svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-icon[aria-pressed="true"] { background: var(--violet); color: #fff; }
.color-dot { width: 1.6em; height: 1.6em; padding: 0; border: 2px solid var(--ink); border-radius: 50%; background: var(--dot); cursor: pointer; }
.color-dot[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
/* la toile occupe la place restante ; le champ de texte s'y pose à l'endroit cliqué */
.draw-surface { position: relative; flex: 1 1 auto; display: flex; min-height: 10em; }
.draw-surface canvas { flex: 1 1 auto; min-height: 10em; }
.scratchpad[data-view="text"] .draw-surface { display: none; }
.scratchpad[data-current-tool="text"] canvas { cursor: text; }
.scratchpad[data-current-tool="eraser"] canvas { cursor: cell; }
.draw-text-input {
  position: absolute;
  width: 8em;
  padding: 0.15em 0.35em;
  font: 700 15px Nunito, system-ui, sans-serif;
  border: 2px dashed var(--violet);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
}
body.portrait .draw-surface canvas { flex: none; height: 360px; }
/* types de triangles : seulement avec l'outil Triangle */
/* variantes : seulement celles de la famille d'outils choisie */
.scratchpad .kinds { display: none; }
.scratchpad[data-view="draw"][data-current-tool="lines"] .kinds[data-group="lines"],
.scratchpad[data-view="draw"][data-current-tool="triangle"] .kinds[data-group="triangle"],
.scratchpad[data-view="draw"][data-current-tool="quad"] .kinds[data-group="quad"],
.scratchpad[data-view="draw"][data-current-tool="solid"] .kinds[data-group="solid"] { display: flex; }
.chip--kind { display: inline-flex; align-items: center; gap: 0.3em; }
.chip--kind svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* le champ de texte reste dans la feuille : rien ne déborde ni ne décale la page */
.draw-surface { overflow: hidden; }
/* brouillon : outil Sélection et bouton Supprimer */
.scratchpad[data-current-tool="select"] canvas { cursor: move; }
.chip:disabled { opacity: 0.4; cursor: default; }

/* ---------- Discussion avec l'enseignante (espace élève) ---------- */
.chat { position: fixed; right: 18px; bottom: 18px; z-index: 60; font-family: var(--font-body); }
.chat-fab {
  position: relative; display: flex; align-items: center; gap: 0.5em;
  padding: 0.6em 1em 0.6em 0.8em; border: var(--border, 2.5px solid var(--ink)); border-radius: 999px;
  background: var(--yellow); color: var(--ink); font: 800 1rem var(--font-body);
  box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}
.chat-fab:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.chat-fab svg { width: 1.5em; height: 1.5em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-fab .chat-presence { position: absolute; left: 2.1em; top: 0.35em; border: 2px solid var(--yellow); }
.chat[data-open="true"] .chat-fab { display: none; }
.chat-presence { display: inline-block; width: 0.75em; height: 0.75em; border-radius: 50%; background: #b8b3c4; flex: none; }
.chat-presence[data-status="online"] { background: var(--teal); box-shadow: 0 0 0 3px rgba(34, 179, 168, 0.25); animation: chat-pulse 2s ease-in-out infinite; }
.chat-presence[data-status="recent"] { background: #e6a800; }
@keyframes chat-pulse { 50% { box-shadow: 0 0 0 6px rgba(34, 179, 168, 0.08); } }
@media (prefers-reduced-motion: reduce) { .chat-presence { animation: none !important; } }
.chat-unread {
  position: absolute; top: -0.5em; right: -0.4em; min-width: 1.5em; padding: 0.1em 0.4em; border-radius: 999px;
  background: var(--pink); color: #fff; font-size: 0.8em; text-align: center; border: 2px solid var(--ink);
}

.chat-panel {
  display: flex; flex-direction: column; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px));
  background: var(--paper); border: var(--border, 2.5px solid var(--ink)); border-radius: 18px; box-shadow: 0 6px 0 var(--ink), 0 18px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 0.6em 0.9em; background: var(--violet); color: #fff; }
.chat-head b { font-family: var(--font-display); font-weight: 400; font-size: 1.1em; letter-spacing: 0.02em; margin-right: 0.5em; }
.chat-status { display: inline-flex; align-items: center; gap: 0.35em; font-size: 0.85em; font-weight: 700; opacity: 0.95; }
.chat-head .chat-presence { border: 2px solid #fff; }
.chat-close { width: 1.8em; height: 1.8em; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 1.2em; line-height: 1; cursor: pointer; }
.chat-hint { margin: 0; padding: 0.45em 0.9em; font-size: 0.82em; font-weight: 700; color: var(--muted); background: rgba(255, 253, 246, 0.92); border-bottom: 1px dashed rgba(0, 0, 0, 0.12); }
.chat-list { flex: 1; overflow-y: auto; padding: 0.8em; display: flex; flex-direction: column; gap: 0.55em; }
.chat-empty { margin: auto 0.5em; color: var(--muted); font-weight: 700; font-size: 0.9em; text-align: center; }
.chat-msg { max-width: 86%; padding: 0.5em 0.7em; border-radius: 14px; background: #fff; border: 2px solid var(--ink); align-self: flex-start; font-size: 0.95em; }
.chat-msg[data-from="me"] { align-self: flex-end; background: #ffe6f2; }
.chat-msg[data-from="teacher"] { background: #e9fbf8; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg time { display: block; margin-top: 0.2em; font-size: 0.72em; color: var(--muted); font-weight: 700; }
.chat-ctx { margin-bottom: 0.35em; padding: 0.45em 0.6em; border-radius: 10px; background: #fff7d6; border: 1.5px dashed #e0c25c; font-size: 0.88em; }
.chat-ctx-head { font-size: 0.78em; font-weight: 800; color: #8a6d00; text-transform: uppercase; letter-spacing: 0.03em; }
.chat-ctx-text { margin-top: 0.15em; white-space: pre-wrap; }
.chat-ctx-problem { margin-top: 0.15em; font-size: 0.92em; max-height: 8em; overflow-y: auto; }
.chat-ctx-math { overflow-x: auto; font-size: 1.05em; }
.chat-ctx-answer { margin-top: 0.2em; font-size: 0.85em; color: var(--muted); }
.chat-form { display: grid; gap: 0.4em; padding: 0.6em 0.8em 0.8em; background: rgba(255, 253, 246, 0.96); border-top: 2px solid var(--ink); }
.chat-form textarea { width: 100%; resize: none; padding: 0.5em 0.65em; border: 2px solid var(--ink); border-radius: 12px; font: inherit; background: #fff; }
.chat-form .btn { justify-self: end; }
.chat-attached { position: relative; max-height: 9em; overflow-y: auto; }
.chat-detach { position: absolute; top: 0.2em; right: 0.2em; width: 1.6em; height: 1.6em; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.08); cursor: pointer; }

/* question en cours : envoyer l'énoncé dans la discussion */
.exo-ask { margin-top: 0.6em; }

/* téléphone : au-dessus des onglets du cahier, panneau plein écran */
@media (max-width: 760px) {
  .chat { right: 12px; bottom: 74px; }
  .chat-fab-label { display: none; }
  .chat-fab { padding: 0.65em; }
  .chat-fab .chat-presence { left: auto; right: -0.1em; top: -0.1em; }
  .chat[data-open="true"] { inset: 0; right: 0; bottom: 0; }
  .chat-panel { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}

/* ==========================================================
   Boutons et pastilles : mêmes dégradés pastel que les intercalaires
   (reflet brillant, liseré violet, ombre violette, texte violet foncé)
   ========================================================== */
:root {
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.18) 42%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.12) 100%);
  --ui-line: #5b34d6;
  --ui-ink: #3a1d9e;
  --ui-shadow: #2b1678;
  --g-sommaire: linear-gradient(90deg, #d9cbff, #ffc6e4);   /* lavande → rose */
  --g-presentation: linear-gradient(90deg, #b9f0d7, #a8d3f7); /* menthe → ciel */
  --g-tarifs: linear-gradient(90deg, #f9a59b, #f8e27c);     /* corail → jaune */
  --g-services: linear-gradient(90deg, #aebcf6, #b6f0cf);   /* pervenche → menthe */
  --g-actualites: linear-gradient(90deg, #e0c8ff, #ffd3b5); /* lilas → pêche */
  --g-avis: linear-gradient(90deg, #f8e58b, #c9b1f6);       /* jaune → lavande */
  --g-contact: linear-gradient(90deg, #a6ecf3, #f6b9d8);    /* turquoise → rose */
  --g-blanc: linear-gradient(90deg, #ffffff, #f1ecfd);      /* boutons secondaires */
}

/* --- boutons d'action ------------------------------------------------------------ */
.btn,
.desk-btn,
.desk-link,
.desk-sound,
.chat-fab {
  --g: var(--g-tarifs);
  color: var(--ui-ink);
  background: var(--gloss), var(--g);
  border-color: var(--ui-line);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), 0 4px 0 var(--ui-shadow);
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover, .desk-btn:hover, .desk-link:hover, .desk-sound:hover, .chat-fab:hover { filter: brightness(1.04) saturate(1.1); }
.btn:active, .desk-btn:active, .desk-link:active, .desk-sound:active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); }

.btn--pink { --g: var(--g-contact); color: var(--ui-ink); }          /* action principale : Valider, Envoyer, Demander un cours */
.btn--blue { --g: var(--g-presentation); color: var(--ui-ink); }
.btn--ghost, .desk-link, .desk-sound { --g: var(--g-blanc); }
.desk-btn { --g: var(--g-avis); }                                     /* Espace élève, Se déconnecter, Retour */
.desk-sound[aria-pressed="true"] { --g: var(--g-services); color: var(--ui-ink); }
.chat-fab { --g: var(--g-avis); }
.chat-fab .chat-presence { border-color: #fff; }
.chat-unread { background: linear-gradient(90deg, #ff7fbf, #c77dff); border-color: var(--ui-line); }

/* --- boutons d'outils (brouillon, calculatrice) ---------------------------------- */
.chip, .tool-icon {
  color: var(--ui-ink);
  border-color: var(--ui-line);
  background: var(--gloss), var(--g-blanc);
}
.chip[aria-pressed="true"], .tool-icon[aria-pressed="true"] {
  color: var(--ui-ink);
  background: var(--gloss), var(--g-sommaire);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75), 0 2px 0 var(--ui-shadow);
}
.chip--danger { background: var(--gloss), var(--g-contact); }
.calc-key { color: var(--ui-ink); border-color: var(--ui-line); background: var(--gloss), var(--g-blanc); box-shadow: 0 3px 0 var(--ui-shadow); }
.calc-key--op { background: var(--gloss), var(--g-sommaire); }
.calc-key--fn { background: var(--gloss), var(--g-contact); }
.calc-key--eq { color: var(--ui-ink); background: var(--gloss), var(--g-tarifs); }

/* --- pastilles --------------------------------------------------------------------- */
.pill {
  color: var(--ui-ink);
  border-color: var(--ui-line);
  background: var(--gloss), var(--g-sommaire);
}
.pill--teal { background: var(--gloss), var(--g-presentation); }
.pill--pink { background: var(--gloss), var(--g-contact); }
.pill--yellow { background: var(--gloss), var(--g-tarifs); }
.score--todo { color: var(--ui-ink); border-color: var(--ui-line); background: var(--gloss), var(--g-avis); }
.cover-sticker { color: var(--ui-ink); border-color: var(--ui-line); background: var(--gloss), var(--g-avis); }

/* lecture de la vidéo des services : pastille ronde assortie */
.video-play { background-color: #c77dff; }

/* boutons Brouillon / Calculatrice, tranches du simulateur : mêmes dégradés */
.exo-toolbox-bar .chip { background: var(--gloss), var(--g-blanc); }
.exo-toolbox-bar [aria-expanded="true"] { color: var(--ui-ink); background: var(--gloss), var(--g-avis); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75), 0 2px 0 var(--ui-shadow); }
.tiers span { color: var(--ui-ink); border-color: var(--ui-line); background: var(--gloss), var(--g-blanc); }
.tiers span[data-active="true"] { background: var(--gloss), var(--g-tarifs); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75), 0 2px 0 var(--ui-shadow); }

/* ---------- planning des disponibilités (vitrine et légende) ----------
   Mêmes dégradés que les intercalaires et les boutons : menthe = libre, corail rosé = pris. */
.slot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 1.15em;
  border: 1.5px solid var(--ui-line);
  border-radius: 6px;
  background: var(--gloss), linear-gradient(90deg, #f7b2a8, #f4bfd8);
}
.slot[data-state="free"] { background: var(--gloss), linear-gradient(90deg, #b9f0d7, #a8e6c4); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.slot[data-state="past"] { background: repeating-linear-gradient(135deg, #f1eef7 0 5px, #e6e1ef 5px 10px); border-color: #c9c1dc; }

.planning-legend { list-style: none; display: grid; gap: 0.45em; padding: 0; margin: 1em 0 0; font-weight: 800; }
.planning-legend li { display: flex; align-items: center; gap: 0.6em; }
.planning-legend .slot { width: 2.4em; height: 1.4em; flex: none; }

.planning { margin-top: 12cqh; } /* loin du coin de la feuille, qui sert à tourner la page */
.planning-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; margin-bottom: 0.6em; }
.planning-title { margin: 0; font: 900 1.05em var(--font-body); color: var(--violet-dark); text-align: center; }
.planning-arrow {
  width: 2.1em; height: 2.1em; flex: none;
  border: 2px solid var(--ui-line); border-radius: 50%;
  background: var(--gloss), var(--g-sommaire);
  color: var(--ui-ink); font: 900 1.3em/1 var(--font-body);
  box-shadow: 0 3px 0 var(--ui-shadow); cursor: pointer;
}
.planning-arrow:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
.planning-arrow:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.planning.is-loading .planning-grid { opacity: 0.5; }

.planning-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.planning-grid th { font-size: 0.72em; font-weight: 900; color: var(--ui-ink); line-height: 1.15; }
.planning-grid thead th { padding: 0.2em 0; border-radius: 6px; }
.planning-grid thead th.is-today { background: var(--gloss), var(--g-avis); border: 1.5px solid var(--ui-line); }
.planning-grid tbody th { width: 2.6em; text-align: right; padding-right: 0.3em; white-space: nowrap; }
.planning-grid thead th:first-child { width: 2.6em; }
.planning-day, .planning-date { display: block; }
.planning-date { font-weight: 700; opacity: 0.75; }
.planning-grid td { padding: 0; height: 1.9em; }
/* une case = une heure : la demi-heure pile en haut, la demie en bas */
.slot-pair { display: flex; flex-direction: column; gap: 1px; height: 100%; }
.slot-pair .slot { flex: 1; min-height: 0; height: auto; }
.slot-pair .slot:first-child { border-radius: 6px 6px 2px 2px; }
.slot-pair .slot:last-child { border-radius: 2px 2px 6px 6px; }

/* ---------- pages « réglées » : le texte s'écrit sur les lignes du cahier (ordinateur) ----------
   Une ligne de texte = un carreau (4.2cqw), le texte démarre sur une ligne, posé sur le trait
   (site.js mesure la ligne de base de chaque texte). Les blocs qui ne tombent pas juste (vidéo, prix, coupures…) sont recalés par
   site.js : ce qui suit retombe sur une ligne. */
body:not(.portrait) .page-inner--ruled {
  --l: 4.2cqw;
  line-height: var(--l);
  padding-top: calc(2 * var(--l));
}
body:not(.portrait) .page-inner--ruled > *,
body:not(.portrait) .page-inner--ruled :is(p, h1, h2, h3, ul, ol, li, label, legend, fieldset, figure, figcaption) { margin-top: 0 !important; margin-bottom: 0 !important; }
body:not(.portrait) .page-inner--ruled :is(h1, h2) { line-height: calc(2 * var(--l)); }
body:not(.portrait) .page-inner--ruled h3 { line-height: var(--l); }
body:not(.portrait) .page-inner--ruled > h3:not(:first-child) { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled:not(.page-inner--legal) > :is(h1, h2) + :not(p.muted) { margin-top: var(--l) !important; }
/* pages denses (mentions légales) : on commence une ligne plus haut */
body:not(.portrait) .page-inner--ruled.page-inner--legal { padding-top: var(--l); padding-right: 4.2cqw; }
/* page très remplie (mentions légales, page 18) : intertitres sans ligne vide avant, la page tient sur la feuille */
body:not(.portrait) .page-inner--ruled.page-inner--tight > h3:not(:first-child) { margin-top: 0 !important; }
body:not(.portrait) .page-inner--ruled > p + p { text-indent: 1.5em; }
body:not(.portrait) .page-inner--ruled > :is(ul, ol, .video, .price, figure, .clipping) { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled > :is(ul, ol, .video, .price, figure, .clipping) + * { margin-top: var(--l) !important; }
/* « * Après crédit d'impôt » collé sous le prix, la ligne d'espace passe après la note */
body:not(.portrait) .page-inner--ruled > .price + .footnote { margin-top: 0 !important; line-height: var(--l); }
body:not(.portrait) .page-inner--ruled > .price + .footnote + * { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled :is(.offer-list, .steps) { gap: 0; }
body:not(.portrait) .page-inner--ruled .hand { line-height: var(--l); }
/* écriture à la main et papiers collés : une ligne d’air avant et après */
body:not(.portrait) .page-inner--ruled > :is(p.hand, .postit):not(:first-child),
body:not(.portrait) .page-inner--ruled > :is(p.hand, .postit) + * { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled > p.hand:first-child + * { margin-top: var(--l) !important; }

/* pages réglées : sommaire, accueil, formulaires, simulateur, planning */
body:not(.portrait) .page-inner--ruled .toc li { padding: 0; line-height: var(--l); height: var(--l); }
body:not(.portrait) .page-inner--ruled .toc li > * { line-height: var(--l); }
body:not(.portrait) .page-inner--ruled .toc li + li { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled .toc .dots { transform: translateY(-0.25em); }
body:not(.portrait) .page-inner--ruled .hero-title { line-height: calc(2 * var(--l)); }
body:not(.portrait) .page-inner--ruled .graph-eq { margin-top: 0; line-height: var(--l); }
body:not(.portrait) .page-inner--ruled :is(.form, .sim, .form-row) { row-gap: 0; }
/* entre deux groupes de champs : l’intitulé s’écrit sur la ligne au-dessus de son cadre, après une ligne d’air */
body:not(.portrait) .page-inner--ruled :is(.form, .sim) > * + * { margin-top: calc(2 * var(--l)) !important; }
body:not(.portrait) .page-inner--ruled .form > :last-child { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled > .sim-address { margin-top: var(--l) !important; }
body:not(.portrait) .page-inner--ruled fieldset { padding: 0; border: 0; }
body:not(.portrait) .page-inner--ruled :is(.field label, .field legend, .sim-address label) { margin: 0; line-height: var(--l); padding: 0; }
body:not(.portrait) .page-inner--ruled :is(input[type="text"], input[type="email"], input[type="tel"], select) { height: calc(2 * var(--l)); box-sizing: border-box; padding-block: 0; }
body:not(.portrait) .page-inner--ruled textarea { box-sizing: border-box; height: calc(4 * var(--l)); min-height: 0 !important; }
body:not(.portrait) .page-inner--ruled #t-message { height: calc(3 * var(--l)); }
body:not(.portrait) .page-inner--ruled input[type="range"] { height: var(--l); margin: 0; display: block; }
body:not(.portrait) .page-inner--ruled :is(.sim-address-status, .field-error, .durations, .notice) { margin: 0; line-height: var(--l); }
body:not(.portrait) .page-inner--ruled .tiers { margin-top: 0; }
body:not(.portrait) .page-inner--ruled .tiers span { line-height: calc(var(--l) * 0.5); padding: calc(var(--l) * 0.25) 0; box-sizing: border-box; height: calc(var(--l) * 1.5 - 0px); }
body:not(.portrait) .page-inner--ruled .planning-legend { gap: 0; }
body:not(.portrait) .page-inner--ruled .planning-legend li { line-height: var(--l); }
body:not(.portrait) .page-inner--ruled .planning { margin-top: calc(2 * var(--l)); }
body:not(.portrait) .page-inner--ruled .planning-nav { margin: 0; min-height: calc(2 * var(--l)); }
body:not(.portrait) .page-inner--ruled .planning-title { line-height: var(--l); }
body:not(.portrait) .page-inner--ruled .planning-grid { margin-top: var(--l); border-spacing: 3px 0; }
body:not(.portrait) .page-inner--ruled .planning-grid th { line-height: var(--l); padding: 0; }
body:not(.portrait) .page-inner--ruled .planning-grid thead th.is-today { border: 0; box-shadow: inset 0 0 0 1.5px var(--ui-line); }
body:not(.portrait) .page-inner--ruled .planning-grid td { height: calc(2 * var(--l)); padding: 0; } /* une heure = deux lignes, une par demi-heure */
body:not(.portrait) .page-inner--ruled .planning-grid td .slot-pair { height: calc(2 * var(--l) - 4px); margin: 2px 0; gap: 2px; }
body:not(.portrait) .page-inner--ruled .planning-grid td .slot { min-height: 0; box-sizing: border-box; }

/* ---------- discussion : fichiers transmis (PDF, photos) ---------- */
.chat-files { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.35em; margin-top: 0.3em; }
.chat-file {
  display: inline-flex; align-items: center; gap: 0.45em; max-width: 100%;
  padding: 0.4em 0.6em; border: 1.5px solid var(--ink); border-radius: 10px;
  background: #fff; color: var(--ink); text-decoration: none; font-size: 0.88em;
}
.chat-file:hover { background: #f4f0ff; }
.chat-file svg { width: 1.3em; height: 1.3em; flex: none; color: #d14d65; }
.chat-file b { display: block; font-weight: 800; overflow-wrap: anywhere; }
.chat-file small { display: block; font-size: 0.8em; color: var(--muted); font-weight: 700; }
.chat-file--image { padding: 0; overflow: hidden; }
.chat-file--image img { display: block; max-width: 13em; max-height: 10em; object-fit: cover; }

.chat-picked { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3em; margin: 0; padding: 0; }
.chat-picked li {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.15em 0.2em 0.15em 0.6em; border: 1.5px solid var(--ui-line); border-radius: 999px;
  background: var(--gloss), var(--g-sommaire); color: var(--ui-ink); font-size: 0.8em; font-weight: 800;
}
.chat-picked button { width: 1.5em; height: 1.5em; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.6); color: var(--ui-ink); cursor: pointer; line-height: 1; }
.chat-progress { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.chat-progress span { display: block; height: 100%; background: var(--g-presentation); transition: width 0.2s; }
.chat-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; }
.chat-form .chat-actions .btn { justify-self: auto; margin-left: auto; }
.chat-attach {
  display: inline-flex; align-items: center; gap: 0.35em; padding: 0.35em 0.7em;
  border: 2px dashed var(--ui-line); border-radius: 999px; color: var(--ui-ink);
  font-weight: 800; font-size: 0.85em; cursor: pointer; background: #fff;
}
.chat-attach:hover { background: #f4f0ff; }
.chat-attach:focus-within { outline: 2px solid var(--violet); outline-offset: 2px; }
.chat-attach svg { width: 1.15em; height: 1.15em; }
.btn:disabled { opacity: 0.55; cursor: wait; }
[x-cloak] { display: none !important; }

/* discussion : message de l'élève lu par l'enseignante */
.chat-seen { color: #11695f; }
.chat-seen svg { width: 1.15em; height: 1.15em; vertical-align: -0.25em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* discussion : notifications sur le téléphone de l'élève */
.chat-push { padding: 0.4em 0.9em; background: #f4f0ff; border-bottom: 1px dashed rgba(91, 52, 214, 0.3); font-size: 0.82em; font-weight: 700; color: var(--ui-ink); }
.chat-push p { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3em 0.6em; margin: 0; }
.chat-push-btn { padding: 0.25em 0.8em; border: 1.5px solid var(--ui-line); border-radius: 999px; background: var(--gloss), var(--g-sommaire); color: var(--ui-ink); font: 800 1em var(--font-body); cursor: pointer; }
.chat-push-link { padding: 0; border: 0; background: none; color: var(--violet); font: 800 1em var(--font-body); text-decoration: underline; cursor: pointer; }
.chat-push-message { margin-top: 0.2em !important; color: #11695f; }

/* barre du haut de l'espace élève : « Mon profil » avec la photo */
.desk-profile { display: inline-flex; align-items: center; gap: 0.45rem; }
.desk-profile img, .desk-profile > span[aria-hidden] { box-shadow: 0 0 0 2px #fff; }
