/* ================= Sensec 患者手机端增强层 v1.0 (2026-10-15) =================
   目标：让患者（含老年患者）在手机上更快找到入口、不裁字、好点、字够大。
   仅在小屏生效，不影响桌面端。 */

:root { --pt-bar-h: 58px; }

/* ---------- 1. 顶部瘦身：导航单行可横滑，首屏内容提前 ---------- */
@media (max-width: 820px) {
  .utility-bar { display: none !important; }
  .topbar-inner {
    height: auto; min-height: 52px;
    padding: 7px 12px; gap: 8px;
    flex-wrap: nowrap; align-items: center;
  }
  .brand { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 15px; }
  .brand-text strong { font-size: 14px; }
  .brand-text small { display: none; }
  .status { display: none; }
  .nav {
    order: 0; width: auto; margin-left: auto; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; max-width: 62vw;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .nav a, .nav-more summary {
    min-height: 40px; display: inline-flex; align-items: center;
    padding: 0 10px; font-size: 13.5px;
  }
  .nav-more-menu { position: fixed; left: 12px; right: 12px; top: auto;
    bottom: calc(var(--pt-bar-h) + 14px + env(safe-area-inset-bottom));
    width: auto; max-height: 56vh; overflow: auto; }
}

/* ---------- 2. 首屏：标题不再过大/被裁，内容更早出现 ---------- */
@media (max-width: 820px) {
  .hero-section { padding: 24px 0 20px !important; }
  .hero-copy h1 { font-size: 27px !important; line-height: 1.34 !important; letter-spacing: -.02em !important; }
  .home-task-grid, .home-cancer-grid { grid-template-columns: 1fr !important; }
  .home-task-card { min-height: 0; padding: 18px 17px; }
  .home-task-card h3 { margin-top: 15px; }
  .home-cancer-feature, .pro-tools-card { padding: 17px; }
  .home-cancer-foot { display: block; }
  .home-cancer-foot a { display: inline-block; margin-top: 8px; }
  .home-v2-aside { padding: 14px 16px; }
  .home-start-row { padding: 11px 0; }
  .home-start-row strong { font-size: 13.5px; }
  .hero-lede { font-size: 15.5px !important; }
  .page-head { padding: 20px 0 14px !important; }
  .page-head h1 { font-size: 22px !important; }
  .sec { overflow: visible !important; }
}

/* ---------- 3. 表格：可横向滑动 + 滑动提示（不再被裁掉右列） ---------- */
@media (max-width: 820px) {
  .tw, .panel-body > .table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .tw { position: relative; }
  .tw::after {
    content: "← 左右滑动查看完整表格 →";
    display: block; text-align: right; font-size: 11px; color: var(--muted, #8a8f98);
    padding: 4px 6px 0;
  }
  table.data { min-width: 520px; }
  table.data th, table.data td { white-space: nowrap; }
  table.data td.name { white-space: normal; min-width: 96px; }
  /* 表格里的「查看」等链接触控区加大 */
  table.data a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; }
}

/* ---------- 4. 触控与字号：更好点、更好读 ---------- */
@media (max-width: 820px) {
  body { font-size: 16px; line-height: 1.75; }
  .crumb { font-size: 12.5px; }
  .crumb a { display: inline-block; padding: 6px 2px; min-height: 32px; }
  .btn, button.btn, .chkbx button { min-height: 44px; }
  .searchbar input, input[type="search"], input[type="text"], select { min-height: 44px; font-size: 16px; }
  .sec h2 { font-size: 17px; }
  .sec p, .sec li, .qgroup li { font-size: 15.5px; line-height: 1.8; }
}

/* 大字模式（老年患者）：右上角 A+ / A- 切换，localStorage 记忆 */
html[data-font="lg"] { font-size: 112.5%; }
html[data-font="lg"] body { font-size: 18px; }
html[data-font="lg"] .sec p, html[data-font="lg"] .sec li, html[data-font="lg"] .qgroup li,
html[data-font="lg"] .hero-lede, html[data-font="lg"] .page-head p { font-size: 17.5px !important; }
html[data-font="lg"] table.data th, html[data-font="lg"] table.data td { font-size: 15px; }
html[data-font="lg"] .ptbar a { font-size: 12.5px; }

/* ---------- 5. 底部患者快捷栏 ---------- */
#pt-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  background: rgba(255,255,255,.97); backdrop-filter: saturate(1.6) blur(10px);
  border-top: 1px solid var(--line, #e6e8ec);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 18px rgba(16,32,48,.06);
}
#pt-bar .in { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-width: 560px; margin: 0 auto; }
#pt-bar a, #pt-bar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 46px; border: 0; background: transparent; border-radius: 10px;
  font-size: 11.5px; color: var(--text-2, #4b5563); text-decoration: none; line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}
#pt-bar a:active, #pt-bar button:active { background: var(--surface-2, #f3f5f7); }
#pt-bar .ic, #pt-quick .ic { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
#pt-bar .ic svg { width: 20px; height: 20px; display: block; }
#pt-bar a.on { color: var(--teal-d, #0d6f66); font-weight: 600; }
@media (max-width: 820px) {
  #pt-bar { display: block; }
  body { padding-bottom: calc(var(--pt-bar-h) + env(safe-area-inset-bottom) + 8px); }
  .back-top { bottom: calc(var(--pt-bar-h) + 20px + env(safe-area-inset-bottom)) !important; }
}

/* 大字模式按钮（注入到顶栏） */
.pt-font { display: none; }
@media (max-width: 820px) {
  .pt-font {
    display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; flex-shrink: 0;
  }
  .pt-font button {
    min-width: 44px; min-height: 44px; border: 1px solid var(--line-2, #d8dde3);
    background: var(--surface, #fff); border-radius: 9px; font-size: 13px; color: var(--text-2, #4b5563);
  }
  .pt-font button[aria-pressed="true"] { background: var(--teal-s, #e8f4f2); color: var(--teal-d, #0d6f66); border-color: var(--teal, #12897e); font-weight: 700; }
}

/* ---------- 6. 微信内打开提示 + 分享 ---------- */
#wx-tip {
  display: none; position: fixed; left: 12px; right: 12px; top: 10px; z-index: 120;
  background: #1f2d3d; color: #fff; border-radius: 12px; padding: 12px 14px;
  font-size: 13px; line-height: 1.6; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
#wx-tip b { color: #ffd479; }
#wx-tip .x { position: absolute; right: 8px; top: 6px; background: transparent; border: 0; color: #cbd5e1; font-size: 18px; min-height: 32px; min-width: 32px; }
#wx-tip.show { display: block; }
.pt-share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
@media (max-width: 820px) { .pt-share-row .btn { flex: 1 1 46%; } }

/* ---------- 7. 患者首屏快捷入口（首页/患者页注入） ---------- */
#pt-quick { display: none; }
@media (max-width: 820px) {
  #pt-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 4px; }
  #pt-quick a {
    display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px 14px;
    background: var(--surface, #fff); border: 1px solid var(--line, #e6e8ec); border-radius: 14px;
    box-shadow: var(--sh, 0 1px 2px rgba(16,32,48,.06)); text-decoration: none;
  }
  #pt-quick .t { font-size: 14px; font-weight: 600; color: var(--text, #1f2d3d); line-height: 1.3; }
  #pt-quick .s { font-size: 11.5px; color: var(--muted, #8a8f98); margin-top: 2px; }
  #pt-quick .ic svg { width: 22px; height: 22px; display: block; }
}

/* ---------- 8. 长标签/长词不再撑破页面（癌种页分子分型标签等） ---------- */
@media (max-width: 820px) {
  .shell, .topbar-inner, .hero-grid, .hero-copy, .section-block, .panel, .panel-body, .card, .path-card, .audience-card, .evidence-card {
    min-width: 0;
  }
  .tag, .chip, .pill { white-space: normal !important; word-break: break-word; overflow-wrap: anywhere; max-width: 100%; }
  .sec p, .sec li, .panel-body, .note { overflow-wrap: anywhere; }
  table.data { max-width: 100%; }
  /* 表单/选择器触控高度 */
  select, .form-row input, .form-row select { min-height: 44px; }
  /* 常见 chip/标签按钮触控区 */
  .chiplist button, .chips button, .tagbtn, .filter-chips button { min-height: 38px; padding: 6px 12px; }
}

/* ---------- 9. 页脚与卡片触控/裁剪修正 ---------- */
@media (max-width: 820px) {
  .site-foot a, .foot-col a, .foot-bottom a, .foot-note a { display: inline-flex; align-items: center; min-height: 34px; }
  .foot-col { gap: 2px; }
  /* 卡片类容器不再因固定高度裁掉文字 */
  .card, .path-card, .audience-card, .evidence-card, .cancer-card { height: auto !important; max-height: none !important; overflow: visible !important; }
}

/* ---------- 10. 按钮文字不再被裁 + 首屏更紧凑 ---------- */
@media (max-width: 820px) {
  .btn, button.btn, a.btn, .hero-cta a, .cta-row a {
    white-space: normal !important; overflow-wrap: anywhere; line-height: 1.35;
    padding: 11px 14px; text-align: center;
  }
  .hero-actions, .cta-row, .hero-cta { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-actions a, .cta-row a, .hero-cta a { width: auto !important; }
  .searchbar { gap: 8px; }
  .hero-section { padding-top: 18px !important; }
}
