/* Fluidpilot — fenêtre de lecture des documents de référence (referentiel.js). Charte : Montserrat ; marine #00345E, bleu #00A7FF,
   vert #00D274, saumon #FF6A6E, blanc. Le bleu, le vert et le saumon ne servent jamais de couleur de texte sur fond clair : ils dessinent
   des traits, des jauges et des repères. Aucune ressource extérieure, aucun url(). */
.fpr { --fpr-marine: #00345E; --fpr-bleu: #00A7FF; --fpr-vert: #00D274; --fpr-saumon: #FF6A6E; --fpr-encre: #10263B; --fpr-doux: #4A5D70;
  --fpr-trait: #D5DEE7; --fpr-scene: #E7EDF3; --fpr-police: "Montserrat", "Segoe UI", Arial, sans-serif;
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--fpr-scene); color: var(--fpr-encre);
  font-family: var(--fpr-police); -webkit-text-size-adjust: 100%; animation: fpr-entree .22s ease-out both; }
.fpr *, .fpr *::before, .fpr *::after { box-sizing: border-box; }
.fpr button, .fpr input { font: inherit; color: inherit; }
.fpr [hidden] { display: none !important; }
@keyframes fpr-entree { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* —— En-tête : marine, filet bleu ——*/
.fpr-tete { flex: none; display: flex; align-items: center; gap: 12px; background: var(--fpr-marine); color: #fff;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  box-shadow: inset 0 -3px 0 var(--fpr-bleu); }
.fpr-sceau { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); }
.fpr-sceau svg { width: 22px; height: 22px; }
.fpr-ou { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-bottom: 3px; }
.fpr-sur { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .78); }
.fpr-titre { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.2; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpr-detail { font-size: 12px; line-height: 1.35; color: rgba(255, 255, 255, .82); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpr-fermer { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .32); color: #fff; font-weight: 600; font-size: 14px; transition: background .15s; }
.fpr-fermer:hover { background: rgba(255, 255, 255, .2); }
.fpr-fermer svg { width: 18px; height: 18px; }

/* —— Corps : la scène où défilent les pages ——*/
.fpr-corps { position: relative; flex: 1; min-height: 0; display: flex; }
.fpr-scene { position: relative; flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; outline: none; }
.fpr-progres { position: sticky; top: 0; left: 0; z-index: 2; height: 4px; background: rgba(0, 52, 94, .08); }
.fpr-progres i { display: block; height: 100%; width: 0; background: var(--fpr-bleu); border-radius: 0 3px 3px 0; transition: width .2s ease-out; }
.fpr-pages { margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 18px; transform-origin: 0 0; }
.fpr-page { position: relative; width: 100%; background: #fff; border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 52, 94, .12), 0 8px 24px rgba(0, 52, 94, .10); overflow: hidden; }
.fpr-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fpr-page::after { content: attr(data-n); position: absolute; right: 10px; bottom: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--fpr-doux); background: rgba(255, 255, 255, .92); border: 1px solid var(--fpr-trait); opacity: 0; transition: opacity .2s; pointer-events: none; }
.fpr-page:hover::after { opacity: 1; }
.fpr-page.attente { background: linear-gradient(100deg, #fff 30%, #F1F5F9 50%, #fff 70%) 0 0 / 300% 100%; animation: fpr-reflet 1.4s linear infinite; }
@keyframes fpr-reflet { from { background-position: 100% 0; } to { background-position: 0 0; } }
.fpr-fin { margin: 6px auto 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fpr-doux); }
.fpr-fin::before { content: ""; width: 26px; height: 3px; border-radius: 3px; background: var(--fpr-vert); }

/* —— Chargement : un manomètre dont l'aiguille monte avec le chargement ——*/
.fpr-etat { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px 16px; background: var(--fpr-scene); }
.fpr-carte { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 28px 22px 24px;
  background: #fff; border-radius: 18px; box-shadow: 0 1px 2px rgba(0, 52, 94, .1), 0 18px 40px rgba(0, 52, 94, .12); }
.fpr-mano { width: 168px; height: 118px; }
.fpr-mano .piste { fill: none; stroke: #E3EAF1; stroke-width: 12; stroke-linecap: round; }
.fpr-mano .jauge { fill: none; stroke: var(--fpr-bleu); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .25s ease-out; }
.fpr-mano .graduation { stroke: #B9C7D4; stroke-width: 2; stroke-linecap: round; }
.fpr-mano .zone-fin { fill: none; stroke: var(--fpr-vert); stroke-width: 4; stroke-linecap: round; }
.fpr-mano .aiguille { transform-origin: 84px 84px; transition: transform .25s ease-out; }
.fpr-mano .aiguille path { fill: var(--fpr-marine); }
.fpr-mano .moyeu { fill: var(--fpr-marine); }
.fpr-mano .moyeu-clair { fill: #fff; }
.fpr-mano.inconnu .aiguille { animation: fpr-hesite 1.6s ease-in-out infinite alternate; transition: none; }
@keyframes fpr-hesite { from { transform: rotate(-100deg); } to { transform: rotate(-20deg); } }
.fpr-valeur { font-size: 26px; font-weight: 800; color: var(--fpr-marine); letter-spacing: -.01em; font-variant-numeric: tabular-nums; min-height: 32px; }
.fpr-message { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--fpr-encre); }
.fpr-aide { margin: 0; font-size: 13px; line-height: 1.5; color: var(--fpr-doux); }
.fpr-carte h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--fpr-marine); }
.fpr-alerte { width: 56px; height: 56px; }
.fpr-alerte circle { fill: #FFF1F1; stroke: var(--fpr-saumon); stroke-width: 3; }
.fpr-alerte path { stroke: var(--fpr-marine); stroke-width: 3.2; stroke-linecap: round; fill: none; }
.fpr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.fpr-bouton { min-height: 44px; padding: 0 20px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; border: 1.5px solid var(--fpr-marine);
  background: #fff; color: var(--fpr-marine); transition: background .15s, transform .1s; }
.fpr-bouton.fort { background: var(--fpr-marine); color: #fff; }
.fpr-bouton:hover { background: #EEF3F8; }
.fpr-bouton.fort:hover { background: #0A4677; }
.fpr-bouton:active { transform: scale(.98); }

/* —— Barre d'outils flottante : pages et taille du texte ——*/
.fpr-outils { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 4; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; background: var(--fpr-marine); color: #fff;
  box-shadow: 0 10px 30px rgba(0, 52, 94, .35), 0 0 0 1px rgba(255, 255, 255, .08) inset; white-space: nowrap; max-width: calc(100% - 20px); }
.fpr-outils button { width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.fpr-outils button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.fpr-outils button:disabled { opacity: .35; cursor: default; }
.fpr-outils button svg { width: 20px; height: 20px; }
.fpr-outils .fpr-ajuster { width: auto; min-width: 58px; padding: 0 10px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fpr-sep { width: 1px; height: 22px; margin: 0 4px; background: rgba(255, 255, 255, .22); }
.fpr-num { display: flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 13px; font-weight: 600; }
.fpr-num input { width: 44px; height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); color: #fff;
  text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.fpr-num input::-webkit-outer-spin-button, .fpr-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fpr-num input:focus { background: #fff; color: var(--fpr-marine); }

/* —— Conseil d'usage, une fois par session ——*/
.fpr-conseil { position: absolute; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 4; transform: translate(-50%, 8px); opacity: 0;
  padding: 9px 14px; border-radius: 12px; background: #fff; color: var(--fpr-encre); font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 52, 94, .18);
  border-left: 4px solid var(--fpr-vert); transition: opacity .3s, transform .3s; pointer-events: none; max-width: calc(100% - 32px); white-space: normal; text-align: center; }
.fpr-conseil.vu { opacity: 1; transform: translate(-50%, 0); }

/* —— Pied : la mention de la source ——*/
.fpr-pied { flex: none; margin: 0; padding: 9px max(16px, env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  font-size: 11.5px; line-height: 1.5; color: var(--fpr-doux); background: #fff; border-top: 1px solid var(--fpr-trait); text-align: center; }

.fpr :focus-visible { outline: 3px solid var(--fpr-bleu); outline-offset: 2px; }
/* Pendant la lecture, le petit bouton « Sécurité de mon accès » (garde.js) s'efface : il recouvrirait la mention de la source.
   La vérification du second facteur, elle, reste au-dessus de tout si le serveur la demande. */
html.fpr-ouvert .garde-acces { visibility: hidden; }
.fpr-vivant { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  .fpr-tete { gap: 10px; }
  .fpr-sceau { display: none; }
  .fpr-titre { font-size: 15.5px; }
  .fpr-detail { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .fpr-fermer { padding: 0 12px; }
  .fpr-fermer span { display: none; }
  .fpr-pages { padding: 12px 10px 104px; gap: 12px; }
  .fpr-outils button { width: 38px; height: 38px; }
  .fpr-outils .fpr-ajuster { min-width: 52px; padding: 0 6px; }
  .fpr-num { padding: 0 2px; }
  .fpr-num .fpr-mot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fpr, .fpr-page.attente, .fpr-mano.inconnu .aiguille { animation: none; }
  .fpr-progres i, .fpr-mano .jauge, .fpr-mano .aiguille, .fpr-conseil { transition: none; }
}
@media print { .fpr { display: none !important; } }
