/* 登录 / 注册 — 全屏居中卡片（参考 imchat 毛玻璃风格） */

:root {
  --auth-brand: #4f6ef7;
  --auth-brand-hover: #3d5ce6;
  --auth-brand-light: rgba(79, 110, 247, 0.12);
  --auth-text-muted: #808080;
  --auth-card-bg: rgba(255, 255, 255, 0.9);
  --auth-card-border: rgba(255, 255, 255, 0.95);
  --auth-input-bg: #fff;
  --auth-page-bg: #f8f9fd;
}

@media (prefers-color-scheme: dark) {
  :root {
    --auth-card-bg: rgba(28, 30, 38, 0.92);
    --auth-card-border: rgba(255, 255, 255, 0.08);
    --auth-input-bg: rgba(255, 255, 255, 0.06);
    --auth-text-muted: #9ca3af;
    --auth-page-bg: #12141c;
  }
}

/* App theme override (设置里的 浅色/深色/系统默认) */
#app-container.scheme-light {
  --auth-card-bg: rgba(255, 255, 255, 0.9);
  --auth-card-border: rgba(255, 255, 255, 0.95);
  --auth-input-bg: #fff;
  --auth-text-muted: #808080;
  --auth-page-bg: #f8f9fd;
}

#app-container.scheme-dark {
  --auth-card-bg: rgba(28, 30, 38, 0.92);
  --auth-card-border: rgba(255, 255, 255, 0.08);
  --auth-input-bg: rgba(255, 255, 255, 0.06);
  --auth-text-muted: #9ca3af;
  --auth-page-bg: #12141c;
}

#mountPoint:has(> #app-container.auth-mode) {
  padding: 0;
  height: 100%;
}

#mountPoint.app-loading:not(:has(#app-container)) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--auth-text-muted, #808080);
  font-size: 0.9375rem;
}

#app-container.auth-mode {
  max-width: none;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: hidden;
}

body:has(#app-container.auth-mode) {
  box-shadow: none;
  background-color: var(--auth-page-bg, #f8f9fd);
}

#app-container.auth-mode #topic-view {
  display: none !important;
}

#app-container.auth-mode #sidepanel.auth-sidepanel {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  flex-shrink: 1;
}

.auth-sidepanel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-backdrop__base,
.auth-backdrop__glows,
.auth-backdrop__panels,
.auth-backdrop__dots {
  position: absolute;
  inset: 0;
}

.auth-backdrop__base {
  background: linear-gradient(135deg,
    #d4e2f8 0%,
    #dce8fa 25%,
    #e6eefb 50%,
    #eef2fc 75%,
    #f8f9fd 100%);
}

.auth-backdrop__glows {
  background-image:
    radial-gradient(ellipse 70% 50% at 85% 15%, rgba(79, 110, 247, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 10% 75%, rgba(200, 218, 248, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 255, 255, 0.45) 0%, transparent 45%);
}

.auth-backdrop__dots {
  opacity: 0.45;
  background-image: radial-gradient(circle, rgba(79, 110, 247, 0.14) 1px, transparent 1px);
  background-size: 24px 24px;
}

.auth-backdrop__panels {
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(115deg,
      transparent 0,
      transparent 60px,
      rgba(79, 110, 247, 0.06) 60px,
      rgba(79, 110, 247, 0.06) 65px),
    repeating-linear-gradient(25deg,
      transparent 0,
      transparent 90px,
      rgba(200, 218, 248, 0.1) 90px,
      rgba(200, 218, 248, 0.1) 95px);
}

@media (prefers-color-scheme: dark) {
  #app-container.auth-mode:not(.scheme-light) .auth-backdrop__base,
  #app-container.scheme-dark .auth-backdrop__base {
    background: linear-gradient(135deg,
      #1b2438 0%,
      #1a1f2e 35%,
      #151822 70%,
      #12141c 100%);
  }

  #app-container.auth-mode:not(.scheme-light) .auth-backdrop__glows,
  #app-container.scheme-dark .auth-backdrop__glows {
    background-image:
      radial-gradient(ellipse 70% 50% at 85% 15%, rgba(79, 110, 247, 0.22) 0%, transparent 55%),
      radial-gradient(ellipse 60% 45% at 10% 75%, rgba(79, 110, 247, 0.1) 0%, transparent 50%),
      radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 45%);
  }

  #app-container.auth-mode:not(.scheme-light) .auth-backdrop__dots,
  #app-container.scheme-dark .auth-backdrop__dots {
    opacity: 0.35;
    background-image: radial-gradient(circle, rgba(79, 110, 247, 0.22) 1px, transparent 1px);
  }

  #app-container.auth-mode:not(.scheme-light) .auth-backdrop__panels,
  #app-container.scheme-dark .auth-backdrop__panels {
    opacity: 0.35;
    background-image:
      repeating-linear-gradient(115deg,
        transparent 0,
        transparent 60px,
        rgba(79, 110, 247, 0.08) 60px,
        rgba(79, 110, 247, 0.08) 65px),
      repeating-linear-gradient(25deg,
        transparent 0,
        transparent 90px,
        rgba(255, 255, 255, 0.03) 90px,
        rgba(255, 255, 255, 0.03) 95px);
  }
}

