* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Roboto Variable", Roboto, "Helvetica Neue", Helvetica, "Noto Sans SC", "Segoe UI", Arial, sans-serif;
  background: #fcf5eb;
  color: #1d1f1f;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.wa-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 40px 32px;
}
.wa-brand {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 28px;
  color: #25d366;
}
.wa-logo { display: block; flex: none; width: 31px; height: 30px; }
.wa-wordmark { display: block; height: 20px; width: auto; }

.dl-banner {
  width: min(100%, 872px);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #000;
  border-radius: 20px;
  color: inherit;
  text-decoration: none;
}
.dl-ill { flex: none; width: 88px; height: 58px; }
.dl-copy { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl-copy strong { font-size: 16px; font-weight: 500; color: #1d1f1f; line-height: 22px; }
.dl-sub {
  display: none;
  color: #1d1f1f;
  font-size: 16px;
  line-height: 20px;
  font-weight: 400;
}
.dl-get {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #1d1f1f;
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
  text-decoration: underline 2px #25d366;
  text-underline-offset: 4px;
  width: fit-content;
}
.dl-get img { flex: none; }
.dl-btn {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  height: 52px;
  padding: 10px 24px;
  background: #25d366;
  color: #1d1f1f;
  border: 1px solid #1d1f1f;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
}

.login-card {
  width: min(100%, 872px);
  background: #fff;
  border: 1px solid #000;
  border-radius: 25px;
  padding: 48px;
}
.qr-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 228px;
  grid-template-areas:
    "copy qr"
    "keep link";
  column-gap: 48px;
  row-gap: 28px;
  align-items: start;
}
.copy { grid-area: copy; }
.qr-side { grid-area: qr; display: flex; justify-content: center; align-items: flex-start; }
.keep { grid-area: keep; align-self: end; }
#toPhone { grid-area: link; justify-self: end; align-self: end; }

h1 {
  margin: 0 0 40px;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0;
  color: #1d1f1f;
  line-height: 1.2;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}
.steps::before {
  content: "";
  position: absolute;
  left: 12.5px;
  top: 13px;
  bottom: 13px;
  width: 1px;
  background: #000;
}
.steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #1d1f1f;
  font-size: 16px;
  line-height: 1.5;
  position: relative;
}
.steps > li > span:first-child {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #000;
  color: #000;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
  z-index: 1;
}
.step-text {
  display: inline;
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}
.step-wa {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0 4px;
  vertical-align: -2px;
  flex: none;
}

.help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 22px;
  color: #1d1f1f;
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  text-decoration: underline 2px #25d366;
  text-underline-offset: 4px;
}
.help svg { flex: none; }

.keep {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1d1f1f;
  font-size: 16px;
  font-weight: 400;
  cursor: default;
  user-select: none;
  line-height: 20px;
}
.keep input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.keep-box {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #1daa61;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.keep-info { color: #667781; flex: none; margin-left: 2px; }

.qr-frame {
  width: 228px;
  height: 228px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  border-radius: 2px;
  overflow: visible;
}
.qr-frame.loading {
  background: #f0f2f5;
  border-radius: 8px;
}
.qr-frame #qrImg {
  width: 228px;
  height: 228px;
  object-fit: contain;
  display: none !important;
  position: relative;
  z-index: 1;
  background: #fff;
}
.qr-frame #qrImg.show { display: block !important; }
.qr-frame .qr-badge {
  position: absolute;
  z-index: 2;
  width: 64px;
  height: 64px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none !important;
  pointer-events: none;
  background: transparent;
  box-shadow: none;
  color: #1f2c34;
  line-height: 0;
}
.qr-frame .qr-badge svg {
  display: block;
  width: 64px;
  height: 64px;
  overflow: visible;
}
.qr-frame.ready .qr-badge.show { display: block !important; }
.qr-frame .qr-spinner {
  width: 40px;
  height: 40px;
  box-sizing: border-box;
  border: 3px solid transparent;
  border-top-color: #54656f;
  border-right-color: #54656f;
  border-radius: 50%;
  animation: qr-spin .75s linear infinite;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -20px 0 0 -20px;
  z-index: 1;
  display: none !important;
}
.qr-frame.loading .qr-spinner { display: block !important; }
.qr-frame.loading .qr-badge,
.qr-frame.loading #qrImg {
  display: none !important;
}
@keyframes qr-spin {
  to { transform: rotate(360deg); }
}

