/* Mon Prono Mondial 2026 — feuille de style "salle d'analyse" */
:root {
  --bg: #0b1016;
  --bg-2: #111a24;
  --panel: #151f2b;
  --panel-2: #1b2836;
  --line: #243343;
  --line-soft: #1d2a38;
  --txt: #e6edf3;
  --txt-dim: #93a4b5;
  --txt-faint: #61748a;
  --pitch: #2ee06a;
  --pitch-deep: #16a34a;
  --amber: #f5a524;
  --blue: #38bdf8;
  --red: #f0506a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(46,224,106,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(56,189,248,.06), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* --- En-tête ---------------------------------------------------------- */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21,31,43,.85), rgba(11,16,22,.4));
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: conic-gradient(from 210deg, var(--pitch), var(--blue), var(--amber), var(--pitch));
  display: grid; place-items: center; font-size: 20px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), var(--shadow);
}
.brand h1 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 19px; margin: 0; letter-spacing: .3px; font-weight: 600;
}
.brand .sub { color: var(--txt-faint); font-size: 12.5px; margin-top: 1px; }
.status-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--txt-dim);
  background: var(--panel); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pitch);
  box-shadow: 0 0 10px var(--pitch); }
.dot.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* --- Navigation ------------------------------------------------------- */
nav.tabs {
  display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
nav.tabs button {
  background: none; border: none; color: var(--txt-dim);
  padding: 14px 18px; font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500;
  transition: color .15s, border-color .15s;
}
nav.tabs button:hover { color: var(--txt); }
nav.tabs button.active { color: var(--pitch); border-bottom-color: var(--pitch); }

main { padding: 26px; max-width: 1240px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

/* --- Grille sandbox --------------------------------------------------- */
.sandbox-grid { display: grid; grid-template-columns: 380px 1fr; gap: 22px; }
@media (max-width: 920px) { .sandbox-grid { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h2 {
  font-family: "Space Grotesk","Inter",sans-serif;
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--txt-faint); margin: 0 0 16px; font-weight: 600;
}
.card h2 .accent { color: var(--pitch); }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; color: var(--txt-dim); margin-bottom: 6px; }
.field label .val { float: right; color: var(--pitch); font-variant-numeric: tabular-nums; }
select, input[type="text"], input[type="number"] {
  width: 100%; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font-size: 14px; font-family: inherit;
}
select:focus, input:focus { outline: none; border-color: var(--pitch); }

.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.vs-row .vs { color: var(--txt-faint); font-weight: 700; padding-bottom: 10px; font-size: 13px; }

input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 5px; border-radius: 5px;
  background: var(--line); outline: none; margin-top: 3px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--pitch); cursor: pointer; box-shadow: 0 0 0 4px rgba(46,224,106,.15);
}

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--line);
  position: relative; transition: background .15s;
}
.toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--txt-dim); transition: transform .15s, background .15s;
}
.toggle input:checked + .track { background: rgba(46,224,106,.35); }
.toggle input:checked + .track::after { transform: translateX(18px); background: var(--pitch); }

.btn {
  width: 100%; padding: 13px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(180deg, var(--pitch), var(--pitch-deep));
  color: #04130a; font-weight: 700; font-size: 14.5px; letter-spacing: .3px;
  box-shadow: 0 6px 18px rgba(46,224,106,.25); transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--panel-2); color: var(--txt); box-shadow: none;
  border: 1px solid var(--line);
}

.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.muted { color: var(--txt-faint); font-size: 12.5px; }

/* --- Résultat --------------------------------------------------------- */
#result .placeholder {
  display: grid; place-items: center; min-height: 360px; text-align: center;
  color: var(--txt-faint);
}
#result .placeholder .big { font-size: 46px; margin-bottom: 10px; opacity: .5; }

.matchline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.matchline .teams { font-family: "Space Grotesk","Inter",sans-serif; font-size: 22px; font-weight: 600; }
.matchline .teams .mid { color: var(--txt-faint); margin: 0 10px; font-size: 16px; }
.badge {
  font-size: 12px; padding: 5px 11px; border-radius: 999px; font-weight: 600;
  background: rgba(46,224,106,.12); color: var(--pitch); border: 1px solid rgba(46,224,106,.3);
}
.badge.amber { background: rgba(245,165,36,.12); color: var(--amber); border-color: rgba(245,165,36,.3); }
.badge.red { background: rgba(240,80,106,.12); color: var(--red); border-color: rgba(240,80,106,.3); }

/* Barre triple proba */
.tribar { display: flex; height: 46px; border-radius: 11px; overflow: hidden; margin: 18px 0 8px;
  border: 1px solid var(--line); }
