/* ============================================================
 * 使用帮助统一样式表
 * 适用于 docs/html/dev_bp_guide/{CN,EN,TW,TH,MM}/*.html（stub 跳转页除外）
 * 包含：
 *   - CSS 变量（浅/深色两套）
 *   - rem 字号（跟随用户系统字体缩放）
 *   - TH/MM 字体栈通过 html[lang] 覆盖
 *   - 主页 + 子页共用一份
 * 深色模式：
 *   - 系统级：@media (prefers-color-scheme: dark)
 *   - 显式：URL 传 ?dark=1 / ?dark=0 或 App 端设置 data-theme 属性
 * ============================================================ */

/* ----- 浅色变量 ----- */
:root {
  --brand: #f52525;
  --bg: #f5f5f5;
  --fg: #333;
  --fg-sub: #666;
  --fg-muted: #6b7280;
  --title: #111;
  --title-sub: #222;
  --title-strong: #444;
  --card: #fff;
  --border: #e5e5e5;
  --border-soft: #eee;
  --border-light: #f0f0f0;
  --hover: #f8f9fa; --pill-bg: #f4f4f4;
  --input-bg: #f8f9fa;
  --code-bg: #f0f0f0;
  --code-fg: #d63384;
  --tip-bg: #fefce8; --tip-br: #eab308; --tip-fg: #92400e;
  --info-bg: #eff6ff; --info-br: #3b82f6; --info-fg: #1e40af;
  --warn-bg: #fef2f2; --warn-br: #ef4444; --warn-fg: #991b1b;
  --tag-bg: #ecfdf5; --tag-fg: #059669;
  --path-bg: #f8f9fa; --path-bd: #eee;
  --shot-bd: #e5e5e5;
  --placeholder-bd: #d1d5db; --placeholder-bg: #fafafa;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-shot: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-backtop: 0 2px 8px rgba(0,0,0,0.2);
}

/* ----- 深色变量（系统偏好深色 & 未被 data-theme="light" 覆盖时）----- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f12;
    --fg: #d4d4d6;
    --fg-sub: #a3a3a6;
    --fg-muted: #8a8a8c;
    --title: #fff;
    --title-sub: #e8e8ea;
    --title-strong: #c4c4c6;
    --card: #1c1c1e;
    --border: #2c2c2e;
    --border-soft: #242426;
    --border-light: #242426;
    --hover: #2a2a2c; --pill-bg: #2a2a2c;
    --input-bg: #242426;
    --code-bg: #2c2c2e;
    --code-fg: #f0a9c7;
    --tip-bg: #3a2f10; --tip-br: #b28912; --tip-fg: #f0c54a;
    --info-bg: #152542; --info-br: #4a8af0; --info-fg: #9cc0f5;
    --warn-bg: #3e1515; --warn-br: #e64545; --warn-fg: #f5a8a8;
    --tag-bg: #0f3a24; --tag-fg: #4cc585;
    --path-bg: #242426; --path-bd: #2c2c2e;
    --shot-bd: #2c2c2e;
    --placeholder-bd: #3a3a3c; --placeholder-bg: #1a1a1c;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-shot: 0 2px 6px rgba(0,0,0,0.5);
    --shadow-backtop: 0 2px 8px rgba(0,0,0,0.6);
  }
}

/* ----- App / URL 显式强制深色 ----- */
:root[data-theme="dark"] {
  --bg: #0f0f12;
  --fg: #d4d4d6;
  --fg-sub: #a3a3a6;
  --fg-muted: #8a8a8c;
  --title: #fff;
  --title-sub: #e8e8ea;
  --title-strong: #c4c4c6;
  --card: #1c1c1e;
  --border: #2c2c2e;
  --border-soft: #242426;
  --border-light: #242426;
  --hover: #2a2a2c; --pill-bg: #2a2a2c;
  --input-bg: #242426;
  --code-bg: #2c2c2e;
  --code-fg: #f0a9c7;
  --tip-bg: #3a2f10; --tip-br: #b28912; --tip-fg: #f0c54a;
  --info-bg: #152542; --info-br: #4a8af0; --info-fg: #9cc0f5;
  --warn-bg: #3e1515; --warn-br: #e64545; --warn-fg: #f5a8a8;
  --tag-bg: #0f3a24; --tag-fg: #4cc585;
  --path-bg: #242426; --path-bd: #2c2c2e;
  --shot-bd: #2c2c2e;
  --placeholder-bd: #3a3a3c; --placeholder-bg: #1a1a1c;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-shot: 0 2px 6px rgba(0,0,0,0.5);
  --shadow-backtop: 0 2px 8px rgba(0,0,0,0.6);
}

