/* ==========================================================================
   RC Trignac — feuille de style unique (remplace Materialize)
   1. Variables   2. Base   3. Layout   4. Navigation   5. Composants
   6. Pages
   ========================================================================== */

/* ── 1. VARIABLES ─────────────────────────────────────────────────────────── */
:root {
    color-scheme: light dark;
    --c-brand: #c62828;
    --c-brand-strong: #8e1515;
    --c-gold: #f9a825;
    --c-gold-ink: #e65100;

    --c-bg: #f4f4f5;
    --c-surface: #ffffff;
    --c-surface-2: #fafafa;
    --c-surface-hover: #fff3f3;
    --c-border: #e7e7e9;
    --c-ink: #1a1a1a;
    --c-text: #26262a;
    --c-muted: #71717a;
    --c-on-brand: #ffffff;

    --c-win: #2e7d32;
    --c-win-bg: #e8f5e9;
    --c-loss: #c62828;
    --c-loss-bg: #ffebee;
    --c-draw: #ef6c00;
    --c-draw-bg: #fff3e0;
    --c-team-b: #1565c0;
    --c-highlight: #fff8e1;

    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow: 0 2px 12px rgba(0, 0, 0, .07);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);

    --topbar-h: 60px;
    --tabbar-h: 64px;

    /* Anciens noms, encore utilisés par quelques templates */
    --rct-red: var(--c-brand);
    --rct-red2: var(--c-brand-strong);
    --rct-gold: var(--c-gold);
    --rct-black: var(--c-ink);
    --rct-card: var(--c-surface);
    --rct-text: var(--c-text);
    --rct-muted: var(--c-muted);
    --win-color: var(--c-win);
    --loss-color: var(--c-loss);
    --draw-color: var(--c-draw);
}

@media (prefers-color-scheme: dark) {
    /* .theme-light : pages admin (TomSelect et styles maison restent en clair) */
    :root:not(.theme-light) {
        --c-brand: #e53935;
        --c-brand-strong: #7f1010;
        --c-gold-ink: #ffb74d;
        --c-bg: #0f0f11;
        --c-surface: #1a1a1d;
        --c-surface-2: #222226;
        --c-surface-hover: #2a1c1c;
        --c-border: #2e2e33;
        --c-ink: #f4f4f5;
        --c-text: #e4e4e7;
        --c-muted: #a1a1aa;
        --c-win: #66bb6a;
        --c-win-bg: rgba(102, 187, 106, .14);
        --c-loss: #ef5350;
        --c-loss-bg: rgba(239, 83, 80, .14);
        --c-draw: #ffa726;
        --c-draw-bg: rgba(255, 167, 38, .14);
        --c-team-b: #64b5f6;
        --c-highlight: rgba(249, 168, 37, .12);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
        --shadow: 0 2px 12px rgba(0, 0, 0, .35);
        --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    }
}


:root.theme-light { color-scheme: light; }

