/* Bankroll — habillage commun (accueil, lobby, chrome du jeu). */

:root {
  --bg: #14161c;
  --bg-soft: #1c1f28;
  --bg-card: #1f232e;
  --line: #2c3140;
  --text: #eef1f7;
  --muted: #98a0b3;
  /* L'or porte la marque : c'est lui qu'on retrouve sur les boutons, les onglets
     actifs et le focus des champs. `--accent-ink` est la couleur du texte qu'on
     pose dessus — jamais du blanc, illisible sur un fond aussi clair. */
  --accent: #f2c11b;
  --accent-ink: #16180f;
  --accent-soft: rgba(242, 193, 27, 0.14);
  --blue: #2f8bff;
  --accent-2: #4ccf6a;
  --danger: #e8493a;
  --gold: #f2c11b;
  --silver: #ccd4e2;
  --bronze: #cd7f32;
  --radius: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Nos sections utilisent display:grid/flex, qui l'emporterait sur l'attribut hidden. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  /* Aucun écran ne doit jamais défiler latéralement : c'est la règle, et ce
     garde-fou la tient même si un contenu déborde par accident. */
  max-width: 100%;
  overflow-x: hidden;
}

/* Le fond vit sur la racine, pas seulement sur le corps : la page de jeu ancre
   le sien en position fixe, et un corps positionné ne peint plus le fond de la
   page — tout ce qui dépassait apparaissait alors en blanc. */
html {
  background: var(--bg);
}

body {
  background: radial-gradient(1200px 600px at 50% -200px, #232838 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* -------------------------------- icônes --------------------------- */
/* Toutes les icônes sont des SVG inline en currentColor (public/js/icons.js) :
   elles héritent donc de la couleur du texte qui les porte. */

.ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.14em;
  flex: 0 0 auto;
}

/* icône accolée à un texte : légèrement en retrait et un cran plus discrète */
.ico-inline {
  width: 1.05em;
  height: 1.05em;
  opacity: 0.75;
  margin-right: 0.4em;
}

/* icône d'un titre de modale */
.ico-title {
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.4em;
  color: var(--accent);
}

/* ------------------------------- chrome ---------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 22, 28, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

.brand img {
  display: block;
  width: 30px;
  height: 30px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.user-chip:hover {
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Vignette de profil                                                  */
/* ------------------------------------------------------------------ */

.avatar {
  display: grid;
  place-items: center;
  /* une taille par défaut : sans elle, la vignette prend celle de son image */
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.72rem;
}

.avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 1.6rem;
  border: 2px solid var(--accent);
  padding: 0;
}

/* Trente-six visages : une grille qui défile plutôt qu'une modale de plus. */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  /* les rangées gardent leur taille : sous une hauteur plafonnée, une grille
     répartit ses lignes par défaut et écrasait les visages de moitié */
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

/* C'est l'image, carrée, qui donne sa taille au bouton : l'aspect-ratio posé
   sur un bouton n'est pas honoré partout, et les vignettes se chevauchaient. */
.avatar-grid button {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  display: block;
}

.avatar-grid img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 50%;
}

.avatar-grid button.is-picked {
  border-color: var(--accent);
}

.avatar-grid button:hover {
  border-color: var(--line);
}

.profile-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* Un trait de séparation, plutôt qu'un titre de section de plus. */
.modal-split {
  height: 1px;
  background: var(--line);
  margin: 20px 0 16px;
}

.modal-sub {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.done {
  color: var(--accent-2);
  font-size: 0.88rem;
  margin: 10px 0 0;
}

.logout-link {
  display: block;
  margin: 0 auto;
}

#profile-bio {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

/* sur un écran étroit, c'est le pseudo qui cède, jamais le lien de sortie */
#user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .link {
  flex: 0 0 auto;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 64px;
  display: grid;
  gap: 16px;
}

/* -------------------------------- cards ---------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}

.lede {
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 14px 0 0;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.error {
  color: #ff8b7e;
  font-size: 0.88rem;
  margin: 10px 0 0;
}

/* -------------------------------- forms ---------------------------- */

form label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

.row {
  display: flex;
  gap: 10px;
}

.row input {
  flex: 1;
  text-transform: uppercase;
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.2);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  width: 100%;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: var(--danger);
  border-color: transparent;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 0.88rem;
}

/* -------------------------------- tabs ----------------------------- */

.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
}

.tab.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ------------------------------ options ---------------------------- */

.options {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.option-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 7px;
}

