/* 855hi 论坛 APP 外壳 —— 只在通过桌面图标启动（standalone）时生效。
   普通浏览器访问论坛不做任何视觉改动，只多一个右下角「安装 APP」入口。 */
.na-topbar, .na-tabbar { display: none; }

.na-install-fab {
  position: fixed; right: 14px; bottom: 18px; z-index: 9000;
  display: inline-flex; align-items: center; gap: 6px;
  background: #066E58; color: #fff; text-decoration: none;
  border-radius: 999px; padding: 9px 15px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(6, 110, 88, .30);
  -webkit-tap-highlight-color: transparent;
}
.na-install-fab:hover { background: #055A48; color: #fff; }

/* 纯 HTML 兜底：非 /news/ 的 APP 相关页由 inc/header.asp 输出。
   JS 壳没启动（普通标签 / 脚本被拦）时，手机窄屏仍有可点的返回论坛入口。 */
.na-home-bar { display: none; }
.na-home-bar:hover, .na-home-bar:focus { color: #fff; text-decoration: none; }

body.na-app .na-install-fab,
body.na-app .na-home-bar { display: none !important; }
body.na-app .site-header,
body.na-app .site-footer,
body.na-app .news-share-bar { display: none !important; }
body.na-app {
  /* 顶栏高度含 safe-area-inset-top，正文留白必须同步，否则刘海屏首行被压在栏下 */
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.na-app .na-topbar {
  display: flex; align-items: center; justify-content: space-between;
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 8px 0;
  background: linear-gradient(100deg, #066E58, #12A672);
  color: #fff; box-shadow: 0 2px 10px rgba(6, 110, 88, .22);
}
.na-topbar .na-tb-title {
  font-size: 16px; font-weight: 800; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.na-topbar button {
  border: 0; background: rgba(255, 255, 255, .16); color: #fff;
  border-radius: 9px; padding: 7px 11px; font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap; min-width: 56px;
}
.na-topbar button:active { background: rgba(255, 255, 255, .34); }

body.na-app .na-tabbar {
  display: flex; align-items: stretch;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff; border-top: 1px solid #E2E8F0;
  box-shadow: 0 -3px 14px rgba(15, 23, 42, .06);
}
.na-tabbar a, .na-tabbar button {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 4px 2px; cursor: pointer;
  color: #64748B; text-decoration: none; font-size: 11px; font-weight: 600;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.na-tabbar .na-ic { font-size: 19px; line-height: 1; font-style: normal; }
.na-tabbar .on { color: #066E58; font-weight: 800; }
.na-tabbar .on .na-ic { transform: translateY(-1px); }
.na-tabbar a:active, .na-tabbar button:active { background: #F1F5F9; }

/* APP 顶栏是 fixed，锚点跳转要留出高度，否则评论框被压在栏下 */
body.na-app #commentForm,
body.na-app #comments { scroll-margin-top: 64px; }

/* ============================================================
   手机版 APP 内显示优化（2026-11-05）
   仅 standalone + 窄屏生效，普通浏览器访问论坛完全不受影响。
   目标：首屏多看到内容、去掉与 APP 顶栏重复的大标题、控件不挤压。
   ============================================================ */
@media (max-width: 768px) {
  body.na-app .news-wrap { padding: 12px 12px 28px; }

  /* APP 顶栏已有站名，Hero 压成一条紧凑搜索栏 */
  body.na-app .news-hero {
    padding: 12px 14px; margin-bottom: 14px; border-radius: 14px;
    box-shadow: 0 4px 14px rgba(6, 110, 88, .14);
  }
  body.na-app .news-hero::after,
  body.na-app .news-hero-title,
  body.na-app .news-hero-sub { display: none; }
  body.na-app .news-search { flex-direction: row; gap: 8px; max-width: none; }
  body.na-app .news-search-input { height: 40px; font-size: 14px; padding: 0 14px; }
  body.na-app .news-search-btn { width: auto; height: 40px; padding: 0 16px; font-size: 14px; }

  body.na-app .news-body { margin-top: 12px; }
  body.na-app .news-list-head { margin-bottom: 6px; }
  body.na-app .news-section-title { font-size: 17px; }
  body.na-app .news-count { font-size: 12px; }

  /* 信息流：缩图收小、间距收紧，一屏多出 1~2 条 */
  body.na-app .news-item { gap: 10px; padding: 12px 0; }
  body.na-app .news-item-thumb { flex-basis: 96px; width: 96px; height: 72px; border-radius: 9px; }
  body.na-app .news-item-title { font-size: 15.5px; line-height: 1.4; margin-bottom: 5px; }
  body.na-app .news-item-sum { font-size: 12.5px; line-height: 1.5; margin-bottom: 5px; }
  body.na-app .news-item-meta { font-size: 11px; gap: 6px; flex-wrap: nowrap; }
  body.na-app .news-meta-src { min-width: 0; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.na-app .news-meta-dot { display: none; }
  body.na-app .news-meta-stats { gap: 8px; flex: 0 0 auto; }

  /* 手机 APP 不展示「热门资讯」「用户贡献榜」两个侧栏卡片 */
  body.na-app .news-side { display: none !important; }
  body.na-app .news-main { width: 100%; }

  body.na-app .pager-btn { padding: 9px 16px; font-size: 13px; }

  /* 详情页 */
  body.na-app .news-crumbs { font-size: 12px; margin-bottom: 10px; }
  body.na-app .news-article { padding: 14px; border-radius: 12px; }
  body.na-app .news-article-title { font-size: 20px; line-height: 1.4; }
  body.na-app .news-article-meta { font-size: 11.5px; gap: 6px; }
  body.na-app .news-content { font-size: 15px; line-height: 1.75; }
  body.na-app .news-content img { margin: 10px 0; }
  body.na-app .news-actions { gap: 10px; margin-top: 16px; padding-top: 14px; }
  body.na-app .news-like-btn { padding: 8px 14px; font-size: 13px; }

  /* 评论：长手机号不把发表按钮挤没 */
  body.na-app .news-comments { margin-top: 20px; }
  body.na-app .comment-item { padding: 10px 0; gap: 8px; }
  body.na-app .comment-avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; }
  body.na-app .comment-children { padding-left: 10px; }
  body.na-app .comment-form { padding: 12px; }
  body.na-app .comment-form-foot { flex-wrap: wrap; gap: 8px; }
  body.na-app .comment-tip { font-size: 11px; word-break: break-all; }
  body.na-app .comment-submit { padding: 9px 20px; }

  /* 底栏 7 格：缩图标与字号，避免窄屏挤压误触 */
  body.na-app .na-tabbar a,
  body.na-app .na-tabbar button { font-size: 10px; padding: 4px 1px; gap: 2px; }
  body.na-app .na-tabbar .na-ic { font-size: 17px; }

  /* 账号页（登录 / 个人中心 / 补号）：收紧卡片留白，表单不被顶栏压住 */
  body.na-app .auth-page { max-width: none; margin: 12px 10px 24px; }
  body.na-app .auth-card { padding: 18px 16px; border-radius: 12px; }
  body.na-app .cp-wrap { margin-top: 12px; }
}

@media (max-width: 360px) {
  .na-tabbar a, .na-tabbar button { font-size: 10px; }
  .na-topbar .na-tb-title { font-size: 14px; }
  body.na-app .news-item-thumb { flex-basis: 84px; width: 84px; height: 64px; }
  body.na-app .news-item-sum { -webkit-line-clamp: 1; }
}

/* 兜底条放在文件末尾：E2E 校验「第一个 @media(max-width:768px) 块」是 APP 壳规则，
   这条不属于壳，别插到前面去。只有手机窄屏 + JS 壳没启动时才出现。 */
@media (max-width: 768px) {
  body:not(.na-app) .na-home-bar {
    display: block; padding: 10px 16px;
    background: #066E58; color: #fff;
    font-size: 14px; font-weight: 700; text-decoration: none;
  }
}
