/* Give the scoped catalog priority over the theme hooks. */
@layer nova-catalog {
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container .chip-list,
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container .item-list {
    height: clamp(160px, calc(100dvh - 320px), 560px) !important;
    max-height: clamp(160px, calc(100dvh - 320px), 560px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    padding-bottom: 20px !important;
    box-sizing: border-box !important;
  }
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container .chip-list {
    flex-wrap: nowrap !important;
    flex-direction: column !important;
  }
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container .chip-list > .chip {
    flex: 0 0 auto !important;
    min-height: 48px !important;
    touch-action: pan-y !important;
  }
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container .item-list {
    align-content: start !important;
    grid-auto-rows: max-content !important;
  }
  body.uc-body:is(:has(.nv9-category-switch[open]), :has(.nv10-explore[open])) #pjax-container :is(.chip-list, .item-list)::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  /* The catalog stays in normal flow. The category drawers use the theme's own layout. */
  body.uc-body:has(#pjax-container main.container .chip-list) {
    --catalog-ink: #30253f;
    --catalog-muted: #5f536f;
    --catalog-accent: #5c3b89;
    --catalog-edge: #fff9;
    --catalog-thumbnail-edge: #6c528216;
    --catalog-surface: linear-gradient(153deg, #ffffff9c, #f6edf842 56%, #e7def951);
    --catalog-key: linear-gradient(168deg, #fff9, #fff3 51%, #e9ddfa42);
    --catalog-selected: linear-gradient(165deg, #fcf6ffe0, #e4d3f29c);
    --catalog-selected-edge: #9b77c85e;
    --catalog-key-shadow: inset 0 1px 0 #fff9, 0 8px 18px -14px #513b7370;
    --catalog-action: #efe5fa;
    --catalog-status: #e8f3ee;
    --catalog-status-ink: #285b4a;
    --catalog-shadow: inset 0 1px 0 #fffa, inset 0 -1px 0 #73528f29, 0 14px 30px -22px #47315ca8;
    --catalog-notes: radial-gradient(ellipse at 17% 25%, #f7e7fd98, transparent 58%), radial-gradient(ellipse at 79% 64%, #e4e5ffab, transparent 61%);
  }

  html[data-theme="dark"] body.uc-body:has(#pjax-container main.container .chip-list) {
    --catalog-ink: #f8f2ff;
    --catalog-muted: #d8c9e6;
    --catalog-accent: #ecd9ff;
    --catalog-edge: #a994bd53;
    --catalog-thumbnail-edge: #cbbbdb40;
    --catalog-surface: linear-gradient(155deg, #49375bbd, #251c3adb);
    --catalog-key: linear-gradient(158deg, #6e528784, #3c2a5682);
    --catalog-selected: linear-gradient(135deg, #605080, #53406c);
    --catalog-selected-edge: #cbb2ee8c;
    --catalog-key-shadow: inset 0 1px 0 #e4d0ff35, 0 8px 18px -14px #0e061a9e;
    --catalog-action: #4d3c65;
    --catalog-status: #223f36;
    --catalog-status-ink: #c5eedc;
    --catalog-shadow: inset 0 1px 0 #cbb5ec48, 0 14px 29px -23px #10091ddf;
    --catalog-notes: radial-gradient(ellipse at 60% 25%, #513d7440, transparent 65%);
  }

  body.uc-body #pjax-container main.container .panel:has(.chip-list) > .panel-header {
    display: none !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container .panel-body:has(.item-list) {
    background: var(--catalog-notes) !important;
    border-radius: 26px !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .catalog-rail-frame {
    display: block !important;
    margin: 0 0 18px !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container .chip-list {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 6px 1px 11px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    scrollbar-color: transparent transparent !important;
    scrollbar-gutter: auto !important;
    -ms-overflow-style: none;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .catalog-rail-frame .chip-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  #pjax-container .catalog-rail-frame.is-dragging .chip-list,
  #pjax-container .catalog-rail-frame.is-dragging .chip-list .chip { cursor: grabbing; user-select: none; }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip {
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex: 1 0 auto !important;
    min-width: clamp(104px, 8.4vw, 140px);
    gap: 8px !important;
    min-height: 57px !important;
    padding: 12px 17px !important;
    border: 1px solid var(--catalog-edge) !important;
    border-radius: 18px !important;
    background: var(--catalog-key) !important;
    box-shadow: var(--catalog-key-shadow) !important;
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    color: var(--catalog-muted) !important;
    font-size: 13px !important;
    font-weight: 560 !important;
    white-space: nowrap !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip.is-primary {
    border-color: var(--catalog-selected-edge) !important;
    background: var(--catalog-selected) !important;
    color: var(--catalog-accent) !important;
    font-weight: 700 !important;
  }

  @media (hover: hover) {
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip:not(.is-primary):hover {
      background: var(--catalog-action) !important;
      color: var(--catalog-accent) !important;
    }
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip-icon {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
    border-radius: 6px !important;
    box-shadow: none !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip:focus-visible {
    outline: 2px solid var(--catalog-accent) !important;
    outline-offset: -2px;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container .item-list {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 16px !important;
    align-items: stretch !important;
  }

  @media (min-width: 1160px) {
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container
    .panel:has(.chip[data-id="recommend"].is-primary) .item-list:has(> .item-card-cell:nth-child(5):last-child) {
      grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list > :not(.item-card-cell) {
    grid-column: 1 / -1;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-card {
    display: flex !important;
    flex-direction: column !important;
    padding: 7px !important;
    border: 1px solid var(--catalog-edge) !important;
    border-radius: 22px !important;
    background: var(--catalog-surface) !important;
    box-shadow: var(--catalog-shadow) !important;
    -webkit-backdrop-filter: blur(18px) saturate(128%) !important;
    backdrop-filter: blur(18px) saturate(128%) !important;
    transition: transform .2s ease, box-shadow .2s ease;
  }

  body.uc-body .nv8-after:has(.nv8-guide-static) {
    width: var(--catalog-row-width, min(1280px, calc(100% - 32px))) !important;
    max-width: 100%;
    margin-inline: auto !important;
  }

  body.uc-body .nv8-after .nv8-guide-static {
    box-sizing: border-box;
    margin-inline: 0 !important;
    border: 1px solid var(--catalog-edge) !important;
    border-radius: 24px !important;
    background: var(--catalog-notes), var(--catalog-surface) !important;
    box-shadow: var(--catalog-shadow) !important;
    -webkit-backdrop-filter: blur(18px) saturate(128%);
    backdrop-filter: blur(18px) saturate(128%);
  }

  @media (min-width: 901px) {
    body.uc-body .nv8-after .nv8-guide-static {
      display: flex !important;
      flex-direction: column;
      justify-content: center;
      min-height: var(--catalog-row-height, 310px);
      padding: 32px clamp(25px, 3vw, 44px) !important;
    }
    body.uc-body .nv8-guide-static .nv8-steps { padding-top: 15px !important; }
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb {
    display: block !important;
    position: relative !important;
    isolation: isolate;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1.48 !important;
    margin: 0 !important;
    border: 1px solid var(--catalog-thumbnail-edge) !important;
    border-radius: 15px !important;
    background-size: cover !important;
    background-position: center !important;
    overflow: hidden !important;
  }

  .item-list .nv-card-muse { --catalog-image: url('/assets/nova-six/muse_ice_lotus.jpg'); }
  .item-list .nv-card-gpt { --catalog-image: url('/assets/nova-six/chatgpt_emerald_core.jpg'); }
  .item-list .nv-card-grok { --catalog-image: url('/assets/nova-six/grok-portal-card-v4.png'); }
  .item-list .nv-card-claude { --catalog-image: url('/assets/nova-six/claude_amber_orrery.jpg'); }
  .item-list .nv-card-gemini { --catalog-image: url('/assets/nova-six/gemini_astrolabe.jpg'); }
  .item-list .nv-card-perplexity { --catalog-image: url('/assets/nova-six/perplexity_cyan_tesseract.jpg'); }
  .item-list .nv-card-netflix { --catalog-image: url('/assets/nova-six/netflix_ruby_cinema.jpg'); }
  .item-list .nv-card-disney { --catalog-image: url('/assets/official-logos/disney-app-v1.webp'); }
  .item-list .nv-card-hbo { --catalog-image: url('/assets/official-logos/hbo-app-v1.webp'); }
  .item-list .nv-card-prime { --catalog-image: url('/assets/nova-six/streaming-v2/assets/prime_sculpture.jpg'); }
  .item-list .nv-card-spotify { --catalog-image: url('/assets/nova-six/streaming-v2/assets/spotify_sculpture.jpg'); }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb:not(.catalog-brand-art)::before,
  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb:not(.catalog-brand-art)::after {
    content: none !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb.catalog-brand-art {
    background: #e8e1f1 !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb.catalog-brand-art::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    opacity: 1 !important;
    background: var(--catalog-image) center / cover no-repeat !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb.catalog-brand-art::after {
    content: '' !important;
    position: absolute !important;
    inset: 9px auto auto 9px !important;
    width: 35px !important;
    height: 35px !important;
    border-radius: 10px !important;
    z-index: 1 !important;
    background: var(--catalog-logo) center / 24px 24px no-repeat, #fffffff0 !important;
    box-shadow: 0 2px 10px #271a3d24 !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-body {
    padding: 13px 9px 9px !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .goods-title {
    color: var(--catalog-ink) !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    font-weight: 630 !important;
    min-height: 2.9em !important;
    margin: 0 0 10px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .tags {
    margin: 0 0 13px !important;
    gap: 5px !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .badge-soft-success {
    color: var(--catalog-status-ink) !important;
    background: var(--catalog-status) !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container
  .panel:has(.chip[data-id="recommend"].is-primary) .item-list .badge-soft-primary {
    display: none !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .stat-row {
    border-top: 1px solid var(--catalog-thumbnail-edge) !important;
    margin: auto 0 0 !important;
    padding: 9px 0 0 !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .price {
    color: var(--catalog-ink) !important;
    font-size: 23px !important;
    font-weight: 720 !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .price .unit {
    color: inherit !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .stat-row::after {
    content: '查看 →' !important;
    color: var(--catalog-accent) !important;
    background: var(--catalog-action) !important;
    border: 0 !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    padding: 6px 9px !important;
    flex: none;
    font-size: 11px !important;
    font-weight: 650 !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .soldout .stat-row::after {
    content: none !important;
  }

  body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .item-card-cell:focus-visible {
    outline: 2px solid var(--catalog-accent) !important;
    outline-offset: 3px;
    border-radius: 22px;
  }

  @media (hover: hover) and (prefers-reduced-motion: no-preference) {
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .item-card-cell:hover .acg-card {
      transform: translateY(-3px) !important;
      box-shadow: 0 16px 28px -18px #42275f7c !important;
    }
  }

  @media (min-width: 761px) and (max-width: 1060px) {
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container .item-list {
      grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
  }

  @media (max-width: 760px) {
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container main.container .item-list {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 11px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .chip-list .chip {
      flex: 0 0 auto !important;
      min-width: 78px;
      padding-inline: 12px !important;
      min-height: 50px !important;
      border-radius: 15px !important;
      font-size: 12px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-card {
      padding: 5px !important;
      border-radius: 17px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb {
      aspect-ratio: 1.25 !important;
      border-radius: 12px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-thumb.catalog-brand-art::after {
      inset: 7px auto auto 7px !important;
      width: 27px !important;
      height: 27px !important;
      border-radius: 7px !important;
      background-size: 18px 18px, auto !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .acg-body {
      padding: 10px 7px 7px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .goods-title {
      font-size: 13px !important;
      min-height: 4.35em !important;
      -webkit-line-clamp: 3 !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .price {
      font-size: 21px !important;
    }
    body.uc-body:not(:has(.nv9-category-switch[open], .nv10-explore[open])) #pjax-container .item-list .stat-row::after {
      content: '→' !important;
      width: 31px !important;
      height: 31px !important;
      display: grid !important;
      place-items: center !important;
      padding: 0 !important;
      font-size: 15px !important;
    }
  }
}

.item-list .nv-card-disney { --catalog-thumbnail-bg:#e8eefb; }
.item-list .nv-card-hbo { --catalog-thumbnail-bg:#eee6f8; }
.item-list .nv-card-prime { --catalog-thumbnail-bg:#dff1f9; }
.item-list .nv-card-spotify { --catalog-thumbnail-bg:#e4f5e9; }
body.uc-body #pjax-container .item-list :is(.nv-card-disney,.nv-card-hbo,.nv-card-prime,.nv-card-spotify) .acg-thumb.catalog-brand-art,
body.uc-body #pjax-container .item-list :is(.nv-card-disney,.nv-card-hbo,.nv-card-prime,.nv-card-spotify) .acg-thumb.catalog-brand-art::before { background-color:var(--catalog-thumbnail-bg) !important; }
body.uc-body #pjax-container .item-list :is(.nv-card-disney,.nv-card-hbo,.nv-card-prime,.nv-card-spotify) .acg-thumb.catalog-brand-art::before { background-size:contain !important; }
