:root {
  --bg: #0f1226;
  --bg2: #161a3a;
  --card: #1d2147;
  --line: #2c326b;
  --txt: #eef0ff;
  --muted: #9aa0d0;
  --accent: #ffd24a;
  --green: #38d39f;
  --red: #ff6b6b;
  --blue: #5b8def;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--txt);
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem 1.2rem; background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--txt); }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-weight: 600; }
.topbar nav a.active { color: var(--accent); }
.topbar .me { color: var(--accent); font-weight: 700; }
.langs { display: inline-flex; align-items: center; gap: .25rem; font-size: .82rem; }
.langs .lang { color: var(--muted); font-weight: 600; }
.langs .lang.active { color: var(--accent); text-decoration: underline; }
.langs .sepdot { color: var(--line); }
.inline { display: inline; margin: 0; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-weight: 600; }
.link:hover { color: var(--red); }

.container { max-width: 860px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.05rem; color: var(--accent); margin: 1.6rem 0 .6rem; letter-spacing: .02em; }
.muted { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: .8rem; }
.flash { background: rgba(56,211,159,.15); border: 1px solid var(--green); color: var(--green); padding: .6rem .9rem; border-radius: 10px; margin-bottom: 1rem; }
.warn { background: rgba(255,210,74,.12); border: 1px solid var(--accent); color: var(--accent); padding: .6rem .9rem; border-radius: 10px; margin-bottom: 1rem; }
.error { background: rgba(255,107,107,.15); border: 1px solid var(--red); color: var(--red); padding: .6rem .9rem; border-radius: 10px; margin-bottom: 1rem; }

