/* ==========================================================================
   Elite 3 — Direction artistique
   --------------------------------------------------------------------------
   Thème unique sombre, gris neutre (aucune teinte bleue).
   Accent : jaune « surligneur ». Motifs : cahiers, papier Seyès, fiches bristol.
   Typo : Instrument Serif (titres du site et du cahier) · Geist (tout le reste).
          Plus de police manuscrite : dans le cahier comme dans les notes,
          le texte est écrit dans la police de l'interface — c'est lisible
          à toutes les tailles, sur papier Seyès comme ailleurs.
   ========================================================================== */

:root {
  --bg:        #141415;
  --bg-2:      #18181a;
  --surface:   #1c1c1f;
  --surface-2: #232327;
  --surface-3: #2b2b30;
  --line:        rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --text:   #ededee;
  --text-2: #a6a6ab;
  --text-3: #9a9aa3;
  --control-border: #787881;

  --accent:      #f2e35c;
  --accent-ink:  #17170f;
  --accent-soft: rgba(242, 227, 92, .12);
  --danger: #ef6461;
  --ok:     #62cf8e;
  --warn:   #f0a54a;

  --paper:   #fbf9f2;
  --ink:     #1f3a8a;
  --ink-red: #c9302c;

  --radius:    16px;
  --radius-sm: 11px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font-ui:      'Geist', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  /* --font-hand : les titres écrits sur le papier · --font-note : le texte courant.
     Les deux sont des polices ordinaires : rien de manuscrit. */
  --font-hand:    'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-note:    'Geist', 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ---------- Base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* L'attribut `hidden` vaut `display: none`… que n'importe quel `display: flex`
   ou `display: grid` écrase sans prévenir. Le piège est revenu sept fois dans
   ce fichier, corrigé règle par règle : on le règle ici, une fois pour toutes. */
[hidden] { display: none !important; }
html { color-scheme: dark; background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 16px/1.55 var(--font-ui); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* grain + lumière douce : donne de la matière au gris */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px 520px at 18% -8%, rgba(255, 255, 255, .05), transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  opacity: .5;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: rgba(242, 227, 92, .35); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.i {
  width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop  { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.rise { animation: rise .35s var(--ease) both; }

/* ---------- Structure ----------------------------------------------------- */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 26px;
  padding: 22px 16px 16px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent 30%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; border: 0; background: none; text-align: left; }
.brand-name { font: italic 30px/1 var(--font-display); letter-spacing: -.01em; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 2px;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px;
  font: 700 17px/1 var(--font-ui); transform: rotate(-6deg);
  box-shadow: 0 6px 16px -6px rgba(242, 227, 92, .55);
}
.brand-sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 3px; letter-spacing: .02em; }

.sb-label { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 0 8px 8px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 11px; background: none;
  color: var(--text-2); font-size: 14.5px; font-weight: 500; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item .i { font-size: 17px; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink);
}
.sb-foot { margin-top: auto; }

.account-card {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left;
  transition: border-color .15s;
}
.account-card:hover { border-color: var(--line-strong); }
.account-card .who { min-width: 0; flex: 1; }
.account-card .who b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card .who span { font-size: 12px; color: var(--text-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--surface-3); color: var(--text);
}
.avatar.is-admin { background: var(--accent); color: var(--accent-ink); }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 44px 48px 90px; }

.topbar, .tabbar { display: none; }

/* ---------- Sélecteur de classe ------------------------------------------ */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px;
  padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: none; padding: 7px 8px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-3); white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }

