:root {
  color-scheme: dark;
  --bg: #090b0a;
  --panel: #131512;
  --panel-2: #181814;
  --line: #4b4435;
  --line-strong: #765d28;
  --text: #f4eddd;
  --muted: #b1a794;
  --gold: #e6b948;
  --gold-bright: #ffd76c;
  --cyan: #28bfd7;
  --red: #d4523d;
  --green: #6ebd79;
  --violet: #9e69c6;
  --food: #c6ae52;
  --lumber: #bd7b42;
  --stone: #8ca3ab;
  --ore: #a16bae;
  --shadow: 0 22px 60px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: 24px;
  color: var(--text);
  background:
    radial-gradient(circle at 83% 8%, rgba(143, 40, 30, .12), transparent 30%),
    radial-gradient(circle at 8% 80%, rgba(23, 127, 145, .1), transparent 28%),
    var(--bg);
  font: 16px/1.45 "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button, select, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.command-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image:
    linear-gradient(rgba(230, 185, 72, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 185, 72, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 7px max(16px, calc((100vw - 1460px) / 2));
  border-top: 2px solid var(--red);
  border-bottom: 1px solid #39352c;
  background: rgba(12, 14, 12, .96);
  backdrop-filter: blur(12px);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #4a4438;
  color: var(--muted);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 800;
}
.back-link:hover { border-color: var(--gold); color: var(--gold-bright); }
.back-link span:first-child { color: var(--gold); font-size: 1.15rem; }
.command-brand { display: flex; align-items: center; gap: 10px; }
.command-brand img { width: 48px; height: 48px; object-fit: contain; }
.command-brand span { display: grid; }
.command-brand b { color: var(--gold-bright); font: 800 1.1rem Georgia, serif; }
.command-brand small, .verified-mark small { color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.verified-mark { display: grid; justify-self: end; text-align: right; }
.verified-mark b { color: var(--green); font-size: .68rem; }

.tools-shell { width: min(1460px, calc(100% - 32px)); margin: 22px auto 0; }
.tools-hero {
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  align-items: center;
  gap: 26px;
  padding: 26px 30px;
  border: 1px solid #57492d;
  border-top: 3px solid var(--red);
  background:
    linear-gradient(100deg, rgba(18, 19, 16, .98), rgba(28, 19, 15, .92)),
    var(--panel);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
}
.tools-hero h1 {
  margin: 4px 0 7px;
  color: var(--gold-bright);
  font: 800 clamp(2.1rem, 5vw, 3.75rem)/1 Georgia, serif;
}
.tools-hero > div:first-child > p:last-child { max-width: 700px; margin: 0; color: var(--muted); }
.hero-arsenal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.hero-arsenal figure { min-width: 0; margin: 0; text-align: center; }
.hero-arsenal img {
  width: min(104px, 100%);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, .76));
}
.hero-arsenal figcaption { color: var(--muted); font-size: .62rem; font-weight: 800; text-transform: uppercase; }

.mode-switch {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 12px 0 18px;
  border: 1px solid var(--line);
  background: #111310;
}
.mode-switch button,
.mode-switch a {
  position: relative;
  min-height: 68px;
  display: grid;
  place-content: center;
  gap: 2px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: center;
  text-decoration: none;
}
.mode-switch > * + * { border-left: 1px solid var(--line); }
.mode-switch button::after,
.mode-switch a::after { position: absolute; inset: auto 0 0; height: 3px; content: ""; background: transparent; }
.mode-switch button.is-active { color: var(--text); background: #251d12; }
.mode-switch button.is-active::after { background: var(--gold); box-shadow: 0 0 12px rgba(230, 185, 72, .4); }
.mode-switch a:hover,
.mode-switch a:focus-visible { color: var(--text); background: #1a1812; }
.mode-switch b { font-size: .86rem; }
.mode-switch small { color: #948a78; font-size: .65rem; }

.tool-panel { display: none; border: 1px solid var(--line); background: #111310; box-shadow: var(--shadow); }
.tool-panel.is-active { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr); }
.configuration, .training-result { min-width: 0; padding: 24px; }
.training-result { border-left: 1px solid var(--line); background: linear-gradient(145deg, #151713, #19140f); }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.section-heading > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #806526;
  color: #171209;
  background: var(--gold);
  font-weight: 950;
}
.section-heading h2, .layer-toolbar h2, .layer-totals h2 { margin: 0; font: 800 1.35rem Georgia, serif; }

.troop-selector {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}
.troop-selector legend { width: 100%; margin-bottom: 8px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.troop-option {
  --tone: var(--gold);
  position: relative;
  min-height: 102px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid #454139;
  background: #171915;
  cursor: pointer;
}
.troop-ranged { --tone: var(--cyan); }
.troop-mounted { --tone: var(--gold); }
.troop-ground { --tone: var(--green); }
.troop-siege { --tone: var(--violet); }
.troop-option:hover { border-color: color-mix(in srgb, var(--tone) 70%, #454139); }
.troop-option:has(input:checked) {
  border-color: var(--tone);
  background: color-mix(in srgb, var(--tone) 9%, #171915);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 28%, transparent);
}
.troop-option input { position: absolute; opacity: 0; pointer-events: none; }
.troop-option img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .72));
  transition: transform .18s ease, filter .18s ease;
}
.troop-option:hover img { transform: scale(1.04); }
.troop-option:has(input:checked) img { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--tone) 58%, transparent)); transform: scale(1.06); }
.troop-option > span { min-width: 0; display: grid; }
.troop-option b { font-size: .8rem; }
.troop-option small { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.troop-option i {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  color: var(--tone);
  font-size: .52rem;
  font-style: normal;
  font-weight: 900;
}
.troop-option:has(input:checked) i { display: block; }

.input-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; }
.input-grid label { display: grid; gap: 7px; }
.input-grid label > span { color: var(--muted); font-size: .7rem; font-weight: 800; }
input, select {
  width: 100%;
  min-height: 49px;
  padding: 0 13px;
  border: 1px solid #4a4438;
  border-radius: 2px;
  color: var(--text);
  background: #10120f;
  font-weight: 750;
}
select { padding-right: 38px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.presets > span { margin-right: 4px; color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.presets button {
  min-width: 51px;
  min-height: 33px;
  padding: 4px 9px;
  border: 1px solid #4a4233;
  color: #ded2b8;
  background: #191913;
  font-size: .68rem;
  font-weight: 850;
}
.presets button:hover { border-color: var(--gold); color: var(--gold-bright); }

.base-cost {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid #3e3a31;
  background: #141612;
}
.base-cost h3 { margin: 0; font: 800 1rem Georgia, serif; }
.base-cost dl { display: grid; grid-template-columns: repeat(6, minmax(68px, 1fr)); gap: 6px; margin: 0; }
.base-cost dl div { min-width: 0; padding: 8px; border-left: 2px solid var(--resource, #777); background: #10110f; }
dt { color: var(--muted); font-size: .6rem; text-transform: uppercase; }
dd { overflow: hidden; margin: 3px 0 0; font-weight: 850; text-overflow: ellipsis; }
.food { --resource: var(--food); }
.lumber { --resource: var(--lumber); }
.stone { --resource: var(--stone); }
.ore { --resource: var(--ore); }
.gold, .power { --resource: var(--gold); }

.power-total {
  min-height: 164px;
  display: grid;
  align-content: center;
  justify-items: center;
  margin-bottom: 15px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 50% 110%, rgba(230, 185, 72, .2), transparent 62%), #14150f;
  text-align: center;
}
.power-total > span { color: var(--gold); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.power-total strong { margin: 7px 0 4px; color: var(--gold-bright); font: 850 2.35rem/1 Georgia, serif; }
.power-total small { color: var(--muted); }
.resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.resource-grid article {
  min-height: 88px;
  display: grid;
  align-content: center;
  padding: 11px 12px;
  border: 1px solid #3f3b32;
  border-left: 3px solid var(--resource);
  background: #121410;
}
.resource-grid article:last-child { grid-column: 1 / -1; }
.resource-grid small { color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.resource-grid b { overflow: hidden; font-size: .92rem; text-overflow: ellipsis; }
.resource-grid em { color: var(--resource); font-size: .68rem; font-style: normal; }

.command-button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #94752f;
  color: #171209;
  background: var(--gold);
  font-size: .75rem;
  font-weight: 900;
}
.command-button:hover { background: var(--gold-bright); }
.command-button.secondary { color: var(--text); background: #171813; }
.command-button.secondary:hover { border-color: var(--gold); color: var(--gold-bright); }
.command-button.full { width: 100%; }
.training-result > .command-button { width: 100%; margin-top: 12px; }

.layer-panel.is-active { display: block; }
.layer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.layer-toolbar p { margin: 0; color: var(--muted); }
.layer-toolbar > div:last-child { display: flex; gap: 8px; }
.layer-layout { min-height: 430px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.layer-matrix { min-width: 0; padding: 20px; }
.layer-head, .layer-row {
  display: grid;
  grid-template-columns: minmax(185px, 1.25fr) 90px minmax(150px, 1fr) 120px 42px;
  align-items: center;
  gap: 7px;
}
.layer-head { min-height: 35px; padding: 0 4px; color: #948a78; font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.layer-row { margin-bottom: 7px; padding: 8px; border: 1px solid #3a372f; border-left: 3px solid var(--cyan); background: #151713; }
.type-field { position: relative; }
.type-field img {
  position: absolute;
  top: 50%;
  left: 5px;
  z-index: 1;
  width: 37px;
  height: 37px;
  object-fit: contain;
  transform: translateY(-50%);
  pointer-events: none;
}
.type-field select { padding-left: 46px; }
.layer-row output { color: var(--gold-bright); font-weight: 850; text-align: right; }
.remove-line {
  min-height: 42px;
  border: 1px solid #69423b;
  color: #ff9e8e;
  background: #1e1412;
  font-weight: 900;
}
.remove-line:hover { border-color: var(--red); }
.layer-totals { padding: 22px; border-left: 1px solid var(--line); background: #151713; }
.layer-power { display: grid; gap: 5px; margin: 15px 0 12px; padding: 16px; border: 1px solid #725b27; background: #211c12; }
.layer-power span { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.layer-power strong { color: var(--gold-bright); font: 850 1.95rem/1 Georgia, serif; }
.layer-totals dl { margin: 0 0 12px; }
.layer-totals dl div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 4px; border-bottom: 1px solid #36332b; }
.layer-totals dd { color: var(--resource, var(--text)); }
.save-state { display: block; margin-top: 9px; color: #8e8575; text-align: center; }

.march-configuration, .march-result { min-width: 0; padding: 24px; }
.march-panel.is-active { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.march-result { border-left: 1px solid var(--line); background: linear-gradient(145deg, #151713, #151512); }
.march-input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.march-input-grid label { display: grid; gap: 7px; }
.march-input-grid label > span { color: var(--muted); font-size: .7rem; font-weight: 800; }
.march-troop-selector { margin-bottom: 14px; }
.distribution-panel { padding: 14px; border: 1px solid #464034; background: #141612; }
.distribution-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.distribution-panel h3 { margin: 0; font: 800 1rem Georgia, serif; }
.distribution-panel output {
  min-width: 58px;
  padding: 5px 8px;
  border: 1px solid #607c5d;
  color: #dff1dc;
  background: #162019;
  font-size: .68rem;
  font-weight: 900;
  text-align: center;
}
.distribution-panel output.is-invalid { border-color: #8b4235; color: #ffb3a3; background: #241512; }
.distribution-rows { display: grid; gap: 7px; }
.distribution-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) minmax(86px, 120px) 18px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #3e3b33;
  background: #10120f;
}
.distribution-row b { color: var(--gold-bright); font-size: .78rem; }
.distribution-row span { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.distribution-row input { min-height: 40px; text-align: right; }
.distribution-row em { color: var(--muted); font-style: normal; font-weight: 800; }
.march-error { margin-top: 12px; padding: 10px 12px; border: 1px solid #8d4337; border-left: 4px solid var(--red); color: #ffc2b5; background: #241512; font-size: .75rem; }
.march-calculate { margin-top: 12px; }
.march-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}
.march-compass {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 5px;
  border: 1px solid #725b28;
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle, #251d12, #111310 68%);
  font: 850 1rem Georgia, serif;
  box-shadow: 0 0 0 7px rgba(230, 185, 72, .035);
}
.march-empty h3, .march-empty p { margin: 0; }
.march-empty h3 { color: var(--text); font: 800 1.15rem Georgia, serif; }
.march-empty p { max-width: 390px; }
.march-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.march-summary article { min-width: 0; display: grid; gap: 3px; padding: 13px; border: 1px solid #4a4335; background: #11130f; }
.march-summary article:first-child { border-top: 2px solid var(--cyan); }
.march-summary article:nth-child(2) { border-top: 2px solid var(--violet); }
.march-summary article:last-child { border-top: 2px solid var(--gold); }
.march-summary small { color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.march-summary strong { overflow: hidden; color: var(--gold-bright); font: 850 1.25rem/1.1 Georgia, serif; text-overflow: ellipsis; }
.march-summary span { overflow: hidden; color: var(--muted); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.march-table-shell { max-height: 540px; overflow: auto; border: 1px solid #413c32; background: #10120f; }
.march-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: .72rem; text-align: center; }
.march-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 105px;
  padding: 8px 6px;
  border-bottom: 1px solid #5a4c32;
  color: var(--muted);
  background: #191912;
  font-size: .61rem;
  text-transform: uppercase;
}
.march-table th:first-child { left: 0; z-index: 3; min-width: 64px; text-align: left; }
.march-table th img { width: 31px; height: 31px; display: block; margin: 0 auto 2px; object-fit: contain; }
.march-table td { padding: 8px 6px; border-bottom: 1px solid #2d2c27; color: #c5bca9; }
.march-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  color: var(--gold-bright);
  background: #161712;
  font-weight: 900;
  text-align: left;
}
.march-table td.is-main {
  color: #171209;
  background: var(--gold);
  font-weight: 950;
  box-shadow: inset 0 0 0 1px #ffd975;
}
.march-table tr:hover td:not(.is-main) { background: #191a15; }
.march-copy { margin-top: 10px; }

.tool-note {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #49402d;
  border-left: 4px solid var(--red);
  color: var(--muted);
  background: #191711;
  font-size: .76rem;
}
.tool-note b { color: var(--text); }
.audio-player {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(126px, auto) repeat(3, auto);
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin: 12px 0 0 auto;
  padding: 7px;
  border: 1px solid #5d5134;
  background: #121310;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
}
.audio-player > div { min-width: 0; display: grid; padding: 0 7px; }
.audio-player b { overflow: hidden; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.audio-player small { color: var(--muted); font-size: .58rem; }
.audio-player button {
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid #4a4438;
  color: var(--text);
  background: #171813;
  font-size: .62rem;
  font-weight: 800;
}
.audio-player button:hover { border-color: var(--gold); color: var(--gold-bright); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid #557c60;
  color: #e2f9e8;
  background: #142019;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .troop-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .base-cost { grid-template-columns: 1fr; }
  .base-cost dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layer-layout { grid-template-columns: minmax(0, 1fr) 290px; }
}

@media (max-width: 820px) {
  .command-bar { grid-template-columns: auto 1fr auto; }
  .back-link span:last-child, .verified-mark small { display: none; }
  .tools-hero { grid-template-columns: 1fr; }
  .hero-arsenal { max-width: 520px; }
  .tool-panel.is-active { grid-template-columns: 1fr; }
  .training-result { border-top: 1px solid var(--line); border-left: 0; }
  .layer-layout { grid-template-columns: 1fr; }
  .layer-totals { border-top: 1px solid var(--line); border-left: 0; }
  .march-result { border-top: 1px solid var(--line); border-left: 0; }
  .layer-head { display: none; }
  .layer-row { grid-template-columns: minmax(150px, 1.2fr) 76px minmax(120px, 1fr) 42px; }
  .layer-row output { grid-column: 1 / 4; grid-row: 2; padding: 4px 2px 0; text-align: left; }
  .layer-row > button { grid-column: 4; grid-row: 1 / 3; }
}

@media (max-width: 560px) {
  body { padding-bottom: 18px; }
  .command-bar { min-height: 58px; padding: 5px 9px; }
  .command-brand { gap: 6px; }
  .command-brand img { width: 40px; height: 40px; }
  .command-brand b { font-size: .94rem; }
  .command-brand small { font-size: .54rem; }
  .back-link { min-width: 40px; justify-content: center; padding: 6px; }
  .verified-mark b { max-width: 66px; font-size: .55rem; line-height: 1.15; }
  .tools-shell { width: calc(100% - 18px); margin-top: 10px; }
  .tools-hero { min-height: 0; gap: 16px; padding: 20px 16px; }
  .tools-hero h1 { font-size: 2.2rem; }
  .hero-arsenal { gap: 2px; }
  .hero-arsenal figcaption { font-size: .52rem; }
  .mode-switch button,
  .mode-switch a { min-height: 62px; padding: 7px; }
  .mode-switch small { display: none; }
  .configuration, .training-result { padding: 17px 13px; }
  .section-heading { margin-bottom: 18px; }
  .section-heading h2 { font-size: 1.2rem; }
  .troop-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .troop-option { min-height: 82px; grid-template-columns: 42px minmax(0, 1fr); gap: 7px; padding: 8px; }
  .troop-option img { width: 42px; height: 42px; }
  .input-grid { grid-template-columns: 1fr; }
  .base-cost dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-grid article:last-child { grid-column: auto; }
  .layer-toolbar { align-items: flex-start; flex-direction: column; padding: 18px 13px; }
  .layer-toolbar > div:last-child { width: 100%; }
  .layer-toolbar .command-button { flex: 1; }
  .layer-matrix { padding: 12px 8px; }
  .layer-row { grid-template-columns: minmax(118px, 1.2fr) 66px minmax(104px, 1fr) 37px; gap: 5px; padding: 7px 5px; }
  .layer-row input, .layer-row select { min-height: 42px; font-size: .76rem; }
  .type-field img { width: 31px; height: 31px; }
  .type-field select { padding-left: 38px; }
  .layer-totals { padding: 18px 14px; }
  .march-configuration, .march-result { padding: 17px 13px; }
  .march-input-grid { grid-template-columns: 1fr; }
  .march-troop-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .distribution-row { grid-template-columns: 48px minmax(0, 1fr) 76px 14px; gap: 6px; padding: 6px; }
  .march-summary { grid-template-columns: 1fr; }
  .march-table-shell { max-height: 470px; }
  .march-table { min-width: 560px; }
  .audio-player {
    width: 100%;
    margin-top: 10px;
    grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  }
  .audio-player button { padding: 5px 7px; }
}
