/*!
 * Apnéo - thème « nuit » (bleu marine profond, clair de lune).
 * Mobile d'abord, utilisable à une main, police Atkinson Hyperlegible Next
 * (conçue pour la lisibilité), hébergée localement : aucun appel externe.
 */
@font-face {
  font-family: 'Atkinson Next';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Next';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
}

:root {
  --nuit-0: #060e22;
  --nuit-1: #0b1a3a;
  --nuit-2: #122650;
  --nuit-3: #1c3466;
  --nuit-4: #2b4784;
  --encre: #eef2fc;
  --brume: #a9b7d9;
  --lune: #f2d58c;
  --lune-fonce: #e3bf62;
  --aube: #7fd4c6;
  --ambre: #f2a75e;
  --corail: #f08a8a;
  --violet: #b48cf2;
  --resp: #dce5fa;
  --pos-dos: #7fd4c6;
  --pos-ventre: #6c9cf0;
  --pos-gauche: #d9a7f0;
  --pos-droite: #f2d58c;
  --pos-debout: #8e9cc4;
  --pos-inconnue: #3a4e7e;
  --rayon: 18px;
  --police: 'Atkinson Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--nuit-0); }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--police);
  font-size: 17px; line-height: 1.5;
  color: var(--encre);
  background:
    radial-gradient(120% 60% at 85% -10%, rgba(242, 213, 140, 0.07), transparent 60%),
    linear-gradient(180deg, var(--nuit-1) 0%, var(--nuit-0) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#apneo { max-width: 36rem; margin: 0 auto; min-height: 100dvh; }
a { color: var(--lune); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--lune); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0.6em 0; }
.ap-ic svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

/* --------------------------------------------------------------- */
/* Squelette */
/* --------------------------------------------------------------- */
.ap-ecran { display: flex; flex-direction: column; min-height: 100dvh; }
.ap-test {
  margin: 0; padding: 6px 16px calc(6px) ; padding-top: calc(6px + env(safe-area-inset-top, 0px));
  font-size: 13px; text-align: center; color: var(--ambre); background: rgba(242, 167, 94, 0.12);
}
.ap-tete {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, var(--nuit-1) 70%, rgba(11, 26, 58, 0));
}
.ap-test + .ap-tete { padding-top: 10px; }
.ap-retour {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--encre); background: var(--nuit-2); text-decoration: none; font-size: 20px;
}
.ap-retour--vide { background: none; }
.ap-tete-marque { justify-self: center; display: inline-flex; gap: 8px; align-items: center; font-weight: 700; color: var(--lune); letter-spacing: 0.02em; }
.ap-tete-compte {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; justify-self: end;
  background: var(--nuit-3); color: var(--encre); text-decoration: none; font-weight: 700;
}
.ap-tete-compte--vide { background: none; }
.ap-progres { height: 6px; border-radius: 3px; background: var(--nuit-3); overflow: hidden; }
.ap-progres span { display: block; height: 100%; border-radius: 3px; background: var(--lune); transition: width 0.4s ease; }
.ap-corps { flex: 1; padding: 8px 20px 150px; }
.ap-surtitre { margin: 6px 0 4px; color: var(--brume); font-size: 15px; }
.ap-titre { font-size: 28px; margin: 4px 0 10px; }
.ap-titre:focus { outline: none; }
.ap-intro { color: var(--brume); font-size: 17.5px; }
.ap-note { color: var(--brume); font-size: 14.5px; }
.ap-discret { color: var(--brume); }
.ap-pied {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 18px 20px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(6, 14, 34, 0) 0%, rgba(6, 14, 34, 0.94) 32%);
}
.ap-pied-int { max-width: 32rem; margin: 0 auto; display: grid; gap: 8px; }

/* --------------------------------------------------------------- */
/* Boutons et formulaires */
/* --------------------------------------------------------------- */
.ap-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 12px 22px; border-radius: 999px;
  font: 700 17px/1.2 var(--police); text-align: center; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.ap-btn--lune { background: var(--lune); color: var(--nuit-1); }
