/* ===== Skill Hub 现代集市 UI ===== */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef2ff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.16);
  --maxw: 1200px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; }
.logo .logo-icon { font-size: 22px; }
.logo span { color: var(--text); }
.logo .dot { color: var(--primary); }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--text-muted);
  font-weight: 500; padding: 7px 14px; border-radius: 9px; transition: .2s;
  font-size: 14px;
}
.nav a:hover, .nav a.active { color: var(--primary); background: var(--primary-soft); }

/* ===== Main ===== */
#app { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 60px; }
.page-title { font-size: 26px; margin-bottom: 4px; font-weight: 700; }
.page-sub { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

/* ===== Search bar ===== */
.search-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.search-bar .field { display: flex; gap: 10px; flex: 1; min-width: 240px; }
.search-bar input[type=text] {
  flex: 1; min-width: 160px; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; outline: none; transition: .2s;
}
.search-bar input[type=text]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.search-bar select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); font-size: 14px; cursor: pointer; color: var(--text); outline: none;
}
.search-bar select:focus { border-color: var(--primary); }
.search-bar button.primary {
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 0 22px; font-weight: 600; cursor: pointer; font-size: 15px; transition: .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.search-bar button.primary:hover { background: var(--primary-dark); }
.search-bar button.primary:active { transform: scale(.98); }

/* ===== Source chips ===== */
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row .label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 13px; color: var(--text-muted); transition: .2s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Card grid ===== */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: .22s; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 8px 24px rgba(99,102,241,.14); }
.card h3 { font-size: 16px; margin-bottom: 6px; line-height: 1.35; }
.card p { font-size: 13px; color: var(--text-muted); flex: 1; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .meta { margin-top: 14px; font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .meta-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .src-tag { background: var(--primary-soft); color: var(--primary); padding: 2px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap; }
.card .cat-tag { color: var(--text-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .rank { color: #f59e0b; font-weight: 700; font-size: 12px; white-space: nowrap; }
.card .stars { color: var(--text-muted); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 30px; align-items: center; flex-wrap: wrap; }
.pagination button {
  padding: 8px 18px; border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; transition: .2s;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { color: var(--text-muted); font-size: 14px; }

/* ===== Drawer ===== */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200; display: flex; justify-content: flex-end; opacity: 1; transition: opacity .25s; }
.drawer-overlay.hidden { display: none; }
.drawer {
  width: 520px; max-width: 94vw; height: 100%; background: var(--card);
  box-shadow: -8px 0 30px rgba(0,0,0,.18); padding: 32px 28px; overflow-y: auto;
  transform: translateX(0); transition: transform .28s ease;
}
.drawer h2 { font-size: 22px; margin-bottom: 14px; padding-right: 32px; line-height: 1.35; }
.drawer .close {
  position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border: none;
  background: var(--bg); border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; transition: .2s;
}
.drawer .close:hover { background: var(--danger-soft); color: var(--danger); }
.drawer .field { margin-bottom: 16px; }
.drawer .field label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; font-weight: 500; }
.drawer .field .val { font-size: 14px; color: var(--text); }
.drawer .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.drawer .tags span { background: var(--bg); padding: 3px 10px; border-radius: 6px; font-size: 12px; }
.drawer .install { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.drawer .drawer-actions { margin-top: 22px; display: flex; gap: 10px; }
.drawer .visit { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; padding: 10px 20px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; transition: .2s; }
.drawer .visit:hover { background: var(--primary-dark); }
.drawer .visit.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.drawer .visit.secondary:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ===== Submit form ===== */
.submit-form { max-width: 620px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.submit-form .form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.submit-form .form-row > div { flex: 1; min-width: 220px; }
.submit-form label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text-muted); font-weight: 500; }
.submit-form label .req { color: var(--danger); }
.submit-form input, .submit-form textarea, .submit-form select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 16px; font-size: 14px; outline: none; font-family: inherit; transition: .2s; background: var(--card); color: var(--text);
}
.submit-form input:focus, .submit-form textarea:focus, .submit-form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.submit-form input.invalid, .submit-form textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.submit-form .hint { font-size: 12px; color: var(--text-muted); margin-top: -10px; margin-bottom: 14px; }
.submit-form .error-msg { font-size: 12px; color: var(--danger); margin-top: -10px; margin-bottom: 14px; display: none; }
.submit-form .field-error { display: block; }
.submit-form button[type=submit] {
  background: var(--primary); color: #fff; border: none; padding: 12px 28px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: .2s; display: inline-flex; align-items: center; gap: 8px;
}
.submit-form button[type=submit]:hover { background: var(--primary-dark); }
.submit-form button[type=submit]:disabled { opacity: .6; cursor: not-allowed; }
.submit-note { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.submit-success {
  text-align: center; padding: 40px 24px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.submit-success .icon { font-size: 44px; margin-bottom: 12px; }
.submit-success h3 { font-size: 20px; margin-bottom: 8px; }
.submit-success p { color: var(--text-muted); font-size: 14px; }

/* ===== Loading / Empty / Error ===== */
.state-box { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.state-box .icon { font-size: 40px; margin-bottom: 12px; }
.state-box h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.state-box p { font-size: 14px; }
.state-box .retry { margin-top: 16px; }

/* Skeleton loading */
.skeleton { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.skeleton .bar { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; margin-bottom: 10px; }
.skeleton .bar.h { height: 16px; width: 60%; }
.skeleton .bar.t { height: 12px; }
.skeleton .bar.s { width: 40%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Spinner button */
.btn-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: 10px; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: toast-in .3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast .t-close { margin-left: auto; cursor: pointer; opacity: .8; background: none; border: none; color: #fff; font-size: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Footer ===== */
.footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Mobile ===== */
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; }
  #app { padding: 20px 16px 50px; }
  .page-title { font-size: 22px; }
  .search-bar { padding: 10px; }
  .search-bar .field { min-width: 100%; }
  .search-bar select { flex: 1; }
  .search-bar button.primary { width: 100%; justify-content: center; padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card { padding: 14px; }
  .card h3 { font-size: 14px; }
  .drawer { padding: 24px 18px; max-width: 100vw; width: 100%; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .logo { font-size: 17px; }
  .form-row { flex-direction: column; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1440px) {
  #app { max-width: 1360px; }
}

/* ===== Hero 数据统计横幅 ===== */
.hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  color: #fff; padding: 46px 24px 40px; text-align: center;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; }
.hero-title { font-size: 30px; font-weight: 800; margin-bottom: 10px; letter-spacing: .5px; }
.hero-title span { background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 8px; }
.hero-sub { font-size: 15px; opacity: .92; margin-bottom: 26px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.hero-stats .stat { text-align: center; }
.hero-stats .stat-num { font-size: 26px; font-weight: 800; display: block; }
.hero-stats .stat-label { font-size: 13px; opacity: .85; }

/* ===== 卡片头部图标与星级增强 ===== */
.card .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card .card-emoji { font-size: 26px; line-height: 1; }
.card h3 { font-size: 16px; margin: 0; line-height: 1.3; flex: 1; }
.card .card-body p { font-size: 13px; color: var(--text-muted); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .install-hint {
  margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--text-muted); background: var(--bg);
  border-radius: 6px; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .stars {
  display: inline-flex; align-items: center; gap: 3px; color: #f59e0b; font-weight: 600;
  font-size: 12px; white-space: nowrap;
}

@media (max-width: 720px) {
  .hero { padding: 32px 16px 28px; }
  .hero-title { font-size: 23px; }
  .hero-stats { gap: 24px; }
  .hero-stats .stat-num { font-size: 20px; }
}

/* ===== 卡片 meta 右部布局 ===== */
.card .meta-right { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

