:root {
  --auth-bg: #f4f5f7;
  --auth-card: #ffffff;
  --auth-text: #111827;
  --auth-muted: rgba(17, 24, 39, 0.55);
  --auth-muted-strong: rgba(17, 24, 39, 0.68);
  --auth-line: rgba(17, 24, 39, 0.12);
  --auth-primary: #2563eb;
  --auth-primary-hover: #1d4ed8;
  --auth-primary-soft: rgba(37, 99, 235, 0.08);
  --auth-danger: #dc2626;
  --auth-success: #059669;
  --auth-shadow: 0 18px 50px rgba(17, 24, 39, 0.08), 0 2px 8px rgba(17, 24, 39, 0.04);
}

.auth-page {
  min-width: 320px;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-family: "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.auth-page a,
.auth-page .auth-link {
  color: var(--auth-primary);
}

.auth-page .skip-link {
  color: var(--auth-primary);
}

.auth-page :focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.34);
  outline-offset: 2px;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(24px, 4vh, 44px) 24px 32px;
}

.auth-stage {
  width: min(100%, 400px);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--auth-text);
}

.auth-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.auth-brand span {
  font-family: "Noto Serif SC", ui-serif, Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.auth-panel {
  display: block;
  width: 100%;
  padding: 24px 24px 20px;
  border: 1px solid var(--auth-line);
  border-radius: 14px;
  background: var(--auth-card);
  box-shadow: var(--auth-shadow);
}

.auth-heading {
  margin-bottom: 16px;
}

.auth-heading h1 {
  margin: 0;
  color: var(--auth-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.auth-heading p {
  margin: 5px 0 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-method-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background: #f8fafc;
}

.auth-method-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--auth-muted-strong);
  font-size: 13px;
  font-weight: 500;
}

.auth-method-tabs button:hover {
  color: var(--auth-primary);
  background: rgba(37, 99, 235, 0.04);
}

.auth-method-tabs button.active {
  background: var(--auth-primary-soft);
  color: var(--auth-primary);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--auth-muted-strong);
  font-size: 12px;
  font-weight: 500;
}

.auth-code-group {
  display: grid;
  gap: 6px;
}

.auth-code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
}

.auth-code-field input {
  min-width: 0;
}

.auth-code-send {
  padding: 0 10px;
  white-space: nowrap;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-form input {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  background: #fff;
  color: var(--auth-text);
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-form input::placeholder {
  color: rgba(17, 24, 39, 0.34);
}

.auth-form input:hover {
  border-color: rgba(17, 24, 39, 0.22);
}

.auth-form input:focus {
  border-color: rgba(37, 99, 235, 0.68);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-password-field {
  position: relative;
  display: block;
}

.auth-password-field input {
  padding-right: 58px;
}

.auth-password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--auth-muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.auth-password-field button:hover {
  color: var(--auth-primary);
}

.auth-forgot {
  justify-self: end;
  margin-top: 0;
}

.auth-link {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: inherit;
  font-weight: 500;
  line-height: 1.5;
}

.auth-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-submit,
.auth-page button.primary {
  min-height: 42px;
  border: 1px solid var(--auth-primary);
  border-radius: 9px;
  background: var(--auth-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.18);
}

.auth-submit:hover,
.auth-page button.primary:hover {
  border-color: var(--auth-primary-hover);
  background: var(--auth-primary-hover);
}

.auth-secondary,
.auth-wechat {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  background: #fff;
  color: var(--auth-text);
  font-size: 13px;
  font-weight: 500;
}

.auth-secondary:hover,
.auth-wechat:hover {
  border-color: rgba(37, 99, 235, 0.26);
  background: rgba(37, 99, 235, 0.035);
}

.auth-form .message {
  min-height: 20px;
  margin-top: -6px;
  color: var(--auth-danger);
  font-size: 13px;
  line-height: 1.5;
}

.auth-form .message:empty {
  display: none;
}

.auth-page .message.ok {
  color: var(--auth-success);
}

.auth-page .message.error {
  color: var(--auth-danger);
}

.auth-alternatives {
  margin-top: 18px;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: rgba(17, 24, 39, 0.38);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--auth-line);
  content: "";
}

.auth-wechat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.auth-wechat img {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.auth-account-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 18px;
  color: var(--auth-muted);
  font-size: 12px;
}

.auth-back {
  display: block;
  margin: 24px auto 0;
}

.auth-flow-panel .auth-heading {
  margin-bottom: 22px;
}

.auth-permissions {
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background: #f8fafc;
}

.auth-permissions h2 {
  margin: 0;
  font-size: 16px;
}

.auth-permissions > p {
  margin: 12px 0 8px;
  color: var(--auth-muted);
  font-size: 12px;
}

.auth-permissions .list {
  gap: 6px;
}

.auth-permissions .item {
  padding: 9px 10px;
  border-color: var(--auth-line);
  border-radius: 8px;
}

.auth-permissions .item p:empty {
  display: none;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-actions button {
  min-height: 46px;
  border-radius: 9px;
}

.auth-flow-panel > .message {
  margin-top: 16px;
}

@media (max-width: 560px) {
  .auth-wrap {
    align-items: flex-start;
    padding: 32px 16px;
  }

  .auth-brand {
    margin-bottom: 22px;
  }

  .auth-brand img {
    width: 42px;
    height: 42px;
  }

  .auth-brand span {
    font-size: 27px;
  }

  .auth-panel {
    padding: 24px 20px;
    border-radius: 14px;
  }

  .auth-heading h1 {
    font-size: 23px;
  }

}

@media (max-height: 760px) and (min-width: 561px) {
  .auth-wrap {
    align-items: flex-start;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .auth-brand {
    margin-bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-form input {
    transition: none;
  }
}
