/* =========================================================================
   手机端 App 壳层 v5 —— 让 APK 看起来是"App"，不是"把网页塞进 WebView"
   -------------------------------------------------------------------------
   这一层做的事：
     1) 附件大图标面板（微信-style 底部网格），代替网页式小弹窗
     2) 表情键恢复（之前被我 hide 掉了）
     3) 设置/个人资料 改成整屏页面（顶部导航栏 + 返回），不是小弹窗
     4) 长按菜单：禁掉系统长按选词，保证长按稳定弹出动作表
     5) 列表分组：灰色分区隔断 + 分区标题（系统设置那种）
     6) 导航栏加毛玻璃与发丝线，Tab 栏加按压反馈
   ========================================================================= */

@media (max-width: 860px) {

  /* ---------- 1) 长按不被系统选词抢走 ---------- */
  #msgList, .msg-row, .bubble, .img-single, .album, .file-card, .msg-col {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
  }
  .ocr-out, .field input, .field textarea, #input, textarea {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
  }

  /* ---------- 2) 表情键恢复 ---------- */
  .composer .emoji-btn {
    display: grid !important;
    order: 3;
  }
  .composer-row { align-items: flex-end; }

  /* ---------- 3) 附件大图标面板 ---------- */
  .attach-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .38);
    z-index: 160;
    animation: fadeIn .18s ease;
  }
  @keyframes fadeIn { from { opacity: 0; } }

  .attach-sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 161;
    background: var(--n-bg, #fff);
    border-radius: 20px 20px 0 0;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.22, .8, .3, 1);
    box-shadow: 0 -14px 40px -20px rgba(0, 0, 0, .4);
  }
  .attach-sheet.in { transform: translateY(0); }
  .attach-grabber {
    width: 36px; height: 5px; border-radius: 3px;
    background: var(--n-sep-strong, rgba(60,60,67,.3));
    margin: 2px auto 14px;
  }
  .attach-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 12px;
  }
  .attach-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 12px 4px;
    background: var(--n-bg-grouped, #f2f2f7);
    border: none; border-radius: 14px;
    color: var(--n-label, #111);
    font-family: var(--font-sans);
  }
  .attach-tile:active { background: var(--n-fill-2, #e9e9ee); transform: scale(.97); }
  .attach-ico {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center;
    background: var(--n-tint, #2f7df6);
    color: #fff;
  }
  .attach-ico svg { width: 24px; height: 24px; }
  .attach-label { font-size: 12.5px; font-weight: 500; }
  .attach-cancel {
    width: 100%; padding: 13px;
    background: var(--n-bg-grouped, #f2f2f7);
    border: none; border-radius: 12px;
    font-size: 16px; font-weight: 600; color: var(--n-tint, #2f7df6);
    font-family: var(--font-sans);
  }
  .attach-cancel:active { background: var(--n-fill-2, #e9e9ee); }

  /* ---------- 4) 设置/资料 → 整屏页面 ---------- */
  .modal.screen {
    inset: 0 !important;
    width: 100vw !important; max-width: 100vw !important;
    height: 100dvh !important; max-height: 100dvh !important;
    border-radius: 0 !important;
    animation: screenIn .24s cubic-bezier(.22, .8, .3, 1);
    overflow: hidden;
    padding-bottom: 0;
    display: flex; flex-direction: column;
  }
  .modal.screen::before { display: none !important; }
  @keyframes screenIn { from { transform: translateX(14px); opacity: .6; } }

  .modal.screen .modal-head {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
    min-height: 46px;
    display: flex; align-items: center;
    background: var(--n-bg) !important;
    border-bottom: 1px solid var(--n-sep);
  }
  .modal.screen .modal-head h3 { font-size: 17px; font-weight: 600; text-align: center; }
  .modal.screen .modal-head .icon-btn { color: var(--n-tint); width: 40px; height: 40px; }
  .modal.screen .modal-body {
    flex: 1 1 auto; overflow-y: auto;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }
  .modal.screen .modal-foot {
    position: sticky; bottom: 0;
    background: var(--n-bg) !important;
    border-top: 1px solid var(--n-sep);
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .modal-host.screen-mode { align-items: stretch; }

  /* ---------- 5) 列表分组：灰色隔断 + 分区标题 ---------- */
  .list-scroll .group-gap {
    height: 10px;
    background: var(--n-bg-grouped, #f2f2f7);
    margin: 0 -12px;
  }
  .list-scroll .section-label {
    background: var(--n-bg-grouped, #f2f2f7);
    margin: 0 -12px;
    padding: 12px 28px 6px;
    font-size: 12.5px; font-weight: 600; color: var(--n-label-2, #6b6b70);
    letter-spacing: .02em;
  }

  /* ---------- 6) 导航栏/Tab 细节 ---------- */
  .list-head {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }
  [data-theme="dark"] .list-head { background: rgba(0, 0, 0, .72); }
  .chat-head {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }
  [data-theme="dark"] .chat-head { background: rgba(0, 0, 0, .74); }

  .rail-btn:active .tab-label { opacity: .5; }
  .rail-btn.active::before {
    content: "";
    position: absolute; top: 0; left: 50%;
    width: 26px; height: 2px; margin-left: -13px;
    background: var(--n-tint);
    border-radius: 0 0 2px 2px;
  }

  /* 搜索框按压反馈 */
  .list-item:active { background: var(--n-fill) !important; }
  /* 输入栏聚焦时蓝色描边 */
  .composer textarea:focus { border-color: var(--n-tint) !important; background: var(--n-bg) !important; }
}

/* ===== 更新弹层 ===== */
.update-wrap { display: flex; flex-direction: column; gap: 16px; }
.update-body { display: flex; flex-direction: column; gap: 12px; }
.update-ver {
  font-size: 15px; font-weight: 600; color: var(--accent, #2f7df6);
  letter-spacing: .01em;
}
.update-notes {
  margin: 0; padding-left: 18px;
  font-size: 14px; line-height: 1.85; color: var(--txt-2, #5b6b80);
}
.update-notes li { margin-bottom: 4px; }
.update-hint { font-size: 12.5px; color: var(--txt-3, #98a2b0); line-height: 1.6; }
.update-actions { display: flex; gap: 10px; }
.update-actions .btn { flex: 1; }
.update-actions .btn.primary[disabled] { opacity: .6; }
