/* VISUELIA — feuille de style de l’écran.
   Interface claire et sobre autour d’une zone d’exercice bleu nuit unie (sans dégradé ni motif distrayant).
   Le compte rendu imprimé a sa propre feuille : compte-rendu-pdf.css. */

/* ========== 1. Couleurs et mesures ========== */
:root {
  /* Interface */
  --bg:#f4f6f3; --surface:#ffffff; --surface-2:#f8faf7; --hover:#edf2ee;
  --ink:#1e2a26; --ink-2:#3b4a44; --mute:#66746d;
  --line:#e3e8e3; --line-strong:#cfd9d2;
  --accent:#2f7a64; --accent-hover:#276a56; --accent-ink:#ffffff; --accent-soft:#e4f1ec;
  /* Zone d’exercice */
  --stage:#13211d; --stage-2:#1c2f29; --stage-3:#243b33; --stage-line:#2d4a40;
  --stage-ink:#f3f8f5; --stage-mute:#a9c2b7; --stage-accent:#7cc7ae;
  /* Sélection dans les exercices : sauge très clair, pour ne pas la confondre avec le vert « bonne réponse » */
  --stage-select:#e3eee8; --stage-select-ink:#0b1f19;
  /* Retours visuels */
  --ok:#5fd39a; --ok-strong:#2e8b57; --ko:#ff8a99; --ko-strong:#d1495b; --focus:#ffd166;
  /* Alias utilisés directement par les scripts */
  --card:var(--surface);
  /* Formes */
  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-xl:20px;
  --shadow-sm:0 1px 2px rgba(19,33,29,.05);
  --shadow-md:0 1px 2px rgba(19,33,29,.04),0 6px 20px rgba(19,33,29,.06);
  --shadow-lg:0 12px 40px rgba(19,33,29,.16);
  --header-h:68px; --sidebar-w:264px;
  color-scheme:light;
}

/* ========== 2. Base ========== */
*,*::before,*::after { box-sizing:border-box; }
[hidden] { display:none !important; }
html { background:var(--bg); -webkit-text-size-adjust:100%; }
body {
  margin:0; background:var(--bg); color:var(--ink);
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:15px; line-height:1.55; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
h1,h2,h3 { margin:0; line-height:1.2; letter-spacing:-.02em; color:var(--ink); }
p { margin:0; }
b,strong { font-weight:650; }
hr { border:0; border-top:1px solid var(--line); margin:28px 0; }
.lead { color:var(--mute); max-width:72ch; }
.mute { color:var(--mute); }
.foot { color:var(--mute); font-size:.82rem; line-height:1.5; margin-top:18px; max-width:90ch; }
:focus-visible { outline:3px solid color-mix(in srgb,var(--accent) 45%,transparent); outline-offset:2px; }

/* ========== 3. Boutons et champs ========== */
/* Style des boutons « d’action ». :where() garde une spécificité nulle : les boutons propres aux exercices
   (cases, tuiles, choix…) définissent leur propre apparence sans conflit. */
:where(button) {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:42px; padding:0 18px; border:1px solid var(--accent); border-radius:10px;
  background:var(--accent); color:var(--accent-ink);
  font:inherit; font-size:.9rem; font-weight:600; letter-spacing:-.005em; line-height:1.2;
  cursor:pointer; touch-action:manipulation; box-shadow:var(--shadow-sm);
  transition:background-color .15s,border-color .15s,color .15s,box-shadow .15s,transform .1s;
}
:where(button:not(:disabled):hover) { background:var(--accent-hover); border-color:var(--accent-hover); }
:where(button:not(:disabled):active) { transform:translateY(1px); }
:where(button:disabled) { opacity:.45; cursor:not-allowed; box-shadow:none; }
button.ghost { background:var(--card); color:var(--ink); border:1px solid var(--line-strong); box-shadow:none; }
button.ghost:not(:disabled):hover { background:var(--hover); border-color:var(--line-strong); color:var(--ink); }
#pause-btn.on { background:var(--accent-soft); border-color:var(--accent); color:var(--accent); }
/* Confirmation sur le bouton lui-même (second clic) et message bref après une action */
button.a-confirmer, button.a-confirmer:not(:disabled):hover { background:var(--ko-strong); border-color:var(--ko-strong); color:#fff; }
button.signale, button.signale:not(:disabled):hover { background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 35%,var(--line)); color:var(--accent); }
/* Bouton présenté comme un lien (actions secondaires dans un texte) */
button.lien { display:inline; min-height:0; padding:0; border:0; border-radius:0; background:none; box-shadow:none; color:var(--accent); font-size:inherit; font-weight:600; text-decoration:underline; text-underline-offset:2px; }
button.lien:not(:disabled):hover { background:none; color:var(--accent-hover); }
button.lien.a-confirmer, button.lien.signale { padding:2px 8px; border-radius:6px; text-decoration:none; }
.msg-erreur { max-width:60ch; padding:10px 14px; border:1px solid color-mix(in srgb,var(--ko-strong) 35%,var(--line)); border-radius:var(--r-md); background:color-mix(in srgb,var(--ko) 10%,var(--surface)); color:#8a2333; font-size:.88rem; font-weight:500; }

input[type="text"], input[type="url"], input[type="date"], input[type="search"], select, textarea {
  width:100%; min-height:42px; padding:9px 12px; font:inherit; font-size:.92rem;
  color:var(--ink); background:var(--surface); border:1px solid var(--line-strong); border-radius:10px;
  box-shadow:var(--shadow-sm); transition:border-color .15s,box-shadow .15s;
}
textarea { min-height:96px; resize:vertical; line-height:1.5; }
select {
  appearance:none; -webkit-appearance:none; padding-right:36px; cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 13px center;
}
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent); }
::placeholder { color:#95a39c; }

/* Curseurs de réglage */
input[type="range"] {
  -webkit-appearance:none; appearance:none; width:100%; height:24px; margin:0; background:transparent; cursor:pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height:6px; border-radius:999px; background:var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance:none; width:20px; height:20px; margin-top:-7px; border-radius:50%;
  background:var(--surface); border:2px solid var(--accent); box-shadow:0 1px 4px rgba(19,33,29,.18);
}
input[type="range"]::-moz-range-track { height:6px; border-radius:999px; background:var(--line); }
input[type="range"]::-moz-range-progress { height:6px; border-radius:999px; background:var(--accent); }
input[type="range"]::-moz-range-thumb { width:16px; height:16px; border-radius:50%; background:var(--surface); border:2px solid var(--accent); box-shadow:0 1px 4px rgba(19,33,29,.18); }
input[type="range"]:focus { outline:none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 22%,transparent); }
input[type="checkbox"] { width:18px; height:18px; margin:0; accent-color:var(--accent); cursor:pointer; }

label { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:6px; font-size:.86rem; font-weight:600; color:var(--ink-2); }
fieldset { border:0; margin:0; padding:0; min-width:0; }
fieldset:disabled { opacity:.55; }

