/* Minimal supplemental styles for unified auth steps on top of exact main-site stylesheets */
.is-hidden {
  display: none !important;
}

/* Theme toggle icon visibility & exact borderless round button matching main site */
.theme-toggle .icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

html:not(#a1):not(#a2) .auth-layout-shell .directory-topbar .top-actions .theme-toggle {
  border: 0 !important;
  border-radius: 50% !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  background: transparent;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Equal top and left distance for top-left AIBuy brand logo */
html:not(#a1):not(#a2) .auth-layout-shell .directory-topbar .brand {
  top: 14px !important;
  left: 14px !important;
}

/* Remove extra horizontal divider lines across topbar, form heading, and footer */
html:not(#a1):not(#a2) .auth-layout-shell .directory-topbar,
html:not(#a1):not(#a2) .auth-layout-shell .directory-topbar::before,
html:not(#a1):not(#a2) .auth-layout-shell .auth-form-panel .auth-form-heading,
html:not(#a1):not(#a2) .auth-layout-shell > .footer,
html:not(#a1):not(#a2) .auth-layout-shell > .footer.site-footer-compact {
  border: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}

html:not(#a1):not(#a2) .auth-layout-shell .auth-form-panel .auth-form-heading {
  padding-bottom: 0 !important;
  margin-bottom: 24px !important;
}

/* Larger subtitle ("继续探索 AI 的更多可能") */
html:not(#a1):not(#a2) .auth-split .auth-form-panel .auth-form-heading > p:last-child,
html:not(#a1):not(#a2) .auth-split .auth-form-panel .auth-form-heading .auth-form-subtitle {
  font-size: 15px !important;
  line-height: 1.65 !important;
}

/* Flat centered bottom footer row */
html:not(#a1):not(#a2) .auth-layout-shell > .footer.site-footer-compact {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  width: 100% !important;
  gap: 6px 20px !important;
}

html:not(#a1):not(#a2) .auth-layout-shell > .footer.site-footer-compact .footer-links {
  width: auto !important;
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px 16px !important;
}

/* Radial Circular View Transition Theme Toggle Animation (from button center to 4 corners) */
html.theme-revealing::view-transition,
html.theme-revealing::view-transition-group(*),
html.theme-revealing::view-transition-image-pair(*),
html.theme-revealing::view-transition-old(*),
html.theme-revealing::view-transition-new(*) {
  pointer-events: none !important;
}

html.theme-revealing,
html.theme-revealing *,
html.theme-revealing *::before,
html.theme-revealing *::after {
  transition: none !important;
}

html.theme-revealing::view-transition-group(root) {
  animation: none;
}

html.theme-revealing::view-transition-image-pair(root) {
  isolation: isolate;
}

html.theme-revealing::view-transition-old(root),
html.theme-revealing::view-transition-new(root) {
  mix-blend-mode: normal;
}

html.theme-revealing::view-transition-old(root) {
  animation: none;
  z-index: 1;
}

html.theme-revealing::view-transition-new(root) {
  z-index: 2;
  animation: theme-reveal-circle 0.52s cubic-bezier(0.4, 0.1, 0.2, 1) both;
}

@keyframes theme-reveal-circle {
  0% {
    clip-path: circle(0 at var(--theme-reveal-x) var(--theme-reveal-y));
  }
  100% {
    clip-path: circle(var(--theme-reveal-radius) at var(--theme-reveal-x) var(--theme-reveal-y));
  }
}

/* Ensure promo SVG fills the exact main-site container cleanly */
.auth-connection-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  display: block;
}

.auth-banner {
  margin: 0 0 18px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(194, 75, 75, 0.1);
  border: 1px solid rgba(194, 75, 75, 0.32);
  color: #b43c3c;
  font-size: 13px;
  line-height: 1.5;
}

html[data-theme="dark"] .auth-banner {
  background: rgba(226, 114, 114, 0.14);
  border-color: rgba(226, 114, 114, 0.35);
  color: #f6b0b0;
}

.auth-email-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  margin-bottom: 18px;
  border-radius: 10px;
  border: 1px solid var(--auth-border, var(--line));
  background: var(--card);
  font-size: 13.5px;
  color: var(--auth-text, var(--ink));
}

.auth-email-pill-addr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

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

.auth-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-field-row label {
  display: inline;
  margin: 0;
}

.auth-inline-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-accent, #2e6b50);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.auth-inline-btn:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-inline-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-optional-pw {
  border-radius: 10px;
  border: 1px solid var(--auth-border, var(--line));
  padding: 10px 12px;
}

.auth-optional-pw summary {
  font-size: 12.5px;
  color: var(--auth-muted, var(--muted));
  cursor: pointer;
  user-select: none;
}

.auth-optional-pw-label {
  margin-top: 12px;
}

.auth-success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(46, 107, 80, 0.14);
  color: var(--ui-accent, #2e6b50);
  margin-bottom: 12px;
}

.auth-phone-actions {
  display: grid;
  gap: 10px;
}

.auth-skip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--auth-border, var(--line));
  background: var(--card);
  color: var(--auth-text, var(--ink));
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
}

.auth-skip-btn:hover {
  filter: brightness(0.97);
}

/* ChatGPT-style sign-in-wrap legal notice (no checkbox) */
.auth-legal-note {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.65;
  color: var(--auth-muted, var(--muted));
}

.auth-legal-note-register {
  margin: 2px 0 0;
  text-align: left;
}

.auth-legal-note a {
  color: var(--ui-accent, #2e6b50);
  text-decoration: none;
  font-weight: 500;
}

.auth-legal-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   SILKY MOTION & SPINNER SYSTEM (Overrides legacy .auth-split transition:none)
   ========================================================================== */

/* Gentle initial page entrance */
.auth-split .auth-promo.auth-connection {
  animation: auth-promo-enter 0.56s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-split .auth-form-panel .account-auth-fields {
  animation: auth-panel-enter 0.52s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
  will-change: height;
}

@keyframes auth-promo-enter {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.988);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auth-panel-enter {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Re-enable smooth micro-interactions inside .auth-split (disabled automatically while theme-revealing) */
html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .button.dark.auth-submit {
  position: relative;
  overflow: hidden;
  transition:
    background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease !important;
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .button.dark.auth-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.985) !important;
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .button.dark.auth-submit:hover:not(:disabled) .auth-btn-arrow {
  transform: translateX(3px);
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-btn-arrow {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split input:not([type="checkbox"]) {
  transition:
    border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.2s ease !important;
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-email-pill,
html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-skip-btn,
html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-inline-btn {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s ease !important;
}

/* Silky button spinner (replaces text loading) */
.auth-submit .auth-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 1;
  transform: scale(1);
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-submit .auth-btn-content {
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.auth-submit .auth-btn-spinner {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.72);
  pointer-events: none;
}

html:not(.theme-revealing):not(#a1):not(#a2) .auth-split .auth-submit .auth-btn-spinner {
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.auth-submit .auth-btn-spinner svg {
  width: 21px;
  height: 21px;
  display: block;
}

.auth-submit .spinner-track {
  opacity: 0.24;
}

.auth-submit .spinner-arc {
  stroke-dasharray: 58;
  stroke-dashoffset: 44;
  transform-origin: center;
}

.auth-submit.is-loading {
  opacity: 0.94 !important;
  cursor: progress !important;
}

.auth-submit.is-loading .auth-btn-content {
  opacity: 0;
  transform: scale(0.9);
}

.auth-submit.is-loading .auth-btn-spinner {
  opacity: 1;
  transform: scale(1);
}

.auth-submit.is-loading .auth-btn-spinner svg {
  animation: auth-spin-rotate 0.85s linear infinite;
}

.auth-submit.is-loading .spinner-arc {
  animation: auth-spin-dash 1.35s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite;
}

/* Miniature inline spinner for resend button */
.auth-inline-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 26%, transparent);
  border-top-color: currentColor;
  vertical-align: -2px;
  animation: auth-spin-rotate 0.68s linear infinite;
}

@keyframes auth-spin-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes auth-spin-dash {
  0% {
    stroke-dasharray: 10, 58;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 42, 58;
    stroke-dashoffset: -14;
  }
  100% {
    stroke-dasharray: 10, 58;
    stroke-dashoffset: -58;
  }
}

/* Step 3 checkmark pop + stroke draw */
.auth-success-badge.is-animated {
  animation: auth-badge-pop 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-success-badge.is-animated svg path {
  stroke-dasharray: 28;
  stroke-dashoffset: 28;
  animation: auth-check-draw 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.18s forwards;
}

@keyframes auth-badge-pop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  65% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes auth-check-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-split .auth-promo.auth-connection,
  .auth-split .auth-form-panel .account-auth-fields,
  .auth-success-badge.is-animated {
    animation: none !important;
  }
}
