/* Formula preview shown below LearnPress editors when a formula is present. */
.triplea-math-preview {
	box-sizing: border-box;
	margin: 10px 0 16px;
	padding: 12px 14px;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	background: #fff;
	color: #1d2327;
	line-height: 1.6;
}

.triplea-math-preview[hidden] {
	display: none !important;
}

.triplea-math-preview::before {
	display: block;
	margin-bottom: 6px;
	color: #50575e;
	font-size: 12px;
	font-weight: 600;
	content: 'ตัวอย่างการแสดงสูตร';
}

.triplea-math-preview .MathJax,
.triplea-math-preview mjx-container {
	max-width: 100%;
}

/* Live preview for TeX typed into a LearnPress answer option. */
.triplea-answer-math-preview {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	margin: 0 0 8px;
	padding: 7px 9px;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	background: #fff;
	color: #1d2327;
	font-size: 13px;
	line-height: 1.5;
	white-space: normal;
	overflow-x: auto;
}

.triplea-answer-math-preview[hidden] {
	display: none !important;
}

.triplea-answer-math-preview::before {
	display: block;
	margin-bottom: 4px;
	color: #50575e;
	font-size: 11px;
	font-weight: 600;
	content: 'ตัวอย่างการแสดงสูตร';
}

.triplea-answer-math-preview .MathJax,
.triplea-answer-math-preview mjx-container {
	max-width: 100%;
}

/*
 * Preserve the exact case entered by the author. Elementor/theme typography
 * can apply text-transform (often `capitalize`) to LearnPress content and to
 * MathJax's generated nodes. That changes both normal words and
 * case-sensitive formula variables such as r/R and d/D.
 */
body .question .question-title,
body .question .question-title *,
body .question .question-content,
body .question .question-content *,
body .question .question-hint-content,
body .question .question-hint-content *,
body .question .question-explanation-content,
body .question .question-explanation-content *,
body .question .question-answers,
body .question .question-answers *,
body .question .answer-options,
body .question .answer-options *,
body .lp-fib-content,
body .lp-fib-content *,
body .triplea-question-answer-title,
body .triplea-question-answer-title *,
body .triplea-math-preview,
body .triplea-math-preview *,
body .triplea-answer-math-preview,
body .triplea-answer-math-preview *,
body .triplea-manual-review-note__content,
body .triplea-manual-review-note__content *,
body .triplea-parent-guardian-feedback,
body .triplea-parent-guardian-feedback *,
body input.lp-question-answer-title-input,
body input.lp-question-fib-option-title-input,
body .lp-question-answer-item input[type='text'],
body .lp-list-options tr.answer-option .answer-text input[type='text'],
body textarea.lp-editor-tinymce,
body textarea.lp-meta-box__wp-editor__textarea,
body textarea.wp-editor-area,
body .course-content,
body .course-content *,
body .lesson-content,
body .lesson-content *,
body .quiz-content,
body .quiz-content *,
body .lp-course-content,
body .lp-course-content *,
body .lp-lesson-content,
body .lp-lesson-content *,
body .lp-quiz-content,
body .lp-quiz-content *,
body .lp-content-area .course-content,
body .lp-content-area .course-content *,
body .lp-content-area .lesson-content,
body .lp-content-area .lesson-content *,
body .lp-content-area .quiz-content,
body .lp-content-area .quiz-content *,
body .lp-content-area .lp-course-content,
body .lp-content-area .lp-course-content *,
body .lp-content-area .lp-lesson-content,
body .lp-content-area .lp-lesson-content *,
body .lp-content-area .lp-quiz-content,
body .lp-content-area .lp-quiz-content * {
	text-transform: none !important;
}

/* MathJax output is generated after the page loads, so reset its descendants
 * explicitly as well as the LearnPress containers above. */
body .MathJax,
body .MathJax *,
body mjx-container,
body mjx-container * {
	text-transform: none !important;
}

/*
 * These are the few layout properties that must win against theme/widget
 * rules. Keep the !important scope narrow: typography and spacing outside a
 * rendered formula should remain owned by the active theme.
 */
body .entry-content .MathJax,
body .entry-content mjx-container,
body .elementor-widget-text-editor .MathJax,
body .elementor-widget-text-editor mjx-container,
body .elementor-widget-html .MathJax,
body .elementor-widget-html mjx-container,
body .elementor-widget-shortcode .MathJax,
body .elementor-widget-shortcode mjx-container,
body .question .option-title .MathJax,
body .question .option-title mjx-container,
body .triplea-math-preview .MathJax,
body .triplea-math-preview mjx-container,
body .triplea-answer-math-preview .MathJax,
body .triplea-answer-math-preview mjx-container {
	max-width: 100% !important;
	box-sizing: border-box !important;
	text-transform: none !important;
}

body .question .option-title mjx-container:not([display='true']),
body .triplea-question-answer-title mjx-container:not([display='true']) {
	display: inline-block !important;
	vertical-align: middle !important;
}

body .question .option-title mjx-container[display='true'],
body .triplea-question-answer-title mjx-container[display='true'] {
	display: block !important;
	overflow-x: auto !important;
	overflow-y: hidden !important;
}

/*
 * Some older answer records contain paragraph/div wrappers from a rich-text
 * editor. An answer label is an inline flow, so those wrappers must not force
 * Thai text and its adjacent Inline Math onto separate rows.
 */
body .question .answer-options .answer-option .option-title p,
body .question .answer-options .answer-option .option-title div {
	display: inline;
	margin: 0;
	padding: 0;
}

body .question .answer-options .answer-option .option-title p + p::before,
body .question .answer-options .answer-option .option-title p + div::before,
body .question .answer-options .answer-option .option-title div + p::before,
body .question .answer-options .answer-option .option-title div + div::before {
	content: ' ';
}
