/* 登录 / 注册分栏页（与 demo-auth 一致） */
:root {
  --ag-ink: #0c0e12;
  --ag-ink-soft: #1a1e26;
  --ag-paper: #f3f1ec;
  --ag-paper-2: #e8e4db;
  --ag-line: rgba(12, 14, 18, 0.12);
  --ag-muted: #6b6f78;
  --ag-text: #14171d;
  --ag-accent: #1d4ed8;
  --ag-font: "Instrument Sans", "Noto Sans SC", sans-serif;
  --ag-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

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

html {
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

body.auth-gate {
  font-family: var(--ag-font);
  color: var(--ag-text);
  background: var(--ag-paper);
  -webkit-font-smoothing: antialiased;
}

body.auth-gate a {
  color: var(--ag-accent);
  text-decoration: none;
}

body.auth-gate a:hover { text-decoration: underline; }

.ag-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: start;
}

.ag-brand {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  color: #f5f5f2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 15%, rgba(255,255,255,0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 80%, rgba(29,78,216,0.22), transparent 50%),
    linear-gradient(160deg, #0c0e12 0%, #151922 45%, #0a0c10 100%);
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
}

.ag-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 80%);
  pointer-events: none;
}

.ag-brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
}

.ag-brand-top:hover { text-decoration: none; }

.ag-brand-top img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.ag-brand-top span {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ag-brand-hero {
  position: absolute;
  z-index: 1;
  left: clamp(28px, 4vw, 48px);
  right: clamp(28px, 4vw, 48px);
  top: 42%;
  transform: translateY(-50%);
  max-width: 28rem;
  animation: ag-rise-brand 0.7s var(--ag-ease) both;
}

.ag-brand-slogan {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.06em;
  color: rgba(158, 193, 255, 0.9);
  margin: 0 0 16px;
}

.ag-brand-hero h1 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}

.ag-brand-hero p {
  margin: 0;
  color: rgba(245,245,242,0.68);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 22rem;
}

.ag-brand-hero code {
  color: #9ec1ff;
  font-family: inherit;
}

.ag-brand-foot {
  position: absolute;
  z-index: 1;
  left: clamp(28px, 4vw, 48px);
  bottom: clamp(28px, 4vw, 48px);
  font-size: 0.8125rem;
  color: rgba(245,245,242,0.4);
}

.ag-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
  padding: clamp(48px, 14vh, 120px) clamp(28px, 5vw, 64px) clamp(40px, 6vh, 64px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), transparent 40%),
    var(--ag-paper);
  position: relative;
}

.ag-panel-inner {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  animation: ag-rise 0.7s 0.08s var(--ag-ease) both;
}

.ag-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  background: var(--ag-paper-2);
  border-radius: 12px;
  margin-bottom: 28px;
}

.ag-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(12,14,18,0.08);
  transition: transform 0.35s var(--ag-ease);
  pointer-events: none;
  z-index: 0;
}

.ag-tabs[data-active="register"] .ag-tab-indicator {
  transform: translateX(100%);
}

.ag-tab {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 9px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--ag-muted);
  cursor: pointer;
  transition: color 0.25s ease;
}

.ag-tab[aria-selected="true"] {
  color: var(--ag-ink);
}

.ag-panel-head { margin-bottom: 28px; }

.ag-title-stack,
.ag-lead-stack { display: grid; }

.ag-title-stack > *,
.ag-lead-stack > * { grid-area: 1 / 1; }

.ag-panel-head h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  transition: opacity 0.28s ease, transform 0.35s var(--ag-ease);
}

.ag-panel-head .ag-lead {
  color: var(--ag-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  transition: opacity 0.28s ease, transform 0.35s var(--ag-ease);
}

.ag-panel-head h2:not(.is-active),
.ag-panel-head .ag-lead:not(.is-active) {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.ag-panel-head h2.is-active,
.ag-panel-head .ag-lead.is-active {
  opacity: 1;
  transform: none;
}

.ag-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
  font-size: 0.875rem;
  line-height: 1.45;
  position: relative;
  z-index: 3;
}

.ag-views {
  position: relative;
  /* 默认不裁切：避免错误提示 / 极验浮层被挡住；切换动画时再加 .is-animating */
  overflow: visible;
}

.ag-views.is-animating {
  overflow: hidden;
}

.ag-view {
  transition: opacity 0.28s ease, transform 0.35s var(--ag-ease);
}

.ag-view.is-leaving {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.ag-view.is-enter {
  opacity: 0;
  transform: translateY(10px);
}

.ag-view.is-enter.is-active {
  opacity: 1;
  transform: none;
}

.ag-view[hidden] { display: none; }
.ag-view.is-leaving[hidden] { display: block; }

.ag-field { margin-bottom: 16px; }

.ag-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 550;
  margin-bottom: 7px;
  color: var(--ag-ink-soft);
}

.ag-field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--ag-line);
  border-radius: 11px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ag-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ag-field input:focus {
  border-color: rgba(29, 78, 216, 0.55);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.ag-optional {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--ag-muted);
}

.ag-field-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ag-muted);
}

.ag-field input.ag-invite-input {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ag-invite-promo-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.55;
  font-weight: 500;
}

.ag-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -4px 0 18px;
  font-size: 0.8125rem;
}