.ap-btn--lune:hover { background: var(--lune-fonce); }
.ap-btn--contour { background: transparent; color: var(--encre); border-color: var(--nuit-4); }
.ap-btn--discret { background: transparent; color: var(--brume); min-height: 44px; text-decoration: underline; text-decoration-color: var(--nuit-4); }
.ap-btn--danger { background: transparent; color: var(--corail); border-color: rgba(240, 138, 138, 0.45); }
.ap-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.ap-form { display: grid; gap: 16px; margin-top: 12px; }
.ap-champ label { display: block; font-weight: 700; margin-bottom: 6px; }
.ap-saisie {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px;
  font: 400 17px var(--police); color: var(--encre); background: var(--nuit-2);
  border: 2px solid var(--nuit-3);
}
.ap-saisie:focus { border-color: var(--lune); outline: none; }
.ap-aide { color: var(--brume); font-size: 14px; margin: 6px 0 0; }
.ap-case { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.ap-case input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--lune); }
.ap-case label { font-size: 15.5px; color: var(--encre); }
.ap-case--grande { margin-top: 22px; padding: 14px 16px; border-radius: var(--rayon); background: var(--nuit-2); align-items: center; }
.ap-case--grande label { font-weight: 700; font-size: 17px; }
.ap-cases { display: grid; gap: 14px; margin: 18px 0; }
.ap-piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ap-erreur, .ap-alerte {
  display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; padding: 12px 14px; border-radius: 14px;
  background: rgba(242, 167, 94, 0.12); border: 1px solid rgba(242, 167, 94, 0.4); color: var(--encre); font-size: 15.5px;
}
.ap-erreur { background: rgba(240, 138, 138, 0.12); border-color: rgba(240, 138, 138, 0.45); }
.ap-erreur .ap-ic, .ap-alerte .ap-ic { color: var(--ambre); }
.ap-alerte { display: block; }
.ap-alerte--douce { background: rgba(169, 183, 217, 0.08); border-color: var(--nuit-3); color: var(--brume); }
.ap-rangee { display: grid; gap: 8px; margin-top: 10px; }
.ap-chargement { display: flex; gap: 12px; align-items: center; color: var(--brume); margin: 20px 0; }
.ap-sablier {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 3px solid var(--nuit-3); border-top-color: var(--lune); animation: ap-tourne 1s linear infinite;
}
@keyframes ap-tourne { to { transform: rotate(360deg); } }
.ap-annonce {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: 90vw; padding: 12px 18px; border-radius: 14px;
  background: var(--encre); color: var(--nuit-1); font-weight: 700; font-size: 15px;
  transition: opacity 0.25s, transform 0.25s;
}
.ap-annonce--visible { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------- */
/* Accueil */
/* --------------------------------------------------------------- */
.ap-hero { text-align: left; padding-top: 6px; }
.ap-hero-lune { width: 132px; height: 132px; margin: 4px 0 6px -10px; }
.ap-hero-lune svg { width: 100%; height: 100%; }
.ap-titre--hero { font-size: 32px; letter-spacing: -0.02em; max-width: 15ch; }
.ap-bloc { margin-top: 30px; }
.ap-bloc h2 { font-size: 21px; margin-bottom: 10px; }
.ap-bloc h3 { font-size: 17.5px; margin: 22px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-bloc--cadre { padding: 18px 18px 14px; border-radius: 22px; background: var(--nuit-2); }
.ap-sequence { list-style: none; counter-reset: etape; margin: 0; padding: 0; display: grid; gap: 4px; }
.ap-sequence li {
  counter-increment: etape; position: relative; padding: 10px 0 14px 50px;
  border-left: 2px solid var(--nuit-3); margin-left: 16px; padding-left: 34px;
}
.ap-sequence li:last-child { border-left-color: transparent; }
.ap-sequence li::before {
  content: counter(etape); position: absolute; left: -17px; top: 6px;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--nuit-1); border: 2px solid var(--lune); color: var(--lune); font-weight: 700; font-size: 15px;
}
.ap-sequence strong { display: block; }
.ap-sequence span { color: var(--brume); font-size: 15.5px; }
.ap-puces { margin: 6px 0; padding-left: 1.2em; }
.ap-puces li { margin: 6px 0; }
.ap-puces li::marker { color: var(--lune); }
.ap-liens { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 28px 0 0; font-size: 14.5px; }
.ap-liens a { color: var(--brume); }

/* Illustrations (SVG en ligne) */
.ap-illus { margin: 14px auto; max-width: 300px; }
.ap-illus--grande { max-width: 340px; }
.ap-illus svg { width: 100%; height: auto; display: block; }
.il-fond { fill: var(--nuit-2); }
.il-trait { fill: none; stroke: var(--brume); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.il-trait-doux { fill: none; stroke: var(--nuit-4); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 4 6; }
.il-tel { fill: var(--nuit-3); stroke: var(--encre); stroke-width: 2.4; }
.il-tel-clair { fill: var(--lune); }
.il-camera { fill: var(--nuit-1); }
.il-objectif { fill: var(--brume); }
.il-plein { fill: var(--aube); }
.il-plein-doux { fill: var(--aube); opacity: 0.4; }
.il-croissant { fill: var(--lune); }
.il-etoile { fill: var(--encre); opacity: 0.8; }
.il-halo { fill: var(--lune); opacity: 0.12; transform-origin: 100px 100px; animation: ap-souffle 10s ease-in-out infinite; }
.il-halo-doux { fill: var(--lune); opacity: 0.1; }
.il-bande { fill: #c7a77e; opacity: 0.92; }
.il-bande-adh { fill: var(--encre); opacity: 0.85; }
.il-fleche { fill: none; stroke: var(--lune); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.il-repere { fill: none; stroke: var(--lune); stroke-width: 2; stroke-dasharray: 3 5; }
.il-rec { fill: var(--corail); }
.il-onde { fill: none; stroke: var(--aube); stroke-width: 2.6; stroke-linecap: round; }
.il-drap { fill: var(--nuit-3); }
@keyframes ap-souffle { 0%, 100% { transform: scale(0.92); opacity: 0.08; } 45% { transform: scale(1.04); opacity: 0.2; } }

/* --------------------------------------------------------------- */
/* Parcours */
/* --------------------------------------------------------------- */
.ap-etapes { display: grid; gap: 10px; margin-top: 16px; }
.ap-etape {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: center;
  padding: 16px; border-radius: var(--rayon); background: var(--nuit-2); color: var(--encre); text-decoration: none;
  border: 1px solid transparent;
}
.ap-etape:hover { border-color: var(--nuit-4); }
.ap-etape--inactive { opacity: 0.55; }
.ap-etape-num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--nuit-4); font-weight: 700; color: var(--brume);
}
.ap-etape--fait .ap-etape-num { border-color: var(--aube); color: var(--aube); }
.ap-etape-txt strong { display: block; }
.ap-etape-txt span { display: block; color: var(--brume); font-size: 14.5px; }
.ap-puce-statut { font-size: 13.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ap-puce-statut--fait { color: var(--aube); background: rgba(127, 212, 198, 0.12); }
.ap-puce-statut--afaire { color: var(--lune); background: rgba(242, 213, 140, 0.12); }
.ap-puce-statut--probleme { color: var(--corail); background: rgba(240, 138, 138, 0.12); }
.ap-puce-statut--neutre { color: var(--brume); background: var(--nuit-3); }
.ap-lancer { margin-top: 8px; }
.ap-lancer .ap-btn { min-height: 60px; font-size: 18px; }
.ap-nuits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ap-nuit-ligne {
  display: grid; grid-template-columns: 64px 1fr 20px; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: var(--nuit-2); color: var(--encre); text-decoration: none;
}
.ap-nuit-date strong { display: block; }
.ap-nuit-date span, .ap-nuit-info span { display: block; font-size: 14px; color: var(--brume); }
.ap-nuit-info .ap-qualite { color: var(--encre); font-weight: 700; }
.ap-qualite--exploitable { color: var(--aube) !important; }
.ap-qualite--partiel { color: var(--ambre) !important; }
.ap-qualite--insuffisant { color: var(--corail) !important; }
.ap-vide { color: var(--brume); padding: 16px; border: 1px dashed var(--nuit-4); border-radius: 14px; }

/* --------------------------------------------------------------- */
/* Questionnaires */
/* --------------------------------------------------------------- */
.ap-question { margin-top: 18px; }
.ap-choix { display: grid; gap: 10px; }
.ap-option {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: center; text-align: left;
  width: 100%; min-height: 58px; padding: 14px 16px; border-radius: 16px; cursor: pointer;
  font: 400 17px/1.3 var(--police); color: var(--encre);
  background: var(--nuit-2); border: 2px solid var(--nuit-3); transition: border-color 0.15s, background 0.15s;
}
.ap-option-marque { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--brume); position: relative; }
.ap-option--multi .ap-option-marque { border-radius: 6px; }
.ap-option--choisie { border-color: var(--lune); background: rgba(242, 213, 140, 0.1); }
.ap-option--choisie .ap-option-marque { border-color: var(--lune); background: var(--lune); box-shadow: inset 0 0 0 4px var(--nuit-2); }
.ap-nombre { display: flex; align-items: baseline; gap: 12px; }
.ap-saisie--grande { font-size: 34px; font-weight: 700; text-align: center; max-width: 9ch; min-height: 72px; }
.ap-unite { font-size: 20px; color: var(--brume); }
.ap-question .ap-btn--discret { margin-top: 10px; width: auto; }
.ap-ecran--saviez .ap-corps { display: grid; align-content: center; }
.ap-saviez { padding: 26px 22px; border-radius: 26px; background: var(--nuit-2); text-align: left; }
.ap-saviez-lune { width: 64px; height: 64px; margin-bottom: 8px; }
.ap-saviez-lune svg { width: 100%; height: 100%; }
.ap-saviez-titre { font-weight: 700; color: var(--lune); font-size: 15.5px; margin: 0; }
.ap-saviez-texte { font-size: 21px; line-height: 1.4; margin: 8px 0 0; }

/* --------------------------------------------------------------- */
/* Vérification */
/* --------------------------------------------------------------- */
.ap-etats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ap-etat { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--nuit-3); }
.ap-etat strong { display: block; font-size: 16px; }
.ap-etat span:not(.ap-ic) { display: block; color: var(--brume); font-size: 14.5px; }
.ap-etat--ok .ap-ic { color: var(--aube); }
.ap-etat--attention .ap-ic { color: var(--ambre); }
.ap-etat--bloquant .ap-ic { color: var(--corail); }
.ap-etat--info .ap-ic { color: var(--brume); }
.ap-trace { display: block; width: 100%; height: 110px; margin: 14px 0 6px; border-radius: 14px; background: var(--nuit-0); }
.ap-trace-statut { font-weight: 700; min-height: 1.5em; }
.ap-verdict { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; margin-top: 26px; padding: 16px; border-radius: var(--rayon); font-weight: 700; }
.ap-verdict p { margin: 0; }
.ap-verdict--compatible { background: rgba(127, 212, 198, 0.12); color: var(--aube); }
.ap-verdict--reserves { background: rgba(242, 167, 94, 0.12); color: var(--ambre); }
.ap-verdict--incompatible { background: rgba(240, 138, 138, 0.12); color: var(--corail); }

/* --------------------------------------------------------------- */
/* Nuit : écran noir, verrou tactile */
/* --------------------------------------------------------------- */
html.ap-mode-nuit, html.ap-mode-nuit body { background: #000; }
.ap-nuit {
  position: fixed; inset: 0; z-index: 40; background: #000; color: #8d9abb;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 22px calc(22px + env(safe-area-inset-bottom, 0px));
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ap-nuit-contenu { transition: opacity 2s ease, transform 1s ease; text-align: center; margin-top: 12vh; }
.ap-nuit--sombre .ap-nuit-contenu, .ap-nuit--sombre .ap-nuit-bas { opacity: 0.07; }
.ap-nuit-bas { transition: opacity 2s ease; }
.ap-nuit-statut { display: inline-flex; gap: 10px; align-items: center; font-size: 15px; }
.ap-micro-actif { width: 10px; height: 10px; border-radius: 50%; background: var(--corail); box-shadow: 0 0 0 4px rgba(240, 138, 138, 0.18); }
.ap-nuit-temps { font-size: 54px; font-weight: 400; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; color: #b9c4e2; margin: 10px 0; }
.ap-nuit-resp { color: #6f8cb0; min-height: 1.5em; }
.ap-nuit-consigne { font-size: 20px; color: var(--encre); max-width: 22ch; margin: 22px auto 6px; }
.ap-nuit-petit { font-size: 14.5px; }
.ap-nuit-alerte { color: var(--ambre); font-weight: 700; }
.ap-nuit-reprise { margin-top: 20px; }
.ap-maintien {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 64px; border-radius: 999px; cursor: pointer;
  font: 700 17px var(--police); color: #b9c4e2; background: #0a0f1d; border: 2px solid #1f2b48;
  overflow: hidden; touch-action: none;
}
.ap-maintien-anneau {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(242, 213, 140, 0.22);
}
.ap-maintien--actif .ap-maintien-anneau { width: 100%; transition: width 2s linear; }
.ap-feuille {
  position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 22px; border-radius: 26px; background: var(--nuit-2); color: var(--encre); text-align: left;
}
.ap-feuille-titre { font-size: 21px; font-weight: 700; margin-top: 0; }
.ap-feuille-boutons { display: grid; gap: 10px; margin-top: 16px; }

/* --------------------------------------------------------------- */
/* Qualité et compte rendu */
/* --------------------------------------------------------------- */
.ap-qualite-bloc { padding: 18px; border-radius: 22px; background: var(--nuit-2); }
.ap-qualite-tete { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.ap-qualite-tete .ap-ic { font-size: 22px; }
.ap-qualite-tete h2 { margin-bottom: 2px; }
.ap-qualite-tete p { color: var(--brume); margin: 4px 0 0; }
.ap-qualite-bloc--exploitable .ap-qualite-tete .ap-ic { color: var(--aube); }
.ap-qualite-bloc--partiel .ap-qualite-tete .ap-ic { color: var(--ambre); }
.ap-qualite-bloc--insuffisant .ap-qualite-tete .ap-ic { color: var(--corail); }
.ap-mesures { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 16px 18px; margin: 16px 0 6px; }
.ap-mesure dt { color: var(--brume); font-size: 14px; }
.ap-mesure dd { margin: 2px 0 0; }
.ap-mesure-val { display: block; font-size: 25px; font-variant-numeric: tabular-nums; }
.ap-mesure-note { display: block; color: var(--brume); font-size: 13.5px; }
.ap-mesures--compact .ap-mesure-val { font-size: 20px; }
.ap-rapport-tete .ap-titre { margin-bottom: 4px; }
.ap-rapport-meta { color: var(--brume); font-size: 14px; }
.ap-bandeau { margin: 16px 0; padding: 12px 14px; border-left: 4px solid var(--lune); border-radius: 0 12px 12px 0; background: rgba(242, 213, 140, 0.08); font-size: 15px; }
.ap-bandeau--demo { border-left-color: var(--ambre); background: rgba(242, 167, 94, 0.14); }
.ap-bandeau--estimation { border-left-color: var(--violet); background: rgba(180, 140, 242, 0.1); }
.ap-statut { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.ap-statut--mesure { color: var(--aube); background: rgba(127, 212, 198, 0.12); }
.ap-statut--estimation { color: var(--violet); background: rgba(180, 140, 242, 0.14); }
.ap-bloc--estimation { padding: 18px; border-radius: 22px; border: 1px dashed rgba(180, 140, 242, 0.5); }
.ap-prioritaire { font-weight: 700; color: var(--ambre); }
.ap-barre { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--nuit-3); margin: 6px 0 10px; }
.ap-barre span { display: block; height: 100%; }
.ap-barre-legende { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 15px; }
.ap-barre-legende li { display: flex; align-items: center; gap: 8px; }
.ap-barre-legende strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.ap-pastille { display: inline-block; width: 12px; height: 12px; border-radius: 4px; flex: none; }
.pos-dos { background: var(--pos-dos); }
.pos-ventre { background: var(--pos-ventre); }
.pos-gauche { background: var(--pos-gauche); }
.pos-droite { background: var(--pos-droite); }
.pos-debout { background: var(--pos-debout); }
.ap-pastille.ronf { background: var(--violet); }
.ap-pastille.evt { background: var(--ambre); border-radius: 50%; }
.ap-pastille.resp { background: var(--resp); height: 3px; border-radius: 2px; }
.ap-chrono { margin: 8px -6px 0; overflow-x: auto; }
.ap-chrono svg { display: block; width: 100%; min-width: 320px; height: auto; font-family: var(--police); }
.ch-heure { stroke: var(--nuit-3); stroke-width: 1; }
.ch-guide { stroke: var(--nuit-4); stroke-width: 1; stroke-dasharray: 2 3; }
.ch-txt { fill: var(--brume); font-size: 10px; }
.ch-lib { fill: var(--brume); font-size: 10.5px; }
.ch-pos.pos-dos { fill: var(--pos-dos); }
.ch-pos.pos-ventre { fill: var(--pos-ventre); }
.ch-pos.pos-gauche { fill: var(--pos-gauche); }
.ch-pos.pos-droite { fill: var(--pos-droite); }
.ch-pos.pos-debout { fill: var(--pos-debout); }
.ch-pos.pos-inconnue { fill: var(--pos-inconnue); }
.ch-pos.pos-non-porte { fill: none; stroke: var(--nuit-4); stroke-dasharray: 2 2; }
.ch-ronf { fill: var(--violet); }
.ch-evt { fill: var(--ambre); }
.ch-rr { fill: none; stroke: var(--resp); stroke-width: 1.4; stroke-linejoin: round; }
.ch-som--sommeil { fill: #4466b0; }
.ch-som--eveil { fill: var(--brume); opacity: 0.55; }
.ap-legende { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13.5px; color: var(--brume); }
.ap-legende span { display: inline-flex; align-items: center; gap: 6px; }
.ap-rapport-actions { display: grid; gap: 8px; margin: 34px 0 10px; }
.ap-texte h2 { font-size: 20px; margin: 22px 0 8px; }
.ap-texte ul { padding-left: 1.2em; }

@media (min-width: 40rem) {
  .ap-corps { padding-left: 8px; padding-right: 8px; }
  .ap-pied { position: sticky; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- */
/* Impression : compte rendu clair, lisible, sans navigation */
/* --------------------------------------------------------------- */
@media print {
  :root { --encre: #10203f; --brume: #4a5878; --nuit-2: #f2f4fa; --nuit-3: #d9deec; --nuit-4: #b7c0d8; --lune: #8a6a10; --resp: #10203f; --violet: #6b43c9; --ambre: #b8650f; --aube: #1d8c7b; }
  html, body { background: #fff !important; color: #10203f; font-size: 11pt; }
  .ap-tete, .ap-pied, .ap-test, .ap-rapport-actions, .ap-liens, .ap-annonce { display: none !important; }
  .ap-corps { padding: 0; }
  .ap-bloc, .ap-bloc--cadre, .ap-qualite-bloc, .ap-bloc--estimation { break-inside: avoid; background: #fff; border: 1px solid #d9deec; }
  .ap-bandeau { background: #f6f1e2; }
  .ap-chrono svg { min-width: 0; }
  a { color: #10203f; }
}

/* --------------------------------------------------------------- */
/* Parcours (cartes illustrées, coche à droite)                     */
/* --------------------------------------------------------------- */
.ap-pcs { display: grid; gap: 12px; margin-top: 18px; }
.ap-pc {
  display: grid; grid-template-columns: 96px 1fr 30px; align-items: stretch;
  border-radius: 20px; overflow: hidden; background: var(--encre); color: var(--nuit-1); text-decoration: none;
  border: 2px solid transparent; min-height: 112px;
}
.ap-pc--fait { background: #c9d6f2; border-color: var(--aube); }
.ap-pc-illus { background: var(--nuit-3); display: grid; place-items: center; }
.ap-pc-illus svg { width: 92px; height: auto; display: block; }
.ap-pc-txt { padding: 14px 6px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.ap-pc-txt strong { font-size: 17px; }
.ap-pc-txt > span { font-size: 14px; color: #4a5878; line-height: 1.35; }
.ap-pc-coche {
  align-self: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--nuit-4);
  display: grid; place-items: center; color: #fff;
}
.ap-pc--fait .ap-pc-coche { background: #1d8c7b; border-color: #1d8c7b; }
.ap-pc-coche .ap-ic svg { width: 15px; height: 15px; stroke-width: 3; }
.ap-pc-prog { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-top: 4px; }
.ap-pc-prog-txt { font-weight: 700; color: #4a5878; font-size: 14px; }
.ap-pc-barre { height: 6px; border-radius: 3px; background: #c3cbe0; overflow: hidden; }
.ap-pc-barre span { display: block; height: 100%; background: #1d8c7b; }
.ap-pc-alerte { color: #b8650f; font-weight: 700; font-size: 13.5px; }
.ap-btn--attente { opacity: 0.45; }

/* --------------------------------------------------------------- */
/* Compte rendu : résultat principal, jauge, cartes détaillées      */
/* --------------------------------------------------------------- */
.ap-titre--date { font-size: 22px; font-weight: 400; color: var(--brume); margin-top: 8px; }
.ap-resultat { margin-top: 12px; padding: 20px 18px; border-radius: 24px; background: var(--nuit-2); }
.ap-resultat-titre { font-size: 22px; line-height: 1.3; margin: 0 0 12px; }
.ap-niv--normal { color: #63d297; }
.ap-niv--leger { color: #e9d65f; }
.ap-niv--modere { color: var(--ambre); }
.ap-niv--severe { color: var(--corail); }
.ap-resultat-sous { display: flex; gap: 8px; align-items: center; color: var(--brume); font-size: 14.5px; margin: 0 0 30px; }
.ap-jauge { position: relative; margin: 0 0 18px; }
.ap-jauge-val { position: absolute; top: -26px; transform: translateX(-50%); font-weight: 700; font-size: 20px; color: var(--encre); white-space: nowrap; }
.ap-jauge-barre { position: relative; display: grid; grid-template-columns: 12.5fr 25fr 37.5fr 25fr; height: 10px; border-radius: 5px; overflow: visible; }
.ap-jauge-seg:first-child { border-radius: 5px 0 0 5px; }
.ap-jauge-seg:nth-child(4) { border-radius: 0 5px 5px 0; }
.ap-jauge-seg--normal { background: #63d297; }
.ap-jauge-seg--leger { background: #e9d65f; }
.ap-jauge-seg--modere { background: var(--ambre); }
.ap-jauge-seg--severe { background: var(--corail); }
.ap-jauge-marque {
  position: absolute; top: -6px; width: 12px; height: 22px; transform: translateX(-50%);
  border-radius: 4px; background: var(--nuit-1); border: 2px solid var(--encre);
}
.ap-jauge-libs { display: grid; grid-template-columns: 12.5fr 25fr 37.5fr 25fr; margin-top: 8px; font-size: 12.5px; color: var(--brume); }
.ap-jauge-libs span { text-align: center; }
.ap-jauge-libs span:first-child { text-align: left; }
.ap-jauge-lib--actif { color: var(--encre); font-weight: 700; }
.ap-sens { margin: 18px 0 6px; padding: 14px 16px; border-radius: 0 16px 16px 0; border-left: 5px solid var(--brume); background: var(--nuit-1); }
.ap-sens--normal { border-left-color: #63d297; }
.ap-sens--leger { border-left-color: #e9d65f; }
.ap-sens--modere { border-left-color: var(--ambre); }
.ap-sens--severe { border-left-color: var(--corail); }
.ap-sens-titre { font-weight: 700; margin-top: 0; }
.ap-sens-note { font-style: italic; color: var(--brume); font-size: 14.5px; margin-bottom: 0; }
.ap-resultat-chiffres { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--nuit-3); }
.ap-analyse-titre { font-size: 26px; margin: 34px 0 12px; }
.ap-carte { margin: 12px 0; padding: 18px; border-radius: 22px; background: var(--nuit-2); }
.ap-carte-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ap-carte-tete h3 { font-size: 19px; margin: 0 0 10px; }
.ap-info { position: relative; }
.ap-info summary { list-style: none; cursor: pointer; color: var(--brume); font-size: 20px; }
.ap-info summary::-webkit-details-marker { display: none; }
.ap-info[open] p {
  position: absolute; right: 0; top: 30px; z-index: 3; width: min(18rem, 78vw); margin: 0;
  padding: 12px 14px; border-radius: 14px; background: var(--encre); color: var(--nuit-1); font-size: 14px;
}
.ap-carte-sous { font-weight: 700; margin: 14px 0 4px; font-size: 15px; }
.ap-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 8px 0; }
.ap-duo-item { display: flex; flex-direction: column; gap: 2px; }
.ap-duo-lib { color: var(--brume); font-size: 14px; }
.ap-duo-val { font-size: 25px; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ap-duo-val small { font-size: 13px; color: var(--brume); }
.ap-point { width: 8px; height: 8px; border-radius: 50%; display: inline-block; align-self: center; }
.ap-point--normal { background: #63d297; }
.ap-point--leger { background: #e9d65f; }
.ap-point--modere { background: var(--ambre); }
.ap-point--severe { background: var(--corail); }
.ap-point--ronf { background: var(--violet); }
.ty-centrale { background: #6fa8f5; }
.ty-obstr { background: var(--aube); }
.ve-eveil { background: #6fa8f5; }
.ve-sommeil { background: var(--aube); }
.ap-mention { color: var(--brume); font-size: 13.5px; margin: 18px 4px; }
@media print {
  .ap-resultat, .ap-carte { background: #fff; border: 1px solid #d9deec; break-inside: avoid; }
  .ap-sens { background: #f6f8fc; }
  .ap-info { display: none; }
}

/* Endormissement en musique */
.ap-musique-reglages summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; }
.ap-musique-reglages summary::-webkit-details-marker { display: none; }
.ap-musique-reglages[open] summary { margin-bottom: 12px; }
.ap-musique-reglages .ap-case, .ap-musique-reglages .ap-champ { margin: 12px 0; }
.ap-curseur { width: 100%; accent-color: var(--lune); }
.ap-musique { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 10px 0; transition: opacity 2s ease; }
.ap-lecteur-yt { width: 200px; height: 200px; border: 0; border-radius: 12px; background: #000; flex: none; }
.ap-musique-ctl { display: flex; flex-direction: column; gap: 10px; max-width: 130px; }
.ap-musique-statut { font-size: 13.5px; color: #8d9abb; }
.ap-musique-btn { min-height: 44px; font-size: 14.5px; padding: 8px 12px; color: #b9c4e2; border-color: #1f2b48; }
.ap-nuit--sombre .ap-musique { opacity: 0.07; }
