/* Blackwell Modular Stylesheet: modules/handheld.css (merged from 1 files) */

/* --- [CSS MODULE PART] v1016-handheld.css --- */
/* 黑井撤离 v1.0.14 · 手持端 HUD 重做
 *
 * 背景：竖屏 HUD 由 v090/v080i/v102 三套规则叠加而成——顶栏 184×64 只放得下两格、
 * 血条下方留 20px 空黑底，任务/菜单/活动三颗按钮分属三个父级、字号 11/12 不一，
 * 小地图和活动键各自悬在屏幕中段，底部摇杆与动作键高低错落。
 * 横屏则是状态块固定 50px 高、内容只占 33px，血条下面空一条黑；
 * 右上「菜单」13px、「任务」10px。
 *
 * 这里统一按一套设计语言重排：胶囊圆角 12、描边 rgba(125,229,220,.16)、
 * 底 rgba(6,11,16,.82)；标签 10px/字距 .08em、数值 13px/700、按钮 12px/700；
 * 竖屏改为「顶栏三格 → 运行条 → 左小地图 + 右按钮列 → 左下摇杆/能力、右下动作」。
 * 全部用三写类名压过运行时注入的构造样式表（它们排在所有 link 之后）。
 */

/* ============================== 通用胶囊语言 ============================== */
html body.ui-handheld.ui-handheld.ui-handheld .topbar .stat,
html body.ui-handheld.ui-handheld.ui-handheld #runContext080i,
html body.ui-handheld.ui-handheld.ui-handheld #taskToggleBtn,
html body.ui-handheld.ui-handheld.ui-handheld #pauseBtn,
html body.ui-handheld.ui-handheld.ui-handheld #mobileUtilityBtn,
html body.ui-handheld.ui-handheld.ui-handheld #hudActivityBtn {
  border: 1px solid rgba(125, 229, 220, .16);
  border-radius: 12px;
  background: rgba(6, 11, 16, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .32);
}
html body.ui-handheld.ui-handheld.ui-handheld .topbar .label {
  display: block !important;
  font-size: 10px !important;
  line-height: 1 !important;
  letter-spacing: .08em !important;
  color: #8ea6ad !important;
}
html body.ui-handheld.ui-handheld.ui-handheld .topbar .value {
  color: #e8f2f4 !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
}

