/* MOYO: окно регистрации + OTP, мобильная версия (по макету 390x844) */

/* Шрифт Montserrat в fonts.css (вшит), без Google Fonts: там подмена шрифта на лету, и Google закрыт в Китае */

/* пока не подставлены тексты нужного языка, форму не показываем (снимает app.js) */
.i18n-wait .page { visibility: hidden; }

:root {
  --bg: #0B0B0B;
  --card: #121212;
  --card-border: #5A4614;
  --popup: #161616;
  --field: #1C1C1C;
  --field-border: #3A3A3A;
  --text: #FFFFFF;
  --muted: #A8A8A8;
  --label: #D6D6D6;
  --body: #C8C8C8;
  --ph: #8A8A8A;
  --focus: #F2C94C;
  --err: #FF6B6B;
  --gold-line: #F0D162;
  --gold-soft: #C9993A;
  --gold-btn: linear-gradient(180deg, #D0B047 0%, #FAE68F 17%, #F0CF6A 27%, #E3B846 37%, #D3A735 55%, #BE9124 75%, #A77B11 100%);
  --gold-btn-shadow: inset 4px 0 5px rgba(110, 70, 0, .18), inset -4px 0 5px rgba(110, 70, 0, .18);
  --gold-text: linear-gradient(135deg, #B8822A 0%, #FAE47A 50%, #C29531 100%);
  --gold-dot: linear-gradient(135deg, #915E12 0%, #FAE47A 50%, #A17817 100%);
  --font: Montserrat, Arial, sans-serif;
}
/* иероглифы системным шрифтом: iPhone PingFang, Android Noto Sans CJK (тот же Noto Sans SC), Windows YaHei */
:lang(zh) { --font: Montserrat, 'PingFang SC', 'Noto Sans SC', 'Noto Sans CJK SC', 'Source Han Sans SC', 'Microsoft YaHei', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input { font-family: inherit; }
button { -webkit-appearance: none; appearance: none; touch-action: manipulation; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- страница и карточка ---------- */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
@media (max-width: 359px) {
  .page { padding-left: 12px; padding-right: 12px; }
}
.card {
  width: 100%;
  max-width: 350px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.banner { position: relative; aspect-ratio: 1284 / 648; background: var(--card); }
.banner img { display: block; width: 100%; height: 100%; object-fit: cover; }

.icon-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.popup .icon-btn { top: 4px; right: 4px; }
.ico-close { width: 32px; height: 32px; }

/* ---------- форма ---------- */
#regForm { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; }
.head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 2px; }
h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.sub { margin: 0; font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 12px; font-weight: 600; color: var(--label); }
.control { position: relative; }

.ico, .ico-sm, .ico-eye {
  fill: none;
  stroke: url(#gIco);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.control > .ico { position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; pointer-events: none; }
.ico-eye { width: 18px; height: 18px; stroke: #FFFFFF; }
.ico-sm { width: 16px; height: 16px; }

/* 16px, а не 14px как в макете: иначе iPhone приближает страницу при вводе */
.input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px 0 44px;
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s;
}
.input.has-toggle { padding-right: 48px; }
.input::placeholder { color: var(--ph); opacity: 1; }
.input:focus { outline: none; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--err); }
/* автозаполнение браузера не должно красить поле в белый */
.input:-webkit-autofill,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px var(--field) inset;
  caret-color: var(--text);
}

.toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.err { margin: 0; font-size: 12px; font-weight: 600; color: var(--err); }

/* ---------- кнопки ---------- */
.btn-gold {
  position: relative;
  width: 100%;
  height: 48px;
  border: 1px solid var(--gold-line);
  border-radius: 6px;
  background: var(--gold-btn);
  box-shadow: var(--gold-btn-shadow);
  color: #1A1200;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: filter .15s;
}
.btn-gold.btn-lg { height: 56px; font-size: 15px; margin-top: 6px; }
.btn-gold:active { filter: brightness(.92); }
.btn-gold:focus-visible, .btn-dark:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, .toggle:focus-visible, .paste:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.bdots { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 6px; }
.bdots i { width: 7px; height: 7px; border-radius: 50%; background: #1A1200; animation: moyoDot 1.2s ease-in-out infinite; }
.bdots i:nth-child(2) { animation-delay: .2s; }
.bdots i:nth-child(3) { animation-delay: .4s; }
.btn-gold[aria-busy="true"] { pointer-events: none; }
.btn-gold[aria-busy="true"] .lbl { visibility: hidden; }
.btn-gold[aria-busy="true"] .bdots { display: flex; }

.btn-dark {
  width: 100%;
  height: 48px;
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
}

.gold-text {
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  text-decoration: none;
}
.btn-dark .gold-text { font-weight: 800; }

.foot { margin: 2px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.foot a { padding: 12px 2px; margin: -12px 0; }

.link-btn { padding: 12px 2px; margin: -12px 0; border: 0; font-size: 13px; cursor: pointer; }

/* ---------- всплывающие окна ---------- */
.overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, .6);
  animation: fadeIn .15s ease-out;
}
.popup {
  position: relative;
  width: 288px;
  max-width: 100%;
  margin: auto;
  padding: 22px 20px 20px;
  background: var(--popup);
  border: 1px solid var(--gold-line);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: popIn .18s ease-out;
}
.badge {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #2D2D2D;
  border: 1px solid var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.badge .ico { width: 26px; height: 26px; }
.ptitle { margin: 2px 0 0; font-size: 18px; font-weight: 800; color: var(--text); }
.ptext { margin: 0; font-size: 13px; line-height: 19px; color: var(--body); text-wrap: balance; }
.popup:focus { outline: none; }
.ptext strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.proc-text { margin-bottom: 6px; }

.otp-field { align-self: stretch; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; text-align: left; }
.otp-input { height: 48px; padding: 0 84px 0 14px; font-size: 16px; font-weight: 600; letter-spacing: 3px; }
.paste {
  position: absolute;
  right: 2px;
  top: 2px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.otp-err { margin-top: -2px; align-self: stretch; text-align: left; }
#btnOtpOk { margin-top: 6px; }
.resend-line { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.cooldown { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.actions { align-self: stretch; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.dots { height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.dots span { width: 12px; height: 12px; border-radius: 6px; background: var(--gold-dot); animation: moyoDot 1.2s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }

@keyframes moyoDot { 0%, 80%, 100% { opacity: .3; transform: scale(.75); } 40% { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.shake { animation: shake .3s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  .overlay, .popup, .shake { animation: none; }
  .dots span, .bdots i { animation-duration: 2.4s; }
}
