/* 洗家村 · UI 修正（横屏/竖屏通用）
   1) 弹窗内容区必须能被压缩并可滚动，否则内容会把底部按钮顶出屏幕，
      既看不见也点不到（设置里的「保存名字」「绑个账号」、排行榜、图鉴都中招）。
   2) 聊天坞只是底部一条，别让它的透明区域挡住右下技能键。
   3) 「输入框 + 按钮」并排的行使：游戏给 .acc-btn 定了 width:100%，
      并排时会把输入框挤成一条缝（设置 → 找回存档 就是这么崩的）。
   4) 存档码浮层：内容比屏幕高时要从上往下排，整层能滚到底。 */

.modal,
.modal-wide,
.modal-chat {
  max-height: calc(var(--app-h, 100vh) - 16px) !important;
  max-width: calc(var(--app-w, 100vw) - 16px) !important;
  overflow: hidden !important;
}
.modal-mask {
  overflow: hidden !important;
  padding: 8px !important;
}
.modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
/* 列表撑不住的时候也要能滚 */
.rank-list,
.track-list,
.bag-main,
.armor-group {
  min-height: 0;
}
/* 聊天坞：缩到不碰右下技能区，并且只在自己身上吃点击 */
.chat-dock {
  z-index: 4 !important;
}

/* 竖屏（物理竖着）时聊天坞会压在右下「拳」键上，导致点了没反应：靠左让开 */
@media (orientation: portrait) {
  .chat-dock {
    left: 10px !important;
    right: auto !important;
    transform: none !important;
    max-width: 46% !important;
  }
  .chat-dock:active {
    transform: scale(.97) !important;
  }
}

/* ---- 并排行里的按钮别抢满宽度 ---- */
.modal-body [style*="display:flex"] > .acc-btn,
.modal-body [style*="display: flex"] > .acc-btn {
  width: auto !important;
  min-width: 84px;
  flex: 0 0 auto !important;
}
.modal-body [style*="display:flex"] > input,
.modal-body [style*="display: flex"] > input {
  min-width: 90px;
}
.modal-body input {
  min-width: 0;
}

/* ---- 存档码浮层：整层滚动，横屏也能滚到底 ---- */
#xjc-layer > div[style*="position:absolute"] {
  align-items: flex-start !important;
}
#xjc-layer > div[style*="position:absolute"] > div {
  margin: auto 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

/* ---- 矮屏（横屏手机）压缩一下留白，少滚一点 ---- */
@media (max-height: 400px) {
  .modal-body {
    padding: 8px 12px 12px !important;
  }
  .modal-body .set-h {
    margin: 10px 0 4px !important;
  }
}
