/* ---------- Fractions ---------- */
.fraction-table {
  border-collapse: collapse;
  width: auto;
  display: inline-table;
  vertical-align: middle;
  margin: 0 2px;
  line-height: 1;
}

.fraction-table td {
  text-align: center;
  padding: 1px 6px;
  line-height: 1.05;
}

.fraction-table tr:nth-child(1) td {
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.fraction-table tr:nth-child(2) td {
  padding-top: 2px;
}

/* ---------- Inline math wrapper ---------- */
.math-expr {
  display: inline-flex;
  align-items: center;
  gap: 0;
  line-height: 1.25;
}

/* ---------- Subscripts ---------- */
:root {
  --script-size: 0.72em;
  --sub-shift: 0.22em;
}

.sub {
  display: inline-block;
  font-size: var(--script-size);
  line-height: 1;
  position: relative;
  margin-left: 1px;
  top: var(--sub-shift);
}

/* ---------- Step answer container ---------- */
.step-answer {
  padding: 20px 18px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Layout ---------- */
.step-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  white-space: normal;
  text-align: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.layout-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  white-space: normal;
  text-align: center;
  width: 100%;
}

.layout-line {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* ---------- Final answer ---------- */
.final-answer-box {
  font-weight: 700;
  margin-top: 12px;
  font-size: 1.1em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}