feat(stats): team comparator with diverging bars (Stage F)

- New Comparator sub-nav section (available once >=1 match played). Two team
  selects (all 48, alphabetical), defaulting to the top-2 ranked teams; the
  choice survives langchange (module-level cmpA/cmpB).
- Diverging mirrored bars: A grows left from the centre metric label, B right;
  each row scales to max(a,b) so the longer bar is the higher value, and the
  higher side's number is gold. Metrics P/W/GF/GA/CS/Pts (all non-negative).
  cmp-grow scaleX animation from the centre edge; off under reduced-motion.
- On select change only the bars panel re-renders (keeps focus, replays the
  animation).
- Players side intentionally NOT shipped: a disabled toggle would be a dead
  control (violates the graceful-degradation rule). The Teams/Players toggle
  arrives in Stage H with players.json.
- i18n comparatorTitle/cmpTeamA/cmpTeamB (EN/PT); CSS for the comparator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Lucas Kalil 2026-06-17 10:58:24 -03:00
parent 489a44fc2d
commit b12110b2a5
3 changed files with 189 additions and 1 deletions

View file

@ -433,6 +433,104 @@ button.record-card:hover { border-color: var(--accent-gold); background: var(--g
color: var(--text-secondary);
}
/* ---------------------------------------------------- team comparator */
.cmp-controls {
display: flex;
align-items: center;
justify-content: center;
gap: 0.8rem;
margin-bottom: 1rem;
}
.cmp-select { flex: 1 1 0; min-width: 0; max-width: 16rem; }
.cmp-vs {
flex: 0 0 auto;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-secondary);
}
.cmp-panel {
display: grid;
gap: 0.7rem;
padding: 1.3rem 1.4rem;
}
.cmp-head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
margin-bottom: 0.4rem;
font-weight: 700;
}
.cmp-team { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.cmp-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-team-b { flex-direction: row; text-align: right; }
.cmp-row {
display: grid;
grid-template-columns: 2.2rem 1fr minmax(56px, auto) 1fr 2.2rem;
align-items: center;
gap: 0.5rem;
}
.cmp-val {
font-weight: 700;
font-variant-numeric: tabular-nums;
color: var(--text-secondary);
}
.cmp-val.a { text-align: right; }
.cmp-val.b { text-align: left; }
.cmp-val.lead { color: var(--accent-gold-soft); }
.cmp-track {
height: 12px;
background: var(--glass-bg-strong);
border-radius: 999px;
overflow: hidden;
display: flex;
}
.cmp-track.a { justify-content: flex-end; }
.cmp-track.b { justify-content: flex-start; }
.cmp-bar {
height: 100%;
border-radius: 999px;
animation: cmp-grow 0.5s ease both;
}
.cmp-bar.a {
background: linear-gradient(90deg, var(--accent-gold-soft), var(--accent-gold));
transform-origin: right center;
}
.cmp-bar.b {
background: linear-gradient(90deg, var(--accent-blue), #5aa9f0);
transform-origin: left center;
}
@keyframes cmp-grow {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
.cmp-label {
text-align: center;
font-size: 0.78rem;
color: var(--text-secondary);
}
@media (prefers-reduced-motion: reduce) {
.cmp-bar { animation: none; }
}
.col-sort {
display: inline-flex;
align-items: center;