/* The roster is a horizontal shelf. Information stays on the card; art never pushes it off-screen. */
#troops-view {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  padding: 4px 8px 8px;
  background:
    linear-gradient(120deg, #102f47ee, #173f4df5),
    url('art/training-camp.webp') center/cover;
}
.roster-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 8px 4px;
  color: #fff4d2;
}
.roster-heading h2 {
  font:
    32px/1 'Lilita One',
    sans-serif;
  margin: 3px 0 5px;
  color: #ffdf86;
  text-shadow: 0 3px #072233;
}
.roster-heading p {
  font-size: 15px;
  margin: 0;
  color: #d8ecea;
}
.roster-heading .eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
}
.roster-heading .deck-slots {
  display: flex;
  position: relative;
  gap: 3px;
  padding-bottom: 18px;
}
.roster-heading .deck-slots > span {
  width: 35px;
  height: 41px;
  display: block;
  border: 2px solid #d5b768;
  border-radius: 7px;
  overflow: hidden;
  background: #163446;
}
.roster-heading .deck-slots svg {
  width: 100%;
  height: 100%;
}
.roster-heading .deck-count {
  position: absolute;
  bottom: 0;
  right: 0;
  color: #dbd4ba;
  font-size: 11px;
}
#troops-view #troop-tabs {
  display: flex;
  flex-direction: row;
  flex: 0 0 44px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px;
  gap: 7px;
  scrollbar-width: none;
}
#troops-view #troop-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 6px 15px;
  font:
    17px 'Lilita One',
    sans-serif;
  border-radius: 12px 12px 5px 5px;
}
.roster-browse {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cce3e7;
  flex: 0 0 44px;
  font-size: 14px;
}
.roster-browse > span {
  flex: 1;
}
.roster-browse button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
  background: #24566b;
  color: #fff1b4;
  border: 1px solid #659297;
  border-radius: 12px;
}
#troops-view #troop-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 330px;
  grid-template-columns: none;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: 450px;
  margin: 0;
  gap: 14px;
  padding: 3px 3px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 3px;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: #b99a55 #163545;
}
.troop-dossier {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 14px;
  color: #243c4c;
  background: linear-gradient(130deg, #fffae8, #ecdcae);
  border: 2px solid #ddbf72;
  border-radius: 18px;
  box-shadow:
    0 4px #8e713b,
    inset 0 2px #fff6d9;
}
.roster-identity {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
}
.roster-portrait {
  height: 86px;
  position: relative;
  border: 3px solid #bc9446;
  border-radius: 13px;
  background: linear-gradient(130deg, var(--troop-color), #16354d);
  box-shadow: 0 3px #826331;
}
.roster-portrait > svg {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}
.roster-energy {
  position: absolute;
  bottom: -5px;
  left: -5px;
  display: grid;
  grid-template-columns: auto;
  min-width: 39px;
  text-align: center;
  padding: 2px 5px;
  background: linear-gradient(#75dbee, #258ec4);
  color: white;
  border: 2px solid #b2f6ff;
  border-radius: 9px;
  font:
    21px/1 'Lilita One',
    sans-serif;
  text-shadow: 0 2px #225e82;
  box-shadow: 0 2px #225e82;
}
.roster-energy small {
  font:
    8px/1.2 'Nunito',
    sans-serif;
  letter-spacing: 0.04em;
}
.roster-state {
  font-size: 11px;
  font-weight: 900;
  color: #48664c;
  letter-spacing: 0.04em;
}
.roster-identity h3 {
  font:
    27px/1.05 'Lilita One',
    sans-serif;
  color: #173e54;
  margin: 3px 0;
}
.roster-identity p {
  font-size: 14px;
  margin: 3px 0;
  color: #52616a;
}
.roster-level {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 14px;
}
.roster-level > span {
  display: flex;
  gap: 3px;
}
.roster-level i {
  width: 13px;
  height: 6px;
  background: #c9be99;
  border-radius: 2px;
}
.roster-level i.filled {
  background: #26826e;
  box-shadow: 0 1px #136151;
}
.roster-description {
  font-size: 15px;
  line-height: 1.3;
  margin: 0;
}
.roster-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 0;
  padding: 9px 0;
  border-top: 1px solid #d4c695;
  border-bottom: 1px solid #d4c695;
}
.roster-stats dt {
  font-size: 12px;
  font-weight: 800;
  color: #566358;
}
.roster-stats dd {
  margin: 3px 0 0;
  font:
    22px/1 'Lilita One',
    sans-serif;
  color: #244e58;
}
.roster-stats small {
  font:
    11px 'Nunito',
    sans-serif;
}
.roster-power {
  font-size: 14px;
  line-height: 1.3;
}
.roster-power strong {
  display: block;
  color: #194f58;
  font-size: 15px;
}
.roster-power p {
  margin: 4px 0;
}
.roster-power > span {
  color: #6b5945;
  font-size: 12px;
}
.roster-training {
  margin-top: auto;
  padding-left: 10px;
  border-left: 3px solid #bc9345;
  font-size: 14px;
}
.roster-training strong {
  color: #775419;
}
.roster-training p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.3;
}
.roster-actions {
  display: flex;
  gap: 7px;
}
.roster-actions button {
  flex: 1;
  min-height: 48px;
  padding: 6px;
  font:
    18px/1.1 'Lilita One',
    sans-serif;
  border-radius: 10px;
}
.roster-actions button span {
  display: block;
  font:
    12px/1.3 'Nunito',
    sans-serif;
  font-weight: 800;
}
.roster-actions button:disabled {
  opacity: 0.75;
}
@media (max-width: 600px) {
  #troops-view #troop-grid {
    grid-auto-columns: calc(100% - 20px);
  }
  .roster-heading .deck-slots {
    display: none;
  }
  .roster-heading {
    padding: 2px 3px;
  }
  .roster-heading h2 {
    font-size: 28px;
  }
  .roster-heading .eyebrow {
    display: none;
  }
}
@media (max-height: 760px) {
  #troops-view {
    gap: 3px;
    padding: 0 4px 5px;
  }
  .roster-heading {
    display: flex;
  }
  .roster-heading h2 {
    font-size: 24px;
    margin: 0;
  }
  .roster-heading p {
    font-size: 13px;
  }
  #troops-view #troop-tabs {
    flex-basis: 42px;
  }
  #troops-view #troop-tabs button {
    font-size: 16px;
    padding: 4px 10px;
  }
  .roster-browse {
    flex-basis: 26px;
    font-size: 12px;
    position: relative;
  }
  .roster-browse button {
    position: absolute;
    bottom: 0;
    right: 0;
    min-height: 44px;
    height: 44px;
    width: 44px;
    transform: translateY(7px);
    z-index: 1;
  }
  .roster-browse button:first-of-type {
    right: 50px;
  }
  .troop-dossier {
    padding: 9px;
    gap: 4px;
  }
  .roster-identity {
    grid-template-columns: 64px 1fr;
    gap: 10px;
  }
  .roster-portrait {
    height: 64px;
  }
  .roster-identity h3 {
    font-size: 23px;
    margin: 1px 0;
  }
  .roster-identity p {
    font-size: 12px;
    margin: 2px 0;
  }
  .roster-state {
    font-size: 10px;
  }
  .roster-energy {
    font-size: 18px;
    min-width: 34px;
  }
  .roster-description {
    font-size: 13px;
    line-height: 1.25;
  }
  .roster-stats {
    padding: 5px 0;
  }
  .roster-stats dd {
    font-size: 20px;
  }
  .roster-power {
    font-size: 13px;
    line-height: 1.2;
  }
  .roster-power strong {
    font-size: 14px;
  }
  .roster-power p {
    margin: 2px 0;
  }
  .roster-training p {
    font-size: 12px;
  }
  .roster-actions button {
    min-height: 44px;
    font-size: 16px;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  #troops-view {
    gap: 3px;
    display: flex;
    padding: 0 4px 4px;
    position: relative;
  }
  .roster-heading {
    padding: 0;
    height: 35px;
  }
  .roster-heading > div:first-child {
    display: flex;
    align-items: center;
    gap: 15px;
  }
  .roster-heading h2 {
    font-size: 25px;
    margin: 0;
  }
  .roster-heading .eyebrow,
  .roster-heading .deck-slots {
    display: none;
  }
  #troops-view #troop-tabs {
    flex-basis: 44px;
    padding-right: 110px;
  }
  .roster-browse {
    position: absolute;
    right: 5px;
    top: 36px;
    width: 96px;
  }
  .roster-browse > span {
    display: none;
  }
  #troops-view #troop-grid {
    grid-auto-columns: 760px;
    gap: 14px;
  }
  .troop-dossier {
    display: grid;
    grid-template-columns: 275px 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 6px 15px;
    padding: 10px;
  }
  .roster-identity {
    grid-column: 1;
    grid-row: 1/3;
    grid-template-columns: 72px 1fr;
    gap: 10px;
  }
  .roster-portrait {
    height: 80px;
  }
  .roster-identity h3 {
    font-size: 23px;
  }
  .roster-description {
    grid-column: 1;
    grid-row: 3;
    font-size: 13px;
  }
  .roster-stats {
    grid-column: 2;
    grid-row: 1;
    padding: 3px 0;
  }
  .roster-stats dd {
    font-size: 20px;
  }
  .roster-power {
    grid-column: 2;
    grid-row: 2/4;
    font-size: 13px;
    line-height: 1.15;
  }
  .roster-power strong {
    font-size: 14px;
  }
  .roster-power p {
    margin: 3px 0;
  }
  .roster-training {
    grid-column: 1;
    grid-row: 4;
    font-size: 13px;
    padding-left: 6px;
  }
  .roster-training p {
    font-size: 12px;
    line-height: 1.2;
  }
  .roster-actions {
    grid-column: 2;
    grid-row: 4;
    align-self: end;
  }
  .roster-actions button {
    min-height: 44px;
    font-size: 17px;
  }
}

