/* ─── Styles des pages d'analyse ────────────────────────────────────────────
   Extrait des blocs <style> inline de : duel.html, grouping_index.html,
   regularity.html, superman.html et performance.html.
   Les couleurs passent par les tokens --co-* (clair / sombre automatiques). */

/* ══ Duel de deux coureurs ════════════════════════════════════════════════ */
  /* ── VS badge ───────────────────────────────────────────────────────── */
  .duel-vs {
    font-family: var(--font-display); font-weight: 800; font-size: 2rem;
    color: var(--co-gold); letter-spacing: .08em;
    text-shadow: 0 2px 8px rgba(0,0,0,.15);
  }

  /* ── Badges temps total ─────────────────────────────────────────────── */
  .duel-badge-a { background: #4363d8; color: #fff; }
  .duel-badge-b { background: #e07840; color: #fff; }

  /* ── Cartes résumé ──────────────────────────────────────────────────── */
  .duel-summary-card {
    background: var(--co-surface); border-radius: 10px;
    box-shadow: var(--co-shadow); border: 1px solid var(--co-border);
    padding: 1rem .5rem;
  }
  .duel-summary-val {
    font-family: var(--font-display); font-weight: 800;
    font-size: 2.2rem; line-height: 1;
  }
  .duel-summary-lbl {
    font-size: .75rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--co-grey); margin-top: .3rem;
  }
  .duel-summary-a { border-top: 4px solid #4363d8; }
  .duel-summary-a .duel-summary-val { color: #4363d8; }
  .duel-summary-b { border-top: 4px solid #e07840; }
  .duel-summary-b .duel-summary-val { color: #e07840; }
  .duel-summary-tie { border-top: 4px solid var(--co-gold); }
  .duel-summary-tie .duel-summary-val { color: var(--co-gold); }

  /* ── Tableau duel ───────────────────────────────────────────────────── */
  .duel-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
  .duel-table thead th {
    background: var(--co-forest); color: #fff;
    font-family: var(--font-display); font-weight: 700;
    font-size: .8rem; letter-spacing: .07em; text-transform: uppercase;
    padding: .65rem 1rem;
  }
  .duel-th-a    { width: 38%; }
  .duel-th-b    { width: 38%; }
  .duel-th-ctrl { width: 14%; }
  .duel-th-delta { width: 10%; }

  .duel-table tbody tr { border-bottom: 1px solid var(--co-border-soft); transition: background .12s; }
  .duel-table tbody tr:hover { background: var(--co-surface-3); }
  .duel-table tbody td { padding: .55rem .85rem; vertical-align: middle; }

  /* cellule coureur */
  .duel-cell-a { text-align: right; }
  .duel-cell-b { text-align: left;  }
  .duel-cell-ctrl {
    text-align: center; font-family: var(--font-display);
    font-weight: 700; font-size: .82rem; color: var(--co-text-deep);
  }
  .duel-cell-delta { text-align: center; }

  /* temps principal */
  .duel-leg-time {
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.05rem; display: inline-block;
  }
  .duel-leg-time.win  { color: var(--co-success); }
  .duel-leg-time.lose { color: var(--co-danger-text); }
  .duel-leg-time.tie  { color: var(--co-grey); }

  /* temps cumulé secondaire */
  .duel-abs-time { font-size: .75rem; color: var(--co-grey); margin-top: .05rem; display: block; }
  .duel-missing  { font-size: .85rem; color: var(--co-grey); }

  /* badge écart */
  .duel-delta-badge {
    display: inline-block; font-family: var(--font-display); font-weight: 700;
    font-size: .85rem; border-radius: 4px; padding: .2rem .55rem;
  }
  .duel-delta-badge.a-wins { background: var(--co-ok-bg); color: var(--co-ok-text); }
  .duel-delta-badge.b-wins { background: var(--co-danger-soft); color: var(--co-danger-text); }
  .duel-delta-badge.tie    { background: var(--co-highlight-bg); color: var(--co-highlight-text); }

  /* indicateur de victoire (flèche) */
  .duel-arrow-a { color: var(--co-success); font-size: 1rem; margin-left: .3rem; }
  .duel-arrow-b { color: var(--co-danger-text); font-size: 1rem; margin-right: .3rem; }

  /* pied de tableau (total) */
  .duel-table tfoot td {
    background: var(--co-forest); color: #fff;
    padding: .7rem .85rem; font-family: var(--font-display);
    font-weight: 700; font-size: 1rem; border-top: 2px solid var(--co-gold);
  }
  .duel-total-time { font-size: 1.15rem; }
  .duel-total-time.win  { color: var(--co-gold); }
  .duel-total-time.lose { color: rgba(255,255,255,.5); }
  .duel-total-time.tie  { color: rgba(255,255,255,.8); }
  .duel-total-delta { font-size: .85rem; color: rgba(255,255,255,.75); }

  /* ── Zone graphique (Chart.js) ──────────────────────────────────────── */
  .duel-chart-canvas { position: relative; height: 380px; }

  @media (max-width: 576px) {
    .duel-abs-time { display: none; }
    .duel-table tbody td { padding: .45rem .5rem; }
    .duel-th-ctrl { display: none; }
    .duel-cell-ctrl { display: none; }
    .duel-chart-canvas { height: 280px; }
  }

/* ══ Regroupement / heatmap ═══════════════════════════════════════════════ */
  /* ── Table heatmap ─────────────────────────────────────────────────────── */
  .gi-table {
    width: max-content; min-width: 100%;
    border-collapse: separate; border-spacing: 0;
    font-size: .78rem;
  }
  .gi-table thead th {
    background: var(--co-forest); color: #fff;
    font-family: var(--font-display); font-weight: 700; font-size: .72rem;
    letter-spacing: .04em; text-transform: uppercase;
    padding: .5rem .6rem; white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
    border-right: 1px solid rgba(255,255,255,.12);
  }
  .gi-table thead th.gi-th-runner {
    position: sticky; left: 0; z-index: 3;
    min-width: 10rem; max-width: 14rem;
  }
  .gi-table thead th.gi-th-global {
    border-left: 2px solid var(--co-gold);
  }

  /* ── Cellules coureur (colonne fixe) ───────────────────────────────────── */
  .gi-table tbody td.gi-td-runner {
    position: sticky; left: 0; z-index: 1;
    background: var(--co-surface); border-right: 2px solid var(--co-border);
    padding: .4rem .6rem; white-space: nowrap;
    font-size: .8rem;
  }

  /* ── Cellules de valeur ────────────────────────────────────────────────── */
  .gi-table tbody td.gi-td-val {
    padding: .2rem .3rem; text-align: center;
    border-right: 1px solid var(--co-border-soft);
    min-width: 3.5rem; max-width: 6rem;
    font-family: var(--font-display); font-weight: 700; font-size: .78rem;
    vertical-align: middle; line-height: 1.2;
  }
  .gi-ref-name {
    display: block;
    font-family: var(--font-body); font-weight: 400; font-size: .65rem;
    opacity: .75; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 5.5rem; margin: 0 auto;
  }

  /* ── Cellule indice global ─────────────────────────────────────────────── */
  .gi-table tbody td.gi-td-global {
    border-left: 2px solid var(--co-gold);
    font-size: .85rem;
  }

  /* ── Lignes alternées ──────────────────────────────────────────────────── */
  .gi-table tbody tr:nth-child(even) td.gi-td-runner {
    background: var(--co-surface-3);
  }

  /* ── Cellule indice / profil fusionnée (tableau récap) ─────────────────────── */
  .gi-cell-profil { padding: .3rem .5rem !important; vertical-align: top; }
  .gi-profil-pct { font-size: .85rem; line-height: 1.1; margin-bottom: .2rem; }
  .gi-bar-wrap  { position: relative; height: 6px; border-radius: 3px;
                  background: var(--co-track-bg); overflow: hidden; width: 100%; }
  .gi-bar       { position: absolute; top: 0; height: 100%; border-radius: 3px; }
  .gi-bar-center { position: absolute; left: 50%; top: 0; height: 100%;
                  width: 1px; background: color-mix(in srgb, var(--co-text) 30%, transparent); }

  /* ── Légende swatches ──────────────────────────────────────────────────── */
  .gi-legend-swatch {
    display: inline-block; width: 18px; height: 10px;
    border-radius: 2px; vertical-align: middle;
  }

/* ══ Régularité ═══════════════════════════════════════════════════════════ */
  .reg-bar-wrap {
    position: relative; height: 6px; border-radius: 3px;
    background: var(--co-track-bg); overflow: hidden; width: 100%;
  }
  .reg-bar { position: absolute; top: 0; height: 100%; border-radius: 3px; }

  /* ── Carte « coureur Superman » (superman.html) ───────────────────────── */
  .slc-ctrl {
    font-family: var(--font-display); font-weight: 800; font-size: .82rem; color: var(--co-text-deep);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .slc-time { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--co-highlight-text); margin-top: .1rem; }
  .slc-name {
    font-size: .7rem; color: var(--co-grey); margin-top: .15rem; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }

  /* ── Barre d'indice de performance (performance.html) ────────────────── */
  .ip-bar-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
  .ip-bar      { height: 4px; border-radius: 2px; max-width: 100px; min-width: 4px; }

/* ── Regroupement (grouping.html) : départ + arrivée fusionnés ──────────────
   Sous md, une seule colonne contenant les deux horaires sur deux lignes. */
  .dep-arr { line-height: 1.2; }
  .dep-arr span { white-space: nowrap; }
  .dep-arr .dep-arr-start { color: var(--co-text-muted); }

/* ── Tableaux récap d'analyse : plus compacts sur petit écran ──────────────── */
@media (max-width: 576px) {
  .analysis-table thead th { padding: .4rem .45rem; }
  .analysis-table tbody td { padding: .35rem .45rem; }
}
@media (max-width: 380px) {
  .analysis-table thead th,
  .analysis-table tbody td { padding-left: .35rem; padding-right: .35rem; }
  .analysis-table .club-name {
    max-width: 4.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}

/* ── Régularité : colonnes fusionnées sous md ────────────────────────────────
   Temps + IP moyen sur deux lignes ; σ superposé au-dessus du profil σ. */
  .time-ip { line-height: 1.2; }
  .time-ip .time-ip-main { white-space: nowrap; }
  .time-ip .time-ip-sub  { color: var(--co-text-muted); font-size: .88rem; white-space: nowrap; }
  .reg-merge .reg-sigma {
    font-family: var(--font-display); font-size: .85rem;
    margin-bottom: .2rem; white-space: nowrap;
  }