.tribar .seg { display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #07120b; font-weight: 700; transition: flex .4s ease; min-width: 0; overflow: hidden; }
.tribar .seg small { font-weight: 600; font-size: 10.5px; opacity: .85; }
.seg.home { background: linear-gradient(180deg, #4ade80, var(--pitch-deep)); }
.seg.draw { background: linear-gradient(180deg, #94a3b8, #64748b); color: #0b0f14; }
.seg.away { background: linear-gradient(180deg, #fbbf24, #d97706); }
.tribar-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--txt-dim); }

.xg { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0; }
.xg .num { font-family: "Space Grotesk","Inter",sans-serif; font-size: 40px; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.xg .sep { color: var(--txt-faint); font-size: 22px; }
.xg .lab { text-align: center; }
.xg .lab small { display: block; color: var(--txt-faint); font-size: 11px; margin-top: 2px; }

/* Heatmap des scores */
.heat-wrap { margin-top: 6px; }
.heat { display: grid; gap: 3px; margin-top: 8px; }
.heat .cell {
  aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center;
  font-size: 11px; color: #e6edf3; font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.heat .axis { background: none; color: var(--txt-faint); font-size: 11px; }
.heat .cell.peak { border-color: var(--pitch); box-shadow: 0 0 0 1px var(--pitch); }

.subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 720px){ .subgrid { grid-template-columns: 1fr; } }

.scorelist .row { display: flex; justify-content: space-between; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.scorelist .row b { color: var(--pitch); }

.reasoning li { margin-bottom: 9px; color: var(--txt-dim); font-size: 13.5px; line-height: 1.55; }
.reasoning li::marker { color: var(--pitch); }

.adj-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; font-size: 12.5px; }
.chip .eff { font-weight: 700; margin-left: 6px; }
.chip .up { color: var(--pitch); } .chip .down { color: var(--red); } .chip .flat { color: var(--txt-faint); }

/* --- Tables / dashboards --------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--txt-faint); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255,255,255,.02); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stat .big { font-family:"Space Grotesk","Inter",sans-serif; font-size: 30px; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.stat .lab { color: var(--txt-faint); font-size: 12px; margin-top: 4px; }
.stat.good .big { color: var(--pitch); } .stat.bad .big { color: var(--red); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--pitch);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Simulation ------------------------------------------------------- */
.seg-tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 2px; }
.seg-tabs button { background: none; border: none; color: var(--txt-dim); cursor: pointer;
  padding: 8px 16px; border-radius: 7px; font-size: 13.5px; font-weight: 500; }
.seg-tabs button.active { background: var(--panel-2); color: var(--pitch); }

/* Arbre FIFA à deux côtés */
.fhead { display: flex; min-width: 1320px; }
.fhead > div { flex: 1; text-align: center; font-family: "Space Grotesk","Inter",sans-serif;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--txt-faint);
  padding: 6px 0; }
.fhead > div:nth-child(5) { color: var(--pitch); font-weight: 700; }

.fbracket { display: flex; height: 720px; min-width: 1320px; overflow-x: auto; }
.fround { flex: 1; display: flex; flex-direction: column; }
.fround .rbody { flex: 1; display: flex; flex-direction: column; justify-content: space-around;
  position: relative; }
.fround.final-col { justify-content: center; }
.fround.final-col .rbody { justify-content: center; gap: 12px; }

.fmatch { position: relative; background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 7px; overflow: hidden; z-index: 2;
  margin: 0 13px; }
.fmatch.final { border-color: var(--pitch); box-shadow: 0 0 0 1px rgba(46,224,106,.4), var(--shadow); margin: 0 8px; }
.fteam { display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 5px 8px; font-size: 11.5px; }
.fteam .tn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fteam .flag { margin-right: 5px; font-size: 14px; }
.fteam b { color: var(--txt-faint); font-weight: 600; font-size: 10px;
  font-variant-numeric: tabular-nums; flex-shrink: 0; }
.fteam.win { background: rgba(46,224,106,.12); }
.fteam.win .tn { color: var(--pitch); font-weight: 600; }
.fteam.win b { color: var(--pitch); }
.fdiv { display: flex; flex-direction: column; align-items: center; text-align: center;
  color: var(--txt-faint); background: var(--bg); padding: 2px 0;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums; }
.fdiv-main { font-size: 11px; font-weight: 700; color: var(--txt-dim); letter-spacing: .5px; }
.fdiv-sub { font-size: 8.5px; color: var(--txt-faint); }
.champ-tag { text-align: center; font-family: "Space Grotesk","Inter",sans-serif; font-weight: 700;
  color: var(--pitch); font-size: 14px; }

/* Connecteurs en équerre (espacement fixe : H=720 → 720/k) */
.fround.left .rbody .fmatch::after,
.fround.right .rbody .fmatch::after { content: ""; position: absolute; width: 13px;
  border: 0 solid var(--line); }
/* gauche : sortie à droite */
.fround.left:not(.r-SF) .rbody .fmatch:nth-child(odd)::after {
  left: 100%; top: 50%; border-right-width: 2px; border-bottom-width: 2px; }
.fround.left:not(.r-SF) .rbody .fmatch:nth-child(even)::after {
  left: 100%; bottom: 50%; border-right-width: 2px; border-top-width: 2px; }
/* droite : sortie à gauche (miroir) */
.fround.right:not(.r-SF) .rbody .fmatch:nth-child(odd)::after {
  right: 100%; top: 50%; border-left-width: 2px; border-bottom-width: 2px; }
.fround.right:not(.r-SF) .rbody .fmatch:nth-child(even)::after {
  right: 100%; bottom: 50%; border-left-width: 2px; border-top-width: 2px; }
/* hauteur de l'équerre = moitié de l'espacement du tour source */
.r-R32 .rbody .fmatch::after { height: 45px; }
.r-R16 .rbody .fmatch::after { height: 90px; }
.r-QF  .rbody .fmatch::after { height: 180px; }
/* demies → finale : simple trait horizontal */
.fround.left.r-SF .rbody .fmatch::after { content:""; position:absolute; left:100%; top:50%;
  width:13px; height:2px; background:var(--line); }
.fround.right.r-SF .rbody .fmatch::after { content:""; position:absolute; right:100%; top:50%;
  width:13px; height:2px; background:var(--line); }

.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 16px; }
.groups-grid table { font-size: 13px; }

.pbar { display: inline-block; width: 60px; height: 6px; background: var(--line); border-radius: 4px;
  overflow: hidden; vertical-align: middle; margin-right: 6px; }
.pbar span { display: block; height: 100%; background: var(--pitch); }
.pnum { font-variant-numeric: tabular-nums; }

/* --- Bandeau contexte (match ouvert depuis le calendrier) ----------- */
.ctx-banner { background: rgba(56,189,248,.10); border: 1px solid rgba(56,189,248,.35);
  color: var(--txt); border-radius: 10px; padding: 11px 15px; margin-bottom: 16px;
  font-size: 13px; }
.ctx-banner b { color: var(--blue); }

/* --- Progression de la simulation ----------------------------------- */
.progress { position: relative; height: 26px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; margin-top: 14px; }
.progress > span { display: block; height: 100%;
  background: linear-gradient(90deg, var(--pitch-deep), var(--pitch)); transition: width .4s ease; }
.progress > b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px;
  color: var(--txt); font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.livelb { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.lb-row { display: grid; grid-template-columns: 160px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.lb-team { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.lb-bar > span { display: block; height: 100%; background: var(--pitch); transition: width .4s ease; }
.lb-pct { text-align: right; color: var(--pitch); font-variant-numeric: tabular-nums; font-weight: 600; }

.fmatch.pred .pteam { cursor: pointer; transition: background .12s; }
.fmatch.pred .pteam:hover { background: rgba(56,189,248,.14); }

.fmatch.clk { cursor: pointer; transition: border-color .12s, transform .08s; }
.fmatch.clk:hover { border-color: var(--pitch); transform: scale(1.03); z-index: 3; }

/* --- Modale fiche détaillée ------------------------------------------ */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,8,12,.72); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px;
  overflow-y: auto; }
.modal-overlay.show { display: flex; animation: fade .2s ease; }
.modal-card { background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 720px; padding: 24px; position: relative; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--txt-dim); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 14px; }
.modal-close:hover { color: var(--txt); border-color: var(--pitch); }
.modal-sub { color: var(--txt-faint); font-size: 12px; margin-bottom: 14px; padding-right: 36px; }

/* --- Calendrier ------------------------------------------------------- */
.cal-day { margin-bottom: 20px; }
.cal-date { font-family: "Space Grotesk","Inter",sans-serif; font-size: 13px; font-weight: 600;
  color: var(--pitch); text-transform: capitalize; letter-spacing: .3px;
  margin: 0 0 9px 2px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.cal-match { display: grid; grid-template-columns: 1fr 200px auto; gap: 14px; align-items: center;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 16px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s, transform .08s; }
.cal-match:hover { border-color: var(--pitch); transform: translateX(2px); }
.cal-teams { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cal-grp { font-size: 10px; font-weight: 700; color: var(--txt-faint); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; min-width: 18px; text-align: center; }
.cal-teams .t { font-weight: 600; font-size: 14px; }
.cal-teams .t.away { color: var(--txt-dim); }
.cal-vs { color: var(--txt-faint); font-size: 11px; }
.mini-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line);
  font-size: 10px; font-weight: 700; }
.mini-bar span { display: grid; place-items: center; color: #06140c; min-width: 0; overflow: hidden; }
.mini-bar .mh { background: var(--pitch-deep); color: #eafff1; }
.mini-bar .md { background: #5b6b7d; color: #0b0f14; }
.mini-bar .ma { background: #d97706; color: #fff6e8; }
.cal-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cal-score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  padding: 4px 10px; border-radius: 7px; }
.cal-score.pred { background: rgba(46,224,106,.12); color: var(--pitch); border: 1px solid rgba(46,224,106,.3);
  font-size: 13px; }
.cal-score.real { background: var(--panel-2); color: var(--txt); border: 1px solid var(--line); }
@media (max-width: 720px) {
  .cal-match { grid-template-columns: 1fr; gap: 9px; }
  .cal-right { justify-content: flex-start; }
}

.scatter-wrap { position: relative; }
.scatter-tip { position: absolute; background: var(--panel-2); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; opacity: 0;
  transition: opacity .12s; white-space: nowrap; z-index: 5; }
