:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #e3e8ef;
  --accent: #2f6df6;
  --accent-soft: #eaf1ff;
  --free: #16a34a;
  --deal: #d97706;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 980px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--free); display: inline-block; }

/* 右上角控件区：语言 + 主题切换 */
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 13px; font-weight: 600;
  line-height: 1; cursor: pointer; transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--accent); }
.header-actions a { color: var(--muted); font-size: 13px; font-weight: 600; }
.header-actions a:hover { color: var(--text); text-decoration: none; }

main { padding: 28px 0 56px; }

.hero { text-align: center; padding: 18px 0 6px; }
.hero h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.5px; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 640px; font-size: 14px; }
.badge {
  display: inline-block; font-size: 12px; color: var(--free);
  background: #e7f7ee; padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.date-line { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* 区域切换菜单 */
.region-switch { display: inline-flex; gap: 6px; margin-top: 16px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow); }
.region-btn {
  border: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); background: transparent; padding: 7px 18px; border-radius: 999px;
  transition: all .15s ease;
}
.region-btn:hover { color: var(--text); }
.region-btn.active { color: #fff; background: var(--accent); box-shadow: 0 1px 2px rgba(47,109,246,.35); }

/* Editorial intro (原创内容，满足 AdSense 要求) */
.intro {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin: 22px 0; box-shadow: var(--shadow); font-size: 14px; color: #374151;
}
.intro h2 { font-size: 16px; margin: 0 0 8px; }
.intro p { margin: 6px 0; }
.intro ul { margin: 6px 0; padding-left: 20px; }
.intro li { margin: 3px 0; }

.ad-slot { margin: 22px 0; text-align: center; }
.ad-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin-bottom: 6px; }
ins.adsbygoogle { background: #f1f4f9; border-radius: 10px; }

/* Sections */
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 20px; margin: 0; }
.section-title .count { font-size: 13px; color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 10px; }
.section-title .count.free { background: var(--free); }
.section-title .count.deal { background: var(--deal); }

/* App cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center;
}
.card img { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--border); background: #fff; flex: none; object-fit: cover; }
.card .info { min-width: 0; flex: 1; }
.card .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .dev { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .genre { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .rating { color: #f59e0b; font-size: 12px; font-weight: 700; margin-top: 3px; }
.card .price { margin-top: 8px; font-size: 13px; }
.card .price .old { color: var(--muted); text-decoration: line-through; margin-right: 8px; }
.card .price .new.free { color: var(--free); font-weight: 800; }
.card .price .new.deal { color: var(--deal); font-weight: 800; }
.card .go { flex: none; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.card .go:hover { background: #dbe7ff; text-decoration: none; }

.empty { text-align: center; color: var(--muted); padding: 30px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.loading { text-align: center; color: var(--muted); padding: 30px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; color: var(--muted); font-size: 13px; }
.site-footer .container { display: flex; flex-direction: column; gap: 6px; }
.disclaimer { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .hero h1 { font-size: 23px; }
  .grid { grid-template-columns: 1fr; }
}

/* 深色主题：手动 data-theme="dark" 强制深色；无 data-theme 时跟随系统 */
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #1a2027; --text: #e6edf3; --muted: #9aa7b4;
  --border: #2a323c; --accent-soft: #16263f; --shadow: 0 1px 3px rgba(0,0,0,.3);
}
:root[data-theme="dark"] ins.adsbygoogle { background: #141b22; }
:root[data-theme="dark"] .intro { color: #c2ccd6; }
:root[data-theme="dark"] .site-header { background: rgba(20, 26, 33, .88); }
:root[data-theme="dark"] .badge { background: #10321f; }
:root[data-theme="dark"] .card img { background: #242c35; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1419; --surface: #1a2027; --text: #e6edf3; --muted: #9aa7b4;
    --border: #2a323c; --accent-soft: #16263f; --shadow: 0 1px 3px rgba(0,0,0,.3);
  }
  :root:not([data-theme]) ins.adsbygoogle { background: #141b22; }
  :root:not([data-theme]) .intro { color: #c2ccd6; }
  :root:not([data-theme]) .site-header { background: rgba(20, 26, 33, .88); }
  :root:not([data-theme]) .badge { background: #10321f; }
  :root:not([data-theme]) .card img { background: #242c35; }
}
