/* mobile.css — M0 全局移动端骨架：底部 tab / 抽屉 / chat 挂件 / 弹窗 bottom sheet
   所有规则限定在 @media (max-width:767px)，桌面端零影响。 */
.m-tabbar,.m-drawer,.m-drawer-mask{display:none}
.matrix-scroll-hint{display:none}

@media (max-width:767px){
  :root{--m-tabbar-h:56px}
  /* M3：padding 加高到 FAB 顶沿（tabbar+12+48=60）之上，悬浮球不再遮住末卡按钮；
     页脚自身底部留白相应减负（见 .site-footer），净增约 30px */
  body{padding-bottom:calc(var(--m-tabbar-h) + 70px + env(safe-area-inset-bottom,0px))}
  body.m-drawer-open{overflow:hidden}

  /* 底部 tab 栏 */
  .m-tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:600;
    height:calc(var(--m-tabbar-h) + env(safe-area-inset-bottom,0px));
    padding-bottom:env(safe-area-inset-bottom,0px);
    background:rgba(255,255,255,.95);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
    border-top:1px solid var(--line,#e5e9f0);box-shadow:0 -6px 20px rgba(15,23,42,.06)}
  .m-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
    min-height:44px;text-decoration:none;color:#64748b;font-size:10.5px;line-height:1;
    -webkit-tap-highlight-color:transparent}
  .m-tab .m-ico{font-size:18px;line-height:1;transition:transform .15s ease}
  .m-tab.active{color:#059669;font-weight:700}
  .m-tab.active .m-ico{transform:translateY(-1px) scale(1.06)}
  .m-tab:active{opacity:.7}

  /* 右侧抽屉 */
  .m-drawer-mask{display:block;position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:700;
    opacity:0;pointer-events:none;transition:opacity .22s ease}
  .m-drawer{display:block;position:fixed;top:0;right:0;bottom:0;width:min(320px,86vw);z-index:701;
    background:#fff;transform:translateX(102%);transition:transform .26s ease;
    overflow-y:auto;padding:14px 6px calc(26px + env(safe-area-inset-bottom,0px));
    box-shadow:-12px 0 34px rgba(15,23,42,.18)}
  body.m-drawer-open .m-drawer{transform:translateX(0)}
  body.m-drawer-open .m-drawer-mask{opacity:1;pointer-events:auto}
  .m-drawer-head{display:flex;align-items:center;justify-content:space-between;
    padding:2px 10px 10px;border-bottom:1px solid var(--line,#eef1f5);margin-bottom:4px}
  .m-drawer-head b{font-size:.92rem;color:#1f2937}
  .m-drawer-x{width:36px;height:36px;border:none;background:#f1f5f9;border-radius:10px;
    font-size:15px;color:#64748b;cursor:pointer}
  .m-drawer-sec{padding:6px 6px 0}
  .m-drawer-sec>div{font-size:10.5px;color:#9ca3af;letter-spacing:.06em;padding:0 10px 5px}
  .m-drawer a{display:flex;align-items:center;gap:10px;min-height:44px;padding:4px 10px;
    border-radius:10px;text-decoration:none;color:#1f2937;font-size:.86rem}
  .m-drawer a .m-ico{width:22px;text-align:center;font-size:15px;color:#94a3b8;flex:none}
  .m-drawer a:active{background:#f1f5f9}
  .m-drawer a.cur{background:#ECFDF5;color:#047857;font-weight:700}
  .m-drawer a.cur .m-ico{color:#059669}

  /* chat 悬浮挂件：缩小 + 面板转全宽 bottom sheet（#cw-root 前缀压过 widget.js 内联样式） */
  #cw-root #cw-fab{width:48px;height:48px;right:12px;
    bottom:calc(var(--m-tabbar-h) + 12px + env(safe-area-inset-bottom,0px));font-size:22px}
  #cw-root #cw-panel{left:0;right:0;bottom:0;top:auto;width:auto;max-width:none;height:78dvh;
    max-height:none;border-radius:16px 16px 0 0;animation:m-sheet-up .22s ease}
  @keyframes m-sheet-up{from{transform:translateY(32px);opacity:.55}to{transform:none;opacity:1}}

  /* 弹窗 → 底部 sheet */
  .stat-modal,.modal-mask{align-items:flex-end;padding:0}
  .stat-modal-box,.modal,.modal-box{width:100%;max-width:none;max-height:88vh;
    border-radius:16px 16px 0 0;box-shadow:0 -10px 34px rgba(15,23,42,.18);
    animation:m-sheet-up .22s ease}
  dialog[open]{position:fixed;top:auto;bottom:0;left:0;right:0;margin:0;width:100%;max-width:none;
    max-height:86vh;border-radius:16px 16px 0 0;border:1px solid var(--line,#e5e9f0)}
  dialog[open]::backdrop{background:rgba(15,23,42,.45)}

  /* M1 手机档 header 收口：导航职责归底部 tabbar——burger 隐藏（与「我的」抽屉重复），
     header 压成薄品牌条，把竖屏空间还给内容区 */
  .nav-burger{display:none !important}
  header{padding:7px 14px !important;gap:8px !important}
  .brand{gap:8px !important}
  .brand h1{font-size:15px !important}
  .brand .sub{font-size:10px !important}
  header .meta{display:none !important}

  /* toast 上移避开 tab 栏 */
  .cw-toast{bottom:calc(var(--m-tabbar-h) + 16px + env(safe-area-inset-bottom,0px))}

  /* 页脚与定位行紧凑化（M3：正文性小字统一 ≥12px 下限） */
  .page-lead{font-size:.8rem;padding:0 10px;margin-top:8px}
  .site-footer{padding:12px 16px 10px;margin-top:18px;font-size:12px}

  /* 横向溢出修复：legend 胶囊允许换行、卡片标题可折行、长 ASCII 强制断行 */
  .card h2, h2{flex-wrap:wrap;row-gap:4px}
  .legend-chip{margin-left:auto;white-space:normal;font-size:12px;padding:2px 9px;line-height:1.5}
  .cog-ev .quote, .quote{overflow-wrap:anywhere;word-break:break-word}
  pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}
  img, svg{max-width:100%;height:auto}

  /* 研读/知识库触控：动作按钮够大、换行铺排，避免小目标误触 */
  .study-actions{align-items:stretch}
  .study-action-link,.study-detail-btn,.m-mat-btn{min-height:38px;flex:1 1 100%;justify-content:center}
  .article-actions{display:flex;flex-wrap:wrap;gap:6px}
  .article-actions .act-btn,.article-actions .act-link{min-height:36px;margin:0;flex:0 0 auto}
  .study-actions + .study-q{margin-top:10px}

  /* 任务行打磨：长文本全宽，动作按钮下置 */
  .task-item{grid-template-columns:1fr;gap:9px;padding:12px}
  .t-right{grid-column:auto;flex-wrap:wrap;gap:7px}
  .s-badge{white-space:normal}
  .t-cat{font-size:10.5px}
  .t-link{flex:1 1 100%;display:inline-flex;align-items:center;justify-content:center;
    padding:10px 14px;font-size:.86rem;border-radius:12px}
  .task-head{flex-wrap:wrap;gap:6px 9px;padding:10px 12px}
  .task-no{order:1}
  .tk-pilot{order:2}
  .task-title{order:3;flex:1 1 auto;min-width:0}
  .task-title b{font-size:.86rem}
  .tk-chev{order:4}
  .task-cost{display:none}
  .tk-ring{order:5;margin-left:auto}
  .hist-btn{order:6}
  .btn-go.tk-go{order:7;flex:1 1 100%;text-align:center;padding:10px 14px;min-height:40px;border-radius:12px}
  .ts2{padding:9px 12px;gap:8px}
  .ts2-act{justify-content:stretch}
  .ts2-act .btn-go-mini{flex:1;min-height:38px;border-radius:10px}
  .sub-note{max-width:100%}
  .wiz-task-h{flex-wrap:wrap;gap:4px 8px}
  .wiz-task-cnt{margin-left:0}

  /* 理论提交展示块：全宽可折行，本人原文不溢出 */
  .my-submission{padding:10px 12px}
  .my-submission p{font-size:12px;overflow-wrap:anywhere;word-break:break-word}
  .review-box{overflow-wrap:anywhere;word-break:break-word}

  /* 统计面板移动端：筛选胶囊可换行、触控更大、图表去 legend 留白 */
  .sm-tabs,.sm-cats{gap:7px}
  .sm-tab,.sm-cat{min-height:36px;padding:7px 13px;font-size:.82rem;line-height:1.2}
  .sm-cat{flex:1 1 auto;text-align:center}
  .cal-nav{gap:6px}
  .cal-nav .tool-btn{min-height:36px;padding:8px 12px}
  .cal-nav .cal-label{min-width:auto;flex:1 1 100%;text-align:left;font-size:.88rem}
  .sm-sum .mini-chip{font-size:.78rem;padding:5px 11px}
  #sm-chart{height:220px !important}

  /* ============ M3 核心页手机体验打磨（截图定性后逐项修） ============ */

  /* 首页首屏：品牌 hero 卡压缩（wordmark 72→44px，slogan 14→12px），
     统计卡标签提到 12px——首屏留给今日任务而非品牌展示 */
  .hero-brand{padding:12px 12px 11px;gap:5px;margin-bottom:10px}
  .hero-wordmark{height:44px}
  .hero-slogan{font-size:12px}
  .mini-stat .lab{font-size:12px}
  .mini-stat .num{font-size:1.15rem}

  /* chat 页 app 化：卡片撑满可用高，对话区内部滚动，输入行 sticky 钉在
     tabbar 之上——多轮对话后不用滚到底才能打字；长说明藏起把空间还给对话 */
  body[data-page="chat"] main.chat-wrap{margin:8px auto 0}
  .chat-card{display:flex;flex-direction:column;min-height:calc(100dvh - 185px)}
  .chat-card .hint{display:none}
  .chat-card .toolbar{flex-wrap:wrap;gap:6px}
  .chat-card .tool-btn{min-height:36px}
  #chatlog{flex:1;min-height:160px;max-height:none}
  #chat-resize{display:none}
  .followup-chip{position:sticky;bottom:calc(var(--m-tabbar-h) + 56px + env(safe-area-inset-bottom,0px));z-index:5}
  .input-row{position:sticky;bottom:calc(var(--m-tabbar-h) + env(safe-area-inset-bottom,0px));z-index:5;
    background:#fff;border-top:1px solid #eef1f5;padding:8px 0 4px;margin-top:6px;
    border-radius:0 0 12px 12px}
  /* 输入框 16px：iOS 聚焦时不再触发自动放大 */
  #q{font-size:16px;padding:11px 12px}
  #send{min-height:44px}

  /* 情报页统计卡：数字 1.4rem 放不下「最近更新」这类长日期文本，压到 1.05rem + 收窄下限 */
  .stat-box{min-width:104px;padding:8px 10px}
  .stat-num{font-size:1.05rem}

  /* 小字下限与触控反馈（截图定性：11px 档小字全站提至 ≥12px，按钮按下有回执） */
  .t-cat{font-size:12px}
  .corpus-tag{font-size:12px}
  .fb-note{font-size:12px}
  .hist-meta,.hist-btn{font-size:12px}
  .tool-btn,.hist-btn,.fb-btn{min-height:34px}
  .m-tab:active,.m-drawer a:active,.btn-go:active,.tool-btn:active,.t-link:active,.sm-tab:active,.sm-cat:active{opacity:.72}

  /* ============ M4 收尾（PB-115）：岗位图谱页矩阵手机重排 + 宽表首列冻结 ============ */

  /* 13×13 热力图（PB-117 起 13 维）：332px 容器里维度列被压成 ~12px/格不可读——定宽 760px
     （13 维 ≈44px/格·轴标签 11px 可读）后在外层容器横滑；ECharts init 时容器即此宽。
     岗位名 y 轴标签在画布内随滚动平移，滑回最左即岗位名列。桌面端零影响。 */
  .matrix-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
  #heatmap{min-width:760px}
  .matrix-scroll-hint{display:block;font-size:12px;color:var(--muted);margin:2px 0 0}
  .matrix-legend{flex-wrap:wrap;row-gap:4px}

  /* 宽表首列冻结（job-table 659px / fit-table 535px 横滑时行标识不丢）：
     job-table 冻「岗位」列；fit-table 冻「#+岗位」两列（# 列定宽 30px 供偏移）。
     仅限岗位图谱页（body[data-page]），避免在其他页不滚动的表格上画出接缝；
     背景实色取面板底色，防滚动时透视串行。 */
  body[data-page="jobs"] .table-wrap th:first-child,
  body[data-page="jobs"] .table-wrap td:first-child{
    position:sticky;left:0;z-index:2;background:var(--panel);
    box-shadow:1px 0 0 var(--line)}
  body[data-page="jobs"] .table-wrap thead th:first-child{z-index:3}
  #fit-table th:first-child,#fit-table td:first-child{
    width:30px;min-width:30px;max-width:30px;padding-left:10px;padding-right:8px}
  #fit-table th:nth-child(2),#fit-table td:nth-child(2){
    position:sticky;left:30px;z-index:2;background:var(--panel);
    box-shadow:1px 0 0 var(--line)}
  #fit-table thead th:nth-child(2){z-index:3}
}

