:root {
  --rose: rgb(91, 5, 54);
  --rose-clair: rgb(239, 163, 224);
  --orange: rgb(255, 166, 0);
  --blanc: #f1f1f1;
  --vert: rgb(125, 241, 129);
  --rouge: rgb(241, 125, 125);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: no-repeat center / cover fixed radial-gradient(var(--rose-clair), var(--rose));
  font-family: Arial, Helvetica, sans-serif;
}

h1 {
  text-align: center;
  margin: clamp(1.5rem, 5vw, 3rem) 1rem;
  font-size: clamp(1.3rem, 5vw, 2.2rem);
  line-height: 1.3;
  color: var(--blanc);
  text-transform: uppercase;
}

h1 span {
  color: var(--orange);
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.quizz-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(0.5rem, 3vw, 1.5rem);
  margin-bottom: 3rem;
}

/* Grille responsive : 1 colonne sur mobile, jusqu'à 4 sur grand écran */
.container-question {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: clamp(0.8rem, 2vw, 1.5rem);
}

.box-question {
  background: var(--orange);
  padding: clamp(1rem, 3vw, 1.8rem);
  box-shadow: 0 5px 5px 0 rgba(0, 0, 0, .3);
  border-radius: 15px;
}

.box-question h4 {
  color: var(--rose);
  margin-bottom: 1rem;
  line-height: 1.35;
}

.box-question > div {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.box-question input[type="radio"] {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--rose);
  cursor: pointer;
}

.box-question label {
  flex: 1;
  font-weight: bold;
  color: var(--blanc);
  padding: 0.4rem 0;
  cursor: pointer;
}

.resultat {
  color: var(--rose);
  background: var(--orange);
  width: 100%;
  max-width: 400px;
  margin: 2rem auto 0;
  padding: 1rem;
  border-radius: 15px;
  box-shadow: 0 5px 5px 0 rgba(0, 0, 0, .3);
  transition: background-color .3s ease-in-out;
}

.resultat.succes {
  background: var(--vert);
}

.resultat.echec {
  background: var(--rouge);
}

button {
  display: block;
  padding: 1rem 2rem;
  background: var(--rose);
  color: var(--blanc);
  border: none;
  border-radius: 5px;
  margin: 0 auto;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: background .2s ease-in-out;
}

button:hover {
  background: rgba(91, 5, 54, .8);
}

button:focus-visible,
.box-question input:focus-visible {
  outline: 3px solid var(--blanc);
  outline-offset: 2px;
}

.resultat h2 {
  color: var(--rose);
  font-size: 1rem;
  text-align: center;
  margin: 1rem 0;
}

.score {
  font-size: 1.5rem;
  font-weight: 400;
  text-align: center;
}

.score span,
.info {
  display: block;
  margin: 0.5rem 0;
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  font-weight: 700;
  text-align: center;
}

/* ================= Ajouts : inscription, barre du haut, classement ================= */

[hidden] {
  display: none !important;
}

/* ---------- Barre fixe du quiz ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(91, 5, 54, .94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--blanc);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .6rem clamp(.8rem, 3vw, 1.5rem);
}

.topbar .joueur {
  max-width: 32%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
}

.topbar .progression {
  flex: 1;
  text-align: center;
  font-size: .85rem;
  line-height: 1.25;
}

.topbar .progression small {
  display: block;
  opacity: .8;
}

.bar {
  height: 5px;
  background: rgba(255, 255, 255, .2);
}

.bar > div {
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width .25s ease;
}

/* la validation native ne doit pas cacher la question sous la barre */
.box-question,
.box-question input {
  scroll-margin-top: 6rem;
}

/* ---------- Boutons-liens ---------- */
.btn {
  display: inline-block;
  padding: .75rem 1.2rem;
  background: var(--orange);
  color: var(--rose);
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .2s ease;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn-petit {
  padding: .5rem .85rem;
  font-size: .85rem;
}

.btn-rose {
  background: var(--rose);
  color: var(--blanc);
}

.btn-rose:hover {
  background: rgba(91, 5, 54, .8);
  filter: none;
}

.btn.bloc {
  display: block;
  margin-top: 1rem;
}

.btn:focus-visible {
  outline: 3px solid var(--blanc);
  outline-offset: 2px;
}

/* ---------- Résultat du quiz ---------- */
.resultat .rang-info {
  text-align: center;
  font-weight: 700;
  margin: .6rem 0;
}

.resultat .btn {
  display: block;
  margin-top: 1rem;
}

button:disabled {
  opacity: .6;
  cursor: wait;
}

/* ---------- Page d'inscription ---------- */
.page-simple {
  padding: 0 1rem 3rem;
}

.carte {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2rem);
  background: var(--orange);
  color: var(--rose);
  border-radius: 15px;
  box-shadow: 0 5px 5px 0 rgba(0, 0, 0, .3);
}

.carte h2 {
  margin-bottom: .5rem;
}

.carte p {
  line-height: 1.4;
  margin-bottom: 1rem;
}

.carte label {
  display: block;
  font-weight: 700;
  margin-bottom: .4rem;
}

.champ {
  display: flex;
  gap: .5rem;
}

.champ input {
  flex: 1;
  min-width: 0;
  padding: .85rem 1rem;
  font-size: 1rem;
  color: var(--rose);
  background: var(--blanc);
  border: 2px solid transparent;
  border-radius: 8px;
}

.champ input:focus-visible {
  outline: none;
  border-color: var(--rose);
}

.btn-de {
  padding: .5rem .9rem;
  font-size: 1.2rem;
}

.erreur {
  min-height: 1.4em;
  margin: .6rem 0 .4rem !important;
  font-weight: 700;
  color: #7a0000;
}

.carte button[type="submit"] {
  width: 100%;
}

.lien {
  display: block;
  margin: 1rem auto 0;
  padding: .3rem;
  background: none;
  color: var(--rose);
  font-weight: 700;
  text-decoration: underline;
}

.lien:hover {
  background: none;
}

.carte .bas {
  margin: 1.2rem 0 0;
  text-align: center;
}

.carte .bas a {
  color: var(--rose);
  font-weight: 700;
}

/* ---------- Classement ---------- */
.page-classement {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.barre-outils {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
}

.resume {
  margin: 1rem 0;
  text-align: center;
  color: var(--blanc);
  font-weight: 700;
}

.liste {
  list-style: none;
  display: grid;
  gap: .6rem;
}

.ligne {
  display: grid;
  grid-template-columns: 2.8rem 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  background: var(--orange);
  color: var(--rose);
  border-radius: 12px;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, .3);
}

.ligne .rang {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.ligne .nom {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.ligne .nom small {
  display: block;
  font-weight: 400;
  font-size: .75rem;
  opacity: .8;
}

.ligne .pts {
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
}

.ligne.podium .rang {
  font-size: 1.6rem;
}

.ligne.moi {
  background: var(--blanc);
  outline: 3px solid var(--vert);
}

@media (max-width: 380px) {
  .topbar .joueur {
    display: none;
  }
  .ligne {
    grid-template-columns: 2.2rem 1fr auto;
    padding: .7rem;
  }
}
