:root {
  --primary: #3498db;
  --primary-dark: #2980b9;
  --primary-light: #d6eaf8;
  --primary-middle: #2980b9;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #7f8c8d;
  --gray: #95a5a6;
  --border: #ecf0f1;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #f0f7ff, #e3f2fd);
  color: var(--text);
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1rem;
  color: var(--gray);
  max-width: 800px;
  margin: 0 auto 20px;
}

/* Search & Filter Bar */
.search-filter {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-input {
  width: 100%;
  padding: 12px 36px 12px 16px; /* 右侧留出 × 按钮空间 */
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #aaa;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover {
  color: #333;
  background: #f0f0f0;
}

.filters {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.checkbox-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.checkbox-item input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.checkbox-item input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkbox-item input:checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ✅ 新增：结果计数 */
.result-count {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Cards Grid - ✅ 固定 4 列（桌面） */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 340px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card-header {
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-middle));
  border-bottom: 1px solid #d1e0ec;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--card-bg);
  margin-bottom: 6px;
  word-break: break-word;
}

.card-meta {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--primary-light);
  flex-wrap: wrap;
}

.card-meta span::before {
  content: "• ";
  margin-left: 6px;
}
.card-meta span:first-child::before {
  content: "";
  margin-left: 0;
}

.card-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #555;
  scrollbar-gutter: stable;
}

/* 滚动条：默认隐藏，hover 卡片时显示（Webkit） */
.card-body::-webkit-scrollbar {
  width: 6px;
  background: transparent;
}
.card-body::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
  visibility: hidden;
}
.card:hover .card-body::-webkit-scrollbar-thumb {
  visibility: visible;
}

/* Firefox 兼容：弱化滚动条，hover 时加深 */
.card-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(204, 204, 204, 0) transparent;
}
.card:hover .card-body {
  scrollbar-color: #ccc transparent;
}

.card-actions {
  padding: 12px 16px;
  background: #fafafa;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy {
  background: #f1f8ff;
  color: var(--primary);
}

.btn-copy:hover {
  background: #e1f0ff;
}

.btn-link {
  background: #e8f4fc;
  color: #2980b9;
}

.btn-link:hover {
  background: #d6eaf8;
}

/* ✅ 统一空/加载状态：居中 */
.status-placeholder {
  grid-column: 1 / -1; /* 横跨整行 */
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 1.2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.logo {
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /*height: 24px;*/
  min-width: 28px;
  padding: 2px 8px;
  margin-top: -18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 14px;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}

.home-badge:hover {
  background: var(--primary);
  color: white;
}

.home-badge:focus {
  outline: 2px solid rgba(52, 152, 219, 0.4);
  outline-offset: 2px;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

footer a,
footer a:visited,
footer a:hover,
footer a:active {
    color: var(--text-light);
    text-decoration: none;
}

/* ✅ 响应式：4 → 2 → 1 列 */
@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .search-input {
    padding-right: 16px; /* 移动端可不显示 × 或微调 */
  }
  .clear-btn {
    right: 8px;
    font-size: 1.2rem;
  }
}