/*
 * Страница Discovery Call GiveMagix — облик секции Figma AI_NETWORKING
 * (8401:15121) и экранов входа приложения: фиолетовый #7F1DDC, кнопка-пилюля
 * 50 px как GmPrimaryButton (StadiumBorder, стрелка в 18 от края), Plus Jakarta
 * Sans. Poppins макета не берём: его нет в репозитории, а внешних шрифтовых
 * хостов страница не зовёт — Plus Jakarta Sans у приложения уже свой.
 *
 * Встроенных стилей нет (CSP): видимость — атрибут hidden, темы экранов —
 * классы на body (theme-call, theme-done).
 */

/* Plus Jakarta Sans — SIL OFL 1.1, (c) 2020 The Plus Jakarta Sans Project
   Authors; лицензия едет рядом: /static-web/fonts/OFL-PlusJakartaSans.txt.
   Файлы — байт в байт из packages/givemagix_brand/assets/fonts (сверка —
   tool/web_static.test.ts). */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static-web/fonts/PlusJakartaSans-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static-web/fonts/PlusJakartaSans-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static-web/fonts/PlusJakartaSans-ExtraBold.ttf") format("truetype");
}

:root {
  --purple: #7f1ddc;
  --purple-hover: #6c13c2;
  --purple-press: #5b0fa6;
  --purple-tint: #f4ecfe;
  --ink: #000000;
  --subtitle: #0f0a44;
  --text: #1d1a2f;
  /* Мелкий текст: #A3A3A3 макета на белом — 2.5:1, ниже AA; берём тёмнее. */
  --muted: #625f75;
  --field: #eef0fd;
  --field-strong: #e3e6fb;
  --line: #e3e6f8;
  --error: #b42318;
  --error-bg: rgba(249, 65, 27, 0.1);
  --error-stroke: #e86478;
  --warn-bg: #fff4e0;
  --warn: #7a4300;
  --call-bg: #170d41;
  --done-from: #6311b0;
  --done-mid: #20033b;
  --done-to: #2723a6;
  --radius-field: 12px;
  --radius-card: 16px;
  --gutter: 24px;
  --col: 430px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --widget-room: 132px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #ffffff;
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
h1, p { margin: 0; }
img { max-width: 100%; }
a { color: var(--purple); text-underline-offset: 2px; }
a:hover { color: var(--purple-hover); }
button, input, textarea { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.noscript { padding: 48px var(--gutter); text-align: center; }

:focus-visible { outline: 3px solid rgba(127, 29, 220, 0.45); outline-offset: 2px; }
h1:focus, h1:focus-visible { outline: none; }

/* ── Колонка: телефон — во всю ширину, компьютер — по центру ── */
.app { min-height: 100vh; min-height: 100dvh; }
.main {
  position: relative;
  max-width: var(--col);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: #ffffff;
  overflow: hidden;
}
@media (min-width: 600px) {
  body { background: #f3f1fb; }
  .main { box-shadow: 0 0 0 1px #ebe8f6, 0 12px 48px rgba(15, 10, 68, 0.08); }
}
.screen { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.col { padding: 0 var(--gutter); }
.col-center { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* ── Темы экранов ── */
body.theme-call, body.theme-call .main { background: var(--call-bg); }
body.theme-done .main,
body.theme-done {
  background: linear-gradient(160deg, var(--done-from) 0%, var(--done-mid) 52%, var(--done-to) 98%);
}
@media (min-width: 600px) {
  body.theme-call, body.theme-done { background: #1b1240; }
  body.theme-call .main, body.theme-done .main { box-shadow: none; }
}

/* ── Текст ── */
.title {
  color: var(--ink);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-align: center;
  margin: 28px 0 10px;
}
.title-code { font-size: 24px; margin-top: 12px; }
.title-light { color: #ffffff; }
.lead {
  color: var(--subtitle);
  font-size: 16px;
  line-height: 1.55;
  text-align: center;
}
.lead strong { font-weight: 700; }
.lead-light { color: rgba(255, 255, 255, 0.92); }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 8px; }
.hint-light { color: rgba(255, 255, 255, 0.82); }
.status { min-height: 22px; color: var(--muted); font-size: 14px; text-align: center; margin-top: 12px; }
.status:empty { min-height: 0; margin: 0; }
.status-light { color: rgba(255, 255, 255, 0.9); font-size: 16px; }
.legal { color: var(--muted); font-size: 12.5px; line-height: 1.55; text-align: center; margin-top: 14px; }
.legal-small { font-size: 11.5px; }
.legal a { color: var(--purple); }
.notice {
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--radius-field);
  background: var(--purple-tint);
  color: var(--subtitle);
  font-size: 14px; line-height: 1.5;
  text-align: left;
}
.notice-warn { background: var(--warn-bg); color: var(--warn); }

/* ── Загрузка ── */
.screen-loading { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--purple-tint);
  border-top-color: var(--purple);
  animation: gm-spin 0.9s linear infinite;
}
@keyframes gm-spin { to { transform: rotate(360deg); } }

/* ── W1: баннер сообщества ── */
.banner {
  position: relative;
  aspect-ratio: 1083 / 420;
  /* Заглушка, пока баннера нет, — как у карточки сообщества (#4D1287 → #331361). */
  background: linear-gradient(135deg, #4d1287 0%, #331361 100%);
  overflow: hidden;
}
.banner-img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Подписи — CommunityStyle приложения: слева 16, снизу 15, Jakarta 600 18 / 400 11. */
.banner-captions {
  position: absolute; left: 16px; right: 16px; bottom: 15px;
  display: flex; flex-direction: column; gap: 8px;
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}
.banner-title { max-width: 264px; font-weight: 700; font-size: 18px; line-height: 1.25; }
.banner-subtitle { max-width: 230px; font-size: 11px; line-height: 1.35; }
.screen-join .title { margin-top: 24px; }

/* ── Поля ── */
.form { margin-top: 22px; text-align: left; }
.field-label { display: block; font-weight: 700; font-size: 14px; color: var(--subtitle); margin: 14px 0 6px; }
.field-label:first-child { margin-top: 0; }
.input {
  display: block; width: 100%;
  min-height: 52px; padding: 12px 16px;
  border: 1.5px solid transparent; border-radius: var(--radius-field);
  background: var(--field);
  color: rgba(0, 0, 0, 0.85);
  font-size: 17px; line-height: 1.3;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.input::placeholder { color: #8b88a0; }
.input:focus { border-color: var(--purple); background: #ffffff; }
.input[aria-invalid="true"] { border-color: var(--error-stroke); }
.phone-row { display: flex; gap: 10px; }
.phone-row .input { flex: 1 1 auto; min-width: 0; }
.country-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 14px;
  border-radius: var(--radius-field);
  background: var(--field);
  color: rgba(0, 0, 0, 0.85);
  font-size: 17px;
}
.flag { flex: 0 0 auto; }
.field-error { color: var(--error); font-size: 13.5px; line-height: 1.4; margin-top: 6px; }

/* ── Плашка ошибки (как GmErrorBanner приложения) ── */
.error-banner {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px;
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--radius-field);
  background: var(--error-bg);
  color: var(--ink);
  font-weight: 700; font-size: 14px; line-height: 1.45;
  text-align: left;
}
.error-banner p { flex: 1 1 0; min-width: 0; }
.error-icon { flex: 0 0 auto; margin-top: 1px; }
/* «Try again» в плашке — зона касания 44, как у всех кнопок страницы (у
   GmErrorBanner приложения — 48x48). */
.error-banner .link-btn { min-height: 44px; min-width: 44px; margin-left: 28px; padding: 0 8px; }

/* ── Кнопки: пилюля 50, подпись по центру, стрелка в 18 от края ── */
.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px;
  margin-top: 22px; padding: 12px 52px;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 16px; line-height: 1.26;
  text-align: center; text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.99); }
.btn-arrow, .btn-spinner { position: absolute; right: 18px; top: 50%; margin-top: -12px; }
.btn-spinner {
  display: none;
  width: 20px; height: 20px; margin-top: -10px; right: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: gm-spin 0.9s linear infinite;
}
.btn.is-busy .btn-arrow { display: none; }
.btn.is-busy .btn-spinner { display: block; }
.btn-primary { background: var(--purple); color: #ffffff; }
.btn-primary:hover { background: var(--purple-hover); color: #ffffff; }
.btn-primary:active { background: var(--purple-press); }
.btn-light { background: #ffffff; color: var(--ink); }
.btn-light:hover { background: #f4f1ff; color: var(--ink); }
.btn-light .btn-spinner { border-color: rgba(0, 0, 0, 0.15); border-top-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.is-busy:disabled { opacity: 1; }

.link-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 8px;
  border: 0; background: none;
  color: var(--purple);
  font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.link-btn:hover { color: var(--purple-hover); text-decoration: underline; }
.link-btn:disabled { opacity: 0.5; cursor: default; text-decoration: none; }
.link-inline { min-height: 44px; padding: 0 4px; font-size: inherit; }
.link-center { display: flex; margin: 10px auto 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-left: -10px;
  border: 0; border-radius: 50%; background: none;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--field); }

/* ── W2: код ── */
.topbar { display: flex; align-items: center; min-height: 56px; padding-top: 8px; }
.form-code { margin-top: 26px; }
.otp { position: relative; width: 100%; max-width: 336px; margin: 0 auto; }
.otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-cell {
  display: flex; align-items: center; justify-content: center;
  height: 56px;
  border: 1.5px solid transparent; border-radius: var(--radius-field);
  background: var(--field);
  color: var(--ink);
  font-weight: 700; font-size: 22px;
}
.otp-cell.is-active { border-color: var(--purple); background: #ffffff; }
.otp-cell.is-filled { background: var(--field-strong); }
.otp.is-invalid .otp-cell { border-color: var(--error-stroke); }
/* Настоящее поле лежит поверх клеток: видимо для ОС (подсказка кода из SMS,
   менеджеры паролей), но прозрачно — цифры рисуют клетки. */
.otp-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; border: 0; outline: none;
  background: transparent;
  color: transparent; -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 1em;
  cursor: text;
}
.otp-input::selection { background: transparent; }
.otp-input:focus-visible { outline: none; }
.otp:focus-within .otp-cells { filter: none; }
.resend { display: flex; justify-content: center; align-items: center; min-height: 44px; margin-top: 18px; color: var(--muted); font-size: 15px; }

/* ── W3: перед звонком ── */
.screen-intro {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: 0;
}
.screen-intro .title { margin-top: 28px; }
.tips { list-style: none; margin: 22px 0 0; padding: 0; text-align: left; }
.tips li { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; color: var(--ink); font-size: 15.5px; line-height: 1.5; }
.tips strong { font-weight: 700; }
.tip-icon { flex: 0 0 auto; margin-top: 1px; color: var(--ink); }
.tip-icon-purple, .tip-purple { color: var(--purple); font-weight: 700; }
.whoami { margin-top: 6px; text-align: center; color: var(--muted); font-size: 14px; }
/* Рисунок прижат к низу, как в Figma: пилюля виджета ложится на стол. На
   низком экране режется низ (стол), лицо и микрофон остаются видны. */
.intro-art { margin-top: auto; line-height: 0; }
.screen-intro .col { padding-bottom: 14px; }
.intro-art img {
  display: block; width: 100%; height: auto;
  max-height: max(260px, 52vh);
  object-fit: cover; object-position: center top;
}
/* Под пилюлю виджета (position: fixed, снизу) — место, чтобы она не легла на текст. */
.screen-intro .intro-art {
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
  /* Низ — цвет стола рисунка под пилюлей; верх прозрачный: полпикселя
     округления над картинкой не даёт цветной полосы. */
  background: linear-gradient(transparent 50%, #5b3a8f 50%);
}
.hero-small { display: block; width: 115px; height: 115px; margin: 36px auto 0; }
.screen-processing .col, .screen-held .col, .screen-error .col { padding-top: 8vh; }
.hero-center { margin-left: auto; margin-right: auto; }

/* ── W4: идёт звонок ── */
.screen-call { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--widget-room) + env(safe-area-inset-bottom)); }
.screen-call .col { padding-top: 12vh; }
.orb {
  width: min(86vw, 340px); height: auto; aspect-ratio: 1;
  /* Края квадрата картинки растворяются в фоне кадра (#170D41). */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  animation: gm-breathe 3.6s ease-in-out infinite;
}
@keyframes gm-breathe { 50% { transform: scale(1.035); } }
.screen-call .title { margin-top: 20px; }

/* ── W5 ── */
.progress {
  position: relative; width: 100%; max-width: 280px; height: 6px;
  margin: 28px auto 0;
  border-radius: 3px; background: var(--purple-tint);
  overflow: hidden;
}
.progress-bar {
  position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7f1ddc, #4182f0);
  animation: gm-slide 1.6s ease-in-out infinite;
}
@keyframes gm-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.late { width: 100%; margin-top: 8px; }
.late .link-btn { margin-top: 18px; }
.link-icon svg { flex: 0 0 auto; }

.form-card { margin-top: 18px; }
.card-field { margin-top: 18px; }
.card-label { display: block; font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 8px; }
.textarea {
  display: block; width: 100%;
  min-height: 112px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-field);
  background: #f9f9ff;
  color: rgba(0, 0, 0, 0.85);
  font-size: 16px; line-height: 1.55;
  resize: vertical;
  outline: none;
}
.textarea:focus { border-color: var(--purple); background: #ffffff; }
.textarea[aria-invalid="true"] { border-color: var(--error-stroke); }
.textarea::placeholder { color: #8b88a0; }
.field-foot { display: flex; align-items: flex-start; gap: 10px; min-height: 20px; }
.field-foot .field-error { flex: 1 1 auto; }
.count { margin-left: auto; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ── W6 ── */
.screen-done { position: relative; min-height: 100vh; min-height: 100dvh; color: #ffffff; }
.confetti {
  position: absolute; top: 0; left: 50%; width: 100%; max-width: 430px; height: auto;
  transform: translateX(-50%); pointer-events: none;
  /* Конфетти — сверху, под заголовком гаснет: текст поверх читается. */
  -webkit-mask-image: linear-gradient(#000 40%, transparent 72%);
  mask-image: linear-gradient(#000 40%, transparent 72%);
}
.screen-done .col { position: relative; padding-top: 20vh; }
.hero-round { display: block; width: 102px; height: 102px; border-radius: 50%; }
.screen-done .title { margin-top: 22px; }
.actions { width: 100%; margin-top: 10px; }
.actions .btn + .btn { margin-top: 12px; }
.screen-done .link-btn { color: #ffffff; }
.screen-held .actions .btn + .btn { margin-top: 12px; }
.screen-held .link-btn { margin-top: 14px; }

/* ── Виджет ElevenLabs: только его же переменные CSS (--el-*, --font-sans)
   на хозяине — без лазания в его shadow DOM. Правило документа сильнее
   :host виджета (каскад: внешний контекст побеждает). ── */
.widget-slot { position: relative; z-index: 5; }
elevenlabs-convai {
  --el-accent: #7f1ddc;
  --el-accent-hover: #6c13c2;
  --el-accent-active: #5b0fa6;
  --el-accent-border: #7f1ddc;
  --el-accent-subtle: #b48bef;
  --el-accent-primary: #ffffff;
  --el-base-primary: #0f0a44;
  --el-button-radius: 25px;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
/* Стенд (fake ElevenLabs): своя пилюля на месте виджета. */
.stand-widget {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(340px, calc(100% - 32px));
  padding: 12px 14px 8px;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(15, 10, 68, 0.18);
  text-align: center;
}
.stand-widget .btn { margin-top: 0; }
.stand-note { margin-top: 6px; color: var(--muted); font-size: 12px; }
.recaptcha-slot { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Значок reCAPTCHA прячем — подпись «protected by reCAPTCHA» стоит текстом на
   экранах входа (так Google разрешает). */
.grecaptcha-badge { visibility: hidden; }

@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .title { font-size: 25px; }
  .title-code { font-size: 21px; }
  .otp-cells { gap: 6px; }
  .otp-cell { height: 50px; font-size: 20px; }
  .country-chip { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .spinner, .btn-spinner, .progress-bar { animation: none; }
  .progress-bar { width: 100%; opacity: 0.5; }
  .btn, .input, .textarea { transition: none; }
}
