/* Wordcast Online CSS */

/* ========== LOADING ========== */

.online-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px;
  min-height: 200px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #c8c4a8;
  border-top-color: #4898c8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #5a5a4a;
}

/* ========== JOIN SCREEN ========== */

.join-screen {
  text-align: center;
}

.join-code-display {
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  color: #1a4a6e;
  letter-spacing: 6px;
  padding: 16px 24px;
  background: linear-gradient(180deg, #a8d4f0 0%, #7bb8e0 100%);
  border: 3px solid #5a8ab4;
  border-radius: 12px;
  box-shadow: 0 3px 0 #4878a8;
  margin-bottom: 8px;
}

/* ========== MAIN MENU ========== */

.online-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  max-width: 320px;
  margin: 0 auto;
}

.online-title {
  font-family: 'VT323', monospace;
  font-size: 2.2rem;
  color: #1a4a6e;
  text-shadow: 0 2px 0 rgba(255,255,255,0.5);
  margin: 0 0 8px 0;
}

.online-form {
  width: 100%;
}

.online-form.row {
  display: flex;
  gap: 8px;
}

.online-label {
  display: block;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: #2a4a5e;
  margin-bottom: 6px;
}

.online-input {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid #c8c4a8;
  border-radius: 8px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #4a4a3a;
  box-sizing: border-box;
}

.online-input:focus {
  outline: none;
  border-color: #4898c8;
  box-shadow: 0 0 0 3px rgba(72, 152, 200, 0.2);
}

.online-input.code-input {
  flex: 1;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 4px;
  font-size: 1.4rem;
}

