/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-hover: #fbfcff;
  --border: #e4e7f0;
  --border-strong: #d4d9e6;
  --text: #171b2f;
  --text-secondary: #5b6479;
  --text-muted: #9099ad;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #f59e0b;
  --gold: #eab308;
  --gold-deep: #ca8a04;
  --success: #10b981;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(23,27,47,.05), 0 1px 3px rgba(23,27,47,.06);
  --shadow: 0 2px 4px rgba(23,27,47,.05), 0 10px 28px rgba(23,27,47,.07);
  --shadow-lg: 0 6px 12px rgba(23,27,47,.07), 0 20px 48px rgba(23,27,47,.11);
  --shadow-gold: 0 2px 5px rgba(234,179,8,.16), 0 10px 26px rgba(234,179,8,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== Header ===== */
.header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #141528 0%, #1b2140 55%, #14305e 100%);
  color: #fff;
  padding: 46px 0 40px;
  text-align: center;
}
/* 顶部金色饰线 */
.header::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #f59e0b 30%, #fcd34d 50%, #f59e0b 70%, transparent);
}
/* 顶部柔光晕 */
.header::before {
  content: '';
  position: absolute;
  top: -140px;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  height: 320px;
  background: radial-gradient(closest-side, rgba(245,158,11,.16), transparent 72%);
  pointer-events: none;
}
.header h1 {
  position: relative;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
.header .subtitle {
  position: relative;
  margin: 10px auto 0;
  font-size: .95rem;
  opacity: .88;
  max-width: 620px;
}
.header .meta {
  position: relative;
  margin-top: 8px;
  font-size: .85rem;
  opacity: .78;
}
.header .gold-hint {
  color: #fcd34d;
  font-weight: 600;
  opacity: 1;
}

/* ===== Controls ===== */
.controls {
  margin: 26px 0 16px;
}
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 17px;
}
.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.filter-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}
.filter-kicker {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.filter-sub {
  font-size: .76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .82rem;
  font-family: var(--font);
  line-height: 1.5;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.filter-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.filter-btn.cat:hover {
  border-color: var(--cat-border);
  color: var(--cat-color);
}
.filter-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.filter-btn.active {
  background: linear-gradient(135deg, #4f46e5, #6d63f0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(79,70,229,.24);
}
.filter-btn.cat.active {
  background: var(--cat-bg);
  border-color: var(--cat-border);
  color: var(--cat-color);
  box-shadow: inset 0 0 0 1px var(--cat-border);
}
.filter-ico {
  font-size: .9rem;
  line-height: 1;
  flex: none;
}
.filter-count {
  min-width: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(23,27,47,.055);
  color: var(--text-muted);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.65;
  text-align: center;
  transition: background .15s ease, color .15s ease;
}
.filter-btn:hover .filter-count { color: var(--text-secondary); }
.filter-btn.active .filter-count {
  background: rgba(255,255,255,.22);
  color: #fff;
}
.filter-btn.cat.active .filter-count {
  background: #fff;
  color: var(--cat-color);
}
.filter-divider {
  width: 1px;
  align-self: stretch;
  min-height: 24px;
  margin: 2px 3px;
  background: var(--border);
  flex: none;
}

.search-bar { flex: 0 1 268px; min-width: 190px; }
.search-bar input {
  width: 100%;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
  background: var(--bg);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.stats-bar span { font-size: .88rem; color: var(--text-secondary); flex: 1; }
.stats-bar strong { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
  font-weight: 500;
}
.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6d63f0);
  color: #fff;
  box-shadow: 0 3px 10px rgba(79,70,229,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #5a50e8);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(79,70,229,.34);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }

/* ===== Skills Grid ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.skill-card:hover {
  border-color: #c7cdf5;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  background: var(--surface-hover);
}
.skill-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.skill-card.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}

/* ---- 金色卡片：本站原创精选 ---- */
.skill-card--own {
  border-color: #f0d48a;
  background: linear-gradient(135deg, #fffdf6 0%, #fef9e9 50%, #fdf3cd 100%);
  box-shadow: var(--shadow-gold);
}
.skill-card--own:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(234,179,8,.2), 0 16px 40px rgba(234,179,8,.16);
}
.skill-card--own.selected {
  border-color: var(--gold-deep);
  background: linear-gradient(135deg, #fffdf6 0%, #fdeeb4 100%);
  box-shadow: 0 0 0 3px rgba(234,179,8,.18);
}
.skill-card--own.selected::before { background: var(--gold); }
.skill-card--own .skill-icon {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  box-shadow: 0 2px 6px rgba(245,158,11,.35);
}
.skill-card--own .skill-name { color: #92400e; }

.skill-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  transition: all .15s;
  font-size: 12px;
  color: transparent;
  background: var(--surface);
}
.skill-card.selected .skill-check { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 4px rgba(79,70,229,.35); }

.skill-body { flex: 1; min-width: 0; }
.skill-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 5px;
}
.skill-icon {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.skill-name { font-size: .95rem; font-weight: 600; }
.skill-badge {
  font-size: .6rem;
  font-weight: 700;
  line-height: 1.9;
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #fff;
  padding: 0 9px;
  border-radius: 999px;
  letter-spacing: .04em;
  box-shadow: 0 1px 4px rgba(234,179,8,.4), inset 0 1px 0 rgba(255,255,255,.3);
  white-space: nowrap;
  vertical-align: middle;
}
.skill-stars {
  font-size: .75rem;
  color: var(--accent);
  font-weight: 600;
}
.skill-cat {
  font-size: .62rem;
  color: var(--cat-color, var(--primary));
  background: var(--cat-bg, var(--primary-soft));
  padding: 0 7px;
  border-radius: 8px;
  border: 1px solid var(--cat-border, var(--border));
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: 0.02em;
}
.skill-source {
  font-size: .72rem;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 10px;
}
.skill-desc {
  font-size: .83rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.skill-updated {
  font-size: .68rem;
  color: var(--text-secondary);
  opacity: .75;
  margin-top: 6px;
  letter-spacing: .02em;
}

.skill-repo {
  font-size: .65rem;
  font-family: var(--font);
  color: #fff;
  background: #24292e;
  border-radius: 5px;
  padding: 1px 7px;
  margin-left: auto;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.6;
}
.skill-repo:hover {
  background: #0366d6;
  text-decoration: none;
}

.skill-card.hidden { display: none; }

/* ===== Output Section ===== */
.output-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.output-section h2 { font-size: 1.1rem; margin-bottom: 4px; }
.output-hint { font-size: .85rem; color: var(--text-secondary); margin-bottom: 12px; }
.output-section textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--text);
  background: #fafbfd;
  margin-bottom: 12px;
}
.output-section textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* ===== LSP Section ===== */
.section-head {
  margin: 34px 0 16px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
.section-head h2 { font-size: 1.2rem; letter-spacing: -.2px; }
.section-sub { font-size: .85rem; color: var(--text-secondary); margin-top: 4px; }
.section-sub strong { color: var(--primary); }

.lsp-card .skill-icon {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13,148,136,.3);
  font-size: .65rem;
  overflow: hidden;
}
.lsp-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
}
.lsp-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lsp-title .skill-name {
  font-family: var(--font-mono);
  font-size: .86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.lsp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lsp-meta .skill-source {
  margin-top: 0;
  font-size: .62rem;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  opacity: 1;
}
.lsp-top .skill-repo { margin-left: 0; flex: none; }
.lsp-card .skill-cat.lsp-lang {
  --cat-color: #0d9488;
  --cat-bg: rgba(13,148,136,.13);
  --cat-border: rgba(13,148,136,.28);
}
.lsp-rating { font-size: .72rem; letter-spacing: -.06em; white-space: nowrap; }
.lsp-install {
  margin-top: 8px;
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lsp-card.selected .lsp-install { background: rgba(79,70,229,.06); }

/* ===== Footer ===== */
.footer {
  margin-top: auto;
  text-align: center;
  padding: 26px 0;
  color: var(--text-secondary);
  font-size: .82rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer a { color: var(--text-secondary); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #171b2f;
  color: #fff;
  padding: 10px 26px;
  border-radius: 999px;
  font-size: .88rem;
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(23,27,47,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Empty State ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header { padding: 30px 0 26px; }
  .header h1 { font-size: 1.55rem; }
  .filter-panel { padding: 14px 14px 15px; border-radius: 16px; }
  .filter-panel-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 11px; }
  .search-bar { flex: 1 1 auto; min-width: 0; }
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-btn { flex: 0 0 auto; }
  .skills-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .stats-bar span { flex: none; }
  .output-section { padding: 16px; }
  .lsp-install { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 420px) {
  .filter-btn { font-size: .78rem; padding: 5px 9px; }
  .skill-header { gap: 4px 6px; }
  .skill-name { font-size: .88rem; }
}
