/* SKILL 商店 · 用户端 深色主题 */
:root {
  --bg: #0d1117;
  --bg-soft: #11161d;
  --panel: #161b22;
  --panel-2: #1b2129;
  --border: #262d37;
  --border-strong: #30363d;
  --text: #e6edf3;
  --text-2: #9aa4b2;
  --text-3: #6b7682;
  --brand: #4f7cff;
  --brand-2: #8b5cf6;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 400px at 12% -8%, rgba(79, 124, 255, .16), transparent 60%),
    radial-gradient(700px 380px at 88% -12%, rgba(139, 92, 246, .14), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2b323c; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a424e; }

/* ---------- 布局 ---------- */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.page { min-height: calc(100vh - 64px); padding: 28px 0 60px; position: relative; z-index: 1; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; height: 64px;
  background: rgba(13, 17, 23, .82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 14px rgba(79, 124, 255, .38);
  font-size: 16px;
}
.brand small { color: var(--text-3); font-weight: 500; font-size: 11px; letter-spacing: 1px; }

.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
  padding: 8px 14px; border-radius: 8px; color: var(--text-2); font-size: 14px;
  transition: .18s; cursor: pointer; white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav-link.active { color: #fff; background: rgba(79, 124, 255, .16); box-shadow: inset 0 0 0 1px rgba(79, 124, 255, .3); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-search { position: relative; width: 240px; }
.nav-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  outline: none; transition: .18s; font-size: 13px;
}
.nav-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 124, 255, .15); }
.nav-search .ico { position: absolute; left: 11px; top: 9px; color: var(--text-3); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13.5px;
  transition: .18s; white-space: nowrap;
}
.btn:hover { background: #232a34; border-color: #3d4550; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #6366f1); border: none; color: #fff;
  box-shadow: 0 4px 16px rgba(79, 124, 255, .3);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 22px rgba(79, 124, 255, .42); }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { color: var(--red); border-color: rgba(248, 81, 73, .35); }
