:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-soft: linear-gradient(135deg, #f5f7ff 0%, #ede9fe 100%);
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 4px 24px rgba(102, 126, 234, 0.08);
  --shadow-hover: 0 8px 32px rgba(102, 126, 234, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ========== 导航栏 ========== */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}
.nav-links a:hover { background: var(--gradient-soft); color: var(--primary); }
.nav-links a.active { color: var(--primary); background: var(--gradient-soft); }
.nav-user {
  display: flex; align-items: center; gap: 12px;
}
.bean-badge {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ========== 认证页（登录/注册） ========== */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--gradient-soft);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: var(--gradient);
  opacity: .08;
  border-radius: 50%;
  filter: blur(40px);
}
.auth-page::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 300px; height: 300px;
  background: var(--secondary);
  opacity: .08;
  border-radius: 50%;
  filter: blur(40px);
}
.auth-card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.12);
  overflow: hidden;
  max-width: 920px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  z-index: 1;
}
.auth-banner {
  background: var(--gradient);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-banner h1 { font-size: 28px; margin-bottom: 16px; line-height: 1.4; }
.auth-banner p { opacity: .9; font-size: 15px; margin-bottom: 32px; }
.auth-features { display: flex; flex-direction: column; gap: 20px; }
.auth-feature { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.auth-feature-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.auth-form-wrap { padding: 48px 40px; }
.auth-form-wrap h2 { font-size: 22px; margin-bottom: 8px; }
.auth-form-wrap .sub { color: var(--text-light); font-size: 14px; margin-bottom: 28px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fafbfc;
  transition: all .2s;
  color: var(--text);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}
.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-light);
  margin: 16px 0;
}
.form-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}
.form-success {
  background: #f0fdf4;
  color: var(--success);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid #bbf7d0;
}

/* ========== 首页 ========== */
.hero {
  background: var(--gradient);
  color: #fff;
  padding: 56px 24px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,.1), transparent 50%);
}
.hero h1 { font-size: 36px; margin-bottom: 12px; position: relative; }
.hero p { font-size: 16px; opacity: .9; max-width: 600px; margin: 0 auto; position: relative; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 32px;
  position: relative;
}
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 28px; font-weight: 700; }
.hero-stat .label { font-size: 13px; opacity: .85; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: -40px 0 24px;
  position: relative;
  z-index: 2;
}
.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  padding: 0 16px;
}
.search-box input {
  flex: 1;
  border: none;
  padding: 14px 8px;
  font-size: 15px;
  background: transparent;
  font-family: inherit;
  color: var(--text);
}
.search-box input:focus { outline: none; }
.search-box .icon { color: var(--text-muted); font-size: 18px; }

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  padding: 4px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.filter-tab {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all .2s;
  border: none;
  background: transparent;
  font-family: inherit;
}
.filter-tab:hover { color: var(--primary); }
.filter-tab.active { background: var(--gradient); color: #fff; }

/* 接口卡片列表 */
.api-list { padding-bottom: 60px; }
.api-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: all .2s;
  border: 1px solid transparent;
}
.api-card:hover { box-shadow: var(--shadow-hover); border-color: rgba(102,126,234,.2); }
.api-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.api-info { flex: 1; min-width: 0; }
.api-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}
.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-2 { background: linear-gradient(135deg, #d1d5db, #9ca3af); color: #fff; }
.rank-3 { background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; }
.rank-other { background: #f3f4f6; color: var(--text-light); }

.official-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 600;
}
.category-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gradient-soft);
  color: var(--primary);
  font-weight: 600;
}
.api-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--text-light);
}
.api-meta span { display: flex; align-items: center; gap: 4px; }
.api-meta .views { color: var(--primary); font-weight: 600; }

.api-url-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8f9fb;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.api-url-locked {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 2px;
}
.api-url-text {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}
.api-actions { display: flex; gap: 8px; flex-shrink: 0; }

.api-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}
.share-by { display: flex; align-items: center; gap: 6px; }

/* ========== Dashboard ========== */
.dash-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 32px 0 60px;
}
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.dash-card h3 { font-size: 16px; margin-bottom: 16px; }
.bean-display {
  text-align: center;
  padding: 8px 0;
}
.bean-display .big {
  font-size: 40px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bean-display .label { font-size: 14px; color: var(--text-light); }
.dash-menu { display: flex; flex-direction: column; gap: 4px; }
.dash-menu a {
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-menu a:hover, .dash-menu a.active { background: var(--gradient-soft); color: var(--primary); }

.dash-main { display: flex; flex-direction: column; gap: 24px; }

.share-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.share-form .full { grid-column: 1 / -1; }

/* ========== 空状态 ========== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty .icon { font-size: 48px; margin-bottom: 16px; }
.empty p { font-size: 15px; }

/* ========== Toast ========== */
.toast-wrap {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid var(--primary);
  animation: slideIn .3s ease;
  max-width: 360px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== 页脚 ========== */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.footer a { color: var(--text-light); margin: 0 12px; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .auth-card { grid-template-columns: 1fr; max-width: 440px; }
  .auth-banner { padding: 32px; }
  .auth-form-wrap { padding: 32px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { gap: 24px; }
  .dash-grid { grid-template-columns: 1fr; }
  .share-form { grid-template-columns: 1fr; }
  .nav-inner { padding: 0 16px; }
  .container { padding: 0 16px; }
  .api-card { padding: 18px; }
  .api-meta { gap: 12px; }
}

@media (max-width: 480px) {
  .nav-links a:not(.btn) { display: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-tabs { overflow-x: auto; }
}
