:root {
  --bg: #faf9f7;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e8e6e1;
  --accent: #e0563f;
  --accent-soft: #fdeeea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
}

.sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Header 布局与搜索 ---------- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { min-width: 0; }

.search {
  position: relative;
  flex: 0 0 auto;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 250px;
  padding: 8px 32px 8px 32px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #f4f2ee;
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.search input::placeholder { color: #9ca3af; }

.search input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 86, 63, .12);
}

.search input::-webkit-search-cancel-button { display: none; }

.clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  font-size: 16px;
  color: var(--muted);
  background: #e6e3dd;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: none;
}

.search.has-value .clear { display: block; }
.clear:hover { color: var(--text); background: #d9d5ce; }

.result-count {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.result-count b { color: var(--accent); }

.empty {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- List ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  padding: 20px 0 40px;
}

.card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .10);
}

.card .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f0eee9;
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .35s ease;
}

.card .thumb img.loaded { opacity: 1; }

.card .info { padding: 10px 12px 12px; }

.card .title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.card .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Detail ---------- */
.detail { padding: 24px 0 48px; }

.back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

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

.detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}

.cover {
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0eee9;
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .35s ease;
}

.cover img.loaded { opacity: 1; }

.detail h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.4;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.chip.plain {
  background: #f1efeb;
  color: var(--muted);
}

.desc {
  font-size: 14.5px;
  color: #3f454c;
  white-space: pre-wrap;
  margin: 0 0 22px;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(224, 86, 63, .32);
  transition: transform .15s ease, box-shadow .15s ease;
}

.download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(224, 86, 63, .42);
}

.tip {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .cover { max-width: 260px; }
  .detail h2 { font-size: 19px; }
}

@media (max-width: 640px) {
  .header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .search { flex: 1 1 auto; }
  .search input { width: 100%; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card .title { font-size: 12.5px; }
}
