/* Each troop group keeps its own manual entry position. */
#march-marker { display: none !important; }
.result-group[data-march-category] { position: relative; isolation: isolate; overflow: visible; border-color: #695137; background: #30251d; }
.result-group[data-march-category] .result-group-heading { background: linear-gradient(110deg, #514023, #392c20); border-bottom-color: #81633c; }
.result-group[data-march-category] .result-group-heading .eyebrow { color: #b9a27c; }
.result-group[data-march-category] .march-column-labels { background: #30251b; color: #c0ab87; border-bottom-color: #705438; }
.result-group[data-march-category] .march-unit:nth-child(2) { border-left-color: #8b6a4155; }

/* Visible overflow lets the sticky controls stay within their own group. */
.march-group-marker { position: sticky; top: 8px; z-index: 20; min-width: 0; }
.march-marker-group { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "heading actions" "steps steps" "names names"; gap: 4px 8px; min-width: 0; padding: 6px 9px; border: 1px solid #99743e; border-radius: 4px; background: #2b2218f7; color: #e6d5b4; box-shadow: 0 5px 14px #0005; backdrop-filter: blur(7px); }
.march-marker-group, .march-marker-group * { box-sizing: border-box; }
.march-marker-heading { grid-area: heading; display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 28px; font-size: 10px; line-height: 1.3; }
.march-marker-heading > strong { max-width: 115px; overflow: hidden; color: #e3bf7c; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.march-marker-label { min-width: 0; overflow: hidden; color: #a9916e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.march-marker-location { display: inline-block; min-width: 0; max-width: 150px; min-height: 23px; padding: 1px 0; overflow: hidden; border: 0; background: transparent; color: #d1bea0; font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.march-marker-location:enabled:hover, .march-marker-names:enabled:hover { color: #ffe0a1; text-decoration: underline; text-underline-offset: 3px; }
.march-marker-location:disabled, .march-marker-names:disabled { opacity: .6; cursor: default; }
.march-marker-help { display: inline-grid; flex: 0 0 16px; place-items: center; width: 16px; height: 16px; border: 1px solid #9e8051; border-radius: 50%; color: #c5ad84; font-size: 10px; cursor: help; }
.march-marker-steps { grid-area: steps; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.march-marker-steps > button { display: inline-grid; flex: 0 0 36px; place-items: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px; margin: 0; padding: 2px; border: 1px solid #756044; border-radius: 4px; background: #3a2e22; color: #ad9a7c; font: 550 12px/1 var(--sans, sans-serif); font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; }
.march-marker-steps > button:hover:enabled { border-color: #caa26a; background: #594326; color: #f0d39b; }
.march-marker-steps > button.is-past { border-color: #687a4d; background: #3e4b2f; color: #c4d29e; }
.march-marker-steps > button.is-current { border-color: #f0ce88; outline: 1px solid #e4b761; outline-offset: -3px; background: linear-gradient(#e0bb75, #bf9350); color: #332315; box-shadow: 0 1px 7px #e4af4630; font-weight: 750; }
.march-marker-steps > button.is-current:hover:enabled { background: linear-gradient(#ebca8c, #cba25f); color: #332315; }
.march-marker-steps > button.is-past:hover:enabled { background: #4b5c39; color: #e0e7bc; }
.march-marker-steps > button.march-marker-done { color: #b8be9a; font-size: 17px; }
.march-marker-steps > button.march-marker-done.is-current { border-color: #bacb8d; outline-color: #acbf7e; background: #617645; color: #fbf0ce; }
.march-marker-steps > button.march-marker-done.is-current:hover:enabled { background: #718552; color: #fbf0ce; }
.march-marker-steps > button:disabled { opacity: .4; cursor: default; }
.march-marker-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.march-marker-actions > button { display: inline-grid; flex: 0 0 auto; place-items: center; min-width: 28px; min-height: 28px; padding: 3px 7px; border: 1px solid #81623b; border-radius: 3px; background: #42311f; color: #ead2a1; font: 500 19px/1 var(--sans, sans-serif); cursor: pointer; touch-action: manipulation; }
.march-marker-actions > button:hover:enabled { border-color: #c99e5d; background: #5b4224; }
.march-marker-actions > .march-marker-reset, .march-marker-actions > [data-march-marker-action="reset"] { max-width: 96px; min-width: 0; overflow: hidden; font-size: 9px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.march-marker-actions > button:disabled { opacity: .35; cursor: default; }
.march-marker-names { grid-area: names; display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 14px; margin: 0; padding: 0; overflow: hidden; border: 0; background: transparent; color: #cdb894; font: 400 9px/14px var(--sans, sans-serif); text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.march-marker-group button:focus-visible, .march-marker-help:focus-visible { outline: 2px solid #ffe0a1; outline-offset: 2px; }
.march-group-marker.is-march-complete .march-marker-location { color: #c0d59c; }
.march-group-marker.is-march-complete .march-marker-group { border-color: #849263; }
#results[aria-busy="true"] .march-group-marker { opacity: .55; pointer-events: none; }

/* Warm alternating rows keep portraits and quantities easy to follow. */
.result-group[data-march-category] .march-row { scroll-margin-top: 154px; background: #3a2e23; border-bottom: 1px solid #8a694347; }
.result-group[data-march-category] .march-row:nth-child(even) { background: #473627; }
.result-group[data-march-category] .march-row .unit-name { color: #eee1c9; }
.result-group[data-march-category] .march-row.is-march-past { background: #343c29; }
.result-group[data-march-category] .march-row.is-march-past:nth-child(even) { background: #3c432d; }
.result-group[data-march-category] .march-row.is-march-past .unit-name { color: #c8c1a4; }
.result-group[data-march-category] .march-row.is-march-past .stack-amount { border-color: #78805b; background: #c3bea0; color: #484831; }
.result-group[data-march-category] .march-row.is-march-past::after { content: '✓'; position: absolute; top: 2px; left: 4px; color: #bfcc91; font-size: 10px; line-height: 1; pointer-events: none; }
.result-group[data-march-category] .march-row.is-march-current { z-index: 2; background: linear-gradient(105deg, #cbb07d, #bda16b); box-shadow: inset 4px 0 #f5d89a, inset -4px 0 #f5d89a; outline: 1px solid #e5bd70; outline-offset: -1px; }
.result-group[data-march-category] .march-row.is-march-current .unit-name { color: #352619; font-weight: 600; }
.result-group[data-march-category] .march-row.is-march-current .tier-badge { border-color: #9a773f; background: #e8d19c; color: #5d421e; }
.result-group[data-march-category] .march-row.is-march-current .stack-amount { border-color: #8b652e; background: linear-gradient(105deg, #f1dfb4, #e4c88f); color: #352315; box-shadow: inset 0 1px 3px #73502228, 0 1px 4px #65452220; }
.result-group[data-march-category] .march-row.is-march-current .stack-amount:hover { border-color: #62401a; background: #f8e6bc; }
.result-group[data-march-category] .march-row.is-march-current .stack-amount.copied { border-color: #647841; background: #d7dfae; color: #314022; }
.result-group[data-march-category] .march-row.is-march-current .march-unit.zero-count { opacity: .65; }

@media (max-width: 480px) {
  .march-marker-group { gap: 4px 6px; padding: 6px 8px; }
  .march-marker-heading { gap: 5px; }
  .march-marker-heading > strong { max-width: 95px; }
  .march-marker-label { display: none; }
  .march-marker-location { max-width: 145px; font-size: 10px; }
  .march-marker-actions > button { padding-left: 6px; padding-right: 6px; }
  .march-marker-actions > .march-marker-reset, .march-marker-actions > [data-march-marker-action="reset"] { max-width: 85px; }
  .result-group[data-march-category] .march-row { scroll-margin-top: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .march-group-marker *, .result-group[data-march-category] .march-row { scroll-behavior: auto; transition: none; }
}
.march-row { cursor: pointer; }
.troop-mark-row { width:100%; padding:0; border:0; border-radius:2px; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.troop-mark-row:hover .unit-name { text-decoration:underline; text-underline-offset:3px; }
.troop-mark-row:focus-visible { outline:2px solid #dfb970; outline-offset:4px; }
.troop-mark-row:disabled { cursor:default; }
