/**
 * 移动端适配：仅 max-width <= 1023px 生效，桌面端布局不变。
 * 覆盖 min-width:1000/1400px 等固定宽度，避免横向溢出。
 */

@media screen and (max-width: 1023px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html,
  body,
  #app {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* ---------- 布局壳层（layout） ---------- */
  .header,
  .pages,
  .content,
  #statement {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .header {
    height: auto !important;
    min-height: 56px;
    padding: 8px 12px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    flex-wrap: wrap;
    justify-content: center !important;
  }

  .header .header-inner {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between !important;
  }

  .header .header-inner img {
    height: 40px !important;
    max-height: 48px;
  }

  .header .header-inner .el-carousel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 56px !important;
    flex: 1 1 100%;
    order: 3;
  }

  .header .header-inner .header-btn-row {
    width: auto !important;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .header .header-inner .header-btn-row .header-btn {
    width: auto !important;
    min-width: 64px;
    padding: 0 8px;
    margin-right: 4px;
    height: 32px;
  }

  .header .header-inner .header-btn-row .header-btn b {
    font-size: 12px !important;
  }

  .content {
    padding-top: 72px;
    box-sizing: border-box;
  }

  /* 导航标签、面包屑、跑马灯、搜索条 */
  .search-tag,
  [class*="breadcrumb-container"],
  [class*="scrolling-text-wrap"],
  .search-box,
  [class*="search-box"] {
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .search-tag {
    margin-top: 12px !important;
  }

  .search-tag .tag {
    width: calc(33.333% - 12px) !important;
    min-width: 0 !important;
    margin-left: 6px !important;
    margin-right: 0 !important;
    font-size: 12px;
  }

  .search-tag .tag small {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .search-box,
  [class*="search-box"] {
    height: auto !important;
    min-height: 56px;
    padding: 6px 0;
  }

  .search-box .search-boxInner,
  [class*="search-box"] [class*="search-boxInner"] {
    flex-wrap: wrap;
    min-height: 48px;
  }

  .search-box .search-boxInner .search-btn,
  [class*="search-box"] .search-btn {
    width: auto !important;
    min-width: 72px;
    margin-left: 8px !important;
    font-size: 14px !important;
    letter-spacing: 1px !important;
  }

  .option-row {
    margin-top: 24px !important;
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
  }

  /* ---------- 首页（与 home-3f5b8859.css 末尾 @media 一致；!important 对抗 chunk 后加载） ---------- */
  .home-body {
    height: auto !important;
    min-height: 100dvh !important;
    justify-content: flex-start !important;
    align-content: flex-start !important;
    overflow-x: hidden !important;
    background-attachment: scroll !important;
    padding: max(12px, env(safe-area-inset-top)) 0 max(20px, env(safe-area-inset-bottom)) !important;
    box-sizing: border-box;
  }

  .home-body .inputBox:empty {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .home-body .inputBox:not(:empty) {
    width: calc(100% - 32px) !important;
    max-width: 735px;
    margin-top: 12px !important;
    height: auto !important;
    min-height: 56px;
  }

  .home-body .inputBox .search-container {
    padding: 0 8px !important;
    flex-wrap: wrap;
  }

  .home-body .inputBox .search-container .search-icon {
    left: 16px !important;
    top: 18px !important;
  }

  .home-body .inputBox .search-container .search-input {
    font-size: 15px;
    padding: 0 44px 0 36px;
  }

  .home-body .inputBox .search-container .search-button {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    flex-shrink: 0;
  }

  .home-body .inputBox .search-container .dropdown-btn {
    position: relative !important;
    right: auto !important;
  }

  .home-body .inputBox .search-container .input-other {
    position: relative !important;
    margin-top: 8px !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
  }

  .home-body .inputBox .search-container .input-other .search-group .group-content {
    grid-template-columns: 1fr !important;
  }

  .home-body .inputBox .search-container .el-button,
  .home-body .inputBox .search-container .el-button.is-round {
    width: 88px !important;
    height: 36px !important;
  }

  .home-body .chapter-box {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 12px 28px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-top: 0 !important;
    gap: 4px;
    box-sizing: border-box;
  }

  .home-body .chapter-box .chapter-box-left,
  .home-body .chapter-box .chapter-box-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    display: block !important;
  }

  .home-body .chapter-box .chapter-item {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 28px !important;
    box-sizing: border-box;
  }

  .home-body .chapter-box .chapter-item .chapter-item-title {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    box-sizing: border-box;
  }

  .home-body .chapter-box .chapter-item .chapter-item-title > span:first-child {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .home-body .chapter-box .chapter-item .chapter-item-title > span:nth-child(2) {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 24px !important;
    max-width: none !important;
    left: 0 !important;
    top: 0 !important;
    display: block !important;
    height: 1px !important;
    margin: 0;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px 6px !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 2px !important;
    box-sizing: border-box;
    text-align: center !important;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content > div:hover {
    transform: none !important;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content > div > div,
  .home-body .chapter-box .chapter-item .chapter-item-content > div > div.btnbg {
    width: 100% !important;
    max-width: 68px !important;
    min-width: 0 !important;
    height: 36px !important;
    line-height: 36px !important;
    margin: 0 auto 6px !important;
    display: block !important;
    font-size: 12px !important;
    box-sizing: border-box;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content > div > span {
    display: block !important;
    width: 100% !important;
    max-width: 72px !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    word-break: break-all !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* ---------- 检索首页 grid ---------- */
  .search-container {
    padding: 12px !important;
    box-sizing: border-box;
  }

  .category-grid,
  [class*="category-grid"] {
    max-width: 100% !important;
    width: 100% !important;
    padding: 8px !important;
  }

  .item-list,
  [class*="item-list"] {
    grid-template-columns: 1fr !important;
  }

  .item-row,
  [class*="item-row"] {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ---------- 道具分类面板 ---------- */
  .prop-classify-panel,
  [class*="prop-classify-panel"] {
    width: calc(100% - 24px) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: auto;
    margin-right: auto;
  }

  /* ---------- 技能树 / 详情树 ---------- */
  .treeView,
  [class*="treeView"] {
    width: calc(100% - 24px) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex-direction: column !important;
    padding: 12px !important;
    box-sizing: border-box;
  }

  .treeView .tree-leftBox,
  [class*="treeView"] [class*="tree-leftBox"] {
    width: 100% !important;
    margin-right: 0 !important;
  }

  /* ---------- 转职树横向滚动（保持结构，可滑动查看） ---------- */
  .tree-transfer,
  [class*="tree-transfer"],
  .zm-tree-org,
  .tree-org {
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
  }

  /* ---------- 表格区域：横向滚动，不撑破屏幕 ---------- */
  .num-range,
  [class*="num-range"],
  [style*="width: 1200px"],
  [style*="width:1200px"],
  [style*="min-width: 1000px"],
  [style*="min-width:1000px"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .num-range,
  [class*="num-range"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .el-table {
    width: 100% !important;
    min-width: 0 !important;
  }

  .el-table__body-wrapper,
  .el-table__header-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  div[style*="min-width: 1000px"],
  div[style*="min-width:1000px"],
  div[style*="width: 62%"],
  div[style*="width:62%"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* ---------- 关于 / 赞助 / 管理 ---------- */
  .about-container,
  [class*="about-container"],
  .manage-about-container,
  [class*="manage-about-container"],
  .sponsor-container,
  [class*="sponsor-container"] {
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px !important;
    box-sizing: border-box;
  }

  .about-content,
  [class*="about-content"],
  .sponsor-content,
  [class*="sponsor-content"] {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 72px !important;
    padding: 16px !important;
    box-sizing: border-box;
  }

  .sponsor-title,
  [class*="sponsor-title"] {
    font-size: 24px !important;
  }

  /* ---------- NPC 筛选、详情 ---------- */
  .filter-section,
  [class*="filter-section"],
  .filter-row,
  [class*="filter-row"] {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .filter-item,
  [class*="filter-item"] {
    width: 100% !important;
    margin-bottom: 8px;
  }

  .details-view,
  [class*="details-view"],
  .details,
  [class*="details"] {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .change-btn,
  [class*="change-btn"] {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* NPC 地图大图：保持比例，容器内横向滑动 */
  .map-box,
  [class*="map-box"] {
    width: 100% !important;
    max-width: 100% !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .map-box .imgBox1,
  [class*="map-box"] [class*="imgBox"],
  .imgBox1,
  [class*="imgBox1"] {
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: 70vh;
    position: relative !important;
  }

  /* ---------- 道具搜索合并表 ---------- */
  .mergeTabel,
  [class*="mergeTabel"] {
    width: calc(100% - 24px) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mergeTabel-title,
  [class*="mergeTabel-title"],
  .mergeTabel-row,
  [class*="mergeTabel-row"] {
    min-width: 640px;
  }

  .title-col,
  [class*="title-col"],
  [class*="right-colTop-box"] {
    width: auto !important;
    min-width: 72px;
    flex: 1 1 auto;
  }

  /* ---------- Element Plus 组件 ---------- */
  .el-segmented {
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .el-pagination {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px;
    padding: 8px 0;
  }

  .el-dialog {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px auto !important;
  }

  .el-tabs__nav-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .demo-tabs > .el-tabs__content,
  [class*="demo-tabs"] > .el-tabs__content {
    padding: 16px !important;
    font-size: 18px !important;
  }

  /* ---------- 任务、转职行 ---------- */
  .trans-row,
  [class*="trans-row"],
  .tabs-row,
  [class*="tabs-row"] {
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  .result-row,
  [class*="result-row"] {
    flex-wrap: wrap !important;
    padding: 12px !important;
  }

  /* ---------- 内联居中容器（各页顶部 flex 包裹） ---------- */
  body > #app > div[style*="justify-content: center"],
  #app [style*="flex-wrap: wrap"][style*="justify-content: center"] {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }
}

/* 小屏手机进一步优化 */
@media screen and (max-width: 767px) {
  .search-tag .tag {
    width: calc(50% - 8px) !important;
  }

  .header .header-inner .header-btn-row .header-btn {
    min-width: 56px;
  }

  .header .header-inner .header-btn-row .header-btn b {
    font-size: 11px !important;
  }

  .home-body .inputBox:not(:empty) {
    margin-top: 12px !important;
  }

  .home-body .chapter-box .chapter-item .chapter-item-content {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .home-body .title {
    font-size: 18px !important;
    padding: 0 12px;
  }

  .search-box .search-boxInner .search-btn,
  [class*="search-box"] .search-btn {
    width: 100% !important;
    margin: 8px 0 0 !important;
    height: 40px;
  }

  .category-title,
  [class*="category-title"] {
    font-size: 16px !important;
  }

  .el-table .cell {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }
}

/* 触控友好：不改变视觉，仅增大可点区域 */
@media (hover: none) and (pointer: coarse) {
  .search-tag .tag,
  .header .header-btn,
  .home-body .chapter-box .chapter-item .chapter-item-content > div,
  .item-row,
  [class*="item-row"] {
    min-height: 40px;
  }
}
