/* ============================================================
   Mobile Adaptive Stylesheet — 文档类页面（LibreOffice / WPS 导出）
   手机端自适应 + 字号放大 + 列宽强制不超屏幕
   本批为纯协议文档：字号放大无条件生效（不依赖媒体查询），
   任何视口宽度（手机 / 平板 / 桌面预览）下均为大字且不横向溢出
   ============================================================ */

/* ---------- 基础兜底 ---------- */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden !important;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    margin: 0 auto;
    /* LibreOffice 导出常无左右留白，加上阅读边距 */
    padding-left: 16px;
    padding-right: 16px;
}

/* 图片 / 视频 / 内嵌框架永不超出屏幕 */
img,
video,
iframe,
embed,
object {
    max-width: 100% !important;
    height: auto;
}

/* 表格：不撑破布局，超宽时在自身范围内横向滚动 */
table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    word-break: break-word;
}

td, th {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

/* 代码块换行 */
pre, code {
    white-space: pre-wrap !important;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 长内容自动换行，杜绝横向撑开 */
a {
    word-break: break-word;
    overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6, p, li, span, div,
blockquote, dd, dt, font {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* ============================================================
   字号放大：无条件生效（任何屏宽）
   覆盖策略三层：
   1) !important 覆盖内嵌 <style> 的 p/h1 10pt 规则
   2) font[size] 属性选择器覆盖 <font size="3"> 等遗留标记
   3) 行内 style 的 font-size 由 [style]{font-size:inherit} 压平
   ============================================================ */

body {
    font-size: 20px !important;
    line-height: 1.9 !important;
}

p, p.western, p.cjk, p.ctl,
li, dd, dt, blockquote {
    font-size: 20px !important;
    line-height: 1.9 !important;
    margin-top: 0.6em !important;
    margin-bottom: 0.6em !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 遗留 <font size="N"> 全部放大 */
font[size="1"], font[size="2"], font[size="3"],
font[size="4"], font[size="5"], font[size="6"],
font[size="7"], font[size="-1"], font[size="-2"] {
    font-size: 20px !important;
}

/* 行内 style 字号压平为大号（继承正文 18px）*/
p[style], span[style], font[style], div[style],
li[style], td[style], th[style], h1[style], h2[style] {
    font-size: inherit;
}

/* 章节标题（LibreOffice 导出的 h1 实为章节标题）*/
h1 {
    font-size: 26px !important;
    line-height: 1.6 !important;
    margin-top: 1.1em !important;
    margin-bottom: 0.7em !important;
    font-weight: bold;
}

h2 { font-size: 24px !important; line-height: 1.6 !important; }
h3 { font-size: 23px !important; line-height: 1.7 !important; }
h4, h5, h6 { font-size: 22px !important; line-height: 1.7 !important; }

/* 文档首页大标题（居中 <p><b> 标题）*/
body > p:first-child {
    font-size: 28px !important;
    margin-top: 1.2em !important;
    margin-bottom: 1em !important;
}

/* 缩进列表不过宽 */
ul, ol {
    padding-left: 1.6em !important;
    margin-left: 0 !important;
}

/* 表格单元格字号略小一档 */
table td, table th {
    font-size: 18px !important;
    line-height: 1.7 !important;
}

/* 手机窄屏再收一档边距 */
@media (max-width: 480px) {
    body {
        padding-left: 12px;
        padding-right: 12px;
    }
}