/* ── F1 Season Simulator ────────────────────────────────────────────────── */

:root {
    --f1-red:    #e10600;
    --f1-dark:   #1a1a1a;
    --f1-mid:    #444;
    --f1-muted:  #888;
    --f1-border: #e0e0e0;
    --f1-bg:     #f7f7f7;
    --f1-white:  #fff;
}

#f1-sim-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--f1-dark);
    max-width: 1140px;
    margin: 0 auto;
}

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.f1-sim-header {
    background: var(--f1-white);
    border-bottom: 3px solid var(--f1-red);
    padding: 14px 16px 0;
    margin-bottom: 20px;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.f1-sim-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.f1-sim-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.f1-sim-title-label {
    font-size: 18px;
    font-weight: 800;
    color: var(--f1-dark);
    letter-spacing: -.02em;
}

/* ── Onglets Pilotes / Écuries ───────────────────────────────────────────── */

.f1-sim-tabs {
    display: flex;
    gap: 4px;
}

.f1-sim-tab {
    padding: 5px 12px;
    border: 2px solid var(--f1-border);
    background: var(--f1-white);
    color: var(--f1-mid);
    font-weight: 700;
    font-size: 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    line-height: 1.4;
}
.f1-sim-tab:hover {
    border-color: var(--f1-red);
    color: var(--f1-dark);
}
.f1-sim-tab--active {
    background: var(--f1-red);
    border-color: var(--f1-red);
    color: var(--f1-white);
}

.f1-sim-season-pick {
    display: flex;
    align-items: center;
    gap: 8px;
}

.f1-sim-season-pick label {
    font-weight: 700;
    font-size: 13px;
    color: var(--f1-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.f1-sim-select {
    padding: 6px 10px;
    border: 2px solid var(--f1-border);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 700;
    color: var(--f1-dark);
    background: var(--f1-white);
    cursor: pointer;
    transition: border-color .15s;
}
.f1-sim-select:focus {
    border-color: var(--f1-red);
    outline: none;
}

/* ── Barre de modes ──────────────────────────────────────────────────────── */

.f1-sim-mode-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 2px;
}

.f1-sim-mode-btn {
    padding: 7px 14px;
    border: 2px solid var(--f1-border);
    background: var(--f1-white);
    color: var(--f1-mid);
    font-weight: 700;
    font-size: 13px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-bottom: -3px;
    border-bottom-color: transparent;
    transition: color .15s, border-color .15s, background .15s;
}
.f1-sim-mode-btn:hover {
    color: var(--f1-dark);
    border-color: #bbb;
    border-bottom-color: transparent;
}
.f1-sim-mode-btn.f1-sim-mode-active {
    background: var(--f1-red);
    color: var(--f1-white);
    border-color: var(--f1-red);
    border-bottom-color: transparent;
}

/* ── Bouton Règlement ────────────────────────────────────────────────────── */
.f1-sim-era-toggle {
    padding: 7px 14px;
    border: 2px solid var(--f1-border);
    background: var(--f1-white);
    color: var(--f1-mid);
    font-weight: 700;
    font-size: 13px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-bottom: -3px;
    border-bottom-color: transparent;
    transition: color .15s, border-color .15s, background .15s;
}
.f1-sim-era-toggle:hover {
    color: var(--f1-dark);
    border-color: #bbb;
    border-bottom-color: transparent;
}
.f1-sim-era-toggle--open {
    background: #f0f4ff;
    color: #2050c0;
    border-color: #90aef0;
    border-bottom-color: transparent;
}
.f1-sim-era-toggle--active {
    background: #e8f0ff;
    color: #1a40a0;
    border-color: #6090e0;
    border-bottom-color: transparent;
}
.f1-sim-era-toggle--active.f1-sim-era-toggle--open {
    background: #d8e8ff;
}

/* ── Picker d'ères ───────────────────────────────────────────────────────── */
.f1-sim-era-picker {
    background: #f8faff;
    border-bottom: 2px solid #90aef0;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

.f1-sim-era-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f1-sim-era-group-label {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #888;
    line-height: 1;
}

.f1-sim-era-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.f1-sim-era-btn {
    padding: 4px 10px;
    border: 2px solid var(--f1-border);
    background: var(--f1-white);
    color: var(--f1-mid);
    font-weight: 700;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}
.f1-sim-era-btn:hover {
    border-color: #6090e0;
    color: #1a40a0;
}
.f1-sim-era-btn.f1-sim-era-active {
    background: #1a40a0;
    border-color: #1a40a0;
    color: #fff;
}

/* ── Zone de détail du barème (dans le picker) ───────────────────────────── */
.f1-sim-era-desc {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #c0d4f8;
    border-radius: 6px;
    font-size: 12px;
    color: #1a1a1a;
    line-height: 1.8;
}

/* ── Barre de détail du barème (dans le classement) ─────────────────────── */
.f1-sim-era-detail-bar {
    padding: 6px 12px;
    background: #f0f4ff;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #1a40a0;
}

/* ── Chips de barème (portés depuis f1-stats.css) ────────────────────────── */
.f1-pts-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
    margin: 2px 0;
}
.f1-pts-item {
    display: inline-block;
    background: rgba(26,64,160,.1);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    color: #1a1a1a;
}
.f1-pts-item[data-pos="1"]::before  { content: "1er "; }
.f1-pts-item[data-pos="2"]::before  { content: "2e "; }
.f1-pts-item[data-pos="3"]::before  { content: "3e "; }
.f1-pts-item[data-pos="4"]::before  { content: "4e "; }
.f1-pts-item[data-pos="5"]::before  { content: "5e "; }
.f1-pts-item[data-pos="6"]::before  { content: "6e "; }
.f1-pts-item[data-pos="7"]::before  { content: "7e "; }
.f1-pts-item[data-pos="8"]::before  { content: "8e "; }
.f1-pts-item[data-pos="9"]::before  { content: "9e "; }
.f1-pts-item[data-pos="10"]::before { content: "10e "; }
.f1-pts-item::after { content: " pts"; font-weight: 400; color: #666; }
.f1-pts-fl { background: rgba(255,160,0,.15); color: #7a4c00; }
.f1-pts-fl::after { content: ""; }
.f1-pts-note {
    font-size: 11px;
    color: #888;
    font-style: italic;
    vertical-align: middle;
}

/* ── Deltas de rang avant/après ──────────────────────────────────────────── */
.f1-sim-rank-delta {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
}
.f1-sim-rank-up {
    background: #e6f9ed;
    color: #1a7a3a;
}
.f1-sim-rank-dn {
    background: #ffeaea;
    color: #c0001c;
}
/* Dans les cards podium : centré sous les pts */
.f1-sim-pod-card .f1-sim-rank-delta {
    margin-top: 4px;
    font-size: 11px;
    padding: 2px 8px;
}
/* Dans la liste : après le numéro de rang */
.f1-sim-entry .f1-sim-rank-delta {
    flex-shrink: 0;
}

/* ── Badge règlement actif ───────────────────────────────────────────────── */
.f1-sim-era-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    background: #e8f0ff;
    border: 1px solid #90aef0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #1a40a0;
    cursor: help;
}

.f1-sim-reset-btn {
    padding: 7px 14px;
    border: 2px solid var(--f1-border);
    background: var(--f1-white);
    color: var(--f1-muted);
    font-weight: 700;
    font-size: 13px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-bottom: -3px;
    border-bottom-color: transparent;
    margin-left: auto;
    transition: color .15s, border-color .15s;
}
.f1-sim-reset-btn:hover {
    color: var(--f1-red);
    border-color: var(--f1-red);
    border-bottom-color: transparent;
}

/* ── Statut ──────────────────────────────────────────────────────────────── */

.f1-sim-status {
    min-height: 0;
    transition: all .2s;
}
.f1-sim-status--loading {
    padding: 24px;
    text-align: center;
    color: var(--f1-muted);
    font-size: 15px;
}
.f1-sim-status--loading::before {
    content: '⏳ ';
}
.f1-sim-status--error {
    padding: 16px;
    background: #fff0f0;
    border: 1px solid #ffc0c0;
    border-radius: 6px;
    color: #c00;
    font-weight: 600;
}
.f1-sim-status--error::before {
    content: '⚠ ';
}

.f1-sim-notice {
    padding: 20px;
    background: var(--f1-bg);
    border-radius: 6px;
    color: var(--f1-muted);
    font-style: italic;
}

/* ── Contenu principal ────────────────────────────────────────────────────── */

.f1-sim-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ── En-tête de section ──────────────────────────────────────────────────── */

.f1-sim-section-hdr {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 4px;
}

.f1-sim-h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--f1-dark);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--f1-red);
    letter-spacing: -.01em;
    flex-shrink: 0;
}

