:root {
  /* Dark base (unchanged feel) + logo teal/cyan energy accents */
  --bg: #0b0d0e;
  --surface: #121518;
  --border: #1e2a2c;
  --text: #e6eef0;
  --muted: #6b8a8a;
  --accent: #14d9c4;
  --accent-hover: #4df0e0;
  --accent-glow: rgba(20, 217, 196, 0.22);
  --on-accent: #051012;
  --danger: #f87171;
  --success: #34d399;
}
* { box-sizing: border-box; }
html {
  overflow-x: clip;
  scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) var(--surface);
}
html::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
html::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 6px;
}
html::-webkit-scrollbar-track {
  background: var(--surface);
}
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: clip;
}
.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.page-body {
  flex: 1;
  /* Same horizontal inset as mobile (0.9rem); symmetric L/R gutters for all viewports */
  padding: 0.9rem;
  min-width: 0;
}
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 1rem 0.5rem;
  flex-shrink: 0;
}
.site-header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}
.edition-banner {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent, #c9a227);
  letter-spacing: 0.02em;
}
.edition-rules-disclosure {
  width: 100%;
  max-width: 36rem;
}
.edition-rules-interim,
button.edition-rules-interim {
  margin: 0;
  width: 100%;
  max-width: 36rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
  color: color-mix(in srgb, var(--text) 88%, var(--accent));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 6px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 18%, transparent);
}
button.edition-rules-interim {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
button.edition-rules-interim:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
}
button.edition-rules-interim:focus-visible {
  outline: 2px solid var(--accent, #c9a227);
  outline-offset: 2px;
}
button.edition-rules-interim[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  box-shadow: none;
}
.edition-rules-interim-text {
  flex: 1 1 auto;
  min-width: 0;
}
.edition-rules-interim-icon {
  flex: 0 0 auto;
  font-size: 0.72rem;
  opacity: 0.85;
  transition: transform 0.2s ease;
}
button.edition-rules-interim[aria-expanded="true"] .edition-rules-interim-icon {
  transform: rotate(180deg);
}
.edition-rules-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease;
  border: 1px solid transparent;
  border-top: none;
  border-radius: 0 0 6px 6px;
}
.edition-rules-panel.is-open {
  max-height: min(70vh, 520px);
  opacity: 1;
  overflow-y: auto;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--surface, #1a1d21) 92%, var(--accent) 8%);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 12%, transparent);
}
.edition-rules-panel-inner {
  padding: 0.65rem 0.85rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text, #e8eaed);
  text-align: left;
}
.edition-rules-lede {
  margin: 0 0 0.65rem;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}
