/* ============ 基础（rem 弹性适配：375px 设计稿，1rem=16px） ============ */
:root {
  --primary: #3B82F6;
  --primary-deep: #2563EB;
  --primary-2: #6366F1;
  --bg: #eff6ff;
  --card: #ffffff;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --radius: 0.875rem;
  --shadow: 0 2px 10px rgba(59, 130, 246, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input { font-size: inherit; }
img { display: block; }
.hidden { display: none !important; }

.app {
  max-width: 30rem;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding-bottom: 4.75rem;
  overflow-x: hidden;
}

/* ============ 首页顶部 ============ */
.app-header {
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: #fff;
  padding: 1.625rem 1.25rem 1.25rem;
  border-radius: 0 0 1.375rem 1.375rem;
}
.app-header h1 { font-size: 1.375rem; font-weight: 600; letter-spacing: 0.0625rem; }
.app-subtitle { font-size: 0.75rem; opacity: .85; margin-top: 0.125rem; }

/* ============ 搜索栏 ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem 0.25rem;
}
.search-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border-radius: 1.25rem;
  padding: 0.5625rem 0.875rem;
  box-shadow: var(--shadow);
}
.search-box svg { flex-shrink: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
}
.search-box input::placeholder { color: var(--text-3); }

.view-toggle {
  display: flex;
  background: var(--card);
  border-radius: 1.25rem;
  padding: 0.1875rem;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.vt-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-2);
  padding: 0.3125rem 0.75rem;
  border-radius: 1rem;
  transition: all .2s;
}
.vt-btn.active { background: var(--primary); color: #fff; }

/* ============ 排序条 ============ */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sort-label { font-size: 0.8125rem; color: var(--text-3); flex-shrink: 0; }
.sort-chip {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
  background: var(--card);
  border-radius: 1rem;
  padding: 0.25rem 0.75rem;
  box-shadow: var(--shadow);
  transition: all .2s;
}
.sort-chip.active { background: var(--primary); color: #fff; font-weight: 500; }

/* ============ 平台列表区域 ============ */
.content { padding: 0.75rem 1rem 1.25rem; }
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 359px) {
  .card-grid { grid-template-columns: 1fr; }
}
.p-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.875rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s;
  min-width: 0;
}
.p-card:active { transform: scale(.97); }

/* 卡片上部：logo 左 + 标题/描述 右 */
.pc-top {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}
.pc-logo {
  width: 3rem;
  height: 3rem;
  border-radius: 0.625rem;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .15);
}
.pc-topinfo { flex: 1; min-width: 0; }
.pc-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
}
.pc-name {
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tag {
  flex-shrink: 0;
  font-size: 0.6875rem;
  padding: 0.0625rem 0.4375rem;
  border-radius: 0.5625rem;
  color: #fff;
  line-height: 1.5;
}
.tag-双端 { background: var(--primary-2); }
.tag-安卓 { background: #10b981; }
.tag-直播 { background: #f59e0b; }
.tag-苹果 { background: #38bdf8; }
.pc-desc {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-type { font-size: 0.8125rem; color: var(--primary-deep); font-weight: 600; margin: 0.625rem 0 0.25rem; }
.pc-view-btn {
  margin: 0.25rem 0 0.625rem;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.9375rem;
  text-align: center;
  border-radius: 0.625rem;
  padding: 0.5625rem 0;
  font-weight: 500;
}
.pc-meta {
  font-size: 0.8125rem;
  color: var(--text);
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ 列表视图 ============ */
.list-view { display: flex; flex-direction: column; gap: 0.625rem; }
.l-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.l-row:active { transform: scale(.98); }
.l-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.l-icon img,
.hero-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.l-main { flex: 1; min-width: 0; }
.l-name-row { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.l-name {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.l-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 0.125rem; }
.l-arrow { color: #cbd5e1; flex-shrink: 0; }

.empty {
  text-align: center;
  color: var(--text-3);
  padding: 3.75rem 0;
  font-size: 0.875rem;
}

/* ============ 底部导航 ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  background: var(--card);
  display: flex;
  border-top: 1px solid var(--line);
  padding: 0.375rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.75rem;
  color: var(--text-3);
  text-decoration: none;
}
.nav-item.active { color: var(--primary); }

/* ============ 弹层 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 0 1.5rem;
}
.modal-box {
  width: 100%;
  max-width: 20rem;
  background: #fff;
  border-radius: 1.125rem;
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
}
.modal-box h3 { font-size: 1.0625rem; font-weight: 600; }
.share-link {
  margin: 1rem 0;
  background: var(--bg);
  border-radius: 0.625rem;
  padding: 0.625rem;
  font-size: 0.8125rem;
  color: var(--primary-deep);
  word-break: break-all;
}
.modal-actions { display: flex; gap: 0.625rem; margin-top: 0.875rem; }
.btn {
  flex: 1;
  padding: 0.6875rem 0;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #f1f5f9; color: var(--text-2); }

/* ============ 咨询客服弹层 ============ */
.wx-qrcode {
  width: 11rem;
  height: 11rem;
  margin: 0.875rem auto 0.375rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  object-fit: cover;
}
.wx-tip { font-size: 0.8125rem; color: var(--text-3); margin-bottom: 0.625rem; }
.wx-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--bg);
  border-radius: 0.625rem;
  padding: 0.5625rem 0.5rem;
  margin-bottom: 0.875rem;
}
.wx-label { font-size: 0.875rem; color: var(--text-2); }
.wx-id { font-size: 1rem; color: var(--primary-deep); letter-spacing: 0.0313rem; word-break: break-all; }
.modal-box .modal-actions .btn-ghost { flex: 1; }

/* ============ 详情页 ============ */
.detail-app { padding-bottom: 5.625rem; }
.detail-hero {
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: #fff;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 1.25rem;
  border-radius: 0 0 1.375rem 1.375rem;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.875rem;
}
.hero-title { font-size: 0.9375rem; opacity: .9; }
.hero-main {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-top: 1.125rem;
}
.hero-logo {
  width: 4rem;
  height: 4rem;
  border-radius: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 0.125rem solid rgba(255, 255, 255, .35);
  box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, .2);
}
.hero-info { flex: 1; min-width: 0; }
.hero-name-row { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.hero-name-row h2 {
  font-size: 1.375rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.level-badge {
  flex-shrink: 0;
  font-size: 0.6875rem;
  color: #fff;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 0.375rem;
  padding: 0.0625rem 0.4375rem;
  white-space: nowrap;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.4375rem; }
.hero-tag {
  font-size: 0.6875rem;
  background: rgba(255, 255, 255, .18);
  border-radius: 0.5rem;
  padding: 0.0625rem 0.5rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-stats {
  margin-top: 1.125rem;
  background: rgba(255, 255, 255, .14);
  border-radius: 0.75rem;
  padding: 0.625rem 0.5rem;
  display: flex;
  align-items: center;
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.stat-num { font-size: 1rem; font-weight: 700; }
.stat-label { font-size: 0.6875rem; opacity: .8; margin-top: 0.125rem; }
.stat-divider { width: 1px; height: 1.75rem; background: rgba(255, 255, 255, .3); }

.detail-content { padding: 1rem; }

/* 折叠板块 */
.acc-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 0.625rem;
  overflow: hidden;
}
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9375rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}
.acc-arrow { color: var(--text-3); transition: transform .25s; flex-shrink: 0; }
.acc-title { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.acc-icon { font-style: normal; font-size: 1rem; flex-shrink: 0; }
.acc-danger .acc-title { color: #dc2626; }
.acc-must .acc-title { color: #d97706; }
.acc-item.open .acc-arrow { transform: rotate(180deg); }
.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.acc-item.open .acc-body { max-height: 62.5rem; }
.acc-body-inner {
  padding: 0 1rem 0.9375rem;
  font-size: 0.875rem;
  color: var(--text-2);
  word-break: break-word;
}
.acc-body-inner ul { padding-left: 1.125rem; }
.acc-body-inner li { margin-bottom: 0.25rem; }
.acc-body-inner p { margin-bottom: 0.375rem; }

/* 底部按钮 */
.detail-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  z-index: 50;
}
.btn-invite {
  width: 100%;
  padding: 0.8125rem 0;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.125rem;
  box-shadow: 0 4px 14px rgba(59, 130, 246, .35);
}
.btn-invite:active { opacity: .88; }

/* 邀请码弹层（参考星探邦样式） */
.invite-modal {
  width: 100%;
  max-width: 20rem;
  max-height: 86vh;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.im-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem 0.5rem;
}
.im-title { font-size: 1.0625rem; font-weight: 600; }
.im-close { color: #94a3b8; display: flex; padding: 0.25rem; }
.im-body {
  overflow-y: auto;
  padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
  text-align: center;
}
.im-poster-wrap {
  border-radius: 0.75rem;
  overflow: hidden;
  background: #f8fafc;
}
.im-poster {
  width: 100%;
  display: block;
}
.im-poster-fallback {
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #dbeafe, #eff6ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1rem;
}
.pfb-badge {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.875rem;
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pfb-name { font-size: 1.25rem; font-weight: 700; color: var(--primary-deep); }
.pfb-line { font-size: 0.75rem; color: var(--text-3); }
.pfb-steps { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--text-2); text-align: left; }
.pfb-steps p { margin-bottom: 0.25rem; }
.im-save-tip { font-size: 0.8125rem; color: #f59e0b; margin: 0.5rem 0 0.375rem; }
.im-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin: 0.375rem 0 0.875rem;
}
.im-code-label { font-size: 1rem; color: var(--primary-deep); font-weight: 600; }
.im-code { font-size: 1.125rem; color: var(--primary-deep); letter-spacing: 0.125rem; }
.im-copy-btn {
  font-size: 0.75rem;
  color: var(--primary-deep);
  background: #dbeafe;
  border-radius: 0.75rem;
  padding: 0.1875rem 0.625rem;
}
.im-actions { display: flex; gap: 0.625rem; }
.im-btn {
  flex: 1;
  padding: 0.75rem 0;
  border-radius: 2rem;
  font-size: 0.9375rem;
  font-weight: 500;
}
.im-btn-ghost {
  background: #dbeafe;
  color: var(--primary-deep);
}
.im-btn-primary {
  background: var(--primary);
  color: #fff;
}
