/* WitsFul Skills Hub — 浅色主题为主，支持深色切换 */
:root {
  --bg: #f7f9fd;
  --surface: #ffffff;
  --surface-2: #f1f5fc;
  --surface-3: #e9f0fb;
  --text: #151f32;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e4eaf4;
  --border-strong: #d3dded;
  --primary: #2b6cf6;
  --primary-dark: #1d55d6;
  --primary-soft: #eaf1ff;
  --violet: #6d5efc;
  --teal: #0eab9b;
  --amber: #e8891a;
  --danger: #e5484d;
  --shadow-sm: 0 1px 2px rgba(20, 40, 90, .05), 0 2px 8px rgba(20, 40, 90, .04);
  --shadow-md: 0 6px 22px rgba(20, 45, 100, .09);
  --shadow-lg: 0 18px 50px rgba(20, 45, 100, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1220px;
}
[data-theme="dark"] {
  --bg: #0d1424;
  --surface: #161f33;
  --surface-2: #1d2940;
  --surface-3: #243352;
  --text: #edf2ff;
  --muted: #a3b1cc;
  --muted-2: #7386a8;
  --border: #283656;
  --border-strong: #3a4a70;
  --primary: #6a9bff;
  --primary-dark: #8bb2ff;
  --primary-soft: #1d3359;
  --violet: #9d90ff;
  --teal: #38cdbb;
  --amber: #f4ad52;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 24px;
  height: 66px; display: flex; align-items: center; gap: 36px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(43, 108, 246, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -.2px; }
.brand-text small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
  padding: 8px 14px; border-radius: 9px; font-size: 14px; color: var(--muted);
  font-weight: 500; transition: .18s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: .18s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(43, 108, 246, .22); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-sm { padding: 8px 15px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: 12px; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-subtle { background: var(--surface-2); color: var(--text); }
.btn-subtle:hover { background: var(--surface-3); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--danger); }
.btn-danger:hover { background: #fdeeee; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------- Layout ---------------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
main { min-height: calc(100vh - 200px); }
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h2 { font-size: 27px; letter-spacing: -.6px; margin: 0 0 6px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 100px;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .2px;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden; padding: 76px 0 58px;
  background:
    radial-gradient(900px 380px at 15% -10%, rgba(91, 143, 255, .18), transparent 70%),
    radial-gradient(700px 360px at 88% 0%, rgba(139, 110, 255, .16), transparent 70%),
    radial-gradient(500px 300px at 60% 100%, rgba(14, 171, 155, .09), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .4;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 75%);
}
.hero-inner { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; text-align: center; }
.hero h1 {
  font-size: clamp(34px, 5.2vw, 54px); line-height: 1.2; letter-spacing: -1.8px;
  margin: 20px 0 16px; font-weight: 800;
}
.hero h1 .gradient {
  background: linear-gradient(100deg, var(--primary), var(--violet) 60%, var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 16px; color: var(--muted); max-width: 630px; margin: 0 auto 30px; }
.hero-search {
  display: flex; align-items: center; gap: 10px; max-width: 660px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 7px 7px 7px 18px; box-shadow: var(--shadow-lg); transition: .2s;
}
.hero-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(43, 108, 246, .1), var(--shadow-lg); }
.hero-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; min-width: 0; }
.hero-search input::placeholder { color: var(--muted-2); }
.hero-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.hero-tags button {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 5px 12px; border-radius: 100px; font-size: 12px; transition: .18s;
}
.hero-tags button:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; margin-top: 48px; }
.hero-stat { padding: 0 34px; border-right: 1px solid var(--border); text-align: center; }
.hero-stat:last-child { border-right: 0; }
.hero-stat b { display: block; font-size: 26px; letter-spacing: -.5px; color: var(--text); }
.hero-stat span { font-size: 12px; color: var(--muted); }

/* ---------------- Category grid ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cat-card {
  display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: .2s;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.cat-icon {
  width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 13px; background: linear-gradient(135deg, var(--primary-soft), var(--surface-3)); font-size: 22px;
  overflow: hidden; position: relative;
}
.cat-icon-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 13px; }
.cat-icon-fallback { line-height: 1; }
.cat-card .cat-name { font-weight: 650; font-size: 15px; }
.cat-card .cat-count { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------------- Skill cards ---------------- */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card {
  position: relative; display: flex; flex-direction: column; padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: .2s; min-height: 196px;
}
.skill-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: var(--shadow-md); }
.skill-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.skill-icon {
  width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 12px; background: var(--surface-2); font-size: 21px;
  border: 1px solid var(--border); overflow: hidden;
}
.skill-title-wrap { min-width: 0; flex: 1; }
.skill-name {
  font-weight: 700; font-size: 15px; line-height: 1.35; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.skill-source { font-size: 11px; color: var(--muted-2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.skill-desc {
  font-size: 13px; color: var(--muted); line-height: 1.65; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.skill-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 6px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap;
}
.tag-primary { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.star-count { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--amber); font-weight: 600; white-space: nowrap; }
.badge-user {
  position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; color: var(--teal); background: rgba(14, 171, 155, .12);
}

/* ---------------- Toolbar / filters ---------------- */
.page-head { padding: 44px 0 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.page-head h1 { font-size: 32px; letter-spacing: -.8px; margin: 0 0 8px; }
.page-head p { color: var(--muted); margin: 0; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0; }
.search-box {
  flex: 1; min-width: 240px; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 13px;
  height: 42px;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,108,246,.09); }
.search-box input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); min-width: 0; }
.search-box input::placeholder { color: var(--muted-2); }
.filter-select {
  height: 42px; padding: 0 34px 0 13px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text); appearance: none; font-size: 13px; cursor: pointer;
}
.sort-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sort-tabs button {
  padding: 8px 14px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.sort-tabs button:hover { background: var(--surface-2); color: var(--text); }
.sort-tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.result-line { font-size: 13px; color: var(--muted); margin: 4px 0 18px; }
.result-line b { color: var(--text); }

/* ---------------- Detail ---------------- */
.detail-wrap { padding: 40px 0 70px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.back-link:hover { color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 30px; box-shadow: var(--shadow-sm); }
.detail-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.detail-icon {
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font-size: 32px;
  background: linear-gradient(135deg, var(--primary-soft), var(--surface-3)); border: 1px solid var(--border); flex-shrink: 0;
  overflow: hidden;
}
.detail-head h1 { font-size: 26px; letter-spacing: -.5px; margin: 2px 0 8px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-section { margin-top: 26px; }
.detail-section h3 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.detail-desc { font-size: 14px; color: var(--muted); line-height: 1.85; }
.code-block {
  position: relative; background: #10192b; color: #d9e6ff; border-radius: 12px; padding: 18px 18px 18px 18px;
  font-size: 12.5px; line-height: 1.8; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}
.code-block .copy-btn {
  position: absolute; top: 9px; right: 9px; padding: 5px 10px; border-radius: 7px;
  border: 1px solid #33415d; background: #1c2942; color: #c7d7f5; font-size: 11px;
}
.code-block .copy-btn:hover { background: #283a5c; }
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); flex-shrink: 0; }
.info-row b { font-weight: 600; text-align: right; word-break: break-all; }

/* ---------------- Forms ---------------- */
.form-card {
  max-width: 780px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px; box-shadow: var(--shadow-sm);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 650; }
.field label .req { color: var(--danger); margin-left: 3px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--text); outline: 0; transition: .18s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,108,246,.09); }
.field textarea { resize: vertical; min-height: 180px; font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; line-height: 1.7; }
.field-hint { font-size: 11px; color: var(--muted-2); }
.drop-zone {
  border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px; text-align: center;
  background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: pointer; transition: .18s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.tip-box {
  display: flex; gap: 12px; padding: 16px 18px; border-radius: 12px; margin-bottom: 22px;
  background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  font-size: 13px; color: var(--text);
}

/* ---------------- Empty / loading ---------------- */
.loading { padding: 100px 20px; text-align: center; color: var(--muted); }
.spinner { width: 32px; height: 32px; margin: 0 auto 14px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .empty-icon { font-size: 42px; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin: 0 0 6px; }
.more-wrap { text-align: center; margin-top: 30px; }

/* ---------------- CTA / footer ---------------- */
.cta {
  margin: 20px 0 0; padding: 46px 40px; border-radius: 24px; text-align: center;
  background: linear-gradient(120deg, #eef4ff, #f4f0ff 55%, #eafcf8);
  border: 1px solid var(--border);
}
[data-theme="dark"] .cta { background: linear-gradient(120deg, #172746, #241f4a 55%, #123b3c); }
.cta h2 { font-size: 26px; margin: 0 0 10px; letter-spacing: -.5px; }
.cta p { color: var(--muted); margin: 0 0 22px; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 36px 0; margin-top: 40px; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand strong { font-size: 15px; }
.footer-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; margin: 22px 0 14px; }
.footer-links a { font-size: 13px; color: var(--muted); }
.footer-links a:hover { color: var(--primary); }
.footer-note { font-size: 11px; color: var(--muted-2); margin: 0; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--surface); padding: 11px 20px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
  .skill-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { height: 58px; gap: 12px; padding: 0 14px; }
  .nav { display: none; position: absolute; top: 58px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; padding: 10px; }
  .nav.open { display: flex; }
  .brand-text small { display: none; }
  .container { padding: 0 16px; }
  .hero { padding: 52px 0 40px; }
  .hero-stats { margin-top: 34px; }
  .hero-stat { padding: 0 16px; }
  .hero-stat b { font-size: 20px; }
  .skill-grid, .cat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .detail-card { padding: 20px; }
  .cta { padding: 34px 20px; }
}