.edition-rules-section {
  margin: 0 0 0.6rem;
}
.edition-rules-section:last-child {
  margin-bottom: 0;
}
.edition-rules-heading {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #c9a227);
}
.edition-rules-list {
  margin: 0;
  padding-left: 1.1rem;
}
.edition-rules-list li {
  margin: 0 0 0.28rem;
}
.edition-rules-list li:last-child {
  margin-bottom: 0;
}
.edition-rules-section--muted .edition-rules-heading {
  color: var(--muted, #9aa0a6);
}
.edition-rules-note {
  margin: 0;
  color: var(--muted, #9aa0a6);
  font-size: 0.76rem;
}
.edition-switch {
  margin: 0;
  font-size: 0.85rem;
}
.edition-switch a {
  color: var(--text-muted, #9aa0a6);
  text-decoration: none;
}
.edition-switch a:hover {
  color: var(--text, #e8eaed);
  text-decoration: underline;
}
.edition-switch [aria-current="page"] {
  color: var(--text, #e8eaed);
  font-weight: 600;
  text-decoration: none;
}
.site-logo {
  display: block;
  height: clamp(100px, 18vw, 140px);
  width: auto;
  max-width: min(100%, 480px);
  object-fit: contain;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  min-width: 0;
  max-width: 100%;
}
.panel h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* --- Combat flow layout (attacker → rules → defender → simulation) --- */
.combat-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.combat-step-rail {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.combat-step-rail__settings.btn-icon {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 3.25rem;
  height: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.combat-step-rail__settings.btn-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}
.combat-step-rail__list {
  display: flex;
  flex: 1 1 0;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  min-width: 0;
}
.combat-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.combat-settings-backdrop:not([hidden]) {
  display: block;
}
.combat-settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(22rem, 92vw);
  max-width: 100%;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 8px 0 28px color-mix(in srgb, var(--bg) 40%, transparent);
  transform: translateX(-105%);
  transition: transform 0.24s ease;
  overflow: hidden;
}
.combat-settings-panel.is-open {
  transform: translateX(0);
}
.combat-settings-panel:not([hidden]) {
  display: flex;
}
.combat-settings-panel__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.combat-settings-panel__title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.combat-settings-panel__close svg {
  width: 1.1rem;
  height: 1.1rem;
}
.combat-settings-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.combat-settings-fieldset {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.combat-settings-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.combat-settings-fieldset .field + .field {
  margin-top: 0.65rem;
}
body.combat-settings-open {
  overflow: hidden;
}
.combat-step-rail__list > li {
  flex: 1 1 0;
  min-width: 0;
  border-right: 1px solid var(--border);
}
.combat-step-rail__list > li:last-child {
  border-right: none;
}
.combat-step-rail__step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s ease;
}
.combat-step-rail__step:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.combat-step-rail__step.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.combat-step-rail__step.is-active .combat-step-rail__short {
  color: var(--accent);
}
.combat-step-rail__step.is-active .combat-step-rail__num {
  background: var(--accent);
  color: var(--on-accent);
}
.combat-step-rail__num {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--muted) 22%, var(--bg));
  color: var(--muted);
}
.combat-step-rail__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.05rem;
}
.combat-step-rail__short {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.combat-step-rail__label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combat-flow__setup {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.panel--combat-step {
  scroll-margin-top: calc(var(--combat-step-rail-height, 3.25rem) + 0.65rem);
}
.panel-step-header {
  display: flex;
  align-items: stretch;
  margin: 0 0 1rem;
}
.panel-step-header__accent {
  width: 4px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--accent);
  margin: 0 0.85rem 0 -1.25rem;
}
.panel-step-header__body {
  flex: 1;
  min-width: 0;
}
.panel-step-header__kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.panel .panel-step-header .panel-step-header__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: none;
  letter-spacing: normal;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.panel-step-header__num {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
}
.panel-step-header__subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}
.combat-run-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0 0 0.65rem;
  border-bottom: 1px solid var(--border);
}
.combat-run-bar .run {
  margin-top: 0;
}
.combat-run-bar .error {
  margin-top: 0;
  flex: 1 1 12rem;
}
@media (max-width: 767px) {
  .combat-step-rail {
    margin-left: -0.15rem;
    margin-right: -0.15rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .combat-step-rail::-webkit-scrollbar {
    display: none;
  }
  .combat-step-rail__list {
    min-width: min(100%, 36rem);
  }
  .combat-step-rail__step {
    padding: 0.55rem 0.6rem;
  }
  .combat-step-rail__settings.btn-icon {
    padding: 0.55rem 0.6rem;
    min-width: 2.85rem;
  }
  .combat-step-rail__label {
    font-size: 0.78rem;
  }
  .panel .panel-step-header .panel-step-header__title {
    font-size: 0.98rem;
  }
  .panel-step-header__subtitle {
    font-size: 0.78rem;
  }
}
.panel-subsection {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.panel-subheading {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Match .unit-section-title (attacker composer section headers); replaces former h3.panel-subheading here */
#manualTargetingPanel > .unit-section-title:first-child {
  margin: 0 0 0.75rem 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.field-label-row .checkbox-label {
  font-size: 0.78rem;
  color: var(--muted);
  gap: 0.35rem;
  margin: 0;
}
.field select, .field input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 140px;
}
/* Tight numeric fields: sized for ~3 digits, capped */
.field input[type="number"] {
  min-width: 0;
  width: auto;
  inline-size: 6.5ch;
  max-inline-size: 8ch;
}
.field select:focus, .field input:focus {
  outline: none;
  border-color: var(--accent);
}
.field-checkbox { min-width: 220px; }
.field-checkbox .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.abilities-list {
  font-size: 0.85rem;
  color: var(--text);
}
.abilities-list .ability-item {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.abilities-list .ability-item:last-child { border-bottom: none; margin-bottom: 0; }
.abilities-list .ability-name { font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.abilities-list .ability-desc { color: var(--muted); line-height: 1.4; }
.ability-keyword {
  font-weight: 600;
  color: var(--accent);
}
.attack-ability-options .ability-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.attack-ability-options .ability-check label { cursor: pointer; font-size: 0.9rem; }
.modifiers-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}
.modifiers-situational-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: stretch;
}
/* Match .attacker-unit-card (e.g. defender instance cards) surface treatment */
.modifiers-subsection-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.85rem;
  min-width: 0;
}
.modifiers-subsection-card > .unit-section-title:first-child {
  margin: 0 0 0.5rem 0;
}
.modifiers-situational-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: center;
}
.modifiers-strat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
}
.modifiers-strat-card-header {
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.35rem;
}
.modifiers-subsection-card .section-note-body {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.modifiers-add-row { position: relative; display: inline-block; margin-bottom: 0.75rem; }
.modifiers-add-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.modifiers-add-btn:hover { border-color: var(--accent); }
.modifiers-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 20;
  overflow: hidden;
}
.modifiers-dropdown.is-open { display: block; }
.modifiers-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.modifiers-dropdown-item:hover { background: var(--bg); }
.modifiers-dropdown-item:disabled { opacity: 0.5; cursor: not-allowed; }
.modifiers-active-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.modifiers-active-label { font-size: 0.85rem; color: var(--muted); }
.modifiers-active-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.modifier-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
}
.modifier-active-chip button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  opacity: 0.8;
}
.modifier-active-chip button:hover { opacity: 1; color: var(--danger); }
.vs {
  align-self: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 1rem;
}
button.run {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
button.run:hover { background: var(--accent-hover); }
button.run:disabled { opacity: 0.5; cursor: not-allowed; }
.results {
  margin-top: 1rem;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.metric .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.metric .label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.metric .label.label--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  line-height: 1.25;
}
.metric--stacked-metrics {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.metric--stacked-metrics .stacked-metrics-row .label {
  margin-top: 0.15rem;
}
.metric--stacked-metrics .value.value--secondary {
  font-size: 1.2rem;
}
.chart-wrap {
  position: relative;
  height: 360px;
  margin-top: 1rem;
  max-width: 100%;
  overflow: hidden;
}
.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
.loading { color: var(--muted); }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}
.profile-grid .stat {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}
.profile-grid .stat span:first-child { color: var(--muted); }
.profile-grid .stat span:last-child { font-weight: 600; }
.profile-grid .keywords { grid-column: 1 / -1; margin-top: 0.25rem; color: var(--muted); font-size: 0.85rem; }
.defender-profile-edit-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  justify-items: start;
  gap: 0.65rem 0.85rem;
}
.defender-profile-edit-grid .field--def-profile-stat {
  min-width: 0;
}
.defender-profile-edit-grid .field--def-profile-plus-stat {
  flex: 0 0 6.5ch;
  max-width: 8ch;
}
.defender-profile-edit-grid .field--def-profile-stat label {
  line-height: 1.25;
  min-height: calc(1.25 * 0.8rem);
}
.defender-profile-edit-grid .field--def-profile-stat input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.defender-profile-edit-grid .field--def-profile-plus-stat input {
  max-width: 8ch;
  inline-size: unset;
  min-inline-size: 0;
}
/* Attacker weapon profile cards only: denser grid (font sizes unchanged). */
.weapon-profile-list .weapon-profile-card .profile-grid {
  /* 2-row stat table: labels row then values row */
  gap: 0;
  line-height: 1.15;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
  justify-content: stretch;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
}
.weapon-profile-list .weapon-profile-card .profile-grid .wp-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.18rem 0.22rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.weapon-profile-list .weapon-profile-card .profile-grid .wp-stat:nth-child(6n) {
  border-right: none;
}
.weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  container-type: inline-size;
}
.weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label .wp-stat-label-long {
  display: none;
}
/* Narrow stat cells (2-col profile cards): short labels even on wide viewports. */
@container (max-width: 4.5rem) {
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label .wp-stat-label-long {
    display: none !important;
  }
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label .wp-stat-label-short {
    display: inline !important;
  }
}
@media (min-width: 768px) {
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label {
    white-space: normal;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label .wp-stat-label-short {
    display: none;
  }
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label .wp-stat-label-long {
    display: inline;
  }
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label.is-wrapped .wp-stat-label-short {
    display: inline;
  }
  .weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--label.is-wrapped .wp-stat-label-long {
    display: none;
  }
}
.weapon-profile-list .weapon-profile-card .profile-grid .wp-stat--value {
  font-weight: 400;
  color: var(--text);
}
.weapon-profile-list .weapon-profile-card .weapon-profile-keywords {
  margin-top: 0.12rem;
  line-height: 1.2;
  color: var(--muted);
  font-size: 0.85rem;
}
.defender-models-table-wrap {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
}
.defender-models-table-wrap .unit-section-title {
  margin: 0 0 0.4rem 0;
}
.defender-models-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.defender-models-table th,
.defender-models-table td {
  padding: 0.25rem 0.5rem 0.25rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.defender-models-table th { color: var(--muted); font-weight: 600; }
.defender-models-table tr:last-child td { border-bottom: none; }
.profile-extra { font-size: 0.9rem; color: var(--accent); }
.chart-caption {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
  max-width: 56rem;
}
.contrib-panel {
  margin: 0.75rem 0 0.9rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
  padding: 0.75rem;
}
.contrib-panel h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.86rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contrib-note {
  margin: 0 0 0.55rem 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: pre-line;
}
.contrib-resolution-order {
  margin: 0 0 0.55rem 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.contrib-resolution-order-list {
  list-style: none; /* ranks come from .contrib-order-rank (accent); avoid 1. 1. from OL + span */
  margin: 0.25rem 0 0 0;
  padding: 0;
  line-height: 1.45;
}
.contrib-order-rank { color: var(--accent); margin-right: 0.25rem; }
.contrib-order-score { opacity: 0.9; font-size: 0.78rem; }
.contrib-list { display: grid; gap: 0.45rem; }
.contrib-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  padding: 0.5rem 0.6rem;
  background: rgba(255,255,255,0.02);
}
.contrib-main {
  flex: 1 1 220px;
  min-width: 0;
}
.contrib-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.3rem; }
.contrib-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.35rem 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.contrib-metrics strong { color: var(--text); font-weight: 600; }
.contrib-funnel {
  flex: 0 0 auto;
  width: 11.25rem;
  max-width: 100%;
  padding: 0.15rem 0 0;
}
.contrib-funnel-seg {
  margin-bottom: 0.32rem;
}
.contrib-funnel-seg:last-child { margin-bottom: 0; }
.contrib-funnel-bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
  margin-bottom: 0.12rem;
}
.contrib-funnel-bar {
  height: 100%;
  border-radius: 3px;
  min-width: 0;
  opacity: 0.88;
  transition: width 0.15s ease;
}
.contrib-funnel-seg-label {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}
.contrib-funnel-seg-label strong {
  color: var(--text);
  font-weight: 600;
}
.contrib-funnel-caption {
  margin: 0.5rem 0 0 0;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
@media (max-width: 767px) {
  #weaponContributionToggle {
    margin-bottom: 1rem !important;
  }
  .contrib-row { flex-direction: column; }
  .contrib-funnel {
    width: 100%;
    max-width: 17rem;
  }
}
.manual-alloc-panel-host {
  display: block;
  margin-top: 0.35rem;
  min-width: 0;
}
.manual-alloc-shell {
  overflow-x: auto;
  padding-bottom: 0.15rem;
  min-width: 0;
}
.manual-alloc-grid-row {
  display: grid;
  align-items: center;
  gap: 0.45rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  padding: 0.45rem 0.55rem;
  background: rgba(255,255,255,0.02);
  min-width: min(100%, 22rem);
}
.manual-alloc-grid-row + .manual-alloc-grid-row {
  margin-top: 0.4rem;
}
.manual-alloc-header-row {
  background: rgba(255,255,255,0.04);
}
.manual-alloc-weapon-col {
  font-size: 0.75rem;
  color: var(--muted);
}
.manual-alloc-def-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manual-alloc-weapon-main {
  min-width: 0;
}
.manual-alloc-weapon-main .contrib-name {
  margin-bottom: 0.18rem;
  font-size: 0.88rem;
}
.manual-alloc-summary {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.manual-alloc-vcell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
/* Match compact modifier number fields (e.g. stratDamageLe): dark field, tight width */
.manual-alloc-input[type="number"] {
  width: 3.35rem;
  min-width: 3.1rem;
  max-width: 4rem;
  box-sizing: border-box;
  padding: 0.45rem 0.4rem;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.9rem;
}
.manual-alloc-input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}
.manual-alloc-order-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: min(100%, 22rem);
}
.manual-alloc-order-list .manual-alloc-header-row {
  margin-top: 0;
}
.manual-alloc-order-list .manual-alloc-data-row.mixed-save-order-row {
  display: grid;
  cursor: grab;
  user-select: none;
}
.manual-alloc-order-list .manual-alloc-data-row.mixed-save-order-row--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.manual-alloc-order-list.mixed-save-order-list--swap-dragging .manual-alloc-data-row {
  transition: transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.manual-alloc-order-list .manual-alloc-data-row.mixed-save-order-row--swap-active {
  position: relative;
  z-index: 2;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.manual-alloc-order-list .mixed-save-order-drag-handle {
  justify-self: center;
  align-self: center;
  line-height: 1;
}
.manual-alloc-order-hint {
  max-width: 52rem;
}
.mixed-attacker-model-composition {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: flex-start;
  margin-top: 0.35rem;
}
.mixed-attacker-member-composition-group {
  flex: 1 1 22rem;
  min-width: min(100%, 20rem);
}
.mixed-attacker-member-composition-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.mixed-attacker-shared-sections {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}
.mixed-attacker-shared-section-header {
  margin-top: 0.55rem;
}
.mixed-attacker-shared-section-header:first-child {
  margin-top: 0;
}
.mixed-attacker-shared-section-body {
  margin-top: 0.35rem;
}
.mixed-attacker-member-detail-block + .mixed-attacker-member-detail-block {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.mixed-attacker-member-detail-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.4rem 0;
}
.catalogue-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}
.attacker-unit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-top: 0.5rem;
}
.custom-model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
}
.custom-model-actions button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}
.custom-model-actions button:hover {
  border-color: var(--accent);
}
.custom-weapon-editor {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.custom-weapon-editor .custom-weapon-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.35rem;
  align-items: end;
  margin-bottom: 0.4rem;
  min-width: 0;
}
.custom-weapon-editor .cw-name-qty-row {
  display: flex;
  flex: 1 1 100%;
  flex-basis: 100%;
  width: 100%;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: nowrap;
}
.custom-weapon-editor .cw-name-qty-row .field--cw-name {
  flex: 1 1 0;
  min-width: 0;
}
.custom-weapon-editor .cw-name-qty-row .field--cw-qty {
  flex: 0 0 4rem;
  min-width: 0;
}
.custom-weapon-editor .field--cw-name,
.custom-weapon-editor .field--cw-range,
.custom-weapon-editor .field--cw-kind,
.custom-weapon-editor .field--cw-qty,
.custom-weapon-editor .field--cw-stat,
.custom-weapon-editor .field--cw-remove {
  min-width: 0;
  flex: 0 0 auto;
}
.custom-weapon-editor .field--cw-kind { flex: 0 0 9rem; }
.custom-weapon-editor .field--cw-qty { flex: 0 0 4rem; }
.custom-weapon-editor .field--cw-range { flex: 0 0 8rem; }
.custom-weapon-editor .field--cw-stat { flex: 0 0 6.5ch; }
.custom-weapon-editor .field--cw-remove { flex: 0 0 2.25rem; }

