@font-face { font-family: 'Fraunces'; src: url('/polices/fraunces.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/polices/fraunces-italique.woff2') format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('/polices/plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('/polices/plex-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('/polices/plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/polices/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --papier: #f4efe6;
  --papier-2: #ebe3d4;
  --carte: #fbf8f2;
  --filet: #d6ccbb;
  --encre: #171412;
  --encre-2: #5b5249;
  --vermillon: #c8402a;
  --vermillon-f: #a5321f;
  --vert: #2f6b4f;
  --vert-clair: #e3efe6;
  --rouge-clair: #f7e2dc;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Plex', system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, monospace;
  --rayon: 12px;
  --hauteur: 100dvh;
  --bas: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 400 17px/1.5 var(--sans);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--vermillon); outline-offset: 2px; }
[hidden] { display: none !important; }
sup { font-size: .62em; line-height: 0; }

.app { min-height: var(--hauteur); }

/* Bandeau hors ligne */
.bandeau {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px;
  background: var(--encre); color: var(--papier); font-size: 14px; text-align: center;
}

/* Écrans à navigation basse */
.page {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(96px + var(--bas));
}
.entete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.marque { font: 600 22px/1.1 var(--serif); letter-spacing: -.01em; margin: 0; }
.date { color: var(--encre-2); font-size: 15px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 19px; line-height: 1.25; }
p { margin: 0 0 12px; }
.discret { color: var(--encre-2); font-size: 15px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: var(--papier); border-top: 1px solid var(--filet);
  padding-bottom: var(--bas);
}
.nav-int { display: flex; width: 100%; max-width: 560px; }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 12px; min-height: 60px; color: var(--encre-2); text-decoration: none; font-size: 13px; font-weight: 500;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--encre); }
.nav a[aria-current="page"] svg { color: var(--vermillon); }

/* Accueil */
.jour { background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 20px; margin-bottom: 20px; }
.jour h1 { margin-bottom: 16px; }
.programme { list-style: none; margin: 0 0 20px; padding: 0; }
.programme li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--filet); }
.programme li:first-child { border-top: 0; padding-top: 0; }
.programme .quoi { color: var(--encre-2); }
.programme .detail { font-weight: 500; text-align: right; }
.semaine { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }
.points { display: flex; gap: 8px; }
.point { width: 30px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--encre-2); }
.point i { display: block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--encre-2); }
.point.actif i { background: var(--vermillon); border-color: var(--vermillon); }
.point.aujourdhui span { color: var(--encre); font-weight: 600; }
.a-revoir { margin-top: 20px; }
.lien-ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; min-height: 52px; border: 1px solid var(--filet); border-radius: var(--rayon);
  background: var(--carte); text-align: left; margin-bottom: 8px;
}

/* Boutons */
.bouton {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 12px 18px; border-radius: var(--rayon);
  border: 1.5px solid var(--encre); background: var(--encre); color: var(--papier);
  font-weight: 600; font-size: 17px; touch-action: manipulation;
}
.bouton:active { transform: translateY(1px); }
.bouton[disabled] { opacity: .35; cursor: default; transform: none; }
.bouton.second { background: transparent; color: var(--encre); }
.bouton.vermillon { background: var(--vermillon); border-color: var(--vermillon); }
.rangee { display: flex; gap: 8px; }
.rangee > * { flex: 1; }
.rangee .bouton { padding: 10px 6px; font-size: 16px; white-space: nowrap; }
.lien { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--encre-2); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

/* Séance plein écran */
.seance { display: flex; flex-direction: column; height: var(--hauteur); max-width: 640px; margin: 0 auto; }
.seance-haut {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
}
.quitter { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; border-radius: 50%; flex: none; }
.quitter svg { width: 22px; height: 22px; }
.barre { flex: 1; height: 6px; background: var(--papier-2); border-radius: 3px; overflow: hidden; }
.barre i { display: block; height: 100%; width: 0; background: var(--vermillon); transition: width .3s ease; }
.etiquette { font-size: 13px; color: var(--encre-2); min-width: 44px; text-align: right; }
.seance-corps { flex: 1; overflow-y: auto; padding: 8px 20px 24px; -webkit-overflow-scrolling: touch; }
.seance-bas {
  padding: 12px 20px calc(12px + var(--bas)); background: var(--papier);
  border-top: 1px solid var(--filet); display: flex; flex-direction: column; gap: 8px;
}
.genre { font: 500 13px/1 var(--sans); color: var(--vermillon-f); text-transform: none; margin-bottom: 10px; display: block; }
.texte-lecon { font-size: 19px; line-height: 1.55; }
.texte-lecon p { margin-bottom: 14px; }