@media (min-width: 601px) and (min-height: 501px) {
  .roster-heading {
    padding: 0 4px;
  }
  .roster-heading .eyebrow {
    display: none;
  }
  .roster-heading h2 {
    font-size: 28px;
  }
  .roster-heading .deck-slots {
    padding-bottom: 14px;
  }
  .roster-browse {
    flex-basis: 44px;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  .roster-heading h2 {
    font-size: 25px;
  }
  .roster-identity {
    grid-template-columns: 66px 1fr;
  }
  .roster-portrait {
    height: 72px;
  }
  .roster-description {
    line-height: 1.15;
  }
  .roster-training p {
    font-size: 12px;
  }
}
#troops-view {
  position: relative;
}
@media (max-width: 600px) and (max-height: 760px) {
  .roster-browse {
    position: absolute;
    top: 0;
    right: 4px;
    height: 44px;
    width: 94px;
  }
  .roster-browse > span {
    display: none;
  }
  .roster-browse button {
    transform: none;
    bottom: auto;
    top: 0;
  }
  .roster-heading {
    padding-right: 100px;
  }
}
@media (min-width: 601px) and (min-height: 501px) {
  .roster-browse {
    position: absolute;
    top: 57px;
    right: 8px;
  }
  .roster-browse > span {
    display: none;
  }
  #troops-view #troop-tabs {
    padding-right: 110px;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  .troop-dossier {
    padding: 8px;
    gap: 4px 15px;
  }
}
.roster-actions button.primary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
}
@media (min-width: 601px) and (min-height: 501px) {
  .roster-browse {
    top: 60px;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  #troops-view {
    padding-top: 0;
  }
  .roster-heading {
    position: absolute;
    top: 0;
    left: 4px;
    width: 225px;
    height: 44px;
  }
  .roster-heading > div:first-child {
    display: block;
  }
  .roster-heading h2 {
    font-size: 23px;
  }
  .roster-heading p {
    font-size: 12px;
  }
  #troops-view #troop-tabs {
    margin-left: 235px;
    width: calc(100% - 235px);
    padding-right: 104px;
    flex-shrink: 0;
  }
  .roster-browse {
    top: 0;
  }
}