.choices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Choix du personnage : deux boutons pleine largeur, avec leur signe. */
.choices.gender {
  margin-bottom: 14px;
}

.choices.gender .choice {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
}

.gender-mark {
  display: inline-grid;
  place-items: center;
}

.gender-mark .ico {
  width: 18px;
  height: 18px;
}

.choice {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  font-weight: 600;
}

.choice.is-active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

/* ------------------------------- lobby ----------------------------- */

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

/* Une carte, pas une ligne : chaque information a son étage, et le bouton
   occupe toute la largeur en bas. Rien ne se comprime, rien ne déborde. */
.game-row {
  display: grid;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

/* L'hôte ouvre la carte : c'est chez lui qu'on entre. */
.game-host {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.game-host-id {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.game-host-id b {
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.avatar-md {
  width: 42px;
  height: 42px;
  font-size: 0.9rem;
  flex: 0 0 auto;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 0.58rem;
  flex: 0 0 auto;
}

.badge {
  flex: 0 0 auto;
}

/* les réglages de la partie, en pastilles qui passent à la ligne */
.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.game-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 5px 10px;
}

.game-meta .ico {
  width: 14px;
  height: 14px;
}

/* l'objectif est ce qu'on regarde en premier : il porte la couleur du jeu */
.game-meta .goal {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Les joueurs déjà là, avec leur visage. */
.game-players {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 22px;
}

.game-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-free {
  font-size: 0.76rem;
  color: var(--muted);
  padding: 3px 4px;
}

.game-row .btn {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.game-row .btn .ico {
  width: 17px;
  height: 17px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--line);
  color: var(--muted);
}

.badge.live {
  background: rgba(76, 207, 106, 0.15);
  color: var(--accent-2);
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 0;
}

/* ------------------------- salon vide ------------------------------ */
/* Le vide occupe la place qui reste, pour que le dé tombe au milieu de
   l'écran et non sous le titre. */
.games.is-empty {
  /* dé, phrase et boutons forment un seul groupe, centré dans ce qui reste
     sous l'en-tête : rien ne flotte, rien ne colle au bas de l'écran */
  min-height: calc(100svh - 145px);
  /* on centre en hauteur seulement : « place-content » resserrait aussi la
     colonne sur son contenu, et les deux boutons passaient à la ligne */
  align-content: center;
}

.games.is-empty .empty {
  width: min(100%, 420px);
  margin: 0 auto;
}

/* la barre n'est plus fixe : elle fait partie du bloc, et le fond du wrap
   n'a plus à lui réserver sa hauteur */
body.home.lobby-empty .wrap {
  padding-bottom: 20px;
}

body.lobby-empty .lobby-actions {
  position: static;
  width: 100%;
  margin-top: 22px;
  padding: 0;
  gap: 8px;
  background: none;
}

/* sans la largeur pleine de la barre fixe, « Rejoindre avec un code » passait
   à la ligne à cinq pixels près : on resserre plutôt que d'empiler */
body.lobby-empty .lobby-actions .btn {
  font-size: 0.86rem;
  padding: 0 8px;
}

.games.is-empty .empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
}

.games.is-empty h3 {
  margin: 14px 0 0;
  font-size: 1.05rem;
  color: var(--text);
}

.games.is-empty p {
  margin: 0;
  max-width: 30ch;
  line-height: 1.45;
}

.empty-die {
  display: grid;
  justify-items: center;
}

.empty-die svg {
  width: 35px;
  height: 35px;
  /* trois faces, trois rebonds : le dé roule sans qu'on ait chargé d'image */
  animation: die-hop 0.9s cubic-bezier(0.3, 0.9, 0.4, 1) infinite;
}

.die-face {
  fill: var(--gold);
}

.die-pips circle {
  fill: #241c00;
}

/* l'opacité se joue sur le groupe : posée sur les points, elle survivrait à
   l'animation du groupe et le dé resterait vierge */
.die-pips {
  opacity: 0;
  animation: die-face 2.7s steps(1, end) infinite;
}

.die-b {
  animation-delay: -1.8s;
}

.die-c {
  animation-delay: -0.9s;
}

/* l'ombre s'écrase quand le dé retombe : c'est elle qui donne le poids */
.die-shadow {
  display: block;
  width: 22px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  filter: blur(3px);
  animation: die-shadow 0.9s cubic-bezier(0.3, 0.9, 0.4, 1) infinite;
}

@keyframes die-hop {
  0% {
    transform: translateY(0) rotate(-9deg);
  }
  45% {
    transform: translateY(-6px) rotate(7deg);
  }
  75% {
    transform: translateY(0) rotate(-3deg);
  }
  100% {
    transform: translateY(0) rotate(-9deg);
  }
}

@keyframes die-shadow {
  0%,
  100% {
    transform: scaleX(1);
    opacity: 0.45;
  }
  45% {
    transform: scaleX(0.7);
    opacity: 0.22;
  }
}

@keyframes die-face {
  0%,
  33.32% {
    opacity: 1;
  }
  33.33%,
  100% {
    opacity: 0;
  }
}

/* on ne fait pas sauter un écran à qui a demandé le calme */
@media (prefers-reduced-motion: reduce) {
  .empty-die svg,
  .die-shadow,
  .die-pips {
    animation: none;
  }

  .die-a {
    opacity: 1;
  }
}

/* ------------------------------------------------------------------ */
/* Écran d'entrée                                                      */
/* ------------------------------------------------------------------ */

.home {
  min-height: 100svh;
  /* le même fond que le plateau : on ne change pas de monde en sortant d'une
     partie */
  background: radial-gradient(1200px 600px at 50% -200px, #232838 0%, var(--bg) 60%);
}

/* Un halo doré derrière la carte, pour que la page ne soit pas un mur noir. */
/* Le halo doré appartient à l'écran d'entrée. Le salon, lui, garde le fond du
   plateau : on ne change pas de monde en sortant d'une partie. */
.auth::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(620px 420px at 50% -6%, rgba(242, 193, 27, 0.16), transparent 70%),
    radial-gradient(520px 380px at 90% 8%, rgba(232, 73, 58, 0.09), transparent 72%);
}

.auth {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0;
  max-width: 380px;
  margin: 0 auto;
  padding: clamp(18px, 6vh, 54px) 0 40px;
}

.auth-logo {
  width: clamp(88px, 26vw, 120px);
  height: auto;
  margin-bottom: 18px;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
}

.auth h1 {
  font-size: clamp(1.35rem, 5.6vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 22px;
}

.auth .tabs {
  width: 100%;
  margin-bottom: 20px;
}

.auth form {
  width: 100%;
  display: grid;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 7px;
}

.auth input {
  width: 100%;
  height: 50px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 0 14px;
  font-size: 1rem;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* champ avec le bouton d'affichage du mot de passe */
.field {
  position: relative;
}

.field input {
  padding-right: 48px;
}

.reveal {
  position: absolute;
  top: 25px;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 9px;
}

.reveal:hover {
  color: var(--text);
}

.reveal .ico {
  width: 19px;
  height: 19px;
}

/* jauge de robustesse */
.gauge {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: -4px 0 7px;
}

.gauge i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--danger);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.gauge i.weak { background: var(--danger); }
.gauge i.fair { background: #f0932b; }
.gauge i.good { background: var(--gold); }
.gauge i.strong { background: var(--accent-2); }

.gauge-label {
  margin: 0 0 12px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  min-height: 1.1em;
}

/* les trois exigences, cochées à mesure qu'on tape */
.rules {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 5px;
}

.rules li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.rules li::before {
  content: '';
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.rules li.ok {
  color: var(--accent-2);
}

.rules li.ok::before {
  border-color: var(--accent-2);
  background: var(--accent-2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314161c' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E")
    center / 11px no-repeat;
}

.auth .btn-primary {
  height: 52px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  margin-top: 4px;
}

.auth .error {
  margin: 0 0 12px;
}

/* ------------------------------------------------------------------ */
/* Lobby : la liste occupe l'écran, les actions restent sous le pouce  */
/* ------------------------------------------------------------------ */

#lobby {
  padding-bottom: 12px;
}

#lobby .card-head {
  margin-bottom: 14px;
}

#lobby h2 {
  margin: 0;
}

.lobby-actions {
  position: sticky;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  flex-wrap: wrap;
  padding: 14px 16px calc(30px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(20, 22, 28, 0));
}

.lobby-actions .btn {
  flex: 1 1 148px;
  height: 50px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  width: auto;
  padding: 0 12px;
}

/* trop étroit pour deux boutons côte à côte : ils s'empilent */
@media (max-width: 359px) {
  .lobby-actions .btn {
    flex: 1 1 100%;
  }
}

/* la barre d'actions ne doit jamais recouvrir la fin de la liste */
body.home .wrap {
  padding-bottom: 116px;
}

/* --------------------------------- modales -------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 9, 13, 0.72);
  backdrop-filter: blur(3px);
}

.modal-inner {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.modal-close .ico {
  width: 18px;
  height: 18px;
}

.modal .btn-primary {
  height: 50px;
  border-radius: 12px;
  font-weight: 800;
}

.modal .options {
  margin-bottom: 20px;
}

/* --------------------------- les réglages -------------------------- */

/*
 * Une passerelle, pas un formulaire.
 *
 * Tout tenait sur une page — la langue, les trois champs du mot de passe, ses
 * règles, la sortie — et l'on cherchait où était quoi. Chaque chose a sa page ;
 * celle-ci ne fait que dire ce qui existe, en lignes qu'on touche.
 */
.reglages {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}

.reglage {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 20px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.reglage:last-child {
  border-bottom: none;
}

.reglage:hover {
  background: rgba(255, 255, 255, 0.035);
}

.reglage b {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
}

/* Ce que la ligne vaut aujourd'hui — la langue en cours — se lit sans entrer. */
.reglage em {
  font-style: normal;
  font-size: 0.84rem;
  color: var(--muted);
}

.reglage i {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.reglage i .ico {
  width: 21px;
  height: 21px;
}

.reglage-fin .ico {
  width: 15px;
  height: 15px;
  transform: rotate(-90deg);
}

/* La sortie du compte se distingue du reste : c'est la seule ligne dont on ne
   revient pas d'un simple retour. */
.reglage.est-grave b,
.reglage.est-grave i {
  color: var(--danger);
}

.reglages-titre {
  margin: 22px 0 -4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Le chemin du retour, en haut de chaque page. */
.retour {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 4px 8px 4px 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.retour:hover {
  color: var(--text);
}

.retour .ico {
  width: 17px;
  height: 17px;
}

/* ---- la langue ---- */

/*
 * Les six tiennent à l'écran : elles se posent en liste plutôt qu'en menu
 * déroulant, qui demandait un geste de plus pour la même chose. Celle du compte
 * porte la couleur du jeu — on voit ce qu'on a avant de voir ce qu'on peut
 * prendre.
 */
/*
 * Six langues ne remplissent pas un écran de téléphone. Plutôt que de les
 * tasser en haut et de laisser le bas vide, elles se répartissent : les lignes
 * respirent jusqu'à une hauteur raisonnable, et ce qui reste d'espace se pose
 * autour d'elles plutôt qu'en dessous.
 */
.langue-liste {
  display: grid;
  gap: 10px;
  align-content: center;
  grid-auto-rows: minmax(58px, 74px);
}

/* Un drapeau, pas deux lettres : on reconnaît le sien sans lire. Les couleurs
   sont celles des drapeaux — c'est le seul endroit du jeu qui échappe à la
   charte, et un drapeau repeint ne serait plus un drapeau. */
.drapeau {
  width: 30px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}

.langue-choix {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.langue-choix b {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
}

.langue-sigle {
  display: grid;
  place-items: center;
  min-width: 34px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.langue-choix.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.langue-choix.is-on .langue-sigle {
  background: var(--accent);
  color: var(--accent-ink);
}

.langue-choix .ico {
  width: 18px;
  height: 18px;
}

/* ---- fermer son compte ---- */

.motifs {
  display: grid;
  gap: 10px;
}

/*
 * Les deux temps du départ : chacun est une colonne à lui, avec son propre
 * espacement — les enfants d'un bloc ne reçoivent pas l'écart de la page, et le
 * libellé se retrouvait collé au choix qui le fait apparaître.
 */
#fermer-etape1,
#fermer-etape2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#fermer-etape1 .field-label,
#fermer-etape2 .field-label {
  margin-top: 6px;
}

.motif {
  padding: 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.motif.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

/* Le bouton qui efface tout ne se prend pas pour un bouton d'action : il est
   sourd, cerné de rouge, et ne se colore qu'au moment d'être touché. */
.btn-danger {
  border: 1px solid var(--danger);
  background: none;
  color: var(--danger);
  font-weight: 800;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ---------------------- le choix du personnage --------------------- */

/*
 * On clique sur son propre visage pour en changer : la vignette est le bouton,
 * et le mot dessous ne fait que le dire à qui ne l'aurait pas deviné.
 */
.avatar-choix {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.avatar-changer {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.avatar-choix:hover .avatar-changer {
  color: var(--accent);
}

/* La fenêtre des personnages : quatre-vingt-dix vignettes, il lui faut de la
   largeur sur grand écran plutôt qu'une colonne de trois. */
.modal-large {
  max-width: 640px;
}

.palettes {
  display: grid;
  gap: 20px;
  max-height: min(62vh, 540px);
  overflow-y: auto;
  padding-right: 4px;
}

/* Une seule grille, du premier personnage au dernier. */
.palettes .avatar-grid {
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 12px 10px;
  max-height: none;
  overflow: visible;
  margin-bottom: 0;
}

/*
 * Un personnage : sa vignette, et rien d'autre. Ceux qu'on n'a pas encore
 * portent un bandeau sombre au bas du cercle, avec un cadenas doré au centre.
 * Le niveau demandé n'y figure pas : quatre-vingt-dix chiffres alignés
 * faisaient un tableau, là où l'on veut regarder des visages. On le lit en
 * touchant celui qu'on convoite.
 */
.perso {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  line-height: 0;
  overflow: hidden;
  cursor: pointer;
}

.perso img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 50%;
}

.perso.is-picked {
  border-color: var(--accent);
}

.perso:hover {
  border-color: var(--line);
}

.perso-verrou {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* un bandeau bas et franc : plus haut il mangeait le menton, plus clair on ne
     le voyait pas passer sur un vêtement sombre */
  height: 24%;
  display: grid;
  place-items: center;
  background: rgba(6, 7, 10, 0.82);
}

.perso-verrou .ico {
  width: 34%;
  height: 34%;
  max-width: 13px;
  max-height: 13px;
  color: var(--accent);
  stroke-width: 2.4;
}

/* La fenêtre du verrou : le visage convoité, ce qu'il demande, et c'est tout. */
.modal-mince {
  max-width: 320px;
}

.verrou-scene {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 6px 0 2px;
  text-align: center;
}

.verrou-face img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: block;
}

.verrou-mot {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.verrou-scene .btn {
  width: auto;
  padding-inline: 34px;
}

/* Les champs se tenaient dans les fenêtres modales ; le profil et les réglages
   sont devenus des pages, et ils y gardent la même tenue. */
.modal input,
.modal textarea,
.vue input,
.vue textarea {
  width: 100%;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.modal input,
.vue input {
  height: 50px;
  padding: 0 14px;
}

/* Le code de partie se lit lettre à lettre : c'est le seul champ à mériter
   ce traitement — le pseudo et les mots de passe restent tels qu'on les tape. */
#join-code {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  text-align: center;
}

/* -------------------------------- toast ---------------------------- */

/* En bas de l'écran, un refus passait inaperçu au milieu d'une partie. Il
   s'affiche maintenant en plein centre, assez gros pour couper le geste. */
.toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(88vw, 420px);
  background: rgba(30, 34, 45, 0.97);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  z-index: 60;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  animation: toast-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.toast .ico {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

/* un refus : la teinte le dit avant la lecture */
.toast.deny {
  border-color: rgba(255, 139, 126, 0.55);
  color: #ff8b7e;
}

@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

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

/* --------------------------- caractère ----------------------------- */
/* Neuf curseurs qui ne changent rien à la partie : ils disent qui l'on est aux
   autres joueurs, comme le tempérament d'un adversaire automatique dit qui il
   est. La légende à droite nomme le côté où penche le curseur — sans elle, on
   croirait qu'il vaut toujours mieux en avoir beaucoup. */

.modal-hint {
  margin: -2px 0 10px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

/* Les tempéraments des joueurs automatiques existaient depuis longtemps, mais
   il fallait trois parties pour les deviner. Six jauges les disent, en deux
   colonnes : la couleur suffit à lire un personnage sans comparer des
   longueurs — rouge quand le trait est au plus bas, jaune quand il est au
   plus haut. */

.traits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 4px 0 16px;
}

.trait-nom {
  display: block;
  margin-bottom: 3px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* La pastille mord sur la barre, comme sur une jauge de jeu : c'est ce
   chevauchement qui fait qu'on la lit comme un cadran et non comme un tableau. */
.trait-bar {
  position: relative;
  height: 18px;
  padding-left: 11px;
  border-radius: 9px;
  background: #3a2f14;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Un trait au plus bas garde un fragment de barre : sans lui, la jauge paraît
   vide et l'on croirait qu'elle n'est pas renseignée, alors que son rouge dit
   justement quelque chose. */
.trait-bar i {
  display: block;
  height: 100%;
  min-width: 13px;
  border-radius: 0 9px 9px 0;
  transition: width 0.3s ease, background 0.3s ease;
}

.trait-ico {
  position: absolute;
  top: 50%;
  left: -1px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--bg-soft, #232838);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
  color: var(--accent);
}

.trait-ico svg {
  width: 13px;
  height: 13px;
}

/* ------------------------------ langues ---------------------------- */

/*
 * Le choix de la langue : une valeur qu'on déplie, pas une liste de six mots.
 *
 * Le bouton porte le globe, le nom de la langue en cours et son chevron ; la
 * liste s'ouvre dessous, chaque langue écrite dans la sienne, précédée de son
 * sigle. Rien de flottant ni d'ombré : le liseré et l'aplat sourd de la charte
 * suffisent à détacher le panneau, comme les fiches du plateau.
 */
.lang-select {
  position: relative;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.lang-select.is-compact {
  margin-top: 6px;
  padding-top: 0;
  border-top: none;
  display: block;
}

.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-select.is-compact .lang-current {
  width: 100%;
  justify-content: space-between;
}

.lang-current:hover {
  border-color: var(--accent);
}

.lang-select.is-open .lang-current {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-globe .ico,
.lang-chevron .ico {
  width: 17px;
  height: 17px;
  display: block;
}

.lang-globe {
  color: var(--accent);
  display: grid;
  place-items: center;
}

.lang-chevron {
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform 0.16s ease;
}

.lang-select.is-compact .lang-now {
  flex: 1;
  text-align: left;
  margin-left: 2px;
}

.lang-select.is-open .lang-chevron {
  transform: rotate(180deg);
}

/* La liste : posée sous le bouton, elle recouvre ce qui suit plutôt que de
   pousser le formulaire vers le bas. */
.lang-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 232px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  display: grid;
  gap: 1px;
}

.lang-select.is-compact .lang-list {
  left: 0;
  right: 0;
  transform: none;
  min-width: 0;
}

/* Pas la place dessous : le panneau se pose au-dessus du bouton. */
.lang-select.is-up .lang-list {
  top: auto;
  bottom: calc(100% + 6px);
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.lang-item:hover {
  background: var(--bg-soft);
}

/* Le sigle tient lieu de repère : trois lettres alignées, la même largeur pour
   toutes, de quoi parcourir la liste sans lire. */
.lang-sigle {
  flex: 0 0 auto;
  min-width: 28px;
  padding: 2px 0;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
}

.lang-nom {
  flex: 1;
}

.lang-check {
  color: var(--accent);
  display: grid;
  place-items: center;
}

.lang-check .ico {
  width: 16px;
  height: 16px;
}

.lang-item.is-on {
  color: var(--accent);
}

.lang-item.is-on .lang-sigle {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ------------------------------ niveaux ---------------------------- */

/*
 * Le niveau d'un joueur, partout où son nom paraît.
 *
 * Une pastille, pas un badge : le médaillon dessiné est superbe et pèse cent
 * kilo-octets — répété douze fois dans une liste, il l'écrase. Ici, seule la
 * couleur de la famille porte le rang, et le chiffre le précise. On lit le
 * niveau d'un coup d'œil sans que le pseudo cesse d'être l'information
 * principale.
 */
.niv {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  height: 1.55em;
  padding: 0 0.32em;
  border-radius: 999px;
  background: var(--niv-teinte, #a98868);
  color: var(--niv-encre, #3a2c1f);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.01em;
  vertical-align: middle;
}

.niv-xs {
  font-size: 0.62rem;
}

/* Au siège, la pastille suit le pseudo sans le pousser hors de sa place. */
.seat-name .niv {
  margin-left: 4px;
}

/* Sur la fiche, le médaillon tient le palmarès à sa gauche. */
.who-rang {
  display: flex;
  align-items: center;
  gap: 12px;
}

.who-rang .stats {
  flex: 1;
}

/* Le médaillon entier : le dessin, et le niveau gravé au centre. */
.niv-badge {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--badge-taille, 96px);
  height: var(--badge-taille, 96px);
  flex: 0 0 auto;
}

.niv-badge img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Le chiffre s'assoit sur la face vide du médaillon, dont la position est
   mesurée dessin par dessin (voir `FAMILLES` dans niveaux.js). */
.niv-badge b {
  position: absolute;
  top: var(--badge-y, 46%);
  left: var(--badge-x, 50%);
  /*
   * Un chiffre repose sur sa ligne de base : le centre de sa boîte tombe plus
   * haut que le centre de ce qu'on voit. Sans ces quelques centièmes de cadratin,
   * tous les badges paraissent porter leur niveau un cran trop haut.
   */
  transform: translate(-50%, calc(-50% + 0.055em));
  color: var(--badge-encre, #3a2c1f);
  font-size: var(--badge-corps, 32px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  /* un liseré sombre : le chiffre garde ses contours sur une face brillante */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* La jauge : ce qu'il reste avant le palier suivant. */
.niv-jauge {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.niv-jauge i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--niv-teinte, #f2c11b);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ------------------------------ accueil ---------------------------- */

/*
 * L'accueil, et les trois autres vues.
 *
 * On arrivait sur une liste de tables, et le geste principal — jouer — se
 * perdait au milieu. L'accueil ne porte plus qu'une carte de joueur et un
 * bouton ; les tables, le profil et les réglages ont chacun leur onglet. La
 * barre du bas ne bouge jamais : c'est elle qui tient la navigation, pas des
 * boutons semés dans les pages.
 *
 * Le décor est une image : tout ce qui se pose dessus porte son propre fond
 * sombre, et rien ne compte sur le contraste de la photo pour rester lisible.
 */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  /* le jeu se joue au téléphone : sur grand écran on garde la même colonne
     plutôt que d'étaler cinq onglets sur un mètre de large */
  max-width: 760px;
  margin-inline: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(102px + var(--bas));
}

.accueil-fond {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg) url('/img/accueil.jpg') center / cover no-repeat;
}

.accueil-fond::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(20, 22, 28, 0.86) 0%,
    rgba(20, 22, 28, 0.34) 32%,
    rgba(20, 22, 28, 0.62) 68%,
    rgba(20, 22, 28, 0.94) 100%
  );
}

/* Hors de l'accueil, le décor s'efface tout à fait : on y lit des formulaires
   et des listes, pas une affiche. La ville qui transparaissait derrière un
   champ de mot de passe ne servait personne. */
body:not(.sur-accueil) .accueil-fond {
  background-image: none;
}

.vue {
  display: grid;
  gap: 12px;
  align-content: start;
}

/*
 * Les pages de réglages tiennent la hauteur de l'écran, et leur bouton descend
 * au pied. Sans cela le contenu se tassait en haut et laissait la moitié basse
 * vide — un formulaire de six lignes dans un écran de téléphone.
 */
/* les deux vues coiffées par la carte du joueur en tiennent compte */
#vue-tables {
  min-height: calc(100dvh - 210px - var(--bas));
}

#vue-params,
#vue-langue,
#vue-motdepasse,
#vue-suggestion,
#vue-suppression {
  min-height: calc(100dvh - 118px - var(--bas));
}

/*
 * Ces pages se lisent de haut en bas : une colonne, ce qui doit s'étirer
 * s'étire, et le bouton d'action descend au pied. Une grille alignée en haut
 * laissait tout le contenu tassé sous le titre et la moitié basse vide.
 */
#vue-params,
#vue-langue,
#vue-motdepasse,
#vue-suggestion,
#vue-suppression,
#vue-tables {
  display: flex;
  flex-direction: column;
}

/*
 * Rien à table : l'invitation se pose au milieu de l'écran plutôt qu'en haut.
 * Un encadré seul sous le bord supérieur, avec tout le vide en dessous, donne
 * l'impression d'une page qui n'a pas fini de charger.
 */
#tables-vide {
  margin: auto 0;
}

/*
 * La passerelle : deux respirations, l'une au-dessus des lignes et l'autre
 * au-dessus de la sortie. L'espace en trop se partage entre les deux au lieu
 * de tomber d'un bloc sous le dernier réglage.
 */
#vue-params .reglages:first-of-type,
#vue-params .logout-link {
  margin-top: auto;
}

#langue-liste,
#sugg-texte {
  flex: 1;
}

#fermer-etape1,
#fermer-etape2 {
  flex: 1;
}

#vue-motdepasse #pw-save,
#fermer-etape1 #fermer-suite,
#fermer-etape2 #fermer-valider,
#vue-params .logout-link {
  margin-top: auto;
}

/* Les champs portent déjà leur écart : celui de la grille suffit. */
.vue input,
.vue textarea {
  margin-bottom: 0;
}

/* le dé et le bouton se posent au milieu de ce que la carte du joueur laisse */
.vue-accueil {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 210px - var(--bas));
}

.vue-titre {
  margin: 2px 0 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- la carte du joueur ---- */

/* la carte du joueur vit au-dessus des vues : elle coiffe l'accueil comme les
   tables, et ne bouge pas quand on passe de l'un à l'autre. Elle garde son air
   sous elle — sans quoi la première table venait s'y coller. */
.moi {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 31, 40, 0.82);
  backdrop-filter: blur(6px);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.moi:hover {
  border-color: var(--accent);
}

.moi-badge .niv-badge {
  display: block;
}

.moi-id {
  min-width: 0;
}

.moi-nom {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.moi-nom b {
  font-size: 1.02rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moi-reste {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

/* Les victoires : le seul chiffre de l'accueil, parce que c'est celui qu'on
   cite. Le reste vit dans le profil. */
.moi-palmares {
  display: grid;
  justify-items: center;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.moi-palmares b {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.moi-palmares small {
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- le geste principal ---- */

.lancer {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
}

/* Le dé roule au-dessus du bouton, sur son propre aplat : posé à même le
   décor, il se perdait dans les lumières de la ville. */
.lancer-de {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 38%, rgba(242, 193, 27, 0.22), rgba(28, 31, 40, 0.9) 70%);
  border: 1px solid var(--line);
  animation: de-flotte 3.4s ease-in-out infinite;
}

.lancer-de svg {
  width: 54px;
  height: 54px;
  animation: de-tourne 4.6s cubic-bezier(0.6, 0, 0.35, 1) infinite;
}

@keyframes de-flotte {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* Il roule, s'arrête, montre une face, repart : un dé qui tourne sans fin
   n'attire plus l'œil au bout de trois secondes. */
@keyframes de-tourne {
  0% { transform: rotate(0deg); }
  16% { transform: rotate(384deg); }
  30%, 100% { transform: rotate(384deg); }
}

.btn-lancer {
  width: 100%;
  max-width: 340px;
  padding: 17px 26px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffd54a, var(--accent));
  box-shadow: 0 5px 0 #a37f08, 0 10px 22px rgba(0, 0, 0, 0.45);
  color: var(--accent-ink);
  font: inherit;
  font-size: 1.12rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-lancer:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a37f08, 0 4px 12px rgba(0, 0, 0, 0.45);
}

.lien-code {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.lien-code:hover {
  color: var(--text);
}

/* ---- l'onglet des tables ---- */

.tables-vide {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.tables-vide p {
  margin: 0;
  font-size: 0.9rem;
}

.tables-vide .btn {
  width: auto;
  padding-inline: 26px;
}

/* ---- le profil ---- */

.profil-niveau {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.profil-niveau-dit {
  flex: 1;
  min-width: 0;
}

.profil-niveau-dit b {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
  font-weight: 800;
}

.profil-niveau-dit small {
  display: block;
  margin-top: 5px;
  font-size: 0.72rem;
  color: var(--muted);
}

.profil-chiffres {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profil-chiffres div {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.profil-chiffres b {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.profil-chiffres small {
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- la barre du bas ---- */

/*
 * Le pied de la barre.
 *
 * Android dessine ses trois boutons par-dessus le bas de la page sans jamais
 * renseigner `safe-area-inset-bottom` : la barre passait dessous et « Accueil »
 * se lisait à travers le bouton Retour. On garde donc un talon fixe, que l'iPhone
 * remplace par sa propre encoche quand elle est plus haute.
 */
:root {
  --bas: max(30px, env(safe-area-inset-bottom));
}

.barre {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  padding: 8px 6px calc(6px + var(--bas));
  background: rgba(20, 22, 28, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

@media (min-width: 620px) {
  .barre {
    left: 50%;
    right: auto;
    width: 520px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 18px 18px 0 0;
  }
}

.onglet {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
}

.onglet i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.onglet .ico {
  width: 21px;
  height: 21px;
}

.onglet.is-on {
  color: var(--accent);
}

/* Le compte des tables ouvertes se pose sur l'icône : un chiffre, pas une
   pastille rouge — personne n'est en retard sur rien. */
.onglet.a-du-monde i::after {
  content: attr(data-compte);
  position: absolute;
  top: -5px;
  left: 13px;
  min-width: 14px;
  padding: 0 3px;
  border: 2px solid rgba(20, 22, 28, 0.94);
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
}

.onglet i {
  position: relative;
}

/*
 * Le bouton du milieu déborde vers le haut : c'est le geste principal, il ne
 * se range pas au même rang que les autres. Sa taille et son or le disent avant
 * qu'on ait lu quoi que ce soit.
 */
.nav-plus {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-top: -26px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd54a, var(--accent));
  box-shadow: 0 4px 14px rgba(242, 193, 27, 0.3);
  color: var(--accent-ink);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.nav-plus:active {
  transform: scale(0.94);
}

.nav-plus .ico {
  width: 27px;
  height: 27px;
  stroke-width: 2.6;
}