/* Keep compact stat/range inputs even when the grid cell is wide */
.custom-weapon-editor .field--cw-range,
.custom-weapon-editor .field--cw-stat,
.custom-weapon-editor .field--cw-qty {
  align-self: end;
}
.custom-weapon-editor .field--cw-range input {
  width: 100%;
  max-width: 10ch;
}
.custom-weapon-editor .field--cw-stat input {
  width: 100%;
  max-width: 8ch;
}
.custom-weapon-editor .field--cw-qty input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  min-width: 0;
}
.custom-weapon-editor .field--cw-remove {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.custom-weapon-editor .field--cw-remove label {
  visibility: hidden;
  font-size: 0.72rem;
  line-height: 1.2;
  min-height: 1.2em;
  margin: 0;
}
.custom-weapon-editor .field--cw-kind select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.custom-weapon-editor .field--cw-stat input {
  box-sizing: border-box;
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  min-width: 0;
}
.custom-weapon-editor .field--cw-name input,
.custom-weapon-editor .field--cw-range input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.defender-profile-in-target {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.def-mod-block-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.def-mod-list.custom-keyword-list {
  align-items: flex-start;
}
.def-mod-list .custom-keyword-card {
  flex: 1 1 18rem;
  max-width: 100%;
  min-width: 0;
}
.def-mod-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.55rem;
  min-width: 0;
}
.def-mod-card-row .field {
  margin: 0;
}
.def-mod-card-row .field.field--inline {
  gap: 0.3rem 0.45rem;
}
/* “Reduce” label: width follows the label text (longest word), never clipped by flex */
.def-mod-card-row .field--def-mod-kind .def-mod-inline-label {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  max-width: none;
}
/* Type picklist: don’t shrink below longest option (“Wound Roll”); keep trigger one line */
.def-mod-card-row .field--def-mod-kind {
  flex: 1 1 12rem;
  min-width: 11rem;
  max-width: 100%;
}
.def-mod-card-row .field--def-mod-kind.field--inline .custom-picklist-shell {
  min-width: 10rem;
  flex: 1 1 auto;
}
.def-mod-card-row .field--def-mod-kind .custom-picklist-trigger {
  white-space: nowrap;
}
.def-mod-card-row .field--def-mod-kind select {
  min-width: 10rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.def-mod-card-row .field--def-mod-num .def-mod-inline-label {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  max-width: none;
}
.def-mod-card-row .field--def-mod-num {
  flex: 0 1 auto;
}
.def-mod-card-row .field--def-mod-num input {
  width: auto;
  min-width: 0;
  inline-size: 5ch;
  max-inline-size: 8ch;
  text-align: center;
}
/* Damage: by + Half; flex-grow 0 so the row doesn’t expand to 100% and push × to the next line */
.def-mod-value-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}
.def-mod-card-row .def-mod-damage-half {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  flex: 0 1 auto;
  font-size: 0.82rem;
  color: var(--text);
}
.def-mod-card-row .def-mod-damage-half span {
  white-space: nowrap;
}
.def-mod-card-row .keyword-remove-x {
  flex: 0 0 auto;
  align-self: center;
}
.def-mod-inline-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.custom-keyword-block {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.custom-keyword-block-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}
.custom-keyword-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.custom-keyword-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}
.custom-keyword-list .custom-keyword-card {
  flex: 0 1 15.5rem;
  max-width: 100%;
}
.custom-keyword-list .add-keyword-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}
.custom-keyword-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  min-width: 0;
}
.custom-keyword-card-summary {
  min-width: 0;
}
.custom-keyword-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.45rem;
  min-width: 0;
}
.custom-keyword-card-row .field--kw-preset {
  flex: 1 1 7rem;
  min-width: 0;
}
.custom-keyword-card .field {
  margin: 0;
  min-width: 0;
}
.custom-keyword-card .field label {
  font-size: 0.72rem;
}
.custom-keyword-preset-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.custom-keyword-readback {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  letter-spacing: 0.01em;
}
.custom-keyword-readback::before {
  content: "·";
  margin-right: 0.35rem;
  color: var(--muted);
  font-weight: 400;
}
.custom-keyword-card .field--kw-preset select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.custom-keyword-anti-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  flex: 0 1 auto;
  min-width: 0;
}
.custom-keyword-anti-inline .field--kw-anti {
  flex: 0 1 6.75rem;
  min-width: 4.5rem;
  max-width: 9rem;
}
.custom-keyword-anti-inline .field--kw-anti select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.custom-keyword-anti-inline .field--kw-num {
  flex: 0 0 3.5rem;
  width: 3.5rem;
}
.custom-keyword-card-row .field--kw-value-only {
  flex: 0 0 3.5rem;
  width: 3.5rem;
}
.custom-keyword-card .field--kw-num input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}
.custom-keyword-card-row .field--kw-custom {
  flex: 1 1 8rem;
  min-width: 5rem;
  max-width: 16rem;
}
.custom-keyword-card .field--kw-custom input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.keyword-remove-x {
  flex: 0 0 auto;
  align-self: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.keyword-remove-x:hover {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.45);
}
.add-keyword-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}
.add-keyword-btn:hover {
  border-color: var(--accent);
}
.attacker-unit-toolbar button,
.attacker-unit-card button[data-role="remove-instance"]:not(.keyword-remove-x),
.attacker-unit-card button[data-role="toggle-composition-options"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.attacker-unit-toolbar button:hover,
.attacker-unit-card button[data-role="remove-instance"]:not(.keyword-remove-x):hover,
.attacker-unit-card button[data-role="toggle-composition-options"]:hover {
  border-color: var(--accent);
}
.attacker-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 1rem;
  margin-top: 1rem;
  min-width: 0;
  width: 100%;
}
/* One unit card should span the full composer width (auto-fit can leave a narrow first column). */
.attacker-unit-grid > .attacker-unit-card:only-child {
  grid-column: 1 / -1;
}
.defender-pool-composer {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.45rem;
  margin-top: 0.5rem;
}
.defender-pool-composer > .attacker-unit-card {
  padding: 0.45rem 0.55rem;
}
.mixed-defender-block {
  padding: 0.35rem 0 0.15rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  margin-top: 0.35rem;
}
.mixed-defender-member-row {
  padding-left: 0.15rem;
  border-left: 2px solid var(--accent-muted, rgba(120, 180, 200, 0.35));
}
.mixed-attacker-block .mixed-defender-member-row {
  padding-left: 0;
  border-left: none;
}
.mixed-attacker-member-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.mixed-attacker-member-pick-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.55rem 0.65rem;
}
.mixed-attacker-member-pick-card .mixed-defender-member-picks {
  margin: 0;
}
.mixed-attacker-member-add {
  margin: 0.1rem 0 0.55rem;
}
.mixed-attacker-block-header .mixed-attacker-mixed-toggle {
  flex: 0 0 auto;
}
.mixed-member-leader-tag {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  opacity: 0.85;
}
.mixed-member-model-types-wrap {
  margin: 0.35rem 0 0.5rem 0.15rem;
  overflow-x: auto;
}
.mixed-member-model-types-table {
  width: 100%;
  max-width: 36rem;
  font-size: 0.82rem;
}
.mixed-member-type-count-input,
.defender-models-table .defender-model-type-count-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 0;
  width: auto;
  inline-size: 6.5ch;
  max-inline-size: 8ch;
}
.mixed-member-type-count-input:focus,
.defender-models-table .defender-model-type-count-input:focus {
  outline: none;
  border-color: var(--accent);
}
.mixed-save-order-block {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}
.mixed-save-order-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
  padding: 0.28rem 0.35rem;
  font-size: 0.84rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: default;
  user-select: none;
  touch-action: none;
}
.mixed-save-order-row--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.mixed-save-order-list--swap-dragging .mixed-save-order-row {
  transition: transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.mixed-save-order-row--swap-active {
  position: relative;
  z-index: 2;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  background: color-mix(in srgb, var(--surface, var(--bg)) 88%, var(--accent));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.mixed-save-order-list--swap-dragging {
  touch-action: none;
}
.mixed-save-order-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.mixed-save-order-drag-handle {
  flex: 0 0 auto;
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
  touch-action: none;
}
.mixed-save-order-label {
  cursor: grab;
  flex: 1 1 auto;
  min-width: 0;
}
.mixed-save-order-drag-handle:hover {
  color: var(--text);
}
.mixed-save-order-drag-handle:active,
.mixed-save-order-list--swap-dragging .mixed-save-order-row {
  cursor: grabbing;
}
.mixed-save-order-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.defender-pool-composer .defender-instance-toolbar,
.defender-pool-composer .defender-instance-mixed-summary {
  margin-bottom: 0.15rem;
}
#attackerPanel .attacker-unit-card .defender-instance-mixed-summary {
  margin-bottom: 0.15rem;
}
.defender-pool-composer .defender-instance-toolbar .field label {
  font-size: 0.78rem;
}
.defender-instance-mixed-summary .defender-mixed-unit-label {
  font-size: 0.95rem;
  line-height: 1.25;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.defender-mixed-unit-name {
  min-width: 0;
}
.defender-mixed-unit-points {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.defender-pool-composer .defender-instance-profile {
  margin-top: 0.4rem;
}
.defender-pool-composer .defender-instance-profile .abilities-list {
  margin-top: 0.5rem !important;
}
.defender-pool-composer .defender-instance-def-mod {
  margin-top: 0.45rem !important;
}
.defender-global-profile-mod-hidden {
  display: none !important;
}
.defender-instance-card .defender-instance-profile {
  margin-top: 0.65rem;
}
.defender-pool-composer .defender-instance-card .defender-instance-profile {
  margin-top: 0.35rem;
}
.defender-instance-card .defender-instance-def-mod {
  margin-top: 0.65rem;
}
.defender-pool-composer .defender-instance-card .defender-instance-def-mod {
  margin-top: 0.4rem !important;
}
.attacker-unit-card {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 0.85rem;
  background: rgba(255,255,255,0.02);
  min-width: 0;
}
.attacker-unit-card .field select,
.attacker-unit-card .field input,
.attacker-unit-card select[data-role="fallback-weapon"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 140px;
}
.attacker-unit-card .field input[type="number"] {
  min-width: 0;
  width: auto;
  inline-size: 6.5ch;
  max-inline-size: 8ch;
}
.attacker-unit-card .custom-weapon-editor .field input,
.attacker-unit-card .custom-weapon-editor .field select {
  min-width: 0;
}
/* Keyword editors outside .custom-weapon-editor: avoid card-wide min-width on inputs breaking the preset + value row */
.attacker-unit-card .unit-modifiers-panel .field input,
.attacker-unit-card .unit-modifiers-panel .field select,
.attacker-unit-card .weapon-profile-card .field input,
.attacker-unit-card .weapon-profile-card .field select {
  min-width: 0;
}
.attacker-unit-card .custom-weapon-editor .field input[type="number"] {
  min-width: 0;
  width: 100%;
}
.attacker-unit-card .custom-weapon-editor .field--cw-qty input[type="number"] {
  max-width: 3.5rem;
  margin-left: auto;
  margin-right: auto;
}
.attacker-unit-card .field select:focus,
.attacker-unit-card .field input:focus,
.attacker-unit-card select[data-role="fallback-weapon"]:focus {
  outline: none;
  border-color: var(--accent);
}
.defender-instance-card .defender-profile-edit-grid .field input,
.defender-instance-card .defender-profile-edit-grid .field select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.defender-instance-card .defender-profile-edit-grid .field input[type="number"] {
  inline-size: unset;
  max-inline-size: none;
}
.defender-instance-card .defender-profile-edit-grid .field--def-profile-plus-stat input {
  inline-size: unset;
  max-inline-size: 8ch;
  width: 100%;
}
.attacker-unit-card .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.3;
}
.attacker-unit-card .slot-option-qty-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: default;
  width: 100%;
}
.attacker-unit-card .slot-option-qty-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 0;
  width: 3.4rem;
  height: 1.85rem;
  padding: 0.2rem 0.35rem;
  text-align: center;
  box-sizing: border-box;
}
.attacker-unit-card .slot-option-qty-input:focus {
  outline: none;
  border-color: var(--accent);
}
.catalogue-model-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 0.45rem;
  align-items: stretch;
}
.catalogue-model-row {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  padding: 0.42rem 0.55rem 0.5rem;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.catalogue-model-row__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.22rem;
}
.catalogue-model-row__header--actions-only {
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0;
  position: absolute;
  top: 0.42rem;
  right: 0.55rem;
  z-index: 2;
}
.catalogue-model-row__title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}
.catalogue-model-row__qty-meta {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.catalogue-model-row__name {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 0;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  line-height: 1.1;
}
.catalogue-model-row__header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.catalogue-model-row__body {
  min-width: 0;
  flex: 1 1 auto;
}
.catalogue-model-row__main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.38rem 0.58rem;
}
.catalogue-model-row__enhancement-field {
  min-width: 13rem;
  flex: 1 1 100%;
  width: 100%;
}
.catalogue-model-row__selection {
  flex: 1 1 16rem;
  min-width: min(100%, 16rem);
}
.catalogue-model-row__summary {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.2rem 0;
  line-height: 1.2;
}
.catalogue-model-row__variant-stack {
  margin-bottom: 0.25rem;
}
.catalogue-model-row__variant-nested-slots {
  margin: 0.2rem 0 0.15rem 0.55rem;
  padding-left: 0.45rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}
