/* Album restyle: A17 bronze chips, 2-row filters, logo-style title. Loaded last. */

.album-panel .collection-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  height: min(900px, calc(100dvh - 18px));
  padding: 10px 18px 12px;
  overflow: hidden;
  background:
    url("./assets/art/a16/main_ui/backgrounds/desk_clean_wood.png") center / cover no-repeat;
}

.collection-topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.collection-topbar-spacer { display: block; width: 44px; height: 44px; }

.collection-hero {
  position: relative;
  justify-self: center;
  display: grid;
  place-items: center;
  width: min(88vw, 460px);
  min-height: 0;
  height: auto !important;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none;
  filter: drop-shadow(0 4px 6px rgba(20, 8, 0, .45));
}

.album-panel .collection-hero h2 {
  margin: 0;
  line-height: 0;
  font-size: 0;
}

.collection-hero img {
  display: block;
  width: min(100%, 340px);
  height: auto;
  max-height: 72px;
  margin: 0 auto;
  object-fit: contain;
}

.collection-summary { display: none; }

.album-panel .collection-close {
  position: static !important;
  top: auto;
  right: auto;
  justify-self: end;
  width: 44px;
  height: 44px;
  margin: 0;
  overflow: hidden;
  border: 0;
  color: transparent;
  background: url("./assets/art/a8/formal_ui/icons/icon_back_arrow_button.png") center / contain no-repeat;
}

.collection-filterbar {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  width: min(940px, 100%);
  margin: 0 auto;
  overflow: visible;
}

.collection-filter-row,
.collection-filter-label,
.collection-filter-divider,
.collection-series-tabs { display: none; }

.collection-status-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.collection-status-tabs button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  color: #3a2010;
  background: url("./assets/art/a17/album/chip_idle.svg?v=2") center / 100% 100% no-repeat;
  box-shadow: none;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 236, 196, .7);
  white-space: nowrap;
}

.collection-status-tabs button[aria-selected="true"] {
  min-height: 40px;
  color: #2a1208;
  background-image: url("./assets/art/a17/album/chip_on.svg?v=2");
  transform: none;
}

.collection-filter-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.collection-dd {
  position: relative;
  display: grid;
  min-width: 0;
}

.collection-dd span {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  color: #6a3a18;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  pointer-events: none;
  transform: translateY(-50%);
}

.collection-dd select {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  height: 40px;
  padding: 6px 28px 6px 42px;
  border: 0;
  border-radius: 0;
  color: #3a2010;
  background: url("./assets/art/a17/album/chip_idle.svg?v=2") center / 100% 100% no-repeat;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
}

.collection-dd::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #4a2810;
  pointer-events: none;
  transform: translateY(-40%);
}

.collection-page-nav {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 3px 3px rgba(55, 25, 8, .35));
}

.collection-page-nav::before { content: none; }
.collection-page-nav img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.collection-page-indicator {
  width: 108px;
  height: 34px;
  border: 0;
  border-radius: 0;
  color: #5a2c14;
  background: url("./assets/art/a17/album/badge_page.svg") center / 100% 100% no-repeat;
  box-shadow: none;
  font-family: "KaiTi", "STKaiti", "Kaiti SC", serif;
}

.collection-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 72px;
}

.collection-actions .collection-back { display: none; }

.collection-actions .collection-rank {
  width: 72px;
  min-width: 72px;
  height: 72px;
  min-height: 72px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: none !important;
  box-shadow: none;
}

