/* IniStats — explorateur visiteur.
 * Reprend les variables du thème Inisport (couleurs, polices, mode sombre) ;
 * les valeurs après la virgule servent si un autre thème est utilisé. */
.ins-x {
    --x-brand: var(--brand, #0A6CFF);
    --x-hot: var(--hot, #FF6A13);
    --x-ink: var(--ink, #0B1222);
    --x-bg: var(--bg, #F6F7FA);
    --x-surface: var(--surface, #FFFFFF);
    --x-surface-2: var(--surface-2, #F0F2F6);
    --x-text: var(--text, #0B1222);
    --x-muted: var(--muted, #5B6578);
    --x-border: var(--border, #E3E7EE);
    --x-accent: var(--accent, #0A5BD8);
    --x-accent-soft: var(--accent-soft, #E6EFFE);
    --x-radius: var(--radius, 16px);
    --x-radius-sm: var(--radius-sm, 10px);
    --x-display: var(--font-display, "Barlow Condensed", "Arial Narrow", sans-serif);
    --x-sans: var(--font-sans, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --x-win: #12A150;
    --x-draw: #8A94A6;
    --x-loss: #E5484D;
    font-family: var(--x-sans);
    color: var(--x-text);
    margin: 0 0 32px;
    display: grid;
    gap: 16px;
}
.ins-x *, .ins-x *::before, .ins-x *::after { box-sizing: border-box; }
.ins-x button { font: inherit; color: inherit; }

/* Version serveur (sans JavaScript) */
.ins-x-static { background: var(--x-surface); border: 1px solid var(--x-border); border-radius: var(--x-radius); padding: 20px; }
.ins-x-plain { width: 100%; border-collapse: collapse; padding-left: 18px; }
.ins-x-plain th, .ins-x-plain td { padding: 6px 8px; border-bottom: 1px solid var(--x-border); text-align: left; }

/* ---------- Sélecteur ---------- */
.ins-x-picker {
    background: var(--x-surface);
    border: 1px solid var(--x-border);
    border-radius: var(--x-radius);
    padding: 6px 20px;
}
.ins-x-step { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 16px; padding: 12px 0; }
.ins-x-step + .ins-x-step { border-top: 1px solid var(--x-border); }
.ins-x-step-label { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--x-muted); }
.ins-x-step-label b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--x-surface-2); color: var(--x-text); font-size: 12px; letter-spacing: 0; }
.ins-x-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.ins-x-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 38px; padding: 0 15px;
    border: 1px solid var(--x-border); border-radius: 999px;
    background: var(--x-surface); cursor: pointer;
    font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}
.ins-x-chip:hover { border-color: var(--x-accent); color: var(--x-accent); }
.ins-x-chip:focus-visible, .ins-x-tab:focus-visible, .ins-x-round:focus-visible, .ins-x-arrow:focus-visible, .ins-x-btn:focus-visible, .ins-x-select:focus-visible {
    outline: 2px solid var(--x-brand); outline-offset: 2px;
}
.ins-x-chip.is-active { background: var(--x-text); border-color: var(--x-text); color: var(--x-surface); }
.ins-x-chip.is-muted:not(.is-active) { color: var(--x-muted); border-style: dashed; }
.ins-x-hint { margin: 0; color: var(--x-muted); font-size: 14px; }

/* ---------- Tableau principal ---------- */
.ins-x-board {
    background: var(--x-surface);
    border: 1px solid var(--x-border);
    border-radius: var(--x-radius);
    overflow: hidden;
    transition: opacity .15s;
}
.ins-x.is-loading .ins-x-body { opacity: .55; pointer-events: none; }
.ins-x-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px 16px; }
.ins-x-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--x-hot); }
.ins-x-title { margin: 0; font-family: var(--x-display); font-weight: 800; font-size: clamp(26px, 3.4vw, 36px); line-height: 1; letter-spacing: .005em; text-transform: none; color: var(--x-text); }
.ins-x-season { display: flex; align-items: center; gap: 8px; }
.ins-x-season-label { font-size: 13px; color: var(--x-muted); font-weight: 600; }
.ins-x-season-tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--x-surface-2); font-size: 13px; font-weight: 600; }
.ins-x-select {
    min-height: 38px; padding: 0 34px 0 12px;
    border: 1px solid var(--x-border); border-radius: var(--x-radius-sm);
    background: var(--x-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238A94A6' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--x-text); font: inherit; font-size: 14px; font-weight: 600;
    -webkit-appearance: none; appearance: none; cursor: pointer;
}

.ins-x-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--x-border); }
.ins-x-tab {
    position: relative; padding: 12px 6px; margin-right: 18px;
    border: 0; background: none; cursor: pointer;
    font-family: var(--x-display); font-size: 19px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
    color: var(--x-muted);
}
.ins-x-tab:hover { color: var(--x-text); }
.ins-x-tab[aria-selected="true"] { color: var(--x-text); }
.ins-x-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--x-brand); }
.ins-x-board.is-empty .ins-x-tabs { display: none; }