/* Forced dark when system is light */
#app-container.scheme-dark .auth-backdrop__base {
  background: linear-gradient(135deg,
    #1b2438 0%,
    #1a1f2e 35%,
    #151822 70%,
    #12141c 100%);
}

#app-container.scheme-dark .auth-backdrop__glows {
  background-image:
    radial-gradient(ellipse 70% 50% at 85% 15%, rgba(79, 110, 247, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 10% 75%, rgba(79, 110, 247, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 45%);
}

#app-container.scheme-dark .auth-backdrop__dots {
  opacity: 0.35;
  background-image: radial-gradient(circle, rgba(79, 110, 247, 0.22) 1px, transparent 1px);
}

#app-container.scheme-dark .auth-backdrop__panels {
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(115deg,
      transparent 0,
      transparent 60px,
      rgba(79, 110, 247, 0.08) 60px,
      rgba(79, 110, 247, 0.08) 65px),
    repeating-linear-gradient(25deg,
      transparent 0,
      transparent 90px,
      rgba(255, 255, 255, 0.03) 90px,
      rgba(255, 255, 255, 0.03) 95px);
}

/* Forced light when system is dark */
#app-container.scheme-light .auth-backdrop__base {
  background: linear-gradient(135deg,
    #d4e2f8 0%,
    #dce8fa 25%,
    #e6eefb 50%,
    #eef2fc 75%,
    #f8f9fd 100%);
}

#app-container.scheme-light .auth-backdrop__glows {
  background-image:
    radial-gradient(ellipse 70% 50% at 85% 15%, rgba(79, 110, 247, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 10% 75%, rgba(200, 218, 248, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 255, 255, 0.45) 0%, transparent 45%);
}

#app-container.scheme-light .auth-backdrop__dots {
  opacity: 0.45;
  background-image: radial-gradient(circle, rgba(79, 110, 247, 0.14) 1px, transparent 1px);
}

#app-container.scheme-light .auth-backdrop__panels {
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(115deg,
      transparent 0,
      transparent 60px,
      rgba(79, 110, 247, 0.06) 60px,
      rgba(79, 110, 247, 0.06) 65px),
    repeating-linear-gradient(25deg,
      transparent 0,
      transparent 90px,
      rgba(200, 218, 248, 0.1) 90px,
      rgba(200, 218, 248, 0.1) 95px);
}

.auth-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.auth-sidepanel .error-panel {
  position: relative;
  z-index: 2;
  margin-bottom: 0.75rem;
  border-radius: 0.75rem;
}

.auth-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 2rem 1.75rem 1.5rem;
  background: var(--auth-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 1.75rem;
  border: 1px solid var(--auth-card-border);
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.auth-card--tall {
  max-height: min(90vh, 42rem);
  overflow-y: auto;
}

.auth-card--sub .auth-card-header {
  margin-bottom: 1rem;
}

.auth-settings-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--auth-text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-settings-btn:hover {
  color: var(--auth-brand);
  background: var(--auth-brand-light);
}

.auth-settings-btn .material-icons {
  font-size: 1.25rem;
}

.auth-card-header {
  flex-shrink: 0;
  text-align: left;
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.auth-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--auth-brand);
}

.auth-card-subtitle {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--auth-text-muted);
  line-height: 1.5;
}

