/* 4.1.3 H5 storefront: desktop layout only. Do not style the checkout routes. */
@media (min-width: 960px) {
  body.uni-body {
    --shop-width: 1240px;
    --shop-gutter: 24px;
    --shop-nav-height: 64px;
    --shop-surface: #f5f7fa;
    --shop-border: #e9edf2;
    --shop-ink: #202835;
  }

  /* Move the original tab bar; its click handlers, badges and active state stay intact. */
  body.uni-body:has(uni-app > uni-tabbar.uni-tabbar-bottom:not([style*="display: none"])) uni-app {
    padding-top: var(--shop-nav-height);
  }

  uni-app > uni-tabbar.uni-tabbar-bottom,
  uni-app > uni-tabbar.uni-tabbar-bottom > .uni-tabbar {
    inset: 0 0 auto !important;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom > .uni-tabbar {
    box-sizing: border-box;
    height: var(--shop-nav-height);
    padding: 0 max(var(--shop-gutter), calc((100% - var(--shop-width)) / 2));
    align-items: stretch;
    gap: 8px;
    background: #fff;
    border-bottom: 1px solid var(--shop-border);
    box-shadow: 0 2px 12px #17203308;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar::before {
    content: "数字权益商城";
    display: flex;
    align-items: center;
    margin-right: auto;
    padding-left: 14px;
    background: linear-gradient(#ff7e42, #ed471b) left center / 4px 22px no-repeat;
    color: var(--shop-ink);
    white-space: nowrap;
    font-size: 20px;
    font-weight: 750;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar-border,
  uni-app > uni-tabbar.uni-tabbar-bottom > .uni-placeholder {
    display: none;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar__item {
    flex: 0 0 auto;
    align-self: center;
    cursor: pointer;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar__bd {
    box-sizing: border-box;
    flex-direction: row;
    gap: 7px;
    padding: 0 15px;
    height: 42px !important;
    border-radius: 9px;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar__bd:hover {
    background: #fff4ee;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar__icon {
    width: 19px !important;
    height: 19px !important;
  }

  uni-app > uni-tabbar.uni-tabbar-bottom .uni-tabbar__label {
    margin-top: 0 !important;
    font-size: 15px !important;
    font-weight: 600;
  }

  /* Search and listing are not tab pages, so provide links back to the catalog. */
  body:is(.pages-rights-goods_list-index, .pages-goods-goods_search-index) > .shop-desktop-links {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 24px;
    box-sizing: border-box;
    height: var(--shop-nav-height);
    padding-inline: max(var(--shop-gutter), calc((100% - var(--shop-width)) / 2));
    background: #fff;
    border-bottom: 1px solid var(--shop-border);
  }

  .shop-desktop-links a {
    color: var(--shop-ink);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }

  .shop-desktop-links a:hover { color: #d84417; }

  .shop-desktop-links .shop-desktop-brand {
    margin-right: auto;
    padding-left: 14px;
    background: linear-gradient(#ff7e42, #ed471b) left center / 4px 22px no-repeat;
    font-size: 20px;
    font-weight: 750;
  }

  /* Center the storefront, not all of uni-app (which also serves orders and payment). */
  body:is(.pages-index-index, .pages-goods_cate-goods_cate, .pages-rights-goods_list-index,
    .pages-goods-goods_search-index, .pages-goods_details-index) {
    background: var(--shop-surface);
  }

  body.uni-body uni-page-body > :is(.rights-home, .rights-cate, .goods-list-page),
  body.pages-goods-goods_search-index uni-page[data-page="pages/goods/goods_search/index"] uni-page-body {
    box-sizing: border-box;
    width: min(var(--shop-width), calc(100% - 2 * var(--shop-gutter)));
    margin-inline: auto;
  }

  body.uni-body uni-page-body > .rights-home {
    padding-top: 24px;
    background: transparent;
  }

  body.uni-body .rights-home:has(> .top-area):has(> .limit-card) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 32%);
    grid-template-areas: "hero promo" "level level" "news news" "catalog catalog" "spacer spacer";
    gap: 14px 18px;
  }

  body.uni-body .rights-home > .top-area { grid-area: hero; }
  body.uni-body .rights-home > .limit-card { grid-area: promo; }
  body.uni-body .rights-home > .levelup { grid-area: level; }
  body.uni-body .rights-home > .news { grid-area: news; }
  body.uni-body .rights-home > .szcate { grid-area: catalog; }
  body.uni-body .rights-home > .safe-bottom { grid-area: spacer; }

  body.uni-body .rights-home > :is(.top-area, .limit-card, .levelup, .news, .szcate) {
    min-width: 0;
    margin-inline: 0;
  }

  body.uni-body .rights-home > .top-area {
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 18px #1720330b;
  }

  body.uni-body .rights-home .top-bg { display: none; }

  body.uni-body .rights-home .search-bar { padding: 12px 16px; }

  body.uni-body .rights-home .search-inner {
    height: 42px;
    background: #f5f7fa;
    border: 1px solid var(--shop-border);
    cursor: text;
  }

  body.uni-body .rights-home .banner-wrap { margin: 0; padding: 0 12px 12px; }
  body.uni-body .rights-home uni-swiper.banner { height: 246px; }
  body.uni-body .rights-home .banner-text {
    box-sizing: border-box;
    height: 100%;
    padding: 28px 34px;
  }
  body.uni-body .rights-home .banner-index { right: 24px; bottom: 24px; }

  body.uni-body .rights-home .bt-title {
    font-size: clamp(25px, 2.55vw, 36px);
    line-height: 1.24;
  }

  body.uni-body .rights-home .bt-sub { font-size: 16px; line-height: 1.6; }

  body.uni-body .rights-home:has(> .limit-card) > :is(.limit-card, .levelup, .news) {
    margin-block: 0;
  }

  body.uni-body .rights-home > .limit-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 22px;
    border: 1px solid #f3e7db;
    border-radius: 16px;
    background: #fffaf5;
  }

  body.uni-body .rights-home .limit-top { gap: 7px; flex-wrap: wrap; }
  body.uni-body .rights-home .limit-title { font-size: 18px; line-height: 1.35; }
  body.uni-body .rights-home .limit-desc { font-size: 13px; line-height: 1.6; }

  body.uni-body .rights-home > :is(.levelup, .news) {
    box-sizing: border-box;
    padding-inline: 16px;
  }

  body.uni-body .rights-home .levelup-text,
  body.uni-body .rights-home .news-text { font-size: 14px; }

  body.uni-body .rights-home > .szcate { padding: 0; }

  body.uni-body .rights-home .cate-box {
    padding: 16px;
    margin-inline: 0;
    border: 1px solid var(--shop-border);
    border-radius: 14px;
    background: #fff;
  }

  body.uni-body .rights-home .cate-title-name { font-size: 18px; }
  body.uni-body .rights-home .cate-more { font-size: 14px; cursor: pointer; }

  body.uni-body .rights-home .cate-list {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }

  body.uni-body .rights-home .cate-item {
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    min-height: 72px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--shop-border);
    border-radius: 9px;
    box-shadow: none;
    cursor: pointer;
  }

  body.uni-body .rights-home .cate-item-name { font-size: 15px; }
  body.uni-body .rights-home .cate-item-buy { font-size: 12px; }
  body.uni-body .rights-home .cate-item:hover,
  body.uni-body .rights-cate .cate-right-item:hover,
  body.uni-body .goods-list-page .goods-card:hover { border-color: #ffc6b0; background: #fff9f5; }

  /* Categories: real sidebar and card grid; retain uni-scroll-view behavior. */
  body.uni-body uni-page-body > .rights-cate {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--shop-nav-height));
    height: calc(100dvh - var(--shop-nav-height));
    background: var(--shop-surface);
  }

  body.pages-goods_cate-goods_cate .uni-app--showtabbar uni-page-wrapper { height: 100%; }
  body.pages-goods_cate-goods_cate .uni-app--showtabbar uni-page-wrapper::after { display: none; }

  body.uni-body .rights-cate > .search-header {
    flex: none;
    margin: 16px 0 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fff;
  }

  body.uni-body .rights-cate .search-bar { cursor: text; }
  body.uni-body .rights-cate .cateBox1 { flex: 1; height: auto; min-height: 0; }

  body.uni-body .rights-cate .cate-left {
    box-sizing: border-box;
    width: 176px;
    flex: 0 0 176px;
    border: 1px solid var(--shop-border);
    border-radius: 12px 12px 0 0;
    background: #fff;
  }

  body.uni-body .rights-cate .cate-left-item {
    min-height: 46px;
    font-size: 15px;
    cursor: pointer;
  }

  body.uni-body .rights-cate .cate-right { min-width: 0; }

  body.uni-body .rights-cate .cate-panel {
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--shop-border);
    border-radius: 12px;
    background: #fff;
  }

  body.uni-body .rights-cate .cate-right-title { font-size: 17px; }

  body.uni-body .rights-cate .cate-right-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
  }

  body.uni-body .rights-cate .cate-right-item {
    box-sizing: border-box;
    width: auto;
    margin: 0;
    padding: 12px 6px;
    border: 1px solid var(--shop-border);
    border-radius: 9px;
    cursor: pointer;
  }

  body.uni-body .rights-cate .cate-right-item .text { font-size: 14px; }

  /* Product listing: use the original cards, sort controls and pagination. */
  body.uni-body uni-page-body > .goods-list-page { padding-block: 16px; }

  body.uni-body .goods-list-page > :is(.sub-tabs, .sort-bar) {
    border-radius: 10px;
    background: #fff;
  }

  body.uni-body .goods-list-page :is(.sub-tab, .sort-item, .buy-btn) { cursor: pointer; }
  body.uni-body .goods-list-page .sort-item { font-size: 15px; }

  body.uni-body .goods-list-page .goods-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    align-items: stretch;
    gap: 14px;
    padding: 14px 0;
  }

  body.uni-body .goods-list-page .goods-list > :not(.goods-card) { grid-column: 1 / -1; }

  body.uni-body .goods-list-page .goods-card {
    box-sizing: border-box;
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--shop-border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
  }

  body.uni-body .goods-list-page .card-body { min-width: 0; }
  body.uni-body .goods-list-page .card-title { font-size: 16px; min-height: 2.6em; line-height: 1.3; }

  /* Detail: keep images, content and existing action bar aligned. */
  body.pages-goods_details-index .product-con {
    width: min(1080px, calc(100% - 2 * var(--shop-gutter)));
    margin-inline: auto;
    padding-top: 50px;
  }

  body.pages-goods_details-index .product-con .page_footer,
  body.pages-goods_details-index .product-con .fixed-lt.w-full.z-99 {
    max-width: 1080px;
    width: calc(100% - 2 * var(--shop-gutter));
    right: 0;
    margin-inline: auto;
  }

  body.pages-goods_details-index .product-con uni-view:has(> .product-bg):has(> .info_card) {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-auto-rows: auto;
    align-items: start;
    gap: 12px 22px;
    position: relative;
  }

  body.pages-goods_details-index .product-con .product-bg {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 340px !important; /* uni-app sets an inline height based on window width. */
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
  }

  body.pages-goods_details-index .product-con .product-bg .white-jianbian { display: none; }
  body.pages-goods_details-index .product-con .mirror-image { position: absolute; }

  body.pages-goods_details-index .product-con .info_card {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    margin-top: 0;
    padding-bottom: 18px;
    border-radius: 12px;
    background: #fff;
  }

  body.pages-goods_details-index .product-con .info_card .fs-30 { font-size: 20px; line-height: 1.45; }
  body.pages-goods_details-index .product-con .info_card + .px-20 { grid-column: 2; padding-inline: 0; }
  body.pages-goods_details-index .product-con .info_card + .px-20 + .px-20 { grid-column: 1 / -1; padding-inline: 0; }

  body.pages-goods_details-index .product-con .description img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
  }

  body.pages-goods_details-index .product-con .page_footer .flex-1 {
    justify-content: flex-end;
  }

  body.pages-goods_details-index .product-con .page_footer .flex-1 > uni-view {
    max-width: 380px;
    font-size: 15px;
  }
}

@media (min-width: 960px) and (max-width: 1150px) {
  body.uni-body .rights-home .cate-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.uni-body .rights-home uni-swiper.banner { height: 214px; }
}
