:root {
  /* Taille des cartes persos/armes (identique à la draft). Sur téléphone,
     recalculée par ajusterGrille() pour 4 cartes par ligne. */
  --taille-carte: 6.875rem;
}

body {
  background-color: #1e1e1e;
  color: white;
  font-family: var(--police-texte);
  margin: 1.25rem;
}

a {
  color: white;
}

h1, h2 {
  margin-top: 1.25rem;
}

/* ---- Liste des comptes ---- */

/* Recherche + tris centrés, dans un rectangle flou figé en haut de l'écran
   au défilement (même flou que la barre de Mon compte). */
.barre-comptes {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1rem;
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background-color: rgba(20, 20, 20, 0.45);
  -webkit-backdrop-filter: blur(0.5rem);
  backdrop-filter: blur(0.5rem);
}

.barre-comptes .tris {
  justify-content: center;
}

.barre-comptes .recherche-personnage {
  width: 15rem;
}

.tri-compte-btn .fleche {
  font-size: 0.8125rem;
}

.liste-vide {
  opacity: 0.7;
  font-style: italic;
}

#accounts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 0.75rem;
}

/* Carte = la deuxième bannière du joueur (1000x137), sans cadre ni
   dégradé ajouté (les images sont déjà assombries à gauche). */
/* Bannière du joueur au format commun (.banniere-joueur, commun/entete.css),
   en miroir du bouton du compte : photo et pseudo à gauche, valeur du tri
   en cours à droite. */
/* width / min-width : la hauteur minimale ne doit pas élargir la carte
   (format imposé) au-delà de sa colonne, sinon elle chevauche la voisine. */
.account-card {
  width: 100%;
  min-width: 0;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.account-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

/* Valeur du tri en cours (points, victoires...), à droite de la carte. */
.account-stat {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0.1875rem 0.625rem;
  border-radius: 62.4375rem;
  background-color: rgba(0, 0, 0, 0.55);
  font-size: 0.875rem;
  font-weight: bold;
  white-space: nowrap;
}

.account-infos {
  min-width: 0;
  flex: 1;
}

.account-pseudo,
.account-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name {
  display: flex;
  min-width: 0;
  font-weight: bold;
}

.account-pseudo {
  min-width: 0;
}

/* Pseudo et @ (coupés si trop longs), puis médaille du théâtre juste après,
   centrée en hauteur sur la carte, même taille que dans le bouton du compte. */
.account-infos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-textes {
  flex: 0 1 auto;
  min-width: 0;
}

.account-infos .medaille-theatre {
  width: 2em;
  height: 2em;
}

.account-sub {
  font-size: 0.75rem;
  opacity: 0.85;
}

@media (max-width: 700px) {
  #accounts-list {
    grid-template-columns: 1fr;
  }

  .barre-comptes .recherche-personnage {
    width: 100%;
  }

  .barre-comptes,
  .barre-comptes .tris {
    flex-wrap: wrap;
  }
}

/* ---- Modal ---- */

#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#modal.active {
  display: flex;
}

/* Assez large pour la barre de filtres sur une seule ligne sur ordi. */
#modal-content {
  box-sizing: border-box;
  background: #2a2a2a;
  border-radius: 0.75rem;
  padding: 1.25rem;
  max-width: 83.75rem;
  width: 95%;
  height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

#modal-header h2 {
  margin: 0;
}

#close-modal {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* ---- Vue (persos/armes) et box (full/stuff) : une seule ligne, boutons
   de taille identique, texte centré ---- */

#selecteurs {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

#view-selector,
#box-selector {
  display: flex;
  gap: 0.5rem;
}

.view-btn,
.box-btn {
  box-sizing: border-box;
  min-width: 8.75rem;
  padding: 0 0.875rem;
  white-space: nowrap;
  height: 2.4375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: rgba(20, 20, 20, 0.45);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5625rem;
  padding: 0 0.5rem;
  cursor: pointer;
  font-size: 1rem;
}

.view-btn.active,
.box-btn.active {
  border-color: rgba(245, 197, 66, 0.8);
  background-color: rgba(245, 197, 66, 0.15);
}

/* ---- Barre recherche / tri / filtres (mêmes styles que la draft) ---- */

