/* ================================================================
 * mobile-app.css — 学习资料共享屋 手机端小程序化框架 V2（美观度优先）
 * 仅 max-width:768px 生效。对标小程序 app.wxss：
 *   主色 #2D7CF5 / 背景 #F2F4F8 / 文字 #1A1A2E / 卡片白底圆角8px
 * 系统性处理：图片裁切、文字断行、间距行距、表格溢出、点击反馈
 * ================================================================ */

@media (max-width: 768px) {
  /* ========== 0. 全局基调与防御 ========== */
  html { -webkit-text-size-adjust: 100%; }
  body {
    background: #F2F4F8 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, 'Microsoft YaHei', sans-serif !important;
    font-size: 14px;
    color: #1A1A2E;
    line-height: 1.6;
    padding-bottom: calc(130px + env(safe-area-inset-bottom));
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  /* 文字断行防御：防止长 URL/数字/英文撑破布局 */
  p, h1, h2, h3, h4, h5, h6, span, a, div, li, td, th, blockquote, pre, code {
    overflow-wrap: break-word;
    word-break: break-word;
  }
  /* 图片永不溢出容器 */
  img, video, canvas { max-width: 100% !important; height: auto !important; }
  img { object-fit: cover; }

  /* ========== 1. 隐藏 PC 框架 ========== */
  .topMiniNav, .pageHeader, .bottomNavigation, .floatItem,
  .pc-only, .desktop-nav, .pc-header, .pc-footer { display: none !important; }

  /* ========== 2. 顶部胶囊搜索栏 ========== */
  .mp-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
    background: linear-gradient(135deg, #2D7CF5, #5A9BFF);
    padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
  }
  .mp-topbar .mp-search-capsule {
    display: flex; align-items: center;
    background: #fff; border-radius: 40px; height: 36px;
    padding: 0 14px; gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
  }
  .mp-topbar .mp-search-capsule:active { opacity: 0.85; }
  .mp-topbar .mp-search-ico { font-size: 15px; color: #8E8EA0; flex-shrink: 0; }
  .mp-topbar .mp-search-txt { font-size: 13px; color: #A5A5B5; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mp-topbar .mp-scan-ico { font-size: 15px; color: #2D7CF5; flex-shrink: 0; }
  .mp-topbar-spacer { height: calc(54px + env(safe-area-inset-top)); }

  /* ========== 3. 底部 TabBar ========== */
  .mp-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
    display: flex; background: #FFFFFF;
    border-top: 1px solid #EDEDF2;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
  }
  .mp-tabbar .mp-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 7px 0 5px; color: #7A7E83; font-size: 10px; gap: 2px;
    text-decoration: none; -webkit-tap-highlight-color: transparent;
  }
  .mp-tabbar .mp-tab .mp-tab-ico { font-size: 20px; line-height: 1; }
  .mp-tabbar .mp-tab.active { color: #2D7CF5; font-weight: 600; }
  .mp-tabbar .mp-tab:active { background: #F5F7FA; }

  /* ========== 4. 通用卡片/区块 ========== */
  .mp-card {
    background: #fff; border-radius: 12px; padding: 14px;
    margin: 10px 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #EEEEF0;
  }
  .mp-section-title {
    font-size: 16px; font-weight: 600; color: #1A1A2E;
    padding: 14px 14px 6px; display: flex; align-items: center; gap: 6px;
  }
  .mp-section-title .mp-bar { width: 4px; height: 16px; border-radius: 2px; background: #2D7CF5; display: inline-block; }
  .mp-section-title .mp-more { margin-left: auto; font-size: 12px; color: #A5A5B5; font-weight: 400; }

  .mp-btn {
    display: inline-block; background: linear-gradient(135deg, #2D7CF5, #5A9BFF);
    color: #fff; border: none; border-radius: 40px;
    padding: 8px 22px; font-size: 14px; font-weight: 500;
    box-shadow: 0 4px 14px rgba(45,124,245,0.25);
    text-align: center; text-decoration: none; line-height: 1.4;
  }
  .mp-btn:active { opacity: 0.85; transform: scale(0.98); }

  /* ========== 5. 首页模块小程序化 ========== */
  .bannerBox {
    margin: 10px 12px; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  }
  .bannerContent, .bannerSlide { border-radius: 12px; }
  .bannerImg { width: 100%; height: 100%; }
  .bannerImg img, .bannerImg div[style*="background"] { border-radius: 12px; }

  /* 金刚区 */
  .quickEntry { padding: 0 12px; }
  .entryGroup {
    border-radius: 12px !important; padding: 14px 10px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #EEEEF0; background: #fff;
  }
  .entryIcon {
    width: 46px !important; height: 46px !important;
    border-radius: 14px !important; font-size: 22px !important;
    box-shadow: 0 3px 10px rgba(45,124,245,0.15);
    display: flex; align-items: center; justify-content: center;
  }
  .entryItem { gap: 6px !important; padding: 6px 2px !important; }
  .entryTitle { font-size: 12px !important; color: #1A1A2E !important; font-weight: 500 !important; white-space: nowrap; }
  .entryDesc { display: none !important; }

  /* 资料卡片流（两列） */
  .courseGrid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; padding: 0 12px; }
  .courseCard {
    border-radius: 12px !important; overflow: hidden; margin: 0 !important;
    border: 1px solid #EEEEF0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    background: #fff;
  }
  .courseCard .cardCover {
    height: 100px !important; font-size: 32px !important; border-radius: 0 !important;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .courseCard .cardCover img { width: 100%; height: 100%; object-fit: cover; }
  .cardBody { padding: 10px 10px 8px !important; }
  .cardTitle {
    font-size: 13px !important; font-weight: 500 !important; line-height: 1.45 !important;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 38px; margin: 0 0 6px !important; color: #1A1A2E;
  }
  .cardMeta { font-size: 11px !important; color: #A5A5B5 !important; margin: 2px 0 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cardPrice {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 6px !important; gap: 4px;
  }
  .cardPrice .price { font-size: 15px !important; font-weight: 600 !important; color: #FF4D4F !important; white-space: nowrap; }
  .cardPrice .price.free { color: #00B578 !important; }
  .cardPrice .buyBtn {
    border-radius: 40px !important; font-size: 12px !important;
    padding: 4px 14px !important; line-height: 1.5 !important;
    background: linear-gradient(135deg, #2D7CF5, #5A9BFF) !important;
    color: #fff !important; border: none !important; white-space: nowrap;
  }

  /* 资讯列表 */
  .mainContent { padding: 0 12px; }
  .newsItem {
    background: #fff; border-radius: 12px;
    padding: 12px 14px !important; margin-bottom: 10px;
    border: 1px solid #EEEEF0; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  }
  .newsTitle { font-size: 14px !important; font-weight: 500 !important; line-height: 1.5 !important; }
  .newsDateBadge { border-radius: 8px !important; }

  /* 单栏化 */
  .mainWrap { display: block !important; }
  .mainLeft { width: 100% !important; }
  .mainRight { width: 100% !important; margin-top: 10px; }
  .sideCard {
    border-radius: 12px !important; border: 1px solid #EEEEF0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04) !important; margin: 0 12px 10px !important;
  }
  .examCalendar { border-radius: 12px !important; margin: 0 12px 10px !important; }
  .adSlot { margin: 10px 12px !important; border-radius: 12px !important; }

  /* ========== 6. 通用页面元素小程序化 ========== */
  /* 页面标题区 */
  .pageTitle, .page-head, .contentTitle { font-size: 17px !important; font-weight: 600 !important; padding: 14px 16px 6px !important; color: #1A1A2E !important; }
  /* 内容容器 */
  .container, .content, .main { padding: 0 12px !important; max-width: 100% !important; }
  /* 表格横向滚动 */
  table { display: block !important; overflow-x: auto !important; white-space: nowrap; }
  /* 表单输入放大（防误触/缩放） */
  input, textarea, select { font-size: 16px !important; }
  /* 链接点击反馈 */
  a { -webkit-tap-highlight-color: rgba(45,124,245,0.1); }
  /* 段落行距 */
  p { line-height: 1.7; }
  /* 弹窗/浮层全屏化 */
  .modal, .dialog, .infoModal { max-width: 92vw !important; border-radius: 14px !important; }

  /* 分隔线更柔和 */
  hr { border: none; border-top: 1px solid #F0F0F2; margin: 12px 0; }
}
