/* Math formulas stay left-to-right even inside RTL text */
.katex {
    direction: ltr;
    unicode-bidi: isolate;
    font-size: 1.1em;
}

.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: .25rem 0;
}

.math-preview .katex-display {
    margin: .5rem 0;
}

#mathEditorPanel math-field {
    display: block;
    width: 100%;
    min-height: 3rem;
    font-size: 1.5rem;
    direction: ltr;
    border-radius: .5rem;
    padding: .25rem .5rem;
}

/* Formula source fields: Latin digits/symbols stay Latin, direction follows the first strong character */
[data-math-input] {
    font-family: Consolas, 'Courier New', Tahoma, monospace !important;
    unicode-bidi: plaintext;
}
