/* Carnet : éditeur de formules (barre d'outils, aperçu) et rendu KaTeX. Utilise les variables de couleur de la page. */
.katex{font-size:1.08em}
.katex-display{position:relative;margin:.5em 0;overflow-x:auto;overflow-y:hidden;padding:2px 0}
.fx-err{color:var(--red);font-size:.9em}

.fx-barre{position:sticky;top:var(--fx-top,0px);z-index:4;background:var(--sheet);border:1px solid var(--line);border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:8px;box-shadow:0 6px 18px -14px rgba(26,11,92,.45)}
.fx-tete{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.fx-sep{flex:1 1 8px}
.fx-onglet{font:600 .85rem var(--f-body);background:none;border:1px solid var(--line);color:var(--muted);border-radius:999px;padding:4px 12px;cursor:pointer}
.fx-onglet[aria-pressed="true"]{background:var(--accent-soft);color:var(--accent);border-color:transparent}
.fx-pal{position:relative;display:flex;flex-wrap:wrap;gap:4px;max-height:132px;overflow-y:auto}
.fx-b{position:relative;min-width:40px;height:38px;padding:0 8px;border:1px solid var(--line);border-radius:8px;background:var(--paper);color:var(--ink);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font:600 .85rem var(--f-body)}
.fx-b .katex{font-size:.95em;pointer-events:none}
.fx-b:hover{border-color:var(--accent);background:var(--accent-soft)}
.fx-b.fx-prin{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);padding:0 12px}
.fx-b.fx-prin:hover{filter:brightness(1.08)}
.fx-aide{margin:0;font-size:.8rem;color:var(--muted);line-height:1.45}
.fx-aide code{font:500 .78rem var(--f-mono);background:var(--paper);border:1px solid var(--line);border-radius:4px;padding:0 4px;white-space:nowrap}
.fx-apercu{position:relative;margin-top:6px;padding:8px 12px;border:1px dashed var(--line);border-radius:8px;background:var(--paper);overflow-x:auto;line-height:1.6}
.fx-apercu .fx-label{display:block;font-size:.72rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:2px}
.choice + .fx-apercu{margin:0 0 4px 34px}
.fx-cote{display:grid;gap:12px;min-width:0}
.fx-cote textarea{min-height:300px;font-family:var(--f-mono);font-size:.88rem;font-variant-ligatures:none;font-feature-settings:"liga" 0,"calt" 0}
.fx-cote .fx-apercu{max-width:none}
@media (min-width:900px){.fx-cote{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}.fx-cote textarea{min-height:440px}.fx-cote .fx-apercu{margin-top:4px;max-height:440px;overflow:auto}}
@media (max-width:560px){.fx-barre{padding:8px;gap:6px;min-width:0;max-width:100%}.fx-tete,.fx-pal{min-width:0;max-width:100%;flex-wrap:nowrap;overflow-x:auto;max-height:none;scrollbar-width:thin;padding-bottom:2px}.fx-tete>*,.fx-pal>*{flex:none}.fx-sep{display:none}.fx-b{min-width:36px;height:36px}.fx-aide{display:none}}

/* Boutons « Formule », « Chimie », « LaTeX » */
.fx-b.fx-prin .katex{font-size:.85em}
.fx-b.fx-latex{font:600 .8rem var(--f-mono);color:var(--muted)}
.fx-aide kbd{font:500 .76rem var(--f-mono);background:var(--paper);border:1px solid var(--line);border-bottom-width:2px;border-radius:4px;padding:0 4px;white-space:nowrap}

/* Fenêtre de saisie sans code */
.fx-modal{position:fixed;inset:0;z-index:90;background:rgba(13,11,38,.45);display:flex;align-items:flex-start;justify-content:center;padding:8vh 16px 16px;overflow-y:auto}
.fx-modal[hidden]{display:none}
.fx-boite{width:min(640px,100%);background:var(--sheet);color:var(--ink);border:1px solid var(--line);border-radius:16px;padding:16px 18px;display:flex;flex-direction:column;gap:12px;box-shadow:0 24px 60px -20px rgba(13,11,38,.5)}
.fx-m-tete{display:flex;align-items:center;justify-content:space-between;gap:12px}
.fx-m-tete h2{margin:0;font:700 1.15rem var(--f-display)}
.fx-m-x{background:none;border:0;font-size:1.6rem;line-height:1;color:var(--muted);cursor:pointer;padding:2px 8px;border-radius:8px}
.fx-m-x:hover{background:var(--paper);color:var(--ink)}
.fx-m-champ{min-height:64px;display:flex;align-items:center}
.fx-m-champ math-field{width:100%;font-size:1.5rem;padding:10px 12px;border:1.5px solid var(--accent);border-radius:10px;background:var(--paper);color:var(--ink);--caret-color:var(--accent);--selection-background-color:var(--accent-soft);--contains-highlight-background-color:var(--accent-soft)}
.fx-m-champ math-field:focus-within{outline:2px solid var(--accent-soft);outline-offset:1px}
.fx-m-chimie{width:100%;font:500 1.15rem var(--f-mono);padding:10px 12px;border:1.5px solid var(--accent);border-radius:10px;background:var(--paper);color:var(--ink)}
.fx-m-chimie:focus{outline:2px solid var(--accent-soft);outline-offset:1px}
.fx-m-aides{display:flex;flex-wrap:wrap;gap:4px}
.fx-m-apercu{min-height:56px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--line);border-radius:10px;padding:6px 12px;overflow-x:auto;font-size:1.15rem}
.fx-m-apercu .katex-display{margin:0}
.fx-m-vide{color:var(--muted);font-size:.9rem}
.fx-m-note{margin:0;font-size:.82rem;color:var(--muted);line-height:1.5}
.fx-m-note code,.fx-m-note kbd{font:500 .78rem var(--f-mono);background:var(--paper);border:1px solid var(--line);border-radius:4px;padding:0 4px;white-space:nowrap}
.fx-m-code summary{font-size:.8rem;color:var(--muted);cursor:pointer}
.fx-m-code code{display:block;margin-top:6px;font:500 .8rem var(--f-mono);background:var(--paper);border:1px solid var(--line);border-radius:6px;padding:6px 8px;overflow-wrap:anywhere;min-height:1.6em}
.fx-boite .fx-m-centre{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;font-size:.9rem;font-weight:500;color:var(--ink);margin:0;cursor:pointer}
.fx-boite .fx-m-centre input{width:18px;height:18px;min-height:0;flex:none;padding:0;accent-color:var(--accent);margin:0}
.fx-m-actions{display:flex;gap:8px;flex-wrap:wrap}
.fx-m-ok,.fx-m-non{font:600 .95rem var(--f-body);border-radius:8px;padding:9px 16px;cursor:pointer;border:1px solid var(--line);background:var(--sheet);color:var(--ink)}
.fx-m-ok{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
html.fx-modal-ouvert{overflow:hidden}
@media (max-width:560px){.fx-m-note{font-size:.76rem}.fx-modal{padding:10px 10px 0}.fx-boite{padding:14px;border-radius:14px}.fx-m-champ math-field{font-size:1.3rem}.fx-m-actions>*{flex:1}}
.fx-aide code,.fx-m-note code,.fx-m-note kbd,.fx-aide kbd,.fx-m-chimie,.fx-m-code code{font-variant-ligatures:none;font-feature-settings:"liga" 0,"calt" 0}