/* ── 2. BASE ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); color: var(--c-ink); line-height: 1.15; margin: 0 0 var(--space-3); }
p { margin: 0 0 var(--space-3); }
a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.material-icons { font-size: 1.25em; line-height: 1; vertical-align: middle; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--c-muted); }
.small { font-size: .85rem; }
.mt-4 { margin-top: var(--space-4); }
.nowrap { white-space: nowrap; }
.text-win { color: var(--c-win); }
.text-loss { color: var(--c-loss); }
.text-draw { color: var(--c-draw); }
.strong { font-weight: 700; }

/* ── 3. LAYOUT ────────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-4); }
.container--narrow { max-width: 760px; }
.section { margin-bottom: var(--space-5); }
.lift { margin-top: -32px; position: relative; z-index: 2; }

.grid { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-5); }
.grid > .card-section { margin-bottom: 0; }
@media (min-width: 720px) {
    .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .grid--1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}
.stats { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: var(--space-5); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ── 4. NAVIGATION ────────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-h);
    background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-strong) 100%);
    color: var(--c-on-brand);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
    padding-top: env(safe-area-inset-top);
    box-sizing: content-box;
}
.topbar .container { height: 100%; display: flex; align-items: center; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 1.45rem; letter-spacing: .5px; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.topbar-links { display: none; margin-left: auto; gap: 2px; list-style: none; }
.topbar-links a, .topbar-icon {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .88); font-size: .9rem; font-weight: 500;
    transition: background .15s, color .15s;
}
.topbar-links a:hover, .topbar-icon:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar-links a[aria-current="page"] { background: rgba(0, 0, 0, .2); color: var(--c-gold); }
.topbar-icon { margin-left: auto; padding: 8px; }
@media (min-width: 900px) and (max-width: 1179px) {
    .topbar-label { display: none; }
}
@media (min-width: 900px) {
    .topbar-links { display: flex; }
    .topbar-icon { display: none; }
}

/* Barre d'onglets mobile (style appli native, utile surtout en PWA) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    display: flex;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .08);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--c-muted); font-size: .7rem; font-weight: 600;
}
.tabbar a .material-icons { font-size: 1.5rem; padding: 2px 16px; border-radius: var(--radius-pill); transition: background .15s; }
.tabbar a[aria-current="page"] { color: var(--c-brand); }
.tabbar a[aria-current="page"] .material-icons { background: var(--c-loss-bg); }
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
    .tabbar { display: none; }
    body.has-tabbar { padding-bottom: 0; }
}

.footer { text-align: center; padding: var(--space-5) var(--space-4); font-size: .82rem; color: var(--c-muted); }
.footer strong { color: var(--c-brand); }

/* ── 5. COMPOSANTS ────────────────────────────────────────────────────────── */

/* Hero */
.hero-section {
    position: relative; overflow: hidden;
    background: linear-gradient(160deg, var(--c-brand) 0%, var(--c-brand-strong) 100%);
    color: #fff;
    padding: var(--space-6) 0 var(--space-7);
}
.hero-section::before {
    content: '🦆'; position: absolute; right: -30px; top: -30px;
    font-size: 200px; opacity: .18; transform: rotate(-20deg); pointer-events: none;
}
.hero-section h1 { color: #fff; font-weight: 900; font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 var(--space-2); }
.hero-section p { opacity: .85; margin: 0; font-size: 1rem; }
.hero-section .container { position: relative; z-index: 1; }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); opacity: .9; }
.breadcrumb-link { font-size: .9rem; margin-bottom: var(--space-2) !important; }
.breadcrumb-link a { color: rgba(255, 255, 255, .8); }
.breadcrumb-link a:hover { color: #fff; }
.hero-actions { margin-top: var(--space-4); display: flex; gap: 10px; flex-wrap: wrap; }
.hero-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border-radius: var(--radius-pill); background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .35);
    color: #fff; font-weight: 600; font-size: .9rem; transition: background .15s;
}
.hero-btn:hover { background: rgba(255, 255, 255, .25); }

/* Cartes */
.card-section {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: var(--space-5);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-5);
    min-width: 0;
}
.card-section--compact { padding: var(--space-3) var(--space-4); }
.card-section--accent { border-left: 4px solid var(--c-gold); }
.card-section h5, .card-title {
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
    margin: 0 0 var(--space-4); color: var(--c-ink);
}
.card-section h5 a { color: inherit; }
.card-section h5 .h5-sub { font-family: var(--font-body); font-size: .8rem; font-weight: 500; color: var(--c-muted); margin-left: auto; }
.empty-state { text-align: center; color: var(--c-muted); padding: var(--space-6) var(--space-4); }
.empty-state .material-icons { display: block; font-size: 2.6rem; margin: 0 auto var(--space-2); opacity: .6; }

/* Chiffres clés */
.stat-card {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-3);
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--c-ink);
    height: 100%;
    transition: transform .2s, box-shadow .2s;
}
a.stat-card { display: block; color: inherit; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-value { font-family: var(--font-display); font-size: 2.4rem; font-weight: 900; color: var(--c-ink); line-height: 1; }
.stat-card .stat-value small { font-size: 1.2rem; }
.stat-card .stat-value--text { font-size: 1.3rem; line-height: 1.2; }
.stat-card .stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--c-muted); margin-top: 6px; }
.stat-card.gold { border-top-color: var(--c-gold); }
.stat-card.gold .stat-value { color: var(--c-gold-ink); }
.stat-card.win { border-top-color: var(--c-win); }
.stat-card.win .stat-value { color: var(--c-win); }
.stat-card.loss { border-top-color: var(--c-loss); }
.stat-card.loss .stat-value { color: var(--c-loss); }

