:root {
  color-scheme: light dark;
  --page: #edf0ec;
  --surface: #f8faf7;
  --surface-strong: #ffffff;
  --text: #15231b;
  --muted: #66736a;
  --line: #d6ded8;
  --line-strong: #aebbb2;
  --accent: #1f6547;
  --accent-hover: #174e37;
  --accent-soft: #e3efe8;
  --button-bg: #1f6547;
  --button-hover: #174e37;
  --button-text: #f7faf8;
  --error: #a23a32;
  --error-soft: #f8e9e7;
  --focus: rgba(31, 101, 71, 0.22);
  --shadow: rgba(21, 44, 31, 0.13);
  font-family: "Avenir Next", Avenir, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--page);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.auth-layout {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 46%) minmax(480px, 54%);
  background: var(--surface);
}

.visual-panel {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  color: #f4f7f3;
  background: #173c2a;
}

.visual-panel > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.visual-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 27, 18, 0.34) 0%, rgba(10, 27, 18, 0.04) 42%, rgba(8, 25, 16, 0.82) 100%),
    linear-gradient(90deg, rgba(10, 27, 18, 0.22), transparent 45%);
}

.brand-lockup {
  position: absolute;
  top: clamp(24px, 4vw, 52px);
  left: clamp(24px, 4vw, 52px);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 10px;
  background: rgba(18, 48, 33, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}

.visual-copy {
  position: absolute;
  left: clamp(24px, 4vw, 52px);
  right: clamp(24px, 5vw, 68px);
  bottom: clamp(34px, 6vw, 74px);
  max-width: 620px;
}

.visual-copy p {
  margin: 0 0 14px;
  color: rgba(244, 247, 243, 0.76);
  font-size: 14px;
  font-weight: 650;
}

.visual-copy h2 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(30px, 3.1vw, 50px);
  font-weight: 640;
  letter-spacing: -0.045em;
  line-height: 1.16;
}

.form-panel {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(32px, 5.2vw, 76px);
  background:
    radial-gradient(circle at 100% 0%, rgba(90, 131, 104, 0.11), transparent 31%),
    var(--surface);
}

.form-wrap {
  width: min(100%, 470px);
  align-self: center;
  justify-self: center;
  padding-block: 30px;
}

.login-head {
  margin-bottom: 34px;
}

.section-label {
  margin: 0 0 20px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.intro {
  max-width: 34ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

form {
  display: grid;
  gap: 20px;
}

.field {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
}

input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 1px 2px rgba(21, 44, 31, 0.025);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input:hover {
  border-color: #87998c;
}

input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

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

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

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 52px;
  height: 36px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--accent-soft);
}

.password-toggle:focus-visible,
.submit-button:focus-visible,
.login-footer a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.status-message {
  margin: -2px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(162, 58, 50, 0.18);
  border-radius: 12px;
  color: var(--error);
  background: var(--error-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.submit-button {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: grid;
  place-items: center;
  margin-top: 4px;
  border: 1px solid var(--button-bg);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: 0 12px 30px var(--shadow);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.submit-button:hover:not(:disabled) {
  background: var(--button-hover);
  box-shadow: 0 15px 34px rgba(21, 70, 48, 0.19);
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

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

.submit-button.is-loading .button-label {
  padding-right: 22px;
}

.button-progress {
  position: absolute;
  right: calc(50% - 58px);
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: #ffffff;
  border-radius: 50%;
  opacity: 0;
}

.submit-button.is-loading .button-progress {
  opacity: 1;
  animation: button-spin 700ms linear infinite;
}

.access-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.access-note a {
  color: var(--accent);
  font-weight: 700;
  text-underline-offset: 3px;
}

.login-footer {
  width: min(100%, 470px);
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
  color: var(--muted);
  font-size: 12px;
}

.login-footer a {
  color: inherit;
  text-underline-offset: 3px;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 880px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    min-height: 260px;
    max-height: 34dvh;
  }

  .visual-panel > img {
    object-position: center 68%;
  }

  .brand-lockup {
    top: 22px;
    left: 22px;
  }

  .visual-copy {
    left: 22px;
    right: 22px;
    bottom: 24px;
  }

  .visual-copy p {
    display: none;
  }

  .visual-copy h2 {
    max-width: 22ch;
    font-size: clamp(24px, 6vw, 34px);
  }

  .form-panel {
    min-height: auto;
    padding: 38px 24px 26px;
  }

  .form-wrap {
    padding-block: 0 42px;
  }
}

@media (max-width: 520px) {
  .visual-panel {
    min-height: 210px;
  }

  .visual-copy h2 {
    font-size: 25px;
  }

  .form-panel {
    padding-inline: 20px;
  }

  .section-label {
    margin-bottom: 15px;
    font-size: 10px;
  }

  h1 {
    font-size: 40px;
  }

  .login-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

.wechat-read-login .auth-layout {
  grid-template-columns: 1fr;
}

.wechat-read-login .visual-panel {
  display: none;
}

.wechat-read-login .form-panel {
  min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
}

.wechat-read-login .form-wrap {
  align-self: center;
  padding-block: 16px 32px;
}

.wechat-read-login .login-head {
  margin-bottom: 28px;
}

.wechat-read-login .section-label {
  margin-bottom: 14px;
  letter-spacing: 0;
}

.wechat-read-login h1 {
  font-size: clamp(36px, 10vw, 44px);
  letter-spacing: -0.035em;
}

.wechat-read-login .intro {
  max-width: none;
  font-size: 15px;
}

.wechat-read-login .login-footer {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101713;
    --surface: #151d18;
    --surface-strong: #1d2821;
    --text: #edf3ef;
    --muted: #a3b0a7;
    --line: #2d3b32;
    --line-strong: #526258;
    --accent: #73b78e;
    --accent-hover: #63a77f;
    --accent-soft: #213a2d;
    --button-bg: #2f7654;
    --button-hover: #286547;
    --button-text: #f2f7f4;
    --error: #f09a92;
    --error-soft: #3b2422;
    --focus: rgba(115, 183, 142, 0.25);
    --shadow: rgba(0, 0, 0, 0.28);
  }

  .form-panel {
    background:
      radial-gradient(circle at 100% 0%, rgba(80, 132, 96, 0.12), transparent 31%),
      var(--surface);
  }

  input {
    box-shadow: none;
  }
}

@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;
  }
}
