/* Éditeur d'écriture commun (14/11/2026) — static/js/editeur.js. Couleurs du thème (public.css). */
.ed { --ed-ecart: #d48a00; --ed-inconnu: #d33a2c; --ed-registre: #2f74c0; --ed-accord: #8a4fc2;
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--pan); position: relative; }
[data-theme="dark"] .ed { --ed-ecart: #f1b84a; --ed-inconnu: #ff8a7a; --ed-registre: #7fb4ee; --ed-accord: #c49af0; }

/* barre d'outils : collée en haut de l'écran quand on descend dans un long texte */
.ed-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 8px; border-bottom: 1px solid var(--line);
  position: sticky; top: var(--ed-haut, 0px); z-index: 3; background: var(--pan); border-radius: 14px 14px 0 0; }
.ed-groupe { display: flex; align-items: center; gap: 2px; }
.ed-groupe + .ed-groupe { padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.ed-droite { margin-inline-start: auto; border-inline-start: 0 !important; gap: 6px; }
.ed-b { min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--fg);
  font: 600 calc(15px * var(--ech, 1)) / 1 var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ed-b:hover:not(:disabled) { background: var(--sun); }
.ed-b:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.ed-b:disabled { opacity: .35; cursor: default; }
.ed-l { font-family: 'Charis SIL', var(--font); font-size: calc(17px * var(--ech, 1)); }
.ed-inter { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: 500 calc(13.5px * var(--ech, 1)) / 1 var(--font); color: var(--mut); }
.ed-inter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ed-inter span[aria-hidden] { width: 32px; height: 18px; border-radius: 9px; background: var(--line); position: relative; transition: background .15s; }
.ed-inter span[aria-hidden]::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ed-inter input:checked + span { background: var(--acc); }
.ed-inter input:checked + span::after { transform: translateX(14px); }
[dir="rtl"] .ed-inter input:checked + span::after { transform: translateX(-14px); }
.ed-inter input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px; }

/* zone : le textarea au-dessus d'un calque qui souligne les mots */
.ed-zone { position: relative; }
.ed-fond { position: absolute; inset: 0 auto auto 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
  color: transparent; pointer-events: none; border-style: solid; border-color: transparent; box-sizing: border-box; margin: 0; }
.ed-fond mark { color: transparent; background: transparent; border-radius: 2px; text-decoration-line: underline; text-decoration-thickness: 2px;
  text-underline-offset: 3px; text-decoration-skip-ink: none; }
.ed-m-ecart { text-decoration-color: var(--ed-ecart); text-decoration-style: solid; background: color-mix(in srgb, var(--ed-ecart) 12%, transparent) !important; }
.ed-m-inconnu { text-decoration-color: var(--ed-inconnu); text-decoration-style: wavy; }
.ed-m-registre { text-decoration-color: var(--ed-registre); text-decoration-style: dotted; }
.ed-m-accord { text-decoration-color: var(--ed-accord); text-decoration-style: double; }
.ed .ed-texte { position: relative; z-index: 1; display: block; width: 100%; box-sizing: border-box; background: transparent !important;
  border: 0; border-radius: 0; resize: vertical; min-height: 320px; margin: 0; outline: none; }
.ed-zone:focus-within { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--acc) 55%, transparent); }

/* barre de suggestion — ordinateur : juste au-dessus du texte, sous les outils */
.ed-sugg { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); background: var(--sun);
  position: sticky; top: calc(var(--ed-haut, 0px) + 47px); z-index: 2; }
