.Trade {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 0.25rem;
  font-size: 0.75em;
  /* allow the Trade component to stretch to its sidebar/container */
  align-self: stretch;
  width: 100%;
  flex-direction: column;
}

.Trade > * {
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  /* fill the available width of the sidebar rather than using a fixed size */
  width: 100%;
  max-width: 100%;
  display: flex;
  padding: 0.5em;
  flex-direction: column;
  box-sizing: border-box;
}

.Trade .Title {
  align-self: center;
  padding: 2px;
  font-weight: bold;
}

.Trade .TradeList {
  padding: 0;
  background-color:rgba(224, 224, 224);
  margin: 0.25rem 0;
  font-size: 1.2em;
}

.Trade .Resource {
  display: inline-flex;
  align-items: center;
  justify-content: space-around;
  width: 3.75em; /* 5x7 aspect ratio */
  height: 3.75em;
  min-width: 3.75em; /* 5x7 aspect ratio */
  min-height: 3.75em;
  margin: 0 0.5em;
  background-size: 130%;
  border: 2px solid #ccc;
  border-radius: 0.25em;
  
}

.Trade b {
  margin-left: 0.25em;
  margin-right: 0.25em;
}

.Trade .Direction {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  height: 2em;
  width: 2em;
  line-height: 2em;
}

.Trade .Resource:hover {
  filter: none;
}

.Trade .Transfer {
  pointer-events: none;
}

.Trade .Transfer .Resource:hover {
  filter: brightness(125%);
}

.Trade .Resource > div.Right {
  user-select: none;
  position: absolute;
  top: -0.75em;
  right: -0.75em;
  border-radius: 50%;
  border: 1px solid white;
  background-color: rgb(36, 148, 46);
  font-size: 1em;
  width: 1.5em;
  height: 1.5em;
  text-align: center;
  line-height: 1.5em;
}

.Trade .Resource > div.Left {
  user-select: none;
  position: absolute;
  bottom: -0.75em;
  left: -0.75em;
  border-radius: 50%;
  border: 1px solid white;
  background-color: #444;
  font-size: 1em;
  width: 1.5em;
  height: 1.5em;
  text-align: center;
  line-height: 1.5em;
}


.Trade .PlayerColor {
  align-self: center;
  width: 0.75em;
  height: 0.75em;
}

.Trade .Transfer {
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.Trade .Transfers {
  font-size: 0.75em;
  display: flex;
  flex-direction: row;
  justify-items: flex-start;
  margin: 0.5rem 0;
  justify-content: center;
}

.Trade .Transfers .GiveGet {
  display: flex;
  position: relative;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  font-weight: bold;
  font-size: 1em;
  margin: 0 0.5em;
  min-width: 3em;
}

.Trade .OfferButton {
  margin: 0 0 0.75em 0;
}

.Trade .Transfers .GiveGet div:nth-child(1) {
  position: absolute;
  top: -0.5em;
  border: 1px solid #888;
  background-color: rgb(36, 148, 46);
  color: white;
  border-radius: 0.25em;
  min-width: 2.5em;
  text-align: center;
  padding: 0.25em;
}

.Trade .Transfers .GiveGet div:nth-child(2) {
  position: absolute;
  top: 5.5em;
  border: 1px solid #888;
  background-color: rgb(36, 148, 46);
  color: white;
  border-radius: 0.25em;
  min-width: 2.5em;
  text-align: center;
  padding: 0.25em;
}

.Trade .Transfers .GiveGet div:last-child {
  position: absolute;
  border: 1px solid #888;
  background-color: #444;
  color: white;
  font-size: 1em;
  border-radius: 0.25em;
  padding: 0.25em;
  bottom: 0.125em;
}

.Trade .TradeLine {
  width: 100%;
  user-select: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 1;
  padding: 0.25rem;
  border-bottom: 1px solid #ccc;
  min-height: fit-content;
  box-sizing: border-box;
}

.Trade .TradeLine:last-child {
  border-bottom: none;
}

.Trade .TradeLine .TradeText {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  padding: 0.25em 0;
}

.Trade .TradeText > span {
  display: inline-flex;
  align-items: center;
  margin-right: 0.25em;
  width: 100%;
  flex-wrap: wrap;
}

.Trade .TradeLine .Resource {
  height: 1.5em;
  width: 1.5em;
  min-width: 1.5em;
  min-height: 1.5em;
}

.Trade .TradeLine .Resource > div {
  font-size: 0.75em;
  width: 1em;
  height: 1em;
  line-height: 1em;
}

.Trade .TradeLine .TradeActions {
  flex-grow: 1;
  display: inline-flex;
  justify-content: flex-end;
}

.Trade .TradeLine .TradeActions > * {
  margin-left: 0.5em;
  font-size: 0.75em;
}