/* Shared textbook-style math typography for student and teacher surfaces. */
.math-content {
  color: #172033;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0;
  line-height: 1.9;
  overflow-wrap: anywhere;
  text-rendering: optimizeLegibility;
  white-space: normal !important;
  word-break: normal;
}

.math-content .yano-math-line {
  display: block;
  min-height: 1.9em;
  white-space: pre-wrap;
}

.math-content .yano-math-line + .yano-math-line {
  margin-top: .08em;
}

.math-content .yano-math-spacer {
  display: block;
  height: .7em;
}

.math-content .yano-math-section-label,
.math-content .yano-math-step-label,
.math-content .yano-math-conclusion-label {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.math-content .yano-math-section-label,
.math-content .yano-math-step-label {
  margin-right: .45em;
  color: #1e3a5f;
}

.math-content .yano-math-heading {
  margin: .9em 0 .2em;
  color: #1e3a5f;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: .94em;
  font-weight: 700;
}

.math-content .yano-math-section-lead {
  margin-top: .35em;
}

.math-content .yano-math-step {
  padding-left: .2em;
}

.math-content .yano-math-conclusion {
  margin-top: .55em;
  padding: .42em .7em;
  border-left: 3px solid #2563eb;
  background: #f5f9ff;
  color: #172033;
}

.math-content .yano-math-conclusion-label {
  margin-right: .45em;
  color: #1d4ed8;
}

.math-content .katex {
  color: #111827;
  font-size: 1.08em;
  line-height: 1.2;
  text-rendering: optimizeLegibility;
}

.math-content .katex-display {
  margin: .9em 0;
  padding: .25em 0 .38em;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center !important;
  -webkit-overflow-scrolling: touch;
}

.math-content .katex-display > .katex {
  display: inline-block;
  min-width: max-content;
  text-align: initial;
}

.math-content.math-has-error {
  border-bottom-color: #f59e0b;
}

.textbook-answer.math-content {
  padding: 18px 20px 22px;
  border: 1px solid #d8e0e8;
  border-top: 3px solid #2563eb;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  color: #172033;
  font-size: 16px;
  line-height: 2;
}

.answer-box.math-content {
  padding: 13px 15px !important;
  border: 1px solid #d8e0e8 !important;
  border-left: 3px solid #2563eb !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #172033 !important;
  font-size: 14px;
  line-height: 1.9;
}

.question-preview.math-content,
.ab-q-text.math-content {
  color: #172033;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.9;
}

.question-preview.math-content {
  padding: 14px 16px;
  border-color: #d8e0e8;
  background: #fff;
}

.review-ocr-text.math-content {
  font-size: 14px;
  line-height: 1.85;
}

.math-snippet.math-content {
  display: -webkit-box;
  max-height: 3.6em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 520px) {
  .math-content {
    font-size: 14px;
    line-height: 1.85;
  }

  .textbook-answer.math-content {
    padding: 15px 14px 18px;
    font-size: 15px;
    line-height: 1.95;
  }

  .answer-box.math-content,
  .question-preview.math-content {
    padding: 12px 13px !important;
    font-size: 14px;
  }

  .math-content .katex {
    font-size: 1.05em;
  }
}

@media print {
  .math-content,
  .textbook-answer.math-content,
  .answer-box.math-content,
  .question-preview.math-content {
    color: #000 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .math-content .katex {
    color: #000;
  }
}
