/* ==========================================================================
   玄枢数字观 · H5 手机版样式（叠加在 app.css 之后）
   触发条件：窄屏 或 粗指针（触屏）。功能与 PC 完全一致，只改交互与尺寸。
   ========================================================================== */

/* ---------- 通用：禁双击缩放、禁橡皮筋、字体不放大 ---------- */
html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; }
.m-body, .zhi-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
input, textarea, select { font-size: 16px; }   /* iOS 聚焦不放大 */

@media (max-width: 820px), (pointer: coarse) {

  /* ---------- 顶部 HUD：两行，图标变 44px 触控块 ---------- */
  .hud-top {
    flex-wrap: wrap; gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 0;
  }
  .brand b { font-size: 16px; letter-spacing: .2em; }
  .brand i { display: none; }
  .stats { order: 3; width: 100%; margin-left: 0; gap: 6px; }
  .stat { flex: 1; min-width: 0; padding: 4px 6px; }
  .stat em { font-size: 9.5px; letter-spacing: .1em; }
  .stat b { font-size: 13px; }
  .hud-acts { order: 2; margin-left: auto; gap: 8px; }
  .hud-acts .ico, .ico { width: 44px; height: 44px; font-size: 15px; border-radius: 9px; }
  .net-stat { order: 4; font-size: 10px; }

  /* ---------- 左下角色卡 ---------- */
  .hud-left { left: 14px; bottom: calc(184px + env(safe-area-inset-bottom)); min-width: 0; max-width: 46vw; }
  .who { font-size: 12px; }
  .who i { font-size: 10px; margin-left: 6px; }

  /* ---------- 摇杆 / 动作按钮：拇指区加大 ---------- */
  .joy {
    left: 16px; bottom: calc(22px + env(safe-area-inset-bottom));
    width: 132px; height: 132px;
  }
  .joy i { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
  .acts { right: 12px; bottom: calc(24px + env(safe-area-inset-bottom)); gap: 10px; }
  .btn-round { width: 70px; height: 70px; font-size: 18px; }
  .btn-round.ghost { width: 56px; height: 56px; font-size: 15px; }

  /* ---------- 提示与准心 ---------- */
  .hint {
    font-size: 10px; bottom: calc(4px + env(safe-area-inset-bottom));
    letter-spacing: 0; padding: 0 10px; text-align: center; white-space: normal; line-height: 1.5;
  }
  .crosshair { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
  .prompt { top: auto; bottom: calc(178px + env(safe-area-inset-bottom)); font-size: 14px; padding: 10px 16px; }
  .prompt kbd { width: 26px; height: 26px; line-height: 26px; font-size: 13px; }

  /* ---------- 面板：全屏抽屉，可滑动，关闭按钮加大 ---------- */
  .panel, .modal-panel {
    width: 100%; max-width: 100%;
    height: 100vh; height: 100dvh; max-height: 100dvh;
    border-radius: 0; border-left: 0; border-right: 0;
    display: flex; flex-direction: column;
  }
  .panel:before { inset: 0; border-radius: 0; }
  .panel-head {
    padding: calc(14px + env(safe-area-inset-top)) 60px 10px 18px;
    flex: 0 0 auto;
  }
  .panel-head .t1 { font-size: 18px; letter-spacing: .24em; }
  .panel-head .t2 { font-size: 11px; }
  .panel-head .x {
    width: 40px; height: 40px; right: 10px; top: calc(10px + env(safe-area-inset-top));
    font-size: 15px; border-radius: 50%;
  }
  .m-body {
    flex: 1 1 auto; overflow: auto;
    padding: 14px 18px calc(32px + env(safe-area-inset-bottom));
    font-size: 15px;
  }
  .m-body p { font-size: 15px; line-height: 1.95; }
  .m-body li { font-size: 14.5px; line-height: 1.95; }
  .m-body h4 { font-size: 15px; margin: 18px 0 8px; }
  .grid2 { grid-template-columns: 1fr; }

  /* ---------- 参访志 ---------- */
  .zhi-tabs { gap: 8px; }
  .zhi-tabs button { padding: 11px 18px; font-size: 14px; }
  .zhi-item { padding: 15px 14px; }
  .zhi-item b { font-size: 16px; }
  .zhi-item span { font-size: 12.5px; }
  .zhi-detail p, .zhi-detail li { font-size: 14.5px; line-height: 2; }
  .zhi-bar { gap: 8px; }
  .zhi-bar button { flex: 1; padding: 13px 10px; font-size: 14px; }

  /* ---------- 示范字幕条 ---------- */
  .demo-cap {
    bottom: calc(196px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px); max-width: none;
    padding: 12px 14px; gap: 10px;
  }
  .demo-cap b { font-size: 14px; line-height: 1.6; }
  .demo-cap button { padding: 9px 12px; font-size: 12px; }

  /* ---------- 注册/登录表单：手机上一屏放下，CTA 不用翻找 ---------- */
  .reg-panel { display: flex; flex-direction: column; }
  .reg-body {
    grid-template-columns: 1fr; gap: 10px;
    max-height: none !important; overflow: auto;
    padding: 2px 16px calc(14px + env(safe-area-inset-bottom));
  }
  .reg-left { display: grid; grid-template-columns: 128px 1fr; gap: 8px 10px; align-items: center; }
  .avatar-stage { grid-row: span 3; }
  .avatar-stage canvas { max-height: 150px; width: auto; margin: 0 auto; }
  .stage-tip { font-size: 9px; }
  .row-btns { margin-top: 0; gap: 6px; }
  .chip { min-width: 44px; padding: 9px 10px; font-size: 13px; }
  .field > span { margin-bottom: 5px; font-size: 11.5px; }
  .field input, .field select { padding: 12px; }
  .agree-line { font-size: 12px; line-height: 1.6; margin: 6px 0; }
  .note { font-size: 10.5px; margin: 4px 0 8px; }
  .btn-main { padding: 16px; font-size: 17px; letter-spacing: .2em; }
  .reg-foot { font-size: 10px; margin-top: 6px; }

  /* 顶栏与底部按钮不拦手势（画布以外的部分才可点） */
  #hud { pointer-events: none; }
  #hud .hud-top, #hud .acts, #hud .joy, #hud .hud-left,
  #hud .prompt, #hud .demo-cap { pointer-events: auto; }
}

/* ---------- 横屏（手机横握）：压缩纵向占用 ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .hud-top { padding-top: calc(4px + env(safe-area-inset-top)); flex-wrap: nowrap; }
  .stats { display: none; }
  .brand b { font-size: 14px; }
  .ico { width: 40px; height: 40px; }
  .hud-left { display: none; }
  .joy { width: 104px; height: 104px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .joy i { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .acts { bottom: calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .btn-round { width: 56px; height: 56px; font-size: 16px; }
  .btn-round.ghost { width: 46px; height: 46px; font-size: 13px; }
  .hint { display: none; }
  .prompt { bottom: calc(120px + env(safe-area-inset-bottom)); }
  .demo-cap { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ---------- 矮屏（360×640 一类小屏机）：注册表单再压缩一档 ---------- */
@media (max-height: 700px) {
  .avatar-stage canvas { max-height: 96px; }
  .stage-tip { display: none; }
  .reg-panel .panel-head { padding: 10px 56px 8px 18px; }
  .reg-panel .panel-head .t2 { display: none; }
  .reg-panel .panel-head .t1 { font-size: 16px; }
  .reg-body { gap: 8px; }
  .agree-line { font-size: 11.5px; line-height: 1.5; }
  .chip { padding: 7px 8px; font-size: 12.5px; }
  .field input, .field select { padding: 10px 12px; }
  .field > span { font-size: 11px; margin-bottom: 4px; }
  .note { display: none; }
  .reg-foot { display: none; }
  .btn-main { padding: 13px; font-size: 16px; }
  .hint { font-size: 9.5px; }
}

/* ---------- 横屏手机：注册表单改回两栏，一屏放下 ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .reg-body { grid-template-columns: 116px 1fr !important; gap: 6px 12px; }
  .reg-left { display: block; }
  .avatar-stage { grid-row: auto; }
  .avatar-stage canvas { max-height: 92px; }
  .reg-panel .panel-head { padding: 8px 56px 6px 14px; }
  .reg-panel .panel-head .t1 { font-size: 15px; letter-spacing: .18em; }
  .reg-panel .panel-head .t2 { display: none; }
  .panel-head .x { top: 6px; width: 36px; height: 36px; }
}

/* ---------- 自动讲解条（手机：抬高到摇杆/按钮之上，整条可点） ---------- */
@media (max-width: 820px), (pointer: coarse) {
  .nar { bottom: calc(178px + env(safe-area-inset-bottom)); width: 92vw; max-width: 460px;
          padding: 11px 12px; gap: 10px; }
  .nar-ico { width: 34px; height: 34px; font-size: 14px; }
  .nar-main b { font-size: 15px; }
  .nar-main span { font-size: 11.5px; }
  .nar-btn { min-width: 56px; min-height: 40px; font-size: 13px; }
}
/* 横屏手机：讲解条压到左侧，别和右侧按钮撞 */
@media (orientation: landscape) and (max-height: 560px) {
  .nar { left: 12px; transform: none; bottom: calc(16px + env(safe-area-inset-bottom));
          width: min(360px, 46vw); }
}