.barre-outils {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.zone-recherche,
.filtres-tri {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tris,
.filtres-icones,
.filtres-etoiles {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tris .tris-label {
  font-size: 0.9375rem;
  opacity: 0.8;
}

.recherche-personnage {
  box-sizing: border-box;
  height: 2.4375rem;
  background-color: rgba(20, 20, 20, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5625rem;
  padding: 0.375rem 0.75rem;
  color: white;
  font-size: 1.0625rem;
  width: 11.875rem;
}

.filtre-icone-btn {
  box-sizing: border-box;
  width: 2.4375rem;
  height: 2.4375rem;
  padding: 0.3125rem;
  border-radius: 0.5625rem;
  border: 2px solid transparent;
  background-color: rgba(20, 20, 20, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filtre-icone-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.filtre-etoile-btn {
  height: 2.4375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5625rem;
  border: 2px solid transparent;
  background-color: rgba(20, 20, 20, 0.45);
  color: white;
  font-size: 1.125rem;
  cursor: pointer;
  white-space: nowrap;
}

.filtre-icone-btn.active,
.filtre-etoile-btn.active {
  border-color: rgba(245, 197, 66, 0.8);
  background-color: rgba(245, 197, 66, 0.15);
}


/* ---- Grille des cartes : colonnes et écart recalculés par ajusterGrille()
   (même écart entre les cartes, sur les bords et entre les lignes). Valeurs
   ci-dessous = repli avant le 1er calcul. ---- */

.grille-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--taille-carte));
  gap: 0.625rem;
  justify-content: center;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 0.625rem;
}

/* ---- Cartes (même rendu que la draft) ---- */

.character-card {
  width: var(--taille-carte);
}

.character-visuel {
  position: relative;
  display: block;
  width: var(--taille-carte);
  height: var(--taille-carte);
  background-size: cover;
  background-position: center;
  border-radius: 0.5rem;
  overflow: hidden;
}

.character-visuel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0.5rem;
}

/* Cercles : constellation en haut à gauche, points en haut à droite,
   niveau en bas à gauche. */
.character-constellation,
.character-points,
.character-niveau {
  position: absolute;
  width: 2.125rem;
  height: 2.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
}

.character-constellation {
  top: 2px;
  left: 2px;
}

.character-points {
  top: 2px;
  right: 2px;
}

.character-niveau {
  bottom: 2px;
  left: 2px;
}

/* Bas à droite : arme signature possédée (logo du type d'arme détouré de
   la couleur du raffinement), ou perso lié pour une arme. */
.character-visuel img.character-raffinement,
.character-visuel img.perso-lie-icone {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0;
}

.character-visuel img.character-raffinement {
  object-fit: contain;
  /* Logo d'arme signature : même taille extérieure que les cercles de
     constellation / points ; contour de la couleur du raffinement (4px)
     tracé vers l'intérieur du cercle. */
  box-sizing: border-box;
  border-radius: 50%;
  outline: var(--epaisseur-contour-arme, 4px) solid var(--couleur-ref);
  outline-offset: calc(-1 * var(--epaisseur-contour-arme, 4px));
}

/* Icône du perso lié : 1.5x la taille des cercles. */
.character-visuel img.perso-lie-icone {
  width: 3.1875rem;
  height: 3.1875rem;
  /* Décalée vers la droite (le bord de la carte rogne le surplus). */
  right: -0.375rem;
  object-fit: cover;
}

/* ---- Téléphone : popup plein écran, 4 cartes par ligne (cf.
   ajusterGrille), barre d'outils qui revient à la ligne. ---- */
@media (max-width: 700px) {
  #modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    padding: 0.75rem;
  }

  #selecteurs {
    gap: 0.375rem;
  }

  #view-selector,
  #box-selector {
    flex: 1 1 0;
    min-width: 0;
    gap: 0.375rem;
  }

  .view-btn,
  .box-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    white-space: normal;
    padding: 0 0.25rem;
    font-size: 0.8125rem;
  }

  .barre-outils,
  .zone-recherche,
  .filtres-tri,
  .tris,
  .filtres-icones,
  .filtres-etoiles {
    flex-wrap: wrap;
  }

  .barre-outils {
    flex-direction: column;
    align-items: stretch;
  }

  .recherche-personnage {
    width: 100%;
  }

  .character-constellation,
  .character-points,
  .character-niveau {
    width: 1.375rem;
    height: 1.375rem;
    font-size: 0.6875rem;
  }

  .character-visuel img.character-raffinement {
    width: 1.375rem;
    height: 1.375rem;
  }

  .character-visuel img.perso-lie-icone {
    width: 2.0625rem;
    height: 2.0625rem;
    right: -0.25rem;
  }
}

/* ---- Voyageur : niveau centré en bas, élément en bas à gauche ---- */

.character-niveau.niveau-centre {
  left: 50%;
  transform: translateX(-50%);
}

.character-visuel img.character-element {
  position: absolute;
  bottom: 2px;
  left: 2px;
  box-sizing: border-box;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0.25rem;
  object-fit: contain;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.8);
}

@media (max-width: 700px) {
  .character-visuel img.character-element {
    width: 1.375rem;
    height: 1.375rem;
    padding: 0.125rem;
  }
}

/* Points de la box, à la suite de son nom. */
.box-btn .points-box {
  margin-left: 0.25rem;
  font-weight: bold;
  color: #f5c542;
}

/* Tris en emoji (C6 5★ 🐋, Matchs ⚔️, Winrate 🏆), à la taille des logos. */
.tri-emoji {
  font-size: 1.25rem;
  line-height: 1;
}
