/*
 * Comparateur d'athlètes (components/comparateur_vue.php), site et appli. Se pose sur assets/fiche-athlete/stats.css
 * (variables --pmfs-*, graphiques, onglets, tir). Deux couleurs seulement : celle de chaque athlète, toujours avec son nom.
 * Aucune ombre, aucun dégradé ; filets, chiffres tabulaires. Jour et nuit dans l'appli par les variables de mobile_header.php.
 */
.pmcmp {
    --pmcmp-a: #1d4ed8;
    --pmcmp-b: #c2410c;
}
.pmcmp.pmcmp-appli { --pmcmp-a: var(--blue); --pmcmp-b: #f59e0b; }
:root[data-theme="light"] .pmcmp.pmcmp-appli { --pmcmp-a: var(--blue-hi); --pmcmp-b: #c2410c; }
.pmcmp .pmcmp-a { --c: var(--pmcmp-a); }
.pmcmp .pmcmp-b { --c: var(--pmcmp-b); }
.pmcmp-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pmcmp-centre { text-align: center; }

/* ── Les deux coins ── */
.pmcmp-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pmcmp-coin {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 16px 12px 12px;
    border-top: 4px solid var(--c);
    border-radius: 0 0 16px 16px;
    background: var(--pmfs-fond);
    text-align: center;
}
.pmcmp-portrait {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 4px;
}
.pmcmp-initiales {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--c);
    color: var(--c);
    font-family: 'Barlow Condensed', 'Bebas Neue', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: .02em;
}
.pmcmp-initiales img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pmcmp-coin-nom { margin: 0; font-weight: 700; font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.pmcmp-coin-nom a { color: inherit; text-decoration: none; }
.pmcmp-coin-nom a:hover { text-decoration: underline; }
.pmcmp-coin-meta { margin: 0; font-size: .8125rem; color: var(--pmfs-doux); }
.pmcmp-coin-score { display: flex; flex-direction: column; align-items: center; margin: 4px 0 0; font-size: .8125rem; color: var(--pmfs-doux); }
.pmcmp-coin-chiffre {
    font-family: 'Barlow Condensed', 'Bebas Neue', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
    color: var(--pmfs-texte);
    font-variant-numeric: tabular-nums;
}
.pmcmp-changer, .pmcmp-choisir {
    min-height: 44px;
    margin-top: 4px;
    padding: 8px 16px;
    border: 1px solid var(--pmfs-filet);
    border-radius: 999px;
    background: transparent;
    color: var(--pmfs-texte);
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease-out;
}
.pmcmp-choisir {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 168px;
    justify-content: center;
    border: 0;
    border-radius: 0;
}
.pmcmp-coin-vide { padding: 0; }
.pmcmp-changer:active, .pmcmp-choisir:active { transform: scale(.98); }
.pmcmp-changer:focus-visible, .pmcmp-choisir:focus-visible, .pmcmp a:focus-visible { outline: 2px solid var(--c, var(--pmfs-texte)); outline-offset: 2px; }
.pmcmp-inverser { margin: 8px 0 0; text-align: center; font-size: .875rem; }
.pmcmp-inverser a { display: inline-block; padding: 12px; color: var(--pmfs-texte); text-decoration: underline; text-underline-offset: 3px; }
.pmcmp-erreur { margin: 0 0 12px; padding: 12px 16px; border-left: 4px solid var(--pmfs-rate); background: var(--pmfs-fond); }

/* ── Blocs ── */
.pmcmp-bloc { margin-top: 32px; }
.pmcmp-bloc > .pmfs-titre, .pmcmp-bloc > .pmfs-titre-ligne { margin-bottom: 4px; }
.pmcmp-vide { margin: 8px 0 0; padding: 12px 16px; border: 1px dashed var(--pmfs-filet); border-radius: 12px; color: var(--pmfs-doux); font-size: .9375rem; line-height: 1.5; }
.pmcmp-source { margin-top: 32px; }
.pmcmp .pmfs-sous-titre { margin: 24px 0 8px; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: .8125rem; letter-spacing: .04em; text-transform: uppercase; color: var(--pmfs-doux); }

/* ── Face à face ── */
.pmcmp-bilan { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 12px 0 0; }
.pmcmp-bilan-cote { display: flex; flex-direction: column; align-items: center; color: var(--c); }
.pmcmp-bilan-cote b { font-family: 'Barlow Condensed', 'Bebas Neue', sans-serif; font-weight: 800; font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.pmcmp-bilan-cote small { font-size: .8125rem; font-weight: 600; color: var(--pmfs-texte); }
.pmcmp-bilan-tiret { font-size: 2rem; color: var(--pmfs-doux); }
.pmcmp-courses { margin: 8px 0 0; padding: 0; list-style: none; }
.pmcmp-course {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5rem 4.5rem;
    grid-template-areas: "nom a b" "date a b";
    gap: 0 8px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--pmfs-filet);
}
.pmcmp-course-tete { padding: 8px 0 4px; border-top: 0; grid-template-areas: ". a b"; }
.pmcmp-course-tete span { text-align: right; font-weight: 700; font-size: .875rem; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmcmp-course-tete .pmcmp-a { grid-area: a; }
.pmcmp-course-tete .pmcmp-b { grid-area: b; }
.pmcmp-course-nom { grid-area: nom; font-weight: 600; font-size: .9375rem; line-height: 1.35; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.pmcmp-course-nom:hover { text-decoration: underline; }
.pmcmp-course-date { grid-area: date; font-size: .8125rem; color: var(--pmfs-doux); }
.pmcmp-course-place { display: flex; flex-direction: column; align-items: flex-end; color: var(--pmfs-doux); font-variant-numeric: tabular-nums; }
.pmcmp-course-place.pmcmp-a { grid-area: a; }
.pmcmp-course-place.pmcmp-b { grid-area: b; }
.pmcmp-course-place b { font-size: 1rem; font-weight: 600; }
.pmcmp-course-place small { font-size: .75rem; }
.pmcmp-course-place.pmcmp-devant { color: var(--c); }
.pmcmp-course-place.pmcmp-devant b { font-weight: 800; }

/* ── PentaScore ── */
.pmcmp-scores { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.pmcmp-score { padding-left: 12px; border-left: 4px solid var(--disc); }
.pmcmp-score-discipline { display: inline-block; margin-bottom: 4px; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; color: var(--pmfs-texte); text-decoration: none; }
.pmcmp-barre-ligne {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr) 5.25rem;
    grid-template-areas: "qui barre valeur" ". niveau niveau";
    align-items: center;
    gap: 0 8px;
    min-height: 32px;
}
.pmcmp-barre-qui { grid-area: qui; font-weight: 600; font-size: .875rem; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmcmp-barre { grid-area: barre; height: 10px; background: var(--pmfs-filet); border-radius: 5px; overflow: hidden; }
.pmcmp-barre span { display: block; height: 100%; background: var(--c); border-radius: 5px; opacity: .55; }
.pmcmp-devant .pmcmp-barre span { opacity: 1; }
.pmcmp-barre-valeur { grid-area: valeur; text-align: right; font-variant-numeric: tabular-nums; }
.pmcmp-barre-valeur b { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.375rem; }
.pmcmp-barre-valeur small { font-size: .75rem; color: var(--pmfs-doux); }
.pmcmp-barre-niveau { grid-area: niveau; font-size: .8125rem; color: var(--pmfs-doux); }
.pmcmp-notes { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .875rem; line-height: 1.5; color: var(--pmfs-doux); }
.pmcmp-notes li { padding-left: 12px; border-left: 2px solid var(--pmfs-filet); }

/* ── Tableaux côte à côte ── */
.pmcmp-tableau { margin: 8px 0 0; }
.pmcmp-ligne {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 12px 0;
    border-top: 1px solid var(--pmfs-filet);
}
.pmcmp-ligne dt { font-size: .875rem; line-height: 1.35; color: var(--pmfs-doux); }
.pmcmp-ligne dd { margin: 0; display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.pmcmp-ligne dd b { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.25rem; line-height: 1.2; }
.pmcmp-ligne dd small { font-size: .75rem; color: var(--pmfs-doux); }
.pmcmp-ligne dd.pmcmp-devant b { font-weight: 800; color: var(--c); }
.pmcmp-ligne dd.pmcmp-devant b::before { content: "▲ "; font-size: .75rem; vertical-align: .2em; }
.pmcmp-entete { padding: 0 0 8px; border-top: 0; }
.pmcmp-entete span { text-align: right; font-weight: 700; font-size: .875rem; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmcmp-format-nom { margin: 8px 0 0; font-weight: 700; padding-left: 12px; border-left: 4px solid var(--disc); }
.pmcmp-format { padding-top: 4px; }

/* Légende du graphique : rond plein (1er athlète), carré creux et trait pointillé (2e). */
.pmcmp-legende { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 4px; font-size: .875rem; font-weight: 600; }
.pmcmp-legende > span { display: inline-flex; align-items: center; gap: 8px; color: var(--pmfs-texte); }
.pmcmp-cle-a, .pmcmp-cle-b { display: inline-block; width: 24px; height: 0; border-top: 3px solid var(--c); position: relative; }
.pmcmp-cle-b { border-top-style: dashed; }

.pmcmp-seuls { margin-top: 24px; border-top: 1px solid var(--pmfs-filet); }
.pmcmp-seuls summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: .9375rem; }
.pmcmp-seuls ul { margin: 0; padding: 0; list-style: none; }
.pmcmp-seuls li { display: grid; gap: 2px; padding: 8px 0 8px 12px; border-left: 3px solid var(--c); margin-bottom: 8px; font-size: .875rem; }
.pmcmp-seuls small { color: var(--pmfs-doux); }

.pmcmp-tir-qui { margin: 12px 0 4px; font-size: .875rem; }
.pmcmp-tir-qui b { color: var(--c); }

/* ── Adversaires et étapes ── */
.pmcmp-adversaires { margin: 8px 0 0; padding: 0; list-style: none; }
.pmcmp-adversaires a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    border-top: 1px solid var(--pmfs-filet);
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease-out;
}
.pmcmp-adversaires a:active { transform: scale(.985); }
.pmcmp-adv-nom { font-weight: 600; }
.pmcmp-adversaires small { color: var(--pmfs-doux); font-size: .8125rem; white-space: nowrap; }
.pmcmp-etapes { margin: 0; padding: 0; list-style: none; counter-reset: etape; display: grid; gap: 16px; }
.pmcmp-etapes li { counter-increment: etape; display: grid; gap: 4px; padding-top: 8px; border-top: 2px solid var(--pmfs-texte); }
.pmcmp-etapes b::before { content: counter(etape) ". "; }
.pmcmp-etapes span { color: var(--pmfs-doux); font-size: .9375rem; }

/* ── Feuille de recherche ── */
.pmcmp-feuille {
    width: min(560px, 100vw);
    max-width: 100vw;
    max-height: 85vh;
    margin: auto auto 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
    background: var(--pmcmp-feuille-fond, #fff);
    color: var(--pmcmp-feuille-texte, #111418);
}
@media (min-width: 700px) { .pmcmp-feuille { margin: auto; border-radius: 20px; } }
.pmcmp-feuille::backdrop { background: rgba(0, 0, 0, .45); }
:root .pmcmp-feuille-appli { --pmcmp-feuille-fond: var(--ink2); --pmcmp-feuille-texte: var(--white); }
.pmcmp-feuille-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pmcmp-feuille-tete h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.pmcmp-fermer { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.pmcmp-q {
    width: 100%;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px;
}
.pmcmp-q:focus { outline: 2px solid currentColor; outline-offset: 1px; }
.pmcmp-feuille-etat { min-height: 20px; margin: 8px 0 0; font-size: .875rem; opacity: .75; }
.pmcmp-liste { margin: 0; padding: 0; list-style: none; overflow-y: auto; max-height: 56vh; }
.pmcmp-liste button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 52px;
    padding: 8px 4px;
    border: 0;
    border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .15s ease-out;
}
.pmcmp-liste button:active { transform: scale(.985); }
.pmcmp-liste button:disabled { opacity: .45; cursor: not-allowed; }
.pmcmp-liste b { font-weight: 600; }
.pmcmp-liste small { font-size: .8125rem; opacity: .7; }

/* ── Ordinateur : coins plus larges, tableaux plus aérés ── */
@media (min-width: 760px) {
    .pmcmp-duo { gap: 24px; }
    .pmcmp-portrait { width: 88px; height: 88px; }
    .pmcmp-initiales img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pmcmp-coin-nom { font-size: 1.25rem; }
    .pmcmp-coin-chiffre { font-size: 2.5rem; }
    .pmcmp-ligne { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); }
    .pmcmp-course { grid-template-columns: minmax(0, 1fr) 6rem 6rem; }
    .pmcmp-barre-ligne { grid-template-columns: 8rem minmax(0, 1fr) 5rem 12rem; grid-template-areas: "qui barre valeur niveau"; }
}

/* ── Appli : marges des blocs ── */
.pmcmp-appli .pmfs-titre { font-size: 1.25rem; }
.pmcmp-appli .pmfs-lien { color: var(--white); }
.pmcmp-appli { padding-bottom: 24px; }

@media (prefers-reduced-motion: reduce) {
    .pmcmp-changer, .pmcmp-choisir, .pmcmp-liste button, .pmcmp-adversaires a { transition: none; }
    .pmcmp-changer:active, .pmcmp-choisir:active, .pmcmp-liste button:active, .pmcmp-adversaires a:active { transform: none; }
}

/* Site sur ordinateur : une colonne de lecture, graphique à taille lisible. */
.pmcmp-site .pmcmp { max-width: 880px; margin: 0 auto; }
@media (min-width: 760px) { .pmcmp .pmfs-graphe { max-width: 720px; } }
