/*! web-calculator.ru © 2022-2026 — авторский код, копирование запрещено. src:matematicheskie-kalkulatori/umnozhenie-stolbikom.css */

.calculator {
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  max-width: 720px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid rgb(224, 224, 224);
  border-radius: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background-color: #fff;
}

.calc-params {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mode-hint {
  font-family: 'Unbounded', serif;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.62);
  margin: 8px 0 12px;
}

/* ==================== поля ====================
   Два числа и знак действия между ними.
   ⚠ min-width: 0 обязателен: без него поле упирается в min-content и
   пара полей на узком экране вылезает за контейнер. */
.cs-inputs {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}

.cs-inputs .form-group {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

/* ⚠ Знак действия центрируем по самому полю, а не по колонке.
   Подпись поля лежит внутри карточки, а у карточки снизу свой отступ 20px:
   выравнивание по нижнему краю ставит знак под поля, а не между ними. */
.cs-sign {
  flex: 0 0 auto;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  line-height: 24px;
  color: #000;
  margin-top: 20px;
}

/* ⚠ Числа вводим текстовым полем, а не type="number":
   в браузере с нерусской локалью «12,5» превращается в 125. */
.cs-inputs .calculator__input {
  width: 100%;
  text-align: center;
}

/* ==================== примеры ==================== */
.cs-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  margin: 14px 0 0;
}

.cs-presets__label {
  font-family: 'Unbounded', serif;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.62);
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.cs-preset,
.rz-chip {
  font-family: 'Unbounded', serif;
  font-size: 12px;
  color: #000;
  background: #fff;
  border: 1px solid #DDD;
  border-radius: 16px;
  /* 40px - нижняя граница удобной цели пальцем */
  min-height: 40px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.cs-preset:hover,
.rz-chip:hover {
  background: #f3f4f6;
  border-color: #c9c9c9;
}

.calc-error {
  display: none;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fdeced;
  color: #b3261e;
  font-size: 13px;
  line-height: 1.4;
}

/* ==================== ответ ==================== */
.cs-res-label {
  display: block;
  font-family: 'Unbounded', serif;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.cs-res-value {
  font-size: 26px;
  line-height: 1.25;
  color: #000;
  /* Числу перенос вредит - его держит неразрывный пробел внутри разрядов,
     а самой строке перенос разрешён, иначе длинный ответ уезжает за край. */
  overflow-wrap: anywhere;
}

.cs-line {
  font-family: 'Unbounded', serif;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.7);
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.cs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==================== ход решения ==================== */
#res-steps {
  font-family: 'Unbounded', serif;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.72);
}

.cs-h {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: #000;
  margin: 16px 0 6px;
}

/* ⚠ Общие стили карточки результата делают абзацы inline-block, и два
   пояснения подряд слипаются в одну строку без пробела между ними.
   Видно только рендером: в разметке это два отдельных <p>. */
#res-steps .cs-note,
#res-steps .cs-h,
#res-steps .cs-list {
  display: block;
}

.cs-note {
  margin: 0 0 8px;
}

.cs-list {
  margin: 0 0 10px;
  padding-left: 18px;
}

.cs-list li {
  margin: 2px 0;
}

/* ==================== сам столбик ====================
   Моноширинный шрифт и одна ширина у всех строк - иначе разряды разъезжаются.
   ⚠ Кегль внутри <pre> менять нельзя: серые переносы обязаны стоять ровно
   над своими разрядами, а другой размер шрифта сдвигает их на доли клетки. */
.rz-scroll {
  overflow-x: auto;
}

.cs-work {
  font-family: 'Courier New', monospace;
  font-size: 17px;
  line-height: 1.45;
  color: #000;
  white-space: pre;
  margin: 6px 0 10px;
}

.cs-work .cs-carry {
  color: rgba(0, 0, 0, 0.45);
}

.cs-work .cs-rule {
  color: rgba(0, 0, 0, 0.6);
}

.cs-work .cs-total {
  font-weight: 700;
}

/* ==================== таблица в тексте ====================
   ⚠ Без table-layout: fixed таблица не сжимается и утаскивает вбок всю
   страницу на 390px и уже. */
.cs-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}

.cs-table th,
.cs-table td {
  border: 1px solid #e3e3e3;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.cs-table th {
  background: #f7f8fa;
  font-weight: 600;
}

@media (max-width: 600px) {
  .calculator {
    padding: 14px;
    margin: 14px auto;
  }

  .cs-inputs {
    gap: 8px;
  }

  /* ⚠ На 320px при minmax(150px, …) примеры выстраиваются в одну колонку,
     шесть строк отодвигают кнопку расчёта за первый экран (876px против
     844px). Порог 120px возвращает две колонки. */
  .cs-presets {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .cs-sign {
    font-size: 18px;
  }

  .cs-work {
    font-size: 15px;
  }

  .cs-table {
    font-size: 12px;
  }

  /* ⚠ Кнопки на мобильном схлопываются в полоски: контейнер разворачивается
     в колонку, и flex: 1 1 0 начинает работать как высота. */
  .calculator__buttons-container {
    flex-direction: row;
    gap: 8px;
  }

  .calculator__buttons-container .button {
    height: 48px;
    flex: 1 1 0;
    min-width: 0;
  }
}
