:root {
  --auth-ink: #33271d;
  --auth-muted: #7b6856;
  --auth-gold: #a67a42;
  --auth-red: #9d3f32;
  --auth-line: rgba(160, 119, 67, 0.34);
}

body.auth-pending {
  overflow: hidden;
}

.auth-pending .app-shell {
  visibility: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
  padding: 32px;
  color: var(--auth-ink);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  background:
    linear-gradient(115deg, rgba(250, 248, 243, 0.82), rgba(239, 233, 224, 0.64)),
    url("assets/home-rebuild/tianze-ink-landscape-v2.png") center / cover fixed;
  overflow: auto;
  isolation: isolate;
}

.auth-screen::before,
.auth-screen::after {
  content: "";
  position: fixed;
  pointer-events: none;
}

.auth-screen::before {
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.88), transparent 34%),
    radial-gradient(circle at 80% 76%, rgba(136, 119, 98, 0.13), transparent 30%);
}

.auth-screen::after {
  inset: 0;
  z-index: -1;
  opacity: 0.12;
  background-image: radial-gradient(rgba(89, 65, 41, 0.28) 0.55px, transparent 0.7px);
  background-size: 5px 5px;
}

.auth-frame {
  width: min(980px, 100%);
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  border: 1px solid rgba(143, 103, 56, 0.45);
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.7);
  box-shadow:
    0 24px 70px rgba(61, 44, 27, 0.18),
    inset 0 0 0 4px rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 610px;
  padding: 58px 54px 46px;
  color: #f0ddba;
  background:
    linear-gradient(150deg, rgba(19, 22, 20, 0.96), rgba(42, 42, 37, 0.9)),
    url("assets/home-rebuild/tianze-ink-landscape-v2.png") 20% center / auto 125%;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.24)),
    radial-gradient(circle at 28% 16%, rgba(211, 170, 97, 0.18), transparent 34%);
  pointer-events: none;
}

.auth-brand-panel::after {
  content: "";
  position: absolute;
  right: -64px;
  bottom: -45px;
  width: 390px;
  height: 280px;
  opacity: 0.27;
  filter: grayscale(0.45) contrast(0.9);
  background: url("assets/home-rebuild/hero-mountain-right.png") right bottom / contain no-repeat;
  pointer-events: none;
}

.auth-brand,
.auth-brand-copy,
.auth-brand-note {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #e4bd72;
}

.auth-emblem {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(221, 181, 107, 0.78);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(222, 181, 102, 0.08);
}