.btn-danger:hover { background: rgba(248, 81, 73, .12); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #2b6cb0, #6b46c1); color: #fff; font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, .12); cursor: pointer; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 通用卡片 ---------- */
.panel {
  background: linear-gradient(180deg, rgba(22, 27, 34, .92), rgba(17, 22, 29, .92));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.section-head { display: flex; align-items: center; gap: 12px; margin: 34px 0 16px; }
.section-head h2 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.section-head .sub { color: var(--text-3); font-size: 12.5px; }
.section-head .more { margin-left: auto; color: var(--text-2); font-size: 13px; cursor: pointer; }
.section-head .more:hover { color: var(--brand); }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 18px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(79, 124, 255, .1); border: 1px solid rgba(79, 124, 255, .28);
  color: #a8c0ff; font-size: 12.5px; margin-bottom: 20px;
}
.hero h1 {
  font-size: 46px; line-height: 1.16; margin: 0 0 14px; letter-spacing: -1px; font-weight: 800;
}
.hero h1 span {
  background: linear-gradient(100deg, #7ea8ff 10%, #b18cff 55%, #63e6be 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 15.5px; margin: 0 auto 30px; max-width: 620px; line-height: 1.7; }

.hero-search { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.hero-search input {
  flex: 1; height: 50px; padding: 0 18px; border-radius: 12px; font-size: 14.5px;
  background: var(--panel); border: 1px solid var(--border-strong); color: var(--text); outline: none;
  transition: .2s;
}
.hero-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 124, 255, .14); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 40px 0 6px; }
.stat {
  padding: 18px 20px; border-radius: var(--radius); background: rgba(22, 27, 34, .7);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px;
}
.stat b { font-size: 26px; font-weight: 700; letter-spacing: -.5px;
  background: linear-gradient(135deg, #fff, #9cb4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--text-3); font-size: 12.5px; }

/* ---------- 分类 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cat-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); cursor: pointer; transition: .2s;
}
.cat-card:hover { border-color: rgba(79, 124, 255, .55); transform: translateY(-2px); background: var(--panel-2); }
.cat-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 19px;
  background: rgba(79, 124, 255, .12); border: 1px solid rgba(79, 124, 255, .2); flex-shrink: 0;
}
.cat-card h4 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.cat-card p { margin: 0; font-size: 12px; color: var(--text-3); }

/* ---------- 技能卡片 ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: .22s; display: flex; flex-direction: column;
}
.skill-card:hover { transform: translateY(-3px); border-color: rgba(79, 124, 255, .5); box-shadow: var(--shadow); }
.skill-cover {
  height: 108px; position: relative; display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(135deg, rgba(79, 124, 255, .18), rgba(139, 92, 246, .15));
  border-bottom: 1px solid var(--border);
}
.skill-cover img { width: 100%; height: 100%; object-fit: cover; }

.skill-body { padding: 14px 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skill-title { font-size: 15px; font-weight: 650; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-desc {
  font-size: 12.8px; color: var(--text-2); line-height: 1.6; margin: 0; height: 41px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.skill-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #9db4ff;
  background: rgba(79, 124, 255, .1); border: 1px solid rgba(79, 124, 255, .22);
}
.skill-foot {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
.skill-foot .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.skill-foot .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- 列表页 ---------- */
.browse-layout { display: grid; grid-template-columns: 236px 1fr; gap: 22px; align-items: start; }
.filter-box { padding: 16px; }
.filter-title { font-size: 12px; color: var(--text-3); letter-spacing: 1px; text-transform: uppercase; margin: 0 0 10px; }
.filter-item {
  padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer;
  display: flex; justify-content: space-between; transition: .15s; margin-bottom: 2px;
}
.filter-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.filter-item.active { background: rgba(79, 124, 255, .14); color: #a8c0ff; }
.filter-item .cnt { font-size: 11.5px; color: var(--text-3); }
.filter-sub { padding-left: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud .tag-chip { cursor: pointer; }
.tag-cloud .tag-chip.on { background: rgba(79, 124, 255, .3); color: #fff; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.sort-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); padding: 3px; border-radius: 9px; }
.sort-tabs button {
  border: none; background: transparent; color: var(--text-2); padding: 6px 14px; border-radius: 7px;
  cursor: pointer; font-size: 13px; transition: .16s;
}
.sort-tabs button.on { background: rgba(79, 124, 255, .18); color: #fff; }
.toolbar .grow { flex: 1; }
.result-count { color: var(--text-3); font-size: 13px; }

/* ---------- 当前生效的筛选条件 ---------- */
.active-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-right: 14px; }
.af-label { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.af-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; font-size: 12.5px; cursor: pointer; transition: .16s;
  color: #79b8ff; background: rgba(88, 166, 255, .12); border: 1px solid rgba(88, 166, 255, .32);
}
.af-chip:hover { background: rgba(88, 166, 255, .22); border-color: rgba(88, 166, 255, .5); }
.af-chip i { font-style: normal; font-size: 10.5px; opacity: .7; }
.af-chip:hover i { opacity: 1; }
.af-reset {
  background: none; border: none; padding: 0 2px; cursor: pointer;
  color: var(--text-3); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px;
}
.af-reset:hover { color: #79b8ff; }

/* 顶部搜索框的清空按钮 */
.nav-search { position: relative; }
.nav-search input { padding-right: 30px; }
.nav-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%;
  font-size: 11px; color: var(--text-3); cursor: pointer; transition: .16s;
}
.nav-search-clear:hover { background: rgba(255, 255, 255, .1); color: var(--text); }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 28px 0 4px; }
.pager button {
  min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text-2); cursor: pointer; font-size: 13px; transition: .16s;
}
.pager button:hover:not(:disabled) { border-color: var(--brand); color: #fff; }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager .info { color: var(--text-3); font-size: 12.5px; margin-left: 8px; }

/* ---------- 详情页 ---------- */
.detail-head { display: flex; gap: 22px; padding: 24px; align-items: flex-start; }
.detail-icon {
  width: 76px; height: 76px; border-radius: 16px; display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(135deg, rgba(79, 124, 255, .22), rgba(139, 92, 246, .2));
  border: 1px solid rgba(79, 124, 255, .3); flex-shrink: 0; overflow: hidden;
}
.detail-icon img { width: 100%; height: 100%; object-fit: cover; }
.detail-head h1 { margin: 0 0 8px; font-size: 26px; font-weight: 750; letter-spacing: -.3px; }
.detail-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-3); font-size: 12.8px; align-items: center; }
.detail-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin: 20px 0 20px; }
.tab {
  padding: 10px 0; color: var(--text-2); font-size: 14px; cursor: pointer; position: relative;
  border-bottom: 2px solid transparent; transition: .18s;
}
.tab.on { color: #fff; border-color: var(--brand); }
.tab:hover { color: var(--text); }

.markdown { line-height: 1.85; font-size: 14.2px; color: #cfd8e3; }
.markdown h1, .markdown h2, .markdown h3 { color: #fff; margin: 26px 0 12px; line-height: 1.4; }
.markdown h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 15.5px; }
.markdown p { margin: 10px 0; }
.markdown code {
  background: #1f2630; padding: 2px 6px; border-radius: 5px; font-size: 12.8px;
  font-family: "JetBrains Mono", Consolas, Monaco, monospace; color: #a5d6ff;
}
.markdown pre { background: #0b0f14; border: 1px solid var(--border); padding: 14px 16px; border-radius: 10px; overflow: auto; }
.markdown pre code { background: none; padding: 0; color: #c9d1d9; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown li { margin: 5px 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 8px 12px; }
.markdown th { background: var(--panel-2); }
.markdown blockquote { border-left: 3px solid var(--brand); margin: 12px 0; padding: 4px 16px; color: var(--text-2); background: rgba(79, 124, 255, .05); }
.markdown a { color: #79b8ff; }

.side-card { padding: 18px; }
.side-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.side-row:last-child { border: none; }
.side-row span { color: var(--text-3); }
.side-row b { font-weight: 600; }

.ai-box { padding: 16px; border-radius: 10px; background: rgba(63, 185, 80, .06); border: 1px solid rgba(63, 185, 80, .22); }
.ai-box.warn { background: rgba(210, 153, 34, .07); border-color: rgba(210, 153, 34, .28); }
.ai-box.danger { background: rgba(248, 81, 73, .07); border-color: rgba(248, 81, 73, .28); }
.ai-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; font-weight: 600; }
.ai-score { margin-left: auto; font-size: 20px; font-weight: 700; color: #7ee787; }
.ai-score i { font-size: 11px; font-style: normal; font-weight: 600; margin-left: 2px; opacity: .7; }
.ai-score.warn { color: #e3b341; }
.ai-score.bad { color: #ff7b72; }

/* ---------- 表单 ---------- */
.form-card { padding: 26px 28px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.field label b { color: var(--red); margin-left: 2px; }
.input, .textarea, .select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 9px; padding: 10px 13px; font-size: 13.8px; outline: none; transition: .18s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 124, 255, .13); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 6px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 34px; text-align: center;
  cursor: pointer; transition: .2s; background: rgba(22, 27, 34, .5);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: rgba(79, 124, 255, .06); }
.dropzone.loading { cursor: progress; border-color: rgba(79, 124, 255, .55); background: rgba(79, 124, 255, .06); }
.dropzone .big { font-size: 34px; margin-bottom: 8px; }
.dropzone h4 { margin: 0 0 6px; font-size: 14.5px; }
.dropzone p { margin: 0; color: var(--text-3); font-size: 12.5px; }

/* ---------- 表格（用户端我的技能） ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.4px; }
.table th {
  text-align: left; padding: 12px 14px; color: var(--text-3); font-weight: 500; font-size: 12.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }

.status-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.status-approved { color: #7ee787; background: rgba(63, 185, 80, .12); border: 1px solid rgba(63, 185, 80, .28); }
.status-pending, .status-reviewing { color: #e3b341; background: rgba(210, 153, 34, .12); border: 1px solid rgba(210, 153, 34, .3); }
.status-manual { color: #f0a020; background: rgba(240, 160, 32, .12); border: 1px solid rgba(240, 160, 32, .32); }
.status-rejected { color: #ff7b72; background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .3); }
.status-draft, .status-offline { color: var(--text-2); background: rgba(139, 148, 158, .12); border: 1px solid rgba(139, 148, 158, .25); }

/* ---------- 空状态 ---------- */
.empty { padding: 64px 20px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 40px; margin-bottom: 12px; opacity: .6; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(1, 4, 9, .72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  /* 遮罩自身可滚动：内容比视口高时整层滚动，而不是把弹窗顶出屏幕 */
  overflow-y: auto; overscroll-behavior: contain;
  z-index: 200; padding: 24px;
}
.modal {
  width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 28px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  /* margin:auto 在空间富余时垂直居中；溢出时自动归零，保证顶部可达 */
  margin: auto;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain;
  animation: pop .22s ease;
}
@supports (height: 100dvh) {
  .modal { max-height: calc(100dvh - 48px); } /* 移动端地址栏收缩时不误判高度 */
}
/* 头 / 脚固定，不参与压缩 */
.modal > :not(.modal-body) { flex: none; }
.modal.wide { max-width: 860px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* toast */
.toast-wrap { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px; background: #1f2630;
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: pop .18s ease;
}
.toast.ok { border-color: rgba(63, 185, 80, .5); color: #7ee787; }
.toast.err { border-color: rgba(248, 81, 73, .5); color: #ff7b72; }
.toast.warn { border-color: rgba(240, 160, 32, .5); color: #f0a020; }
.ai-tip { margin: 12px 0 4px; padding: 10px 12px; border-radius: 9px; background: rgba(240, 160, 32, .1); border: 1px solid rgba(240, 160, 32, .3); }
.ai-tip b { display: block; color: #f0a020; font-size: 13.5px; }
.ai-tip span { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }

/* 加载 */
.loading { padding: 70px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.spinner {
  width: 26px; height: 26px; border: 2.5px solid rgba(255, 255, 255, .12); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #161b22 25%, #1c2229 37%, #161b22 63%); background-size: 400% 100%; animation: shine 1.4s ease infinite; border-radius: 8px; }
@keyframes shine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 执行状态：顶部进度条 ---------- */
.top-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 3000;
  pointer-events: none; opacity: 0; transition: opacity .28s ease;
}
.top-progress.on { opacity: 1; }
.top-progress i {
  display: block; height: 100%; width: 32%; border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, #4f7cff, #a371f7);
  box-shadow: 0 0 12px rgba(79, 124, 255, .75);
  animation: topSlide 1.15s ease-in-out infinite;
}
@keyframes topSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(330%); } }

/* ---------- 执行状态：按钮内联 spinner ---------- */
.btn-spin {
  display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%;
  animation: spin .72s linear infinite;
}
.btn.busy { pointer-events: none; opacity: .82; }
.spin-sm {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 6px;
  border: 2px solid rgba(255, 255, 255, .18); border-top-color: var(--brand); border-radius: 50%;
  animation: spin .72s linear infinite;
}

/* ---------- 执行状态：表格遮罩 ---------- */
.table-panel { position: relative; }
.table-mask {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; font-size: 12.8px; color: var(--text-2);
  background: rgba(13, 17, 23, .66); backdrop-filter: blur(1.5px); border-radius: inherit;
}
.table-mask .spinner { width: 22px; height: 22px; margin: 0; border-width: 2px; }

/* ---------- 执行状态：居中任务面板 ---------- */
.busy-mask {
  position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 24px;
  background: rgba(1, 4, 9, .72); backdrop-filter: blur(4px);
}
.busy-card {
  width: 100%; max-width: 430px; padding: 24px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--border-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65); animation: pop .2s ease;
}
.busy-head { display: flex; gap: 14px; align-items: flex-start; }
.busy-ring {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  border: 3px solid rgba(79, 124, 255, .2); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
.busy-title h4 { margin: 2px 0 5px; font-size: 15px; }
.busy-title p { margin: 0; font-size: 12.4px; color: var(--text-3); line-height: 1.6; }
.busy-steps { margin: 18px 0 14px; }
.busy-step { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--text-3); transition: color .2s; }
.busy-step .dot {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); font-size: 10px; line-height: 1; transition: .2s;
}
.busy-step.done .dot { background: rgba(63, 185, 80, .18); border-color: rgba(63, 185, 80, .55); color: #7ee787; }
.busy-step.on { color: var(--text); }
.busy-step.on .dot { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 124, 255, .16); }
.busy-step.on .dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.busy-foot { display: flex; align-items: center; gap: 12px; }
.busy-bar { flex: 1; height: 5px; border-radius: 999px; background: rgba(139, 148, 158, .18); overflow: hidden; }
.busy-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f7cff, #a371f7); transition: width .4s ease; }
.busy-foot .elapsed { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.busy-note {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; font-size: 12px; line-height: 1.7;
  color: #e3b341; background: rgba(210, 153, 34, .08); border: 1px solid rgba(210, 153, 34, .25);
}

/* 骨架屏（首页/列表初次加载） */
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sk-card { height: 236px; border-radius: 14px; }
.sk-line { height: 12px; border-radius: 6px; }

/* 页脚 */
.footer {
  border-top: 1px solid var(--border); margin-top: 60px; padding: 26px 0; color: var(--text-3);
  font-size: 12.5px; display: flex; align-items: center; gap: 12px; position: relative; z-index: 1;
}
.footer .grow { flex: 1; }

/* responsive */
@media (max-width: 1080px) {
  .skill-grid, .cat-grid, .sk-grid { grid-template-columns: repeat(2, 1fr); }
  .browse-layout { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 34px; }
  .nav-search { display: none; }
}
@media (max-width: 640px) {
  .skill-grid, .cat-grid, .sk-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .detail-head { flex-direction: column; }
  .detail-actions { margin-left: 0; }
}

/* ---------- 用户菜单 ---------- */
.user-menu {
  position: absolute; top: 56px; right: 0; width: 200px; background: #1b2129;
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); z-index: 80;
}
.nav-right { position: relative; }
.um-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.um-head b { display: block; font-size: 13.5px; }
.um-head span { font-size: 11.5px; color: var(--text-3); }
.um-item {
  display: block; padding: 9px 12px; border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.um-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.um-item.danger { color: #ff7b72; }
.user-menu { right: 0; }

/* ---------- 热门榜单 ---------- */
.hot-row {
  display: flex; align-items: center; gap: 16px; padding: 13px 4px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: .16s;
}
.hot-row:last-child { border-bottom: none; }
.hot-row:hover { background: rgba(79, 124, 255, .05); }
.rank {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-3); background: rgba(255, 255, 255, .05); flex-shrink: 0;
}
.rank.r1 { background: linear-gradient(135deg, #ffb400, #ff7a00); color: #1a1a1a; }
.rank.r2 { background: linear-gradient(135deg, #b8c2cc, #8b98a5); color: #1a1a1a; }
.rank.r3 { background: linear-gradient(135deg, #d08a4e, #a9673a); color: #1a1a1a; }
.hot-info { flex: 1; min-width: 0; }
.hot-info h4 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.hot-info p { margin: 0; font-size: 12.4px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-cat { font-size: 12px; color: var(--text-3); padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; }
.hot-num { font-size: 12.5px; color: #a8c0ff; width: 70px; text-align: right; }

@media (max-width: 720px) {
  .hot-cat { display: none; }
}

/* ---------- 详情页右侧栏 ---------- */
.detail-layout {
  display: grid; grid-template-columns: 1fr 340px; gap: 20px;
  align-items: start; margin-top: 20px;
}
.detail-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side-title {
  font-size: 12px; color: var(--text-3); letter-spacing: 1px;
  margin: 0 0 12px; font-weight: 600;
}

/* 安装命令 */
.install-item + .install-item {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.install-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.8px; color: var(--text-3); line-height: 1.6; margin-bottom: 8px;
}
.install-label .il-text { flex: 1; min-width: 0; }
.il-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 5px; white-space: nowrap;
  color: #a8c0ff; background: rgba(79, 124, 255, .14); border: 1px solid rgba(79, 124, 255, .3);
}
.il-tag.agent {
  color: #c9b3ff; background: rgba(139, 92, 246, .15); border-color: rgba(139, 92, 246, .34);
}
.cmd-row code {
  display: block; width: 100%; white-space: pre-wrap; overflow-wrap: normal; overflow-x: auto;
  background: #0b0f14; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font-size: 11.4px; line-height: 1.7; color: #a5d6ff;
  font-family: "JetBrains Mono", Consolas, Monaco, monospace;
  max-height: 82px;
}
.copy-btn {
  flex-shrink: 0; height: 24px; border: 1px solid var(--border-strong); background: var(--panel-2);
  color: var(--text-2); font-size: 11.5px; padding: 0 10px; border-radius: 7px;
  cursor: pointer; transition: .16s;
}
.copy-btn:hover { border-color: var(--brand); color: #fff; }
.copy-btn.done {
  border-color: rgba(63, 185, 80, .5); color: #7ee787; background: rgba(63, 185, 80, .12);
}

/* 分类树 */
.cat-tree { display: flex; flex-direction: column; gap: 1px; }
.tree-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 7px;
  font-size: 13px; color: var(--text-2); cursor: pointer; transition: .15s;
}
.tree-row:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.tree-row.active { background: rgba(79, 124, 255, .16); color: #a8c0ff; }
.tree-row.branch { color: var(--text); }
.tree-arrow {
  width: 14px; text-align: center; font-size: 10px; color: var(--text-3);
  transition: transform .18s; flex-shrink: 0; user-select: none;
}
.tree-arrow.open { transform: rotate(90deg); }
.tree-arrow.ghost { visibility: hidden; }
.tree-ico { font-size: 12.5px; }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-cnt { font-size: 11px; color: var(--text-3); }
.tree-children {
  padding-left: 18px; margin: 1px 0 5px 14px; border-left: 1px dashed var(--border);
}
.tree-row.child { padding: 6px 8px; font-size: 12.6px; }

/* 卡片评分角标 */
.skill-cover .badge-rate {
  position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; color: #e3b341;
  background: rgba(13, 17, 23, .78); border: 1px solid rgba(210, 153, 34, .42);
  display: flex; align-items: center; gap: 3px;
}

@media (max-width: 1080px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* ---------- 广场：分类树（侧栏内） ---------- */
.filter-box .cat-tree { margin-top: 6px; }
.filter-box .tree-row { padding: 7px 8px; }
.filter-box .tree-row .tree-name { font-size: 13px; }
.filter-box .tree-children { padding-left: 14px; margin: 1px 0 4px 13px; }
.filter-box .tree-row.child { padding: 6px 8px 6px 6px; }
.filter-box .tree-row.child .tree-name { font-size: 12.6px; }

/* ---------- 广场：标签筛选条 ---------- */
.tag-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px 14px; margin-bottom: 16px;
}
.tp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tp-title { font-size: 12px; color: var(--text-3); letter-spacing: 1px; }
.tp-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 0;
  background: none; border: none; color: #a8c0ff; font-size: 12.5px; cursor: pointer; transition: .15s;
}
.tp-toggle:hover { color: #fff; }
.tp-toggle .chev { font-size: 9px; transition: transform .18s; }
.tp-toggle .chev.open { transform: rotate(180deg); }

.tag-panel .tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-panel .tag-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; box-sizing: border-box;
  cursor: pointer; transition: .15s;
}
.tag-panel .tag-chip:hover { background: rgba(79, 124, 255, .18); }
.tag-panel .tag-chip.on {
  background: rgba(79, 124, 255, .3); color: #fff; border-color: rgba(79, 124, 255, .6);
}
.tag-panel .tag-chip .tcnt { font-size: 10px; font-style: normal; color: #6b7682; }
.tag-panel .tag-chip.on .tcnt { color: #cfe0ff; }

/* 折叠态：桌面最多 2 行，移动端最多 5 行 */
.tag-cloud.collapsed { max-height: 56px; overflow: hidden; }
@media (max-width: 640px) {
  .tag-cloud.collapsed { max-height: 152px; }
}

/* 广场网格：桌面 3 列 → 平板 2 列 → 手机 1 列 */
.browse-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1080px) {
  .browse-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .browse-grid { grid-template-columns: 1fr; }
}

/* 分类树层级：父级文字更亮 */
.filter-box .tree-row:not(.child) { color: var(--text); }
.filter-box .tree-row.branch .tree-name { font-weight: 600; }

/* ---------- 技能管理弹窗（编辑 / 版本更新 / 在线预览） ---------- */
.modal-head { display: flex; align-items: center; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-x {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-3); cursor: pointer; font-size: 13px; line-height: 1;
  flex: none;
}
.modal-x:hover { color: var(--text-1); border-color: var(--border-strong); }
.modal-sub { margin: 0 0 16px; font-size: 12.5px; line-height: 1.7; color: var(--text-3); }
.modal-body {
  /* 高度由 flex 分配（头部/底栏固定），不再写死 vh，避免矮视口下头部被挤出 */
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px; position: relative;
}
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; row-gap: 10px; }
.form-row { display: flex; gap: 14px; }
.cnt { float: right; font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.file-input { padding: 9px 10px; font-size: 12.5px; }
.file-picked { margin-top: 6px; font-size: 12px; color: #79b8ff; }

.readonly-box { margin-top: 6px; padding: 12px 14px; border-radius: 10px; background: rgba(110, 118, 129, .1); border: 1px dashed var(--border-strong); }
.ro-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.ro-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-3); }
.ro-row b { color: var(--text-2); margin-left: 4px; }
.ro-hint { margin-top: 8px; font-size: 11.5px; color: var(--text-3); }

/* 在线预览 */
.preview-grid { display: grid; grid-template-columns: 240px 1fr; gap: 12px; min-height: 320px; }
.pv-files { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: rgba(1, 4, 9, .25); max-height: 420px; overflow-y: auto; }
.pv-files-head { padding: 9px 12px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.pv-file { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12px; cursor: pointer; border-left: 2px solid transparent; }
.pv-file:hover { background: rgba(255, 255, 255, .04); }
.pv-file.on { background: rgba(79, 124, 255, .14); border-left-color: var(--brand); }
.pv-file.dim { opacity: .55; }
.pv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; }
.pv-size { color: var(--text-3); font-size: 11px; }
.pv-view { border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; min-width: 0; background: rgba(1, 4, 9, .25); }
.pv-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-3); font-family: Consolas, monospace; }
.pv-note { margin-left: auto; color: #f0a020; font-family: inherit; }
.pv-code {
  margin: 0; padding: 12px 14px; font-size: 12.5px; line-height: 1.7; color: var(--text-2);
  overflow: auto; max-height: 380px; white-space: pre-wrap; word-break: break-word;
}
.pv-md { padding: 4px 14px 14px; max-height: 380px; overflow: auto; }
.preview-note { padding: 40px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.readonly-box .ro-row { align-items: center; }
.readonly-box .ro-title { margin: 0; white-space: nowrap; color: var(--text-3); font-weight: 600; }
.readonly-box { margin-top: 12px; padding: 9px 12px; }

/* ---------- 安装命令两类输入（上传 / 编辑 / 版本更新共用） ---------- */
.install-inputs { display: flex; flex-direction: column; gap: 10px; }
.install-input { display: flex; align-items: flex-start; gap: 10px; }
.install-input .il-tag { margin-top: 9px; flex: none; }
.install-input .input { flex: 1; }

/* ---------- 版本更新分步 ---------- */
.ver-step {
  display: flex; align-items: center; gap: 8px;
  margin: 20px 0 10px; font-size: 13.5px; font-weight: 600; color: var(--text-1);
}
.ver-step:first-child { margin-top: 4px; }
.vs-no {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(79, 124, 255, .16); color: #79b8ff; font-size: 11.5px; font-weight: 700;
}
.vs-opt { font-size: 11.5px; font-weight: 400; color: var(--text-3); }

.ver-precheck {
  margin-top: 10px; padding: 3px 14px 10px; border-radius: 10px;
  background: rgba(79, 124, 255, .06); border: 1px solid rgba(79, 124, 255, .18);
}
.vp-line { font-size: 12.5px; color: var(--text-2); padding-top: 8px; }
.vp-ok { color: #7ee787; }
.vp-warn { color: #e3b341; }
.vp-dim { color: var(--text-3); }
.vp-issue { font-size: 12px; color: #e3b341; margin-top: 5px; }

/* 两个安装标签等宽，保证命令行与智能体卡片左缩进对齐 */
.install-label .il-tag, .install-input .il-tag {
  min-width: 80px; text-align: center; display: inline-block;
}

/* ---------- 弹窗自适应（窄屏 / 矮视口 / 滚动锁） ---------- */
body.modal-open { overflow: hidden; padding-right: var(--sbw, 0px); }

@media (max-height: 700px) {
  .modal { padding: 20px 22px; }
  .modal-sub { margin-bottom: 12px; }
  .modal-foot { margin-top: 14px; }
  .ver-step { margin: 14px 0 8px; }
}

@media (max-width: 640px) {
  .mask { padding: 10px; }
  .modal { padding: 18px; border-radius: 14px; max-height: calc(100vh - 20px); }
  .modal-foot { margin-top: 14px; }
  .form-row { flex-direction: column; gap: 0; }
  .preview-grid { grid-template-columns: 1fr; }
  .pv-files { max-height: 150px; }
  .pv-code, .pv-md { max-height: none; }
  .readonly-box .ro-row { gap: 6px 12px; }
}

@supports (height: 100dvh) {
  @media (max-width: 640px) {
    .modal { max-height: calc(100dvh - 20px); }
  }
}
