/* Compare: the pair pages (/compare/<a>-vs-<b>/) and the 3-way tool on /compare/. Tokens only; mobile first. */

/* Result table. The leader of a row carries the word "Ahead" (pair pages) or "Best" (tool); the bar and the pill only repeat it. */
.cmp-table { min-width: 28rem; }
.cmp-table tbody th[scope="row"] { min-width: 11rem; position: sticky; left: 0; background: var(--surface-1); z-index: 1; }
.cmp-table tbody tr:hover th[scope="row"] { background: var(--surface-2); }
.cmp-table .cmp-dir { font-weight: 400; }
.cmp-table .meta.block { margin-top: 2px; font-weight: 400; }
.cmp-table td.num { min-width: 7.5rem; }
.cmp-lead { box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.cmp-flag { display: inline-block; margin-left: var(--space-2); padding: 0 8px; border: 1px solid var(--accent); border-radius: 999px; font-size: var(--text-xs); font-weight: 700; line-height: 1.5; color: var(--accent); }
.cmp-flag-tie { border-color: var(--border-control); color: var(--text-muted); font-weight: 600; }
.cmp-na { color: var(--text-muted); font-style: italic; font-weight: 400; }
.cmp-group th { padding: 6px 14px; background: var(--surface-2); color: var(--text-muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.02em; }
.cmp-table tbody tr.cmp-group:hover { background: transparent; }
.cmp-table tbody tr.cmp-group th { position: static; min-width: 0; }

/* Pair lists: hub, "more comparisons" and the weapon page. Each link is a 44px tap target. */
.cmp-pairs { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.cmp-pairs a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text); font-size: var(--text-sm); text-decoration: none; }
.cmp-pairs a:hover { background: var(--surface-3); border-color: var(--border-strong); }
.section h3 + .cmp-pairs, .section p + .cmp-pairs { margin-top: var(--space-2); }

/* The tool */
.cmp { max-width: 100%; }
.cmp-loading, .cmp-error, .cmp-intro, .cmp-hint { max-width: 58ch; margin: 0 0 var(--space-3); color: var(--text-muted); }
.cmp-error { color: var(--negative); }
.cmp-picks { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-3); }
.cmp-pick label, .cmp-share > label { display: block; margin-bottom: 4px; font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); }
.cmp-select, .cmp-link { width: 100%; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--text-md); }
.cmp-share-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cmp-link { flex: 1 1 14rem; min-width: 0; font-size: var(--text-sm); }
.cmp .btn { min-height: 44px; }
.cmp-status { min-height: 1.5em; margin: var(--space-2) 0 var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.cmp-result > * + * { margin-top: var(--space-3); }
.cmp-tally h3 { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.cmp-pairlink a { display: inline-flex; align-items: center; min-height: 44px; }
.cmp-patch + .cmp-patch { margin-top: var(--space-4); }
.cmp-patch h3 { margin: 0 0 var(--space-2); font-size: var(--text-md); }

/* Phones: the stat column and up to three weapon columns fit the screen without sideways scrolling; the flag drops under the value. */
@media (max-width: 639px) {
  .cmp-table { min-width: 0; }
  .cmp-table th, .cmp-table td { padding: 8px 6px; }
  .cmp-table thead th { white-space: normal; }
  .cmp-table tbody th[scope="row"] { min-width: 0; width: 28%; font-size: var(--text-xs); }
  .cmp-table .cmp-dir { display: block; }
  .cmp-table td.num { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: var(--text-xs); }
  .cmp-flag { display: block; width: fit-content; margin: 3px 0 0 auto; }
  .cmp-group th { padding: 6px; }
}

@media (min-width: 720px) {
  .cmp-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