/* ========== 4. En-tête ========== */
main { min-height:100vh; }
.top-nav {
  position:sticky; top:0; z-index:50; height:var(--header-h);
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:0 28px; background:color-mix(in srgb,var(--surface) 92%,transparent);
  border-bottom:1px solid var(--line); backdrop-filter:saturate(1.4) blur(10px); -webkit-backdrop-filter:saturate(1.4) blur(10px);
}
.brand-lockup { display:flex; align-items:center; gap:12px; flex:0 0 auto; white-space:nowrap; color:#2f7a64; text-decoration:none; border-radius:var(--r-md); }
body.mode-patient .brand-lockup { cursor:default; }
.brand-eye { width:42px; height:30px; flex:0 0 auto; }
.brand-lockup h1 { font-size:1.3rem; font-weight:750; letter-spacing:-.04em; color:var(--ink); }
.brand-subtitle { font-size:.76rem; color:var(--mute); margin-top:1px; }
.header-note {
  display:inline-flex; align-items:center; gap:8px; padding:6px 12px; border:1px solid var(--line);
  border-radius:999px; background:var(--surface-2); color:var(--ink-2); font-size:.78rem; font-weight:550; white-space:nowrap;
}
.header-dot { width:7px; height:7px; border-radius:50%; background:var(--ok-strong); box-shadow:0 0 0 3px color-mix(in srgb,var(--ok-strong) 18%,transparent); }

/* Outils de l’en-tête : compte rendu, playlists, QR code */
.header-tools { display:flex; align-items:center; gap:6px; margin-left:auto; }
.tool-btn {
  position:relative; display:inline-flex; align-items:center; justify-content:center; gap:7px;
  min-height:38px; padding:0 13px; border:1px solid var(--line); border-radius:10px;
  background:var(--surface); color:var(--ink-2); box-shadow:none;
  font:inherit; font-size:.84rem; font-weight:600; white-space:nowrap; cursor:pointer;
  transition:background-color .15s,border-color .15s,color .15s;
}
.tool-btn svg { width:18px; height:18px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.tool-btn:hover { background:var(--hover); border-color:var(--line-strong); color:var(--ink); }
.tool-btn.on { background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 35%,var(--line)); color:var(--accent); }
.tool-badge {
  min-width:19px; height:19px; padding:0 5px; border-radius:999px; background:var(--accent); color:var(--accent-ink);
  font-size:.7rem; font-weight:700; line-height:19px; text-align:center; font-variant-numeric:tabular-nums;
}

/* Icônes au trait (js/icones.js) */
.ic { width:18px; height:18px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* ========== 5. Mise en page : barre latérale + contenu ========== */
.layout { display:flex; align-items:flex-start; }
.sidebar {
  position:sticky; top:var(--header-h); flex:0 0 var(--sidebar-w); width:var(--sidebar-w);
  height:calc(100vh - var(--header-h)); overflow-y:auto; overscroll-behavior:contain;
  padding:20px 14px 24px; background:var(--surface); border-right:1px solid var(--line);
  display:flex; flex-direction:column; gap:18px;
}
.sidebar-note { margin-top:auto; padding:12px 14px; border-radius:var(--r-md); background:var(--surface-2); border:1px solid var(--line); color:var(--mute); font-size:.78rem; line-height:1.5; }
.content { flex:1 1 auto; min-width:0; padding:30px clamp(18px,3vw,40px) 48px; max-width:1480px; }
.page-foot { margin-top:32px; padding-top:18px; border-top:1px solid var(--line); display:grid; gap:6px; }
.page-foot .avertissement { color:var(--ink-2); }
.liens-legaux a { color:var(--accent); text-decoration:none; font-weight:600; }
.liens-legaux a:hover { text-decoration:underline; }

/* Navigation — sur grand écran, chaque groupe est une liste toujours visible */
#tabs { display:flex; flex-direction:column; gap:18px; }
.nav-menu { position:relative; }
.nav-menu-trigger {
  display:flex; align-items:center; justify-content:space-between; width:100%; min-height:0;
  padding:0 12px 6px; border:0; border-radius:0; background:none; box-shadow:none;
  color:var(--mute); font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
  pointer-events:none; cursor:default;
}
.nav-chevron { display:none; }
.nav-menu-list { display:flex; flex-direction:column; gap:2px; }
.tab {
  display:flex; align-items:center; justify-content:flex-start; width:100%; min-height:36px; padding:7px 12px;
  border:0; border-radius:var(--r-sm); background:transparent; box-shadow:none;
  color:var(--ink-2); font:inherit; font-size:.88rem; font-weight:500; text-align:left; line-height:1.3;
  cursor:pointer; transition:background-color .12s,color .12s;
}
.tab:hover { background:var(--hover); color:var(--ink); }
.tab.on { background:var(--accent-soft); color:var(--accent); font-weight:650; box-shadow:inset 3px 0 0 var(--accent); }
.tab { gap:10px; }
.tab .ic { width:17px; height:17px; color:var(--mute); transition:color .12s; }
.tab:hover .ic, .tab.on .ic { color:var(--accent); }
.nav-accueil { color:var(--ink); font-weight:600; }
#tabs > .nav-accueil { margin-bottom:-4px; }

/* ========== 6. Écran d’exercice ========== */
#play { display:grid; grid-template-columns:minmax(0,1fr); gap:20px; align-items:start; }
@media (min-width:1440px) {
  #play { grid-template-columns:minmax(0,1fr) 330px; gap:24px; }
  #play > .settings { position:sticky; top:calc(var(--header-h) + 24px); }
  #play > .settings .grid { grid-template-columns:1fr; }
}
.play-main { min-width:0; }
#et { font-size:1.65rem; font-weight:750; letter-spacing:-.035em; }
#desc { margin:6px 0 8px; font-size:.95rem; }
.ex-kicker { display:flex; align-items:center; gap:7px; margin-bottom:6px; color:var(--accent); font-size:.72rem; font-weight:700; letter-spacing:.09em; text-transform:uppercase; }
.ex-kicker .ic { width:15px; height:15px; }
.ex-obj { display:flex; align-items:baseline; gap:8px; max-width:82ch; margin:0 0 18px; color:var(--ink-2); font-size:.84rem; line-height:1.5; }
.ex-obj span { flex:none; padding:1px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:.66rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase; }
.ex-obj:empty { display:none; }
.home-banner { margin-bottom:18px; border-left:3px solid var(--accent); }
/* Exercice à domicile (QR code) : seules les options de son et de voix restent sous l’exercice */
body.domicile .settings-foot { margin-top:0; padding-top:0; border-top:0; }
body.domicile .settings-foot p { display:none; }
.home-banner p { color:var(--mute); }

#stage {
  /* Couleurs locales : tout ce qui est dessiné dans la scène suit le thème bleu nuit */
  --card:var(--stage-2); --ink:var(--stage-ink); --mute:var(--stage-mute);
  --line:var(--stage-line); --line-strong:var(--stage-line); --hover:var(--stage-3);
  --accent:var(--stage-accent); --accent-hover:#98d6c1; --accent-ink:#0b1f19; --accent-soft:#24453b;
  position:relative; display:flex; align-items:center; justify-content:center; text-align:center;
  min-height:clamp(320px,52vh,640px); padding:clamp(16px,2.6vw,36px);
  background:var(--stage); color:var(--stage-ink); border:1px solid #1f3530; border-radius:var(--r-xl);
  box-shadow:var(--shadow-md); overflow:hidden; user-select:none; -webkit-user-select:none; font-weight:700;
}
#stage.is-paused::after {
  content:"PAUSE"; position:absolute; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  background:rgba(19,33,29,.96); color:var(--stage-ink); font-size:2.2rem; font-weight:700; letter-spacing:.3em; pointer-events:all;
}

.under { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:14px; }
#go { min-width:150px; min-height:46px; font-size:.95rem; }
#q-add { margin-right:auto; }
#ans {
  flex:1; min-width:160px; min-height:46px; font-size:1.3rem; font-weight:700; letter-spacing:.25em; text-transform:uppercase;
}
#live { min-height:0; margin-top:12px; font-weight:600; font-size:.92rem; color:var(--ink); }
#live:not(:empty) { padding:11px 14px; border:1px solid color-mix(in srgb,var(--accent) 22%,var(--line)); border-radius:var(--r-md); background:var(--accent-soft); }

/* ========== 7. Panneaux ========== */
.panel {
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg);
  padding:clamp(18px,2vw,26px); box-shadow:var(--shadow-md);
}
.panel h2 { font-size:1.08rem; font-weight:700; margin-bottom:6px; }
.panel > .lead { margin-bottom:18px; font-size:.92rem; }
.panel .panel { box-shadow:none; background:var(--surface-2); }
.grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px 22px; }
.form-grid { margin-bottom:18px; }
.panel > .under { margin-top:18px; }

/* Réglages */
.settings h2 { margin-bottom:16px; }
#cfg > div { min-width:0; }
#cfg label b {
  min-width:52px; padding:2px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent);
  font-size:.8rem; font-weight:650; text-align:center; font-variant-numeric:tabular-nums; white-space:nowrap;
}
.niveaux { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:-4px 0 18px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.niveaux-label { font-size:.86rem; font-weight:600; color:var(--ink-2); }
.niveaux-btns { display:inline-flex; padding:3px; gap:2px; border-radius:10px; background:var(--surface-2); border:1px solid var(--line); }
.niveau-btn {
  min-height:32px; padding:0 12px; border:0; border-radius:8px; background:transparent; box-shadow:none;
  color:var(--ink-2); font:inherit; font-size:.84rem; font-weight:600; cursor:pointer;
}
.niveau-btn:hover { background:var(--hover); color:var(--ink); }
.niveau-btn.on { background:var(--surface); color:var(--accent); box-shadow:0 1px 3px rgba(19,33,29,.12); }
.niveaux-perso { font-size:.78rem; color:var(--mute); font-style:italic; }
.settings-foot { display:flex; flex-direction:column; gap:10px; margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }
.settings-foot p { color:var(--mute); font-size:.8rem; }
label.check { justify-content:flex-start; align-items:center; gap:10px; margin:0; color:var(--ink); cursor:pointer; }

/* Compte rendu, QR, playlists */
#report-session-list { margin-top:18px; color:var(--ink-2); font-size:.9rem; }
.page-tete { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
.page-tete .lead { margin-top:4px; font-size:.92rem; }
.seances-vide { display:flex; align-items:center; gap:14px; color:var(--mute); font-size:.86rem; }
.seances-vide .ic { width:30px; height:30px; color:var(--accent); stroke-width:1.5; }
.seances-vide b { display:block; color:var(--ink); font-size:.92rem; }
.seances-tete { display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:4px 12px; margin-bottom:12px; }
.seances-tete b { color:var(--ink); }
.seances-tete span { color:var(--mute); font-size:.82rem; }
.seances { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.seance { display:flex; align-items:center; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); }
.seance-ic { display:grid; place-items:center; width:36px; height:36px; flex:none; border-radius:10px; background:var(--accent-soft); color:var(--accent); }
.seance-txt { flex:1 1 auto; min-width:0; }
.seance-txt b { color:var(--ink); font-size:.9rem; }
.seance-txt small { display:block; color:var(--mute); font-size:.78rem; line-height:1.45; overflow-wrap:anywhere; }
.seance-score { flex:none; padding:4px 10px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:.85rem; font-weight:700; font-variant-numeric:tabular-nums; }
.seance-suppr { flex:none; min-width:32px; min-height:32px; padding:0 8px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--mute); box-shadow:none; font-size:1.1rem; font-weight:500; }
.seance-suppr:not(:disabled):hover { background:var(--hover); border-color:var(--line); color:var(--ink); }
.seance-suppr.a-confirmer { font-size:.8rem; }
#qr-output { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; min-height:200px; margin-top:18px; text-align:center; }
#qr-output .hint { color:var(--mute); font-weight:400; }
#q-list { margin-bottom:14px; color:var(--accent); font-weight:650; line-height:1.9; }
#q-list:empty { display:none; }
#q-save-box { display:flex; flex-wrap:wrap; gap:10px; }
#q-name { flex:1; min-width:200px; }
.pl-list { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.pl-item {
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface);
}
.pl-info { flex:1 1 320px; min-width:0; }
.pl-title { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 10px; }
.pl-title b { font-size:.98rem; }
.pl-meta { color:var(--mute); font-size:.8rem; }
.pl-desc { margin-top:4px; color:var(--ink-2); font-size:.86rem; }
.pl-steps { margin-top:6px; color:var(--accent); font-size:.8rem; font-weight:600; }
.pl-actions { display:flex; gap:8px; }
.pl-empty { padding:14px 16px; border:1px dashed var(--line-strong); border-radius:var(--r-md); color:var(--mute); font-size:.88rem; }
#playlists > .lead { margin-bottom:14px; }
.pl-auto { margin:0 0 14px; padding:10px 14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface-2); color:var(--ink); }

