:root {
    --sun:    #F97316;
    --gold:   #FBBF24;
    --grass:  #16A34A;
    --sky:    #0EA5E9;
    --dark:   #1C1917;
    --mid:    #44403C;
    --light:  #FEF3C7;
    --white:  #FFFBF5;
    --shadow: 0 4px 24px rgba(249,115,22,.12);
    --border: rgba(0,0,0,.08);
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: 'DM Sans', sans-serif; 
    background: #F5F3EE; 
    color: var(--dark); 
    min-height: 100vh; 
}

/* ── NAV ── */
nav {
    position: sticky; 
    top: 0; 
    z-index: 100;
    background: var(--dark);
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 2rem; 
    height: 60px;
    box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

.nav-logo { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 1.5rem; 
    letter-spacing: .1em; 
    color: var(--gold); 
    text-decoration: none; 
}

.nav-links { 
    display: flex; 
    gap: .25rem; 
}

.nav-links a { 
    color: #A8A29E; 
    text-decoration: none; 
    font-size: .85rem; 
    font-weight: 500; 
    padding: .4rem .9rem; 
    border-radius: 6px; 
    transition: all .2s; 
}

.nav-links a:hover, .nav-links a.active { 
    color: var(--white); 
    background: rgba(255,255,255,.1); 
}

.nav-links a.active { 
    color: var(--gold); 
}

/* ── PAGE HEADER ── */
.page-header {
    background: var(--dark);
    padding: 2.5rem 2rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute; 
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(249,115,22,.2) 0%, transparent 55%),
                radial-gradient(ellipse at 70% 30%, rgba(251,191,36,.15) 0%, transparent 50%);
    pointer-events: none;
}

.page-header h1 { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: clamp(2.5rem,6vw,4rem); 
    color: var(--white); 
    letter-spacing: .08em; 
    position: relative; 
}

.page-header h1 span { 
    color: var(--sun); 
}

.page-header p { 
    color: #A8A29E; 
    font-size: .9rem; 
    margin-top: .5rem; 
    position: relative; 
}

/* ── FILTER BAR ── */
.filter-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .75rem 2rem;
    display: flex; 
    align-items: center; 
    gap: .5rem;
    flex-wrap: wrap;
    position: sticky; 
    top: 60px; 
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.filter-label { 
    font-size: .75rem; 
    font-weight: 700; 
    letter-spacing: .1em; 
    text-transform: uppercase; 
    color: var(--mid); 
    margin-right: .25rem; 
}

.filter-btn {
    font-size: .8rem; 
    font-weight: 600; 
    padding: .3rem .8rem;
    border-radius: 99px; 
    border: 1.5px solid #E7E5E4;
    background: transparent; 
    color: #78716C; 
    cursor: pointer;
    transition: all .2s; 
    font-family: 'DM Sans', sans-serif;
}

.filter-btn:hover { 
    border-color: var(--sun); 
    color: var(--sun); 
}

.filter-btn.active { 
    background: var(--sun); 
    border-color: var(--sun); 
    color: white; 
}

.filter-btn.all-btn { 
    border-color: var(--dark); 
    color: var(--dark); 
}

.filter-btn.all-btn.active { 
    background: var(--dark); 
    color: white; 
}

/* ── MAIN LAYOUT ── */
.main { 
    max-width: 1500px;    
    margin: 0 auto; 
    padding: 2rem; 
}

/* ── GROUP BLOCK ── */
.group-block {
    margin-bottom: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 820px) {
    .group-block { 
        grid-template-columns: 1fr; 
    } 
}

.group-letter-tag {
    display: inline-flex; 
    align-items: center; 
    gap: .5rem;
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 2rem; 
    letter-spacing: .12em;
    color: var(--sun); 
    margin-bottom: .75rem; 
    line-height: 1;
}

.group-letter-tag .conf-badge {
    font-family: 'DM Sans', sans-serif; 
    font-size: .65rem; 
    font-weight: 700;
    letter-spacing: .1em; 
    text-transform: uppercase;
    padding: .2rem .55rem; 
    border-radius: 99px;
    background: var(--dark); 
    color: var(--gold);
    vertical-align: middle; 
    margin-top: 6px;
}

/* ── STANDINGS TABLE ── */
.standings-card {
    background: var(--white); 
    border-radius: 16px;
    box-shadow: var(--shadow); 
    overflow: hidden;
    border: 1px solid rgba(249,115,22,.08);
}

.standings-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: .82rem; 
}

.standings-table thead th {
    background: var(--dark); 
    color: #78716C;
    font-size: .68rem; 
    font-weight: 700; 
    letter-spacing: .1em; 
    text-transform: uppercase;
    padding: .55rem .75rem; 
    text-align: center;
}

.standings-table thead th:first-child { 
    text-align: left; 
    padding-left: 1rem; 
}

.standings-table tbody tr { 
    border-bottom: 1px solid #F5F3EE; 
    transition: background .15s; 
}

.standings-table tbody tr:hover { 
    background: #FFFBF5; 
}