.f1-sim-section-hdr .f1-sim-h2 {
    margin-bottom: 10px;
}

.f1-sim-mode-hint {
    display: none;
    margin-top: 8px;
    padding: 10px 14px;
    background: #fffbf0;
    border-left: 3px solid #f0a500;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: #7a5500;
    margin-bottom: 8px;
}
.f1-sim-mode-hint:not(:empty) {
    display: block;
}

/* ── Titre championnat + badges ──────────────────────────────────────────── */

.f1-sim-champ-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--f1-dark);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.f1-sim-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: var(--f1-bg);
    border: 1px solid var(--f1-border);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--f1-mid);
}

.f1-sim-alert {
    padding: 10px 14px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #7a5c00;
    margin-bottom: 16px;
}

/* ── Podium (P2 · P1 · P3) ──────────────────────────────────────────────── */

.f1-sim-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.f1-sim-pod-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--f1-white);
    border: 2px solid var(--f1-border);
    border-radius: 10px;
    padding: 14px 10px 12px;
    width: 140px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: opacity .3s;
}

/* P1 — plus grand */
.f1-sim-rank-1 {
    width: 170px;
    border-color: #ffd700;
    box-shadow: 0 4px 16px rgba(255,215,0,.25);
    padding-top: 20px;
}
/* P2 — argent */
.f1-sim-rank-2 {
    border-color: #c0c0c0;
}
/* P3 — bronze */
.f1-sim-rank-3 {
    border-color: #cd7f32;
}