.text-link {
  border: 0;
  background: transparent;
  color: #1d1f1f;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  text-decoration: underline 2px #25d366;
  text-underline-offset: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.text-link.inline {
  display: inline;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
.text-link.center { display: inline-flex; margin: 24px 0 0; }

.phone-mode {
  width: min(100%, 872px);
  text-align: center;
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.phone-mode h1 {
  font-size: 32px;
  margin-bottom: 12px;
  text-align: center;
}
.hint {
  margin: 0 0 28px;
  color: #1d1f1f;
  font-size: 18px;
  line-height: 21px;
  font-weight: 400;
}
.field { display: block; width: min(100%, 320px); margin: 0 auto 14px; text-align: left; }
.phone-line {
  width: min(100%, 320px);
  height: 52px;
  border: 1px solid #0a0a0a;
  border-radius: 24px;
  background: #fff;
  padding: 14.5px 10px 15.5px 24px;
  color: #0a0a0a;
  display: flex;
  align-items: center;
  margin: 0 auto 14px;
}
.phone-line input {
  flex: 1;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  line-height: 16px;
  height: auto;
  padding: 0;
  color: #0a0a0a;
  caret-color: #0a0a0a;
}
.next {
  margin-top: 10px;
  min-width: 90px;
  width: 90px;
  height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: 9999px;
  background: #1daa61;
  color: #fff;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  line-height: normal;
}
.next:disabled { opacity: .55; cursor: default; }

.country-pick { position: relative; width: min(100%, 320px); margin: 0 auto 12px; text-align: left; }
.country-btn {
  width: 100%;
  height: 52px;
  border: 1px solid #0a0a0a;
  border-radius: 24px;
  background: #fff;
  padding: 10px 24px;
  color: #1b8755;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 16px;
}
.country-btn .flag {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.country-btn .country-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-btn .chevron { flex: none; transform: rotate(90deg); opacity: .7; }
.country-menu {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  top: 0;
  background: #fff;
  border-radius: 24px;
  border: 1px solid #0a0a0a;
  box-shadow: 0 8px 28px rgba(11,20,26,.16);
  padding: 8px;
  max-height: min(360px, 52vh);
  display: flex;
  flex-direction: column;
}
.country-search input {
  width: 100%;
  height: 42px;
  border: 2px solid #25d366;
  border-radius: 22px;
  padding: 0 14px;
  outline: none;
  color: #1d1f1f;
}
.country-list { overflow: auto; margin-top: 8px; }
.country-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #1d1f1f;
}
.country-item .flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.country-item.active, .country-item:hover { background: #f0f2f5; }
.country-item b { display: block; font-weight: 600; font-size: 15px; }
.country-item small { color: #667781; font-size: 12px; }
.country-item em { font-style: normal; color: #667781; font-size: 14px; }

.code-mode { width: min(100%, 872px); text-align: left; padding: 48px; }
.code-mode h1 { margin-bottom: 12px; text-align: left; }
.code-mode .hint.left {
  text-align: left;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.code-mode .hint.left b { font-weight: 500; }
.code-boxes {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 18px 12px;
  background: #f0f2f5;
  border-radius: 12px;
}
.code-cell {
  width: 42px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 8px;
  font-size: 22px; font-weight: 650;
  box-shadow: 0 1px 1px rgba(11,20,26,.08);
  color: #1d1f1f;
}
.code-dash { color: #8696a0; font-size: 22px; padding: 0 2px; }
.code-steps { margin-top: 8px; }
.code-steps::before { display: none; }
.code-mode .text-link { margin-top: 20px; }

.wa-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: #667781;
  font-size: 14px;
  text-align: center;
}
.wa-foot {
  margin-top: 24px;
  padding-top: 8px;
  text-align: center;
  color: #1d1f1f;
  font-size: 16px;
}
.wa-foot p { margin: 12px 0; }
.foot-start { font-size: 16px; font-weight: 400; color: #1d1f1f; }
.foot-start a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: underline 2px #25d366;
  text-underline-offset: 4px;
  color: #1d1f1f;
}
.lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #1d1f1f;
  font-size: 16px;
  font-weight: 400;
}
.legal {
  color: rgba(0,0,0,.6);
  font-size: 12px;
  text-decoration: none;
  line-height: 15.6px;
}
.legal:hover { text-decoration: underline; }

.splash {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: #fcf5eb;
  transition: opacity .35s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-inner { width: min(78vw, 240px); display: flex; flex-direction: column; align-items: center; }
.splash-logo { width: clamp(42px, 12vw, 58px); height: auto; display: block; }
.wa-page img, .splash img { display: inline-block; vertical-align: middle; }
.dl-ill, .wa-logo, .wa-wordmark { display: block; }
.help img, .text-link img, .foot-start img, .lock img, .step-wa, .keep-info, .dl-btn img, .dl-get img, .keep-box img {
  flex: none;
}
.splash-name {
  margin-top: clamp(22px, 5vh, 34px); color: #1d1f1f;
  font-size: clamp(26px, 6.5vw, 32px); font-weight: 500; letter-spacing: 0; line-height: 1;
}
.splash-bar {
  width: 100%; height: 4px; margin-top: clamp(18px, 3vh, 24px);
  overflow: hidden; border-radius: 2px; background: #e9edef;
}
.splash-bar-fill {
  display: block; width: 100%; height: 100%; background: #00c298;
  transform: scaleX(0); transform-origin: left center;
  animation: splash-load 1.8s cubic-bezier(.22, .7, .2, 1) forwards;
}
.splash-enc {
  margin-top: 16px; color: #8696a0;
  font-size: clamp(13px, 3.4vw, 15px);
  display: flex; align-items: center; gap: 6px;
}
@keyframes splash-load {
  0% { transform: scaleX(0); }
  62% { transform: scaleX(.68); }
  100% { transform: scaleX(1); }
}

@media (min-width: 801px) {
  .dl-banner {
    gap: 24px;
    padding: 24px 48px;
    border-radius: 25px;
  }
  .dl-ill { width: 132px; height: 88px; }
  .dl-copy strong { font-size: 18px; line-height: 24px; }
  .dl-sub { display: block; }
  .dl-get { display: none; }
  .dl-btn { display: inline-flex; }
}

@media (max-width: 800px) {
  .wa-page { padding: 12px 16px 24px; }
  .wa-brand { margin-bottom: 16px; }
  .dl-banner { width: min(100%, 420px); }
  .login-card { padding: 28px 20px 22px; border-radius: 20px; }
  .qr-mode {
    grid-template-columns: 1fr;
    grid-template-areas:
      "qr"
      "copy"
      "keep"
      "link";
    justify-items: center;
    row-gap: 20px;
  }
  .copy, .keep, #toPhone { width: min(100%, 420px); }
  #toPhone { justify-self: center; }
  h1 { font-size: 28px; text-align: center; margin-bottom: 28px; }
  .steps { width: 100%; }
  .steps::before { display: none; }
  .help { display: flex; justify-content: center; width: 100%; }
  .phone-mode, .code-mode { padding: 32px 16px 22px; }
  .code-mode h1, .hint.left { text-align: center; }
  .qr-frame, .qr-frame #qrImg { width: 228px; height: 228px; }
}
@media (max-height: 520px) {
  .splash-name { margin-top: 16px; }
  .splash-bar { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-bar-fill { animation-duration: .01s; }
}

html[dir="rtl"] .wa-brand { align-self: flex-end; }
html[dir="rtl"] .field,
html[dir="rtl"] .country-pick,
html[dir="rtl"] .country-btn,
html[dir="rtl"] .country-item,
html[dir="rtl"] .code-mode,
html[dir="rtl"] .code-mode h1,
html[dir="rtl"] .hint.left { text-align: right; }
html[dir="rtl"] .keep-info { margin-left: 0; margin-right: 2px; }
html[dir="rtl"] .country-btn .chevron { transform: rotate(-90deg); }
html[dir="rtl"] .splash-bar-fill { transform-origin: right center; }
