:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
  color: #303133;
  background: #f4edf1;
  --card-width: 480px;
  --login-top-trim: 32px;
  --stage-height: 724px;
  --stage-padding: clamp(24px, 6svh, 51px);
  --blue: #3478ff;
  --muted: #74859d;
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --exit-duration: 200ms;
  --enter-duration: 260ms;
  --enter-delay: 150ms;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 240px; min-height: 100%; }
body { -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.auth-stage {
  position: relative;
  min-height: max(100svh, calc(var(--stage-height) + 2 * var(--stage-padding)));
  padding: var(--stage-padding) 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #f4edf1 url('./assets/auth-background.png') center / cover no-repeat;
  isolation: isolate;
}
.auth-card { position: relative; width: min(var(--card-width), 100%); height: var(--stage-height); flex: none; }
.auth-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--panel-height);
  border-radius: 12px;
  background: #fff;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
}
.auth-panel[data-view="login"] {
  --panel-height: calc(509px - var(--login-top-trim));
  top: var(--login-top-trim);
  border-radius: 12px;
}
.auth-panel[data-view="register"] { --panel-height: 723px; }
.auth-stage--email-code { --stage-height:816px; }
.auth-stage--email-code .auth-panel[data-view="register"] { --panel-height:815px; }
.auth-panel[data-view="recovery"] { --panel-height: 697px; }
.auth-panel[data-state="active"] { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.auth-panel[data-state="leaving"] {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--exit-duration) var(--smooth), transform var(--exit-duration) var(--smooth), visibility 0s linear var(--exit-duration);
}
.auth-panel[data-state="entering"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity var(--enter-duration) var(--smooth) var(--enter-delay), transform var(--enter-duration) var(--smooth) var(--enter-delay), visibility 0s linear;
}
.auth-stage[data-transitioning="true"] .auth-panel { will-change: opacity, transform; }
.auth-form { margin: 0; padding: 40px 41px; font-size: 14px; }
.login-form { padding-top: calc(40px - var(--login-top-trim)); }
.form-header { text-align: center; }
.form-header h1 { margin: 0; color: #242628; font-size: 24px; line-height: 32px; font-weight: 700; }
.form-header--login { padding-top: 32px; }
.form-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 20px; }
.text-link { display: inline; margin: 0; padding: 0; border: 0; border-radius: 2px; background: transparent; color: var(--blue); line-height: inherit; font-size: inherit; font-weight: 600; cursor: pointer; }
.text-link:hover { color: #2465eb; }
.text-link:active { color: #1753ca; }
.text-link:disabled { cursor: default; }
.text-link, .code-button {
  font-family: Inter, "Noto Sans SC", sans-serif;
  font-synthesis: weight style small-caps;
  font-size: 14px;
  font-weight: 600;
}
.form-divider { display: flex; align-items: center; gap: 24px; height: 20px; margin: 32px 0 29px; color: #8b98aa; line-height: 20px; }
.form-divider::before, .form-divider::after { content: ""; height: 1px; flex: 1; background: #edf0f6; }
.field-stack { display: flex; flex-direction: column; gap: 28px; }
.auth-field { width: 100%; min-width: 0; }
.field-heading { display: flex; align-items: center; justify-content: space-between; min-height: 20px; margin-bottom: 4px; font-size: 14px; line-height: 20px; }
.input-shell { position: relative; height: 48px; }
.auth-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #e9edf5;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #495365;
  font-size: 14px;
  line-height: normal;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.auth-input::placeholder { color: #8b99ad; opacity: 1; }
.auth-input:focus { border-color: #b6c1d3; box-shadow: 0 0 0 2px rgb(136 149 174 / 7%); }
.auth-input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px #fff inset; -webkit-text-fill-color: #495365; }
.input-shell--password .auth-input { padding-right: 48px; }
.password-toggle { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; padding: 12px; display: grid; place-items: center; border: 0; border-radius: 4px; color: #93a0b3; background: transparent; cursor: pointer; }
.password-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle:hover { color: #6f7e93; }
.form-options { display: flex; align-items: center; gap: 4px; min-height: 20px; margin-top: 24px; color: var(--muted); line-height: 20px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input { appearance: none; position: relative; margin: 0; width: 16px; height: 16px; flex: none; border: 1px solid #e9edf5; border-radius: 3px; background: #fff; cursor: pointer; }
.checkbox-label input:checked { background: var(--blue); border-color: var(--blue); }
.checkbox-label input:checked::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.form-actions, .back-actions { display: flex; justify-content: center; align-items: center; height: 48px; margin-top: 24px; }
.back-actions { margin-top: 16px; }
.circle-arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  padding: 0;
  border: 1px solid #dce0e7;
  border-radius: 50%;
  background: #fff;
  color: #a9aebb;
  box-shadow: 0 4px 9px -6px rgb(50 58 74 / 16%);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.circle-arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.circle-arrow:hover { border-color: #bfc5d1; color: #8992a2; }
.circle-arrow:active { background: #fafbfc; }
.circle-arrow:disabled { cursor: default; }
.recovery-form .form-subtitle { line-height: 21px; }
.recovery-form { padding-bottom: 34px; }
.recovery-form .field-stack { margin-top: 34px; }
.recovery-form .form-actions { margin-top: 23px; }
.input-shell--code .auth-input { padding-right: 78px; }
.code-button { position: absolute; top: 0; right: 0; height: 48px; min-width: 62px; padding: 0 16px; border: 1px solid var(--blue); border-radius: 0 4px 4px 0; background: var(--blue); color: #fff; cursor: pointer; }
.code-button:hover { background: #286bea; border-color: #286bea; }
.code-button:active { background: #1e5ed9; border-color: #1e5ed9; }
button:focus-visible, input[type="checkbox"]:focus-visible { outline: 2px solid #b5c0d3; outline-offset: 3px; }
.terms-dialog { width: min(380px, calc(100vw - 40px)); padding: 28px; border: 0; border-radius: 12px; color: #303133; }
.terms-dialog::backdrop { background: rgb(34 39 49 / 28%); }
.terms-dialog h2 { margin: 0 0 16px; font-size: 20px; }
.terms-dialog p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.dialog-close { display: block; margin: 24px 0 0 auto; padding: 6px 16px; border: 1px solid #dce0e7; border-radius: 4px; background: #fff; color: #556176; cursor: pointer; }
.preview-status { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px; text-align: center; color: #74859d; }
.preview-status p { margin: 6px 0; }
@media (max-width: 520px) {
  .auth-form { padding-inline: 24px; }
  .form-header h1 { font-size: 22px; }
  .recovery-form .form-subtitle { font-size: 13px; }
}
@media (max-width: 360px) {
  .auth-form { padding-inline: 18px; }
  .form-subtitle { font-size: 13px; }
  .auth-input { padding-left: 12px; font-size: 13px; }
  .auth-panel[data-view="recovery"] { --panel-height: 720px; }
}
@media (max-width: 280px) {
  :root { --stage-height: 784px; }
  .auth-panel[data-view="recovery"] { --panel-height: 780px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-panel[data-state] { transition: none; transform: none; }
  .auth-input, button { transition: none; }
}
/* Account service feedback stays outside the fixed reference form geometry. */
.auth-feedback { position:fixed; z-index:250; bottom:22px; left:50%; transform:translateX(-50%); max-width:calc(100vw - 32px); padding:12px 18px; border:1px solid #efc5c5; border-radius:8px; background:#fff6f6; color:#995151; font:14px/1.7 Inter,"Noto Sans SC",sans-serif; }
.auth-feedback[data-tone="success"] { background:#f3fff7; border-color:#bde2c8; color:#477658; }
@media (max-width: 600px) {
  .auth-feedback { position:relative; inset:auto; transform:none; width:fit-content; margin:12px auto 24px; }
}