.ins-x-body { padding: 18px 24px 24px; min-height: 160px; transition: opacity .15s; }

/* Journées */
.ins-x-rounds { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.ins-x-strip { display: flex; gap: 6px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 2px; }
.ins-x-strip::-webkit-scrollbar { display: none; }
.ins-x-round {
    flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-width: 50px; height: 50px; padding: 0 8px;
    border: 1px solid var(--x-border); border-radius: var(--x-radius-sm);
    background: var(--x-surface); cursor: pointer;
}
.ins-x-round-n { font-family: var(--x-display); font-weight: 700; font-size: 17px; line-height: 1; }
.ins-x-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--x-border); }
.ins-x-round.is-done .ins-x-dot { background: var(--x-win); }
.ins-x-round.is-part .ins-x-dot { background: var(--x-hot); }
.ins-x-round.is-todo .ins-x-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--x-muted); }
.ins-x-round:hover { border-color: var(--x-accent); }
.ins-x-round.is-active { background: var(--x-brand); border-color: var(--x-brand); color: #fff; }
.ins-x-round.is-active .ins-x-dot { background: #fff; box-shadow: none; }
.ins-x-arrow {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--x-border); background: var(--x-surface); cursor: pointer;
    font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.ins-x-arrow:hover:not(:disabled) { border-color: var(--x-accent); color: var(--x-accent); }
.ins-x-arrow:disabled { opacity: .35; cursor: default; }

.ins-x-roundhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 6px; }
.ins-x-roundtitle { margin: 0; font-family: var(--x-display); font-size: 24px; font-weight: 800; line-height: 1.1; }
.ins-x-roundmeta { font-size: 13px; color: var(--x-muted); font-weight: 600; }

/* Matchs */
.ins-x-games { display: grid; }
.ins-x-day { margin: 16px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--x-muted); }
.ins-x-game {
    display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr) 76px;
    align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--x-radius-sm);
    background: var(--x-surface-2);
}
.ins-x-game + .ins-x-game { margin-top: 6px; }
.ins-x-team { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.ins-x-team.is-home { justify-content: flex-end; text-align: right; }
.ins-x-team.is-win { font-weight: 800; }
.ins-x-team.is-loss .ins-x-name { color: var(--x-muted); }
.ins-x-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-x-logo { flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: contain; background: #fff; }
.ins-x-logo.is-ph { display: inline-grid; place-items: center; background: var(--x-surface); border: 1px solid var(--x-border); color: var(--x-muted); font-size: 11px; font-weight: 800; }
.ins-x-score { display: flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--x-display); font-weight: 800; font-size: 26px; line-height: 1; }
.ins-x-score span { min-width: 34px; padding: 5px 0 3px; border-radius: 8px; background: var(--x-ink); color: #fff; text-align: center; }
.ins-x-score i { font-style: normal; color: var(--x-muted); font-size: 18px; }
[data-theme="dark"] .ins-x-score span, .dark-skin .ins-x-score span { background: var(--x-brand); }
.ins-x-time { justify-self: center; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--x-border); background: var(--x-surface); font-family: var(--x-display); font-weight: 700; font-size: 19px; line-height: 1; }
.ins-x-time.is-postponed { font-family: var(--x-sans); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--x-hot); border-color: currentColor; }
.ins-x-status { justify-self: end; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--x-muted); }
.ins-x-game.is-s1 .ins-x-status { color: var(--x-win); }
.ins-x-game.is-s2 .ins-x-status { color: var(--x-hot); }