/* ---------- Typographie --------------------------------------------------- */
.page-head { margin-bottom: 34px; }
.eyebrow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); }
.display {
  margin: 12px 0 0; font: 400 clamp(38px, 5.2vw, 62px)/1.02 var(--font-display);
  letter-spacing: -.02em; text-wrap: balance;
}
.display em { font-style: italic; color: var(--text-2); }
.lead { margin: 14px 0 0; max-width: 60ch; color: var(--text-2); font-size: 15.5px; }
.mark {
  padding: 0 .06em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
  background: linear-gradient(100deg, transparent .2em, var(--accent) .28em, var(--accent) calc(100% - .2em), transparent calc(100% - .12em))
              no-repeat 0 92% / 100% .2em;
}
.mark.draw { animation: draw-mark .9s .45s var(--ease) both; }
@keyframes draw-mark { from { background-size: 0 .2em; } to { background-size: 100% .2em; } }
.h2 { margin: 0; font: 400 28px/1.1 var(--font-display); letter-spacing: -.01em; }
.h2 em { font-style: italic; color: var(--text-2); }
.h3 { margin: 0; font-size: 15px; font-weight: 600; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.hand { font-family: var(--font-hand); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- Boutons ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 15px; border-radius: 11px; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 550; text-decoration: none;
  transition: background .15s, border-color .15s, transform .12s, filter .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .i { font-size: 16px; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(239, 100, 97, .14); border-color: rgba(239, 100, 97, .25); color: #ff8b88; }
.btn-danger:hover { background: rgba(239, 100, 97, .22); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; background: transparent; border-color: transparent; color: var(--text-3); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon .i { font-size: 17px; }

/* ---------- Formulaires --------------------------------------------------- */
.field { display: block; }
.field + .field, .field + .grid-2, .grid-2 + .field, .grid-2 + .grid-2 { margin-top: 16px; }
.label { display: block; margin-bottom: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--control-border); color: var(--text);
  font-size: 14.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(242, 227, 92, .6); box-shadow: 0 0 0 3px rgba(242, 227, 92, .12); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a6a6ab' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.select option, .select optgroup { background: var(--surface-2); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.textarea.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13.5px; }
.hint { margin-top: 7px; font-size: 12.5px; color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 > .field { margin-top: 0; }
.check { display: flex; align-items: flex-start; gap: 11px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }

.tchips { display: flex; flex-wrap: wrap; gap: 7px; }
.tchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text-2);
  font-size: 13px; font-weight: 550; transition: .15s;
}
.tchip .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tchip:hover { color: var(--text); }
.tchip.on { background: var(--accent-soft); border-color: rgba(242, 227, 92, .45); color: var(--text); }
.tchip.on::after { content: ''; width: 6px; height: 10px; margin-left: 2px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }

/* ---------- Puces & onglets ---------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip .i { font-size: 13px; }
.chip .sw { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-ok     { background: rgba(98, 207, 142, .13); color: var(--ok); }
.chip-warn   { background: rgba(240, 165, 74, .14); color: var(--warn); }
.chip-danger { background: rgba(239, 100, 97, .14); color: #ff8b88; }
button.chip { border: 0; }
button.chip:hover { filter: brightness(1.2); }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none;
  padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-3); white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface-3); color: var(--text); }
.tabs .count { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }

/* ---------- Panneaux ----------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.panel-title .i { color: var(--text-3); }
.link { border: 0; background: none; padding: 0; color: var(--text-2); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.link:hover { color: var(--accent); }
.stack > * + * { margin-top: 10px; }

/* ---------- Accueil ------------------------------------------------------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 34px; align-items: start; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 20px; }

/* Une matière = un cahier */
.cahier {
  --c: #777;
  position: relative; display: block; width: 100%; aspect-ratio: 5 / 6.5; padding: 0; margin: 0 6px 0 0;
  border: 0; border-radius: 4px 12px 12px 4px; text-align: left; color: #1a1a1a;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, .13), transparent 42%),
    repeating-linear-gradient(135deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 6px),
    color-mix(in srgb, var(--c) 86%, #202020);
  box-shadow:
    inset 12px 0 0 rgba(0, 0, 0, .22), inset 13px 0 0 rgba(255, 255, 255, .07),
    inset 0 1px 0 rgba(255, 255, 255, .14),
    5px 0 0 -1px #e7e2d4, 6px 1px 0 -1px #bfb9a9,
    0 26px 34px -20px rgba(0, 0, 0, .95), 0 3px 6px rgba(0, 0, 0, .4);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.cahier:hover { transform: translateY(-6px) rotate(-1deg); }
.cahier:focus-visible { outline-offset: 4px; }
.cahier-spine {
  position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
  background: radial-gradient(circle, rgba(255, 255, 255, .45) 1.3px, transparent 1.8px) center 7px / 12px 16px repeat-y;
}
.cahier-label {
  position: absolute; left: 20%; right: 9%; top: 19%;
  padding: 11px 12px 12px; border-radius: 7px; background: #f4f1e7;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 16px -10px rgba(0, 0, 0, .7);
}
.cahier-label::before {
  content: ''; position: absolute; inset: 4px; border-radius: 4px; pointer-events: none;
  border: 1.5px solid color-mix(in srgb, var(--c) 75%, #000); opacity: .45;
}
.cahier-kicker { display: block; font: 600 8.5px/1 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: #7a7465; }
.cahier-name { display: block; margin-top: 5px; font: 400 21px/1.05 var(--font-hand); color: #1c2b5a; overflow-wrap: anywhere; }
.cahier-meta { display: block; margin-top: 7px; font: 500 11px/1.2 var(--font-ui); color: #7a7465; }
.cahier-icon { position: absolute; right: 12px; bottom: 12px; color: rgba(255, 255, 255, .8); font-size: 22px; }
.cahier-icon .i { stroke-width: 1.6; }
.cahier-count {
  position: absolute; left: 20%; bottom: 12px; font: 600 11px var(--font-ui); color: rgba(255, 255, 255, .72);
  display: inline-flex; align-items: center; gap: 5px;
}

/* Contribuer */
.cta-card {
  position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius);
  background: linear-gradient(160deg, #26261f, #1c1c1d 60%); border: 1px solid rgba(242, 227, 92, .16);
}
.cta-card h3 { margin: 0 0 6px; font: 400 26px/1.1 var(--font-display); }
.cta-card p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }

/* ---------- Matière : sommaire des chapitres ----------------------------- */
.subject-hero { display: flex; align-items: center; gap: 22px; }
.subject-badge {
  width: 74px; height: 92px; flex-shrink: 0; border-radius: 3px 9px 9px 3px; display: grid; place-items: center;
  color: rgba(255, 255, 255, .88); font-size: 30px;
  background: linear-gradient(118deg, rgba(255, 255, 255, .14), transparent 45%), color-mix(in srgb, var(--c) 86%, #202020);
  box-shadow: inset 8px 0 0 rgba(0, 0, 0, .22), 4px 0 0 -1px #e7e2d4, 0 18px 26px -16px rgba(0, 0, 0, .9);
}
.toc { border-top: 1px solid var(--line); }
.toc-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  width: 100%; padding: 20px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
  transition: background .15s;
}
.toc-row:hover { background: linear-gradient(90deg, rgba(255, 255, 255, .025), transparent); }
.toc-num { font: italic 40px/1 var(--font-display); color: var(--text-3); transition: color .2s; }
.toc-row:hover .toc-num { color: var(--accent); }
.toc-title { display: block; font-size: 18px; font-weight: 550; letter-spacing: -.005em; }
.toc-meta { display: block; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.toc-go { color: var(--text-3); font-size: 18px; transition: transform .2s, color .2s; }
.toc-row:hover .toc-go { color: var(--text); transform: translateX(3px); }

/* ---------- Chapitre : documents & fiches -------------------------------- */
.part { margin-top: 40px; }
.part-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.part-num { font: italic 24px/1 var(--font-display); color: var(--c, var(--accent)); min-width: 28px; }
.part-title { flex: 1; min-width: 0; margin: 0; font: 400 26px/1.15 var(--font-display); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.item {
  display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, transform .2s var(--ease);
}
.item:hover { border-color: var(--line-strong); transform: translateY(-1px); }

/* ---------- Archivé (v14) ---------------------------------------------------
   Visible seulement par ceux qui peuvent écrire la matière : grisé, rayé
   d'aucun trait (ce n'est pas supprimé), avec une étiquette « hors ligne ». */
.is-archived { opacity: .52; border-style: dashed; }
.is-archived:hover { opacity: .78; }
.item.is-archived, .deck.is-archived { background: var(--surface-2); }
.toc-row.is-archived { opacity: .52; }
.part-head.is-archived { opacity: .55; }
.arch-tag {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 7px; padding: 1px 7px;
  border-radius: 99px; border: 1px dashed var(--line-strong); background: var(--surface-3);
  color: var(--text-3); font: 600 10.5px/1.7 var(--font-ui); font-style: normal;
  letter-spacing: .03em; vertical-align: middle; white-space: nowrap;
}
.arch-tag .i { width: 12px; height: 12px; }
.item-open { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.item-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--c, var(--text-2)); font-size: 19px;
}
.item-title { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

/* Série de flashcards = fiche bristol */
.deck {
  position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 14px 14px 16px;
  border-radius: 12px; color: #1d2a55; background-color: #f4f1e7;
  background-image:
    linear-gradient(#df6a5f, #df6a5f),
    repeating-linear-gradient(to bottom, transparent 0 19px, rgba(80, 110, 190, .28) 19px 20px);
  background-size: 100% 1.5px, 100% calc(100% - 40px);
  background-position: 0 39px, 0 40px;
  background-repeat: no-repeat, no-repeat;
  box-shadow: 0 16px 24px -18px rgba(0, 0, 0, .9);
  transition: transform .25s var(--ease);
}
.deck:hover { transform: translateY(-2px) rotate(-.4deg); }
.deck-open { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; color: inherit; }
.deck-title { display: block; font: 400 21px/1.15 var(--font-hand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-count { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; font: 600 11.5px var(--font-ui); color: #6b6657; }
.deck .btn-play {
  width: 38px; height: 38px; border-radius: 50%; border: 0; flex-shrink: 0; display: grid; place-items: center;
  background: #1c1c1f; color: var(--accent); transition: transform .15s;
}
.deck .btn-play:hover { transform: scale(1.07); }
.deck .btn-icon { color: #6b6657; }
.deck .btn-icon:hover { background: rgba(0, 0, 0, .07); color: #1d2a55; }

/* ---------- Vide & chargement ------------------------------------------- */
.empty { padding: 56px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 17px; background: var(--surface-2); color: var(--text-2); font-size: 26px; }
.empty h3 { margin: 0; font: 400 26px/1.15 var(--font-display); }
.empty p { margin: 8px auto 20px; max-width: 40ch; color: var(--text-2); font-size: 14px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Lecture d'un document ---------------------------------------- */
.reader { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.open-cahier {
  display: flex; align-items: center; gap: 16px; width: 100%; margin: 0 0 26px; padding: 16px 18px;
  border-radius: var(--radius); border: 1px solid rgba(242, 227, 92, .22); text-align: left;
  background: linear-gradient(100deg, rgba(242, 227, 92, .09), rgba(242, 227, 92, .02) 60%); color: var(--text);
  transition: border-color .2s;
}
.open-cahier:hover { border-color: rgba(242, 227, 92, .5); }
.open-cahier .oc-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 20px; flex-shrink: 0; }
.open-cahier b { display: block; font-size: 15px; }
.open-cahier span { font-size: 13px; color: var(--text-2); }
.open-cahier .i-go { margin-left: auto; color: var(--accent); font-size: 20px; }

/* ---------- La visionneuse (images, vidéos, fichiers) ---------------------- */
.lb { position: fixed; inset: 0; z-index: 140; display: flex; flex-direction: column;
  background: rgba(8, 8, 9, .93); backdrop-filter: blur(8px); animation: fade .18s var(--ease) both; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; }
.lb-title { flex: 1; min-width: 0; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-title em { margin-left: 8px; font-style: normal; color: var(--text-3); font-size: 13px; }
.lb-bar .btn-icon { color: #fff; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 14px 18px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px;
  animation: lb-pop .26s var(--spring) both; }
@keyframes lb-pop { from { opacity: 0; transform: scale(.93); } }
.lb-pdf { width: min(100%, 980px); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.lb-video { width: min(100%, 1100px); aspect-ratio: 16 / 9; }
.lb-media { max-width: 100%; max-height: 100%; border-radius: 10px; background: #000; }
.lb-audio { display: grid; justify-items: center; gap: 14px; padding: 30px 24px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-align: center; max-width: 440px; }
.lb-audio .i { font-size: 34px; color: var(--accent); }
.lb-audio b { font-size: 15px; overflow-wrap: anywhere; }
.lb-audio audio { width: 100%; }
.lb-video iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; transition: background .2s, scale .2s; }
.lb-nav:hover { background: rgba(255, 255, 255, .26); }
.lb-nav:active { scale: .92; }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }

/* ---------- Vidéos jointes à un cours ------------------------------------- */
.videos { margin-top: 28px; }
.video-list { display: grid; gap: 18px; }
.doc-video { margin: 18px 0; }
/* la miniature de la vidéo : un clic ouvre YouTube (l'appli sur téléphone) */
.ytb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0;
  border-radius: 14px; overflow: hidden; background: #000; box-shadow: var(--shadow-2); cursor: pointer; }
.ytb img { width: 100%; height: 100%; object-fit: cover; transition: scale .35s var(--ease), opacity .2s; }
.ytb:hover img { scale: 1.04; opacity: .9; }
.ytb-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.ytb-play svg { width: 62px; height: 62px; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .7)); }
.ytb-badge { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 8px; background: rgba(12, 12, 14, .72); color: #fff;
  font: 600 11.5px/1.4 var(--font-ui); }
.ytb-badge .i { color: #ff3b30; }
.doc-video figcaption em { display: block; font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* la miniature dans « Pour toi » */
.fd-thumb { position: relative; display: block; margin: -17px -10px 10px -17px; aspect-ratio: 16 / 7; overflow: hidden; }
.fd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fd-thumb i { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.fd-thumb i svg { width: 46px; height: 46px; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .6)); }
.fd-mini { position: relative; flex-shrink: 0; width: 62px; height: 42px; border-radius: 9px; overflow: hidden; }
.fd-mini img { width: 100%; height: 100%; object-fit: cover; }
.fd-mini .i { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 20px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }
.doc-video figcaption { margin-top: 8px; display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-2); }
/* ---------- Vidéos de Lumni (v14) -------------------------------------------
   Lumni n'a pas de lecteur public : on montre la vignette et le titre, et le
   bouton ouvre la page de Lumni. La source est citée sous chaque vidéo. */
.lumni-vid figcaption { flex-wrap: wrap; }
.lumni-vid figcaption em { flex-basis: 100%; }
.lumni-badge { background: #0b2d4d; color: #fff; }
.lumni-badge .i { color: #fff; }
.ytb-void { position: absolute; inset: 0; background:
  linear-gradient(135deg, var(--surface-3), var(--surface-2)); }
.vid-src { flex-basis: 100%; margin-top: 3px; font-size: 11.5px; line-height: 1.5; color: var(--text-3); }
.vid-src a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.vid-src a:hover { color: var(--accent); }

/* ---------- Le contenu d'un fichier joint, lu dans la page (v14) ------------
   Un .docx devient du cours : mêmes titres, mêmes listes, mêmes tableaux. On
   l'encadre en pointillé pour que ce soit clair que ça vient d'un fichier. */
.file-read {
  grid-column: 1 / -1; margin: -4px 0 14px; padding: 14px 16px; border-radius: 16px;
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  animation: fr-in .26s var(--ease) both;
}
@keyframes fr-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
:root.reduce-motion .file-read { animation: none; }
.file-read[hidden] { display: none; }
.fr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fr-head .i { color: var(--accent); }
.fr-head .btn-icon { margin-left: auto; }
.fr-wait { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); }
.fr-body { font-size: 15.5px; }
.fr-body > *:first-child { margin-top: 0; }
.fr-body img { max-width: 100%; height: auto; border-radius: 10px; }
.doc-video figcaption svg { width: 17px; height: 17px; color: #e04a4a; }

/* une image du cours s'ouvre en grand */
.doc-zoom { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.doc-zoom .zoom-mark, .photo .zoom-mark { position: absolute; right: 10px; bottom: 10px; width: 20px; height: 20px;
  padding: 6px; box-sizing: content-box; border-radius: 8px; background: rgba(12, 12, 14, .62); color: #fff;
  opacity: 0; transition: opacity .2s; }
.doc-zoom:hover .zoom-mark, .photo:hover .zoom-mark, .photo:focus-visible .zoom-mark { opacity: 1; }
/* ==========================================================================
   Fluidité sur téléphone
   --------------------------------------------------------------------------
   Le flou d'arrière-plan (« backdrop-filter ») est très joli sur ordinateur,
   mais c'est lui qui fait saccader le défilement sur un téléphone : le
   navigateur doit refloutter la barre du haut et celle du bas à chaque image.
   Sur écran tactile, on garde donc un fond opaque — la différence se voit à
   peine, le défilement redevient lisse.
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  .topbar { background: #1a1a1c; backdrop-filter: none; }
  .tabbar { background: #1a1a1c; backdrop-filter: none; }
  .cr-head { background: #1a1a1c; backdrop-filter: none; }
  .composer { background: #1a1a1c; backdrop-filter: none; }
  .cr-day span { backdrop-filter: none; }
  .nb-arrow { backdrop-filter: none; }
  .cahier-flag { backdrop-filter: none; }
  /* les ombres très étalées coûtent cher à redessiner pendant le défilement */
  .cahier { box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .7); }
}
/* ---------- Trois façons de réviser --------------------------------------- */
.deck-kind { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-3); font: 600 10.5px/1.6 var(--font-ui); font-style: normal; vertical-align: 2px; }
.deck-kind .i { font-size: 12px; }
.card-qcm, .card-memo { grid-template-columns: 26px 1fr 1fr auto; }
.card-qcm .js-w { grid-column: 2 / -1; font-size: 13.5px; opacity: .85; }
.card-memo .js-a { grid-column: 2 / -1; min-height: 90px; }
.bristol-memo .bristol-back { align-items: stretch; }
.bristol-rich { width: 100%; max-height: 100%; overflow-y: auto; padding: 4px 18px 16px; text-align: left;
  font-size: 15px; color: var(--ink);
  /* la fiche est du papier : les blocs prennent les couleurs du cahier */
  --cb-bg: rgba(255, 253, 244, .9); --cb-bg2: rgba(236, 231, 214, .6); --cb-line: rgba(60, 50, 30, .3);
  --cb-text: var(--ink); --cb-dim: #7b7263; --cb-accent: #1f3a8a; }
.bristol-rich > *:first-child { margin-top: 0; }
.bristol-rich .cbox, .bristol-rich .ctable-wrap, .bristol-rich .cformula { margin: 10px 0; }

/* ---------- La barre d'outils de l'éditeur -------------------------------- */
.ed-bar { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ed-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.ed-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
  font: 500 12px var(--font-ui); cursor: pointer; transition: border-color .15s, color .15s, scale .12s; }
.ed-chip .i { font-size: 14px; color: var(--accent); }
.ed-chip:hover { border-color: var(--line-strong); color: var(--text); }
.ed-chip:active { scale: .95; }
.ed-eye { flex-shrink: 0; }
.ed-eye.is-on { border-color: var(--accent); color: var(--accent); }
.auto-filled { animation: pop-spring .5s var(--spring); border-color: var(--accent); }
.ed-plus { border-style: dashed; }
.ed-plus.is-on { border-color: var(--accent); color: var(--accent); }
.ed-palette { margin-bottom: 10px; padding: 12px 13px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--line); max-height: 44vh; overflow-y: auto; display: grid; gap: 12px;
  animation: rise .2s var(--ease) both; }
.ed-grp-t { display: block; margin-bottom: 6px; font: 600 11px var(--font-ui); letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); }
.ed-grp-l { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-preview { min-height: 160px; max-height: 52vh; overflow-y: auto; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong); background: var(--surface); }
@media (max-width: 560px) {
  /* sur téléphone la barre défile : les noms restent lisibles, rien n'est deviné */
  .ed-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .ed-chips::-webkit-scrollbar { display: none; }
  .ed-chip { flex-shrink: 0; }
}

/* ==========================================================================
   Les blocs de cours
   --------------------------------------------------------------------------
   Tableaux, encadrés, frises, schémas, figures et graphiques. Les mêmes blocs
   servent dans le cours (fond sombre) et dans le cahier (papier crème) : les
   couleurs passent par quatre variables, redéfinies plus bas pour le papier.
   ========================================================================== */
.article, .nb-body {
  --cb-bg: var(--surface);
  --cb-bg2: var(--surface-2);
  --cb-line: var(--line);
  --cb-text: var(--text);
  --cb-dim: var(--text-3);
  --cb-accent: var(--accent);
}
.nb-body {
  --cb-bg: rgba(255, 253, 244, .9);
  --cb-bg2: rgba(236, 231, 214, .55);
  --cb-line: rgba(60, 50, 30, .3);
  --cb-text: var(--ink);
  --cb-dim: #7b7263;
  --cb-accent: #1f3a8a;
}

/* ---------- Tableau ------------------------------------------------------- */
.ctable-wrap { margin: 20px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ctable { width: 100%; border-collapse: collapse; font-size: 14.5px; color: var(--cb-text); }
.ctable th, .ctable td { padding: 9px 12px; border: 1px solid var(--cb-line); text-align: left; vertical-align: top; }
.ctable th { background: var(--cb-bg2); font-weight: 650; }
.ctable tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--cb-bg2) 45%, transparent); }
.ctable-cap { display: block; margin-top: 6px; font-size: 12.5px; color: var(--cb-dim); }
.nb-body .ctable { font: 400 14px/22px var(--font-note); }
.nb-body .ctable th, .nb-body .ctable td { padding: 5px 8px; }

/* ---------- Encadrés ------------------------------------------------------ */
.cbox { display: block; margin: 20px 0; padding: 13px 15px; border-radius: 14px;
  background: var(--cb-bg2); border: 1px solid var(--cb-line); border-left: 3px solid var(--cb-accent); color: var(--cb-text); }
.cbox-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--cb-accent);
  letter-spacing: .01em; }
.cbox-head .i { font-size: 17px; }
.cbox-body { margin-top: 6px; font-size: 15px; line-height: 1.6; }
.cbox-body p { margin: 5px 0; }
.cbox-body p:first-child { margin-top: 0; }
.cbox-body p:last-child { margin-bottom: 0; }
.c-definition { --cb-accent: #6b8dff; }
.c-retenir    { --cb-accent: #f2c14e; }
.c-attention  { --cb-accent: #e07a5f; }
.c-exemple    { --cb-accent: #5ec2a0; }
.c-methode    { --cb-accent: #a98bff; }
.c-astuce     { --cb-accent: #f2a2d0; }
.nb-body .cbox { margin: 8px 0 12px; padding: 9px 12px; border-radius: 8px; }
.nb-body .cbox-body { font: 400 15px/24px var(--font-note); }
.nb-body .c-definition { --cb-accent: #1f3a8a; }
.nb-body .c-retenir { --cb-accent: #9a6b00; }
.nb-body .c-attention { --cb-accent: #b3402a; }
.nb-body .c-exemple { --cb-accent: #1d7a41; }
.nb-body .c-methode { --cb-accent: #6a2c91; }
.nb-body .c-astuce { --cb-accent: #a33b7a; }

/* ---------- Frise chronologique ------------------------------------------- */
.cfrise { list-style: none; margin: 22px 0; padding: 0 0 0 4px; position: relative; }
.cfrise::before { content: ''; position: absolute; left: 76px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--cb-accent), color-mix(in srgb, var(--cb-accent) 25%, transparent)); border-radius: 2px; }
.cfrise li { display: grid; grid-template-columns: 70px 16px 1fr; align-items: baseline; gap: 0 10px; padding: 7px 0; }
.cf-date { font-size: 13.5px; font-weight: 700; color: var(--cb-accent); text-align: right; }
.cf-dot { position: relative; width: 10px; height: 10px; margin-left: 1px; border-radius: 50%;
  background: var(--cb-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cb-accent) 22%, transparent); align-self: center; }
.cf-txt { font-size: 14.5px; line-height: 1.5; color: var(--cb-text); }
.nb-body .cfrise { margin: 8px 0; }
.nb-body .cf-txt, .nb-body .cf-date { font-family: var(--font-note); }

/* ---------- Étapes -------------------------------------------------------- */
.cetapes { counter-reset: et; list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 8px; }
.cetapes li { counter-increment: et; display: grid; grid-template-columns: 28px 1fr; align-items: start; gap: 11px;
  padding: 9px 12px; border-radius: 12px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cetapes li::before { content: counter(et); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px;
  background: var(--cb-accent); color: #fff; font-size: 13px; font-weight: 700; }
.nb-body .cetapes li::before { color: #fffdf4; }
.cetapes li span { font-size: 14.5px; line-height: 1.55; color: var(--cb-text); }

/* ---------- Vocabulaire --------------------------------------------------- */
.cvoc { margin: 20px 0; display: grid; gap: 4px; }
.cvoc > div { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 12px; padding: 7px 11px; border-radius: 10px;
  background: var(--cb-bg2); }
.cvoc dt { margin: 0; font-weight: 650; color: var(--cb-accent); font-size: 14.5px; }
.cvoc dd { margin: 0; color: var(--cb-text); font-size: 14.5px; }
.nb-body .cvoc > div { background: transparent; border-bottom: 1px dotted var(--cb-line); border-radius: 0; padding: 2px 0; }
.nb-body .cvoc dt, .nb-body .cvoc dd { font: 400 15px/24px var(--font-note); }

/* ---------- Citation ------------------------------------------------------ */
.cquote { margin: 20px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--cb-accent); }
.cquote blockquote { margin: 0; font-size: 15.5px; line-height: 1.65; font-style: italic; color: var(--cb-text); }
.cquote figcaption { margin-top: 6px; font-size: 13px; color: var(--cb-dim); }
.nb-body .cquote blockquote { font: italic 15px/24px var(--font-note); }

/* ---------- Séparateur et formule ----------------------------------------- */
.crule { margin: 26px auto; width: 64px; height: 2px; border: 0; border-radius: 2px;
  background: color-mix(in srgb, var(--cb-accent) 55%, transparent); }
.cformula { margin: 18px 0; padding: 12px 14px; border-radius: 12px; background: var(--cb-bg2);
  text-align: center; font-size: 19px; color: var(--cb-text); overflow-x: auto; }
.nb-body .cformula { font: 400 17px/26px var(--font-note); background: transparent; padding: 2px 0; }

/* ---------- Schéma : cases et flèches -------------------------------------- */
.cflow { margin: 20px 0; padding: 13px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cflow-t { display: block; margin-bottom: 9px; font-size: 12.5px; font-weight: 700; color: var(--cb-accent);
  text-transform: uppercase; letter-spacing: .05em; }
.cf-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin: 5px 0; }
.cf-box { padding: 8px 13px; border-radius: 11px; background: var(--cb-bg); border: 1.5px solid var(--cb-accent);
  font-size: 14px; font-weight: 600; color: var(--cb-text); text-align: center; }
.cf-arr { color: var(--cb-accent); font-size: 19px; line-height: 1; }
.cf-lab { font-size: 12px; color: var(--cb-dim); font-style: italic; }
.nb-body .cflow { padding: 8px; margin: 8px 0; }
.nb-body .cf-box { font: 400 14px/1.3 var(--font-note); padding: 5px 9px; }

/* ---------- Figures de géométrie et graphiques ------------------------------ */
.cgeo, .cchart { margin: 22px 0; text-align: center; }
.cgeo svg, .cchart svg { width: 100%; max-width: 520px; height: auto; }
.cgeo figcaption, .cchart figcaption { margin-top: 7px; font-size: 13px; color: var(--cb-dim); }
.g-face { fill: color-mix(in srgb, var(--cb-accent) 12%, transparent); stroke: var(--cb-accent); stroke-width: 2; }
.g-line { stroke: var(--cb-accent); stroke-width: 2; fill: none; }
.g-thin { stroke: var(--cb-accent); stroke-width: 1.4; fill: none; }
.g-pt { fill: var(--cb-accent); }
.g-name { fill: var(--cb-text); font: 600 15px var(--font-ui); text-anchor: middle; }
.g-mes { fill: var(--cb-dim); font: 500 12.5px var(--font-ui); text-anchor: middle; }
/* v14 : hauteurs et arêtes cachées, repère gradué, hachures, flèches */
.g-dash  { stroke: var(--cb-accent); stroke-width: 1.6; fill: none; stroke-dasharray: 6 4; opacity: .8; }
.g-grid  { stroke: var(--cb-line); stroke-width: 1; opacity: .7; }
.g-axis  { stroke: var(--cb-dim); stroke-width: 1.5; }
.g-tick  { fill: var(--cb-dim); font: 400 11px var(--font-ui); text-anchor: middle; }
.g-curve { fill: none; stroke: var(--cb-accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.g-hatch { stroke: var(--cb-accent); stroke-width: 1.1; opacity: .55; }
.g-hline { stroke: var(--cb-accent); stroke-width: 1.6; }
.g-arrow { fill: var(--cb-accent); stroke: none; }
.k-grid { stroke: var(--cb-line); stroke-width: 1; }
.k-axis { stroke: var(--cb-dim); stroke-width: 1.4; }
.k-bar { fill: var(--cb-accent); opacity: .85; }
.k-curve { fill: none; stroke: var(--cb-accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.k-dot { fill: var(--cb-accent); }
.k-val { fill: var(--cb-text); font: 600 11.5px var(--font-ui); text-anchor: middle; }
.k-ax { fill: var(--cb-dim); font: 400 11.5px var(--font-ui); }
.k-lab { fill: var(--cb-dim); font: 600 11.5px var(--font-ui); }
.k-leg { fill: var(--cb-text); font: 400 12.5px var(--font-ui); }
.k-pct { fill: #fff; font: 700 12px var(--font-ui); text-anchor: middle; }
.k-sl { stroke: var(--cb-bg); stroke-width: 1.5; }
.k-c0 { fill: #6b8dff; } .k-c1 { fill: #f2c14e; } .k-c2 { fill: #5ec2a0; }
.k-c3 { fill: #e07a5f; } .k-c4 { fill: #a98bff; } .k-c5 { fill: #4fb0c6; }
.nb-body .cgeo, .nb-body .cchart { margin: 6px 0 10px; }
.nb-body .cgeo svg, .nb-body .cchart svg { max-width: 100%; }
.nb-body .g-name, .nb-body .g-mes, .nb-body .g-tick, .nb-body .k-val, .nb-body .k-ax, .nb-body .k-leg, .nb-body .k-lab { font-family: var(--font-note); }

/* ---------- Les nouveaux blocs -------------------------------------------- */
.c-rappel   { --cb-accent: #8aa4c8; }
.c-objectif { --cb-accent: #4fb0c6; }
.c-consigne { --cb-accent: #d0904a; }
.c-culture  { --cb-accent: #7bc47f; }
.c-brevet   { --cb-accent: #e0546b; }
.nb-body .c-rappel { --cb-accent: #38507a; }
.nb-body .c-objectif { --cb-accent: #0f6b7d; }
.nb-body .c-consigne { --cb-accent: #8a5410; }
.nb-body .c-culture { --cb-accent: #1d6b3a; }
.nb-body .c-brevet { --cb-accent: #a01b36; }

/* un bloc qui se déplie : correction, réponse, question */
.cfold, .cquiz { margin: 18px 0; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); overflow: hidden; }
.cfold > summary, .cquiz > summary { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 12px 14px;
  cursor: pointer; list-style: none; color: var(--cb-text); font-size: 14.5px; }
.cfold > summary::-webkit-details-marker, .cquiz > summary::-webkit-details-marker { display: none; }
.cfold > summary .i, .cquiz > summary .i { color: var(--cb-accent); font-size: 17px; }
.cf-hint { margin-left: auto; font-size: 11.5px; color: var(--cb-dim); font-weight: 500; }
.cfold[open] > summary, .cquiz[open] > summary { border-bottom: 1px solid var(--cb-line); }
.cfold-body { padding: 4px 14px 12px; font-size: 15px; }
.cq-k { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--cb-accent); }
.cq-list { list-style: none; margin: 0; padding: 10px 14px 12px; display: grid; gap: 6px; }
.cq-list li { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 10px;
  background: var(--cb-bg); border: 1px solid var(--cb-line); font-size: 14.5px; color: var(--cb-text); }
.cq-list li .i { color: var(--cb-dim); }
.cq-list li.bon { border-color: var(--ok); color: var(--cb-text); }
.cq-list li.bon .i { color: var(--ok); }
.nb-body .cq-list li.bon { border-color: #1d7a41; }
.nb-body .cq-list li.bon .i { color: #1d7a41; }

/* checklist, plan, hiérarchie */
.ccheck { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 6px; }
.ccheck li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; color: var(--cb-text); }
.ccheck li .i { color: var(--cb-accent); flex-shrink: 0; margin-top: 1px; }
.cplan { margin: 18px 0; padding-left: 20px; color: var(--cb-text); font-size: 14.5px; }
.cplan li { margin: 4px 0; }
.cplan li.sub { list-style: circle; margin-left: 18px; color: var(--cb-dim); }
.chier { list-style: none; margin: 18px 0; padding: 0; }
.chier li { position: relative; padding: 7px 12px; margin: 4px 0 4px 0; border-radius: 10px;
  background: var(--cb-bg2); font-size: 14.5px; color: var(--cb-text); }
.chier li.d1 { margin-left: 22px; }
.chier li.d2 { margin-left: 44px; }
.chier li.d3 { margin-left: 66px; }
.chier li.d1::before, .chier li.d2::before, .chier li.d3::before {
  content: ''; position: absolute; left: -12px; top: 50%; width: 10px; height: 1.5px; background: var(--cb-line); }

/* mots-clés, repères, liens */
.cmots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 18px 0; }
.cm-t { font-size: 12.5px; font-weight: 700; color: var(--cb-accent); margin-right: 4px; }
.cmot { padding: 5px 11px; border-radius: 999px; background: var(--cb-bg2); border: 1px solid var(--cb-line);
  font-size: 13.5px; color: var(--cb-text); }
.creperes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 18px 0; }
.crep { padding: 9px 12px; border-radius: 12px; background: var(--cb-bg2); border-left: 3px solid var(--cb-accent); }
.crep b { display: block; font-size: 14.5px; color: var(--cb-text); }
.crep span { font-size: 12.5px; color: var(--cb-dim); }
.cliens { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 6px; }
.cliens a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 11px;
  background: var(--cb-bg2); color: var(--cb-accent); font-size: 14px; text-decoration: none; }
.cliens a:hover { text-decoration: underline; }

/* dialogue */
.cdial { margin: 18px 0; display: grid; gap: 7px; }
.cd-line { display: grid; gap: 2px; max-width: 86%; padding: 9px 13px; border-radius: 14px; background: var(--cb-bg2); }
.cd-a { justify-self: start; border-bottom-left-radius: 4px; }
.cd-b { justify-self: end; border-bottom-right-radius: 4px; background: color-mix(in srgb, var(--cb-accent) 16%, var(--cb-bg2)); }
.cd-who { font-size: 11.5px; font-weight: 700; color: var(--cb-accent); }
.cd-txt { font-size: 14.5px; color: var(--cb-text); }
.cd-narr { text-align: center; font-size: 13px; font-style: italic; color: var(--cb-dim); margin: 2px 0; }

/* comparaison, conjugaison, barème, unités */
.ccomp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.cc-col { display: grid; align-content: start; gap: 6px; padding: 12px; border-radius: 14px;
  background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cc-h { font-size: 13px; font-weight: 700; color: var(--cb-accent); padding-bottom: 6px; border-bottom: 1px solid var(--cb-line); }
.cc-i { font-size: 14px; color: var(--cb-text); }
.cconj { margin: 18px 0; padding: 12px 14px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cc-t { display: block; font-size: 13px; font-weight: 700; color: var(--cb-accent); margin-bottom: 8px; }
.cconj-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; }
.cj-p { color: var(--cb-dim); }
.cj-f { color: var(--cb-text); font-weight: 600; }
.cbareme, .cunites { margin: 18px 0; padding: 10px 14px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cb-t, .cu-t { display: block; font-size: 13px; font-weight: 700; color: var(--cb-accent); margin-bottom: 6px; }
.cb-l { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; color: var(--cb-text);
  border-bottom: 1px dotted var(--cb-line); }
.cb-l:last-child { border-bottom: 0; }
.cb-tot { font-weight: 700; color: var(--cb-accent); }
.cu-l { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14.5px; color: var(--cb-text); }
.cu-l .i { color: var(--cb-accent); font-size: 15px; }

/* cycle */
.ccycle { margin: 18px 0; padding: 13px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.ccy-ring { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; }
.ccy-step { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px;
  background: var(--cb-bg); border: 1.5px solid var(--cb-accent); font-size: 14px; color: var(--cb-text); }
.ccy-step i { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%;
  background: var(--cb-accent); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; }
.nb-body .ccy-step i { color: #fffdf4; }
.ccy-arr { color: var(--cb-accent); }
.ccy-loop { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--cb-dim); font-style: italic; }

/* circuit électrique */
.ccircuit { margin: 20px 0; text-align: center; }
.ccircuit svg { width: 100%; max-width: 520px; height: auto; }
.ccircuit figcaption { margin-top: 6px; font-size: 13px; color: var(--cb-dim); }
.e-w { stroke: var(--cb-accent); stroke-width: 2; fill: none; }
.e-c { stroke: var(--cb-text); stroke-width: 2; fill: none; }
.e-t { fill: var(--cb-text); stroke: none; font: 600 13px var(--font-ui); text-anchor: middle; }
.e-l { fill: var(--cb-dim); stroke: none; font: 500 12px var(--font-ui); text-anchor: middle; }
.nb-body .e-l, .nb-body .e-t { font-family: var(--font-note); }

/* proportions et chiffres clés */
.cprop { margin: 18px 0; }
.cp-t { display: block; font-size: 13px; font-weight: 700; color: var(--cb-accent); margin-bottom: 7px; }
.cp-bar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; border: 1px solid var(--cb-line); }
.cp-s { display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #10101a; }
.cp-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--cb-dim); }
.cp-leg span { display: inline-flex; align-items: center; gap: 6px; }
.cp-leg i { width: 11px; height: 11px; border-radius: 3px; }
.cchiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.cch { padding: 13px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); text-align: center; }
.cch b { display: block; font-size: 24px; font-weight: 700; color: var(--cb-accent); line-height: 1.1; }
.cch span { font-size: 12.5px; color: var(--cb-dim); }

/* réaction chimique et expérience */
.creaction { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; margin: 18px 0;
  padding: 14px; border-radius: 14px; background: var(--cb-bg2); font-size: 18px; color: var(--cb-text); }
.cr-f i { font-style: normal; font-weight: 700; color: var(--cb-accent); margin-right: 2px; }
.cr-op, .cr-arr { color: var(--cb-accent); font-weight: 700; }
.cr-note { flex-basis: 100%; text-align: center; font-size: 12.5px; color: var(--cb-dim); }
.cexp { margin: 18px 0; padding: 13px 15px; border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cx-t { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--cb-accent); margin-bottom: 8px; }
.cx-part { margin-top: 8px; }
.cx-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--cb-dim); }
.cx-part ul { margin: 4px 0 0; padding-left: 22px; font-size: 14.5px; color: var(--cb-text); }
.cx-part li { margin: 2px 0; }

/* fiches */
.cfiche { display: flex; gap: 13px; margin: 18px 0; padding: 13px 15px; border-radius: 14px;
  background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.cf-ic { flex-shrink: 0; font-size: 26px; color: var(--cb-accent); }
.cf-b b { font-size: 16px; color: var(--cb-text); }
.cf-b em { display: block; font-size: 12.5px; color: var(--cb-dim); font-style: normal; margin-top: 1px; }
.cf-d p { margin: 6px 0 0; font-size: 14.5px; color: var(--cb-text); }
.cdoc { margin: 18px 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--cb-line); background: var(--cb-bg2); }
.cdoc-h { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; font-weight: 700;
  color: var(--cb-accent); border-bottom: 1px solid var(--cb-line); }
.cdoc-b { padding: 11px 15px; font-size: 14.5px; line-height: 1.6; color: var(--cb-text); font-style: italic; }
.cdoc-b p { margin: 5px 0; }

/* médias */
.cgal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 18px 0; }
.cgal-i { padding: 0; border: 1px solid var(--cb-line); border-radius: 12px; overflow: hidden; background: none; cursor: zoom-in; }
.cgal-i img { display: block; width: 100%; height: 130px; object-fit: cover; }
.cgal-c { grid-column: 1 / -1; font-size: 12.5px; color: var(--cb-dim); }
.caudio { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; padding: 12px 14px;
  border-radius: 14px; background: var(--cb-bg2); border: 1px solid var(--cb-line); }
.caudio .i { color: var(--cb-accent); font-size: 20px; }
.caudio b { font-size: 14px; color: var(--cb-text); }
.caudio audio { flex-basis: 100%; width: 100%; }
.cfile { display: flex; align-items: center; gap: 12px; margin: 18px 0; padding: 12px 14px; border-radius: 14px;
  background: var(--cb-bg2); border: 1px solid var(--cb-line); color: var(--cb-text); text-decoration: none; }
.cfile > .i:first-child { color: var(--cb-accent); font-size: 20px; }
.cfile span { flex: 1; min-width: 0; display: grid; }
.cfile b { font-size: 14px; }
.cfile small { font-size: 12px; color: var(--cb-dim); }

@media (max-width: 560px) {
  .ccomp { grid-template-columns: 1fr; }
  .cch b { font-size: 21px; }
}
.nb-body .ccomp, .nb-body .cchiffres { gap: 6px; }
.nb-body .cfold, .nb-body .cquiz { background: transparent; }
.nb-body .cfold-body, .nb-body .cq-list { display: block; }
.nb-body .cfold > summary .cf-hint, .nb-body .cquiz > summary .cf-hint { display: none; }

/* ---------- Les formules mathématiques -----------------------------------
   Une fraction est écrite comme au tableau : le numérateur au-dessus du trait,
   le dénominateur en dessous. Tout est en « em » : la formule suit la taille
   du texte qui l'entoure, dans un cours comme sur une fiche bristol. */
.mfrac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .16em; line-height: 1.14; }
.mfrac > .mnum { padding: 0 .3em .05em; border-bottom: 1.4px solid currentColor; }
.mfrac > .mden { padding: .05em .3em 0; }
.mfrac .mfrac { font-size: .84em; }          /* une fraction dans une fraction reste lisible */

.msqrt { display: inline-flex; align-items: flex-start; margin: 0 .06em; }
.msqrt::before { content: '√'; transform: scaleY(1.1); transform-origin: top; }
.msqrt > .mroot { font-size: .6em; margin: -.15em -.5em 0 0; }
.msqrt > .msq { border-top: 1.4px solid currentColor; padding: 0 .2em; margin-top: .18em; }

.mvec, .mhat { position: relative; }
.mover { border-top: 1.4px solid currentColor; }
.mvec::after, .mhat::after { position: absolute; left: 0; right: 0; text-align: center; font-size: .7em; line-height: 1; pointer-events: none; }
.mvec::after { content: '→'; top: -.62em; }
.mhat::after { content: '^'; top: -.34em; }
.mtext { font-style: normal; }
.mfrac sup, .mfrac sub, .msqrt sup, .msqrt sub { line-height: 0; }
/* dans le cahier, les lignes font 32 px : la fraction se serre un peu */
.nb-p .mfrac, .nb-li .mfrac, .nb-h3 .mfrac { font-size: .8em; }

.article { font-size: 16.5px; line-height: 1.75; color: #dcdcde; }
.article h1, .article h2, .article h3 { color: var(--text); font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; }
.article h1 { font-size: 34px; line-height: 1.15; margin: 36px 0 10px; }
.article h2 { font-size: 27px; line-height: 1.2; margin: 30px 0 8px; }
.article h3 { font-size: 21px; margin: 24px 0 6px; font-style: italic; }
.article > :first-child { margin-top: 0; }
.article p { margin: 10px 0; }
.article ul, .article ol { margin: 10px 0; padding-left: 22px; }
.article li { margin: 5px 0; }
.article li::marker { color: var(--text-3); }
.article strong { color: var(--text); font-weight: 600; background: linear-gradient(transparent 58%, rgba(242, 227, 92, .26) 58%); }
.article code { font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.md-note { color: var(--text-3); font-style: italic; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 30px; }
.photo { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.photo img { width: 100%; height: 190px; object-fit: cover; transition: transform .4s var(--ease); }
.photo:hover img { transform: scale(1.03); }
.photo { padding: 0; cursor: zoom-in; position: relative; }

/* ---------- Modales ------------------------------------------------------ */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 9, .7); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: 100%; max-width: 540px; max-height: min(92vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 22px;
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .8); animation: pop .2s var(--ease) both;
}
.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-title { flex: 1; margin: 0; font: 400 27px/1.15 var(--font-display); }
.modal-body { padding: 14px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.modal-note { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ---------- Menu contextuel ---------------------------------------------- */
.menu-catch { position: fixed; inset: 0; z-index: 70; }
.menu {
  position: fixed; z-index: 71; min-width: 210px; padding: 6px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .85);
  animation: pop .14s var(--ease) both;
}
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border: 0; border-radius: 9px;
  background: none; color: var(--text); font-size: 14px; text-align: left;
}
.menu-item .i { color: var(--text-3); font-size: 16px; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger, .menu-item.danger .i { color: #ff8b88; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

/* ---------- Notifications ------------------------------------------------ */
#toast-root { position: fixed; z-index: 120; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 14px; font-weight: 500; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8);
  animation: rise .25s var(--ease) both; transition: opacity .3s, transform .3s;
}
.toast .i { color: var(--ok); font-size: 17px; }
.toast.err .i { color: var(--danger); }
.toast.warn .i { color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Import de photos (IA) ---------------------------------------- */
.ai-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 13px;
  background: linear-gradient(120deg, rgba(242, 227, 92, .09), transparent 70%); border: 1px solid rgba(242, 227, 92, .18);
  font-size: 13.5px; color: var(--text-2);
}
.ai-banner .i { color: var(--accent); font-size: 20px; margin-top: 1px; }
.ai-banner b { color: var(--text); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 150px; padding: 22px; border-radius: 16px; text-align: center;
  border: 1.5px dashed var(--line-strong); background: var(--bg-2); color: var(--text-2); transition: .15s;
}
.drop:hover, .drop.over { border-color: rgba(242, 227, 92, .55); background: rgba(242, 227, 92, .04); color: var(--text); }
.drop .i { font-size: 28px; color: var(--accent); }
.drop b { color: var(--text); font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .n { position: absolute; left: 6px; top: 6px; min-width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: rgba(0, 0, 0, .7); font-size: 11px; font-weight: 700; }
.thumb button { position: absolute; right: 5px; top: 5px; width: 24px; height: 24px; border-radius: 7px; border: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: #fff; padding: 0; }
.ai-status { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; color: var(--text-2); }
.ai-status .i { color: var(--accent); }
.card-rows { display: flex; flex-direction: column; gap: 8px; }
.card-row { display: grid; grid-template-columns: 26px 1fr 1fr 34px; gap: 8px; align-items: center; }
.card-row .n { font: italic 18px/1 var(--font-display); color: var(--text-3); text-align: center; }
.card-row .input { padding: 9px 11px; font-size: 14px; }
.subbox { margin-top: 18px; padding: 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.img-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.img-edit div { position: relative; }
.img-edit img { width: 100%; height: 78px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line-strong); }
.img-fit { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 4px; font-size: 11.5px;
  color: var(--text-3); cursor: pointer; }
.img-fit input { width: 14px; height: 14px; accent-color: var(--accent); }
.img-fit .i { width: 13px; height: 13px; }
.img-fit:has(input:checked) { color: var(--accent); }
.img-edit button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: 0; padding: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .75); color: #ff8b88; }

/* ---------- Révision : fiche bristol ------------------------------------- */
.rev { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 30%, #262628, #131314 70%); animation: rise .25s var(--ease) both; }
.rev-top { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.rev-top .t { flex: 1; min-width: 0; }
.rev-top .t b { display: block; font: 400 22px/1.1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 4px; margin-top: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .35s var(--ease); }
.rev-count { font: italic 22px/1 var(--font-display); color: var(--text-2); }
.rev-stage { flex: 1; display: grid; place-items: center; padding: 16px 20px 28px; }
.rev-card-wrap { width: min(640px, 100%); }
.bristol { perspective: 1600px; height: min(56vh, 400px); cursor: pointer; }
.bristol-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.4, .2, .2, 1); }
.bristol.flipped .bristol-inner { transform: rotateY(180deg); }
.bristol-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; color: #1d2a55; background-color: #f6f3ea;
  background-image:
    linear-gradient(#df6a5f, #df6a5f),
    repeating-linear-gradient(to bottom, transparent 0 35px, rgba(80, 110, 190, .3) 35px 36px);
  background-size: 100% 2px, 100% 100%; background-position: 0 58px, 0 22px; background-repeat: no-repeat, repeat;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .9);
}
.bristol-back { transform: rotateY(180deg); background-color: #fff8d6; }
.bristol-tag { height: 58px; display: flex; align-items: center; padding: 0 22px; font: 600 11px var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: #8a8372; }
.bristol-text { flex: 1; display: grid; place-items: center; padding: 10px 30px 30px; text-align: center; font: 500 23px/1.4 var(--font-note); white-space: pre-line; overflow-y: auto; }
.bristol-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font: 500 12px var(--font-ui); color: #8a8372; }
.rev-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; transition: opacity .25s; }
.rev-actions.hidden { opacity: 0; pointer-events: none; }
.rev-actions .btn { height: 54px; font-size: 15px; }
.btn-again { background: rgba(240, 165, 74, .12); border-color: rgba(240, 165, 74, .28); color: var(--warn); }
.btn-again:hover { background: rgba(240, 165, 74, .2); }
.btn-known { background: rgba(98, 207, 142, .12); border-color: rgba(98, 207, 142, .28); color: var(--ok); }
.btn-known:hover { background: rgba(98, 207, 142, .2); }
.rev-keys { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 11.5px; font-family: var(--font-ui); }
.rev-end { width: min(440px, 100%); text-align: center; animation: rise .35s var(--ease) both; }
.rev-end .big { font: 400 64px/1 var(--font-display); }
.rev-end .big em { color: var(--accent); }
.stats-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0; }
.stat { padding: 16px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font: 400 34px/1 var(--font-display); }
.stat span { font-size: 12px; color: var(--text-3); font-weight: 600; }

/* ---------- Compte & admin ------------------------------------------------ */
.profile { display: flex; align-items: center; gap: 18px; }
.profile h2 { margin: 0; font: 400 32px/1.1 var(--font-display); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat-card { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat-card .num { display: block; font: 400 42px/1 var(--font-display); }
.stat-card .lbl { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.stat-card.hot { border-color: rgba(242, 227, 92, .3); background: linear-gradient(160deg, rgba(242, 227, 92, .08), var(--surface) 70%); }
.stat-card.hot .num { color: var(--accent); }
.app-card { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.app-card + .app-card { margin-top: 12px; }
.app-head { display: flex; align-items: center; gap: 12px; }
.app-head .who { flex: 1; min-width: 0; }
.app-head .who b { display: block; font-size: 15px; }
.app-head .who span { font-size: 12.5px; color: var(--text-3); }
.app-msg { margin: 14px 0 0; padding: 12px 14px; border-radius: 11px; background: var(--bg-2); color: var(--text-2); font-size: 14px; white-space: pre-line; border-left: 2px solid var(--accent); }
.app-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.app-foot .input { flex: 1; min-width: 180px; height: 40px; padding: 0 12px; }
.member { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .who b { font-size: 14.5px; }
.member .who .perms { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.perm-table th { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; padding: 0 6px 10px; }
.perm-table td { padding: 8px 6px; border-top: 1px solid var(--line); }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 70px; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--accent); }
.key-row { display: flex; gap: 8px; }
.key-row .input { flex: 1; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.notice .i { font-size: 19px; margin-top: 1px; }
.notice.ok .i { color: var(--ok); } .notice.warn .i { color: var(--warn); } .notice.err .i { color: var(--danger); } .notice.info .i { color: var(--accent); }
.notice b { color: var(--text); }

/* ---------- Écran d'erreur de démarrage ---------------------------------- */
.boot { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.boot .box { max-width: 460px; }
.boot pre { text-align: left; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; overflow-x: auto; }

/* ==========================================================================
   Le cahier (lecture plein écran, pages qui se tournent)
   ========================================================================== */
.nb {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; user-select: none;
  /* un bureau sombre, une lampe au-dessus du cahier */
  background:
    radial-gradient(ellipse 46% 36% at 50% 30%, rgba(255, 244, 214, .10), transparent 72%),
    radial-gradient(ellipse 74% 64% at 50% 46%, #313134, #161617 76%),
    #131314;
  animation: rise .3s var(--ease) both;
}
.nb-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.nb-title { flex: 1; min-width: 0; }
.nb-title b { display: block; font: 400 22px/1.1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-title span { font-size: 12.5px; color: var(--text-3); }
.nb-pages { font: italic 19px/1 var(--font-display); color: var(--text-2); white-space: nowrap; }
/* La perspective vit ici : les feuilles tournent dans le MÊME espace 3D,
   au lieu d'avoir chacune la leur (ce qui aplatissait tout). */
.nb-view { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; perspective: 2200px; perspective-origin: 50% 44%; }
.nb-stage { transform-origin: center center; transform-style: preserve-3d; }

/* Couche qui porte l'inclinaison du cahier (l'échelle, elle, reste sur .nb-stage) */
.nb-tilt {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.22, .9, .25, 1);
}
.nb-tilt.turning { transform: rotateX(7deg) translateY(-8px); }
.nb-tilt.opening { animation: nb-open .95s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes nb-open {
  from { opacity: 0; transform: rotateX(26deg) rotateY(-17deg) translateY(56px) scale(.87); }
  55%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}

/* L'épaisseur du cahier : la tranche des pages, collée aux bords du livre
   (portée par .nb-book, sinon elle ne suit pas ses déplacements). */
.nb-book::before, .nb-book::after {
  content: ''; position: absolute; top: 6px; bottom: 6px; width: 11px; z-index: 0;
  background:
    repeating-linear-gradient(90deg, rgba(90, 78, 52, .22) 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #f2ecdd, #d8d0bc 55%, #b9b09a);
  box-shadow: 0 22px 34px -18px rgba(0, 0, 0, .85);
  transform: translateZ(-2px);
  transition: opacity .5s var(--ease);
}
.nb-book::before { left: -10px;  border-radius: 4px 0 0 4px; }
.nb-book::after  { right: -10px; border-radius: 0 4px 4px 0; }
.nb.single .nb-book::before, .nb.single .nb-book::after { width: 8px; }
.nb.single .nb-book::before { left: -7px; }
.nb.single .nb-book::after  { right: -7px; }
/* cahier fermé : la moitié cachée n'a pas de tranche à montrer */
.nb.double .nb-book.at-start::before, .nb.double .nb-book.at-end::after { opacity: 0; }

/* L'ombre portée : c'est elle qui pose le cahier sur le bureau */
.nb-ground {
  position: absolute; left: 3%; right: 3%; bottom: -34px; height: 60px; z-index: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 0, 0, .62), transparent 72%);
  filter: blur(16px); transform: translateZ(-60px);
  transition: left .5s var(--ease), right .5s var(--ease);
}
.nb.double .nb-book.at-start .nb-ground { left: 51%; right: 2%; }
.nb.double .nb-book.at-end   .nb-ground { left: 2%;  right: 51%; }
.nb-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-2); }
.nb-loading .i { font-size: 30px; color: var(--accent); }
.nb-arrow {
  position: absolute; top: 50%; z-index: 3; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line-strong); background: rgba(28, 28, 31, .8); color: var(--text);
  backdrop-filter: blur(6px); transition: opacity .2s, background .15s;
}
/* sur un écran tactile, le flou d'arrière-plan fait saccader tout le cahier */
@media (hover: none) {
  .nb-arrow { backdrop-filter: none; background: rgba(28, 28, 31, .92); }
  /* l'ombre au sol est un deuxième calque flou permanent : plus légère ici */
  .nb-ground { filter: blur(10px); opacity: .7; }
}
.nb-arrow:hover { background: var(--surface-3); }
.nb-arrow:disabled { opacity: 0; pointer-events: none; }
.nb-arrow .i { font-size: 22px; }
.nb-arrow.prev { left: 18px; }
.nb-arrow.next { right: 18px; }
.nb-hint { position: relative; z-index: 3; padding: 0 0 16px; text-align: center; font-size: 12.5px; color: var(--text-3); }

.nb-book { position: relative; z-index: 1; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.645, .045, .355, 1); }
.nb.double .nb-book { width: calc(var(--pw) * 2); height: var(--ph); }
.nb.single .nb-book { width: var(--pw); height: var(--ph); }
.nb.double .nb-book.at-start { transform: translateX(-25%); }
.nb.double .nb-book.at-end   { transform: translateX(25%); }
.nb.instant .nb-book, .nb.instant .nb-leaf { transition: none !important; }

.nb-leaf {
  position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d;
  /* --z : la profondeur propre de la feuille. Dans un contexte « preserve-3d »
     le z-index ne sert à rien — c'est la position 3D qui décide de l'ordre.
     Sans ces quelques centièmes de pixel, deux demi-pages se chevauchent. */
  transform: translateZ(var(--z, 0px)) rotateY(0deg);
  transition: transform .92s cubic-bezier(.58, .06, .32, 1), opacity .1s;
}
/* hors de la fenêtre utile : plus rien à composer (on ne la voyait pas) */
.nb-leaf.far { visibility: hidden; }
.nb-leaf.far .nb-face { box-shadow: none; }
.nb.double .nb-leaf { left: 50%; width: 50%; }
.nb.single .nb-leaf { left: 0; width: 100%; }
.nb-leaf.flipped { transform: translateZ(var(--z, 0px)) rotateY(-180deg); }
.nb.single .nb-leaf.flipped { opacity: 0; transition: transform .82s cubic-bezier(.58, .06, .32, 1), opacity .2s .64s; }
.nb-face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* Une grande ombre floue par face coûtait cher pour rien : seules les deux
   feuilles du dessus, et celle qui tourne, en ont vraiment besoin. */
.nb-leaf.top .nb-face, .nb-leaf.turning .nb-face { box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .85); }
.nb-face.front { border-radius: 2px 8px 8px 2px; }
.nb-face.back  { border-radius: 8px 2px 2px 8px; transform: rotateY(180deg); }
.nb.single .nb-face.back { border-radius: 2px 8px 8px 2px; }
/* ombre qui passe sur la page pendant qu'elle tourne */
.nb-shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.nb-face.front .nb-shade { background: linear-gradient(90deg, rgba(255, 255, 255, .10) 0 6%, rgba(0, 0, 0, .04) 26%, rgba(0, 0, 0, .46)); }
.nb-face.back  .nb-shade { background: linear-gradient(270deg, rgba(255, 255, 255, .10) 0 6%, rgba(0, 0, 0, .04) 26%, rgba(0, 0, 0, .46)); }
.nb-leaf.turning .nb-shade { animation: shade .92s ease-in-out; }
@keyframes shade { 0%, 100% { opacity: 0; } 46% { opacity: 1; } }
/* le bord de la page qui se soulève accroche la lumière */
.nb-leaf.turning .nb-face::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 34px; z-index: 4; pointer-events: none;
  animation: curl .92s ease-in-out;
}
.nb-face.front::after { right: 0; background: linear-gradient(270deg, rgba(255, 255, 255, .5), transparent); }
.nb-face.back::after  { left: 0;  background: linear-gradient(90deg, rgba(255, 255, 255, .5), transparent); }
@keyframes curl { 0%, 100% { opacity: 0; } 40% { opacity: .9; } }

/* Papier Seyès (grands carreaux) */
.nb-page {
  position: absolute; inset: 0; padding: var(--pt) var(--pr) var(--pb) var(--pl);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent calc(var(--margin) - 1px), #e2645c calc(var(--margin) - 1px), #e2645c calc(var(--margin) + 1px), transparent calc(var(--margin) + 1px)),
    linear-gradient(to bottom, rgba(92, 114, 188, .5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(118, 138, 206, .2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(158, 120, 198, .15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 32px, 100% 8px, 32px 100%;
  background-position: 0 0, 0 var(--base), 0 var(--base), var(--margin) 0;
  color: var(--ink);
}
.nb-face.front .nb-page { box-shadow: inset 34px 0 38px -26px rgba(58, 46, 26, .58); }
.nb-face.back  .nb-page { box-shadow: inset -34px 0 38px -26px rgba(58, 46, 26, .58); }
.nb.single .nb-face .nb-page { box-shadow: inset 16px 0 26px -20px rgba(58, 46, 26, .4), inset -16px 0 26px -20px rgba(58, 46, 26, .4); }
/* un voile de lumière en diagonale : le papier cesse d'être un aplat */
.nb-page::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, .5) 0 18%, transparent 46%, rgba(120, 100, 60, .06));
  mix-blend-mode: soft-light;
}
.nb-page.verso { filter: brightness(.96); }
.nb-body { position: relative; height: calc(var(--lines) * 32px); overflow: hidden; display: flow-root; }
.nb-num { position: absolute; bottom: 8px; font: 400 15px/1 var(--font-hand); color: #8b8474; }
.nb-face.front .nb-num { right: 24px; }
.nb-face.back  .nb-num { left: 24px; }

/* Écriture : tout est multiple de 32px pour rester sur les lignes */
.nb-body > * { margin: 0; }
.nb-section { font: 400 34px/64px var(--font-hand); color: var(--ink-red); margin-bottom: 32px !important; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 9px; }
.nb-doc { display: flex; align-items: baseline; gap: 12px; font: 400 29px/64px var(--font-hand); color: #16213e; }
.nb-body > .nb-doc:not(:first-child) { margin-top: 32px; }
.nb-doc span { flex: 1; min-width: 0; }
.nb-doc em { flex-shrink: 0; font: 600 10px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; font-style: normal; color: var(--ink-red); border: 1.5px solid currentColor; border-radius: 5px; padding: 4px 6px; transform: rotate(-3deg) translateY(-4px); }
.nb-h1 { font: 400 26px/64px var(--font-hand); color: var(--ink-red); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 8px; }
.nb-h2 { font: 400 23px/32px var(--font-hand); color: #1d7a41; }
.nb-body > .nb-h2:not(:first-child) { margin-top: 32px; }
.nb-h3 { font: 600 17px/32px var(--font-note); color: #16213e; text-decoration: underline; text-underline-offset: 6px; }
.nb-p, .nb-li { font: 400 16px/32px var(--font-note); letter-spacing: .005em; color: var(--ink); }
.nb-li { position: relative; padding-left: 30px; }
.nb-li::before { content: '–'; position: absolute; left: 8px; color: var(--ink-red); }
.nb-li.nb-ol::before { content: attr(data-n); left: 0; }
.nb-li.nb-cont::before { content: none; }
.nb-p strong, .nb-li strong { font-weight: 400; background: linear-gradient(transparent 38%, rgba(255, 224, 58, .8) 38% 86%, transparent 86%); }
.nb-p em, .nb-li em { color: #6a2c91; }
.nb-p code, .nb-li code { font-family: inherit; }
.nb-p .md-note, .nb-li .md-note { color: #857d6c; font-style: normal; }
.nb-photo { height: 224px; display: grid; place-items: center; }
.nb-photo img { max-height: 176px; max-width: 86%; padding: 7px; background: #fff; transform: rotate(-1.6deg); box-shadow: 0 6px 14px -4px rgba(0, 0, 0, .35); position: relative; }
.nb-photo:nth-of-type(even) img { transform: rotate(1.4deg); }
.nb-tape { position: relative; display: inline-block; }
.nb-tape::before, .nb-tape::after { content: ''; position: absolute; z-index: 1; width: 64px; height: 20px; background: rgba(240, 232, 190, .75); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.nb-tape::before { top: -8px; left: -18px; transform: rotate(-32deg); }
.nb-tape::after { bottom: -8px; right: -18px; transform: rotate(-32deg); }
/* ---------- Cahier : images, vidéos et fichiers ---------------------------
   Une image de cours ne sert à rien si on ne la voit pas : elle prend au
   minimum toute la largeur de la page, et le créateur peut lui donner la page
   entière. On touche pour l'ouvrir en grand. */
.nb-media { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; margin: 4px 0 10px; cursor: zoom-in; }
.nb-media.wide { min-height: 160px; }
.nb-media.page { height: calc(var(--lines) * 32px); margin: 0; }
.nb-media .nb-shot { position: relative; display: flex; flex: 1; min-height: 0; width: 100%; justify-content: center; }
.nb-media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #fff;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .45); border: 1px solid rgba(60, 50, 30, .12); }
.nb-media.wide img { max-height: calc(var(--lines) * 32px - 96px); }
.nb-media figcaption { font: 400 13px/18px var(--font-note); color: #6f6857; text-align: center; }
.nb-media::after { content: ''; position: absolute; inset: -4px; border: 1.5px dashed transparent; border-radius: 6px; transition: border-color .2s; }
.nb-media:hover::after, .nb-media:focus-visible::after { border-color: rgba(31, 58, 138, .35); }
.nb-play i { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; }
.nb-play i svg { width: 54px; height: 54px; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .6)); }
.nb-file { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 18px 16px;
  background: linear-gradient(#fffdf6, #f4efe0); border: 1.5px solid rgba(60, 50, 30, .18); border-radius: 8px;
  box-shadow: 0 8px 16px -10px rgba(0, 0, 0, .4); text-align: center; }
.nb-file svg { width: 34px; height: 34px; color: #2c4aa0; }
.nb-file b { font: 400 17px/1.25 var(--font-note); color: var(--ink); overflow-wrap: anywhere; }
.nb-file small { font: 400 12px/1.2 var(--font-note); color: #857d6c; }

.nb-toc-title { font: 400 34px/64px var(--font-hand); color: var(--ink-red); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 9px; margin-bottom: 32px !important; }
.nb-toc-row { display: flex; align-items: baseline; font: 400 16px/32px var(--font-note); color: var(--ink); }
.nb-toc-row.sub { padding-left: 22px; color: #2c4aa0; }
.nb-toc-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-toc-row .dots { flex: 1; min-width: 20px; margin: 0 8px; border-bottom: 2px dotted rgba(31, 58, 138, .35); transform: translateY(-6px); }
.nb-toc-row .p { font: 600 15px/32px var(--font-note); color: var(--ink-red); }

/* Couvertures */
.nb-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, .16), transparent 40%),
    repeating-linear-gradient(135deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 7px),
    color-mix(in srgb, var(--c) 86%, #1e1e1e);
  box-shadow: inset 26px 0 0 rgba(0, 0, 0, .2), inset 27px 0 0 rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .9);
}
.nb-cover::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 26px; background: radial-gradient(circle, rgba(255, 255, 255, .45) 1.6px, transparent 2.2px) center 10px / 26px 22px repeat-y; }
.nb-face.back .nb-cover { box-shadow: inset -26px 0 0 rgba(0, 0, 0, .2); }
.nb-face.back .nb-cover::before { left: auto; right: 0; }
.nb-label { position: relative; width: 70%; padding: 26px 24px 24px; border-radius: 14px; background: #f4f1e7; color: #1c2b5a; text-align: center; box-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 18px 30px -14px rgba(0, 0, 0, .6); }
.nb-label::before { content: ''; position: absolute; inset: 7px; border-radius: 9px; border: 2px solid color-mix(in srgb, var(--c) 75%, #000); opacity: .5; }
.nb-label .k { font: 600 11px/1 var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: #7a7465; }
.nb-label .s { margin-top: 10px; font: 400 40px/1.05 var(--font-hand); }
.nb-label .t { margin-top: 12px; font: 400 16px/1.35 var(--font-note); color: #2b3a6b; }
.nb-label .c { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin-top: 18px; font: 400 14px/1 var(--font-note); color: #555; }
.nb-label .c u { text-decoration: none; border-bottom: 2px dotted #999; padding: 0 12px 3px; font-family: var(--font-note); font-size: 15px; font-weight: 600; color: #1c2b5a; }
.nb-cover .brandline { display: flex; align-items: center; gap: 8px; font: italic 22px/1 var(--font-display); color: rgba(255, 255, 255, .8); }
.nb-cover .brandline span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font: 700 13px/1 var(--font-ui); font-style: normal; transform: rotate(-6deg); }
.nb-cover .ico { font-size: 44px; opacity: .85; }
.nb-cover .ico .i { stroke-width: 1.4; }
.nb-cover .end { font: 400 26px/1 var(--font-hand); color: rgba(255, 255, 255, .85); }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid > aside { order: -1; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
    height: 60px; padding: 0 16px; border-bottom: 1px solid var(--line);
    background: rgba(20, 20, 21, .88); backdrop-filter: blur(14px);
  }
  .topbar .brand-name { font-size: 25px; }
  .topbar .brand-mark { width: 25px; height: 25px; font-size: 14px; }
  .topbar .seg { margin-left: auto; }
  .topbar .seg button { padding: 6px 9px; font-size: 12.5px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
    background: rgba(20, 20, 21, .94); backdrop-filter: blur(14px);
  }
  .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px;
    border: 0; background: none; border-radius: 11px; color: var(--text-3); font-size: 11px; font-weight: 600;
  }
  .tab .i { font-size: 21px; }
  .tab.active { color: var(--text); }
  .tab.active .i { color: var(--accent); }
  .tab-dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
  .main { padding: 26px 16px 110px; }
  .page-head { margin-bottom: 26px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; }
  .items { grid-template-columns: minmax(0, 1fr); }
  .toc-row { grid-template-columns: 46px minmax(0, 1fr) auto; padding: 16px 2px; }
  .toc-row .toc-go { display: none; }
  .toc-num { font-size: 32px; }
  .hw { grid-template-columns: auto 44px minmax(0, 1fr) auto; gap: 11px; padding: 12px; }
  .hw-day { font-size: 26px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 94vh; }
  .card-row { grid-template-columns: 20px 1fr 30px; }
  .card-row .input.js-a { grid-column: 2; }
  .card-row .n { grid-row: span 2; }
  .card-row .btn-icon { grid-row: 1 / span 2; grid-column: 3; }
  .nb-arrow { display: none; }
  .nb-top { padding: 10px 12px; }
  .subject-hero { gap: 16px; }
  .subject-badge { width: 58px; height: 72px; font-size: 24px; }
  .stats-3 .stat b { font-size: 28px; }
  .bristol-text { font-size: 25px; padding: 10px 20px 30px; }
}

/* ==========================================================================
   v3 — Animations & immersion
   ========================================================================== */
:root { --accent-glow: rgba(242, 227, 92, .35); --spring: cubic-bezier(.34, 1.56, .64, 1); }
body { opacity: 1; }
body.ready { opacity: 1; }
/* respect des préférences : animations réduites */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important;
}
@keyframes fade-up { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-spring { 0% { opacity: 0; transform: scale(.85); } 100% { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes glow-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 9px transparent; } }
@keyframes grow { from { transform: scaleX(0); } }
[data-stagger] > * { animation: fade-up .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 80ms); }
.hero-title .w, .display .w { display: inline-block; animation: word-in .7s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes word-in { from { opacity: 0; transform: translateY(.45em) rotate(2deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* fermeture animée des couches (fenêtres, menus, palette…) */
#ghost-root > * { pointer-events: none; }
.modal-wrap.closing { animation: fade-in .18s reverse both; }
.modal-wrap.closing .modal { animation: pop .18s var(--ease) reverse both; }
.menu.closing, .palette-wrap.closing, .pomo.closing, .tts.closing, .lightbox.closing { animation: pop .15s var(--ease) reverse both; }
.rev.closing { animation: fade-in .22s reverse both; }
.modal-backdrop { animation: fade-in .25s both; }
.modal { animation: pop-spring .34s var(--spring) both; }

/* onde au clic */
.btn, .nav-item, .tab, .menu-item { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* halo qui suit la souris */
.spot { position: relative; isolation: isolate; }
.spot::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .06), transparent 45%);
}
.spot:hover::after { opacity: 1; }

/* ---------- Barre latérale v3 ------------------------------------------- */
.search-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-3); font-size: 14px; text-align: left; transition: .2s;
}
.search-btn:hover { border-color: var(--line-strong); color: var(--text); }
.search-btn span { flex: 1; }
kbd, .kbd { display: inline-block; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg-2); font: 600 10.5px var(--font-ui); color: var(--text-3); }
.sb-nav { position: relative; }
.nav-glow { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: 11px; background: var(--surface-2); opacity: 0; pointer-events: none;
  transition: top .45s var(--spring), height .3s, opacity .3s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.nav-glow::before { content: ''; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.nav-item { z-index: 1; }
.nav-item.active { background: transparent; }
.nav-item.active::before { display: none; }
.nav-item.active .i { color: var(--accent); }
.nav-badge[hidden] { display: none; }
.nav-badge { animation: pop-spring .4s var(--spring); }
.nav-badge.soft { background: var(--surface-3); color: var(--text); }
.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st, #707076); margin-right: 6px; vertical-align: 1px; }
.focus-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line-strong); background: none; color: var(--text-2); font-size: 13.5px; transition: .2s; }
.focus-btn span { flex: 1; text-align: left; }
.focus-btn b { font: 600 13px var(--font-ui); font-variant-numeric: tabular-nums; color: var(--text-3); }
.focus-btn:hover { color: var(--text); border-color: var(--accent); }
.focus-btn.on { border-style: solid; border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--text); }
.focus-btn.on b { color: var(--accent); }
.focus-btn.on .i { color: var(--accent); animation: float 2s ease-in-out infinite; }

/* ---------- Avatars ------------------------------------------------------ */
.av {
  position: relative; width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--av, #5d5d66); color: #fff; font: 700 13px var(--font-ui); text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.av > img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.av > span { line-height: 1; }
.av .i { font-size: 17px; }
.av.xs { width: 22px; height: 22px; font-size: 9px; }
.av.xs .i { font-size: 11px; }
.av.sm { width: 30px; height: 30px; font-size: 11px; }
.av.sm .i { font-size: 14px; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }
.av.lg .i { font-size: 24px; }
.av.xl { width: 88px; height: 88px; font-size: 30px; }
.av.xl .i { font-size: 36px; }
.av-dot { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 9px; min-height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2.5px var(--bg); animation: pop-spring .4s var(--spring); }
.group-av { border-radius: 30%; }
.class-av { background: var(--accent); color: var(--accent-ink); text-shadow: none; }
.av-btn { border: 0; background: none; padding: 0; border-radius: 50%; }

/* ---------- Accueil v3 --------------------------------------------------- */
.hero { position: relative; }
.hero::before {
  content: ''; position: absolute; left: -120px; top: -140px; width: 520px; height: 420px; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, var(--accent), transparent); opacity: .08; filter: blur(30px);
  animation: aurora 12s ease-in-out infinite alternate;
}
@keyframes aurora { from { transform: translate(0, 0) scale(1); } to { transform: translate(80px, 30px) scale(1.15); } }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hchip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.hchip b { color: var(--text); font-weight: 650; }
.hchip .i { color: var(--text-3); }
.hchip.hot { border-color: rgba(240, 165, 74, .4); background: rgba(240, 165, 74, .09); }
.hchip.hot .i { color: var(--warn); animation: float 2.4s ease-in-out infinite; }
.row-title { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.qrow { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 18px; scroll-snap-type: x mandatory; }
.qrow::-webkit-scrollbar { height: 6px; }
.qcard {
  flex: 0 0 230px; display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 14px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--line); text-align: left; color: var(--text); transition: transform .3s var(--ease), border-color .2s;
}
.qcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.qc-ic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; font-size: 18px;
  color: var(--c, var(--text-2)); background: color-mix(in srgb, var(--c, #888) 16%, var(--surface-2)); }
.qc-t { min-width: 0; }
.qc-t b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-t span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cahier.tilt { transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s var(--ease), box-shadow .4s; }
.cahier.tilt:hover { transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-8px) scale(1.02); }
.cahier-shine { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .22), transparent 55%); }
.cahier:hover .cahier-shine { opacity: 1; }
.cahier-prog { display: block; height: 3px; margin-top: 8px; border-radius: 99px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.cahier-prog i { display: block; height: 100%; border-radius: 99px; background: color-mix(in srgb, var(--c) 80%, #000); transform-origin: left; animation: grow 1s .5s var(--ease) both; }
.side-stack > * + * { margin-top: 14px; }
.daily-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; min-width: 0; }
.daily-top .h3 { display: flex; align-items: center; gap: 8px; }
.daily-top p { margin: 3px 0 0; }
.fc-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 22px; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.fc-ic.on { background: var(--accent-soft); color: var(--accent); animation: glow-pulse 2s infinite; }
.chat-card .av { width: 52px; height: 52px; }
.chat-card .cl-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* anneau de progression */
.ring { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; animation: ring-in 1.2s .2s var(--ease) both; transition: stroke-dashoffset .5s linear; }
@keyframes ring-in { from { stroke-dashoffset: var(--full); } }
.ring-in { position: relative; text-align: center; line-height: 1; }
.ring-in b { font: 400 24px var(--font-display); }
.ring-in small { font-size: 11px; color: var(--text-3); }

/* ---------- Matière, chapitre, document v3 ------------------------------- */
.back { margin-bottom: 4px; }
.toc-row .toc-title .fav-mark { color: var(--accent); font-size: 14px; margin-left: 8px; vertical-align: 0; }
.toc-meta b { color: var(--text-2); font-weight: 600; }
.toc-prog { display: block; width: min(260px, 100%); height: 3px; margin-top: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.toc-prog i { display: block; height: 100%; background: var(--c); transform-origin: left; animation: grow .9s .3s var(--ease) both; }
.progress-block { display: flex; align-items: center; gap: 14px; margin: -14px 0 26px; }
.progress-line { flex: 1; max-width: 360px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-line i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); transform-origin: left; animation: grow 1s .2s var(--ease) both; }
.btn-icon-text { width: 40px; padding: 0; }
.btn.is-on { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); color: var(--accent); }
.btn.is-on .i { animation: pop-spring .4s var(--spring); }
.item.learned .item-icon { background: rgba(98, 207, 142, .13); }
.item-icon { position: relative; }
.item-check { position: absolute; right: -5px; bottom: -5px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #0d1a12; font-size: 11px; box-shadow: 0 0 0 2.5px var(--surface); }
.item-check .i { stroke-width: 3; }
.deck-mastery { display: block; height: 3px; margin-top: 8px; border-radius: 99px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.deck-mastery i { display: block; height: 100%; background: #2e7d32; transform-origin: left; animation: grow 1s .4s var(--ease) both; }
.deck-count b { color: #b3261e; }
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 45; pointer-events: none; }
.read-progress i { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); transition: width .1s linear; }
.doc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -8px 0 24px; }
.tools-sep { width: 1px; height: 26px; background: var(--line-strong); margin: 0 4px; }
.reader-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 30px; align-items: start; }
.reader-grid .article { max-width: 760px; }
.sticky-note {
  position: sticky; top: 24px; padding: 16px 16px 12px; border-radius: 4px 4px 14px 4px; color: #3a3212;
  background: linear-gradient(180deg, #fff3a6, #fbe77e); box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .9); transform: rotate(.8deg);
  transition: transform .3s var(--ease);
}
.sticky-note:focus-within { transform: rotate(0) scale(1.02); }
.sticky-note::before { content: ''; position: absolute; top: -9px; left: 50%; width: 80px; height: 20px; margin-left: -40px; background: rgba(255, 255, 255, .45); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.sn-head { display: flex; align-items: center; gap: 7px; font: 600 13px/1.2 var(--font-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.sn-head span { margin-left: auto; font: 500 11px var(--font-ui); opacity: .6; }
.sticky-note textarea { width: 100%; min-height: 220px; margin-top: 8px; border: 0; background: transparent; resize: vertical; outline: none; color: #2a2410;
  font: 400 15px/28px var(--font-note); background-image: repeating-linear-gradient(transparent 0 27px, rgba(120, 100, 20, .18) 27px 28px); }
.sticky-note textarea::placeholder { color: rgba(58, 50, 18, .5); }

/* lecture à voix haute */
.tts {
  position: fixed; z-index: 55; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: rgba(35, 35, 39, .92);
  border: 1px solid var(--line-strong); backdrop-filter: blur(14px); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .8); animation: pop-spring .35s var(--spring);
}
.tts-play { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex-shrink: 0; }
.tts-info { flex: 1; min-width: 0; }
.tts-info b { display: block; font-size: 13px; }
.tts-line { display: block; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tts-prog { display: block; height: 3px; margin-top: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.tts-prog i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.tts-wave { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.tts-wave i { width: 3px; border-radius: 2px; background: var(--accent); animation: wave 1s ease-in-out infinite; }
.tts-wave i:nth-child(2) { animation-delay: .15s; } .tts-wave i:nth-child(3) { animation-delay: .3s; } .tts-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 4px; } 50% { height: 16px; } }

/* ---------- Compte & préférences ---------------------------------------- */
.profile h2 { margin: 0; font: 400 32px/1.1 var(--font-display); }
.profile-edit { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; }
.avatar-edit { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.avatar-edit .av.xl { width: 120px; height: 120px; font-size: 40px; box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.avatar-actions { display: flex; flex-direction: column; gap: 6px; }
.av-colors { display: grid; grid-template-columns: repeat(5, 22px); gap: 8px; }
.av-color input, .swatch input, .status-opt input, .choice input, .pill-radio input { position: absolute; opacity: 0; pointer-events: none; }
.av-color span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--sw); cursor: pointer; transition: transform .2s var(--spring), box-shadow .2s; }
.av-color input:checked + span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); transform: scale(1.12); }
.swatches { display: flex; flex-wrap: wrap; gap: 14px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.swatch span { width: 44px; height: 44px; border-radius: 14px; background: var(--sw); transition: transform .25s var(--spring), box-shadow .2s; box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .15); }
.swatch:hover span { transform: translateY(-3px) rotate(-4deg); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--sw), 0 10px 22px -8px var(--sw); transform: scale(1.06); }
.swatch small { font-size: 11.5px; color: var(--text-3); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row b { display: block; font-size: 14.5px; font-weight: 550; }
.switch-row small { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.switch { appearance: none; position: relative; width: 44px; height: 26px; flex-shrink: 0; border-radius: 99px; background: var(--surface-3); cursor: pointer; transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .3s var(--spring); box-shadow: 0 2px 5px rgba(0, 0, 0, .35); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.range { width: 100%; accent-color: var(--accent); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-3 > .field { margin-top: 0; }
.status-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.status-opt span { display: inline-flex; align-items: center; padding: 8px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--bg-2); font-size: 13px; cursor: pointer; transition: .2s; }
.status-opt input:checked + span { border-color: var(--text-2); background: var(--surface-3); color: var(--text); }
.choice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg-2); cursor: pointer; transition: .2s; }
.choice span .i { font-size: 20px; color: var(--text-3); margin-bottom: 4px; }
.choice small { color: var(--text-3); font-size: 12.5px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:checked + span .i { color: var(--accent); }
.account-body > .panel + .panel { margin-top: 14px; }
.accent-link { color: var(--accent); }

/* ---------- Formulaires & Elite Scribe ------------------------------------ */
.cards-ctl .cards-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; transition: opacity .2s; }
.cards-ctl .cards-mode.off { opacity: .4; pointer-events: none; }
.cards-ctl .js-n { width: 90px; padding: 8px 10px; }
.pill-radio span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--bg-2); font-size: 13px; cursor: pointer; transition: .2s; }
.pill-radio input:checked + span { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--text); }
.pill-radio input:checked + span .i { color: var(--accent); }
.ai-extra, .ai-box { margin-top: 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--bg-2); }
.ai-extra summary, .ai-box summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600; list-style: none; }
.ai-extra summary::-webkit-details-marker, .ai-box summary::-webkit-details-marker { display: none; }
.ai-extra[open] summary, .ai-box[open] summary { border-bottom: 1px solid var(--line); }
.ai-extra textarea { display: block; width: calc(100% - 24px); margin: 12px; }
.ai-box { margin: 0 0 18px; border-color: color-mix(in srgb, var(--accent) 25%, transparent); background: linear-gradient(120deg, var(--accent-soft), var(--bg-2) 60%); }
.ai-box summary .i { color: var(--accent); }
.ai-box > :not(summary) { margin-left: 14px; margin-right: 14px; }
.ai-box > :last-child { margin-bottom: 14px; }
.ai-box > .field:first-of-type { margin-top: 14px; }
.scan-anim { position: relative; display: inline-grid; place-items: center; color: var(--accent); }
.scan-anim::after { content: ''; position: absolute; left: -2px; right: -2px; height: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: scan 1.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 0; } 50% { top: 100%; } }
.card-row.pop-in { animation: fade-up .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.card-row.leaving { animation: fade-up .18s reverse both; }
.send-preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 12px; background: var(--bg-2); }

/* ---------- Palette de commandes (Ctrl+K) -------------------------------- */
.palette-wrap { position: fixed; inset: 0; z-index: 110; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 9, .62); backdrop-filter: blur(4px); animation: fade-in .2s both; }
.palette { position: relative; width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: rgba(30, 30, 33, .96); border: 1px solid var(--line-strong); box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .9); animation: pop-spring .3s var(--spring) both; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-input .i { font-size: 19px; color: var(--accent); }
.palette-input input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; color: var(--text); }
.palette-list { overflow-y: auto; padding: 8px; }
.pal-group { padding: 10px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 11px; background: none; color: var(--text); text-align: left; }
.pal-item.sel, .pal-item:hover { background: var(--surface-3); }
.pal-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--c, var(--text-2)); }
.pal-txt { flex: 1; min-width: 0; }
.pal-txt b { display: block; font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-txt span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-go { color: var(--text-3); opacity: 0; transform: scaleX(-1); }
.pal-item.sel .pal-go { opacity: 1; }
.pal-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px; color: var(--text-3); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.kb-grid { display: grid; gap: 2px; }
.kb-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.menu-item kbd { margin-left: auto; }
.menu-item.active { color: var(--accent); }

/* ---------- Révision v3 --------------------------------------------------- */
.daily-hero { display: flex; align-items: center; gap: 24px; padding: 22px 24px; margin-bottom: 30px; border-radius: 22px;
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 55%); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.dh-txt { flex: 1; min-width: 0; }
.dh-txt p { margin: 6px 0 0; }
.dh-actions { display: flex; gap: 6px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 16px; border-radius: 16px; text-align: left;
  border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); transition: transform .3s var(--spring), border-color .2s; }
.mode-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.mode-card.last { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mode-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 21px; margin-bottom: 4px; }
.mode-card b { font-size: 15px; }
.mode-card small { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.mode-card .chip { margin-top: 6px; }
.rev-top .t span.faint { display: block; margin-top: 2px; }
.combo { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; background: rgba(240, 165, 74, .15); color: var(--warn); font-weight: 700; font-size: 13px; animation: pop-spring .4s var(--spring); }
#rev-card { transition: transform .26s var(--ease), opacity .26s; }
#rev-card.fly-right { transform: translateX(120px) rotate(8deg); opacity: 0; }
#rev-card.fly-left { transform: translateX(-120px) rotate(-8deg); opacity: 0; }
.rev-card-wrap { animation: fade-up .35s var(--ease) both; }
.bristol.single { cursor: default; height: min(38vh, 290px); }
.bristol.single .bristol-text { font-size: 26px; }
.bristol.single .bristol-face { transition: box-shadow .3s; }
.bristol.good .bristol-face { box-shadow: 0 0 0 3px var(--ok), 0 30px 60px -24px rgba(0, 0, 0, .9); }
.bristol.bad .bristol-face { box-shadow: 0 0 0 3px var(--warn), 0 30px 60px -24px rgba(0, 0, 0, .9); animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.bristol-answer { margin: 0 24px 24px; padding: 12px 14px; border-radius: 10px; background: rgba(255, 255, 255, .7); font: 500 14px var(--font-ui); color: #1d2a55; display: flex; align-items: center; gap: 8px; animation: fade-up .3s var(--ease); }
.bristol.good .bristol-answer .i { color: #2e7d32; } .bristol.bad .bristol-answer .i { color: #c62828; }
.write-row { display: flex; gap: 10px; margin-top: 20px; }
.write-row .input { font-size: 16px; padding: 14px 16px; }
.write-row .btn { height: auto; }
.qcm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.qcm-opt { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); text-align: left; font-size: 14.5px; transition: .2s; }
.qcm-opt:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.qcm-k { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); font-weight: 700; font-size: 12px; }
.qcm-opt.right { border-color: var(--ok); background: rgba(98, 207, 142, .14); animation: pop-spring .35s var(--spring); }
.qcm-opt.right .qcm-k { background: var(--ok); color: #0d1a12; }
.qcm-opt.wrong { border-color: var(--danger); background: rgba(239, 100, 97, .14); animation: shake .4s; }
.qcm-opt.dim { opacity: .45; }
.goal-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -8px 0 20px; color: var(--text-2); font-size: 14px; }
.goal-line .i { color: var(--accent); }

/* ---------- Progression ---------------------------------------------------- */
.stat-card .num small { font-size: 22px; color: var(--text-3); }
.ring-card { display: flex; flex-direction: column; gap: 8px; }
.prog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.prog-grid .panel { margin: 0; }
.prog-grid .wide { grid-column: 1 / -1; }
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.hm { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--surface-3); animation: fade-in .4s both; animation-delay: calc(var(--i, 0) * 25ms); }
.hm.l-1 { opacity: .3; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.hm.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--surface-3)); }
.hm.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-3)); }
.hm.l3 { background: color-mix(in srgb, var(--accent) 75%, var(--surface-3)); }
.hm.l4 { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.hm-legend { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.hm-legend .hm { width: 11px; height: 11px; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { display: block; width: 100%; height: calc(var(--h) * .82); min-height: 3px; border-radius: 6px 6px 3px 3px; background: var(--surface-3); transform-origin: bottom; animation: bar-up .8s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.bar.now i, .bar.alt i { background: var(--accent); }
.bar.alt i { background: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); }
.bar span { font-size: 11px; color: var(--text-3); }
.bar b { font-size: 11px; color: var(--text-2); }
@keyframes bar-up { from { transform: scaleY(0); } }
.goal-mark { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); font-size: 10px; color: var(--accent); text-align: right; padding-right: 2px; pointer-events: none; }
.mastery { display: flex; flex-direction: column; gap: 12px; }
.m-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 50px; align-items: center; gap: 12px; font-size: 14px; }
.m-name { display: flex; align-items: center; gap: 8px; } .m-name .i { color: var(--c); }
.m-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.m-bar i { display: block; height: 100%; border-radius: 99px; background: var(--c); transform-origin: left; animation: grow 1s .3s var(--ease) both; }
.m-row b { text-align: right; font-variant-numeric: tabular-nums; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; border-radius: 16px; text-align: center; background: var(--surface); border: 1px solid var(--line); opacity: .5; filter: grayscale(1); transition: transform .3s var(--spring); }
.badge.on { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge.on:hover { transform: translateY(-4px) rotate(-1.5deg); }
.badge-ic { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--surface-3); color: var(--text-3); }
.badge.on .badge-ic { background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); color: var(--accent-ink); box-shadow: 0 10px 24px -10px var(--accent-glow); }
.badge b { font-size: 13.5px; } .badge small { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }

/* ---------- Minuteur focus -------------------------------------------------- */
#pomo-root { position: fixed; right: 22px; bottom: 22px; z-index: 50; }
.pomo { width: 270px; padding: 14px; border-radius: 22px; background: rgba(30, 30, 33, .95); border: 1px solid var(--line-strong); backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85); animation: pop-spring .4s var(--spring) both; }
.pomo.running.work { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pomo-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-2); }
.pomo-head span { display: flex; align-items: center; gap: 7px; }
.pomo-phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; margin: 10px 0 6px; border-radius: 11px; background: var(--bg-2); }
.pomo-phases button { border: 0; background: none; padding: 6px 4px; border-radius: 8px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.pomo-phases button.active { background: var(--surface-3); color: var(--text); }
.pomo-dial { position: relative; width: 150px; height: 150px; margin: 8px auto; }
.pomo-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-dial circle { fill: none; }
.pomo.short .ring-fg, .pomo.long .ring-fg { stroke: var(--ok); }
.pomo-time { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pomo-time b { font: 400 40px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pomo-time span { margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.pomo.running .pomo-time b { animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .75; } }
.pomo-ctrl { display: flex; align-items: center; justify-content: center; gap: 14px; }
.pomo-main { width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 22px; transition: transform .2s var(--spring); box-shadow: 0 10px 24px -10px var(--accent-glow); }
.pomo-main:hover { transform: scale(1.08); }
.pomo-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pomo-foot .i { color: var(--warn); }

/* ---------- Notifications v3 ------------------------------------------------ */
.toast { position: relative; overflow: hidden; max-width: min(460px, calc(100vw - 32px)); pointer-events: auto; animation: toast-in .45s var(--spring) both; }
.toast span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--accent); }
.toast .i { color: var(--accent); }
.toast.ok .i { color: var(--ok); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); opacity: .5; transform-origin: left; animation: toast-bar linear both; }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 130; pointer-events: none; }

/* ---------- Messagerie ------------------------------------------------------ */
.main-chat { max-width: none; padding: 0; }
.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100vh; overflow: hidden; }
.chat.has-info { grid-template-columns: 340px minmax(0, 1fr) 320px; }
.chat-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .012), transparent 40%); }
.cl-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 12px; }
.cl-title { margin: 0; font: 400 32px/1 var(--font-display); }
.cl-search { display: flex; align-items: center; gap: 10px; margin: 0 16px; padding: 10px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text-3); }
.cl-search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.cl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 14px; }
.cl-filters { display: flex; gap: 6px; padding: 12px 16px 8px; overflow-x: auto; }
.cl-filters button { border: 1px solid var(--line); background: none; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; transition: .2s; }
.cl-filters button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.cl-items { flex: 1; overflow-y: auto; padding: 4px 8px 20px; }
.cl-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 14px; background: none; text-align: left; color: var(--text); transition: background .15s, transform .15s; }
.cl-items.animate .cl-item { animation: fade-up .35s var(--ease) both; }
.cl-item:hover { background: var(--surface); }
.cl-item.active { background: var(--surface-2); }
.cl-item.is-class { background: linear-gradient(100deg, var(--accent-soft), transparent 70%); }
.cl-item.is-class.active { background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 20%, transparent), var(--surface-2) 70%); }
.cl-item .av { width: 46px; height: 46px; }
.cl-main { flex: 1; min-width: 0; }
.cl-top { display: flex; align-items: baseline; gap: 8px; }
.cl-top b { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-top time { font-size: 11.5px; color: var(--text-3); flex-shrink: 0; }
.cl-bottom { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.cl-prev { flex: 1; min-width: 0; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-prev mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; }
.cl-item.unread .cl-prev { color: var(--text); }
.cl-item.unread .cl-top time { color: var(--accent); }
.cl-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--accent-ink); animation: pop-spring .4s var(--spring); }
.cl-badge.soft { background: var(--surface-3); color: var(--text-2); }
.cl-at { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 11px; }
.cl-pin, .cl-muted { color: var(--text-3); font-size: 13px; display: inline-flex; }
/* --- Les flammes : le compteur d'entraide entre deux eleves --------------- */
.flame { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; flex: 0 0 auto;
  color: #ff8a3d; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.flame svg { width: 15px; height: 15px; }
.flame b { font: inherit; }
.flame.risk { color: var(--text-3); }
.flame.risk svg { animation: flame-beat 1.8s ease-in-out infinite; }
@keyframes flame-beat { 0%, 100% { opacity: .45; transform: none; } 50% { opacity: 1; transform: scale(1.14); } }
.cr-name .flame { vertical-align: -2px; }

.ci-flame { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); text-align: left; }
.ci-flame .cif-n { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  font: 800 17px/1 var(--font-ui); color: var(--text-3); font-variant-numeric: tabular-nums; }
.ci-flame .cif-n svg { width: 22px; height: 22px; }
.ci-flame .cif-t { font: 400 12.5px/1.4 var(--font-ui); color: var(--text-2); }
.ci-flame.lit { border-color: rgba(255, 138, 61, .45); background: linear-gradient(180deg, rgba(255, 138, 61, .13), transparent); }
.ci-flame.lit .cif-n { color: #ff8a3d; }
.ci-flame.risk .cif-n svg { animation: flame-beat 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .flame.risk svg, .ci-flame.risk .cif-n svg { animation: none; } }

.cl-sep { padding: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.cl-empty { padding: 20px 12px; color: var(--text-3); font-size: 13.5px; text-align: center; }
.online-txt { color: var(--ok); }
.typing-txt { color: var(--accent); }

.chat-room { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: radial-gradient(900px 500px at 70% 0%, rgba(255, 255, 255, .025), transparent 60%),
              repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, .018) 31px 32px); }
.cr-loading { display: grid; place-items: center; flex: 1; font-size: 26px; color: var(--accent); padding: 30px; }
.cr-empty { margin: auto; max-width: 400px; padding: 30px; text-align: center; animation: fade-up .5s var(--ease) both; }
.cr-empty-art { width: 96px; height: 96px; margin: 0 auto 20px; border-radius: 30px; display: grid; place-items: center; font-size: 44px; color: var(--accent); background: var(--accent-soft); animation: float 4s ease-in-out infinite; }
.cr-empty p { margin: 10px 0 20px; }
.cr-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(20, 20, 21, .75); backdrop-filter: blur(12px); z-index: 2; }
.cr-back { display: none; }
.cr-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 4px; border-radius: 12px; text-align: left; color: var(--text); }
.cr-who:hover { background: var(--surface); }
.cr-name { min-width: 0; }
.cr-name b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-name small { display: block; font-size: 12.5px; color: var(--text-3); }
.cr-actions { display: flex; gap: 2px; }
.btn-icon.is-on { color: var(--accent); background: var(--accent-soft); }
.cr-pinbar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); animation: fade-in .3s; }
.pin-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; color: var(--text); padding: 2px; }
.pin-main > .i { color: var(--accent); transform: rotate(35deg); }
.pin-main span span { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-main b { font-size: 12px; color: var(--accent); }
.cr-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 8px; scroll-behavior: auto; }
.cr-start { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 0 18px; text-align: center; color: var(--text-3); font-size: 13px; }
.cr-start b { color: var(--text); font: 400 24px var(--font-display); margin-top: 6px; }
.cr-day { display: flex; justify-content: center; margin: 16px 0 10px; }
.cr-day span { padding: 4px 12px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: rgba(35, 35, 39, .9); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.cr-sys { display: flex; justify-content: center; margin: 10px 0; }
.cr-sys span { padding: 5px 12px; border-radius: 10px; font-size: 12px; color: var(--text-3); background: var(--surface); }

.msg { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.msg.first { margin-top: 10px; }
.msg.me { flex-direction: row-reverse; }
.msg-av { width: 30px; flex-shrink: 0; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; max-width: min(560px, 78%); min-width: 0; }
.msg.me .msg-body { align-items: flex-end; }
.msg-author { border: 0; background: none; padding: 0 12px 3px; font-size: 12px; font-weight: 700; }
.bubble { position: relative; max-width: 100%; padding: 8px 12px 6px; border-radius: 18px; background: var(--surface-2); color: var(--text); font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset; }
.msg.them.first .bubble { border-top-left-radius: 18px; }
.msg.them:not(.last) .bubble { border-bottom-left-radius: 6px; }
.msg.them:not(.first) .bubble { border-top-left-radius: 6px; }
.msg.me .bubble { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.msg.me:not(.last) .bubble { border-bottom-right-radius: 6px; }
.msg.me:not(.first) .bubble { border-top-right-radius: 6px; }
.msg.at-me .bubble { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.msg.new { animation: msg-in .38s var(--spring) both; }
.msg.me.new { transform-origin: bottom right; }
.msg.them.new { transform-origin: bottom left; }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px) scale(.9); } to { opacity: 1; transform: none; } }
.msg.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.msg-text { white-space: pre-wrap; }
.msg-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg.me .msg-text a { color: var(--text); }
.mention { color: var(--accent); font-weight: 600; }
.mention.me { background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 0 3px; }
.msg-meta { display: inline-flex; align-items: center; gap: 4px; float: right; margin: 6px 0 -2px 10px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.msg-meta .i { font-size: 12px; }
.rcpt { display: inline-flex; align-items: center; gap: 2px; }
.rcpt.seen { color: var(--accent); }
.deleted { display: inline-flex; align-items: center; gap: 6px; font-style: italic; color: var(--text-3); }
.msg.k-deleted .bubble { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.msg-reply { display: block; max-width: 100%; margin-bottom: 3px; padding: 6px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 10px; background: rgba(255, 255, 255, .04); text-align: left; color: var(--text-2); font-size: 12.5px; }
.msg-reply b { display: block; color: var(--accent); font-size: 12px; }
.msg-reply span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-img { display: block; border: 0; padding: 0; margin: -4px -8px 4px; background: none; border-radius: 14px; overflow: hidden; }
.msg-img img { max-width: min(320px, 100%); max-height: 340px; object-fit: cover; border-radius: 14px; transition: transform .3s var(--ease); }
.msg-img:hover img { transform: scale(1.02); }
.msg.k-image .msg-meta { position: relative; }
.course-card { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 250px; margin: 2px 0 4px; padding: 10px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 12%, var(--bg-2)); text-align: left; color: var(--text); transition: transform .25s var(--spring); }
.course-card:hover { transform: translateY(-2px); }
.course-card.gone { opacity: .6; }
.cc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--c); color: #fff; font-size: 19px; }
.cc-txt { flex: 1; min-width: 0; }
.cc-txt small { display: block; font-size: 11.5px; color: var(--text-3); }
.cc-txt b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-go { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--c); white-space: nowrap; filter: brightness(1.5); }
.poll { min-width: 260px; padding: 2px 0 4px; }
.poll-q { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 8px; }
.poll-q .i { color: var(--accent); }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); text-align: left; overflow: hidden; }
.poll-opt:disabled { cursor: default; }
.po-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .6s var(--ease); }
.poll-opt.voted { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.poll-opt.voted .po-bar { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.po-check { position: relative; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }
.poll-opt.voted .po-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.po-txt { position: relative; flex: 1; font-size: 13.5px; }
.po-pct { position: relative; font-size: 12px; font-weight: 700; color: var(--text-2); }
.poll-foot { margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 8px 0; position: relative; z-index: 1; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-size: 12px; transition: transform .2s var(--spring); }
.react:hover { transform: scale(1.08); }
.react.mine { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.react b { font-weight: 700; }
.reacts.bump .react { animation: pop-spring .35s var(--spring); }
.msg-tools { display: flex; gap: 0; opacity: 0; transform: translateY(4px); transition: .15s; align-self: center; }
.msg-tools .btn-icon { width: 30px; height: 30px; }
.msg:hover .msg-tools { opacity: 1; transform: none; }
.react-bar, .react-menu { display: flex; gap: 2px; padding: 4px; }
.react-bar { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.react-menu { min-width: 0; border-radius: 99px; }
.react-pick { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: 18px; display: grid; place-items: center; transition: transform .2s var(--spring), background .15s; }
.react-pick:hover { transform: scale(1.25) translateY(-2px); background: var(--surface-3); color: var(--accent); }
.typing { display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 4px 38px; padding: 8px 12px; border-radius: 18px; background: var(--surface-2); animation: msg-in .3s var(--spring); }
.typing .av { margin-right: -6px; box-shadow: 0 0 0 2px var(--surface-2); }
.dots { display: inline-flex; gap: 3px; margin-left: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.cr-down { position: absolute; right: 22px; bottom: 90px; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .8); animation: pop-spring .3s var(--spring); }
.cr-down span:empty { display: none; }
.cr-down span { font-size: 12px; font-weight: 700; color: var(--accent); }
.cr-drop { position: absolute; inset: 10px; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-radius: 20px; border: 2px dashed var(--accent); background: rgba(20, 20, 21, .85); color: var(--text); font-size: 15px; }
.cr-drop .i { font-size: 36px; color: var(--accent); }
.chat-room.dragging .cr-drop { display: flex; animation: fade-in .2s; }

.composer { position: relative; padding: 10px 16px 14px; border-top: 1px solid var(--line); background: rgba(20, 20, 21, .8); backdrop-filter: blur(12px); }
.composer.blocked { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.cp-row { display: flex; align-items: flex-end; gap: 8px; }
.cp-row textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14.5px; line-height: 1.45; resize: none; outline: none; transition: border-color .2s; }
.cp-row textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.cp-attach { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); }
.cp-attach:hover .i { transform: rotate(90deg); }
.cp-attach .i { transition: transform .3s var(--spring); }
.cp-send { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 18px; transition: transform .25s var(--spring), opacity .2s; box-shadow: 0 8px 20px -8px var(--accent-glow); }
.cp-send:disabled { opacity: .35; transform: scale(.9); box-shadow: none; }
.cp-send:not(:disabled):hover { transform: scale(1.08) rotate(-8deg); }
.cp-context { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 8px 10px; border-radius: 12px; border-left: 3px solid var(--accent); background: var(--surface); font-size: 13px; animation: fade-up .25s var(--ease); }
.cp-context > .i { color: var(--accent); }
.cp-context > span { flex: 1; min-width: 0; }
.cp-context b { display: block; font-size: 12px; color: var(--accent); }
.cp-context span span { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-mentions { position: absolute; left: 60px; bottom: calc(100% - 4px); width: 280px; padding: 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .8); animation: pop-spring .25s var(--spring); }
.mention-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 9px; background: none; color: var(--text); text-align: left; font-size: 13.5px; }
.mention-item span { color: var(--text-3); font-size: 12px; }
.mention-item.sel, .mention-item:hover { background: var(--surface-3); }

.chat-info { display: none; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg-2); }
.chat.has-info .chat-info { display: flex; animation: slide-in .35s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.ci-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.ci-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 16px 14px; text-align: center; }
.ci-hero h3 { margin: 10px 0 0; font: 400 24px var(--font-display); }
.ci-hero p { margin: 0; }
.ci-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.ci-tabs { padding: 4px 12px 8px; }
.ci-body { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.ci-foot { padding: 12px; border-top: 1px solid var(--line); }
.ci-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ci-grid button { border: 0; padding: 0; background: none; aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.ci-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.ci-grid button:hover img { transform: scale(1.06); }
.ci-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; text-decoration: none; }
.ci-row:hover { background: var(--surface); }
.ci-row > .i { color: var(--text-3); flex-shrink: 0; }
.ci-row > span { min-width: 0; flex: 1; }
.ci-row b { display: block; font-size: 13px; }
.ci-row span span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-body .course-card { min-width: 0; margin-bottom: 8px; }

.people { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; }
.person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 8px; border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.person:hover { background: var(--surface-2); }
.person[hidden] { display: none; }
.person input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 14px; }
.person .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 4px 0 8px; }
.profile-card h3 { margin: 12px 0 0; font: 400 30px var(--font-display); }
.pc-status { display: flex; align-items: center; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.pc-bio { margin: 12px 0 4px; font: 400 15px/1.45 var(--font-note); color: var(--text-2); }
.share-preview { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 14px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.share-preview > .i { font-size: 22px; color: var(--c); filter: brightness(1.4); }
.share-preview b { display: block; } .share-preview small { color: var(--text-3); }
.poll-row .input { padding: 9px 12px; }
.lightbox { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: 30px; background: rgba(5, 5, 6, .92); animation: fade-in .2s both; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; animation: pop-spring .35s var(--spring); box-shadow: 0 40px 80px -20px #000; }
.lightbox .btn-icon { position: absolute; top: 16px; right: 16px; background: var(--surface-2); }
.chat-guest { max-width: 900px; }

/* ---------- Cahier : ouverture -------------------------------------------
   L'animation d'arrivée est portée par .nb-tilt (voir plus haut) : elle a
   besoin de la perspective de .nb-view, que .nb-book n'avait pas. */

/* ---------- Impression (bouton « Imprimer / PDF ») ------------------------ */
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body::before, .sidebar, .topbar, .tabbar, .doc-tools, .sticky-note, .back, .read-progress, #pomo-root, #tts-root, #toast-root, .eyebrow .dot { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .reader-grid { display: block; }
  .display, .article, .article h1, .article h2, .article h3, .article strong { color: #000 !important; }
  .article strong { background: #fff3a0 !important; }
  .display .w { animation: none !important; opacity: 1 !important; }
  .gallery img { max-height: 260px; }
}

/* ---------- Mobile v3 ------------------------------------------------------ */
@media (max-width: 1100px) {
  .reader-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky-note { position: relative; top: 0; transform: none; }
  .chat.has-info { grid-template-columns: 300px minmax(0, 1fr) 300px; }
}
@media (max-width: 900px) {
  .topbar .btn-icon { margin-left: auto; }
  .topbar .seg { margin-left: 0; }
  .qcard { flex-basis: 210px; }
  .profile-edit { grid-template-columns: minmax(0, 1fr); }
  .choice-cards, .mode-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .daily-hero { flex-wrap: wrap; gap: 16px; padding: 18px; }
  .prog-grid { grid-template-columns: minmax(0, 1fr); }
  .m-row { grid-template-columns: 120px minmax(0, 1fr) 44px; font-size: 13px; }
  .qcm { grid-template-columns: minmax(0, 1fr); }
  #pomo-root { right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* messagerie plein écran */
  .main-chat { padding: 0; }
  .chat, .chat.has-info { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 60px - 68px - env(safe-area-inset-bottom)); }
  .chat.has-open .chat-list { display: none; }
  .chat:not(.has-open) .chat-room { display: none; }
  body.chat-open.in-chat .tabbar, body.chat-open.in-chat .topbar { display: none; }
  body.chat-open.in-chat .chat { height: 100dvh; }
  .chat.has-info .chat-info { position: fixed; inset: 0; z-index: 60; }
  .cr-back { display: grid; }
  .cr-scroll { padding: 12px 10px 6px; }
  .msg-body { max-width: 84%; }
  .msg-tools { display: none; }
  .cr-down { bottom: 84px; right: 14px; }
  .cp-mentions { left: 10px; width: calc(100% - 20px); }
  .course-card { min-width: 0; }
}

/* pastille « non lus » en coin de l'icône (barre du bas) */
.tab .nav-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px; margin: 0; }
.tabs, .cl-filters, .qrow { scrollbar-width: none; }
.tabs::-webkit-scrollbar, .cl-filters::-webkit-scrollbar { display: none; }
@media (max-width: 900px) { .tools-sep { display: none; } }

/* ==========================================================================
   v4 — Téléphone d'abord (la grande majorité des utilisations)
   ========================================================================== */
* { -webkit-tap-highlight-color: transparent; }
button, a, [role=button], label, .tchip { touch-action: manipulation; }

/* ==========================================================================
   Les formulaires en plusieurs écrans (v14)
   --------------------------------------------------------------------------
   Une étape à la fois, la barre de progression collée en haut du formulaire,
   et des boutons assez gros pour le pouce. Tout est pensé pour 320 px d'abord.
   ========================================================================== */
.wiz-modal .modal-body { padding-top: 0; }
.wiz-rail {
  position: sticky; top: 0; z-index: 3; display: grid; gap: 9px;
  padding: 13px 0 12px; margin-bottom: 4px;
  background: linear-gradient(var(--surface) 72%, transparent);
}
.wiz-bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wiz-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .32s var(--ease); }
.wiz-dots { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wiz-dot {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-3);
  font: 700 12px var(--font-ui); transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.wiz-dot:not(:disabled) { cursor: pointer; }
.wiz-dot:not(:disabled):hover { border-color: var(--accent); color: var(--text); }
.wiz-dot.done { background: var(--accent-soft); border-color: rgba(242, 227, 92, .4); color: var(--accent); }
.wiz-dot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.1); }
.wiz-dot .i { width: 13px; height: 13px; }
.wiz-count { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.wiz-head { display: flex; gap: 12px; align-items: flex-start; margin: 6px 0 16px; }
.wiz-ic {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.wiz-ic .i { font-size: 19px; }
.wiz-head h3 { margin: 0; font: 400 21px/1.2 var(--font-display); }
.wiz-head p { margin: 5px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.wiz-pane[hidden] { display: none; }
.wiz-pane { animation: wiz-in .26s var(--ease) both; }
@keyframes wiz-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
:root.reduce-motion .wiz-pane { animation: none; }

/* la relecture de la dernière étape */
.wiz-rc {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.wiz-rc:last-child { border-bottom: 0; }
.wiz-rc > span { display: inline-flex; align-items: center; gap: 7px; flex: none; font-size: 13px; color: var(--text-3); }
.wiz-rc > b { min-width: 0; text-align: right; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.wiz-rc .i { font-size: 14px; }

/* des cartes à toucher plutôt qu'une liste déroulante */
.wiz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.wiz-card input { position: absolute; opacity: 0; pointer-events: none; }
.wiz-card.wide { grid-column: 1 / -1; }
.wiz-card > span {
  display: flex; flex-direction: column; gap: 3px; height: 100%; min-height: 62px;
  padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--bg-2); cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
}
.wiz-card > span .i { font-size: 19px; color: var(--text-3); margin-bottom: 3px; }
.wiz-card > span b { font-size: 14.5px; }
.wiz-card > span small { font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.wiz-card > span:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.wiz-card input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.wiz-card input:checked + span .i, .wiz-card input:checked + span b { color: var(--accent); }
.wiz-card input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* un aperçu en direct dans l'étape, encadré comme une page de cahier */
.wiz-peek {
  margin-top: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px dashed var(--line-strong); background: var(--surface-2); max-height: 320px; overflow: auto;
}
.wiz-peek:empty { display: none; }
.wiz-note { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.wiz-sep { height: 1px; margin: 20px 0; background: var(--line); }

/* la jauge de mot de passe (v16) */
.pw-meter { display: grid; grid-auto-flow: column; gap: 4px; margin: 8px 0 6px; }
.pw-meter i { height: 4px; border-radius: 99px; background: var(--surface-3); transition: background .2s; }
.pw-meter[data-n="1"] i.on { background: var(--danger); }
.pw-meter[data-n="2"] i.on { background: var(--warn); }
.pw-meter[data-n="3"] i.on { background: #8ec07c; }
.pw-meter[data-n="4"] i.on { background: var(--ok); }
.hint.pw-bad { color: var(--warn); }
.hint.pw-ok { color: var(--ok); }

/* ==========================================================================
   La vidéothèque (v15)
   --------------------------------------------------------------------------
   Une série = une page de Lumni importée. Les vignettes défilent à l'horizontale
   sur téléphone : on en voit plusieurs sans faire une page de dix kilomètres.
   ========================================================================== */
.vid-sets { display: grid; gap: 26px; }
.vid-set { --c: var(--accent); }
.vid-set-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.vid-set-ic {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
}
.vid-set-ic .i { font-size: 19px; }
.vid-set-txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.vid-set-txt b { font: 400 19px/1.2 var(--font-display); }
.vid-set-txt small { font-size: 12.5px; color: var(--text-3); }
.vid-note { color: var(--text-2) !important; font-style: italic; }
.vid-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(172px, 1fr);
  gap: 11px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.vid-card { display: grid; gap: 5px; min-width: 0; scroll-snap-align: start; color: var(--text); }
.vid-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 12px;
  overflow: hidden; background: var(--surface-3); color: var(--text-3);
}
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; transition: scale .35s var(--ease), opacity .2s; }
.vid-card:hover .vid-thumb img { scale: 1.05; opacity: .85; }
.vid-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.vid-play .i { width: 34px; height: 34px; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .7)); }
.vid-time {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .72); color: #fff; font: 600 11px var(--font-ui);
}
.vid-card b { font-size: 13.5px; line-height: 1.3; }
.vid-card small { font-size: 11.5px; color: var(--text-3); }
.vid-set .or-src { margin-top: 10px !important; }
@media (max-width: 420px) {
  .vid-row { grid-auto-columns: minmax(148px, 1fr); }
  .vid-set-txt b { font-size: 17px; }
}

/* un cahier réservé aux élèves connectés : un cadenas, et la couverture pâlit */
.cahier-locked { opacity: .72; }
.cahier-locked .cahier-name { opacity: .85; }
.cahier-lock {
  position: absolute; top: 10px; right: 10px; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff;
}
.cahier-lock .i { width: 13px; height: 13px; }

/* ==========================================================================
   Orientation, stage de 3e et métiers (v14)
   ========================================================================== */
.or-prog { display: grid; gap: 6px; margin: 4px 0 18px; }
.or-tabs { margin-bottom: 20px; }

/* --- le calendrier --- */
.or-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: or; }
.or-step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.or-step:last-child { border-bottom: 0; }
.or-tick {
  display: grid; place-items: center; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: transparent; color: transparent; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .15s;
}
.or-tick:hover { border-color: var(--accent); color: var(--text-3); }
.or-tick .i { width: 15px; height: 15px; }
.or-step.done .or-tick { background: var(--ok); border-color: var(--ok); color: #0d1a12; }
.or-step.done .or-tick:active { transform: scale(.9); }
.or-step.done .or-body { opacity: .6; }
.or-step.done h3 { text-decoration: line-through; text-decoration-color: var(--text-3); }
.or-when { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.or-when .i { width: 14px; height: 14px; }
.or-step h3 { margin: 5px 0 4px; font: 400 18px/1.25 var(--font-display); }
.or-step p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.or-todo { margin: 9px 0 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; color: var(--text-3); }

/* --- les fiches --- */
.or-cards, .or-list { display: grid; gap: 9px; }
.or-card, .or-fam {
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  overflow: hidden; transition: border-color .16s;
}
.or-card[open], .or-fam[open] { border-color: var(--line-strong); }
.or-card > summary, .or-fam > summary {
  display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none;
}
.or-card > summary::-webkit-details-marker, .or-fam > summary::-webkit-details-marker { display: none; }
.or-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent); }
.or-ic .i { font-size: 18px; }
.or-card summary > span:nth-child(2), .or-fam summary > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; flex: 1; }
.or-card summary b, .or-fam summary b { font-size: 15px; }
.or-card summary small, .or-fam summary small { font-size: 12.5px; color: var(--text-3); }
.or-card[open] > summary .aide-mark, .or-fam[open] > summary .aide-mark { transform: rotate(180deg); }
.or-text { padding: 0 14px 14px; }
.or-text p { margin: 0 0 11px; font-size: 14.5px; line-height: 1.65; color: var(--text-2); }
.or-src {
  margin: 14px 0 0 !important; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12px !important; line-height: 1.55; color: var(--text-3) !important;
}
.or-src .i { width: 13px; height: 13px; vertical-align: -2px; }
.or-src a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.or-src a:hover { color: var(--accent); }

/* --- les modèles --- */
.or-model { margin: 12px 0; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; }
.or-model-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 11px 13px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.or-model-head .btn { margin-left: auto; }
.or-pre {
  margin: 0; padding: 14px; max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 400 13.5px/1.7 var(--font-note); color: var(--text-2); background: var(--surface);
}
.or-tips { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.or-tips li { display: flex; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.or-tips .i { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.or-plan { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.or-plan li b { display: block; font-size: 14.5px; }
.or-plan li span { font-size: 13.5px; line-height: 1.55; color: var(--text-3); }

/* --- mes pistes --- */
.or-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: start; gap: 11px;
  padding: 13px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
}
.or-item-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--surface-3); color: var(--text-3); }
.or-rank { font: 700 14px var(--font-ui); color: var(--accent); }
.or-item-txt { display: grid; gap: 3px; min-width: 0; }
.or-item-txt b { font-size: 14.5px; }
.or-item-txt small { font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.or-love { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 1px 8px;
  border-radius: 99px; background: var(--accent-soft); color: var(--accent);
  font: 600 11px/1.7 var(--font-ui); font-style: normal; }
.or-love .i { width: 11px; height: 11px; }
.or-link { display: inline-flex; align-items: center; gap: 4px; width: fit-content; font-size: 12.5px; color: var(--text-2); }
.or-link .i { width: 13px; height: 13px; }
.or-link:hover { color: var(--accent); }

/* --- les vidéos métiers --- */
.or-vids { display: grid; gap: 6px; padding: 0 12px 12px; }
.or-vid { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px;
  background: var(--surface-2); color: var(--text); transition: background .15s; }
.or-vid:hover { background: var(--surface-3); }
.or-vid span { display: grid; gap: 1px; min-width: 0; flex: 1; }
.or-vid b { font-size: 13.5px; }
.or-vid small { font-size: 11.5px; color: var(--text-3); }
.or-vid-ic { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: #0b2d4d; color: #fff; }
.or-vid-ic .i { width: 14px; height: 14px; }
.or-vid > .i:last-child { flex: none; color: var(--text-3); }

@media (max-width: 560px) {
  .or-step { gap: 10px; padding: 14px 0; }
  .or-step h3 { font-size: 16.5px; }
  .or-item { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 9px; padding: 11px; }
  .or-model-head .btn { margin-left: 0; width: 100%; justify-content: center; }
}

/* ==========================================================================
   Les appels vocaux (v14)
   --------------------------------------------------------------------------
   Un panneau posé en bas de l'écran, au-dessus de la barre d'onglets : il
   suit la personne de page en page, et le bouton « raccrocher » est TOUJOURS
   visible, même réduit.
   ========================================================================== */
#call-root { position: fixed; inset: auto 0 0 0; z-index: 128; display: grid; justify-items: center; pointer-events: none; }
#call-root > * { pointer-events: auto; }
.call-panel, .call-ring {
  width: min(460px, calc(100vw - 20px));
  margin: 0 10px calc(var(--tabbar-h, 62px) + 10px + env(safe-area-inset-bottom));
  padding: 14px 16px 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 0 22px 46px -18px rgba(0, 0, 0, .85);
  animation: call-in .26s var(--ease) both;
}
@keyframes call-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
:root.reduce-motion .call-panel, :root.reduce-motion .call-ring { animation: none; }
.call-panel.heavy { border-color: color-mix(in srgb, var(--warn) 55%, var(--line-strong)); }

.call-top { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.call-top b { font-variant-numeric: tabular-nums; }
.call-top .btn-icon { margin-left: auto; }
.call-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: call-pulse 1.6s infinite; }
@keyframes call-pulse { 50% { opacity: .25; } }
:root.reduce-motion .call-dot { animation: none; }

.call-warn {
  display: flex; gap: 8px; margin-top: 10px; padding: 9px 11px; border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 13%, transparent); font-size: 12.5px; line-height: 1.45; color: var(--text-2);
}
.call-warn .i { flex: none; color: var(--warn); }

.call-people { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 14px 0 4px; }
.call-face { display: grid; justify-items: center; gap: 3px; width: 74px; text-align: center; }
.call-face b { font-size: 12.5px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-face small { font-size: 10.5px; color: var(--text-3); }
.call-av { position: relative; display: block; border-radius: 50%; outline: 2px solid transparent; transition: outline-color .14s, box-shadow .14s; }
.call-face.talking .call-av { outline-color: var(--ok); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 22%, transparent); }
.call-face.ringing .call-av { animation: call-pulse 1.1s infinite; }
.call-mute {
  position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); color: var(--text-3);
  border: 1px solid var(--surface);
}
.call-mute .i { width: 11px; height: 11px; }

.call-bar { display: flex; gap: 9px; margin-top: 12px; }
.call-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 54px;
  padding: 8px 10px; border-radius: 15px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 11.5px; font-weight: 600; transition: background .16s, border-color .16s, transform .12s;
}
.call-btn .i { font-size: 19px; }
.call-btn:hover { background: var(--surface-3); }
.call-btn:active { transform: scale(.97); }
.call-btn.off { background: var(--accent-soft); border-color: rgba(242, 227, 92, .4); color: var(--accent); }
.call-btn.hang { background: color-mix(in srgb, var(--danger) 85%, #000); border-color: transparent; color: #fff; }
.call-btn.take { background: var(--ok); border-color: transparent; color: #0d1a12; }

/* réduit : on ne garde que la durée et « raccrocher » */
.call-panel.small .call-people, .call-panel.small .call-warn { display: none; }
.call-panel.small .call-bar { margin-top: 10px; }

.call-ring { display: grid; justify-items: center; gap: 2px; text-align: center; padding-top: 20px; }
.call-ring b { font-size: 17px; }
.call-ring small { font-size: 12.5px; color: var(--text-3); }
.call-ring .call-bar { width: 100%; }
.call-go.btn-icon { color: var(--ok); }

/* réduit au maximum : une pastille dans la barre du haut, à côté du minuteur */
.call-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 14%, var(--surface-2)); color: var(--text);
  font: 600 12.5px var(--font-ui); cursor: pointer; white-space: nowrap;
  transition: background .16s, transform .12s;
}
.call-pill:hover { background: color-mix(in srgb, var(--ok) 22%, var(--surface-2)); }
.call-pill:active { transform: scale(.96); }
.call-pill .i { width: 14px; height: 14px; }
.call-pill b { font-variant-numeric: tabular-nums; }
.call-pill.muted { border-color: var(--line-strong); background: var(--surface-3); }
.call-pill.muted .call-dot { background: var(--text-3); animation: none; }
.call-pill .call-dot { width: 7px; height: 7px; }
#tb-call:empty, #sb-call:empty { display: none; }
#sb-call { padding: 0 2px 4px; }
#sb-call .call-pill { width: 100%; justify-content: center; }
/* dans une conversation, la barre d'onglets laisse la place au champ de saisie :
   le panneau doit monter d'autant, sinon il mord dessus */
body.in-chat .call-panel, body.in-chat .call-ring { margin-bottom: calc(100px + env(safe-area-inset-bottom)); }

/* la trace laissée dans la conversation */
.call-log { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.call-log > .i { flex: none; color: var(--text-3); }
.call-log.missed > .i { color: var(--danger); }
.call-log span { display: grid; min-width: 0; }
.call-log small { font-size: 11.5px; color: var(--text-3); }
.call-log .btn { margin-left: auto; flex: none; }
@media (max-width: 360px) {
  .call-face { width: 62px; }
  .call-people { gap: 9px; }
}

/* ==========================================================================
   La page d'aide (v14)
   --------------------------------------------------------------------------
   Les visites guidées sont passées de 16 et 9 écrans à 5 et 3 ; tout le détail
   a atterri ici, replié, avec une recherche.
   ========================================================================== */
.aide-search { position: relative; margin: 4px 0 14px; }
.aide-search > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.aide-search .input { padding-left: 40px; }
.aide-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.aide-sec { margin-bottom: 30px; }
.aide-sec .row-title { margin: 0 0 12px; }
.aide-list { display: grid; }
.aide-q { border-bottom: 1px solid var(--line); }
.aide-q:first-child { border-top: 1px solid var(--line); }
.aide-q > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 2px; cursor: pointer;
  font-size: 15px; font-weight: 600; list-style: none;
}
.aide-q > summary::-webkit-details-marker { display: none; }
.aide-q > summary:hover { color: var(--accent); }
.aide-mark { margin-left: auto; flex: none; color: var(--text-3); transition: transform .22s var(--ease); }
.aide-q[open] > summary .aide-mark { transform: rotate(180deg); }
.aide-a {
  padding: 0 2px 16px; font-size: 14.5px; line-height: 1.65; color: var(--text-2);
  animation: aide-in .22s var(--ease) both;
}
.aide-a code {
  padding: 1px 5px; border-radius: 5px; background: var(--surface-3);
  font: 500 13px var(--font-mono, ui-monospace, monospace); color: var(--text);
}
@keyframes aide-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
:root.reduce-motion .aide-a { animation: none; }
@media (max-width: 560px) {
  .aide-q > summary { font-size: 14.5px; padding: 13px 2px; }
  .aide-tools .btn { flex: 1 1 auto; justify-content: center; }
}

/* les trois façons de remplir un cours : écrire, photographier, importer */
.ed-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; margin-bottom: 16px; }
.ed-way {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 13px 14px;
  border-radius: 14px; border: 1px dashed var(--line-strong); background: var(--surface-2);
  color: var(--text); cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
}
.ed-way .i { font-size: 19px; color: var(--text-3); margin-bottom: 3px; }
.ed-way b { font-size: 14.5px; }
.ed-way small { font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.ed-way:hover { transform: translateY(-1px); border-color: var(--line-strong); background: var(--surface-3); }
.ed-way.on { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.ed-way.on .i, .ed-way.on b { color: var(--accent); }

/* ---------- Importer un dossier Lumni (v14) -------------------------------- */
.lum-go { display: flex; gap: 8px; }
.lum-go .input { flex: 1; min-width: 0; }
.lum-go .btn { flex: none; }
.lum-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 10px; font-size: 15px; }
.lum-head .i { color: var(--accent); }
.lum-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lum-tools .spacer { flex: 1; }
.lum-list { display: grid; gap: 7px; max-height: 340px; overflow-y: auto; padding-right: 3px; }
.lum-item {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 11px;
  padding: 7px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  transition: border-color .16s, background .16s;
}
.lum-item input { position: absolute; opacity: 0; pointer-events: none; }
.lum-item:hover { border-color: var(--line-strong); }
.lum-thumb {
  display: grid; place-items: center; width: 74px; aspect-ratio: 16 / 10; border-radius: 8px;
  overflow: hidden; background: var(--surface-3); color: var(--text-3);
}
.lum-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lum-txt { min-width: 0; display: grid; gap: 2px; }
.lum-txt b { font-size: 13.5px; line-height: 1.3; }
.lum-txt small { font-size: 11.5px; color: var(--text-3); }
.lum-check {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: transparent; transition: .16s;
}
.lum-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.lum-item:has(input:checked) .lum-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lum-check .i { width: 14px; height: 14px; }
@media (max-width: 420px) {
  .lum-go { flex-wrap: wrap; }
  .lum-go .btn { width: 100%; justify-content: center; }
  .lum-item { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .lum-thumb { width: 58px; }
}
/* un bouton « hidden » reste caché, même si une règle lui donne un display */
.wiz-modal [hidden] { display: none !important; }

@media (max-width: 560px) {
  .wiz-head h3 { font-size: 19px; }
  .wiz-ic { width: 34px; height: 34px; }
  .wiz-modal .modal-foot { flex-wrap: wrap; }
  .wiz-modal .modal-foot .btn:not([hidden]) { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .wiz-modal .modal-foot #wiz-back { flex: 0 0 auto; }
  .wiz-cards { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
}
@media (max-width: 360px) {
  .wiz-cards { grid-template-columns: 1fr; }
  .wiz-count { font-size: 11px; }
  .wiz-dot { width: 24px; height: 24px; }
}

.modal-body, .menu, .palette-list, .cl-items, .cr-scroll, .ci-body, .people, .rev-stage, .qrow, .side-stack { overscroll-behavior: contain; }
.sheet-handle, .focus-pill, .rev-swipe { display: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* bandeau « hors ligne » */
#net-banner {
  position: fixed; z-index: 115; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: 99px;
  background: #3a2a14; border: 1px solid rgba(240, 165, 74, .4); color: #ffcf94; font-size: 13px; font-weight: 600;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .8); animation: toast-in .4s var(--spring) both; transition: opacity .3s;
}
#net-banner.out { opacity: 0; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.steps li + li { margin-top: 6px; }
.steps code.url { color: var(--accent); user-select: all; -webkit-user-select: all; }
.switch-row.off { opacity: .6; cursor: default; }

/* double-tap sur un message : cœur qui éclate */
.heart-burst { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; display: grid; place-items: center;
  color: #ff5c7a; font-size: 42px; pointer-events: none; z-index: 2; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); animation: heart-burst .8s var(--spring) forwards; }
.heart-burst .i { fill: currentColor; }
@keyframes heart-burst { 0% { opacity: 0; transform: scale(0); } 30% { opacity: 1; transform: scale(1.25); } 60% { transform: scale(.95); } 100% { opacity: 0; transform: scale(1.1) translateY(-18px); } }

/* glisser un message vers la droite pour y répondre */
.msg::before {
  content: ''; position: absolute; left: -46px; top: 50%; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%; opacity: 0; transform: scale(.5);
  background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ededee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3Cpath d='m9 17-5-5 5-5'/%3E%3C/svg%3E") center / 18px no-repeat;
  transition: opacity .15s, transform .2s var(--spring), background-color .15s;
}
.msg.swipe-ready::before { opacity: 1; transform: scale(1); background-color: var(--accent); }

/* ---------- Écrans tactiles : pas d'effets de survol « collés » ---------- */
@media (hover: none) {
  .cahier.tilt:hover { transform: none; }
  .qcard:hover, .item:hover, .deck:hover, .mode-card:hover, .badge.on:hover, .course-card:hover, .react:hover, .swatch:hover span,
  .cp-send:not(:disabled):hover, .pomo-main:hover, .deck .btn-play:hover, .qcm-opt:hover:not(:disabled), .react-pick:hover,
  .cp-attach:hover .i, .toc-row:hover .toc-go, .photo:hover img, .ci-grid button:hover img, .msg-img:hover img { transform: none; }
  .qcard:hover { border-color: var(--line); }
  .cahier-shine, .spot::after { display: none; }
  /* retour visuel au toucher */
  .cahier:active { transform: scale(.96) !important; transition-duration: .12s; }
  .qcard:active, .item:active, .deck:active, .toc-row:active, .course-card:active, .mode-card:active, .person:active,
  .cl-item:active, .badge:active, .panel.daily:active, .choice:active span, .swatch:active span { transform: scale(.98); }
  .btn:active, .btn-icon:active, .tab:active, .cp-send:active, .pomo-main:active, .react-pick:active, .focus-pill:active { transform: scale(.94); }
  .cl-item:active, .toc-row:active, .person:active { background: var(--surface); }
  .rev-keys, .palette-foot, .search-btn kbd { display: none !important; }
  .rev-swipe { display: flex; }
  .msg .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .msg { touch-action: pan-y; }
  .msg-tools { display: none !important; }
}

/* ---------- Téléphones --------------------------------------------------- */
@media (max-width: 900px) {
  /* 16 px minimum dans les champs : sinon l'iPhone zoome dès qu'on touche un champ */
  .input, .select, .textarea, .textarea.mono, .cl-search input, .cp-row textarea, .palette-input input,
  .write-row .input, .card-row .input, .app-foot .input, .key-row .input { font-size: 16px; }

  /* barre du haut (encoche comprise) */
  .topbar { height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 8px; }
  .topbar .brand { padding: 0 2px; }
  .topbar .tb-search { margin-left: auto; width: 42px; height: 42px; }
  .topbar .seg { margin-left: 0; }
  .topbar .seg button { min-height: 36px; padding: 8px 9px; font-size: 13px; }
  #tb-focus:empty { display: none; }
  .focus-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 99px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: 600 13px var(--font-ui); font-variant-numeric: tabular-nums;
    animation: pop-spring .35s var(--spring);
  }
  .focus-pill.on { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); color: var(--accent); }
  .focus-pill.on .i { animation: float 2s ease-in-out infinite; }

  /* barre d'onglets (barre d'accueil de l'iPhone comprise) */
  .tabbar { padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tab { min-height: 52px; z-index: 0; }
  .tab.active::before { content: ''; position: absolute; top: 3px; left: 50%; width: 44px; height: 30px; margin-left: -22px; border-radius: 12px; background: var(--accent-soft); z-index: -1; animation: pop-spring .35s var(--spring); }
  body.kb-open .tabbar, body.kb-open #pomo-root, body.kb-open #tts-root { display: none; }

  /* contenu */
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .main.main-chat { padding: 0; }
  .display { font-size: clamp(32px, 9vw, 44px); }
  .page-head { margin-bottom: 22px; }
  .lead { font-size: 14.5px; }
  .h2 { font-size: 24px; }
  .link.back { min-height: 40px; padding: 10px 12px 10px 0; margin: -10px 0 -4px; }
  .btn { height: 44px; }
  .btn-sm { height: 38px; }
  .btn-icon { width: 42px; height: 42px; }
  .head-actions .btn-primary:first-child, .doc-tools .btn-primary:first-child { flex: 1 1 100%; }
  .tools-sep { display: none; }
  .cl-filters button { padding: 8px 14px; font-size: 13px; }
  .tchip { padding: 9px 14px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 34px; }
  .article { font-size: 16px; }
  .reader-grid { gap: 22px; }

  /* accueil : défilements horizontaux bord à bord */
  .hero::before { animation: none; left: -14px; width: calc(100% + 28px); }
  .main-wrap { overflow-x: clip; } /* aucun décor ne doit élargir la page (sinon le téléphone dézoome) */
  .hero-chips { flex-wrap: nowrap; overflow-x: auto; margin: 18px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
  .hero-chips::-webkit-scrollbar { display: none; }
  .hchip { flex-shrink: 0; }
  .qrow { margin: 0 -16px 16px; padding: 4px 16px 12px; scroll-padding: 16px; }
  .qcard { flex-basis: 74%; max-width: 280px; }
  .home-grid { gap: 0; }
  .side-stack { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 24px; padding: 2px 16px 10px; scroll-padding: 16px; scrollbar-width: none; }
  .side-stack::-webkit-scrollbar { display: none; }
  .side-stack > * { flex: 0 0 86%; max-width: 380px; margin-top: 0 !important; scroll-snap-align: start; display: flex; flex-direction: column; justify-content: space-between; }
  .shelf { gap: 20px 16px; }

  /* fenêtres = panneaux qui montent du bas, toujours au-dessus du clavier */
  .modal-wrap { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); }
  .modal { max-height: calc(var(--vvh, 100dvh) - 12px); border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .38s var(--ease) both; transition: transform .25s var(--ease); }
  .modal-wrap.closing .modal { animation: sheet-up .22s var(--ease) reverse both; }
  .sheet-handle { display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 99px; background: var(--surface-3); flex-shrink: 0; }
  .modal-head { padding: 8px 18px 4px; }
  .modal-title { font-size: 24px; }
  .modal-body { padding: 12px 18px 18px; }
  .modal-foot { flex-wrap: wrap; padding: 12px 18px; }
  .modal-foot .spacer { display: none; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .btn-primary, .modal-foot .btn-danger { flex: 1 1 55%; }

  /* menus = panneaux d'actions en bas de l'écran */
  .sheet-backdrop { background: rgba(8, 8, 9, .55); animation: fade-in .2s both; }
  .menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; min-width: 0; max-height: 80dvh; overflow-y: auto;
    padding: 4px 10px calc(12px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; transform-origin: bottom;
    animation: sheet-up .32s var(--ease) both; transition: transform .25s var(--ease); }
  .menu.sheet.closing { animation: sheet-up .2s var(--ease) reverse both; }
  .menu.sheet .menu-item { padding: 14px 12px; gap: 14px; border-radius: 12px; font-size: 15.5px; }
  .menu.sheet .menu-item .i { font-size: 19px; }
  .sheet-title { padding: 8px 12px 10px; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu.sheet .react-bar { justify-content: space-around; padding: 6px 0 12px; }
  .menu.sheet .react-pick { width: 48px; height: 48px; font-size: 22px; background: var(--surface-3); }

  /* recherche (Ctrl+K) : plein écran au-dessus du clavier */
  .palette-wrap { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); padding: calc(10px + env(safe-area-inset-top)) 10px 10px; }
  .palette { max-height: 100%; border-radius: 18px; }
  .pal-item { padding: 11px 10px; }

  /* notifications au-dessus de la barre d'onglets ou de la saisie ; en haut si le clavier est ouvert */
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  body.chat-open.in-chat #toast-root { bottom: calc(88px + env(safe-area-inset-bottom)); }
  body.kb-open #toast-root { top: calc(var(--vvt, 0px) + 12px + env(safe-area-inset-top)); bottom: auto; }
  .toast { width: 100%; }

  /* messagerie : collée à la partie visible de l'écran (le clavier ne cache plus la saisie) */
  .chat, .chat.has-info { height: calc(var(--vvh, 100dvh) - 58px - var(--tabbar-h, 72px) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  body.chat-open.in-chat .main-chat { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); z-index: 30; }
  body.chat-open.in-chat .chat { height: 100%; }
  .cl-head { padding: 16px 16px 10px; }
  .cl-title { font-size: 28px; }
  .cl-item { padding: 12px 10px; }
  .cr-head { gap: 4px; padding: calc(8px + env(safe-area-inset-top)) 6px 8px; }
  .cr-who { gap: 10px; }
  .cr-who .av { width: 40px; height: 40px; }
  .cr-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  body.kb-open .composer { padding-bottom: 8px; }
  .msg-author { padding: 4px 12px; }
  .poll { min-width: 0; width: 100%; }
  .msg.k-poll .msg-body, .msg.k-course .msg-body { width: 84%; }
  .chat.has-info .chat-info { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); animation: slide-up .3s var(--ease); }
  body.chat-open.in-chat #pomo-root, body.chat-open.in-chat #tts-root { display: none; }

  /* révision */
  .rev { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); }
  .rev-top { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
  .rev-stage { overflow-y: auto; padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); }
  .bristol { height: min(50vh, 360px); }
  .rev-actions .btn { height: 58px; }
  #rev-card[data-swipe="yes"] .bristol-face { box-shadow: 0 0 0 3px var(--ok), 0 30px 60px -24px rgba(0, 0, 0, .9); }
  #rev-card[data-swipe="no"] .bristol-face { box-shadow: 0 0 0 3px var(--warn), 0 30px 60px -24px rgba(0, 0, 0, .9); }
  .rev-swipe { align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
  .rev-swipe span { padding: 0 8px; font-weight: 400; }

  /* cahier */
  .nb-top { padding: calc(8px + env(safe-area-inset-top)) 10px 8px; }
  .nb-hint { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  /* minuteur focus : version compacte au-dessus de la barre d'onglets */
  #pomo-root { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  .pomo { width: auto; display: grid; grid-template-columns: 108px minmax(0, 1fr); grid-template-areas: "head head" "dial phases" "dial ctrl" "foot foot"; column-gap: 14px; padding: 12px 14px; }
  .pomo-head { grid-area: head; }
  .pomo-phases { grid-area: phases; align-self: end; margin: 6px 0 0; }
  .pomo-dial { grid-area: dial; width: 108px; height: 108px; margin: 6px 0 0; }
  .pomo-time b { font-size: 28px; }
  .pomo-time span { font-size: 10px; }
  .pomo-ctrl { grid-area: ctrl; justify-content: space-around; }
  .pomo-foot { grid-area: foot; margin-top: 10px; }

  /* lecture audio */
  .tts { left: 12px; right: 12px; width: auto; transform: none; bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* compte, admin, visionneuse */
  .avatar-edit .av.xl { width: 104px; height: 104px; }
  .app-foot .btn { flex: 1; }
  .perm-table td:not(:first-child), .perm-table th:not(:first-child) { width: 56px; }
  .lightbox { padding: 12px; }
  .lightbox .btn-icon { top: calc(12px + env(safe-area-inset-top)); }
}

/* ---------- Petits téléphones (iPhone SE, 320 à 380 px) ------------------ */
@media (max-width: 380px) {
  .topbar .brand-name { display: none; }
  .topbar .seg button { padding: 8px 7px; font-size: 12.5px; }
  .main { padding-left: 14px; padding-right: 14px; }
  .hero-chips, .qrow, .side-stack { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; scroll-padding: 14px; }
  .display { font-size: 30px; }
  .shelf { gap: 16px 12px; }
  .cahier-label { left: 17%; right: 7%; padding: 9px 9px 10px; }
  .cahier-name { font-size: 20px; }
  .tab > span { font-size: 9.5px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .qcm-opt { padding: 12px; }
  .hchip { padding: 6px 11px; }
  .pomo { grid-template-columns: 92px minmax(0, 1fr); }
  .pomo-dial { width: 92px; height: 92px; }
  .pomo-time b { font-size: 24px; }
}

/* ---------- Téléphone à l'horizontale ------------------------------------- */
@media (max-width: 900px) and (max-height: 500px) {
  :root { --tabbar-h: 54px; }
  .tab { min-height: 40px; flex-direction: row; gap: 6px; }
  .tab > span { display: none; }
  .tab.active::before { top: 5px; }
  .bristol { height: min(56vh, 240px); }
  .rev-actions .btn { height: 46px; }
}

/* ---------- Grandes tablettes / téléphones pliants ------------------------ */
@media (min-width: 600px) and (max-width: 900px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Application installée sur l'écran d'accueil ------------------- */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}
@media (max-width: 900px) {
  .topbar .brand { min-height: 42px; }
  .cl-search { padding: 12px 14px; }
  .cr-down { min-height: 44px; padding: 10px 14px; }
  .msg-av .av-btn { padding: 6px; margin: -6px; }
}

/* ==========================================================================
   L'appli : proposition d'installation, mise à jour obligatoire
   ========================================================================== */
#app-root { position: relative; z-index: 116; }
.inst-wrap { position: fixed; inset: 0; z-index: 116; display: flex; align-items: center; justify-content: center; padding: 20px; }
.inst-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 9, .66); backdrop-filter: blur(4px); animation: fade-in .25s both; }
.inst-sheet {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 24px 22px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 0 40px 90px -24px rgba(0, 0, 0, .85); animation: pop-spring .4s var(--spring) both;
}
.inst-wrap.no-anim .inst-sheet, .inst-wrap.no-anim .inst-backdrop { animation: none; }
.inst-wrap.closing .inst-sheet { animation: pop .18s var(--ease) reverse both; }
.inst-wrap.closing .inst-backdrop { animation: fade-in .2s reverse both; }
.inst-x { position: absolute; top: 12px; right: 12px; z-index: 1; }
.inst-preview { display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 14px; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600; }
.inst-head { display: flex; align-items: center; gap: 16px; padding-right: 36px; }
.inst-icon { width: 60px; height: 60px; border-radius: 15px; flex-shrink: 0; box-shadow: 0 10px 30px -8px var(--accent-glow); animation: inst-bob 3.2s ease-in-out infinite; }
@keyframes inst-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(2deg); } }
.inst-title { margin: 0; font: 400 28px/1.08 var(--font-display); }
.inst-title em { color: var(--accent); }
.inst-sub { margin: 5px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.inst-perks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 20px 0 4px; }
.inst-perks span { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 6px; border-radius: 14px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; text-align: center; color: var(--text-2); animation: rise .4s var(--ease) both; }
.inst-perks span:nth-child(2) { animation-delay: .07s; }
.inst-perks span:nth-child(3) { animation-delay: .14s; }
.inst-perks .i { font-size: 20px; color: var(--accent); }
.inst-steps { list-style: none; counter-reset: st; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.inst-steps li { counter-increment: st; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; line-height: 1.4; animation: rise .4s var(--ease) both; }
.inst-steps li:nth-child(2) { animation-delay: .08s; }
.inst-steps li:nth-child(3) { animation-delay: .16s; }
.inst-n { width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.inst-n::before { content: counter(st); }
.inst-t { flex: 1; min-width: 0; color: var(--text-2); }
.inst-t b { color: var(--text); font-weight: 600; }
.inst-k { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--bg); border: 1px solid var(--line-strong); color: var(--accent); font-size: 19px; }
.inst-note { display: flex; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--text-3); line-height: 1.5; }
.inst-note .i { flex-shrink: 0; margin-top: 2px; }
.inst-note b { color: var(--text-2); }
.inst-foot { display: grid; gap: 8px; margin-top: 20px; }
.inst-already { justify-self: center; padding: 8px; }

/* maquette de téléphone : où toucher */
.ph { position: relative; width: 210px; margin: 20px auto 0; border: 2px solid var(--line-strong); background: var(--bg); }
.ph-top { border-radius: 28px 28px 0 0; border-bottom: 0; padding-top: 12px; }
.ph-bottom { border-radius: 0 0 28px 28px; border-top: 0; padding-bottom: 12px; }
.ph::after { content: ''; position: absolute; left: -2px; right: -2px; height: 46px; pointer-events: none; }
.ph-top::after { bottom: 0; background: linear-gradient(transparent, var(--surface)); }
.ph-bottom::after { top: 0; background: linear-gradient(var(--surface), transparent); }
.ph-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 10px; padding: 7px 8px; border-radius: 14px; background: var(--surface-2); }
.ph-ic { width: 26px; height: 26px; display: grid; place-items: center; color: var(--text-3); font-size: 15px; }
.ph-pill { flex: 1; height: 26px; display: flex; align-items: center; padding: 0 10px; border-radius: 9px; background: var(--surface-3); }
.ph-pill i { width: 60%; height: 5px; border-radius: 3px; background: var(--text-3); opacity: .45; }
.ph-hit { position: relative; width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.ph-hit::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--accent); animation: ph-ping 1.6s var(--ease) infinite; }
@keyframes ph-ping { from { transform: scale(.75); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.ph-screen { display: grid; gap: 7px; padding: 14px 18px; }
.ph-screen i { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); }
.ph-screen b { display: block; height: 30px; margin-top: 3px; border-radius: 8px; background: var(--surface-2); }
.ph-arrow { position: absolute; z-index: 1; color: var(--accent); font-size: 22px; animation: ph-down 1.2s ease-in-out infinite; }
.ph-top .ph-arrow { top: 58px; animation-name: ph-up; }
.ph-bottom .ph-arrow { bottom: 58px; }
.hit-right .ph-arrow { right: 21px; }
.hit-center .ph-arrow { left: calc(50% - 11px); }
@keyframes ph-down { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes ph-up { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* carte « Installe l'appli » de l'accueil */
.install-card { display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 24px; padding: 12px 14px; border-radius: 18px; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); animation: rise .45s var(--ease) .2s both; }
.install-card { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 15%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.install-card img { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.install-card span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.install-card b { font-size: 15px; }
.install-card small { color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.install-card > .i { flex-shrink: 0; font-size: 20px; color: var(--accent); }

/* aperçu de l'icône sous la couleur d'accent */
.accent-app { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.accent-app img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.accent-app img.pop { animation: pop-spring .45s var(--spring); }

/* mise à jour obligatoire */
#update-root { position: relative; z-index: 140; }
.upd { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 18%, #232326, #111112 70%); animation: fade-in .3s both; }
.upd { background: radial-gradient(ellipse at 50% 18%, color-mix(in srgb, var(--accent) 13%, #1b1b1d), #111112 70%); }
.upd-card { width: 100%; max-width: 420px; text-align: center; animation: rise .5s var(--ease) .1s both; }
.upd-badge { position: relative; width: 76px; height: 76px; margin: 0 auto 24px; }
.upd-badge img { width: 76px; height: 76px; border-radius: 19px; box-shadow: 0 18px 50px -10px var(--accent-glow); animation: inst-bob 3.2s ease-in-out infinite; }
.upd-badge span { position: absolute; right: -10px; top: -10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: var(--text); color: var(--bg); font-size: 16px; box-shadow: 0 6px 16px rgba(0, 0, 0, .45); animation: pop-spring .5s var(--spring) .45s both; }
.upd-title { font-size: clamp(34px, 9vw, 46px); margin: 10px 0 12px; }
.upd-lead { max-width: 340px; margin: 0 auto 24px; color: var(--text-2); line-height: 1.55; }
.upd-note { margin: 0 0 22px; padding: 14px 16px; border-radius: 16px; text-align: left; background: var(--surface); border: 1px solid var(--line-strong); }
.upd-note b { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--accent); }
.upd-note p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; white-space: pre-line; }
.upd-safe { margin: 14px auto 0; max-width: 300px; font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.upd-safe .i { vertical-align: -2px; margin-right: 3px; }

@media (max-width: 900px) {
  .inst-wrap { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); align-items: flex-end; padding: 0; }
  .inst-sheet { max-width: none; max-height: calc(var(--vvh, 100dvh) - 10px); border-radius: 26px 26px 0 0; border-bottom: 0;
    padding: 4px 20px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .42s var(--ease) both; transition: transform .25s var(--ease); }
  .inst-wrap.closing .inst-sheet { animation: sheet-up .22s var(--ease) reverse both; }
  .inst-x { top: 14px; }
  .inst-preview { margin: 12px 0 0; }
  .inst-head { margin-top: 16px; }
  .inst-title { font-size: 25px; }
  .install-card { margin-top: -6px; }
}
/* écran bas (iPhone SE, téléphone à l'horizontale) : les étapes suffisent, sans la maquette */
@media (max-height: 680px) {
  .ph { display: none; }
  .inst-steps { margin-top: 14px; }
  .inst-foot { margin-top: 14px; }
}
@media (max-width: 380px) {
  .inst-sheet { padding-left: 14px; padding-right: 14px; }
  .inst-head { gap: 12px; }
  .inst-icon { width: 52px; height: 52px; border-radius: 13px; }
  .inst-title { font-size: 23px; }
  .inst-perks span { padding: 12px 4px; font-size: 11.5px; }
  .inst-steps li { gap: 10px; padding: 10px; font-size: 14px; }
  .inst-k { width: 34px; height: 34px; font-size: 17px; }
}

/* ==========================================================================
   Le fil « Pour toi » et les conditions d'utilisation
   ========================================================================== */
/* ---------- Le ciblage, visible sur toutes les pages ----------------------
   L'algorithme ne parle plus seulement dans « Pour toi » : il pose un repère
   sur le cahier qui presse, sur le chapitre par lequel commencer, sur la
   matière à réviser en premier, et propose la suite à la fin d'un cours. */
.cahier-flag { position: absolute; top: 10px; right: 10px; z-index: 3; max-width: 62%; padding: 4px 9px;
  border-radius: 999px; font: 600 10.5px/1.25 var(--font-ui); letter-spacing: .01em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: #fff; background: rgba(28, 28, 32, .78);
  backdrop-filter: blur(3px); box-shadow: 0 3px 10px -4px rgba(0, 0, 0, .6); }
.cahier-flag.warn { background: color-mix(in srgb, var(--warn) 88%, #000); }
.cahier-flag.danger { background: color-mix(in srgb, var(--danger) 88%, #000); animation: badge-pulse 3s 1.4s ease-in-out infinite; }

.prio-line { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 11px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); font-size: 13.5px; color: var(--text-2); }
.prio-line.warn { border-left-color: var(--warn); }
.prio-line.danger { border-left-color: var(--danger); }
.prio-line .i { flex-shrink: 0; color: var(--accent); font-size: 18px; }
.prio-line.warn .i { color: var(--warn); }
.prio-line.danger .i { color: var(--danger); }
.prio-line b { color: var(--text); font-weight: 600; }

.toc-row.toc-top { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.toc-flag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; vertical-align: 2px;
  background: color-mix(in srgb, var(--c) 22%, var(--surface-2)); color: var(--c);
  font: 600 10.5px/1.5 var(--font-ui); font-style: normal; white-space: nowrap; }
.group-tag { margin-left: 10px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-3); font: 600 11px/1.6 var(--font-ui); font-style: normal; }
.group-tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.group-tag.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }

.next-step { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 13px; width: 100%;
  margin: 30px 0 10px; padding: 15px 17px; border-radius: 18px; text-align: left; color: var(--text);
  background: radial-gradient(120% 150% at 0% 0%, color-mix(in srgb, var(--c) 20%, transparent), transparent 60%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); cursor: pointer;
  transition: border-color .2s, scale .18s var(--ease); }
.next-step:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.next-step:active { scale: .99; }
.ns-k { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--font-ui);
  letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.ns-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; font-size: 19px;
  background: color-mix(in srgb, var(--c) 20%, var(--surface-2)); color: var(--c); }
.ns-txt { min-width: 0; display: grid; gap: 2px; }
.ns-txt b { font-size: 15.5px; font-weight: 600; }
.ns-txt small { font-size: 12.5px; color: var(--text-3); }

/* ---------- « Pour toi » : une grande carte, deux petites ----------------
   La première proposition est celle qui compte : elle prend de la place, dit
   pourquoi elle est là, combien de temps elle prend et ce qu'elle rapporte.
   Les suivantes restent discrètes, et le reste se déplie à la demande. */
.fd-hero { position: relative; display: flex; margin-bottom: 12px; border-radius: 20px; overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 62%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--c) 34%, var(--line)); box-shadow: var(--shadow-2);
  transition: border-color .25s, box-shadow .25s, scale .18s var(--ease); }
.fd-hero:hover { border-color: color-mix(in srgb, var(--c) 58%, var(--line)); box-shadow: 0 18px 40px -22px var(--c); }
.fd-hero:active { scale: .992; }
.fd-hero-main { flex: 1; min-width: 0; display: grid; gap: 7px; padding: 17px 10px 15px 17px; border: 0;
  background: none; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.fd-hero-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.fd-hero .fd-ic { flex-shrink: 0; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px;
  font-size: 21px; background: color-mix(in srgb, var(--c) 24%, var(--surface-2)); color: var(--c); }
.fd-kicker { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; font-weight: 700;
  letter-spacing: .01em; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-kicker .i { font-size: 15px; flex-shrink: 0; }
.fd-hero-title { font-size: 19.5px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.fd-hero-sub { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-hero-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.fd-tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.fd-tag .i { font-size: 14px; color: var(--c); }
.fd-go { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 7px 13px; border-radius: 999px;
  background: var(--c); color: #fff; font-size: 13.5px; font-weight: 650; white-space: nowrap;
  box-shadow: 0 8px 18px -10px var(--c); }
.fd-go .i { transition: translate .25s var(--ease); }
.fd-hero:hover .fd-go .i { translate: 3px 0; }
.fd-why { position: absolute; top: 8px; right: 6px; color: var(--text-3); }
.fd-expand { margin-bottom: 26px; }

.fd-list { display: grid; gap: 10px; margin-bottom: 26px; }
.fd-card { position: relative; display: flex; align-items: stretch; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  overflow: hidden; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); transition: border-color .2s, transform .2s; }
.fd-card:hover { border-color: var(--line-strong); }
.fd-card.fd-out { animation: fade-in .2s reverse both; }
.fd-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 13px 8px 13px 14px; border: 0; background: none; text-align: left; color: var(--text); }
.fd-ic { flex-shrink: 0; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-size: 20px;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.fd-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.fd-txt b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-txt small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-reason { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.fd-reason .i { font-size: 14px; }
.fd-meta { flex-shrink: 0; align-self: center; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.fd-more { align-self: center; margin-right: 4px; color: var(--text-3); }
.fd-note { flex-shrink: 0; }
.fd-skel { display: grid; gap: 10px; margin-bottom: 26px; }
.fd-skel .skeleton { height: 68px; border-radius: 16px; }
.menu-why { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.menu-why b { display: block; margin-bottom: 7px; font-size: 12px; color: var(--text-3); }
.menu-why span { display: flex; align-items: flex-start; gap: 7px; padding: 3px 0; font-size: 13.5px; color: var(--text-2); }
.menu-why .i { flex-shrink: 0; margin-top: 2px; font-size: 14px; color: var(--ok); }
.why-list { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; gap: 8px; }
.why-list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--text-2); }
.why-list .i { flex-shrink: 0; margin-top: 1px; color: var(--accent); }

/* conditions d'utilisation */
.legal-tldr { display: grid; gap: 8px; margin-bottom: 26px; }
.legal-tldr div { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.legal-tldr .i { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.legal-part { margin-bottom: 22px; }
.legal-part h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font: 400 21px/1.2 var(--font-display); }
.legal-part h3 .i { color: var(--accent); font-size: 19px; }
.legal-part p, .legal-part li { color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.legal-part p { margin: 0 0 10px; }
.legal-part ul { margin: 0 0 10px; padding-left: 20px; }
.legal-part b { color: var(--text); }
.legal-date { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.legal-scroll { max-height: 42vh; overflow-y: auto; overscroll-behavior: contain; padding: 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.legal-scroll .legal-tldr { margin-bottom: 18px; }

/* case à cocher d'un formulaire (conditions) */
.check-row { display: flex; align-items: flex-start; gap: 11px; margin-top: 14px; padding: 12px 14px; border-radius: 13px; background: var(--surface-2); font-size: 14px; line-height: 1.5; color: var(--text-2); }
.check-row input { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); }
.check-row .link { display: inline; font-size: inherit; color: var(--accent); text-decoration: underline; }

@media (max-width: 900px) {
  .fd-main { padding: 11px 6px 11px 11px; gap: 11px; }
  .fd-ic { width: 38px; height: 38px; font-size: 18px; border-radius: 11px; }
  .fd-meta { display: none; }
  .fd-txt b { font-size: 14.5px; white-space: normal; }
  .legal-scroll { max-height: 38vh; }
}

/* bandeau de confiance d'un cours (auteur, vérification) */
.trust { display: flex; align-items: center; gap: 11px; margin: -4px 0 22px; padding: 11px 14px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-3); }
.trust.ok { border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.trust > .i { flex-shrink: 0; font-size: 18px; color: var(--warn); }
.trust.ok > .i { color: var(--ok); }
.trust-txt { flex: 1; min-width: 0; line-height: 1.5; }
.trust b { color: var(--text-2); }
@media (max-width: 900px) { .trust { flex-wrap: wrap; } .trust .btn { width: 100%; justify-content: center; } }

/* ==========================================================================
   Minuteur de session, brevet blanc, exercices
   ========================================================================== */
.rev-timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line-strong); font: 600 14px/1 var(--font-ui);
  font-variant-numeric: tabular-nums; color: var(--text-2); }
.rev-timer .i { font-size: 15px; color: var(--accent); }
.rev-timer.hot { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft { 50% { transform: scale(1.06); } }

.daily-btns { display: flex; gap: 8px; }
.daily-btns .btn { flex: 1; justify-content: center; }
.daily-btns .btn:last-child { flex: 0 0 auto; }

.exam-card { display: flex; align-items: center; gap: 14px; width: 100%; margin: 14px 0 26px; padding: 16px 18px; border-radius: 18px; text-align: left; color: var(--text);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); transition: transform .2s var(--ease); }
.exam-card:hover { transform: translateY(-2px); }
.exam-card span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: 3px; }
.exam-card b { font: 400 22px/1.1 var(--font-display); }
.exam-card small { color: var(--text-2); font-size: 13px; }
.exam-ic { flex-shrink: 0; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-size: 22px; }
.exam-card > .i { flex-shrink: 0; color: var(--accent); }

.exam-end { width: min(680px, 100%); margin: 0 auto; padding: 8px 4px 24px; text-align: center; overflow-y: auto; }
.exam-note { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.exam-note b { font: 400 68px/1 var(--font-display); color: var(--accent); }
.exam-note em { font: italic 26px/1 var(--font-display); color: var(--text-3); }
.exam-list { display: grid; gap: 8px; text-align: left; }
.exam-row { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.exam-row.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.exam-row.bad { border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.exam-row b { font-size: 14.5px; font-weight: 600; }
.exam-row .small { margin-top: 4px; font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.exam-row.ok .small .i { color: var(--ok); }
.exam-row.bad .small .i { color: var(--danger); }
.exam-row .ok-line { color: var(--text-2); }
.exam-row .ok-line .i { color: var(--ok); }
.exam-row .ok-line b { color: var(--text); font-size: 13px; }
.exam-n { flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 700; }

.card-choices { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-left: 34px;
  font-size: 12px; color: var(--text-3); }
.card-choices .i { font-size: 14px; color: var(--accent); }

@media (max-width: 900px) {
  .exam-card { padding: 14px; gap: 12px; }
  .exam-ic { width: 40px; height: 40px; font-size: 19px; }
  .exam-note b { font-size: 56px; }
  .rev-timer { padding: 5px 9px; font-size: 13px; }
}

/* ==========================================================================
   Quêtes de la semaine, défi de classe, récap
   ========================================================================== */
.quests .daily-top { display: flex; align-items: center; gap: 14px; }
.q-ring { flex-shrink: 0; }
.q-list { display: grid; gap: 9px; margin-top: 14px; }
.q-row { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: var(--text-2); }
.q-row > .i { flex-shrink: 0; font-size: 17px; color: var(--text-3); }
.q-row.is-done > .i { color: var(--ok); }
.q-txt { flex: 1; min-width: 0; display: grid; gap: 5px; }
.q-txt b { font-weight: 600; font-size: 13.5px; color: var(--text); }
.q-row.is-done .q-txt b { color: var(--text-3); text-decoration: line-through; }
.q-bar { display: block; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.q-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s var(--ease); }
.q-row.is-done .q-bar i { background: var(--ok); }
.q-n { flex-shrink: 0; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.ch-bar { position: relative; height: 26px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ch-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff 0%), var(--accent));
  transition: width .8s var(--ease); }
.ch-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); mix-blend-mode: difference; }

.recap { text-align: center; }
.recap-hero { margin-bottom: 18px; }
.recap-hero b { display: block; font: 400 64px/1 var(--font-display); color: var(--accent); }
.recap-hero span { color: var(--text-2); font-size: 14px; }
.recap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.recap-cell { display: grid; justify-items: center; gap: 3px; padding: 14px 8px; border-radius: 14px; background: var(--surface-2); }
.recap-cell .i { font-size: 19px; color: var(--accent); }
.recap-cell b { font-size: 20px; font-weight: 700; }
.recap-cell small { color: var(--text-3); font-size: 12px; text-align: center; }
@media (min-width: 620px) { .recap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ==========================================================================
   Entraide (questions de la classe) et duels
   ========================================================================== */
.qa-list { display: grid; gap: 10px; }
.qa-card { border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: border-color .2s; }
.qa-card.open { border-color: var(--line-strong); }
.qa-card.solved .qa-t b { color: var(--text-2); }
.qa-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 0; background: none; text-align: left; color: var(--text); }
.qa-sub { flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: 18px;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.qa-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.qa-t b { font-size: 14.5px; font-weight: 600; }
.qa-t small { color: var(--text-3); font-size: 12.5px; }
.qa-chev { flex-shrink: 0; color: var(--text-3); }
.qa-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.qa-text { margin: 12px 0; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.qa-answers { display: grid; gap: 10px; margin: 12px 0; }
.qa-answer { display: flex; gap: 11px; padding: 11px 12px; border-radius: 13px; background: var(--surface-2); }
.qa-answer.best { background: color-mix(in srgb, var(--ok) 10%, var(--surface-2)); }
.qa-answer b { font-size: 13.5px; }
.qa-answer p { margin: 5px 0 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.qa-answer .chip { margin-left: 6px; }
.qa-reply { display: flex; gap: 8px; }
.qa-reply .input { flex: 1; min-width: 0; }
.qa-del { margin-top: 12px; color: var(--danger); }

.duels .duel-list { display: grid; gap: 8px; margin-top: 12px; }
.duel-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid transparent; text-align: left; color: var(--text); }
.duel-row[data-act] { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.duel-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.duel-txt b { font-size: 14px; }
.duel-txt small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-play .rev-stage { align-items: flex-start; }
.help-card .btn { margin-top: 12px; }

@media (max-width: 900px) {
  .qa-reply { flex-wrap: wrap; }
  .qa-reply .btn { width: 100%; justify-content: center; }
  .duel-row .chip { font-size: 11px; }
}

/* ---------- Surlignage d'un cours ---------------------------------------- */
mark.hl { background: color-mix(in srgb, var(--accent) 34%, transparent); color: inherit; border-radius: 3px; padding: 1px 2px;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 55%, transparent); cursor: pointer; }
mark.hl:hover { background: color-mix(in srgb, var(--accent) 48%, transparent); }
.hl-bar { position: fixed; z-index: 95; display: flex; gap: 2px; padding: 4px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .8); }
.hl-bar[hidden] { display: none; }
.hl-bar button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border: 0; border-radius: 9px;
  background: none; color: var(--text); font: 600 13px var(--font-ui); }
.hl-bar button:hover { background: var(--surface-3); }
.hl-bar .i { font-size: 15px; color: var(--accent); }
.hl-list { display: grid; gap: 6px; margin-top: 8px; }
.hl-item { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: 12.5px; line-height: 1.45; text-align: left; }
.hl-item .i { flex-shrink: 0; margin-top: 1px; font-size: 14px; color: var(--accent); }
.hl-item span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Connexion du téléphone par QR code --------------------------- */
.pair { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pair-qr { flex-shrink: 0; padding: 10px; border-radius: 14px; background: #fff; line-height: 0; transition: opacity .3s; }
.pair-qr .qr { display: block; width: 210px; height: 210px; }
.pair-side { flex: 1; min-width: 180px; display: grid; gap: 8px; align-content: start; }
.pair-side .url { display: block; word-break: break-all; }
.pair-side .btn { justify-self: start; }
@media (max-width: 560px) { .pair { justify-content: center; } .pair-qr .qr { width: 180px; height: 180px; } }

/* ==========================================================================
   Présentation animée (première ouverture)
   ========================================================================== */
#intro-root { position: relative; z-index: 135; }
.intro { position: fixed; inset: 0; z-index: 135; display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 12%, color-mix(in srgb, var(--accent) 11%, #191919), #101011 68%);
  animation: fade-in .35s both; overflow: hidden; }
.intro.closing { animation: fade-in .25s reverse both; }

.in-bars { display: flex; gap: 5px; }
.in-bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.in-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.in-bar.done i { width: 100%; }
@keyframes in-fill { from { width: 0; } to { width: 100%; } }

.in-skip { position: absolute; top: calc(22px + env(safe-area-inset-top)); right: 16px; z-index: 3; color: var(--text-3); }
.in-tap { position: absolute; top: 60px; bottom: 90px; width: 34%; border: 0; background: none; z-index: 2; }
.in-tap.left { left: 0; }
.in-tap.right { right: 0; }

.in-stage { flex: 1; display: grid; place-items: center; min-height: 0; }
.in-scene { width: min(560px, 100%); text-align: center; animation: in-enter .5s var(--ease) both; }
@keyframes in-enter { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.in-art { height: min(38vh, 280px); display: grid; place-items: center; margin-bottom: 26px; }
.in-title { margin: 0 0 10px; font: 400 clamp(30px, 7vw, 44px)/1.08 var(--font-display); }
.in-title em { color: var(--accent); }
.in-line { margin: 0 auto; max-width: 420px; color: var(--text-2); font-size: 15px; line-height: 1.6; }

.in-foot { position: relative; z-index: 3; display: flex; gap: 10px; justify-content: center; padding-top: 16px; }
.in-foot .btn { min-width: 132px; justify-content: center; }

/* scène 1 : le logo qui se pose */
.in-logo { position: relative; width: 132px; height: 132px; border-radius: 34px; display: grid; place-items: center;
  background: var(--accent); box-shadow: 0 30px 70px -18px var(--accent-glow); animation: in-pop .7s var(--spring) both; }
.in-3 { font: italic 82px/1 Georgia, serif; color: var(--accent-ink); animation: in-pop .6s var(--spring) .15s both; }
.in-underline { position: absolute; bottom: 34px; width: 46px; height: 5px; border-radius: 3px; background: var(--accent-ink);
  transform-origin: left; animation: in-draw .5s var(--ease) .45s both; }
@keyframes in-pop { from { opacity: 0; transform: scale(.7) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes in-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* scène 2 : l'étagère de cahiers */
.in-shelf { display: flex; align-items: flex-end; gap: 12px; height: 190px; }
.in-book { position: relative; width: 62px; height: 150px; border-radius: 8px 12px 12px 8px; background: var(--c);
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .9); animation: in-slide .6s var(--ease) var(--d) both; }
.in-book b { position: absolute; left: 0; top: 0; bottom: 0; width: 9px; border-radius: 8px 0 0 8px; background: rgba(0, 0, 0, .35); }
.in-book i { position: absolute; left: 18px; right: 10px; top: 28px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .5);
  box-shadow: 0 16px 0 rgba(255, 255, 255, .3), 0 32px 0 rgba(255, 255, 255, .2); }
.in-book.open { height: 178px; transform-origin: bottom; animation: in-slide .6s var(--ease) var(--d) both, in-lift 1.6s ease-in-out 1.1s infinite alternate; }
@keyframes in-slide { from { opacity: 0; transform: translateY(26px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes in-lift { to { transform: translateY(-14px) rotate(2deg); } }

/* scène 3 : la photo qui devient un cours */
.in-scribe { display: flex; align-items: center; gap: 18px; }
.in-photo, .in-doc { width: 118px; height: 156px; border-radius: 12px; padding: 16px 12px; display: grid; align-content: start; gap: 9px; }
.in-photo { background: repeating-linear-gradient(#fdfcf5 0 22px, #dfe6f5 22px 23px); transform: rotate(-4deg); box-shadow: 0 16px 30px -12px rgba(0,0,0,.8); }
.in-photo i { height: 7px; border-radius: 2px; background: #2b3a63; opacity: .75; }
.in-photo i:nth-child(2) { width: 80%; } .in-photo i:nth-child(4) { width: 65%; } .in-photo i:nth-child(5) { width: 45%; }
.in-doc { background: var(--surface); border: 1px solid var(--line-strong); animation: in-appear .6s var(--ease) .5s both; }
.in-doc i { height: 7px; border-radius: 3px; background: var(--surface-3); animation: in-type .35s var(--ease) both; }
.in-doc i:nth-child(1) { width: 60%; background: var(--accent); animation-delay: .7s; }
.in-doc i:nth-child(2) { animation-delay: .9s; } .in-doc i:nth-child(3) { width: 85%; animation-delay: 1.05s; }
.in-doc i:nth-child(4) { width: 70%; animation-delay: 1.2s; } .in-doc i:nth-child(5) { width: 90%; animation-delay: 1.35s; }
.in-doc i:nth-child(6) { width: 50%; animation-delay: 1.5s; }
.in-arrow { font-size: 30px; color: var(--accent); animation: in-wand 1.8s ease-in-out infinite; }
@keyframes in-appear { from { opacity: 0; transform: translateX(16px) rotate(4deg); } to { opacity: 1; transform: none; } }
@keyframes in-type { from { opacity: 0; transform: scaleX(.2); transform-origin: left; } to { opacity: 1; transform: none; } }
@keyframes in-wand { 0%, 100% { transform: translateX(-4px) rotate(-8deg); } 50% { transform: translateX(4px) rotate(8deg); } }

/* scène 4 : les fiches de révision */
.in-cards { position: relative; width: 240px; height: 170px; }
.in-card { position: absolute; inset: 0; border-radius: 16px; background: var(--paper); box-shadow: 0 18px 40px -16px rgba(0,0,0,.85); }
.in-card.c3 { transform: rotate(-7deg) translateY(10px); opacity: .45; }
.in-card.c2 { transform: rotate(4deg) translateY(5px); opacity: .7; }
.in-card.c1 { display: grid; place-content: center; gap: 8px; text-align: center; color: #1f2430;
  animation: in-flip 3.4s ease-in-out .4s infinite; backface-visibility: visible; }
.in-card.c1 b { font: 400 24px/1.1 var(--font-display); }
.in-card.c1 small { font: 600 14px var(--font-ui); color: #46506b; }
@keyframes in-flip { 0%, 40% { transform: rotateY(0); } 55%, 95% { transform: rotateY(-8deg) scale(1.02); } 100% { transform: rotateY(0); } }
.in-streak { position: absolute; right: -18px; top: -18px; display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px;
  border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 700 14px var(--font-ui);
  animation: in-pop .5s var(--spring) .8s both; }

/* scène 5 : la messagerie */
.in-bulles { display: grid; gap: 10px; width: 260px; }
.in-msg { padding: 11px 14px; border-radius: 16px; font-size: 14px; animation: in-msg .45s var(--ease) both; }
.in-msg.a { justify-self: start; background: var(--surface-2); border-bottom-left-radius: 6px; animation-delay: .2s; }
.in-msg.b { justify-self: end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; animation-delay: .8s; }
.in-msg.c { justify-self: center; display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); animation-delay: 1.5s; }
.in-msg.c .i { color: var(--accent); }
@keyframes in-msg { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }

/* scène 6 : le fil « Pour toi » */
.in-feed { display: grid; gap: 9px; width: 290px; }
.in-fd { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; align-items: center; padding: 11px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); text-align: left; animation: in-msg .5s var(--ease) var(--d) both; }
.in-fd .i { grid-row: span 2; font-size: 19px; color: var(--accent); }
.in-fd b { font-size: 14px; }
.in-fd small { font-size: 12px; color: var(--accent); font-weight: 600; }

/* animations réduites : tout reste lisible, rien ne bouge */
.intro.still .in-bar i { width: 100% !important; animation: none !important; }
@media (max-width: 900px) {
  .in-art { height: min(34vh, 240px); margin-bottom: 20px; }
  .in-foot .btn { flex: 1; min-width: 0; }
  .in-shelf { gap: 9px; height: 170px; }
  .in-book { width: 52px; height: 130px; }
  .in-book.open { height: 154px; }
  .in-cards { width: 210px; height: 150px; }
  .in-feed, .in-bulles { width: min(300px, 78vw); }
}

/* ---------- Pièces jointes d'un cours ------------------------------------ */
.files { margin-top: 28px; }
.file-list { display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: border-color .2s, transform .2s; }
.file-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.file-ic { flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface-2); color: var(--accent); font-size: 19px; }
.file-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.file-txt b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-txt small { color: var(--text-3); font-size: 12px; }
.file-item > .i { flex-shrink: 0; color: var(--text-3); }
/* le fichier s'ouvre en grand d'un côté, se télécharge de l'autre */
.file-item { padding: 0; gap: 4px; }
.file-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 13px; padding: 12px 4px 12px 14px;
  border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.file-main > .i { flex-shrink: 0; color: var(--text-3); }
.file-item > .btn-icon { margin-right: 8px; }
.file-edit { display: grid; gap: 7px; }
.file-keep { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.file-keep input { width: 18px; height: 18px; accent-color: var(--accent); }
.file-keep .i { color: var(--accent); }
.file-keep span { display: grid; gap: 1px; min-width: 0; }
.file-keep small { color: var(--text-3); font-size: 11.5px; }

/* ---------- Classes cochées (publication multi-classes, comptes profs) ---- */
.class-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.class-chip input { width: 16px; height: 16px; accent-color: var(--accent); }
.class-chip:has(input:checked) { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

/* ---------- Mot de passe temporaire d'un professeur ---------------------- */
.temp-pass { display: grid; gap: 10px; margin: 6px 0 16px; }
.temp-pass div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px;
  border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.temp-pass span { font-size: 12.5px; color: var(--text-3); }
.temp-pass code { font: 700 17px var(--font-ui); color: var(--accent); letter-spacing: .3px; user-select: all; }

/* ---------- « Ce qu'Elite 3 sait de moi » -------------------------------- */
.data-list { display: grid; gap: 7px; margin: 4px 0 8px; }
.data-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 13px;
  border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--text-3); }
.data-row b { color: var(--text); font-size: 13.5px; text-align: right; }

/* ---------- Connexion par QR code ---------------------------------------- */
.pair-code { font: 700 30px/1 var(--font-ui); letter-spacing: 3px; color: var(--accent); user-select: all; }
.pair-input { font: 700 20px var(--font-ui); letter-spacing: 3px; text-transform: uppercase; text-align: center; }
.qr-scan { position: relative; width: 100%; max-width: 320px; margin: 0 auto; aspect-ratio: 1; border-radius: 18px;
  overflow: hidden; background: #000; }
.qr-scan video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; inset: 14%; border: 3px solid var(--accent); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }

/* ---------- Suivi des classes (professeur) ------------------------------- */
.tc-group + .tc-group { margin-top: 16px; }
.tc-group .panel-title .i { color: var(--c, var(--accent)); }
.tc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tc-table th { text-align: left; padding: 6px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; }
.tc-table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tc-table tr td:first-child { max-width: 260px; }
.tc-bar { position: relative; display: block; min-width: 90px; height: 22px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tc-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); opacity: .55; }
.tc-bar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.tc-none { color: var(--text-3); }
.tc-hard { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.tc-hard .label { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tc-hard .label .i { color: var(--warn); }
.tc-hard-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.tc-hard-row span { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.staff-av { background: color-mix(in srgb, #5d6b78 30%, var(--surface-2)); color: #a8b8c6; }
.delegate-av { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--accent); }
@media (max-width: 900px) {
  .tc-table th:nth-child(2), .tc-table td:nth-child(2) { display: none; }
  .tc-table td { padding: 9px 6px; }
}

/* ==========================================================================
   v8 — Agenda, notes, vie scolaire, brevet, environnement de l'algorithme
   --------------------------------------------------------------------------
   Même direction artistique : gris neutres, accent personnalisable, fiches
   bristol et papier. Téléphone d'abord, puis élargi sur ordinateur.
   ========================================================================== */

/* ---------- Briques partagées -------------------------------------------- */
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.ok  { color: var(--ok); }
.chip.mid { color: var(--warn); }
.chip.bad { color: #ff8b88; }
.chip-link { border: 1px solid var(--line-strong); background: var(--surface-2); }
.chip-link:hover { background: var(--surface-3); color: var(--text); }
.only-wide { display: none; }
@media (min-width: 720px) { .only-wide { display: inline; } }

/* une image de document, placée dans le texte du cours par Elite Scribe */
.doc-fig { margin: 22px 0; text-align: center; }
.doc-fig img { margin: 0 auto; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); }
.doc-fig a { display: block; }
.doc-fig figcaption {
  margin-top: 8px; font-size: 13px; color: var(--text-3); font-style: italic; text-align: center;
}

/* ---------- Alertes de l'algorithme -------------------------------------- */
.al-list { display: grid; gap: 10px; margin-bottom: 26px; }
.al {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) 20px; gap: 12px; align-items: center;
  width: 100%; padding: 13px 14px; text-align: left; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: transform .2s var(--ease), background .2s, border-color .2s;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.al:hover { background: var(--surface-2); transform: translateY(-1px); }
.al-ic {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface-3); color: var(--c, var(--text-2)); font-size: 19px;
}
.al-txt { display: grid; gap: 2px; min-width: 0; }
.al-txt b { font-size: 14.5px; }
.al-txt span { font-size: 12.8px; color: var(--text-2); }
.al .i:last-child { color: var(--text-3); }
.al.danger { border-color: rgba(239, 100, 97, .34); background: linear-gradient(120deg, rgba(239, 100, 97, .09), var(--surface) 62%); }
.al.danger .al-ic { color: #ff8b88; background: rgba(239, 100, 97, .15); }
.al.warn { border-color: rgba(240, 165, 74, .3); background: linear-gradient(120deg, rgba(240, 165, 74, .08), var(--surface) 62%); }
.al.warn .al-ic { color: var(--warn); background: rgba(240, 165, 74, .14); }
.al.info .al-ic { color: var(--accent); background: var(--accent-soft); }

/* ---------- Plan du jour ------------------------------------------------- */
.pl-list {
  display: grid; gap: 8px; margin-bottom: 30px; padding: 6px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--line);
}
.pl-step {
  display: grid; grid-template-columns: 26px 36px minmax(0, 1fr) auto; gap: 11px; align-items: center;
  width: 100%; padding: 11px 10px; text-align: left; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); transition: background .18s;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.pl-step:hover { background: var(--surface-2); }
.pl-n { font: 400 22px/1 var(--font-display); color: var(--text-3); text-align: center; }
.pl-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.pl-txt { display: grid; gap: 2px; min-width: 0; }
.pl-txt b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-txt span { font-size: 12.5px; color: var(--text-3); }
.pl-min { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }

/* estimation de la note au brevet */
.pred { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 18px; padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-strong); }
.pred-note { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-display); color: var(--accent); }
.pred-note b { font-size: 40px; font-weight: 400; }
.pred-note em { font-size: 17px; font-style: normal; color: var(--text-3); }

/* ---------- Agenda ------------------------------------------------------- */
.hw-day-group { margin-bottom: 22px; }
.hw-day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0 2px 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.hw-day-head b { font: 400 21px/1.1 var(--font-display); }
.hw-day-head span { font-size: 12px; font-weight: 600; color: var(--text-3); }
.hw-list { display: grid; gap: 10px; }
.hwc {
  padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); border-left: 3px solid var(--c);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
/* l'animation d'entrée fixe l'opacité : les devoirs faits ont donc la leur */
.hwc.done { opacity: .55; animation-name: rise-dim; }
@keyframes rise-dim { from { opacity: 0; transform: translateY(8px); } to { opacity: .55; transform: none; } }
.hwc.done .hwc-head b { text-decoration: line-through; text-decoration-color: var(--text-3); }
.hwc.late { border-color: rgba(239, 100, 97, .32); background: linear-gradient(120deg, rgba(239, 100, 97, .07), var(--surface) 60%); }
.hwc-top { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.hwc-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.hwc-head { display: grid; gap: 2px; min-width: 0; }
.hwc-head b { font-size: 15px; }
.hwc-meta { font-size: 12.5px; color: var(--text-3); }
.hwc-check {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text-3);
  transition: transform .18s var(--ease), background .18s, color .18s;
}
.hwc-check:hover { background: var(--surface-3); color: var(--text); }
.hwc-check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hwc-check:active { transform: scale(.92); }
.hwc-body { margin: 11px 0 0; font-size: 14px; color: var(--text-2); white-space: pre-line; }
.hwc-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.past-fold { margin-top: 18px; }
.past-fold > summary { cursor: pointer; padding: 11px 0; font-size: 13.5px; font-weight: 600; color: var(--text-3); }
.past-fold > summary:hover { color: var(--text); }
.past-fold[open] > summary { margin-bottom: 12px; }

/* carte d'accueil */
.agc-list { display: grid; gap: 7px; margin: 4px 0 14px; }
.agc-row {
  display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 10px; align-items: center;
  width: 100%; padding: 9px 10px; text-align: left; border: 0; border-radius: 10px;
  background: var(--surface-2); color: var(--text); transition: background .18s;
}
.agc-row:hover { background: var(--surface-3); }
.agc-sw { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.agc-txt { display: grid; gap: 1px; min-width: 0; }
.agc-txt b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agc-txt span { font-size: 11.8px; color: var(--text-3); }

/* ---------- Notes -------------------------------------------------------- */
.notes-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.notes-hero .ring-in b { font: 400 30px/1 var(--font-display); }
.notes-hero .ring-in small { display: block; font-size: 11px; color: var(--text-3); }

.sub-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.sub-row:last-child { border-bottom: 0; }
.sub-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.sub-txt { display: grid; gap: 3px; min-width: 0; }
.sub-txt b { font-size: 14px; }
.sub-bar { position: relative; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.sub-bar i { display: block; height: 6px; border-radius: 99px; background: var(--c); transition: width .7s var(--ease); }
.sub-bar u { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text-2); border-radius: 2px; }
.sub-val { font: 400 26px/1 var(--font-display); color: var(--text-2); }
.sub-val.ok { color: var(--ok); } .sub-val.mid { color: var(--warn); } .sub-val.bad { color: #ff8b88; }

.mk-row, .ev-row { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.ev-row { grid-template-columns: 7px minmax(0, 1fr) auto auto auto; }
.mk-row:last-child, .ev-row:last-child { border-bottom: 0; }
.mk-sw { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.mk-txt { display: grid; gap: 2px; min-width: 0; }
.mk-txt b { font-size: 14.5px; }
.mk-note { color: var(--text-2); font-style: italic; }
.mk-val { text-align: right; display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.mk-val b { font: 400 27px/1 var(--font-display); }
.mk-val em { font-size: 13px; font-style: normal; color: var(--text-3); }
.mk-val span { flex-basis: 100%; }
.mk-val.ok b { color: var(--ok); } .mk-val.mid b { color: var(--warn); } .mk-val.bad b { color: #ff8b88; }
.ev-stats { text-align: right; }
.ev-stats b { font: 400 22px/1 var(--font-display); }
.ev-stats em { font-size: 12px; font-style: normal; color: var(--text-3); }
.ev-stats span { display: block; }

/* tableau de saisie des notes */
.marks-wrap { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.marks-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.marks-table th {
  position: sticky; top: 0; z-index: 1; padding: 10px 10px; text-align: left;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line-strong);
}
.marks-table td { padding: 6px 8px; border-top: 1px solid var(--line); }
.marks-table tr:first-child td { border-top: 0; }
.mt-name { font-weight: 600; white-space: nowrap; }
.marks-table .input { padding: 8px 9px; font-size: 16px; }
.marks-table .mt-v { text-align: center; font-weight: 700; }
.check-mini { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); cursor: pointer; }
.check-mini input { width: 16px; height: 16px; accent-color: var(--accent); }
.marks-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 13px; }

/* ---------- Vie scolaire ------------------------------------------------- */
.vs-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.vs-row:last-child { border-bottom: 0; }
.vs-row.need { border-left: 3px solid var(--warn); padding-left: 11px; margin-left: -14px; }
.vs-main { display: grid; gap: 5px; min-width: 0; }
.vs-line { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.vs-name { font-size: 14px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.vs-name:hover { text-decoration-color: var(--accent); }
.vs-note { margin: 2px 0 0; font-size: 13.5px; color: var(--text-2); }
.vs-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.vs-file { max-height: 46vh; overflow: auto; }

.call-list { display: grid; gap: 6px; max-height: 46vh; overflow: auto; margin-top: 6px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.call-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px auto; gap: 8px; align-items: center; }
.call-name {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 10px;
  background: var(--surface-2); color: var(--text); text-align: left; transition: background .16s, border-color .16s;
}
.call-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.call-state { font-size: 11.5px; font-style: normal; color: var(--ok); white-space: nowrap; }
.call-row.is-abs .call-name { background: rgba(239, 100, 97, .14); border-color: rgba(239, 100, 97, .34); }
.call-row.is-abs .call-state { color: #ff8b88; }
.call-row.is-late .call-name { background: rgba(240, 165, 74, .13); border-color: rgba(240, 165, 74, .32); }
.call-row.is-late .call-state { color: var(--warn); }
.call-row .js-min { width: 74px; padding: 7px 8px; text-align: center; }

/* ---------- Panneau des comptes (admin) ---------------------------------- */
.acc-bar { display: grid; gap: 12px; margin-bottom: 18px; }
.acc-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-tools .select { width: auto; min-width: 150px; }
.acc-search { position: relative; flex: 1; min-width: 190px; }
.acc-search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.acc-search .input { padding-left: 38px; }
.acc-list { display: grid; }
.acc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border-bottom: 0; }
.acc-who { display: grid; gap: 3px; min-width: 0; }
.acc-who b { font-size: 14.5px; }
.acc-act { display: flex; gap: 5px; align-items: center; }

/* ---------- Elite Scribe : raccourcis et découpes ------------------------ */
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.sc-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 600; transition: background .16s, color .16s, border-color .16s;
}
.sc-chip .i { font-size: 13px; }
.sc-chip:hover { background: var(--surface-3); color: var(--text); }
.sc-chip.on { background: var(--accent-soft); border-color: rgba(242, 227, 92, .4); color: var(--accent); }

/* ==========================================================================
   Épreuves de brevet
   ========================================================================== */
.bv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 30px; }
.bv-card {
  display: flex; flex-direction: column; gap: 9px; padding: 18px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: linear-gradient(165deg, color-mix(in srgb, var(--c) 10%, var(--surface)), var(--surface) 62%);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms);
}
.bv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bv-year { font: 400 15px/1 var(--font-display); letter-spacing: .1em; color: var(--c); }
.bv-name { margin: 0; font: 400 24px/1.15 var(--font-display); }
.bv-theme { margin: 0; font-size: 13px; color: var(--text-2); }
.bv-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.bv-meta span { display: inline-flex; align-items: center; gap: 4px; }
.bv-best.ok { color: var(--ok); } .bv-best.mid { color: var(--warn); } .bv-best.bad { color: #ff8b88; }
.bv-act { display: grid; gap: 7px; margin-top: auto; padding-top: 10px; }

.bv-hist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.bv-hist:last-child { border-bottom: 0; }
.bv-hist-note { display: flex; align-items: baseline; gap: 1px; font-family: var(--font-display); font-size: 25px; min-width: 62px; }
.bv-hist-note em { font-size: 12px; font-style: normal; color: var(--text-3); }
.bv-hist-note.ok { color: var(--ok); } .bv-hist-note.mid { color: var(--warn); } .bv-hist-note.bad { color: #ff8b88; }
.bv-parts { display: flex; gap: 3px; margin-top: 5px; }
.bv-parts i { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bv-parts i::after { content: ''; display: block; width: var(--p, 0%); height: 5px; background: var(--accent); }
.bv-sources { margin-top: 26px; }

.bv-brief { display: grid; gap: 12px; margin-top: 4px; }
.bv-brief-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; align-items: start; }
.bv-brief-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); color: var(--accent); }
.bv-brief-txt { display: block; min-width: 0; }
.bv-brief b { display: block; font-size: 14px; line-height: 1.35; }
.bv-brief small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }

/* ---------- La composition ---------------------------------------------- */
/* --sticky-top : hauteur de la barre du haut (0 sur ordinateur, où elle est cachée) */
:root { --sticky-top: 0px; }
.bv-bar {
  position: sticky; top: var(--sticky-top); z-index: 30; display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 9px; align-items: center; margin: 0 0 22px; padding: 11px 13px 13px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: rgba(24, 24, 26, .96); backdrop-filter: blur(14px);
}
.bv-bar-txt { display: grid; gap: 1px; min-width: 0; }
.bv-bar-txt b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-bar-txt span { font-size: 11.8px; color: var(--text-3); }
.bv-bar-txt i { font-style: normal; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bv-bar-txt i.over { color: var(--warn); }
.bv-prog { grid-column: 1 / -1; height: 3px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bv-prog i { display: block; height: 3px; border-radius: 99px; background: var(--accent); transition: width .3s var(--ease); }

.bv-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.bv-paper { min-width: 0; }
.bv-side { display: none; }
.bv-intro { margin-bottom: 30px; }
.bv-intro .display { font-size: clamp(28px, 6vw, 44px); margin: 8px 0 6px; }
.bv-intro-txt { margin: 14px 0 18px; }
.bv-intro-txt p { margin: 0 0 10px; font-size: 14.5px; color: var(--text-2); }
.bv-docs { display: grid; gap: 8px; margin-bottom: 18px; }
.bv-doc { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.bv-doc > summary { padding: 12px 14px; cursor: pointer; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bv-doc > div { padding: 0 14px 14px; }
.bv-doc p { margin: 0 0 6px; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }

.bv-part { margin-bottom: 34px; }
.bv-part-head { padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.bv-part-head .h2 { margin: 0 0 4px; }
.bv-part-head p { margin: 0 0 8px; }

.bv-q {
  padding: 16px; margin-bottom: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s;
}
.bv-q.done { border-color: rgba(242, 227, 92, .26); background: linear-gradient(120deg, var(--accent-soft), var(--surface) 55%); }
.bv-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 10px; }
.bv-q-n { font: 400 19px/1 var(--font-display); color: var(--accent); }
.bv-q-pts { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.bv-q-ok { margin-left: auto; color: var(--text-3); opacity: 0; transition: opacity .2s, color .2s; }
.bv-q.done .bv-q-ok { opacity: 1; color: var(--accent); }
.bv-q-txt { margin: 0 0 12px; font-size: 15px; line-height: 1.6; white-space: pre-line; }
.bv-q-help { display: flex; gap: 7px; margin: -4px 0 12px; font-size: 13px; color: var(--text-3); font-style: italic; }
.bv-q-help .i { flex-shrink: 0; color: var(--accent); font-style: normal; }
.bv-text { min-height: 0; resize: vertical; }
.bv-num { max-width: 280px; font-weight: 700; }

.bv-choices { display: grid; gap: 8px; }
.bv-choice {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; align-items: center;
  padding: 11px 13px; border-radius: 11px; border: 1.5px solid var(--line-strong);
  background: var(--surface-2); cursor: pointer; font-size: 14.5px; transition: border-color .16s, background .16s;
}
.bv-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bv-choice:hover { background: var(--surface-3); }
.bv-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.bv-letter { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); font: 400 15px/1 var(--font-display); color: var(--text-2); }
.bv-choice.on .bv-letter { background: var(--accent); color: var(--accent-ink); }
.bv-end { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; }
.bv-end p { margin: 0 0 14px; font-size: 14px; }

/* ---------- La copie corrigée ------------------------------------------- */
.bv-result { padding: 24px; margin-bottom: 28px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); text-align: center; }
.bv-note { display: flex; align-items: baseline; justify-content: center; gap: 4px; flex-wrap: wrap; }
.bv-note b { font: 400 clamp(56px, 16vw, 88px)/1 var(--font-display); }
.bv-note em { font: 400 24px/1 var(--font-display); font-style: normal; color: var(--text-3); }
.bv-note span { flex-basis: 100%; margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.bv-note.ok b { color: var(--ok); } .bv-note.mid b { color: var(--warn); } .bv-note.bad b { color: #ff8b88; }
.bv-verdict { margin: 14px auto 4px; max-width: 40ch; font-size: 15px; color: var(--text-2); }
.bv-parts-scores { display: grid; gap: 10px; margin: 20px 0 6px; text-align: left; }
.bv-part-score { display: grid; grid-template-columns: minmax(0, 1fr) 90px 50px; gap: 12px; align-items: center; }
.bv-part-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bv-part-bar i { display: block; height: 7px; border-radius: 99px; background: var(--text-2); transition: width .8s var(--ease); }
.bv-part-bar i.ok { background: var(--ok); } .bv-part-bar i.mid { background: var(--warn); } .bv-part-bar i.bad { background: #ff8b88; }
.bv-part-score > b { text-align: right; font-size: 14px; }
.bv-part-score > b.ok { color: var(--ok); } .bv-part-score > b.mid { color: var(--warn); } .bv-part-score > b.bad { color: #ff8b88; }
.bv-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }

.bv-rows { display: grid; gap: 9px; margin-bottom: 26px; }
.bv-r { border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.bv-r > summary { display: grid; grid-template-columns: 24px 46px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 13px 14px; cursor: pointer; }
.bv-r > summary::-webkit-details-marker { display: none; }
.bv-r-ic { color: var(--text-3); }
.bv-r-n { font: 400 15px/1 var(--font-display); color: var(--text-2); }
.bv-r-t { font-size: 13.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-r-p { font-size: 14px; font-weight: 700; white-space: nowrap; }
.bv-r-p em { font-size: 11.5px; font-style: normal; font-weight: 500; color: var(--text-3); }
.bv-r.ok { border-color: rgba(98, 207, 142, .3); } .bv-r.ok .bv-r-ic, .bv-r.ok .bv-r-p { color: var(--ok); }
.bv-r.mid { border-color: rgba(240, 165, 74, .3); } .bv-r.mid .bv-r-ic, .bv-r.mid .bv-r-p { color: var(--warn); }
.bv-r.bad { border-color: rgba(239, 100, 97, .3); } .bv-r.bad .bv-r-ic, .bv-r.bad .bv-r-p { color: #ff8b88; }
.bv-r-body { padding: 0 14px 16px; display: grid; gap: 13px; }
.bv-r-block b { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.bv-given { margin: 0; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; }
.bv-r-block.ai p { margin: 0; padding: 11px 13px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; color: var(--text); }
.bv-r-block.ai b { color: var(--accent); }
.bv-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bv-keys b { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.bv-keys b.ok { color: var(--ok); } .bv-keys b.bad { color: #ff8b88; }
.bv-fix { padding: 13px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.65; }
.bv-fix p { margin: 0 0 9px; } .bv-fix p:last-child { margin-bottom: 0; }
.bv-fix strong { color: var(--accent); }
.bv-fix ul, .bv-fix ol { margin: 0 0 9px; padding-left: 20px; }

/* ---------- Sur ordinateur : le sujet à côté des questions -------------- */
@media (min-width: 1100px) {
  body.bv-split .bv-stage { grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); }
  body.bv-split .bv-side { display: block; position: sticky; top: 90px; height: calc(100vh - 130px); }
  .bv-side-head { display: flex; align-items: center; gap: 8px; padding: 0 0 8px; font-size: 13px; }
  .bv-side-head b { display: flex; align-items: center; gap: 7px; flex: 1; }
  .bv-side iframe { width: 100%; height: calc(100% - 32px); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
}

/* ==========================================================================
   Téléphone
   ========================================================================== */
@media (max-width: 900px) {
  /* six onglets : on serre un peu le texte */
  .tabbar[data-n="6"] .tab { font-size: 10px; padding: 7px 0; }
  .tabbar[data-n="6"] .tab .i { font-size: 19px; }

  .al { grid-template-columns: 38px minmax(0, 1fr) 18px; gap: 10px; padding: 11px 12px; }
  .al-ic { width: 38px; height: 38px; font-size: 17px; }
  .pl-step { grid-template-columns: 22px 32px minmax(0, 1fr) auto; gap: 9px; }
  .pl-ic { width: 32px; height: 32px; }

  .hwc-top { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .hwc-ic { width: 32px; height: 32px; }
  .hwc-check { width: 44px; height: 44px; }

  .notes-hero { gap: 16px; padding: 18px; }
  .ev-row { grid-template-columns: 7px minmax(0, 1fr) auto; row-gap: 9px; }
  .ev-row .btn, .ev-row .btn-icon { grid-column: 2 / span 2; justify-self: start; }
  .mk-val b { font-size: 24px; }

  .vs-row { grid-template-columns: minmax(0, 1fr); }
  .vs-act { justify-content: flex-start; }
  .acc-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .acc-act { grid-column: 1 / span 2; }

  .marks-wrap { max-height: 46vh; }
  .marks-table th:nth-child(4), .marks-table td:nth-child(4) { display: none; }
  .mt-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

  .bv-grid { grid-template-columns: minmax(0, 1fr); }
  :root { --sticky-top: 58px; }
  .bv-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .bv-bar .btn-sm:not(.btn-primary) { display: none; }
  .bv-q { padding: 14px; }
  .bv-result { padding: 20px 16px; }
  .bv-part-score { grid-template-columns: minmax(0, 1fr) 60px 42px; gap: 9px; }
  .bv-r > summary { grid-template-columns: 20px 40px minmax(0, 1fr) auto; gap: 8px; padding: 12px; }
}
@media (max-width: 360px) {
  .tabbar[data-n="6"] .tab span { font-size: 9px; }
  .hw-day-head b { font-size: 19px; }
  .bv-note b { font-size: 52px; }
}

/* moins d'animations : on garde tout lisible, sans mouvement */
@media (prefers-reduced-motion: reduce) {
  .al, .hwc, .pl-step, .bv-card { animation: none; }
}
html.reduce-motion .al, html.reduce-motion .hwc, html.reduce-motion .pl-step, html.reduce-motion .bv-card { animation: none; }

/* pied du bloc des documents découpés */

/* constats de l'algorithme (page Progression) */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ins {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.ins-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ins b { font-size: 14px; }
.ins p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
html.reduce-motion .ins { animation: none; }

/* ==========================================================================
   v9 — Réharmonisation
   --------------------------------------------------------------------------
   Le site s'était chargé au fil des ajouts : panneaux de tailles différentes,
   colonne latérale sur ordinateur et carrousel sur téléphone, six styles de
   cartes. On garde toutes les fonctions, mais on les range :

     · une seule colonne, la même sur téléphone et sur ordinateur ;
     · un bloc « Aujourd'hui » qui réunit la révision, les alertes et le plan ;
     · une grille de cartes toutes bâties pareil pour le reste ;
     · un rythme vertical unique (--sp) et deux tailles de titres, pas six.
   ========================================================================== */

:root {
  --sp: 22px;            /* respiration entre deux sections */
  --sp-sm: 14px;         /* respiration à l'intérieur d'un bloc */
}

/* ---------- Rythme commun ------------------------------------------------ */
.section-head { margin: var(--sp) 0 var(--sp-sm); }
.section-head:first-child { margin-top: 0; }
.h2 { font-size: 25px; }
.page-head { margin-bottom: var(--sp); }
.panel { padding: 18px; }
.panel + .panel { margin-top: 12px; }

/* l'accueil est désormais une seule colonne */
.home-grid { display: block; }
.side-stack { display: grid; gap: 12px; }

/* ---------- Bloc « Aujourd'hui » ----------------------------------------- */
.today { padding: 0; overflow: hidden; }
.today-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.today-head .h3 { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.today-head .h3 .i { color: var(--accent); }

.today-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 18px; }
.today-ring { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 28px; }
.today-txt { display: grid; gap: 3px; min-width: 0; }
.today-txt b { font: 400 21px/1.15 var(--font-display); }
.today-txt span { font-size: 13.5px; color: var(--text-2); }
.today-btns { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; }
.today .ring-in b { font: 400 26px/1 var(--font-display); }
.today .ring-in small { display: block; font-size: 11px; color: var(--text-3); }

.today-sep {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px 8px; border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.today-sep span { display: flex; align-items: center; gap: 7px; }
.today-sep em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; }
.today-sep .link { font-size: 12px; text-transform: none; letter-spacing: 0; }
.today .al-list, .today .pl-list { margin: 0; padding: 0 12px 12px; background: none; border: 0; gap: 8px; }
.today .al { background: var(--surface-2); border-color: var(--line); }
.today .al:hover { background: var(--surface-3); }
.today-more { margin: 0; border-radius: 0; border: 0; border-top: 1px solid var(--line); height: 42px; color: var(--text-3); }
.today-more:hover { background: var(--surface-2); color: var(--text); }

/* ---------- « Ton espace » : des cartes toutes identiques ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; align-items: stretch; }
.card-grid > .panel { margin-top: 0; height: 100%; display: flex; flex-direction: column; }
.card-grid > .panel > .btn:last-child, .card-grid > .panel > .stack:last-child { margin-top: auto; }
.card-grid .panel-head { margin-bottom: 10px; }
.card-grid p { margin-bottom: 14px; }
/* la vieille carte « Envie d'aider » prend le costume des autres */
.cta-card { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.cta-card h3 { display: none; }

/* ---------- Bandeaux et notices, plus calmes ----------------------------- */
.notice { padding: 13px 15px; font-size: 13.5px; }
.stats-row { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: var(--sp); }
.stat-card { padding: 14px; }
.stat-card .num { font-size: 34px; }
.stat-card .lbl { margin-top: 5px; font-size: 11.5px; }

/* ---------- Visiteur : le rappel de connexion ---------------------------- */
.guest-bar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); width: min(680px, calc(100vw - 28px));
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 11px; align-items: center;
  grid-template-areas: 'ic txt go x';
  padding: 11px 12px; border-radius: 15px; border: 1px solid var(--line-strong);
  background: rgba(28, 28, 32, .97); backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  animation: guest-in .45s var(--ease) both;
}
@keyframes guest-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.guest-ic { grid-area: ic; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.guest-go { grid-area: go; }
.guest-x { grid-area: x; }
.guest-txt { grid-area: txt; display: grid; gap: 1px; min-width: 0; }
.guest-txt b { font-size: 13.5px; }
.guest-txt span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-x { color: var(--text-3); }
html.reduce-motion .guest-bar { animation: none; }
body:has(.guest-bar) .main { padding-bottom: 110px; }

/* ==========================================================================
   Téléphone
   ========================================================================== */
@media (max-width: 900px) {
  :root { --sp: 18px; --sp-sm: 12px; }
  .h2 { font-size: 22px; }
  .hero-title { font-size: clamp(30px, 8.5vw, 42px); }
  .panel { padding: 16px; }

  .today-main { grid-template-columns: auto minmax(0, 1fr); gap: 13px; padding: 15px; }
  .today-ring { width: 60px; height: 60px; border-radius: 17px; font-size: 24px; }
  .today .ring { width: 60px !important; height: 60px !important; }
  .today-txt b { font-size: 18px; }
  .today-btns { grid-column: 1 / -1; }
  .today-btns .btn { flex: 1; min-width: 130px; }
  .today-sep { padding: 11px 15px 7px; }
  .today .al-list, .today .pl-list { padding: 0 10px 10px; }

  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-card .num { font-size: 30px; }

  /* le bandeau visiteur se range au-dessus de la barre du bas */
  .guest-bar {
    bottom: calc(72px + env(safe-area-inset-bottom)); width: calc(100vw - 20px);
    grid-template-columns: 34px minmax(0, 1fr) auto; row-gap: 9px; padding: 10px 11px;
    grid-template-areas: 'ic txt x' 'go go go';
  }
  .guest-ic { width: 34px; height: 34px; }
  .guest-go { width: 100%; }
  /* la barre ne doit rien cacher en bas de page */
  body:has(.guest-bar) .main { padding-bottom: 168px; }
  body.kb-open .guest-bar, body.in-chat.chat-open .guest-bar { display: none; }
}
@media (max-width: 340px) {
  .guest-txt span { display: none; }
}

/* Repli d'information : remplace un gros bandeau par une ligne discrète */
.fold { margin-bottom: var(--sp); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.fold > summary {
  display: flex; align-items: center; gap: 9px; padding: 12px 15px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '⌄'; margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.fold[open] > summary::after { transform: rotate(180deg); }
.fold > summary:hover { color: var(--text); }
.fold > summary .i { color: var(--accent); }
.fold p { margin: 0 15px 12px; font-size: 13.5px; color: var(--text-2); }

/* ==========================================================================
   v10 — Le mouvement
   --------------------------------------------------------------------------
   Sur ordinateur, la souris fait vivre l'interface. Sur téléphone, il n'y a
   ni survol ni curseur : tout paraissait figé. On rend donc le mouvement
   au doigt et au défilement.

   On anime « translate » et « scale » (les propriétés séparées) plutôt que
   « transform » : ainsi rien n'écrase les inclinaisons 3D déjà en place.
   ========================================================================== */

/* ---------- Révélation au défilement -------------------------------------
   Tant que le bloc n'est pas atteint, il attend ; il arrive quand on y est.
   On emploie une TRANSITION, pas une animation : dans un onglet mis en
   arrière-plan, le temps des animations se fige et le bloc resterait
   invisible. Avec une transition, l'état d'arrivée s'applique quoi qu'il
   arrive — au pire sans être vu bouger.
   On anime « translate » / « scale » / « rotate » (les propriétés séparées)
   pour ne jamais écraser un « transform » déjà posé ailleurs.
   Double classe : pour passer devant .cahier.tilt, qui redéfinit transition. */
.reveal.reveal {
  animation: none !important;
  transition: opacity .5s var(--ease), translate .6s var(--ease),
              scale .6s var(--ease), rotate .6s var(--ease);
  transition-delay: calc(var(--mi, 0) * 45ms);
}
.reveal.reveal:not(.in) { opacity: 0; translate: 0 18px; scale: .984; }
.reveal.reveal.in { opacity: 1; translate: none; scale: none; rotate: none; }
/* une carte de l'étagère arrive en tournant un peu : elle a une épaisseur */
.cahier.reveal.reveal:not(.in) { translate: 0 26px; scale: .93; rotate: -2.5deg; }

/* ---------- Réponse au doigt --------------------------------------------- */
@media (hover: none) {
  .btn:active, .btn-icon:active, .tab:active, .cahier:active, .qcard:active,
  .al:active, .pl-step:active, .hwc:active, .hwc-check:active, .bv-card:active,
  .agc-row:active, .acc-row:active, .member:active, .bv-choice:active,
  .sc-chip:active, .call-name:active, .cgal-i:active, .chip-link:active,
  .fd-main:active, .nav-item:active, .seg button:active, .tabs button:active,
  .bv-r > summary:active, .fold > summary:active, .toc-row:active {
    scale: .965;
    transition: scale .09s ease-out;
  }
  /* un cahier qu'on touche s'enfonce et se redresse */
  .cahier:active { scale: .955; rotate: -1deg; }

  /* l'étagère respire : la lumière passe sur les couvertures, l'une après l'autre */
  .cahier-shine { opacity: 1; animation: shelf-shine 7s ease-in-out infinite; animation-delay: calc(var(--mi, 0) * 800ms - 2s); }
  @keyframes shelf-shine {
    0%, 62%, 100% { opacity: 0; }
    72% { opacity: .55; }
    86% { opacity: 0; }
  }
  .cahier-shine { background: linear-gradient(112deg, transparent 32%, rgba(255, 255, 255, .3) 48%, transparent 62%); }
}

/* ---------- La barre du bas ---------------------------------------------- */
.tab .i { transition: transform .34s var(--spring), color .2s; }
.tab.active .i { transform: translateY(-2px) scale(1.14); }
.tab span { transition: opacity .25s var(--ease); }
.tab:not(.active) span { opacity: .82; }

/* ---------- Changement de page ------------------------------------------- */
@media (max-width: 900px) {
  .main.rise { animation: page-in .4s var(--ease) both; }
  @keyframes page-in { from { opacity: 0; translate: 0 20px; } to { opacity: 1; translate: none; } }
  /* les titres arrivent un cran après le reste */
  .main.rise .page-head { animation: head-in .5s .04s var(--ease) both; }
  @keyframes head-in { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: none; } }
}

/* ---------- Petits signes de vie ----------------------------------------- */
/* la pastille « à revoir » pulse doucement quand il y a du retard */
.nav-badge:not([hidden]):not(.soft) { animation: pop-spring .4s var(--spring), badge-pulse 2.6s 1s ease-in-out infinite; }
@keyframes badge-pulse { 0%, 88%, 100% { scale: 1; } 94% { scale: 1.16; } }

/* l'anneau de progression se remplit à l'arrivée */
.ring-fg { transition: stroke-dashoffset 1.1s var(--ease); }

/* le bouton principal d'une page respire tant qu'on n'y a pas touché */
.today-btns .btn-primary:not(:disabled) { animation: breathe 3.4s 1.2s ease-in-out infinite; }
@keyframes breathe { 0%, 82%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 90% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- Animations réduites : on coupe tout -------------------------- */
html.reduce-motion .reveal.reveal:not(.in) { opacity: 1; translate: none; scale: none; rotate: none; }
html.reduce-motion .cahier-shine,
html.reduce-motion .nav-badge,
html.reduce-motion .today-btns .btn-primary { animation: none !important; }


/* ==========================================================================
   Les visites guidées
   --------------------------------------------------------------------------
   Un calque plein écran, une partie par chapitre, une barre d'avancement, et
   au milieu une scène qui défile. Tout est pensé téléphone d'abord.
   ========================================================================== */
#guide-root { position: relative; z-index: 132; }
.guide { position: fixed; inset: 0; z-index: 132; display: flex; flex-direction: column;
  background: var(--bg); animation: gd-in .32s var(--spring) both; }
.guide.closing { animation: gd-out .24s ease forwards; }
@keyframes gd-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes gd-out { to { opacity: 0; transform: translateY(8px); } }

.gd-head { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line); }
.gd-head > b { display: inline-flex; align-items: center; gap: 7px; font: 600 14.5px var(--font-ui); }
.gd-head > b svg { width: 18px; height: 18px; color: var(--accent); }
.gd-parts { display: flex; gap: 5px; margin-left: auto; margin-right: 4px; }
.gd-parts i { width: 7px; height: 7px; border-radius: 99px; background: var(--surface-3); transition: all .25s var(--spring); }
.gd-parts i.done { background: var(--accent); opacity: .45; }
.gd-parts i.now { background: var(--accent); width: 20px; }
.gd-rail { height: 2px; background: var(--surface-2); }
.gd-rail i { display: block; height: 100%; background: var(--accent); transition: width .35s var(--spring); }

.gd-stage { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.gd-scene { max-width: 620px; margin: 0 auto; padding: 22px 16px 28px; animation: gd-scene .34s var(--spring) both; }
@keyframes gd-scene { from { opacity: 0; transform: translateY(12px); } }
.gd-part { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--surface-2);
  color: var(--text-3); font: 700 10.5px/1.5 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.gd-title { margin: 12px 0 0; font: 400 27px/1.2 var(--font-display); }
.gd-title em { font-style: normal; color: var(--accent); }
.gd-text { margin-top: 12px; font: 400 15.5px/1.6 var(--font-ui); color: var(--text-2); }
.gd-text b { color: var(--text); font-weight: 650; }
.gd-text code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); font: 500 13.5px ui-monospace, 'Cascadia Code', Consolas, monospace; color: var(--text); }
.gd-tip { display: flex; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); font: 400 13.5px/1.45 var(--font-ui); color: var(--text-2); }
.gd-tip svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--accent); }
.gd-art { margin-top: 18px; padding: 18px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; }

.gd-foot { display: flex; align-items: center; gap: 12px; padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface); }
.gd-foot .btn-primary { margin-left: auto; }
.gd-count { margin: 0 auto; font: 500 12.5px var(--font-ui); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* --- Le point de contrôle : on répond, on comprend, on avance ----------- */
.gd-check { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gd-check > b { display: flex; gap: 8px; font: 600 14.5px/1.4 var(--font-ui); }
.gd-check > b svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent); }
.gd-opts { display: grid; gap: 8px; margin-top: 12px; }
.gd-opt { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  font: 400 14px/1.35 var(--font-ui); color: var(--text); text-align: left; cursor: pointer; transition: all .18s; }
.gd-opt:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.gd-opt:disabled { cursor: default; opacity: .6; }
.gd-opt.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); opacity: 1; }
.gd-opt.no { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); opacity: 1; }
.gd-why { display: flex; gap: 8px; margin: 12px 0 0; font: 400 13.5px/1.45 var(--font-ui); color: var(--text-2); }
.gd-why svg { width: 17px; height: 17px; flex: 0 0 auto; }
.gd-why.ok svg { color: var(--ok); }
.gd-why.no svg { color: var(--text-3); }

/* --- L'atelier de blocs : on choisit, on voit ---------------------------- */
.gd-lab { display: grid; gap: 12px; }
.gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border: 1px solid var(--line);
  border-radius: 99px; background: var(--surface-2); font: 500 12.5px var(--font-ui); color: var(--text-2); cursor: pointer; transition: all .18s; }
.gd-chip svg { width: 14px; height: 14px; }
.gd-chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.gd-out { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.gd-out > *:first-child { margin-top: 0; }
.gd-out > *:last-child { margin-bottom: 0; }
.gd-src { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  font: 400 11.5px/1.5 ui-monospace, 'Cascadia Code', Consolas, monospace; color: var(--text-3); white-space: pre-wrap; overflow-x: auto; }

/* --- Les illustrations --------------------------------------------------- */
.gd-shelf { display: flex; justify-content: center; align-items: flex-end; gap: 10px; height: 96px; }
.gd-book { position: relative; width: 44px; height: 74px; border-radius: 3px 7px 7px 3px; background: var(--c);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28); animation: gd-pop .5s var(--spring) both; animation-delay: var(--d); }
.gd-book b { position: absolute; inset: 9px 8px auto 10px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .6); }
.gd-book i { position: absolute; inset: 18px 14px auto 10px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
@keyframes gd-pop { from { opacity: 0; transform: translateY(14px) rotate(-6deg); } }

.gd-path { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.gd-node { display: grid; justify-items: center; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); min-width: 92px; animation: gd-pop .45s var(--spring) both; animation-delay: var(--d); }
.gd-node svg { width: 20px; height: 20px; color: var(--accent); }
.gd-node b { font: 600 12.5px var(--font-ui); }
.gd-node small { font: 400 11px var(--font-ui); color: var(--text-3); text-align: center; }
.gd-link svg { width: 16px; height: 16px; color: var(--text-3); }

.gd-flip { display: grid; place-items: center; perspective: 900px; }
.gd-card { width: min(300px, 100%); height: 150px; position: relative; transform-style: preserve-3d;
  transition: transform .55s var(--spring); background: none; border: 0; padding: 0; cursor: pointer; }
.gd-flip.back .gd-card { transform: rotateY(180deg); }
.gd-face { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 6px;
  padding: 16px; border-radius: var(--radius); backface-visibility: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.gd-face.back { transform: rotateY(180deg); background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.gd-face small { font: 700 10px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.gd-face b { font: 400 19px/1.3 var(--font-display); text-align: center; }
.gd-face em { display: inline-flex; align-items: center; gap: 5px; font: 400 11.5px var(--font-ui); font-style: normal; opacity: .6; }
.gd-face em svg { width: 13px; height: 13px; }

.gd-srs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.gd-step { display: grid; gap: 2px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--surface-2);
  border-left: 3px solid var(--text-3); animation: gd-pop .45s var(--spring) both; animation-delay: var(--d); }
.gd-step.bad { border-left-color: #c8483e; }
.gd-step.mid { border-left-color: #b4762a; }
.gd-step.ok { border-left-color: #2d8566; }
.gd-step b { font: 600 12px var(--font-ui); }
.gd-step small { font: 400 11px var(--font-ui); color: var(--text-3); }

.gd-kinds, .gd-groupes, .gd-medias, .gd-feed { display: grid; gap: 8px; }
.gd-kind, .gd-grp, .gd-md, .gd-fd { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 4px 11px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  animation: gd-pop .45s var(--spring) both; animation-delay: var(--d); }
.gd-kind svg, .gd-grp svg, .gd-md svg, .gd-fd svg { grid-row: span 2; width: 20px; height: 20px; color: var(--accent); }
.gd-kind b, .gd-grp b, .gd-md b, .gd-fd b { font: 600 13.5px var(--font-ui); }
.gd-kind small, .gd-grp small, .gd-md small, .gd-fd small { font: 400 11.5px var(--font-ui); color: var(--text-3); }

.gd-flame { display: grid; grid-template-columns: auto auto auto; justify-content: center; align-items: center; gap: 14px; }
.gd-av { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 99px; background: var(--surface-3); }
.gd-av svg { width: 22px; height: 22px; color: var(--text-2); }
.gd-fl { display: inline-flex; align-items: center; gap: 3px; color: #ff8a3d; font: 800 20px var(--font-ui); }
.gd-fl svg { width: 28px; height: 28px; animation: gd-flicker 2.4s ease-in-out infinite; }
@keyframes gd-flicker { 0%, 100% { transform: none; } 50% { transform: scale(1.12) rotate(-3deg); } }
.gd-fl-note { grid-column: 1 / -1; text-align: center; font: 400 12px var(--font-ui); color: var(--text-3); }

.gd-scribe { display: flex; align-items: center; justify-content: center; gap: 12px; }
.gd-photo, .gd-doc { display: grid; gap: 5px; align-content: center; width: 92px; height: 106px; padding: 12px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2); }
.gd-photo { transform: rotate(-3deg); }
.gd-photo i, .gd-doc i { height: 5px; border-radius: 3px; background: var(--surface-3); }
.gd-photo i:nth-child(2n) { width: 72%; }
.gd-doc { background: var(--paper); }
.gd-doc i { background: rgba(0, 0, 0, .18); height: 4px; }
.gd-doc i:nth-child(3n) { width: 64%; }
.gd-wand svg { width: 24px; height: 24px; color: var(--accent); animation: gd-flicker 2.2s ease-in-out infinite; }

.gd-brevet { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gd-year { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); font: 600 13px var(--font-ui); animation: gd-pop .45s var(--spring) both; animation-delay: var(--d); }
.gd-year svg { width: 17px; height: 17px; color: var(--accent); }
.gd-blanc { flex: 1 0 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 4px; font: 400 12.5px var(--font-ui); color: var(--text-3); }
.gd-blanc svg { width: 15px; height: 15px; }

.gd-palette { display: grid; gap: 10px; justify-items: center; }
.gd-tb { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: var(--radius-sm); background: var(--surface-2); }
.gd-tb i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--surface-3); }
.gd-tb i svg { width: 15px; height: 15px; color: var(--text-2); }
.gd-plus { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink); font: 600 12px var(--font-ui); }
.gd-plus svg { width: 13px; height: 13px; }
.gd-drawer { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 340px; }
.gd-drawer em { padding: 5px 10px; border-radius: 99px; background: var(--surface-2); font: 500 11.5px var(--font-ui);
  font-style: normal; color: var(--text-2); animation: gd-pop .4s var(--spring) both; animation-delay: var(--d); }

@media (min-width: 720px) { .gd-title { font-size: 31px; } .gd-scene { padding-top: 30px; } }
@media (prefers-reduced-motion: reduce) {
  .guide, .gd-scene, .gd-book, .gd-node, .gd-step, .gd-kind, .gd-grp, .gd-md, .gd-fd, .gd-year, .gd-drawer em,
  .gd-fl svg, .gd-wand svg { animation: none !important; }
  .gd-card { transition: none; }
}

/* ==========================================================================
   v16 — « Pour toi », le lecteur, la page d'une vidéo, la Ranked, « Toi »
   ========================================================================== */

/* ---------- le « + » au milieu de la barre du bas ------------------------- */
.nav-item.nav-plus .i { color: var(--accent); }
@media (max-width: 900px) {
  .tab-plus { justify-content: center; }
  .tab-plus .i {
    display: grid; place-items: center; width: 42px; height: 30px; margin-top: -2px;
    border-radius: 11px; background: var(--accent); color: var(--accent-ink);
    font-size: 20px; box-shadow: 0 6px 18px -8px var(--accent-glow, rgba(242, 227, 92, .4));
    transition: transform .2s var(--spring);
  }
  .tab-plus:active .i { transform: scale(.92); }
  .tab-plus.active .i { color: var(--accent-ink); }
  .tab-plus span { color: var(--text-3); }
}

/* ---------- « Pour toi » : le fil de vidéos ------------------------------- */
.page-head.for-you { margin-bottom: 20px; }
.vfeed { display: grid; gap: 26px 18px; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }
.vcard { display: grid; gap: 10px; color: inherit; text-decoration: none; }
.vcard-big { grid-column: 1 / -1; }
.vthumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 14px; background: var(--surface-2);
}
.vcard-big .vthumb { border-radius: 18px; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.vcard:hover .vthumb img { transform: scale(1.04); }
.vthumb-none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: var(--text-3); }
.vplay {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 34px; color: #fff; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle at center, rgba(0, 0, 0, .45), transparent 62%);
}
.vcard:hover .vplay, .vcard:focus-visible .vplay { opacity: 1; }
.vlen, .vid-time, .pl-len {
  position: absolute; right: 7px; bottom: 7px; padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .78); color: #fff; font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.vresume { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .55); }
.vresume i { display: block; height: 100%; background: var(--danger); }
.vmeta { display: grid; gap: 3px; min-width: 0; }
.vtitle { font-size: 15px; line-height: 1.32; font-weight: 650; }
.vcard-big .vtitle { font-size: 20px; }
.vsub, .vstats { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.vstats { color: var(--text-3); font-size: 12px; }
.vstats .i { font-size: 12px; }
.vdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.vwhy {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 3px;
  font-size: 11.5px; color: var(--accent); opacity: .9;
}
.vwhy .i { font-size: 12px; }
.vcard.skel { pointer-events: none; }
.vfeed-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 32px 0 6px; }

/* ---------- le lecteur ---------------------------------------------------- */
.pl {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px;
  background: #000; user-select: none;
}
.pl video { width: 100%; height: 100%; display: block; background: #000; }
.pl-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.pl-big {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 68px; height: 68px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: 28px; backdrop-filter: blur(6px);
  transition: transform .2s var(--spring), opacity .2s;
}
.pl-big:active { transform: translate(-50%, -50%) scale(.93); }
.pl.playing .pl-big { opacity: 0; pointer-events: none; }
.pl-spin { position: absolute; left: 50%; top: 50%; translate: -50% -50%; font-size: 30px; color: #fff; }
.pl-bar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, .82), transparent);
  opacity: 1; transition: opacity .25s;
}
.pl.playing:not(:hover):not(:focus-within) .pl-bar { opacity: 0; }
.pl-seek { position: relative; height: 16px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.pl-seek::before { content: ''; position: absolute; left: 0; right: 0; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .25); }
.pl-buf, .pl-done { position: absolute; left: 0; height: 4px; border-radius: 99px; }
.pl-buf { background: rgba(255, 255, 255, .38); }
.pl-done { background: var(--accent); }
.pl-knob {
  position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px; translate: 0 -50%;
  border-radius: 50%; background: var(--accent); opacity: 0; transition: opacity .18s;
}
.pl-seek:hover .pl-knob, .pl-seek.grab .pl-knob, .pl-seek:focus-visible .pl-knob { opacity: 1; }
.pl-seek.grab::before, .pl-seek:hover::before { height: 5px; }
.pl-row { display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.pl-b {
  display: grid; place-items: center; width: 36px; height: 34px; border: 0; border-radius: 9px;
  background: none; color: #fff; font-size: 18px;
}
.pl-b:hover { background: rgba(255, 255, 255, .14); }
.pl-speed { width: auto; min-width: 38px; padding: 0 7px; font-size: 12.5px; font-weight: 700; }
.pl-time { padding: 0 8px; color: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: .9; }
.pl-away { display: grid; place-items: center; }
.pl-away-in {
  position: relative; display: grid; justify-items: center; gap: 7px; padding: 22px 18px; text-align: center;
}
.pl-away-in b { font-size: 16px; max-width: 30ch; }
.pl-away-in small { color: var(--text-2); font-size: 12px; }
.pl-away .pl-big { position: static; translate: none; margin-bottom: 4px; }
.pl-away .pl-big:active { transform: scale(.93); }
.pl.left .pl-away-in::after {
  content: 'Lecture lancée dans un onglet · le temps regardé est compté';
  font-size: 11px; color: var(--accent); opacity: .85;
}
.pl-broken { outline: 1px solid var(--warn); }
.pl:fullscreen { border-radius: 0; aspect-ratio: auto; height: 100%; }

/* ---------- la page d'une vidéo ------------------------------------------- */
.vpage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.vpage-main { min-width: 0; }
.vp-title { font: 650 23px/1.26 var(--font-ui); margin: 16px 0 6px; letter-spacing: -.01em; }
.vp-line { display: flex; gap: 7px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.vp-acts { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 16px 0 0; }
.vp-vote { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 99px; overflow: hidden; }
.vote {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0;
  background: var(--surface); color: var(--text-2); font-size: 13.5px; font-weight: 650;
  font-variant-numeric: tabular-nums; transition: background .16s, color .16s;
}
.vote + .vote { border-left: 1px solid var(--line); }
.vote:hover { background: var(--surface-2); color: var(--text); }
.vote.on { background: var(--accent-soft); color: var(--accent); }
.vote.on.down { background: rgba(239, 100, 97, .14); color: var(--danger); }
.vp-note, .vp-why {
  display: flex; gap: 11px; margin: 16px 0 0; padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2);
}
.vp-why { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.vp-why .i, .vp-note .i { flex: none; color: var(--accent); }
.vpage-side { min-width: 0; }
.vnext { display: grid; gap: 12px; }
.vnext-row { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 11px; color: inherit; text-decoration: none; }
.vnext-th {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center; color: var(--text-3);
}
.vnext-th img { width: 100%; height: 100%; object-fit: cover; }
.vnext-tx { display: grid; gap: 3px; align-content: start; min-width: 0; }
.vnext-tx b { font-size: 13.5px; line-height: 1.3; font-weight: 650; }
.vnext-tx small { font-size: 11.5px; color: var(--text-3); }
.vnext-row:hover .vnext-tx b { color: var(--accent); }

/* ---------- les commentaires --------------------------------------------- */
.vcom { margin-top: 34px; }
.vcom-new { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; margin-bottom: 22px; }
.vcom-field { display: grid; gap: 9px; }
.vcom-field textarea { resize: none; min-height: 42px; }
.vcom-tools { display: flex; align-items: center; gap: 8px; }
.vcom-locked {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap; padding: 15px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); margin-bottom: 20px;
}
.vcom-locked .i { font-size: 20px; color: var(--accent); flex: none; }
.vcom-locked div { display: grid; gap: 3px; min-width: 190px; flex: 1; }
.vcom-locked span { font-size: 12.5px; color: var(--text-2); }
.vcom-list { display: grid; gap: 20px; }
.vcom-it { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.vcom-body { min-width: 0; }
.vcom-who { display: flex; align-items: baseline; gap: 8px; }
.vcom-who b { font-size: 13.5px; }
.vcom-tx { margin: 4px 0 6px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.vcom-row { display: flex; align-items: center; gap: 4px; }
.vcom-b {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 0; border-radius: 99px;
  background: none; color: var(--text-3); font-size: 12.5px; font-weight: 600;
}
.vcom-b:hover { background: var(--surface-2); color: var(--text); }
.vcom-b.on { color: var(--accent); }
.vcom-replies { display: grid; gap: 16px; margin-top: 14px; padding-left: 4px; border-left: 2px solid var(--line); padding-left: 14px; }
.vcom-it.is-reply .vcom-tx { font-size: 13.5px; }

/* ---------- la section « Toi » ------------------------------------------- */
.toi-me {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center;
}
.toi-who { display: grid; gap: 3px; min-width: 0; }
.toi-who b { font: 650 19px/1.2 var(--font-ui); }
.toi-bio { font-size: 13px; color: var(--text-2); }
.toi-stats { display: flex; gap: 7px; flex-wrap: wrap; }
.toi-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.toi-tile {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 13px; align-items: center;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit; text-align: left;
  transition: border-color .16s, background .16s, transform .16s var(--ease);
}
.toi-tile:hover { border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-1px); }
.toi-tile > .i { font-size: 19px; color: var(--text-3); }
.toi-ic {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface-2); color: var(--accent); font-size: 18px;
}
.toi-tx { display: grid; gap: 2px; min-width: 0; }
.toi-tx b { font-size: 14.5px; font-weight: 650; }
.toi-tx small { font-size: 12px; color: var(--text-3); }
.toi-badge {
  min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800;
}
.toi-out { margin: 34px 0 10px; display: flex; justify-content: center; }


/* ---------- le « + » : créer ---------------------------------------------- */
.creer-why { display: flex; gap: 14px; align-items: flex-start; }
.creer-why > .i { font-size: 26px; color: var(--accent); flex: none; margin-top: 2px; }
.creer-why b { display: block; font-size: 15px; margin-bottom: 4px; }
.creer-list { display: grid; gap: 9px; margin-top: 18px; }
.creer-it {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px;
}
.creer-it .i { font-size: 18px; color: var(--accent); flex: none; }
.creer-it b { display: block; font-size: 13.5px; }
.creer-it small { color: var(--text-3); font-size: 12px; }
.creer-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.creer-card {
  display: grid; gap: 3px; justify-items: start; padding: 16px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: inherit; text-align: left;
  transition: border-color .16s, transform .16s var(--ease);
}
.creer-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.creer-card .i { font-size: 22px; color: var(--accent); margin-bottom: 6px; }
.creer-card b { font-size: 14.5px; }
.creer-card small { font-size: 12px; color: var(--text-3); }

/* ---------- la Ranked ----------------------------------------------------- */
.rk-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center;
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--tc) 18%, transparent), transparent 62%),
    var(--surface);
}
.rk-crest {
  position: relative; display: grid; place-items: center; width: 62px; height: 70px;
  color: var(--tc); font-size: 27px;
  background: color-mix(in srgb, var(--tc) 14%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent);
  clip-path: polygon(50% 0, 100% 17%, 100% 74%, 50% 100%, 0 74%, 0 17%);
}
.rk-crest i {
  position: absolute; bottom: 7px; font-style: normal; font-size: 10.5px; font-weight: 800;
  letter-spacing: .06em; color: var(--tc);
}
.rk-txt { display: grid; gap: 5px; min-width: 0; }
.rk-label { font: 650 22px/1.1 var(--font-ui); color: var(--tc); letter-spacing: -.01em; }
.rk-rp { font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rk-via { font-size: 12px; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.rk-prog { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 3px; }
.rk-prog i { display: block; height: 100%; border-radius: 99px; background: var(--tc); transition: width .5s var(--ease); }
.rk-nums { display: grid; grid-auto-flow: column; gap: 16px; text-align: center; }
.rk-num { display: grid; gap: 1px; }
.rk-num b { font-size: 20px; font-variant-numeric: tabular-nums; }
.rk-num small { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.rk-start, .rk-queue, .rk-ready { margin-top: 16px; }
.rk-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.rk-queue { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.rk-queue .rk-btns { grid-column: 1 / -1; margin-top: 4px; }
.rk-radar { font-size: 32px; color: var(--accent); }
.spin-slow { animation: spin 2.4s linear infinite; }
.rk-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin-bottom: 14px; }
.rk-side { display: grid; justify-items: center; gap: 5px; text-align: center; }
.rk-side b { font-size: 14px; }
.rk-side small { font-size: 11.5px; color: var(--text-3); }
.rk-vs-x { font: 650 17px/1 var(--font-display); color: var(--text-3); }

/* l'arène : une manche, plein écran */
.rk-arena { display: grid; gap: 16px; max-width: 680px; margin: 0 auto; min-height: 60vh; align-content: start; }
.rk-top { display: flex; align-items: center; gap: 10px; }
.rk-step { font: 650 20px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.rk-step small { font-size: 13px; color: var(--text-3); font-weight: 500; }
.rk-clock { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rk-clock i { display: block; height: 100%; background: var(--accent); transition: width .12s linear; }
.rk-clock i[style*="width: 1"], .rk-clock i[style*="width: 2"] { background: var(--danger); }
.rk-q { font: 650 23px/1.32 var(--font-ui); margin: 8px 0 4px; letter-spacing: -.01em; }
.rk-choices { display: grid; gap: 10px; }
.rk-ch {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; align-items: center;
  padding: 16px 17px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); color: inherit; text-align: left; font-size: 15.5px;
  transition: border-color .14s, background .14s, transform .14s var(--ease), opacity .2s;
}
.rk-ch:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.rk-ch:active:not(:disabled) { transform: scale(.99); }
.rk-ch.picked { border-color: var(--accent); background: var(--accent-soft); }
.rk-ch.dim { opacity: .42; }
.rk-k {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: var(--surface-3); font-size: 12.5px; font-weight: 800; color: var(--text-2);
}
.rk-ch.picked .rk-k { background: var(--accent); color: var(--accent-ink); }
.rk-late { color: var(--warn); font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.rk-dots { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
.rk-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.rk-dots i.done { background: var(--text-3); }
.rk-dots i.now { background: var(--accent); transform: scale(1.3); }
.rk-wait { display: grid; justify-items: center; gap: 12px; padding: 50px 0; font-size: 30px; color: var(--accent); }
.rk-wait b { font-size: 15px; color: var(--text); }

/* le résultat */
.rk-res.won { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.rk-res.lost { border-color: color-mix(in srgb, var(--danger) 38%, var(--line)); }
.rk-score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin: 6px 0 12px; }
.rk-sc { display: grid; justify-items: center; gap: 2px; text-align: center; }
.rk-sc b { font: 650 30px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.rk-sc small { font-size: 11.5px; color: var(--text-3); }
.rk-sc-x { color: var(--text-3); }
.rk-move { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0; }
.rk-move .i { color: var(--accent); }
.rk-detail { margin-top: 14px; }
.rk-detail summary { cursor: pointer; font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.rk-list { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.rk-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; font-size: 13.5px; }
.rk-list li.ok > .i { color: var(--ok); }
.rk-list li.ko > .i { color: var(--danger); }
.rk-list small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* la route vers Legend */
.rk-road { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.rk-road-done { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.rk-road-pace {
  position: absolute; top: -4px; width: 3px; height: 18px; border-radius: 2px;
  background: var(--text); box-shadow: 0 0 0 2px var(--surface);
}
.rk-road-lab { display: flex; justify-content: space-between; margin-top: 7px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* le classement */
.rk-rows { display: grid; gap: 2px; }
.rk-row {
  display: grid; grid-template-columns: 32px auto minmax(0, 1fr) auto auto; gap: 11px; align-items: center;
  padding: 9px 10px; border-radius: 10px; font-size: 13.5px;
}
.rk-row:nth-child(odd) { background: var(--surface-2); }
.rk-row.me { background: var(--accent-soft); outline: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.rk-place { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-3); text-align: right; }
.rk-row.top .rk-place { color: var(--accent); }
.rk-name { display: grid; min-width: 0; }
.rk-name b { font-size: 13.5px; font-weight: 650; }
.rk-name small { font-size: 11px; color: var(--text-3); }
.rk-tier { font-size: 12px; font-weight: 700; color: var(--tc); white-space: nowrap; }
.rk-tier .i { font-size: 12px; }
.rk-pts { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 48px; text-align: right; }

/* l'échelle */
.rk-tiers { display: grid; gap: 5px; }
.rk-tier-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 7px 9px; border-radius: 10px; opacity: .5;
}
.rk-tier-row.passed { opacity: 1; }
.rk-tier-row.here { background: color-mix(in srgb, var(--tc) 12%, transparent); opacity: 1; }
.rk-tier-row .rk-crest { width: 32px; height: 36px; font-size: 14px; }
.rk-tier-row b { font-size: 13.5px; }
.rk-mini { border-color: color-mix(in srgb, var(--tc, var(--accent)) 35%, var(--line)); }

/* ---------- téléphone ----------------------------------------------------- */
@media (max-width: 1050px) {
  .vpage { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .vnext { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }
  .vnext-row { grid-template-columns: 112px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .vfeed { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .vcard-big .vtitle { font-size: 17px; }
  .vthumb, .vcard-big .vthumb { border-radius: 12px; }
  .pl { border-radius: 12px; margin: 0 -16px; width: calc(100% + 32px); border-radius: 0; }
  .vp-title { font-size: 19px; margin-top: 14px; }
  .rk-card { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 16px; }
  .rk-nums { grid-column: 1 / -1; grid-auto-flow: column; gap: 8px; }
  .rk-num b { font-size: 17px; }
  .rk-label { font-size: 19px; }
  .rk-q { font-size: 19px; }
  .rk-ch { padding: 14px; font-size: 14.5px; }
  .rk-queue { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .rk-row { grid-template-columns: 26px auto minmax(0, 1fr) auto; gap: 9px; font-size: 13px; }
  .rk-row .rk-tier { display: none; }
  .toi-me { grid-template-columns: auto minmax(0, 1fr); }
  .toi-me .btn { grid-column: 1 / -1; justify-self: start; }
  .toi-stats { grid-column: 1 / -1; }
  .toi-grid { grid-template-columns: minmax(0, 1fr); }
  .vcom-new { grid-template-columns: minmax(0, 1fr); }
  .vcom-new .av { display: none; }
}
@media (max-width: 360px) {
  .rk-nums { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .pl-b { width: 32px; }
  .pl-time { padding: 0 4px; font-size: 11.5px; }
}

/* ---------- le laboratoire de l'algorithme (admin, v16) ------------------- */
.lab-arms { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); margin-top: 14px; }
.lab-arm {
  display: grid; gap: 2px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.lab-arm b { font-size: 13px; }
.lab-arm small { font-size: 11.5px; color: var(--text-3); }
.lab-rows { display: grid; gap: 2px; margin-top: 6px; overflow-x: auto; }
.lab-row {
  display: grid; grid-template-columns: minmax(150px, 2fr) 72px 72px 78px 128px 80px;
  gap: 8px; align-items: center; padding: 9px 10px; border-radius: 9px;
  font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 580px;
}
.lab-row.lab-head { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.lab-row:not(.lab-head):nth-of-type(odd) { background: var(--surface-2); }
.lab-row.won { background: color-mix(in srgb, var(--ok) 13%, transparent); outline: 1px solid color-mix(in srgb, var(--ok) 32%, transparent); }
.lab-row.thin { opacity: .55; }
.lab-row i.faint { font-style: normal; font-size: 11px; }
.lab-lift { font-weight: 700; }
.lab-lift.up { color: var(--ok); }
.lab-lift.down { color: var(--danger); }
.lab-log { display: grid; gap: 7px; }
.lab-log-it { display: flex; gap: 9px; align-items: baseline; font-size: 13px; }
.lab-log-it .i { color: var(--accent); flex: none; }

/* ==========================================================================
   v17 — la vidéothèque rangée, le défilement sans fin, le dépôt d'un fichier
   ========================================================================== */

/* ---------- le bas du fil : la suite arrive toute seule -------------------- */
.vfeed-end { min-height: 60px; margin-top: 28px; }
.vfeed-wait { display: grid; place-items: center; padding: 26px 0; font-size: 26px; color: var(--text-3); }
.vfeed-done {
  display: grid; justify-items: center; gap: 4px; padding: 30px 16px; text-align: center;
  border-top: 1px solid var(--line); color: var(--text-3);
}
.vfeed-done .i { font-size: 24px; color: var(--ok); margin-bottom: 4px; }
.vfeed-done b { color: var(--text); font-size: 15px; }
.vfeed-done span { font-size: 13px; }
.vtag {
  position: absolute; left: 7px; top: 7px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: 7px; background: rgba(0, 0, 0, .72); color: #fff;
  font-size: 11px; font-weight: 650;
}
.vtag .i { font-size: 12px; }

/* ---------- la vidéothèque : outils ---------------------------------------- */
.vlib-tools { display: grid; gap: 12px; margin-bottom: 26px; }
.vlib-search { position: relative; display: block; }
.vlib-search > .i {
  position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--text-3); font-size: 17px;
  pointer-events: none;
}
.vlib-search .input { padding-left: 40px; }
.vlib-search .input::-webkit-search-cancel-button { filter: invert(.6); }
.vlib-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.vlib-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; transition: border-color .14s, color .14s, background .14s;
}
.vlib-chip .i { font-size: 15px; color: var(--c, var(--text-3)); }
.vlib-chip:hover { border-color: var(--c, var(--line-strong)); color: var(--text); }
.vlib-chip.on { background: var(--surface-2); border-color: var(--c, var(--accent)); color: var(--text); }

/* ---------- un rayon : une matière ---------------------------------------- */
.vshelf { margin-bottom: 36px; }
.vshelf-head {
  display: flex; align-items: center; gap: 11px; padding-bottom: 11px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.vshelf-ic {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface-2));
  color: var(--c, var(--accent)); font-size: 17px; flex: none;
}
.vshelf-name { font: 650 19px/1.2 var(--font-ui); margin: 0; flex: 1; letter-spacing: -.01em; }

/* ---------- un chapitre ---------------------------------------------------- */
.vch-list { display: grid; gap: 14px; }
.vch {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px 16px; scroll-margin-top: 80px;
}
.vch-head { display: flex; align-items: center; gap: 8px; }
.vch-title {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 4px 0;
  border: 0; background: none; color: inherit; text-align: left;
}
.vch-title > .i { color: var(--text-3); font-size: 17px; flex: none; transition: color .14s; }
.vch-title:hover > .i { color: var(--accent); }
.vch-title b { font-size: 15.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vch-n {
  flex: none; padding: 2px 8px; border-radius: 99px; background: var(--surface-2);
  color: var(--text-3); font-size: 11.5px; font-weight: 650;
}
.vch-note { margin: 6px 0 0 26px; font-size: 13px; color: var(--text-2); }
.vch-grid {
  display: grid; gap: 12px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
}
.vtile { position: relative; }
.vtile-go { display: grid; gap: 6px; color: inherit; text-decoration: none; }
.vtile-th {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px;
  background: var(--surface-2);
}
.vtile-th img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.vtile-go:hover .vtile-th img { transform: scale(1.05); }
.vtile-go b { font-size: 13px; line-height: 1.3; font-weight: 600; }
.vtile-go small { font-size: 11.5px; color: var(--text-3); }
.vtile-here {
  position: absolute; left: 6px; top: 6px; display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--ok); color: #0d2417; font-size: 12px;
}
.vtile-x {
  position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .72); color: #fff; font-size: 14px;
  opacity: 0; transition: opacity .16s, background .16s;
}
.vtile:hover .vtile-x, .vtile-x:focus-visible { opacity: 1; }
.vtile-x:hover { background: var(--danger); }
@media (hover: none) { .vtile-x { opacity: .9; } }
.vch-more {
  display: grid; place-content: center; justify-items: center; gap: 1px; aspect-ratio: 16 / 9;
  border: 1px dashed var(--line-strong); border-radius: 10px; background: none; color: var(--text-3);
  transition: border-color .16s, color .16s;
}
.vch-more:hover { border-color: var(--accent); color: var(--accent); }
.vch-more .i { font-size: 18px; }
.vch-more b { font-size: 15px; }
.vch-more small { font-size: 11px; }

/* ---------- déposer un fichier --------------------------------------------- */
.drop {
  display: grid; justify-items: center; gap: 4px; padding: 30px 20px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: border-color .16s, background .16s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has { border-style: solid; border-color: var(--ok); }
.drop-ic { font-size: 30px; color: var(--accent); margin-bottom: 4px; }
.drop b { font-size: 15px; }
.drop small { font-size: 12.5px; color: var(--text-3); }
.drop-got {
  display: flex; align-items: center; gap: 11px; margin-top: 12px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--ok) 11%, var(--surface));
}
.drop-got .i { color: var(--ok); font-size: 19px; flex: none; }
.drop-got b { display: block; font-size: 13.5px; overflow-wrap: anywhere; }
.drop-got small { font-size: 12px; color: var(--text-3); }

/* ---------- le lecteur quand il n'a pas le fichier ------------------------- */
.pl-away-in { max-width: 420px; }
.pl-away-ic { font-size: 30px; color: var(--text-2); }
.pl-away-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.pl.left .pl-away-in::after { content: none; }

@media (max-width: 900px) {
  .vch { padding: 12px 13px 14px; }
  .vch-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .vshelf-name { font-size: 17px; }
  .vlib-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .vlib-chips::-webkit-scrollbar { display: none; }
  .vlib-chip { flex: none; }
}
@media (max-width: 360px) {
  .vch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vch-note { margin-left: 0; }
}

/* ---------- le lecteur prêté : il vit DANS notre cadre (v18) -------------- */
.pl-frame { background: #000; }
.pl-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
/* la barre d'Elite 3 passe AU-DESSUS du lecteur emprunté */
.pl-frame .pl-bar { z-index: 2; }
/* leurs boutons à eux : on laisse la place en bas pour ne pas les recouvrir */
.pl-frame:not(.pl-yt) .pl-bar { display: none; }
.pl-grow {
  position: absolute; right: 10px; top: 10px; z-index: 2; display: grid; place-items: center;
  width: 36px; height: 36px; border: 0; border-radius: 10px; font-size: 18px;
  background: rgba(0, 0, 0, .62); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s;
}
.pl-frame:hover .pl-grow, .pl-grow:focus-visible { opacity: 1; }
@media (hover: none) { .pl-grow { opacity: .85; } }
/* en plein écran, c'est NOTRE fenêtre qui s'agrandit, pas la leur */
.pl-frame:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.pl-frame:fullscreen iframe { position: absolute; inset: 0; }
.pl-yt .pl-bar { padding-top: 34px; }

/* ---------- « Aller à… » : le navigateur (v18) ---------------------------- */
.nav-panel { padding-bottom: 6px; }
.nav-panel .palette-list { padding: 0 0 8px; }
.nav-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line); font-size: 15px;
}
.nav-head .i { color: var(--accent); font-size: 18px; }
.nav-head b { flex: 1; font-weight: 650; }
.nav-group {
  padding: 15px 18px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
}
.nav-dest {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 10px 18px; border: 0; background: none; color: inherit; text-align: left;
}
.nav-dest:hover, .nav-dest:focus-visible { background: var(--surface-2); }
.nav-ic {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--c, var(--accent)) 15%, var(--surface-2));
  color: var(--c, var(--accent)); font-size: 16px;
}
.nav-txt { display: grid; gap: 1px; min-width: 0; }
.nav-txt b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-txt span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.i.nav-go { color: var(--text-3); font-size: 16px; opacity: 0; transition: opacity .14s; }
.nav-dest:hover .nav-go, .nav-dest:focus-visible .nav-go { opacity: 1; }

/* ---------- la recherche de vidéos (v18) ---------------------------------- */
.vsearch { position: relative; display: block; margin-bottom: 22px; }
.vsearch > .i {
  position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--text-3);
  font-size: 17px; pointer-events: none;
}
.vsearch .input { padding-left: 42px; padding-right: 42px; }
.vsearch .input::-webkit-search-cancel-button { display: none; }
.vsearch-x {
  position: absolute; right: 8px; top: 50%; translate: 0 -50%; display: grid; place-items: center;
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface-3);
  color: var(--text-2); font-size: 14px;
}
.vsearch-x:hover { background: var(--surface-2); color: var(--text); }
.vsearch-n { margin: 0 0 14px; font-size: 13px; color: var(--text-3); }
.vsearch-none {
  display: grid; justify-items: center; gap: 4px; padding: 44px 16px; text-align: center; color: var(--text-3);
}
.vsearch-none .i { font-size: 28px; margin-bottom: 6px; }
.vsearch-none b { color: var(--text); font-size: 15px; }
.vsearch-none span { font-size: 13px; }
.vlib-tools .vsearch { margin-bottom: 0; }

/* ---------- l'historique des vidéos (v18) --------------------------------- */
.hist-list { display: grid; gap: 12px; }
.hist-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none;
  transition: background .14s;
}
.hist-row:hover { background: var(--surface); }
.hist-row.is-gone { opacity: .55; }
.hist-th {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center; color: var(--text-3);
}
.hist-th img { width: 100%; height: 100%; object-fit: cover; }
.hist-tx { display: grid; gap: 2px; min-width: 0; }
.hist-tx b { font-size: 14.5px; font-weight: 650; }
.hist-tx small { font-size: 12px; color: var(--text-3); }
.hist-when { display: inline-flex; align-items: center; gap: 5px; }
.hist-when .i { font-size: 13px; color: var(--ok); }
.hist-gone {
  padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-3);
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
@media (max-width: 560px) {
  .hist-row { grid-template-columns: 118px minmax(0, 1fr); gap: 11px; padding: 8px; }
  .hist-gone { grid-column: 2; justify-self: start; }
}

/* ==========================================================================
   v19 — cloche, Ranked animée, mode facile, multi-classes
   ========================================================================== */

/* ---------- la cloche des notifications ----------------------------------- */
.sb-top { display: flex; gap: 8px; align-items: stretch; }
.sb-top .search-btn { flex: 1; }
.tb-bell {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 19px;
  transition: background .15s, color .15s;
}
.tb-bell:hover { background: var(--surface-3); color: var(--text); }
.tb-bell.has { color: var(--accent); }
.tb-bell.has .i { animation: bell-wobble 2.2s ease-in-out 1s 2; transform-origin: top center; }
@keyframes bell-wobble { 0%,92%,100% { transform: rotate(0); } 94% { transform: rotate(10deg); } 96% { transform: rotate(-8deg); } 98% { transform: rotate(5deg); } }
.tb-badge {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; box-shadow: 0 0 0 2px var(--bg-2);
}
.notif-wrap { position: fixed; inset: 0; z-index: 112; }
.notif-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 9, .5); backdrop-filter: blur(3px); animation: fade-in .18s both; }
.notif-panel {
  position: absolute; top: 58px; right: 14px; width: min(380px, calc(100vw - 24px)); max-height: 72vh;
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: rgba(28, 28, 31, .98); border: 1px solid var(--line-strong);
  box-shadow: 0 32px 70px -22px rgba(0, 0, 0, .9); animation: notif-pop .26s var(--spring) both;
}
@keyframes notif-pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-head .i:first-child { color: var(--accent); }
.notif-head b { flex: 1; font-weight: 650; }
.notif-head .link { font-size: 12.5px; }
.notif-head .btn-icon { width: 30px; height: 30px; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-it {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px;
  align-items: center; padding: 11px 12px; border-radius: 12px; color: inherit; text-decoration: none;
}
.notif-it:hover { background: var(--surface-2); }
.notif-it.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-ic {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface-2)); color: var(--c, var(--accent)); font-size: 17px;
}
.notif-tx { display: grid; gap: 1px; min-width: 0; }
.notif-tx b { font-size: 13.5px; font-weight: 600; }
.notif-x { font-style: normal; color: var(--accent); font-size: 12px; margin-left: 4px; }
.notif-body { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-tx small { font-size: 11px; color: var(--text-3); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.notif-empty, .notif-wait { display: grid; justify-items: center; gap: 4px; padding: 40px 16px; text-align: center; color: var(--text-3); }
.notif-empty .i { font-size: 26px; margin-bottom: 4px; }
.notif-empty b { color: var(--text); font-size: 14.5px; }
.notif-empty span { font-size: 12.5px; }
.notif-wait { font-size: 26px; color: var(--accent); }
@media (max-width: 900px) {
  .notif-panel { top: 56px; right: 8px; left: 8px; width: auto; }
}

/* ---------- Ranked : le lancement (VS + 3-2-1) ---------------------------- */
.rk-launch { display: grid; justify-items: center; gap: 22px; padding: 30px 10px; min-height: 60vh; align-content: center; }
.rk-vs-big { grid-template-columns: 1fr auto 1fr; width: 100%; max-width: 440px; gap: 18px; }
.rk-vs-big .rk-side { animation: rk-slide-in .5s var(--spring) both; }
.rk-side-me { animation-name: rk-from-left !important; }
.rk-side-foe { animation-name: rk-from-right !important; }
@keyframes rk-from-left { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes rk-from-right { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.rk-vs-big .rk-vs-x {
  font: 700 26px/1 var(--font-display); color: var(--accent);
  animation: rk-vs-pop .5s .3s var(--spring) both;
}
@keyframes rk-vs-pop { from { opacity: 0; transform: scale(.3) rotate(-12deg); } to { opacity: 1; transform: none; } }
.av-bot { display: grid; place-items: center; background: var(--surface-3); color: var(--warn); }
.rk-go {
  font: 800 86px/1 var(--font-ui); color: var(--accent); letter-spacing: -.03em;
  text-shadow: 0 8px 40px var(--accent-glow, rgba(242, 227, 92, .4));
}
.rk-go[key] { animation: rk-go-pop .8s var(--spring); }
@keyframes rk-go-pop { 0% { opacity: 0; transform: scale(2.2); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: .2; transform: scale(.7); } }

/* ---------- Ranked : pendant la manche ------------------------------------ */
.rk-clock.rk-hurry i { background: var(--danger); }
.rk-clock.rk-hurry { animation: rk-shake .4s ease-in-out infinite; }
@keyframes rk-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.rk-arena.rk-locked .rk-ch.picked { animation: rk-lock .45s var(--spring); }
@keyframes rk-lock { 0% { transform: scale(1); } 40% { transform: scale(1.04); box-shadow: 0 0 0 4px var(--accent-soft); } 100% { transform: scale(1); } }
.rk-q { animation: rk-q-in .4s var(--ease) both; }
@keyframes rk-q-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rk-ch { animation: rk-q-in .35s var(--ease) both; }
.rk-ch:nth-child(1) { animation-delay: .04s; } .rk-ch:nth-child(2) { animation-delay: .09s; }
.rk-ch:nth-child(3) { animation-delay: .14s; } .rk-ch:nth-child(4) { animation-delay: .19s; }

/* ---------- Ranked : le résultat ------------------------------------------ */
.rk-reveal { position: relative; overflow: hidden; animation: rk-q-in .4s var(--ease) both; }
.rk-stamp {
  position: absolute; right: -6px; top: -6px; font-size: 92px; opacity: .06; color: var(--text);
  pointer-events: none; transform: rotate(-12deg);
}
.rk-res.won .rk-stamp { color: var(--ok); }
.rk-res.lost .rk-stamp { color: var(--danger); }
.rk-gain { animation: rk-gain-pop .5s .2s var(--spring) both; }
@keyframes rk-gain-pop { from { transform: scale(0); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
.rk-promote {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 11px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--tc) 16%, var(--surface)); color: var(--text);
  font-size: 14px; animation: rk-gain-pop .5s .35s var(--spring) both;
}
.rk-promote.up .i { color: var(--tc); }
.rk-promote.down { background: rgba(239, 100, 97, .12); }
.rk-promote b { color: var(--tc); }

/* ---------- Ranked : la file (compte à rebours) --------------------------- */
.rk-radar { position: relative; display: grid; place-items: center; }
.rk-radar-n {
  position: absolute; font: 700 15px/1 var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums;
}
.rk-queue-tx { min-width: 0; }
.spin-slow { animation: spin 2.4s linear infinite; }

/* ---------- Ranked : la bannière promo ------------------------------------ */
.rk-promo {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px;
  align-items: center; margin: 0 0 20px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--tc, var(--accent)) 40%, var(--line-strong));
  background:
    radial-gradient(130% 150% at 100% 0%, color-mix(in srgb, var(--tc, #ef6b8a) 20%, transparent), transparent 60%),
    var(--surface);
}
.rk-promo-x { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: none; color: var(--text-3); display: grid; place-items: center; }
.rk-promo-x:hover { background: var(--surface-2); color: var(--text); }
.rk-promo-ic {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
  background: color-mix(in srgb, var(--tc, var(--accent)) 20%, var(--surface-2)); color: var(--tc, var(--accent)); font-size: 22px;
}
.rk-promo-tx { display: grid; gap: 3px; min-width: 0; }
.rk-promo-tx b { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.rk-new {
  font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink);
}
.rk-promo-tx span { font-size: 12.5px; color: var(--text-2); }
.rk-promo-tiers { display: flex; gap: 4px; margin-top: 6px; }
.rk-promo-tiers .rk-crest { width: 22px; height: 24px; font-size: 11px; }
@media (max-width: 760px) {
  .rk-promo { grid-template-columns: auto minmax(0, 1fr); }
  .rk-promo .btn { grid-column: 1 / -1; }
}

/* ---------- mode facile : deux boutons ronds sur une série ---------------- */
.deck-play { display: inline-flex; gap: 6px; align-items: center; }
.btn-easy { color: var(--accent); }
.btn-easy:hover { background: var(--accent-soft); }

/* ---------- devoir pour plusieurs classes --------------------------------- */
.class-checks { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- le lecteur simple (bouton play -> source) --------------------- */
.pl-attach-link {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 99px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s;
}
.pl-away:hover .pl-attach-link, .pl-attach-link:focus-visible { opacity: 1; }
@media (hover: none) { .pl-attach-link { opacity: .9; } }

/* ---------- Lisibilité, clavier et adaptation de l'interface -------------- */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 20000;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.boot-loading { padding: 24px 0; color: var(--text-2); }
.main:focus { outline: none; }
html { scroll-padding-block: 80px 104px; }
:where(button, a, input, select, textarea, [tabindex]) { scroll-margin-block: 80px 104px; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn, .btn-icon, .seg button, .tabs button, button.link { min-height: 32px; }
.btn { height: auto; padding-block: 8px; white-space: normal; }
.btn-icon { min-width: 32px; flex-shrink: 0; }
button, a { touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
.btn:active:not(:disabled), .btn-icon:active:not(:disabled), .nav-dest:active { filter: brightness(.85); }
.label { font-size: 14px; }
.sb-label, .brand-sub { font-size: 12px; }
.display, .h2, .modal-title { text-wrap: balance; overflow-wrap: anywhere; }
.lead, .modal-note, .hint, .toi-tx, .vcard-title { overflow-wrap: anywhere; }
.grid-2, .grid-3 { min-width: 0; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2 > .panel, .grid-3 > .panel, .card-grid > .panel { margin-top: 0; }
.toc-open { padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.nb :focus-visible, .bristol-rich :focus-visible { outline-color: var(--ink); }
.swatch small { font-size: 12px; }
.form-errors {
  margin: 0 0 20px; padding: 12px 16px;
  border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--text);
}
.form-errors p { margin: 0; font-weight: 600; }
.form-errors a { display: block; padding-block: 8px; color: var(--text); text-decoration: underline; }
.field-error { margin: 8px 0 0; color: var(--danger); font-size: 14px; }
[aria-invalid=true] { border-color: var(--danger); }
.required-label { color: var(--text-3); font-weight: 400; }
.password-field { position: relative; }
.password-field { display: block; }
.swatch:has(input:focus-visible), .class-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.password-field .input { padding-right: 56px; }
.password-reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.field-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-group legend { margin-bottom: 8px; }
.data-scroll, .ctable-wrap, .marks-wrap { max-width: 100%; overflow-x: auto; }
.data-scroll { border-radius: var(--radius-sm); }
.tc-table, .marks-table { font-variant-numeric: tabular-nums; }
.tc-table caption, .marks-table caption, .ctable caption {
  padding: 8px 0 12px; text-align: left; color: var(--text-2); font-size: 14px;
}
.marks-table tbody th { text-align: left; font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: normal; }
.aide-search .label { padding-left: 0; }
.aide-search > .i { top: auto; bottom: 14px; }
.cahier-locked, .cahier-locked .cahier-name, .rk-tier-row { opacity: 1; }
.cahier-kicker, .cahier-meta { color: #595345; }
.cahier-kicker { font-size: 10px; }
.empty h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
.profile-title { font-size: 36px; margin-bottom: 8px; }
.or-step .or-step-title { margin: 5px 0 4px; font: 400 18px/1.25 var(--font-display); }
.av { color: var(--av-ink, #fff); text-shadow: none; }
.class-av { color: var(--accent-ink); }
.av-colors { grid-template-columns: repeat(5, 32px); }
.av-color { display: grid; place-items: center; width: 32px; height: 32px; }
.av-color:has(input:focus-visible), .wiz-card:has(input:focus-visible), .status-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
/* L'invitation reste dans le flux : aucun cours ni contrôle ne passe dessous. */
.guest-bar {
  position: static; transform: none; margin: 0 auto 24px;
  width: min(680px, calc(100% - 32px));
  background: var(--surface); backdrop-filter: none; box-shadow: none; animation: none;
}
.guest-txt span { white-space: normal; overflow: visible; }
body:has(.guest-bar) .main { padding-bottom: 32px; }
#guest-root { padding-bottom: env(safe-area-inset-bottom); }

@media (max-width: 900px) {
  .btn, .btn-icon, .seg button, .tabs button, button.link, .menu-item, .tchip, .vcom-b { min-height: 44px; }
  .av-colors { grid-template-columns: repeat(4, 44px); }
  .av-color { width: 44px; height: 44px; }
  .topbar .seg button, .brand, .toc-open, .check, .check-mini, .class-chip { min-height: 44px; }
  .brand { min-width: 44px; }
  .btn-icon { min-width: 44px; }
  .seg button { padding-inline: 8px; }
  .guest-bar { width: calc(100% - 32px); }
  #guest-root { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .tc-table, .marks-table { min-width: 560px; }
  .tc-table th:nth-child(2), .tc-table td:nth-child(2),
  .marks-table th:nth-child(4), .marks-table td:nth-child(4) { display: table-cell; }
  .main-chat + #guest-root { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { scroll-behavior: auto !important; }
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .modal, .menu, .palette, .toast, .notif-panel { backdrop-filter: none; background: var(--surface); }
  .modal-backdrop, .palette-backdrop, .notif-backdrop { backdrop-filter: none; background: rgba(0, 0, 0, .85); }
}
@media (prefers-contrast: more) {
  :root { --text-2: #dedee2; --text-3: #c2c2ca; --line: #787881; --line-strong: #9999a2; }
}
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight; }
  .btn, .input, .select, .textarea, .nav-item.active, .tab.active { border: 1px solid ButtonText; }
}
