:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #8b5cf6;
  --bg-dark: #0a0b10;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #c7d2fe;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 背景 */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #0a0b10 0%, #12131a 40%, #1a1035 100%);
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 12s ease-in-out infinite;
}

.auth-bg-orb-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  top: -120px;
  left: -80px;
}

.auth-bg-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, transparent 70%);
  bottom: -100px;
  right: -60px;
  animation-delay: -6s;
}

.auth-bg-grid {
  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: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}

/* 主布局 */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-container {
  display: flex;
  width: 100%;
  max-width: 960px;
  min-height: 580px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 左侧品牌区 */
.auth-brand {
  flex: 0 0 42%;
  background: linear-gradient(155deg, #1a1d2d 0%, #252050 50%, #2d1b69 100%);
  color: #fff;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  position: relative;
}

.brand-logo-ring {
  position: relative;
  flex-shrink: 0;
}

.brand-logo-ring::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  opacity: 0.6;
  z-index: 0;
}

.brand-logo,
.brand-logo-fallback {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.brand-logo { object-fit: cover; display: block; }

.brand-logo-fallback {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 5px;
}

.brand-desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.75;
  margin-bottom: 24px;
  position: relative;
}

.brand-features {
  list-style: none;
  margin-bottom: 28px;
  position: relative;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  padding: 6px 0;
}

.feat-icon {
  color: var(--primary-light);
  font-size: 10px;
}

.announcement-wrap {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 14px 16px;
  backdrop-filter: blur(8px);
}

.announcement-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.announcement-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.announcement-box {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
  max-height: 120px;
  overflow-y: auto;
}

.announcement-box:empty::before {
  content: '暂无公告，欢迎使用远方账号系统';
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
}

.announcement-box::-webkit-scrollbar { width: 4px; }
.announcement-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* 右侧表单区 */
.auth-form-side {
  flex: 1;
  padding: 36px 44px 32px;
  display: flex;
  flex-direction: column;
  background: #fafbfc;
}

.form-header {
  margin-bottom: 24px;
}

.form-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.form-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* Tab 切换 */
.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: #eef2ff;
  border-radius: 10px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
  font-weight: 600;
}

.auth-tab.active svg { opacity: 1; }

.auth-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.auth-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form { }

.form-group { margin-bottom: 16px; }

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
}

/* 输入框 */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
  transition: color var(--transition);
}

.form-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-input:focus + .input-toggle,
.input-wrap:focus-within .input-icon {
  color: var(--primary);
}

.form-input::placeholder { color: #94a3b8; }

.input-toggle {
  position: absolute;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.input-toggle svg { width: 18px; height: 18px; }
.input-toggle:hover { color: var(--primary); background: #f1f5f9; }

/* 验证码行 */
.code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.code-input-wrap { flex: 1; min-width: 0; }

.code-input {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}

.btn-code {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 128px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn-code-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-code:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-code:active:not(:disabled) { transform: translateY(0); }

.btn-code:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  color: #64748b;
}

.btn-code.counting {
  background: #e2e8f0;
  color: #64748b;
  box-shadow: none;
  min-width: 100px;
}

.code-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 图形验证码 */
.captcha-input {
  padding-left: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.captcha-img {
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.captcha-img[hidden] { display: none; }

/* 提示条 */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 12px;
  color: #047857;
  line-height: 1.55;
  margin-bottom: 18px;
}

.info-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-banner-warn {
  background: var(--warning-bg);
  border-color: #fde68a;
  color: #b45309;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.form-check input { display: none; }

.checkmark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: #fff;
  position: relative;
  transition: var(--transition);
}

.form-check input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.form-check input:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.form-link:hover { color: var(--primary-dark); text-decoration: underline; }

/* 提交按钮 */
.btn-submit {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-submit:active:not(:disabled) { transform: translateY(0); }

.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-loading { display: inline-flex; align-items: center; gap: 8px; }
.btn-loading[hidden] { display: none; }
.btn-text[hidden] { display: none; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 忘记密码 */
.panel-back { margin-bottom: 16px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 6px;
  border: none;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.back-btn svg { width: 16px; height: 16px; }
.back-btn:hover { color: var(--primary); border-color: var(--border-focus); background: #eef2ff; }

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  pointer-events: none;
  max-width: min(420px, 90vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.toast.success .toast-icon::before { content: '✓'; font-size: 16px; font-weight: 700; }
.toast.error .toast-icon::before { content: '!'; font-size: 16px; font-weight: 700; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.2); border-radius: 50%; }

.register-disabled {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.register-disabled .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.auth-footer {
  margin-top: 24px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.04em;
}

/* 响应式 */
@media (max-width: 768px) {
  .auth-container {
    flex-direction: column;
    max-width: 440px;
    min-height: auto;
  }

  .auth-brand {
    flex: none;
    padding: 32px 28px 28px;
  }

  .brand-features,
  .brand-desc { display: none; }

  .auth-form-side { padding: 28px 24px 24px; }

  .form-row-2 { grid-template-columns: 1fr; }

  .code-row { flex-direction: column; }

  .btn-code { width: 100%; min-width: 0; padding: 12px; }

  .form-title { font-size: 20px; }
}

/* 个人中心 */
.home-container { max-width: 920px; }
.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 4px; }
.home-stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.home-stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.home-stat-value { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }
.home-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-ghost {
  appearance: none; border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--primary-light); color: var(--primary); }
@media (max-width: 720px) {
  .home-stats { grid-template-columns: 1fr; }
}
