:root {
  --bg: #040812;
  --bg-soft: #071225;
  --panel: rgba(13, 25, 47, 0.74);
  --text: #f4f8ff;
  --muted: #9aa9c3;
  --blue: #2f80ff;
  --blue-press: #2a73e6;
  --cyan: #5ce1ff;
  --border: rgba(255, 255, 255, 0.14);
  --field: rgba(255, 255, 255, 0.03);
  --danger: #ff6b6b;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 8%, rgba(47, 128, 255, 0.22), transparent 34%),
    radial-gradient(circle at 84% 14%, rgba(92, 225, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #040812 0%, #050915 42%, #02040a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  width: min(460px, calc(100% - 40px));
  margin: 22px auto 0;
  display: flex;
  align-items: center;
}
.back-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s ease;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.1); }

.wrap {
  flex: 1;
  width: min(460px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 28px 0 48px;
}

.card { width: 100%; }

.step { display: none; }
.step.active { display: block; animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 {
  font-size: clamp(2.1rem, 7vw, 2.8rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.subtitle { margin-top: 10px; color: var(--muted); font-size: 1.02rem; }

.fields { margin-top: 34px; display: flex; flex-direction: column; gap: 18px; }

.field {
  position: relative;
  display: flex;
  align-items: center;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.18);
}
.field input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.05rem;
  padding: 0 16px;
}
.field input::placeholder { color: var(--muted); }

.field .lead-icon {
  display: grid; place-items: center;
  width: 48px; color: var(--muted);
  font-size: 1.1rem;
}

/* country picker */
.phone-field { padding-left: 6px; }
.country-trigger {
  display: flex; align-items: center; gap: 7px;
  height: 46px; margin: 0 4px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--blue);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.country-trigger .flag { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; }
.country-trigger .caret { color: var(--muted); font-size: 0.7rem; margin-left: 1px; }

.country-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: 320px;
  display: none;
  flex-direction: column;
  background: #0a1426;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 40;
}
.country-menu.open { display: flex; }
.country-menu .search {
  height: 46px; margin: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
.country-list { overflow-y: auto; padding: 4px 6px 8px; }
.country-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
  font-size: 0.96rem;
}
.country-row:hover { background: rgba(255, 255, 255, 0.06); }
.country-row .flag { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; flex: 0 0 24px; }
.country-row .cn { flex: 1; }
.country-row .cd { color: var(--muted); }

/* password eye */
.pw-toggle {
  width: 50px; height: 100%;
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.pw-toggle svg { width: 22px; height: 22px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.revealed .eye-on { display: none; }
.pw-toggle.revealed .eye-off { display: block; }

/* primary button */
.primary-btn {
  width: 100%;
  height: 58px;
  margin-top: 28px;
  border: none;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.12s ease, opacity 0.2s ease;
}
.primary-btn:hover { background: var(--blue-press); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn.loading, .primary-btn:disabled { opacity: 0.7; cursor: default; }

.alt-line { margin-top: 22px; text-align: center; color: var(--muted); }
.error {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--danger);
  font-size: 0.92rem;
}
.error.show { display: block; }

.agreement {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* OTP */
.otp-sub { margin-top: 12px; color: var(--muted); line-height: 1.6; }
.otp-sub strong { color: var(--text); }
.otp-inputs {
  margin-top: 34px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.otp-box {
  flex: 1;
  min-width: 0;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.otp-box:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.18);
}

.foot {
  width: min(460px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 26px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 420px) {
  .otp-box { height: 56px; font-size: 1.3rem; }
}
