/* This visual experiment is scoped to the library; no battle selectors. */
#libraryOverlay .library-view-switch {
  display: flex;
  margin-left: auto;
  border-bottom: 1px solid #716957;
}
#libraryOverlay .library-view-switch button {
  min-height: 42px;
  padding: 8px 14px;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #b9bec5;
  font-size: 14px;
}
#libraryOverlay .library-view-switch [aria-pressed="true"] {
  color: #e5d9ba;
  border-bottom-color: #b9a57b;
}
#cardGallery[hidden],
#libraryOverlay.library-gallery-mode .library-tabs,
#libraryOverlay.library-gallery-mode #librarySeriesIntro,
#libraryOverlay.library-gallery-mode #skillLibrary,
#libraryOverlay.library-gallery-mode #cardLibrary { display: none; }

#libraryOverlay.library-gallery-mode {
  padding: 0;
  background: #090c10;
}
#libraryOverlay.library-gallery-mode .library-panel {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: 24px max(24px, calc((100% - 1360px) / 2));
  border: 0;
  border-radius: 0;
  background: #0c1015;
  box-shadow: none;
}
#libraryOverlay.library-gallery-mode .library-header {
  flex-direction: row;
  align-items: center;
  max-width: 1360px;
  margin: 0 auto;
  padding-bottom: 18px;
  border-bottom: 1px solid #353831;
}
#libraryOverlay.library-gallery-mode .library-header .eyebrow {
  color: #a9a28f;
  font-size: 10px;
  margin: 0 0 6px;
  letter-spacing: 0;
}
#libraryOverlay.library-gallery-mode h2 {
  font-family: "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  color: #e5ded0;
  font-size: 23px;
  font-weight: 500;
  margin: 0;
}
#libraryOverlay.library-gallery-mode #closeLibraryButton {
  border: 0;
  border-radius: 0;
  padding: 10px 0 10px 20px;
  background: transparent;
  color: #c3c6c9;
  font-size: 13px;
  font-weight: 400;
}
#cardGallery {
  --gallery-gold: #baaa83;
  --gallery-cyan: #9ccdd2;
  --gallery-ink: #ece7dd;
  color: var(--gallery-ink);
  max-width: 1360px;
  margin: auto;
  letter-spacing: 0;
}
#cardGallery button, #cardGallery select { font-family: inherit; }
#cardGallery button:focus-visible, #cardGallery select:focus-visible,
#libraryOverlay .library-view-switch button:focus-visible {
  outline: 2px solid #9ccdd2;
  outline-offset: 5px;
}
#cardGallery .gallery-series-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
}
#cardGallery .gallery-series-tabs { display: flex; gap: 32px; }
#cardGallery .gallery-series-tabs button {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  color: #9b9f9f;
  font: 26px Georgia, "Songti SC", serif;
  background: none;
  border-bottom: 1px solid transparent;
}
#cardGallery .gallery-series-tabs span { font: 12px system-ui, sans-serif; }
#cardGallery .gallery-series-tabs [aria-pressed="true"] {
  color: var(--gallery-gold);
  border-bottom-color: var(--gallery-gold);
}
#cardGallery .gallery-catalog-label {
  display: flex;
  gap: 16px;
  align-items: center;
  color: #a5aaa9;
  font-size: 12px;
}
#cardGallery select {
  width: 180px;
  min-height: 40px;
  padding: 8px;
  background: #11171c;
  color: #dedcd4;
  border: 1px solid #474b45;
  border-radius: 2px;
  font-size: 13px;
}
#cardGallery .gallery-composition {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 56px;
  min-height: 510px;
  padding: 16px 24px 28px 0;
}
#cardGallery .gallery-collection { min-width: 0; position: relative; }
#cardGallery .gallery-collection::before {
  content: "";
  pointer-events: none;
  position: absolute;
  width: min(80%, 390px);
  aspect-ratio: 1;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #baa9830d;
  border-radius: 50%;
  box-shadow: 0 0 0 18px #baa98302, 0 0 0 19px #baa98308;
}
#cardGallery .gallery-cards {
  position: relative;
  height: 436px;
  isolation: isolate;
}
#cardGallery .gallery-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: 280px;
  height: 420px;
  border-radius: 7px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ac9c76;
  background: #151a20;
  box-shadow: 8px 16px 28px #0008, inset 0 0 0 4px #13181d;
  transition: transform 220ms ease, box-shadow 220ms ease;
}
#cardGallery .gallery-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid #d7c7a64d;
  border-radius: 3px;
  pointer-events: none;
}
#cardGallery .gallery-card-front {
  z-index: 3;
  transform: translateX(-50%);
}
#cardGallery .gallery-card-left {
  z-index: 1;
  transform: translateX(-85%) rotate(-11deg) scale(.84);
}
#cardGallery .gallery-card-right {
  z-index: 2;
  transform: translateX(-15%) rotate(11deg) scale(.84);
}
#cardGallery .gallery-art { position: absolute; inset: 0; display: grid; place-items: center; }
#cardGallery .gallery-art-image { width: 100%; height: 100%; object-fit: contain; }
#cardGallery .gallery-art-missing { position: absolute; color: #ada691; font-size: 14px; }
#cardGallery .gallery-card-title {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 9px;
  border: 1px solid #b5a57e99;
  background: #0c131bea;
  text-align: left;
  color: #f5eedf;
  font: 16px "Songti SC", Georgia, serif;
}
#cardGallery .gallery-cost { color: #a7dbe1; font: 26px Georgia, serif; }
#cardGallery .gallery-card-title strong { font-weight: 500; overflow-wrap: anywhere; }
#cardGallery .gallery-card-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0b101bed;
  border-top: 1px solid #b5a57e99;
  color: #e0d7c3;
  font-size: 12px;
}
#cardGallery .gallery-card-stats { font: 22px Georgia, serif; color: #f4f1e5; }
#cardGallery .gallery-card[data-rarity="legendary"] { border-color: #e0c68b; }
#cardGallery .gallery-card[data-rarity="epic"] { border-color: #a8b9c0; }
#cardGallery .gallery-pagination { display: flex; justify-content: center; gap: 28px; align-items: center; margin-top: 18px; }
#cardGallery .gallery-pagination button { width: 44px; height: 40px; background: transparent; color: #c6b88f; font-size: 23px; }
#cardGallery .gallery-pagination span { color: #c6c4bc; font: 13px Georgia, serif; font-variant-numeric: tabular-nums; }
#cardGallery .gallery-details { min-width: 0; animation: gallery-arrive 220ms ease-out; }
#cardGallery .gallery-eyebrow { color: var(--gallery-gold); font-size: 12px; margin: 0 0 22px; }
#cardGallery .gallery-name { font: 42px/1.3 "Songti SC", "Noto Serif CJK SC", Georgia, serif; margin: 0 0 14px; color: #f0ede4; overflow-wrap: anywhere; }
#cardGallery .gallery-metadata { font-size: 13px; color: #b2b6b8; margin: 0; }
#cardGallery .gallery-attributes { display: flex; gap: 0; margin: 28px 0; border-block: 1px solid #9f977435; padding: 16px 0; }
#cardGallery .gallery-attributes > div { min-width: 78px; padding-right: 24px; margin-right: 24px; border-right: 1px solid #9f977435; }
#cardGallery .gallery-attributes > div:last-child { border: 0; margin: 0; padding: 0; }
#cardGallery dt { font-size: 11px; color: #a9aeaf; margin-bottom: 6px; }
#cardGallery dd { margin: 0; font: 30px Georgia, serif; color: #dde7e6; }
#cardGallery .gallery-effect-title { font-weight: 400; color: #baa983; font-size: 12px; margin: 0 0 12px; }
#cardGallery .gallery-effect { color: #d2d5d5; font-size: 15px; line-height: 1.9; margin: 0; min-height: 86px; }
#cardGallery .gallery-keywords { font-size: 13px; color: #9ccdd2; }
#cardGallery .gallery-card-number { font-size: 10px; color: #929c9e; margin: 24px 0 0; }
#cardGallery .gallery-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #353831; padding: 20px 0 8px; color: #a5a499; font-size: 11px; }
@keyframes gallery-arrive { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #cardGallery .gallery-card-front:hover { transform: translateX(-50%) translateY(-5px) rotate(-1deg); box-shadow: 10px 22px 36px #0009; }
  #cardGallery .gallery-card-left:hover { transform: translateX(-88%) rotate(-13deg) scale(.85); }
  #cardGallery .gallery-card-right:hover { transform: translateX(-12%) rotate(13deg) scale(.85); }
  #cardGallery .gallery-card:hover::after { background: linear-gradient(120deg, transparent 25%, #d9f7ff16 48%, transparent 70%); }
}
@media (min-width: 851px) and (max-height: 780px) {
  #libraryOverlay.library-gallery-mode .library-panel { padding-top: 14px; }
  #cardGallery .gallery-series-bar { padding-block: 10px; }
  #cardGallery .gallery-composition { min-height: 440px; gap: 36px; padding-bottom: 12px; }
  #cardGallery .gallery-cards { height: 360px; }
  #cardGallery .gallery-card { width: 232px; height: 348px; }
  #cardGallery .gallery-name { font-size: 34px; }
  #cardGallery .gallery-attributes { margin-block: 18px; }
}
@media (max-width: 850px) {
  #libraryOverlay.library-gallery-mode .library-panel { padding: 20px; }
  #cardGallery .gallery-composition { gap: 30px; padding-right: 0; grid-template-columns: minmax(0, 1fr); }
  #cardGallery .gallery-collection { max-width: 560px; width: 100%; margin: auto; }
  #cardGallery .gallery-details { max-width: 560px; width: 100%; margin: auto; }
  #cardGallery .gallery-name { font-size: 32px; }
  #cardGallery .gallery-effect { min-height: 0; }
}
@media (max-width: 520px) {
  #libraryOverlay .library-header { flex-wrap: wrap; }
  #libraryOverlay .library-view-switch { order: 3; flex-basis: 100%; margin: 0; }
  #libraryOverlay .library-view-switch button { flex: 1; }
  #libraryOverlay #closeLibraryButton { margin-left: auto; }
  #cardGallery .gallery-series-bar { flex-wrap: wrap; gap: 16px; }
  #cardGallery .gallery-catalog-label { width: 100%; justify-content: space-between; }
  #cardGallery .gallery-series-tabs { width: 100%; gap: 32px; }
  #cardGallery .gallery-card { width: 210px; height: 315px; }
  #cardGallery .gallery-cards { height: 330px; }
  #cardGallery .gallery-card-left { transform: translateX(-69%) rotate(-8deg) scale(.8); }
  #cardGallery .gallery-card-right { transform: translateX(-31%) rotate(8deg) scale(.8); }
  #cardGallery .gallery-composition { padding-top: 2px; }
  #cardGallery .gallery-footer { flex-direction: column; }
  #cardGallery .gallery-card-title { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #cardGallery *, #cardGallery *::after { animation: none !important; transition: none !important; }
}
