/* AI 技能商店 — 浅色 Vercel/Linear 风格 */
:root {
  --bg: #ffffff;
  --bg-sub: #fafafa;
  --bg-hover: #f5f5f5;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --text: #171717;
  --text-dim: #666666;
  --text-faint: #999999;
  --accent: #0070f3;
  --accent-hover: #0060d0;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 10px;
  --shadow: 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .12);
}

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

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

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 24px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 16px; font-weight: 600; white-space: nowrap; letter-spacing: -.2px; }
.logo span { color: var(--accent); }
.stat-mini { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

.search-wrap { flex: 1; max-width: 560px; position: relative; }
.search-input {
  width: 100%; height: 36px; padding: 0 36px 0 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sub); font-size: 14px; color: var(--text);
  outline: none; transition: border-color .15s, background .15s;
}
.search-input:focus { border-color: var(--accent); background: #fff; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px; display: none;
}
.search-clear:hover { background: var(--bg-hover); color: var(--text); }
.search-clear.show { display: block; }

/* ---------- 布局 ---------- */
.layout { display: flex; align-items: flex-start; }

.sidebar {
  width: 232px; flex-shrink: 0;
  height: calc(100vh - 60px);
  position: sticky; top: 60px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 16px 12px 40px;
}
.side-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-faint);
  padding: 14px 10px 6px;
}
.side-title:first-child { padding-top: 0; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 6px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text-dim); text-align: left;
  transition: background .12s, color .12s;
}
.cat-item:hover { background: var(--bg-hover); color: var(--text); }
.cat-item.active { background: #eff6ff; color: var(--accent); font-weight: 500; }
.cat-count { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cat-item.active .cat-count { color: var(--accent); }

.filter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 13px; color: var(--text-dim); cursor: pointer;
  border-radius: 6px;
}
.filter-row:hover { background: var(--bg-hover); }
.filter-row input { accent-color: var(--accent); cursor: pointer; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.result-count { font-size: 13px; color: var(--text-dim); }
.result-count b { color: var(--text); font-variant-numeric: tabular-nums; }
.sorts { display: flex; gap: 4px; }
.sort-btn {
  padding: 5px 11px; font-size: 13px; border-radius: 6px;
  color: var(--text-dim); border: 1px solid var(--border);
  transition: all .12s;
}
.sort-btn:hover { border-color: var(--border-strong); color: var(--text); }
.sort-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 12px;
}
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; background: var(--bg);
  cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }

.card-head { display: flex; gap: 10px; align-items: flex-start; }
.card-icon {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0;
  background: var(--bg-sub); border: 1px solid var(--border);
  object-fit: cover;
}
.card-icon-fallback {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #f0f4ff, #e8eeff);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.card-title {
  font-size: 14px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.card-author { font-size: 12px; color: var(--text-faint); }

.card-desc {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 38px;
}
.card-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-faint);
  padding-top: 4px; border-top: 1px solid var(--border); margin-top: auto;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 20px;
  background: var(--bg-sub); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-dim); white-space: nowrap;
}
.chip-blue { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.chip-green { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.chip-amber { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.chip-red { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-gray { background: #c4c4c4; }

.heat { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }

.card-actions { margin-top: 2px; }
.card-install {
  width: 100%; padding: 7px 0; border-radius: 7px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  transition: background .12s;
}
.card-install:hover { background: var(--accent-hover); }

/* ---------- 加载更多 ---------- */
.load-more { text-align: center; padding: 28px 0; color: var(--text-faint); font-size: 13px; }
.empty { text-align: center; padding: 80px 20px; color: var(--text-faint); }
.empty h3 { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .35);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.overlay.show { display: flex; }
.modal {
  background: var(--bg); border-radius: 14px;
  width: 100%; max-width: 760px;
  box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .16s ease-out;
}
.install-only { max-width: 560px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.modal-head {
  display: flex; gap: 14px; padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.modal-icon {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg-sub); border: 1px solid var(--border); object-fit: cover;
}
.modal-icon-fallback {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #f0f4ff, #e8eeff);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600; color: var(--accent);
}
.modal-title { font-size: 18px; font-weight: 600; line-height: 1.3; padding-right: 36px; }
.modal-sub { font-size: 13px; color: var(--text-faint); margin-top: 3px; }
.modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 28px; height: 28px; border-radius: 6px;
  color: var(--text-faint); font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 18px 24px 24px; }
.sec-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-faint); margin: 18px 0 8px;
}
.sec-title:first-child { margin-top: 0; }
.desc-block { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; white-space: pre-wrap; }
.desc-block.en { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kv {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; background: var(--bg-sub);
}
.kv-k { font-size: 11px; color: var(--text-faint); }
.kv-v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tab {
  padding: 5px 12px; font-size: 13px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--text-dim); transition: all .12s;
}
.tab:hover { border-color: var(--border-strong); color: var(--text); }
.tab.active { background: var(--text); color: #fff; border-color: var(--text); }

.cmd-box {
  display: flex; align-items: center; gap: 10px;
  background: #0c0c0c; border-radius: 8px; padding: 11px 13px;
}
.cmd-text {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; color: #e8e8e8; word-break: break-all; line-height: 1.5;
}
.copy-btn {
  flex-shrink: 0; padding: 5px 12px; border-radius: 6px;
  background: #fff; color: #171717; font-size: 12px; font-weight: 500;
  transition: opacity .12s;
}
.copy-btn:hover { opacity: .85; }
.copy-btn.done { background: var(--green); color: #fff; }

.tip {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #fffbeb; border: 1px solid #fde68a;
  font-size: 12.5px; color: #92400e; line-height: 1.6;
}
.tip-soft { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.tip code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: rgba(0, 0, 0, .06); padding: 1px 4px; border-radius: 3px;
}

.prompt-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f6f9ff; border: 1px solid #dbeafe; border-radius: 10px;
  padding: 13px 14px;
}
.prompt-text {
  flex: 1; font-size: 13px; color: #1e3a5f; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; min-height: 96px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.copy-prompt { background: var(--accent); color: #fff; font-weight: 600; }
.copy-prompt:hover { opacity: .9; }
.copy-prompt.done { background: var(--green); }

.cmd-collapsible { margin-top: 10px; }
.link-btn {
  font-size: 12.5px; color: var(--text-dim); padding: 4px 0;
  display: inline-flex; align-items: center; gap: 2px;
}
.link-btn:hover { color: var(--accent); }
.cmd-collapsible .cmd-box { margin-top: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.loading-detail { padding: 40px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .search-wrap { max-width: none; }
}
