/* The ship bar along the bottom: a thumbnail of every ship type, how many, choose a group, buy */

.ships {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 2px;
  max-width: calc(100% - 32px);
  padding: 4px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--hud-text);
  font: 600 11px monospace;
  letter-spacing: 0.03em;
  z-index: 2;
}

/* the thumbnails, scrolled sideways when they do not all fit */
.shipbar-track {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.shipbar-track::-webkit-scrollbar {
  display: none;
}

/* ◀ ▶: shown only when the ships do not all fit */
.shipbar-scroll {
  flex: none;
  width: 20px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: 700 11px/1 monospace;
  cursor: pointer;
}

.shipbar-scroll[hidden] {
  display: none;
}

.shipbar-scroll:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(143, 208, 255, 0.12);
}

.shipbar-scroll:disabled {
  opacity: 0.3;
  cursor: default;
}

.shipbar-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shipbar-item {
  flex: none;
  display: grid;
  gap: 2px;
  padding: 3px 3px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.shipbar-item:hover {
  border-color: var(--panel-border);
}

.shipbar-item.is-chosen {
  border-color: var(--accent);
  background: rgba(143, 208, 255, 0.12);
}

.shipbar-pick {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hud-text);
  font: inherit;
  cursor: pointer;
}

.shipbar-item.is-chosen .shipbar-pick {
  color: var(--accent);
}

.shipbar-pick:focus-visible,
.shipbar-buy:focus-visible,
.shipbar-sell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shipbar-pic {
  display: block;
  border-radius: 4px;
}

.shipbar-name {
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

/* how many, and + (buy) */
.shipbar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.shipbar-count {
  min-width: 14px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.shipbar-buy,
.shipbar-sell {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  font: 700 12px/1 monospace;
  cursor: pointer;
}

.shipbar-buy:hover:not(:disabled),
.shipbar-sell:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.shipbar-buy:disabled,
.shipbar-sell:disabled {
  opacity: 0.3;
  cursor: default;
}

.shipbar-sep {
  flex: none;
  width: 1px;
  margin: 4px 3px;
  background: var(--panel-border);
}
