:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  font-kerning: normal;
  --canvas: #f8f9fa;
  --surface: #ffffff;
  --surface-subtle: #f2f3f4;
  --surface-hover: #e9ebed;
  --ink: #0f1419;
  --ink-soft: #3d4852;
  --muted: #656d74;
  --line: #e9ebed;
  --line-strong: #dce0e3;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.auth-panel {
  width: min(100%, 430px);
  display: grid;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  background: var(--surface);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-brand img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.auth-brand div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.auth-brand strong {
  font-size: 15px;
  font-weight: 600;
}

.auth-brand span,
.auth-copy p,
.auth-note,
.field small {
  color: var(--muted);
}

.auth-brand span {
  font-size: 12px;
}

.auth-copy {
  display: grid;
  gap: 7px;
}

.auth-copy h1,
.auth-copy p,
.auth-note {
  margin: 0;
}

.auth-copy h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.auth-copy p {
  font-size: 14px;
  text-wrap: pretty;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 10px;
  padding: 4px;
  background: var(--surface-subtle);
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 120ms var(--ease-out);
}

.auth-tabs button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.auth-tabs button.active {
  background: var(--surface);
  color: var(--ink);
}

.auth-tabs button:active,
.auth-submit:active,
.password-toggle:active {
  transform: scale(0.98);
}

.auth-error {
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.field input:hover {
  border-color: #c8cdd1;
}

.field input::placeholder {
  color: #6b737a;
  opacity: 1;
}

.field small {
  font-size: 12px;
  font-weight: 400;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  inset: 5px 5px 5px auto;
  width: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.password-toggle:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-submit {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 3px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out), opacity 160ms var(--ease-out);
}

.auth-submit:hover:not(:disabled) {
  background: #050709;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.auth-submit svg {
  width: 17px;
  height: 17px;
}

.auth-submit.is-loading svg {
  animation: submit-nudge 700ms ease-in-out infinite alternate;
}

.auth-note {
  font-size: 12px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@keyframes submit-nudge {
  from { transform: translateX(-2px); }
  to { transform: translateX(2px); }
}

@media (max-width: 520px) {
  body {
    background: var(--surface);
  }

  .auth-shell {
    place-items: start center;
    padding: max(22px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  }

  .auth-panel {
    gap: 22px;
    border: 0;
    padding: 0;
  }

  .auth-brand {
    margin-bottom: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
