:root {
  --bg: #ececec;
  --panel: #ffffff;
  --panel2: #f3f3f3;
  --border: #d6d6d6;
  --text: #1c1c1e;
  --muted: #6f6f6f;
  --accent: #2b2b2b;
  --accent-hover: #111111;
  --green: #2e7d32;
  --danger: #d32f2f;
  --warn: #f57c00;
  --radius: 18px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.3px; display: inline-flex; align-items: center; line-height: 1; }
.brand img { width: 24px; height: 24px; margin-right: 8px; display: block; }
.brand .flow { color: var(--accent); }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 16px; border-radius: 980px; width: 220px; outline: none; font-size: 14px;
}
.search:focus { border-color: var(--accent); background: #fff; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
section { margin-bottom: 36px; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -.4px; margin: 0 0 16px; }

.hero { text-align: center; padding: 64px 24px 40px; background: linear-gradient(180deg, #f7f7f7 0%, #ececec 100%); }
.hero h1 {
  font-size: 46px; font-weight: 800; letter-spacing: -.8px; line-height: 1.15; margin: 0 0 18px;
  background: linear-gradient(135deg, #1c1c1e 20%, #6f6f6f 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.hero .sub { font-size: 20px; color: var(--muted); margin: 0 0 28px; line-height: 1.5; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 48px; justify-content: center; margin-top: 44px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.hero-stats span { color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.card {
  display: flex; gap: 14px; padding: 18px;
  background: linear-gradient(180deg, #ffffff, #fafafa);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0, 0, 0, .1); }
.card-icon {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, #e8e8e8, #d2d2d2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; overflow: hidden;
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-icon .ic { font-size: 30px; line-height: 1; }
.card-name { font-weight: 700; font-size: 16px; }
.card-desc { color: var(--muted); font-size: 14px; margin: 2px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }

.btn {
  display: inline-block; padding: 10px 22px; border-radius: 980px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 15px;
  transition: all .15s ease; font-weight: 500;
}
.btn:hover { background: #e3e3e3; }
.btn.primary { background: linear-gradient(135deg, #3a3a3a, #1c1c1e); border: none; color: #fff; font-weight: 600; }
.btn.primary:hover { background: linear-gradient(135deg, #4a4a4a, #2a2a2a); }
.btn.small { padding: 7px 16px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.lg { padding: 13px 30px; font-size: 16px; }

.empty { color: var(--muted); font-size: 14px; }

.panel { background: var(--panel); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; margin: 0 auto; }
.form label { font-size: 13px; color: var(--muted); }
.form input, .form textarea, .form select {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 14px; border-radius: 12px; font-size: 15px; outline: none; width: 100%;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); background: #fff; }

.detail-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.detail-head .card-icon { flex: 0 0 72px; width: 72px; height: 72px; font-size: 30px; border-radius: 18px; }
.detail-head .card-icon .ic { font-size: 40px; }
.detail-head h1 { margin: 0; font-size: 28px; letter-spacing: -.5px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 980px; background: var(--panel2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); margin-right: 6px; }

.runner { background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.runner-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.runner iframe { width: 100%; height: 560px; border: 0; background: #fff; }

.review { padding: 16px 0; border-bottom: 1px solid var(--border); }
.review:last-child { border-bottom: 0; }
.review .r-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.review .r-stars { color: #f5a623; }

.badge { font-size: 12px; padding: 2px 9px; border-radius: 980px; font-weight: 500; }
.badge.approved { background: rgba(46, 125, 50, .12); color: #2e7d32; }
.badge.pending { background: rgba(245, 124, 0, .14); color: #c25e00; }
.badge.rejected { background: rgba(211, 47, 47, .12); color: #c62828; }
.badge.promo { background: rgba(0, 0, 0, .06); color: #333; }

.authbox { text-align: center; max-width: 400px; margin: 60px auto; }
.hidden { display: none; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* 管理后台 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .n.warn { color: var(--danger); }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 8px 18px; border-radius: 980px; background: var(--panel); cursor: pointer; font-size: 14px; border: 1px solid var(--border); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { padding: 7px 16px; border-radius: 980px; background: var(--panel); cursor: pointer; font-size: 13px; border: 1px solid var(--border); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 12px; letter-spacing: .5px; font-weight: 600; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 980px; background: #d2d2d2; cursor: pointer; transition: background .2s; border: none; }
.switch.on { background: var(--green); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.switch.on::after { left: 25px; }

.notice { background: rgba(245, 124, 0, .1); border: 1px solid rgba(245, 124, 0, .4); color: #c25e00; border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }

/* 推荐位（合作伙伴） */
.affiliate { max-width: 1080px; margin: 0 auto 36px; padding: 0 24px; }
.affiliate a { display: block; }
.aff-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(180deg, #ffffff, #fafafa);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.aff-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .1); }
.aff-icon { font-size: 32px; line-height: 1; }
.aff-body { flex: 1; min-width: 0; }
.aff-title { font-weight: 700; font-size: 16px; }
.aff-tag { font-size: 11px; color: var(--muted); background: var(--panel2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 980px; margin-left: 7px; vertical-align: 1px; }
.aff-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.aff-cta { color: var(--accent); font-weight: 600; font-size: 14px; white-space: nowrap; }
@media (max-width: 640px) {
  .aff-card { flex-wrap: wrap; }
  .aff-cta { width: 100%; }
}

/* ---------- 移动端适配（手机 / 平板） ---------- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar nav { width: 100%; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .topbar .search { width: 100%; order: 3; }
  .brand { font-size: 18px; }
  .btn { padding: 8px 16px; font-size: 14px; }
  .btn.small { padding: 6px 12px; font-size: 12px; }
  .container { padding: 14px; }
  section { margin-bottom: 26px; }

  .hero { padding: 36px 16px 28px; }
  .hero h1 { font-size: 27px; letter-spacing: -.5px; }
  .hero .sub { font-size: 15px; }
  .hero-stats { gap: 22px; margin-top: 30px; }
  .hero-stats b { font-size: 22px; }
  .hero-stats span { font-size: 12px; }

  /* 应用卡片：手机单列，避免 300px 最小宽溢出 */
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 14px; }
  .card-icon { flex-basis: 48px; width: 48px; height: 48px; font-size: 20px; border-radius: 12px; }
  .card-icon .ic { font-size: 26px; }
  .card-desc { -webkit-line-clamp: 3; }

  /* 发布页类型卡片：2×2 */
  .type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .type-card { padding: 14px 8px; }

  .panel { padding: 16px; }
  .form { max-width: 100%; }

  /* 详情页 */
  .detail-head { gap: 12px; }
  .detail-head .card-icon { flex-basis: 56px; width: 56px; height: 56px; font-size: 24px; }
  .detail-head h1 { font-size: 21px; }
  .runner-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .runner iframe { height: 420px; }

  /* 表格：横向滚动防溢出（保持表格布局，外层容器滚动） */
  .panel { overflow-x: auto; }
  #apps, #promo, #users, #orders, #reviews { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel table { min-width: 520px; }
  th, td { padding: 10px 12px; }

  /* 评价输入行换行 */
  .review .form div { flex-wrap: wrap; }
  .review select { width: 100%; }
  .review input { min-width: 100%; }
  .review button { width: 100%; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat .n { font-size: 22px; }
  .switch-row { gap: 10px; }

  h2 { font-size: 20px; }
  .tabs .tab { padding: 6px 13px; font-size: 13px; }
}

/* 通用防溢出：长链接 / Key / 长单词不撑破布局 */
img { max-width: 100%; }
code { word-break: break-all; }
textarea { resize: vertical; }
a, p, div { overflow-wrap: break-word; }

/* 发布页：应用类型选择卡片 */
.type-cards { display: flex; gap: 10px; margin-bottom: 20px; }
.type-card { flex: 1; text-align: center; padding: 16px 8px; border: 2px solid var(--border); border-radius: 14px; cursor: pointer; transition: all .15s; background: var(--panel); }
.type-card.active { border-color: var(--accent); background: linear-gradient(135deg, #3a3a3a, #1c1c1e); }
.type-card.active .tc-name, .type-card.active .tc-desc { color: #fff; }
.tc-icon { font-size: 26px; line-height: 1; }
.tc-name { font-weight: 700; font-size: 14px; margin-top: 6px; }
.tc-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.type-card.active .tc-desc { color: rgba(255, 255, 255, .75); }