.standings-table tbody tr:last-child { 
    border-bottom: none; 
}

.standings-table td { 
    padding: .65rem .75rem; 
    text-align: center; 
}

.standings-table td:first-child { 
    text-align: left; 
    padding-left: 1rem; 
}

.team-cell { 
    display: flex; 
    align-items: center; 
    gap: .5rem; 
}

.team-flag-img { 
    width: 22px; 
    height: 15px;
    object-fit: cover; 
    border-radius: 2px; 
    flex-shrink: 0; 
}

.team-flag-emoji { 
    font-size: 1.1rem; 
    flex-shrink: 0; 
}

.team-cell-name { 
    font-weight: 500;
    color: var(--dark); 
    white-space: nowrap; 
}

.pos-num { 
    font-size: .75rem; 
    color: #A8A29E; 
    font-weight: 600; 
    min-width: 14px; 
}

.qual-badge {
    font-size: .65rem; 
    font-weight: 700; 
    letter-spacing: .06em;
    padding: .15rem .45rem; 
    border-radius: 4px; 
    white-space: nowrap;
}
.qual-1ST   { 
    background: #DCFCE7; 
    color: #15803D; 
}

.qual-2ND   { 
    background: #DBEAFE; 
    color: #1D4ED8;
}

.qual-3RD   { 
    background: #FEF3C7; 
    color: #B45309; 
}

.qual-OUT   { 
    background: #F5F3EE; 
    color: #A8A29E; 
}

.pts-cell { 
    font-weight: 700; 
    font-size: .92rem; 
    color: var(--dark); 
}

/* Progress bar pour prob qualification */
.prob-bar-wrap { 
    display: flex; 
    align-items: center; 
    gap: .4rem; 
    min-width: 80px; 
}

.prob-bar { 
    height: 5px; 
    background: #E7E5E4; 
    border-radius: 99px; 
    flex: 1; 
    overflow: hidden; 
}

.prob-bar-fill { 
    height: 100%; 
    border-radius: 99px; 
    background: var(--grass); 
    transition: width .6s ease; 
}

.prob-val { 
    font-size: .72rem; 
    font-weight: 600; 
    color: var(--mid); 
    min-width: 28px; 
}

/* Prob columns (p1–p4) */
.p-bar-cell { 
    width: 60px; 
}

.p-bar-mini { 
    height: 3px; 
    border-radius: 99px; 
    margin-top: 2px; 
}

/* ── MATCHES CARD ── */
.matches-card {
    background: var(--white); 
    border-radius: 16px;
    box-shadow: var(--shadow); 
    overflow: hidden;
    border: 1px solid rgba(249,115,22,.08);
}

.matches-card-header {
    background: var(--dark); 
    padding: .65rem 1rem;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

.matches-card-header span { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 1rem; 
    letter-spacing: .1em; 
    color: var(--gold); 
}

.matches-card-header small { 
    font-size: .7rem; 
    color: #78716C; 
}

.match-row {
    display: grid;
    grid-template-columns: 48px 1fr auto 1fr 90px;
    align-items: center;
    padding: .6rem 1rem;
    gap: .5rem;
    border-bottom: 1px solid #F5F3EE;
    font-size: .82rem;
}
.match-row:last-child { 
    border-bottom: none; 
}

.match-date-col { 
    font-size: .7rem; 
    color: #A8A29E; 
    font-weight: 600; 
    text-align: left; 
    white-space: nowrap; 
}

.match-home { 
    text-align: right; 
    font-weight: 500; 
    display: flex; 
    align-items: center; 
    justify-content: flex-end; 
    gap: .35rem; 
}

.match-away { 
    text-align: left; 
    font-weight: 500; 
    display: flex; 
    align-items: center; 
    gap: .35rem; 
}

.match-score-block { 
    text-align: center; 
}

/* Score affiché vs prédit */
.score-actual { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 1.3rem; 
    letter-spacing: .08em; 
    color: var(--dark); 
    line-height: 1; 
}

.score-pred   { 
    font-size: .7rem; 
    color: #A8A29E; 
    margin-top: 1px; 
    white-space: nowrap; 
}

.score-pred.correct { 
    color: var(--grass); 
    font-weight: 600; 
}

/* Barres de probabilité du match */
.match-proba { 
    display: flex; 
    gap: 2px; 
    height: 4px; 
    border-radius: 2px; 
    overflow: hidden; 
    width: 80px; 
    margin: 0 auto;
    margin-top: 3px; 
}

.mp-h { 
    background: var(--grass); 
}

.mp-d { 
    background: var(--gold); 
}

.mp-a { 
    background: #EF4444; 
}

/* ── MEILLEURS 3EMES ── */
.best3-section { 
    margin-bottom: 3rem; 
}

.section-title-row {
    display: flex; 
    align-items: baseline; 
    gap: .75rem;
    margin-bottom: 1rem; 
    border-bottom: 2px solid var(--light); 
    padding-bottom: .75rem;
}

.section-title { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 1.8rem; 
    letter-spacing: .08em; 
    color: var(--dark); 
}

.section-sub { 
    color: #78716C; 
    font-size: .88rem; 
}

.best3-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: .75rem; 
}

