@import url('https://font.sec.miui.com/font/css?family=MiSans:400,500,600,700:Chinese_Simplify,Latin&display=swap');

:root {
  color-scheme: light dark;
  --primary-color: light-dark(#007aff, #0a84ff);
  --word-color: light-dark(#111111, #f5f5f5);
  --muted-color: light-dark(#666666, #aaaaaa);
  --surface-bg: light-dark(rgba(255, 255, 255, 0.45), rgba(30, 30, 30, 0.35));
  --surface-border: light-dark(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.14));
  --input-bg: light-dark(rgba(255, 255, 255, 0.65), rgba(0, 0, 0, 0.25));
  --border-radius-md: 14px;
  --border-radius-lg: 22px;
  --font-sans: "MiSans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  font-family: var(--font-sans);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--word-color);
  background: light-dark(#f4f7fb, #0f1115);
  overflow-x: hidden;
}

/* 流动背景色块 */
.color-bg {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: light-dark(0.32, 0.22);
  pointer-events: none;
  z-index: 0;
}
.color-bg-1 { width: 420px; height: 420px; background: #00ffcc; top: -120px; left: -100px; }
.color-bg-2 { width: 460px; height: 460px; background: #5e447b; bottom: -140px; right: -100px; }
.color-bg-3 { width: 320px; height: 320px; background: #ffe92c; top: 38%; right: 12%; }
.color-bg-4 { width: 340px; height: 340px; background: #ff9999; bottom: 16%; left: 10%; }

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.brand-header {
  text-align: center;
  margin-bottom: 20px;
}
.brand-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.brand-subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--muted-color);
}

.glass-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  background: var(--surface-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--surface-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), inset 0 0 20px rgba(255, 255, 255, 0.08);
  animation: fadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 接入应用提示条 */
.sso-banner {
  display: none;
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  background: light-dark(rgba(0, 122, 255, 0.08), rgba(10, 132, 255, 0.16));
  border: 1px solid light-dark(rgba(0, 122, 255, 0.2), rgba(10, 132, 255, 0.3));
}
.sso-banner strong {
  color: var(--primary-color);
}

/* 分段控制器 */
.segmented-control {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  margin-bottom: 22px;
  border-radius: var(--border-radius-md);
  background: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
}
.segmented-control button {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: var(--word-color);
  padding: 10px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.25s ease;
}
.segmented-control button.active {
  background: light-dark(#ffffff, rgba(255, 255, 255, 0.16));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 表单 */
.auth-form { display: none; }
.auth-form.is-active { display: block; }

.form-group { margin-bottom: 16px; }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.15));
  background: var(--input-bg);
  color: var(--word-color);
  font-size: 15px;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.submit-btn, .secondary-btn, .logout-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.submit-btn {
  margin-top: 8px;
  border: none;
  background: var(--primary-color);
  color: #ffffff;
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.submit-btn:active, .secondary-btn:active, .logout-btn:active { transform: scale(0.98); }

.secondary-btn {
  margin-top: 10px;
  border: 1px solid light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.18));
  background: transparent;
  color: var(--word-color);
}

.logout-btn {
  background: light-dark(rgba(255, 59, 48, 0.1), rgba(255, 69, 58, 0.15));
  color: light-dark(#ff3b30, #ff453a);
  border: 1px solid currentColor;
}

/* 个人中心头像与信息行 */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}
.avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 14px;
  border-radius: 50%;
  border: 3px solid var(--primary-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  cursor: pointer;
}
.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.avatar-wrapper:hover .avatar-overlay { opacity: 1; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
  font-size: 14px;
}
.info-label { color: var(--muted-color); }
.info-value { font-weight: 600; }

.danger-zone {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.14));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--muted-color);
  text-decoration: none;
  font-size: 14px;
}
.back-link:hover { color: var(--primary-color); }

/* Loading & Spinner */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 0;
  color: var(--muted-color);
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.18));
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: light-dark(rgba(20, 20, 20, 0.88), rgba(245, 245, 245, 0.92));
  color: light-dark(#ffffff, #111111);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
