.math-match {
  container-type: inline-size;
  margin: 1.05em 0;
  max-width: 100%;
}

.math-match-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-block: 1px solid var(--line, #687778);
  font: inherit;
  line-height: 1.45;
  color: inherit;
}

.math-match-label-column {
  width: 2.75em;
}

.math-match-table th {
  padding: .44em .5em;
  border-bottom: 1px solid var(--line, #687778);
  text-align: center;
  font-weight: 700;
}

.math-match-table td {
  padding: .35em .5em .35em .2em;
  text-align: start;
  vertical-align: top;
}

.math-match-table td.math-match-label {
  padding-inline-end: .4em;
  text-align: end;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.math-match-cell {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
}

.math-match-cell .question-figure {
  margin: .3em 0;
}

.math-match-cell > .katex-display {
  margin: .35em 0;
  text-align: left;
}

.math-match-stacked {
  display: none;
}

.math-match-group + .math-match-group {
  margin-top: .8em;
}

@media screen and (max-width: 46rem) {
  .math-match-wide { display: none; }
  .math-match-stacked { display: block; }
}

@container (max-width: 39rem) {
  @media screen {
    .math-match-wide { display: none; }
    .math-match-stacked { display: block; }
  }
}

@media print {
  .math-match {
    container-type: normal;
    break-inside: avoid;
  }
  .math-match-table th, .math-match-table td { padding-block: .25em; }
  .math-match-cell { overflow: visible; }
}
