:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --paper-deep: #efede5;
  --ink: #1e211e;
  --ink-soft: #6f726c;
  --primary: #2f4db8;
  --primary-strong: #243d98;
  --accent: #e8613c;
  --white: #fff;
  --line: #d9d6cc;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input { font: inherit; }

a { color: inherit; text-decoration: none; }

.login-page {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 80px 24px 64px;
  overflow: hidden;
}

.login-page::before,
.login-page::after {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.login-page::before {
  top: -15rem;
  right: -13rem;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

.login-page::after {
  bottom: -23rem;
  left: -15rem;
  border: 1px solid #dedbd1;
  background: #e6eafe;
}

.back-home {
  position: absolute;
  z-index: 2;
  top: 24px;
  left: 28px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  transition: transform 180ms ease, background-color 180ms ease;
}

.back-home:hover {
  background: var(--paper-deep);
  color: var(--ink);
  transform: translateY(-2px);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(500px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 12px 12px 0 #e6e3da;
}

.login-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 38px;
}

.login-heading h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(42px, 8vw, 58px);
  font-weight: 700;
  letter-spacing: -.055em;
  line-height: .95;
}

.close-login {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  transition: transform 180ms ease, background-color 180ms ease;
}

.close-login:hover {
  background: var(--paper-deep);
  transform: translateY(-2px);
}

#auth-form { display: grid; gap: 20px; }

.field {
  display: grid;
  gap: 9px;
  color: #555952;
  font-size: 14px;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 58px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgb(47 77 184 / 12%);
}

.field.has-error input {
  border-color: #b64d37;
  background: #fffaf8;
}

.field.has-error input:focus {
  border-color: #b64d37;
  box-shadow: 0 0 0 3px rgb(182 77 55 / 12%);
}

.field-error {
  margin: -2px 0 0;
  color: #b64d37;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.field-error:empty { display: none; }

.field-hint {
  margin: 2px 0 0;
  color: #6f6a5f;
  font-size: 12px;
  line-height: 1.5;
}

.field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-message {
  min-height: 22px;
  margin: -4px 0 -2px;
  color: #b64d37;
  font-size: 13px;
  line-height: 1.55;
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 62px;
  margin-top: 2px;
  padding: 0 20px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  box-shadow: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.submit-button:hover:not(:disabled) {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: none;
}

.submit-button:disabled { cursor: wait; opacity: .68; }

.switch-button {
  justify-self: center;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgb(47 77 184 / 28%);
  text-underline-offset: 4px;
}

.login-note {
  position: absolute;
  z-index: 1;
  bottom: 22px;
  margin: 0;
  color: #85877f;
  font-size: 12px;
}

.is-hidden { display: none; }

@media (max-width: 560px) {
  .login-page { padding: 72px 14px 54px; }
  .back-home { top: 14px; left: 14px; }
  .login-card { padding: 30px 22px; border-radius: 10px; box-shadow: 7px 7px 0 #e6e3da; }
  .login-heading { margin-bottom: 30px; }
  .close-login { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
