:root {
  --fond: #091428;
  --fond-2: #0f1e36;
  --carte: #142540;
  --bord: #29405f;
  --texte: #f0e6d2;
  --doux: #a09b8c;
  --or: #c8aa6e;
  --or-vif: #f0c75e;
  --bleu: #3a8fd9;
  --rouge: #e0464a;
  --vert: #3fbf7f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #13284a 0%, var(--fond) 60%);
  color: var(--texte);
  font: 18px/1.4 "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  background: var(--carte);
  border: 1px solid var(--or);
  border-radius: 6px;
  padding: .45em 1em;
  cursor: pointer;
}
button:hover { background: #1d3456; }
button.principal { background: var(--or); color: var(--fond); font-weight: 700; }
button.principal:hover { background: var(--or-vif); }
button:disabled { opacity: .4; cursor: default; }

input, select {
  background: var(--fond-2);
  border: 1px solid var(--bord);
  border-radius: 6px;
  padding: .45em .7em;
}

/* --- Bandeau du haut : scores, modes, minuteur --- */

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--bord);
  background: rgba(0, 0, 0, .25);
}

h1 {
  margin: 0;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--or);
}

.centre { display: flex; flex-direction: column; align-items: center; gap: .5rem; }

h1 { cursor: pointer; }
.barre { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4rem; }
#titre-mode { color: var(--or-vif); font-weight: 700; padding: 0 .4rem; }
#son, #zero { padding: .45em .7em; }

.equipe { display: flex; align-items: center; gap: .6rem; }
.equipe.rouge { justify-content: flex-end; }
.equipe .nom {
  width: 11em;
  font-weight: 700;
  border-color: var(--bleu);
}
.equipe.rouge .nom { border-color: var(--rouge); text-align: right; }
.equipe .score {
  font-size: 2.6rem;
  font-weight: 800;
  min-width: 1.6em;
  text-align: center;
  color: var(--bleu);
}
.equipe.rouge .score { color: var(--rouge); }
.equipe .plus, .equipe .moins { width: 2.2em; padding: .3em 0; }

#chrono { min-width: 6.5em; }
#chrono.court { border-color: var(--rouge); color: var(--rouge); font-weight: 700; }

/* --- Scène du mode --- */

main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

.info { color: var(--doux); text-align: center; }

.reglage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin-bottom: 1.2rem;
  color: var(--doux);
}

.consigne {
  text-align: center;
  font-size: 1.15rem;
  color: var(--doux);
  margin: 0 0 1rem;
}

.deux-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.panneau {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-top: 4px solid var(--bleu);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}
.panneau.rouge { border-top-color: var(--rouge); }
.panneau h2 { margin: 0 0 .7rem; font-size: 1.1rem; }

.saisie { display: flex; gap: .5rem; }
.saisie input { flex: 1; min-width: 0; }

.message { min-height: 1.4em; margin: .5rem 0 0; color: var(--doux); font-size: .95rem; }
.message.erreur { color: var(--rouge); }

.resultat {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 1.3rem;
}
.resultat .gros { font-size: 1.8rem; font-weight: 800; color: var(--or-vif); }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1rem; }

/* --- Mode clubs --- */

.clubs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.club {
  background: var(--carte);
  border: 2px solid var(--or);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  justify-content: center;
  min-height: 9rem;
}
.club .anciens { font-size: .8rem; font-weight: 400; color: var(--doux); }
.club .marques { display: flex; justify-content: center; gap: .4rem; min-height: 1.2rem; }
.marque { width: 1rem; height: 1rem; border-radius: 50%; }
.marque.b0 { background: var(--bleu); }
.marque.b1 { background: var(--rouge); }

.reponse { margin-top: .8rem; font-size: 1.1rem; }
.reponse strong { color: var(--or-vif); }

.solutions { margin-top: 1rem; color: var(--doux); }
.solutions strong { color: var(--texte); }

/* --- Mode cible de kills --- */

.cible {
  text-align: center;
  font-size: 1rem;
  color: var(--doux);
  margin-bottom: 1rem;
}
.cible strong { display: block; font-size: 3.5rem; color: var(--or-vif); line-height: 1.1; }

.choisis { list-style: none; padding: 0; margin: .8rem 0; }
.choisis li {
  display: flex;
  justify-content: space-between;
  padding: .45rem .2rem;
  border-bottom: 1px solid var(--bord);
  font-size: 1.15rem;
  animation: apparait .4s ease-out;
}
.choisis li span:last-child { font-weight: 700; color: var(--or-vif); }

