/* Inventory viewport: keep the item scrollbar and its final row inside the panel. */
.panel.inventory-panel.client-open:not(.inventory-minimized) {
  display: flex;
  flex-direction: column;
  height: min(620px, calc(100dvh - 16px));
  min-height: min(420px, calc(100dvh - 16px));
  overflow: hidden;
}

.inventory-panel.client-open .inventory-title,
.inventory-panel.client-open .inventory-section-label,
.inventory-panel.client-open .inventory-team-section,
.inventory-panel.client-open .source-note {
  flex: 0 0 auto;
}

.inventory-panel.client-open .loot-list {
  flex: 1 1 190px;
  min-height: 0;
  max-height: none;
  margin-bottom: 8px;
  padding: 9px 12px 16px 9px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scroll-padding-bottom: 16px;
  overscroll-behavior: contain;
}

/* Compact Pokémon detail while preserving every gameplay value and action. */
#app .inventory-panel.client-open .inventory-pokemon-detail {
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 6px 18px #0007;
}

#app .inventory-panel.client-open .inventory-pokemon-detail > #inventory-pokemon-detail-close {
  right: 6px;
  top: 6px;
  width: 21px;
  height: 21px;
  line-height: 18px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head {
  gap: 8px;
  min-height: 44px;
  padding-right: 24px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head canvas {
  width: 44px;
  height: 44px;
  border-radius: 7px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head > span {
  min-width: 0;
  gap: 1px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head small {
  font-size: 6px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head em {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  color: #8db0bb;
  font-size: 7px;
  line-height: 12px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head em .detail-level {
  color: #a9c0c7;
  font-weight: 800;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-head em .rarity-badge,
#app .inventory-panel.client-open .inventory-pokemon-detail-head em .compact-quality,
#app .inventory-panel.client-open .inventory-pokemon-detail-head em .compact-power {
  display: inline-flex;
  align-items: center;
  min-height: 12px;
  margin: 0;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 6px;
  line-height: 9px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-stats {
  gap: 4px;
  margin: 6px 0;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-stats span {
  min-height: 31px;
  padding: 4px 6px;
  font-size: 5px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail-stats b {
  margin-top: 1px;
  font-size: 8px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail .upgrade {
  min-height: 35px;
  padding: 5px 8px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail .upgrade small {
  font-size: 7px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail .inventory-cp-action {
  height: 27px;
  margin-top: 5px;
  font-size: 7px;
}

#app .inventory-panel.client-open .inventory-pokemon-detail > p {
  margin-top: 4px;
  font-size: 5px;
}

@media (max-height: 560px) {
  .panel.inventory-panel.client-open:not(.inventory-minimized) {
    min-height: calc(100dvh - 16px);
  }

  .inventory-panel.client-open .loot-list {
    flex-basis: 120px;
  }
}
