.leaderboard-chat-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
  color: var(--screen-text-color-main);
  font-family: var(--screen-font-family);
  font-size: var(--main-font-size);
}

.container {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 15px;
  width: 595px;
  height: 800px;
  max-height: 800px;
  gap: 15px;
  background: var(--main-container-bg);
  border: var(--main-border);
  border-radius: var(--border-radius);
  box-shadow: var(--container-shadow);
}

.leaderboard-content {
  padding: 15px;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  border-radius: var(--screen-border-radius);
  overflow: hidden;
  height: 100%;
  min-height: 0;
  border: var(--main-border);
  background: var(--content-bg);
}

.leaderboard-list {
  margin-top: 15px;
  box-sizing: border-box;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: var(--item-bg);
  border: var(--item-border);
  border-radius: var(--item-border-radius);
  transition: all 0.2s ease;
  box-shadow: var(--item-shadow);
  transform: translateZ(0); /* Enable hardware acceleration */
  backface-visibility: hidden; /* Reduce flickering */
}
.leaderboard-item:hover {
  background-color: #424242;
}
.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.leaderboard-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
}

.rank.top-1,
.country-name.top-1 {
  color: #FFD700;
}
.rank.top-2,
.country-name.top-2 {
  color: #C0C0C0;
}
.rank.top-3,
.country-name.top-3 {
  color: #CD7F32;
}
.country {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.country-flag {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.country-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.country-name {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sps-indicator {
    animation: pulse-green 2s infinite;
    white-space: nowrap;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.total-spins {
  text-align: right;
  min-width: 80px;
  flex-shrink: 0;
}
.today-spins {
  color: var(--screen-text-color);
  text-align: right;
  min-width: 80px;
  flex-shrink: 0;
}

.leaderboard-stats {
  border-top: var(--main-border);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 15px;
  gap: 15px;
}

.total-spins-stats {
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  text-transform: uppercase;
  border-bottom: var(--main-border);
  padding-bottom: 15px;
}

.total-spins-display .number {
  color: var(--screen-text-color);
}

.today-spins-display .number {
  color: var(--screen-text-color);
}
.user-country-info {
  justify-content: space-between;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.user-country-flag {
  border: var(--main-border);
}

/* Empty state styles */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}
.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}
.empty-state p {
    margin: 0;
    font-size: 1rem;
}

@media (max-width: 768px) {
  .leaderboard-chat-container {
    flex-direction: column;
    gap: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100vw;
  }
  .container {
    height: 550px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    padding: 10px;
    gap: 10px;
    box-sizing: border-box;
  }
  .leaderboard-item {
    padding: 6px;
    gap: 5px;
    transition: none; /* Disable transitions on mobile for better performance */
    will-change: auto; /* Let browser optimize */
  }
  .leaderboard-list {
    margin-top: 10px;
    contain: layout style paint; /* CSS containment for better performance */
  }
  .leaderboard-left {
    gap: 8px;
  }

  .leaderboard-right {
    gap: 10px;
  }

  .rank {
    font-size: 0.7rem;
    width: 30px;
  }
  .country-flag {
    width: 25px;
    height: 15px;
    image-rendering: auto;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    transform: translateZ(0); /* Force hardware acceleration */
    backface-visibility: hidden; /* Prevent flickering */
  }
  .country-name {
    font-size: 0.7rem;
  }
  .total-spins {
    font-size: 0.7rem;
    min-width: 30px;
  }
  .today-spins {
    font-size: 0.7rem;
    min-width: 30px;
  }
  .leaderboard-stats {
    pmargin-bottom: 30px;
    gap: 5px;
  }

  .total-spins-stats {
    padding-bottom: 5px;
  }
  .total-spins-display .number {
    font-size: 0.7rem;
  }
  .today-spins-display .number {
    font-size: 0.7rem;
  }

  .user-country-display {
    font-size: 0.7rem;
  }
  .user-country-flag {
    width: 25px;
    height: 15px;
  }
}