/* 42 px tiles with 4 px gaps: hunt-notifications.js measures rows of 46 px. */
.hunt-notifications {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hunt-notifications[hidden],
.hunt-notification-rail[hidden] {
  display: none;
}

.hunt-notification-rail {
  position: absolute;
}

/* Left column: recent rare finds, then the passing Pokédollars. */
.hunt-notification-loot-rail {
  top: var(--hunt-loot-offset, 0px);
  right: calc(100% + 7px);
  width: 42px;
}

/* Below the card: the log button opens a single line of captures. */
.hunt-notification-capture-rail {
  top: calc(100% + 7px);
  right: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 42px;
  gap: 4px;
}

.hunt-notification-capture-rail[data-placement="above"] {
  top: auto;
  bottom: calc(100% + 7px);
}

.hunt-notification-list {
  min-width: 0;
  display: grid;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Its items continue the rail's own grid, right after the log button. */
.hunt-notification-capture-rail .hunt-notification-capture-list {
  display: contents;
}

.hunt-notification-entry {
  min-width: 0;
  height: 42px;
  animation: hunt-notification-appear 180ms ease-out both;
}

.hunt-notification-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 1px;
  overflow: hidden;
  border: 1px solid #9b7845;
  border-radius: 0;
  background: #1b1d18d6;
  color: #f2e9ce;
}

button.hunt-notification-tile,
button.hunt-notification-overflow,
.hunt-notification-special .hunt-notification-tile {
  pointer-events: auto;
}

button.hunt-notification-tile {
  cursor: pointer;
}

.hunt-notification-entry > button.hunt-notification-tile:hover {
  background: color-mix(in srgb, var(--notification-color) 18%, #20201c);
  border-color: var(--notification-color);
}

button.hunt-notification-tile:focus-visible,
button.hunt-notification-overflow:focus-visible {
  outline: 2px solid #f6d979;
  outline-offset: 2px;
}

.hunt-notification-icon {
  display: block;
  width: min(32px, 83%);
  height: min(32px, 83%);
  object-fit: contain;
  image-rendering: pixelated;
}

.hunt-notification-fallback {
  width: 20px;
  height: 20px;
  color: #d7c291;
}

.hunt-notification-value {
  position: absolute;
  right: 1px;
  bottom: 0;
  min-width: 12px;
  padding: 0 2px;
  background: #111510e8;
  color: #f6de9d;
  font: 800 10px/1.2 var(--font-ui, "Barlow", sans-serif);
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-shadow: 0 1px #000;
}

/* Rare finds stay longer than the coins and read stronger. */
.hunt-notification-special .hunt-notification-tile {
  border-color: #e2b755;
  background: #33290fd6;
}

.hunt-notification-special.stone .hunt-notification-tile {
  border-color: #8fb9ea;
  background: #1a2a40d6;
}

.hunt-notification-special.gained {
  animation: hunt-special-gained 900ms ease-out;
}

.hunt-notification-special.leaving {
  animation: hunt-notification-leave 500ms ease-in forwards;
}

.hunt-notification-loot.currency .hunt-notification-tile {
  border-color: #6d6040;
  background: #14140fd6;
}

/* Coins fade on their own during the last moments of their 6 s. */
.hunt-notification-loot {
  animation:
    hunt-notification-appear 180ms ease-out both,
    hunt-notification-leave 500ms 5.5s ease-in forwards;
}

/* Log button: a raised pixel key with stepped corners, so it never reads as
   one of the capture tiles. Two layers draw the dark rim and the relief. */
button.hunt-capture-log-button {
  overflow: visible;
  border: 0;
  background: transparent;
  isolation: isolate;
}

.hunt-capture-log-button::before,
.hunt-capture-log-button::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(
    2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px,
    100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px),
    calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px),
    0 calc(100% - 2px), 0 2px, 2px 2px
  );
}

.hunt-capture-log-button::before {
  inset: 0;
  background: #060b13;
}

.hunt-capture-log-button::after {
  inset: 2px;
  border: 2px solid;
  border-color: #8fa9cb #46618a #46618a #8fa9cb;
  background: #28405f;
}

.hunt-capture-log-button > img {
  display: block;
  image-rendering: pixelated;
}

/* The counter sits on the key's top corner, over the ball. */
.hunt-capture-log-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 15px;
  padding: 1px 3px;
  border: 1px solid #5b78a0;
  background: #060b13;
  color: #d6e2f2;
  font: 800 9px/1.1 var(--font-ui, "Barlow", sans-serif);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

