/* Classement et ligues : position sur l'écran de fin, panneau plein écran, récap d'accueil, écran « Rejoindre », pied de page. */

/* ---------- Écran de fin : position discrète + bouton ---------- */
.scoreboard__rank { margin-top: 2px; font-weight: 700; font-size: clamp(0.82rem, 1.9vh, 1rem); opacity: 0.9; }
.scoreboard__rank:empty { display: none; }
.rank-btn {
  margin-top: clamp(4px, 0.9vh, 8px); padding: 4px 16px;
  font: inherit; font-weight: 800; font-size: clamp(0.85rem, 2vh, 1rem); color: var(--yellow);
  background: transparent; border: 2px solid var(--yellow); border-radius: 999px; cursor: pointer;
}
.rank-btn:active { background: rgba(255, 214, 46, 0.18); }

/* ---------- Panneau classement ---------- */
body.has-panel { overflow: hidden; }
.panel {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  color: var(--white); background: var(--ink);
  animation: fade-in 0.2s;
}
.panel > * { width: min(100%, 30rem); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel__title { font-family: var(--font-display); font-weight: 900; font-size: 2.1rem; line-height: 1; color: var(--yellow); }
.panel__close {
  width: 44px; height: 44px; font: inherit; font-weight: 900; font-size: 1.2rem; color: var(--ink);
  background: var(--white); border: var(--border); border-radius: 50%; cursor: pointer;
}
.panel__sub { margin: -6px 0 0; font-weight: 700; font-size: 0.85rem; opacity: 0.8; }
.panel__tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.panel__tab {
  flex: 0 0 auto; max-width: 60%; padding: 6px 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: inherit; font-weight: 800; color: var(--white); background: transparent; border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 999px; cursor: pointer;
}
.panel__tab.is-active { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.board { display: flex; flex-direction: column; gap: 6px; }
.board__row {
  display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: center; gap: 8px;
  padding: 8px 12px; color: var(--ink); background: var(--white); border: 3px solid transparent; border-radius: 14px; font-weight: 800;
}
.board__row.is-me { background: var(--yellow); border-color: var(--white); box-shadow: 0 0 0 3px var(--yellow); }
.board__rank { font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; text-align: center; }
.board__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__you { margin-left: 8px; padding: 1px 8px; font-size: 0.7rem; color: var(--white); background: var(--ink); border-radius: 999px; vertical-align: 2px; }
.board__pts { font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.board__gap { text-align: center; opacity: 0.6; line-height: 0.6; }
.panel__status { margin-top: 10px; font-weight: 700; text-align: center; }
.panel__status:empty { display: none; }
.panel__status .link-btn { padding: 0 4px; }
.panel__foot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.panel__age { font-size: 0.75rem; opacity: 0.7; }
.panel__actions { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.panel__actions .btn { width: 100%; }
.panel__actions .link-btn { font-size: 0.9rem; }

/* ---------- Récap de la veille sur l'accueil ---------- */
.recap-slot:empty { display: none; }
.recap {
  position: relative; margin-bottom: 12px; padding: 12px 14px;
  color: var(--ink); background: var(--white); border: var(--border); border-radius: var(--radius); box-shadow: 0 6px 0 var(--ink);
  animation: toast-in 0.4s both;
}
.recap__phrase { font-family: var(--font-display); font-weight: 900; font-size: clamp(1.3rem, 5.6vw, 1.75rem); line-height: 1.08; }
.recap__podium { display: flex; justify-content: space-between; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.recap__place {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 3px; padding: 2px 4px;
  font-size: 0.78rem; font-weight: 700; border-radius: 8px; white-space: nowrap;
}
.recap__place.is-me { background: var(--yellow); }
.recap__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.recap__place b { font-variant-numeric: tabular-nums; }
.recap__me { margin: 6px 0 0; font-weight: 700; font-size: 0.82rem; opacity: 0.85; }
.recap__crown { position: absolute; top: -34px; right: 16px; font-size: 2.3rem; animation: crown 1.6s ease-in-out infinite alternate; transform-origin: 50% 90%; }
@keyframes crown { from { transform: rotate(-10deg) translateY(0); } to { transform: rotate(10deg) translateY(-6px); } }
/* Avec le récap, les règles (déjà connues) laissent la place : le bouton Jouer reste visible sans scroll */
.has-recap .rules { display: none; }
.has-recap .hero { padding-top: 10px; margin-bottom: 10px; }

/* Petits écrans : les 8 premières lignes du panneau tiennent sans défiler */
@media (max-height: 720px) {
  .board { gap: 4px; }
  .board__row { padding: 5px 12px; }
  .board__rank, .board__pts { font-size: 1.15rem; }
  .panel { gap: 8px; }
  .panel__title { font-size: 1.9rem; }
}

/* ---------- Écran « Rejoindre une ligue » ---------- */
.join__title { font-family: var(--font-display); font-weight: 900; font-size: 2rem; line-height: 1; }
.join__text { font-weight: 600; }
.join__wait { font-weight: 700; text-align: center; }
.join__later { align-self: center; }

/* ---------- Pied de page de l'accueil : confidentialité, discret ---------- */
.privacy { margin-top: 14px; text-align: center; color: var(--white); text-shadow: 0 1px 0 var(--ink); }
.privacy__text { font-size: 0.75rem; font-weight: 600; opacity: 0.9; }
.privacy__links { display: flex; justify-content: center; gap: 4px 14px; flex-wrap: wrap; }
.privacy .link-btn { padding: 4px 2px; font-size: 0.78rem; font-weight: 600; opacity: 0.9; }

/* ---------- Fenêtres : saisie ---------- */
.modal__input { width: 100%; margin-bottom: 8px; }
.modal__link { font-size: 0.9rem; }
.modal__actions--stack { flex-direction: column; align-items: stretch; gap: 8px; }
.modal__actions--stack .link-btn { align-self: center; }

@media (prefers-reduced-motion: reduce) { .recap, .recap__crown { animation: none; } }

.panel__privacy { margin: 0; font-size: 0.72rem; text-align: center; opacity: 0.8; }
.panel__privacy .link-btn { padding: 0; font-size: 0.72rem; color: var(--white); }
