/* ==========================================================================
   Parties à plusieurs — styles propres aux pages /multi/
   ========================================================================== */

.mp-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
.mp-side { display: grid; gap: 22px; }
.panel h2 { font-size: 1.5rem; margin-bottom: 18px; }

/* Formulaires */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-weight: 750; }
.field input {
  width: 100%; min-height: 58px; padding: .7em 1em; border-radius: 14px; border: 2px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1.2rem;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field .code-input { padding-left: 1.2em; font-size: 2.2rem; font-weight: 800; letter-spacing: .45em; text-align: center; font-variant-numeric: tabular-nums; }
.form-error { display: none; margin: 0 0 16px; }
.form-error.on { display: flex; }
.note { margin: 16px 0 0; color: var(--muted); font-size: .92rem; }
.note i svg { width: 15px; height: 15px; vertical-align: -2px; }

/* Comment ça marche */
.how { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: h; }
.how li { display: flex; gap: 14px; align-items: flex-start; }
.how li::before {
  counter-increment: h; content: counter(h); flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800;
}
.how b { display: block; }
.how span { color: var(--muted); font-size: .97rem; }

/* Choix de l'atelier */
.choix-atelier { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 22px; }
.choix-atelier button {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 750; font-size: 1.05rem; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.choix-atelier button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.choix-atelier button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.choix-atelier .ico-tile { width: 44px; height: 44px; border-radius: 14px; }
.choix-atelier .ico-tile svg { width: 22px; height: 22px; }
.choix-atelier small { display: block; color: var(--muted); font-weight: 600; font-size: .85rem; }

/* Grand code à projeter */
.lobby { text-align: center; padding: clamp(24px, 4vw, 44px); }
.lobby .go-to { margin: 0 0 18px; font-size: clamp(1.1rem, 2.4vw, 1.5rem); color: var(--muted); font-weight: 650; }
.lobby .go-to b { color: var(--ink); }
.big-code { display: flex; justify-content: center; gap: clamp(8px, 1.6vw, 16px); margin: 0 0 18px; }
.big-code span {
  display: grid; place-items: center; width: clamp(64px, 12vw, 128px); aspect-ratio: .82; border-radius: 24px;
  background: var(--grad); color: #fff; font-size: clamp(3rem, 9vw, 6.5rem); font-weight: 800; box-shadow: 0 22px 40px -22px rgba(91, 76, 240, .9);
  animation: pop-in .4s ease both;
}
.big-code span:nth-child(2) { animation-delay: .06s; }
.big-code span:nth-child(3) { animation-delay: .12s; }
.big-code span:nth-child(4) { animation-delay: .18s; }
.lobby .atelier-pill { display: inline-flex; align-items: center; gap: 10px; padding: .4em 1em .4em .4em; border-radius: 999px; background: var(--surface-2); font-weight: 750; }
.lobby .atelier-pill .ico-tile { width: 34px; height: 34px; border-radius: 11px; }
.lobby .atelier-pill .ico-tile svg { width: 18px; height: 18px; }

.lobby-players { margin-top: 26px; }
.lobby-players h2 { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.35rem; margin-bottom: 16px; }
.count { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 48px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: .55em 1.1em; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-weight: 750; font-size: 1.08rem; animation: pop-in .35s ease both;
}
.chip.moi { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip .kick { margin-right: -.5em; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: 1.1rem; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: bounce 1.2s ease infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

/* Bouton « retirer » (animateur) */
.kick {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; transition: background .15s, color .15s;
}
.kick:hover, .kick.sure { background: var(--red-soft); color: var(--red); }
.kick.sure { width: auto; padding: 0 12px; border-radius: 999px; font-size: .85rem; font-weight: 800; }

/* Retour dans la partie (animateur) : bouton ↩, demandes, participants retirés */
.revenir {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--green-soft); color: var(--green); font-size: 1.05rem; font-weight: 800; line-height: 1; cursor: pointer;
}
.revenir:hover { background: var(--green); color: #fff; }
.revenir:disabled { opacity: .5; cursor: default; }
.racer .acts { display: flex; align-items: center; gap: 6px; }
.chip.parti { border-style: dashed; color: var(--muted); box-shadow: none; }
.chip small { color: var(--muted); font-size: .8rem; font-weight: 700; }
.chip .revenir { width: 26px; height: 26px; font-size: .95rem; }
.demandes { display: grid; gap: 10px; margin-bottom: 22px; }
.demande {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 18px; border-radius: 18px;
  border: 2px solid var(--green); background: var(--green-soft); box-shadow: var(--shadow-sm); animation: pop-in .35s ease both;
}
.demande .emoji { font-size: 1.8rem; line-height: 1; }
.demande p { flex: 1; min-width: 220px; margin: 0; font-size: 1.12rem; }
.demande small { display: block; margin-top: 2px; color: var(--muted); font-size: .9rem; font-weight: 650; }
.retires { margin-top: 30px; padding: 18px 20px; border-radius: 20px; border: 2px dashed var(--line-strong); }
.retires h2 { margin: 0 0 12px; font-size: 1.15rem; }
.retires ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.retires li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.retires li small { color: var(--muted); font-weight: 650; }
.retires li .btn { margin-left: auto; }
.alerte-anim { margin-bottom: 16px; }

/* Participant qui attend de pouvoir revenir */
.attente-retour { text-align: center; }
.attente-retour .big { display: block; font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.attente-retour p { color: var(--muted); font-size: 1.08rem; }
.attente-retour .waiting { margin: 20px 0; }

/* En-tête de course */
.race-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-bottom: 20px; padding: 16px 20px;
  border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.race-head .titre { display: flex; align-items: center; gap: 14px; min-width: 0; }
.race-head .titre b { display: block; font-size: 1.2rem; }
.race-head .titre small { color: var(--muted); font-weight: 650; }
.race-head .chrono { margin-left: auto; font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.code-tag { padding: .3em .8em; border-radius: 12px; background: var(--surface-2); font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }

/* Classement en direct */
.race { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.racer {
  position: relative; display: grid; grid-template-columns: 50px minmax(0, 1fr) minmax(110px, 1.25fr) auto auto; align-items: center; gap: 16px;
  padding: 12px 16px 12px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.racer .rk { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--surface-2); font-weight: 800; font-size: 1.1rem; }
.racer .rk.medal { background: none; font-size: 1.9rem; }
.racer .who { min-width: 0; }
.racer .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.12rem; }
.racer .who em { font-style: normal; color: var(--primary); }
.racer .who small { color: var(--muted); font-weight: 650; }
.racer .res { min-width: 70px; text-align: right; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.racer.fini { border-color: #bbf7d0; background: linear-gradient(90deg, var(--green-soft), var(--surface) 70%); }
.racer.moi { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.racer.absent .who b, .racer.parti .who b, .racer.peut-revenir .who b { opacity: .55; }
.racer.absent .who small::after { content: " · hors ligne"; }
.racer.parti .who small::after { content: " · a quitté la partie"; }
.racer.peut-revenir .who small::after { content: " · peut revenir"; color: var(--green); }
.racer.arrive { animation: pop-in .4s ease both; }
.racer:not(:has(.kick)) { grid-template-columns: 50px minmax(0, 1fr) minmax(110px, 1.25fr) auto; }
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segs i { height: 12px; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.segs i.on { background: var(--grad); box-shadow: none; }
.racer.fini .segs i.on { background: linear-gradient(90deg, #22c55e, #0ea5a0); }
.segs i.pop { animation: seg-pop .7s ease; }
@keyframes seg-pop { 0% { transform: scaleY(1); filter: brightness(1.8); } 35% { transform: scaleY(1.9); } 100% { transform: none; filter: none; } }
.empty { padding: 26px; border-radius: 20px; border: 2px dashed var(--line-strong); color: var(--muted); text-align: center; font-weight: 650; }

/* Podium */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: clamp(8px, 2vw, 18px); margin: 8px 0 36px; }
.place { display: flex; flex-direction: column; align-items: center; gap: 2px; width: min(31%, 220px); min-width: 0; text-align: center; animation: rise .7s ease both; }
.place .medal { font-size: clamp(2.4rem, 6vw, 3.4rem); line-height: 1.1; }
.place b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(1rem, 2.6vw, 1.35rem); }
.place small { color: var(--muted); font-weight: 650; font-size: .88rem; }
.place.moi b { color: var(--primary); }
.place .socle {
  display: grid; place-items: center; width: 100%; margin-top: 10px; border-radius: 20px 20px 6px 6px; color: #fff;
  font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; background: linear-gradient(160deg, var(--g1), var(--g2)); box-shadow: 0 20px 34px -20px var(--g1);
}
.p1 { --g1: #f5b021; --g2: #ea8a00; animation-delay: .5s; }
.p1 .socle { height: 170px; }
.p2 { --g1: #a3b1c6; --g2: #64748b; animation-delay: .25s; }
.p2 .socle { height: 120px; }
.p3 { --g1: #f08a4b; --g2: #c2410c; }
.p3 .socle { height: 88px; }

/* Résultat du participant */
.result-hero { text-align: center; padding: clamp(24px, 4vw, 40px); }
.result-hero .big { display: block; font-size: clamp(3rem, 10vw, 5rem); line-height: 1; margin-bottom: 10px; }
.result-hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 8px; }
.result-hero p { margin: 0 auto; color: var(--muted); font-size: 1.12rem; max-width: 560px; }
.result-hero .btn-row { justify-content: center; margin-top: 22px; }
.section-title { margin: 34px 0 14px; font-size: 1.35rem; }

/* Compte à rebours */
.countdown {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; text-align: center;
  background: rgba(15, 18, 40, .86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff;
}
.countdown span { display: block; font-size: clamp(7rem, 32vw, 15rem); font-weight: 800; line-height: 1; animation: count .9s ease both; }
.countdown span.mot { font-size: clamp(4rem, 16vw, 9rem); }
.countdown small { display: block; margin-top: 10px; font-size: 1.3rem; font-weight: 700; opacity: .8; }
@keyframes count { 0% { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(.92); opacity: .95; } }

@media (max-width: 900px) {
  .mp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .racer, .racer:not(:has(.kick)) { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px 12px; }
  .racer .rk { width: 40px; height: 40px; }
  .racer .segs { grid-column: 2 / -1; grid-row: 2; }
  .racer .acts { grid-column: 3; grid-row: 1; justify-self: end; }
  .racer:has(.kick) .res { display: none; }
  .race-head .chrono { margin-left: 0; width: 100%; }
}
