/* 手机端适配层：在 style.css 之后加载，只做覆盖，不改桌面样式 */

html { -webkit-text-size-adjust: 100%; }
body { min-height: 100svh; }

/* iOS 安全区：底部按钮与页脚不被系统横条压住 */
main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* 中文长文本与英文技能名都要能断行，避免撑出横向滚动 */
.card, .hero, .job, .tl, .callout, .dimrow, .dual { word-break: break-word; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  /* 顶栏：状态与导航挤在一行会溢出，状态省掉，导航保留三个 */
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand { gap: 9px; }
  .logo { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .brand h1 { font-size: 15px; }
  .topnav { gap: 2px; }
  .topnav button { padding: 8px 10px; font-size: 12.5px; border-radius: 8px; min-height: 36px; }
  .svc { display: none; }

  main { padding: 16px 13px calc(84px + env(safe-area-inset-bottom)); }

  .card { padding: 16px 14px; border-radius: 13px; margin-bottom: 12px; }
  .card.tight { padding: 13px 14px; }
  .card-h { margin-bottom: 11px; }
  .card-h h2 { font-size: 15.5px; }

  .hero { padding: 20px 16px; border-radius: 15px; }
  .hero h2 { font-size: 19.5px; line-height: 1.45; }
  .hero p { font-size: 13.5px; }
  .hero .tags { margin-top: 12px; gap: 6px; }
  .tagpill { font-size: 11px; padding: 4px 9px; }

  .entry .card h3 { font-size: 15.5px; }
  .entry ul { font-size: 13px; padding-left: 16px; }

  /* 输入框 16px 以下 iOS 会强制放大页面，这里必须 16px */
  .input { font-size: 16px; padding: 11px 12px; }
  .suggest div { padding: 11px 12px; font-size: 14px; }
  .seg button { padding: 9px 12px; font-size: 13px; min-height: 38px; }

  .btn { padding: 11px 15px; font-size: 14px; min-height: 44px; }
  .btn-lg { padding: 13px 18px; font-size: 15px; width: 100%; justify-content: center; }

  /* 答题：五个量表按钮要够大，手指点得准 */
  .qhead { top: 56px; padding: 6px 0 10px; }
  .qitem { padding: 13px 13px; border-radius: 11px; }
  .qno { width: 22px; height: 22px; font-size: 11.5px; }
  .qtext { font-size: 14px; }
  .scale { gap: 5px; margin-top: 2px; }
  .opt { font-size: 11.5px; padding: 0; min-height: 42px; display: flex; align-items: center; justify-content: center; line-height: 1.25; }
  .ab { padding: 13px 13px; font-size: 14px; min-height: 52px; }
  .ab-mid { min-height: 40px; padding: 8px; }
  .submitbar { padding: 10px 0 12px; }
  .submitbar .btn-lg { width: auto; flex: 1; }

  /* 结果页：分数与徽章缩小，六维条重新分配宽度 */
  .codebar { gap: 10px; }
  .code-badge { width: 40px; height: 47px; font-size: 19px; border-radius: 10px; }
  .metric b { font-size: 36px; }
  .metric span { font-size: 12px; }
  .dimrow { grid-template-columns: 76px 1fr 34px; gap: 8px; }
  .dimrow .nm { font-size: 12px; }
  .typebig b { font-size: 32px; }
  .typebig span { font-size: 15px; }
  .dual { grid-template-columns: 46px 1fr 46px; gap: 6px; font-size: 11.5px; }
  .job { padding: 11px 12px; }
  .job .jn { font-size: 13.5px; }
  .kv { grid-template-columns: 76px 1fr; font-size: 12.5px; }
  .timeline { padding-left: 18px; }
  .tl:before { left: -18px; }

  /* 历史表：手机上改用卡片式堆叠，不横向滚动 */
  table.hist thead { display: none; }
  table.hist, table.hist tbody, table.hist tr, table.hist td { display: block; width: 100%; }
  table.hist tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.hist tr:last-child { border-bottom: 0; }
  table.hist td { border: 0; padding: 1px 0; }
  table.hist td.t { font-size: 11.5px; }
  table.hist td:first-child { font-weight: 600; }
}

@media (max-width: 360px) {
  .opt { font-size: 11px; }
  .brand h1 { font-size: 14px; }
  .topnav button { padding: 8px; font-size: 12px; }
}
