.page-combat-simulator {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #10192555, var(--night) 390px),
    url("/art/willowford-siege.webp") center 42% / 100% auto no-repeat,
    var(--night);
}

.combat-main {
  width: min(1260px, 100%);
  margin-inline: auto;
  padding: clamp(24px, 5vw, 64px) clamp(12px, 4vw, 48px) 64px;
}

.combat-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  text-shadow: 0 2px 8px #080c12, 0 1px 4px #080c12;
}
.combat-heading h1 { font-size: clamp(40px, 6vw, 68px); margin: 0; }
.combat-heading p { margin: .45rem 0 0; }
.combat-heading .button { text-shadow: none; }

.combat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.combat-panel {
  padding: clamp(12px, 2.2vw, 24px);
  background: linear-gradient(155deg, var(--raised), var(--field));
  border: 1px solid #866941;
  border-radius: 6px;
  box-shadow: 0 8px 28px #080e1766;
}
.combat-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.combat-panel-heading h2 { margin: 0; }
.combat-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.combat-presets .button { border-color: #846b4e; background: var(--field); }
.combat-presets .button:hover { background: var(--hover); }

.combat-roster { width: 100%; border-collapse: collapse; }
.combat-roster th, .combat-roster td {
  padding: 5px 6px;
  text-align: right;
  border-bottom: 1px solid #d8b77e32;
}
.combat-roster th:first-child { text-align: left; }
.combat-roster thead { color: var(--muted); font-size: .88rem; }
.combat-roster .combat-group th {
  padding-top: 8px;
  background: #0b152070;
  color: #e7bd80;
  font-size: .83rem;
  font-weight: 600;
}
.combat-unit { display: inline-flex; align-items: center; gap: 8px; }
.combat-unit img { object-fit: cover; object-position: center top; border-radius: 3px; }
.combat-roster input, .combat-conditions input {
  width: 100%;
  min-height: 34px;
  background: var(--night);
  color: inherit;
  border: 1px solid #a1845b;
  border-radius: 4px;
  padding: 3px 5px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.combat-roster input { width: min(100%, 94px); text-align: right; }
.combat-form td { width: 24%; }
.combat-conditions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-block: 18px;
}
.combat-conditions label { display: grid; align-content: space-between; gap: 4px; font-size: .86rem; }
.combat-submit { display: flex; align-items: center; gap: 14px; }

.combat-result { scroll-margin-top: 16px; }
.combat-outcome { font-size: .93rem; color: #f0bf7b; }
.combat-outcome.defender-wins { color: #abd4b0; }
.combat-error { color: #ffc2af; }
.combat-forces { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.combat-forces > div { display: grid; gap: 3px; padding: 10px; background: var(--night); border: 1px solid #d8b77e32; border-radius: 4px; }
.combat-forces strong { color: #f4d3a4; font-size: clamp(16px, 2vw, 25px); overflow-wrap: anywhere; }
.combat-forces small, .combat-population dt, .combat-empty, .combat-rules, .combat-carry { color: var(--muted); }
.combat-carry, .combat-rules { font-size: .88rem; }
.combat-losses td, .combat-population dd, .combat-forces strong { font-variant-numeric: tabular-nums; }
.combat-population { margin: 18px 0 10px; }
.combat-population div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #d8b77e32; }
.combat-population dd { margin: 0; }
.combat-rules { margin-bottom: 0; }

@media (max-width: 820px) {
  .combat-grid { grid-template-columns: 1fr; }
  .page-combat-simulator { background-size: auto, auto 420px; }
}

@media (max-width: 440px) {
  .combat-roster th, .combat-roster td { padding-inline: 3px; }
  .combat-unit { gap: 5px; }
  .combat-unit img { width: 27px; height: 27px; }
  .combat-losses { font-size: .88rem; }
}
