/* =====================================================================
   Badge de niveau, cadres d'avatar et titres (voir /assets/js/niveau-badge.js).
   Commun au site et aux jeux : ne dépend pas de style.css (couleurs et police définies ici).
   Le badge est un petit bloc taillé (comme les cubes du site), de la couleur de son palier :
     bois (1-9), bronze (10-19), argent (20-29), or (30-49), diamant (50-74), rubis (75-99), légende (100).
   Les cadres entourent l'avatar ; « Légende » brille doucement (immobile si « moins d'animations » est demandé).
   ===================================================================== */
@font-face { font-family: "Tilt Warp"; src: url("/assets/polices/TiltWarp-Variable.ttf") format("truetype"); font-display: swap; }

/* ---------- Le badge ---------- */
.nb-badge {
  --nb-face: #b07a45; --nb-cote: #6e4422; --nb-texte: #1f1206; --nb-reflet: rgba(255, 236, 205, .45);
  display: inline-grid; place-items: center; flex: none; vertical-align: middle;
  position: relative; box-sizing: border-box;
  min-width: 26px; height: 24px; padding: 0 5px;
  font-family: "Tilt Warp", "Atkinson Hyperlegible Next", "Trebuchet MS", system-ui, sans-serif;
  font-size: .8rem; line-height: 1; letter-spacing: .01em; font-weight: 400;
  color: var(--nb-texte);
  background: var(--nb-face);
  /* bords taillés en biseau : un bloc vu de face */
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  box-shadow: inset -3px -3px 0 var(--nb-cote), inset 2px 2px 0 var(--nb-reflet);
  font-variant-numeric: tabular-nums;
}
.nb-num { position: relative; top: .5px; }
.nb-moyen { min-width: 36px; height: 34px; padding: 0 7px; font-size: 1.05rem;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  box-shadow: inset -4px -4px 0 var(--nb-cote), inset 3px 3px 0 var(--nb-reflet); }
.nb-grand { min-width: 72px; height: 72px; padding: 0 10px; font-size: 2rem;
  clip-path: polygon(13px 0, calc(100% - 13px) 0, 100% 13px, 100% calc(100% - 13px), calc(100% - 13px) 100%, 13px 100%, 0 calc(100% - 13px), 0 13px);
  box-shadow: inset -7px -7px 0 var(--nb-cote), inset 5px 5px 0 var(--nb-reflet); }

.nb-p-bois    { --nb-face: #c08a52; --nb-cote: #6e4422; --nb-texte: #24150a; }
.nb-p-bronze  { --nb-face: #e09257; --nb-cote: #8a4d1e; --nb-texte: #2a1405; }
.nb-p-argent  { --nb-face: #dfe4ea; --nb-cote: #8a93a3; --nb-texte: #1e2430; --nb-reflet: rgba(255, 255, 255, .8); }
.nb-p-or      { --nb-face: #ffcf4a; --nb-cote: #b07a0b; --nb-texte: #2b1a00; --nb-reflet: rgba(255, 250, 210, .8); }
.nb-p-diamant { --nb-face: #9cecff; --nb-cote: #2a86ad; --nb-texte: #062633; --nb-reflet: rgba(255, 255, 255, .85); }
.nb-p-rubis   { --nb-face: #ff6b86; --nb-cote: #a3173a; --nb-texte: #2e0410; --nb-reflet: rgba(255, 215, 225, .7); }
.nb-p-legende {
  --nb-cote: #7a2a8c; --nb-texte: #1d0826; --nb-reflet: rgba(255, 255, 255, .75);
  background: linear-gradient(135deg, #ffd27a 0%, #ff9ec7 38%, #9cecff 70%, #ffd27a 100%);
  background-size: 220% 220%;
  animation: nb-lueur 6s ease-in-out infinite alternate;
}
@keyframes nb-lueur { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }

/* ---------- Le titre (sous le pseudo) ---------- */
.nb-titre {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  color: #e9c98f; line-height: 1.25;
}

/* ---------- Les cadres d'avatar ---------- */
.nb-cadre {
  --nb-c1: transparent; --nb-c2: transparent;
  display: inline-grid; place-items: center; flex: none; position: relative; box-sizing: border-box;
  padding: 3px; border-radius: 10px; vertical-align: middle;
}
.nb-cadre > * { margin: 0; }
.nb-sans-cadre { padding: 0; }
.nb-cadre:not(.nb-sans-cadre) {
  background: linear-gradient(135deg, var(--nb-c1), var(--nb-c2));
  box-shadow: 0 0 0 2px #120c08, inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.nb-c-planche  { --nb-c1: #c08a52; --nb-c2: #7a4b25; background: repeating-linear-gradient(90deg, #b98048 0 6px, #a46d3a 6px 9px, #c08a52 9px 14px) !important; }
.nb-c-bronze   { --nb-c1: #f0a46b; --nb-c2: #8a4d1e; }
.nb-c-argent   { --nb-c1: #ffffff; --nb-c2: #8a93a3; }
.nb-c-or       { --nb-c1: #fff0a8; --nb-c2: #c8900f; }
.nb-c-emeraude { --nb-c1: #9df5b9; --nb-c2: #1f8a4d; }
.nb-c-diamant  { --nb-c1: #ffffff; --nb-c2: #39a7d4; background: conic-gradient(from 45deg, #e9fbff, #6fd3f5, #ffffff, #39a7d4, #e9fbff) !important; }
.nb-c-amethyste { --nb-c1: #e3c2ff; --nb-c2: #7b3fb8; }
.nb-c-rubis    { --nb-c1: #ffb0bf; --nb-c2: #b0173d; }
.nb-c-prisme   { background: conic-gradient(#ff8a7e, #ffd27a, #7be39b, #7cc8ff, #d6b4ff, #ff8a7e) !important; }
.nb-c-legende  {
  background: conic-gradient(from var(--nb-angle, 0deg), #ffd27a, #ff9ec7, #9cecff, #ffd27a) !important;
  box-shadow: 0 0 0 2px #120c08, 0 0 12px 2px rgba(255, 210, 122, .55) !important;
  animation: nb-tour 8s linear infinite;
}
@property --nb-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes nb-tour { to { --nb-angle: 360deg; } }

/* ---------- Pseudo + badge + titre ensemble ---------- */
.nb-joueur { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.nb-joueur-texte { display: inline-flex; flex-direction: column; min-width: 0; }
.nb-joueur-ligne { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.nb-pseudo { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  .nb-p-legende, .nb-c-legende { animation: none; }
}
@media (forced-colors: active) {
  .nb-badge { border: 1px solid CanvasText; clip-path: none; }
}