/* Accueil */
#accueil { display:grid; grid-template-columns:minmax(0,1fr); gap:28px; }
.acc-hero {
  position:relative; overflow:hidden; display:grid; gap:22px; padding:clamp(22px,3.4vw,40px);
  border-radius:var(--r-xl); background:var(--stage); color:var(--stage-ink); box-shadow:var(--shadow-md);
}
/* Iris en filigrane, comme dans le logo */
.acc-hero::before, .acc-hero::after { content:""; position:absolute; border-radius:50%; pointer-events:none; }
.acc-hero::before { right:-70px; top:-90px; width:300px; height:300px; border:44px solid rgba(124,199,174,.07); }
.acc-hero::after { right:40px; top:20px; width:80px; height:80px; background:rgba(124,199,174,.06); }
.acc-hero > * { position:relative; z-index:1; }
.acc-kicker { color:var(--stage-accent); font-size:.74rem; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.acc-titre { margin-top:6px; color:#fff; font-size:clamp(1.5rem,3vw,2.15rem); font-weight:750; letter-spacing:-.035em; }
.acc-sous { margin-top:8px; max-width:62ch; color:var(--stage-mute); font-size:.98rem; }
label.acc-recherche { position:relative; display:flex; align-items:center; max-width:580px; margin:0; }
.acc-recherche .ic { position:absolute; left:15px; width:19px; height:19px; color:#7b8a83; pointer-events:none; }
.acc-recherche input { min-height:50px; padding-left:46px; border-color:transparent; border-radius:12px; font-size:1rem; box-shadow:0 2px 12px rgba(0,0,0,.2); }
.acc-reprise { display:flex; align-items:center; flex-wrap:wrap; gap:10px 14px; padding:14px 16px; border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius:var(--r-lg); background:var(--accent-soft); color:var(--ink-2); font-size:.9rem; }
.acc-reprise > .ic { width:22px; height:22px; color:var(--accent); }
.acc-reprise span { flex:1 1 240px; }
.acc-reprise b { color:var(--ink); }
.acc-bloc-tete { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.acc-bloc-tete h3 { display:flex; align-items:center; gap:9px; font-size:1.02rem; font-weight:700; }
.acc-bloc-tete h3 .ic { width:20px; height:20px; color:var(--accent); }
.acc-compte { color:var(--mute); font-size:.8rem; }
.acc-grille { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:10px; }
.acc-ex {
  display:flex; align-items:flex-start; justify-content:flex-start; gap:12px; width:100%; min-height:0; padding:14px;
  border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-sm);
  font-weight:400; text-align:left; transition:border-color .15s,box-shadow .15s,transform .15s;
}
.acc-ex:not(:disabled):hover { background:var(--surface); border-color:color-mix(in srgb,var(--accent) 42%,var(--line)); box-shadow:var(--shadow-md); transform:translateY(-1px); }
.acc-ex-ic, .acc-outil-ic { display:grid; place-items:center; width:42px; height:42px; flex:none; border-radius:12px; background:var(--accent-soft); color:var(--accent); }
.acc-ex-ic .ic, .acc-outil-ic .ic { width:22px; height:22px; }
.acc-ex-txt { min-width:0; }
.acc-ex-txt b, .acc-outil b { display:block; color:var(--ink); font-size:.93rem; font-weight:650; line-height:1.3; }
.acc-ex-txt small, .acc-outil small { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-top:3px; color:var(--mute); font-size:.8rem; line-height:1.42; }
.acc-seances { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:10px; }
.acc-seance { display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:16px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--shadow-sm); }
.acc-seance-ics { display:flex; gap:4px; margin-bottom:4px; color:var(--accent); }
.acc-seance-ics .ic { width:26px; height:26px; padding:4px; border-radius:8px; background:var(--accent-soft); }
.acc-seance b { font-size:.96rem; }
.acc-seance-meta { color:var(--mute); font-size:.78rem; }
.acc-seance p { flex:1; color:var(--ink-2); font-size:.84rem; line-height:1.5; }
.acc-seance button { margin-top:6px; }
.acc-outils { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:10px; }
.acc-outil {
  display:flex; align-items:center; justify-content:flex-start; gap:12px; min-height:0; padding:14px; border:1px solid var(--line); border-radius:var(--r-lg);
  background:var(--surface-2); color:var(--ink); box-shadow:none; font-weight:400; text-align:left;
}
.acc-outil > span:not(.acc-outil-ic) { flex:1; min-width:0; }
.acc-outil:not(:disabled):hover { background:var(--surface); border-color:color-mix(in srgb,var(--accent) 42%,var(--line)); }
.acc-outil-ic { background:var(--surface); border:1px solid var(--line); }
.acc-fleche { width:16px; height:16px; color:var(--mute); }
.acc-vide { padding:22px; border:1px dashed var(--line-strong); border-radius:var(--r-lg); color:var(--mute); text-align:center; }
.acc-confiance { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:16px 22px; padding:18px 20px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); }
.acc-confiance > div { display:flex; align-items:flex-start; gap:11px; }
.acc-confiance .ic { width:20px; height:20px; margin-top:2px; color:var(--accent); }
.acc-confiance b { display:block; font-size:.88rem; }
.acc-confiance span { display:block; color:var(--mute); font-size:.8rem; line-height:1.45; }
.acc-install { align-items:center !important; }
.acc-install button .ic { color:currentColor; margin:0; }

/* Taille réelle sous les curseurs en pixels (écran étalonné) */
.phys { display:block; margin-top:2px; color:var(--mute); font-size:.74rem; }
.phys:empty { display:none; }

/* Suivi entre les séances */
.suivi { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 20px; margin-top:18px; padding:16px 18px; border:1px solid color-mix(in srgb,var(--accent) 25%,var(--line)); border-radius:var(--r-md); background:var(--accent-soft); }
.suivi > div:first-child { flex:1 1 320px; }
.suivi h3 { font-size:.95rem; margin-bottom:4px; }
.suivi p { color:var(--ink-2); font-size:.84rem; }
.suivi-actions { display:flex; flex-wrap:wrap; gap:8px; }
.seance-importee { display:inline-block; margin-left:6px; padding:1px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:.72rem; font-weight:650; vertical-align:1px; }

/* Étalonnage de l’écran */
.ecran-etapes { margin:0 0 18px; padding-left:20px; color:var(--ink-2); font-size:.9rem; }
.ecran-etapes li { margin:3px 0; }
.ecran-carte-zone { display:flex; justify-content:center; margin:0 0 20px; padding:18px; overflow-x:auto; border:1px dashed var(--line-strong); border-radius:var(--r-md); background:var(--surface-2); }
.ecran-carte {
  flex:0 0 auto; display:flex; align-items:flex-end; justify-content:flex-end; padding:8px 10px; border-radius:3.2% / 5%;
  background:linear-gradient(135deg,#2f7a64,#3f9478); color:#fff; font-size:.8rem; font-weight:650; box-shadow:var(--shadow-md);
}

/* Mode patient : seuls l’exercice et ses boutons restent visibles */
.quitter-patient {
  position:relative; overflow:hidden; min-height:38px; padding:0 14px; border:1px solid var(--line-strong); border-radius:10px;
  background:var(--surface); color:var(--ink-2); box-shadow:none; font-size:.8rem; font-weight:600; user-select:none; -webkit-user-select:none; touch-action:none;
}
.quitter-patient::before { content:""; position:absolute; inset:0; width:0; background:var(--accent-soft); }
.quitter-patient.en-cours::before { width:100%; transition:width 1.5s linear; }
.quitter-patient span { position:relative; }
body.mode-patient .sidebar, body.mode-patient .header-tools, body.mode-patient .header-note,
body.mode-patient #play > .settings, body.mode-patient #q-add, body.mode-patient #desc, body.mode-patient .page-foot,
body.mode-patient .ex-kicker, body.mode-patient .ex-obj, body.mode-patient .attente-aide,
body.mode-patient .home-banner { display:none !important; }
body.mode-patient .layout { display:block; }
body.mode-patient .content { max-width:none; }
body.mode-patient #play { grid-template-columns:minmax(0,1fr); }
body.mode-patient #stage { min-height:calc(100vh - var(--header-h) - 170px); }
body.mode-patient .under > button { min-height:52px; padding:0 24px; font-size:1.05rem; }

/* ========== 8. Composants dessinés dans la scène ========== */
.hint { max-width:36ch; color:var(--stage-mute); font-size:1rem; font-weight:400; line-height:1.55; }
.bw { width:100%; }
.mod { margin:0 0 12px; font-weight:400; color:var(--stage-mute); }
.mod b { font-size:1.6rem; color:var(--stage-ink); }

/* Points (saccades, poursuite, repérage) */
.dot {
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); border-radius:50%;
  display:flex; align-items:center; justify-content:center; background:#fff; color:#0c1a24; font-style:normal; font-weight:700;
}
.dot.g { background:var(--ok); } .dot.r { background:var(--ko); }
.dot.crosshair { width:18px !important; height:18px !important; background:transparent; border-radius:0; color:transparent; }
.dot.crosshair::before, .dot.crosshair::after {
  content:""; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); background:var(--stage-ink); border-radius:1px; pointer-events:none;
}
.dot.crosshair::before { width:18px; height:2px; } .dot.crosshair::after { width:2px; height:18px; }

/* Séries de signes (empan) */
.row { display:flex; justify-content:center; flex-wrap:nowrap; gap:.4em; line-height:1; }
.row span { min-width:.9em; } .row .ok { color:var(--ok); } .row .ko { color:var(--ko); }

/* Quadrillage */
.qc { padding:8px 0; border-radius:var(--r-sm); background:var(--stage-2); font-size:clamp(18px,5vw,34px); }
.qc.on { background:var(--focus); color:#12202b; }

/* Grilles et choix (discrimination, figures, cubes, rotation) */
.rot { display:flex; align-items:center; justify-content:center; gap:40px; margin-bottom:14px; line-height:1; }
.pt { display:grid; gap:2px; width:90px; } .pt i { aspect-ratio:1; background:var(--stage-3); border-radius:2px; } .pt i.f { background:var(--stage-ink); }
.mdl { display:flex; justify-content:center; margin-bottom:14px; } .mdl .pt { width:120px; }
.opts { display:flex; flex-wrap:wrap; justify-content:center; gap:10px; }
.pb {
  min-height:0; padding:8px; border:2px solid var(--stage-line); border-radius:var(--r-md);
  background:transparent; color:inherit; box-shadow:none; cursor:pointer; transition:border-color .15s,background-color .15s;
}
.pb:hover { border-color:var(--stage-mute); background:var(--stage-2); }
.pb svg { display:block; }
.pb.g { border-color:var(--ok); } .pb.r { border-color:var(--ko); }

/* Copie de grille */
.cg { display:grid; justify-content:center; gap:2px; }
.cp { display:flex; flex-wrap:wrap; justify-content:center; gap:8px 20px; }
.cc {
  width:38px; height:38px; min-height:0; padding:0; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--stage-line); border-radius:6px; background:transparent; color:var(--stage-ink); box-shadow:none;
  font-size:20px; font-weight:700; cursor:pointer;
}
.cc.sel { background:var(--stage-select); color:var(--stage-select-ink); }
.cc.g { background:var(--ok-strong); } .cc.r { background:var(--ko-strong); } .cc.miss { outline:2px solid var(--ko); }
.cc:disabled { opacity:.3; }
.cg.hid .cc { color:transparent; }

/* Recherche de cible */
.fld { display:grid; grid-template-columns:repeat(8,1fr); gap:2px 4px; width:100%; max-width:520px; margin:0 auto; }
.fld div { aspect-ratio:1; display:flex; align-items:center; justify-content:center; border-radius:var(--r-sm); font-size:clamp(16px,5.5vw,36px); }