/* ----- Reset ----- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 100%; }  /* 16px 基准，便于 rem 换算 & 跟随系统字体缩放 */
a, button { -webkit-tap-highlight-color: transparent; }  /* 去掉移动端浏览器点击时的蓝色色块残影 */

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  padding: 16px;
  line-height: 1.7;
  font-size: 0.9375rem; /* 15px */
}

/* ----- 语言相关字体栈覆盖 ----- */
html[lang="th"] body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans Thai", "Sarabun", "Segoe UI", Roboto, sans-serif;
}
html[lang="my"] body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans Myanmar", "Padauk", "Myanmar Text", "Segoe UI", Roboto, sans-serif;
}

.container { max-width: 700px; margin: 0 auto; padding-bottom: 60px; }

/* ----- 通用排版 ----- */
h1 { font-size: 1.0625rem; font-weight: 700; margin: 8px 0 12px; color: var(--title); }
h1:first-child { margin-top: 0; }

p { margin: 6px 0; }
ul, ol { padding-left: 20px; margin: 6px 0; }
li { margin: 4px 0; font-size: 0.875rem; /* 14px */ }

.desc { color: var(--fg-sub); font-size: 0.875rem; margin: 4px 0 10px; }
.section > .desc:only-child { margin: 0; }  /* 单独一段说明的卡片（如页首简介）：上下留白只靠卡片内边距，保持对称 */
.videos h1 { margin-left: -2px; }  /* 视频教程页标题距画布左边 14px（body 内边距 16px 抵掉 2px） */
h1 + .desc { margin-top: -15px; margin-right: -2px; margin-left: -2px; }  /* 上：与 h1 的 12px 下边距折叠后为 -3px，再加两行各自的行距留白，标题字底到说明字顶约 8px；左右：body 内边距 16px 抵掉 2px，文字距画布 14px */

code {
  background: var(--code-bg); color: var(--code-fg);
  padding: 1px 5px; border-radius: 3px;
  font-size: 0.8125rem; /* 13px */
  font-family: Menlo, Monaco, monospace;
}

