/* 手机端响应式适配（自建版）
 * 原 PC 站是固定 1200px 宽的桌面布局，在手机上会横向溢出、字小、按钮难点。
 * 这里用媒体查询做温和覆盖，不破坏桌面端。通过 <link> 注入，无需重新编译。
 */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }

  /* 容器：满宽 + 内边距 */
  .w1200 { max-width: 100% !important; padding-left: 12px !important; padding-right: 12px !important; }

  /* 顶部导航：横向可滚动，不再挤成两行 */
  .el-menu--horizontal { display: flex !important; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .el-menu--horizontal::-webkit-scrollbar { display: none; }
  .el-menu--horizontal > .el-menu-item, .el-menu--horizontal > .el-submenu { float: none !important; flex: 0 0 auto; }
  .el-menu-item { font-size: 15px !important; padding: 0 10px !important; }
  .el-menu-item a { font-size: 15px !important; float: none !important; }
  .logo { margin-top: 6px !important; }
  .logo .el-image { width: 104px !important; height: auto !important; }

  /* 卡片/栅格：小屏单列 */
  .el-row { flex-wrap: wrap; }
  .c-t-top { height: auto !important; padding: 28px 14px !important; }
  .c-t-top h1 { font-size: 22px !important; margin-bottom: 12px !important; }
  .c-t-top p { line-height: 24px !important; font-size: 14px; }

  /* 正文区域加点留白 */
  .c-m-mid, .c-mid { padding: 14px !important; min-height: auto !important; }
  .user-mid { margin-top: 10px !important; }

  /* 用户中心左侧栏：改为顶部横排，避免占满屏幕 */
  .u-left { min-height: auto !important; border-right: 0 !important; padding: 16px 10px !important; }

  /* 表格：可横向滚动，不撑破页面 */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* 图片自适应 */
  img { max-width: 100%; height: auto; }

  /* 输入区 / 文本域：满宽、字号 >=16px 防 iOS 自动放大 */
  textarea, input, .el-textarea__inner, .el-input__inner { font-size: 16px !important; }
  textarea { min-height: 220px !important; }

  /* 弹窗（Element UI）适配 */
  .el-dialog { width: 92% !important; margin-top: 12vh !important; }
  .el-message-box { width: 86% !important; }

  /* 底部/悬浮客服缩小并靠边，避免遮挡 */
  .kefu, .kefu-box { transform: scale(.85); transform-origin: right bottom; }

  /* 安全区（iPhone 刘海/底部横条） */
  body { padding-bottom: env(safe-area-inset-bottom); }

  /* 按钮点击区 */
  .el-button { min-height: 40px; }
}

/* 超小屏进一步压缩 */
@media (max-width: 380px) {
  .c-t-top h1 { font-size: 19px !important; }
  .el-menu-item, .el-menu-item a { font-size: 14px !important; padding: 0 8px !important; }
}

/* ===== 触控目标尺寸修正（2026-10-31 实测发现导航 21px、按钮 14px 偏小）===== */
@media (max-width: 900px) {
  /* 顶部导航：每个菜单项至少 44px 高 */
  .el-menu--horizontal .el-menu-item {
    min-height: 44px !important;
    display: flex !important;
    align-items: center;
    line-height: 44px !important;
  }
  .el-menu--horizontal .el-menu-item a {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px;
    padding: 0 2px;
    line-height: 1.2 !important;
  }
  /* 小号按钮：提升到可点击尺寸 */
  .el-button--mini {
    min-height: 34px !important;
    padding: 6px 10px !important;
  }
  .el-button--mini > span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
  }
  .el-button--mini a.buta,
  .el-button--mini a {
    display: inline-flex !important;
    align-items: center;
    min-height: 28px;
    padding: 4px 2px;
    line-height: 1.2 !important;
  }
}

/* ===== 用户中心/充值页 侧边栏适配（2026-10-31 实测：5/24 列宽导致文字逐字换行）===== */
@media (max-width: 900px) {
  .user-mid .el-row > .el-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  .u-left {
    width: 100% !important;
    min-height: auto !important;
    border-right: 0 !important;
    padding: 12px !important;
    text-align: left !important;
  }
  .u-left > .el-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100% !important;
  }
  .u-left .avatar.el-col-24 {
    width: auto !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .u-left .avatar .el-avatar {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
  }
  .u-left .avatar .el-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  .u-left .num.el-col-24 {
    width: auto !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .u-left .num .el-button {
    min-height: 34px;
    padding: 6px 10px;
  }
  .u-left .u-men.el-col-24 {
    width: auto !important;
    flex: 0 0 auto !important;
    min-height: 38px;
    padding: 8px 12px;
    margin: 0 !important;
    background: #f1f5f9;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1.2 !important;
    font-size: 13px;
  }
  .u-left .u-men uni-navigator {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }
  .u-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 12px !important;
  }
}