.collection-actions .collection-rank img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.collection-item.is-locked .card-art { visibility: visible !important; }
.collection-item.is-locked:not(.rarity-hidden) .card-frame::before { content: none !important; display: none !important; }
.collection-item.is-locked .card-frame::after {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
.collection-item.is-locked.rarity-normal .locked-card-art,
.collection-item.is-locked.rarity-rare .locked-card-art,
.collection-item.is-locked.rarity-hidden .locked-card-art {
  filter: grayscale(1) contrast(.82) brightness(.88) !important;
  opacity: .8 !important;
}

@media (max-width: 760px) {
  .album-panel {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
  }

  .album-panel .collection-shell {
    height: 100dvh;
    max-height: 100dvh;
    gap: 6px;
    padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  }

  .collection-topbar {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .collection-topbar-spacer,
  .album-panel .collection-close {
    width: 40px;
    height: 40px;
  }

  .collection-hero {
    width: min(92vw, 380px);
  }

  .collection-hero img { max-height: 70px; }

  .collection-status-tabs button,
  .collection-dd select {
    min-height: 38px;
    height: 38px;
    font-size: 14px;
  }

  .collection-dd span { font-size: 10px; left: 10px; }
  .collection-dd select { padding-left: 36px; padding-right: 24px; font-size: 12px; }

  .collection-book {
    min-height: 0;
    height: 100%;
    padding: 10px 2% 32px;
  }
  .collection-book-toolbar { display: none; }
  .album-page-stage {
    inset: 8px 0 30px;
    display: block;
  }
  .collection-page-window {
    height: 100%;
    overflow: hidden;
  }
  .collection-page-nav {
    position: absolute;
    top: 42%;
    z-index: 8;
    width: 38px;
    height: 38px;
    margin: 0;
  }
  .collection-prev { left: 0; }
  .collection-next { right: 0; }
  .collection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    justify-content: stretch;
    align-content: stretch;
    align-items: start;
    gap: 6px 8px;
    width: 100%;
    height: 100%;
    padding: 0 40px;
    overflow: hidden;
  }
  .collection-item {
    width: 100%;
    max-width: none;
    gap: 2px;
  }
  .collection-page-indicator {
    bottom: 4px;
    width: 96px;
    height: 28px;
    font-size: 12px;
  }

  .collection-actions { min-height: 64px; }
  .collection-actions .collection-rank {
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .album-panel .collection-shell {
    grid-template-columns: 160px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) 56px;
  }
  .collection-topbar {
    grid-column: 1;
    grid-row: 1 / 3;
    grid-template-columns: 1fr;
    grid-template-rows: auto 36px;
    align-content: start;
  }
  .collection-hero { width: 150px; }
  .collection-hero img { max-height: 48px; }
  .collection-topbar-spacer { display: none; }
  .album-panel .collection-close { justify-self: center; }
  .collection-filterbar {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
  }
  .collection-book { grid-column: 1 / 3; grid-row: 2; }
  .collection-actions { grid-column: 1 / 3; grid-row: 3; }
  .collection-grid { height: 100%; }
}

/* Fill the remaining desk with the open book; keep captions on the pages. */
.collection-book {
  align-self: stretch;
  width: 100%;
  min-height: 0;
  height: 100%;
  justify-self: stretch;
  background-size: cover !important;
  background-position: center 46% !important;
  background-repeat: no-repeat;
}

.collection-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.collection-item .card-frame {
  min-height: 0;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
}

.collection-card-caption {
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-height: 1.7em;
  padding: 0 2px;
  overflow: hidden;
  font-family: "Microsoft YaHei", "SimHei", "PingFang SC", sans-serif;
}

.collection-card-caption.is-locked {
  justify-content: center;
  min-height: 36px;
}

.collection-card-caption.is-locked img {
  display: block;
  width: min(100%, 148px);
  height: auto;
  max-height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(20, 8, 0, .35));
}

.collection-card-caption.is-locked strong { display: none; }

.collection-card-caption.is-owned {
  justify-content: center;
}

.collection-card-caption.is-owned strong { display: none; }

.collection-card-caption.is-owned span {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  color: #c41c1c;
  font-family: inherit;
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-text-stroke: 2px #fff8e4;
  paint-order: stroke fill;
  text-shadow: 1px 1px 0 #2a1408;
}

.collection-card-caption.is-owned span b {
  color: #c41c1c;
  font-size: 1em;
  -webkit-text-stroke: 2px #fff8e4;
}

@media (max-width: 760px) {
  .album-panel .collection-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 2px;
    padding-inline: 4px;
  }

  .collection-topbar { grid-row: 1; }

  .collection-filterbar {
    grid-row: 2;
    grid-column: 1;
    z-index: 6;
    align-self: start;
    width: calc(100% - 16px);
    margin: 6px auto 0;
    padding: 0;
  }

  .collection-hero {
    width: min(92vw, 380px);
  }

  .collection-hero img { max-height: 68px; }

  .collection-book {
    grid-row: 2;
    grid-column: 1;
    margin: 0;
    padding: 4px 0 22px;
    min-height: 0;
    height: 100%;
    background-size: 112% 108% !important;
    background-position: center 40% !important;
  }

  .album-page-stage {
    inset: 92px 0 22px;
  }

  .collection-grid {
    align-items: stretch;
    align-content: stretch;
    gap: 4px 10px;
    padding: 2px 36px 4px;
  }

  .collection-card-caption {
    min-height: 1.7em;
  }

  .collection-card-caption.is-locked {
    min-height: 34px;
  }

  .collection-card-caption.is-locked img {
    width: min(100%, 140px);
    max-height: 34px;
  }

  .collection-card-caption.is-owned span { font-size: 18px; }

  .collection-actions {
    grid-row: 3;
    min-height: 52px;
  }
  .collection-actions .collection-rank {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
  }
}