.total { display: flex; justify-content: space-between; font-size: 1.4rem; font-weight: 800; }
.total.depasse { color: var(--rouge); }

.jauge {
  height: 14px;
  background: var(--fond-2);
  border-radius: 7px;
  overflow: hidden;
  margin: .5rem 0;
  position: relative;
}
.jauge div { height: 100%; background: var(--bleu); transition: width .5s ease-out; }
.panneau.rouge .jauge div { background: var(--rouge); }
.jauge.depasse div { background: var(--doux); }

@keyframes apparait {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* --- Mode draft --- */

.draft {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
}
.cote h2 { margin: 0 0 .6rem; text-align: center; min-height: 1.6em; }
.cote.bleu h2 { color: var(--bleu); }
.cote.rouge h2 { color: var(--rouge); }

.pick {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--carte);
  border-radius: 8px;
  padding: .4rem;
  margin-bottom: .5rem;
}
.cote.rouge .pick { flex-direction: row-reverse; text-align: right; }
.pick img, .pick .vide { width: 64px; height: 64px; border-radius: 6px; flex: none; }
.pick .vide { background: var(--fond-2); display: grid; place-items: center; font-size: .7rem; padding: 2px; text-align: center; }
.pick .nom-champ { font-weight: 700; }
.pick .role { color: var(--doux); font-size: .85rem; }
.pick .joueur { color: var(--or-vif); font-weight: 700; }
.pick.cliquable { cursor: pointer; }
.pick.cliquable:hover { outline: 1px solid var(--or); }
.pick.cliquable .joueur { color: var(--bord); }

.indice .valeur .regions { font-size: 1.05rem; }
.r-bleu { color: var(--bleu); }
.r-rouge { color: var(--rouge); }

.bans { display: flex; gap: .3rem; justify-content: center; margin-top: .6rem; }
.bans img, .bans .vide { width: 36px; height: 36px; border-radius: 4px; filter: grayscale(1) brightness(.6); }
.bans .vide { background: var(--fond-2); font-size: .5rem; display: grid; place-items: center; overflow: hidden; }

.milieu { display: flex; flex-direction: column; gap: .8rem; align-items: center; min-width: 14rem; }
.indice {
  width: 100%;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 8px;
  padding: .7rem;
  text-align: center;
}
.indice .label { color: var(--doux); font-size: .85rem; }
.indice .valeur { font-size: 1.4rem; font-weight: 800; color: var(--or-vif); }
.indice.cache .valeur { color: var(--bord); }

/* --- Accueil : les modes en cartes illustrées --- */

.bienvenue { text-align: center; margin-bottom: 1.2rem; font-size: 1.15rem; }
.bienvenue .info { font-size: .9rem; }

