.collection-launch {
  position: relative;
}

.collection-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding-inline: 2px;
  border: 1px solid #ba9de6;
  border-radius: 10px;
  background: #4d306a;
  color: #fff5f4;
  font: 700 10px/1 var(--sans);
  pointer-events: none;
}

.collection-launch[data-complete] .collection-count {
  border-color: #f1d390;
  background: #563a22;
}

.collection-book {
  --book-ink: #100d19;
  --book-line: #816995;
  --book-muted: #c7bad4;
  --book-bright: #f6ecff;
  box-sizing: border-box;
  width: min(1010px, calc(100% - 36px));
  max-width: none;
  max-height: calc(100dvh - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 1px solid var(--book-line);
  border-radius: 18px;
  background: radial-gradient(ellipse at 77% 49%, #2b1d3c, #1a1526 47%, #16111f 72%);
  box-shadow: 0 28px 100px #05030ccc, 0 0 44px #734db035, inset 0 0 0 1px #dac1ff12;
  color: var(--book-bright);
  scrollbar-color: var(--chrome-scroll) var(--book-ink);
  scrollbar-width: thin;
}

.collection-book::backdrop {
  background: #080610d8;
  backdrop-filter: blur(5px);
}

.collection-book[open] {
  animation: collection-book-open .34s cubic-bezier(.18, .71, .28, 1) both;
}

.collection-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 26px 34px 24px;
  border-bottom: 1px solid #a184ba55;
  background: #191224;
}

.collection-hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0;
  background:
    linear-gradient(90deg, #171021 3%, #171021f0 31%, #17102180 57%, transparent 82%),
    url("./collection-astrolabe.webp") 70% center / cover no-repeat,
    radial-gradient(circle at 78% 33%, #ab82e6 0 1px, transparent 2px),
    radial-gradient(circle at 65% 48%, #f3dfff 0 1px, transparent 2px),
    radial-gradient(circle at 91% 65%, #df93fa 0 1px, transparent 2px),
    radial-gradient(circle at 86% 32%, #d0a4f9 0 1px, transparent 3px),
    radial-gradient(circle at 68% 26%, #9271bf 0 1px, transparent 2px),
    radial-gradient(circle at 76% 78%, #dcbeff 0 2px, transparent 3px),
    radial-gradient(ellipse at 84% 48%, #59397d, transparent 54%),
    linear-gradient(102deg, #171021 45%, #271834 85%);
}

.collection-hero-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 7px;
  border: 1px solid #9677b780;
  border-radius: 9px;
  background: linear-gradient(145deg, #3c2751, #251831);
  color: #e5cafa;
  box-shadow: inset 0 0 15px #be83f122;
}

.collection-hero h2 {
  position: relative;
  max-width: 610px;
  margin: 8px 40px 7px 0;
  color: #fcf3ff;
  font: 600 clamp(24px, 3.4vw, 46px)/1.12 var(--title);
  text-wrap: balance;
  text-shadow: 0 2px 8px #140b1e;
}

.collection-hero p {
  max-width: 510px;
  margin: 0;
  color: #e3d7ed;
  font-size: 15px;
  line-height: 1.5;
}

.collection-close,
.collection-toast-dismiss {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #9c83b481;
  border-radius: 8px;
  background: #21182c;
  color: #f1e3fa;
  cursor: pointer;
  font: 400 24px/1 var(--sans);
}

.collection-close {
  position: absolute;
  z-index: 2;
  top: 15px;
  right: 17px;
  width: 44px;
  height: 44px;
}

.collection-hero-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 16px;
}

.collection-progress {
  flex: 0 1 370px;
  min-width: 108px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px 12px;
  max-width: 100%;
}

.collection-progress label {
  color: #e9d8f5;
  font-size: 13px;
  font-weight: 700;
}

.collection-progress output {
  color: #ffeab9;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.collection-progress progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
  appearance: none;
  border: 1px solid #8f75a85c;
  border-radius: 6px;
  background: #120c1c;
  color: #d9b1ff;
  overflow: hidden;
}

.collection-progress progress::-webkit-progress-bar { background: #120c1c; }
.collection-progress progress::-webkit-progress-value {
  border-radius: 4px;
  background: linear-gradient(90deg, #906bd1, #dfbdff);
}
.collection-progress progress::-moz-progress-bar {
  border-radius: 4px;
  background: linear-gradient(90deg, #906bd1, #dfbdff);
}

.collection-pages {
  display: grid;
  grid-template: 'slots detail' auto / minmax(0, 1fr) minmax(215px, .43fr);
  align-items: stretch;
  gap: 18px;
  padding: 20px 26px;
}

.collection-slots {
  grid-area: slots;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-self: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.collection-slots li { min-width: 0; }

.collection-slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: space-between;
  width: 100%;
  height: 100%;
  min-height: 105px;
  padding: 7px 5px 9px;
  border: 1px solid #8b709c55;
  border-radius: 8px;
  background: radial-gradient(ellipse at 50% 48%, #302442, #1c1628 72%);
  color: var(--book-muted);
  text-align: center;
}

.collection-slot[data-found] {
  border-color: color-mix(in srgb, var(--sighting) 40%, #362842);
  background: radial-gradient(ellipse at 50% 37%, color-mix(in srgb, var(--sighting) 24%, #251a2f), #1e162a 72%);
  color: #f3e9fc;
  cursor: pointer;
}

.collection-slot[data-found]:is(:hover, :focus-visible, [aria-pressed='true']) {
  border-color: color-mix(in srgb, var(--sighting) 69%, white);
  box-shadow: inset 0 0 15px color-mix(in srgb, var(--sighting) 20%, transparent);
  color: #fff3ff;
}

.collection-slot[data-found][aria-pressed='true']::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  background: color-mix(in srgb, var(--sighting) 62%, white);
  box-shadow: 0 0 6px var(--sighting);
}

.collection-slot-caption {
  align-self: end;
  font: 600 11px/1.18 var(--sans);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.collection-art {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.collection-art img {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.collection-slot .collection-art { height: 63px; }
.collection-slot:not([data-found]) { align-content: center; }
.collection-slot:not([data-found]) .collection-art img {
  opacity: .66;
  filter: brightness(0) invert(.43) sepia(.25) saturate(1.35) hue-rotate(219deg) drop-shadow(0 0 3px #a88adf42);
}

.collection-slot:not([data-found]) .collection-art svg { color: #8d79a6; }
.collection-slot[data-found] .collection-art img { filter: drop-shadow(0 2px 3px #08050da8); }

.collection-detail {
  grid-area: detail;
  display: grid;
  align-content: start;
  padding: 0 13px 12px;
  overflow: hidden;
  border: 1px solid #9273ae70;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% 32%, color-mix(in srgb, var(--sighting) 21%, transparent), transparent 65%),
    #1b1426;
}

.collection-detail-art {
  display: grid;
  justify-items: center;
  align-items: center;
  min-width: 0;
  height: 112px;
  padding: 9px 0 5px;
  background: radial-gradient(ellipse at 50% 50%, #e4c2fa1b, transparent 67%);
}

.collection-detail-art > svg { width: 74px; height: 74px; color: #a587bd; }
.collection-detail-art .collection-art img { filter: drop-shadow(0 6px 7px #09060ec5); }

.collection-category,
.collection-achievement p,
.collection-toast p {
  margin: 0 0 4px;
  color: #edd6fe;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.collection-detail h3,
.collection-achievement h3 {
  margin: 0 0 4px;
  color: #fff1fa;
  font: 600 19px/1.23 var(--title);
  overflow-wrap: anywhere;
}

.collection-description {
  margin: 0;
  color: #e0d3e9;
  font-size: 13px;
  line-height: 1.5;
}

.collection-footer {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 15px 26px 17px;
  border-top: 1px solid #866ca254;
  background: #100d19a8;
}

.collection-footer form { margin-left: auto; }

.collection-button {
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid #9075a7;
  border-radius: 7px;
  background: linear-gradient(#362646, #251a33);
  color: #f6e7fd;
  cursor: pointer;
  font: 700 13px/1.2 var(--sans);
}

.collection-button:is(:hover, :focus-visible),
.collection-close:is(:hover, :focus-visible),
.collection-toast-dismiss:is(:hover, :focus-visible) {
  border-color: var(--chrome-focus);
  background: #48345e;
  color: white;
}

.collection-button.collection-continue {
  border-color: #c29aef;
  background: linear-gradient(#754d9d, #553174);
  box-shadow: inset 0 1px #f4daff65, 0 2px 14px #713ca947;
  color: #fff6ff;
}

.collection-button.collection-continue:is(:hover, :focus-visible) {
  border-color: #e6cdff;
  background: linear-gradient(#895cb5, #6b4491);
}

.collection-book :is(a, button):focus-visible,
.collection-toast button:focus-visible {
  outline: 2px solid var(--chrome-focus);
  outline-offset: 2px;
}

.collection-sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.collection-sound[aria-pressed='false'] .collection-sound-waves,
.collection-sound[aria-pressed='true'] .collection-sound-slash { display: none; }

.collection-hint {
  order: 2;
  width: 100%;
  margin: 4px 0 0;
  color: #e7d7f2;
  font-size: 13px;
}

.collection-source {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--chrome-accent);
  font-size: 13px;
  text-underline-offset: 3px;
}

.collection-live {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.collection-toast {
  --sighting: #d5a6ff;
  position: fixed;
  z-index: 98;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 76px));
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
  width: min(344px, calc(100% - 36px));
  min-height: 77px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--sighting) 54%, #6d5489);
  border-radius: 10px;
  background: linear-gradient(117deg, #352146, #20162d 55%);
  box-shadow: 0 10px 28px #0a0612bf, inset 0 1px #efc8ff39;
}

.collection-toast-art {
  align-self: stretch;
  height: 56px;
  border: 1px solid #b18ac258;
  border-radius: 6px;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--sighting) 25%, #2b1b39), #281b38 70%);
}

.collection-toast-open {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff1fc;
  cursor: pointer;
  font: 650 16px/1.2 var(--title);
  text-align: left;
  text-wrap: balance;
}

.collection-toast-open:hover { text-decoration: underline; }

.collection-toast-hunt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 2px 5px 2px 0;
  border: 0;
  background: transparent;
  color: #e9d2ff;
  font-size: 12px;
  font-weight: 700;
}

.collection-toast-hunt:is(:hover, :focus-visible) { text-decoration: underline; }
.collection-toast-dismiss { width: 36px; height: 40px; }

.collection-achievement {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  padding: 8px 24px;
  overflow: hidden;
  border-bottom: 1px solid #a882bea1;
  background: linear-gradient(108deg, #482e65, #2c1b46 52%, #251838);
}

.collection-achievement p { color: #ffe7b0; }
.collection-achievement h3 { margin: 0; font-size: clamp(17px, 3.6vw, 23px); }

.collection-achievement-crest {
  flex: none;
  width: 61px;
  height: 61px;
  padding: 5px;
  border: 1px solid #efcc8e88;
  border-radius: 50%;
  background: radial-gradient(circle, #614059, #2d1a44 60%);
  color: #ffebbc;
  box-shadow: inset 0 0 14px #ffdb8d30, 0 0 26px #dcb3ff42;
}

.collection-achievement-crest svg { width: 100%; height: 100%; }

.collection-rings {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .68;
}

.collection-rings i {
  position: absolute;
  top: 50%;
  left: 58px;
  width: 100px;
  aspect-ratio: 1;
  translate: -50% -50%;
  scale: 2;
  border: 1px solid #edcbff;
  border-radius: 50%;
  box-shadow: 0 0 22px #b87cf881, inset 0 0 22px #b87cf881;
  opacity: .34;
}

.collection-rings i:nth-child(2) { scale: 3.3; opacity: .2; }
.collection-rings i:nth-child(3) { scale: 4.4; opacity: .14; }

.collection-earned .collection-rings i {
  animation: collection-orbit .92s cubic-bezier(.14, .56, .3, 1) both;
}

.collection-earned .collection-rings i:nth-child(2) { animation-delay: .14s; }
.collection-earned .collection-rings i:nth-child(3) { animation-delay: .28s; }

.collection-earned .collection-achievement-crest {
  animation: collection-crown .68s cubic-bezier(.16, .65, .37, 1) both;
}

.collection-discovered .collection-art {
  animation: collection-record .62s cubic-bezier(.19, .73, .26, 1) both;
}

@keyframes collection-book-open {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes collection-record {
  0% { opacity: .52; transform: translateY(5px) scale(.74); filter: brightness(1.4); }
  62% { transform: translateY(-2px) scale(1.09); }
  100% { opacity: 1; transform: none; }
}

@keyframes collection-orbit {
  from { transform: scale(.2); opacity: .87; }
  to { transform: scale(1.3); }
}

@keyframes collection-crown {
  from { transform: rotate(-27deg) scale(.42); opacity: .16; }
  65% { transform: rotate(5deg) scale(1.17); opacity: 1; }
  to { transform: none; }
}

.collection-book [hidden],
.collection-toast[hidden],
.collection-count[hidden] { display: none; }

@media (max-width: 900px) {
  .collection-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 670px) {
  .collection-book {
    width: min(540px, calc(100% - 20px));
    max-height: calc(100dvh - 20px);
    border-radius: 12px;
  }

  .collection-hero { padding: 15px 16px 14px; }
  .collection-hero h2 { max-width: 320px; }
  .collection-hero p { max-width: 405px; font-size: 14px; }
  .collection-hero-controls { gap: 8px 10px; margin-top: 12px; }
  .collection-progress { flex: 1; }
  .collection-hero::before {
    background-image: linear-gradient(90deg, #171021 0%, #171021ee 38%, #1710216b), url("./collection-astrolabe.webp"),
      radial-gradient(ellipse at 84% 48%, #59397d, transparent 70%);
    background-position: center, 67% center, center;
    background-size: cover;
  }
  .collection-hero-icon { width: 34px; height: 34px; }
  .collection-close { top: 10px; right: 10px; }

  .collection-pages {
    grid-template: 'detail' auto 'slots' auto / minmax(0, 1fr);
    gap: 10px;
    padding: 13px 12px;
  }

  .collection-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .collection-detail {
    grid-template-columns: minmax(58px, .28fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px;
  }

  .collection-detail-art { height: 66px; padding: 1px 0; }
  .collection-detail-art > svg { width: 53px; height: 53px; }
  .collection-detail h3 { font-size: 16px; }

  .collection-footer { padding: 11px 12px; }
  .collection-achievement { gap: 9px; padding: 6px 12px; }
  .collection-achievement-crest { width: 49px; height: 49px; }
  .collection-toast { grid-template-columns: 60px minmax(0, 1fr) 44px; }
  .collection-toast-copy button { min-height: 44px; }
  .collection-toast-dismiss { width: 44px; height: 44px; }
}

@media (max-width: 350px) {
  .collection-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .collection-book[open],
  .collection-discovered .collection-art,
  .collection-earned :is(.collection-achievement-crest, .collection-rings i) {
    animation: none;
  }
}

@media (forced-colors: active) {
  .collection-slot[data-found][aria-pressed='true'] { border: 2px solid Highlight; }
}