/* ----- 卡片容器 ----- */
.section {
  background: var(--card);
  border-radius: 12px; padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.section-title { font-size: 0.9375rem; /* 15px */ font-weight: 600; color: var(--fg); margin-bottom: 10px; }
.sub-title { font-size: 0.9375rem; /* 15px */ font-weight: 600; color: var(--title-strong); margin: 14px 0 6px; }

/* ----- 提示框 ----- */
.tip  { background: var(--tip-bg);  border-left: 3px solid var(--tip-br);  color: var(--tip-fg);  padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 0.875rem; }
.info { background: var(--info-bg); border-left: 3px solid var(--info-br); color: var(--info-fg); padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 0.875rem; }
.warn { background: var(--warn-bg); border-left: 3px solid var(--warn-br); color: var(--warn-fg); padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 0.875rem; }

.tag { display: inline-block; background: var(--tag-bg); color: var(--tag-fg); padding: 2px 8px; border-radius: 4px; font-size: 0.8125rem; margin: 2px; }

.path {
  background: var(--path-bg); border: 1px solid var(--path-bd);
  border-radius: 6px; padding: 8px 10px; margin: 6px 0;
  font-size: 0.8125rem; color: var(--fg-sub);
}

/* ----- 目录 / 锚点 ----- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a {
  color: var(--fg-sub); text-decoration: none; display: inline-block;
  padding: 4px 16px; border-radius: 999px; background: var(--pill-bg);
  font-size: 0.875rem; line-height: 1.5;
}
.toc a:active { opacity: 0.7; }

/* ----- 权限门控:外壳/各页头部脚本会从 ?permissions= 写到 <html data-perm>;permissions=0(默认)时隐藏标准版独有入口 ----- */
html[data-perm="0"] .perm-gated { display: none !important; }
/* perm-base-only:permissions=0 才显示(简易/未授权时的特定文案,如「4 个 Tab」「不含影音」),permissions=1 时反过来隐藏 */
html[data-perm="1"] .perm-base-only { display: none !important; }

/* ----- 截图 ----- */
.shot { display: block; width: 100%; max-width: 260px; margin: 12px auto; border: 1px solid var(--shot-bd); border-radius: 10px; box-shadow: var(--shadow-shot); }
.shot-caption { text-align: center; color: var(--fg-sub); font-size: 0.75rem; /* 12px */ margin: -6px 0 10px; }
.placeholder { display: block; width: 100%; max-width: 260px; margin: 12px auto; padding: 40px 12px; border: 2px dashed var(--placeholder-bd); border-radius: 10px; text-align: center; color: var(--fg-muted); font-size: 0.8125rem; background: var(--placeholder-bg); }

/* ----- 返回顶部按钮 ----- */
#backTop {
  position: fixed; right: 16px; bottom: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  text-align: center; line-height: 40px;
  font-size: 1.25rem; text-decoration: none;
  box-shadow: var(--shadow-backtop); z-index: 99;
}
#backTop:active { opacity: 0.7; }

/* ============================================================
 * 主页专属：搜索框 / 热门 / 分类网格
 * ============================================================ */
.search-box {
  background: var(--card); border-radius: 12px;
  padding: 14px; margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.search-box input {
  width: 100%; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  font-size: 0.9375rem; background: var(--input-bg);
  color: var(--fg); outline: none;
}
.search-box input:focus { border-color: var(--brand); background: var(--card); }

.search-result { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.search-result a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--title); text-decoration: none;
  font-size: 0.875rem; border-bottom: 1px solid var(--border-light);
}
.search-result a:hover { background: var(--hover); }
.search-result .cat { color: var(--fg-sub); font-size: 0.75rem; margin-left: 6px; }
.search-result .empty { padding: 12px; color: var(--fg-sub); font-size: 0.875rem; }

.hot-list li { list-style: none; border-bottom: 1px solid var(--border-light); }
.hot-list li:last-child { border-bottom: none; }
.hot-list a { display: block; padding: 0; color: var(--fg); text-decoration: none; font-size: 1rem; line-height: 3rem; /* 16px / 48px */ }

.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.category-card {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 14px;
  text-decoration: none; color: var(--title-sub);
  display: block; transition: all 0.15s;
}
.category-card:active { background: var(--hover); transform: scale(0.98); }
.category-card .title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.category-card .sub { font-size: 0.875rem; color: var(--fg-sub); }
.category-card .icon { font-size: 1.375rem; margin-bottom: 6px; }
.category-card img.icon {
  display: block; width: auto; height: 28px;
  object-fit: contain; margin: 0 0 8px 0;
  /* Force all icons to uniform dark-grey silhouette regardless of source color/gradient/PNG */
  filter: brightness(0) saturate(100%) invert(40%);
}
:root[data-theme="dark"] .category-card img.icon { filter: brightness(0) saturate(100%) invert(78%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .category-card img.icon { filter: brightness(0) saturate(100%) invert(78%); }
}

/* ============================================================
 * 视频教程（assets/js/videos.js 渲染）：竖版缩略图 / 首页横排 / 列表卡片 / 功能页入口 / 全屏播放层
 * ============================================================ */
.gv-thumb {
  position: relative; display: block; flex: none;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 8px; overflow: hidden;
  background: var(--hover);
}
.gv-thumb::before { content: ""; display: block; padding-top: 177.78%; } /* 9:16，不依赖 aspect-ratio 兼容老 WebView */
.gv-thumb img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
/* 首页横排 + 视频教程页卡片 + 功能页入口：横版 167.5:95 比例（150×85），竖版封面裁中间偏上（保留封面标题） */
.gv-thumb-wide { width: 150px; }
.gv-thumb-wide::before { padding-top: 56.72%; }
.gv-thumb-wide img { object-position: center 30%; }
.gv-thumb-wide .gv-play { top: 50%; }
.gv-thumb-wide::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.3); }
.gv-thumb-wide .gv-play, .gv-thumb-wide .gv-dur { z-index: 1; }
.gv-ph {
  display: none; position: absolute; left: 6px; right: 6px; top: 20%;
  text-align: center; font-size: 0.75rem; font-weight: 600; line-height: 1.4; color: var(--fg-sub);
}
.gv-noimg img { display: none; }
.gv-noimg .gv-ph { display: block; }
.gv-play {
  position: absolute; left: 50%; top: 70%; /* 封面标题在中间偏上，播放图标放到下方空白处 */
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; background: rgba(0,0,0,0.45);
}
.gv-play::after {
  content: ""; position: absolute; left: 13px; top: 10px;
  border-style: solid; border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
}
.gv-dur {
  position: absolute; right: 4px; bottom: 4px;
  padding: 0 5px; border-radius: 4px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.6875rem; line-height: 1.6;
}

