.encore-collection-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

/* Shared global search presentation for Encore, Owned, and Missing pages. */
.global-search-panel {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(117, 171, 210, 0.72);
  border-radius: 8px;
  background: rgba(238, 248, 253, 0.78);
}

.global-search-label {
  display: block;
  margin-bottom: 0.5rem;
  color: #245b88;
  font-size: 0.9rem;
  font-weight: 700;
}

.global-collection-search {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(23, 63, 102, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 3px 10px rgba(23, 63, 102, 0.07);
  color: #173f66;
  font: inherit;
}

.global-collection-search::placeholder {
  color: rgba(23, 63, 102, 0.62);
}

.global-collection-search:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.global-search-status {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
  color: #245b88;
  font-size: 0.88rem;
}

.global-search-results {
  display: grid;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.global-search-results li {
  display: grid;
  gap: 0.18rem;
}

.global-search-results li a {
  width: fit-content;
}

.global-search-results li span {
  display: block;
  color: #526b7d;
  font-size: 0.88rem;
}

tr[id^="item-"] {
  scroll-margin-block: 1rem;
}

tr[id^="item-"]:target td,
.collection-card[id^="item-"]:target {
  animation: global-search-highlight 4s ease-out;
}

@keyframes global-search-highlight {
  0%, 55% { background-color: rgba(255, 232, 112, 0.72); }
  100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  tr[id^="item-"]:target td,
  .collection-card[id^="item-"]:target {
    animation-duration: 0.01ms;
  }
}

.encore-collection-layout > main {
  grid-area: 1 / 1;
  width: min(calc(100% - 2rem), 1000px) !important;
  min-width: 0;
  margin-right: auto !important;
  margin-left: auto !important;
  padding-top: clamp(0.4rem, 1vw, 0.75rem) !important;
}

.encore-category-sidebar {
  position: absolute;
  top: var(--encore-sidebar-top, 0);
  left: clamp(0.5rem, 1vw, 1rem);
  z-index: 4;
  width: clamp(250px, 18vw, 270px);
  overflow: hidden;
  border: 1px solid #75abd2;
  border-radius: 4px;
  background: #dceef8;
  box-shadow: 0 3px 9px rgba(23, 63, 102, 0.16);
  color: #123f68;
}

.encore-category-sidebar__title {
  margin: 0;
  padding: 0.55rem 0.68rem;
  background: #245f91;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.encore-category-sidebar__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.encore-category-sidebar__nav li + li:not(.encore-category-sidebar__character),
.encore-category-sidebar__character + li:not(.encore-category-sidebar__character) {
  border-top: 1px solid rgba(36, 95, 145, 0.16);
}

.encore-category-sidebar__nav a {
  display: block;
  min-height: 0;
  padding: 0.46rem 0.72rem;
  background: rgba(117, 171, 210, 0.18);
  color: #123f68;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.encore-category-sidebar__nav a:hover,
.encore-category-sidebar__nav a:focus-visible {
  background: #eef8fd;
  color: #0d3457;
}

.encore-category-sidebar__nav a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.encore-category-sidebar__nav a[aria-current="page"] {
  border-left: 4px solid #173f66;
  padding-left: calc(0.72rem - 4px);
  background: #fff;
  color: #173f66;
}

.encore-category-sidebar__nav .encore-category-sidebar__character a {
  padding: 0.32rem 0.65rem 0.32rem 1.3rem;
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.82rem;
  font-weight: 400;
}

.encore-category-sidebar__nav .encore-category-sidebar__character a[aria-current="page"] {
  padding-left: calc(1.3rem - 4px);
  background: #fff;
  font-weight: 700;
}

.encore-collection-layout .character-sidebar[hidden] {
  display: none !important;
}

.encore-mobile-character-selector {
  display: none;
}

.encore-category-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.encore-category-banner {
  display: block;
  width: min(100%, 960px);
  height: auto;
  margin: clamp(0.35rem, 1vw, 0.65rem) auto clamp(0.45rem, 1.2vw, 0.8rem);
}

.encore-category-banner[hidden] {
  display: none;
}

@media (max-width: 1520px) {
  .encore-collection-layout {
    display: block;
    width: min(calc(100% - 2rem), 1000px);
    margin: 0 auto;
  }

  .encore-category-sidebar {
    position: static;
    width: min(100%, 420px);
    margin-top: 1.25rem;
    margin-right: auto;
    margin-left: auto;
    border-left: 1px solid #75abd2;
    border-radius: 4px;
  }

  .encore-collection-layout > main {
    width: 100% !important;
    margin: 0 !important;
    padding-top: 0.75rem !important;
  }
}

@media (max-width: 820px) {
  .encore-category-sidebar {
    width: 100%;
  }

  .encore-category-sidebar__nav a {
    min-height: 36px;
    padding-top: 0.52rem;
    padding-bottom: 0.52rem;
  }
}

@media (max-width: 1024px) {
  .encore-collection-layout {
    width: min(calc(100% - 1rem), 1000px);
    max-width: 100%;
    overflow-x: hidden;
  }

  .encore-category-sidebar {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-top: 0.75rem;
  }

  .encore-category-sidebar__nav {
    max-height: 230px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .encore-category-sidebar__nav .encore-category-sidebar__character {
    display: none;
  }

  .encore-category-sidebar__nav a {
    box-sizing: border-box;
    min-height: 44px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    touch-action: manipulation;
  }

  .encore-category-sidebar__current-category > a {
    border-left: 4px solid #173f66;
    padding-left: calc(0.72rem - 4px);
    background: #fff;
    color: #173f66;
  }

  .encore-mobile-character-selector {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0.65rem auto 0;
    padding: 0.65rem;
    border: 1px solid #75abd2;
    border-radius: 4px;
    background: #dceef8;
    box-shadow: 0 3px 9px rgba(23, 63, 102, 0.12);
    color: #123f68;
  }

  .encore-mobile-character-selector label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
  }

  .encore-mobile-character-selector select {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 2.25rem 0.55rem 0.65rem;
    border: 1px solid #507da2;
    border-radius: 4px;
    background: #fff;
    color: #123f68;
    font: inherit;
    touch-action: manipulation;
  }

  .encore-collection-layout > main {
    min-width: 0;
    max-width: 100%;
    padding-top: 0.5rem !important;
  }
}
