/* Шахта — мини-апп ручного прогрева.
   Чёрный фон, сгруппированные карточки, системный синий акцент — как в
   нативных списках iOS. Цвет несёт только статус: зелёный жив, красный бан,
   оранжевый — аккаунт в работе. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Скрытое остаётся скрытым: у листов и стадий свой display, который иначе
   перебивает атрибут hidden. */
[hidden] { display: none !important; }

:root {
  --bg:         #000000;
  --card:       #1C1C1E;
  --card-2:     #2C2C2E;
  --sep:        rgba(255, 255, 255, .09);

  --text:       #FFFFFF;
  --text-2:     #8E8E93;
  --text-3:     #636366;

  --blue:       #0A84FF;
  --green:      #30D158;
  --red:        #FF453A;
  --orange:     #FF9F0A;

  --r:    12px;
  --r-sm: 8px;

  --ease: cubic-bezier(.25, .1, .25, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; background: var(--bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, textarea, select {
  font: inherit; color: inherit;
  background: none; border: none; outline: none;
}
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
b, strong, .num { font-variant-numeric: tabular-nums; }

.ic {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.ic.big { width: 32px; height: 32px; stroke-width: 2; }
.ic.sm  { width: 16px; height: 16px; }

/* ─────────── Шапка ─────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 6px;
}
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--blue);
  transition: opacity .15s var(--ease);
}
.icon-btn:active { opacity: .5; }
.icon-btn.is-busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────── Вкладки ─────────── */

.tabs {
  position: relative;
  display: flex; gap: 24px;
  padding: 0 16px;
  border-bottom: .5px solid var(--sep);
}
.tab {
  padding: 8px 0 12px;
  font-size: 16px; font-weight: 500;
  color: var(--text-2);
  transition: color .2s var(--ease);
}
.tab.is-active { color: var(--text); font-weight: 600; }
.tab-underline {
  position: absolute; bottom: -.5px; left: 0;
  height: 2.5px; border-radius: 2px;
  background: var(--blue);
  transition: transform .3s var(--ease), width .3s var(--ease);
}

.progress { height: 2px; background: transparent; }
.progress-fill {
  display: block; height: 100%; width: 0;
  background: var(--blue);
  transition: width .3s var(--ease);
}

/* Полоска состояния: видно, что идёт проверка, а не «просто висит» */
.status-bar {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  background: var(--card);
  font-size: 14px; color: var(--text-2);
  animation: statusIn .2s var(--ease);
}
@keyframes statusIn { from { opacity: 0; transform: translateY(-4px); } }

.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid var(--card-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ─────────── Экраны ─────────── */

.screens {
  position: absolute; inset: 0;
  top: calc(var(--safe-top) + 100px);
  overflow: hidden;
  transition: top .2s var(--ease);
}
/* Полоса состояния занимает место в потоке — экраны уезжают вниз ровно на неё */
body.has-status .screens { top: calc(var(--safe-top) + 140px); }
.screen {
  position: absolute; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(var(--safe-bottom) + 24px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s var(--ease), visibility .2s;
}
.screen.is-active { opacity: 1; visibility: visible; }

/* ─────────── Выбор аккаунта ─────────── */

.account-picker {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 14px 15px;
  background: var(--card);
  border-radius: var(--r);
  text-align: left;
  transition: opacity .15s var(--ease);
}
.account-picker:active { opacity: .7; }
.picker-name { font-weight: 600; letter-spacing: -.01em; }
.picker-user { color: var(--text-2); }
.account-picker .chev {
  margin-left: auto; color: var(--text-2);
  transition: transform .25s var(--ease);
}
.account-picker.is-open .chev { transform: rotate(180deg); }

/* ─────────── Аватарка аккаунта ─────────── */

.avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card-2);
}
.avatar.sm { width: 28px; height: 28px; }

/* Заглушка до первой проверки: буква на своём для аккаунта тоне.
   Тона приглушённые — карточка не должна кричать цветом. */
.avatar-stub {
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600; color: #fff;
  letter-spacing: -.01em;
}
.avatar-stub.sm { font-size: 12px; }
.avatar-stub.tone-0 { background: linear-gradient(140deg, #4A5A78, #35435C); }
.avatar-stub.tone-1 { background: linear-gradient(140deg, #6A5378, #4B3A57); }
.avatar-stub.tone-2 { background: linear-gradient(140deg, #3F6A5E, #2C4C44); }
.avatar-stub.tone-3 { background: linear-gradient(140deg, #7A5A46, #5A4133); }
.avatar-stub.tone-4 { background: linear-gradient(140deg, #4C6480, #364A5E); }
.avatar-stub.tone-5 { background: linear-gradient(140deg, #6E4C55, #4E353D); }

/* ─────────── Плашка статуса ─────────── */

.pill {
  display: inline-flex; align-items: center;
  height: 17px; padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  flex: none;
}
.pill.alive { background: rgba(48, 209, 88, .16);  color: var(--green); }
.pill.dead  { background: rgba(255, 69, 58, .16);  color: var(--red); }
.pill.spam  { background: rgba(255, 159, 10, .16); color: var(--orange); }
.pill.idle  { background: var(--card-2);           color: var(--text-2); }
.pill.busy  { background: rgba(10, 132, 255, .16); color: var(--blue); }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-3); flex: none;
}
.dot.alive, .dot.live { background: var(--green); }
.dot.dead { background: var(--red); }
.dot.live { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .5); }
  55%      { box-shadow: 0 0 0 6px rgba(48, 209, 88, 0); }
}

.dropdown {
  margin-top: 6px;
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  animation: dropIn .2s var(--ease);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } }
.dropdown-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 15px;
  text-align: left;
}
.dropdown-item + .dropdown-item { box-shadow: inset 0 .5px 0 var(--sep); }
.dropdown-item:active { background: var(--card-2); }
.dropdown-item .muted { color: var(--text-2); }
.dropdown-item .check { margin-left: auto; color: var(--blue); }
.dropdown-item.action .ic { color: var(--blue); }

/* Сводка по аккаунту — одна строка вместо блока плиток */
.summary {
  padding: 10px 4px 0;
  font-size: 14px; color: var(--text-2);
}
.summary b { color: var(--text); font-weight: 600; }

/* ─────────── Сгруппированные списки ─────────── */

.list {
  display: flex; flex-direction: column;
  margin-top: 10px;
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
}
.list:empty { display: none; }
.list.scroll { overflow-y: auto; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  transition: background .12s var(--ease);
}
.row + .row { box-shadow: inset 0 .5px 0 var(--sep); }
.row:active { background: var(--card-2); }
/* Строка канала нажимается только когда база собрана — иначе открывать нечего */
.row.is-tappable { cursor: pointer; }

.row-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.row-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub {
  display: block;
  color: var(--text-2); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub.dim { color: var(--text-3); }
.row-meta {
  display: block;
  font-size: 13px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-meta b { color: var(--text); font-weight: 600; }
/* Метрика читается как фраза: «2 диалога, 1 ответ». Числа выделены весом,
   подписи приглушены — двоеточия и колонки тут только мешали. */
.mi { display: inline-block; margin-right: 14px; color: var(--text-3); }
.mi:last-child { margin-right: 0; }
.mi b { color: var(--text-2); font-weight: 600; }

.row-side {
  display: flex; align-items: center; gap: 8px;
  flex: none; color: var(--text-3);
}
.row-time { font-size: 13px; color: var(--text-2); }
.row-side .chev { width: 16px; height: 16px; }

/* Проверить один аккаунт, не гоняя всю пачку. Кнопка в строке, а не в меню:
   после бана или переезда прокси проверяют обычно один конкретный номер. */
/* Чем занят аккаунт: свободен, в рассылке, собирает базу. Иконкой, а не
   словом — в строке и так три плашки, ещё одна подпись её перегрузит. */
.work {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  color: var(--text-3);
}
.work.on { color: var(--blue); }
.work .ic { width: 17px; height: 17px; }
.work.on .ic { animation: pulseFade 1.6s ease-in-out infinite; }
@keyframes pulseFade {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}

.row-check {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-3);
}
.row-check:active { color: var(--blue); }
.row-check .ic { width: 17px; height: 17px; }
.row-check.is-busy .ic { animation: spin 1s linear infinite; }
.row.is-connecting .row-meta { color: var(--blue); }


.badge {
  min-width: 21px; height: 21px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 600;
}

.tag { font-size: 13px; font-weight: 500; }
.tag.dead { color: var(--red); }
.tag.spam { color: var(--orange); }

.row-add { color: var(--text-2); }
.row-add .ic { color: var(--blue); }
.row-add span { font-size: 17px; }


.section-title.first { padding-top: 16px; }
.section-title {
  padding: 20px 6px 2px;
  font-size: 15px; font-weight: 600; color: var(--text-2);
}

/* Действие в строке — текстом, чтобы не гадать по значку */
.row-action {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--blue);
  font-size: 14px; font-weight: 550;
  flex: none;
}
.row-action:active { opacity: .6; }
.row-action[disabled] { color: var(--text-3); }

.empty, .hint {
  text-align: center; color: var(--text-2);
  padding: 44px 24px; font-size: 15px;
}
.empty p { margin-bottom: 16px; }

.btn-ghost {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--blue);
  font-size: 15px; font-weight: 500;
}
.btn-ghost:active { opacity: .6; }

.btn-primary {
  width: 100%;
  padding: 15px;
  border-radius: var(--r);
  background: var(--blue);
  color: #fff;
  font-size: 17px; font-weight: 600;
  transition: opacity .15s var(--ease), transform .1s var(--ease);
}
.btn-primary:active { transform: scale(.99); opacity: .85; }
.btn-primary:disabled { opacity: .32; }

/* ─────────── Ход поиска каналов ─────────── */

.scan {
  margin-top: 10px; padding: 12px 14px;
  background: var(--card);
  border-radius: var(--r);
  animation: statusIn .2s var(--ease);
}
.scan-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.scan-text { font-size: 14px; color: var(--text-2); }
.scan-stop {
  color: var(--red); font-size: 14px; font-weight: 550;
  padding: 2px 4px; flex: none;
}
.scan-stop:active { opacity: .5; }
.scan-bar {
  height: 3px; border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}
.scan-fill {
  display: block; height: 100%; width: 30%;
  border-radius: 3px;
  background: var(--blue);
  transition: width .3s var(--ease);
}
/* Пока общего числа чатов не знаем, полоса бежит сама — она про «идёт», а не «сколько» */
.scan-fill.indeterminate {
  width: 35%;
  animation: runline 1.3s var(--ease) infinite;
}
@keyframes runline {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* Ход сбора прямо в строке канала */
.row-progress {
  margin-top: 7px;
  height: 3px; border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}
.row-progress span {
  display: block; height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width .3s var(--ease);
}

/* ─────────── Модальные окна ─────────── */

.modal {
  position: fixed; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .55);
  z-index: 80;
  animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: 100%; max-width: 480px;
  padding: 22px 18px calc(var(--safe-bottom) + 18px);
  background: var(--card);
  border-radius: 20px 20px 0 0;
  animation: sheetUp .26s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } }
.modal-card h3 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.modal-sub { margin-top: 6px; color: var(--text-2); font-size: 14px; }

.slider-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 0 6px;
}
.slider-value {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.slider-max { color: var(--text-3); font-size: 14px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; margin: 8px 0 4px;
  border-radius: 4px;
  /* Пройденная часть синяя, остаток серый. Ширину заливки задаёт --fill,
     которую обновляет JS: у ползунка нет своего стиля для этой половины. */
  background: linear-gradient(var(--blue), var(--blue)) left/var(--fill, 100%) 100% no-repeat,
              var(--card-2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: #fff;
}

.modal-input {
  width: 100%; margin-top: 16px; padding: 14px 16px;
  background: var(--card-2);
  border-radius: var(--r);
  font-size: 16px;
}
/* Ожидание ответа: видно, что процесс идёт, и его можно бросить */
.wait {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 22px 0 6px;
  text-align: center;
}
.spinner.lg { width: 26px; height: 26px; border-width: 2.5px; }
.modal-sub.answer { white-space: pre-wrap; margin-top: 10px; }
.modal-card h3.ok  { color: var(--green); }
.modal-card h3.bad { color: var(--red); }

.modal-hint { margin: 18px 0 -4px; color: var(--text-3); font-size: 13px; }
/* Список каналов в модалке скроллится: их бывают десятки */
.list.pick { max-height: 34vh; overflow-y: auto; background: var(--card-2); }
.list.pick .row-title { font-size: 15px; }
.list.pick .row { padding: 11px 14px; }

.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn-primary { flex: 1; }
.btn-flat {
  flex: 1; padding: 15px;
  border-radius: var(--r);
  background: var(--card-2);
  color: var(--text);
  font-size: 17px; font-weight: 550;
}
.btn-flat:active { opacity: .6; }

/* ─────────── Полноэкранные листы ─────────── */

.sheet {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  z-index: 40;
  animation: sheetIn .28s var(--ease);
}
.sheet.closing { animation: sheetOut .22s var(--ease) forwards; }
@keyframes sheetIn  { from { opacity: 0; transform: translateX(26px); } }
@keyframes sheetOut { to   { opacity: 0; transform: translateX(26px); } }

.sheet-head {
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-top) + 10px) 12px 10px;
  border-bottom: .5px solid var(--sep);
}
.sheet-head .icon-btn { color: var(--blue); }
.sheet-title { min-width: 0; }
.sheet-action {
  margin-left: auto; flex: none;
  padding: 6px 10px;
  color: var(--blue); font-size: 14px; font-weight: 500;
}
.sheet-action:active { opacity: .5; }
.sheet-title strong {
  display: block; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-title span { font-size: 13px; color: var(--text-2); }
.sheet .list { margin: 12px; }

/* ─────────── Профиль аккаунта ─────────── */

.card-body { padding: 18px 12px calc(var(--safe-bottom) + 24px); overflow-y: auto; }

/* Шапка как в профиле Telegram: крупный аватар, имя, номер под ним */
.profile-head {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 16px;
}
.profile-head .avatar { width: 88px; height: 88px; }
.profile-head .avatar-stub { font-size: 34px; }
.profile-title { text-align: center; }
.profile-title strong {
  display: block; font-size: 21px; font-weight: 700; letter-spacing: -.02em;
}
.profile-title span { color: var(--text-2); font-size: 15px; }

.facts {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; margin-bottom: 4px;
}

/* Поля правки — сгруппированы, как настройки в iOS */
.fields {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: 8px;
}
.field {
  width: 100%; padding: 14px 15px;
  font-size: 17px;
  background: transparent;
}
.field + .field { box-shadow: inset 0 .5px 0 var(--sep); }
.field::placeholder { color: var(--text-3); }
.field-note { padding: 8px 6px 18px; color: var(--text-3); font-size: 13px; }

.row-add.danger { color: var(--red); }
.row-add.danger .ic { color: var(--red); }

.btn-danger {
  flex: 1; padding: 15px;
  border-radius: var(--r);
  background: var(--red); color: #fff;
  font-size: 17px; font-weight: 600;
}
.btn-danger:active { opacity: .8; }

/* ─────────── Переписка ─────────── */

.thread {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 12px 8px;
  display: flex; flex-direction: column; gap: 5px;
}
.day {
  align-self: center; margin: 12px 0 6px;
  font-size: 12px; color: var(--text-3);
}
.bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 16px; line-height: 1.35;
  word-wrap: break-word;
  animation: bubbleIn .22s var(--ease);
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.bubble.them {
  align-self: flex-start;
  background: var(--card);
  border-bottom-left-radius: 6px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--blue);
  border-bottom-right-radius: 6px;
}
.bubble .kind { opacity: .75; font-style: italic; }

/* Предпросмотр ссылки: полоска слева и три строки текста — так его рисует и
   сам Telegram, только без картинки. */
.preview {
  display: block;
  margin-top: 6px; padding-left: 9px;
  border-left: 2px solid currentColor;
  font-size: 14px; line-height: 1.35;
}
.preview b { display: block; font-weight: 600; }
.preview-title { display: block; opacity: .95; }
.preview-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: .7;
}
.no-preview { display: block; margin-top: 5px; font-size: 12px; opacity: .5; }
.bubble time {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  margin-top: 2px; font-size: 11px; opacity: .6;
}
.bubble.them time { justify-content: flex-start; }
/* Галочки: одна — ушло, две — собеседник прочитал */
.tick { width: 15px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 12px calc(var(--safe-bottom) + 10px);
  border-top: .5px solid var(--sep);
}
.composer textarea {
  flex: 1; max-height: 120px;
  padding: 10px 15px;
  background: var(--card);
  border-radius: 20px;
  resize: none;
}
.send {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue); color: #fff;
  transition: transform .12s var(--ease), opacity .15s var(--ease);
}
.send:disabled { background: var(--card-2); color: var(--text-3); }
.send:not(:disabled):active { transform: scale(.9); }

/* ─────────── Первое сообщение ─────────── */

.start-body { padding: 16px 14px calc(var(--safe-bottom) + 18px); }
.start-note { color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
.start-note b { color: var(--text); font-weight: 600; }
.field-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-3); font-size: 13px;
}
.paste-link {
  color: var(--blue); font-size: 15px; font-weight: 500;
  padding: 4px 2px;
}
.paste-link:active { opacity: .5; }

#startInput {
  width: 100%;
  padding: 14px;
  background: var(--card);
  border-radius: var(--r);
  resize: none;
  margin-bottom: 16px;
}

/* ─────────── Авторизация ─────────── */

.auth-stage {
  flex: 1;
  padding: 56px 22px calc(var(--safe-bottom) + 22px);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  animation: stageIn .32s var(--ease);
}
@keyframes stageIn { from { opacity: 0; transform: translateY(12px); } }
.auth-stage h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { color: var(--text-2); font-size: 15px; margin: 8px 0 26px; max-width: 32ch; }
.auth-sub b { color: var(--text); font-weight: 600; }

.auth-art {
  position: relative;
  width: 92px; height: 92px; margin: 14px 0 18px;
  display: grid; place-items: center;
}
  25%  { opacity: .8; }
  100% { transform: scale(1); opacity: 0; }
}
  50%      { transform: scale(.82); box-shadow: 0 0 0 16px rgba(10, 132, 255, 0); }
}
.auth-art.done { color: var(--green); }
.auth-art.done .ic { animation: popIn .38s var(--ease); }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } }

