/* Blackwell Modular Stylesheet: modules/multiplayer.css (merged from 2 files) */

/* --- [CSS MODULE PART] v1017-coop.css --- */
/* 黑井撤离 v1.0.15 · 联机通讯与房间 UI
 *
 * 反馈：局内队伍通讯是一块常驻大面板，横屏压掉三分之一画面，手机竖屏直接盖满；
 * 结算页/大厅里它还浮在上面；点发送提示未发出。
 * 这里把它改成「一条胶囊按钮 + 展开面板」，并且只在对局进行中出现。
 */

/* ============ 1) 默认折叠：只留一个 40px 的入口 ============ */
#teamChat {
  left: max(12px, env(safe-area-inset-left)) !important;
  bottom: max(140px, calc(env(safe-area-inset-bottom) + 132px)) !important;
  width: min(300px, calc(100vw - 24px)) !important;
  z-index: 18;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#teamChat .chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  align-self: flex-start;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(125, 229, 220, .24);
  background: rgba(6, 12, 18, .86);
  color: #cfe6e6;
  font: 700 12px/1 inherit;
  letter-spacing: .04em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .32);
}
#teamChat .chat-toggle::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: #7fe6d6;
  box-shadow: 0 0 8px rgba(127, 230, 214, .8);
}
#teamChat .chat-toggle:active { transform: scale(.97); }

/* 收起态：面板、标记条、输入框全隐藏 */
#teamChat:not(.chat-expanded) .team-chat-log,
#teamChat:not(.chat-expanded) .team-chat-state,
#teamChat:not(.chat-expanded) form,
#teamChat:not(.chat-expanded) .team-marker-bar { display: none !important; }

/* 展开态：限制高度，避免又是一整块糊在画面上 */
#teamChat.chat-expanded {
  width: min(340px, calc(100vw - 24px)) !important;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(125, 229, 220, .18);
  background: rgba(5, 10, 15, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#teamChat.chat-expanded .team-chat-log {
  max-height: min(180px, 26dvh) !important;
  margin-bottom: 6px;
  background: rgba(3, 7, 11, .7);
  border-radius: 10px;
  border-color: rgba(125, 229, 220, .12);
}
#teamChat.chat-expanded .team-chat-state { display: none !important; }
#teamChat.chat-expanded .team-marker-bar {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  max-height: 96px;
  overflow-y: auto;
}
#teamChat.chat-expanded .team-marker-bar button {
  min-height: 28px;
  padding: 2px 4px;
  font-size: 10.5px;
  border-radius: 8px;
}
#teamChat.chat-expanded form { gap: 5px; }
#teamChat.chat-expanded input { min-height: 34px; font-size: 12.5px; padding: 6px 9px; }
#teamChat.chat-expanded form button { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }

/* ============ 2) 只在对局里出现 ============ */
/* 大厅：游戏主菜单打开时 */
html body.in-main-menu > #teamChat { display: none !important; }
/* 结算/背包/活动等任何弹层打开时（房间大厅里的嵌配套餐不受影响，它在 overlay 内部） */
html body.modal-open-080f > #teamChat { display: none !important; }
/* 单人房间（非今日异常）没有队友，没必要占位；今日异常保留局内通讯 */
html body.solo-room:not(.daily-room-active) > #teamChat { display: none !important; }

/* ============ 3) 手机端：贴底一条，别盖住摇杆 ============ */
@media (orientation: portrait) {
  html body.ui-handheld #teamChat {
    left: max(10px, env(safe-area-inset-left)) !important;
    bottom: auto !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 240px) !important;
    width: auto !important;
    max-width: calc(100vw - 110px);
  }
  html body.ui-handheld #teamChat.chat-expanded {
    width: calc(100vw - 20px) !important;
    max-width: none;
    left: max(10px, env(safe-area-inset-left)) !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 96px) !important;
    max-height: 60dvh;
    overflow-y: auto;
  }
  html body.ui-handheld #teamChat.chat-expanded .team-chat-log { max-height: 160px !important; }
}

