/* 详情关闭控件与滚动内容分离；面板自身不滚动，关闭按钮始终可见。 */
.drawer .pn {
  overflow: hidden;
}

.drawer .dw-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

/* 手机排版共用规则；只在窄屏生效，页面数据和桌面布局保持原有行为。 */
@media (max-width: 767.98px) {
  /* 六个现有入口使用等宽的一排，避免第六项掉到第二排。 */
  .mob-tabbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .mob-tabbar a {
    min-width: 0;
    min-height: 50px;
    padding: 5px 0;
    gap: 3px;
    justify-content: center;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
  }

  .mob-tabbar a svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .page {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  /* flex 子项允许收缩到可用空间，输入框默认宽度不能撑出手机屏幕。 */
  .mob-top {
    gap: 8px;
  }

  .mob-top .gs-wrap,
  .mob-top .mob-gs,
  .mob-search,
  .hero-search {
    min-width: 0;
  }

  .mob-top .gs-wrap {
    flex: 1 1 0;
  }

  .mob-search input,
  .hero-search input,
  .in-search input {
    min-width: 0;
    font-size: 16px;
  }

  .hero h1 {
    line-height: 1.4;
  }

  /* 快报明确分为标题、商品和更新时间，商品区不再和标题争抢一行。 */
  .tk {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 8px;
    align-items: center;
  }

  .tk-h {
    white-space: nowrap;
  }

  .tk-r {
    margin-left: auto;
    padding: 3px 8px;
  }

  .tk-goods,
  .tk > .tk-tx {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .tk-goods {
    gap: 8px 12px;
  }

  .tk-g {
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    line-height: 1.6;
  }

  .tk-g em,
  .tk-g i {
    white-space: nowrap;
  }

  .tk-at {
    flex: 1 1 0;
    width: auto;
    margin: 0;
    white-space: normal;
    line-height: 1.6;
  }

  .tk-arr {
    margin-left: auto;
  }

  .entries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry p {
    font-size: 13px;
    line-height: 1.6;
  }

  /* 图鉴切换与排序/搜索分行排列，所有控件无需横滑即可使用。 */
  .mob-tools {
    display: grid;
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
    gap: 10px;
    overflow: visible;
  }

  .mob-tools .seg {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: auto;
    min-width: 0;
    border-radius: 16px;
  }

  .mob-tools .seg button {
    min-width: 0;
    min-height: 44px;
    padding: 7px 4px;
    justify-content: center;
    font-size: 14px;
    white-space: nowrap;
  }

  .mob-tools .seg button .n {
    font-size: 11px;
  }

  .mob-tools .sel,
  .mob-tools .in-search {
    width: 100%;
    min-width: 0;
    height: 44px;
  }

  .mob-tools .sel {
    padding-left: 12px;
    padding-right: 30px;
    background-position: right 10px center;
    font-size: 14px;
  }

  .mob-tools .in-search {
    padding: 0 10px;
    gap: 6px;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .mob-tools .sel {
    grid-column: 1;
    grid-row: 3;
  }

  /* 筛选入口进入文档流，不再悬浮遮挡卡片；保留原按钮和事件绑定。 */
  .mob-tools .mob-fab {
    position: relative;
    inset: auto;
    z-index: auto;
    grid-column: 2;
    grid-row: 3;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    padding: 0 12px;
    box-shadow: none;
    font-size: 14px;
    gap: 6px;
  }

  .mob-tools .mob-fab .badge {
    position: static;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
  }

  .mob-tools .mob-fab svg {
    width: 16px;
    height: 16px;
    flex: none;
  }

  .pet-name,
  .sc-n {
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  /* 图鉴属性标签缩紧留白与行高，保留完整文字；详情标签沿用原尺寸。 */
  .pet-types {
    gap: 4px;
    margin-top: 5px;
  }

  .pet-types .ty {
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
  }

  .pet-foot {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .pet-total,
  .pet-h {
    white-space: nowrap;
  }

  .pet-h {
    margin-left: 0;
    font-size: 11px;
  }

  .sc-r {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .dw-side {
    min-width: 0;
  }

  .dw-side h2 {
    padding-right: 32px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .dw-tags .ty {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
  }

  .drawer .cls {
    width: 44px;
    height: 44px;
  }

  /* 详情里的数值和横条要铺满内容列，不能按文字宽度收缩。 */
  .race-rows {
    width: 100%;
  }

  .kv {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .kv dd {
    overflow-wrap: anywhere;
  }

  .item-n,
  .today-meta,
  .acc-st {
    flex-wrap: wrap;
  }

  .item-n .onsale,
  .item-n .hot {
    white-space: nowrap;
  }

  .acc-item {
    max-width: 100%;
    flex-wrap: wrap;
    font-size: 13px;
    line-height: 1.6;
  }

  .slot {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