.ed-sugg-tete { display: flex; align-items: center; gap: 8px; font: 600 calc(13px * var(--ech, 1)) / 1.3 var(--font); }
.ed-sugg-mot { font-weight: 400; color: var(--mut); }
.ed-x { margin-inline-start: auto; border: 0; background: transparent; color: var(--mut); font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.ed-x:hover { background: var(--line); }
.ed-pastille { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ed-pastille.ed-m-ecart { background: var(--ed-ecart) !important; } .ed-pastille.ed-m-inconnu { background: var(--ed-inconnu); }
.ed-pastille.ed-m-registre { background: var(--ed-registre); } .ed-pastille.ed-m-accord { background: var(--ed-accord); }
.ed-sugg-choix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ed-choix { border: 1px solid var(--line); background: var(--pan); color: var(--fg); border-radius: 999px; padding: 6px 14px; min-height: 36px;
  font: 500 calc(15px * var(--ech, 1)) / 1 'Charis SIL', var(--font); cursor: pointer; }
.ed-choix.ed-premier { background: var(--acc); color: var(--onacc); border-color: var(--acc); }
.ed-choix:hover { filter: brightness(.96); }
.ed-lien { border: 0; background: transparent; color: var(--link); font: 500 calc(13.5px * var(--ech, 1)) / 1 var(--font); padding: 8px 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ed-sans { color: var(--mut); font-size: calc(13.5px * var(--ech, 1)); }
.ed-pourquoi { margin: 6px 0 0; color: var(--mut); font-size: calc(13px * var(--ech, 1)); line-height: 1.4; }

.ed-pied { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); color: var(--mut);
  font: 400 calc(12.5px * var(--ech, 1)) / 1.3 var(--font); }
.ed-etat:empty { display: none; }

/* téléphone : outils qui défilent sur une ligne, suggestion posée au-dessus du clavier, jamais sur le texte */
@media (max-width: 760px), (pointer: coarse) {
  .ed-barre { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .ed-barre::-webkit-scrollbar { display: none; }
  .ed-b { min-width: 40px; height: 40px; }
  .ed-inter-txt { display: none; }
  .ed-sugg { position: fixed; inset-inline: 0; bottom: 0; top: auto; z-index: 60; border: 0; border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .12); padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0;
    max-height: 40vh; overflow: auto; }
  .ed-pourquoi { display: none; }   /* court : le pourquoi reste sur ordinateur */
  .ed-avec-sugg .ed-pied { padding-bottom: 120px; }
}
@media print { .ed-barre, .ed-sugg, .ed-pied { display: none !important; } .ed { border: 0; } }

/* orientation du correcteur (15/11/2026) */
.ed-parler select { border: 1px solid var(--line); background: var(--pan); color: var(--fg); border-radius: 8px; padding: 5px 8px; font: 500 calc(13px * var(--ech, 1)) / 1.2 var(--font); max-width: 190px; }
@media (max-width: 760px), (pointer: coarse) { .ed-parler select { max-width: 130px; } }

/* ═══ Éditeur sur téléphone (15/11/2026) : outils essentiels, le reste sous « ⋮ » ; barre visible en écrivant ; texte avec marges ═══ */
.ed-plus { display: none; }
.ed-etat.ed-etat-err { color: var(--errfg); background: var(--errbg); padding: 4px 10px; border-radius: 8px; }
@media (max-width: 760px), (pointer: coarse) {
  .ed-barre { position: sticky; top: var(--h-entete, 64px); z-index: 20; background: var(--pan); }
  .ed-plus { display: inline-flex; font-size: 20px; line-height: 1; }
  /* réglages et formats moins courants : sur une deuxième ligne, à la demande */
  .ed:not(.ed-plus-ouvert) .ed-droite, .ed:not(.ed-plus-ouvert) .ed-b[data-f="titre"], .ed:not(.ed-plus-ouvert) .ed-b[data-f="pause"] { display: none; }
  .ed.ed-plus-ouvert .ed-barre { flex-wrap: wrap; }
  .ed.ed-plus-ouvert .ed-droite { margin-inline-start: 0; width: 100%; }
  .ed.ed-plus-ouvert .ed-inter-txt { display: inline; }
  .ed .ed-texte { padding: 16px 18px; }
}

/* lettres pular en tiroir (15/11/2026) : bouton « ɓ/abc » sur téléphone seulement */
.ed-lettres-bascule { display: none; font-size: 13px; padding-inline: 8px; white-space: nowrap; }
.ed-lettres-bascule[aria-expanded="true"] { background: var(--sun); }
@media (max-width: 760px), (pointer: coarse) {
  .ed-lettres-bascule { display: inline-flex; align-items: center; }
  .ed:not(.ed-lettres-ouvert) .ed-lettres { display: none; }
  .ed-barre .jw-oeil { margin-inline-start: auto; }
}
