/* The paper grid remains in each page's existing styles. */
body.mm-math-background-on { isolation: isolate; }
/* Older cached animation bundles must not add a second layer of marks. */
body.mm-math-background-on .am-ambient { display: none; }
.mm-math-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.mm-math-expression {
  position: absolute;
  max-width: 90%;
  color: rgba(29, 43, 79, .12);
  font: 700 clamp(.9rem, 1.8vw, 1.35rem) var(--mono, monospace);
  white-space: nowrap;
  transform: rotate(var(--math-angle, 0deg));
  opacity: 0;
  animation: math-expression-life var(--math-duration, 18000ms) linear var(--math-delay, 0ms) both;
}
.mm-math-expression:nth-child(3n) { color: rgba(28, 135, 84, .14); }
.mm-math-expression:nth-child(4n) { color: rgba(162, 54, 39, .11); }
@media (max-width: 600px) {
  .mm-math-expression { font-size: .85rem; }
  .mm-math-expression:nth-child(3n) { visibility: hidden; }
}
@keyframes math-expression-life {
  0%, 100% { opacity: 0; }
  14%, 72% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mm-math-expression { animation: none; opacity: 1; }
}
