:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #f4eadc;
  color: #3d2423;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 246, 215, 0.96), transparent 36%),
    linear-gradient(165deg, #f7efdf 0%, #eadac4 58%, #d8bda0 100%);
}

button,
input {
  font: inherit;
}

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

.auth-page {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding:
    max(24px, env(safe-area-inset-top))
    16px
    max(24px, env(safe-area-inset-bottom));
}

.auth-ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-halo {
  position: absolute;
  top: -18vw;
  left: 50%;
  width: min(90vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 239, 175, 0.72), transparent 66%);
  transform: translateX(-50%);
}

.auth-cloud {
  position: absolute;
  width: 320px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 250, 239, 0.5);
  filter: blur(28px);
}

.auth-cloud-left {
  bottom: 5%;
  left: -130px;
}

.auth-cloud-right {
  top: 18%;
  right: -145px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 28px 24px 24px;
  border: 1px solid rgba(139, 92, 48, 0.28);
  border-radius: 28px;
  background: rgba(255, 252, 244, 0.93);
  box-shadow:
    0 24px 64px rgba(78, 37, 31, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
}

.auth-header {
  text-align: center;
}

.auth-emblem {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  place-items: center;
  border: 2px solid #c89c58;
  border-radius: 50%;
  background: #6f2731;
  color: #f8db96;
  font-family: STKaiti, KaiTi, serif;
  font-size: 34px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(91, 30, 39, 0.22);
}

.auth-kicker {
  margin: 0 0 5px;
  color: #916d42;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.auth-header h1 {
  margin: 0;
  color: #542026;
  font-family: STKaiti, KaiTi, "Microsoft YaHei", serif;
  font-size: clamp(28px, 7.5vw, 36px);
  line-height: 1.2;
}

.auth-introduction {
  margin: 12px 0 24px;
  color: #6f5a4d;
  font-size: 17px;
  line-height: 1.7;
}

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

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  color: #4d302e;
  font-size: 17px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #cdbca8;
  border-radius: 14px;
  outline: none;
  background: #fffdf8;
  color: #352322;
  font-size: 17px;
  padding: 0 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field input:focus {
  border-color: #8a4148;
  box-shadow: 0 0 0 4px rgba(111, 39, 49, 0.12);
}

.auth-field input[aria-invalid="true"] {
  border-color: #a33c3c;
}

.code-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 10px;
}

.send-code-button,
.phone-login-button,
.guest-entry-button {
  min-height: 52px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
}

.send-code-button {
  border: 1px solid #a47542;
  background: #fff7e7;
  color: #6d3a28;
  font-size: 15px;
}

.send-code-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.phone-login-button {
  border: 1px solid #67222b;
  background: linear-gradient(180deg, #7c3039, #5c1d26);
  color: #fff9ea;
  box-shadow: 0 8px 20px rgba(91, 29, 38, 0.24);
}

.guest-entry-button {
  width: 100%;
  border: 1px solid #9d815e;
  background: rgba(255, 252, 244, 0.86);
  color: #5a3b30;
}

.consent-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  color: #5b4940;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.45;
}

.consent-checkbox {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: #6f2731;
}

.auth-field-error {
  margin: 0;
  color: #a13131;
  font-size: 14px;
  line-height: 1.4;
}

.consent-error {
  margin-top: -12px;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #9a8877;
}

.auth-separator::before,
.auth-separator::after {
  height: 1px;
  flex: 1;
  background: #ded0bd;
  content: "";
}

.prototype-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f5ead7;
  color: #665344;
  font-size: 14px;
  line-height: 1.55;
}

.prototype-note strong {
  color: #714532;
}

.prototype-note p {
  margin: 3px 0 0;
}

.prototype-note span {
  color: #6f2731;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.prototype-note[hidden] {
  display: none;
}

.auth-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: #6f2731;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

button:focus-visible,
input:focus-visible,
.consent-row:has(input:focus-visible) {
  outline: 3px solid rgba(166, 111, 45, 0.72);
  outline-offset: 3px;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

@media (max-width: 370px) {
  .auth-page {
    padding-inline: 12px;
  }

  .auth-card {
    padding: 22px 17px 20px;
    border-radius: 22px;
  }

  .auth-introduction {
    margin-bottom: 18px;
    font-size: 16px;
  }

  .code-input-row {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 8px;
  }

  .send-code-button {
    font-size: 14px;
  }
}

@media (min-width: 900px) {
  .auth-page {
    padding-block: 48px;
  }

  .auth-card {
    padding: 34px 34px 30px;
  }
}

@media (min-width: 900px) and (max-height: 820px) {
  .auth-page {
    padding-block: 20px;
  }

  .auth-card {
    padding: 20px 28px 18px;
  }

  .auth-emblem {
    width: 54px;
    height: 54px;
    margin-bottom: 6px;
    font-size: 29px;
  }

  .auth-header h1 {
    font-size: 30px;
  }

  .auth-introduction {
    margin: 6px 0 14px;
    font-size: 16px;
    line-height: 1.5;
  }

  .phone-auth-form {
    gap: 10px;
  }

  .auth-field {
    gap: 4px;
  }

  .auth-field input,
  .send-code-button,
  .phone-login-button,
  .guest-entry-button {
    min-height: 48px;
  }

  .consent-row {
    min-height: 44px;
  }

  .auth-separator {
    margin: 10px 0;
  }

  .prototype-note {
    margin-top: 10px;
    padding: 10px 14px;
    line-height: 1.4;
  }

  .auth-status {
    min-height: 18px;
    margin-top: 4px;
  }
}

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