/**
 * Поля ввода и управляющие элементы формы.
 * Терминология подписей — по ТЗ 3.2.1: «Описание», а не «Промпт».
 */

.field {
  position: relative;
  margin-bottom: var(--s4);
}

.lab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tx2);
  margin-bottom: 7px;
}

.lab .req {
  color: var(--acc);
}

.inp {
  width: 100%;
  min-height: var(--h-inp);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  color: var(--tx);
}

.inp:focus {
  border-color: var(--acc);
  outline: none;
}

.inp[readonly] {
  color: var(--tx2);
  cursor: default;
}

textarea.inp {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.hint {
  font-size: 11.5px;
  color: var(--mut);
  margin-top: 5px;
  line-height: 1.5;
}

.select {
  height: var(--h-btn-sm);
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 0 32px 0 12px;
  color: var(--tx);
  min-width: 170px;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select:hover {
  border-color: var(--acc);
}

.select--auto {
  min-width: 0;
  width: auto;
}

.f2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}

@media (max-width: 560px) {
  .f2 {
    grid-template-columns: 1fr;
  }
}

/* --- Переключатель --- */
.sw {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 11px 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
}

.track {
  width: 36px;
  height: 21px;
  border-radius: var(--r-pill);
  background: var(--surface3);
  border: 1px solid var(--line2);
  position: relative;
  cursor: pointer;
  flex: none;
  padding: 0;
}

.track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--mut);
  transition: left var(--tr), background var(--tr);
}

.track[aria-checked="true"] {
  background: var(--acc-bg2);
  border-color: var(--acc);
}

.track[aria-checked="true"]::after {
  left: 17px;
  background: var(--acc);
}

/* --- Чекбокс --- */
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
  position: relative;
}

/* Два чекбокса подряд без отступа между собой слипались в одну
   полосу — например, «Запомнить способ» и согласие с офертой
   в окне пополнения. */
.check + .check {
  margin-top: var(--s2);
}

.check .box {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 2px solid var(--line2);
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check input:checked ~ .box {
  border-color: var(--acc);
  background: var(--acc);
}

.check input:checked ~ .box::after {
  content: "✓";
  color: var(--acc-ink);
  font-size: 10px;
  font-weight: 700;
}

.check input:focus-visible ~ .box {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* --- Радио-карточка --- */
.radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface2);
  cursor: pointer;
  position: relative;
}

.radio .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line2);
  flex: none;
  margin-top: 2px;
  position: relative;
}

.radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio input:checked ~ .dot {
  border-color: var(--acc);
}

.radio input:checked ~ .dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--acc);
}

.radio:has(input:checked) {
  border-color: var(--acc);
  background: var(--acc-bg);
}

.radio b {
  font-size: 13.5px;
  display: block;
  color: var(--tx);
}

/* Приглушается только пояснение под заголовком. Раньше правило
   било по всем вложенным span, включая обёртку с заголовком, —
   и оба варианта выглядели выключенными, хотя были доступны. */
.radio b + span {
  font-size: 11.5px;
  color: var(--mut);
}

.radio > span {
  color: var(--tx);
}

/* --- Числовой степпер: ползунок не используется (ТЗ 9.3) --- */
.stepper {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  width: max-content;
}

.stepper button {
  width: 38px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--tx2);
  cursor: pointer;
  font-size: 17px;
  display: grid;
  place-items: center;
}

.stepper button:hover {
  background: var(--surface3);
  color: var(--tx);
}

.stepper input {
  width: 56px;
  height: 40px;
  text-align: center;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--tx);
  font-family: var(--mono);
  font-size: 14px;
  appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.stepper .unit {
  padding: 0 12px;
  color: var(--mut);
  font-size: 12.5px;
  height: 40px;
  display: flex;
  align-items: center;
}

/* --- Плитка выбора: пресеты суммы, тип плательщика --- */
.pick {
  padding: 13px 8px;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: center;
  color: var(--tx2);
  font-size: 12.5px;
}

.pick[aria-pressed="true"] {
  border-color: var(--acc);
  background: var(--acc-bg);
  color: var(--tx);
}

.pick .a {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--tx);
  /* Сумма с пробелом-разделителем («10 000 ₽») не должна
     разрываться на две строки в узкой ячейке. */
  white-space: nowrap;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

@media (max-width: 560px) {
  .pick-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------------
   Палитра: список цветов, при необходимости с долей каждого.

   Цвет выбирается системным окном выбора цвета, рядом остаётся
   его код — попасть в нужный оттенок, набирая #C2D1E6 руками,
   невозможно, но вписать точное значение из фирменного стиля
   иногда нужно.
   --------------------------------------------------------------- */

.palette__row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.palette__row input[type="color"] {
  inline-size: 44px;
  block-size: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface2);
  cursor: pointer;
}

.palette__hex {
  inline-size: 110px;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.palette__share {
  inline-size: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.palette__drop {
  inline-size: 32px;
  block-size: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tx2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.palette__drop:hover {
  background: var(--surface2);
  color: var(--tx);
}

/* Единственный цвет убрать нельзя: пустая палитра не имеет смысла,
   и кнопка не должна обещать невозможное. */
.palette__row:only-child .palette__drop {
  visibility: hidden;
}

/* ---------------------------------------------------------------
   Области правки: рамки поверх исходной картинки.
   --------------------------------------------------------------- */

.regions__stage {
  position: relative;
  display: inline-block;
  max-inline-size: 100%;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}

.regions__stage img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

.regions__canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  /* Рисование не должно превращаться в прокрутку страницы
     на сенсорном экране. */
  touch-action: none;
}

.regions__box {
  position: absolute;
  border: 2px solid var(--acc);
  background: color-mix(in srgb, var(--acc) 18%, transparent);
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Разобранное описание: сцена, разложенная по частям.
   --------------------------------------------------------------- */

.structured__line {
  display: block;
  margin-bottom: var(--s3);
}

.structured__group {
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: var(--s3);
}

/* Холст модели — квадрат: она мыслит долями кадра от 0 до 1000,
   а не точками конкретной картинки. */
.structured__canvas {
  position: relative;
  aspect-ratio: 1 / 1;
  max-inline-size: 420px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  background: var(--surface2);
  cursor: crosshair;
  touch-action: none;
  margin-bottom: var(--s3);
}

.structured__box {
  position: absolute;
  border: 2px solid var(--acc);
  background: color-mix(in srgb, var(--acc) 15%, transparent);
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  pointer-events: none;
}

.structured__row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.structured__num {
  inline-size: 24px;
  text-align: center;
  color: var(--tx2);
  font-variant-numeric: tabular-nums;
}

.structured__row [data-row-type] {
  inline-size: 120px;
  flex: none;
}
