/**
 * 手机端 / 窄屏专用页面布局（独立样式文件）
 * 说明：与桌面端共用同一套页面结构与数据，只覆盖 ≤900px 的版式，
 * 避免另建模板造成功能与内容不同步。加载顺序 style.css → mobile.css。
 * ≤640px 再叠加一层「紧凑」规则，适配常见手机宽度。
 */

/* ======================= 一、移动版基础与右上角下拉菜单 ======================= */
@media (max-width: 900px) {
  .header-inner { height: 58px; gap: 8px; }
  .brand-mark svg { width: 32px; height: 32px; }
  .brand-text strong { font-size: 15px; }
  .brand-text small { display: none; }
  .header-actions { margin-left: auto; gap: 6px; }
  /* 登录、投稿、头像、后台入口全部收进右上角下拉菜单 */
  .header-actions > a { display: none; }

  .mobile-toggle {
    display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    color: var(--primary); font-size: 19px; line-height: 1; cursor: pointer;
  }
  .mobile-toggle.open { background: #eaf1ff; border-color: #cdd9ef; }

  /* 下拉面板：固定在右上角，浮于页面之上，不占文档流 */
  body.front-body > .mobile-nav {
    display: none; position: fixed; top: 62px; right: max(10px, env(safe-area-inset-right));
    left: auto; width: min(280px, calc(100vw - 20px)); max-height: calc(100vh - 76px);
    overflow-y: auto; z-index: 60; box-sizing: border-box;
    flex-direction: column; gap: 1px; padding: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 18px 46px rgba(12, 30, 70, .22);
  }
  body.front-body > .mobile-nav.open { display: flex; }
  .mobile-nav a { padding: 9px 10px; border-bottom: 0; border-radius: 8px; font-size: 14px; }
  .mobile-nav a:hover, .mobile-nav a.active { background: #eaf1ff; color: var(--primary); font-weight: 700; }
  .mnav-search { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; padding: 4px 6px 4px 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; }
  .mnav-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 13px; }
  .mnav-search button { border: 0; background: transparent; color: var(--primary); font-size: 18px; cursor: pointer; }
  .mnav-label { padding: 8px 10px 3px; font-size: 11px; letter-spacing: 1px; font-weight: 700; color: var(--light); }

  /* 首屏：隐藏纯装饰的浮动卡片组，正文占满宽度 */
  .hero { padding: 18px 0 10px; }
  .hero-visual { display: none; }
  .hero-badge { margin-bottom: 12px; padding: 4px 10px; font-size: 11px; }
  .hero h1 { font-size: clamp(27px, 8vw, 34px); margin-bottom: 10px; }
  .hero-desc { font-size: 13.5px; line-height: 1.65; margin-bottom: 14px; }
  .hero-actions { gap: 8px; margin-bottom: 12px; }
  .hero-actions .btn-lg { padding: 9px 14px; font-size: 13px; border-radius: 10px; }
  .hero-search { padding: 3px 3px 3px 10px; border-radius: 11px; }
  .hero-search input { font-size: 13px; padding: 8px 6px; }
  .hero-hot { margin-top: 8px; gap: 8px; font-size: 11.5px; }

  /* 五项统计：强制一行，紧凑排布 */
  .stat-strip { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 0; padding: 11px 4px; border-radius: 12px; }
  .stat-strip > div { flex: 1 1 0; min-width: 0; padding: 0 2px; border-right: 1px solid var(--line); }
  .stat-strip > div:last-child { border-right: 0; }
  .stat-strip strong { font-size: 17px; line-height: 1.25; }
  .stat-strip span { display: block; font-size: 10px; line-height: 1.3; white-space: nowrap; }

  /* 公众号窄条：图标 + 文字 + 小按钮保持同一行 */
  .oa-strip { flex-wrap: nowrap; gap: 9px; margin-top: 12px; padding: 8px 10px; border-radius: 12px; }
  .oa-ico { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; }
  .oa-ico svg { width: 18px; height: 18px; }
  .oa-text { flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 1px; }
  .oa-text strong { font-size: 13px; }
  .oa-text span { font-size: 10.5px; line-height: 1.35; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .oa-btn { width: auto; flex: 0 0 auto; padding: 6px 11px; font-size: 12px; border-radius: 8px; }
  .oa-btn span { display: none; }

  /* 二维码图片弹窗：始终浮在网页上一层，居中覆盖，不进入文档流 */
  body.front-body > .oa-mask {
    position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box; background: rgba(12, 25, 55, .62);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  }
  .oa-modal { width: min(300px, calc(100vw - 36px)); padding: 22px 18px 18px; }
  .oa-qr { width: 180px; height: 180px; }
  body.front-body > .wb-toast { position: fixed; z-index: 10000; }

  /* 公告通知 / 优秀教师荣誉榜：手机端各只显示 2 条，其余走「更多」 */
  .notice-box > a:nth-of-type(n+3) { display: none; }
  .honor-box .honor-row:nth-of-type(n+3) { display: none; }

  /* 筛选区：搜索整行，学科 / 分类两个选择框并排，排序另起一行 */
  .filter-bar { padding: 10px 12px; }
  .filter-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 0; padding-top: 0; border-top: 0; }
  .filter-tools > form:first-child { grid-column: 1 / -1; }
  .filter-tools .inline-search { min-width: 0; }
  .filter-tools .inline-search input { min-width: 0; width: 100%; flex: 1; font-size: 12.5px; }
  .inline-search.subj-filter select, .inline-search.cat-filter select { width: 100%; min-width: 0; padding: 7px 8px; font-size: 12.5px; }
  .sort-group { grid-column: 1 / -1; justify-content: flex-start; gap: 2px; }
  .sort-group a { padding: 5px 10px; font-size: 12px; }
  .filter-tools.single { grid-template-columns: 1fr; }
  .filter-tools.single > .cat-filter select { width: 100%; }
}

/* ======================= 二、手机窄屏紧凑排版 ======================= */
@media (max-width: 640px) {
  .container { width: calc(100% - 20px); }
  .main-wrap { padding-top: 12px; padding-bottom: 22px; }
  .section { margin-top: 26px; }
  /* 标题与「更多」同一行，省掉竖排时额外占的一行 */
  .section-head { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
  .section-head h2 { font-size: 18px; margin: 0; }
  .section-head p { display: none; }
  .section-head .more-link { font-size: 12px; white-space: nowrap; }
  .kicker { font-size: 10px; letter-spacing: 1.6px; margin-bottom: 3px; }
  .two-col { gap: 18px; }
  .btn { padding: 8px 13px; font-size: 13px; }
  .btn-lg { padding: 10px 16px; font-size: 14px; }

  .page-hero { padding: 14px 0 16px; margin-bottom: 14px; }
  .page-hero h1 { font-size: 21px; }
  .page-hero p { font-size: 12px; }
  .detail-card, .article-card, .card-block, .learn-main { padding: 16px; }
  .result-line { font-size: 12px; margin: 10px 0; }

  /* 四步路径 2×2，比四行竖排更紧凑 */
  .path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .path-card { padding: 13px; }
  .path-card h3 { font-size: 14px; margin: 6px 0 4px; }
  .path-card p { font-size: 11.5px; line-height: 1.55; }
  .path-card b { font-size: 11.5px; }
  .path-no { font-size: 11px; }
  .path-ico { font-size: 20px; }

  .prompt-card, .case-card, .tool-card { padding: 13px; }
  .prompt-card h3, .case-body h3 { font-size: 14.5px; margin: 6px 0; }
  .prompt-card p, .case-body p { font-size: 12px; }
  /* 案例封面收窄，把宽度让给标题与摘要，避免手机上文字被挤成窄条 */
  .case-cover { width: 68px; }
  .case-cover i { font-size: 18px; letter-spacing: 1px; }
  .case-cover small { font-size: 10px; }
  .case-body { padding: 12px; }
  .pc-preview { font-size: 11.5px; }
  .course-row { padding: 10px 0; }
  .course-cover { width: 42px; height: 42px; flex: 0 0 42px; }

  .notice-box, .honor-box { padding: 6px 12px; }
  .notice-box a { padding: 9px 0; font-size: 13px; }
  .honor-box { margin-top: 10px; padding-top: 12px; }
  .honor-box h3 { font-size: 14px; }
  .honor-row { font-size: 12.5px; padding: 6px 0; }

  .cta-band { margin-top: 24px; padding: 18px; }
  .cta-band h2 { font-size: 17px; }
  .cta-band p { font-size: 12px; }
  .warning-wrap { margin: 14px 0; }
  .achievement-strip { padding: 16px; }

  .site-footer .footer-inner { padding: 22px 0 12px; gap: 14px; }
  .footer-links { gap: 6px 12px; }
  .footer-beian { padding: 10px 0 18px; font-size: 11px; }
}

/* 超窄屏（≤360px）：统计与路径进一步压缩，保证不横向溢出 */
@media (max-width: 360px) {
  .stat-strip { padding: 9px 2px; }
  .stat-strip strong { font-size: 15px; }
  .stat-strip span { font-size: 9px; }
  .hero-actions .btn-lg { padding: 8px 10px; font-size: 12px; }
  .oa-text span { font-size: 10px; }
  .oa-btn { padding: 6px 8px; font-size: 11px; }
}
