:root {
  --bg: #0f0f17;
  --card-bg: #1a1a2e;
  --text: #e0e0ff;
  --text-secondary: #a0a0cc;
  --accent: #7c3aed;
  --accent-hover: #a78bfa;
}

[data-theme="light"] {
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #212529;
  --text-secondary: #6c757d;
  --accent: #6f42c1;
  --accent-hover: #9d7cd8;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.header {
  padding: 1.2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
}

.theme-toggle button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
}

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

.search-bar {
  margin: 1rem 0 2rem;
}

#searchInput {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border: 1px solid #444;
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}

.book-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.22s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}

.book-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #222;
}

.book-info {
  padding: 1rem 0.9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.book-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.book-tags {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: auto;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid #333;
}

/* 响应式 */
@media (max-width: 600px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