/* ============================== 竖屏重排 ============================== */
@media (orientation: portrait) {
  /* --- 1) 顶栏：横贯三格（生命 / 平静 / 层级），高度贴合内容 --- */
  html body.ui-handheld.ui-handheld.ui-handheld .topbar {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    width: auto !important;
    top: max(6px, env(safe-area-inset-top)) !important;
    height: 52px !important;
    grid-template-columns: 1.25fr 1fr 1fr !important;
    gap: 6px !important;
    align-items: stretch !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .stat {
    height: 52px !important;
    min-height: 0 !important;
    padding: 6px 8px 5px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    border-radius: 12px !important;
  }
  /* 背包格在这一行放不下，数值并入运行条 */
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .stat:nth-child(2) { display: none !important; }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value {
    font-size: 13px !important;
    gap: 0 5px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: baseline !important;
    min-width: 0 !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value > * {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value #levelText {
    flex: 1 0 100% !important;
    font-size: 9.5px !important;
    font-weight: 600 !important;
    opacity: .78;
    line-height: 1.1 !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .bar {
    height: 3px !important;
    margin: 0 !important;
    border-radius: 2px !important;
  }

  /* --- 2) 运行条：顶栏下方一条，只留当前层 / 压力 / 规则 --- */
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    width: auto !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 58px) !important;
    height: 30px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 0 10px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-brand-080i,
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .cargo-slot-080i2,
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .event-slot-080i {
    display: none !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i {
    display: flex !important;
    align-items: baseline !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
  }
  /* 单类会被上一条 display:flex 以「同权重后写」反超，这里先全部收起再按需放回 */
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i {
    display: none !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i > .run-context-item-080i:nth-child(2),
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i > .run-context-item-080i.event-slot-080i {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    height: 30px !important;
    gap: 6px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i > .run-context-item-080i:nth-child(2) { flex: 1 1 auto !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i > .run-context-item-080i.event-slot-080i { flex: 0 1 45% !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i > b,
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i > span {
    line-height: 1 !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i > span {
    color: #7f979d !important;
    font-size: 9px !important;
    letter-spacing: .06em;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i > b {
    font-size: 11px !important;
    color: #dfeef0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i .run-context-item-080i > small {
    display: none !important;
  }

  /* --- 3) 左上小地图（运行条下方） --- */
  html body.ui-handheld.ui-handheld.ui-handheld #fogMinimapV0130 {
    left: max(8px, env(safe-area-inset-left)) !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 96px) !important;
    width: 84px !important;
    height: 84px !important;
    border-radius: 12px !important;
    border-color: rgba(125, 229, 220, .18) !important;
    opacity: .9 !important;
  }

  /* --- 4) 右上按钮列：任务 / 菜单 / 活动，同尺寸同字号 --- */
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions {
    left: auto !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 96px) !important;
    width: 76px !important;
    display: block !important;
    pointer-events: none !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions button { display: none !important; }
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions #taskToggleBtn,
  html body.ui-handheld.ui-handheld.ui-handheld #mobileUtilityBtn,
  html body.ui-handheld.ui-handheld.ui-handheld #hudActivityBtn {
    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;
    letter-spacing: .04em;
    color: #cfe6e6 !important;
    pointer-events: auto !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions #taskToggleBtn { top: calc(max(6px, env(safe-area-inset-top)) + 90px) !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #mobileUtilityBtn { top: calc(max(6px, env(safe-area-inset-top)) + 142px) !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #hudActivityBtn { top: calc(max(6px, env(safe-area-inset-top)) + 188px) !important; }

  /* --- 5) 底部：左下摇杆 + 能力（竖排），右下动作键（横排） + 冲刺 --- */
  html body.ui-handheld.ui-handheld.ui-handheld #stick {
    left: max(14px, env(safe-area-inset-left)) !important;
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    width: 100px !important;
    height: 100px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #abilityMobile {
    left: max(22px, env(safe-area-inset-left)) !important;
    right: auto !important;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 112px) !important;
    width: 84px !important;
    height: 48px !important;
    font-size: 12px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #actionButton {
    right: max(118px, calc(env(safe-area-inset-right) + 118px)) !important;
    left: auto !important;
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    width: 96px !important;
    height: 76px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #mineButton {
    right: max(12px, env(safe-area-inset-right)) !important;
    left: auto !important;
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    width: 100px !important;
    height: 76px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #v0130ActionGroup {
    right: max(12px, env(safe-area-inset-right)) !important;
    left: auto !important;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 112px) !important;
    top: auto !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #actionButton span,
  html body.ui-handheld.ui-handheld.ui-handheld #mineButton span { font-size: 14px !important; }
  html body.ui-handheld.ui-handheld.ui-handheld #actionButton small,
  html body.ui-handheld.ui-handheld.ui-handheld #mineButton small { font-size: 9px !important; opacity: .72; }

  /* 教程卡原 top:78 会压住运行条（58~88），下移到运行条下方，并盖住小地图 */
  html body.ui-handheld.ui-handheld.ui-handheld #tutorialPanelV0682 {
    top: calc(max(6px, env(safe-area-inset-top)) + 94px) !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    width: calc(100vw - 108px) !important;
    max-height: 150px !important;
    z-index: 45 !important;
    border-radius: 14px !important;
  }

  /* --- 6) 任务面板：展开时接管运行条位置，收起键独占一行 --- */
  html body.ui-handheld.ui-handheld.ui-handheld #objective {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    width: auto !important;
    top: calc(max(6px, env(safe-area-inset-top)) + 94px) !important;
    max-height: calc(100dvh - 222px) !important;
    border-radius: 14px !important;
  }
  /* 展开任务时运行条与右列让位，避免压住面板文字 */
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #runContext080i,
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #fogMinimapV0130,
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #mobileUtilityBtn,
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #hudActivityBtn,
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #dailyPvpBtn {
    display: none !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld.tasks-user-open #taskToggleBtn {
    top: calc(max(6px, env(safe-area-inset-top)) + 52px) !important;
    width: 96px !important;
  }
}

/* ============================== 横屏收口 ============================== */
@media (orientation: landscape) {
  /* 状态块贴合内容：原来固定 50px，数值+血条只占 33px，下面留一条空黑 */
  html body.ui-handheld.ui-handheld.ui-handheld .topbar {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: auto !important;
    width: min(430px, 51vw) !important;
    grid-template-columns: 1.35fr 1fr 1fr !important;
    gap: 6px !important;
    height: auto !important;
    align-items: start !important;
  }
  /* 第 2 格（背包）在横屏放不下，负重信息在背包面板里；第 4 格（经验）保留 */
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .stat:nth-child(2) { display: none !important; }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .stat {
    height: 48px !important;
    min-height: 0 !important;
    padding: 5px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    border-radius: 12px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value {
    font-size: 12.5px !important;
    line-height: 1.12 !important;
    flex-wrap: wrap !important;
    gap: 0 5px !important;
    min-width: 0 !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value > * {
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .value #levelText {
    flex: 1 0 100% !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    opacity: .78;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .topbar .bar {
    height: 3px !important;
    margin: 0 !important;
    border-radius: 2px !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #runContext080i {
    height: 48px !important;
    top: max(7px, env(safe-area-inset-top)) !important;
    left: calc(max(8px, env(safe-area-inset-left)) + min(430px, 51vw) + 8px) !important;
    width: min(272px, 31vw) !important;
    border-radius: 12px !important;
    font-size: 10.5px !important;
  }
  /* 右上两颗按钮统一 72×40 / 12px */
  html body.ui-handheld.ui-handheld.ui-handheld #mobileUtilityBtn,
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions #taskToggleBtn {
    width: 72px !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;
  }
  html body.ui-handheld.ui-handheld.ui-handheld .right-actions #taskToggleBtn {
    top: calc(max(7px, env(safe-area-inset-top)) + 46px) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
  }
  /* 活动键与小地图左列对齐，别悬在屏幕中段 */
  html body.ui-handheld.ui-handheld.ui-handheld #hudActivityBtn {
    left: max(8px, env(safe-area-inset-left)) !important;
    top: calc(max(7px, env(safe-area-inset-top)) + 96px) !important;
    width: 84px !important;
    height: 40px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }
  html body.ui-handheld.ui-handheld.ui-handheld #fogMinimapV0130 {
    top: calc(max(7px, env(safe-area-inset-top)) + 142px) !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    width: 84px !important;
    height: 84px !important;
    border-radius: 12px !important;
  }
}
