.matrix-scope,
.matrix-wrapper{
  --cell-size:46px;
}

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

/* layout */
.matrices-area{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:16px;
  flex-wrap:wrap;
  padding:0 8px;
}
.matrix-block{
  text-align:center;
  margin:0 10px;
}
.matrix-title{
  margin-bottom:8px;
  font-weight:600;
}

/* matrix styling (same system as your other calcs) */
.matrix-wrapper{
  display:inline-block;
  position:relative;
  padding:8px 10px;
  vertical-align:middle;
}

.matrix-wrapper table{
  border-collapse:separate;
  border-spacing:2px;
  table-layout:auto;
}

.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:6px 0 0 6px;
}

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

.matrix-wrapper.matrix-input .matrix-cell{
  width:var(--cell-size);
  min-width:var(--cell-size);
  height:34px;
  padding:4px 6px;
  border:1px solid #999;
  box-sizing:border-box;
  vertical-align:middle;
}

.matrix-wrapper.matrix-input .cell-input{
  width:100%;
  height:100%;
  border:none;
  padding:0;
  margin:0;
  text-align:center;
  font-size:0.95rem;
  background:transparent;
  outline:none;
  box-sizing:border-box;
  white-space:nowrap;
}

.matrix-wrapper.matrix-display .matrix-cell{
  min-width:var(--cell-size);
  height:34px;
  padding:6px 8px;
  border:1px solid #999;
  box-sizing:border-box;
  vertical-align:middle;
  width:auto;
  max-width:260px;
}

.matrix-wrapper.matrix-display .cell-display{
  width:100%;
  text-align:center;
  font-size:0.95rem;
  line-height:1.15;
  white-space:nowrap;
}

.matrix-wrapper.matrix-display .formula-text{
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
  font-size:0.82rem;
  line-height:1.15;
}

/* keep all grey step containers same height */
.step-answer{
  padding:20px 18px;
  min-height:90px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow-x:auto;
  width:100%;
  box-sizing:border-box;
}

/* answer box */
.answer-box{
  margin-bottom:16px;
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:bold;
}
.answer-box strong{
  font-weight:700;
}

/* solve hover */
.solve-button:hover{
  background-color:#2980b9;
}
