* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(760px 520px at 7% -8%, color-mix(in srgb, var(--color-accent) 16%, transparent), transparent 70%),
    radial-gradient(680px 480px at 100% 82%, color-mix(in srgb, var(--color-accent) 10%, transparent), transparent 72%),
    var(--canvas);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  line-height: 1.5;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.auth-shell { width: min(1100px, calc(100% - 48px)); margin: 0 auto; }
.auth-topbar {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(209, 221, 239, .8);
}
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--blue); text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 15px; letter-spacing: -.04em; }
.brand small { color: var(--muted); font-size: 10px; }
.brand-mark {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 1px solid var(--color-accent-border);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--color-surface-elevated), var(--color-accent-soft));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.brand-mark svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.back-link { color: #617694; font-size: 13px; font-weight: 650; text-decoration: none; }
.back-link span { color: var(--blue); }

main {
  display: grid;
  min-height: calc(100vh - 75px);
  grid-template-columns: minmax(0, 1fr) minmax(390px, 440px);
  gap: clamp(54px, 9vw, 120px);
  align-items: center;
  padding: 62px 5% 82px;
}
.auth-intro { align-self: start; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 760; letter-spacing: .12em; }
.auth-intro h1 { margin: 18px 0 0; font-size: clamp(42px, 5.2vw, 66px); font-weight: 680; letter-spacing: -.065em; line-height: 1.02; }
.auth-intro h1 span { color: var(--blue); }
.auth-intro > p:not(.eyebrow) { max-width: 520px; margin: 24px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.security-note { display: flex; gap: 12px; align-items: center; margin-top: 32px; }
.security-note i { width: 9px; height: 9px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 5px var(--color-accent-soft); }
.security-note span { display: grid; }
.security-note strong { font-size: 13px; }
.security-note small { color: var(--muted); font-size: 11px; }

.account-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 20px 58px rgba(43, 78, 128, .1);
}
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: #f2f6fb; }
.mode-tabs button { min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 680; }
.mode-tabs button[aria-selected="true"] { background: var(--color-surface-elevated); color: var(--color-accent-hover); box-shadow: 0 3px 12px color-mix(in srgb, var(--color-accent) 12%, transparent); }
.form-heading { margin: 27px 0 23px; }
.form-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.form-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.provider-login { display: grid; gap: 10px; }
.provider-button {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #d7e2ef;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 140ms ease;
}
.provider-button:hover:not(:disabled) { border-color: var(--color-accent-border); box-shadow: 0 7px 20px color-mix(in srgb, var(--color-accent) 10%, transparent); }
.provider-button:active:not(:disabled) { transform: scale(.985); }
.provider-button:disabled { cursor: not-allowed; opacity: .5; }
.provider-mark { display: grid; width: 22px; place-items: center; font-size: 18px; font-weight: 760; }
.provider-google .provider-mark { color: #4285f4; }
.provider-apple .provider-mark { color: #111; font-size: 21px; }
.auth-divider {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 20px 0;
  color: var(--faint);
  font-size: 10px;
}
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
form { display: grid; gap: 17px; }
label { display: grid; gap: 7px; color: #4e6079; font-size: 13px; font-weight: 650; }
label small { color: var(--faint); font-weight: 500; }
.login-password-heading { display: flex; align-items: center; justify-content: space-between; }
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}
.text-button:hover { color: var(--blue-deep); }
.reset-back { min-height: 32px; justify-self: center; }
.captcha-field { display: grid; gap: 6px; font-weight: 500; }
.captcha-inline {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 110px 62px;
  gap: 8px;
  align-items: start;
}
#captcha-image, #reset-captcha-image {
  width: 100%;
  height: 45px;
  border: 1px solid #d7e2ef;
  border-radius: 9px;
  background: #f3f7fc;
  object-fit: fill;
  cursor: pointer;
}
#captcha-image:focus-visible, #reset-captcha-image:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}
#captcha-image[aria-disabled="true"], #reset-captcha-image[aria-disabled="true"] { cursor: default; }
#captcha-image[aria-busy="true"], #reset-captcha-image[aria-busy="true"] { cursor: wait; }
.captcha-verify {
  border: 1px solid #cdddf4;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}
.captcha-verify { min-height: 45px; }
.captcha-verify:disabled { cursor: wait; opacity: .58; }
#captcha-status, #reset-captcha-status { color: var(--faint); }
#captcha-status.success, #reset-captcha-status.success { color: var(--success); }
#captcha-status.error, #reset-captcha-status.error { color: var(--danger); }
input {
  width: 100%;
  min-width: 0;
  height: 45px;
  padding: 0 13px;
  border: 1px solid #d7e2ef;
  border-radius: 9px;
  background: #fbfdff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
input:focus { border-color: var(--color-border-focus); background: var(--color-surface-elevated); box-shadow: 0 0 0 3px var(--color-focus-ring); outline: 0; }
input::placeholder { color: #a7b2c1; }
.code-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.code-button {
  min-width: 110px;
  border: 1px solid #cdddf4;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}
.code-button:disabled { cursor: default; color: var(--faint); background: #f4f6f9; }
.primary-button, .secondary-button {
  display: grid;
  min-height: 45px;
  place-items: center;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 720;
  text-decoration: none;
}
.primary-button { border: 1px solid var(--color-accent); background: var(--color-accent); color: var(--color-accent-contrast); box-shadow: 0 9px 20px color-mix(in srgb, var(--color-accent) 22%, transparent); }
.primary-button:hover { border-color: var(--blue-deep); background: var(--blue-deep); }
.primary-button:disabled { cursor: wait; opacity: .62; }
.secondary-button { width: 100%; border: 1px solid #d7e2ef; background: #fff; color: var(--muted); }
.form-message { margin: 0; padding: 9px 11px; border-radius: 8px; background: #fff0f1; color: var(--danger); font-size: 12px; font-weight: 500; }
.form-message.success { background: #edf9f4; color: var(--success); }
.terms { margin: -4px 0 0; color: var(--faint); font-size: 10px; line-height: 1.6; text-align: center; }
.terms a { color: inherit; font-weight: 600; text-underline-offset: 2px; }
.signed-in { display: grid; justify-items: center; padding: 24px 4px 8px; text-align: center; }
.signed-in-mark { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; background: #edf9f4; color: var(--success); font-size: 22px; }
.signed-in p { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.signed-in h2 { max-width: 100%; margin: 6px 0 24px; overflow-wrap: anywhere; font-size: 22px; }
.signed-in .link-button, .signed-in .secondary-button { width: 100%; }
.signed-in .secondary-button { margin-top: 10px; }

.toast { position: fixed; z-index: 110; right: 22px; bottom: 22px; max-width: min(340px, calc(100% - 44px)); padding: 11px 14px; border: 1px solid #d4e0ef; border-radius: 10px; background: rgba(255, 255, 255, 0.97); box-shadow: 0 16px 42px rgba(38, 59, 91, 0.18); color: #526985; font-size: 11px; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(8px) scale(0.98); transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }

@media (max-width: 820px) {
  main { grid-template-columns: 1fr; gap: 34px; padding: 54px 0 70px; }
  .auth-intro { text-align: center; }
  .auth-intro > p:not(.eyebrow) { margin-inline: auto; }
  .security-note { justify-content: center; text-align: left; }
  .account-card { width: min(100%, 480px); margin: 0 auto; }
}
@media (max-width: 540px) {
  .auth-shell { width: min(100% - 28px, 480px); }
  .auth-topbar { min-height: 64px; }
  .back-link { font-size: 11px; }
  main { min-height: auto; padding-top: 42px; }
  .auth-intro h1 { font-size: 40px; }
  .auth-intro > p:not(.eyebrow), .security-note { display: none; }
  .account-card { padding: 22px 17px; border-radius: 17px; }
  .code-field { grid-template-columns: minmax(0, 1fr) 104px; }
  .code-button { min-width: 0; font-size: 11px; }
  .captcha-inline { grid-template-columns: minmax(0, 1fr) 100px 54px; gap: 6px; }
  #captcha-image, #reset-captcha-image { height: 45px; }
  .toast { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