/* Classement */
.ins-x-tablewrap { overflow-x: auto; margin: 0 -8px; }
.ins-x-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.ins-x-table th { padding: 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--x-muted); text-align: center; border-bottom: 1px solid var(--x-border); }
.ins-x-table th abbr { text-decoration: none; cursor: help; }
.ins-x-table td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--x-border); }
.ins-x-table tbody tr:last-child td { border-bottom: 0; }
.ins-x-table tbody tr:hover td { background: var(--x-surface-2); }
.ins-x-table .c-team { text-align: left; width: 40%; }
.ins-x-table .c-rank { width: 44px; }
.ins-x-table .c-pts strong { font-family: var(--x-display); font-size: 20px; font-weight: 800; }
.ins-x-table th.c-pts { color: var(--x-text); }
.ins-x-table .is-pos { color: var(--x-win); font-weight: 600; }
.ins-x-table .is-neg { color: var(--x-loss); font-weight: 600; }
.ins-x-rank { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--x-surface-2); font-weight: 700; font-size: 13px; }
.ins-x-table tr.is-top .ins-x-rank { background: var(--x-brand); color: #fff; }
.ins-x-teamcell { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.ins-x-teamcell .ins-x-logo { width: 28px; height: 28px; }
.ins-x-form { display: inline-flex; gap: 3px; }
.ins-x-form i, .ins-x-legend-form i {
    display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px;
    font-style: normal; font-size: 10px; font-weight: 800; color: #fff;
}
.f-v { background: var(--x-win); }
.f-n { background: var(--x-draw); }
.f-d { background: var(--x-loss); }
.ins-x-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: 16px 0 0; font-size: 12px; color: var(--x-muted); }
.ins-x-legend-form { display: inline-flex; align-items: center; gap: 4px; }
.ins-x-legend-form i { width: 16px; height: 16px; font-size: 9px; }
.ins-x-notice { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--x-radius-sm); background: var(--x-accent-soft); color: var(--x-text); font-size: 14px; }

/* États vides, erreurs, chargement */
.ins-x-empty { display: grid; justify-items: center; gap: 4px; padding: 36px 16px; text-align: center; }
.ins-x-empty-ico { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 50%; background: var(--x-surface-2); color: var(--x-muted); font-size: 22px; font-weight: 700; }
.ins-x-empty.is-error .ins-x-empty-ico { background: rgba(229, 72, 77, .12); color: var(--x-loss); }
.ins-x-empty-title { margin: 0; font-weight: 700; font-size: 16px; }
.ins-x-empty-text { margin: 0; max-width: 46ch; color: var(--x-muted); font-size: 14px; }
.ins-x-btn { margin-top: 12px; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--x-brand); color: #fff !important; font-weight: 700; cursor: pointer; }
.ins-x-skel { display: grid; gap: 8px; }
.ins-x-skel-row { height: 56px; border-radius: var(--x-radius-sm); background: linear-gradient(90deg, var(--x-surface-2) 0%, var(--x-border) 50%, var(--x-surface-2) 100%); background-size: 200% 100%; animation: ins-x-shine 1.1s linear infinite; }
@keyframes ins-x-shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ins-x-skel-row { animation: none; } .ins-x-strip { scroll-behavior: auto; } }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
    .ins-x-table .c-md, .ins-x-table .c-form { display: none; }
}
@media (max-width: 720px) {
    .ins-x-picker { padding: 4px 14px; }
    .ins-x-step { grid-template-columns: 1fr; gap: 8px; padding: 12px 0; }
    .ins-x-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; }
    .ins-x-chips::-webkit-scrollbar { display: none; }
    .ins-x-head { padding: 18px 16px 12px; }
    .ins-x-tabs { padding: 0 16px; }
    .ins-x-body { padding: 14px 16px 18px; }
    .ins-x-arrow { display: none; }
    .ins-x-rounds { grid-template-columns: minmax(0, 1fr); }
    .ins-x-game { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 10px; }
    .ins-x-status { display: none; }
    .ins-x-team { flex-direction: column; gap: 6px; text-align: center; font-size: 13px; }
    .ins-x-team.is-home { flex-direction: column-reverse; justify-content: center; text-align: center; }
    .ins-x-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .ins-x-score { font-size: 22px; }
    .ins-x-score span { min-width: 30px; }
    .ins-x-table .c-sm { display: none; }
    .ins-x-table { font-size: 13px; }
    .ins-x-table .c-team { width: auto; }
}