.breeding-modes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  margin: 0 0 1.25rem;
  overflow: hidden;
  gap: 0.25rem;
  padding: 0.3rem;
  border: 0;
  border-radius: 999px;
  background: #1b222d;
}

.breeding-mode {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #abb1ba;
  font-size: 0.82rem;
  font-weight: 700;
}

.breeding-mode + .breeding-mode {
  border-left: 0;
}

.breeding-mode.active {
  background: #101720;
  color: #d7e2f1;
  box-shadow: none;
}

.breeding-mode-descriptions {
  margin: -0.55rem 0 1.25rem;
  padding-inline: 0.65rem;
}

.breeding-mode-descriptions p {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
}

.breeding-mode-descriptions p::before {
  display: inline-grid;
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "i";
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.breeding-controls,
.breeding-results {
  border: 0;
  border-radius: 0.85rem;
  background: var(--surface-1);
  box-shadow: none;
}

.breeding-controls {
  padding: 1.6rem;
}

.breeding-controls label {
  display: block;
  margin-bottom: 0.55rem;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.breeding-field {
  position: relative;
}

.breeding-input.has-selected-pal:not(:focus) {
  color: transparent;
}

.breeding-selected-pal {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: calc(var(--bs-gutter-x) * 0.5 + 2.6rem);
  left: calc(var(--bs-gutter-x) * 0.5 + 1rem);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-50%);
}

.breeding-selected-pal[hidden] {
  display: none;
}

.breeding-field:focus-within .breeding-selected-pal {
  display: none;
}

.breeding-selected-pal .breeding-pal-portrait {
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
}

.breeding-selected-pal .breeding-pal-sprite {
  width: 1.85rem;
  height: 1.85rem;
}

.breeding-selected-identity,
.breeding-autocomplete-identity {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.35rem;
}

.breeding-selected-identity strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breeding-selected-identity span,
.breeding-autocomplete-identity span {
  flex: 0 0 auto;
  color: #737c89;
  font-size: 0.68rem;
  font-weight: 650;
}

.breeding-selected-identity .pal-id,
.breeding-autocomplete-identity .pal-id {
  color: #fff;
}

.breeding-autocomplete {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.3rem);
  right: calc(var(--bs-gutter-x) * 0.5);
  left: calc(var(--bs-gutter-x) * 0.5);
  max-height: 17rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--surface-3);
  box-shadow: 0 0.8rem 2rem rgb(0 0 0 / 0.45);
}

.breeding-autocomplete-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: #e9ecf1;
  font-size: 0.82rem;
  text-align: left;
}

.breeding-autocomplete-option:hover,
.breeding-autocomplete-option:focus-visible {
  outline: 0;
  background: #252d4d;
  color: #fff;
}

.breeding-autocomplete-option .breeding-pal-portrait {
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  background: transparent;
}

.breeding-autocomplete-option .breeding-pal-sprite {
  width: 2rem;
  height: 2rem;
}

.breeding-autocomplete-identity strong {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breeding-autocomplete-empty {
  margin: 0;
  padding: 0.7rem;
  color: #7f8792;
  font-size: 0.8rem;
  text-align: center;
}

.breeding-favorites {
  padding-top: 0.4rem;
}

.breeding-favorites h2 {
  margin: 0 0 0.65rem;
  color: #b8bec8;
  font-size: 0.78rem;
  font-weight: 700;
}

.favorite-pals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.65rem;
}

.favorite-pal {
  display: grid;
  place-items: center;
  align-content: start;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.65rem 0.35rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--surface-2);
  color: #fff;
}

.favorite-pal:hover,
.favorite-pal:focus-visible {
  outline: 0;
  background: var(--surface-3);
  transform: translateY(-1px);
}

.favorite-pal .breeding-pal-portrait {
  width: 3.75rem;
  height: 3.75rem;
}

.favorite-pal .breeding-pal-sprite {
  width: 3.4rem;
  height: 3.4rem;
}

.favorite-pal > span:last-child {
  width: 100%;
  overflow: hidden;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breeding-results {
  min-height: 10rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
}

.breeding-empty {
  display: grid;
  min-height: 8rem;
  place-items: center;
  align-content: center;
  gap: 0.65rem;
  color: #7c838f;
  text-align: center;
}

.breeding-empty > span {
  color: #444b59;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.breeding-empty p {
  margin: 0;
}

.breeding-result-list {
  display: grid;
  gap: 0.75rem;
}

.breeding-result-list > h1,
.breeding-results-heading h1 {
  margin: 0 0 0.45rem;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.breeding-results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.breeding-results-heading > span {
  color: #838b97;
  font-size: 0.76rem;
}

.child-result-list {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 20rem));
  justify-content: center;
}

.child-result-list > h1 {
  grid-column: 1 / -1;
  text-align: center;
}

