:root {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --accent: #7c3aed;
  --success: #16a34a;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  color: white;
  padding: 28px 0 24px;
  margin-bottom: 28px;
}
.logo { font-size: 28px; font-weight: 700; }
.tagline { font-size: 14px; opacity: 0.8; margin-top: 4px; }

/* ===== Stats ===== */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  text-align: center;
  flex: 1;
}
.stat-item span {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}
.stat-item small { color: var(--muted); font-size: 13px; }

/* ===== Filter ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.filter-bar input[type="text"]:focus { border-color: var(--primary); }
.filter-bar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}
.ai-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

/* ===== Cards ===== */
.paper-list { display: flex; flex-direction: column; gap: 14px; }

.paper-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
}
.paper-card:hover {
  box-shadow: 0 4px 20px rgba(37,99,235,.12);
  transform: translateY(-1px);
}
.paper-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.paper-title-zh {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.paper-title-en {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.paper-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  align-items: center;
}
.paper-summary {
  font-size: 13px;
  color: #475569;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 28px 0;
  flex-wrap: wrap;
}
.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  overflow-y: auto;
  padding: 40px 20px;
}
.modal-overlay.open { display: block; }
.modal {
  background: white;
  border-radius: 16px;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 16px;
}
.modal-title-zh { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-title-en { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.modal-section { margin-bottom: 20px; }
.modal-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.modal-section p { font-size: 14px; line-height: 1.8; color: #334155; }

.ai-block {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ai-block-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}
.ai-block p { font-size: 13px; line-height: 1.7; }

.factor-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 10px;
}
.factor-name { font-weight: 600; font-size: 14px; color: #15803d; }
.factor-desc { font-size: 13px; color: #374151; margin-top: 4px; }

.modal-links { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.link-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-btn-primary { background: var(--primary); color: white; }
.link-btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.loading {
  text-align: center;
  padding: 60px;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 600px) {
  .stats-bar { flex-direction: column; }
  .modal { padding: 20px; }
  .paper-card-header { flex-direction: column; }
}