.cartes-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}
.carte-mode {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: .45rem;
  min-height: 260px;
  padding: 1.1rem;
  text-align: left;
  border: 1px solid var(--or);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 20, 40, .1) 0%, rgba(9, 20, 40, .75) 50%, rgba(9, 20, 40, .97) 100%),
    var(--image) center 20% / cover;
  transition: transform .25s ease, box-shadow .25s ease;
  animation: arrivee .5s ease-out backwards;
  animation-delay: calc(var(--i) * 70ms);
}
.carte-mode:hover, .carte-mode:focus-visible {
  background:
    linear-gradient(180deg, rgba(9, 20, 40, 0) 0%, rgba(9, 20, 40, .65) 50%, rgba(9, 20, 40, .95) 100%),
    var(--image) center 20% / cover;
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 30px rgba(200, 170, 110, .25);
}
.nom-mode { font-size: 1.5rem; font-weight: 800; color: var(--or-vif); }
.regle { color: var(--texte); font-size: .95rem; }
.jouer { align-self: flex-end; font-weight: 700; color: var(--or); }
.niveau {
  position: absolute;
  top: .8rem;
  left: .8rem;
  padding: .15rem .6rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--vert);
  color: var(--fond);
}
.niveau.connaisseur { background: var(--bleu); color: #fff; }
.niveau.expert { background: var(--rouge); color: #fff; }

/* --- Animations --- */

@keyframes arrivee { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes bond { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes secoue { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes envol { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-60px); } }
@keyframes eclat {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
@keyframes retourne { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes lueur { 0%, 100% { box-shadow: 0 0 0 rgba(240, 199, 94, 0); } 50% { box-shadow: 0 0 24px rgba(240, 199, 94, .7); } }

main.entree > * { animation: arrivee .4s ease-out backwards; }
main.entree > *:nth-child(2) { animation-delay: .05s; }
main.entree > *:nth-child(3) { animation-delay: .1s; }
main.entree > *:nth-child(n+4) { animation-delay: .15s; }
.bond { animation: bond .45s ease-out; }
.secoue { animation: secoue .4s ease-in-out; }
.pop { animation: pop .45s ease-out; }
.lueur { animation: lueur 1.2s ease-in-out 2; }

.equipe { position: relative; }
.flottant {
  position: absolute;
  top: -.4rem;
  left: 50%;
  font-weight: 800;
  font-size: 1.4rem;
  pointer-events: none;
  animation: envol 1.1s ease-out forwards;
}
.flottant.plus { color: var(--vert); }
.flottant.moins { color: var(--rouge); }

.confetti {
  position: fixed;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 50;
  animation: eclat 1.3s cubic-bezier(.2, .7, .4, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* --- Chrono en anneau (dans un mode) --- */

.anneau {
  --part: 360deg;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--or-vif) var(--part), var(--fond-2) 0);
  margin: 0 auto;
}
.anneau span {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fond);
  font-size: 1.6rem;
  font-weight: 800;
}
.anneau.urgent { background: conic-gradient(var(--rouge) var(--part), var(--fond-2) 0); }
.anneau.urgent span { color: var(--rouge); }

/* --- « Le savais-tu ? » --- */

.lien {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted var(--or);
  text-underline-offset: 3px;
  cursor: help;
}
.lien:hover { color: var(--or-vif); background: none; }
.resume { display: block; color: var(--doux); font-size: .9rem; margin-top: .2rem; }

.fond-fiche {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 8, 18, .75);
  animation: arrivee .2s ease-out;
}
.fond-fiche.sortie { opacity: 0; transition: opacity .2s; }
.fiche {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--carte);
  border: 1px solid var(--or);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  animation: pop .35s ease-out;
}
.fiche h2 { margin: .2rem 0 .4rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.fiche h3 { margin: .2rem 0 .4rem; font-size: .9rem; color: var(--doux); text-transform: uppercase; letter-spacing: .06em; }
.fiche .bloc { margin-top: .9rem; }
.fiche-titre { color: var(--or); font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; }
.fiche .fermer { position: absolute; top: .6rem; right: .6rem; padding: .2em .55em; }
.fiche-image { height: 170px; margin: .6rem -1.4rem .6rem; background: center 25% / cover; }
.titre-champ { color: var(--or-vif); font-style: italic; margin-top: 0; }
.titres { color: var(--or-vif); font-weight: 700; }
.etiquette {
  font-size: .75rem;
  font-weight: 600;
  padding: .1rem .55rem;
  border-radius: 99px;
  background: var(--fond-2);
  border: 1px solid var(--bord);
  color: var(--doux);
}
.rangee { display: flex; flex-wrap: wrap; gap: .6rem; }
.champ-mini { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .8rem; }
.vignette { width: 48px; height: 48px; border-radius: 6px; }
.vignette.vide { display: inline-grid; place-items: center; background: var(--fond-2); font-size: .6rem; }
.parcours { display: flex; flex-wrap: wrap; gap: .35rem; }
.puce { padding: .2rem .55rem; border-radius: 6px; background: var(--fond-2); border: 1px solid var(--bord); font-size: .85rem; }
.puce small { color: var(--doux); }

/* --- La Faille en or --- */

.question-faille { text-align: center; font-size: 1.5rem; font-weight: 800; margin: .2rem 0 1rem; }
.plateau {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  max-width: 900px;
  margin: 0 auto 1rem;
  perspective: 800px;
}
.case {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 62px;
  padding: .4rem .8rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d3a66, #142540);
  border: 1px solid var(--bord);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: left;
}
.case .rang {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--fond);
  color: var(--or);
  flex: none;
}
.case .valeur { margin-left: auto; color: var(--or-vif); font-size: .95rem; }
.case.trouvee { background: linear-gradient(180deg, #2c5a3f, #1d3b2b); border-color: var(--vert); animation: retourne .5s ease-out; }
.case.manquee { background: linear-gradient(180deg, #4a2328, #2a1518); border-color: var(--rouge); animation: retourne .5s ease-out; }
.case.cachee { color: var(--bord); }
.case .vignette { width: 42px; height: 42px; }
.croix { display: flex; justify-content: center; gap: .5rem; min-height: 3.2rem; }
.croix span { font-size: 2.6rem; font-weight: 900; color: var(--rouge); animation: pop .35s ease-out; }
.pot { text-align: center; color: var(--doux); }
.pot strong { font-size: 1.6rem; color: var(--or-vif); }
.main-equipe { text-align: center; font-size: 1.15rem; margin-bottom: .6rem; }
.main-equipe strong { color: var(--bleu); }
.main-equipe strong.rouge { color: var(--rouge); }
.saisie-centre { display: flex; gap: .5rem; max-width: 560px; margin: 0 auto; }
.saisie-centre input { flex: 1; min-width: 0; font-size: 1.1rem; }

/* --- Les enchères --- */

.theme { text-align: center; font-size: 1.4rem; font-weight: 800; margin: .4rem 0; }
.encheres { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 820px; margin: 0 auto; }
.mise { font-size: 3rem; font-weight: 900; text-align: center; color: var(--or-vif); }
.mise.meneur { animation: lueur 1.2s ease-in-out 1; }
.boutons-mise { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.cites { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1rem 0; min-height: 2.5rem; }
.cites .puce { animation: pop .35s ease-out; background: #1d3b2b; border-color: var(--vert); }
.compteur { text-align: center; font-size: 2.2rem; font-weight: 900; }
.compteur.reussi { color: var(--vert); }

/* --- La chaîne des coéquipiers --- */

.chaine { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem; margin: 1rem 0; }
.maillon {
  padding: .5rem .8rem;
  border-radius: 10px;
  background: var(--carte);
  border: 2px solid var(--bleu);
  text-align: center;
  animation: pop .4s ease-out;
}
.maillon.rouge { border-color: var(--rouge); }
.maillon.depart { border-color: var(--or); }
.maillon .nom-joueur { font-size: 1.15rem; font-weight: 800; }
.maillon small { display: block; color: var(--doux); font-size: .75rem; }
.fleche { color: var(--or); font-size: 1.4rem; }
.tour { text-align: center; font-size: 1.2rem; margin: .4rem 0; }
.tour strong, .main-equipe strong { color: var(--bleu); }
.tour strong.rouge { color: var(--rouge); }
p.message { text-align: center; }

/* --- Le bracket des Worlds --- */

.bracket { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; align-items: center; }
.colonne { display: flex; flex-direction: column; gap: 1rem; justify-content: space-around; height: 100%; }
.colonne h3 { text-align: center; color: var(--doux); margin: 0; font-size: .9rem; text-transform: uppercase; }
.match {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .5rem;
}
.match.juste { border-color: var(--vert); animation: pop .4s ease-out; }
.match.faux { border-color: var(--rouge); animation: secoue .4s ease-in-out; }
.equipe-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  width: 100%;
  padding: .35rem .5rem;
  margin: .15rem 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--fond-2);
  text-align: left;
}
.equipe-match.choisie { border-color: var(--or); background: #2b2614; }
.equipe-match small { color: var(--doux); }
.equipe-match.vide { color: var(--bord); cursor: default; }
.score-match { display: flex; gap: .3rem; justify-content: center; margin-top: .3rem; }
.score-match button { padding: .15em .6em; font-size: .85rem; }
.score-match button.choisi { background: var(--or); color: var(--fond); }
.verdict { text-align: center; font-size: .85rem; margin-top: .3rem; }

/* --- Écran étroit (téléphone, fenêtre réduite) --- */

@media (max-width: 900px) {
  header { grid-template-columns: 1fr 1fr; padding: .6rem 16px; }
  .centre { grid-column: 1 / -1; grid-row: 1; }
  #modes { flex-wrap: wrap; justify-content: center; }
  .equipe .nom { width: 100%; min-width: 0; }
  .equipe .score { font-size: 1.8rem; }
  main { padding: 1rem 16px; }
  .clubs { grid-template-columns: repeat(2, 1fr); }
  .club { font-size: 1.1rem; padding: 1rem .5rem; min-height: 6rem; }
  .deux-cols, .draft, .encheres, .bracket, .plateau { grid-template-columns: 1fr; }
  .milieu { min-width: 0; }
}

footer {
  padding: .8rem 1.5rem 1.2rem;
  color: var(--doux);
  font-size: .75rem;
  text-align: center;
  border-top: 1px solid var(--bord);
}
footer p { max-width: 70rem; margin: .3rem auto; }
footer a { color: var(--or); }
