/* ===== SCREEN 5 : RANKING ===== */
#screen-ranking { background: linear-gradient(160deg, #F5E6C8 0%, #FAEBD0 60%, #F5E6C8 100%); }
.ranking-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.ranking-header {
  padding: 20px 20px 10px;
  text-align: center;
}
.ranking-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--brown);
}

.ranking-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.ranking-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px var(--shadow);
  overflow: hidden;
  cursor: pointer;
}
.ranking-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  user-select: none;
}
.ranking-rank {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--amber);
  min-width: 32px;
}
.ranking-rank.rank-1 { color: #FFD700; }
.ranking-rank.rank-2 { color: #B0B0B0; }
.ranking-rank.rank-3 { color: #CD7F32; }

.ranking-name {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brown);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranking-score {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--terracotta);
}
.ranking-chevron {
  font-size: 1rem;
  color: var(--amber);
  transition: transform 0.25s;
  margin-left: 4px;
}
.ranking-card.open .ranking-chevron { transform: rotate(90deg); }

.ranking-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
  background: #fdf8f0;
  border-top: 0px solid #e0d5c8;
}
.ranking-card.open .ranking-detail {
  max-height: 800px;
  border-top-width: 1px;
}
.ranking-detail-inner {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ranking-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.ranking-detail-row img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.ranking-detail-row-name {
  flex: 1;
  font-weight: 700;
  color: var(--brown);
}
.ranking-detail-row-pts {
  font-weight: 800;
  color: var(--terracotta);
  min-width: 40px;
  text-align: right;
}
.ranking-detail-row-pts.negative { color: #c0392b; }

.ranking-footer {
  padding: 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* ===== TABLEAU RÉCAP ===== */
.ranking-recap {
  max-width: 640px;
  margin: 20px auto 0;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px var(--shadow);
  overflow: hidden;
}
.ranking-recap h3 {
  font-size: 1rem;
  font-weight: 900;
  color: var(--brown);
  padding: 12px 16px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--beige);
}
.recap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.recap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
}
.recap-table th,
.recap-table td {
  padding: 6px 10px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 1px solid #ede3d6;
}
/* Première colonne : label carte */
.recap-table th:first-child,
.recap-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--white);
  z-index: 1;
  padding-left: 12px;
  min-width: 110px;
}
/* Header joueurs */
.recap-table thead th {
  background: var(--brown);
  color: var(--gold);
  font-weight: 800;
  font-size: 0.8rem;
  border-bottom: none;
}
.recap-table thead th:first-child {
  background: var(--brown);
  color: var(--beige);
}
/* Lignes alternées */
.recap-table tbody tr:nth-child(even) td { background: #fdf8f0; }
.recap-table tbody tr:nth-child(even) td:first-child { background: #fdf8f0; }
/* Cellule carte : image + nom */
.recap-card-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.recap-card-label img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
/* Score normal / négatif */
.recap-pts { color: var(--brown); }
.recap-pts.neg { color: #c0392b; }
.recap-pts.zero { color: #b5a090; }
/* Ligne total */
.recap-table tfoot td {
  background: var(--brown) !important;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 900;
  border-bottom: none;
  padding: 10px 10px;
}
.recap-table tfoot td:first-child {
  background: var(--brown) !important;
  color: var(--beige);
}
