/* prompt-hub — 极简检索站 */
:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --card: #181b1f;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #2a2e33;
    --accent: #818cf8;
    --accent-soft: #1e2130;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── 顶栏 ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 10px;
}
.topbar-inner { display: flex; align-items: center; gap: 16px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.logo { font-size: 20px; margin: 0; white-space: nowrap; }
.logo span { color: var(--accent); }
.search-wrap { flex: 1; min-width: 240px; display: flex; align-items: center; gap: 10px; }
#search {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.result-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ── 筛选 ── */
.filters { max-width: 1200px; margin: 10px auto 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.type-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#category-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  max-width: 260px;
}

/* ── 列表 ── */
.grid {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; flex: 1; }
.card-copy {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 6px;
  flex-shrink: 0;
}
.card-copy:hover { background: var(--accent-soft); color: var(--accent); }
.card-preview {
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge.type { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge.custom { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge.thumb { background: transparent; border: none; padding: 0; }
.badge.thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }
.sentinel { text-align: center; color: var(--muted); padding: 20px; font-size: 13px; }

/* ── 详情 ── */
.detail {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  overflow-y: auto;
}
.detail-bar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .9; }
.detail-body { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.detail-body h2 { margin: 0 0 10px; font-size: 22px; }
.d-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.d-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
}
.d-media { margin: 0 0 16px; }
.d-media img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
}
.d-examples h3 { font-size: 15px; color: var(--muted); margin: 20px 0 10px; }
.d-examples .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.d-examples .thumbs figure { margin: 0; }
.d-examples .thumbs img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.d-examples .thumbs figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── 其他 ── */
.foot {
  max-width: 1200px;
  margin: 30px auto;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}
.foot a { color: var(--accent); text-decoration: none; }
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 99;
}

/* ── 响应式 ── */
@media (max-width: 640px) {
  .topbar-inner { gap: 8px; }
  .grid { grid-template-columns: 1fr; }
  .result-count { display: none; }
}
