:root {
  --fond: #0a0a0c;
  --panneau: #141418;
  --panneau-2: #1b1b21;
  --filet: #2a2a32;
  --texte: #f4f4f5;
  --sourdine: #9a9aa6;
  --rouge: #e3202f;
  --rouge-fonce: #8f0f19;
  --vert: #2fbf71;
  --rayon: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(143, 15, 25, 0.55), transparent 60%),
    var(--fond);
  background-attachment: fixed;
  color: var(--texte);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* --- En-tête --- */
.entete { text-align: center; padding: 10px 0 6px; }
.titre {
  font-weight: 800;
  font-size: clamp(40px, 12vw, 68px);
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin: 0;
}
.titre .r { color: var(--rouge); }
.sous-titre {
  margin: 10px 0 0;
  letter-spacing: 0.22em;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
}
.drapeau {
  display: inline-grid;
  grid-template-columns: 1fr 1.5fr;
  grid-template-rows: 1fr 1fr;
  width: 22px;
  height: 15px;
  border-radius: 3px;
  overflow: hidden;
  vertical-align: -2px;
  margin-left: 6px;
}
.drapeau i:nth-child(1) { grid-row: 1 / 3; background: #008751; }
.drapeau i:nth-child(2) { background: #fcd116; }
.drapeau i:nth-child(3) { background: #e8112d; }
.plateforme {
  color: var(--rouge);
  letter-spacing: 0.32em;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  text-transform: uppercase;
}

.prix {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--rayon);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.18), rgba(227, 32, 47, 0.12));
  border: 1px solid rgba(212, 175, 55, 0.6);
  font-size: 14px;
  text-align: center;
}
.prix b { color: #f3d36b; }
.case-ip { display: flex; gap: 8px; align-items: flex-start; color: var(--texte); margin-top: 14px; }
.case-ip input { width: auto; margin-top: 3px; }

/* --- Bandeau d'état --- */
.bandeau {
  margin: 18px 0 14px;
  border-radius: var(--rayon);
  padding: 12px 14px;
  text-align: center;
  background: var(--panneau);
  border: 1px solid var(--filet);
  font-weight: 600;
}
.bandeau.ouvert { border-color: rgba(47, 191, 113, 0.5); }
.bandeau.ouvert .point { background: var(--vert); }
.bandeau.ferme { border-color: rgba(227, 32, 47, 0.6); }
.bandeau.ferme .point { background: var(--rouge); }
.bandeau .point {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  animation: pouls 1.6s infinite;
}
.bandeau .compte {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-weight: 700;
  margin-left: 6px;
}
@keyframes pouls { 50% { opacity: 0.35; } }

/* --- Duel --- */
.duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
}
.joueur {
  background: var(--panneau);
  border-radius: var(--rayon);
  overflow: hidden;
  border: 1px solid var(--filet);
  display: flex;
  flex-direction: column;
}
.joueur .photo {
  aspect-ratio: 4 / 4.4;
  background: #222 center / cover no-repeat;
  filter: grayscale(1) contrast(1.05);
  border-bottom: 3px solid var(--rouge);
  display: grid;
  place-items: center;
  font-size: 54px;
  font-weight: 800;
  color: #555;
}
.joueur .infos { padding: 10px 8px 12px; text-align: center; }
.joueur .nom {
  font-weight: 800;
  font-size: clamp(20px, 6vw, 28px);
  text-transform: uppercase;
  line-height: 1.05;
}
.joueur .cote {
  color: var(--rouge);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 13px;
  margin-top: 4px;
}
.joueur .cote b {
  font-size: 22px;
  letter-spacing: 0;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}
.fleche { font-size: 14px; margin-left: 2px; }
.fleche.haut { color: var(--vert); }
.fleche.bas { color: var(--rouge); }
.joueur .proba { color: var(--sourdine); font-size: 12px; }
.joueur.gagnant { border-color: var(--vert); box-shadow: 0 0 0 1px var(--vert) inset; }

.centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
}
.vs {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #0b0b0d;
  border: 3px solid var(--rouge);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}
.score {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-weight: 800;
  font-size: 22px;
  white-space: nowrap;
}
.score small { display: block; text-align: center; color: var(--sourdine); font-size: 11px; font-weight: 500; font-family: 'Poppins', sans-serif; }

/* --- Blocs --- */
.bloc {
  background: var(--panneau);
  border: 1px solid var(--filet);
  border-radius: var(--rayon);
  padding: 16px;
  margin-top: 14px;
}
.bloc h2 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sourdine);
  font-weight: 600;
}
.bloc h2 .r { color: var(--rouge); }