/* ============ 4) 房间大厅里的嵌配套餐：保持铺满挂载区 ============ */
.coop-chat-mount-v090 .team-chat {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  display: flex !important;
  flex-direction: column;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  backdrop-filter: none !important;
}
.coop-chat-mount-v090 .team-chat .chat-toggle { display: none !important; }
.coop-chat-mount-v090 .team-chat .team-chat-log,
.coop-chat-mount-v090 .team-chat .team-chat-state,
.coop-chat-mount-v090 .team-chat form,
.coop-chat-mount-v090 .team-chat .team-marker-bar { display: flex !important; }
.coop-chat-mount-v090 .team-chat form,
.coop-chat-mount-v090 .team-chat .team-chat-state { display: flex !important; }
.coop-chat-mount-v090 .team-chat .team-marker-bar { display: grid !important; }

/* ============ 5) 加入房间弹层：角色卡按钮不再压住内容 ============ */
/* 反馈：加入联合下井房间时，卡片上的「选择角色 / 查看详情」浮在文字上，两张卡叠在一起 */
#coopOverlay .deployment-loadout-grid,
#coopOverlay .loadout-grid { align-items: start !important; }
#coopOverlay .loadout-card > .loadout-actions,
#coopOverlay .loadout-card .deployment-card-actions {
  position: static !important;
  display: flex !important;
  gap: 6px !important;
  margin-top: 10px !important;
}
#coopOverlay .loadout-card {
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

/* ============ 6) 旧版菜单右上角快捷入口（手机端） ============ */
.handheld-quick-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: none;
  gap: 6px;
}
body.ui-handheld .handheld-quick-actions,
body.force-handheld-081 .handheld-quick-actions { display: flex; }
.handheld-quick-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(125, 229, 220, .28);
  background: rgba(6, 12, 18, .88);
  color: #cfe6e6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.handheld-quick-actions button:active { transform: scale(.96); }
@media (max-width: 480px) {
  .handheld-quick-actions { top: 8px; right: 8px; gap: 4px; }
  .handheld-quick-actions button { min-height: 30px; padding: 0 9px; font-size: 11px; }
}

/* ============ 7) 出击准备 / 加入房间：卡片不再被 62dvh 裁成半截 ============ */
/* 反馈：加入房间的角色选择里，底部一排卡片只露半个按钮，看着像两张卡叠在一起。
   根因是 #loadoutGrid 被限制成 max-height:62dvh 并自带滚动条，
   内容比容器高（桌面 666>558、手机 1077>523）就被硬裁。
   改成网格不限高、由弹层自身滚动，一屏看不完时整体滚。 */
#deploymentOverlay > .panel {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;   /* 改由卡片区滚动，头尾固定 */
  overscroll-behavior: contain;
}
#deploymentOverlay > .panel #loadoutGrid,
#deploymentOverlay .deployment-loadout-grid {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
/* 底栏不再 sticky 覆盖卡片，直接贴在弹层底部 */
#deploymentOverlay .deployment-footer {
  position: static !important;
  background: none !important;
  margin-top: 10px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(140, 190, 194, .14);
}
/* 弹层打开时整层收起 HUD。
   注意：活动键/任务键被 `html body.ui-handheld.ui-handheld.ui-handheld ...` 三连类名的
   !important 规则撑着，单层 :has() 权重不够，这里用双 :has() 压过它。 */
html body:has(#deploymentOverlay:not(.hidden)):has(#deploymentOverlay:not(.hidden)) .hud {
  display: none !important;
}
/* 活动键挂在 #app 下、不在 .hud 里，必须单独点掉 */
html body:has(#deploymentOverlay:not(.hidden)):has(#deploymentOverlay:not(.hidden)) #hudActivityBtn,
html body:has(#deploymentOverlay:not(.hidden)):has(#deploymentOverlay:not(.hidden)) #teamChat {
  display: none !important;
}
/* 卡片保持自身内容高度：改成 flex 会把内容顶出卡片、行与行互相压住 */
/* 卡片原本被一条老规则设成 display:flex（默认横排），内容被挤成一团、溢出到下一张卡。
   改回块级流式布局，高度由内容决定。 */
#deploymentOverlay .loadout-card {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  align-self: start !important;   /* 不被网格强行拉成同一行高，高度跟着内容走 */
}

/* 窄屏（手机竖屏）用纵向 flex 排列：网格轨道在部分手持机型上会把行高算小，
   卡片内容就会溢出到下一张卡上。flex 纵向排列由内容决定高度，不会重叠。 */
