:root {
  --auth-yellow: #ffcb37;
  --auth-yellow-soft: #ffe990;
  --auth-blush: #ffb8c8;
  --auth-cream: #fff8e6;
  --auth-paper: rgba(255, 253, 244, .94);
  --auth-ink: #1f1a12;
  --auth-muted: #6d6044;
  --auth-line: rgba(31, 26, 18, .16);
  --auth-sage: #6d7f61;
  --auth-shadow: rgba(91, 68, 0, .18);
}

body:is([data-page="login"], [data-page="register"], [data-page="loading"]) {
  background: #ffd84d;
}

.auth-shell {
  display: grid;
  place-items: center;
  position: relative;
  max-width: none;
  min-height: 100svh;
  padding: 128px clamp(24px, 5vw, 72px) 86px;
  overflow: hidden;
  color: var(--auth-ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.auth-brand {
  position: absolute;
  top: clamp(26px, 4vw, 54px);
  left: clamp(22px, 5vw, 72px);
  z-index: 4;
  display: inline-block;
  width: max-content;
  padding-top: clamp(22px, 2vw, 34px);
}

.auth-cover {
  position: absolute;
  top: clamp(34px, 5vw, 68px);
  right: clamp(20px, 5vw, 76px);
  z-index: 1;
  width: min(30vw, 440px);
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(31, 26, 18, .12);
  border-radius: 28px;
  background: #ffcf35;
  box-shadow: 0 24px 70px var(--auth-shadow);
}

.auth-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 248, 230, .12) 0%, rgba(255, 248, 230, .04) 48%, rgba(255, 203, 55, .12) 100%),
    linear-gradient(0deg, rgba(31, 26, 18, .14), transparent 52%);
}

.auth-cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.auth-wordmark {
  position: absolute;
  left: .28em;
  top: -14px;
  z-index: 2;
  display: block;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  transform: rotate(-2deg);
}

.auth-wordmark span {
  display: grid;
  place-items: center;
  min-width: 68px;
  height: 44px;
  border-radius: 999px;
  color: #111111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 3.7vw, 64px);
  font-style: italic;
  font-weight: 700;
  line-height: .86;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .42)) drop-shadow(0 7px 10px rgba(38, 30, 0, .14));
}

.auth-brand h1 {
  position: relative;
  margin: 0;
  color: #111111;
  font-family: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(42px, 5.1vw, 82px);
  font-weight: 900;
  line-height: .96;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .42)) drop-shadow(0 9px 13px rgba(38, 30, 0, .16));
}

.auth-brand h1::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 3%;
  bottom: -10px;
  height: 22px;
  border-bottom: 5px solid #111111;
  border-radius: 0 0 50% 50%;
  transform: rotate(-2deg);
  transform-origin: left center;
}

.login-page {
  position: relative;
  z-index: 3;
  width: min(100%, 430px);
  padding: 30px;
  border: 1px solid var(--auth-line);
  border-radius: 24px;
  background: var(--auth-paper);
  box-shadow: 0 24px 70px var(--auth-shadow);
  backdrop-filter: blur(14px);
  animation: auth-arrive 240ms ease-out;
}

.register-page {
  width: min(100%, 640px);
  max-width: 640px;
}

.auth-tagline {
  position: absolute;
  left: 50%;
  bottom: clamp(22px, 4vw, 42px);
  z-index: 3;
  margin: 0;
  color: var(--auth-ink);
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
  letter-spacing: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

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

.auth-heading h2 {
  margin: 0 0 8px;
  color: var(--auth-ink);
  font-size: 29px;
  font-weight: 850;
  line-height: 1.22;
}

.auth-heading p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 14px;
}

.register-page .auth-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.register-page .auth-heading h2 {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 20px;
}

.register-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
}

.login-form > div {
  min-width: 0;
}

.auth-wide,
.auth-switch,
.login-error,
.login-form button[type="submit"] {
  grid-column: 1 / -1;
}

.login-form label,
.login-form legend {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  color: var(--auth-ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 20px;
}

.login-form input,
.login-form select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 10px 14px;
  border: 1px solid rgba(31, 26, 18, .2);
  border-radius: 14px;
  background: #fffdf4;
  color: var(--auth-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.login-form input::placeholder {
  color: #997970;
  opacity: 1;
}

.login-form select:invalid {
  color: #997970;
}

.login-form select option {
  color: var(--auth-ink);
}

.login-form input:hover,
.login-form select:hover {
  border-color: rgba(31, 26, 18, .42);
  background: #ffffff;
}

.login-form input:focus,
.login-form select:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 203, 55, .42);
}

