/* ===== XJS 应用站 ===== */
:root {
  --primary: #4f7cff;
  --primary-dark: #3a63d8;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-sub: #7a8199;
  --border: #e6e9f2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 45, 92, .06);
  --shadow-hover: 0 8px 24px rgba(31, 45, 92, .14);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* hidden 属性必须压过 .modal-mask 的 display:flex，否则蒙板永远挡住页面 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- 头部 ---- */
.site-header {
  background: linear-gradient(135deg, #4f7cff 0%, #6a5cff 55%, #8a4fff 100%);
  color: #fff;
  padding: 28px 0 0;
  box-shadow: 0 4px 18px rgba(79, 124, 255, .35);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { font-size: 44px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.25)); }
.brand h1 { font-size: 26px; letter-spacing: 1px; }
.slogan { font-size: 13px; opacity: .88; margin-top: 2px; }

.search-box { flex: 1; min-width: 240px; max-width: 420px; }
.search-box input {
  width: 100%;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,.95);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.08);
}
.search-box input:focus { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }

.category-bar {
  max-width: 1080px;
  margin: 20px auto 0;
  padding: 0 20px 14px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid transparent;
  transition: all .18s;
  user-select: none;
}
.cat-chip:hover { background: rgba(255,255,255,.32); }
.cat-chip.active { background: #fff; color: var(--primary-dark); font-weight: 600; }

/* ---- 主体 ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px; flex: 1; width: 100%; }
.stats-line { color: var(--text-sub); font-size: 13px; margin-bottom: 14px; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.app-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.app-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  object-fit: cover;
  flex: 0 0 64px;
  background: #eef1f8;
  border: 1px solid var(--border);
}
.app-icon-fallback {
  width: 64px; height: 64px;
  border-radius: 16px;
  flex: 0 0 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
}
.app-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-name { font-size: 16px; font-weight: 600; }
.badge {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 500;
}
.badge-self { background: #e3f7e8; color: #1a9e4b; }
.badge-oss  { background: #e4eeff; color: #3a63d8; }
.badge-free { background: #fff3e0; color: #e65100; }
.app-meta { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.app-desc {
  font-size: 13px; color: #555c70; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-actions { margin-top: auto; padding-top: 10px; }
.btn-download {
  display: inline-block;
  padding: 7px 22px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s;
}
.btn-download:hover { background: var(--primary-dark); }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 90px 20px; color: var(--text-sub); }
.empty-icon { font-size: 56px; margin-bottom: 14px; }
.empty-state h2 { color: var(--text); margin-bottom: 8px; font-size: 20px; }

/* ---- 页脚 ---- */
.site-footer {
  text-align: center;
  padding: 26px 20px calc(26px + env(safe-area-inset-bottom));
  color: var(--text-sub);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.site-footer .copyright { margin-top: 6px; opacity: .7; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 24, 40, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 18px;
}
.modal {
  background: #fff;
  border-radius: 18px;
  max-width: 560px; width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 10px; right: 12px;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: #f0f2f8; color: #666;
  font-size: 20px; cursor: pointer;
  z-index: 2;
}
.modal-close:hover { background: #e2e6f0; }
.modal-body { padding: 26px; }
.modal-head { display: flex; gap: 16px; align-items: center; }
.modal-head .app-icon, .modal-head .app-icon-fallback { width: 76px; height: 76px; flex-basis: 76px; font-size: 32px; }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-meta { font-size: 12.5px; color: var(--text-sub); margin-top: 4px; line-height: 1.8; }
.modal-meta code { background: #f0f2f8; padding: 1px 6px; border-radius: 6px; font-size: 11.5px; }
.modal-section { margin-top: 18px; }
.modal-section h3 { font-size: 14px; color: var(--text-sub); margin-bottom: 8px; font-weight: 600; }
.modal-desc { font-size: 14px; white-space: pre-wrap; color: #3a4054; }
.shots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.shots img { height: 240px; border-radius: 10px; border: 1px solid var(--border); flex: 0 0 auto; }
.modal-download { margin-top: 22px; text-align: center; }
.modal-download .btn-download { padding: 12px 46px; font-size: 15px; }
.install-tip { font-size: 12px; color: var(--text-sub); margin-top: 10px; }
.source-line { font-size: 12.5px; margin-top: 10px; }
.source-line a { color: var(--primary); text-decoration: none; }

@media (max-width: 640px) {
  .header-inner { justify-content: center; text-align: center; }
  .brand { width: 100%; justify-content: center; }
  .app-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 20px; }
}
