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

:root {
  --blue:    #2AABEE;
  --blue-d:  #1a8fc5;
  --bg:      #0d1117;
  --card:    #161b22;
  --border:  rgba(255,255,255,0.08);
  --text:    #f0f6fc;
  --muted:   #8b949e;
  --err:     #f85149;
  --ok:      #3fb950;
  --radius:  16px;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  overflow: hidden;
}

/* ── Background orbs ── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 12s ease-in-out infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(42,171,238,0.18) 0%, transparent 70%);
  top: -150px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(100,60,240,0.12) 0%, transparent 70%);
  bottom: -100px; right: -80px;
  animation-delay: -4s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(42,171,238,0.08) 0%, transparent 70%);
  bottom: 30%; left: 60%;
  animation-delay: -8s;
}
@keyframes orb-drift {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(30px) scale(1.05); }
}

/* ── Wrap + Card ── */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
  position: relative;
  min-height: 480px;
}

/* ── Steps ── */
.step {
  display: none;
  flex-direction: column;
  animation: step-in 0.35s cubic-bezier(.22,.68,0,1.2) both;
}
.step.active { display: flex; }
.step.slide-out {
  animation: step-out 0.25s ease-in both;
}
@keyframes step-in {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes step-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-28px); }
}

/* ── Logo ── */
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}

.sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}
.sub strong { color: var(--text); font-weight: 600; }

/* ── Fields ── */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px 8px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.field input:focus {
  border-color: var(--blue);
  background: rgba(42,171,238,0.05);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.12);
}
.field.has-err input {
  border-color: var(--err);
  background: rgba(248,81,73,0.05);
}
.field.has-err input:focus {
  box-shadow: 0 0 0 3px rgba(248,81,73,0.12);
}

.field label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transition: top 0.18s, font-size 0.18s, color 0.18s, transform 0.18s;
}
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label {
  top: 10px;
  transform: none;
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.field.has-err input:not(:placeholder-shown) ~ label,
.field.has-err input:focus ~ label { color: var(--err); }

.field-err {
  display: block;
  font-size: 12px;
  color: var(--err);
  margin-top: 5px;
  padding-left: 4px;
  min-height: 16px;
}

/* ── Eye button ── */
.eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.eye:hover { color: var(--text); }

/* ── Password strength ── */
.strength-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}
.strength-wrap.visible { opacity: 1; }

.strength-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.3s, background 0.3s;
}
.strength-label {
  font-size: 11px;
  color: var(--muted);
  min-width: 60px;
  text-align: right;
}

/* ── Global error ── */
.global-err {
  font-size: 13px;
  color: var(--err);
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}
.global-err.show { display: block; }

.global-ok {
  font-size: 13px;
  color: #3fb950;
  background: rgba(63,185,80,0.1);
  border: 1px solid rgba(63,185,80,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}
.global-ok.show { display: block; }

/* ── Buttons ── */
.btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(42,171,238,0.35);
  position: relative;
  overflow: hidden;
}
.btn:hover:not(:disabled) {
  background: var(--blue-d);
  box-shadow: 0 6px 28px rgba(42,171,238,0.45);
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn.loading span { opacity: 0; }
.btn.loading .spin { opacity: 1; }

/* Ripple */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn:active:not(:disabled)::after { opacity: 1; }

.spin {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0;
  transition: opacity 0.2s;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer link ── */
.foot {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
}
.foot a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}
.foot a:hover { text-decoration: underline; }

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 24px;
  transition: color 0.2s;
  align-self: flex-start;
}
.back-btn:hover { color: var(--text); }

/* ── Mail icon ── */
.mail-icon {
  width: 72px; height: 72px;
  background: rgba(42,171,238,0.1);
  border: 1.5px solid rgba(42,171,238,0.25);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

/* ── Code row ── */
.code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.box {
  width: 48px; height: 56px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  caret-color: transparent;
  -webkit-appearance: none;
}
.box:focus {
  border-color: var(--blue);
  background: rgba(42,171,238,0.06);
  box-shadow: 0 0 0 3px rgba(42,171,238,0.14);
}
.box.filled {
  border-color: rgba(42,171,238,0.4);
  color: var(--blue);
}
.box.err { border-color: var(--err); animation: shake 0.4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.code-sep {
  width: 12px; height: 2px;
  background: var(--border);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Resend ── */
.resend-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  margin-top: 14px;
  padding: 8px;
  align-self: center;
  transition: color 0.2s;
  border-radius: 8px;
}
.resend-btn:not(:disabled):hover { color: var(--blue); background: rgba(42,171,238,0.08); }
.resend-btn:disabled { cursor: default; }

/* ── Success ── */
.check-wrap {
  width: 88px; height: 88px;
  margin: 0 auto 28px;
}
.check-svg { width: 100%; height: 100%; }
.check-circle {
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: draw-circle 0.5s ease-out 0.1s forwards;
}
.check-mark {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: draw-mark 0.4s ease-out 0.5s forwards;
}
@keyframes draw-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes draw-mark {
  to { stroke-dashoffset: 0; }
}

#s3 { text-align: center; padding-top: 20px; }
#s3 h1 { margin-bottom: 8px; }
#s3 .sub { margin-bottom: 32px; }
#done-btn { max-width: 260px; margin: 0 auto; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 32px 24px; border-radius: 20px; }
  h1 { font-size: 22px; }
  .box { width: 42px; height: 50px; font-size: 20px; }
  .code-row { gap: 6px; }
}