button.hunt-capture-log-button:is(:hover, :focus-visible) {
  background: transparent;
}

.hunt-capture-log-button:is(:hover, :focus-visible)::after {
  border-color: #c3d6ef #4f6c96 #4f6c96 #c3d6ef;
  background: #38567e;
}

.hunt-capture-log-button:active::after {
  border-color: #46618a #8fa9cb #8fa9cb #46618a;
}

.hunt-capture-log-button:active > img {
  translate: 0 1px;
}

.hunt-notification-capture,
.hunt-notification-best {
  --notification-color: #7dc77a;
}

:is(.hunt-notification-capture, .hunt-notification-best)
  .hunt-notification-tile {
  border-color: var(--notification-color);
  background: color-mix(in srgb, var(--notification-color) 12%, #161a16d6);
}

:is(.hunt-notification-capture, .hunt-notification-best)
  .hunt-notification-iv {
  color: var(--notification-color);
}

.hunt-notification-best .hunt-notification-tile {
  background: color-mix(in srgb, var(--notification-color) 20%, #12161ad6);
}

.hunt-notification-capture.pending .hunt-notification-tile {
  border-color: #b1a080;
  background: #282820d6;
  animation: hunt-capture-pending 700ms ease-in-out infinite;
}

.hunt-notification-capture.pending,
.hunt-notification-capture.resolved {
  animation: none;
}

/* Escapes and outranked captures fade in the last moments of their life. */
.hunt-notification-capture.settled {
  animation: hunt-notification-leave 450ms
    calc(var(--hunt-notification-life, 4s) - 450ms) ease-in forwards;
}

.hunt-notification-best {
  animation: none;
}

.hunt-notification-best.landed .hunt-notification-tile {
  animation: hunt-capture-landed 1100ms ease-out;
}

.hunt-notification-entry.tier-weak {
  --notification-color: #a7a7a7;
}
.hunt-notification-entry.tier-common {
  --notification-color: #7dc77a;
}
.hunt-notification-entry.tier-uncommon {
  --notification-color: #5ed7b9;
}
.hunt-notification-entry.tier-rare {
  --notification-color: #69b7ff;
}
.hunt-notification-entry.tier-epic {
  --notification-color: #d985ff;
}
.hunt-notification-entry.tier-legendary {
  --notification-color: #f1c644;
}
.hunt-notification-entry.tier-mythic {
  --notification-color: #ff6680;
}
.hunt-notification-entry.tier-ancient {
  --notification-color: #ff9800;
}
.hunt-notification-entry.tier-divine {
  --notification-color: #00bcd4;
}

.hunt-notification-capture.failed .hunt-notification-tile {
  border-color: #746b60;
  background: #11120fd6;
}

.hunt-notification-capture.failed .hunt-notification-icon {
  filter: grayscale(1) brightness(0.52);
}

.hunt-notification-failure {
  position: absolute;
  top: -3px;
  right: 1px;
  color: #cf867c;
  font: 700 17px/1 var(--font-ui, "Barlow", sans-serif);
  text-shadow: 0 1px 2px #000;
}

.hunt-notification-overflow {
  width: 100%;
  margin-top: 4px;
  padding: 3px 2px;
  border: 1px solid #6d6040;
  background: #14140fd6;
  color: #f4cb79;
  font: 700 12px/1 var(--font-display, "Pixelify Sans", sans-serif);
  text-align: center;
  text-shadow: 0 1px 2px #000;
  cursor: pointer;
}

.hunt-notification-overflow[hidden] {
  display: none;
}

.hunt-notification-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes hunt-notification-appear {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hunt-notification-leave {
  to {
    opacity: 0;
    transform: translateX(-6px);
  }
}

@keyframes hunt-special-gained {
  0% {
    transform: scale(0.8);
    filter: brightness(2);
  }
  35% {
    transform: scale(1.14);
    filter: brightness(1.6);
  }
  100% {
    transform: none;
    filter: none;
  }
}

@keyframes hunt-capture-landed {
  0%,
  45% {
    filter: brightness(1.35);
  }
  100% {
    filter: none;
  }
}

@keyframes hunt-capture-pending {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hunt-notification-entry,
  .hunt-notification-special:is(.gained, .leaving),
  .hunt-notification-capture.settled,
  .hunt-notification-best.landed .hunt-notification-tile,
  .hunt-notification-capture.pending .hunt-notification-tile {
    animation: none;
  }
}

.hunt-notification-variants {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  gap: 0;
  padding: 0 1px;
  background: #10252be6;
  pointer-events: none;
}
