/* ============================================================
   App Store 风格样式 —— 以 apps.apple.com / iOS 视觉语言为基准
   系统灰底 + 白卡片 + 大粗标题 + 蓝(#007AFF)操作 + 极少 JS
   ============================================================ */

:root {
  --bg: #f2f2f7;            /* iOS grouped background */
  --card: #ffffff;
  --text: #1c1c1e;
  --text2: #8e8e93;         /* iOS secondaryLabel */
  --line: #e5e5ea;          /* separator */
  --fill: #e9e9eb;          /* iOS tertiarySystemFill */
  --accent: #007aff;
  --accent-dark: #0071e3;
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --radius: 14px;
  --radius-s: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.015em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 99; }
.skip-link:focus { left: 8px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .86em; }
.text-danger { color: var(--red); }
.text-ok { color: var(--green); }

/* ------------------------------ 顶栏（App Store 式） ----------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 250, 250, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar {
  max-width: 1080px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0)),
    linear-gradient(180deg, #19c2fb, #0a63ff);
  position: relative;
  box-shadow: 0 1px 3px rgba(10,99,255,.4);
}
.logo-mark::after {
  content: "A"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: 0;
  font-family: var(--font);
}
.logo-text { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

.cat-pills {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin-left: 8px; flex: 1;
}
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pills a {
  color: var(--text); font-size: 14px; font-weight: 500;
  background: var(--fill); border-radius: 980px;
  padding: 6px 14px; white-space: nowrap;
}
.cat-pills a:hover { background: #dcdce1; text-decoration: none; }

.topbar-search { display: flex; flex: none; }
.topbar-search input {
  width: 190px; padding: 7px 12px 7px 32px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E") no-repeat 10px center;
  border: 0; border-radius: 980px; font: 14px var(--font); color: var(--text);
}
.topbar-search input::placeholder { color: var(--text2); }
.topbar-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background-color: #fff; }

.user-zone { display: flex; align-items: center; gap: 14px; font-size: 14px; flex: none; }
.user-zone > a { color: var(--text); font-weight: 500; }
.inline-form { display: inline; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* ------------------------------- Flash 提示 ------------------------------ */
.flash-wrap { max-width: 1080px; margin: 14px auto 0; padding: 0 20px; }
.flash { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 8px; }
.flash-success { background: #e6f7ec; color: #1b7f3b; }
.flash-error   { background: #ffe5e2; color: #b3261e; }
.flash-warning { background: #fff3e0; color: #8a5300; }
.flash-info    { background: #e8f1ff; color: #0a5ac2; }

/* -------------------------------- Hero（首屏大标题） ------------------------------ */
.hero { padding: 54px 0 8px; text-align: left; }
.hero h1 {
  font-size: 44px; line-height: 1.12; margin: 0; font-weight: 800; letter-spacing: -.03em;
}
.hero-sub { color: var(--text2); font-size: 19px; margin: 10px 0 26px; font-weight: 500; }
.hero-search { display: flex; max-width: 520px; }
.hero-search input {
  flex: 1; padding: 12px 16px; font: 15px var(--font);
  border: 0; border-radius: 12px 0 0 12px; background: #fff;
}
.hero-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hero-search .btn { border-radius: 0 12px 12px 0; }

/* ------------------------- 分区标题（App Store 大标题 + 查看全部） ------------------- */
.section { margin: 38px 0; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px;
}
.sec-head h2, .section-title { font-size: 28px; margin: 0; font-weight: 800; letter-spacing: -.025em; }
.sec-head > a { font-size: 16px; flex: none; }

.page-title { font-size: 32px; margin: 30px 0 6px; font-weight: 800; letter-spacing: -.03em; }
.page-sub { color: var(--text2); margin: 0 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

.breadcrumb { display: flex; gap: 6px; color: var(--text2); font-size: 14px; margin: 20px 0 2px; }
.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--accent); }

/* --------------------- 卡片行（横向滚动，App Store「精选」式） --------------------- */
.rail {
  list-style: none; padding: 2px 2px 6px; margin: 0;
  display: flex; gap: 14px; overflow-x: auto;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > li { flex: 0 0 300px; scroll-snap-align: start; }
.rail-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; height: 100%;
  color: var(--text); transition: transform .15s ease;
}
.rail-card:hover { text-decoration: none; transform: scale(1.015); }
.rail-info { flex: 1; min-width: 0; }
.rail-title { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-sub { margin: 1px 0 0; color: var(--text2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text2); }
.rail-foot .get { margin-left: auto; }

/* ------------------------------- 应用网格（列表页） ------------------------------ */
.app-grid {
  list-style: none; padding: 0; margin: 0 0 30px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px;
}
.app-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.app-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.app-card-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); }
.app-card-link:hover { text-decoration: none; background: #fafafa; }

/* App 图标（iOS 圆角方） */
.app-icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 60px; height: 60px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #eef4ff, #e8e6ff);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-icon span { font-size: 26px; font-weight: 700; color: #4c6bd4; }
.app-icon-lg { width: 128px; height: 128px; border-radius: 28px; }
.app-icon-lg span { font-size: 54px; }

.app-card-name { margin: 0; font-size: 16px; font-weight: 600; }
.app-card-sub { margin: 1px 0 0; color: var(--text2); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-card-info { flex: 1; min-width: 0; }
.app-card-meta { margin: 6px 0 0; font-size: 12px; color: var(--text2); display: flex; gap: 8px; align-items: center; }
.app-card-meta .get { margin-left: auto; }

/* 获取/价格按钮（App Store 蓝色胶囊圆角） */
.get {
  display: inline-block; padding: 5px 16px; border-radius: 9px;
  background: #eaf3ff; color: var(--accent-dark);
  font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center;
}
a.get:hover, .get-link:hover { text-decoration: none; }
.get-blue { background: var(--accent-dark); color: #fff; padding: 6px 18px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 980px; font-size: 12px; font-weight: 600; }
.badge-free   { background: #e6f7ec; color: #1b7f3b; }
.badge-paid   { background: #ffefdb; color: #a05a00; }
.badge-warning{ background: #fff3e0; color: #8a5300; }
.badge-danger { background: #ffe5e2; color: #b3261e; }

/* -------------------------------- 分类切片 ------------------------------ */
.cat-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 980px;
  padding: 8px 16px; color: var(--text); font-size: 15px; font-weight: 500;
}
.cat-chip:hover { text-decoration: none; background: #fff; border-color: #d9d9de; }
.cat-count { color: var(--text2); font-size: 13px; }

/* ================================== 应用详情页（apps.apple.com 式） ================================== */
.ad { margin-top: 14px; }
.ad-hero {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 22px; align-items: start; padding: 26px 0 18px;
  border-bottom: 1px solid var(--line);
}
.ad-title h1 { margin: 6px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.ad-sub { color: var(--text2); font-size: 17px; margin: 2px 0 10px; }
.ad-dev { font-weight: 600; font-size: 15px; }
.ad-cat { display: inline-block; margin-left: 12px; color: var(--text2); font-size: 14px; }
.ad-buy { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 118px; text-align: center; padding-top: 18px; }
.get-btn {
  display: inline-block; min-width: 88px; text-align: center;
  background: var(--accent-dark); color: #fff;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
  padding: 9px 22px; border-radius: 10px;
  border: 0; cursor: pointer; font-family: var(--font);
}
.get-btn:hover { opacity: .9; text-decoration: none; }
.get-btn-secondary {
  display: inline-block; background: var(--fill); color: var(--accent-dark);
  font-size: 15px; font-weight: 600; padding: 10px 20px; border-radius: 10px; text-align: center;
}
.ad-note { color: var(--text2); font-size: 12px; margin: 0; }

/* 信息小结横排（类似 评分/年龄/开发者 三栏） */
.ad-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0; border-bottom: 1px solid var(--line); padding: 14px 0;
}
.ad-facts > div { text-align: center; padding: 4px 10px; border-right: 1px solid var(--line); }
.ad-facts > div:last-child { border-right: 0; }
.ad-facts b { display: block; font-size: 18px; font-weight: 700; color: var(--text2); letter-spacing: -.01em; }
.ad-facts span { display: block; color: var(--text2); font-size: 12px; }

/* 截图横滑 */
.shots {
  list-style: none; padding: 4px 0 10px; margin: 0;
  display: flex; gap: 14px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.shots::-webkit-scrollbar { display: none; }
.screen { flex: 0 0 auto; scroll-snap-align: center; }
.screen img { height: 340px; width: auto; border-radius: 18px; border: 1px solid var(--line); background: #fff; }

/* 介绍（HTML5 details 折叠，零 JS） */
.fold { background: none; border: 0; padding: 0; margin: 0; }
.fold summary {
  list-style: none; cursor: pointer; color: var(--accent);
  font-size: 16px; font-weight: 600; padding: 2px 0;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "更多 "; }
.fold[open] summary::before { content: "收起 "; }
.fold .prose { line-height: 1.85; }
.prose { max-width: 760px; }

/* 信息列表（iOS 设置列表式） */
.ios-list {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0; padding: 4px 18px; max-width: 640px;
}
.ios-list > div {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.ios-list > div:last-child { border-bottom: 0; }
.ios-list dt { color: var(--text2); font-size: 14px; }
.ios-list dd { margin: 0; text-align: right; font-size: 15px; }

/* --------------------------------- 表单控件 ------------------------------ */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font: 600 14px var(--font); cursor: pointer;
}
.btn:hover { text-decoration: none; background: #fafafa; }
.btn-primary { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-secondary { background: var(--fill); border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-alipay { background: #1677ff; border-color: #1677ff; color: #fff; }
.btn-lg { padding: 12px 24px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text2); }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="search"], .field input[type="url"],
.field select, .field textarea, .filter-bar input, .filter-bar select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s);
  font: 15px var(--font); background: #fff; color: var(--text);
}
.field textarea { resize: vertical; }
.field-wide { grid-column: 1 / -1; }
.field-checks { flex-direction: row; gap: 24px; }
.field-checks label { font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.hint { color: var(--text2); font-size: 13px; }
.shot-thumb { border-radius: 8px; border: 1px solid var(--line); margin: 4px 4px 4px 0; }

/* -------------------------------- 认证/面板 卡片 ------------------------------ */
.auth-card {
  max-width: 460px; margin: 40px auto 60px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px;
  box-shadow: 0 8px 30px rgba(0,0,0,.05);
}
.auth-card h1 { margin-top: 0; font-size: 24px; font-weight: 700; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.auth-note { color: var(--text2); font-size: 13px; }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px;
}
.panel h2 { margin: 6px 0 14px; font-size: 18px; font-weight: 700; }

.order-card .app-meta, .order-card .ios-list { margin: 18px 0; max-width: none; }
.order-amount { font-size: 20px; font-weight: 700; color: var(--accent-dark); }

/* -------------------------------- 表格与分页 ------------------------------ */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.table th { color: var(--text2); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.tbl-icon { vertical-align: -7px; border-radius: 7px; margin-right: 6px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-form { display: inline-flex; gap: 6px; margin: 2px 8px 2px 0; }
.row-form .thin { width: 150px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.row-form .thin.wide { width: 260px; }
.row-form .thin.num { width: 70px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin: 20px 0 40px; }
.page-link {
  padding: 7px 13px; border-radius: 9px; background: #fff; border: 1px solid var(--line);
  color: var(--text); font-size: 14px;
}
.page-link.is-current, .page-link:hover { text-decoration: none; }
.page-link.is-current { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }
.page-link:hover:not(.is-current) { border-color: var(--accent); }

/* -------------------------------- 页脚 ------------------------------ */
.site-footer { border-top: 1px solid var(--line); margin-top: 60px; background: var(--bg); }
.footer-inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px; padding: 30px 20px 6px;
}
.footer-col h2 { font-size: 13px; margin: 0 0 10px; color: var(--text); }
.footer-col p { color: var(--text2); font-size: 13px; }
.footer-col nav { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.footer-col nav a { color: var(--text2); }
.footer-bottom { padding: 12px 20px; color: var(--text2); font-size: 12px; border-top: 1px solid var(--line); }
.footer-bottom p { margin: 8px 0; }

.empty, .empty-state { color: var(--text2); text-align: center; padding: 40px 0; }
.empty-state h1 { color: var(--text); }

/* ------------------------------- 后台（保持功能布局） ------------------------------- */
.admin-body { background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 210px; flex: none; background: #1d1d1f; color: #d6d6d9; padding: 20px 14px;
  display: flex; flex-direction: column;
}
.admin-side-title { font-weight: 700; color: #fff; margin: 0 8px 18px; }
.admin-side nav { display: flex; flex-direction: column; gap: 4px; }
.admin-side nav a { color: #d6d6d9; padding: 9px 12px; border-radius: 9px; font-size: 14px; }
.admin-side nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.admin-side nav a.is-active { background: var(--accent-dark); color: #fff; }
.admin-side-foot { margin-top: auto; font-size: 12px; color: #86868b; }
.admin-side-foot a { color: #9ac7ff; }
.admin-main { flex: 1; padding: 26px 28px 60px; min-width: 0; }
.admin-main .panel { box-shadow: none; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card h2 { font-size: 13px; color: var(--text2); margin: 4px 0 0; font-weight: 500; }
.stat-num { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.stat-card.warn .stat-num { color: var(--orange); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text2); }
.bar-label { width: 42px; text-align: right; flex: none; }
.bar-track { flex: 1; background: var(--bg); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-fill-green { background: var(--green); }
.bar-val { width: 76px; flex: none; }

.filter-bar { display: flex; gap: 8px; margin: 12px 0 16px; flex-wrap: wrap; }
.filter-bar input { width: 260px; }

/* ------------------------------- 响应式 ------------------------------ */
@media (max-width: 880px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-search { order: 3; width: 100%; }
  .topbar-search input { width: 100%; flex: 1; }
  .cat-pills { order: 2; }
  .hero h1 { font-size: 34px; }
  .ad-hero { grid-template-columns: 84px 1fr; gap: 18px; align-items: start; }
  .app-icon-lg { width: 84px; height: 84px; border-radius: 20px; }
  .ad-title h1 { font-size: 24px; font-weight: 800; }
  .ad-sub { font-size: 14px; margin: 4px 0 8px; word-break: break-all; }
  .ad-buy { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; align-items: center; padding-top: 6px; }
  .ad-facts > div { border-right: 0; }
  .ad-facts { grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
  .screen img { height: 240px; }
  .two-col { grid-template-columns: 1fr; }
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-foot { display: none; }
  .app-grid { grid-template-columns: 1fr; }
}
