/* Compact Barracks-only sorting controls, matching the game's existing UI. */
#page-army .army-sort {
  display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end;
  gap:4px; padding:0; border:0; background:transparent;
}
#page-army .army-sort-label {
  display:none;
}
#page-army .army-sort button {
  min-height:24px; padding:4px 7px; background:#081d14;
  border:1px solid var(--line); color:var(--muted);
  font-size:.6rem; font-weight:750; line-height:1;
}
#page-army .army-sort button.active {
  color:var(--green); border-color:#31865b; background:#16402c;
}
#page-army .army-sort button:hover:not(.active) {
  color:var(--text); border-color:#367555;
}
@media(max-width:750px) {
  #page-army .army-sort { justify-content:flex-start; width:max-content; max-width:100%; margin-top:14px; }
  #page-army .army-sort button { padding:4px 7px; }
}

/* Two compact view modes sit beside the existing sort buttons. */
#page-army .army-tools { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:12px; }
#page-army .army-view { display:flex; align-items:center; gap:4px; }
#page-army .army-view button {
  min-height:24px; padding:4px 7px; background:#081d14; border:1px solid var(--line);
  color:var(--muted); font-size:.6rem; font-weight:750; line-height:1;
}
#page-army .army-view button.active { color:var(--green); border-color:#31865b; background:#16402c; }
#page-army .army-view button:hover:not(.active) { color:var(--text); border-color:#367555; }
/* Simple cards end after the description, with even row/card heights.
   Empty space is retained for cards with shorter descriptions. */
#unit-cards.army-simple { align-items:stretch; grid-auto-rows:1fr; }
#unit-cards.army-simple .unit-card { min-height:0; height:100%; box-sizing:border-box; }
#unit-cards.army-simple .unit-card .unit-lore { min-height:0; margin-bottom:0; }
#unit-cards.army-simple .unit-card .unit-stats,
#unit-cards.army-simple .unit-card .unit-secondary-stats,
#unit-cards.army-simple .unit-card .unit-ripper-chances,
#unit-cards.army-simple .unit-card .unit-implant-line,
#unit-cards.army-simple .unit-card .unit-ability-list,
#unit-cards.army-simple .unit-card .unit-progression { display:none; }
@media(max-width:750px) {
  #page-army .army-tools { justify-content:flex-start; gap:10px; margin-top:14px; }
  #page-army .army-sort { margin-top:0; }
}

/* COLLECTION: borderless visual roster, isolated from Simple/Detailed cards.
   Preview sprites and weapon geometry come from the existing skin renderer. */
#unit-cards.army-collection {
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:20px 16px;
  align-items:start;
  overflow:visible;
}
#unit-cards.army-collection .collection-unit {
  position:relative;
  overflow:visible !important;
  min-width:0;
  min-height:0;
  padding:0;
  margin:0;
  border:0;
  background:transparent;
  box-shadow:none;
  text-align:center;
}
#unit-cards.army-collection .collection-unit:hover,
#unit-cards.army-collection .collection-unit:focus-within { z-index:2; }
#unit-cards.army-collection .collection-unit-link {
  display:flex;
  flex-direction:column;
  align-items:center;
  width:100%;
  min-width:0;
  padding:0 3px 8px;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  cursor:pointer;
  text-align:center;
  overflow:visible;
}
#unit-cards.army-collection .collection-unit-link:disabled { cursor:default; }
#unit-cards.army-collection .collection-unit-link:focus-visible { outline:1px solid var(--green);outline-offset:4px; }
#unit-cards.army-collection .collection-unit .unit-mark,
#unit-cards.army-collection .collection-unit[data-unit-id="vampire"] .unit-mark {
  width:min(150px,100%);
  max-width:none;
  height:auto;
  aspect-ratio:1;
  margin:10px auto 14px;
  overflow:visible;
  flex:none;
}
#unit-cards.army-collection .collection-unit h2 {
  margin:0 0 5px;
  font-size:.77rem;
  line-height:1.2;
  overflow-wrap:anywhere;
}
#unit-cards.army-collection .collection-skin,
#unit-cards.army-collection .collection-pet {
  display:block;
  color:var(--green);
  font-weight:700;
  font-size:.61rem;
  line-height:1.3;
  overflow-wrap:anywhere;
}
#unit-cards.army-collection .collection-level {
  display:block;
  color:var(--gold);
  margin-top:6px;
  font-size:.62rem;
  font-weight:700;
}
@media(max-width:1500px) { #unit-cards.army-collection {grid-template-columns:repeat(5,minmax(0,1fr));} }
@media(max-width:1200px) { #unit-cards.army-collection {grid-template-columns:repeat(4,minmax(0,1fr));} }
@media(max-width:900px) { #unit-cards.army-collection {grid-template-columns:repeat(3,minmax(0,1fr));} }
@media(max-width:600px) { #unit-cards.army-collection {grid-template-columns:repeat(2,minmax(0,1fr));gap:22px 14px;} }

/* COLLECTION only: no rarity panels, and title colors match the main Barracks.
   The higher specificity also overrides legendary-units.css loaded later. */
#unit-cards.army-collection .unit-card.collection-unit,
#unit-cards.army-collection .unit-card.collection-unit.rarity-legendary,
#unit-cards.army-collection .unit-card.collection-unit.rarity-epic {
  background:transparent;
  border:0;
  box-shadow:none;
}
#unit-cards.army-collection .unit-card.collection-unit.rarity-common h2 { color:#c3ccc7; }
#unit-cards.army-collection .unit-card.collection-unit.rarity-uncommon h2 { color:#65e69c; }
#unit-cards.army-collection .unit-card.collection-unit.rarity-rare h2 { color:#79cdff; }
#unit-cards.army-collection .unit-card.collection-unit.rarity-epic h2 { color:#cf98ff; }
#unit-cards.army-collection .unit-card.collection-unit.rarity-legendary h2 { color:#ffc45c; }


/* Barracks previews only. Preserve all battlefield and cosmetic sprite geometry. */
/* Field Surgeon: slightly smaller, lower Surgeon Colt. Its idle sway remains intact. */
#unit-cards .unit-card[data-unit-id="field_surgeon"] .pawn-preview img.pawn-preview-weapon {
  scale: .86;
  translate: 0 8px;
}

/* Bombardier: enlarge the whole composition in Detailed/Simple Barracks.
   Oversized howitzer edges may clip at the card boundary by design. */
#unit-cards:not(.army-collection) .unit-card[data-unit-id="bombardier"] .unit-mark {
  width: min(270px, 100%);
}
/* Raise the operator's visual prominence and lower her toward the howitzer baseline. */
#unit-cards .unit-card[data-unit-id="bombardier"] .pawn-preview-artillery .pawn-preview-idle {
  left: -20%;
  top: 22%;
  width: 86%;
  height: 79%;
}
#unit-cards .unit-card[data-unit-id="bombardier"] .pawn-preview-artillery img.pawn-preview-howitzer {
  left: 40%;
  top: 13%;
  width: 85%;
  height: 81%;
}