.auth-card-body {
  flex: 1;
  min-height: 0;
}

.auth-card-footer {
  flex-shrink: 0;
  margin-top: 1.25rem;
  text-align: right;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  line-height: normal;
}

.auth-field {
  display: flex;
  align-items: stretch;
  margin-bottom: 1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--auth-input-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .auth-field {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

.auth-field:focus-within {
  border-color: rgba(79, 110, 247, 0.35);
  box-shadow: 0 0 0 3px var(--auth-brand-light);
}

.auth-field-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  color: var(--auth-brand);
  opacity: 0.75;
}

.auth-field-icon .material-icons {
  font-size: 1.25rem;
}

.auth-field-input {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.auth-field-input input[type="text"],
.auth-field-input input[type="email"],
.auth-field-input input[type="password"],
.auth-field-input input[type="tel"] {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem 0 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: inherit;
  outline: none;
  box-sizing: border-box;
}

.auth-field-input input::placeholder {
  color: var(--auth-text-muted);
  opacity: 0.85;
}

.auth-field-input .group-focus {
  width: 100%;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.auth-field-input .group-focus input.with-icon-right {
  flex: 1;
  height: 3.25rem;
  padding: 0 0.25rem 0 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
}

.auth-field-input .group-focus .material-icons {
  margin-right: 0.75rem;
  color: var(--auth-text-muted);
  font-size: 1.25rem;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.25rem 0 1rem;
  font-size: 0.875rem;
}

.auth-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--auth-text-muted);
  cursor: pointer;
}

.auth-link {
  color: var(--auth-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.auth-link:hover {
  color: var(--auth-brand);
}

.auth-link--primary {
  color: var(--auth-brand);
  font-weight: 600;
}

.auth-submit {
  width: 100%;
  height: 3.25rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 999px;
  background: var(--auth-brand);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-submit:hover:not(.disabled):not(:disabled) {
  background: var(--auth-brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(79, 110, 247, 0.35);
}

.auth-submit.disabled,
.auth-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-register-avatar {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.auth-register-fields {
  flex: 1;
  min-width: 0;
}

.auth-register-avatar .avatar-upload {
  width: 5.5rem;
  height: 5.5rem;
  font-size: 2.5rem;
  margin: 0;
  border-radius: 1rem;
  overflow: hidden;
  border: 2px dashed rgba(79, 110, 247, 0.25);
}

.auth-register-avatar .avatar-upload .lettertile,
.auth-register-avatar .avatar-upload img {
  border-radius: 0.75rem;
}

.auth-block-label {
  display: block;
  margin: 0 0 0.5rem 0.25rem;
  font-size: 0.8125rem;
  color: var(--auth-text-muted);
}

.auth-phone-block {
  margin-bottom: 1rem;
}

.auth-phone-block .panel-form-row {
  padding: 0;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--auth-brand);
  font-size: 0.875rem;
  cursor: pointer;
}

.auth-back-link .material-icons {
  font-size: 1.125rem;
}

.auth-home-brand {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--auth-brand);
  font-weight: 700;
  font-size: 1.125rem;
}

.auth-home-brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.auth-card--sub .panel-form-row {
  padding-left: 0;
  padding-right: 0;
}

.auth-card--sub .dialog-buttons {
  padding: 0;
  margin-top: 1rem;
}

.auth-card--sub .dialog-buttons button.primary {
  width: 100%;
  height: 3.25rem;
  border-radius: 999px;
  background: var(--auth-brand);
  letter-spacing: 0.05em;
}

@media (max-width: 640px) {
  .auth-sidepanel {
    padding: 1rem 0.75rem;
    align-items: flex-start;
    padding-top: 3.5rem;
  }

  .auth-card {
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: 1.25rem;
  }

  .auth-card-title {
    font-size: 1.375rem;
  }

  .auth-home-brand {
    top: 0.75rem;
    left: 0.75rem;
  }
}

.auth-maintenance-banner {
  max-width: 26rem;
  width: 100%;
  margin: 0 auto 0.85rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.65rem;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: center;
}

#app-container.scheme-dark .auth-maintenance-banner,
#app-container.auth-mode:not(.scheme-light) .auth-maintenance-banner {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

.auth-closed-note {
  margin: 0;
  color: var(--auth-text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