.auth-shell :is(input, select, button, a):focus-visible {
  outline: 3px solid rgba(31, 26, 18, .48);
  outline-offset: 3px;
}

.login-form fieldset {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.birth-selects {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.login-form input[readonly] {
  background: #fff1b8;
  color: var(--auth-ink);
}

.field-optional {
  margin-left: 4px;
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 500;
}

.required {
  color: #c35d78;
}

.height-field,
.password-field {
  position: relative;
}

.height-field input {
  padding-right: 48px;
}

.height-field > span {
  position: absolute;
  right: 14px;
  top: 15px;
  color: #997970;
  font-size: 14px;
  pointer-events: none;
}

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

.login-form .password-toggle {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: var(--auth-ink);
}

.password-toggle:hover {
  background: rgba(255, 203, 55, .28);
}

.password-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("/assets/icons/eye.svg") center / contain no-repeat;
}

.password-toggle[data-visible="true"] .password-icon {
  mask-image: url("/assets/icons/eye-off.svg");
}

.auth-switch {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 28px;
  margin-top: -8px;
}

.auth-link {
  color: var(--auth-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 28px;
  text-decoration: underline;
  text-decoration-color: var(--auth-yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.auth-link:hover {
  color: #6b5200;
}

.login-form button[type="submit"] {
  width: 100%;
  min-height: 52px;
  margin-top: -4px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--auth-yellow);
  box-shadow: 0 14px 30px rgba(166, 124, 0, .26);
  color: var(--auth-ink);
  font-size: 16px;
  font-weight: 900;
  transition: box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.login-form button[type="submit"]:hover:not(:disabled) {
  background: #f0bb1d;
  box-shadow: 0 18px 36px rgba(166, 124, 0, .3);
  transform: translateY(-1px);
}

.login-form button[type="submit"]:disabled {
  opacity: .65;
  cursor: wait;
}

.login-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(195, 93, 120, .35);
  border-radius: 14px;
  background: #fff0f4;
  color: #8a2e49;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.auth-loading {
  position: relative;
  z-index: 3;
  width: min(100%, 430px);
  padding: 18px;
  border: 1px solid var(--auth-line);
  border-radius: 18px;
  background: var(--auth-paper);
  box-shadow: 0 18px 44px var(--auth-shadow);
  text-align: center;
  color: var(--auth-muted);
  font-size: 14px;
}

.auth-shell noscript {
  display: block;
  align-self: end;
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
}

@keyframes auth-arrive {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 1800px) {
  .auth-brand h1 {
    font-size: 90px;
  }

  .auth-cover {
    width: 500px;
  }

  .login-page {
    width: min(100%, 500px);
  }

  .register-page {
    width: min(100%, 680px);
  }
}

@media (max-width: 1060px) {
  .auth-shell {
    padding: 230px 22px 76px;
    overflow: visible;
  }

  .auth-brand {
    top: 24px;
    left: 22px;
    padding-top: 26px;
  }

  .auth-cover {
    top: 86px;
    right: 22px;
    width: min(72vw, 560px);
    min-height: 0;
  }

  .auth-brand h1 {
    font-size: 54px;
  }

  .login-page {
    width: min(100%, 560px);
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    padding: 218px 14px 72px;
  }

  .auth-brand {
    top: 20px;
    left: 16px;
    padding-top: 18px;
  }

  .auth-cover {
    top: 82px;
    right: 14px;
    width: min(78vw, 340px);
    min-height: 0;
    border-radius: 22px;
  }

  .auth-wordmark {
    left: .22em;
    top: -12px;
    padding: 0;
  }

  .auth-wordmark span {
    min-width: 44px;
    height: 28px;
    font-size: 28px;
  }

  .auth-brand h1 {
    font-size: 38px;
    max-width: none;
  }

  .login-page {
    width: calc(100% - 12px);
    margin-top: 0;
    padding: 22px;
    border-radius: 20px;
  }

  .auth-heading h2 {
    font-size: 25px;
  }

  .register-form {
    gap: 17px 14px;
  }

  .auth-account-field {
    grid-column: 1 / -1;
  }

  .register-page .auth-heading {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
  }

  .register-page .auth-heading p {
    font-size: 13px;
  }

  .birth-selects {
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .auth-brand h1 {
    font-size: 34px;
    max-width: none;
  }

  .login-page {
    width: 100%;
    padding: 18px;
  }

  .login-form input,
  .login-form select {
    padding-left: 12px;
  }

  .login-form .password-field input {
    padding-right: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-page {
    animation: none;
  }

  .auth-shell * {
    transition: none;
  }
}