@media (max-width: 560px) {
  #deploymentOverlay #loadoutGrid,
  #deploymentOverlay .deployment-loadout-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  #deploymentOverlay #loadoutGrid .loadout-card {
    width: 100% !important;
    flex: 0 0 auto !important;
  }
}

/* ============ 8) 遗落背包自选面板 ============ */
.bag-chooser-v1022 .panel { width: min(420px, 92vw); }
.bag-chooser-grid-v1022 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 6px;
}
.bag-chooser-grid-v1022 > div {
  padding: 10px 12px;
  border: 1px solid rgba(140, 190, 194, .16);
  border-radius: 12px;
  background: rgba(8, 14, 19, .6);
  display: grid;
  gap: 2px;
}
.bag-chooser-grid-v1022 small { font-size: 11px; color: #7f979d; }
.bag-chooser-grid-v1022 b { font-size: 20px; color: #dfeef0; }
.bag-chooser-grid-v1022 span { font-size: 11px; color: #8ea6ad; }
.bag-chooser-grid-v1022 i { font-style: normal; color: #cfd8dc; }
.bag-chooser-hint-v1022 { font-size: 11px; color: #7f979d; margin: 10px 0 0; line-height: 1.5; }
body.ui-handheld .bag-chooser-v1022 .panel { width: min(360px, 94vw); padding: 16px; }
body.ui-handheld .bag-chooser-grid-v1022 b { font-size: 17px; }
/* 自选面板打开时也收起局内悬浮键，避免「活动」压在面板边上 */
html body:has(#bagChooserV1022:not(.hidden)):has(#bagChooserV1022:not(.hidden)) #hudActivityBtn,
html body:has(#bagChooserV1022:not(.hidden)):has(#bagChooserV1022:not(.hidden)) #teamChat {
  display: none !important;
}

/* ============ 9) 遗落背包逐件挑选（v1.0.17） ============ */
/* 统计格复用 .bag-chooser-grid-v1022；已勾选格超重时整格变红警示 */
.bag-chooser-grid-v1022 > div.overweight {
  border-color: rgba(231, 125, 98, .55);
  background: rgba(46, 14, 10, .6);
}
.bag-chooser-grid-v1022 > div.overweight b { color: #ff9d84; }
.bag-chooser-items-v1022 {
  margin: 10px 0 4px;
  max-height: 30dvh;
  overflow-y: auto;
  border: 1px solid rgba(140, 190, 194, .16);
  border-radius: 12px;
  background: rgba(8, 14, 19, .45);
}
.bag-chooser-item-v1022 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(140, 190, 194, .08);
  user-select: none;
}
.bag-chooser-item-v1022:last-child { border-bottom: none; }
.bag-chooser-item-v1022:hover { background: rgba(140, 190, 194, .08); }
.bag-chooser-item-v1022.checked { background: rgba(112, 240, 225, .1); }
.bag-chooser-item-v1022 input[type="checkbox"] { pointer-events: none; accent-color: #70f0e1; }
.bag-chooser-item-v1022 b { font-size: 14px; min-width: 44px; }
.bag-chooser-item-v1022 span { font-size: 12px; color: #dfeef0; }
.bag-chooser-item-v1022 small { margin-left: auto; font-size: 11px; color: #8ea6ad; }
.bag-chooser-empty-v1022 { padding: 14px 12px; font-size: 12px; color: #7f979d; text-align: center; }
.bag-chooser-quick-v1022 { display: flex; gap: 8px; margin: 6px 0 10px; }
.bag-chooser-quick-v1022 button { flex: 1; font-size: 12px; padding: 7px 8px; }
body.ui-handheld .bag-chooser-items-v1022 { max-height: 26dvh; }
body.ui-handheld .bag-chooser-item-v1022 { padding: 8px 10px; }
/* 贵重品段：金色系提示头 + 行样式（不占负重，勾选即拿走） */
.bag-chooser-valhead-v1022 {
  padding: 6px 12px;
  font-size: 11px;
  color: #ffd77d;
  background: rgba(255, 215, 125, .07);
  border-bottom: 1px solid rgba(255, 215, 125, .14);
}
.bag-chooser-valuable-v1022.checked { background: rgba(255, 215, 125, .12); }
.bag-chooser-valuable-v1022 input[type="checkbox"] { accent-color: #ffd77d; }
/* 撤离横幅会压住面板标题：自选面板打开时临时收起，关面板自动恢复 */
html body:has(#bagChooserV1022:not(.hidden)):has(#bagChooserV1022:not(.hidden)) #extractionHud0822 {
  display: none !important;
}

/* --- [CSS MODULE PART] v1020-pvp.css --- */
/* 黑井撤离 v1.0.16 · 今日异常玩家伤害开关
 * 默认关闭；开启后本人冒红光、可打中其他玩家。只影响今日异常，联机模式不出现该按钮。
 */

#dailyPvpBtn {
  min-width: 88px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(144, 177, 197, .26);
  background: rgba(10, 18, 24, .86);
  color: #c9dbe0;
  font: 700 13px/1.2 system-ui, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}
#dailyPvpBtn:hover { border-color: rgba(255, 120, 136, .5); color: #ffd9de; }
#dailyPvpBtn.on {
  border-color: rgba(255, 77, 94, .78);
  background: rgba(60, 12, 20, .9);
  color: #ffd7dc;
  box-shadow: 0 0 0 1px rgba(255, 77, 94, .28), 0 0 18px rgba(255, 77, 94, .35);
}
#dailyPvpBtn.nearby:not(.on) {
  animation: dailyPvpPulse 1.8s ease-in-out infinite;
  border-color: rgba(255, 150, 120, .55);
}
@keyframes dailyPvpPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 120, 136, 0); }
  50% { box-shadow: 0 0 14px rgba(255, 120, 136, .4); }
}
#dailyPvpBtn.hidden { display: none !important; }

/* 确认弹层：只在开启前询问，不遮挡太久 */
#dailyPvpConfirm {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 7, 11, .78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#dailyPvpConfirm.hidden { display: none !important; }
#dailyPvpConfirm .pvp-card {
  width: min(420px, 100%);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 120, 136, .36);
  background: rgba(12, 10, 14, .97);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
  color: #e8eef0;
  font: 400 14px/1.6 system-ui, sans-serif;
}
#dailyPvpConfirm .pvp-eyebrow {
  font-size: 11px;
  letter-spacing: .16em;
  font-weight: 700;
  color: #ff8d9c;
}
#dailyPvpConfirm h3 { margin: 6px 0 8px; font-size: 18px; font-weight: 800; color: #fff; }
#dailyPvpConfirm p { margin: 0 0 14px; color: #b9c8cc; }
#dailyPvpConfirm .pvp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#dailyPvpConfirm button {
  flex: 1 1 130px;
  min-height: 40px;
  border-radius: 10px;
  font: 700 13px system-ui, sans-serif;
  cursor: pointer;
}
#dailyPvpConfirm #dailyPvpAccept {
  border: 1px solid rgba(255, 77, 94, .62);
  background: rgba(86, 16, 26, .92);
  color: #ffdde1;
}
#dailyPvpConfirm #dailyPvpCancel {
  border: 1px solid rgba(150, 172, 182, .26);
  background: rgba(16, 22, 28, .9);
  color: #9fb4ba;
}

/* 手持端：塞进右上按钮列，竖屏在活动键下方，横屏在菜单键下方 */
@media (max-width: 900px) {
  html body.ui-handheld.ui-handheld.ui-handheld #dailyPvpBtn,
  html body.force-handheld-081.force-handheld-081 #dailyPvpBtn {
    position: fixed !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    left: auto !important;
    width: 76px !important;
    height: 40px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    z-index: 63 !important;
    pointer-events: auto !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #dailyPvpBtn { top: calc(max(6px, env(safe-area-inset-top)) + 234px) !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #dailyPvpBtn.hidden { display: none !important; }
}
@media (max-width: 900px) and (orientation: landscape) {
  html body.ui-handheld.ui-handheld.ui-handheld #dailyPvpBtn { top: calc(max(7px, env(safe-area-inset-top)) + 192px) !important; }
}

/* 开启期间屏幕四周一圈很淡的红晕：不用盯着角色也能知道自己是敌对状态 */
body.daily-pvp-on::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  box-shadow: inset 0 0 120px rgba(255, 56, 78, .20), inset 0 0 24px rgba(255, 56, 78, .12);
}
