/* ========================================
   SCOREBOARD STYLES - Premium Design
   ======================================== */

/* Game container with scoreboard */
.game-container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  background: transparent !important;
}

/* Scoreboard - Premium glassmorphism design */
.scoreboard {
  position: absolute;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, 
    rgba(42, 42, 42, 0.95) 0%, 
    rgba(30, 30, 30, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  padding: 20px;
  min-width: 220px;
  max-width: 300px;
  display: none;
  z-index: 10;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 20px rgba(255, 215, 0, 0.1);
  animation: scoreboardSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transition: all 0.3s ease;
}

.scoreboard:hover {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 0 30px rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

@keyframes scoreboardSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scoreboard header */
.scoreboard h3 {
  color: #ffd700;
  text-align: center;
  margin-top: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
  padding-bottom: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
  position: relative;
}

.scoreboard h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    #ffd700, 
    transparent);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.5;
    width: 60px;
  }
  50% {
    opacity: 1;
    width: 80px;
  }
}

/* Score items */
.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, 
    rgba(58, 58, 58, 0.6) 0%, 
    rgba(48, 48, 48, 0.8) 100%);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.score-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.1), 
    transparent);
  transition: left 0.5s ease;
}

.score-item:hover::before {
  left: 100%;
}

.score-item:hover {
  background: linear-gradient(135deg, 
    rgba(68, 68, 68, 0.7) 0%, 
    rgba(58, 58, 58, 0.9) 100%);
  border-color: rgba(255, 215, 0, 0.2);
  transform: translateX(-3px);
  box-shadow: 
    3px 0 0 rgba(255, 215, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3);
}

/* First place styling */
.score-item.first-place {
  background: linear-gradient(135deg, 
    rgba(45, 125, 49, 0.9) 0%, 
    rgba(35, 100, 39, 0.95) 100%);
  color: white;
  font-weight: bold;
  border: 2px solid #4CAF50;
  box-shadow: 
    0 0 20px rgba(76, 175, 80, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  animation: firstPlaceGlow 2s ease-in-out infinite;
}

@keyframes firstPlaceGlow {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(76, 175, 80, 0.4),
      0 4px 12px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  }
  50% {
    box-shadow: 
      0 0 30px rgba(76, 175, 80, 0.6),
      0 6px 16px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  }
}

.score-item.first-place::after {
  content: '👑';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.8;
  animation: crownBounce 1s ease-in-out infinite;
}

@keyframes crownBounce {
  0%, 100% {
    transform: translateY(-50%) scale(1);
  }
  50% {
    transform: translateY(-55%) scale(1.1);
  }
}

/* Current player highlight */
.score-item.current-player {
  border: 2px solid #ffd700;
  box-shadow: 
    0 0 15px rgba(255, 215, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.3);
  animation: currentPlayerPulse 1.5s ease-in-out infinite;
}

@keyframes currentPlayerPulse {
  0%, 100% {
    border-color: #ffd700;
    box-shadow: 
      0 0 15px rgba(255, 215, 0, 0.4),
      0 4px 12px rgba(0, 0, 0, 0.3);
  }
  50% {
    border-color: #ffed4e;
    box-shadow: 
      0 0 25px rgba(255, 215, 0, 0.6),
      0 6px 16px rgba(0, 0, 0, 0.4);
  }
}

/* Rank badge */
.rank {
  font-weight: bold;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border-radius: 50%;
  color: #1a1a1a;
  font-size: 0.9rem;
  box-shadow: 
    0 2px 8px rgba(255, 215, 0, 0.4),
    0 0 0 2px rgba(0, 0, 0, 0.2) inset;
  flex-shrink: 0;
}

.score-item.first-place .rank {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  animation: rankShine 2s linear infinite;
}

@keyframes rankShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* Player name */
.player-name {
  flex: 1;
  text-align: left;
  margin: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
}

/* Score value */
.score {
  font-weight: bold;
  font-size: 1.1rem;
  color: #4CAF50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  padding: 4px 10px;
  background: rgba(76, 175, 80, 0.15);
  border-radius: 6px;
  border: 1px solid rgba(76, 175, 80, 0.3);
  min-width: 50px;
  text-align: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.score-item:hover .score {
  background: rgba(76, 175, 80, 0.25);
  border-color: rgba(76, 175, 80, 0.5);
  transform: scale(1.05);
}

.score-item.first-place .score {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Keyboard controls info */
.keyboard-controls-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
  font-style: italic;
}

/* Responsive adjustments for scoreboard */
@media (max-width: 768px) {
  .scoreboard {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin: 0 0 20px 0;
    padding: 16px;
  }

  .scoreboard h3 {
    font-size: 1.1rem;
  }

  .score-item {
    padding: 12px 10px;
  }

  .rank {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .player-name {
    font-size: 0.9rem;
    margin: 0 10px;
  }

  .score {
    font-size: 1rem;
    padding: 3px 8px;
  }
}

@media (max-height: 600px) {
  .scoreboard {
    padding: 12px;
    min-width: 180px;
  }

  .scoreboard h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .score-item {
    padding: 10px 8px;
    margin-bottom: 6px;
  }
}