.auth-emblem svg {
  width: 45px;
  height: 45px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.auth-brand-name {
  font-size: 31px;
  font-weight: 700;
  letter-spacing: 8px;
}

.auth-brand-copy {
  margin: auto 0;
  padding-bottom: 20px;
}

.auth-brand-copy h1 {
  margin: 0 0 22px;
  font-size: 39px;
  line-height: 1.35;
  letter-spacing: 6px;
  font-weight: 600;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.auth-brand-copy p {
  max-width: 360px;
  margin: 0;
  color: rgba(238, 219, 184, 0.74);
  font-size: 16px;
  line-height: 2;
  letter-spacing: 4px;
}

.auth-brand-note {
  color: rgba(231, 211, 177, 0.55);
  font-size: 12px;
  letter-spacing: 3px;
}

.auth-form-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 58px;
  background: linear-gradient(145deg, rgba(255, 255, 253, 0.84), rgba(248, 242, 233, 0.63));
}

.auth-form-panel::after {
  content: "";
  position: absolute;
  right: 26px;
  top: 24px;
  width: 64px;
  height: 64px;
  opacity: 0.72;
  transform: rotate(-4deg);
  background: url("assets/branding/tianze-cursive-seal.png") center / contain no-repeat;
  pointer-events: none;
}

.auth-form-header {
  margin-bottom: 34px;
}

.auth-kicker {
  margin: 0 0 10px;
  color: var(--auth-gold);
  font-size: 13px;
  letter-spacing: 4px;
}

.auth-form-header h2 {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 6px;
}

.auth-form-header p:last-child {
  margin: 0;
  color: var(--auth-muted);
  font-size: 14px;
  letter-spacing: 1px;
  line-height: 1.7;
}

.auth-field {
  display: block;
  margin-bottom: 20px;
}

.auth-field-label {
  display: block;
  margin: 0 0 9px;
  color: #5f4b38;
  font-size: 14px;
  letter-spacing: 2px;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(160, 119, 67, 0.38);
  border-radius: 11px;
  background: rgba(255, 255, 253, 0.66);
  box-shadow: inset 0 1px 5px rgba(90, 66, 40, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input-wrap:focus-within {
  border-color: rgba(151, 104, 47, 0.78);
  background: rgba(255, 255, 253, 0.9);
  box-shadow: 0 0 0 3px rgba(166, 122, 66, 0.1);
}

.auth-prefix {
  flex: 0 0 auto;
  padding-right: 13px;
  margin-right: 13px;
  border-right: 1px solid rgba(160, 119, 67, 0.25);
  color: #6d5740;
  font: 14px Georgia, serif;
}

.auth-input {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: 0;
  color: var(--auth-ink);
  background: transparent;
  font: 16px "Songti SC", "STSong", "SimSun", serif;
  letter-spacing: 1.5px;
}

.auth-input::placeholder {
  color: #aa9c8d;
}

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

.auth-code-button {
  border: 1px solid rgba(160, 119, 67, 0.43);
  border-radius: 11px;
  color: #8b6334;
  background: rgba(251, 246, 237, 0.74);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.auth-code-button:hover:not(:disabled) {
  background: rgba(255, 251, 244, 0.98);
  transform: translateY(-1px);
}

.auth-code-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-options {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 20px;
  color: var(--auth-muted);
  font-size: 12px;
  line-height: 1.6;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.auth-check input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: #916a3d;
}

.auth-link {
  padding: 0;
  border: 0;
  color: #946b3a;
  background: none;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-submit {
  width: 100%;
  height: 52px;
  border: 1px solid #c79a5e;
  border-radius: 11px;
  color: #fff8e8;
  background: linear-gradient(135deg, #a47a43, #765126);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.34),
    0 6px 14px rgba(88, 56, 24, 0.2);
  font: 16px "Songti SC", "STSong", "SimSun", serif;
  letter-spacing: 5px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-message {
  min-height: 21px;
  margin: 12px 0 0;
  color: var(--auth-red);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.5px;
}

.auth-message.is-success {
  color: #5e7650;
}

.auth-demo-tip {
  margin: 12px 0 0;
  color: #9a8875;
  text-align: center;
  font-size: 11px;
  letter-spacing: 1px;
}

.auth-screen.is-leaving {
  animation: authFadeOut 0.42s ease forwards;
}

@keyframes authFadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.auth-account-menu {
  position: absolute;
  z-index: 120;
  right: 38px;
  top: 68px;
  width: 232px;
  padding: 11px;
  border: 1px solid rgba(190, 153, 99, 0.46);
  border-radius: 14px;
  color: #443424;
  background: rgba(255, 252, 246, 0.96);
  box-shadow: 0 14px 35px rgba(28, 24, 18, 0.25);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.auth-account-menu[hidden] {
  display: none;
}

.auth-account-summary {
  padding: 10px 11px 12px;
  border-bottom: 1px solid rgba(160, 119, 67, 0.2);
}

.auth-account-summary strong,
.auth-account-summary span {
  display: block;
}

.auth-account-summary strong {
  margin-bottom: 5px;
  font-size: 15px;
  letter-spacing: 2px;
}

.auth-account-summary span {
  color: #8a7865;
  font: 12px Georgia, serif;
  letter-spacing: 1px;
}

.auth-account-action {
  width: 100%;
  margin-top: 7px;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  color: #5f4934;
  background: transparent;
  text-align: left;
  font: 14px "Songti SC", "STSong", "SimSun", serif;
  letter-spacing: 2px;
}

.auth-account-action:hover {
  background: rgba(169, 128, 75, 0.1);
}

.auth-account-action.is-danger {
  color: #963f34;
}

@media (max-width: 820px) {
  .auth-screen {
    padding: 18px;
  }

  .auth-frame {
    grid-template-columns: 1fr;
    width: min(520px, 100%);
    min-height: 0;
  }

  .auth-brand-panel {
    min-height: 190px;
    padding: 28px 30px;
  }

  .auth-brand-copy {
    margin: 28px 0 0;
    padding: 0;
  }

  .auth-brand-copy h1 {
    margin: 0;
    font-size: 28px;
  }

  .auth-brand-copy p,
  .auth-brand-note {
    display: none;
  }

  .auth-form-panel {
    padding: 40px 32px 36px;
  }

  .auth-account-menu {
    right: 14px;
    top: 64px;
  }
}

@media (max-width: 480px) {
  .auth-screen {
    align-items: start;
    padding: 10px;
  }

  .auth-frame {
    margin: 8px 0;
    border-radius: 22px;
  }

  .auth-brand-panel {
    min-height: 145px;
    padding: 22px 23px;
  }

  .auth-brand-name {
    font-size: 26px;
  }

  .auth-emblem {
    width: 46px;
    height: 46px;
  }

  .auth-brand-copy {
    margin-top: 20px;
  }

  .auth-brand-copy h1 {
    font-size: 23px;
    letter-spacing: 6px;
  }

  .auth-form-panel {
    padding: 33px 22px 28px;
  }

  .auth-form-panel::after {
    width: 52px;
    height: 52px;
    right: 18px;
    top: 18px;
  }

  .auth-form-header h2 {
    font-size: 27px;
  }

  .auth-code-row {
    grid-template-columns: minmax(0, 1fr) 108px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen,
  .auth-submit,
  .auth-code-button,
  .auth-input-wrap {
    animation: none !important;
    transition: none !important;
  }
}