.online-btn {
  padding: 12px 24px;
  background: linear-gradient(180deg, #f8f4e8 0%, #e8e4d8 100%);
  border: 2px solid #c8c4a8;
  border-radius: 10px;
  color: #5a5a4a;
  font-size: 1.3rem;
  font-family: 'VT323', monospace;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 3px 0 #a8a488;
  width: 100%;
}

.online-btn:hover {
  background: linear-gradient(180deg, #fff 0%, #f0ece0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #a8a488;
}

.online-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #a8a488;
}

.online-btn.primary {
  background: linear-gradient(180deg, #a8e0a8 0%, #88c888 100%);
  border-color: #68a868;
  color: #2a5a2a;
  box-shadow: 0 3px 0 #488848;
}

.online-btn.primary:hover {
  background: linear-gradient(180deg, #b8f0b8 0%, #98d898 100%);
}

.online-btn.secondary {
  background: linear-gradient(180deg, #d8e8f0 0%, #b8d0e0 100%);
  border-color: #98b8c8;
  color: #4a6a7a;
  box-shadow: 0 3px 0 #8aa8b8;
}

.online-btn.small {
  padding: 8px 16px;
  font-size: 1.1rem;
  width: auto;
}

.online-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.online-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8a8a7a;
  font-family: 'VT323', monospace;
  font-size: 1rem;
}

.online-divider::before,
.online-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #c8c4a8;
}

/* ========== LOBBY ========== */

.online-lobby {
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #a8d4f0 0%, #7bb8e0 100%);
  border: 2px solid #5a8ab4;
  border-radius: 12px;
  box-shadow: 0 3px 0 #4878a8;
}

/* Language Selection */
.lobby-language {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f4e8;
  border: 2px solid #c8c4a8;
  border-radius: 10px;
}

.lang-label {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: #5a5a4a;
}

.lang-display {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #4a4a3a;
}

.lang-toggle {
  display: flex;
  gap: 8px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #fff 0%, #f0ece0 100%);
  border: 2px solid #c8c4a8;
  border-radius: 8px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: #5a5a4a;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 0 #a8a488;
}

.lang-btn:hover {
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e4d8 100%);
  transform: translateY(-1px);
}

.lang-btn.active {
  background: linear-gradient(180deg, #a8e0a8 0%, #88c888 100%);
  border-color: #68a868;
  color: #2a5a2a;
  box-shadow: 0 2px 0 #488848;
}

.lang-flag {
  font-size: 1.2rem;
}

.menu-language {
  width: 100%;
  margin-bottom: 8px;
}

.menu-language .lang-toggle {
  justify-content: center;
  margin-top: 6px;
}

.lobby-code {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.code-label {
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  color: #2a5a7a;
}

.code-value {
  font-family: 'VT323', monospace;
  font-size: 2rem;
  color: #1a4a6e;
  letter-spacing: 4px;
  font-weight: 400;
}

.lobby-players {
  background: #f0e6f4;
  border: 2px solid #c4a8d4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #a888b8;
}

.lobby-players h3 {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #6a4a7a;
  margin: 0 0 12px 0;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #4a4a3a;
}

.player-item.disconnected {
  opacity: 0.5;
}

.host-badge {
  color: #c8a828;
  font-size: 1rem;
}

.dc-badge {
  font-size: 0.85rem;
  color: #c85858;
  margin-left: auto;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.waiting-text {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #6a6a5a;
  text-align: center;
  padding: 12px;
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========== IN-GAME LAYOUT ========== */

.online-game {
  display: flex;
  gap: 24px;
  padding: 16px;
}

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.online-board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 450px;
}

.game-sidebar {
  min-width: 200px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.round-display {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: #1a4a6e;
  text-align: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, #a8d4f0 0%, #7bb8e0 100%);
  border: 2px solid #5a8ab4;
  border-radius: 10px;
  box-shadow: 0 2px 0 #4878a8;
}

.players-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.player-card {
  background: #f0e6f4;
  border: 2px solid #c4a8d4;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 0 #a888b8;
  transition: all 0.2s ease;
}

.player-card.current-turn {
  background: linear-gradient(180deg, #d8f0d8 0%, #b8e0b8 100%);
  border-color: #88c888;
  box-shadow: 0 2px 0 #68a868, 0 0 12px rgba(136, 200, 136, 0.4);
}

.player-card.disconnected {
  opacity: 0.5;
}

.player-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.player-card-name {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: #4a4a3a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card-score {
  font-family: 'VT323', monospace;
  font-size: 1.8rem;
  color: #6a4a7a;
  line-height: 1;
}

.player-card-gems {
  font-size: 0.85rem;
  color: #d46a98;
  letter-spacing: 1px;
}

.skip-btn {
  padding: 4px 10px;
  background: linear-gradient(180deg, #f8d8d8 0%, #e8b8b8 100%);
  border: 1px solid #c88888;
  border-radius: 6px;
  color: #8a4a4a;
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  cursor: pointer;
}

.skip-btn:hover {
  background: linear-gradient(180deg, #ffe0e0 0%, #f0c0c0 100%);
}

/* ========== TURN INDICATOR ========== */

.turn-indicator {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: #5a5a4a;
  text-align: center;
  padding: 8px 20px;
  background: rgba(255,255,255,0.7);
  border-radius: 20px;
  border: 2px solid #c8c4a8;
}

.turn-indicator.my-turn {
  background: linear-gradient(180deg, #d8f0d8 0%, #b8e0b8 100%);
  border-color: #88c888;
  color: #2a5a2a;
  animation: my-turn-pulse 1.5s ease-in-out infinite;
}

@keyframes my-turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(136, 200, 136, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(136, 200, 136, 0); }
}

/* ========== TIMER ========== */

.timer-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  width: 100%;
  justify-content: center;
}

.vote-timer-btn {
  padding: 8px 16px;
  background: linear-gradient(180deg, #f8e8a8 0%, #e8d078 100%);
  border: 2px solid #c8a838;
  border-radius: 8px;
  color: #6a5a2a;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 0 #a88828;
}

.vote-timer-btn:hover {
  background: linear-gradient(180deg, #fff0b8 0%, #f0d888 100%);
}

.timer-votes {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #8a8a7a;
}

.timer-bar-container {
  flex: 1;
  max-width: 300px;
  height: 24px;
  background: #e8e4d8;
  border: 2px solid #c8c4a8;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(180deg, #88c888 0%, #68a868 100%);
  transition: width 1s linear;
  border-radius: 10px;
}

.timer-bar.low {
  background: linear-gradient(180deg, #e88888 0%, #c86868 100%);
  animation: timer-urgent 0.5s ease-in-out infinite;
}

@keyframes timer-urgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #4a4a3a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.extend-btn {
  padding: 6px 12px;
  background: linear-gradient(180deg, #f4e8f8 0%, #e4d8ec 100%);
  border: 2px solid #c8b8d4;
  border-radius: 8px;
  color: #6a5a7a;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 0 #a898b8;
  white-space: nowrap;
}

.extend-btn:hover {
  background: linear-gradient(180deg, #fcf0ff 0%, #ece0f4 100%);
}

/* ========== BOARD STATE ========== */

#online-board.disabled {
  pointer-events: none;
  opacity: 0.7;
}

#online-board.disabled .spellcast-tile {
  cursor: not-allowed;
}

.spellcast-tile.other-selected {
  background: linear-gradient(180deg, #f8e8a8 0%, #e8d078 100%);
  border-color: #c8a838;
  box-shadow: 0 0 8px rgba(200, 168, 56, 0.5);
}

.spellcast-word-text.other-word {
  color: #c8a838;
  opacity: 0.8;
}

.spellcast-word-points.invalid {
  color: #c85858;
}

/* ========== GAME OVER / LEADERBOARD ========== */

.game-over-screen {
  padding: 32px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.game-over-screen .game-over-title {
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  color: #1a4a6e;
  margin: 0 0 24px 0;
  text-shadow: 0 2px 0 rgba(255,255,255,0.5);
}

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f0e6f4;
  border: 2px solid #c4a8d4;
  border-radius: 10px;
  box-shadow: 0 2px 0 #a888b8;
}

.leaderboard-entry.winner {
  background: linear-gradient(180deg, #f8e8a8 0%, #e8d078 100%);
  border-color: #c8a838;
  box-shadow: 0 2px 0 #a88828, 0 0 16px rgba(248, 216, 120, 0.4);
}

.lb-rank {
  font-size: 1.5rem;
  min-width: 32px;
}

.lb-name {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #4a4a3a;
  flex: 1;
  text-align: left;
}

.lb-score {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: #6a4a7a;
}

.lb-best {
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  color: #8a8a7a;
  text-align: right;
}

.game-over-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========== MESSAGES ========== */

.online-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #fff;
  border: 2px solid #c8c4a8;
  border-radius: 10px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #4a4a3a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: message-in 0.3s ease;
}

.online-message.success {
  background: #d8f0d8;
  border-color: #88c888;
  color: #2a5a2a;
}

.online-message.error {
  background: #f8d8d8;
  border-color: #c88888;
  color: #8a2a2a;
}

@keyframes message-in {
  0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 700px) {
  .online-game {
    flex-direction: column;
    gap: 16px;
  }
  
  .game-sidebar {
    max-width: none;
    min-width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .round-display {
    flex: 0 0 auto;
  }
  
  .players-panel {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .player-card {
    flex: 0 0 auto;
    min-width: 120px;
  }
}

@media (max-width: 500px) {
  .online-menu {
    padding: 20px 16px;
  }
  
  .online-title {
    font-size: 1.8rem;
  }
  
  .lobby-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .online-game {
    padding: 10px;
  }
  
  .game-sidebar {
    gap: 8px;
  }
  
  .player-card {
    padding: 8px 10px;
    min-width: 100px;
  }
  
  .player-card-score {
    font-size: 1.4rem;
  }
  
  .timer-bar-container {
    max-width: 200px;
  }
  
  .leaderboard-entry {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .lb-best {
    display: none;
  }
}

/* ========== TURN NOTIFICATIONS ========== */

.your-turn-flash {
  animation: turn-flash 0.5s ease 3;
}

@keyframes turn-flash {
  0%, 100% { box-shadow: 0 4px 0 #5a8ab4, 0 8px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 #e8f4fc; }
  50% { box-shadow: 0 4px 0 #5a8ab4, 0 8px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 #e8f4fc, 0 0 30px rgba(136, 200, 136, 0.8); }
}

.turn-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 32px;
  background: linear-gradient(180deg, #d8f0d8 0%, #b8e0b8 100%);
  border: 3px solid #88c888;
  border-radius: 12px;
  font-family: 'VT323', monospace;
  font-size: 2rem;
  color: #2a5a2a;
  box-shadow: 0 4px 20px rgba(136, 200, 136, 0.5);
  z-index: 100;
  animation: toast-in-out 2.5s ease forwards;
}

@keyframes toast-in-out {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.spellcast-word-text.waiting-text {
  color: #8a8a7a;
  font-size: 1.2rem;
  animation: pulse-text 1.5s ease-in-out infinite;
}

/* ========== WORD HISTORY ========== */

.word-history-panel {
  background: #e8f0e8;
  border: 2px solid #a8c8a8;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #88a888;
}

.history-title {
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  color: #5a7a5a;
  margin-bottom: 6px;
}

.word-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 100px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  gap: 6px;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  padding: 2px 4px;
  background: rgba(255,255,255,0.5);
  border-radius: 4px;
}

.history-player {
  color: #6a6a5a;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-word {
  color: #4a4a3a;
  font-weight: bold;
}

.history-points {
  color: #4a8a4a;
}

/* ========== SCORE ANIMATIONS ========== */

.player-card.score-pulse {
  animation: card-pulse 0.5s ease;
}

@keyframes card-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(136, 200, 136, 0.6); }
}

.player-card-score.tick {
  color: #4a8a4a;
}

/* ========== REACTIONS ========== */

.reactions-bar {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 8px 0;
}

.reaction-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #c8c4a8;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8f4e8 0%, #e8e4d8 100%);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 2px 0 #a8a488;
}

.reaction-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #a8a488;
}

.reaction-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #a8a488;
}

.reaction-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: #fff;
  border: 2px solid #c8c4a8;
  border-radius: 20px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: reaction-toast 2s ease forwards;
}

.reaction-emoji {
  font-size: 1.5rem;
  margin-right: 8px;
}

.reaction-name {
  color: #6a6a5a;
}

@keyframes reaction-toast {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ========== DISCONNECT TIMER ========== */

.dc-timer {
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: #c85858;
  margin-left: 4px;
}

/* ========== COUNTDOWN ========== */

.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  z-index: 50;
}

.countdown-overlay.fade-out {
  animation: fade-out 0.3s ease forwards;
}

@keyframes fade-out {
  to { opacity: 0; }
}

.countdown-number {
  font-family: 'VT323', monospace;
  font-size: 6rem;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.countdown-number.go {
  color: #88e888;
  font-size: 5rem;
}

.countdown-number.countdown-pop {
  animation: countdown-pop 0.8s ease;
}

@keyframes countdown-pop {
  0% { transform: scale(0); opacity: 0; }
  30% { transform: scale(1.3); opacity: 1; }
  50% { transform: scale(1); }
  100% { transform: scale(0.8); opacity: 0; }
}

/* ========== LEADER CROWN ========== */

.player-card.leader {
  background: linear-gradient(180deg, #fff8e0 0%, #f8e8b8 100%);
  border-color: #d4b458;
  box-shadow: 0 2px 0 #b89838, 0 0 12px rgba(212, 180, 88, 0.3);
}

.leader-crown {
  font-size: 1rem;
  margin-right: 4px;
  animation: crown-bounce 1s ease infinite;
}

@keyframes crown-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ========== STREAK ========== */

.streak-badge {
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  color: #e85830;
  background: linear-gradient(180deg, #fff0e8 0%, #ffe0d0 100%);
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid #f0a080;
  margin-left: auto;
}

.streak-popup {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #e85830;
  white-space: nowrap;
  animation: streak-float 1.5s ease forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes streak-float {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.5); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
  40% { transform: translateX(-50%) translateY(-5px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.8); }
}

/* ========== TYPING INDICATOR ========== */

.typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: #88c888;
  border-radius: 50%;
  animation: typing-dot 1.2s ease infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ========== PLAYER JOIN/LEAVE ANIMATIONS ========== */

.player-item {
  transition: all 0.3s ease;
}

.player-join-anim {
  animation: player-join 0.5s ease;
}

@keyframes player-join {
  0% { opacity: 0; transform: translateX(-20px); }
  50% { transform: translateX(5px); }
  100% { opacity: 1; transform: translateX(0); }
}

.player-leave-anim {
  animation: player-leave 0.3s ease forwards;
}

@keyframes player-leave {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(20px); height: 0; padding: 0; margin: 0; }
}

/* ========== GAME OVER IMPROVEMENTS ========== */

.leaderboard-entry.animate-in {
  animation: entry-slide-in 0.4s ease backwards;
}

@keyframes entry-slide-in {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.best-words-showcase {
  margin: 20px 0;
  padding: 16px;
  background: #e8f0e8;
  border: 2px solid #a8c8a8;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #88a888;
}

.showcase-title {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #4a6a4a;
  margin-bottom: 12px;
  text-align: center;
}

.best-word-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  margin-bottom: 6px;
}

.best-word-card.animate-in {
  animation: word-card-in 0.3s ease backwards;
}

@keyframes word-card-in {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.bw-player {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #6a6a5a;
  min-width: 80px;
}

.bw-word {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #4a4a3a;
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.bw-points {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: #4a8a4a;
}

/* ========== HINT HIGHLIGHT ========== */

.spellcast-tile.hint-highlight {
  background: linear-gradient(180deg, #d8f0f8 0%, #a8d8e8 100%);
  border-color: #68a8c8;
  box-shadow: 0 0 12px rgba(104, 168, 200, 0.6);
  animation: hint-glow 0.8s ease infinite;
}

@keyframes hint-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(104, 168, 200, 0.4); }
  50% { box-shadow: 0 0 16px rgba(104, 168, 200, 0.8); }
}

/* ========== SWAP MODE ========== */

.spellcast-tile.swap-selectable {
  cursor: pointer;
}

.spellcast-tile.swap-selectable:hover {
  background: linear-gradient(180deg, #f8e8f8 0%, #e8d0e8 100%);
  border-color: #c8a8c8;
}

.spellcast-tile.swap-selected {
  background: linear-gradient(180deg, #e8d0f8 0%, #d8b8e8 100%);
  border-color: #b888c8;
  box-shadow: 0 0 12px rgba(184, 136, 200, 0.6);
}

.swap-letter-picker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 3px solid #c8c4a8;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 100;
  max-width: 320px;
}

.picker-title {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: #4a4a3a;
  text-align: center;
  margin-bottom: 16px;
}

.picker-letters {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.picker-letter {
  width: 36px;
  height: 36px;
  border: 2px solid #c8c4a8;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8f4e8 0%, #e8e4d8 100%);
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #4a4a3a;
  cursor: pointer;
  transition: all 0.1s;
}

.picker-letter:hover {
  background: linear-gradient(180deg, #a8d4f0 0%, #88c4e0 100%);
  border-color: #68a4c8;
  transform: scale(1.1);
}

.picker-cancel {
  width: 100%;
  padding: 10px;
  background: linear-gradient(180deg, #f8d8d8 0%, #e8b8b8 100%);
  border: 2px solid #c88888;
  border-radius: 8px;
  color: #8a4a4a;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
}
