/* Страница входа: строгий тёмный фон, по центру логотип и карточка входа. Цвета свои, от темы не зависят. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

/* html:root[data-theme] сильнее, чем :root[data-theme="dark"] из tokens.css: тёмная тема системы не должна менять цвета этой страницы
   (карточка всегда белая, и светлый текст тёмной темы на ней почти не виден) */
html:root,
html:root[data-theme] {
  color-scheme: light; /* флажки, списки и подсказки полей — светлые, как карточка */
  --bg: #0b0a12;
  --ink: #14121c;
  --muted: #6b6878;
  --faint: #9c99a8;
  --line: #e4e1ea;
  --brand: #502ceb;
  --brand-hi: #6342f5;
  --brand-lo: #4423d6;
}

body {
  margin: 0;
  color: #fff;
  font: 500 16px/1.5 var(--font);
  background:
    radial-gradient(1100px 620px at 50% -12%, rgba(92, 64, 230, 0.22), transparent 64%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* фон: сетка и линия роста */
.backdrop { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
.bd-grid line { stroke: rgba(255, 255, 255, 0.045); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bd-curve { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 2.4s cubic-bezier(.3, .6, .2, 1) 0.2s forwards; }

.screen { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; padding: 24px 32px 32px; }

.top { display: flex; justify-content: flex-end; }
.lang { display: flex; gap: 2px; }
.lang button {
  height: 32px;
  min-width: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font: 600 13px var(--font);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang button:hover { color: rgba(255, 255, 255, 0.85); }
.lang button[aria-pressed="true"] { color: #fff; background: rgba(255, 255, 255, 0.08); }

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 0 8px; }

.logo { width: 220px; height: auto; }
.tagline { margin: 14px 0 32px; color: rgba(255, 255, 255, 0.55); font-size: 15px; text-align: center; }

.card {
  width: min(420px, 100%);
  padding: 36px 36px 24px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 30px 70px -20px rgba(0, 0, 0, 0.65);
  animation: rise 0.6s cubic-bezier(.2, .7, .2, 1) both;
}

.eyebrow { margin: 0 0 6px; font-size: 24px; font-weight: 800; line-height: 1.2; letter-spacing: -0.025em; }
.lead { margin: 0 0 26px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.notice { margin: 0 0 18px; padding: 11px 13px; border-radius: 10px; background: #f0edfd; color: #4325cf; font-size: 13.5px; font-weight: 700; }
.error { margin: 0 0 14px; padding: 11px 13px; border-radius: 10px; background: #fdeceb; color: #b42318; font-size: 13.5px; font-weight: 700; }

.field { display: block; margin-bottom: 18px; }
.field > span:first-child { display: block; margin-bottom: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d9d5e2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 600 15px var(--font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:hover { border-color: #bdb6cf; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(80, 44, 235, 0.15); }
.input.otp { letter-spacing: 0.5em; text-align: center; font-size: 22px; font-weight: 800; }
/* код восстановления XXXXX-XXXXX: 11 знаков, буквы и цифры — плотнее, чтобы влез в поле */
.input.otp.is-recovery { letter-spacing: 0.12em; font-size: 18px; }
.btn-link.otp-switch { margin: 4px auto 0; font-size: 13px; font-weight: 600; }

.pw { position: relative; display: block; }
.pw .input { padding-right: 54px; }
.pw-toggle { position: absolute; top: 6px; right: 6px; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer; transition: color 0.15s ease, background 0.15s ease; }
.pw-toggle:hover { background: #f2f0f6; color: var(--ink); }
.pw-toggle[aria-pressed="true"] { color: var(--brand); }
/* глаз — пароль скрыт, перечёркнутый глаз — пароль виден */
.pw-toggle::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pw-toggle[aria-pressed="true"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.9 5.2A10.4 10.4 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.1M6.6 6.6C3.8 8.4 2 12 2 12s3.6 7 10 7a9.8 9.8 0 0 0 5.4-1.6'/%3E%3Cpath d='M9.9 9.9a3 3 0 0 0 4.2 4.2'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.9 5.2A10.4 10.4 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.1M6.6 6.6C3.8 8.4 2 12 2 12s3.6 7 10 7a9.8 9.8 0 0 0 5.4-1.6'/%3E%3Cpath d='M9.9 9.9a3 3 0 0 0 4.2 4.2'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--brand-hi) 0%, var(--brand) 60%, var(--brand-lo) 100%);
  color: #fff;
  font: 700 15.5px var(--font);
  letter-spacing: 0.005em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px -8px rgba(80, 44, 235, 0.55);
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}
/* стрелка; текст кнопки задаёт login.js, поэтому иконка в ::after */
.btn::after {
  content: "";
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:hover::after { transform: translateX(3px); }
.btn:active { filter: brightness(0.96); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(80, 44, 235, 0.3); }
/* во время запроса вместо стрелки крутится индикатор */
.btn:disabled { cursor: default; filter: none; opacity: 0.85; }
.btn:disabled::after { -webkit-mask: none; mask: none; background: none; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

.remember { display: flex; align-items: center; gap: 9px; width: max-content; margin: -4px 0 18px; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.remember input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.btn-link { display: block; margin: 14px auto 0; border: 0; background: transparent; color: var(--muted); font: 700 14px var(--font); cursor: pointer; }
.btn-link:hover { color: var(--brand); }

.secure { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 20px 0 0; padding-top: 18px; border-top: 1px solid #efedf3; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.secure svg { flex: none; width: 15px; height: 15px; fill: none; stroke: #16a34a; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.legal { margin: 22px 0 0; color: rgba(255, 255, 255, 0.45); font-size: 13px; text-align: center; }
a { color: rgba(255, 255, 255, 0.85); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.3); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid #a994ff; outline-offset: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .bd-curve { stroke-dashoffset: 0; } }

@media (max-width: 600px) {
  .screen { padding: 14px 16px 24px; }
  .top { justify-content: center; }
  .lang button { min-width: 38px; padding: 0 8px; font-size: 12.5px; }
  .center { justify-content: flex-start; padding-top: 28px; }
  .logo { width: 180px; }
  .tagline { margin: 10px 0 24px; font-size: 14px; }
  .card { padding: 28px 22px 20px; }
}

/* регистрация */
.hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.terms { width: auto; align-items: flex-start; margin: 0 0 18px; font-size: 13.5px; line-height: 1.45; }
.terms input { margin-top: 2px; }
.terms a { color: var(--brand); font-weight: 700; }

/* Телефон при регистрации: слева страна (флаг и код, список стран — обычный выпадающий список поверх), справа номер */
.phone-field { display: flex; gap: 8px; }
.phone-country { position: relative; flex: none; width: 104px; }
.phone-shown { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 48px; padding: 0 12px; border: 1px solid #d9d5e2; border-radius: 10px; background: #fff; color: var(--ink); font: 700 15px var(--font); white-space: nowrap; pointer-events: none; }
.phone-shown::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.phone-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: 500 15px var(--font); }
.phone-country:hover .phone-shown { border-color: #bdb6cf; }
.phone-select:focus-visible + .phone-shown, .phone-country:focus-within .phone-shown { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(80, 44, 235, 0.15); }
.phone-num { flex: 1; min-width: 0; }
.input.invalid { border-color: #d92d20; }
