/* ════════════════════════════════════════════════════════
   Cloud Memory Hub — Design System
   品牌色: 紫 #7c5cfc → 青 #3bb89a
   字体: Inter / PingFang
   ════════════════════════════════════════════════════════ */

:root {
  /* ── 色彩系统 ─────────────────────────────────────── */
  --bg-primary: #faf8f6;
  --bg-secondary: #f3efea;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);

  --text-primary: #1c1a18;
  --text-secondary: #8c8680;
  --text-tertiary: #b5b0aa;

  --accent-1: #7c5cfc;
  --accent-1-hover: #6a48e8;
  --accent-1-light: rgba(124, 92, 252, 0.08);
  --accent-2: #3bb89a;
  --accent-2-light: rgba(59, 184, 154, 0.08);
  --accent-3: #e8606c;

  --gradient-main: linear-gradient(135deg, #7c5cfc, #3bb89a);
  --gradient-accent: linear-gradient(135deg, #f7a8b8, #e8606c);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
               "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ═══ 粒子背景 ═══ */
#bgCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ═══ 容器 ═══ */
.container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ═══ 毛玻璃组件 ═══ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

.glass-light {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══ 按钮系统 ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-xs);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--gradient-main);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.35);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(124, 92, 252, 0.06);
  border-color: rgba(124, 92, 252, 0.25);
}

.btn-lg {
  padding: 16px 36px;
  font-size: 18px;
  flex-direction: column;
  gap: 2px;
}
.btn-lg small {
  font-size: 13px;
  opacity: 0.8;
  font-weight: 400;
}

.btn-full { width: 100%; justify-content: center; }

/* ═══ 导航 ═══ */
nav {
  margin: 20px 0;
  padding: 0 24px;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }

/* ═══ Hero ═══ */
.hero {
  text-align: center;
  padding: 72px 0 48px;
}
.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.hero-title {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 20px;
  letter-spacing: -2px;
}
.hero-sub {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-sub strong {
  color: var(--text-primary);
}

/* 实时计数 */
.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  padding: 18px 36px;
  margin-bottom: 28px;
}
.counter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.counter-num {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.counter-label {
  font-size: 13px;
  color: var(--text-tertiary);
}
.counter-divider {
  width: 1px;
  height: 36px;
  background: var(--glass-border);
}

/* CTA */
.hero-cta { margin-bottom: 36px; }

/* ═══ Sections ═══ */
.section {
  padding: 72px 0;
}
.section-title {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.section-desc {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-size: 16px;
}

/* ═══ Agent Grid ═══ */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}
.agent-card {
  padding: 24px 16px;
  text-align: center;
  transition: all 0.25s ease;
}
.agent-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 252, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.agent-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}
.agent-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.agent-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}
.agent-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-2-light);
  color: var(--accent-2);
}

/* ═══ Features Grid ═══ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}
.feature-card {
  padding: 28px 24px;
  transition: all 0.25s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 252, 0.2);
}
.feature-icon {
  font-size: 32px;
  margin-bottom: 14px;
}
.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}
.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ═══ Footer ═══ */
footer {
  text-align: center;
  padding: 28px;
  margin: 36px 0 20px;
}
footer p {
  font-size: 14px;
  color: var(--text-secondary);
}
.footer-links {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 16px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text-primary); }

/* ═══ 登录/注册 ═══ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
}
.auth-card h1 {
  font-size: 26px;
  text-align: center;
  margin-bottom: 6px;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-1-light);
}
.form-group input::placeholder {
  color: var(--text-tertiary);
}

.form-error {
  color: var(--accent-3);
  font-size: 13px;
  margin-top: 4px;
}
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.form-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-secondary);
}
.form-footer a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 500;
}
.form-footer a:hover { text-decoration: underline; }

/* ═══ Dashboard ═══ */
.dashboard {
  padding: 24px 0 60px;
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  margin-bottom: 22px;
}
.dashboard-header h1 { font-size: 22px; }
.dashboard-header .user-email {
  font-size: 14px;
  color: var(--text-secondary);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 22px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 安装命令展示 */
.install-box {
  padding: 24px 26px;
  margin-bottom: 22px;
}
.install-box h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}

.command-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.command-box code {
  flex: 1;
  font-size: 13px;
  color: var(--accent-2);
  word-break: break-all;
  line-height: 1.5;
}
.copy-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  background: var(--gradient-main);
  color: #fff;
  border: none;
  cursor: pointer;
  margin-left: 12px;
  transition: all 0.2s;
}
.copy-btn:hover { opacity: 0.9; }
.copy-btn.copied { background: var(--accent-2); }

.install-tip {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* API Key 展示 */
.api-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  margin-bottom: 10px;
}
.api-key-box code {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: "SF Mono", "Fira Code", monospace;
}
.api-key-box .copy-btn {
  margin-left: 0;
}

/* 记忆列表 */
.memories-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
}
.memory-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-xs);
  padding: 4px;
}
.memory-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  border: none;
  background: transparent;
  font-weight: 500;
}
.memory-tab:hover { color: var(--text-primary); }
.memory-tab.active {
  background: var(--glass-bg);
  color: var(--accent-1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.memory-item {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  transition: all 0.2s;
}
.memory-item .memory-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.memory-item:hover {
  border-color: rgba(124, 92, 252, 0.2);
}

.memories-empty {
  text-align: center;
  padding: 36px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ═══ 弹窗 ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}
.modal-card h3 { margin-bottom: 10px; }
.modal-card p { color: var(--text-secondary); font-size: 14px; margin-bottom: 18px; }

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 18px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.toast.success { background: var(--accent-2-light); border: 1px solid var(--accent-2); color: var(--accent-2); }
.toast.error { background: rgba(232,96,108,0.08); border: 1px solid var(--accent-3); color: var(--accent-3); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ═══ 加载 ═══ */
.loading {
  text-align: center;
  padding: 36px;
  color: var(--text-secondary);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

/* ═══ 响应式 ═══ */
@media (max-width: 480px) {
  .hero-title { font-size: 28px; letter-spacing: -1px; }
  .hero-sub { font-size: 15px; }
  .section-title { font-size: 22px; }
  .container { padding: 0 16px; }
  .agent-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .agent-card { padding: 16px 10px; }
  .agent-icon { width: 40px; height: 40px; }
  .agent-card h3 { font-size: 13px; }
  .features-grid { grid-template-columns: 1fr; }
  .nav-links a[href="#agents"],
  .nav-links a[href="#how-it-works"],
  .nav-links a[href="#features"] { display: none; }
}

@media (max-width: 768px) {
  .hero-title { font-size: 34px; }
  .hero-sub { font-size: 16px; }
  .live-counter { flex-direction: column; gap: 14px; }
  .counter-divider { display: none; }
  .nav-inner { flex-direction: column; gap: 10px; }
  .dashboard-header { flex-direction: column; gap: 6px; text-align: center; }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .section-title { font-size: 26px; }
}