/* Badges & pastilles */
.badge-result {
    display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill);
    font-family: var(--font-display); font-size: .82rem; font-weight: 700; letter-spacing: .4px; white-space: nowrap;
}
.badge-V, .badge-VBO, .badge-success { background: var(--c-win-bg); color: var(--c-win); }
.badge-D, .badge-DBD, .badge-danger { background: var(--c-loss-bg); color: var(--c-loss); }
.badge-N, .badge-warning { background: var(--c-draw-bg); color: var(--c-draw); }
.captain-star { color: var(--c-gold); }
.jersey-dot {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--c-ink); color: var(--c-surface); font-size: .72rem; font-weight: 700;
}
.jersey-dot--sub { background: var(--c-muted); }
.team-group { font-weight: 700; color: var(--c-brand); }
.team-group--B { color: var(--c-team-b); }
.team-logo { width: var(--logo-size, 24px); height: var(--logo-size, 24px); object-fit: contain; border-radius: 3px; vertical-align: middle; margin-right: 6px; flex: none; }
.team-logo--placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-border); color: var(--c-muted);
    font-family: var(--font-display); font-weight: 700; font-size: calc(var(--logo-size, 24px) * .45);
}
.team-name { display: inline-flex; align-items: center; min-width: 0; }

/* Chips (saisons, filtres) */
.chip-scroller { display: flex; gap: var(--space-2); overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px var(--space-2); margin: 0 -2px; scrollbar-width: thin; }
.chip-scroller > * { scroll-snap-align: start; flex: none; }
@media (min-width: 900px) { .chip-scroller--wrap { flex-wrap: wrap; overflow: visible; } }
.season-chip {
    display: inline-flex; flex-direction: column; align-items: flex-start;
    background: var(--c-surface); border: 2px solid var(--c-border); border-radius: var(--radius);
    padding: 8px 14px; color: var(--c-text);
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2;
    transition: border-color .15s, background .15s, transform .15s;
}
.season-chip small { font-family: var(--font-body); font-weight: 500; font-size: .72rem; color: var(--c-muted); }
.season-chip:hover { border-color: var(--c-brand); transform: translateY(-1px); }
.season-chip.active, .season-chip[aria-current="page"] { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-surface); }
.season-chip.active small, .season-chip[aria-current="page"] small { color: inherit; opacity: .7; }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
    border: 2px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
    font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, opacity .15s;
}
.btn:hover { border-color: var(--c-brand); }
.btn--primary { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.btn--primary:hover { opacity: .92; }
.btn--success { background: var(--c-win); border-color: var(--c-win); color: #fff; }
.btn--block { width: 100%; height: 50px; font-family: var(--font-display); font-size: 1.15rem; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--c-muted); }
.btn--small { height: 32px; padding: 0 12px; font-size: .85rem; border-width: 1px; border-radius: var(--radius-pill); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-4); }
.field label, .field-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); }
.input, .select {
    height: 44px; padding: 0 12px; width: 100%;
    border: 2px solid var(--c-border); border-radius: var(--radius-sm);
    background: var(--c-surface); color: var(--c-text);
}
.input:focus, .select:focus { outline: none; border-color: var(--c-brand); }
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4); display: flex; gap: var(--space-2); align-items: center; }
.alert--error { background: var(--c-loss-bg); color: var(--c-loss); }
.alert--success { background: var(--c-win-bg); color: var(--c-win); }
.segmented { display: inline-flex; border: 2px solid var(--c-border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented a { padding: 8px 18px; font-weight: 700; color: var(--c-text); }
.segmented a.active { background: var(--c-ink); color: var(--c-surface); }

/* Onglets (graphiques) */
.tabs { display: flex; gap: var(--space-1); overflow-x: auto; border-bottom: 1px solid var(--c-border); margin: calc(var(--space-2) * -1) 0 var(--space-4); scrollbar-width: none; }
.tabs button {
    flex: none; border: none; background: none; cursor: pointer;
    padding: var(--space-3) var(--space-3); color: var(--c-muted); font-weight: 600; font-size: .9rem;
    border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--c-brand); border-bottom-color: var(--c-brand); }
.tab-panel[hidden] { display: none; }
.tab-panel > .grid { margin-bottom: 0; }

/* Filtre de saisons */
.season-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.season-filter > .material-icons { color: var(--c-brand); }
.season-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; }
.season-filter select {
    height: 36px; border: 2px solid var(--c-border); border-radius: var(--radius-sm); padding: 0 8px;
    background: var(--c-surface); font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.season-filter__reset { display: inline-flex; align-items: center; gap: 2px; font-size: .85rem; color: var(--c-muted); }

/* Recherche */
.search-field { display: flex; align-items: center; gap: 8px; border: 2px solid var(--c-border); border-radius: var(--radius-sm); padding: 0 12px; margin-bottom: var(--space-4); background: var(--c-surface); }
.search-field:focus-within { border-color: var(--c-brand); }
.search-field .material-icons { color: var(--c-muted); }
.search-field input { flex: 1; border: none; outline: none; height: 42px; background: transparent; }

/* Tableaux */
.responsive-table { overflow-x: auto; }
.match-table th {
    background: var(--c-brand); color: #fff;
    font-family: var(--font-display); font-size: .85rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    padding: 10px 12px; text-align: left; white-space: nowrap;
}
.match-table th:first-child { border-top-left-radius: var(--radius-sm); }
.match-table th:last-child { border-top-right-radius: var(--radius-sm); }
.match-table td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); font-size: .9rem; vertical-align: middle; }
.match-table tr:last-child td { border-bottom: none; }
.match-table tbody tr:hover td { background: var(--c-surface-hover); }
.match-table .num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-link { cursor: pointer; }
.sortable th[data-col] { cursor: pointer; user-select: none; }
.sortable th[data-col]:hover { background: var(--c-brand-strong); }
.sort-icon { font-size: .75rem; opacity: .6; }
.sortable th.sort-asc .sort-icon::after { content: ' ▲'; }
.sortable th.sort-desc .sort-icon::after { content: ' ▼'; }
@media (max-width: 640px) {
    .match-table--responsive thead { display: none; }
    .match-table--responsive tr { display: block; border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: var(--space-3); padding: 4px 0; }
    .match-table--responsive td { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 8px 14px; border-bottom: 1px solid var(--c-border); }
    .match-table--responsive td::before { content: attr(data-label); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); flex-shrink: 0; }
    .match-table--responsive tbody tr:hover td { background: transparent; }
}

