/* auth.css — вход, регистрация, подтверждение почты, сброс пароля.
   Фон-сцена (templates/includes/auth_scene.html): небо, облака и холмы, как на заставке
   и в шапке профиля; сверху надпись-шары «НЕСКУЧНО», над карточкой — Неско.
   Селекторы через .auth-page .auth-card — старые правила .auth-card в main.css
   (капс в label, свой градиент кнопки) не должны сюда протекать. */

.auth-page {
  --auth-sky: linear-gradient(180deg, #5DBDFB 0%, #9AD8FF 55%, #CDEEFF 100%);
  --auth-card: #ffffff;
  --auth-field: #f3f4f8;
  --auth-field-focus: #ffffff;
  --auth-ink: #14161f;
  --auth-muted: rgba(20,22,31,.55);
  --auth-faint: rgba(20,22,31,.38);
  --auth-line: rgba(20,22,31,.08);
  --auth-cloud: #ffffff;
  --auth-far: #B5E478; --auth-mid: #86D24E; --auth-near: #5FBF3A;
  --auth-card-shadow: 0 1px 2px rgba(20,40,90,.06), 0 24px 60px -24px rgba(20,60,130,.40);

  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(28px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  position: relative;
  color: var(--auth-ink);
  /* Без собственного overflow: иначе .auth-page становится вложенным скролл-контейнером
     и карточка скроллится внутри него, обрезая себе верх. */
}
html.dark-theme .auth-page {
  --auth-sky: linear-gradient(180deg, #0B1633 0%, #16285A 60%, #1F3570 100%);
  --auth-card: #1b1f2a;
  --auth-field: rgba(255,255,255,.06);
  --auth-field-focus: rgba(255,255,255,.09);
  --auth-ink: #eef0ff;
  --auth-muted: rgba(220,226,255,.62);
  --auth-faint: rgba(220,226,255,.40);
  --auth-line: rgba(255,255,255,.08);
  --auth-cloud: #2A3768;
  --auth-far: #1F4A44; --auth-mid: #215446; --auth-near: #23614A;
  --auth-card-shadow: 0 24px 60px -20px rgba(0,0,0,.6);
}

/* ── сцена ── */
.auth-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--auth-sky);
  pointer-events: none;
}
.auth-cloud {
  position: absolute; left: 0;
  fill: var(--auth-cloud); opacity: .95;
  filter: drop-shadow(0 4px 6px rgba(60,110,180,.16));
  animation: auth-drift var(--t) linear var(--dl) infinite;
}
html.dark-theme .auth-cloud { opacity: .8; filter: none; }
@keyframes auth-drift { from { transform: translateX(-160px); } to { transform: translateX(calc(100vw + 40px)); } }
.auth-land { position: absolute; left: 0; bottom: 0; width: 100%; height: 24vh; min-height: 140px; }
.auth-far { fill: var(--auth-far); } .auth-mid { fill: var(--auth-mid); } .auth-near { fill: var(--auth-near); }

.auth-brand {
  position: relative; z-index: 1;
  display: block;
  margin: 6px auto 54px;
  -webkit-tap-highlight-color: transparent;
}
.auth-brand .nes-balloons { width: min(78vw, 360px); }

/* ── карточка ── */
.auth-page .auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto auto;
  padding: 30px 22px 24px;
  background: var(--auth-card);
  border: 0;
  border-radius: 30px;
  box-shadow: var(--auth-card-shadow);
  overflow: visible; /* общее правило карточек режет вылезающего Неско */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: authCardIn .45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Неско выглядывает из-за верхнего края карточки */
.auth-neski {
  position: absolute;
  top: -58px;
  right: 18px;
  pointer-events: none;
}
.auth-neski .neski { --neski-size: 76px; }

.auth-page .auth-header { text-align: left; margin: 0 92px 22px 0; }
.auth-page .auth-title {
  margin: 0 0 6px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--auth-ink);
}
.auth-page .auth-subtitle {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--auth-muted);
}

/* ── поля ── */
.auth-page .auth-field { margin-bottom: 14px; }
.auth-page .auth-card label,
.auth-page .auth-label {
  display: block;
  margin: 0 0 6px 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--auth-muted);
}
.auth-page .auth-card .auth-input {
  width: 100%;
  height: 52px;
  min-height: 52px;
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: var(--auth-field);
  color: var(--auth-ink);
  font-family: var(--font, "Manrope", sans-serif);
  font-size: 16px; /* 16px — iOS не зумит поле при фокусе */
  font-weight: 600;
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.auth-page .auth-card .auth-input.code-input { height: auto; min-height: 68px; }
.auth-page .auth-card .auth-input::placeholder { color: var(--auth-faint); font-weight: 500; }
.auth-page .auth-card .auth-input:focus {
  background: var(--auth-field-focus);
  border-color: rgba(var(--brand-rgb), .55);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}
.auth-page .auth-card .auth-input[aria-invalid="true"] {
  border-color: rgba(229,72,77,.6);
  box-shadow: 0 0 0 4px rgba(229,72,77,.10);
}
.auth-page .auth-field-error {
  margin: 6px 0 0 4px;
  color: var(--danger, #e5484d);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
}
.auth-page .auth-helptext {
  margin: 6px 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--auth-faint);
}

/* чекбоксы согласий на регистрации */
.auth-page .auth-checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 12px;
}
.auth-page .auth-checkbox-field input[type="checkbox"] {
  flex: none;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.auth-page .auth-card .auth-checkbox-field label {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--auth-muted);
  cursor: pointer;
}
.auth-page .auth-checkbox-field a { color: var(--soft-text, var(--brand)); font-weight: 700; text-decoration: none; }

