:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e5e6eb;
  --border-strong: #c9cdd4;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --primary: #2f54eb;
  --primary-soft: #eaf0ff;
  --shadow: 0 2px 12px rgba(20, 30, 60, 0.06);
  --radius: 12px;

  --cat-web: #2f54eb;
  --cat-electron: #009a4e;
  --cat-fullstack: #d25f00;
  --cat-react: #7646c4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 3vw;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 15px;
  border-radius: 10px; letter-spacing: 1px;
}
.brand-text h1 { font-size: 17px; margin: 0; font-weight: 700; }
.brand-text p { font-size: 12px; margin: 2px 0 0; color: var(--text-3); }

.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tabs a {
  text-decoration: none; color: var(--text-2);
  font-size: 14px; padding: 7px 16px; border-radius: 8px;
  transition: all .15s ease;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ===== 主区 ===== */
#app { max-width: none; padding: 24px 3vw 60px; }

/* 响应式：窄屏时减少边距 */
@media (max-width: 640px) {
  #app { padding: 16px 16px 40px; }
  .topbar { padding: 12px 16px; }
}

/* ===== 筛选条 ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  cursor: pointer; user-select: none;
  font-size: 13px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all .15s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.section-title { font-size: 15px; color: var(--text-2); margin: 0 0 14px; font-weight: 600; }

/* ===== 卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(20, 30, 60, 0.1); }
.card-thumb {
  width: 100%; aspect-ratio: 16 / 9;
  background: #eef1f6 center/cover no-repeat;
  border-bottom: 1px solid var(--border);
}
.card-thumb.empty { display: grid; place-items: center; color: var(--text-3); font-size: 13px; }
.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-name { font-size: 15px; font-weight: 700; }
.card-cn { font-size: 12px; color: var(--text-3); }
.card-summary { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ===== 标签 ===== */
.tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 6px;
  background: var(--bg); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.tag.cat-web { background: #eef2ff; color: var(--cat-web); border-color: #dbe3ff; }
.tag.cat-electron { background: #e8f8ef; color: var(--cat-electron); border-color: #c8eed8; }
.tag.cat-fullstack { background: #fff3e8; color: var(--cat-fullstack); border-color: #ffe2c4; }
.tag.cat-react { background: #f3ecfb; color: var(--cat-react); border-color: #e3d6f5; }
.tag.ui { background: var(--primary-soft); color: var(--primary); border-color: #d6e0ff; }

/* ===== 详情页 ===== */
.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); text-decoration: none; font-size: 13px; margin-bottom: 14px; }
.detail-back:hover { text-decoration: underline; }
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.detail-head h2 { margin: 0; font-size: 22px; }
.detail-cn { color: var(--text-3); font-size: 14px; }
.detail-summary { color: var(--text-2); font-size: 14px; margin: 10px 0 22px; max-width: none; }

.detail-layout { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
@media (max-width: 920px) { .detail-layout { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.panel h3 { font-size: 14px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); }

/* 依赖表 */
.deps { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.deps th, .deps td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.deps th { color: var(--text-3); font-weight: 600; }
.deps td.ver { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--primary); white-space: nowrap; }
.deps tr:last-child td { border-bottom: none; }

/* 后端矩阵 */
.matrix { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.matrix-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.matrix-item .mk { color: var(--text-3); display: block; margin-bottom: 3px; }
.matrix-item .mv { font-weight: 600; }
.mv.yes { color: var(--cat-electron); }
.mv.no { color: var(--text-3); }

/* 功能 chips */
.feat-list { display: flex; flex-wrap: wrap; gap: 7px; }
.feat { font-size: 12px; padding: 4px 10px; border-radius: 7px; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }

.repo-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); text-decoration: none; font-size: 13px; word-break: break-all; }
.repo-link:hover { text-decoration: underline; }

/* 画廊 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shot {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: #eef1f6;
}
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform .2s ease; }
.shot:hover img { transform: scale(1.04); }
.shot .cap { font-size: 12px; color: var(--text-2); padding: 6px 9px; border-top: 1px solid var(--border); background: var(--surface); }
.gallery-empty { color: var(--text-3); font-size: 13px; padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }

/* ===== 对比表 ===== */
.table-wrap { overflow-x: auto; width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.compare { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 1080px; table-layout: auto; }
table.compare th, table.compare td { padding: 10px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: left; vertical-align: top; }
table.compare thead th { background: #f0f3f8; color: var(--text); position: sticky; top: 0; font-weight: 700; white-space: nowrap; }
table.compare tbody th { background: #fafbfc; font-weight: 600; color: var(--text-2); white-space: nowrap; }
table.compare tbody tr:nth-child(even) td { background: #fbfcfe; }
table.compare .demo-name { font-weight: 700; }
table.compare .cell-yes { color: var(--cat-electron); font-weight: 600; }
table.compare .cell-no { color: var(--text-3); }
table.compare .ver { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--primary); }

/* ===== 灯箱 ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 20, 35, 0.86);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; gap: 14px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.15); color: #fff; font-size: 24px; cursor: pointer; line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.28); }
.lb-cap { color: #fff; font-size: 14px; }

/* ===== 页脚 ===== */
.site-foot {
  max-width: none; padding: 18px 3vw 30px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .site-foot { padding: 14px 16px 24px; }
}