.catalogue-model-row__variant-nested-slots--inactive {
  opacity: 0.42;
  pointer-events: none;
  filter: grayscale(0.25);
}
.catalogue-model-row__slot-block {
  margin-bottom: 0.3rem;
}
.catalogue-model-row__slot-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.catalogue-model-row__slot-help {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.28rem 0;
  line-height: 1.3;
}
.catalogue-model-row .field {
  margin: 0;
}
.catalogue-model-row__checkboxes {
  display: grid;
  gap: 0.12rem;
}
.catalogue-model-row__inline-hint {
  font-size: 0.74rem;
  color: var(--muted);
}
.unit-section-title {
  margin: 0.7rem 0 0.35rem 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.unit-section-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0.7rem 0 0.35rem 0;
}
.unit-section-header-row .unit-section-title {
  margin: 0;
  flex: 0 1 auto;
}
.ranged-firing-mode-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.4rem 0;
  flex-wrap: wrap;
}
.ranged-firing-mode-row .field {
  margin: 0;
}
.ranged-firing-mode-row select {
  min-width: 11rem;
}
.section-heading-note-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.section-heading-note-row > h2,
.section-heading-note-row > h3,
.section-heading-note-row > h4 {
  margin: 0;
}
/**
 * Composer section title + visibility (eye): state lives only on the unit instance.
 * Toggling these does not change the global View mode picklist (#attackerViewMode).
 */
