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

body {
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  padding: 2rem;
  line-height: 1.6;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.2rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

#total-count {
  color: #7f8c8d;
  font-size: 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.card a {
  text-decoration: none;
  color: #2980b9;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
  flex-grow: 1;
  word-break: break-word;
}

.card a:hover {
  color: #1a5276;
  text-decoration: underline;
}

#load-more {
  display: block;
  margin: 2rem auto 0;
  padding: 0.8rem 2rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

#load-more:hover {
  background: #2980b9;
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
  }
  body {
    padding: 1.2rem;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== 控件栏 ========== */
.controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

#search-input {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 30px;
  width: 320px;
  max-width: 100%;
  outline: none;
  transition: border-color 0.3s;
}

#search-input:focus {
  border-color: #3498db;
}

#theme-toggle {
  background: #f0f0f0;
  border: 2px solid #ddd;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

#theme-toggle:hover {
  background: #e0e0e0;
  transform: rotate(15deg);
}

/* ========== 暗色模式 ========== */
:root {
  --bg-primary: #f5f7fa;
  --bg-card: white;
  --text-primary: #333;
  --text-secondary: #7f8c8d;
  --border-color: #ddd;
  --shadow: rgba(0,0,0,0.08);
  --accent: #3498db;
  --accent-hover: #2980b9;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-card: #252526;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --border-color: #444;
  --shadow: rgba(0,0,0,0.3);
  --accent: #4a90e2;
  --accent-hover: #5ca0f0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.card {
  background: var(--bg-card);
  box-shadow: 0 4px 12px var(--shadow);
}

.card a {
  color: var(--accent);
}

.card a:hover {
  color: var(--accent-hover);
}

#search-input {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

#search-input::placeholder {
  color: var(--text-secondary);
}

#theme-toggle {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

/* 响应式微调 */
@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: center;
  }
  #search-input {
    width: 100%;
  }
}