/* 首页横排 */
.gv-head { display: flex; align-items: baseline; justify-content: space-between; }
.gv-all { color: #999; text-decoration: none; font-size: 0.875rem; }
.gv-all::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 4px; vertical-align: 1px;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg);
}
.gv-strip {
  display: flex; gap: 10px; overflow-x: auto;
  margin: 0 -16px; padding: 0 16px 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.gv-strip::-webkit-scrollbar { display: none; }
.gv-item { flex: none; width: 150px; }
.gv-name { margin-top: 6px; font-size: 1rem; line-height: 1.4; color: var(--fg); text-align: center; }

/* 视频教程页卡片 */
.gv-card {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.section-title + .gv-card { padding-top: 0; }
.gv-card:last-child { border-bottom: none; padding-bottom: 0; }
/* 封面与首页横排一致：118×158（3:4）；align-self 防止被右侧文字高度拉伸 */
.gv-card .gv-thumb-wide, .gv-row .gv-thumb-wide { width: 118px; align-self: flex-start; }
.gv-card .gv-thumb-wide::before, .gv-row .gv-thumb-wide::before { padding-top: 133.33%; }
.gv-body { flex: 1; min-width: 0; }
.gv-title { font-size: 1rem; font-weight: 600; color: var(--fg); line-height: 1.5; }
.gv-intro { margin-top: 4px; font-size: 0.875rem; line-height: 1.6; color: var(--fg-sub); }
.gv-card .gv-body { cursor: pointer; }
.gv-toggle {
  margin-top: 8px; padding: 3px 12px;
  border: 1px solid var(--brand); border-radius: 999px; background: none;
  color: var(--brand); font: inherit; font-size: 0.75rem; line-height: 1.6; cursor: pointer;
}
.gv-toggle:active { opacity: 0.7; }

/* 功能页顶部入口 */
.gv-entry:empty { display: none; }
.gv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border-light); cursor: pointer;
}
.section-title + .gv-row { border-top: none; padding-top: 0; }
.gv-row:last-child { padding-bottom: 0; }
.gv-row:active { opacity: 0.7; }
.gv-row .gv-intro { margin-top: 2px; }

/* 全屏播放层（始终黑底，不跟随深浅色） */
html.gv-lock, html.gv-lock body { overflow: hidden; }
.gv-player {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000;
  display: flex; flex-direction: column; background: #000;
}
.gv-player[hidden] { display: none; }
.gv-bar { display: flex; align-items: center; gap: 12px; flex: none; height: 48px; padding: 0 8px 0 16px; }
.gv-player-title { flex: 1; min-width: 0; color: #fff; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-close { width: 40px; height: 40px; border: 0; background: none; color: #fff; font-size: 1.25rem; cursor: pointer; }
.gv-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.gv-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }

/* 要点弹窗（底部面板） */
.gv-sheet { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 900; display: flex; flex-direction: column; justify-content: flex-end; }
.gv-sheet[hidden] { display: none; }
.gv-mask { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.45); }
.gv-panel {
  position: relative; width: 100%; max-width: 700px; max-height: 80vh; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--card); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.gv-panel-head { display: flex; align-items: flex-start; gap: 8px; flex: none; padding-left: 38px; }  /* 左侧留出与关闭按钮等宽的空位，标题才能真正居中 */
.gv-panel-head .gv-title { flex: 1; min-width: 0; padding-top: 6px; text-align: center; }
.gv-panel-close { flex: none; width: 36px; height: 36px; margin: -2px -6px 0 0; border: 0; background: none; color: var(--fg-sub); font-size: 1.125rem; cursor: pointer; }
.gv-points { flex: 1; min-height: 0; overflow-y: auto; margin: 10px 0 14px; padding-left: 20px; -webkit-overflow-scrolling: touch; }
.gv-points li { color: var(--fg); }
.gv-play-btn {
  flex: none; width: 100%; height: 44px; border: 0; border-radius: 22px;
  background: var(--brand); color: #fff; font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
}
.gv-play-btn:active { opacity: 0.8; }

/* ============================================================
 * 主页样式（body.home）：白色圆角卡片 / 最新功能 / 竖版视频横排 / 编号热门问题
 * ============================================================ */
body.home { padding: 10px 14px 0; }
.home h1 { display: none; }  /* 标题由 App 原生导航栏 / document.title 承担 */
.home .container { padding-bottom: 24px; }
.home .section { padding: 14px; margin-bottom: 10px; box-shadow: none; }
.home .section-title { margin-bottom: 2px; }

/* 最新功能：标题 + 大一号条目 + 品牌色小标签（浅色底用伪元素叠 10% 透明，避免依赖 color-mix） */
.home .latest { padding-bottom: 12px; }
.home .latest .hot-list a { font-size: 1rem; font-weight: 500; line-height: 1.5rem; }
/* 多条时条目之间留白，分隔线不贴字；只有一条时外观不变 */
.home .latest .hot-list li:not(:last-child) a { padding-bottom: 10px; }
.home .latest .hot-list li + li a { padding-top: 10px; }
.home .latest .tag {
  position: relative; z-index: 0; margin: 0 0 0 4px; padding: 0 8px; vertical-align: 1px;
  background: none; color: var(--brand); font-size: 0.875rem; font-weight: 400; line-height: 20px;
}
.home .latest .tag::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1;
  border-radius: 4px; background: var(--brand); opacity: 0.1;
}

/* 影片教学横排：118×158（3:4）竖版缩略图，名称左对齐 */
.home .gv-strip { margin: 0 -14px; padding: 0 14px 2px; }
.home .gv-item { width: 118px; }
.home .gv-strip .gv-thumb-wide { width: 118px; }
.home .gv-strip .gv-thumb-wide::before { padding-top: 133.33%; }
.home .gv-strip .gv-play { top: 50%; }  /* 播放图标在封面正中，时长文字贴在其下方 */
.home .gv-strip .gv-dur,
.gv-card .gv-dur,
.gv-row .gv-dur {  /* 视频教程页卡片、功能页入口的封面与首页横排一致 */
  top: calc(50% + 24px); right: 0; bottom: auto; left: 0;
  padding: 0; background: none; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  font-size: 0.75rem;
}
.home .gv-name {
  margin-top: 4px; text-align: left; font-size: 0.9375rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 热门问题：01. 编号（display:none 的权限门控项不计数）；分隔线从文字起点拉到卡片右边缘 */
.home .hot-list { padding-left: 0; }
.home .hot-list li { margin: 0; }
/* 末行文字下方留白（行高余量 16 + ul 下边距 6 + 卡片内边距 14 = 36）压到 17：margin-bottom 6 → -13 */
.home .hot-list.numbered { counter-reset: hot; margin-right: -14px; margin-bottom: -13px; }
.home .hot-list.numbered li { counter-increment: hot; }
.home .hot-list.numbered a { padding-right: 14px; }
.home .hot-list.numbered a::before { content: counter(hot, decimal-leading-zero) "."; }