.best3-card {
    background: var(--white); 
    border-radius: 12px; 
    padding: 1rem;
    border: 1px solid #E7E5E4;
    display: flex; 
    align-items: center; 
    gap: .75rem;
    transition: box-shadow .2s, transform .2s;
}

.best3-card:hover { 
    box-shadow: var(--shadow); 
    transform: translateY(-1px);
}

.best3-rank {
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 2rem; 
    color: var(--sun);
    line-height: 1; 
    min-width: 28px; 
    text-align: center;
}

.best3-info { 
    flex: 1; 
    min-width: 0; 
}

.best3-name { 
    font-weight: 600; 
    font-size: .88rem; 
    color: var(--dark); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.best3-group { 
    font-size: .72rem; 
    color: #A8A29E; 
    margin-bottom: .35rem; 
}

.best3-stats { 
    font-size: .72rem; 
    color: var(--mid); 
}

.qual-pct {
    font-size: .8rem; 
    font-weight: 700;
    color: var(--grass);
    min-width: 36px; 
    text-align: right;
}

.qual-pct.low { 
    color: #B45309; 
}

/* ── BEST 3 TABLE ── */
.best3-table-wrap { 
    overflow-x: auto; 
    border-radius: 14px;
    border: 1px solid #E7E5E4; 
}

.best3-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: .82rem; 
}

.best3-table thead th {
    background: var(--dark); 
    color: #78716C;
    font-size: .68rem; 
    font-weight: 700; 
    letter-spacing: .1em; 
    text-transform: uppercase;
    padding: .55rem .75rem; 
    text-align: center; 
    white-space: nowrap;
}

.best3-table thead th:nth-child(3) { 
    text-align: left; 
}

.best3-table tbody tr {
    border-bottom: 1px solid #F5F3EE;
    transition: background .15s; 
}

.best3-table tbody tr:hover { 
    background: #FFFBF5; 
}

.best3-table tbody tr:last-child {
    border-bottom: none; 
}

.best3-table td { 
    padding: .6rem .75rem; 
    text-align: center; 
    vertical-align: middle; 
}

.row-qualified { 
    background: #FAFFF5; 
}

.row-out {
    opacity: .65; 
}

.cutoff-row td { 
    padding: .4rem .75rem; 
    background: #F5F3EE; 
    text-align: center; 
}

.cutoff-row span { 
    font-size: .72rem; 
    font-weight: 700; 
    letter-spacing: .12em; 
    color: #A8A29E; 
    text-transform: uppercase; 
}

.b3-rank { 
    font-family: 'Bebas Neue', sans-serif; 
    font-size: 1.4rem; 
    color: var(--sun); 
    line-height: 1; 
    min-width: 28px; 
}

.b3-group { 
    font-size: .72rem; 
    color: #A8A29E; 
    font-weight: 600; 
    white-space: nowrap; 
}

.b3-name-cell { 
    text-align: left; 
    display: flex; 
    align-items: center; 
    gap: .5rem; 
    white-space: nowrap; 
    font-weight: 500; 
}

.b3-num { 
    font-weight: 600; 
}

/* ── ANIMATIONS ── */
.fade-in { 
    opacity: 0; 
    transform: translateY(14px);
    transition: opacity .5s ease, transform .5s ease; 
}

.fade-in.visible { 
    opacity: 1; 
    transform: none; 
}

/* ── GROUPE HEADER ROW ── */
.group-header-row {
    grid-column: 1 / -1;
    display: flex; 
    align-items: center; 
    gap: 1rem;
    margin-bottom: .1rem;
}

.group-header-line { 
    flex: 1; 
    height: 1px; 
    background: #E7E5E4; 
}

/* ── EMPTY / LOADING ── */
.loading {
    padding: 4rem; 
    text-align: center; 
    color: #A8A29E; 
}

@media (max-width: 640px) {
    nav { 
        padding: 0 1rem; 
    }

    .nav-links a {
        padding: .4rem .5rem; 
        font-size: .75rem; 
    }
    .main { 
        padding: 1rem; 
    }
    .match-row { 
        grid-template-columns: 40px 1fr auto 1fr 72px; 
        font-size: .75rem; 
    }
}

/* ── TOGGLE REAL RESULT ── */
.mode-toggle {
  display: flex;
  gap: .25rem;
  margin-left: auto;
  background: #F5F3EE;
  border-radius: 99px;
  padding: .2rem;
}
.mode-btn {
  font-size: .78rem;
  font-weight: 600;
  padding: .3rem .9rem;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: #78716C;
  cursor: pointer;
  transition: all .2s;
  font-family: 'DM Sans', sans-serif;
}
.mode-btn.active {
  background: var(--dark);
  color: white;
}
.pred-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 4px;
  margin-left: .3rem;
  vertical-align: middle;
}
.pred-badge.correct  { background: #DCFCE7; color: #15803D; }
.pred-badge.wrong    { background: #FEE2E2; color: #B91C1C; }