/* ============================================================
   全局适配层（最后加载，用来兜住各页自写的样式）
   只做三件事：小屏收边、触控手感、打印输出。
   不改配色、不改布局结构，避免和页面自己的样式打架。
   ============================================================ */

/* ---------- 1. 基础：不让浏览器自作主张 ---------- */
html{
  -webkit-text-size-adjust:100%;      /* 横屏时不放大字号 */
  text-size-adjust:100%;
  scroll-behavior:smooth;
}
body{
  overscroll-behavior-y:contain;      /* 避免下拉时整页橡皮筋带动刷新 */
  -webkit-tap-highlight-color:transparent;
}
@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{
    animation-duration:.001ms !important;
    transition-duration:.001ms !important;
  }
}
img,svg,video,canvas{ max-width:100%; height:auto; }

/* 可点元素去掉 300ms 延迟；输入框字号≥16px 防 iOS 自动放大 */
button,a,[onclick],.tab,.f,.tool,.m-item,.ord,.back,.act{
  touch-action:manipulation;
}
/* iOS 的规矩：输入框字号 < 16px，一聚焦就放大整页。
   移动端统一顶到 16px；桌面端交给各页自己的样式。 */
@media (max-width:520px){
  input,textarea,select{ font-size:16px !important; }
}

/* ---------- 2. 触控热区：小图标不能只有 16px ---------- */
/* 只加最小高度，不改 display —— 这些元素各页自己的 display 不一样（flex/inline-flex/block），
   强行统一成 inline-flex 会把纵向排布的 tab 挤成一行 */
.back,.act,.close,.copy,.tab,.f,.chip{
  min-height:36px;
}
.tool,.m-item,.ord{
  min-height:56px;
}
.f{ min-width:44px; }

/* ---------- 3. 长串不撑破卡片 ---------- */
.bal-v,.acc-v,.num,.amt,.code b,.rp-meta span,.wd-row b,.meta{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.rp-meta,.wd-list,.fee,.caseit,.basis div{
  overflow-wrap:anywhere;
}

/* 表格与横向列表：能滑就滑，不要截断 */
.dyt,.dyun,.tabs,.filter{
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.dyt::-webkit-scrollbar,.dyun::-webkit-scrollbar,
.tabs::-webkit-scrollbar,.filter::-webkit-scrollbar{ height:0; }

/* ---------- 4. 小屏收边（iPhone SE / 安卓小屏 320–360） ---------- */
@media (max-width:360px){
  .page,.wrap{ padding-left:12px !important; padding-right:12px !important; }
  h1{ font-size:17px; }
  .title{ font-size:19px; }
  .ch-t{ font-size:15px; }
  .bal-v{ font-size:24px !important; }
  .acc-v{ font-size:16px; }
  .pillars{ gap:6px; }
  .pl{ padding:8px 0; }
  .pl .v{ font-size:15px; letter-spacing:0; }
  .caseit span{ margin:0 3px; }
  .toc a{ padding:8px 8px !important; }
  .dy{ flex-basis:66px; }
  .acts button{ font-size:13px; }
}
@media (max-width:320px){
  .page,.wrap{ padding-left:10px !important; padding-right:10px !important; }
  .pl .v{ font-size:14px; }
  .acc-v{ font-size:15px; }
}

/* ---------- 5. 横屏 / 矮屏：别让固定条吃掉正文 ---------- */
@media (max-height:480px) and (orientation:landscape){
  .hd,.head{ padding-top:12px; padding-bottom:12px; }
  .page{ padding-bottom:calc(120px + env(safe-area-inset-bottom,0px)) !important; }
  .toc{ position:static !important; }
}

/* ---------- 6. 平板 / 桌面：单列已经够用，只把两边留白统一 ---------- */
/* 不加"白卡片"外框：多数页有全宽固定底栏，加框反而上下不接 */
@media (min-width:768px){
  body{ padding-left:env(safe-area-inset-left,0px); padding-right:env(safe-area-inset-right,0px); }
  .app-tabbar{ max-width:640px; margin:0 auto; left:0; right:0; }
}

/* ---------- 7. 打印：把报告存成 PDF 用 ---------- */
@media print{
  @page{ margin:14mm 12mm; }
  html,body{ background:#fff !important; }
  .app-tabbar,.tabbar,.bar,.acts,.toast,.toc,.nav,.demo,
  .hd .act,.btn,.foot,.note-close{ display:none !important; }
  .page,.wrap{
    max-width:none !important; width:auto !important;
    margin:0 !important; padding:0 !important;
    box-shadow:none !important; border:0 !important;
    background:#fff !important; color:#000 !important;
  }
  .hd,.head{
    background:#fff !important; color:#000 !important;
    padding:0 0 10px !important;
  }
  .hd .title,.hd .subtitle,.hd .owner,.hd .owner b,
  .head .name,.head .meta{ color:#000 !important; }
  .ch{ break-inside:avoid; page-break-inside:avoid; }
  .ch-hd{ border-bottom:1px solid #ccc !important; }
  .basis,.casebox{ background:#fafafa !important; border-color:#ddd !important; }
  a[href]::after{ content:""; }
}
