/* Auth — log in / sign up: email → code → username, one page, three steps */

.page-auth .page { gap: 0; padding-bottom: 0; min-height: var(--app-h); }

.auth { position: relative; flex: 1; display: flex; flex-direction: column; isolation: isolate; overflow: hidden; overflow: clip; }
.auth__glow { position: absolute; z-index: -1; left: 50%; top: -180px; width: 560px; height: 480px; margin-left: -280px; border-radius: 50%; background: radial-gradient(closest-side, rgba(198,42,32,.38), rgba(198,42,32,0)); pointer-events: none; }
.auth__card { position: relative; flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 520px; margin: 0 auto; }

/* ---------- Top bar: back + sign-up progress ---------- */
.auth__bar { display: flex; align-items: center; gap: 8px; height: calc(var(--bar-h) + var(--safe-t)); padding: var(--safe-t) 16px 0 4px; }
.auth__progress { flex: 1; display: flex; gap: 6px; }
.auth__progress li { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--gold); }
.auth__progress li.is-current { opacity: .45; }
.auth__progress li.is-todo { background: var(--line); }
.auth__count { font-size: 14px; font-weight: 600; color: var(--tx3); white-space: nowrap; }

/* ---------- Steps ---------- */
.auth__step { flex: 1; display: flex; flex-direction: column; padding: 8px 20px calc(24px + var(--safe-b)); animation: sbl-fade var(--dur-3) var(--ease) both; }
.auth__head { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth__title { margin-top: 18px; font-family: var(--disp); font-weight: 400; font-size: 36px; line-height: 1.1; outline: none; }
.auth__lede { margin-top: 8px; font-size: 17px; line-height: 1.5; color: var(--tx2); }
.auth__head .auth__lede { max-width: 310px; }
.auth__lede b { color: var(--tx); font-weight: 700; overflow-wrap: anywhere; }
.auth__foot { margin-top: auto; padding-top: 24px; }

.auth .label { margin-bottom: 0; }
.auth .field { min-height: 56px; font-size: 17px; }
.auth .help { margin-top: 0; align-items: flex-start; }
.auth .help svg { flex: none; margin-top: 3px; }
.auth .btn[aria-busy="true"] svg { display: none; }

/* Step 1 · email */
.auth__form { display: flex; flex-direction: column; }
.auth__form--email { gap: 8px; margin-top: 32px; }
.auth__form--email .btn { margin-top: 4px; }
.auth__note { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 14px 16px; border-radius: 16px; background: var(--s1); border: 1px solid var(--line2); font-size: 15px; line-height: 1.45; color: var(--tx2); }
.auth__note svg { flex: none; margin-top: 1px; color: var(--gold-ink); }
.auth__note b { color: var(--tx); font-weight: 700; }
.auth__legal { font-size: 14px; line-height: 1.5; color: var(--tx3); text-align: center; }
.auth__legal a { color: var(--gold-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Step 2 · code */
.auth__badge { width: 72px; height: 72px; border-radius: 22px; background: var(--gold-soft); color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; }
.auth__step--code .auth__title { margin-top: 20px; }
.auth__change { display: inline; padding: 6px 2px; margin: -6px 0; color: var(--gold-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth__flag { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); font-size: 15px; line-height: 1.45; color: var(--tx); }
.auth__form--code { margin-top: 28px; }
.auth__form--code .otp { margin-top: 8px; }
.auth .otp__box { height: 62px; font-size: 28px; color: var(--tx); }
.auth .otp.is-focused:not(.is-error) .otp__box:not(:empty) { border-color: var(--gold-line); }
.auth .otp.is-error .otp__box { border: 2px solid var(--danger); box-shadow: none; }
.auth .otp.is-ok .otp__box { border: 2px solid var(--ok); box-shadow: none; }
.auth .otp__input:focus-visible { outline: none; }
.otp.is-shake { animation: auth-shake 360ms var(--ease) both; }
@keyframes auth-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.auth__msg { min-height: 24px; margin-top: 10px !important; font-size: 15px; font-weight: 600; }
.auth__form--code .btn { margin-top: 14px; }
.auth__resend { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 14px; }
.auth__wait { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--tx3); }
.auth__wait b { font-weight: 700; color: var(--tx2); font-variant-numeric: tabular-nums; }
.auth__tip { padding: 14px 16px; border-radius: 16px; background: var(--s1); border: 1px solid var(--line2); font-size: 14px; line-height: 1.5; color: var(--tx2); }

/* Step 3 · username */
.auth__step--profile .auth__title { margin-top: 4px; }
.auth__form--profile { flex: 1; margin-top: 26px; }
.auth__ufield { min-height: 56px; margin-top: 8px; padding: 0 14px 0 16px; }
.auth__ufield input { height: 52px; font-size: 17px; }
.auth__ufield input::placeholder { color: var(--tx3); }
.auth__at { font-size: 17px; color: var(--tx3); }
.auth__ustate { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; color: var(--ok); }
.auth__ufield.is-ok, .auth__ufield.is-bad { padding-left: 15.5px; }
.auth__umsg { margin-top: 8px !important; font-weight: 600; }
.auth__suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.auth__suggest .chip { padding: 0 12px; font-size: 15px; font-weight: 600; }
.auth__hint { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--tx3); overflow-wrap: anywhere; }
.auth__hint b { font-weight: 700; color: var(--tx2); }
.auth__names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.auth__names > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.auth__names .label span { font-weight: 500; color: var(--tx3); }
.auth__names .field { min-width: 0; padding: 0 14px; }
.auth__perr { margin-bottom: 10px; }

/* ---------- Tablet + desktop: a centred card ---------- */
@media (min-width: 640px) {
  .page-auth .page { min-height: 0; }
  .auth { justify-content: center; padding: 48px 16px 72px; }
  .auth__glow { top: -160px; width: 980px; height: 720px; margin-left: -490px; }
  .auth__card { flex: none; padding: 8px 16px 12px; border-radius: 28px; background: var(--s1); border: 1px solid var(--line2); box-shadow: var(--e2); }
  .auth__bar { height: var(--bar-h); padding-top: 0; }
  .auth__step { padding-bottom: 24px; }
  .auth__note, .auth__tip { background: var(--s2); border-color: var(--line); }
  .auth__foot { padding-top: 32px; }
}
@media (min-width: 1024px) {
  .auth[data-current="email"] .auth__bar { visibility: hidden; height: 24px; }
}