/* Cartes de match (listes) */
.match-list { display: flex; flex-direction: column; gap: var(--space-2); }
.match-card {
    position: relative; display: grid; align-items: center; gap: 2px var(--space-3);
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo title score" "logo meta result";
    padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 2px);
    background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius);
    color: var(--c-text); overflow: hidden;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.match-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c-border); }
.match-card--win::before { background: var(--c-win); }
.match-card--loss::before { background: var(--c-loss); }
.match-card--draw::before { background: var(--c-draw); }
a.match-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: transparent; }
.match-card__logo { grid-area: logo; }
.match-card__logo .team-logo { margin: 0; }
.match-card__title { grid-area: title; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-card__meta { grid-area: meta; font-size: .8rem; color: var(--c-muted); display: flex; flex-wrap: wrap; gap: 0 var(--space-3); }
.match-card__score { grid-area: score; text-align: right; font-family: var(--font-display); font-weight: 900; font-size: 1.35rem; color: var(--c-ink); white-space: nowrap; }
.match-card__result { grid-area: result; text-align: right; }
.match-card--missed { opacity: .75; }

/* Frise de résultats */
.form-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.form-strip a, .form-strip span {
    width: 22px; height: 22px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .65rem; font-weight: 800; color: #fff; background: var(--c-muted);
    transition: transform .1s;
}
.form-strip a:hover { transform: scale(1.25); }
.form-strip .is-win { background: var(--c-win); }
.form-strip .is-loss { background: var(--c-loss); }
.form-strip .is-draw { background: var(--c-draw); }
.form-strip .is-missed { background: transparent; border: 2px dashed var(--c-border); color: var(--c-muted); }
.form-strip-season { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-3); align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--c-border); }
.form-strip-season:last-child { border-bottom: none; }
.form-strip-season > a { font-family: var(--font-display); font-weight: 700; color: var(--c-text); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: .78rem; color: var(--c-muted); margin-top: var(--space-3); }
.legend i.is-win { background: var(--c-win); }
.legend i.is-loss { background: var(--c-loss); }
.legend i.is-draw { background: var(--c-draw); }
.legend i.is-missed { border: 2px dashed var(--c-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }

/* Classements simples (top 5) */
.ranking { list-style: none; display: flex; flex-direction: column; gap: var(--space-1); }
.ranking li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "pos name value" "pos detail value"; align-items: center; column-gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--c-border); }
.ranking li:last-child { border-bottom: none; }
.ranking-pos { grid-area: pos; font-family: var(--font-display); font-weight: 900; font-size: 1.2rem; color: var(--c-muted); }
.ranking .team-name { grid-area: name; font-weight: 600; color: var(--c-text); }
.ranking-value { grid-area: value; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.ranking-detail { grid-area: detail; font-size: .78rem; color: var(--c-muted); }

/* Graphiques */
.chart-wrapper { position: relative; height: 280px; }
.chart-wrapper-sm { position: relative; height: 220px; }

/* Liens joueurs */
.player-link { color: inherit; font-weight: 500; border-bottom: 1px dotted var(--c-muted); }
.player-link:hover { color: var(--c-brand); border-bottom-color: var(--c-brand); }
.player-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-pill);
    padding: 3px 10px 3px 4px; font-size: .84rem; color: var(--c-text);
}
a.player-chip:hover { border-color: var(--c-brand); }

