.math-article-explorer {
  --math-explorer-primary: #1453a5;
  --math-explorer-accent: #257b53;
  --math-explorer-foreground: #19382d;
  --math-explorer-background: #f3f7f5;
  --math-explorer-border: #80998e;
  --math-explorer-grid: #80998e55;
  margin: 2rem 0;
}

.math-article-explorer-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(13rem, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.math-article-explorer-board {
  width: 100%;
  min-width: 0;
  height: 360px;
  overflow: hidden;
  border: 1px solid var(--math-explorer-border);
  border-radius: 12px;
  background: var(--math-explorer-background);
  color: var(--math-explorer-foreground);
}

.math-article-explorer-board .JXGtext {
  color: var(--math-explorer-foreground) !important;
}

.math-article-explorer-controls {
  display: grid;
  gap: 1rem;
}

.math-article-explorer-control {
  display: grid;
  gap: .35rem;
  margin: 0;
  color: inherit;
}

.math-article-explorer-control-label {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  justify-content: space-between;
  line-height: 1.4;
}

.math-article-explorer-control-value {
  flex: none;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.math-article-explorer-control input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--math-explorer-accent);
  cursor: pointer;
}

.math-article-explorer-control input[type="range"]:focus-visible {
  outline: 3px solid var(--math-explorer-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.math-article-explorer-output {
  display: block;
  max-width: 100%;
  margin: 1rem 0 0;
  overflow-x: auto;
  color: inherit;
}

.math-article-explorer-output math {
  margin: .65rem auto;
  font-size: 1.12em;
}

.math-article-explorer-note {
  display: block;
  margin-top: .55rem;
  line-height: 1.55;
}

.math-article-explorer .article-matrix {
  border-collapse: separate;
  border-spacing: .4em .25em;
}

.math-article-explorer .article-matrix mtd {
  padding: .15em .3em;
  text-align: center;
  vertical-align: middle;
}

.article-equation .article-calculation {
  border-collapse: separate;
  border-spacing: .7em .55em;
}

.article-equation .article-calculation mtd {
  padding: .15em .3em;
  text-align: center;
  vertical-align: middle;
}

.article-inline-math {
  display: inline-block;
  margin: 0 .08em;
  vertical-align: -.12em;
  line-height: 1.25;
}

.article-inline-math mfrac {
  font-size: .95em;
}

body.dark-mode .math-article-explorer,
body.dark .math-article-explorer,
[data-theme="dark"] .math-article-explorer {
  --math-explorer-primary: #8fc5ff;
  --math-explorer-accent: #83ddb2;
  --math-explorer-foreground: #ecf5ef;
  --math-explorer-background: #19382d;
  --math-explorer-border: #9cb8aa;
  --math-explorer-grid: #d7ebe155;
}

@media (max-width: 600px) {
  .math-article-explorer-layout {
    grid-template-columns: 1fr;
  }

  .math-article-explorer-board {
    height: 290px;
  }

  .math-article-explorer-output math {
    font-size: 1em;
  }

  .article-equation .article-calculation {
    border-spacing: .35em .4em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .math-article-explorer *,
  .math-article-explorer *::before,
  .math-article-explorer *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