/* Match */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.match .team { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.match .team.away { justify-content: flex-end; text-align: right; }
.match .team img { width: 26px; height: 26px; object-fit: contain; }
.match .team span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .mid { text-align: center; min-width: 110px; }
.kickoff { color: var(--muted); font-size: .82rem; }
.scoreline { font-size: 1.4rem; font-weight: 800; }

.predform { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: .7rem; }
.predform input[type=number] {
  width: 56px; padding: .45rem; text-align: center; font-size: 1.1rem; font-weight: 700;
  background: var(--bg); color: var(--txt); border: 1px solid var(--line); border-radius: 8px;
}
.predform button {
  background: var(--accent); color: #20233f; border: none; font-weight: 800;
  padding: .5rem .9rem; border-radius: 8px; cursor: pointer;
}
.predform button:hover { filter: brightness(1.05); }
.predform .sep { font-weight: 800; color: var(--muted); }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.badge.locked { background: rgba(154,160,208,.2); color: var(--muted); }
.badge.live { background: rgba(255,107,107,.2); color: var(--red); }
.badge.exact { background: rgba(56,211,159,.2); color: var(--green); }
.badge.result { background: rgba(91,141,239,.25); color: var(--blue); }
.badge.miss { background: rgba(154,160,208,.18); color: var(--muted); }
.pred-recap { margin-top: .55rem; font-size: .9rem; color: var(--muted); text-align: center; }

/* Tableau classement */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me { background: rgba(255,210,74,.1); }
.rank { font-weight: 800; color: var(--accent); }
.medal { font-size: 1.1rem; }

/* Formulaires auth */
.authbox { max-width: 380px; margin: 2rem auto; }
.field { margin-bottom: .9rem; }
.field label { display: block; margin-bottom: .3rem; color: var(--muted); font-weight: 600; }
.field input, .field select {
  width: 100%; padding: .6rem .7rem; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px; font-size: 1rem;
}
.btn { width: 100%; padding: .7rem; background: var(--accent); color: #20233f; border: none; border-radius: 9px; font-weight: 800; font-size: 1rem; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn.alt { background: var(--blue); color: #fff; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tabs a { flex: 1; text-align: center; padding: .55rem; border-radius: 9px; background: var(--card); color: var(--muted); font-weight: 700; border: 1px solid var(--line); }
.tabs a.active { background: var(--accent); color: #20233f; }

.champion-pick { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.champion-pick select { flex: 1; min-width: 180px; }

.adminbtn { background: var(--blue); color:#fff; border:none; padding:.55rem .9rem; border-radius:8px; font-weight:700; cursor:pointer; }
.scorecell input { width: 42px; padding: .3rem; text-align:center; background: var(--bg); color: var(--txt); border:1px solid var(--line); border-radius:6px; }
small.kbd { background: var(--bg); padding: .1rem .4rem; border-radius: 5px; border: 1px solid var(--line); }

/* Onglets */
.tabbar { display: flex; gap: .4rem; margin: 1.2rem 0 1rem; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; border-bottom: 3px solid transparent; color: var(--muted); font: inherit; font-weight: 700; padding: .6rem .9rem; cursor: pointer; }
.tab:hover { color: var(--txt); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-badge { display: inline-block; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .05rem .4rem; vertical-align: middle; }
.need-banner { font-weight: 700; }
.filter-toggle { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.filter-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Carte de match cliquable */
.match-link { display: block; color: inherit; text-decoration: none; }
.match-link:hover { text-decoration: none; }
.matchcard { transition: border-color .15s; }
.matchcard:hover { border-color: var(--blue); }
.card-foot { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--line); text-align: right; }
.see-preds { font-size: .82rem; font-weight: 700; color: var(--blue); }
.back { color: var(--muted); font-weight: 700; }

/* Tableau final (bracket) */
.bracket { display: flex; gap: 0; overflow-x: auto; padding-bottom: .8rem; align-items: stretch; }
.round { flex: 0 0 200px; display: flex; flex-direction: column; }
.round h3 { color: var(--accent); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; margin: .2rem 0 .8rem; text-align: center; }
.round-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: .6rem; }
.match-wrap { position: relative; display: flex; align-items: center; padding: 0 14px; }
.match-wrap .bx { width: 100%; }

/* connecteurs : sortie à droite (sauf finale) + entrée à gauche (sauf 1er tour) */
.round:not(:last-of-type) .match-wrap::after {
  content: ''; position: absolute; left: calc(100% - 14px); top: 50%;
  width: 14px; height: 2px; background: var(--line);
}
.round:not(:first-of-type) .match-wrap::before {
  content: ''; position: absolute; right: calc(100% - 14px); top: 50%;
  width: 14px; height: 2px; background: var(--line);
}
.bx {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .5rem .6rem; color: inherit; text-decoration: none; transition: border-color .15s;
}
.bx:hover { border-color: var(--blue); text-decoration: none; }
.bx-row { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .15rem 0; }
.bx-team { display: flex; align-items: center; gap: .35rem; min-width: 0; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-team img { width: 18px; height: 18px; object-fit: contain; flex: none; }
.bx-row.win .bx-team { color: var(--accent); }
.bx-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.bx-meta { margin-top: .35rem; padding-top: .3rem; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.bx-mine { color: var(--green); font-size: .7rem; }

.third-place { margin-top: 1.4rem; max-width: 260px; }
.third-place h3 { color: var(--accent); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .6rem; }

/* Votants (qui a pronostiqué, sans le score) */
.voters { display: flex; flex-wrap: wrap; gap: .4rem; }
.voter { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; font-weight: 600; }
.voter.me { border-color: var(--accent); color: var(--accent); }

/* Liens vers profils */
.player-link { color: var(--txt); font-weight: 600; }
.player-link:hover { color: var(--blue); }

/* Grille de stats du profil */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .6rem; text-align: center; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: .76rem; color: var(--muted); margin-top: .2rem; }
@media (max-width: 600px) { .statgrid { grid-template-columns: repeat(3, 1fr); gap: .4rem; } .stat-val { font-size: 1.25rem; } }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .container { padding: 1rem .7rem 2.5rem; }
  .topbar { padding: .6rem .8rem; gap: .5rem; }
  .brand { font-size: 1rem; }
  .topbar nav { gap: .7rem; width: 100%; }
  .topbar nav a, .topbar nav .link { font-size: .9rem; }
  .langs { width: 100%; justify-content: flex-start; margin-top: .2rem; }

  h1 { font-size: 1.35rem; }
  .card { padding: .85rem .9rem; border-radius: 12px; }

  /* match : noms plus compacts, score lisible */
  .match { grid-template-columns: 1fr auto 1fr; gap: .35rem; }
  .match .team span { font-size: .92rem; }
  .match .team img { width: 22px; height: 22px; }
  .match .mid { min-width: 84px; }
  .scoreline { font-size: 1.2rem; }
  .kickoff { font-size: .76rem; }

  /* formulaire de score : gros boutons tactiles */
  .predform input[type=number] { width: 52px; padding: .55rem; font-size: 1.15rem; }
  .predform button { padding: .55rem 1rem; }

  /* tableaux : compacts */
  th, td { padding: .5rem .35rem; font-size: .92rem; }
  th { font-size: .72rem; }

  /* onglets : pleine largeur scrollable */
  .tabbar { overflow-x: auto; }
  .tab { padding: .55rem .7rem; white-space: nowrap; font-size: .92rem; }

  .champion-pick select { min-width: 0; }
  .bracket-col, .round { flex-basis: 180px; min-width: 180px; }
}