.composer-section-toggle-row.unit-section-header-row,
.composer-section-toggle-row.weapon-profile-title-row {
  gap: 0.35rem;
  align-items: center;
}
.def-mod-block-header .unit-section-title {
  flex: 1 1 auto;
  min-width: 0;
}
.section-heading-note-row .panel-subheading {
  margin: 0;
}
.section-note-body {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
  max-width: 56rem;
  line-height: 1.4;
}
.section-note-body p {
  margin: 0 0 0.5rem 0;
}
.section-note-body p:last-child {
  margin-bottom: 0;
}
.chart-section-header {
  margin: 0 0 0.35rem 0;
}
.chart-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1 1 auto;
  min-width: 0;
}
.simulation-analytics-header {
  margin-bottom: 0.75rem;
}
.def-mod-block-header.section-heading-note-row {
  margin-bottom: 0.35rem;
}
/* Per-instance defender card: keep title width to text so the collapse eye sits beside the heading. */
.def-mod-block.defender-instance-def-mod .def-mod-block-header.section-heading-note-row {
  gap: 0.35rem 0.5rem;
}
.def-mod-block.defender-instance-def-mod .def-mod-block-header .unit-section-title {
  flex: 0 1 auto;
  max-width: max-content;
  min-width: 0;
}
.def-mod-block.defender-instance-def-mod .def-mod-block-header .def-mod-header-icon-actions {
  flex: 0 0 auto;
}
.weapon-profile-list {
  display: grid;
  gap: 0.6rem;
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  width: 100%;
}
@media (max-width: 767px) {
  .weapon-profile-list {
    grid-template-columns: 1fr;
  }
}
.weapon-profile-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.6rem;
  background: rgba(0,0,0,0.12);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.weapon-profile-card.weapon-profile-card--dimmed {
  opacity: 0.5;
}
.weapon-profile-name {
  margin: 0 0 0.45rem 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
}
.ability-mini-list {
  display: grid;
  gap: 0.45rem;
}
.ability-mini-item {
  font-size: 0.86rem;
  border-left: 2px solid rgba(20, 217, 196, 0.5);
  padding-left: 0.5rem;
}
.ability-mini-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.ability-mini-name--enhancement {
  color: var(--accent);
}
.imported-unit-row-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
}
.imported-unit-row-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #041313;
}
.imported-unit-row-btn.is-selected .custom-picklist-unit-points,
.imported-unit-row-btn.is-selected .custom-picklist-unit-name,
.imported-unit-row-btn.is-selected .catalogue-hint {
  color: #041313;
}
.ability-mini-desc {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.constraint-list {
  display: grid;
  gap: 0.45rem;
}
.constraint-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: rgba(0,0,0,0.12);
  font-size: 0.84rem;
}
.constraint-item strong { color: var(--text); }
.constraint-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  line-height: 1.35;
}

