/* Login, signup and password recovery share one account visual system.
   Authentication behavior remains in the individual pages. */
.login-page *, .login-page *::before, .login-page *::after { box-sizing: border-box; }
body.login-page {
  --login-accent: var(--auth-accent);
  --login-hover: var(--auth-hover);
  --login-rgb: var(--auth-rgb);
  --login-ink: var(--auth-ink);
  --login-body: var(--auth-body);
  --login-muted: var(--auth-muted);
  --login-tint: var(--auth-tint);
  --login-line: var(--auth-line);
  margin: 0; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  color: var(--login-ink); font: 400 16px/1.5 var(--t-ui);
  background: radial-gradient(ellipse at 10% 15%, var(--auth-tint), transparent 52%), var(--auth-wash);
}
.login-page :is(h1, p) { margin: 0; }
.login-page a { color: var(--login-accent); text-decoration: none; }
.login-page a:hover { text-decoration: underline; text-underline-offset: 3px; }
.login-page :where(button) { font: inherit; cursor: pointer; }
.login-page :is(a, button, input):focus-visible { outline: 2px solid var(--t-focus); outline-offset: 4px; }

/* The compact auth header keeps the same brand scale and gutters as the site. */
.login-page .site-header {
  flex: 0 0 auto; background: #fff;
  border-bottom: 1px solid var(--login-line);
}
.login-page .header-inner {
  max-width: 1200px; min-height: 88px; margin: 0 auto; padding: 12px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.login-page .brand { display: flex; flex-shrink: 0; }
.login-page .brand-logo { display: block; width: auto; height: 52px; }
.login-page .header-cta {
  display: flex; align-items: center; gap: 16px;
  color: var(--login-muted); font-size: 14px;
}
.login-page .header-cta a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 22px; border-radius: var(--t-r-pill);
  border: 1px solid #F1C2C3; background: var(--login-tint);
  font-weight: 600; white-space: nowrap;
  transition: background .15s ease;
}
.login-page .header-cta a:hover { background: #FFE3E1; text-decoration: none; }

.login-page main {
  flex: 1 0 auto; width: 100%; display: grid; place-items: center;
  padding: 56px 32px;
}
.login-page .auth-layout {
  display: grid; grid-template-columns: .9fr 1.1fr;
  width: 100%; max-width: 1016px;
  overflow: hidden; border: 1px solid var(--login-line); border-radius: 32px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(var(--login-rgb), .04), 0 24px 64px -36px rgba(var(--login-rgb), .3);
}
.login-page .auth-intro {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 52px 40px 220px;
  background: linear-gradient(150deg, #FFF5F4, #FFE3E1);
  border-right: 1px solid #F4D5D2;
}
.login-page .auth-intro::after {
  content: ""; position: absolute; z-index: -1;
  width: 400px; height: 270px; right: -24px; bottom: -40px;
  background: url("hanzi-home/hero-calligraphy.webp") center / contain no-repeat;
  opacity: .13; transform: rotate(-8deg); pointer-events: none;
}
.login-page .auth-intro-title {
  max-width: 340px; margin-bottom: 24px;
  color: var(--login-accent);
  font: 600 clamp(32px, 3.2vw, 42px)/1.16 var(--t-display); letter-spacing: -.035em;
}
.login-page .auth-intro-copy { max-width: 340px; color: var(--login-body); font-size: 17px; line-height: 1.7; }
.login-page .auth-card { min-width: 0; padding: 48px; background: #fff; }
.login-page .auth-head { margin-bottom: 28px; }
.login-page .eyebrow {
  display: inline-flex; padding: 6px 12px; margin-bottom: 16px;
  border: 1px solid #F4D5D2; border-radius: var(--t-r-pill);
  color: var(--login-accent); background: var(--login-tint);
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.login-page .auth-head h1 { font: 600 32px/1.2 var(--t-display); letter-spacing: -.035em; }

/* Both sign-in methods share one form surface. */
.login-page .mode-toggle {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 24px;
  border: 1px solid #F4D5D2; border-radius: var(--t-r-pill); background: var(--login-tint);
}
.login-page .mode-toggle button {
  flex: 1; min-height: 44px; padding: 10px; border: 0; border-radius: var(--t-r-pill);
  color: var(--login-muted); background: transparent; font-size: 14px; font-weight: 600;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.login-page .mode-toggle button.active {
  color: var(--login-accent); background: #fff;
  box-shadow: 0 2px 6px rgba(var(--login-rgb), .1);
}
.login-page .mode-toggle button:hover { color: var(--login-accent); }
.login-page .otp-mode { display: none; }
.login-page .otp-mode.active { display: block; }
.login-page .password-mode.hidden { display: none; }
.login-page .field { margin-bottom: 20px; }
.login-page .field label { display: block; margin-bottom: 8px; color: var(--login-body); font-size: 14px; font-weight: 600; }
.login-page .field input {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border: 1px solid #C9B8B6; border-radius: 14px;
  color: var(--login-ink); background: #fff; font: 400 16px/1.5 var(--t-ui);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-page .field input::placeholder { color: var(--login-muted); opacity: 1; }
.login-page .field input:hover { border-color: #A99592; }
.login-page .field input:focus { border-color: var(--login-accent); box-shadow: 0 0 0 3px rgba(var(--login-rgb), .1); }
.login-page .field-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
  margin: 4px 0 24px; font-size: 14px;
}
.login-page .remember-me { display: inline-flex; align-items: center; gap: 8px; color: var(--login-body); cursor: pointer; }
.login-page .remember-me input { margin: 0; width: 16px; height: 16px; accent-color: var(--login-accent); }
.login-page .forgot-link { font-weight: 500; }
.login-page .btn-primary {
  width: 100%; min-height: 50px; padding: 12px 20px;
  border: 1px solid var(--login-accent); border-radius: var(--t-r-pill);
  background: var(--login-accent); color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: 0 8px 18px -10px rgba(var(--login-rgb), .55);
  transition: background .15s ease, box-shadow .15s ease;
}
.login-page .btn-primary:not(:disabled):hover { background: var(--login-hover); box-shadow: 0 10px 22px -10px rgba(var(--login-rgb), .45); }
.login-page .btn-primary:disabled { opacity: .6; cursor: wait; }
.login-page .otp-note { margin-bottom: 24px; font-size: 14px; line-height: 1.65; color: var(--login-muted); overflow-wrap: anywhere; }
.login-page :is(.form-error, .form-info) { padding: 12px 14px; border: 1px solid; border-radius: 14px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.login-page .form-error { margin-bottom: 20px; color: var(--t-wrong-ink); background: var(--t-wrong-tint); border-color: var(--t-wrong-edge); }
.login-page .form-info { margin-top: 20px; color: var(--login-accent); background: var(--login-tint); border-color: #F4D5D2; }
.login-page :is(.form-error, .form-info):empty { display: none; }

/* Match the existing footer and feedback control to the login page palette. */
.login-page .site-footer { width: 100%; max-width: 1120px; padding: 24px 64px; margin: 0 auto; border-top: 1px solid var(--login-line); color: var(--login-muted); text-align: center; font: 400 13px/2 var(--t-ui); }
.login-page .site-footer :is(a, button.link-btn) { color: var(--login-accent); }
.login-page .site-footer :is(a, button.link-btn):hover { color: var(--login-hover); }
.login-page .site-footer .site-footer-sep { color: #B8A4A2; }
.login-page .mw-fb-fab { background: var(--login-accent); border-color: rgba(var(--login-rgb), .25); box-shadow: 0 8px 20px -8px rgba(var(--login-rgb), .5); }
.login-page .mw-fb-fab:hover { background: var(--login-hover); box-shadow: 0 10px 24px -8px rgba(var(--login-rgb), .5); }

@media (max-width: 900px) {
  .login-page .auth-intro { padding: 40px 28px 190px; }
  .login-page .auth-card { padding: 40px 32px; }
  .login-page .auth-head h1 { font-size: 28px; }
}
@media (max-width: 760px) {
  /* The footer offers the same feedback action without covering form fields. */
  .login-page .mw-fb-fab { display: none; }
  .login-page .header-inner { min-height: 76px; padding: 12px 24px; }
  .login-page .brand-logo { height: 44px; }
  .login-page main { padding: 32px 20px; }
  .login-page .auth-layout { grid-template-columns: 1fr; max-width: 500px; border-radius: 28px; }
  .login-page .auth-intro { padding: 28px 32px; border-right: 0; border-bottom: 1px solid #F4D5D2; }
  .login-page .auth-intro::after { display: none; }
  .login-page .auth-intro-title { margin-bottom: 12px; max-width: none; font-size: 30px; }
  .login-page .auth-intro-title br { display: none; }
  .login-page .auth-intro-copy { max-width: none; font-size: 15px; line-height: 1.6; }
  .login-page .auth-card { padding: 28px 32px 32px; }
}
@media (max-width: 480px) {
  .login-page .header-inner { min-height: 72px; padding: 12px 20px; }
  .login-page .brand-logo { height: 40px; }
  .login-page .header-cta { font-size: 0; gap: 0; }
  .login-page .header-cta a { min-height: 40px; padding: 8px 20px; font-size: 14px; }
  .login-page main { padding: 24px 16px 32px; }
  .login-page .auth-layout { border-radius: 24px; }
  .login-page .auth-intro { padding: 24px; }
  .login-page .auth-intro-title { font-size: 26px; }
  .login-page .auth-card { padding: 24px; }
  .login-page .auth-head { margin-bottom: 24px; }
  .login-page .auth-head h1 { font-size: 27px; }
  .login-page .site-footer { padding: 20px 52px 28px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page *, .login-page *::before, .login-page *::after { transition: none !important; }
}

/* Signup form details; the page frame and controls use the shared styles above. */
.signup-page .field { margin-bottom: 16px; }
.login-page .field-hint { margin-top: 8px; color: var(--login-muted); font-size: 13px; line-height: 1.5; }
.login-page .strength { display: flex; gap: 6px; margin-top: 8px; height: 6px; }
.login-page .strength span { flex: 1; border-radius: var(--t-r-pill); background: var(--login-line); transition: background .15s ease; }
.login-page .strength.weak span:nth-child(1) { background: var(--t-warning-mark); }
.login-page .strength.medium span:nth-child(-n+2) { background: var(--t-gold-ink); }
.login-page .strength.strong span { background: var(--t-action-fill); }
.signup-page .agree { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 24px; color: var(--login-body); font-size: 14px; line-height: 1.6; }
.signup-page .agree input { flex: 0 0 16px; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--login-accent); cursor: pointer; }
.signup-page .agree a { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 761px) {
  .signup-page main { padding-block: 40px; }
  .signup-page .auth-card { padding-block: 36px; }
}

/* Recovery has four existing views, all within the same account card. */
.recovery-page { --green: var(--t-correct-ink); --red: var(--t-wrong-ink); --muted: var(--auth-muted); }
.recovery-page .step-view { display: none; }
.recovery-page .step-view.active { display: block; }
.recovery-page .stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.recovery-page .step-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--auth-tint); color: var(--auth-muted); font-size: 13px; font-weight: 600; }
.recovery-page .step-dot.active { background: var(--auth-accent); color: #fff; box-shadow: 0 4px 10px -4px rgba(var(--auth-rgb), .3); }
.recovery-page .step-dot.done { background: var(--auth-tint-2); color: var(--auth-accent); }
.recovery-page .step-dot.done::after { content: "✓"; }
.recovery-page .step-dot.done > span { display: none; }
.recovery-page .step-line { width: 32px; height: 2px; background: var(--auth-line); }
.recovery-page .step-line.done { background: var(--auth-accent); }
.recovery-page :is(.icon-block, .success-icon) { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 20px; border: 1px solid #F4D5D2; border-radius: 18px; color: var(--auth-accent); background: var(--auth-tint); }
.recovery-page :is(.icon-block, .success-icon) svg { width: 26px; height: 26px; }
.recovery-page .auth-head p { margin-top: 12px; color: var(--auth-muted); font-size: 15px; line-height: 1.65; }
.recovery-page .email-tag { display: inline-block; max-width: 100%; padding: 3px 8px; margin-top: 8px; border-radius: 8px; color: var(--auth-accent); background: var(--auth-tint); overflow-wrap: anywhere; }
.recovery-page .btn-ghost { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; margin-top: 12px; padding: 10px 16px; border: 1px solid var(--auth-line); border-radius: var(--t-r-pill); background: #fff; color: var(--auth-accent); font-size: 14px; font-weight: 500; }
.recovery-page .btn-ghost:hover { background: var(--auth-tint); }
.recovery-page .resend-block { padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--auth-line); text-align: center; color: var(--auth-muted); font-size: 14px; }
.recovery-page .resend-block button { padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--auth-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.recovery-page .resend-block button:hover { background: var(--auth-tint); }
.recovery-page .resend-block button:disabled { color: var(--auth-muted); cursor: wait; }
