/* KaTeX styles for math rendering */
.katex {
    font: normal 1.21em KaTeX_Main, Times New Roman, serif;
    line-height: 1.2;
    text-indent: 0;
    text-rendering: auto;
}

.katex-display {
    display: block;
    margin: 1em 0;
    text-align: center;
}

.katex-inline {
    display: inline;
    margin: 0;
}

/* Ensure math elements are properly sized */
.katex .mfrac .frac-line {
    border-bottom-style: solid;
    border-bottom-width: 1px;
    display: inline-block;
    width: 100%;
}

.katex .mfrac .frac-line,
.katex .overline .overline-line,
.katex .underline .underline-line,
.katex .hline,
.katex .hdashline,
.katex .rule {
    min-height: 1px;
}

/* Ensure proper spacing for math elements */
.katex .mspace {
    display: inline-block;
}

.katex .mspace.negativethinspace {
    margin-left: -0.16667em;
}

.katex .mspace.thinspace {
    width: 0.16667em;
}

.katex .mspace.negativemediumspace {
    margin-left: -0.22222em;
}

.katex .mspace.mediumspace {
    width: 0.22222em;
}

.katex .mspace.thickspace {
    width: 0.27778em;
}

.katex .mspace.negativethickspace {
    margin-left: -0.27778em;
}

/* Ensure proper styling for math elements */
.katex .mord+.mop {
    margin-left: 0.16667em;
}

.katex .mord+.mbin {
    margin-left: 0.22222em;
}

.katex .mord+.mrel {
    margin-left: 0.27778em;
}

.katex .mop+.mord {
    margin-left: 0.16667em;
}

.katex .mop+.mop {
    margin-left: 0.16667em;
}

.katex .mop+.mrel {
    margin-left: 0.27778em;
}

.katex .mop+.minner {
    margin-left: 0.16667em;
}

.katex .mbin+.mord {
    margin-left: 0.22222em;
}

.katex .mbin+.mop {
    margin-left: 0.22222em;
}

.katex .mbin+.mopen {
    margin-left: 0.22222em;
}

.katex .mbin+.minner {
    margin-left: 0.22222em;
}

.katex .mrel+.mord {
    margin-left: 0.27778em;
}

.katex .mrel+.mop {
    margin-left: 0.27778em;
}

.katex .mrel+.mopen {
    margin-left: 0.27778em;
}

.katex .mrel+.minner {
    margin-left: 0.27778em;
}

.katex .mpunct+.mord {
    margin-left: 0.16667em;
}

.katex .mpunct+.mop {
    margin-left: 0.16667em;
}

.katex .mpunct+.mrel {
    margin-left: 0.16667em;
}

.katex .mpunct+.mopen {
    margin-left: 0.16667em;
}

.katex .mpunct+.mclose {
    margin-left: 0.16667em;
}

.katex .mpunct+.mpunct {
    margin-left: 0.16667em;
}

.katex .mpunct+.minner {
    margin-left: 0.16667em;
}

.katex .minner+.mord {
    margin-left: 0.16667em;
}

.katex .minner+.mop {
    margin-left: 0.16667em;
}

.katex .minner+.mbin {
    margin-left: 0.22222em;
}

.katex .minner+.mrel {
    margin-left: 0.27778em;
}

.katex .minner+.mopen {
    margin-left: 0.16667em;
}

.katex .minner+.mpunct {
    margin-left: 0.16667em;
}

.katex .minner+.minner {
    margin-left: 0.16667em;
}

/* Ensure proper styling for delimiters */
.katex .mord.delim-size1 {
    font-family: KaTeX_Size1;
}

.katex .mord.delim-size2 {
    font-family: KaTeX_Size2;
}

.katex .mord.delim-size3 {
    font-family: KaTeX_Size3;
}

.katex .mord.delim-size4 {
    font-family: KaTeX_Size4;
}

/* Ensure proper styling for operators */
.katex .mop.op-limits>.vlist-t {
    text-align: center;
}

.katex .mop.op-limits>.vlist-t>.vlist-r>.vlist {
    height: 0;
    position: relative;
}

.katex .mop.op-limits>.vlist-t>.vlist-r>.vlist>span {
    position: absolute;
}

.katex .mop.op-limits>.vlist-t>.vlist-r>.vlist>span:first-child {
    bottom: 100%;
}

.katex .mop.op-limits>.vlist-t>.vlist-r>.vlist>span:last-child {
    top: 100%;
}

/* Ensure proper styling for fractions */
.katex .mfrac>span {
    display: inline-block;
    text-align: center;
}

.katex .mfrac .frac-line {
    width: 100%;
}

.katex .mfrac .frac-line:after {
    border-bottom-style: solid;
    border-bottom-width: 1px;
    content: "";
    display: block;
}

.katex .mfrac .frac-line:before {
    border-bottom-style: solid;
    border-bottom-width: 1px;
    content: "";
    display: block;
}

/* Ensure proper styling for sqrt */
.katex .sqrt>.sqrt-sign {
    position: relative;
}

.katex .sqrt>.sqrt-line {
    width: 100%;
}

.katex .sqrt>.sqrt-line:before {
    border-bottom-style: solid;
    border-bottom-width: 1px;
    content: "";
    display: block;
}

.katex .sqrt>.sqrt-line:after {
    border-bottom-style: solid;
    border-bottom-width: 1px;
    content: "";
    display: block;
}