:root {
  color-scheme: dark;
  --ink: #111015;
  --panel: #1b191f;
  --panel-soft: #201d24;
  --field: #131217;
  --line: #373039;
  --line-soft: #2b262e;
  --gold: #d8b56f;
  --gold-bright: #f0d79f;
  --gold-muted: #958058;
  --cream: #f2ebe0;
  --text: #d9d3cd;
  --muted: #a49c98;
  --red: #a43835;
  --red-bright: #bf4943;
  --serif: "Cinzel", Georgia, serif;
  --sans: "DM Sans", "Segoe UI", Arial, sans-serif;
}

body[data-view="progress"] .page-intro { padding-top: 22px; padding-bottom: 15px; }
body[data-view="progress"] .page-intro h1 { font-size: 32px; }
#progress-page .xp-intro { margin: 0 0 16px; }
#progress-page .xp-intro h2 { margin: 0 0 7px; color: var(--cream); font: 500 24px/1.35 var(--serif); }
#progress-page .xp-intro p { margin: 0; }

/* Troop pairs follow the two columns in the game's march window at every width. */
.results-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.results-actions .button { min-height: 35px; padding: 8px 10px; font-size: 10px; }
.results-actions [aria-pressed="true"] { color: var(--gold-bright); border-color: var(--gold); }
.march-guide { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: -7px 0 18px; }
.march-guide p { margin: 0; color: #b6a68d; font-size: 11px; line-height: 1.8; }
.march-guide .text-button { min-height: 25px; font-size: 10px; }
.march-column-labels, .march-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.march-column-labels { padding: 8px 0; border-bottom: 1px solid var(--line); background: #0e0e1026; color: #a1937d; font-size: 9px; }
.march-column-labels span { padding: 0 15px; }
.march-row { position: relative; border-bottom: 1px solid #43372b77; }
.march-row:last-child { border-bottom: 0; }
.march-row:nth-child(even) { background: #f0dca004; }
.march-unit { position: relative; display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; min-width: 0; padding: 15px; align-items: center; }
.march-unit:nth-child(2) { border-left: 1px solid #55422c55; }
.march-unit.zero-count { opacity: .45; }
.march-unit-content { min-width: 0; }
.march-unit-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-height: 20px; margin-bottom: 5px; }
.march-unit .unit-name { font-size: 11px; line-height: 1.4; font-weight: 450; overflow-wrap: anywhere; }
.march-unit .tier-badge { margin: 0; padding: 1px 4px; font-size: 8px; white-space: nowrap; }
.unit-portrait { position: relative; z-index: 1; display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 80px; height: 80px; aspect-ratio: 1; border: 1px solid #8c7046; background: #2b241b; box-shadow: 0 2px 9px #0005; transform-origin: center; transition: transform .16s ease, box-shadow .16s ease; }
.unit-portrait img { display: block; width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; object-position: center 30%; }
.unit-portrait::after { content: ''; position: absolute; inset: -4px; z-index: 1; background: url('/portraits/game-frame.png') center / 100% 100% no-repeat; pointer-events: none; }
.unit-portrait .portrait-rank { z-index: 2; }
.unit-portrait:focus-visible { z-index: 12; outline: 2px solid var(--gold-bright); outline-offset: 3px; transform: scale(1.85); box-shadow: 0 6px 20px #000a; }
.march-unit:has(.unit-portrait:focus-visible), .march-row:has(.unit-portrait:focus-visible) { z-index: 8; }
.result-group:has(.unit-portrait:focus-visible) { position: relative; z-index: 8; overflow: visible; }
@media (hover: hover) and (pointer: fine) {
  .unit-portrait:hover { z-index: 12; transform: scale(1.85); box-shadow: 0 6px 20px #000a; }
  .march-unit:has(.unit-portrait:hover), .march-row:has(.unit-portrait:hover) { z-index: 8; }
  .result-group:has(.unit-portrait:hover) { position: relative; z-index: 8; overflow: visible; }
}
.portrait-tier-9 { border-color: #8b9957; }
.portrait-tier-8 { border-color: #b1b0a6; }
.portrait-tier-7 { border-color: #aa6250; }
.portrait-tier-6 { border-color: #a68d66; }
.portrait-rank { position: absolute; top: -6px; left: -6px; display: flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 3px; border: 1px solid #9d875b; border-radius: 50%; background: #303125; color: #f5e8b7; font: 600 10px/1 var(--serif); box-shadow: 0 1px 4px #0006; }
.portrait-tier-9 .portrait-rank { background: #43591f; }
.portrait-tier-8 .portrait-rank { background: #75746a; }
.portrait-tier-7 .portrait-rank { background: #653129; }
.portrait-fallback { color: #ae9569; font: 500 16px/1 var(--serif); }
.stack-amount { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-width: 0; min-height: 37px; padding: 5px 9px; border: 1px solid #675238; border-radius: 2px; background: linear-gradient(105deg, #e2d2af, #cbb994); color: #49302b; box-shadow: inset 0 1px 3px #53402444; font: 550 21px/1.2 var(--sans); font-variant-numeric: tabular-nums; text-align: left; }
.stack-amount:hover { border-color: #dec58e; background: #efdfb9; }
.stack-amount svg { width: 12px; height: 12px; flex-shrink: 0; color: #75593a; opacity: .65; }
.stack-amount.copied { border-color: #a8bd70; background: #c8d2a6; color: #334322; }
.order-actions { display: flex; gap: 5px; margin-top: 5px; }
.order-actions button { min-width: 31px; min-height: 25px; border: 1px solid #675238; background: #231f1c; color: #e0c99d; font-size: 15px; }
.order-actions button:disabled { opacity: .25; cursor: default; }
@media (max-width: 600px) {
  .results-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .results-actions { justify-content: flex-start; }
  .march-unit { grid-template-columns: 56px minmax(0, 1fr); gap: 7px; padding: 12px 8px; }
  .unit-portrait { width: 56px; height: 56px; }
  .portrait-rank { min-width: 18px; height: 18px; top: -5px; left: -4px; font-size: 8px; }
  .march-unit .unit-name { font-size: 10px; }
  .march-unit .tier-badge { font-size: 7px; }
  .stack-amount { min-height: 33px; padding: 5px 6px; font-size: 17px; }
  .stack-amount svg { display: none; }
  .march-column-labels { font-size: 8px; }
  .march-column-labels span { padding: 0 9px; }
  .march-guide p { font-size: 10px; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body::before { position: fixed; inset: 0; z-index: -1; content: ""; pointer-events: none; background: radial-gradient(ellipse at 0 0, #58252638, transparent 38%), radial-gradient(ellipse at 100% 20%, #5b412014, transparent 47%), linear-gradient(180deg, #17131900 40%, #0e0e12 100%); }
body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, summary, select, input[type="checkbox"] { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .55; }
input { min-width: 0; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 4px; }
input:focus-visible, select:focus-visible { outline-offset: 1px; }
::selection { background: #8f663b; color: white; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -70px; left: 20px; z-index: 100; padding: 10px 18px; background: var(--gold); color: #171318; }
.skip-link:focus { top: 12px; }
.site-shell { width: min(1200px, calc(100% - 72px)); margin: 0 auto; }

.site-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; min-height: 114px; border-bottom: 1px solid var(--line-soft); }
.brand { display: inline-flex; align-items: center; gap: 15px; color: var(--gold); }
.brand-mark { width: 36px; height: 42px; }
.brand-name { display: block; color: var(--cream); font: 600 28px/1.1 var(--serif); letter-spacing: .17em; }
.brand-subtitle { display: block; margin-top: 5px; font-size: 8.7px; font-weight: 550; letter-spacing: .2em; }
.header-note { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; }
.header-tools { display: flex; flex: 1; align-items: center; justify-content: flex-end; flex-wrap: wrap; min-width: 0; gap: 12px 22px; }
.language-control { display: flex; align-items: center; gap: 9px; min-width: 0; color: #afa18e; font-size: 11px; }
.language-control > span, .language-control > label { flex-shrink: 0; }
#language-select { width: auto; min-width: 175px; max-width: 245px; min-height: 38px; padding: 8px 30px 8px 11px; border: 1px solid #554535; border-radius: 2px; background: #1c171e; color: #decdb2; font-size: 12px; line-height: 1.4; cursor: pointer; }
#language-select:hover { border-color: #9e8150; }
#language-select:focus-visible { border-color: var(--gold); outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.tiny-diamond { display: inline-block; width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); }

.tier-navigation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.tier-card { position: relative; display: flex; gap: 17px; align-items: center; min-height: 91px; padding: 19px 23px; border: 1px solid var(--line); background: #1b181e90; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
.tier-card:not([aria-current="page"]):hover { border-color: #7b6747; background: #252026; transform: translateY(-1px); }
.tier-card[aria-current="page"] { border-color: #e6bb68; background: linear-gradient(115deg, #76552c, #48331f); box-shadow: inset 0 0 0 1px #f5d49145, 0 3px 16px #e6b45820; }
.tier-card[aria-current="page"]:hover { transform: none; }
.tier-card:focus-visible { outline: 2px solid #fff0c5; outline-offset: 3px; }
.tier-card[aria-current="page"] .tier-card-title { color: #fff3d2; }
.tier-card[aria-current="page"] .tier-card-subtitle { color: #f1d5a6; }
.tier-card[aria-current="page"]::before, .tier-card.is-active::before, .tier-card.active::before, .tier-card.selected::before { position: absolute; content: ""; left: -1px; top: 18px; bottom: 18px; width: 3px; background: var(--gold); }
.tier-card-number { color: #847461; font: 500 30px/1 var(--serif); min-width: 59px; }
.tier-card[aria-current="page"] .tier-card-number, .tier-card.is-active .tier-card-number, .tier-card.active .tier-card-number { color: #ffdc8d; }
.tier-card-title { display: block; color: var(--cream); font-size: 16px; font-weight: 600; }
.tier-card-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.tier-card-arrow { margin-left: auto; color: #83776c; font-size: 20px; }
.tier-card[aria-current="page"] .tier-card-arrow { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid #f7d99b80; border-radius: 50%; background: #f0cc7520; color: #fff0bc; font-size: 0; }
.tier-card[aria-current="page"] .tier-card-arrow::after { content: "\2713"; font: 600 16px/1 var(--sans); }

.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 41px 0 33px; }
.eyebrow, .step-label { margin: 0; color: var(--gold-muted); font-size: 9px; font-weight: 600; letter-spacing: .16em; }
.page-intro .eyebrow { margin-bottom: 6px; }
h1 { margin: 0; color: var(--cream); font: 500 42px/1.3 var(--serif); letter-spacing: -.035em; }
.intro-copy { margin: 9px 0 0; color: #b4aaa5; font-size: 14px; }
.tier-summary { max-width: 295px; margin: 17px 0 0; padding-left: 17px; border-left: 1px solid #74613f; color: var(--muted); font-size: 12px; line-height: 1.9; }
.calculator-layout { display: grid; grid-template-columns: 326px minmax(0, 1fr); gap: 29px; align-items: start; }
.settings-column, .results-column { min-width: 0; }
.panel { border: 1px solid var(--line); background: var(--panel); }
.capacity-panel { position: relative; padding: 25px; border-top-color: #76603b; }
.capacity-panel::before { position: absolute; top: -1px; left: -1px; width: 28px; height: 2px; content: ""; background: var(--gold); }
.panel-heading h2 { margin: 9px 0 5px; font-size: 19px; font-weight: 550; color: var(--cream); letter-spacing: -.025em; }
.panel-heading p { margin: 0 0 26px; color: var(--muted); font-size: 11px; }
.budget-field { margin-bottom: 18px; }
.budget-field > label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: 12px; font-weight: 550; }
.resource-label { display: flex; align-items: center; gap: 8px; }
.resource-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 19px; font-size: 18px; line-height: 1; }
.leadership-icon { color: #c6a56d; }
.dominance-icon { color: #9d9cc9; }
.authority-icon { color: #b99b80; }
.field-hint { color: #89807e; font-size: 10px; font-weight: 400; }
.budget-field > input { width: 100%; height: 51px; padding: 10px 13px; border: 1px solid #3c333b; border-radius: 2px; background: var(--field); color: var(--cream); font-size: 22px; font-weight: 450; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
input::placeholder { color: #655c61; }
input:hover, select:hover { border-color: #776647; }
input:focus, select:focus { border-color: var(--gold); }
.inclusion-options { display: grid; gap: 10px; margin: 23px 0 22px; padding-top: 19px; border-top: 1px solid var(--line-soft); }
.checkbox-label { display: flex; align-items: center; gap: 9px; color: #b9b0ab; font-size: 11px; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--gold); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 10px 15px; border: 1px solid transparent; border-radius: 2px; background: transparent; font-size: 11px; font-weight: 600; line-height: 1.3; transition: background .15s, border-color .15s; }
.button svg { width: 17px; height: 17px; }
.button-primary { width: 100%; min-height: 48px; padding: 13px; border-color: #b94741; background: linear-gradient(180deg, #a83a36, #8d2b2a); color: #fff4e7; box-shadow: 0 3px 10px #0003; }
.button-primary:hover { background: linear-gradient(180deg, #bc4741, #a2312f); }
.button-primary > span:last-child { margin-left: auto; font-size: 18px; font-weight: 400; }
.status-line { min-height: 0; margin: 10px 0 0; color: #b7a78b; font-size: 10px; line-height: 1.6; }
.status-line:empty { display: none; }
.button-outline { border-color: #655238; color: var(--gold-bright); }
.button-outline:hover { background: #74603a24; border-color: #a28551; }
.button-subtle { border-color: var(--line); color: #b7ada5; }
.button-subtle:hover { background: #ffffff07; border-color: #776647; color: var(--cream); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 0; border: 0; background: none; color: #a69a8a; font-size: 10px; }
.text-button:hover { color: var(--gold-bright); }
.reset-settings { width: 100%; margin-top: 4px; }
.reset-settings > span { font-size: 17px; }

.calibration-panel { margin-top: 15px; background: #1a171d; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.calibration-panel > summary { display: flex; align-items: center; gap: 11px; min-height: 75px; padding: 17px 19px; font-size: 12px; color: #d7cbbb; }
.summary-icon { font-size: 19px; color: #b49a67; }
.calibration-panel summary small { display: block; margin-top: 3px; color: #8f8480; font-size: 9px; }
.details-chevron { margin-left: auto; font-size: 17px; color: #8d795a; transition: transform .15s; }
details[open] .details-chevron { transform: rotate(180deg); }
.details-content { padding: 0 20px 18px; }
.help-copy { margin: 0 0 18px; color: #9b9089; font-size: 10px; line-height: 1.8; }
.help-copy.small { margin: 12px 0 0; font-size: 9px; }
.bonus-group { min-width: 0; margin: 0 0 15px; padding: 0; border: 0; }
.bonus-group legend { width: 100%; margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); color: #c4b8a7; font-size: 11px; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.field-pair label { color: #9e928a; font-size: 9px; }
.field-pair input { display: block; width: 100%; height: 35px; margin-top: 5px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--field); color: var(--cream); font-size: 12px; font-variant-numeric: tabular-nums; }

.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; margin-bottom: 18px; }
.results-heading .step-label { color: #8f8376; }
.results-heading h2 { margin: 6px 0 0; color: var(--cream); font-size: 22px; font-weight: 500; letter-spacing: -.035em; }
.copy-button { min-height: 34px; padding: 7px 10px; font-size: 10px; }
.copy-button svg { width: 15px; height: 15px; }
.resource-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.resource-summary:empty { display: none; }
.resource-card, .budget-summary-card, .summary-card { min-width: 0; padding: 14px 13px 12px; border: 1px solid var(--line); background: #1b181e; }
.resource-card h3, .budget-summary-card h3, .summary-card h3, .resource-card .label, .summary-label { margin: 0 0 8px; color: #aa9a85; font-size: 10px; font-weight: 500; }
.resource-card strong, .budget-summary-card strong, .summary-card strong, .resource-used { display: block; color: var(--cream); font-size: 17px; font-weight: 550; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.resource-card small, .budget-summary-card small, .summary-card small, .resource-limit { display: block; margin-top: 4px; color: #8a7f79; font-size: 9px; font-variant-numeric: tabular-nums; }
.resource-card .bar, .budget-bar, .progress-bar, .resource-bar { height: 3px; margin-top: 11px; overflow: hidden; background: #373039; }
.resource-card .bar span, .budget-bar span, .progress-bar span, .resource-bar span, .resource-bar i, .resource-card .bar i { display: block; height: 100%; max-width: 100%; background: #b69b63; }
.resource-card.dominance .bar span, .resource-card.dominance .bar i, .resource-card[data-category="dominance"] .bar span, .resource-card[data-category="dominance"] .resource-bar span { background: #9591b9; }
.resource-card.authority .bar span, .resource-card.authority .bar i { background: #a68772; }
.results-container { min-height: 280px; }
.empty-state { display: flex; min-height: 340px; padding: 35px; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); background: #1c191d50; text-align: center; }
.empty-emblem { color: #8e73484d; font-size: 48px; }
.empty-state h3 { margin: 12px 0 6px; color: #c8b99e; font-family: var(--serif); font-size: 18px; font-weight: 400; }
.empty-state p { max-width: 300px; margin: 0; color: #92867f; font-size: 12px; }

.results-container > section, .result-category, .troop-section, .result-group { overflow: hidden; margin-bottom: 17px; border: 1px solid var(--line); background: #1b181c; }
.category-header, .result-category > header, .troop-section > header, .result-group > header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid #6550334d; background: linear-gradient(110deg, #6b53252b, #4c392015); }
.category-header h3, .result-category > header h3, .troop-section > header h3, .result-group > header h3, .section-heading h3 { margin: 0; color: var(--gold); font: 500 14px/1.5 var(--serif); letter-spacing: .045em; }
.category-header small, .category-meta, .section-count, .category-budget { color: #a3967c; font-size: 10px; font-variant-numeric: tabular-nums; }
.results-container table { width: 100%; border-collapse: collapse; }
.results-container thead th { padding: 9px 18px; border-bottom: 1px solid var(--line-soft); background: #0e0e1026; color: #978a80; text-align: left; font-size: 9px; font-weight: 450; }
.results-container tbody td { padding: 12px 18px; border-bottom: 1px solid #312a2d6b; font-size: 12px; }
.results-container tbody tr:nth-child(even) { background: #ffffff03; }
.results-container tbody tr:hover { background: #d8b56f06; }
.results-container tbody tr:last-child td { border-bottom: 0; }
.results-container th:last-child, .results-container td:last-child, .results-container .numeric, .results-container .number, .results-container .count { text-align: right; font-variant-numeric: tabular-nums; }
.results-container tbody td:last-child, .results-container .count { color: var(--cream); font-size: 15px; font-weight: 550; }
.results-container .troop-name { color: #d2c7ba; }
.results-container .troop-meta, .results-container .troop-tier, .troop-name small { display: inline-block; margin-left: 8px; color: #7f746b; font-size: 9px; font-weight: 400; }
.troop-name small { display: block; margin-left: 0; margin-top: 1px; }
.tier-badge, .family-badge { display: inline-block; padding: 1px 5px; border: 1px solid #584a354d; border-radius: 2px; color: #a99879; font-size: 8px; letter-spacing: .035em; }
.result-note, .section-note { margin: 0; padding: 10px 18px; border-top: 1px solid var(--line-soft); color: #8f8179; font-size: 10px; }
.notice, .warnings { margin: 0 0 20px; padding: 12px 15px; border: 1px solid #8d693a6b; background: #7b51201a; color: #d8ba86; font-size: 11px; }
.warnings { list-style-position: inside; }
.warnings li + li { margin-top: 4px; }
.notice-error { border-color: #9a4f4b; background: #76332f28; color: #f0beb4; }

.merc-card { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 20px; padding: 22px; border: 1px solid #4d4034; background: linear-gradient(110deg, #38261d70, #20191f); }
.merc-card-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 39px; height: 43px; margin-top: 2px; border: 1px solid #72573870; color: #cfab72; font-size: 26px; background: #bb945612; }
.merc-card-copy { min-width: 0; }
.merc-card .eyebrow { font-size: 8px; color: #a28a65; letter-spacing: .13em; }
.merc-card h2 { margin: 4px 0 7px; color: #e4d4bb; font-size: 15px; font-weight: 500; letter-spacing: -.015em; }
.merc-card-copy > p:not(.eyebrow) { max-width: 390px; margin: 0; color: #a89888; font-size: 10px; line-height: 1.8; }
.merc-count { display: block; margin-top: 9px; color: #b7a07e; font-size: 9px; }
.merc-card > button { flex-shrink: 0; align-self: center; margin-left: auto; padding: 10px 12px; font-size: 9px; }
.source-details { margin-top: 21px; color: #8f837b; font-size: 10px; }
.source-details > summary { display: inline-flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 10px; }
.source-details > div { max-width: 620px; padding-bottom: 8px; }
.source-details p { margin: 4px 0 10px; line-height: 1.9; }
.source-details ul { padding-left: 15px; }
.source-details li { margin-bottom: 4px; }
.source-details a { color: #b8a080; text-decoration: underline; text-underline-offset: 3px; }
.source-details a:hover { color: var(--gold-bright); }
.site-footer { display: flex; align-items: center; gap: 20px; margin-top: 53px; padding: 24px 0 27px; border-top: 1px solid var(--line-soft); }
.footer-wordmark { display: flex; align-items: center; gap: 16px; color: #b7a17d; font: 500 12px/1 var(--serif); letter-spacing: .16em; }
.footer-wordmark .tiny-diamond { width: 3px; height: 3px; background: #77674d; }
.site-footer p, .footer-note { margin: 0; color: #746b65; font-size: 9px; }
.footer-note { margin-left: auto; }

dialog { width: min(1190px, calc(100% - 48px)); max-width: none; max-height: 91vh; padding: 0; overflow: auto; border: 1px solid #766044; border-radius: 3px; background: #1b181f; color: var(--text); box-shadow: 0 30px 100px #0009; }
dialog::backdrop { background: #07060bba; backdrop-filter: blur(5px); }
.dialog-heading { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px 29px 21px; border-bottom: 1px solid var(--line); background: #211c24; }
.dialog-heading h2 { margin: 5px 0 0; color: var(--cream); font: 500 23px/1.4 var(--serif); letter-spacing: -.025em; }
.dialog-heading .eyebrow { font-size: 8px; }
.dialog-close { min-width: 34px; min-height: 34px; padding: 3px; border-color: #5d4c43; }
.dialog-close span { font-size: 25px; font-weight: 400; }
.dialog-body { padding: 21px 29px 10px; }
.dialog-description { max-width: 820px; margin: 0; color: #b5aaa0; font-size: 12px; line-height: 1.9; }
.merc-toolbar { display: flex; align-items: flex-end; gap: 18px; margin: 21px 0 17px; }
.merc-toolbar > button { min-height: 39px; font-size: 10px; }
.merc-corrections { margin: 15px 0 0; }
.merc-toolbar > label { width: 185px; color: #a69a8e; font-size: 10px; }
.merc-toolbar .search-label { flex: 1; max-width: 370px; }
.merc-toolbar input, .merc-toolbar select { display: block; width: 100%; height: 39px; margin-top: 6px; padding: 9px 11px; border: 1px solid #493c44; border-radius: 2px; background: var(--field); color: #d6cabb; font-size: 12px; }
.merc-table-scroll { overflow-x: auto; border: 1px solid var(--line); scrollbar-color: #77603d #1c1820; scrollbar-width: thin; }
.merc-table { width: 100%; min-width: 1000px; border-collapse: collapse; }
.merc-table thead th { padding: 12px 8px; border-bottom: 1px solid #65543c; background: #2b2326; color: #bca585; font-size: 9px; font-weight: 500; white-space: nowrap; text-align: left; }
.merc-table th:first-child, .merc-table td:first-child { width: 35px; padding-left: 13px; text-align: center; }
.merc-table th:nth-child(2) { min-width: 165px; }
.merc-table th:nth-child(3) { min-width: 60px; }
.merc-table tbody tr:nth-child(even) { background: #ffffff03; }
.merc-table tbody td { padding: 10px 6px; border-bottom: 1px solid #30272f; vertical-align: middle; font-size: 10px; }
.merc-table tbody tr:last-child td { border-bottom: 0; }
.merc-table tbody tr:has(input[type="checkbox"]:checked) { background-color: #c0a46404; }
.merc-table input:not([type="checkbox"]), .merc-table select { width: 100%; min-width: 65px; height: 32px; padding: 6px; border: 1px solid #453841; border-radius: 2px; background: #131117; color: #d9cfc1; font-size: 10px; font-variant-numeric: tabular-nums; }
.merc-table input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.merc-table input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.merc-table input[data-field="name"], .merc-table input[name="name"], .merc-table .merc-name input { min-width: 150px; }
.merc-table input[data-field="tier"] { min-width: 42px; max-width: 62px; }
.merc-table .merc-name { color: #d0c1ad; font-weight: 500; }
.merc-table .merc-name small { display: block; margin-top: 3px; color: #86786d; font-size: 8px; font-weight: 400; }
.merc-table button { min-width: 27px; min-height: 28px; padding: 4px; border: 1px solid #58414a; border-radius: 2px; background: #2c2027; color: #b89191; font-size: 12px; }
.merc-table button:hover { border-color: #ab625c; color: #f1bdb2; }
.merc-table td.empty, .merc-table .empty-row td { padding: 30px; color: var(--muted); text-align: center; }
.editor-help { margin: 12px 0 7px; color: #8f8176; font-size: 9px; line-height: 1.9; }
.dialog-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 17px; padding: 17px 29px 22px; border-top: 1px solid #3b3038; }
.dialog-footer > .button { font-size: 10px; }
.dialog-footer p { margin: 0 0 0 auto; color: #8a7c71; font-size: 9px; }

/* Live calculator results and editable troop values. */
.resource-card > .resource-label { display: block; margin-bottom: 8px; color: #b5a38b; font-size: 10px; font-weight: 500; }
.resource-track { height: 3px; margin-top: 11px; overflow: hidden; background: #373039; }
.resource-track > span { display: block; height: 100%; max-width: 100%; background: #b69b63; }
.resource-card.dominance .resource-track > span { background: #9591b9; }
.resource-card.authority .resource-track > span { background: #a68772; }
.result-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 15px 18px; border-bottom: 1px solid #6550334d; background: linear-gradient(110deg, #6b53252b, #4c392015); }
.result-group-heading .eyebrow { color: #8f7d61; font-size: 8px; }
.result-group-heading h2 { margin: 4px 0 0; color: var(--gold); font: 500 15px/1.5 var(--serif); letter-spacing: .035em; }
.group-total { color: #b8a88b; font: 400 19px/1.3 var(--serif); font-variant-numeric: tabular-nums; }
.results-container .stack-table th:nth-child(2) { text-align: right; }
.results-container .stack-table th:last-child { color: #776d66; }
.results-container .stack-table th:nth-child(2), .results-container .stack-table td:nth-child(2) { width: 23%; }
.results-container .stack-table th:last-child, .results-container .stack-table td:last-child { width: 24%; }
.unit-name { color: #d7cbbb; }
.unit-name + .tier-badge { margin-left: 8px; vertical-align: 1px; }
.results-container tbody td.unit-count { color: var(--cream); font-size: 16px; font-weight: 550; text-align: right; font-variant-numeric: tabular-nums; }
.results-container tbody td.unit-cost { color: #93867a; font-size: 11px; font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; }
.results-container tr.zero-count { opacity: .45; }
.damage-note { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; padding: 2px 0 0; color: #8d8074; font-size: 10px; font-variant-numeric: tabular-nums; }
.damage-note strong { color: #c2ad8a; font-weight: 500; }
.merc-table .merc-number { min-width: 75px; }
.merc-table input.merc-name { min-width: 155px; color: #e0ceba; font-weight: 450; }
.merc-table .correction-tag { display: block; margin-top: 4px; color: #c8a46a; font-size: 8px; line-height: 1.4; }
.merc-table a { color: #ad9879; font-size: 9px; white-space: nowrap; }
.merc-table a:hover { color: var(--gold-bright); }
.results-container[aria-busy="true"] { opacity: .55; }
.calibration-panel .help-copy { font-size: 11px; }
.calibration-panel .help-copy.small { font-size: 10px; }
.calibration-panel .field-pair label { font-size: 10px; }
.panel-heading p { font-size: 12px; }
.checkbox-label { font-size: 12px; }
.field-hint { font-size: 11px; }

/* Accounts keep their own army settings while sharing the tier navigation. */
.profile-panel { position: relative; z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 11px 14px; min-width: 0; margin: 0 0 25px; padding: 16px 20px; border: 1px solid #4d4034; background: linear-gradient(110deg, #30251c70, #1e1921); }
.profile-panel > label, .profile-panel .profile-picker { display: flex; flex: 1 1 280px; align-items: center; gap: 11px; min-width: 0; max-width: 570px; color: #c2ae8e; font-size: 11px; font-weight: 500; }
.profile-panel label > span { flex-shrink: 0; }
#profile-select { display: block; flex: 1; width: 100%; min-width: 0; min-height: 39px; padding: 8px 30px 8px 11px; border: 1px solid #5d4a34; border-radius: 2px; background: #141217; color: #e5d7c0; font-size: 12px; line-height: 1.4; text-overflow: ellipsis; }
#profile-select:hover { border-color: #a38650; }
#profile-select:focus-visible { border-color: var(--gold); }
#new-profile { flex-shrink: 0; min-height: 39px; white-space: nowrap; }
.profile-management { position: relative; flex-shrink: 0; margin-left: auto; color: #b9a78a; font-size: 11px; }
.profile-management > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; padding: 9px 12px; border: 1px solid #594733; border-radius: 2px; color: #c9b28b; white-space: nowrap; }
.profile-management > summary::after { content: "⌄"; color: #927c59; font-size: 13px; }
.profile-management > summary:hover, .profile-management[open] > summary { border-color: #9b7b49; background: #765d3020; }
.profile-management[open] > summary::after { transform: rotate(180deg); }
.profile-management > .profile-actions, .profile-management > div { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; display: grid; gap: 5px; width: max-content; min-width: 190px; max-width: min(290px, 80vw); padding: 9px; border: 1px solid #766044; border-radius: 2px; background: #251e27; box-shadow: 0 12px 30px #0008; }
.profile-management .button, .profile-management .text-button { justify-content: flex-start; width: 100%; min-height: 35px; margin: 0; padding: 8px 10px; font-size: 11px; text-align: left; white-space: normal; }
.profile-management button:hover { background: #a58b5414; }
.profile-help { flex: 0 0 100%; min-width: 0; margin: 0; color: #a29480; font-size: 11px; line-height: 1.7; }
#profile-dialog { width: min(520px, calc(100% - 36px)); max-height: 88vh; }
#profile-dialog > h2 { margin: 24px 28px 0; color: var(--cream); font: 500 23px/1.4 var(--serif); }
#profile-form { min-width: 0; padding: 23px 28px 25px; }
#profile-form > p { margin: 0 0 18px; color: #b5a58f; font-size: 12px; line-height: 1.8; }
#profile-form label { display: block; margin-bottom: 7px; color: #c7b495; font-size: 12px; font-weight: 500; }
#profile-name { display: block; width: 100%; min-width: 0; height: 45px; padding: 11px 12px; border: 1px solid #64503a; border-radius: 2px; background: #131117; color: #f0e1c8; font-size: 15px; }
#profile-name:focus-visible { border-color: var(--gold); }
.profile-dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.profile-dialog-actions .button { min-height: 40px; }
.profile-dialog-actions .button-primary { width: auto; min-width: 132px; }

/* Primary sections share the same compact navigation and independent pages. */
.section-navigation { display: flex; align-items: stretch; flex-wrap: wrap; gap: 5px 17px; margin: 7px 0 0; border-bottom: 1px solid var(--line-soft); }
.section-navigation > a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; margin-bottom: -1px; padding: 13px 13px 12px; border-bottom: 2px solid transparent; color: #a99c8c; font-size: 12px; font-weight: 500; line-height: 1.45; text-align: center; transition: color .15s, border-color .15s; }
.section-navigation > a:hover { color: var(--cream); border-bottom-color: #73613f; }
.section-navigation > a[aria-current="page"] { color: var(--gold-bright); border-bottom-color: var(--gold); }
.section-navigation svg { width: 15px; height: 15px; }
.section-navigation > a[data-page="advanced"] { margin-left: auto; color: #9d8d76; font-size: 11px; }
.section-navigation > a[data-page="advanced"][aria-current="page"] { color: var(--gold-bright); }

/* Detailed bonuses and troop stats live away from the everyday march setup. */
#advanced-page { width: 100%; min-width: 0; margin: 32px auto 0; }
.advanced-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px 25px; margin-bottom: 24px; }
.advanced-header > div { flex: 1 1 360px; min-width: 0; }
.advanced-header .eyebrow { margin-bottom: 8px; }
.advanced-header h1 { margin: 0; font-size: 35px; line-height: 1.35; }
.advanced-header p:not(.eyebrow) { max-width: 790px; margin: 11px 0 0; color: #b6a68e; font-size: 13px; line-height: 1.9; }
.advanced-header .button, .advanced-header .text-button { flex-shrink: 0; min-height: 39px; margin-top: 5px; }
.advanced-status { min-width: 0; margin: 0 0 19px; padding: 11px 14px; border-left: 2px solid #a2824e; background: #8d66251a; color: #d2ba8f; font-size: 12px; line-height: 1.8; }
.advanced-status:empty { display: none; }
.advanced-panel { min-width: 0; margin-bottom: 22px; padding: 25px 27px; border: 1px solid #4e4034; background: #1b181f; }
.advanced-panel > h2, .advanced-panel > header h2 { margin: 0 0 13px; color: #e2cca3; font: 500 21px/1.55 var(--serif); }
.advanced-panel > p, .advanced-panel > header p { max-width: 870px; margin: 9px 0 17px; color: #b9aa93; font-size: 12px; line-height: 1.9; }
.advanced-panel h3 { color: #d7c09a; font-size: 15px; font-weight: 500; }
.advanced-panel .calibration-panel { margin: 0; border: 0; background: transparent; }
.advanced-panel .calibration-panel > summary { min-height: 0; padding: 0 0 18px; font-size: 15px; }
.advanced-panel .calibration-panel > summary small { font-size: 11px; }
.advanced-panel .calibration-panel .details-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 27px; padding: 0; }
.advanced-panel .calibration-panel .details-content > p { grid-column: 1 / -1; }
.advanced-panel .calibration-panel .help-copy { max-width: 900px; color: #b0a08a; font-size: 12px; }
.advanced-panel .calibration-panel .help-copy.small { margin-top: 0; font-size: 11px; }
.advanced-panel .bonus-group { margin-bottom: 18px; }
.advanced-panel .bonus-group legend { margin-bottom: 10px; color: #cdb896; font-size: 13px; }
.advanced-panel .calibration-panel .field-pair label { color: #ad9c82; font-size: 11px; }
.advanced-panel .field-pair input { height: 43px; padding: 10px 11px; font-size: 14px; }
.advanced-panel .merc-toolbar { flex-wrap: wrap; margin-top: 20px; }
.advanced-panel .merc-toolbar label { font-size: 11px; }
#advanced-merc-tier, #advanced-merc-search { min-width: 0; height: 41px; font-size: 13px; }
.advanced-panel .merc-table th { font-size: 10px; }
.advanced-panel .merc-table td { font-size: 11px; }
.advanced-panel .merc-table input:not([type="checkbox"]), .advanced-panel .merc-table select { height: 37px; font-size: 12px; }
.advanced-panel .editor-help { margin-top: 13px; font-size: 11px; }
.advanced-panel .dialog-footer { margin: 19px -27px -25px; padding: 18px 27px; }

.results-column > .merc-card { gap: 13px; padding: 17px 19px; }
.results-column > .merc-card .merc-card-icon { width: 33px; height: 36px; font-size: 23px; }
.results-column > .merc-card h2 { margin: 3px 0 5px; font-size: 14px; }
.results-column > .merc-card .merc-count { margin-top: 6px; font-size: 10px; }
#merc-dialog:has(.merc-inventory-table) { width: min(820px, calc(100% - 48px)); }
.merc-table.merc-inventory-table { width: 100%; min-width: 0; table-layout: fixed; }
.merc-table.merc-inventory-table th, .merc-table.merc-inventory-table td { padding: 11px 10px; }
.merc-table.merc-inventory-table th { font-size: 11px; line-height: 1.5; white-space: normal; }
.merc-table.merc-inventory-table th:first-child, .merc-table.merc-inventory-table td:first-child { width: 42px; padding-left: 11px; padding-right: 7px; }
.merc-table.merc-inventory-table th:nth-child(2) { min-width: 0; }
.merc-table.merc-inventory-table th:nth-child(3), .merc-table.merc-inventory-table td:nth-child(3) { width: 64px; min-width: 0; text-align: center; }
.merc-table.merc-inventory-table th:nth-child(4), .merc-table.merc-inventory-table td:nth-child(4) { width: 160px; text-align: right; }
.merc-inventory-name, .merc-inventory-unit, .merc-inventory-table td:nth-child(2) > div { display: flex; align-items: center; gap: 11px; min-width: 0; }
.merc-inventory-label, .merc-inventory-table .merc-name { min-width: 0; color: #d9c8ad; font-size: 12px; font-weight: 450; line-height: 1.65; overflow-wrap: anywhere; }
.merc-inventory-portrait, .merc-inventory-table td:nth-child(2) img { display: block; flex-shrink: 0; width: 36px; height: 36px; aspect-ratio: 1; border: 1px solid #756345; background: #2a211b; object-fit: cover; object-position: center 30%; }
.merc-inventory-table .unit-portrait { flex-shrink: 0; width: 36px; height: 36px; }
.merc-inventory-table .portrait-rank { top: -4px; left: -4px; min-width: 15px; height: 15px; font-size: 7px; }
.merc-inventory-table input:not([type="checkbox"]), .merc-inventory-table .merc-number { min-width: 0; height: 39px; padding: 8px 9px; font-size: 13px; text-align: right; }
.merc-inventory-table input[type="checkbox"] { width: 17px; height: 17px; }
.merc-inventory-table .tier-badge { padding: 2px 6px; font-size: 10px; }
#merc-dialog:has(.merc-inventory-table) .dialog-footer { justify-content: flex-end; gap: 10px; }
#merc-dialog:has(.merc-inventory-table) .dialog-footer .button-primary { width: auto; min-width: 120px; }

@media (max-width: 680px) {
  #advanced-page { margin-top: 26px; }
  .advanced-header { gap: 14px; margin-bottom: 19px; }
  .advanced-header > div { flex-basis: 100%; }
  .advanced-header h1 { font-size: 28px; }
  .advanced-header p:not(.eyebrow) { font-size: 12px; }
  .advanced-header .button, .advanced-header .text-button { margin-top: 0; font-size: 11px; }
  .advanced-status { font-size: 11px; }
  .advanced-panel { margin-bottom: 18px; padding: 20px 17px; }
  .advanced-panel > h2, .advanced-panel > header h2 { font-size: 19px; }
  .advanced-panel .calibration-panel .details-content { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .advanced-panel .calibration-panel .help-copy { font-size: 11px; }
  .advanced-panel .bonus-group legend { font-size: 12px; }
  .advanced-panel .field-pair { gap: 11px; }
  .advanced-panel .dialog-footer { margin: 17px -17px -20px; padding: 16px 17px; }
  .results-column > .merc-card { padding: 15px; }
  .results-column > .merc-card > button { margin-left: 46px; }
  #merc-dialog:has(.merc-inventory-table) { width: calc(100% - 20px); }
  .merc-table.merc-inventory-table th, .merc-table.merc-inventory-table td { padding: 10px 5px; }
  .merc-table.merc-inventory-table th { font-size: 9px; }
  .merc-table.merc-inventory-table th:first-child, .merc-table.merc-inventory-table td:first-child { width: 28px; padding-left: 5px; padding-right: 3px; }
  .merc-table.merc-inventory-table th:nth-child(3), .merc-table.merc-inventory-table td:nth-child(3) { width: 38px; }
  .merc-table.merc-inventory-table th:nth-child(4), .merc-table.merc-inventory-table td:nth-child(4) { width: 94px; }
  .merc-inventory-name, .merc-inventory-unit, .merc-inventory-table td:nth-child(2) > div { gap: 7px; }
  .merc-inventory-label, .merc-inventory-table .merc-name { font-size: 11px; line-height: 1.65; }
  .merc-inventory-portrait, .merc-inventory-table td:nth-child(2) img { width: 28px; height: 28px; }
  .merc-inventory-table .unit-portrait { width: 28px; height: 28px; }
  .merc-inventory-table input:not([type="checkbox"]), .merc-inventory-table .merc-number { height: 37px; padding: 7px 5px; font-size: 11px; }
  .merc-inventory-table .tier-badge { padding: 1px 3px; font-size: 9px; }
}

/* XP progress stays a separate tool, with manual values per character. */
#progress-page { width: min(960px, 100%); min-width: 0; margin: 0 auto; }
.xp-intro { margin: 35px 0 26px; }
.xp-intro .eyebrow { margin-bottom: 8px; }
.xp-intro h1 { font-size: 35px; line-height: 1.35; }
.xp-intro > p:not(.eyebrow) { max-width: 760px; margin: 12px 0 0; color: #b8a995; font-size: 13px; line-height: 1.9; }
.xp-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.xp-panel { min-width: 0; padding: 24px; border: 1px solid #4e4034; background: #1c191f; }
.xp-panel > h2, .xp-panel > header h2 { margin: 0 0 18px; color: var(--cream); font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.xp-panel > .eyebrow { margin-bottom: 8px; }
.xp-character-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; padding-bottom: 19px; border-bottom: 1px solid #3c3037; }
.xp-character-toolbar > label { flex: 1 1 200px; min-width: 0; color: #c2ae8e; font-size: 11px; }
.xp-character-toolbar > label > span { display: block; margin-bottom: 6px; }
#xp-character-select, .xp-character-select { display: block; flex: 1 1 200px; width: 100%; min-width: 0; max-width: 100%; height: 40px; padding: 8px 28px 8px 10px; border: 1px solid #5c4935; border-radius: 2px; background: #141217; color: #e6d7bd; font-size: 12px; line-height: 1.4; text-overflow: ellipsis; }
.xp-character-toolbar .button, .xp-character-toolbar > button, .xp-panel .secondary-button { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 12px; border: 1px solid #695135; border-radius: 2px; background: #45342022; color: #d5b582; font: 500 11px/1.4 var(--sans); }
.xp-character-toolbar button:hover, .xp-panel .secondary-button:hover { border-color: #a3844d; background: #7c613424; }
.xp-character-toolbar .xp-remove { border-color: #68423f; background: #6a302317; color: #c89f91; }
.xp-character-toolbar .xp-remove:hover { border-color: #9c5a4d; background: #8b3d3026; color: #f0c2b1; }
.xp-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.xp-field-grid > legend { margin-bottom: 17px; color: #d5c0a0; font-size: 14px; font-weight: 500; }
.xp-field-grid label { display: block; min-width: 0; color: #b8a78e; font-size: 11px; line-height: 1.6; }
.xp-field-grid label > span { display: block; margin-bottom: 6px; }
.xp-field-grid input, .xp-field-grid select, .xp-hit-form input { display: block; width: 100%; min-width: 0; height: 43px; padding: 10px 11px; border: 1px solid #4e3d43; border-radius: 2px; background: #131217; color: #ebdcc4; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.xp-field-grid input:hover, .xp-field-grid select:hover, .xp-hit-form input:hover { border-color: #977b4d; }
.xp-field-grid input:focus-visible, .xp-field-grid select:focus-visible, .xp-hit-form input:focus-visible { border-color: var(--gold); }
.xp-field-grid .xp-full-wide { grid-column: 1 / -1; }
.xp-help { margin: 15px 0 0; color: #a1927d; font-size: 11px; line-height: 1.85; }
.xp-help + .xp-help { margin-top: 8px; }
.xp-estimate-panel { border-top-color: #a1844a; background: linear-gradient(145deg, #3c2d1f45, #1c191f 65%); }
.xp-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.xp-summary-card { min-width: 0; padding: 17px 18px; border: 1px solid #4c3c2f; background: #15121799; }
.xp-summary-card > p, .xp-summary-card > h3 { margin: 0 0 8px; color: #baa483; font-size: 11px; font-weight: 400; line-height: 1.6; }
.xp-stat-value { display: block; margin-top: 4px; color: #eddbb9; font-size: clamp(22px, 2.6vw, 32px); font-weight: 500; line-height: 1.35; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.xp-summary-card small { display: block; margin-top: 7px; color: #9b8b75; font-size: 10px; line-height: 1.8; }
.xp-prediction-note { margin: 17px 0 0; padding: 11px 13px; border-left: 2px solid #a2834f; background: #9e763011; color: #bba786; font-size: 11px; line-height: 1.85; }
.xp-hit-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid #4b3a2c; }
.xp-hit-form > h3, .xp-hit-form > p { flex: 0 0 100%; margin: 0 0 3px; color: #d7c19d; font-size: 13px; font-weight: 500; }
.xp-hit-form > label { flex: 1 1 155px; min-width: 0; color: #b4a086; font-size: 11px; }
.xp-hit-form label > span { display: block; margin-bottom: 6px; }
.xp-hit-form .button { flex-shrink: 0; min-height: 43px; font-size: 11px; }
.xp-hit-form .button-primary { width: auto; padding-left: 14px; padding-right: 14px; }
.xp-hit-form .xp-help { flex: 0 0 100%; margin-top: 1px; font-size: 10px; font-weight: 400; }
.xp-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; min-height: 270px; padding: 32px; border: 1px solid #514132; background: #211b1e70; text-align: center; }
.xp-empty h2 { margin: 0; color: #e1ca9f; font: 500 22px/1.5 var(--serif); }
.xp-empty p { max-width: 450px; margin: 0; color: #ac9b83; font-size: 13px; line-height: 1.9; }
.xp-empty .button { width: auto; min-width: 165px; margin-top: 5px; }
.xp-delete-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 19px; padding: 13px; border: 1px solid #805043; background: #6e2d2524; color: #ddbaa7; font-size: 11px; line-height: 1.7; }
.xp-delete-confirm > span, .xp-delete-confirm > p, .xp-delete-confirm > label { flex: 1 1 200px; margin: 0; }
.xp-delete-confirm .button, .xp-delete-confirm button { min-height: 35px; font-size: 10px; }

#info-page { width: min(960px, 100%); min-width: 0; margin: 33px auto 0; }
#info-page > h1 { margin-bottom: 13px; font-size: 35px; }
#info-page > p { max-width: 790px; margin: 0 0 24px; color: #b9ab96; font-size: 13px; line-height: 1.9; }
.info-panel { min-width: 0; margin-bottom: 19px; padding: 24px 27px; border: 1px solid #4b3d32; background: #1c191f; }
.info-panel > h2 { margin: 0 0 14px; color: #e2cc9f; font: 500 20px/1.55 var(--serif); }
.info-panel h3 { margin: 22px 0 9px; color: #d9c39e; font-size: 14px; font-weight: 500; }
.info-panel p, .info-panel li { color: #bbad99; font-size: 13px; line-height: 1.9; }
.info-panel p { margin: 10px 0; }
.info-panel ul, .info-panel ol { margin: 12px 0; padding-left: 21px; }
.info-panel li + li { margin-top: 7px; }
.info-panel strong { color: #e0caa4; font-weight: 550; }
.info-panel a { color: #d8b77c; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.info-panel a:hover { color: var(--gold-bright); }
.info-table { width: 100%; margin: 17px 0; border-collapse: collapse; }
.info-table th { padding: 12px; border: 1px solid #564331; background: #58412524; color: #d7bd90; font-size: 11px; font-weight: 500; line-height: 1.6; text-align: left; }
.info-table td { padding: 12px; border: 1px solid #3c3034; color: #bcae98; font-size: 12px; line-height: 1.8; vertical-align: top; overflow-wrap: anywhere; }
.info-table tbody tr:nth-child(even) { background: #d0ad6304; }
.info-table td:first-child { color: #ddc79f; font-weight: 500; }
.info-links { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 17px; margin: 18px 0 0; padding: 0; list-style: none; }
.info-links > a, .info-links > li { margin: 0; font-size: 12px; }
.info-links a { color: #d4b27b; text-decoration: underline; text-underline-offset: 3px; line-height: 1.8; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .xp-layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .xp-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-stat-value { font-size: clamp(20px, 4.2vw, 29px); }
  .xp-character-toolbar > label { flex-basis: 230px; }
}

@media (max-width: 480px) {
  .section-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .section-navigation > a { min-width: 0; min-height: 47px; padding: 11px 6px; font-size: 10px; overflow-wrap: anywhere; }
  .section-navigation > a[data-page="advanced"] { width: 100%; margin-left: 0; font-size: 10px; }
  .xp-intro { margin-top: 27px; margin-bottom: 21px; }
  .xp-intro h1, #info-page > h1 { font-size: 28px; }
  .xp-intro > p:not(.eyebrow) { font-size: 12px; }
  .xp-panel { padding: 19px 17px; }
  .xp-panel > h2, .xp-panel > header h2 { font-size: 18px; }
  .xp-character-toolbar { gap: 8px; margin-bottom: 19px; padding-bottom: 17px; }
  .xp-character-toolbar > label, #xp-character-select, .xp-character-select { flex-basis: 100%; }
  .xp-field-grid { gap: 15px 11px; }
  .xp-field-grid input, .xp-field-grid select { padding-left: 9px; padding-right: 9px; font-size: 13px; }
  .xp-summary { gap: 9px; }
  .xp-summary-card { padding: 14px 12px; }
  .xp-summary-card > p, .xp-summary-card > h3 { font-size: 10px; }
  .xp-summary-card small { font-size: 9px; }
  .xp-stat-value { font-size: 21px; }
  .xp-hit-form { margin-top: 19px; padding-top: 18px; }
  .xp-hit-form > label { flex-basis: 150px; }
  .xp-hit-form .button { padding-left: 11px; padding-right: 11px; font-size: 10px; }
  .xp-empty { padding: 27px 18px; }
  .xp-empty h2 { font-size: 19px; }
  .xp-empty p { font-size: 12px; }
  #info-page { margin-top: 26px; }
  #info-page > p { font-size: 12px; }
  .info-panel { margin-bottom: 15px; padding: 20px 17px; }
  .info-panel > h2 { font-size: 18px; }
  .info-panel p, .info-panel li { font-size: 12px; }
  .info-table th { padding: 9px 7px; font-size: 10px; }
  .info-table td { padding: 9px 7px; font-size: 11px; }
  .info-links { gap: 9px 14px; }
  .info-links > a, .info-links > li { font-size: 11px; }
}

@media (max-width: 680px) {
  .profile-panel { gap: 10px; margin-bottom: 23px; padding: 15px; }
  .profile-panel > label, .profile-panel .profile-picker { flex-basis: 100%; max-width: none; gap: 9px; }
  #profile-select { min-height: 40px; font-size: 12px; }
  #new-profile { min-height: 37px; padding-left: 11px; padding-right: 11px; font-size: 10px; }
  .profile-management { margin-left: auto; font-size: 10px; }
  .profile-management > summary { min-height: 37px; padding: 8px 10px; }
  .profile-help { font-size: 10px; line-height: 1.7; }
  #profile-dialog { width: calc(100% - 24px); }
  #profile-dialog > h2 { margin: 21px 20px 0; font-size: 21px; }
  #profile-form { padding: 20px; }
  #profile-form > p { font-size: 11px; }
}

@media (max-width: 1100px) {
  .site-shell { width: calc(100% - 48px); }
  .calculator-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 23px; }
  .capacity-panel { padding: 22px; }
  .merc-card { flex-wrap: wrap; }
  .merc-card-copy { flex: 1; }
  .merc-card > button { margin: 0 0 0 55px; }
}

@media (max-width: 820px) {
  .site-shell { width: calc(100% - 36px); }
  .site-header { min-height: 95px; }
  .tier-navigation { gap: 10px; margin-top: 22px; }
  .tier-card { min-height: 83px; padding: 15px; gap: 12px; }
  .tier-card-number { min-width: 36px; font-size: 24px; }
  .tier-card-title { font-size: 14px; }
  .tier-card-arrow { display: none; }
  .page-intro { padding: 32px 0 27px; }
  h1 { font-size: 36px; }
  .tier-summary { max-width: 230px; font-size: 11px; }
  .calculator-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 19px; }
  .capacity-panel { padding: 19px; }
  .panel-heading h2 { font-size: 18px; }
  .budget-field > input { height: 47px; font-size: 20px; }
  .field-hint { font-size: 9px; }
  .button-primary { gap: 7px; font-size: 10px; }
  .results-heading h2 { font-size: 20px; }
  .resource-summary { gap: 6px; }
  .resource-card, .budget-summary-card, .summary-card { padding: 12px 9px; }
  .resource-card strong, .budget-summary-card strong, .summary-card strong, .resource-used { font-size: 14px; }
  .resource-card small, .resource-limit { font-size: 8px; }
  .results-container tbody td, .results-container thead th { padding-left: 12px; padding-right: 12px; }
  .category-header, .section-heading { padding: 14px 12px; }
  .category-header h3, .section-heading h3 { font-size: 12px; }
  .merc-card { padding: 17px; gap: 12px; }
  .merc-card > button { margin-left: 51px; }
  .footer-note { display: none; }
}

@media (max-width: 680px) {
  .site-shell { width: calc(100% - 32px); }
  .site-header { flex-wrap: wrap; gap: 14px 18px; min-height: 86px; padding: 17px 0; }
  .brand { gap: 10px; }
  .brand-mark { width: 29px; height: 35px; }
  .brand-name { font-size: 22px; }
  .brand-subtitle { margin-top: 4px; font-size: 7px; }
  .header-note { gap: 7px; font-size: 10px; }
  .header-tools { flex: 1 1 215px; gap: 10px; }
  .header-tools .header-note { display: none; }
  .language-control { justify-content: flex-end; width: 100%; gap: 7px; font-size: 10px; }
  #language-select { min-width: 160px; max-width: 230px; min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: 11px; }
  .tiny-diamond { width: 4px; height: 4px; }
  .tier-navigation { gap: 8px; margin-top: 18px; }
  .tier-card { min-height: 78px; padding: 12px 10px; gap: 0; flex-direction: column; align-items: flex-start; }
  .tier-card-number { display: none; }
  .tier-card-title { font-size: 13px; }
  .tier-card-subtitle { margin-top: 5px; font-size: 10px; }
  .tier-card[aria-current="page"]::before, .tier-card.is-active::before, .tier-card.active::before { left: 10px; top: auto; bottom: -1px; width: 20px; height: 2px; }
  .page-intro { display: block; padding: 28px 0 25px; }
  .page-intro .eyebrow { font-size: 8px; }
  h1 { font-size: 33px; }
  .intro-copy { margin-top: 7px; font-size: 12px; }
  .tier-summary { max-width: none; margin-top: 15px; padding-left: 10px; font-size: 10px; line-height: 1.6; }
  .calculator-layout { display: block; }
  .capacity-panel { padding: 22px; }
  .panel-heading { margin-bottom: 18px; }
  .panel-heading h2 { margin-top: 7px; font-size: 21px; }
  .panel-heading p { margin-bottom: 0; font-size: 11px; }
  .budget-field { margin-bottom: 15px; }
  .budget-field > label { font-size: 12px; }
  .field-hint { font-size: 10px; }
  .budget-field > input { height: 49px; font-size: 22px; }
  .inclusion-options { display: flex; justify-content: space-between; gap: 12px; margin-top: 19px; padding-top: 16px; }
  .checkbox-label { gap: 6px; font-size: 10px; }
  .button-primary { min-height: 48px; font-size: 12px; }
  .button-primary svg { width: 18px; height: 18px; }
  .calibration-panel > summary { min-height: 65px; }
  .calibration-panel summary small { font-size: 10px; }
  .details-content { padding-left: 22px; padding-right: 22px; }
  .bonus-group legend { font-size: 12px; }
  .field-pair label { font-size: 10px; }
  .field-pair input { height: 40px; font-size: 14px; }
  .help-copy { font-size: 11px; }
  .results-column { margin-top: 29px; }
  .results-heading { min-height: 57px; margin-bottom: 16px; }
  .results-heading h2 { font-size: 23px; }
  .step-label { font-size: 8px; }
  .resource-summary { gap: 8px; margin-bottom: 17px; }
  .resource-card, .budget-summary-card, .summary-card { padding: 12px 10px; }
  .resource-card h3, .summary-label { font-size: 9px; }
  .resource-card strong, .budget-summary-card strong, .summary-card strong, .resource-used { font-size: 16px; }
  .resource-card small, .resource-limit { font-size: 8px; }
  .category-header, .section-heading { padding: 15px; }
  .category-header h3, .section-heading h3 { font-size: 14px; }
  .category-header small, .category-meta, .section-count, .category-budget { font-size: 9px; }
  .result-group-heading { min-height: 74px; padding: 15px; }
  .result-group-heading h2 { font-size: 14px; }
  .group-total { font-size: 17px; }
  .results-container tbody td { padding: 12px 15px; font-size: 12px; }
  .results-container tbody td:last-child { font-size: 15px; }
  .results-container tbody td.unit-count { font-size: 15px; }
  .results-container tbody td.unit-cost { font-size: 10px; }
  .results-container thead th { padding: 9px 15px; }
  .merc-card { padding: 20px 17px; }
  .merc-card h2 { font-size: 16px; }
  .merc-card-copy > p:not(.eyebrow) { font-size: 11px; }
  .merc-card > button { min-height: 40px; font-size: 10px; }
  .merc-count { font-size: 10px; }
  .source-details { font-size: 11px; }
  .source-details > summary { padding: 9px 0; font-size: 11px; }
  .site-footer { flex-wrap: wrap; gap: 12px; margin-top: 34px; padding: 22px 0; }
  .site-footer p { width: 100%; font-size: 9px; }
  dialog { width: calc(100% - 20px); max-height: 93vh; }
  .dialog-heading { padding: 19px 17px 17px; gap: 10px; }
  .dialog-heading h2 { font-size: 19px; }
  .dialog-heading .eyebrow { font-size: 7px; }
  .dialog-body { padding: 17px 17px 8px; }
  .dialog-description { font-size: 11px; }
  .merc-toolbar { flex-wrap: wrap; gap: 11px; }
  .merc-toolbar > label { width: 125px; font-size: 9px; }
  .merc-toolbar .search-label { width: auto; min-width: 0; }
  .merc-toolbar input, .merc-toolbar select { height: 39px; padding: 8px; font-size: 11px; }
  .merc-toolbar > button { min-height: 35px; font-size: 10px; }
  .merc-table input:not([type="checkbox"]), .merc-table select { height: 36px; font-size: 12px; }
  .merc-table thead th { font-size: 10px; }
  .merc-table tbody td { font-size: 11px; }
  .editor-help { font-size: 10px; }
  .dialog-footer { gap: 10px; padding: 15px 17px 18px; }
  .dialog-footer .button { min-height: 40px; }
  .dialog-footer .text-button { margin-left: auto; font-size: 9px; }
  .dialog-footer p { width: 100%; margin: 3px 0 0; font-size: 9px; }
}

@media (max-width: 370px) {
  .site-shell { width: calc(100% - 24px); }
  .header-note { display: none; }
  .capacity-panel { padding: 18px; }
  .inclusion-options { flex-direction: column; gap: 10px; }
  .resource-summary { gap: 5px; }
  .resource-card, .summary-card { padding: 10px 7px; }
  .resource-card strong, .summary-card strong, .resource-used { font-size: 14px; }
  .category-header h3, .section-heading h3 { font-size: 12px; }
  .category-header, .section-heading { padding-left: 12px; padding-right: 12px; }
  .category-header small, .category-budget { font-size: 8px; }
  .result-group-heading { padding-left: 12px; padding-right: 12px; }
  .result-group-heading h2 { font-size: 12px; }
  .group-total { font-size: 15px; }
  .unit-name + .tier-badge { margin-left: 4px; }
  .results-container tbody td { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Keep account switching within reach before the calculator navigation. */
.site-shell > .profile-panel { margin: 0; padding: 11px 0; gap: 9px 14px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; }
.site-shell > .profile-panel .profile-picker { flex: 0 1 430px; max-width: 430px; font-size: 10px; }
.site-shell > .profile-panel #profile-select { min-height: 35px; height: 35px; font-size: 12px; }
.site-shell > .profile-panel #new-profile { min-height: 35px; padding: 7px 11px; font-size: 10px; }
.site-shell > .profile-panel .profile-management > summary { min-height: 35px; padding: 7px 10px; font-size: 10px; }
.site-shell > .profile-panel:has(.has-player-data) .profile-picker { flex: 0 1 275px; max-width: 275px; }
.profile-identity-summary { display: flex; flex: 1 1 180px; flex-direction: column; gap: 5px; min-width: 0; }
.profile-identity-summary.has-player-data { display: flex; flex: 1 1 320px; flex-direction: column; gap: 5px; }
.profile-identity-facts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 16px; margin: 0; }
.profile-identity-facts > div { display: flex; align-items: baseline; gap: 6px; }
.profile-identity-facts dt { color: #a99a83; font-size: 10px; }
.profile-identity-facts dd { margin: 0; color: #e2cfab; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.profile-vip-fact dt, .profile-vip-fact dd { color: #d4b375; }
.profile-identity-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-width: 0; }
.profile-badge { display: inline-flex; flex: 0 0 28px; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 3px; color: #c4a66a; line-height: 1; transition: transform .15s; }
.profile-badge img { display: block; width: 28px; height: 28px; object-fit: contain; }
.profile-badge:hover { transform: scale(1.18); }
.profile-badge:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.profile-link-player { padding: 4px 0; font-size: 10px; }
.profile-completion-link { display: block; width: 100%; max-width: 360px; padding-top: 1px; color: #b4a58c; }
.profile-completion-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; font-size: 9px; line-height: 1.4; }
.profile-completion-heading strong { color: #d9c18c; font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.profile-completion-track { display: block; height: 4px; overflow: hidden; border-radius: 4px; background: #55472d60; }
.profile-completion-track > span { display: block; height: 100%; background: linear-gradient(90deg,#947340,#d7b56d); }
.profile-completion-track.is-complete > span { background: #83a57a; }
.profile-completion-link:hover { color: #ead6aa; }
.profile-completion-link:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.captain-completion-panel { margin: 16px 0 20px; padding: 16px 18px; border: 1px solid #54452f; background: #b9954610; }
.captain-completion-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.captain-completion-heading h3 { margin: 0; color: #ddc79c; font-size: 13px; font-weight: 500; }
.captain-completion-heading strong { color: #dfbe77; font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
.captain-completion-track { height: 9px; margin: 12px 0 9px; overflow: hidden; border-radius: 6px; background: #57472c70; }
.captain-completion-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#9b7841,#d9b86b); }
.captain-completion-track[aria-valuenow="100"] .captain-completion-fill { background: #83a57a; }
.captain-completion-note { display: block; margin: 4px 0 0; color: #ad9d83; font-size: 11px; line-height: 1.6; }
small.captain-completion-note { color: #91836f; font-size: 10px; }
.captain-card-completion { display: block; margin-top: 8px; color: #c5a673; font-size: 10px; line-height: 1.4; }
.captain-card-completion.is-ready { color: #99b98e; }
.captain-confirm-values { margin: 0 0 17px; font-size: 11px; }
.captain-ownership-controls { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.captain-not-owned { min-height: 25px; padding: 2px 0; border: 0; background: none; color: #c5a673; cursor: pointer; font: inherit; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.captain-not-owned:hover { color: #ead4a3; }
.captain-not-owned:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.captain-not-owned-label { color: #99b98e; font-size: 9px; }
#captain-edit-dialog .captain-ownership-controls { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-bottom: 12px; }
@media (max-width: 680px) {
  .site-shell > .profile-panel:has(.has-player-data) .profile-picker { flex: 1 1 calc(100% - 44px); max-width: calc(100% - 44px); }
  .profile-identity-summary, .profile-identity-summary.has-player-data { flex: 1 1 100%; }
  .profile-identity-summary.has-player-data { gap: 7px; padding: 2px 0 3px; }
}
.profile-management .profile-help { max-width: 255px; margin: 5px 0 0; padding: 8px 10px; border-top: 1px solid var(--line); color: #a29480; font-size: 10px; line-height: 1.7; }

/* These portraits already include the game's frame and rank badge. */
.unit-portrait.portrait-native { border: 0; background: transparent; box-shadow: none; }
.unit-portrait.portrait-native img { object-fit: contain; object-position: center; }
.unit-portrait.portrait-native::after, .unit-portrait.portrait-native .portrait-rank { display: none; }
.resource-icon, .group-resource-icon { object-fit: contain; flex-shrink: 0; }
img.resource-icon { width: 25px; height: 27px; }
.group-resource-icon { width: 32px; height: 34px; margin-right: 10px; }
.result-group-heading > .group-resource-icon { margin-right: -5px; }
.result-group-heading > .group-resource-icon + div { flex: 1; min-width: 0; }
.result-group-heading > div:has(.group-resource-icon) { display: flex; align-items: center; min-width: 0; }
.result-group-heading > div:has(.group-resource-icon) h2 { margin-top: 0; }

/* Used capacity is a quiet march footer, in the same order as the game. */
.resource-summary.march-capacity-bar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px 18px; margin: 17px 0 0; padding: 12px 0 3px; border-top: 1px solid var(--line); background: transparent; }
.march-capacity-bar .capacity-item { display: flex; align-items: center; gap: 8px; min-width: 0; color: #a79b8b; }
.march-capacity-bar .capacity-values { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.march-capacity-bar .capacity-values strong { color: #d1b887; font-weight: 500; }
.march-capacity-bar .resource-icon { width: 24px; height: 26px; }
.march-capacity-bar .capacity-label { display: block; color: #968774; font-size: 9px; line-height: 1.4; }

@media (min-width: 681px) and (max-width: 1000px) {
  .march-unit { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 14px 9px; }
  .unit-portrait { width: 64px; height: 64px; }
  .stack-amount { font-size: 18px; padding-left: 7px; padding-right: 7px; }
  .stack-amount svg { display: none; }
  .resource-summary.march-capacity-bar { gap: 8px 13px; }
}

@media (max-width: 680px) {
  .site-shell > .profile-panel { gap: 8px; padding: 10px 0; }
  .site-shell > .profile-panel .profile-picker { flex: 1 1 100%; max-width: none; gap: 9px; }
  .site-shell > .profile-panel .profile-management { margin-left: auto; }
  .resource-summary.march-capacity-bar { gap: 10px 15px; }
  .march-capacity-bar .capacity-item { gap: 6px; }
  .march-capacity-bar .capacity-values { font-size: 10px; }
  .march-capacity-bar .resource-icon { width: 21px; height: 23px; }
  .group-resource-icon { width: 28px; height: 30px; margin-right: 8px; }
}

@media (max-width: 400px) {
  .march-unit .unit-name { font-size: 9px; }
  .march-unit .tier-badge { font-size: 7px; padding-left: 3px; padding-right: 3px; }
  .stack-amount { font-size: 16px; padding-left: 5px; padding-right: 5px; }
  .resource-summary.march-capacity-bar { gap: 9px 12px; }
  .march-capacity-bar .capacity-values { font-size: 9px; }
  .march-capacity-bar .resource-icon { width: 19px; height: 21px; }
}

/* Small edit actions stay secondary to selecting an account or formation. */
.icon-button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 10px; border: 1px solid #554535; border-radius: 2px; background: transparent; color: #bea477; line-height: 1; }
.icon-button svg { display: block; width: 20px; height: 20px; }
.icon-button:hover { border-color: #a38650; background: #a58b5415; color: var(--gold-bright); }
.icon-button:focus-visible { border-color: var(--gold); outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.icon-button:disabled { cursor: default; opacity: .35; }
#edit-current-profile { width: 35px; height: 35px; padding: 8px; }
#edit-current-profile svg { width: 17px; height: 17px; }
#profile-account-list { min-width: 0; max-height: min(340px, 50vh); overflow-y: auto; margin-bottom: 5px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.profile-account-row { display: flex; align-items: center; gap: 3px; min-width: 0; padding: 3px; border-left: 2px solid transparent; }
.profile-account-row:has(.selected), .profile-account-row.selected, .profile-account-row.is-current { border-left-color: var(--gold); background: #a58b5411; }
.profile-account-name { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px; overflow: hidden; border: 0; background: transparent; color: #bbae98; font-size: 11px; line-height: 1.5; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.profile-account-name.selected, .profile-account-row.is-current .profile-account-name { color: var(--gold-bright); font-weight: 600; }
.profile-account-name:hover { color: var(--cream); }
.profile-account-row .icon-button { width: 38px; min-width: 38px; height: 44px; padding: 10px; border-color: transparent; }
.profile-account-row .icon-button svg { width: 17px; height: 17px; }
.profile-account-row [data-profile-delete]:hover { color: #e5aa98; border-color: #8e5145; background: #8b3d3026; }

.formation-picker { min-width: 0; margin-bottom: 23px; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.formation-picker > label { display: block; margin-bottom: 7px; color: #bca583; font-size: 11px; font-weight: 500; }
.formation-picker-controls { display: flex; align-items: center; gap: 6px; min-width: 0; }
#formation-select { display: block; flex: 1 1 auto; width: 100%; min-width: 0; height: 41px; padding: 9px 24px 9px 9px; border: 1px solid #5d4a34; border-radius: 2px; background: #141217; color: #e5d7c0; font-size: 12px; line-height: 1.5; text-overflow: ellipsis; }
.formation-picker-controls > .icon-button { width: 36px; height: 41px; padding: 9px; }
.formation-picker-controls > .icon-button svg { width: 18px; height: 18px; }
#formation-summary { margin: 7px 0 0; color: #9e917c; font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
#formation-load-main { min-height: 32px; margin-top: 1px; padding: 5px 0; color: #b29a75; font-size: 10px; }
#formation-unsaved { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 9px; padding: 8px 10px; border-left: 2px solid #a58852; background: #a5885210; color: #b6a17d; font-size: 10px; line-height: 1.7; }
#formation-unsaved .button, #formation-unsaved button { width: auto; min-height: 31px; padding: 5px 8px; font-size: 10px; }

/* Captain values are optional detail within a named formation. */
#formation-dialog { width: min(760px, calc(100% - 36px)); max-height: 91vh; }
#formation-form { min-width: 0; margin: 0; }
#formation-dialog .dialog-heading h2 { margin-top: 0; font-size: 22px; }
#close-formation { width: 36px; height: 36px; padding: 2px; font-size: 24px; font-weight: 400; line-height: 1; }
#formation-dialog .dialog-body { min-width: 0; padding-bottom: 24px; }
#formation-dialog .dialog-description { margin-bottom: 21px; font-size: 12px; }
#formation-dialog .dialog-body > label, #formation-copy-field > label { display: block; margin: 0 0 7px; color: #c6b18c; font-size: 12px; font-weight: 500; }
.formation-name-field > span { display: block; margin-bottom: 7px; }
#formation-dialog input:not([type="checkbox"]), #formation-dialog select { display: block; width: 100%; min-width: 0; height: 43px; padding: 10px 11px; border: 1px solid #514048; border-radius: 2px; background: #131217; color: #ebdcc4; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
#formation-dialog input:not([type="checkbox"]):hover, #formation-dialog select:hover { border-color: #977b4d; }
#formation-dialog input:not([type="checkbox"]):focus, #formation-dialog select:focus { border-color: var(--gold); }
#formation-dialog input[aria-invalid="true"] { border-color: #c56a58; }
.formation-rules { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 15px 24px; margin: 20px 0; }
.formation-rules > label { display: block; flex: 0 1 190px; min-width: 0; color: #b9a68a; font-size: 11px; }
.formation-rules > label > span { display: block; margin-bottom: 6px; }
.formation-rules label:has(input[type="checkbox"]) { display: flex; flex: 1 1 160px; align-items: center; gap: 9px; min-height: 43px; }
.formation-rules label:has(input[type="checkbox"]) > span { margin: 0; }
.formation-rules input[type="checkbox"] { flex-shrink: 0; width: 16px; height: 16px; }
.commander-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; min-width: 0; }
.commander-card { min-width: 0; padding: 17px; border: 1px solid #493d32; background: #14121670; }
.commander-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.commander-heading > span:first-child { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid #705b3c; border-radius: 50%; color: #d0b276; font: 500 12px/1 var(--serif); }
.commander-heading h3 { margin: 0; color: #d8c6a6; font-size: 13px; font-weight: 500; }
.commander-card > label { display: block; color: #a99b86; font-size: 10px; }
.commander-card > label > span { display: block; margin-bottom: 6px; }
.commander-values { margin-top: 13px; }
.commander-values > summary { display: flex; align-items: center; gap: 6px; min-height: 34px; color: #b29b76; font-size: 10px; line-height: 1.6; }
.commander-values > summary svg { width: 14px; height: 14px; }
.commander-values > summary::after { content: '⌄'; margin-left: auto; color: #8f7955; font-size: 13px; }
.commander-values[open] > summary::after { transform: rotate(180deg); }
.commander-values > summary:hover { color: var(--gold-bright); }
.commander-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.commander-stats > label { display: block; min-width: 0; color: #a99b86; font-size: 9px; }
.commander-stats > label > span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 27px; margin-bottom: 6px; }
.commander-stats .resource-icon { width: 20px; height: 23px; }
#formation-dialog .commander-stats input { height: 38px; padding: 8px 7px; font-size: 12px; }
.commander-card .use-commander { width: auto; min-height: 34px; margin-top: 12px; padding: 7px 9px; font-size: 10px; }
.use-commander { width: auto; min-height: 36px; margin-top: 8px; font-size: 10px; }
.formation-capacities { margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--line); }
.formation-capacities > h3 { margin: 0 0 8px; color: #d8c6a6; font-size: 14px; font-weight: 500; }
.formation-capacities > .help-copy { margin-bottom: 15px; font-size: 10px; line-height: 1.8; }
.formation-capacities > .formation-totals { margin-top: 0; padding-top: 0; border: 0; }
.formation-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-width: 0; margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--line); }
.formation-totals > h3, .formation-totals > p { grid-column: 1 / -1; margin: 0; }
.formation-totals > h3 { color: #d8c6a6; font-size: 14px; font-weight: 500; }
.formation-totals > p { color: #a99b86; font-size: 10px; line-height: 1.8; }
.formation-budget { display: block; min-width: 0; color: #c4b08c; font-size: 11px; }
.formation-budget > span, .formation-budget > label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.formation-budget .resource-icon { width: 24px; height: 27px; }
#formation-dialog .formation-budget input { border-color: #705b3b; background: #211a18; color: #ecd7ae; font-size: 16px; }
.formation-files { min-width: 0; margin-top: 23px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.formation-files > summary { display: flex; align-items: center; gap: 9px; min-height: 35px; color: #a99b86; font-size: 11px; }
.formation-files > summary::after { content: '⌄'; margin-left: auto; color: #8f7955; font-size: 13px; }
.formation-files[open] > summary::after { transform: rotate(180deg); }
.formation-files > summary:hover { color: var(--gold-bright); }
.formation-file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.formation-file-actions .button, .formation-file-actions button { width: auto; min-height: 36px; padding: 7px 10px; font-size: 10px; }
.formation-file-actions [data-delete], #delete-formation, #formation-delete { color: #c39888; border-color: #6b463e; }
.formation-history { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; min-width: 0; margin-top: 14px; }
.formation-history > label { flex: 0 0 100%; min-width: 0; color: #a99b86; font-size: 10px; }
.formation-history > label > span { display: block; margin-bottom: 6px; }
.formation-history > select { flex: 1 1 230px; }
.formation-history .button, .formation-history > button { width: auto; min-height: 42px; padding: 8px 11px; font-size: 10px; }
.formation-history > p { flex: 0 0 100%; margin: 0; }
#formation-copy-field { margin-top: 19px; padding: 14px; border: 1px solid #705b3b; background: #a58b5409; }
#formation-error { margin: 17px 0 0; color: #edb5a5; font-size: 11px; line-height: 1.8; }
#formation-error:empty { display: none; }
#formation-dialog .dialog-footer { justify-content: flex-end; padding-top: 16px; }
.formation-save-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; width: 100%; }
.formation-save-actions .button, .formation-save-actions > button { width: auto; min-height: 44px; margin-left: 0; padding: 10px 13px; font-size: 11px; }
.formation-save-actions .button-primary { min-width: 135px; }

/* Imported identity remains an optional detail of the local account. */
.profile-identity { margin-top: 19px; padding-top: 12px; border-top: 1px solid var(--line); }
.profile-identity > summary { display: flex; align-items: center; min-height: 37px; color: #bca583; font-size: 11px; }
.profile-identity > summary::after { content: '⌄'; margin-left: auto; color: #8f7955; }
.profile-identity[open] > summary::after { transform: rotate(180deg); }
.identity-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-top: 12px; }
#profile-form .identity-fields label { min-width: 0; margin: 0; font-size: 10px; }
.identity-fields label > span { display: block; margin-bottom: 6px; }
#profile-form .identity-fields input { width: 100%; min-width: 0; height: 39px; padding: 8px 9px; font-size: 12px; }
.profile-identity > .help-copy { margin: 11px 0 0; font-size: 10px; }
.profile-source-info { margin-top: 15px; padding: 13px; border: 1px solid #493d32; background: #14121670; }
#profile-form .profile-source-info .snapshot-title { margin: 0 0 9px; color: #d3bd98; font-size: 11px; font-weight: 500; }
.identity-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; margin: 0; }
.identity-facts dt { color: #948773; font-size: 9px; }
.identity-facts dd { margin: 2px 0 0; color: #c5b392; font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#profile-form .profile-source-info .identity-badges { margin: 10px 0 7px; color: #a99b86; font-size: 10px; line-height: 1.7; }
.profile-source-info .source-link { color: #cfad74; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.profile-source-info small { display: block; margin-top: 8px; color: #8e8171; font-size: 9px; line-height: 1.7; }
@media (max-width: 480px) { .identity-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .identity-fields > label:first-child { grid-column: 1 / -1; } .identity-facts { gap: 6px 9px; } }

/* The optional clan snapshot picker sits inside account details. */
.rng-player-picker { min-width: 0; margin: 15px 0 18px; padding: 14px; border: 1px solid #51402f; background: #a58b5409; }
.rng-player-picker > h3 { margin: 0 0 10px; color: #d3ba90; font-size: 14px; font-weight: 500; }
#profile-form .rng-player-picker > label { display: block; margin: 0; color: #bea988; font-size: 11px; }
.rng-player-picker > label > span { display: block; margin-bottom: 7px; }
#profile-form #rng-player-search { width: 100%; min-width: 0; height: 41px; padding: 9px 10px; font-size: 12px; }
.rng-player-picker > label + #rng-player-search { margin-top: 7px; }
.rng-player-match { min-width: 0; margin-top: 12px; padding: 12px; border: 1px solid #5e4b32; background: #171318; }
.rng-player-match > strong, .rng-player-match .rng-player-name { display: block; color: #e1c799; font-size: 16px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.rng-player-match small { display: block; margin-top: 3px; color: #a99b86; font-size: 10px; line-height: 1.7; }
.rng-player-match .rng-player-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 9px 0 0; }
.rng-player-badges > span, .rng-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid #584732; border-radius: 2px; color: #c5ad85; background: #a58b540b; font-size: 9px; line-height: 1.5; }
#profile-form #rng-use-player { width: 100%; min-height: 40px; margin-top: 12px; padding: 9px 11px; font-size: 11px; }
#profile-form .rng-player-picker .help-copy { margin: 10px 0 0; color: #968774; font-size: 9px; line-height: 1.8; }
.rng-player-picker .text-button { min-height: 34px; font-size: 10px; }
.rng-player-picker > small { display: block; margin-top: 10px; color: #91816c; font-size: 9px; line-height: 1.8; }
.rng-player-picker .source-link { color: #c6a774; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }

/* A searchable roster keeps every captain in one place for this account. */
.captain-roster-layout { display: grid; grid-template-columns: minmax(310px, .85fr) minmax(0, 1.3fr); align-items: start; gap: 18px; }
.captain-roster-panel { padding: 19px; }
.captain-detail-panel { padding: 23px; }
.captain-roster-panel > h2, .captain-detail-panel > h2 { margin-bottom: 15px; font-size: 19px; }
.captain-roster-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.captain-roster-actions .button, .captain-roster-actions > button { width: auto; min-height: 37px; padding: 8px 10px; font-size: 10px; }
.captain-roster-search { display: block; min-width: 0; color: #baa789; font-size: 11px; }
.captain-roster-search > span { display: block; margin-bottom: 7px; }
#captain-roster-search { display: block; width: 100%; min-width: 0; height: 43px; padding: 10px 11px; border: 1px solid #5c4937; border-radius: 2px; background: #131217; color: #ebdcc4; font-size: 12px; line-height: 1.5; }
#captain-roster-search:hover { border-color: #9c8050; }
#captain-roster-search:focus { border-color: var(--gold); }
.captain-roster-filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 11px 0 14px; }
.captain-roster-filters > button { flex: 1 1 auto; min-height: 34px; padding: 6px 8px; border: 1px solid #514234; border-radius: 2px; background: transparent; color: #a99a83; font-size: 10px; line-height: 1.5; }
.captain-roster-filters > button:hover { border-color: #947545; color: #e0c79d; }
.captain-roster-filters > button[aria-pressed="true"], .captain-roster-filters > button.is-active { border-color: #a88b53; background: #a58b5418; color: #e5c993; }
.captain-roster-count.xp-help { margin: 0 0 12px; font-size: 10px; }
.captain-roster-list { max-height: 480px; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #6b5639 #161318; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.captain-roster-row { display: flex; align-items: center; gap: 3px; min-width: 0; min-height: 70px; padding: 7px 4px 7px 7px; border-bottom: 1px solid #3e3235; border-left: 2px solid transparent; }
.captain-roster-row:last-child { border-bottom: 0; }
.captain-roster-row:hover { background: #e0c07a05; }
.captain-roster-row.is-selected { border-left-color: #d0ae68; background: #a58b5415; }
.captain-roster-select { display: flex; flex: 1 1 auto; align-items: center; gap: 9px; min-width: 0; min-height: 48px; padding: 0; border: 0; background: transparent; text-align: left; }
.captain-portrait, .captain-portrait-placeholder { display: flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; height: 44px; aspect-ratio: 1; border: 1px solid #78613c; border-radius: 2px; object-fit: cover; object-position: center; background: #2c251f; color: #bca474; font: 500 16px/1 var(--serif); }
.captain-roster-copy { display: block; min-width: 0; }
.captain-roster-name { display: block; overflow: hidden; color: #d6c4a7; font-size: 12px; font-weight: 500; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.is-selected .captain-roster-name { color: #f0d69f; }
.captain-roster-meta { display: block; margin-top: 3px; color: #9e8e77; font-size: 9px; line-height: 1.65; }
.captain-roster-row .captain-owned-checkbox { flex: 0 0 auto; width: 16px; height: 16px; margin: 0 6px; accent-color: var(--gold); }
.captain-roster-row .icon-button { width: 30px; height: 44px; padding: 7px; border-color: transparent; }
.captain-roster-row .icon-button svg { width: 17px; height: 17px; }
.captain-roster-row .captain-favorite { color: #8c7b60; font-size: 23px; font-weight: 400; }
.captain-roster-row .captain-info { font: 600 16px/1 Georgia, serif; }
.captain-roster-row .captain-favorite[aria-pressed="true"], .captain-roster-row .captain-favorite.is-favorite { color: #edc76e; background: #b99b4312; }
.captain-roster-list > .xp-help, .captain-roster-list > .empty-state { margin: 0; padding: 24px 15px; border: 0; font-size: 11px; line-height: 1.8; }
.captain-roster-list > .empty-state { min-height: 150px; }
.captain-full-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 0 0 14px; padding: 12px; border: 1px solid #8b6e3f; background: #a88b5311; color: #c8b18c; font-size: 11px; line-height: 1.8; }
.captain-full-confirm > p, .captain-full-confirm > span { flex: 0 0 100%; margin: 0; }
.captain-full-confirm .button, .captain-full-confirm > button { width: auto; min-height: 36px; padding: 7px 10px; font-size: 10px; }
.captain-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.captain-detail-heading > div { min-width: 0; }
.captain-detail-heading h2, .captain-detail-heading h3 { margin: 0; color: #e0caa1; font: 500 21px/1.5 var(--serif); overflow-wrap: anywhere; }
.captain-detail-heading p, .captain-detail-heading small { display: block; margin: 5px 0 0; color: #a3937b; font-size: 10px; line-height: 1.7; }
.captain-detail-heading .xp-help { display: block; margin: 5px 0 0; font-size: 10px; }
.captain-detail-heading > .button, .captain-detail-heading > button { flex-shrink: 0; width: auto; min-height: 39px; padding: 8px 13px; font-size: 11px; }
.captain-detail-panel .xp-field-grid { gap: 15px 12px; }
.captain-detail-panel .xp-field-grid input[readonly] { background: #1b171c; border-color: #453b39; color: #ad9d84; }
.captain-detail-panel .captain-xp-inputs { margin-top: 17px; }
.captain-detail-panel > label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 9px; min-height: 41px; margin-top: 9px; color: #b5a182; font-size: 11px; }
.captain-detail-panel .xp-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 21px; }
.captain-detail-panel .xp-summary-card { padding: 14px 13px; }
.captain-detail-panel .xp-stat-value { font-size: clamp(21px, 2vw, 28px); }
.captain-resource-details { margin: 17px 0 0; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.captain-resource-details > summary { display: flex; align-items: center; min-height: 35px; color: #ad9877; font-size: 11px; }
.captain-resource-details > summary::after { content: '⌄'; margin-left: auto; color: #8f7955; }
.captain-resource-details[open] > summary::after { transform: rotate(180deg); }
.captain-resource-details > summary:hover { color: var(--gold-bright); }
.captain-resource-details .xp-field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.captain-resource-details .xp-field-grid label { font-size: 10px; }
.captain-resource-details .xp-field-grid input { height: 39px; padding: 8px; font-size: 12px; }
.captain-info-dialog, #captain-info-dialog { width: min(600px, calc(100% - 36px)); max-height: 88vh; padding: 24px 27px; }
.captain-info-content > h2 { margin: 0 0 17px; color: #e3cba1; font: 500 23px/1.5 var(--serif); }
.captain-info-content > h3 { margin: 19px 0 9px; color: #bba27a; font-size: 12px; font-weight: 500; }
.captain-info-content > p { margin: 12px 0; color: #b9aa93; font-size: 12px; line-height: 1.9; }
.captain-info-content > .captain-role { color: #cdb38a; }
.captain-info-dialog > [data-xp-action="close-info"] { display: flex; width: auto; min-width: 105px; min-height: 42px; margin: 23px 0 0 auto; }
.captain-info-dialog .dialog-heading h2 { margin-top: 0; font-size: 22px; }
.captain-info-dialog .dialog-description { margin-bottom: 17px; font-size: 12px; }
.captain-info-dialog .captain-portrait { width: 70px; height: 70px; flex-basis: 70px; margin-bottom: 15px; }
.captain-bonuses { margin: 16px 0 20px; padding-left: 20px; }
.captain-bonuses > li { padding-left: 3px; color: #c1af91; font-size: 12px; line-height: 1.9; }
.captain-bonuses > li + li { margin-top: 8px; }
.captain-bonuses strong { color: #e1c48e; font-weight: 500; }
.captain-info-dialog a { color: #cdae79; font-size: 11px; line-height: 1.8; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.captain-info-dialog .dialog-footer { justify-content: flex-end; }
.captain-info-dialog .dialog-footer .button { width: auto; min-width: 100px; }

/* Linked commanders reuse the account roster while custom names stay editable. */
.commander-roster-select { display: block; width: 100%; min-width: 0; }
.commander-card label:has(.commander-roster-select) { display: block; margin: 0 0 12px; color: #ae9d82; font-size: 10px; }
.commander-card label:has(.commander-roster-select) > span { display: block; margin-bottom: 6px; }
.commander-roster-meta { margin: 7px 0 0; color: #bca174; font-size: 10px; line-height: 1.7; }
.commander-roster-link { display: inline-flex; align-items: center; min-height: 31px; color: #b99b67; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.commander-roster-link:hover { color: var(--gold-bright); }
#formation-dialog .commander-stats input[readonly] { background: #1b171c; border-color: #453b39; color: #ad9d84; }
#formation-roster-warning { margin: 9px 0 0; padding-left: 8px; border-left: 2px solid #a58b54; color: #bca174; font-size: 10px; line-height: 1.7; }

/* Owned game captains form the main view; editing stays in a compact dialog. */
.captain-collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 31px 0 23px; }
.captain-collection-heading h2 { margin: 0 0 8px; color: #e2cda6; font: 500 25px/1.5 var(--serif); }
.captain-collection-heading p { max-width: 650px; margin: 0; color: #a99b88; font-size: 12px; line-height: 1.8; }
.captain-collection-heading > button { flex-shrink: 0; width: auto; min-height: 39px; font-size: 10px; }
.captain-collection-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 1fr); align-items: center; gap: 20px; margin-bottom: 16px; }
.captain-mode-tabs { display: flex; gap: 7px; }
.captain-mode-tabs > button { flex: 1; min-height: 43px; padding: 9px 13px; border: 1px solid #514234; border-radius: 2px; background: #171419; color: #a79983; font-size: 12px; }
.captain-mode-tabs > button[aria-pressed="true"] { border-color: #a88b53; background: #a58b541c; color: #e5c993; }
.captain-faction-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 13px; }
.captain-faction-filters > button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 50px; padding: 8px 10px; border: 1px solid #493d34; border-radius: 2px; background: #19161b; color: #b7a78d; font-size: 11px; }
.captain-faction-filters img { display: block; width: 31px; height: 31px; object-fit: contain; }
.captain-faction-filters small { margin-left: auto; color: #a99370; font-size: 10px; font-variant-numeric: tabular-nums; }
.captain-faction-filters > button[aria-pressed="true"] { border-color: #bb9c61; background: #a58b5414; color: #eed4a1; }
.faction-tenacity { --faction-color: #6089ad; --faction-tint: #253a5224; }
.faction-courage { --faction-color: #af6856; --faction-tint: #62271e20; }
.faction-resolve { --faction-color: #769966; --faction-tint: #30452625; }
.faction-hero { --faction-color: #aa8b53; --faction-tint: #9a75301a; }
.captain-faction-section { margin-top: 24px; }
.captain-faction-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; padding-bottom: 10px; border-bottom: 1px solid var(--faction-color, #76613c); }
.captain-faction-heading > img { width: 42px; height: 42px; object-fit: contain; }
.captain-faction-heading h3 { margin: 0; color: #d9c7a9; font: 500 16px/1.5 var(--serif); }
.captain-faction-heading > span { margin-left: auto; color: #a8977b; font-size: 11px; }
.captain-owned-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.captain-owned-card { min-width: 0; overflow: hidden; border: 1px solid #554533; border-top-color: var(--faction-color); border-radius: 3px; background: linear-gradient(150deg, var(--faction-tint), #1a171c 75%); }
.captain-card-edit { display: flex; flex-direction: column; align-items: center; width: 100%; min-width: 0; padding: 14px 12px 12px; border: 0; background: transparent; text-align: center; }
.captain-card-edit:hover { background: #c2a46b0a; }
.captain-card-art { display: flex; align-items: center; justify-content: center; width: 100%; height: 145px; margin-bottom: 11px; }
.captain-card-portrait { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.captain-card-placeholder { color: #aa8b53; font-size: 65px; }
.captain-card-name { display: block; color: #e1cda9; font-size: 14px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.captain-card-level { display: block; margin-top: 4px; color: #b7a180; font-size: 11px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.captain-rank-stars { display: block; margin-top: 6px; color: #ddb75e; font-size: 17px; line-height: 1.3; letter-spacing: 1px; white-space: nowrap; }
.captain-rank-stars .empty-stars { color: #796a4e; }
.captain-card-footer { display: flex; align-items: center; gap: 6px; min-height: 49px; padding: 4px 10px; border-top: 1px solid #4a3c2f; background: #11101544; }
.captain-card-owned { display: flex; flex: 1; align-items: center; gap: 7px; min-width: 0; min-height: 40px; color: #a99a81; font-size: 10px; line-height: 1.5; }
.captain-card-owned > input { flex-shrink: 0; }
.captain-card-owned > span { min-width: 0; }
.captain-card-footer .captain-info { width: 30px; height: 39px; padding: 7px; border-color: transparent; font: 600 16px/1 Georgia, serif; }
.captain-owned-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 230px; padding: 32px; border: 1px solid #493d34; background: #1b171c70; text-align: center; }
.captain-owned-empty p { margin: 0; color: #c5b18f; font-size: 14px; }
.captain-owned-empty small { max-width: 420px; color: #a1917a; font-size: 11px; line-height: 1.8; }
#captain-edit-dialog { width: min(630px, calc(100% - 36px)); max-height: 90vh; }
#captain-edit-dialog .dialog-heading h2 { margin: 0; font-size: 23px; }
#captain-edit-dialog .dialog-heading p { margin: 4px 0 0; color: #a69377; font-size: 10px; }
#captain-edit-dialog .dialog-heading .icon-button { font-size: 24px; }
#captain-edit-dialog .dialog-body > .captain-card-owned { margin-bottom: 16px; }
.captain-level-editor { display: flex; align-items: flex-end; gap: 13px; }
.captain-level-editor > .xp-field-grid { flex: 1; min-width: 0; }
.captain-level-editor > button { flex-shrink: 0; min-height: 43px; padding: 10px 16px; }
.captain-xp-details { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.captain-xp-details > summary { display: flex; align-items: center; min-height: 37px; color: #ad9877; font-size: 11px; }
.captain-xp-details > summary::after { content: '⌄'; margin-left: auto; color: #8f7955; }
.captain-xp-details[open] > summary::after { transform: rotate(180deg); }
#captain-edit-dialog .xp-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
#captain-edit-dialog .xp-summary-card { padding: 14px; }
#captain-edit-dialog .xp-stat-value { font-size: 24px; }
#captain-edit-dialog .captain-xp-inputs { margin-top: 16px; }
#captain-edit-dialog .dialog-footer { justify-content: flex-end; }
#captain-edit-dialog .dialog-footer > .button { min-width: 105px; min-height: 41px; }

@media (max-width: 680px) {
  .captain-collection-heading { align-items: flex-start; flex-wrap: wrap; gap: 15px; margin-top: 26px; }
  .captain-collection-heading h2 { font-size: 22px; }
  .captain-collection-heading p { font-size: 11px; }
  .captain-collection-toolbar { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .captain-faction-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .captain-faction-filters > button { justify-content: flex-start; }
  .captain-owned-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .captain-card-edit { padding: 12px 9px 10px; }
  .captain-card-art { height: 128px; }
  .captain-card-name { font-size: 12px; }
  .captain-rank-stars { font-size: 15px; letter-spacing: 0; }
  .captain-card-footer { gap: 3px; padding-left: 8px; padding-right: 6px; }
  .captain-card-owned { gap: 5px; font-size: 9px; }
  #captain-edit-dialog { width: calc(100% - 20px); max-height: 93vh; }
  #captain-edit-dialog .dialog-heading h2 { font-size: 20px; }
  #captain-edit-dialog .xp-stat-value { font-size: 21px; }
}

@media (max-width: 760px) {
  .captain-roster-layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .captain-roster-panel, .captain-detail-panel { padding: 20px; }
  .captain-roster-row { min-height: 68px; }
  .captain-roster-row .icon-button { width: 40px; }
  .captain-roster-name { font-size: 13px; }
  .captain-roster-meta { font-size: 10px; }
  .captain-roster-row .captain-owned-checkbox { margin-left: 8px; margin-right: 8px; }
  .captain-detail-panel .xp-stat-value { font-size: clamp(21px, 4vw, 28px); }
}

@media (max-width: 480px) {
  .captain-roster-panel, .captain-detail-panel { padding: 17px; }
  .captain-roster-row { gap: 2px; padding-left: 5px; padding-right: 0; }
  .captain-roster-select { gap: 8px; }
  .captain-roster-row .icon-button { width: 31px; }
  .captain-roster-row .captain-owned-checkbox { width: 15px; height: 15px; margin-left: 5px; margin-right: 5px; }
  .captain-portrait, .captain-portrait-placeholder { width: 40px; height: 40px; flex-basis: 40px; }
  .captain-roster-name { font-size: 12px; }
  .captain-roster-meta { font-size: 9px; }
  .captain-detail-heading h2, .captain-detail-heading h3 { font-size: 19px; }
  .captain-detail-panel .xp-summary-card { padding: 13px 11px; }
  .captain-resource-details .xp-field-grid { gap: 8px; }
  .captain-resource-details .xp-field-grid input { padding: 8px 6px; font-size: 11px; }
  .captain-info-dialog, #captain-info-dialog { width: calc(100% - 20px); max-height: 91vh; padding: 21px 18px; }
  .rng-player-picker { padding: 12px; }
}

@media (max-width: 680px) {
  .site-shell > .profile-panel .profile-picker { flex: 1 1 calc(100% - 44px); max-width: calc(100% - 44px); }
  .site-shell > .profile-panel > #edit-current-profile { margin-left: auto; }
}

@media (max-width: 600px) {
  #formation-dialog { width: calc(100% - 20px); max-height: 93vh; }
  #formation-dialog .dialog-heading { padding: 18px 17px; }
  #formation-dialog .dialog-heading h2 { font-size: 19px; }
  #formation-dialog .dialog-body { padding: 18px 17px 21px; }
  #formation-dialog .dialog-description { margin-bottom: 17px; font-size: 11px; }
  .formation-rules { gap: 12px 18px; margin-top: 17px; margin-bottom: 17px; }
  .formation-rules > label { flex-basis: 135px; }
  .formation-rules label:has(input[type="checkbox"]) { flex-basis: 130px; }
  .commander-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .commander-card { padding: 15px; }
  .formation-totals { gap: 10px; margin-top: 20px; padding-top: 18px; }
  .formation-budget { font-size: 9px; }
  .formation-budget > span, .formation-budget > label { gap: 4px; }
  .formation-budget .resource-icon { width: 21px; height: 24px; }
  #formation-dialog .formation-budget input { height: 41px; padding: 9px 7px; font-size: 13px; }
  .formation-save-actions { gap: 8px; }
  .formation-save-actions .button, .formation-save-actions > button { flex: 1 1 auto; margin-left: 0; padding-left: 9px; padding-right: 9px; font-size: 10px; }
  .formation-save-actions .button-primary { min-width: 120px; }
}

/* Account, attack setup and language form one compact control area. */
.site-shell > .profile-panel { display: grid; grid-template-columns: minmax(170px, 235px) 35px minmax(230px, 1fr) auto auto; grid-template-areas: "account edit setup language manage" "identity identity identity refresh refresh"; align-items: end; gap: 10px 12px; padding: 11px 0 12px; }
.site-shell > .profile-panel .profile-picker, .site-shell > .profile-panel:has(.has-player-data) .profile-picker { grid-area: account; display: grid; gap: 5px; width: 100%; max-width: none; min-width: 0; margin: 0; font-size: 9px; }
.site-shell > .profile-panel #profile-select { width: 100%; min-width: 0; height: 35px; min-height: 35px; padding: 7px 25px 7px 9px; }
.site-shell > .profile-panel > #edit-current-profile { grid-area: edit; align-self: end; margin: 0; }
.profile-quick-formation { grid-area: setup; display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; gap: 5px; min-width: 0; }
.profile-quick-formation > label { grid-column: 1 / -1; margin: 0; color: #bdab8b; font-size: 9px; font-weight: 500; line-height: 1.5; }
.quick-formation-controls { display: grid; grid-template-columns: minmax(0, 1fr) 35px 35px; align-items: center; gap: 6px; min-width: 0; }
#quick-formation-select { display: block; width: 100%; min-width: 0; height: 35px; padding: 7px 24px 7px 9px; border: 1px solid #71603e; border-radius: 2px; background: #1e1919; color: #ead9b8; font-size: 12px; line-height: 1.5; text-overflow: ellipsis; }
#quick-formation-select:hover { border-color: #a98a51; }
#quick-formation-select:focus { border-color: var(--gold); }
.profile-quick-formation .icon-button { width: 35px; height: 35px; padding: 8px; }
.profile-quick-formation .icon-button svg { width: 17px; height: 17px; }
.site-shell > .profile-panel > .language-control { grid-area: language; display: grid; justify-content: stretch; width: auto; gap: 5px; margin: 0; color: #aa9b84; font-size: 9px; }
.profile-panel #language-select { width: 145px; min-width: 130px; max-width: 170px; min-height: 35px; height: 35px; padding: 7px 24px 7px 9px; font-size: 11px; }
.site-shell > .profile-panel > .profile-management { grid-area: manage; align-self: end; margin: 0; }
.site-shell > .profile-panel .profile-management > summary { min-height: 35px; padding: 7px 10px; font-size: 10px; }
.profile-management .profile-actions #new-profile, .profile-management .profile-actions #formation-load-main { justify-content: flex-start; width: 100%; min-height: 35px; margin: 0; padding: 8px 10px; border: 0; color: #c3ae87; font-size: 11px; }
.site-shell > .profile-panel > .profile-identity-summary, .site-shell > .profile-panel > .profile-identity-summary.has-player-data { grid-area: identity; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 7px 16px; min-width: 0; padding: 0; }
.profile-identity-summary .profile-identity-facts { flex: 0 1 auto; gap: 5px 14px; }
.profile-identity-summary .profile-identity-facts dt { font-size: 9px; }
.profile-identity-summary .profile-identity-facts dd { font-size: 11px; }
.profile-identity-summary .profile-identity-badges { flex: 0 1 auto; }
.profile-identity-summary .profile-completion-link { flex: 1 1 190px; width: auto; max-width: 235px; margin-left: auto; }
.profile-identity-summary .profile-completion-heading { font-size: 8px; }
.profile-data-refresh { grid-area: refresh; display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 3px 7px; justify-self: end; max-width: 270px; min-width: 0; }
#refresh-profile-data { grid-column: 1; grid-row: 1; width: 31px; height: 31px; padding: 7px; }
#refresh-profile-data svg { width: 16px; height: 16px; }
.profile-data-time { grid-column: 2; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.profile-data-mode { color: #a18a67; font-size: 8px; line-height: 1.5; letter-spacing: .08em; text-transform: uppercase; }
#profile-data-updated, .profile-data-updated { grid-column: 2; color: #8e826e; font-size: 9px; line-height: 1.6; }
#profile-refresh-status { grid-column: 1 / -1; margin: 0; color: #b49b73; font-size: 9px; line-height: 1.6; }
#profile-refresh-status:empty { display: none; }

.site-header { min-height: 59px; padding: 9px 0; gap: 25px; }
.site-header .brand { flex-shrink: 0; gap: 10px; }
.site-header .brand-mark { width: 28px; height: 34px; }
.site-header .brand-name { font-size: 23px; letter-spacing: .13em; }
.site-header .brand-subtitle { margin-top: 3px; font-size: 7px; letter-spacing: .15em; }
.site-header > .section-navigation { flex: 1; align-self: stretch; justify-content: flex-end; gap: 3px 7px; margin: 0; border: 0; }
.site-header .section-navigation > a { min-height: 39px; margin: 0; padding: 10px 11px 8px; font-size: 11px; }
.site-header .section-navigation > a[data-page="advanced"] { margin-left: 0; font-size: 10px; }
.tier-navigation { gap: 10px; margin: 17px 0 22px; }
.tier-card { min-height: 61px; padding: 11px 17px; gap: 12px; }
.tier-card-number { min-width: 39px; font-size: 23px; }
.tier-card-title { font-size: 14px; }
.tier-card-subtitle { margin-top: 2px; font-size: 10px; }
.tier-card-arrow { font-size: 18px; }
.tier-card[aria-current="page"]::before, .tier-card.active::before { top: 13px; bottom: 13px; }
body[data-view="calculator"] .page-intro, body[data-view="progress"] .page-intro { display: none; }
body[data-view="calculator"] .calculator-layout { grid-template-columns: 306px minmax(0, 1fr); gap: 24px; align-items: start; }

/* The capacity card stays in view on desktop, with every control reachable. */
.capacity-panel { padding: 18px; border: 1px solid #715735; border-radius: 3px; background: linear-gradient(145deg, #30251a, #211c1d 65%); box-shadow: 0 9px 24px #0003; }
.capacity-panel::before { width: 47px; height: 2px; background: #deb96f; }
.capacity-panel .panel-heading { margin: 0 0 12px; }
.capacity-panel .panel-heading .step-label { display: none; }
.capacity-panel .panel-heading h2 { margin: 0 0 3px; color: #ebd6ad; font-size: 19px; line-height: 1.4; letter-spacing: -.02em; }
.capacity-panel .panel-heading p { margin: 0; color: #af9e85; font-size: 10px; line-height: 1.6; }
.capacity-panel .formation-picker { margin: 0 0 13px; padding: 0 0 10px; border-bottom-color: #655034; }
.capacity-panel #formation-summary { margin: 0; color: #c1ac88; font-size: 10px; line-height: 1.6; }
.capacity-panel #formation-unsaved { gap: 3px 8px; margin-top: 8px; padding: 6px 8px; font-size: 9px; }
.capacity-panel #formation-roster-warning { margin-top: 7px; font-size: 9px; }
.capacity-panel .budget-field { margin-bottom: 12px; }
.capacity-panel .budget-field > label { margin-bottom: 5px; color: #dbc8a5; font-size: 11px; }
.capacity-panel .budget-field .resource-icon { width: 22px; height: 23px; }
.capacity-panel .field-hint { color: #a18e73; font-size: 9px; }
.capacity-panel .budget-field > input { height: 46px; padding: 9px 12px; border-color: #665039; border-radius: 3px; background: #151216; color: #f2e5ca; font-size: 23px; box-shadow: inset 0 2px 5px #0003; }
.capacity-panel .budget-field > input:focus { border-color: #dfb975; background: #1c171a; }
.capacity-panel .inclusion-options { margin: 14px 0; padding-top: 12px; border-top-color: #564531; }
.capacity-panel .checkbox-label { color: #c4b18e; font-size: 10px; }
.capacity-panel #run-button { min-height: 45px; border-color: #a87640; background: linear-gradient(180deg, #a47a3c, #7c552b); color: #fff0cb; font-size: 11px; box-shadow: 0 2px 8px #0004; }
.capacity-panel #run-button:hover { border-color: #d1a463; background: linear-gradient(180deg, #b88b47, #946632); }
.capacity-panel .status-line { margin-top: 8px; color: #b4a080; font-size: 9px; line-height: 1.5; }
@media (min-width: 901px) {
  body[data-view="calculator"] .settings-column { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; scrollbar-width: thin; scrollbar-color: #806039 #221b18; border-radius: 3px; }
}

@media (max-width: 1050px) {
  .site-shell > .profile-panel { grid-template-columns: minmax(0, 1fr) 35px minmax(240px, 1.35fr) auto; grid-template-areas: "account edit setup language" "identity identity identity manage" "refresh refresh refresh refresh"; gap: 9px 10px; }
  .profile-data-refresh { display: flex; flex-wrap: wrap; justify-self: start; max-width: 100%; gap: 4px 7px; }
  #profile-refresh-status { flex-basis: 100%; }
  .site-shell > .profile-panel > .profile-management { align-self: start; }
  .site-header .section-navigation > a { padding-left: 8px; padding-right: 8px; font-size: 10px; }
  body[data-view="calculator"] .calculator-layout { grid-template-columns: 285px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 900px) {
  .site-header { gap: 16px; }
  .site-header .brand-subtitle { font-size: 6px; }
  .site-header .section-navigation { gap: 0; }
  .site-header .section-navigation > a { padding-left: 7px; padding-right: 7px; font-size: 10px; }
  body[data-view="calculator"] .calculator-layout { display: block; }
  body[data-view="calculator"] .settings-column { position: static; max-height: none; overflow: visible; }
  .results-column { margin-top: 22px; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .capacity-panel #calculator-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 15px; }
  .capacity-panel .budget-field { margin: 0; }
  .capacity-panel .inclusion-options { grid-column: 1 / -1; margin: 0; }
  .capacity-panel #run-button, .capacity-panel .status-line { grid-column: 1 / -1; margin-top: 0; }
}

@media (max-width: 680px) {
  .site-shell > .profile-panel { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "language manage" "account edit" "setup setup" "identity identity" "refresh refresh"; gap: 9px 10px; padding-top: 8px; }
  .site-shell > .profile-panel > .language-control { display: flex; justify-content: flex-start; align-self: start; min-width: 0; }
  .site-shell > .profile-panel > .language-control > span { display: none; }
  .profile-panel #language-select { width: 150px; min-width: 120px; max-width: 100%; }
  .site-shell > .profile-panel > .profile-management { justify-self: end; }
  .site-shell > .profile-panel > #edit-current-profile { justify-self: end; }
  .profile-quick-formation { gap: 5px 6px; }
  .site-shell > .profile-panel > .profile-identity-summary, .site-shell > .profile-panel > .profile-identity-summary.has-player-data { gap: 7px 12px; }
  .profile-identity-summary .profile-completion-link { flex: 1 1 170px; max-width: none; margin-left: 0; }
  .profile-identity-summary .profile-identity-badges { flex: 1 1 auto; }
  .profile-data-refresh { align-items: center; }
  .site-header { min-height: 51px; flex-wrap: wrap; gap: 4px 15px; padding: 9px 0 0; }
  .site-header .brand { gap: 8px; }
  .site-header .brand-mark { width: 25px; height: 30px; }
  .site-header .brand-name { font-size: 21px; }
  .site-header .brand-subtitle { font-size: 6px; }
  .site-header > .section-navigation { display: flex; flex: 1 1 100%; flex-wrap: nowrap; justify-content: space-between; width: 100%; margin-top: 4px; }
  .site-header .section-navigation > a { flex: 1; min-width: 0; min-height: 39px; padding: 9px 5px 8px; font-size: 9px; overflow-wrap: anywhere; }
  .site-header .section-navigation > a[data-page="advanced"] { width: auto; font-size: 9px; }
  .tier-navigation { gap: 8px; margin: 14px 0 18px; }
  .tier-card { min-height: 57px; padding: 10px; }
  .tier-card-title { font-size: 12px; }
  .tier-card-subtitle { margin-top: 3px; font-size: 9px; }
  .tier-card[aria-current="page"]::before, .tier-card.active::before { left: 10px; top: auto; bottom: -1px; width: 24px; height: 2px; }
  .tier-card[aria-current="page"]::before { left: 0; bottom: 0; width: 100%; height: 3px; background: #edc47a; }
  .tier-card[aria-current="page"] .tier-card-arrow { position: absolute; top: 8px; right: 7px; width: 17px; height: 17px; border: 0; background: transparent; }
  .tier-card[aria-current="page"] .tier-card-arrow::after { font-size: 13px; }
  .capacity-panel { padding: 18px; }
}
/* One Hero progression, with a real avatar selected inside its details. */
.hero-avatar-editor { display:grid; grid-template-columns:96px minmax(0,1fr); gap:12px 17px; padding:14px; margin-bottom:18px; border:1px solid rgba(190,151,74,.26); border-radius:12px; background:linear-gradient(135deg,rgba(148,103,37,.12),rgba(24,21,22,.7)); }
.hero-avatar-preview { display:grid; place-items:center; min-width:0; height:130px; }
.hero-avatar-preview img { width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 6px 7px rgba(0,0,0,.4)); }
.hero-avatar-fields { min-width:0; align-self:center; }
.hero-avatar-fields .xp-field { margin:0 0 10px; }
.hero-avatar-fields select { width:100%; min-width:0; min-height:44px; }
.hero-shared-progress { grid-column:1/-1; margin:0; }
.hero-vip-summary { display:flex; flex-wrap:wrap; align-items:center; gap:7px 12px; }
.hero-vip-pill { display:inline-flex; align-items:center; padding:3px 9px; border:1px solid rgba(209,169,79,.36); border-radius:999px; color:#efd493; background:rgba(123,80,24,.17); font-size:.76rem; line-height:1.4; font-weight:700; }
.hero-vip-pill.is-unknown { color:var(--text-muted,#a99f8c); border-color:rgba(177,166,137,.19); background:rgba(255,255,255,.025); font-weight:400; }
.hero-profile-link,.hero-info-link { padding:5px 0; border:0; background:transparent; color:#d7b66e; font:inherit; font-size:.78rem; cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
.hero-profile-link:hover,.hero-info-link:hover { color:#ffe4a2; }
.hero-profile-link:focus-visible,.hero-info-link:focus-visible { outline:2px solid #e3bb60; outline-offset:4px; border-radius:2px; }
.hero-info-link { display:inline-block; margin-top:4px; }
.hero-card-vip { display:block; margin-top:6px; }
.hero-card-hint { display:block; max-width:23ch; margin:7px auto 0; color:#d1bd91; font-size:.72rem; line-height:1.45; }
.hero-info-heading { display:flex; gap:18px; align-items:center; margin-bottom:17px; }
.hero-info-heading h2 { margin:0 0 9px; }
.hero-info-portrait { width:96px; height:128px; object-fit:contain; flex:none; }
.hero-bonus-description { color:#e4d6b8; line-height:1.7; }
.hero-bonus-conditions { margin:13px 0 18px; padding-left:20px; color:#bfb3a1; font-size:.85rem; line-height:1.65; }
.hero-bonus-conditions li+li { margin-top:8px; }
.hero-bonus-conditions strong { color:#dfc38a; font-weight:600; }
.hero-source-links { display:flex; flex-direction:column; align-items:flex-start; gap:8px; font-size:.78rem; line-height:1.4; overflow-wrap:anywhere; }
/* Compact roster cards keep quick controls outside the details button. */
#captain-roster-page .captain-owned-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
#captain-roster-page .captain-owned-card { position:relative; border-radius:7px; background:linear-gradient(145deg,var(--faction-tint),#211c1c 90%); }
#captain-roster-page .captain-owned-card.is-unowned { border-color:#443d34; background:#1c1a1b; }
#captain-roster-page .captain-owned-card.is-unowned .captain-card-art { filter:grayscale(1); opacity:.55; }
#captain-roster-page .captain-owned-card.is-unowned .captain-card-name { color:#a89e8f; }
#captain-roster-page .captain-card-face { position:relative; min-width:0; }
#captain-roster-page .captain-card-edit { padding:8px 7px 2px; }
#captain-roster-page .captain-card-art { width:88px; height:88px; aspect-ratio:1; margin:0 0 4px; flex:none; border:1px solid #79633e; border-radius:4px; background:radial-gradient(ellipse at center,#4a3d28,#171518 80%); }
#captain-roster-page .captain-card-portrait { width:100%; height:100%; object-fit:contain; object-position:center; }
#captain-roster-page .captain-portrait-square { object-fit:cover; }
#captain-roster-page .captain-card-art:has(.captain-icon-zoom) { overflow:hidden; }
#captain-roster-page .captain-icon-zoom { position:relative; display:block; width:100%; height:100%; transform-origin:center; }
#captain-roster-page .captain-native-icon { position:absolute; display:block; max-width:none; max-height:none; object-fit:fill; pointer-events:none; }
@media(hover:hover) and (pointer:fine) { #captain-roster-page .captain-icon-zoom { transition:transform 180ms ease; } #captain-roster-page .captain-card-edit:is(:hover,:focus-visible) .captain-icon-zoom { transform:scale(1.12); } }
@media(prefers-reduced-motion:reduce) { #captain-roster-page .captain-icon-zoom { transition:none; } }
#captain-roster-page .captain-card-name { min-height:28px; max-width:100%; font-size:11px; line-height:1.3; }
#captain-roster-page .captain-inline-level { position:absolute; top:8px; right:5px; z-index:2; }
#captain-roster-page .captain-inline-level input { display:block; width:48px; height:28px; padding:2px 3px; border:1px solid #b59a5b; border-radius:3px; background:#27251c; color:#f4e7c9; text-align:center; font:600 13px/1.2 var(--sans,Arial,sans-serif); font-variant-numeric:tabular-nums; appearance:textfield; -moz-appearance:textfield; }
#captain-roster-page .captain-inline-level input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
#captain-roster-page .captain-inline-level input:focus-visible { outline:2px solid #f3ca70; outline-offset:2px; background:#392e1b; }
#captain-roster-page .captain-inline-level input:invalid { border-color:#cf8575; }
#captain-roster-page .captain-inline-stars { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:2px; margin:0 7px 2px; }
#captain-roster-page .captain-inline-stars button { min-width:0; height:26px; padding:0; border:1px solid transparent; border-radius:3px; background:#211e1a; color:#776e5b; font-size:16px; line-height:1; cursor:pointer; }
#captain-roster-page .captain-inline-stars button:first-child { font-size:11px; }
#captain-roster-page .captain-inline-stars button.is-filled { color:#e8be5c; }
#captain-roster-page .captain-inline-stars button[aria-pressed="true"] { border-color:#a78a4b; background:#3a2e1c; }
#captain-roster-page .captain-inline-stars button:is(:hover,:focus-visible) { outline:1px solid #e6bf68; outline-offset:1px; color:#ffe5a4; }
#captain-roster-page .captain-card-completion { display:block; margin:0 6px 3px; text-align:center; font-size:8px; line-height:1.3; }
#captain-roster-page .captain-owned-card.is-unowned .captain-card-completion { display:none; }
#captain-roster-page .captain-card-footer { display:flex; align-items:center; gap:3px; min-height:34px; padding:3px 5px; }
#captain-roster-page .captain-card-footer .captain-ownership-controls { display:flex; flex:1; flex-direction:row; flex-wrap:nowrap; min-width:0; min-height:26px; align-items:center; gap:3px; }
#captain-roster-page .captain-card-footer .captain-card-owned { flex:0 0 18px; width:18px; min-height:26px; gap:0; margin:0; font-size:9px; line-height:1.3; }
#captain-roster-page .captain-card-footer .captain-card-owned > span { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
#captain-roster-page .captain-card-footer .captain-owned-checkbox { width:15px; height:15px; }
#captain-roster-page .captain-card-footer .captain-not-owned { flex:1; min-width:0; min-height:23px; padding:2px 3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:8px; }
#captain-roster-page .captain-card-footer .captain-not-owned-label { display:none; }
#captain-roster-page .captain-card-actions { display:flex; flex:none; justify-content:space-between; align-items:center; gap:1px; margin:0; }
#captain-roster-page .captain-inline-undo { width:24px; min-height:26px; padding:0; border:1px solid #695238; border-radius:3px; background:#2a231b; color:#cdb586; font:inherit; font-size:18px; line-height:1; cursor:pointer; }
#captain-roster-page .captain-inline-undo:disabled { opacity:.3; cursor:default; border-color:transparent; background:transparent; }
#captain-roster-page .captain-inline-undo:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
#captain-roster-page .captain-card-footer .captain-info { width:26px; height:26px; min-height:26px; padding:3px; font-size:13px; }
#captain-roster-page .hero-card-vip { margin:2px 6px 6px; text-align:center; }
#captain-roster-page .hero-vip-pill { font-size:9px; }
@media(max-width:900px) { #captain-roster-page .captain-owned-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:600px) { #captain-roster-page .captain-owned-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; } }
.captain-star-field { min-width:0; }
.captain-star-field > span:first-child { display:block; margin-bottom:8px; color:#cbb896; font-size:.78rem; }
.captain-star-picker { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:3px; width:min(277px,100%); }
.captain-star-picker button { display:grid; place-items:center; width:100%; min-width:0; height:38px; padding:0; border:1px solid #514334; border-radius:5px; background:#201c1a; color:#736758; font-size:22px; line-height:1; cursor:pointer; }
.captain-star-picker button:first-child { font-size:15px; }
.captain-star-picker button.is-filled { color:#e9bf5d; background:#392c1b; }
.captain-star-picker button[aria-pressed="true"] { border-color:#f4cf74; box-shadow:0 0 0 1px #f4cf74; }
.captain-star-picker button:focus-visible { outline:2px solid #ffe09a; outline-offset:3px; }
.captain-star-picker button:hover { background:#514025; color:#ffe3a0; }
.captain-editor-rank { display:block; margin-top:7px; color:#bda779; font-size:.72rem; }
#captain-edit-dialog .captain-level-editor { display:grid; grid-template-columns:minmax(100px,1fr) minmax(0,1.5fr); align-items:start; gap:18px; margin-top:18px; }
#captain-edit-dialog .captain-level-editor .xp-field { margin:0; }
#captain-edit-dialog .captain-level-editor > .xp-field { display:grid; align-content:start; gap:6px; min-width:0; color:#b8a78e; font-size:11px; line-height:1.6; }
#captain-edit-dialog .captain-level-editor > .xp-field > input[type="number"] { display:block; width:100%; max-width:240px; min-width:0; height:44px; padding:10px 11px; border:1px solid #4e3d43; border-radius:2px; background:#131217; color:#ebdcc4; font:inherit; font-size:14px; line-height:1.4; font-variant-numeric:tabular-nums; }
#captain-edit-dialog .captain-level-editor > .xp-field > input[type="number"]:hover { border-color:#977b4d; }
#captain-edit-dialog .captain-level-editor > .xp-field > input[type="number"]:focus-visible { border-color:var(--gold); outline:2px solid var(--gold); outline-offset:2px; }
#captain-edit-dialog .hero-level-editor { grid-template-columns:minmax(100px,200px); }
#captain-edit-dialog .captain-save-footer { display:flex; flex-wrap:wrap; gap:9px; }
#captain-edit-dialog .captain-save-footer .button { flex:0 1 auto; width:auto; min-width:0; }
#captain-edit-dialog .captain-save-footer .button-primary { min-width:95px; }
.captain-undo-help { flex:1 0 100%; margin-bottom:2px; color:#9f937e; font-size:.7rem; line-height:1.5; }
#captain-edit-dialog .captain-save-footer .button:disabled { opacity:.4; cursor:default; }
@media(max-width:520px) { #captain-edit-dialog .captain-level-editor { grid-template-columns:1fr; gap:15px; } #captain-edit-dialog .hero-level-editor { grid-template-columns:minmax(100px,180px); } }
@media(max-width:520px) { .hero-avatar-editor { grid-template-columns:76px minmax(0,1fr); gap:10px; padding:11px; } .hero-avatar-preview { height:112px; } .hero-vip-summary { gap:5px 8px; } .hero-info-heading { gap:12px; } .hero-info-portrait { width:75px; height:105px; } }
