/* Shared math-token colors (LC page, LCW, YouTube).
 * Digits/variables stay inherited ink. Only structure / relations / indices tint.
 * Slots (rotate among these three):
 *   structure — ( ) [ ]
 *   operator  — = ≠ + − (relations + binary ops) — blue, not brick/error-red
 *   exponent  — superscripts & subscripts
 */

:root {
  --am-math-structure: #1d4ed8;
  --am-math-operator: #3b82f6;
  --am-math-exponent: #0f7a55;
}

.am-math-chroma .katex .mopen,
.am-math-chroma .katex .mclose {
  color: var(--am-math-structure) !important;
}

.am-math-chroma .katex .mrel,
.am-math-chroma .katex .mbin {
  color: var(--am-math-operator) !important;
}

/* Indices live under .msupsub (KaTeX); leave the base letter alone.
 * Skip .phantom wrappers — but KaTeX nests a real .mord digit *inside*
 * .phantom, so a separate higher-specificity hide rule is required below. */
.am-math-chroma .katex .msupsub .mord:not(.phantom),
.am-math-chroma .katex .msupsub .mop:not(.phantom),
.am-math-chroma .katex .msupsub .mbin:not(.phantom),
.am-math-chroma .katex .msupsub .mrel:not(.phantom),
.am-math-chroma .katex .msupsub .mathnormal:not(.phantom),
.am-math-chroma .katex .msupsub .mathrm:not(.phantom),
.am-math-chroma .katex .msupsub .mtight:not(.phantom) {
  color: var(--am-math-exponent) !important;
}

/* Phantoms: KaTeX uses color:transparent; chroma !important was un-hiding
 * \phantom{0} inside exponent boxes (EXP/2). Must beat the .msupsub .mord rule. */
.am-math-chroma .katex .phantom,
.am-math-chroma .katex .phantom *,
.am-math-chroma .katex .msupsub .phantom,
.am-math-chroma .katex .msupsub .phantom .mord,
.am-math-chroma .katex .msupsub .phantom .mop,
.am-math-chroma .katex .msupsub .phantom .mathnormal,
.am-math-chroma .katex .msupsub .phantom .mathrm,
.am-math-chroma .katex .msupsub .phantom .mtight,
.am-math-chroma .katex .msupsub .phantom * {
  color: transparent !important;
  visibility: hidden !important;
}

/* Only the ≠ slot: hide KaTeX "=" and overlay a clear serif ≠ (rest of math unchanged). */
.am-neq {
  position: relative;
  display: inline-block;
  line-height: 1;
  vertical-align: baseline;
}

.am-neq > * {
  visibility: hidden;
}

.am-neq::before {
  content: "≠";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  font-family: "KaTeX_Main", "Times New Roman", Times, serif;
  font-style: normal;
  font-weight: 400;
  font-size: 1.05em;
  line-height: 1;
  color: inherit;
  pointer-events: none;
}

.am-neq::after {
  content: none !important;
  display: none !important;
}

.am-math-chroma .am-neq {
  color: var(--am-math-operator);
}

/* LCW / SW dark moment cards (Takeaway, Here's the trick!) — single light ink. */
.am-math-chroma .takeaway-panel .takeaway-box .t-body,
.am-math-chroma .takeaway-panel .takeaway-box .t-body .katex,
.am-math-chroma .takeaway-panel .takeaway-box .t-body .katex *,
.am-math-chroma .takeaway-panel .takeaway-box .t-body .am-neq {
  color: inherit !important;
}
