.trade-panel {
  container-type: inline-size;
}

.trade-entry .trade-code-input {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  max-width: 12rem;
  margin-bottom: 1rem;
}

.trade-code {
  text-align: center;
  margin-bottom: 1rem;
}

.trade-code__value {
  letter-spacing: 0.4em;
  font-size: 1.4em;
}

.trade-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@container (max-width: 40rem) {
  .trade-sides {
    grid-template-columns: 1fr;
  }
}

.trade-side {
  border: 4px solid currentColor;
  padding: 0.75rem;
  text-align: center;
}

.trade-side__name {
  font-size: 0.8em;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.trade-side__cap {
  font-size: 0.65em;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.trade-picker__capped {
  font-size: 0.65em;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.trade-slot {
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.trade-slot__empty {
  opacity: 0.6;
  font-size: 0.7em;
}

.trade-side__status {
  font-size: 0.7em;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.trade-side__status.is-accepted {
  color: #92cc41;
  opacity: 1;
}

.trade-actions {
  margin-top: 1rem;
  text-align: center;
}

.trade-actions__form {
  display: inline-block;
}

.trade-actions__blocker {
  font-size: 0.7em;
  opacity: 0.7;
}

.trade-picker {
  margin-top: 1rem;
}

.trade-picker__title {
  font-size: 0.8em;
  margin-bottom: 0.5rem;
}

.trade-picker__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.trade-picker__query {
  flex: 1 1 auto;
  min-width: 0;
}

.trade-picker__clear {
  flex: 0 0 auto;
}

/* A full storage is 128 Pokémon — scroll the list instead of the page. */
.trade-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 20rem;
  overflow-y: auto;
}

.trade-picker__form {
  display: contents;
}

.trade-picker__choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem;
  background: transparent;
  border: 4px solid rgba(255, 255, 255, 0.3);
  color: inherit;
  cursor: pointer;
  font-size: 0.6em;
  width: 7rem;
}

/* The display: flex above would otherwise beat the UA's [hidden] rule. */
.trade-picker__choice[hidden] {
  display: none;
}

.trade-picker__choice:hover {
  border-color: #f7d51d;
}

.trade-picker__choice.is-offered {
  border-color: #92cc41;
}

.trade-picker__empty {
  font-size: 0.7em;
  opacity: 0.7;
}

.trade-exit {
  margin-top: 1rem;
  text-align: center;
}

/* Result screen. The sprites slide in from their owners' sides — a stand-in
   until the full trade animation lands. */
.trade-result__sprites {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.7em;
}

.trade-result__arrows {
  font-size: 2em;
}

.trade-result__sprite {
  animation: trade-slide-in 600ms ease-out both;
}

.trade-result__sprite--received {
  animation-delay: 200ms;
}

@keyframes trade-slide-in {
  from {
    opacity: 0;
    transform: translateX(-2rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trade-result__sprite {
    animation: none;
  }
}
