/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Cacher et positionner la modale */
#stats-modal.modal {
  position: fixed;
  width: 100%;
  height: 100%;
  inset: 0;
  z-index: 6000; /* Plus haut que l'end_screen_container */
  background: rgba(0,0,0,0.25); /* léger fond sombre */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Par défaut : visible si pas .hidden */
}
#stats-modal.modal.hidden {
  display: none;
}

/* ====== MODALE COEUR / SOUTENIR ====== */
.stats-big-modal {
  width: min(100vw, 56.25vh);   /* 100vh × 9/16 = 56.25vw */
  height: min(100vh, 177.78vw); /* 100vw × 16/9 = 177.78vw */
  aspect-ratio: 9 / 16;
  padding-left: 15px;
  padding-right: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  container-type: inline-size;
}

.stats-modal-content {
  width: 100%;
  aspect-ratio: 7 / 9;
  background: var(--color-popup);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
  border-radius: 18px; 
  box-shadow: 0 6px 32px rgba(0,0,0,0.14);
  font-family: 'Nunito', Arial, sans-serif;
  animation: fade-in 0.0s ease-out;
}

.stats-modal-header {
  width: 100%;
  display: flex;
  padding: 5px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--color-border);
}

.stats-modal-header-text {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-modal-title {
  width: 100%;
  font-size: clamp(8px, 6cqw, 70px);
  font-weight: 700;
  color: var(--color-secondary);
  flex: 1;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stats-modal-close-btn {
  width: clamp(20px, 9cqw, 50px);        /* Ou clamp(28px, 8cqw, 44px) si tu veux du responsive ! */
  height: clamp(20px, 9cqw, 50px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-close);
  border: none;
  border-radius: 7px;
  padding: 0;         /* Mets à zéro pour un carré parfait */
  cursor: pointer;
  transition: background 0.15s;
  margin-left: 8px;   /* Garde la marge si tu veux séparer du titre */
}

.stats-modal-close-btn .modal-close {
  width: clamp(12px, 7cqw, 44px);
  height: clamp(12px, 7cqw, 44px);
  display: block;
  transition: transform 0.28s cubic-bezier(.62,.18,.21,.97);
}
.stats-modal-close-btn:hover .modal-close {
  transform: rotate(90deg);
}
.stats-modal-close-btn:active {
  transform: scale(0.95);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Body */
.stats-body {
  width: 100%;
  aspect-ratio: 8 / 9;
  color: #33363f;
  gap: 20px;
  text-align: justify;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

/* Stats résumé (les 4 cartes) */
.stats-main {
  width: 100%;
  aspect-ratio: 40 / 9;
  color: var(--color-secondary);
  gap: 10px;
  text-align: justify;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.stats-card {
  background: var(--color-card-bg);
  border-radius: 10px;
  height: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(110, 208, 110, 0.05);
}
/* Taille générale par défaut */
.stats-value {
  font-weight: bold;
  color: var(--color-green);
  margin-bottom: 0.3rem;
}

.stat-games .stats-label   { font-size: clamp(5px, 5cqw, 200px); }
.stat-avg .stats-label { font-size: clamp(5px, 4.3cqw, 200px); }
.stat-best .stats-label   { font-size: clamp(5px, 4.3cqw, 200px); }
.stat-perfect .stats-label { font-size: clamp(5px, 5cqw, 200px); }

/* Personnalisation */
.stat-games .stats-value    { font-size: clamp(5px, 7cqw, 200px); }
.stat-avg .stats-value      { font-size: clamp(5px, 6cqw, 200px); }
.stat-best .stats-value     { font-size: clamp(5px, 6cqw, 200px); }
.stat-perfect .stats-value  { font-size: clamp(5px, 7cqw, 200px); }

.stats-label {
  line-height: 1.0;
}

.stats-label {
  font-size: 1rem;
  color: var(--stats-txt-main);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Détails (lignes historiques) */

.stats-details {
  width: 100%;
  aspect-ratio: 10 / 9;
  color: var(--color-secondary);
  gap:10px;
  padding: 5px;
  display: flex;
  flex-direction: row;
  overflow-y: auto;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.stats-detail-row {
  width: 100%;
  aspect-ratio: 90 / 9;
  display: flex;
  align-items: center;        /* <-- centre tous les enfants verticalement */
  justify-content: space-between;
  border-radius: 10px;
  gap: 14px;
}

.stats-detail-value.round-num{
  width: 17%;
  font-size: clamp(5px, 6cqw, 200px);
  font-weight: 700;
  color: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;  
}

.stats-detail-value.score {
  width: 27%;
  font-size: clamp(5px, 6cqw, 200px);
  font-weight: 700;
  color: var(--color-secondary);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.stats-bar-cercles{
  width: 56%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-bar {
  width: 15%;
  aspect-ratio: 1/1;
  border-radius: 5px;
  background: var(--color-gray);
}

.stats-bar-green  { background: var(--color-green); }
.stats-bar-yellow { background: var(--color-yellow); }
.stats-bar-blue    { background: var(--color-blue); }
.stats-bar-red    { background: var(--color-red); }

/* {
  outline: 1px dashed red;
}