.f1-sim-pod-rank {
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
}
.f1-sim-rank-1 .f1-sim-pod-rank { color: #c8a600; font-size: 28px; }
.f1-sim-rank-2 .f1-sim-pod-rank { color: #888; }
.f1-sim-rank-3 .f1-sim-pod-rank { color: #a0622a; }

.f1-sim-pod-rank sup {
    font-size: .55em;
    font-weight: 700;
}

.f1-sim-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 2px solid var(--f1-border);
    margin-bottom: 8px;
    background: var(--f1-bg);
}
.f1-sim-rank-1 .f1-sim-photo {
    width: 88px;
    height: 88px;
    border-color: #ffd700;
}

.f1-sim-pod-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--f1-dark);
    line-height: 1.2;
    margin-bottom: 4px;
}
.f1-sim-rank-1 .f1-sim-pod-name { font-size: 15px; }

.f1-sim-pod-pts {
    font-size: 14px;
    font-weight: 800;
    color: var(--f1-red);
}
.f1-sim-rank-1 .f1-sim-pod-pts { font-size: 16px; }

.f1-sim-pod-team {
    font-size: 10px;
    color: var(--f1-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── Bouton masquer (remove_driver mode) ─────────────────────────────────── */

.f1-sim-rm-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    background: var(--f1-red);
    color: var(--f1-white);
    font-size: 12px;
    font-weight: 900;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background .15s, transform .15s;
    z-index: 2;
}
.f1-sim-rm-btn:hover {
    background: #a00;
    transform: scale(1.15);
}

.f1-sim-rm-btn--sm {
    position: static;
    width: 18px;
    height: 18px;
    font-size: 10px;
    flex-shrink: 0;
}

/* ── Barre pilotes masqués ───────────────────────────────────────────────── */

.f1-sim-masked-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: #fff8f8;
    border: 1px solid #ffd0d0;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Variante pour les courses dont l'ordre a été modifié */
.f1-sim-reordered-bar {
    background: #f0f4ff;
    border-color: #b0c4f8;
}
.f1-sim-reordered-bar .f1-sim-mask-pill {
    border-color: #90aef0;
}
.f1-sim-reordered-bar .f1-sim-mask-unmask {
    background: #c8d8f8;
    color: #1a40a0;
}
.f1-sim-reordered-bar .f1-sim-mask-unmask:hover {
    background: #2050c0;
    color: #fff;
}

/* Variante pour les courses annulées */
.f1-sim-cancelled-bar {
    background: #fff8f0;
    border-color: #ffd0a0;
}
.f1-sim-cancelled-bar .f1-sim-mask-pill {
    border-color: #ffc080;
}
.f1-sim-cancelled-bar .f1-sim-mask-unmask {
    background: #ffe0b0;
    color: #c05000;
}
.f1-sim-cancelled-bar .f1-sim-mask-unmask:hover {
    background: #e06000;
    color: #fff;
}

.f1-sim-masked-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--f1-muted);
    white-space: nowrap;
}

