/* Compact, mode-based authentication surface. */
:root {
  --auth-glass: rgba(65, 8, 25, .76);
  --auth-line: rgba(255, 239, 233, .17);
  --auth-ink: #fff4ef;
  --auth-muted: #d9b9bd;
  --auth-accent: #ffd2b4;
}

body:has(#auth-dialog) {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--auth-ink);
}

#auth-dialog {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 420px) !important;
  max-width: calc(100vw - 20px) !important;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0 auto;
  padding: 26px 28px 22px;
  border: 1px solid var(--auth-line);
  border-radius: 18px;
  background: var(--auth-glass);
  box-shadow: 0 22px 70px rgba(20, 0, 8, .3);
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
}

#auth-dialog [hidden] { display: none !important; }
#auth-dialog .auth-brand { display: inline-flex; margin: 0 0 14px; }
#auth-dialog .auth-brand img { width: auto; height: 26px; }
#auth-dialog .dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--auth-muted);
  font-size: 25px;
  cursor: pointer;
}
#auth-dialog h1 { margin: 0 42px 8px 0; font-size: 23px; line-height: 1.3; }
#auth-dialog .account-note { margin: 0 0 12px; color: var(--auth-muted); font-size: 13px; line-height: 1.55; }

.wechat-login { display: grid; justify-items: center; gap: 8px; margin: 12px auto 8px; }
#wechat-frame {
  display: block;
  width: 300px;
  height: 400px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
#wechat-caption { margin: 0; color: var(--auth-muted); font-size: 13px; }
.wechat-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; color: var(--auth-muted); font-size: 12px; }
.wechat-divider::before, .wechat-divider::after { content: ""; height: 1px; flex: 1; background: var(--auth-line); }
.wechat-entry-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wechat-entry-actions .register-entry { grid-column: 1 / -1; border-color: rgba(255, 210, 180, .5); color: var(--auth-accent); }
#auth-dialog button { font: inherit; }
.wechat-entry-actions button, .auth-tabs button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  background: rgba(255, 246, 241, .055);
  color: var(--auth-ink);
  cursor: pointer;
}
.wechat-entry-actions button:hover, .auth-tabs button:hover { background: rgba(255, 246, 241, .11); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 16px; }
.auth-tabs button.active { border-color: rgba(255, 210, 180, .65); background: rgba(255, 210, 180, .12); color: var(--auth-accent); }
#auth-form { display: grid; gap: 8px; }
#auth-form label { display: block; margin: 4px 0 5px; color: var(--auth-muted); font-size: 13px; }
#auth-form input:not([type=checkbox]) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  outline: none;
  background: rgba(20, 0, 8, .2);
  color: var(--auth-ink);
  font: inherit;
}
#auth-form input:focus { border-color: rgba(255, 210, 180, .76); box-shadow: 0 0 0 3px rgba(255, 210, 180, .1); }
#auth-form input::placeholder { color: rgba(255, 239, 233, .48); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.code-row button { min-width: 112px; padding: 0 10px; border: 1px solid var(--auth-line); border-radius: 9px; background: rgba(255, 246, 241, .07); color: var(--auth-accent); cursor: pointer; }
.code-row button:disabled, #auth-submit:disabled { opacity: .55; cursor: wait; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px !important; }
.password-toggle { position: absolute; top: 3px; right: 4px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--auth-muted); cursor: pointer; }
#auth-submit.primary { width: 100%; min-height: 46px; margin-top: 6px; border: 0; border-radius: 9px; background: var(--auth-accent); color: #421123; font-weight: 650; cursor: pointer; }
#auth-dialog .auth-consent { display: flex !important; flex-direction: row !important; align-items: flex-start !important; gap: 8px; margin: 12px 0 0; color: var(--auth-muted); font-size: 12px; line-height: 1.55; }
#auth-dialog .auth-consent input { flex: 0 0 16px; width: 16px !important; min-width: 16px !important; height: 16px !important; min-height: 16px !important; margin: 2px 0 0 !important; padding: 0 !important; accent-color: var(--auth-accent); }
.auth-consent a { color: var(--auth-ink); }
.auth-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin: 11px 0 0; }
.auth-actions button, .text-action, #wechat-later, #optional-skip { padding: 4px 0; border: 0; background: transparent; color: var(--auth-accent); font-size: 13px; cursor: pointer; }
#auth-status, #auth-error { margin: 8px 0 0; min-height: 0; font-size: 12px; line-height: 1.45; }
#auth-status { color: #d2efcf; }
#auth-error { color: #ffd2c1; }
#sms-help { margin-top: 8px; color: var(--auth-muted); font-size: 12px; }
#sms-help p { line-height: 1.5; }
.skip-link { position: absolute; left: -10000px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 2; padding: 8px; background: #fff; color: #222; }

body.embedded { display: block; min-height: 0; padding: 0; background: transparent; }
body.embedded #auth-dialog { width: 100%; max-height: none; margin: 0; padding: 18px 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }

@media (max-height: 700px) {
  #auth-dialog { max-height: calc(100dvh - 20px); padding-top: 18px; padding-bottom: 16px; }
  #auth-dialog .auth-brand { margin-bottom: 8px; }
  .wechat-login { margin: 6px auto; }
}
@media (max-width: 480px) {
  body:has(#auth-dialog) { padding: 10px; }
  #auth-dialog { max-height: calc(100dvh - 20px); padding: 22px 18px 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