.auth-field { position: relative; width: 100%; }
.paste {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  padding: 8px 12px;
  color: var(--blue);
  font-size: 15px; font-weight: 500;
  border-radius: var(--r-sm);
  transition: opacity .15s var(--ease);
}
.paste:active { opacity: .5; }

.auth-input {
  width: 100%;
  padding: 16px 92px 16px 16px;
  text-align: center;
  font-size: 22px; font-weight: 600; letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border-radius: var(--r);
}
.auth-input::placeholder { color: var(--text-3); font-weight: 500; }

.auth-pack {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 0 22px; padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r);
  color: var(--text-2); font-size: 15px;
}
.auth-pack select { color: var(--blue); text-align: right; font-weight: 500; }

.code-cells { display: flex; gap: 10px; margin-bottom: 24px; }
.code-cell {
  width: 44px; height: 56px;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.code-cell.filled { animation: cellPop .2s var(--ease); }
.code-cell.active { border-color: var(--blue); }
@keyframes cellPop { 50% { transform: scale(1.08); } }
.code-hidden { position: absolute; opacity: 0; pointer-events: none; height: 0; }

.auth-error {
  margin-top: 16px; color: var(--red); font-size: 14px;
  animation: shake .32s var(--ease);
}
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}

/* ─────────── Тост ─────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 26px);
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 12px 20px;
  background: var(--card-2);
  border-radius: 999px;
  font-size: 15px;
  z-index: 90;
  animation: toastIn .24s var(--ease);
}
.toast.err { color: #FF8A80; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

.skeleton {
  height: 64px;
  background: linear-gradient(100deg, var(--card) 30%, var(--card-2) 50%, var(--card) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