.f1-sim-mask-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    background: var(--f1-white);
    border: 1px solid #ffc0c0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--f1-mid);
}

.f1-sim-mask-unmask {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: #ffd0d0;
    color: var(--f1-red);
    font-size: 10px;
    font-weight: 900;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background .15s;
    flex-shrink: 0;
}
.f1-sim-mask-unmask:hover {
    background: var(--f1-red);
    color: var(--f1-white);
}

/* ── État masqué ──────────────────────────────────────────────────────────── */

.f1-sim-dimmed {
    opacity: .3;
    pointer-events: none; /* empêche le re-clic après masquage */
}
/* Mais les boutons restent cliquables pour démasquer */
.f1-sim-dimmed .f1-sim-rm-btn,
.f1-sim-dimmed .f1-sim-rm-btn--sm {
    pointer-events: auto;
}

/* ── Liste classement (rang 4+) ──────────────────────────────────────────── */

.f1-sim-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f1-sim-entry {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--f1-white);
    border: 1px solid var(--f1-border);
    border-radius: 6px;
    transition: opacity .3s;
}
.f1-sim-entry:hover {
    background: var(--f1-bg);
}

.f1-sim-entry-rank {
    width: 28px;
    text-align: right;
    font-weight: 800;
    font-size: 13px;
    color: var(--f1-muted);
    flex-shrink: 0;
}

.f1-sim-entry-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    background: var(--f1-bg);
    flex-shrink: 0;
}