.roster-stats.hybrid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.troop-dossier {
  align-self: start;
  max-height: 100%;
}
@media (max-width: 600px) {
  #troops-view #troop-grid {
    grid-auto-columns: min(330px, calc(100% - 20px));
  }
}
button.gem-balance {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 44px;
}
.recruit-heading {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  align-items: center;
}
.recruit-heading > svg {
  width: 82px;
  height: 95px;
  border: 3px solid #cfad57;
  border-radius: 14px;
  background: #244e65;
}
#modal .recruit-heading h2 {
  font-size: 30px;
  margin: 0 0 6px;
}
#modal .recruit-heading p {
  font-size: 15px;
  line-height: 1.3;
  margin: 0;
}
.recruit-price {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 10px;
  background: #d9f1e7;
  border: 1px solid #8cbba7;
  border-radius: 12px;
  color: #205164;
}
.recruit-price strong {
  font:
    32px 'Lilita One',
    sans-serif;
  white-space: nowrap;
}
.recruit-price span {
  font-size: 15px;
}
#recruit-error {
  color: #9d382a;
}
.gem-packs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 15px 0;
}
.gem-packs article {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: linear-gradient(#d4faff, #8bc6d7);
  border: 2px solid #7ba7b7;
  border-radius: 14px;
  padding: 12px 5px;
  color: #193e50;
}
.pack-gem {
  font:
    45px/1 'Lilita One',
    sans-serif;
  color: #0673b5;
  text-shadow: 0 2px #e6ffff;
}
.gem-packs h3 {
  font:
    22px/1.1 'Lilita One',
    sans-serif;
  margin: 0;
  text-align: center;
}
.gem-packs strong {
  font-size: 23px;
}
.gem-packs button {
  min-height: 44px;
  font-size: 12px;
  padding: 5px;
}
@media (max-height: 500px) and (min-width: 601px) {
  #modal[data-variant='recruit'] .modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
  }
  #modal[data-variant='recruit'] .eyebrow {
    display: none;
  }
  .recruit-heading {
    grid-column: 1;
    grid-row: 1/4;
    align-self: start;
    grid-template-columns: 72px 1fr;
  }
  .recruit-heading > svg {
    width: 72px;
    height: 85px;
  }
  #modal .recruit-heading h2 {
    font-size: 26px;
  }
  .recruit-price {
    grid-column: 2;
    margin: 0;
    padding: 6px;
  }
  #modal[data-variant='recruit'] .modal-body > p {
    grid-column: 2;
    font-size: 13px;
    margin: 0;
    line-height: 1.2;
  }
  #modal[data-variant='recruit'] .modal-actions {
    grid-column: 1/3;
    margin-top: 0;
  }
  #modal[data-variant='recruit'] #recruit-error:empty {
    display: none;
  }
  #modal[data-variant='gems'] .modal-body {
    display: grid;
    grid-template-columns: 36% 1fr;
    gap: 6px 16px;
  }
  #modal[data-variant='gems'] .eyebrow {
    display: none;
  }
  #modal[data-variant='gems'] h2 {
    grid-column: 1;
    grid-row: 1;
    font-size: 28px;
  }
  #modal[data-variant='gems'] .modal-body > p {
    grid-column: 1;
    grid-row: 2;
    font-size: 14px;
  }
  .gem-packs {
    grid-column: 2;
    grid-row: 1/3;
    margin: 0;
  }
  .gem-packs article {
    padding: 5px;
    gap: 4px;
  }
  .pack-gem {
    font-size: 28px;
  }
  .gem-packs h3 {
    font-size: 19px;
  }
  #modal[data-variant='gems'] .modal-actions {
    grid-column: 1/3;
    margin: 0;
  }
}
.battle-receipt {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 600px) {
  .battle-receipt b {
    font-size: 22px;
  }
}
@media (max-height: 500px) and (min-width: 601px) {
  #brief-rewards .level-recruits {
    float: left;
    width: 125px;
    margin-right: 14px;
  }
  #brief-rewards > p {
    margin-top: 0;
  }
}
