.tex-text { white-space: inherit; }
.tex-inline { display: inline; }
.tex-block { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: .18em .1em; }
.tex-block > .katex-display { display: block; width: max-content; min-width: 100%; margin: .65em 0; }
.tex-block:focus-visible { outline: 2px solid #8b51ae; outline-offset: 2px; }
.tex-error, .tex-code, .math-example-source { overflow-wrap: anywhere; font: .9em/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; }
.tex-error { color: #841735; background: #fff0f3; border-bottom: 1px dashed #b63f5d; padding: .1rem .25rem; border-radius: .24rem; white-space: pre-wrap; }
.tex-code { color: #4f2b66; background: #f4eaf9; border-radius: .27rem; padding: .1rem .25rem; white-space: pre-wrap; }
.tex-code-block { display: block; padding: .7rem; margin: .4rem 0; }
.math-editor { display: grid; gap: .55rem; width: 100%; min-width: 0; }
.math-editor [hidden], .math-editor[hidden] { display: none; }
.math-tools { width: 100%; min-width: 0; border: 1px solid #decbe9; border-radius: .66rem; background: #f9f4fb; padding: .58rem .73rem; }
.math-tools > summary { cursor: pointer; color: #542568; font-size: .94rem; font-weight: 720; }
.math-controls { display: grid; gap: .52rem; margin-top: .55rem; }
.math-controls .math-style { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; color: #542568; font-size: .9rem; font-weight: 670; }
.math-controls .math-style select { width: auto; min-height: 2.35rem; padding-inline: .58rem 1.5rem; border: 1px solid #dcc9e6; border-radius: .5rem; color: #3f2454; background-color: #fff; }
.math-shortcuts { display: flex; gap: .35rem; flex-wrap: wrap; }
.math-guide-link, .math-helptext { font-size: .9rem; color: #604173; }
.math-guide-link { width: fit-content; }
.math-preview-panel { border: 1px solid #d7c2e2; border-radius: .66rem; padding: .65rem .8rem; background: #faf6fc; min-width: 0; }
.math-preview-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem; color: #49265d; }
.math-preview-heading .math-tool:disabled { opacity: .6; cursor: default; }
.math-live-preview { min-height: 3.25rem; border: 1px solid #e6d7ee; border-radius: .53rem; padding: .66rem .78rem; margin-top: .45rem; background: white; color: #21152c; font-size: 1rem; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.math-live-preview .katex { font-size: 1.27em; }
.math-live-preview .tex-block > .katex-display { margin: .4em 0; }
.math-editor-status { margin-top: .35rem; color: #614571; font-size: .89rem; }
.math-editor-status:empty { display: none; }
.math-editor-status[data-error="true"] { color: #921a3a; }
.math-copy-source { margin-top: .4rem; min-width: 0; width: 100%; font: .9rem/1.35 ui-monospace, "Cascadia Code", Consolas, monospace; }
textarea[data-math-editor] { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.math-studio .math-example { min-width: 0; }
.math-example-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%,15rem),1fr)); }
.math-example-source, .math-example-formula { display: block; width: 100%; max-width: 100%; min-width: 0; }
.math-example-source { color: #543766; background: #faf1fc; padding: .5rem; border-radius: .42rem; white-space: pre-wrap; }
.math-example-formula { padding: .3rem 0; min-height: 3.75rem; }