.f1-sim-entry-name {
    font-weight: 700;
    font-size: 13px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.f1-sim-entry-team {
    font-size: 11px;
    color: var(--f1-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.f1-sim-entry-pts {
    font-weight: 800;
    font-size: 13px;
    color: var(--f1-red);
    flex-shrink: 0;
    min-width: 52px;
    text-align: right;
}

/* ── Courses de la saison ────────────────────────────────────────────────── */

.f1-sim-races {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f1-sim-race {
    background: var(--f1-white);
    border: 1px solid var(--f1-border);
    border-radius: 8px;
    padding: 10px 12px;
    transition: opacity .3s, border-color .2s, box-shadow .2s;
}

.f1-sim-race--cancelled {
    opacity: .3;
}

.f1-sim-race--reordering {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
    background: #fafcff;
}

.f1-sim-race--clickable {
    cursor: pointer;
    user-select: none;
}
.f1-sim-race--clickable:hover {
    border-color: var(--f1-red);
    box-shadow: 0 0 0 2px rgba(225,6,0,.12);
}

.f1-sim-race-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.f1-sim-race-hdr-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.f1-sim-race-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.f1-sim-race-act {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid var(--f1-border);
    background: none;
    cursor: pointer;
    color: var(--f1-muted);
    transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap;
    line-height: 1.4;
}
.f1-sim-race-act:hover {
    background: var(--f1-bg);
    color: var(--f1-dark);
    border-color: #bbb;
}
.f1-sim-race-act--active {
    background: #eef4ff;
    border-color: #3b82f6;
    color: #1e40af;
    font-weight: 700;
}
.f1-sim-race-act--cancel.f1-sim-race-act--active {
    background: #fff0f0;
    border-color: #e53e3e;
    color: #b91c1c;
}

/* Meilleur tour en course */
.f1-sim-fl-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}
.f1-sim-fl-row--suppressed {
    opacity: 0.65;
}
.f1-sim-fl-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #7b2d8b;
    background: #faf0ff;
    border: 1px solid #d8b4fe;
    border-radius: 8px;
    padding: 1px 7px;
}
.f1-sim-fl-badge em {
    font-style: normal;
    font-weight: 400;
    color: #a855f7;
    margin-left: 2px;
}
.f1-sim-fl-badge--suppressed {
    background: #f5f5f5;
    border-color: #ddd;
    color: #aaa;
}
.f1-sim-fl-badge--suppressed em { color: #aaa; }
.f1-sim-fl-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    font-size: 10px;
    border: 1px solid #d8b4fe;
    border-radius: 6px;
    background: none;
    color: #9333ea;
    cursor: pointer;
    line-height: 1.4;
    transition: background .12s;
}
.f1-sim-fl-toggle:hover { background: #faf0ff; }
.f1-sim-fl-toggle--restore {
    border-color: #aaa;
    color: #555;
}
.f1-sim-fl-toggle--restore:hover { background: #f5f5f5; }

/* FL pastille dans les barres du classement */
.f1-sim-fl-suppressed-bar {
    background: #fdf4ff;
    border-color: #d8b4fe;
}
.f1-sim-fl-suppressed-bar .f1-sim-mask-pill { border-color: #c084fc; }
.f1-sim-fl-pill { font-size: 11px; }

.f1-sim-race-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--f1-dark);
}

.f1-sim-race-date {
    font-size: 11px;
    color: var(--f1-muted);
}

.f1-sim-cancelled-lbl {
    display: inline-block;
    padding: 1px 7px;
    background: var(--f1-red);
    color: var(--f1-white);
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ── Chips pilotes ────────────────────────────────────────────────────────── */

.f1-sim-race-drivers {
    display: flex;
    flex-wrap: nowrap;   /* 1 seule ligne sur desktop */
    gap: 5px;
    align-items: center;
    overflow: hidden;    /* sécurité, les pilotes dans les points tiennent toujours */
}

/* Section hors des points (dépliée par le bouton ···) */
.f1-sim-out-section {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

/* Bouton expand "···" / "▲" */
.f1-sim-chip-more {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    background: none;
    border: 1px dashed var(--f1-border);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--f1-muted);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color .15s, color .15s;
    line-height: 1;
}
.f1-sim-chip-more:hover {
    border-color: #999;
    color: var(--f1-dark);
}

/* Chips hors des points */
.f1-sim-chip--out {
    opacity: 0.5;
    transition: opacity .15s;
}
.f1-sim-chip--out:hover {
    opacity: 1;
}

.f1-sim-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: var(--f1-bg);
    border: 1px solid var(--f1-border);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--f1-mid);
    white-space: nowrap;
}

.f1-sim-chip--drag {
    cursor: grab;
    transition: background .15s, border-color .15s, box-shadow .15s;
    /* iOS : empêche la sélection de texte et le menu contextuel pendant le touch drag */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none; /* indique au navigateur qu'on gère le touch manuellement */
}
.f1-sim-chip--drag:hover {
    background: #e8e8e8;
    border-color: #aaa;
}
.f1-sim-chip--drag:active {
    cursor: grabbing;
}

.f1-sim-chip-pos {
    font-size: 10px;
    font-weight: 800;
    color: var(--f1-red);
    min-width: 12px;
}

.f1-sim-chip--gained {
    border-color: #2a9d2a;
    border-width: 2px;
}
.f1-sim-chip--lost {
    border-color: #c0392b;
    border-width: 2px;
}
.f1-sim-chip-pos--gained {
    color: #2a9d2a;
}
.f1-sim-chip-pos--lost {
    color: #c0392b;
}
.f1-sim-chip-orig {
    font-size: 9px;
    color: #888;
    font-weight: 400;
    margin-left: 1px;
}

/* ── Drag-and-drop ───────────────────────────────────────────────────────── */

.f1-sim-dragging {
    opacity: .4;
    cursor: grabbing !important;
}

.f1-sim-drag-over {
    background: #fff0f0 !important;
    border-color: var(--f1-red) !important;
    box-shadow: 0 0 0 2px rgba(225,6,0,.18) !important;
}

/* ── Sprint ──────────────────────────────────────────────────────────────── */

.f1-sim-sprint-section {
    margin-top: 6px;
    border-top: 1px dashed var(--f1-border);
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f1-sim-sprint-section--cancelled .f1-sim-sprint-drivers,
.f1-sim-sprint-section--cancelled .f1-sim-out-section--sprint {
    opacity: 0.35;
    pointer-events: none;
}

.f1-sim-sprint-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.f1-sim-race-actions--sm .f1-sim-race-act {
    padding: 1px 5px;
    font-size: 10px;
}

.f1-sim-sprint-label {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 800;
    color: #c66a00;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #fff3e0;
    border: 1px solid #f5a623;
    border-radius: 8px;
    padding: 1px 6px;
    width: fit-content;
}

.f1-sim-sprint-drivers {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: center;
    overflow: hidden;
}

.f1-sim-chip--sprint {
    background: #fff8f0;
    border-color: #f5c070;
}

.f1-sim-chip-pos--sprint {
    color: #d48a10;
}

/* Sprint : gained/lost overrides the orange sprint default (higher specificity) */
.f1-sim-chip--sprint.f1-sim-chip--gained { border-color: #2a9d2a; }
.f1-sim-chip--sprint.f1-sim-chip--lost   { border-color: #c0392b; }
.f1-sim-chip-pos--sprint.f1-sim-chip-pos--gained { color: #2a9d2a; }
.f1-sim-chip-pos--sprint.f1-sim-chip-pos--lost   { color: #c0392b; }

/* FL star dans chip GP */
.f1-sim-chip-fl {
    font-size: 8px;
    color: #9b59b6;
    margin-left: 1px;
    line-height: 1;
}

/* ── Impact sur le palmarès ──────────────────────────────────────────────── */

.f1-sim-impact-note {
    font-size: 13px;
    color: var(--f1-mid);
    margin: 0 0 12px;
}

.f1-sim-ct-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--f1-border);
}

.f1-sim-ct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.f1-sim-ct-table thead th {
    background: var(--f1-bg);
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--f1-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: left;
    border-bottom: 1px solid var(--f1-border);
}
.f1-sim-ct-table tbody tr {
    border-bottom: 1px solid var(--f1-border);
    transition: background .12s;
}
.f1-sim-ct-table tbody tr:last-child {
    border-bottom: none;
}
.f1-sim-ct-table tbody tr:hover {
    background: var(--f1-bg);
}
.f1-sim-ct-table td {
    padding: 8px 12px;
    vertical-align: middle;
}

.f1-sim-ct-pos  { width: 36px; font-weight: 800; color: var(--f1-muted); }
.f1-sim-ct-name { font-weight: 700; }
.f1-sim-ct-t    { width: 80px; font-weight: 800; color: var(--f1-dark); white-space: nowrap; }
.f1-sim-ct-yrs  { font-size: 11px; color: var(--f1-muted); }

/* Ligne impactée */
.f1-sim-row-impact {
    background: #fff8e1 !important;
}
.f1-sim-row-impact:hover {
    background: #fff3cd !important;
}

/* Deltas */
.f1-sim-dt {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 4px;
}
.f1-sim-dt--up {
    background: #e6f9ed;
    color: #1a7a3a;
}
.f1-sim-dt--dn {
    background: #ffeaea;
    color: #c0001c;
}

/* ── Logos constructeurs ─────────────────────────────────────────────────── */

.f1-sim-co-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--f1-border);
    margin-bottom: 8px;
    background: var(--f1-white);
    padding: 4px;
}
.f1-sim-rank-1 .f1-sim-co-logo {
    width: 88px;
    height: 88px;
}
.f1-sim-co-logo--sm {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--f1-border);
    background: var(--f1-white);
    padding: 2px;
    flex-shrink: 0;
}

/* ── Symbole ™ ───────────────────────────────────────────────────────────── */

.f1-sim-tm {
    font-size: 0.65em;
    vertical-align: super;
    font-weight: 400;
    color: var(--f1-muted);
    margin-left: 2px;
    letter-spacing: 0;
}

/* ── Règlement indisponible pour CC ─────────────────────────────────────── */

.f1-sim-era-unavail {
    padding: 16px 20px;
    background: var(--f1-bg);
    border: 1px solid var(--f1-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--f1-muted);
    font-style: italic;
    margin-top: 12px;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 680px) {
    /* Courses : wrap autorisé sur mobile (les points tiennent en 1-2 lignes) */
    .f1-sim-race-drivers {
        flex-wrap: wrap;
        overflow: visible;
    }

    .f1-sim-sprint-drivers {
        flex-wrap: wrap;
        overflow: visible;
    }

    .f1-sim-podium {
        gap: 5px;
    }

    .f1-sim-pod-card {
        width: 28vw;
        min-width: 80px;
        padding: 10px 6px 10px;
    }

    .f1-sim-rank-1 {
        width: 34vw;
        min-width: 96px;
    }

    .f1-sim-photo {
        width: 52px;
        height: 52px;
    }

    .f1-sim-rank-1 .f1-sim-photo {
        width: 64px;
        height: 64px;
    }

    .f1-sim-pod-rank { font-size: 18px; }
    .f1-sim-rank-1 .f1-sim-pod-rank { font-size: 22px; }

    .f1-sim-pod-name { font-size: 11px; }
    .f1-sim-rank-1 .f1-sim-pod-name { font-size: 13px; }

    .f1-sim-pod-pts { font-size: 12px; }
    .f1-sim-rank-1 .f1-sim-pod-pts { font-size: 14px; }

    .f1-sim-pod-team { display: none; }

    .f1-sim-mode-bar {
        gap: 4px;
    }

    .f1-sim-mode-btn,
    .f1-sim-reset-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .f1-sim-entry-team {
        display: none;
    }

    .f1-sim-ct-yrs {
        display: none;
    }
}

@media (max-width: 420px) {
    .f1-sim-top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .f1-sim-mode-btn {
        font-size: 11px;
        padding: 5px 8px;
    }
}

/* ── Cards cliquables (pilotes & constructeurs) ──────────────────────────── */

.f1-sim-clickable-card {
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
}
.f1-sim-pod-card.f1-sim-clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,.22);
}
.f1-sim-entry.f1-sim-clickable-card:hover {
    background: #f0f3ff;
}

