/* Shared by every page that renders math with KaTeX (chat.html, mistakes.html — 2026-10-17).
   The pages are dir="rtl"; KaTeX sets no direction of its own, so a formula inherited RTL
   and read backwards ("1− N.m 100 = k" for "k = 100 N.m⁻¹"). Math always reads left-to-right,
   isolated from the Arabic around it. Link it right after katex.min.css. */
.katex, .katex-display {
  direction: ltr;
  unicode-bidi: isolate;
}

/* A formula wider than its bubble (2026-11-05, a student's screenshot: «… = √(sin²x) = |s» cut off at the
   bubble's edge). Pages that fit formulas (chat.html: long «=» chains → one step per line, then a little
   smaller) leave only the rare very wide one — that one scrolls sideways inside the bubble instead of being
   cut; a thin bar shows there's more. The padding keeps tall parts (roots, fractions) from being clipped. */
.katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}
.katex-display.math-scroll {
  padding-bottom: 8px;
  scrollbar-width: thin;
}
