/* 前台公式样式：仅匹配公式组件，不依赖客户正文模板的容器 class。 */
.ue-formula {
    display: inline-block;
    box-sizing: border-box;
    max-width: none;
    height: auto;
    max-height: none;
    padding: .25em .1em;
    margin: 0;
    border: 0;
    vertical-align: middle;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    /* 行内公式不建立滚动容器，避免字形边缘的亚像素溢出触发滚动条。 */
    overflow: visible;
    cursor: text;
    text-indent: 0;
    line-height: normal;
}

/* 提高公式规则优先级，覆盖正文 span 的 text-indent:inherit !important。
   仅隔离公式内部，不改变正文段落的首行缩进。 */
.ue-formula.ue-formula,
.ue-formula.ue-formula * {
    text-indent: 0 !important;
}

.ue-formula[data-display="block"] {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: .75em 0;
    text-align: center;
}

.ue-formula .katex-display {
    display: inline-block;
    min-width: 100%;
    margin: 0;
    vertical-align: middle;
}

/* MathML is retained in the saved article, but must not appear a second time. */
.ue-formula .katex-mathml {
    display: none !important;
}

.ue-formula:hover {
    outline: none;
    border: 0;
    background: transparent;
}
