.battle-entry,
.battle-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #867048a8;
  border-radius: 3px;
  background: linear-gradient(#382f20, #2b2419);
  color: #e6cc9e;
  font: inherit;
  cursor: pointer;
}

.battle-entry { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.battle-entry [data-icon] { display: grid; width: 16px; height: 16px; }
.battle-entry svg, .battle-button svg { width: 100%; height: 100%; }
.battle-entry:hover, .battle-button:hover, .battle-button[aria-pressed="true"] { border-color: #d8b270; background: #4a3c28; color: #ffebc7; }
.battle-entry:disabled, .battle-button:disabled { opacity: .6; cursor: default; }
.battle-overlay[hidden], .battle-overlay [hidden] { display: none !important; }

.battle-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: none;
  color: #ebdbc0;
  background: #424b38;
  font-size: 13px;
}

.battle-overlay::backdrop { background: #201d17; }
#battle-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#battle-canvas:active { cursor: grabbing; }
.battle-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(#1717128f 0%, transparent 22%, transparent 72%, #18160fa8 100%);
}

.battle-header {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 22px;
  right: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}
.battle-heading { display: flex; align-items: center; gap: 10px; text-shadow: 0 2px 4px #17120e; }
.battle-heading > span { display: block; width: 22px; height: 25px; color: #d2ad73; }
.battle-heading svg { width: 100%; height: 100%; }
.battle-heading h2 { margin: 0; color: #f4e4c5; font-size: clamp(20px, 2.12vw, 34px); font-weight: 700; letter-spacing: .16em; white-space: nowrap; }
.battle-time {
  display: grid;
  justify-items: center;
  min-width: 79px;
  padding: 7px 11px;
  border: 1px solid #b3945d95;
  border-radius: 3px;
  background: #251f17e3;
  box-shadow: 0 4px 16px #1b170e48;
  color: #f6deb0;
  font: 700 21px Georgia, serif;
  font-variant-numeric: tabular-nums;
}
#battle-compatibility { font: 10px system-ui, sans-serif; color: #c3b298; }
#battle-exit { justify-self: end; min-width: 93px; }

.battle-rosters {
  position: absolute;
  z-index: 1;
  inset: 78px 22px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.battle-army {
  --army-color: #a4c6c6;
  width: min(236px, 22vw);
  border: 1px solid #9a81585c;
  border-radius: 3px;
  background: #221e17e8;
  box-shadow: 0 6px 15px #1c170f54;
  pointer-events: auto;
}
.battle-army-b { --army-color: #e6a082; }
.battle-army header { display: grid; gap: 3px; padding: 12px 11px 10px; border-bottom: 1px solid #7a674455; }
.battle-army h3 { margin: 0; color: var(--army-color); font-size: 14px; letter-spacing: .08em; }
.battle-army-total { color: #f4ddae; font: 700 20px Georgia, serif; font-variant-numeric: tabular-nums; }
.battle-army-models { color: #ccbda2; font-size: 11px; }
.battle-companies { display: grid; gap: 0; }
.battle-company {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 7px;
  row-gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 8px 8px 6px;
  text-align: left;
  border: none;
  border-bottom: 1px solid #7a68463d;
  color: #eadbc0;
  background: #2c261b65;
  font: inherit;
  cursor: pointer;
}
.battle-company:last-child { border-bottom: 0; }
.battle-company:hover,
.battle-company[aria-pressed="true"] { background: #51432d; }
.battle-company.is-target { background: #51352b; }
.battle-company.is-defeated { opacity: .42; cursor: default; }
.battle-company-summary, .battle-company-readout { display: grid; min-width: 0; gap: 2px; }
.battle-company-summary strong, .battle-company-hero { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.battle-company-hero { font-size: 11px; color: #ccbda5; }
.battle-company-insignia {
  display: grid;
  place-content: center;
  width: 25px;
  height: 28px;
  color: #f8e4c2;
  border: 1px solid var(--company-color);
  border-radius: 2px;
  background: color-mix(in srgb, var(--company-color) 25%, #272116);
  font-size: 11px;
}
.battle-company-readout { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; }
.battle-company-type, .battle-company-count { color: #d4c19e; font-size: 11px; }
.battle-company-count { justify-self: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.battle-company-bar { grid-column: 1 / -1; height: 2px; background: #1b180f; min-width: 0; }
.battle-company-bar::before {
  content: "";
  display: block;
  height: 100%;
  transform: scaleX(var(--company-health, 1));
  transform-origin: left;
  background: var(--company-color);
}

.battle-camera {
  display: flex;
  position: absolute;
  z-index: 2;
  right: 22px;
  bottom: 113px;
  gap: 4px;
}
.battle-view { display: grid; place-items: center; width: 35px; aspect-ratio: 1; min-height: 0; padding: 7px; }
.battle-focus {
  min-height: 0;
  min-width: 80px;
  padding-inline: 9px;
  font-size: 12px;
  white-space: nowrap;
}
.battle-orders {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  z-index: 2;
  left: 22px;
  right: 22px;
  bottom: 18px;
  min-height: 70px;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid #a587505e;
  border-radius: 3px;
  box-shadow: 0 4px 18px #12110a7f;
  background: #292218ed;
}
.battle-orders-copy { flex: 1 1 150px; display: grid; gap: 5px; }
#battle-status { color: #d6c6ab; font-size: 12px; }
#battle-result { color: #f0c886; font-size: 16px; letter-spacing: .06em; }
.battle-actions, #battle-playback, .battle-setup, #battle-strength-form, .battle-presets {
  display: flex;
  align-items: center;
  gap: 6px;
}
.battle-setup {
  border-inline: 1px solid #92734652;
  padding-inline: 11px;
}
.battle-setup label, .battle-presets > span { color: #c9b58f; white-space: nowrap; font-size: 11px; }
.battle-setup input {
  min-width: 64px;
  width: 75px;
  height: 35px;
  padding: 4px 6px;
  border: 1px solid #a4895875;
  border-radius: 2px;
  color: #f7dfb3;
  background: #221b13;
  font: 13px system-ui, sans-serif;
}
.battle-actions .battle-button, .battle-setup .battle-button { white-space: nowrap; }
.battle-primary {
  border-color: #e3b879;
  background: #d4ae74;
  color: #272015;
  font-weight: 800;
}
.battle-primary:hover { background: #f1c88e; color: #272015; }

@media (max-width: 1040px), (max-height: 670px) {
  .battle-orders { flex-wrap: wrap; min-height: 54px; }
  .battle-company { padding-block: 5px 4px; }
  .battle-army header { padding-block: 8px 6px; }
  .battle-company-insignia { height: 23px; }
}

@media (max-width: 740px) {
  .battle-header { top: 8px; left: 9px; right: 9px; gap: 6px; }
  .battle-heading { gap: 5px; }
  .battle-heading > span { display: none; }
  .battle-heading h2 { font-size: 18px; letter-spacing: .05em; }
  .battle-time { font-size: 18px; }
  #battle-exit { min-width: 0; font-size: 12px; }
  .battle-entry { min-height: 34px; padding: 0 7px; font-size: 10px; }
  .battle-entry [data-icon] { display: none; }
  .battle-rosters { inset: auto 9px clamp(127px, 18vh, 162px); gap: 8px; }
  .battle-army { width: 50%; min-width: 0; }
  .battle-army header { grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; padding: 6px; }
  .battle-army h3 { white-space: nowrap; font-size: 10px; letter-spacing: 0; }
  .battle-army-total { font-size: 12px; }
  .battle-army-models { grid-column: 1 / -1; font-size: 9px; }
  .battle-companies { display: flex; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .battle-company { flex: 0 0 127px; border-right: 1px solid #7a684655; padding-inline: 6px; }
  .battle-company strong, .battle-company-type, .battle-company-count { font-size: 10px; }
  .battle-company-hero { font-size: 9px; }
  .battle-camera { right: 9px; top: 72px; bottom: auto; }
  .battle-camera .battle-view { width: 30px; padding: 5px; }
  .battle-camera .battle-focus { min-width: 76px; font-size: 11px; }
  .battle-orders { left: 9px; right: 9px; bottom: 9px; gap: 7px; padding: 7px; }
  .battle-orders-copy { flex-basis: 100%; }
  .battle-setup { flex-wrap: wrap; padding-inline: 0; border: 0; }
  .battle-orders .battle-button { min-height: 30px; padding-inline: 7px; font-size: 11px; }
  .battle-setup input { height: 30px; }
  #battle-status { font-size: 11px; }
}
