:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #86909c;
  --accent: #4f6ef2;
  --accent-2: #7b5cf0;
  --border: #e5e8ef;
  --shadow: 0 2px 10px rgba(31, 45, 61, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { max-width: 760px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* 顶栏：只有标题 */
.topbar {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 16px 0;
  box-shadow: var(--shadow);
}

main { flex: 1; padding: 20px 0 40px; }

/* 竖排应用列表 */
.vlist { display: flex; flex-direction: column; gap: 14px; }

.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
.item:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31, 45, 61, 0.12); }

.item-icon {
  width: 56px; height: 56px; flex: none;
  border-radius: 14px; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef1ff, #f3efff);
}

.item-body { flex: 1; min-width: 0; }
.item-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.badge-demo {
  font-size: 11px; font-weight: 400;
  background: #fff3e0; color: #e8850c;
  border-radius: 10px; padding: 2px 8px;
}
.item-ver { font-size: 12px; color: var(--muted); margin: 3px 0 6px; }
.item-desc {
  font-size: 13px; color: #4e5969; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.item-action { flex: none; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 9px 18px; border-radius: 10px; font-size: 14px;
  cursor: pointer; border: none; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty-icon { font-size: 44px; margin-bottom: 12px; }

footer {
  background: #fff; border-top: 1px solid var(--border);
  padding: 14px 0; font-size: 13px; color: #4e5969;
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; max-width: 480px; width: 100%;
  padding: 28px; position: relative; animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: .5; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; border: none; background: #f2f3f5;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; color: #4e5969;
}
.modal-close:hover { background: #e5e8ef; }
.modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.modal-icon {
  width: 68px; height: 68px; border-radius: 16px; font-size: 40px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef1ff, #f3efff);
}
.modal-head h2 { font-size: 20px; }
.modal-desc { font-size: 14px; line-height: 1.7; color: #4e5969; white-space: pre-wrap; }
.modal-actions { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn-ghost { background: #eef1ff; color: var(--accent); }

/* 修复：hidden 属性被 display:flex 覆盖，导致弹窗常驻屏幕 */
[hidden] { display: none !important; }

@media (max-width: 520px) {
  .item { flex-wrap: wrap; }
  .item-action { width: 100%; }
  .item-action .btn { width: 100%; justify-content: center; }
}

/* ==============================================================================
 * 应用详情页（app.html）
 * ------------------------------------------------------------------------------
 * 照手机应用商店详情页做的：
 *   图标 + 名称 + 简介 → 安全检测行 → 评分/大小/下载量 三格 → 安装按钮
 *   → 应用介绍 → 用户评价
 * ============================================================================== */

.detail-page { background: #f2f4f7; }

.detail-wrap { max-width: 560px; margin: 0 auto; padding-bottom: 40px; }

.d-loading { padding: 80px 20px; text-align: center; color: var(--muted); }

/* 顶栏 */
.d-topbar {
  position: sticky; top: 0; z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
}
.d-back {
  color: var(--accent); text-decoration: none;
  font-size: 15px; font-weight: 500;
}
.d-back:hover { text-decoration: underline; }
.d-topbar-title { font-size: 16px; font-weight: 600; }

.d-main { padding: 16px 16px 0; }

/* ── 图标 + 名称 ── */
.d-hero {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.d-icon {
  width: 76px; height: 76px; flex: none;
  border-radius: 18px; font-size: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef1ff, #f3efff);
}
.d-hero-body { flex: 1; min-width: 0; }
.d-name {
  font-size: 21px; font-weight: 700; line-height: 1.3;
  margin: 0 0 6px; color: var(--text);
}
.d-brief {
  font-size: 13.5px; color: #4e5969; line-height: 1.6;
  margin: 0 0 8px;
}
.d-safe-line {
  font-size: 12.5px; color: #86909c; margin: 0;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.d-safe { color: #0a8f5a; font-weight: 500; }
.d-safe.warn { color: #e8850c; }
.d-dot { color: #c9cdd4; }

/* ── 三格数据 ── */
.d-stats {
  display: flex;
  background: var(--card);
  border-radius: 14px;
  padding: 18px 8px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}
.d-stat {
  flex: 1; text-align: center; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.d-stat + .d-stat::before {
  content: ''; position: absolute; left: 0; top: 12%; bottom: 12%;
  width: 1px; background: var(--border);
}
.d-stat b {
  font-size: 18px; font-weight: 700; color: var(--text);
  line-height: 1.2;
}
.d-stat span { font-size: 12px; color: var(--muted); }

/* ── 安装按钮 ── */
.d-cta { margin: 16px 0 4px; }
.d-install {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 50px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; text-decoration: none;
  font-size: 17px; font-weight: 600; letter-spacing: 4px;
  box-shadow: 0 6px 18px rgba(79, 110, 242, 0.28);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.d-install:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(79, 110, 242, 0.34); }
.d-install:active { transform: scale(.985); }

/* ── 介绍 / 评价 ── */
.d-block {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}
.d-h2 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0 0 12px;
  display: flex; align-items: baseline; gap: 8px;
}
.d-count { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.d-intro {
  font-size: 14px; line-height: 1.75; color: #4e5969;
  white-space: pre-wrap; margin: 0 0 12px;
}
.d-updated { font-size: 12.5px; color: #86909c; margin: 0; }

.d-reviews { display: flex; flex-direction: column; gap: 18px; }
.rv { display: flex; gap: 10px; }
.rv-avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.rv-body { flex: 1; min-width: 0; }
.rv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-head b { font-size: 13.5px; color: var(--text); }
.rv-stars { color: #f5a623; font-size: 12px; letter-spacing: 1px; }
.rv-time { font-size: 12px; color: #a9aeb8; margin-left: auto; }
.rv-text {
  font-size: 13.5px; color: #4e5969; line-height: 1.65;
  margin: 5px 0 0;
}

/* 小屏微调 */
@media (max-width: 380px) {
  .d-icon { width: 64px; height: 64px; font-size: 36px; border-radius: 15px; }
  .d-name { font-size: 19px; }
  .d-stat b { font-size: 16px; }
}

/* ==============================================================================
 * 应用图标：emoji 或图片（后台上传 APK 时自动提取的真实图标）
 * ============================================================================== */

.app-ico-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* 详情页的大图标 —— 同样要约束尺寸。
   少了 width/height:100% 的话，432×432 的原图会按自然尺寸渲染，
   在 76×76 的容器里被裁掉一大块，看起来跟首页完全不是一个图标。 */
.d-ico-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* 首页列表的图标框：图片铺满，emoji 居中 */
.item-icon { overflow: hidden; }
.item-icon .app-ico-img { border-radius: 14px; }

/* 详情页的大图标 */
.d-icon { overflow: hidden; }
.d-icon .d-ico-img { border-radius: 18px; }
.d-icon { overflow: hidden; }