/* Avatars de coéquipiers */
.avatar { width: var(--avatar-size, 32px); height: var(--avatar-size, 32px); border-radius: 50%; object-fit: cover; flex: none; margin-right: 8px; vertical-align: middle; background: var(--c-surface-2); }
.avatar--initials { display: inline-flex; align-items: center; justify-content: center; background: var(--c-ink); color: var(--c-surface); font-family: var(--font-display); font-weight: 700; font-size: calc(var(--avatar-size, 32px) * .4); }
.hero-identity { display: flex; align-items: center; gap: var(--space-4); }
.hero-identity .avatar { margin: 0; border: 3px solid rgba(255, 255, 255, .8); box-shadow: var(--shadow-lg); }
.hero-identity .team-logo { margin: 0; background: #fff; padding: 4px; border-radius: var(--radius-sm); }
.hero-identity .avatar--initials { background: rgba(0, 0, 0, .25); color: #fff; }

/* Sélection de joueurs (duos) */
.pick-list { display: flex; flex-wrap: wrap; gap: var(--space-2); max-height: 320px; overflow-y: auto; padding: 2px; }
.pick { cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-flex; align-items: center; padding: 3px 12px 3px 3px; border-radius: var(--radius-pill); border: 2px solid var(--c-border); background: var(--c-surface); font-size: .88rem; font-weight: 500; transition: border-color .15s, background .15s; }
.pick span .avatar { margin-right: 6px; }
.pick:hover span { border-color: var(--c-brand); }
.pick input:checked + span { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.pick input:focus-visible + span { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.pick input:disabled + span { opacity: .4; cursor: not-allowed; }
.duo-list { list-style: none; display: flex; flex-direction: column; }
.duo-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av names value" "av detail value"; column-gap: var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--c-border); color: var(--c-text); }
.duo-list li:last-child .duo-row { border-bottom: none; }
.duo-avatars { grid-area: av; display: flex; }
.duo-avatars .avatar { margin: 0; border: 2px solid var(--c-surface); }
.duo-avatars .avatar + .avatar { margin-left: -10px; }
.duo-names { grid-area: names; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duo-value { grid-area: value; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--c-win); }
.duo-detail { grid-area: detail; font-size: .78rem; color: var(--c-muted); }
.duo-row:hover .duo-names { color: var(--c-brand); }

/* Terrain (XV type, compo de match) */
.pitch {
    background: repeating-linear-gradient(180deg, #2e7d32 0 56px, #2b7530 56px 112px);
    border-radius: var(--radius-lg); padding: 20px 8px;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, .25), var(--shadow);
}
.pitch-label { text-align: center; color: rgba(255, 255, 255, .6); font-family: var(--font-display); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: .75rem; margin: 4px 0 8px; }
.pitch-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pitch-divider { border: none; border-top: 1px dashed rgba(255, 255, 255, .25); margin: 14px 0; }
.pitch-slot {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    width: 124px; padding: 8px 6px;
    background: rgba(255, 255, 255, .95); border-radius: 10px;
    color: #212121; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    transition: transform .15s;
}
a.pitch-slot:hover { transform: translateY(-2px); }
.pitch-jersey { width: 28px; height: 28px; border-radius: 50%; background: #c62828; color: #fff; font-family: var(--font-display); font-weight: 900; display: flex; align-items: center; justify-content: center; }
.pitch-photo { position: relative; display: inline-flex; }
.pitch-photo .avatar { margin: 0; border: 2px solid #fff; }
.pitch-jersey--badge { position: absolute; right: -8px; bottom: -4px; width: 20px; height: 20px; font-size: .72rem; }
.pitch-name { font-weight: 600; font-size: .85rem; line-height: 1.15; }
.pitch-pos { font-size: .68rem; color: #757575; line-height: 1.1; }
.pitch-slot--me { background: var(--c-gold); }
.pitch-slot--me .pitch-jersey { background: #1a1a1a; }
.pitch-slot--me .pitch-pos { color: rgba(0, 0, 0, .6); }
.pitch-slot--empty { opacity: .6; }
.pitch-slot--sub .pitch-jersey { background: #424242; }
@media (max-width: 600px) {
    .pitch-row { gap: 5px; }
    .pitch-slot { width: 98px; padding: 6px 4px; }
    .pitch-name { font-size: .78rem; }
}

/* Souvenirs */
.memories-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.memory { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius); background: var(--c-surface-2); border: 1px solid var(--c-border); color: var(--c-text); transition: transform .15s, box-shadow .15s; }
.memory:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.memory-when { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--c-gold-ink); }
.memory-match { display: inline-flex; align-items: center; font-weight: 600; }
.memory-note { font-size: .82rem; font-style: italic; color: var(--c-muted); }
.memory-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.memory-line > .material-icons { color: var(--c-gold); }

/* Classement */
.standing-table th, .standing-table td { text-align: center; padding: 8px 10px; }
.standing-table th:nth-child(2), .standing-table td:nth-child(2) { text-align: left; }
.standing-rank { font-family: var(--font-display); font-weight: 900; font-size: 1.1rem; }
.standing-table tr.standing-us td { background: var(--c-highlight); font-weight: 700; }

/* Navigation saison précédente / suivante */
.season-nav { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-4); }
.season-nav a { display: inline-flex; align-items: center; color: rgba(255, 255, 255, .9); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .14); }
.season-nav a:hover { background: rgba(255, 255, 255, .26); color: #fff; }

/* Galerie photo + visionneuse */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); }
.gallery button { padding: 0; border: none; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; background: var(--c-surface-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery button:hover img { transform: scale(1.05); }
.gallery-item { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gallery-item button { width: 100%; }
.gallery-item figcaption { font-size: .75rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gallery-item figcaption a { color: var(--c-muted); }
.gallery-item figcaption a:hover { color: var(--c-brand); }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: var(--radius-sm); object-fit: contain; }
.lightbox-caption { color: rgba(255, 255, 255, .8); margin-top: 14px; text-align: center; padding: 0 16px; }
.lightbox-counter { color: rgba(255, 255, 255, .45); margin-top: 6px; font-size: .8rem; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .14); border: none; color: #fff; font-size: 2rem; line-height: 1; padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer; }
.lightbox .lb-close { top: calc(16px + env(safe-area-inset-top)); right: 16px; }
.lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* PWA : encart d'installation */
.pwa-card:not([hidden]) { display: flex; align-items: center; gap: 14px; border-left: 4px solid var(--c-brand); }
.pwa-icon { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.pwa-text { flex: 1; font-size: .9rem; line-height: 1.35; }
.pwa-text strong { display: block; }
.pwa-steps { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; }
.pwa-actions { display: flex; flex-direction: column; gap: 6px; }

/* Palmarès : records, séries, jalons */
.record-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.record-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon label" "icon value" "icon detail"; column-gap: var(--space-3); align-items: center; padding: var(--space-4); background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--c-text); transition: transform .15s, box-shadow .15s; }
a.record-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.record-icon { grid-area: icon; font-size: 2rem; line-height: 1; }
.record-label { grid-area: label; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--c-muted); }
.record-value { grid-area: value; font-family: var(--font-display); font-weight: 900; font-size: 1.8rem; color: var(--c-ink); line-height: 1.1; }
.record-detail { grid-area: detail; font-size: .8rem; color: var(--c-muted); }
.streak-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.streak-list li { display: flex; gap: var(--space-3); align-items: center; }
.streak-list small { display: block; }
.milestone-list { list-style: none; position: relative; display: flex; flex-direction: column; gap: var(--space-2); }
.milestone-list li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px dashed var(--c-border); }
.milestone-list li:last-child { border-bottom: none; }
.milestone-icon { width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--c-highlight); font-size: 1.2rem; }
.milestone-body { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--c-text); }
.milestone-body small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.milestone-banner { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); border-radius: var(--radius); background: linear-gradient(135deg, var(--c-gold), #ffca28); color: #1a1a1a; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; box-shadow: var(--shadow); }
.legend i.is-milestone, .form-strip a.is-milestone { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-gold); }

/* Carte */
.card-section--flush { padding: 0; overflow: hidden; }
.map { height: min(70vh, 560px); width: 100%; background: var(--c-surface-2); }
.map-legend { padding: var(--space-3) var(--space-4); margin: 0; }
.map-home img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.leaflet-popup-content { font-family: var(--font-body); }
code { font-size: .85em; background: var(--c-surface-2); padding: 1px 6px; border-radius: 4px; }

/* Wrapped de saison (écrans plein écran) */
.wrapped-page .topbar, .wrapped-page .tabbar, .wrapped-page .footer { display: none; }
.wrapped { position: fixed; inset: 0; z-index: 500; overflow: hidden; background: #0d0d0d; color: #fff; outline: none; user-select: none; }
.wrapped-progress { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 56px; z-index: 3; display: flex; gap: 4px; }
.wrapped-progress span { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.wrapped-progress i { display: block; height: 100%; width: 0; background: #fff; }
.wrapped-progress .is-done i { width: 100%; }
.wrapped-progress .is-current i { animation: wrapped-fill 6s linear forwards; }
@keyframes wrapped-fill { to { width: 100%; } }
.wrapped-close { position: absolute; top: calc(2px + env(safe-area-inset-top)); right: 12px; z-index: 3; color: #fff; font-size: 1.6rem; padding: 4px 10px; }
.wrapped-slide {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    padding: 56px 24px calc(32px + env(safe-area-inset-bottom));
    background: radial-gradient(ellipse at 30% 20%, #3a0d0d, #0d0d0d 70%);
    opacity: 0; visibility: hidden; transform: scale(1.04); transition: opacity .45s, transform .45s, visibility .45s;
}
.wrapped-slide.is-active { opacity: 1; visibility: visible; transform: none; }
.wrapped-slide--intro { background: linear-gradient(160deg, #c62828, #5e0b0b); }
.wrapped-slide--win { background: radial-gradient(ellipse at 50% 30%, #1b5e20, #0b1f0c 75%); }
.wrapped-slide--loss { background: radial-gradient(ellipse at 50% 30%, #6d1414, #1a0606 75%); }
.wrapped-slide--road { background: radial-gradient(ellipse at 50% 30%, #0d47a1, #06142e 75%); }
.wrapped-slide--gold { background: radial-gradient(ellipse at 50% 30%, #f9a825, #5d3b00 80%); }
.wrapped-slide--outro { justify-content: flex-start; overflow-y: auto; }
.wrapped-slide h1 { color: #fff; font-size: clamp(3rem, 14vw, 6rem); font-weight: 900; line-height: .95; margin: 8px 0 12px; }
.wrapped-logo { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .5)); }
.wrapped-kicker { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 3px; font-weight: 700; color: var(--c-gold); margin: 0 0 8px; }
.wrapped-big { font-family: var(--font-display); font-weight: 900; font-size: clamp(5rem, 28vw, 11rem); line-height: .9; font-variant-numeric: tabular-nums; }
.wrapped-big--score { font-size: clamp(4rem, 20vw, 8rem); }
.wrapped-big--name { font-size: clamp(2.4rem, 11vw, 4.5rem); line-height: 1; margin-top: 12px; }
.wrapped-big sup { font-size: .35em; }
.wrapped-sub { font-size: 1.2rem; opacity: .85; margin: 8px 0 0; }
.wrapped-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; margin-top: 36px; }
.wrapped-row div { display: flex; flex-direction: column; min-width: 90px; }
.wrapped-row strong { font-family: var(--font-display); font-weight: 900; font-size: 2.6rem; line-height: 1; }
.wrapped-row span { font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; opacity: .7; }
.wrapped-note { margin-top: 32px; opacity: .85; max-width: 420px; }
.wrapped-hint { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); opacity: .6; font-size: .85rem; animation: wrapped-blink 2s ease-in-out infinite; }
@keyframes wrapped-blink { 50% { opacity: .2; } }
.wrapped-match, .wrapped-mate { display: flex; flex-direction: column; align-items: center; }
.wrapped-match .team-logo { margin: 0 0 12px; background: #fff; border-radius: 12px; padding: 6px; }
.wrapped-mate .avatar { margin: 0; border: 4px solid var(--c-gold); }
.wrapped-list { list-style: none; display: flex; flex-direction: column; gap: 14px; text-align: left; font-size: 1.25rem; font-weight: 600; }
.wrapped-list small { display: block; margin-left: 2.1em; font-size: .8rem; font-weight: 400; opacity: .7; }
.wrapped-card { width: min(100%, 360px); height: auto; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); margin: 8px 0 20px; }
.wrapped-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wrapped-actions .btn:not(.btn--primary) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); }
.wrapped-nav { display: flex; gap: 20px; margin-top: 24px; }
.wrapped-nav a { color: rgba(255, 255, 255, .8); }

/* Page « Plus » */
.more-list { list-style: none; }
.more-link { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; color: var(--c-text); border-bottom: 1px solid var(--c-border); }
.more-list li:last-child .more-link { border-bottom: none; }
.more-link > .material-icons:first-child { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--c-loss-bg); color: var(--c-brand); }
.more-link span { flex: 1; display: flex; flex-direction: column; }
.more-link small { color: var(--c-muted); font-size: .8rem; }
.more-chevron { color: var(--c-muted); }

/* Écrans admin maison (compo, classement) */
.admin-back { text-align: center; margin: var(--space-4) 0 var(--space-5); font-size: .9rem; }
.admin-back a { color: var(--c-muted); }
.admin-row-actions { margin: var(--space-4) 0; }
.th-left { text-align: left !important; }

/* ── 6. PAGES ─────────────────────────────────────────────────────────────── */

/* Page match */
.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-4); text-align: center; }
.scoreboard-team { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: #fff; }
.scoreboard-team img, .scoreboard-team .team-logo { width: 64px; height: 64px; margin: 0; }
.scoreboard-link { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); color: #fff; }
.scoreboard-link:hover { text-decoration: underline; }
.scoreboard-score { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.6rem, 10vw, 4rem); color: #fff; line-height: 1; white-space: nowrap; }
.match-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-3); }
.match-fact { background: var(--c-surface-2); border-radius: var(--radius-sm); padding: var(--space-3); }
.match-fact dt { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); }
.match-fact dd { margin: 2px 0 0; font-weight: 600; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.pager a { display: flex; flex-direction: column; padding: var(--space-3) var(--space-4); background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--c-text); min-width: 0; }
.pager a:hover { box-shadow: var(--shadow); }
.pager a small { color: var(--c-muted); font-size: .75rem; }
.pager a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pager .pager-next { text-align: right; grid-column: 2; }
.match-facts + .quote { margin-top: var(--space-4); }
.quote { font-size: 1.05rem; font-style: italic; border-left: 4px solid var(--c-gold); padding: var(--space-2) var(--space-4); margin: 0; color: var(--c-text); }

/* Connexion */
.login-card { max-width: 440px; margin-inline: auto; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
