.matrix-scope,
.matrix-wrapper {
  --cell-size: 48px;
  --cell-gap: 6px;
}

.formula-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  text-align: left;
  margin: 18px 0 10px 0;
}

.matrices-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 0 8px;
  overflow-x: auto;
}

.matrix-block {
  text-align: center;
}

.matrix-title {
  margin-bottom: 10px;
  font-weight: 700;
}

.matrix-wrapper {
  display: inline-block;
  position: relative;
  padding: 6px;
  vertical-align: middle;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: var(--cell-gap);
}

.matrix-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid #999;
  box-sizing: border-box;
  padding: 0;
  vertical-align: middle;
}

.cell-input {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  text-align: center;
  font-size: 14px;
  background: transparent;
  outline: none;
  box-sizing: border-box;
}

.cell-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: 14px;
  white-space: nowrap;
  padding: 0;
}

.matrix-wrapper::before,
.matrix-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
}

.matrix-wrapper::before {
  left: 0;
  border-left: 2px solid #333;
  border-radius: 4px 0 0 4px;
}

.matrix-wrapper::after {
  right: 0;
  border-right: 2px solid #333;
  border-radius: 0 4px 4px 0;
}

.matrix-wrapper.expr-mode .matrix-cell {
  width: max-content;
  min-width: var(--cell-size);
  height: auto;
  padding: 6px 8px;
}

.matrix-wrapper.expr-mode .cell-text {
  height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.15;
  padding: 0;
}

.fraction-table {
  border-collapse: collapse;
  width: auto;
  display: inline-table;
  margin: 0;
}

.fraction-table td {
  text-align: center;
  padding: 1px 6px;
  border: none;
  white-space: nowrap;
}

.fraction-table tr:nth-child(1) td {
  border-bottom: 1px solid #333;
}

.matrix-inline-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.matrix-nowrap-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
}

.matrix-formula-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.step-formula .step-answer {
  text-align: center;
}

.step-formula .matrix-formula-column {
  align-items: center;
}

.step-formula .matrix-inline-row,
.step-formula .matrix-nowrap-row {
  justify-content: center;
}

.step-formula .matrix-wrapper {
  --cell-size: 48px;
}

.matrix-inline-label {
  font-weight: 700;
  white-space: nowrap;
}

.step-layout.matrix-scope {
  overflow-x: auto;
}

.final-answer-box {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.answer-label {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  line-height: 1;
}

.final-answer-box .matrix-scope {
  display: inline-flex;
  align-items: center;
}

.not-equal-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  margin: 0 3px;
  vertical-align: -2px;
}

.not-equal-svg {
  display: block;
  width: 16px;
  height: 14px;
}

.not-equal-svg line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}