.ag-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ag-muted);
  cursor: pointer;
  user-select: none;
}
.ag-remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ag-accent);
  cursor: pointer;
}
.ag-remember:hover { color: var(--ag-ink-soft); }

.ag-field-row a { color: var(--ag-muted); }
.ag-field-row a:hover { color: var(--ag-accent); }

.ag-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ag-code-row input {
  flex: 1;
  min-width: 0;
}
.ag-code-btn {
  flex-shrink: 0;
  padding: 0 14px;
  border: 1px solid var(--ag-line, rgba(0,0,0,.12));
  border-radius: 10px;
  background: transparent;
  color: var(--ag-ink, #1a1a1a);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.ag-code-btn:hover:not(:disabled) {
  background: rgba(0,0,0,.04);
}
.ag-code-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ag-code-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--ag-muted);
  line-height: 1.4;
}
.ag-code-hint.is-error { color: #b91c1c; }
.ag-code-hint.is-ok { color: #15803d; }

.ag-captcha-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ag-captcha-row input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.ag-captcha-img-btn {
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--ag-line, rgba(0,0,0,.12));
  border-radius: 10px;
  background: #f1f5f9;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
}
.ag-captcha-img-btn:hover { opacity: 0.9; }
.ag-captcha-img {
  display: block;
  width: 120px;
  height: 40px;
}

.ag-field:has(.ag-geetest-box) {
  position: relative;
  z-index: 2;
  overflow: visible;
}

.ag-geetest-box {
  min-height: 44px;
  width: 100%;
  max-width: none;
  overflow: visible;
}

.ag-geetest-box .geetest_holder,
.ag-geetest-box .geetest_box,
.ag-geetest-box .geetest_btn,
.ag-geetest-box .geetest_radar_btn {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

.ag-btn {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 14px 16px;
  background: var(--ag-ink);
  color: #fff;
  font: inherit;
  font-size: 0.975rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.ag-btn:hover { background: var(--ag-ink-soft); }
.ag-btn:active { transform: translateY(1px); }

.ag-hint {
  margin-top: 22px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ag-muted);
}

.ag-oauth {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--ag-line);
}

/* 微信弹窗登录等待时：轻微遮罩提示仍在本页 */
body.ag-oauth-waiting::after {
  content: "请在弹窗中完成微信扫码…";
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 48px;
  background: rgba(12, 14, 18, 0.28);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: ag-oauth-wait-in 0.25s ease both;
}

@keyframes ag-oauth-wait-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.ag-oauth-waiting::after { animation: none; }
}

.ag-oauth-label {
  margin: 0 0 14px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ag-muted);
}

.ag-oauth-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}

.ag-oauth-btn {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ag-oauth-btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
  text-decoration: none;
}

.ag-oauth-btn:active {
  transform: translateY(0);
}

.ag-oauth-btn img {
  display: block;
  width: 100%;
  height: 40px;
  object-fit: contain;
  object-position: center;
}

.ag-legal {
  margin-top: 18px;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ag-muted);
  display: grid;
}

.ag-legal > span {
  grid-area: 1 / 1;
  transition: opacity 0.28s ease;
}

.ag-legal > span:not(.is-active) {
  opacity: 0;
  pointer-events: none;
}

.ag-legal a {
  color: var(--ag-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ag-legal a:hover { color: var(--ag-accent); }

@keyframes ag-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes ag-rise-brand {
  from { opacity: 0; transform: translateY(calc(-50% + 14px)); }
  to { opacity: 1; transform: translateY(-50%); }
}

@keyframes ag-rise-brand-mobile {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .ag-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .ag-brand {
    position: relative;
    height: auto;
    min-height: 0;
    padding: 20px 20px 8px;
    overflow: visible;
  }

  .ag-brand-hero {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    padding: 18px 0 16px;
    max-width: none;
    animation: ag-rise-brand-mobile 0.55s var(--ag-ease) both;
  }

  .ag-brand-slogan {
    margin-bottom: 10px;
    font-size: 0.8125rem;
  }

  .ag-brand-hero h1 {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-bottom: 8px;
  }

  .ag-brand-hero h1 br { display: none; }

  .ag-brand-hero p {
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ag-brand-foot { display: none; }

  .ag-panel {
    min-height: 0;
    padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
  }

  .ag-panel-inner {
    max-width: none;
    animation: ag-rise 0.55s 0.04s var(--ag-ease) both;
  }

  .ag-tabs { margin-bottom: 20px; }

  .ag-panel-head { margin-bottom: 20px; }

  .ag-panel-head h2 { font-size: 1.4rem; }

  .ag-captcha-row,
  .ag-code-row {
    flex-wrap: nowrap;
  }

  .ag-captcha-img {
    width: 100px;
    height: 40px;
  }

  .ag-code-btn {
    padding: 0 10px;
    font-size: 0.75rem;
  }

  .ag-field-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .ag-oauth-buttons {
    max-width: 100%;
  }

  .ag-oauth-btn img {
    height: 38px;
  }
}

@media (max-width: 380px) {
  .ag-brand,
  .ag-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ag-captcha-img {
    width: 88px;
  }

  .ag-code-btn {
    max-width: 6.5rem;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-tab-indicator,
  .ag-view,
  .ag-brand-hero,
  .ag-panel-inner {
    transition: none !important;
    animation: none !important;
  }

  .ag-brand-hero {
    transform: none !important;
  }
}
