/* ==========================================================================
   K-12 理科数学文档与二维公式无损渲染样式表 (math-doc-compiler.css v3.0.0)
   适用环境：Web (HTML / Vue / React)、Electron、微信小程序 (wxss)
   ========================================================================== */

.parsed-doc-body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #1e293b;
  line-height: 1.85;
  font-size: 15px;
  word-break: break-word;
}
.parsed-doc-body p {
  margin-bottom: 0.75rem;
}
.parsed-doc-body h1,
.parsed-doc-body h2,
.parsed-doc-body h3,
.parsed-doc-body h4 {
  font-weight: 700;
  color: #0f172a;
  margin-top: 1.25rem;
  margin-bottom: 0.6rem;
}
.parsed-doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85rem 0;
  font-size: 0.92rem;
}
.parsed-doc-body th,
.parsed-doc-body td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.parsed-doc-body th {
  background-color: #f1f5f9;
  font-weight: 700;
}
.doc-textbox-block {
  margin: 0.6rem 0;
  padding: 0.65rem 0.9rem;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 0.5rem;
}

/* 试卷内嵌数轴、几何图、函数图与 WMF 矢量图 */
.parsed-doc-body img.doc-content-img,
.parsed-doc-body img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  margin: 0.35rem 0.25rem;
  border-radius: 0.375rem;
  background-color: #ffffff;
  padding: 2px 4px;
}
.parsed-doc-body svg.doc-wmf-svg {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  height: auto;
  margin: 0.15rem 0.15rem;
}

/* 教师红字解析高亮与试卷填空下划线 */
.doc-red-emphasis {
  color: #dc2626 !important;
  font-weight: 700;
}
.doc-blank-underline {
  display: inline-block;
  border-bottom: 1.5px solid currentColor;
  min-width: 3.5em;
  padding: 0 0.25em;
  margin: 0 0.12em;
  line-height: 1.15;
  vertical-align: baseline;
  white-space: pre;
}

/* 行内与块级数学公式基础字体 */
.doc-math-inline {
  font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', 'Times New Roman', serif;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.08em;
  line-height: 1.25;
  font-size: 1.03em;
}
.doc-math-block {
  font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', 'Times New Roman', serif;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0.45rem 0;
  overflow-x: auto;
  line-height: 1.35;
}

/* 二维垂直分式 (分子在上、分数线居中、分母在下) */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.18em;
  line-height: 1.12;
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
}
.math-frac-num {
  display: block;
  padding: 0 0.24em 0.08em;
  border-bottom: 1.35px solid currentColor;
  text-align: center;
  width: 100%;
  font-size: 0.92em;
  line-height: 1.15;
  white-space: nowrap;
}
.math-frac-den {
  display: block;
  padding: 0.08em 0.24em 0;
  text-align: center;
  width: 100%;
  font-size: 0.92em;
  line-height: 1.15;
  white-space: nowrap;
}

/* 二维无缝矢量顶横线根式 (√‾‾‾：纯矢量几何折线钩顶与右侧被开方数上边框在 y=0..1.35px 严丝合缝零断层连接) */
.math-rad {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0 0.06em;
  font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', 'Times New Roman', serif;
  line-height: 1.15;
  position: relative;
}
.math-rad-deg {
  font-size: 0.65em;
  line-height: 1;
  margin-right: -0.2em;
  align-self: flex-start;
  margin-top: 0.02em;
  z-index: 1;
}
.math-rad-sym {
  position: relative;
  display: inline-block;
  width: 0.62em;
  min-width: 9.5px;
  align-self: stretch;
  flex-shrink: 0;
  margin: 0 -0.5px 0 0;
  padding: 0;
  font-size: inherit;
  line-height: 0;
  color: inherit;
  -webkit-text-fill-color: transparent;
  text-indent: -9999px;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  transform: none;
  box-sizing: border-box;
}
.math-rad-sym::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-clip-path: polygon(
    3% 55%,
    22% 42%,
    50% 79%,
    83% 0px,
    100% 0px,
    100% 1.35px,
    95% 1.35px,
    55% 96%,
    44% 96%,
    16% 51%,
    7% 59%
  );
  clip-path: polygon(
    3% 55%,
    22% 42%,
    50% 79%,
    83% 0px,
    100% 0px,
    100% 1.35px,
    95% 1.35px,
    55% 96%,
    44% 96%,
    16% 51%,
    7% 59%
  );
}
.math-rad-body {
  display: inline-flex;
  align-items: center;
  border-top: 1.35px solid currentColor;
  padding: 0.04em 0.08em 0.01em 0.05em;
  margin: 0;
  line-height: 1.12;
  box-sizing: border-box;
}
.math-rad-body > span[style*="background-color"] {
  padding: 0 1px !important;
  border-radius: 2px !important;
}

/* 方程组与自适应高度定界符 */
.math-delim-group {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.1em;
}
.math-delim-char {
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-weight: 400;
  line-height: 1;
  padding: 0 0.06em;
}
.math-delim-tall {
  font-size: 1.65em;
  line-height: 0.95;
}
.math-eqarr {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  vertical-align: middle;
  gap: 0.18em;
  padding: 0.05em 0.15em;
}
.math-eqrow {
  display: block;
  white-space: nowrap;
  line-height: 1.25;
}

/* 矩阵与行列式 */
.math-matrix {
  display: inline-table;
  vertical-align: middle;
  border-collapse: collapse;
  margin: 0 0.12em;
}
.math-matrix td {
  border: none !important;
  padding: 0.1em 0.35em !important;
  text-align: center !important;
}

/* 顶横线、底横线、向量箭头、大型求和积分上下限 */
.math-overbar {
  display: inline-block;
  border-top: 1.25px solid currentColor;
  padding-top: 0.03em;
  line-height: 1.1;
}
.math-underbar {
  display: inline-block;
  border-bottom: 1.25px solid currentColor;
  padding-bottom: 0.03em;
  line-height: 1.1;
}
.math-acc {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}
.math-acc-mark {
  font-size: 0.72em;
  line-height: 0.75;
  margin-bottom: -0.1em;
}
.math-nary {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.12em;
}
.math-nary-sym {
  font-size: 1.35em;
  line-height: 1;
  margin-right: 0.06em;
}
.math-nary-limits {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.72em;
  line-height: 1.05;
  margin-right: 0.12em;
}

/* 屏蔽公式内部继承或误加的文字下划线与空白填空下划线，消除上下标及分式旁的多余短横线（多余减号假象） */
.doc-math-inline *,
.doc-math-block *,
.math-frac *,
.math-rad *,
.parsed-doc-body sup,
.parsed-doc-body sub,
.parsed-doc-body sup *,
.parsed-doc-body sub * {
  text-decoration: none !important;
}
.doc-math-inline .doc-blank-underline,
.doc-math-block .doc-blank-underline,
.math-frac .doc-blank-underline,
.math-rad .doc-blank-underline {
  border-bottom: none !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}
