/* One tray stays in view above the facilities. Open the drawer to see the rest. */
.upgrade-section {
  --tile: 46px;
  min-height: 0;
  padding: 4px 13px 9px;
  background: #102333;
  border-block: 1px solid #405563;
}
#upgradeShelfToggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 30px;
  padding: 1px 2px 4px;
  text-align: left;
  color: #cedbdc;
  font-size: .8125rem;
  font-weight: 600;
}
#upgradeShelfToggle:focus-visible { outline: 2px solid #dfc58d; outline-offset: 0 }
.shelf-count {
  margin-left: auto;
  color: #a7b9c0;
  font-size: .75rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.shelf-chevron {
  margin: -3px 3px 0 1px;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
#upgradeShelfToggle[aria-expanded="true"] .shelf-chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}
#upgradeShelfToggle:disabled .shelf-chevron { visibility: hidden }
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--tile));
  grid-auto-rows: var(--tile);
  align-content: start;
  align-items: stretch;
  gap: 4px;
  max-height: var(--tile);
  overflow: hidden;
  padding: 0;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.upgrade-section.shelf-open .upgrade-grid {
  max-height: min(196px, 30vh);
  max-height: max(var(--tile), min(196px, 30svh));
  overflow-y: auto;
}
.upgrade-empty {
  grid-column: 1/-1;
  align-self: center;
  padding: 0 2px;
  margin: 0;
}
.upgrade-grid:has(.upgrade-empty) { grid-auto-rows: minmax(26px, auto) }
.upgrade-grid .upgrade, .tip-icon.upgrade-preview {
  border: 1px solid #526676;
  border-radius: 2px;
  background: #243847;
  box-shadow: inset 0 -2px #182936;
}
.upgrade-grid .upgrade {
  height: var(--tile);
  width: var(--tile);
  padding: 3px;
  transition: none;
}
.upgrade-grid .upgrade::before, .upgrade-grid .upgrade::after,
.tip-icon.upgrade-preview::before { content: none }
.upgrade-grid .upgrade.affordable {
  background: #2b414d;
  border-color: #9baaa7;
}
.upgrade-grid .upgrade[aria-disabled="true"] {
  opacity: .69;
  filter: saturate(.45);
  background: #172a38;
  border-color: #465867;
}
.upgrade-grid .upgrade:hover, .upgrade-grid .upgrade:focus-visible {
  border-color: #f2d192;
  box-shadow: inset 0 0 0 1px #f2d192;
}
.upgrade-emblem { filter: none }
.upgrade-part img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto }
.upgrade-emblem .tibo-face { box-shadow: none; border-color: #c7b891 }
.cursor-upgrade>svg { width: 85%; left: 5%; fill: #93d6eb; stroke: #162b39; stroke-width: 1.2 }
.upgrade-tier:not(:empty) {
  right: 1px;
  bottom: 1px;
  padding-inline: 2px;
  color: #e2e0cc;
  background: #192a36;
  font: 600 10px/1.05 "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  #upgradeShelfToggle { min-height: 38px }
}