/* ==================================================================
   移动端 H5 深度适配 v2（2026-10-31）
   目标：手机上不要再出现"像电脑版被裁切"的观感
   ================================================================== */
@media (max-width: 900px) {
  /* 1) 输入框 16px：避免 iOS 聚焦时自动放大整页（"放大后错乱"的根因） */
  textarea, input, select, .uni-input-input, .uni-textarea-textarea {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  html, body {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    max-width: 100%;
    overflow-x: hidden;
  }
  img, video, canvas, pre, table { max-width: 100% !important; }
  * { word-break: break-word; }

  /* 2) 顶部大横幅：手机上压缩高度 */
  .banner, .header-banner, .index-banner, [class*="banner"] { min-height: auto !important; }
  [class*="banner"] h1, [class*="banner"] .title { font-size: 20px !important; }

  /* 3) 订单列表：8 列表格 → 卡片流 */
  .el-table__header-wrapper, .el-table__header, .el-table__footer-wrapper { display: none !important; }
  .el-table, .el-table__body-wrapper, .el-table table, .el-table tbody {
    display: block !important; width: 100% !important; overflow-x: visible !important;
  }
  .el-table colgroup { display: none !important; }
  .el-table .el-table__row {
    display: block !important; background: #fff; border: 1px solid #E6EAF2;
    border-radius: 14px; margin: 10px 0; padding: 6px 14px;
    box-shadow: 0 4px 14px rgba(16,24,40,.05);
  }
  .el-table .el-table__row td {
    display: flex !important; align-items: center; justify-content: space-between;
    gap: 10px; width: 100% !important; border: 0 !important;
    padding: 8px 0 !important; font-size: 13px !important; line-height: 1.5 !important;
    text-align: right !important;
  }
  .el-table .el-table__row td::before {
    content: attr(data-label); flex: 0 0 auto; color: #94A3B8; font-size: 12px; text-align: left;
  }
  .el-table .el-table__row td:nth-child(2) {
    display: block !important; text-align: left !important; color: #475569;
    font-size: 12px !important; max-height: 4.6em; overflow: hidden; padding-top: 0 !important;
  }
  .el-table .el-table__row td:nth-child(2)::before { display: none; }
  .el-table .el-table__row td .el-button,
  .el-table .el-table__row td button {
    min-height: 34px; padding: 6px 14px !important; font-size: 13px !important;
  }

  /* 4) 底部悬浮按钮不遮挡正文（同时保留 iPhone 安全区；老内核不支持 env()，先给纯 px 兜底） */
  body { padding-bottom: 76px; }
  @supports (padding: env(safe-area-inset-bottom)) {
    body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  }

  /* 5) 通用表格横向滚动兜底 */
  .table-wrap, .uni-table { width: 100% !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* 6) 弹窗留边距、内部可滚动 */
  .el-dialog, .uni-modal, [class*="dialog"] { max-width: calc(100vw - 24px) !important; }
  .el-dialog__body, .uni-modal__bd { max-height: 62vh; overflow-y: auto; }
}


/* 结果弹窗与固定列优化（移动端） */
@media (max-width: 900px) {
  /* el-table 固定列会在移动端生成一份超宽的重复表格，直接隐藏 */
  .el-table__fixed,
  .el-table__fixed-right,
  .el-table__fixed-left,
  .el-table__fixed-body-wrapper,
  .el-table__fixed-header-wrapper { display: none !important; }

  /* 结果弹窗：占满屏幕宽度，内容可滚动 */
  .el-dialog { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; margin: 8px auto !important; border-radius: 14px !important; }
  .el-dialog__header { padding: 14px 16px 8px !important; }
  .el-dialog__body { max-height: 74vh !important; overflow-y: auto !important; padding: 8px 14px 16px !important; -webkit-overflow-scrolling: touch; }
  .el-dialog__body .el-textarea__inner,
  .el-dialog__body textarea { max-height: 30vh !important; font-size: 14px !important; line-height: 1.7 !important; }

  /* 对比开关一行放得下 */
  .el-dialog__body .el-row { flex-wrap: wrap; }
}

/* ==================================================================
   移动端全站适配 v3（2026-11-13）
   仅 <=900px 生效，PC 端完全不受影响
   ================================================================== */
@media (max-width: 900px) {
  /* 桌面版右侧竖条工具（视频教程/改写记录等）在手机上隐藏，避免遮挡正文 */
  #pb-sidebar { display: none !important; }

  /* 顶部导航更紧凑，给正文留空间 */
  .header { padding: 0 !important; }
  .header .el-row { flex-wrap: nowrap !important; align-items: center; }
  .header .el-row > .el-col:nth-child(1) { width: auto !important; max-width: 100px; min-width: 0; flex: 0 0 auto !important; padding-right: 4px !important; }
  .header .el-row > .el-col:nth-child(2) { width: auto !important; flex: 1 1 auto !important; max-width: none !important; min-width: 0 !important; overflow: hidden !important; padding-left: 0 !important; }
  .menu .el-menu--horizontal { max-width: 100% !important; }
  /* 手机端：隐藏横向导航，改用右上角汉堡/用户名按钮 */
  .el-menu--horizontal { display: none !important; }
  .header .el-row { height: 48px !important; align-items: center !important; }
  .header .el-row > .el-col { height: 48px !important; }
  .logo { height: 48px !important; display: flex; align-items: center; }
  .el-menu--horizontal > .el-submenu { display: none !important; }
  .menu { min-height: 0 !important; height: 48px !important; }
  body .header .logo .el-image {
    width: 84px !important;
    height: 28px !important;
    background-size: contain !important;
    background-position: left center !important;
    background-repeat: no-repeat !important;
  }
  .el-menu-item { height: 48px !important; line-height: 48px !important; padding: 0 8px !important; }
  .el-menu-item a { font-size: 14px !important; }

  /* 订单列表：固定列原件隐藏（按钮由 mobile-enhance.js 以整行按钮重建） */
  .el-table .el-table__row td.is-hidden { display: none !important; }
  .el-table__row td[data-pb-action] { display: block !important; }
  .el-table__row td[data-pb-action]::before { display: none !important; }
  .el-table__row td:has(> .cell:empty) { display: none !important; }
  .el-table__row td > .cell:empty { display: none !important; }
  .el-table .el-table__row { padding: 10px 14px !important; }
  .el-table .el-table__row td { font-size: 13px !important; }

  /* 订单详情：参数表不再横向溢出 */
  .el-descriptions__body { overflow-x: hidden !important; }
  .el-descriptions__table { table-layout: fixed !important; width: 100% !important; }
  .el-descriptions__table th { width: 70px !important; max-width: 70px !important; }
  .el-descriptions__table td { width: auto !important; min-width: 0 !important; word-break: break-all !important; }
  .el-descriptions__table th,
  .el-descriptions__table td {
    font-size: 12px !important;
    padding: 5px 6px !important;
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
  }
  .el-descriptions-item__label { width: 72px !important; }
  .el-descriptions__title { font-size: 15px !important; }

  /* 订单详情：手机上改为「标签 + 值」两列网格，订单号不再一字一行 */
  .el-descriptions__table,
  .el-descriptions__table tbody { display: block !important; width: 100% !important; }
  .el-descriptions__table tr.el-descriptions-row {
    display: grid !important;
    grid-template-columns: 64px 1fr !important;
    width: 100% !important;
  }
  .el-descriptions__table th.el-descriptions-item__label {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    padding: 6px 6px !important;
    background: #f8fafc !important;
    color: #64748b !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    text-align: left !important;
  }
  .el-descriptions__table td.el-descriptions-item__content {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    padding: 6px 8px !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  /* 原文/改写内容区：去掉固定高度，手机上更紧凑 */
  .mt-m-text { height: auto !important; max-height: none !important; min-height: 120px !important; }
  .mid-text .el-textarea__inner,
  .mid-text textarea { min-height: 150px !important; max-height: 240px !important; font-size: 14px !important; line-height: 1.7 !important; }
  .mt-top { height: auto !important; }
  .mt-ftr { height: auto !important; padding: 10px 0 !important; }

  /* 底部留白，避免悬浮按钮遮住最后一块内容 */
  body { padding-bottom: 180px !important; }

  /* 首页横幅压缩 */
  .c-t-top { padding: 18px 14px !important; }
  .c-t-top h1 { font-size: 20px !important; margin-bottom: 8px !important; }
  .c-t-top p { font-size: 13px !important; line-height: 22px !important; }
}