/* ── кнопка: фирменная капсула, как главные CTA приложения ── */
.auth-page .auth-card .auth-btn,
.auth-page .auth-card button[type="submit"].auth-btn {
  width: 100%;
  height: 54px;
  min-height: 54px;
  margin-top: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--cta, linear-gradient(135deg, #ffb03a 0%, #ff4d2e 48%, #e8243c 100%));
  box-shadow: var(--cta-shadow, 0 10px 24px -10px rgba(232,36,60,.6));
  color: #fff;
  font-family: var(--font);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), filter .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.auth-page .auth-card .auth-btn:hover { color: #fff; filter: brightness(1.04); transform: none; }
.auth-page .auth-card .auth-btn:active { transform: scale(.97); }
.auth-page .auth-card .auth-btn:disabled { opacity: .7; cursor: wait; transform: none; }

/* ── низ карточки ── */
.auth-page .auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--auth-muted);
}
.auth-page .auth-footer p { margin: 6px 0; }
.auth-page .auth-footer a,
.auth-page .auth-footer button.auth-linkbtn { color: var(--soft-text, var(--brand)); font-weight: 800; text-decoration: none; }
.auth-page .auth-footer a:hover { text-decoration: underline; }
.auth-page .auth-secondary { margin-top: 12px; font-size: 13px; }
.auth-page .auth-footer .auth-secondary a { color: var(--auth-faint); font-weight: 700; }

/* ── сообщения ── */
.auth-page .auth-errors,
.auth-page .auth-info {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}
.auth-page .auth-errors { background: rgba(229,72,77,.10); color: #c53036; }
.auth-page .auth-info { background: rgba(var(--brand-rgb),.10); color: var(--soft-text, var(--brand)); }
html.dark-theme .auth-page .auth-errors { color: #ff8a8e; }
.auth-page .auth-errors p, .auth-page .auth-info p { margin: 0 0 4px; }
.auth-page .auth-errors p:last-child, .auth-page .auth-info p:last-child { margin-bottom: 0; }
.auth-page .auth-errors ul { margin: 0; padding: 0 0 0 16px; }
.auth-page .auth-info a,
.auth-page .auth-errors a { color: inherit; text-decoration: underline; font-weight: 800; }

/* ── экраны-итоги: «письмо отправлено», «пароль изменён» ── */
.auth-page .auth-success { text-align: center; padding: 18px 0 4px; }
.auth-page .auth-success-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 24px;
  background: var(--brand-soft, rgba(255,77,46,.12));
  color: var(--brand);
  font-size: 34px;
  line-height: 1;
}
.auth-page .auth-success-title { margin-bottom: 8px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--auth-ink); }
.auth-page .auth-card .auth-success-text { margin-bottom: 22px; font-size: 14.5px; font-weight: 600; line-height: 1.45; color: var(--auth-muted); }

.auth-page .auth-success .auth-btn { margin-top: 0; }

/* Маленькие телефоны (SE, Mini) */
@media (max-width: 360px) {
  .auth-page .auth-card { padding: 26px 16px 20px; border-radius: 26px; }
  .auth-page .auth-title { font-size: 24px; }
  .auth-brand { margin-bottom: 50px; }
}
/* Низкий экран / телефон боком — надпись и Неско меньше, всё ближе */
@media (max-height: 640px) {
  .auth-page { padding-top: 16px; }
  .auth-brand { margin-bottom: 46px; }
  .auth-brand .nes-balloons { width: min(64vw, 280px); }
}
@media (min-width: 769px) {
  .auth-page { justify-content: center; }
  .auth-page .auth-card { margin-bottom: auto; padding: 34px 30px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-cloud, .auth-page .auth-card { animation: none; }
}

/* ── вход через Яндекс ID / VK ID ── */
.auth-page .auth-sso { margin-bottom: 4px; }
.auth-page .auth-sso form { margin: 0 0 10px; }
.auth-page .auth-card .auth-sso-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), filter .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.auth-page .auth-card .auth-sso-btn:active { transform: scale(.97); }
.auth-page .auth-card .auth-sso-btn:hover { filter: brightness(1.08); }
.auth-page .auth-card .auth-sso-btn--yandex { background: #000; }
.auth-page .auth-card .auth-sso-btn--vk { background: #0077FF; }
html.dark-theme .auth-page .auth-card .auth-sso-btn--yandex { background: #fff; color: #000; }
.auth-page .auth-sso-logo { width: 22px; height: 22px; flex: none; }
.auth-page .auth-sso-note {
  margin: 2px 4px 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: var(--auth-faint);
}
.auth-page .auth-sso-note a { color: inherit; text-decoration: underline; }
.auth-page .auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--auth-faint);
}
.auth-page .auth-or::before,
.auth-page .auth-or::after { content: ''; flex: 1; height: 1px; background: currentColor; opacity: .35; }

/* ── регистрация по ссылке на событие: «Тебя зовут на …» ── */
.auth-page .auth-invite {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--brand-soft, rgba(236,58,138,.11));
  border: 1px solid var(--brand-soft-border, rgba(236,58,138,.2));
}
.auth-page .auth-invite__kicker { font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--soft-text, var(--brand)); }
.auth-page .auth-invite__name { margin: 4px 0 2px; font-size: 18px; font-weight: 900; line-height: 1.2; color: var(--auth-ink); overflow-wrap: anywhere; }
.auth-page .auth-invite__when { font-size: 13.5px; font-weight: 700; color: var(--auth-muted); }

/* Поле-ловушка для ботов (accounts/antibot.py): людям не видно и не фокусируется */
.auth-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.auth-captcha { margin: 6px 0 14px; min-height: 102px; }