@media (max-width: 767px) {
  /* Avoid any right-edge overflow from minimum card widths */
  .attacker-unit-grid { grid-template-columns: 1fr; }
  .attacker-unit-card { min-width: 0; }

  /* Let fields shrink/wrap on phones */
  .field { min-width: 0; width: 100%; }
  /* Multi-field rows (Unit + Models + icons): each .field must NOT be 100% width or buttons clip off-screen */
  .attacker-unit-card .attacker-unit-header-row .field {
    width: auto;
    max-width: none;
  }
  .def-mod-list .def-mod-card-row > .field {
    width: auto;
    max-width: none;
  }
  .field select, .field input { min-width: 0; width: 100%; max-width: 100%; }
  .def-mod-list .def-mod-card-row .field--def-mod-kind {
    min-width: min(100%, 11rem);
  }
  .def-mod-list .def-mod-card-row .field--def-mod-kind.field--inline .custom-picklist-shell {
    min-width: 9rem;
  }
  .def-mod-list .def-mod-card-row .field--def-mod-kind .custom-picklist-trigger {
    white-space: nowrap;
  }
  .def-mod-list .def-mod-card-row .field--def-mod-kind select {
    min-width: 10rem;
    width: auto;
    max-width: 100%;
  }
  /* Mobile: global `.field { width:100% }` + cluster wrapper made × wrap alone.
     Flatten cluster into the card row so by + Half + × share one flex line. */
  .def-mod-list .def-mod-value-cluster {
    display: contents;
  }
  .def-mod-list .def-mod-value-cluster > .field {
    width: auto;
    max-width: none;
  }
  .def-mod-list .def-mod-card-row > .field--def-mod-num {
    width: auto;
    max-width: none;
  }
  .def-mod-list .def-mod-card-row .def-mod-damage-half {
    flex: 0 0 auto;
  }
  .def-mod-list .def-mod-card-row .keyword-remove-x {
    flex: 0 0 auto;
    align-self: center;
  }
  .def-mod-list .def-mod-card-row .field--def-mod-num input[type="number"] {
    width: auto;
  }

  .defender-profile-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .defender-profile-edit-grid .field--def-profile-stat {
    width: auto;
    max-width: none;
  }
  .defender-instance-card .defender-profile-edit-grid .field input[type="number"] {
    width: 100%;
    inline-size: unset;
    max-inline-size: none;
    min-inline-size: 0;
  }

  /* 3-digit-friendly numeric sizing (without forcing huge fields) */
  .field input[type="number"],
  .attacker-unit-card .field input[type="number"] {
    min-inline-size: 6.5ch;
    inline-size: 6.5ch;
    max-inline-size: 8ch;
    width: auto;
  }

  input[type="number"][data-role="defender-instance-count"],
  input[type="number"][data-role="mixed-member-count"],
  .attacker-unit-card .field input[type="number"][data-role="defender-instance-count"],
  .attacker-unit-card .field input[type="number"][data-role="mixed-member-count"],
  #targetCount {
    min-inline-size: 9ch;
    inline-size: 9ch;
    max-inline-size: 11ch;
  }

  /* Remove desktop indent that can push content past the edge */

  .custom-weapon-editor .field--cw-remove { justify-content: flex-start; }
}


/* Army import roster inputs */
  #attackerRosterInput,
  #defenderRosterInput {
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 6px;
caret-color: var(--text);
  }

  #attackerRosterInput:focus,
  #defenderRosterInput:focus {
outline: none;
border-color: var(--accent);
  }

  #attackerRosterInput::placeholder,
  #defenderRosterInput::placeholder {
color: var(--muted);
opacity: 1;
  }