/* Séquence */
.tl { max-width:300px; }
.tile { height:80px; min-height:0; padding:0; border:0; border-radius:14px; box-shadow:none; opacity:.45; cursor:pointer; transition:opacity .12s,transform .12s; }
.tile.lit { opacity:1; transform:scale(1.05); }
.tile:disabled { cursor:default; }

/* Lecture guidée */
.txt { max-width:36em; text-align:left; font-weight:400; line-height:1.8; }
.w { padding:0 .12em; border-radius:6px; } .w.on { background:var(--focus); color:#12202b; }

/* Barrage */
.g2 { display:grid; gap:4px; width:100%; }
.cell {
  min-height:0; padding:6px 0; border:1px solid var(--stage-line); border-radius:var(--r-sm);
  background:transparent; color:var(--stage-ink); box-shadow:none; font-size:clamp(16px,5vw,30px); cursor:pointer;
}
.cell:hover { background:var(--stage-2); }
.cell.on { background:var(--stage-select); color:var(--stage-select-ink); }
.cell.hit { background:var(--ok-strong); } .cell.err { background:var(--ko-strong); } .cell.miss { outline:3px solid var(--ko); outline-offset:-3px; }
.g2 .cell:disabled { opacity:.5; }
.g2 .cell.hit, .g2 .cell.err, .g2 .cell.miss { opacity:1; }
.cell:disabled { cursor:default; }

/* Empan visuel et Mot → image */
.emp-shell { width:100%; max-width:760px; margin:0 auto; padding:clamp(6px,2vw,16px); text-align:center; color:var(--stage-ink); }
.emp-kicker { margin-bottom:6px; color:var(--stage-mute); font-size:.74rem; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.emp-title { margin:0 0 6px; font-size:clamp(1.1rem,3vw,1.5rem); font-weight:700; letter-spacing:-.02em; }
.emp-subtitle { margin:0 0 14px; color:var(--stage-mute); font-size:.92rem; font-weight:400; }
.emp-memory-stage { min-height:120px; display:flex; align-items:center; justify-content:center; }
.emp-pics { display:flex; flex-wrap:wrap; justify-content:center; align-items:stretch; gap:clamp(8px,2vw,16px); padding:18px 10px; line-height:1.2; }
.emp-pics span {
  display:flex; align-items:center; justify-content:center; min-width:clamp(58px,10vw,92px); min-height:clamp(68px,11vw,100px);
  padding:8px; border:1px solid var(--stage-line); border-radius:var(--r-lg); background:var(--stage-2); font-size:clamp(38px,7vw,64px);
}
.emp-word-flash {
  display:flex; align-items:center; justify-content:center; min-height:130px; margin:16px auto; padding:18px;
  border:1px solid var(--stage-line); border-radius:var(--r-lg); background:var(--stage-2);
  font-size:clamp(2rem,7vw,3.4rem); font-weight:800; letter-spacing:.08em;
}
.emp-choice-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:clamp(7px,1.5vw,12px); max-width:590px; margin:18px auto; }
.emp-choice {
  display:flex; align-items:center; justify-content:center; aspect-ratio:1; min-height:60px; padding:8px 4px;
  border:1px solid var(--stage-line); border-radius:14px; background:var(--stage-2); color:var(--stage-ink); box-shadow:none;
  font-size:clamp(30px,6vw,48px); cursor:pointer; transition:border-color .15s,background-color .15s,transform .15s;
}
.emp-choice:not(:disabled):hover { border-color:var(--stage-accent); background:var(--stage-3); transform:translateY(-1px); }
.emp-choice:disabled { opacity:.38; transform:scale(.96); }
.emp-word-grid { width:min(100%,1100px); max-width:1100px; grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); align-content:center; gap:clamp(8px,1.5vw,18px); }
.emp-word-choice { flex-direction:column; gap:6px; aspect-ratio:1/1.05; overflow:hidden; padding:8px; }
.emp-word-photo { display:block; width:100%; height:100%; min-height:0; max-height:180px; object-fit:cover; border-radius:10px; background:#fff; }
.emp-word-fallback { font-size:clamp(2.6rem,8vw,4rem); line-height:1.2; }
.emp-word-caption { color:var(--stage-mute); font-size:.7rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.emp-answer-card {
  display:flex; align-items:center; justify-content:center; gap:16px; max-width:360px; margin:18px auto; padding:16px 24px;
  border:1px solid var(--stage-line); border-radius:var(--r-lg); background:var(--stage-2);
}
.emp-answer-card span { font-size:3.2rem; } .emp-answer-card strong { font-size:1.3rem; letter-spacing:.05em; }
.emp-feedback-photo { width:100px; height:100px; object-fit:cover; border-radius:var(--r-md); }
.emp-answer-timer {
  display:inline-flex; align-items:center; justify-content:center; min-width:60px; height:40px; margin-top:14px; padding:0 14px;
  border-radius:999px; background:var(--stage-3); color:var(--stage-ink); font-size:1.05rem; font-weight:800; font-variant-numeric:tabular-nums;
}
.emp-answer-timer.urgent { background:#5a2a24; color:#ffb4a1; }
.emp-sequence { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; min-height:58px; margin:12px auto; }
.emp-slot {
  display:flex; align-items:center; justify-content:center; width:clamp(42px,8vw,58px); height:clamp(42px,8vw,58px);
  border:2px dashed var(--stage-line); border-radius:var(--r-md); color:var(--stage-mute); font-size:clamp(24px,4.5vw,34px);
}
.emp-slot.filled { border-style:solid; border-color:var(--stage-accent); background:var(--stage-3); color:var(--stage-ink); }
.emp-selected { margin:12px auto 0; color:var(--stage-mute); font-size:.9rem; font-weight:400; }
.emp-progress { max-width:420px; height:6px; margin:12px auto 4px; border-radius:999px; background:var(--stage-3); overflow:hidden; }
.emp-progress span { display:block; height:100%; border-radius:999px; background:var(--stage-accent); transition:width .2s; }
#stage img { background:#fff; }
.emp-choice.is-correct { border-color:var(--ok) !important; background:color-mix(in srgb,var(--ok) 18%,var(--stage-2)); opacity:1; }
.emp-choice.is-wrong { border-color:var(--ko) !important; background:color-mix(in srgb,var(--ko) 18%,var(--stage-2)); opacity:1; }

/* Lecture de nombres V/H : feuille claire, comme une planche papier ; la taille des chiffres s’adapte à la hauteur disponible */
#stage:has(.dem) { min-height:max(clamp(320px,52vh,640px), calc(100vh - 230px)); }
.dem { position:absolute; inset:clamp(10px,1.6vw,20px); display:flex; flex-direction:column; gap:10px; }
.dem-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; font-weight:400; color:var(--stage-mute); font-size:.88rem; }
.dem-bar b { color:var(--stage-ink); margin-right:6px; }
.dem-bar button { flex:0 0 auto; }
.dem-bar .dem-stop { background:var(--ko-strong); border-color:var(--ko-strong); color:#fff; }
.dem-sheet {
  flex:1 1 auto; min-height:0; display:flex; align-items:center; justify-content:center; container-type:size;
  background:#fbfaf6; color:#151a18; border-radius:var(--r-md); overflow:hidden;
}
.dem-text {
  font-family:"SF Mono",ui-monospace,Menlo,Consolas,monospace; font-weight:600; font-variant-numeric:tabular-nums;
  /* Taille limitée par le réglage, la hauteur et la largeur de la planche */
  font-size:min(var(--dem-max), calc(92cqh / (var(--dem-rows) * var(--dem-lh))), calc(94cqw / var(--dem-wem, 10))); line-height:var(--dem-lh);
}
.dem-text.dem-mots { font-family:inherit; font-weight:600; letter-spacing:.01em; }
.dem-vert { display:flex; }
.dem-mots .dem-col { text-align:left; }
.dem-col span { display:block; }
.dem-horiz { text-align:left; }
.dem-row { white-space:nowrap; }
.dem-err-list { display:grid; gap:8px; max-width:520px; margin:16px auto 18px; }
.dem-err-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 14px; border:1px solid var(--stage-line); border-radius:var(--r-md); background:var(--stage-2); text-align:left; }
.dem-err-row span { display:block; color:var(--stage-mute); font-size:.82rem; font-weight:400; }
.dem-step { display:flex; align-items:center; gap:10px; }
.dem-step button { width:38px; min-height:38px; padding:0; font-size:1.2rem; }
.dem-step output { min-width:28px; font-size:1.3rem; font-variant-numeric:tabular-nums; }

/* Parcours numéroté */
.trail { position:absolute; inset:clamp(14px,2vw,26px); }
.trail-lines { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.trail-lines line { stroke:var(--stage-accent); stroke-width:3; stroke-linecap:round; vector-effect:non-scaling-stroke; }
.trail-dot {
  position:absolute; transform:translate(-50%,-50%); display:flex; align-items:center; justify-content:center; min-height:0; padding:0;
  border:2px solid var(--stage-line); border-radius:50%; background:var(--stage-2); color:var(--stage-ink); box-shadow:none;
  font-weight:700; cursor:pointer; transition:background-color .12s,border-color .12s;
}
.trail-dot:hover { border-color:var(--stage-mute); }
.trail-dot.trail-start { border-color:var(--stage-accent); }
.trail-dot.ok { background:var(--ok-strong); border-color:var(--ok); color:#fff; }
.trail-dot.ko { background:var(--ko-strong); border-color:var(--ko); color:#fff; }

/* Lignes emmêlées */
.lg-svg { display:block; width:100%; max-width:680px; height:auto; margin:0 auto; }
.lg-path { fill:none; stroke-width:3; stroke-linecap:round; opacity:.9; }
.lg-path.lg-show { stroke:var(--focus) !important; stroke-width:5; opacity:1; }
.lg-end { fill:var(--stage-mute); }
.lg-lab { fill:var(--stage-mute); font-size:20px; font-weight:700; }
.lg-lab.lg-on { fill:var(--focus); }
.lg-opts { margin-top:12px; }
.lg-opts button { min-width:46px; }
.lg-opts .lg-good { background:var(--ok-strong); border-color:var(--ok-strong); color:#fff; }
.lg-opts .lg-bad { background:var(--ko-strong); border-color:var(--ko-strong); color:#fff; }

/* Jeu de Kim */
.kim-grid { display:grid; gap:clamp(8px,1.5vw,14px); max-width:560px; margin:14px auto; }
.kim-grid span {
  display:flex; align-items:center; justify-content:center; aspect-ratio:1; border:1px solid var(--stage-line);
  border-radius:var(--r-lg); background:var(--stage-2); font-size:clamp(30px,5vw,48px);
}
.kim-grid .kim-trou { border-style:dashed; background:transparent; color:var(--stage-mute); font-size:clamp(22px,3.5vw,32px); }
.kim-choix { grid-template-columns:repeat(4,minmax(0,1fr)); max-width:420px; }

/* Mots cachés : la grille occupe la hauteur disponible, la liste des mots à côté */
#stage:has(.mots) { min-height:max(clamp(320px,52vh,640px), calc(100vh - 230px)); }
.mots { position:absolute; inset:clamp(10px,1.6vw,20px); display:flex; align-items:center; justify-content:center; gap:clamp(14px,2.5vw,32px); container-type:size; }
.mots-grid {
  --cell:min(46px, calc(94cqh / var(--n)), calc((100cqw - 200px) / var(--n)));
  display:grid; grid-template-columns:repeat(var(--n), var(--cell)); gap:2px; flex:0 0 auto;
}
.mots-c {
  width:var(--cell); height:var(--cell); min-height:0; padding:0; border:0; border-radius:6px; box-shadow:none;
  background:transparent; color:var(--stage-ink); font-size:calc(var(--cell) * .55); font-weight:700; font-family:inherit; cursor:pointer;
}
.mots-c:hover { background:var(--stage-2); }
.mots-c.ancre { background:var(--stage-select); color:var(--stage-select-ink); }
.mots-c.trouve { background:color-mix(in srgb,var(--ok) 28%,transparent); color:var(--stage-ink); }
.mots-c.ko { background:var(--ko-strong); color:#fff; }
.mots-c.manque { box-shadow:inset 0 0 0 2px var(--ko); }
.mots-liste { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; text-align:left; min-width:120px; }
.mots-liste li { padding:5px 10px; border:1px solid var(--stage-line); border-radius:8px; font-size:.92rem; letter-spacing:.06em; }
.mots-liste li.fait { text-decoration:line-through; color:var(--stage-mute); border-color:transparent; background:var(--stage-2); }
/* Petit écran : la liste passe sous la grille, en étiquettes, pour laisser toute la largeur aux lettres */
@media (max-width:620px) {
  .mots { flex-direction:column; justify-content:flex-start; gap:10px; }
  .mots-grid { --cell:min(40px, calc(98cqw / var(--n)), calc((100cqh - 110px) / var(--n))); }
  .mots-liste { flex-direction:row; flex-wrap:wrap; justify-content:center; gap:5px; min-width:0; }
  .mots-liste li { padding:3px 8px; font-size:.76rem; }
}

/* Jeu des différences */
.diff { width:100%; }
.diff-pair { display:flex; flex-wrap:wrap; justify-content:center; gap:clamp(16px,4vw,48px); }
.diff-grid { --cell:clamp(32px,calc(36vw / var(--n) / 2.2),60px); display:grid; grid-template-columns:repeat(var(--n), var(--cell)); gap:4px; padding:10px; border:1px solid var(--stage-line); border-radius:var(--r-md); }
.diff-c {
  width:var(--cell); height:var(--cell); min-height:0; padding:0; border:1px solid transparent; border-radius:8px; box-shadow:none;
  background:var(--stage-2); color:var(--stage-ink); font-size:calc(var(--cell) * .55); cursor:pointer;
}
.diff-c:hover { border-color:var(--stage-mute); }
.diff-c.vu { border:2px solid var(--ok); background:color-mix(in srgb,var(--ok) 20%,var(--stage-2)); }
.diff-c.ko { background:var(--ko-strong); }

/* Mémory */
.memo-grid { display:grid; gap:clamp(6px,1.2vw,12px); max-width:620px; margin:0 auto; }
.memo-c {
  aspect-ratio:1; min-height:0; padding:0; border:1px solid var(--stage-line); border-radius:var(--r-md); box-shadow:none;
  background:var(--stage-3); color:var(--stage-ink); font-size:clamp(26px,4.5vw,44px); cursor:pointer; transition:background-color .15s,transform .15s;
}
.memo-c span { visibility:hidden; }
.memo-c:hover { border-color:var(--stage-mute); }
.memo-c.ouverte { background:var(--stage-2); transform:scale(1.03); }
.memo-c.ouverte span { visibility:visible; }
.memo-c.paire { border-color:var(--ok); background:color-mix(in srgb,var(--ok) 16%,var(--stage-2)); transform:none; cursor:default; }

/* Pointage chronométré */
.point { position:absolute; inset:clamp(10px,1.6vw,20px); }
.point-cible {
  position:absolute; transform:translate(-50%,-50%); min-height:0; padding:0; border:3px solid var(--stage-ink); border-radius:50%;
  background:var(--stage-accent); box-shadow:0 0 0 6px color-mix(in srgb,var(--stage-accent) 25%,transparent); cursor:pointer;
}
.point-carte { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-width:420px; margin:14px auto; }
.point-carte div {
  display:flex; flex-direction:column; align-items:center; justify-content:center; aspect-ratio:1.4; border-radius:var(--r-md);
  background:color-mix(in srgb,var(--ko-strong) calc(var(--k) * 70%),var(--stage-2)); border:1px solid var(--stage-line);
}
.point-carte b { font-size:1.05rem; } .point-carte span { color:var(--stage-mute); font-size:.72rem; font-weight:500; }

/* Stroop */
.stroop-mot { font-weight:800; letter-spacing:.04em; line-height:1.1; margin:6px 0 4px; }
.stroop-consigne { margin:0 auto 16px; }
.stroop-opts button { min-width:110px; }
.stroop-opts i { width:14px; height:14px; border-radius:50%; flex:0 0 auto; }
.stroop-opts .lg-good { background:var(--ok-strong); border-color:var(--ok-strong); color:#fff; }
.stroop-opts .lg-bad { background:var(--ko-strong); border-color:var(--ko-strong); color:#fff; }

/* Rouge-vert : fond noir pur, pour que chaque couleur ne soit vue qu’à travers son filtre */
#stage:has(.rv), #play.is-fs #stage:has(.rv) { --stage:#000; background:#000 !important; border-color:#222 !important; }
.rv { width:100%; display:flex; flex-direction:column; align-items:center; gap:14px; }
.rv-modele { color:#fff; font-weight:400; } .rv-modele b { font-size:1.6rem; margin-left:4px; }
.rv-grid { display:grid; gap:.25em .5em; justify-content:center; }
.rv-c { min-width:1.4em; min-height:1.4em; padding:0; border:2px solid transparent; border-radius:8px; background:transparent; box-shadow:none; font:inherit; font-weight:800; line-height:1; cursor:pointer; }
.rv-c.vu { border-color:#fff; }
.rv-c.ko { border-color:#777; }
#rv-fin { background:#000; color:#fff; border-color:#555; }

/* Écran d’attente avant le lancement : icône de l’exercice et consigne pour le patient */
.attente { display:flex; flex-direction:column; align-items:center; gap:14px; max-width:48ch; font-weight:400; }
.attente-ic { display:grid; place-items:center; width:78px; height:78px; border:1px solid var(--stage-line); border-radius:24px; background:var(--stage-2); color:var(--stage-accent); }
.attente-ic .ic { width:42px; height:42px; stroke-width:1.5; }
.attente-consigne { color:var(--stage-ink); font-size:clamp(1.05rem,2.2vw,1.3rem); font-weight:600; line-height:1.45; text-wrap:balance; }
.attente-aide { color:var(--stage-mute); font-size:.9rem; }

/* Bilan de fin d’exercice, posé sur la scène */
.bilan { position:absolute; inset:0; z-index:60; display:flex; padding:16px; overflow:auto; background:rgba(10,20,17,.78); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); animation:bilan-voile .25s ease-out; }
.bilan-carte {
  width:min(100%,460px); margin:auto; padding:22px 24px; border:1px solid var(--stage-line); border-radius:var(--r-xl);
  background:var(--stage-2); box-shadow:0 22px 60px rgba(0,0,0,.4); text-align:left; font-weight:400; animation:bilan-carte .32s cubic-bezier(.2,.8,.2,1);
}
.bilan-kicker { display:flex; align-items:center; gap:6px; color:var(--stage-accent); font-size:.74rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.bilan-kicker .ic { width:16px; height:16px; stroke-width:2.6; }
.bilan-titre { margin-top:4px; color:var(--stage-ink); font-size:1.4rem; font-weight:750; letter-spacing:-.025em; line-height:1.2; }
.bilan-score { display:flex; align-items:center; gap:16px; margin:16px 0 2px; }
.bilan-score svg { width:86px; height:86px; flex:none; }
.bilan-piste { fill:none; stroke:var(--stage-3); stroke-width:8; }
.bilan-arc { fill:none; stroke:var(--stage-accent); stroke-width:8; stroke-linecap:round; }
.bilan-score b { display:block; color:var(--stage-ink); font-size:2.1rem; font-weight:800; letter-spacing:-.03em; line-height:1; font-variant-numeric:tabular-nums; }
.bilan-score span { display:block; margin-top:5px; color:var(--stage-mute); font-size:.86rem; }
.bilan-ind { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:16px 0 0; }
.bilan-ind div { min-width:0; padding:9px 12px; border-radius:var(--r-md); background:var(--stage-3); }
.bilan-ind dt { color:var(--stage-mute); font-size:.74rem; line-height:1.3; }
.bilan-ind dd { margin:3px 0 0; color:var(--stage-ink); font-size:.98rem; font-weight:700; line-height:1.3; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.bilan-note { margin-top:12px; color:var(--stage-mute); font-size:.82rem; line-height:1.45; }
.bilan-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.bilan-actions button { flex:1 1 auto; }
.enchainement { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 12px; margin-top:14px; padding:10px 12px; border:1px solid var(--stage-line); border-radius:var(--r-md); background:var(--stage-3); color:var(--stage-ink); font-size:.88rem; font-weight:400; }
.enchainement button { min-height:34px; }
.emp-shell > .enchainement { max-width:460px; margin:0 auto; }
/* La scène s’agrandit si besoin pour que le bilan tienne sans défilement */
#stage:has(.bilan) { min-height:max(clamp(320px,52vh,640px),540px); }
@keyframes bilan-voile { from { opacity:0; } to { opacity:1; } }
@keyframes bilan-carte { from { opacity:0; transform:translateY(10px) scale(.98); } to { opacity:1; transform:none; } }

/* Décompte 3-2-1 : se fond dans la scène, sans cadre */
.start-countdown { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; width:100%; }
.countdown-label, .countdown-sub { color:var(--stage-mute); font-size:.9rem; font-weight:600; }
.countdown-label { letter-spacing:.16em; text-transform:uppercase; }
.countdown-number { color:var(--stage-ink); font-size:clamp(3.8rem,15vw,6rem); font-weight:800; line-height:1; letter-spacing:-.04em; font-variant-numeric:tabular-nums; }
.start-countdown.ready .countdown-number { font-size:clamp(2.4rem,8vw,4rem); }

/* ========== 9. Plein écran de l’exercice ========== */
#play.is-fs, #play:fullscreen, #play:-webkit-full-screen {
  /* L’interface autour de la scène passe en bleu nuit */
  --ink:var(--stage-ink); --ink-2:#dbe9e2; --mute:#c2d6cc; --card:#172a24; --surface:#172a24; --hover:#1f3a31;
  --line:#335247; --line-strong:#3e6155; --accent:var(--stage-accent); --accent-hover:#98d6c1; --accent-ink:#0b1f19; --accent-soft:#1d3d33;
  position:fixed; inset:0; z-index:9999; display:flex; flex-direction:column; align-items:stretch;
  width:100vw; height:100vh; height:100dvh; margin:0; padding:clamp(8px,1.5vw,22px); overflow:auto;
  background:#0e1a17; color:var(--ink);
}
#play.is-fs .play-main, #play:fullscreen .play-main, #play:-webkit-full-screen .play-main { flex:1 1 auto; display:flex; flex-direction:column; gap:10px; min-height:0; }
#play.is-fs #et, #play:fullscreen #et, #play:-webkit-full-screen #et { color:var(--ink); font-size:1.3rem; }
#play.is-fs #desc, #play:fullscreen #desc, #play:-webkit-full-screen #desc { margin:0; color:var(--mute); }
#play.is-fs .ex-kicker, #play:fullscreen .ex-kicker, #play:-webkit-full-screen .ex-kicker,
#play.is-fs .ex-obj, #play:fullscreen .ex-obj, #play:-webkit-full-screen .ex-obj { display:none; }
#play.is-fs #stage, #play:fullscreen #stage, #play:-webkit-full-screen #stage { flex:1 1 auto; min-height:0; border-color:#335247; box-shadow:none; }
#play.is-fs .under, #play:fullscreen .under, #play:-webkit-full-screen .under { margin:0; justify-content:center; }
#play.is-fs #q-add, #play:fullscreen #q-add, #play:-webkit-full-screen #q-add { display:none !important; }
#play.is-fs #live, #play:fullscreen #live, #play:-webkit-full-screen #live { margin:0; text-align:center; }
#play.is-fs > .settings, #play:fullscreen > .settings, #play:-webkit-full-screen > .settings,
#play.is-fs .home-banner, #play:fullscreen .home-banner, #play:-webkit-full-screen .home-banner { display:none !important; }
#play.is-fs #stage .emp-shell, #play:fullscreen #stage .emp-shell { width:min(100%,1500px); max-width:1500px; max-height:100%; overflow:auto; }
#play.is-fs #stage .emp-word-grid, #play:fullscreen #stage .emp-word-grid { width:100%; max-width:1500px; grid-template-columns:repeat(var(--word-cols,2),minmax(0,1fr)); }
#play.is-fs #stage .emp-word-choice, #play:fullscreen #stage .emp-word-choice { aspect-ratio:1.35/1; min-height:0; }
#play.is-fs #stage .emp-word-photo, #play:fullscreen #stage .emp-word-photo { max-height:min(24vh,260px); object-fit:contain; }
#play.is-fs #stage .txt, #play:fullscreen #stage .txt { max-width:min(90vw,70em); }

/* ========== 10. Tablette et mobile ========== */
@media (max-width:1280px) {
  .header-note { display:none; }
}
@media (max-width:1100px) {
  .layout { display:block; }
  /* La barre latérale devient une rangée de menus déroulants */
  .sidebar {
    position:sticky; top:var(--header-h); z-index:40; width:auto; height:auto; overflow:visible;
    padding:10px clamp(12px,3vw,28px); border-right:0; border-bottom:1px solid var(--line);
    background:var(--surface); /* pas de backdrop-filter : il décalerait les menus en position fixe */
  }
  .sidebar-note { display:none; }
  #tabs { flex-direction:row; flex-wrap:wrap; gap:6px; }
  .nav-menu-trigger {
    width:auto; min-height:38px; gap:8px; padding:0 14px; pointer-events:auto; cursor:pointer;
    border:1px solid var(--line-strong); border-radius:999px; background:var(--surface);
    color:var(--ink-2); font-size:.85rem; font-weight:600; text-transform:none; letter-spacing:0;
  }
  .nav-menu-trigger:hover, .nav-menu.open > .nav-menu-trigger { background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 35%,var(--line)); color:var(--accent); }
  #tabs > .nav-accueil { width:auto; min-height:38px; margin:0; padding:0 14px; gap:7px; border:1px solid var(--line-strong); border-radius:999px; background:var(--surface); color:var(--ink-2); font-size:.85rem; }
  #tabs > .nav-accueil.on { background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 35%,var(--line)); color:var(--accent); box-shadow:none; }
  .nav-menu-list .tab .ic { width:16px; height:16px; }
  .nav-chevron { display:inline-block; font-size:.9rem; line-height:1; transition:transform .15s; }
  .nav-menu.open .nav-chevron { transform:rotate(180deg); }
  .nav-menu.open { z-index:100; }
  .nav-menu-list {
    position:absolute; top:calc(100% + 8px); left:0; z-index:100; display:none; min-width:240px; max-width:min(340px,calc(100vw - 24px));
    max-height:min(65vh,520px); overflow-y:auto; overscroll-behavior:contain; padding:6px;
    background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--shadow-lg);
  }
  .nav-menu.open > .nav-menu-list { display:flex; }
  .nav-menu:nth-last-child(-n+2) .nav-menu-list { left:auto; right:0; }
  .tab { min-height:40px; }
  .content { padding:22px clamp(12px,3vw,28px) 40px; }
}
/* Fenêtre trop étroite pour le logo et les libellés des outils (≈ 930 px) : outils en icônes seules,
   le libellé reste lisible par les lecteurs d’écran et s’affiche au survol (attribut title) */
@media (max-width:940px) {
  .header-tools { gap:4px; }
  .tool-btn { width:40px; min-height:40px; padding:0; }
  .tool-label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  .tool-badge { position:absolute; top:-6px; right:-6px; min-width:17px; height:17px; line-height:17px; font-size:.64rem; border:2px solid var(--surface); box-sizing:content-box; }
}
@media (max-width:620px) {
  :root { --header-h:58px; }
  body { font-size:14.5px; }
  .top-nav { padding:0 14px; }
  .brand-eye { width:34px; height:25px; }
  .brand-lockup h1 { font-size:1.12rem; }
  .brand-subtitle { display:none; } /* place libérée pour les 5 boutons d’outils */
  .nav-menu-trigger { padding:0 12px; font-size:.8rem; }
  #tabs > .nav-accueil { padding:0 11px; }
  #tabs > .nav-accueil span { display:none; }
  .acc-grille { grid-template-columns:1fr; }
  .acc-hero::before { width:220px; height:220px; border-width:32px; }
  /* Le menu s’ouvre en pleine largeur juste sous la barre de menus (la barre collante sert de repère).
     Les !important neutralisent la position calculée par menu-position.js, inutile ici. */
  .nav-menu { position:static; }
  .nav-menu-list { position:absolute; top:calc(100% + 6px) !important; left:12px !important; right:12px !important; width:auto; min-width:0; max-width:none; max-height:calc(100dvh - 170px); }
  #et { font-size:1.35rem; }
  #stage { min-height:260px; padding:12px; border-radius:var(--r-lg); }
  .grid { grid-template-columns:1fr; }
  .under > button { flex:1 1 auto; }
  #q-add { margin-right:0; }
  .emp-choice-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  /* Téléphone : le bilan prend la place de l’exercice dans la scène, qui s’allonge à sa mesure */
  #stage:has(.bilan) { min-height:260px; }
  #stage:has(.bilan) > :not(.bilan) { display:none !important; }
  .bilan { position:relative; inset:auto; width:100%; padding:0; overflow:visible; background:none; -webkit-backdrop-filter:none; backdrop-filter:none; }
  .bilan-carte { width:100%; padding:10px 6px; border:0; background:transparent; box-shadow:none; }
  .bilan-score svg { width:72px; height:72px; }
  .bilan-score b { font-size:1.8rem; }
  #play.is-fs, #play:fullscreen { padding:env(safe-area-inset-top,8px) 8px env(safe-area-inset-bottom,8px); }
  #play.is-fs #stage, #play:fullscreen #stage { padding:10px 6px; }
}
/* Très petits téléphones : on resserre l’en-tête, puis on ne garde que l’œil du logo (le nom reste dans aria-label) */
@media (max-width:400px) {
  .top-nav { gap:8px; padding:0 10px; }
  .brand-lockup { gap:8px; }
  .header-tools { gap:3px; }
  .tool-btn { width:36px; min-height:36px; }
}
@media (max-width:345px) {
  .brand-lockup h1 { display:none; }
}
@media (max-height:650px) {
  #play.is-fs #stage .emp-word-photo { max-height:19vh; }
}

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

/* Message bref en bas de l’écran (annonce() dans outils.js) */
.annonce {
  position:fixed; left:50%; bottom:24px; z-index:300; max-width:min(92vw,460px); padding:12px 18px; border-radius:12px;
  background:var(--ink); color:#fff; font-size:.9rem; font-weight:500; box-shadow:var(--shadow-lg);
  opacity:0; transform:translate(-50%,16px); pointer-events:none; transition:opacity .2s,transform .2s;
}
.annonce.visible { opacity:1; transform:translate(-50%,0); }

/* Panneau des tests automatiques (index.html?tests) */
.tests-panneau { position:fixed; right:16px; bottom:16px; z-index:20000; width:min(360px,calc(100vw - 32px)); max-height:70vh; overflow:auto; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--shadow-lg); font-size:.84rem; }
.tests-panneau p { margin:4px 0 10px; color:var(--mute); }
.tests-panneau ul { list-style:none; margin:8px 0 0; padding:0; }
.tests-panneau li { padding:2px 0; }
.tests-panneau .ok { color:var(--ok-strong); } .tests-panneau .ko { color:var(--ko-strong); }

/* ========== Indications : « Conseillé pour » et conseil d’utilisation (indications.js) ========== */
.puce {
  min-height:32px; padding:0 12px; border:1px solid var(--line-strong); border-radius:999px;
  background:var(--surface); color:var(--ink-2); box-shadow:none; font-size:.8rem; font-weight:600;
}
.puce:not(:disabled):hover { background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 40%,var(--line)); color:var(--accent); }
.puce.on, .puce.on:not(:disabled):hover { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.ex-ind { display:grid; gap:10px; margin-top:16px; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface-2); }
.ex-ind-pour { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.ex-ind-tit { display:block; margin-right:4px; color:var(--mute); font-size:.68rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.ex-ind-pour .ex-ind-tit { display:inline; }
.ex-ind-conseil { max-width:90ch; color:var(--ink-2); font-size:.86rem; line-height:1.55; }
.ex-ind-conseil .ex-ind-tit { margin-bottom:3px; }
body.mode-patient .ex-ind, #play.is-fs .ex-ind, #play:fullscreen .ex-ind, #play:-webkit-full-screen .ex-ind { display:none !important; }
.acc-puces { display:flex; flex-wrap:wrap; gap:8px; }
.acc-dif-note { margin-top:12px; color:var(--ink-2); font-size:.86rem; }
/* Téléphone : les difficultés défilent sur deux lignes au lieu d’occuper tout l’écran */
@media (max-width:620px) {
  .acc-difs { min-width:0; max-width:100%; }
  .acc-puces { display:grid; grid-auto-flow:column; grid-auto-columns:max-content; grid-template-rows:repeat(2,auto); justify-content:start; max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; padding-bottom:2px; }
  .acc-puces::-webkit-scrollbar { display:none; }
  .acc-puces .puce { white-space:nowrap; }
}
.acc-dif-note b { color:var(--ink); }

/* Anti-saccades */
.anti-etoile, .anti-fleche { position:absolute; transform:translate(-50%,-50%); font-style:normal; line-height:1; pointer-events:none; }
.anti-etoile { color:var(--focus); }
.anti-fleche { color:var(--stage-ink); }
.anti-opts button { min-width:64px; min-height:56px; font-size:1.5rem; }

/* Lecture guidée : mots colorés en alternance */
/* Lecture guidée : listes de mots, de syllabes ou de pseudo-mots, bien espacées */
.txt-liste { max-width:40em; }
.txt-liste .w { display:inline-block; margin:0 .6em .25em 0; }
.txt-alt .w:nth-child(even) { color:#8fd0ff; }
.txt-alt .w.on { color:#12202b; }

/* Fond de la zone d’exercice (réglage « Fond de l’exercice »). Le rouge-vert garde un fond noir uni. */
.fond-ligne { flex-direction:column; align-items:stretch; gap:6px; margin:0; }
.fond-ligne select { font-weight:500; }
#stage[data-fond="grille"] {
  background-image:linear-gradient(rgba(169,194,183,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(169,194,183,.09) 1px,transparent 1px);
  background-size:36px 36px; background-position:center;
}
#stage[data-fond="motif"] {
  background-image:radial-gradient(rgba(169,194,183,.13) 1.6px,transparent 2px),radial-gradient(rgba(124,199,174,.08) 1.6px,transparent 2px);
  background-size:26px 26px; background-position:0 0,13px 13px;
}
#stage[data-fond="anime"] {
  background-image:repeating-linear-gradient(135deg,rgba(169,194,183,.07) 0 14px,transparent 14px 34px);
  background-size:96px 96px; animation:fond-defile 6s linear infinite;
}
@keyframes fond-defile { to { background-position:96px 0; } }
#stage.is-paused[data-fond="anime"] { animation-play-state:paused; }

/* ========== Thème sombre de l’interface (bouton de l’en-tête) ==========
   Écran seulement : le compte rendu imprimé reste en clair. */
@media screen {
  :root[data-theme="sombre"] {
    --bg:#0e1714; --surface:#15211d; --surface-2:#192824; --hover:#1f302b;
    --ink:#e4ede8; --ink-2:#c2d0c9; --mute:#8fa39a;
    --line:#24352f; --line-strong:#33483f;
    --accent:#5cb898; --accent-hover:#6fc7a7; --accent-ink:#06130f; --accent-soft:#183a30;
    --shadow-sm:0 1px 2px rgba(0,0,0,.3);
    --shadow-md:0 1px 2px rgba(0,0,0,.25),0 6px 20px rgba(0,0,0,.3);
    --shadow-lg:0 12px 40px rgba(0,0,0,.5);
    color-scheme:dark;
  }
  :root[data-theme="sombre"] .annonce { background:#e4ede8; color:#0e1714; }
  :root[data-theme="sombre"] .msg-erreur { color:#ffb3bf; }
}

/* ========== Contraste de la zone d’exercice (réglage « Contraste ») ==========
   Normal : bleu nuit et blanc cassé (≈ 16:1). Fort : noir et blanc pur (21:1), pour la basse vision.
   Doux : texte moins blanc sur un fond un peu moins sombre (≈ 11:1), pour la lecture prolongée ou l’éblouissement.
   Clair : fond crème et texte gris foncé (≈ 13:1). Les couleurs écrites dans les exercices passent par coul() (core.js). */
#stage[data-contraste="fort"] {
  --stage:#000; --stage-2:#141414; --stage-3:#262626; --stage-line:#6b6b6b;
  --stage-ink:#fff; --stage-mute:#e6e6e6; --stage-accent:#7ee8c4; --stage-select:#fff; --stage-select-ink:#000;
  border-color:#3a3a3a;
}
#stage[data-contraste="doux"] {
  --stage:#1e2b27; --stage-2:#26352f; --stage-3:#2e3f38; --stage-line:#3a4f46;
  --stage-ink:#d9e2dd; --stage-mute:#a7b8b0; --stage-accent:#8cc4b0; --stage-select:#cbd8d1; --stage-select-ink:#14211d;
  border-color:#2f413a;
}
#stage[data-contraste="doux"] .dot { filter:brightness(.88); }
#stage[data-contraste="clair"] {
  --stage:#f7f1e3; --stage-2:#ede4cf; --stage-3:#e2d7bd; --stage-line:#cdbf9f;
  --stage-ink:#262b29; --stage-mute:#5a5649; --stage-accent:#2f7a64; --stage-select:#2f4a40; --stage-select-ink:#fff;
  --accent-hover:#276a56; --accent-ink:#fff; --accent-soft:#dfe9dd; --focus:#f2c14e;
  --ok:#1d8150; --ko:#c62f3d;
  border-color:#e1d5b8; box-shadow:var(--shadow-sm);
}
#stage[data-contraste="clair"] .dot { color:#fff; }
#stage[data-contraste="clair"] .anti-etoile { color:#a87400; }
#stage[data-contraste="clair"] .txt-alt .w:nth-child(even) { color:#1f66b3; }
#stage[data-contraste="clair"] .txt-alt .w.on { color:#12202b; }
#stage[data-contraste="clair"] .fg-svg { filter:invert(1) hue-rotate(180deg); }
#stage[data-contraste="clair"] .bilan { background:rgba(247,241,227,.82); }
#stage[data-contraste="clair"] .bilan-carte { box-shadow:0 18px 50px rgba(60,48,20,.18); }
#stage[data-contraste="clair"][data-fond="grille"] {
  background-image:linear-gradient(rgba(90,80,55,.1) 1px,transparent 1px),linear-gradient(90deg,rgba(90,80,55,.1) 1px,transparent 1px);
}
#stage[data-contraste="clair"][data-fond="motif"] {
  background-image:radial-gradient(rgba(90,80,55,.16) 1.6px,transparent 2px),radial-gradient(rgba(47,122,100,.12) 1.6px,transparent 2px);
}
#stage[data-contraste="clair"][data-fond="anime"] {
  background-image:repeating-linear-gradient(135deg,rgba(90,80,55,.08) 0 14px,transparent 14px 34px);
}
/* Plein écran : l’entourage suit le contraste choisi */
#play.is-fs:has(#stage[data-contraste="fort"]), #play:fullscreen:has(#stage[data-contraste="fort"]) { background:#000; }
#play.is-fs:has(#stage[data-contraste="clair"]), #play:fullscreen:has(#stage[data-contraste="clair"]) {
  --ink:#262b29; --ink-2:#3d433f; --mute:#5a5649; --card:#ede4cf; --surface:#ede4cf; --hover:#e2d7bd;
  --line:#cdbf9f; --line-strong:#bfae89; --accent:#2f7a64; --accent-hover:#276a56; --accent-ink:#fff; --accent-soft:#dfe9dd;
  background:#efe7d4;
}
/* Rouge-vert : toujours sur fond noir, quel que soit le contraste choisi (les filtres des lunettes en dépendent) */
#stage[data-contraste]:has(.rv) { --stage-ink:#f3f8f5; --stage-mute:#a9c2b7; --stage-2:#111; --stage-3:#1c1c1c; --stage-line:#333; background-image:none; }

/* ========== Mode enfant (mode-enfant.js) ========== */
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.enfant-compteur { display:inline-flex; align-items:center; gap:6px; min-height:42px; margin-left:auto; padding:0 14px; border-radius:999px; background:#fff4d6; color:#7a5200; font-weight:750; font-size:1rem; }
.enfant-compteur svg { width:20px; height:20px; fill:#f2b01e; }
.enfant-compteur.gagne { animation:compteur-gagne .45s ease-out; }
@keyframes compteur-gagne { 40% { transform:scale(1.18); } }
:root[data-theme="sombre"] .enfant-compteur { background:#3a3016; color:#ffd77a; }
.etoile-pop { position:absolute; z-index:40; width:46px; height:46px; margin:-23px 0 0 -23px; pointer-events:none; animation:etoile-pop .9s ease-out forwards; }
.etoile-pop svg { width:100%; height:100%; fill:#ffd166; stroke:#b07d00; stroke-width:1; filter:drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
@keyframes etoile-pop { 0% { transform:scale(.2) rotate(-30deg); opacity:0; } 25% { transform:scale(1.15) rotate(8deg); opacity:1; } 100% { transform:translateY(-70px) scale(.7) rotate(20deg); opacity:0; } }
.bilan-carte { position:relative; overflow:hidden; }
.bilan-enfant { position:relative; display:flex; align-items:center; gap:14px; margin:12px 0 4px; }
.mascotte { flex:none; width:76px; height:66px; animation:mascotte .9s ease-in-out infinite alternate; }
@keyframes mascotte { to { transform:translateY(-4px) rotate(-3deg); } }
.bilan-etoiles { display:flex; gap:4px; }
.bilan-etoiles span { width:34px; height:34px; }
.bilan-etoiles svg { width:100%; height:100%; fill:var(--stage-3); stroke:var(--stage-line); stroke-width:1; }
.bilan-etoiles span.on { animation:etoile-bilan .5s cubic-bezier(.2,1.6,.4,1) both; }
.bilan-etoiles span.on svg { fill:#ffd166; stroke:#b07d00; }
@keyframes etoile-bilan { from { transform:scale(0) rotate(-40deg); } }
.bilan-bravo { margin-top:4px; color:var(--stage-ink); font-size:1.15rem; font-weight:750; }
.bilan-gagnees { color:var(--stage-mute); font-size:.84rem; }
.confettis { position:absolute; left:-24px; right:-24px; top:-30px; height:0; pointer-events:none; }
.confettis i { position:absolute; top:0; width:8px; height:12px; border-radius:2px; opacity:0; animation:confetti 1.6s ease-in forwards; }
@keyframes confetti { 0% { opacity:1; transform:translateY(0) rotate(0); } 100% { opacity:0; transform:translateY(230px) rotate(540deg); } }
@media (prefers-reduced-motion:reduce) { .mascotte, .confettis, .etoile-pop { animation:none; } .confettis { display:none; } }

/* ========== Programme à domicile (programme.js) ========== */
.qr-modes { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; margin:0 0 18px; }
.qr-mode { display:flex; justify-content:flex-start; align-items:flex-start; gap:10px; text-align:left; margin:0; padding:14px; border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); cursor:pointer; }
.qr-mode:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); }
.qr-mode input { margin-top:3px; accent-color:var(--accent); }
.qr-mode b { display:block; color:var(--ink); font-size:.92rem; }
.qr-mode small { display:block; color:var(--mute); font-size:.8rem; font-weight:500; }
.qr-enfant { margin:14px 0 0; }
.qr-prog-liste { margin:4px 0; padding-left:20px; font-size:.88rem; text-align:left; }
.badge-bilan { display:inline-block; padding:1px 8px; border-radius:999px; background:var(--accent); color:var(--accent-ink); font-size:.66rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; vertical-align:2px; }
#programme { display:grid; gap:18px; max-width:820px; }
.prog-tete { padding:clamp(20px,3vw,30px); border-radius:var(--r-xl); background:var(--stage); color:var(--stage-mute); }
.prog-tete h2 { margin:6px 0 8px; color:#fff; font-size:clamp(1.4rem,3vw,1.9rem); letter-spacing:-.03em; }
.prog-semaine { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; padding:16px 18px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); }
.prog-semaine b { display:block; color:var(--ink); }
.prog-bravo { color:var(--ok-strong); font-size:.86rem; font-weight:650; }
.prog-etoiles { display:inline-flex; align-items:center; gap:5px; margin-left:10px; color:#9a6a00; font-size:.86rem; font-weight:650; }
.prog-etoiles svg { width:16px; height:16px; fill:#f2b01e; }
.prog-jours { display:flex; gap:6px; }
.prog-jour { display:grid; justify-items:center; gap:3px; }
.prog-jour small { color:var(--mute); font-size:.72rem; font-weight:650; }
.prog-jour i { display:grid; place-items:center; width:30px; height:30px; border:2px solid var(--line-strong); border-radius:50%; }
.prog-jour.auj i { border-color:var(--accent); }
.prog-jour.fait i { border-color:var(--accent); background:var(--accent); color:var(--accent-ink); }
.prog-jour .ic { width:16px; height:16px; }
.prog-actions button { min-height:50px; padding:0 26px; font-size:1rem; }
.prog-liste { display:grid; gap:10px; margin:0; padding:0; list-style:none; }
.prog-ex { display:flex; align-items:center; gap:14px; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); }
.prog-ex.fait { background:var(--surface-2); }
.prog-ex-txt { flex:1; min-width:0; }
.prog-ex-txt b { display:block; color:var(--ink); font-size:.95rem; }
.prog-ex-txt small { display:block; margin-top:2px; color:var(--mute); font-size:.82rem; line-height:1.45; }
.prog-ex-txt .prog-dernier { color:var(--ink-2); font-weight:600; }
.prog-etat { display:inline-flex; align-items:center; gap:5px; color:var(--ok-strong); font-size:.8rem; font-weight:650; white-space:nowrap; }
.prog-etat .ic { width:16px; height:16px; }
.prog-pied { color:var(--mute); font-size:.84rem; }
.prog-bandeau { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.prog-bandeau span { color:var(--ink-2); font-weight:650; }
.prog-retour-ic { width:16px; height:16px; transform:rotate(180deg); }
@media (max-width:620px) {
  .prog-ex { flex-wrap:wrap; }
  .prog-ex-txt { flex-basis:calc(100% - 60px); }
  .prog-etat { order:3; }
  .prog-ex button { order:4; margin-left:auto; }
  .prog-jour i { width:26px; height:26px; }
}

/* ========== Retour des résultats du domicile (retour-domicile.js) ========== */
.retours-tete { margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
.seances-vide + .retours-tete, #report-session-list > .retours-tete:first-child { margin-top:0; padding-top:0; border-top:0; }
.msg-info { margin:0 0 12px; padding:12px 14px; border:1px solid color-mix(in srgb,var(--accent) 30%,var(--line)); border-radius:var(--r-md); background:var(--accent-soft); color:var(--ink); font-size:.9rem; font-weight:550; }
.suivi-domicile { background:var(--surface-2); border-color:var(--line-strong); }
/* Fenêtre de lecture du QR code (cabinet) et fenêtre « Mes résultats » (patient) */
.scan-voile { position:fixed; inset:0; z-index:400; display:grid; place-items:center; padding:16px; overflow:auto; background:rgba(8,16,13,.62); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
.scan-carte { width:min(100%,560px); padding:20px; border-radius:var(--r-xl); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-lg); }
.scan-tete { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.scan-tete h3 { font-size:1.1rem; }
.scan-video { position:relative; overflow:hidden; aspect-ratio:4/3; border-radius:var(--r-lg); background:#0b1512; }
.scan-video video { display:block; width:100%; height:100%; object-fit:cover; }
.scan-video video.miroir { transform:scaleX(-1); }
.scan-cadre { position:absolute; left:50%; top:50%; width:min(62%,300px); aspect-ratio:1; transform:translate(-50%,-50%); border:3px solid rgba(255,255,255,.85); border-radius:18px; box-shadow:0 0 0 999px rgba(0,0,0,.28); pointer-events:none; animation:scan-pulse 1.6s ease-in-out infinite; }
@keyframes scan-pulse { 50% { border-color:var(--stage-accent); } }
.scan-etat { margin-top:12px; color:var(--ink); font-weight:600; font-size:.92rem; }
.scan-aide { margin-top:6px; color:var(--mute); font-size:.84rem; }
.resultats-carte { width:min(100%,440px); text-align:center; }
.res-consigne { color:var(--ink-2); font-size:.9rem; text-align:left; }
.res-qr { width:min(100%,320px); margin:14px auto; padding:12px; border-radius:var(--r-lg); background:#fff; box-shadow:inset 0 0 0 1px var(--line); }
.res-qr svg { display:block; width:100%; height:auto; }
.res-resume { color:var(--ink-2); font-size:.92rem; }
.res-resume b { color:var(--ink); }
.res-liste { display:grid; gap:4px; margin:10px 0 0; padding:0; list-style:none; text-align:left; font-size:.86rem; }
.res-liste li { display:flex; justify-content:space-between; gap:12px; padding:6px 10px; border-radius:8px; background:var(--surface-2); }
.res-liste span { color:var(--ink-2); }
.res-actions { display:flex; justify-content:center; margin-top:16px; }
.res-note { margin-top:10px; color:var(--mute); font-size:.8rem; }
.prog-envoi { display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:16px; border:1px dashed color-mix(in srgb,var(--accent) 45%,var(--line)); border-radius:var(--r-lg); background:var(--accent-soft); }
.prog-envoi > div { flex:1 1 220px; min-width:0; }
.prog-envoi b { display:block; color:var(--ink); }
.prog-envoi small { display:block; margin-top:2px; color:var(--ink-2); font-size:.84rem; line-height:1.45; }
.prog-envoi .acc-ex-ic { background:var(--surface); }
@media (prefers-reduced-motion:reduce) { .scan-cadre { animation:none; } }

/* ========== Visite guidée (guide.js) ========== */
.acc-visite { margin-top:14px; min-height:36px; padding:0 14px; border-color:rgba(255,255,255,.28); background:rgba(255,255,255,.08); color:#e7f3ee; box-shadow:none; font-size:.84rem; }
.acc-visite:not(:disabled):hover { background:rgba(255,255,255,.16); border-color:rgba(255,255,255,.5); }
.acc-visite .ic { width:16px; height:16px; }
.guide-voile { position:fixed; inset:0; z-index:500; }
.guide-spot { position:fixed; z-index:501; border-radius:16px; box-shadow:0 0 0 4px rgba(124,199,174,.85),0 0 0 9999px rgba(8,16,13,.58); pointer-events:none; transition:left .25s,top .25s,width .25s,height .25s; }
.guide-carte { position:fixed; z-index:502; width:min(380px,calc(100vw - 24px)); padding:18px 18px 14px; border-radius:var(--r-lg); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-lg); }
.guide-carte.bas { left:12px !important; right:12px; bottom:12px; top:auto !important; width:auto; }
.guide-etapes { display:flex; gap:5px; margin-bottom:10px; }
.guide-etapes i { width:22px; height:4px; border-radius:2px; background:var(--line-strong); }
.guide-etapes i.vu { background:color-mix(in srgb,var(--accent) 45%,var(--line)); }
.guide-etapes i.on { background:var(--accent); }
.guide-num { color:var(--accent); font-size:.72rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.guide-carte h3 { margin-top:4px; font-size:1.12rem; }
.guide-texte { margin-top:6px; color:var(--ink-2); font-size:.9rem; line-height:1.5; }
.guide-actions { display:flex; align-items:center; gap:8px; margin-top:14px; }
.guide-actions .lien { margin-right:auto; font-size:.84rem; }
@media (prefers-reduced-motion:reduce) { .guide-spot { transition:none; } }