.breeding-combination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.breeding-combination.parent-pair .breeding-pal-chip,
.breeding-offspring-combination .breeding-pal-chip,
.breeding-pal-child {
  min-height: 4.75rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.7rem;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.025), transparent 60%),
    var(--surface-2);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.02);
}

.breeding-pal-child {
  border-color: transparent;
  background: var(--surface-3);
}

.breeding-child-only {
  min-height: 5rem;
  padding: 0.85rem 1rem;
}

.breeding-pal-chip {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.65rem;
}

.breeding-pal-portrait {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 3rem;
  height: 3rem;
  overflow: hidden;
  border: 2px solid var(--pal-element-color, #71808e);
  border-radius: 50%;
  background: #191d22;
  color: #9ba3ae;
  font-weight: 800;
}

.breeding-pal-sprite {
  width: 2.7rem;
  height: 2.7rem;
  background-repeat: no-repeat;
}

.breeding-child-only .breeding-pal-portrait {
  width: 3.75rem;
  height: 3.75rem;
}

.breeding-child-only .breeding-pal-sprite {
  width: 3.4rem;
  height: 3.4rem;
}

.breeding-pal-chip > div:last-child {
  display: grid;
  min-width: 0;
}

.breeding-pal-chip strong {
  overflow: hidden;
  color: #fff;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breeding-pal-chip > div:last-child > span {
  color: #fff;
  font-size: 0.67rem;
  font-weight: 700;
}

.breeding-pal-chip > div:last-child > span.breeding-power-badge {
  justify-self: start;
  margin-top: 0.18rem;
  padding: 0.12rem 0.38rem;
  border: 0;
  border-radius: 999px;
  background: #1b222d;
  color: var(--text-soft);
  font-size: 0.62rem;
  line-height: 1.2;
}

.breeding-pal-chip small {
  color: #a8b7ef;
  font-size: 0.65rem;
}

.breeding-operator {
  color: #77808d;
  font-size: 1.25rem;
  font-weight: 700;
}

.breeding-plus {
  color: var(--accent-green);
  font-size: 2rem;
  line-height: 1;
  text-shadow: 0 0 0.6rem rgb(84 226 149 / 0.45);
}

.breeding-offspring-combination {
  grid-template-columns:
    minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
}

.breeding-produces {
  color: #aebdff;
  font-size: 1.4rem;
}

.breeding-offspring-child {
  border-color: transparent !important;
  background: var(--surface-3) !important;
}

.breeding-show-more {
  justify-self: center;
  margin-top: 0.5rem;
}

.mutation-normal-result {
  display: grid;
  grid-template-columns: auto repeat(auto-fit, minmax(14rem, 20rem));
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 0.7rem;
  background: var(--surface-2);
}

.mutation-normal-result > strong {
  color: var(--text-soft);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.mutation-normal-result .breeding-pal-chip {
  min-height: 4.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.65rem;
  background: transparent;
}

.mutation-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.mutation-outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.75rem;
}

.mutation-outcome-card {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.8rem;
  border-radius: 0.7rem;
  background: var(--surface-2);
}

.mutation-outcome-card .breeding-pal-chip {
  min-width: 0;
  background: transparent;
  box-shadow: none;
}

.mutation-outcome-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.mutation-outcome-card > p strong {
  color: var(--text-soft);
}

.reverse-mutation-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(11rem, auto);
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: 0.7rem;
  background: var(--surface-2);
}

.reverse-mutation-pair .breeding-pal-chip {
  min-width: 0;
}

.reverse-mutation-pair > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.reverse-mutation-pair > p strong {
  color: var(--text-soft);
}

@media (max-width: 767.98px) {
  .breeding-controls,
  .breeding-results {
    padding: 1rem;
  }

  .breeding-mode {
    padding-inline: 0.45rem;
    font-size: 0.72rem;
  }

  .breeding-modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 0.85rem;
  }

  .breeding-mode-descriptions { margin-top: -0.45rem; }

  .mutation-normal-result {
    grid-template-columns: 1fr;
  }

  .reverse-mutation-pair {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .reverse-mutation-pair > p {
    grid-column: 1 / -1;
    text-align: center;
  }

  .breeding-offspring-combination {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .breeding-produces,
  .breeding-offspring-child {
    grid-column: 1 / -1;
  }

  .breeding-produces {
    justify-self: center;
    transform: rotate(90deg);
  }

  .breeding-selected-parent,
  .breeding-partner {
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0.35rem !important;
    text-align: center;
  }

  .breeding-selected-parent .breeding-pal-portrait,
  .breeding-partner .breeding-pal-portrait {
    width: 2.5rem;
    height: 2.5rem;
  }

  .breeding-selected-parent .breeding-pal-sprite,
  .breeding-partner .breeding-pal-sprite {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .favorite-pals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
