/* =========================================================================
 * Bilan de la soirée (bilanSoiree.js)
 *
 * Une fenêtre par-dessus la page, une fois le dernier match du soir fini.
 * En haut, deux cartes : le total de la soirée (et la part de chaque joueur
 * en une barre) et le classement — ou le duel de la semaine. Dessous, les
 * joueurs, triés par points : une rangée de cartes sur ordinateur ; sur
 * téléphone, une liste dans un panneau qui monte du bas.
 *
 * La fenêtre suit le thème (l'échelle de gris d'Apple, DESIGN.md) : chaque
 * couleur est un jeton d'index.css. La seule chroma libre est celle des
 * clubs : le filet d'une carte, sa part de la barre, et le fond de la photo,
 * à la teinte sombre du club dans les deux thèmes. Le rouge ne marque que
 * l'action. Les chiffres et les titres sont en Barlow Condensed, le texte en
 * Barlow — la fenêtre charge elle-même ses polices.
 * ========================================================================= */

.fzb-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;                        /* au-dessus de la fiche de joueur (10000), sous fzDialog (10100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--overlay-dark, rgba(0, 0, 0, .6));
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: fzbFondu .22s ease both;
}
.fzb-overlay.is-leaving { animation: fzbFonduSortie .24s ease both; }
.fzb-overlay.is-leaving .fzb-sheet { animation: fzbSortie .2s ease forwards; }
html.fzb-lock, html.fzb-lock body { overflow: hidden; }

@keyframes fzbFondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes fzbFonduSortie { to { opacity: 0; } }
@keyframes fzbMontee {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to { opacity: 1; transform: none; }
}
@keyframes fzbSortie { to { opacity: 0; transform: translateY(12px) scale(.98); } }

.fzb-sheet {
    /* Un voile neutre sur le palier surélevé : pastilles, piste de la barre,
       fond des visages. Tiré du texte, il marche dans les deux thèmes. */
    --fzb-tint: color-mix(in srgb, var(--text-main, #F5F5F7) 9%, transparent);
    --fzb-pad: 24px;
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--card, #1C1C1E);
    color: var(--text-main, #F5F5F7);
    border: 1px solid var(--border-light, #38383A);
    border-radius: 16px;
    box-shadow: var(--elevation-4, 0 20px 50px rgba(0, 0, 0, .55));
    overflow: hidden;
    font: 400 15px/1.35 'Barlow', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Sans « forwards » : le panneau tiré du doigt (téléphone) se déplace
       par son style en ligne, qu'une animation figée écraserait. */
    animation: fzbMontee .34s cubic-bezier(.2, .8, .2, 1) backwards;
}
/* La fenêtre reçoit le focus à l'ouverture pour que le lecteur d'écran lise
   son titre ; c'est un conteneur, pas une commande : pas d'anneau. */
.fzb-sheet:focus,
.fzb-sheet:focus-visible { outline: none; }

.fzb-sheet p,
.fzb-sheet h2,
.fzb-sheet h3 { margin: 0; }

/* Deux libellés, le long sur ordinateur, le court sur téléphone. */
.fzb-short { display: none; }

/* ---- Le haut : la progression, l'équipe, la date ------------------------ */

.fzb-top { flex: none; }
.fzb-grab { display: none; }

.fzb-progress {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 12px 20px 0;
}
.fzb-seg {
    height: 3px;
    border-radius: 2px;
    background: var(--border-light, #38383A);
    overflow: hidden;
}
.fzb-seg i {
    display: block;
    height: 100%;
    background: var(--text-main, #F5F5F7);
    transform: scaleX(0);
    transform-origin: left;
}
.fzb-seg.is-done i { transform: scaleX(1); }
.fzb-seg.is-active i { animation: fzbSegment var(--fzb-step, 1750ms) linear both; }
@keyframes fzbSegment { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.fzb-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px var(--fzb-pad) 0;
}
.fzb-titles { flex: 1; min-width: 0; }
.fzb-eyebrow {
    font: 600 12px/1.3 'Barlow', 'Segoe UI', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-secondary, #A1A1A6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fzb-title {
    font: 700 30px/1.05 'Barlow Condensed', 'Segoe UI', sans-serif;
    letter-spacing: .01em;
    text-transform: uppercase;
    color: var(--text-main, #F5F5F7);
}

/* Le logo d'une équipe de pool : son premier club, sinon ses initiales. */
.fzb-logo,
.fzb-duel-logo {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--card-white, #2C2C2E);
    border: 1px solid var(--border-light, #38383A);
    overflow: hidden;
}
.fzb-logo { width: 48px; height: 48px; }
.fzb-logo img,
.fzb-duel-logo img {
    position: absolute;
    inset: 14%;
    width: 72%;
    height: 72%;
    object-fit: contain;
    z-index: 1;
}
.fzb-logo img ~ span,
.fzb-duel-logo img ~ span { visibility: hidden; }
.fzb-logo-initiales,
.fzb-duel-logo-initiales {
    font: 600 13px/1 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-secondary, #A1A1A6);
}

.fzb-close {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #A1A1A6);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.fzb-close:hover { background: var(--bg-hover, #2C2C2E); color: var(--text-main, #F5F5F7); }

/* ---- Le corps : les deux cartes, puis les joueurs ----------------------- */

.fzb-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 0 20px;
}

.fzb-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    padding: 0 var(--fzb-pad);
}

.fzb-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--card-white, #2C2C2E);
    border: 1px solid var(--border-light, #38383A);
}
.fzb-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.fzb-label {
    font: 600 12px/1.3 'Barlow', 'Segoe UI', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-secondary, #A1A1A6);
}
.fzb-panel-aside {
    font: 500 13px/1.3 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-secondary, #A1A1A6);
    white-space: nowrap;
}

.fzb-big { display: flex; align-items: baseline; gap: 6px; }
.fzb-big-n {
    display: inline-block;
    font: 700 56px/.9 'Barlow Condensed', 'Segoe UI', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--text-main, #F5F5F7);
    transform-origin: left bottom;
}
.fzb-big-n sup {
    position: relative;
    top: 4px;
    font-size: 24px;
    line-height: 1;
    vertical-align: top;
}
.fzb-big-unit {
    font: 700 16px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary, #A1A1A6);
}
.fzb-rank .fzb-big-unit { font-weight: 600; letter-spacing: .04em; }

/* Le total grimpe : un bond, en vert, à chaque arrivée de points. */
.fzb-tally.is-bump .fzb-tally-n { animation: fzbBond .42s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes fzbBond {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); color: var(--success, #30D158); }
    100% { transform: scale(1); }
}

/* La part de chaque joueur, aux couleurs de son club. La piste se remplit
   pendant le spectacle, puis s'efface : il ne reste que les parts. */
.fzb-mix {
    display: flex;
    height: 6px;
    border-radius: 3px;
    background: var(--fzb-tint);
    overflow: hidden;
    transition: background .4s ease;
}
.fzb-mix.is-full { background: transparent; }
.fzb-mix i {
    flex: 0 1 0%;
    min-width: 0;
    border-radius: 3px;
    background: var(--fzb-club, var(--border-gray, #636366));
    transition: flex-basis .55s cubic-bezier(.2, .8, .2, 1), margin .55s cubic-bezier(.2, .8, .2, 1);
}
.fzb-mix i.is-on { flex-basis: calc(var(--fzb-part) * 1%); }
.fzb-mix i.is-on ~ i.is-on { margin-left: 3px; }

/* Le mouvement : ▲ ▼ = dans un rond, puis le texte. Il attend la fin. */
.fzb-move {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 500 13px/1.3 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-secondary, #A1A1A6);
}
.fzb-move-ico {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--fzb-tint);
    color: var(--text-main, #F5F5F7);
    font: 600 12px/1 'Barlow', 'Segoe UI', sans-serif;
}
.fzb-move.is-up .fzb-move-ico { background: color-mix(in srgb, var(--success, #30D158) 18%, transparent); color: var(--success, #30D158); }
.fzb-move.is-down .fzb-move-ico { background: rgba(var(--primary-rgb, 230, 32, 48), .16); color: var(--primary-text, #FF5C66); }
.fzb-move-txt { min-width: 0; }
.fzb-move sup { font-size: .7em; }
.fzb-panel.is-attente .fzb-move { visibility: hidden; }
.fzb-panel:not(.is-attente) .fzb-move { animation: fzbLevee .4s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes fzbLevee { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fzb-rank-n.is-change { animation: fzbPoints .5s cubic-bezier(.2, .9, .3, 1.35) both; }

/* Le duel de la semaine : une ligne par équipe, le pointage de celle qui
   mène en blanc une fois la soirée comptée. */
.fzb-duel-rows { list-style: none; margin: 0; padding: 0; }
.fzb-duel-team {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.fzb-duel-team + .fzb-duel-team { border-top: 1px solid var(--border-light, #38383A); }
.fzb-duel-logo { width: 24px; height: 24px; }
.fzb-duel-logo-initiales { font-size: 9px; }
.fzb-duel-name {
    font: 600 14px/1.2 'Barlow', 'Segoe UI', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fzb-duel-score {
    font: 700 24px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary, #A1A1A6);
    transition: color .4s ease;
}
.fzb-duel:not(.is-attente) .is-lead .fzb-duel-score { color: var(--text-main, #F5F5F7); }

/* ---- Les joueurs --------------------------------------------------------- */

.fzb-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px var(--fzb-pad) 10px;
}
.fzb-list-aside {
    font: 500 13px/1.3 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-light-gray, #6E6E73);
    white-space: nowrap;
}
.fzb-list-head [hidden] { display: none !important; }
/* « Passer » tient la place du « Triés par points » de la fin ; ses marges
   négatives gardent la rangée à la hauteur du texte. */
.fzb-skip {
    height: 40px;
    margin: -12px -12px -12px 0;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--primary-text, #FF5C66);
    font: 600 13px/1 'Barlow', 'Segoe UI', sans-serif;
    cursor: pointer;
}
.fzb-skip:hover { background: rgba(var(--primary-rgb, 230, 32, 48), .08); }

.fzb-rail-wrap { position: relative; }

/* La rangée : quatre cartes à la largeur de la fenêtre, et un défilement
   au-delà. Toutes les cartes y sont dès l'ouverture, invisibles. */
.fzb-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max(160px, calc((100% - 36px) / 4));
    gap: 12px;
    padding: 0 var(--fzb-pad) 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--fzb-pad);
    scrollbar-width: none;
    -webkit-tap-highlight-color: transparent;
}
.fzb-rail::-webkit-scrollbar { display: none; }
.fzb-rail.is-show { cursor: pointer; }
.fzb-rail.is-vide { display: block; }
.fzb-rail.has-gauche,
.fzb-rail.has-droite {
    --fzb-fade-l: 0px;
    --fzb-fade-r: 0px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fzb-fade-l), #000 calc(100% - var(--fzb-fade-r)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fzb-fade-l), #000 calc(100% - var(--fzb-fade-r)), transparent 100%);
}
.fzb-rail.has-gauche { --fzb-fade-l: 32px; }
.fzb-rail.has-droite { --fzb-fade-r: 32px; }

.fzb-rail-btn {
    position: absolute;
    top: 38%;
    z-index: 5;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-light, #38383A);
    border-radius: 50%;
    background: var(--card, #1C1C1E);
    color: var(--text-main, #F5F5F7);
    box-shadow: var(--elevation-2, 0 2px 8px rgba(0, 0, 0, .32));
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity .15s ease, background .15s ease;
}
.fzb-rail-btn.is-prev { left: 10px; }
.fzb-rail-btn.is-next { right: 10px; }
.fzb-rail-btn:hover { background: var(--bg-hover, #2C2C2E); }
.fzb-rail-btn.is-off { opacity: 0; pointer-events: none; }
.fzb-rail-btn[hidden] { display: none; }

/* ---- Une carte ----------------------------------------------------------- */

.fzb-card {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    background: var(--card-white, #2C2C2E);
    border: 1px solid var(--border-light, #38383A);
    overflow: hidden;
    isolation: isolate;
    scroll-snap-align: start;
}
/* Le filet du club : en haut sur ordinateur, à gauche sur téléphone. */
.fzb-card::before {
    content: '';
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--fzb-club, var(--border-gray, #636366));
}
.fzb-card.is-vide::before { display: none; }

.fzb-card.is-attente { opacity: 0; transform: translateY(14px) scale(.96); }
.fzb-card.is-entree { animation: fzbCarteEntree .5s cubic-bezier(.2, .8, .2, 1) both; }
.fzb-card.is-entree .fzb-card-photo img { animation: fzbPhoto .6s .06s cubic-bezier(.2, .8, .2, 1) both; }
.fzb-card.is-entree .fzb-card-pts { animation: fzbPoints .5s .3s cubic-bezier(.2, .9, .3, 1.35) both; }
.fzb-card.is-posee { animation: fzbFondu .25s ease both; }
@keyframes fzbCarteEntree {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to { opacity: 1; transform: none; }
}
@keyframes fzbPhoto {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}
@keyframes fzbPoints {
    0% { opacity: 0; transform: scale(.4); }
    60% { opacity: 1; transform: scale(1.14); }
    100% { opacity: 1; transform: scale(1); }
}

/* La photo, sur la teinte sombre du club, l'écusson en filigrane. */
.fzb-card-media {
    position: relative;
    flex: none;
    aspect-ratio: 4 / 3;
    margin-top: 4px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    background-color: var(--fzb-surface, #2C2C2E);
    background-image:
        radial-gradient(110% 80% at 50% 0%, rgba(255, 255, 255, .14), transparent 62%),
        linear-gradient(170deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .3));
}
.fzb-card-crest {
    position: absolute;
    top: -14%;
    right: -16%;
    width: 68%;
    height: auto;
    opacity: .18;
    transform: rotate(-12deg);
    pointer-events: none;
}
.fzb-card-photo {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.fzb-card-photo img {
    height: 100%;
    width: auto;
    max-width: none;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
}
.fzb-card-photo.is-club { align-items: center; }
.fzb-card-photo.is-club img { height: 70%; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3)); }
.fzb-card-photo img ~ span { display: none; }
.fzb-card-photo-initiales {
    align-self: center;
    font: 700 40px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .55);
}

/* Ceux qui ont joué sans marquer : leurs visages, sur le voile neutre. */
.fzb-card-media.is-faces {
    align-items: center;
    padding: 0 8px 0 18px;
    background: var(--fzb-tint);
}
.fzb-face {
    position: relative;
    flex: none;
    width: 44px;
    height: 44px;
    margin-left: -10px;
    border-radius: 50%;
    border: 2px solid var(--card-white, #2C2C2E);
    background: var(--fzb-surface, var(--border-light, #38383A));
    overflow: hidden;
    display: grid;
    place-items: center;
}
.fzb-face.is-plus {
    background: var(--border-light, #38383A);
    font: 600 13px/1 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-main, #F5F5F7);
}
.fzb-face-photo { position: absolute; inset: 0; display: grid; place-items: center; }
.fzb-face-photo img { position: absolute; left: 0; bottom: -2px; width: 100%; height: auto; z-index: 1; }
.fzb-face-photo.is-club img { inset: 18%; width: 64%; height: 64%; object-fit: contain; }
.fzb-face-photo img ~ span { visibility: hidden; }
.fzb-face-photo-initiales { font: 600 12px/1 'Barlow', 'Segoe UI', sans-serif; color: rgba(255, 255, 255, .85); }

.fzb-card-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 0;
}
.fzb-card-id { min-width: 0; }
.fzb-card-name {
    font: 600 15px/1.2 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-main, #F5F5F7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fzb-card-meta {
    font: 400 13px/1.3 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-secondary, #A1A1A6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Sur ordinateur, les résultats sont en pastilles ; sur téléphone, à la
   suite du poste. */
.fzb-card-meta-res { display: none; }
.fzb-card.is-groupe .fzb-card-meta {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.fzb-card-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
}
.fzb-card-stats li {
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--fzb-tint);
    font: 500 12px/1.3 'Barlow', 'Segoe UI', sans-serif;
    color: var(--text-main, #F5F5F7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fzb-card-pts {
    flex: none;
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 10px 12px 14px;
    transform-origin: left bottom;
}
.fzb-card-pts-v {
    font: 700 34px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--text-main, #F5F5F7);
}
.fzb-card-pts-l {
    font: 700 12px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary, #A1A1A6);
}
.fzb-card-pts.is-zero .fzb-card-pts-v { color: var(--text-secondary, #A1A1A6); }
.fzb-card-pts.is-moins .fzb-card-pts-v { color: var(--primary-text, #FF5C66); }

.fzb-card.is-vide { padding: 22px 20px; text-align: center; }
.fzb-card.is-vide .fzb-card-body { padding: 0; gap: 4px; }
.fzb-card.is-vide .fzb-card-meta { white-space: normal; }

/* ---- Les points qui filent vers le total -------------------------------- */

.fzb-fly {
    position: fixed;
    z-index: 10060;
    padding: 4px 12px;
    border-radius: 999px;
    font: 700 26px/1 'Barlow Condensed', 'Segoe UI', sans-serif;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.fzb-fly.is-plus { background: var(--success, #30D158); color: var(--on-success, #000000); }
.fzb-fly.is-moins { background: var(--card-white, #2C2C2E); color: var(--primary-text, #FF5C66); }

/* ---- Pied : fermer, et l'action ------------------------------------------ */

.fzb-foot {
    flex: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 20px var(--fzb-pad) 24px;
    border-top: 1px solid var(--border-light, #38383A);
}

.fzb-btn-primary,
.fzb-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    border: 0;
    border-radius: 10px;
    font: 600 15px/1 'Barlow', 'Segoe UI', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
}
.fzb-btn-primary {
    padding: 0 22px;
    background: var(--primary, #E62030);
    color: var(--on-primary, #FFFFFF);
}
.fzb-btn-primary:hover { background: var(--primary-deep, #C41A28); color: var(--on-primary, #FFFFFF); }
.fzb-btn-secondary {
    padding: 0 20px;
    background: transparent;
    color: var(--text-main, #F5F5F7);
}
.fzb-btn-secondary:hover { background: var(--bg-hover, #2C2C2E); }

.fzb-close:focus-visible,
.fzb-skip:focus-visible,
.fzb-rail-btn:focus-visible,
.fzb-btn-primary:focus-visible,
.fzb-btn-secondary:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px rgba(230, 32, 48, .4)); }

.fzb-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Ordinateur à l'écran bas : la photo se resserre ---------------------- */

@media (min-width: 601px) and (max-height: 760px) {
    .fzb-head { padding-top: 14px; }
    .fzb-body { padding-top: 14px; }
    .fzb-big-n { font-size: 48px; }
    .fzb-list-head { padding-top: 16px; }
    .fzb-card-media { aspect-ratio: 16 / 10; }
    .fzb-foot { padding-top: 14px; padding-bottom: 16px; }
}

/* ---- Téléphone : un panneau qui monte du bas ------------------------------
   Les deux cartes côte à côte restent en haut pendant que la liste défile
   dessous : le total reste en vue quand les points y filent. */

@media (max-width: 600px) {
    .fzb-overlay { align-items: flex-end; padding: 0; }
    .fzb-sheet {
        --fzb-pad: 16px;
        max-width: none;
        max-height: calc(100dvh - 56px);
        border-width: 1px 0 0;
        border-radius: 24px 24px 0 0;
        animation: fzbMonteeBas .42s cubic-bezier(.2, .8, .2, 1) backwards;
        transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    }
    .fzb-sheet.is-drag { transition: none; }
    .fzb-overlay.is-leaving .fzb-sheet { animation: fzbDescente .24s cubic-bezier(.4, 0, 1, 1) forwards; }

    .fzb-long { display: none; }
    .fzb-short { display: inline; }

    .fzb-top { touch-action: none; }
    .fzb-grab { display: flex; justify-content: center; padding: 8px 0 0; }
    .fzb-grab span { width: 40px; height: 5px; border-radius: 3px; background: var(--border-light, #38383A); }
    .fzb-progress { padding: 10px 16px 0; }
    .fzb-head { gap: 12px; padding: 16px 16px 0; }
    .fzb-logo { width: 40px; height: 40px; }
    .fzb-eyebrow { font-size: 11px; }
    .fzb-title { font-size: 26px; }
    .fzb-close {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--bg-hover, #2C2C2E);
        color: var(--text-main, #F5F5F7);
    }

    .fzb-body { padding: 0; }
    .fzb-summary {
        position: sticky;
        top: 0;
        z-index: 4;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 16px 16px 12px;
        background: var(--card, #1C1C1E);
    }
    /* La liste passe dessous en fondu, sans arête nette. */
    .fzb-summary::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        height: 14px;
        background: linear-gradient(var(--card, #1C1C1E), transparent);
        pointer-events: none;
    }
    .fzb-panel { gap: 6px; padding: 12px 14px; }
    .fzb-label { font-size: 11px; letter-spacing: .1em; }
    .fzb-panel-aside { display: none; }
    .fzb-big { gap: 4px; }
    .fzb-big-n { font-size: 44px; }
    .fzb-big-n sup { top: 3px; font-size: 20px; }
    .fzb-big-unit { font-size: 13px; }
    .fzb-mix { height: 5px; }
    .fzb-mix i.is-on ~ i.is-on { margin-left: 2px; }
    .fzb-move { gap: 6px; font-size: 12px; }
    .fzb-move-ico { width: 16px; height: 16px; font-size: 11px; }
    .fzb-duel-team { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px; padding: 3px 0; }
    .fzb-duel-logo { width: 20px; height: 20px; }
    .fzb-duel-name { font-size: 13px; }
    .fzb-duel-score { font-size: 20px; }

    .fzb-list-head { padding: 8px 16px 10px; }
    .fzb-list-aside { font-size: 12px; }

    /* La liste : une rangée par joueur. */
    .fzb-rail {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0 16px 16px;
        overflow: visible;
        scroll-snap-type: none;
    }
    .fzb-rail-btn { display: none; }
    .fzb-card {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
        padding: 10px 14px 10px 10px;
    }
    .fzb-card::before { right: auto; bottom: 0; width: 3px; height: auto; }
    .fzb-card-media {
        width: 52px;
        height: 52px;
        aspect-ratio: auto;
        margin: 0;
        border-radius: 10px;
    }
    .fzb-card-crest { display: none; }
    .fzb-card-photo-initiales { font-size: 22px; }
    .fzb-card-body { padding: 0; gap: 2px; }
    .fzb-card-stats { display: none; }
    .fzb-card-meta-res { display: inline; }
    .fzb-card.is-groupe .fzb-card-meta { -webkit-line-clamp: 1; }
    .fzb-card-pts { padding: 0; gap: 3px; transform-origin: right center; }
    .fzb-card-pts-v { font-size: 28px; }
    .fzb-card-pts-l { font-size: 11px; }

    .fzb-card-media.is-faces {
        display: grid;
        grid-template-columns: repeat(2, 22px);
        gap: 2px;
        place-content: center;
        padding: 0;
    }
    .fzb-face { width: 22px; height: 22px; margin: 0; border-width: 1px; }
    .fzb-face:only-child { grid-column: 1 / -1; width: 38px; height: 38px; }
    .fzb-face.is-plus { font-size: 10px; }
    .fzb-face-photo-initiales { font-size: 9px; }
    .fzb-card.is-vide { display: block; }

    /* Le pied : l'action sur toute la largeur, « Fermer » dessous, au-dessus
       de la barre d'accueil. */
    .fzb-foot {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 4px;
        padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px));
    }
    .fzb-btn-primary { height: 52px; border-radius: 12px; font-size: 16px; }
    .fzb-btn-secondary { height: 44px; border-radius: 12px; }
}
@keyframes fzbMonteeBas { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fzbDescente { to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
    .fzb-overlay,
    .fzb-overlay.is-leaving .fzb-sheet,
    .fzb-sheet,
    .fzb-card.is-entree,
    .fzb-card.is-entree .fzb-card-photo img,
    .fzb-card.is-entree .fzb-card-pts,
    .fzb-card.is-posee,
    .fzb-panel:not(.is-attente) .fzb-move,
    .fzb-rank-n.is-change,
    .fzb-tally.is-bump .fzb-tally-n { animation: none; }
    .fzb-sheet,
    .fzb-mix,
    .fzb-mix i,
    .fzb-duel-score { transition: none; }
    .fzb-seg.is-active i { animation: none; transform: scaleX(1); }
}