.repartition .barre {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panneau-2);
}
.repartition .barre .a { background: var(--rouge); transition: width 0.6s; }
.repartition .barre .b { background: #e9e9ee; transition: width 0.6s; }
.repartition .legende {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 8px;
  color: var(--sourdine);
}
.repartition .legende b { color: var(--texte); }

.graphe svg { width: 100%; height: 120px; display: block; }
.graphe .vide { color: var(--sourdine); font-size: 13px; }

/* --- Parties --- */
.parties { width: 100%; border-collapse: collapse; font-size: 14px; }
.parties td { padding: 8px 4px; border-top: 1px solid var(--filet); }
.parties tr:first-child td { border-top: 0; }
.parties .num { color: var(--sourdine); width: 28px; }
.parties .cad { font-weight: 700; }
.parties .pts { color: var(--rouge); font-weight: 600; text-align: right; white-space: nowrap; }
.parties .res { text-align: right; width: 110px; }
.pastille {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--panneau-2);
  color: var(--sourdine);
}
.pastille.a { background: var(--rouge); color: #fff; }
.pastille.b { background: #e9e9ee; color: #111; }
.pastille.n { background: #3a3a44; color: #fff; }
.admin-res { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.admin-res button { padding: 4px 8px; font-size: 12px; min-height: 30px; }

/* --- Formulaires --- */
label { display: block; font-size: 13px; color: var(--sourdine); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  background: #0d0d10;
  border: 1px solid var(--filet);
  color: var(--texte);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rouge); outline-offset: 1px; }
button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
  background: var(--panneau-2);
  color: var(--texte);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.principal { background: var(--rouge); color: #fff; width: 100%; margin-top: 14px; font-size: 16px; }
button.principal:hover:not(:disabled) { background: #f22d3c; }
button.lien { background: none; color: var(--sourdine); padding: 4px; min-height: 0; text-decoration: underline; font-weight: 500; }
button.danger { background: var(--rouge-fonce); color: #fff; }

.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choix button {
  background: #0d0d10;
  border: 2px solid var(--filet);
  padding: 12px 8px;
  text-align: center;
  line-height: 1.2;
}
.choix button .n { display: block; font-size: 18px; text-transform: uppercase; font-weight: 800; }
.choix button .c { display: block; color: var(--rouge); font-family: ui-monospace, Consolas, monospace; font-size: 16px; margin-top: 4px; }
.choix button.actif { border-color: var(--rouge); background: rgba(227, 32, 47, 0.12); }

.jetons { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.jetons button { flex: 1; min-width: 56px; padding: 8px 6px; min-height: 38px; font-size: 13px; }

.gain { margin-top: 10px; font-size: 14px; color: var(--sourdine); }
.gain b { color: var(--texte); font-family: ui-monospace, Consolas, monospace; }

.solde { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.solde .montant { font-size: 28px; font-weight: 800; font-family: ui-monospace, Consolas, monospace; }
.solde .montant small { font-size: 13px; color: var(--sourdine); font-family: 'Poppins', sans-serif; font-weight: 500; }
.qui { color: var(--sourdine); font-size: 14px; }
.qui b { color: var(--texte); }

.message { margin-top: 10px; font-size: 14px; min-height: 1em; }
.message.erreur { color: #ff6b74; }
.message.ok { color: var(--vert); }

/* --- Listes --- */
.liste { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.liste li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--filet);
}
.liste li:first-child { border-top: 0; }
.liste .d { color: var(--sourdine); font-size: 12px; }
.liste .m { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; text-align: right; }
.liste .rang { color: var(--sourdine); width: 26px; display: inline-block; }
.liste li.moi { color: var(--rouge); }
.statut-pari { font-size: 12px; font-weight: 700; }
.statut-pari.gagne { color: var(--vert); }
.statut-pari.perdu { color: #ff6b74; }
.statut-pari.rembourse { color: var(--sourdine); }
.vide { color: var(--sourdine); font-size: 14px; }

.admin { border-color: rgba(227, 32, 47, 0.6); }
.admin .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin .actions button { flex: 1; min-width: 140px; }
details summary { cursor: pointer; color: var(--sourdine); margin-top: 14px; }

.regles { color: var(--sourdine); font-size: 13px; }
.regles ul { padding-left: 18px; margin: 6px 0 0; }
.regles li { margin: 4px 0; }

.pied { text-align: center; color: var(--sourdine); font-size: 12px; margin-top: 28px; }
.pied b { color: var(--texte); letter-spacing: 0.2em; }

.cache { display: none !important; }

.d { color: var(--sourdine); font-size: 12px; }
.bloc h3 { font-size: 14px; margin: 18px 0 4px; }
.ligne-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ligne-form input { flex: 1; min-width: 120px; }
.ligne-form input[type='range'] { padding: 0; accent-color: var(--rouge); }

/* Onglets du pari */
.onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.onglets button { background: #0d0d10; border: 1px solid var(--filet); font-size: 13px; padding: 10px 6px; }
.onglets button.actif { background: var(--rouge); border-color: var(--rouge); color: #fff; }

/* Analyse de Claude */
.analyse { border-color: rgba(227, 32, 47, 0.45); }
.commentaire { margin: 0 0 6px; font-style: italic; font-size: 15px; }

/* Partie en direct */
.direct { border-color: var(--rouge); }
.echiquier {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
  max-width: 420px;
  margin: 6px auto;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #2a2a32;
}
.echiquier div {
  display: grid;
  place-items: center;
  font-size: clamp(22px, 8.5vw, 44px);
  line-height: 1;
  user-select: none;
}
.echiquier .cl { background: #d9d9de; }
.echiquier .cf { background: #7a1620; }
.echiquier .pb { color: #fff; text-shadow: 0 0 2px #000, 0 0 1px #000; }
.echiquier .pn { color: #0a0a0c; }
.pendule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 420px;
  margin: 0 auto;
  font-weight: 700;
}
.pendule b {
  font-family: ui-monospace, Consolas, monospace;
  background: #0d0d10;
  border: 1px solid var(--filet);
  border-radius: 8px;
  padding: 2px 10px;
}
.pendule b.trait { border-color: var(--rouge); color: #fff; background: rgba(227, 32, 47, 0.25); }
.jauge { height: 10px; background: #e9e9ee; border-radius: 5px; overflow: hidden; margin-top: 12px; }
.jauge .a { height: 100%; background: var(--rouge); width: 50%; transition: width 0.6s; }
.direct .legende { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; color: var(--sourdine); }
.lien-lichess { display: inline-block; margin-top: 10px; color: var(--texte); font-weight: 600; }
.parties .ligne-cotes td { border-top: 0; padding-top: 0; text-align: right; }
.cote-partie { min-height: 30px; padding: 4px 10px; font-size: 12px; font-weight: 600; margin-left: 6px; background: #0d0d10; border: 1px solid var(--filet); }
.cote-partie b { color: var(--rouge); font-family: ui-monospace, Consolas, monospace; }
.cote-partie:hover { border-color: var(--rouge); }

/* --- Page classement --- */
.page.large { max-width: 1080px; }
.nav { display: flex; justify-content: space-between; align-items: center; }
.nav a { color: var(--texte); font-weight: 700; text-decoration: none; border: 1px solid var(--filet); border-radius: 999px; padding: 6px 14px; background: var(--panneau); }
.grille-filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.grille-filtres label { margin-top: 0; }
.grille-filtres .case label { display: flex; gap: 8px; align-items: center; color: var(--texte); }
.grille-filtres .case input { width: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.carte-stat { background: var(--panneau); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 12px; }
.carte-stat .valeur { font-size: 22px; font-weight: 800; margin: 2px 0; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.marche-podium { background: var(--panneau); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 14px; text-align: center; }
.marche-podium.p1 { border-color: #d4af37; box-shadow: 0 0 0 1px #d4af37 inset; }
.marche-podium.moi { outline: 2px solid var(--rouge); }
.marche-podium .medaille { font-size: 28px; }
.marche-podium .pseudo { font-weight: 800; font-size: 18px; overflow-wrap: anywhere; }
.marche-podium .valeur { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 800; }
.plus { color: var(--vert); }
.moins { color: #ff6b74; }
.tableau-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tableau { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
.tableau th { text-align: left; color: var(--sourdine); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 6px; border-bottom: 1px solid var(--filet); white-space: nowrap; }
.tableau td { padding: 9px 6px; border-bottom: 1px solid var(--filet); white-space: nowrap; }
.tableau .n { text-align: right; font-family: ui-monospace, Consolas, monospace; }
.tableau th.n { font-family: inherit; }
.tableau tr.moi td { background: rgba(227, 32, 47, 0.12); }
.tableau .pseudo { font-weight: 700; }
.lien-classement { display: block; text-align: center; margin-top: 14px; color: var(--texte); font-weight: 700; border: 1px solid var(--rouge); border-radius: var(--rayon); padding: 12px; text-decoration: none; background: rgba(227, 32, 47, 0.1); }

.liens-direct { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.liens-direct a {
  color: var(--texte);
  font-size: 12px;
  border: 1px solid var(--filet);
  border-radius: 999px;
  padding: 4px 10px;
  text-decoration: none;
  background: var(--panneau);
}
.liens-direct a.twitch { border-color: #9146ff; background: rgba(145, 70, 255, 0.18); font-weight: 700; }

@media (min-width: 560px) {
  .duel { gap: 14px; }
  .vs { width: 72px; height: 72px; font-size: 22px; }
}

/* Bordures carrées partout (seul le rond « VS » de l'affiche est gardé). */
*, *::before, *::after { border-radius: 0 !important; }
.vs { border-radius: 50% !important; }
.marche-podium .medaille { font-size: 14px; font-weight: 800; letter-spacing: 0.2em; color: #d4af37; }