/* ── Modale pilote/écurie (simulateur) ───────────────────────────────────── */

.f1-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity .2s;
}
.f1-modal-overlay.f1-modal-visible { opacity: 1; }

.f1-modal {
    background: #fff;
    border-radius: 10px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    transform: translateY(16px);
    transition: transform .2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.f1-modal-overlay.f1-modal-visible .f1-modal { transform: translateY(0); }

.f1-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.f1-modal-close:hover { background: #e10600; }

.f1-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 24px 28px;
    padding-top: 48px;
}

.f1-modal-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}
.f1-modal-header--co { min-height: 64px; }

.f1-modal-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 3px solid #e10600;
    flex-shrink: 0;
}
.f1-modal-photo[src$=".svg"] {
    background: #1a1a1a;
    padding: 8px;
    box-sizing: border-box;
}
.f1-modal-co-logo {
    border-radius: 10px;
    object-fit: contain;
    object-position: center;
    background: #fff;
    border-color: #e0e0e0;
    padding: 6px;
    box-sizing: border-box;
}

.f1-modal-title h2 {
    font-size: 1.35em;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 4px;
}
.f1-modal-subtitle {
    font-size: 12px;
    color: #888;
    margin: 0;
}
.f1-modal-bio {
    font-size: 12px;
    color: #666;
    margin: 5px 0 0;
    line-height: 1.4;
}
.f1-modal-teams {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0 0;
}
.f1-modal-team {
    display: inline-block;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: #1a1a1a;
}
.f1-modal-team small { font-weight: 400; color: #888; }
.f1-modal-wiki {
    display: inline-block;
    margin-top: 8px;
    font-size: 11.5px;
    color: #e10600;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px solid transparent;
}
.f1-modal-wiki:hover { border-bottom-color: #e10600; }

.f1-modal-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.f1-modal-stat-block {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 130px;
}
.f1-modal-stat-label {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}
.f1-modal-stat-val {
    font-size: 1.6em;
    font-weight: 900;
    color: #1a1a1a;
    line-height: 1.1;
}
.f1-modal-years {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #666;
    margin-top: 3px;
    line-height: 1.5;
}

.f1-modal-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: #1a1a1a;
    border-radius: 8px;
    color: #fff;
}
.f1-modal-stat-cell {
    flex: 1;
    min-width: 70px;
    text-align: center;
}
.f1-modal-stats-row .f1-modal-stat-label { color: #aaa; }
.f1-modal-stats-row .f1-modal-stat-val   { font-size: 1.1em; color: #fff; }
.f1-modal-stats-row .f1-modal-stat-val small { font-size: 11px; color: #ccc; font-weight: 400; }

.f1-modal-h3 {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 8px;
}
.f1-modal-table { font-size: 12.5px; }
.f1-modal-table thead th { font-size: 11px; padding: 7px 10px; }
.f1-modal-table tbody td { padding: 5px 10px; min-width: 60px; }

/* Position simulée dans la modale */
.f1-sim-modal-simpos {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0f3ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
}
.f1-sim-modal-simpos-label {
    font-size: 12px;
    font-weight: 700;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.f1-sim-modal-simpos-val {
    font-size: 14px;
    font-weight: 800;
    color: #1a1a1a;
}

/* Spinner de chargement */
.f1-sim-modal-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    font-size: 2em;
    animation: f1-spin 1s linear infinite;
    transform-origin: center;
}
@keyframes f1-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Utilitaires table modale ────────────────────────────────────────────── */

.f1-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.f1-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.f1-table thead th {
    background: #1a1a1a;
    color: #fff;
    padding: 9px 12px;
    text-align: left;
    font-weight: 700;
}
.f1-table tbody tr:nth-child(even) { background: #f9f9f9; }
.f1-table tbody tr:hover            { background: #eef3ff; }
.f1-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid #eee;
}

td.f1-year {
    font-weight: 800;
    color: #e10600;
    white-space: nowrap;
    min-width: 52px;
    font-size: 14px;
}
td.f1-stat-num {
    text-align: right;
    white-space: nowrap;
}

.f1-flag {
    display: inline-block;
    font-size: 1.15em;
    line-height: 1;
    cursor: default;
    vertical-align: middle;
}