/* Schémas */
.schema { background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); margin: 4px 0 16px; overflow: hidden; }
.schema svg { display: block; width: 100%; height: auto; }
.schema-controles { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.schema-controles[hidden] { display: none; }
.lecture { font: 500 16px/1.3 var(--mono); text-align: center; min-height: 1.3em; }
.bascule { display: flex; border: 1.5px solid var(--encre); border-radius: 10px; overflow: hidden; }
.bascule button { flex: 1; min-height: 44px; border: 0; background: transparent; font-weight: 500; }
.bascule button[aria-pressed="true"] { background: var(--encre); color: var(--papier); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--encre); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 4px; background: var(--encre); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -13px; border-radius: 50%; background: var(--vermillon); border: 3px solid var(--carte); box-shadow: 0 0 0 1.5px var(--encre); }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--vermillon); border: 3px solid var(--carte); box-shadow: 0 0 0 1.5px var(--encre); }

/* Questions */
.enonce { font: 500 20px/1.4 var(--serif); margin: 0 0 18px; }
.saisie { display: flex; align-items: center; gap: 10px; }
.champ {
  width: 100%; min-height: 56px; padding: 12px 14px; font-size: 22px; font-family: var(--mono);
  border: 1.5px solid var(--encre); border-radius: 10px; background: var(--carte);
}
.champ:focus { outline: none; border-color: var(--vermillon); box-shadow: 0 0 0 3px rgba(200, 64, 42, .18); }
.unite { font: 500 18px var(--mono); color: var(--encre-2); white-space: nowrap; }
.puissance { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.puissance .champ { width: 5.2em; text-align: center; }
.puissance .fois { font: 500 22px var(--mono); }
.puissance .exposant-boite { display: flex; align-items: flex-start; gap: 4px; }
.puissance .exposant-boite .champ { width: 4.2em; font-size: 18px; min-height: 48px; margin-top: -18px; }
.signe { min-width: 48px; min-height: 48px; border: 1.5px solid var(--encre); border-radius: 10px; background: transparent; font: 600 20px var(--mono); margin-top: -18px; }
.zone { width: 100%; min-height: 170px; padding: 14px; font-size: 18px; line-height: 1.5; border: 1.5px solid var(--encre); border-radius: 10px; background: var(--carte); resize: vertical; }
.zone:focus { outline: none; border-color: var(--vermillon); box-shadow: 0 0 0 3px rgba(200, 64, 42, .18); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  text-align: left; min-height: 56px; padding: 14px 16px; border: 1.5px solid var(--filet); border-radius: 10px;
  background: var(--carte); font-size: 17px; line-height: 1.35;
}
.option[aria-pressed="true"] { border-color: var(--encre); box-shadow: inset 0 0 0 1.5px var(--encre); }
.option.bonne { border-color: var(--vert); background: var(--vert-clair); box-shadow: inset 0 0 0 1.5px var(--vert); }
.option.fausse { border-color: var(--vermillon); background: var(--rouge-clair); }
.option[disabled] { cursor: default; color: var(--encre); }
.echelle-valeur { font: 500 26px var(--mono); text-align: center; margin: 6px 0 2px; }
.reperes { position: relative; height: 34px; margin: 0 15px; font-size: 12px; color: var(--encre-2); }
.reperes span { position: absolute; transform: translateX(-50%); white-space: nowrap; top: 0; }
.reperes span::before { content: ''; display: block; width: 1px; height: 6px; background: var(--encre-2); margin: 0 auto 2px; }
.plusmoins { display: flex; gap: 8px; }
.plusmoins button { flex: 1; min-height: 48px; border: 1.5px solid var(--encre); border-radius: 10px; background: transparent; font: 600 20px var(--mono); }
.indices { margin-top: 16px; }
.indice { background: var(--papier-2); border-radius: 10px; padding: 12px 14px; margin-top: 8px; font-size: 16px; }
.verdict { margin-top: 18px; padding: 16px; border-radius: 10px; font-size: 17px; }
.verdict strong { display: block; font-family: var(--serif); font-size: 19px; margin-bottom: 4px; }
.verdict.juste { background: var(--vert-clair); }
.verdict.faux { background: var(--rouge-clair); }
.verdict p:last-child { margin-bottom: 0; }
.modele { background: var(--carte); border: 1px solid var(--filet); border-left: 0; border-radius: 10px; padding: 14px 16px; margin-top: 14px; }
.question-confiance { font-size: 14px; color: var(--encre-2); text-align: center; margin: 0; }

/* Explication */
.idees { list-style: none; padding: 0; margin: 12px 0; }
.idees li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--filet); font-size: 16px; }
.idees li:first-child { border-top: 0; }
.coche { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 1.5px solid var(--encre); display: grid; place-items: center; margin-top: 1px; }
.coche.ok { background: var(--vert); border-color: var(--vert); color: #fff; }
.idees label { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; width: 100%; }
.idees input[type="checkbox"] { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--vert); flex: none; }
.relance { font: italic 500 19px/1.4 var(--serif); margin: 12px 0; }
.attente { display: flex; align-items: center; gap: 10px; color: var(--encre-2); margin: 14px 0; }
.attente i { width: 18px; height: 18px; border: 2px solid var(--filet); border-top-color: var(--vermillon); border-radius: 50%; animation: tour 1s linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }

/* Exemple travaillé */
.pas { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: pas; }
.pas li { counter-increment: pas; position: relative; padding: 10px 0 10px 40px; border-top: 1px solid var(--filet); font-size: 18px; }
.pas li::before { content: counter(pas); position: absolute; left: 0; top: 9px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--encre); display: grid; place-items: center; font: 500 14px var(--mono); }
.pas li.neuf { animation: apparition .35s ease; }
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } }

/* Carte */
.branche { border-top: 1px solid var(--filet); padding: 14px 0; }
.branche-titre { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.branche-titre b { font: 500 13px var(--mono); color: var(--vermillon-f); margin-right: 8px; }
.notions { list-style: none; margin: 12px 0 0; padding: 0; }
.notions li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; }
.notions button { background: none; border: 0; padding: 0; text-align: left; font-size: 17px; min-height: 44px; }
.etat { font-size: 13px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--filet); white-space: nowrap; color: var(--encre-2); }
.etat.validee { background: var(--vert-clair); border-color: var(--vert); color: var(--vert); }
.etat.provisoire, .etat.en_cours, .etat.ouverte { border-color: var(--encre); color: var(--encre); }
.etat.a-revoir { background: var(--rouge-clair); border-color: var(--vermillon); color: var(--vermillon-f); }

/* Carnet */
.entree { border-top: 1px solid var(--filet); padding: 16px 0; }
.entree p { white-space: pre-wrap; margin: 8px 0 0; }

/* Connexion */
.connexion { min-height: var(--hauteur); display: flex; flex-direction: column; justify-content: center; max-width: 400px; margin: 0 auto; padding: 24px; }
.connexion h1 { font-size: 40px; margin-bottom: 28px; }
.connexion label { display: block; font-weight: 500; margin-bottom: 8px; }
.mdp { position: relative; margin-bottom: 16px; }
.mdp .champ { font-family: var(--sans); font-size: 18px; padding-right: 60px; }
.oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; background: none; display: grid; place-items: center; border-radius: 8px; }
.oeil svg { width: 24px; height: 24px; }
.erreur { color: var(--vermillon-f); min-height: 1.5em; margin: 0 0 12px; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 700px) {
  .seance-corps { padding: 16px 28px 28px; }
}
