/* The selection composition, roster and viewport fit share one owner. */
.ship-count {
  margin-left: 16px;
  color: var(--selected-ship-color, var(--cyan));
  white-space: nowrap;
}

.selected-ship-trait {
  color: #b0c6dc;
  font: clamp(8px, 1.1vw, 11px)/1.7 var(--pixel-font);
}

.hangar-controls {
  display: grid;
  justify-items: center;
  gap: 20px;
}

.ship-choices {
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  gap: 10px;
  width: min(100%, 540px);
}

.ship-choice {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 44px;
  min-height: 64px;
  border: 2px solid #213751;
  padding: 4px;
  color: #b0c6dc;
  background: #091427;
  box-shadow: 0 4px 0 #01040d;
  cursor: pointer;
  touch-action: manipulation;
}

.ship-choice .ship-preview {
  width: 48px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.ship-choice span {
  font: 7px/1 var(--pixel-font);
}

.ship-choice[aria-pressed='true'] {
  border-color: var(--ship-color);
  color: var(--ship-color);
  background: #14283d;
  box-shadow: 0 4px 0 var(--ship-color);
}

.ship-choice:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .ship-choice:hover {
    border-color: var(--ship-color);
    transform: translateY(-3px);
  }
}

.ship-choice:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ship-color);
}

.ship-choice:disabled {
  cursor: default;
}

.ship-demo::before {
  content: '';
  position: absolute;
  inset: 0;
  border-inline: 2px solid #213751;
  pointer-events: none;
}

/* Compact layouts keep the full roster and Launch in the available cabinet. */
@media (max-width: 600px) {
  .hangar {
    gap: 12px;
    padding: 18px 12px 24px;
  }

  .hangar-heading {
    gap: 10px;
  }

  .ship-picker {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .ship-cycle {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }

  .ship-choices {
    gap: 5px;
  }

  .ship-choice {
    min-height: 56px;
    padding: 2px;
  }

  .ship-demo {
    --demo-travel: 28px;
  }

  .launch-button {
    width: min(280px, 82vw);
    min-height: 56px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .hangar {
    gap: 8px;
    padding: 8px 14px 16px;
  }

  .hangar-heading {
    gap: 3px;
  }

  .hangar h2 {
    font-size: 8px;
  }

  .selected-ship-name {
    font-size: clamp(12px, 3.5vh, 18px);
    line-height: 1.3;
  }

  .selected-ship-trait {
    font-size: 7px;
    line-height: 1.4;
  }

  .ship-picker {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 12px;
    max-width: 600px;
  }

  .ship-cycle {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }

  .hangar-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    width: min(100%, 680px);
    margin-inline: auto;
    align-items: center;
  }

  .ship-choices {
    gap: 5px;
  }

  .ship-choice {
    min-height: 44px;
    padding: 2px;
  }

  .ship-choice .ship-preview {
    width: 36px;
  }

  .ship-choice span {
    display: none;
  }

  .launch-button {
    width: 150px;
    min-height: 56px;
    padding: 10px 18px;
    font-size: 12px;
  }

  .ship-demo {
    --demo-travel: 58px;
  }

  .ship-demo-runner {
    bottom: 4px;
  }

  .ship-demo .ship-preview {
    width: calc(var(--demo-ship-width) * 0.65);
  }

  .ship-demo-shot {
    bottom: calc(var(--demo-shot-bottom) * 0.65);
  }
}
