/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  justify-content: center;
}

.mode-btn {
  padding: 0.875rem 2rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
  color: var(--text-primary);
}

/* Multiplayer Panel */
.multiplayer-panel {
  display: grid;
  gap: 2rem;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

/* Player Stats Card */
.player-stats-card {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-light);
}

.player-stats-card h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  color: var(--accent-primary);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Active Players Card */
.active-players-card {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  min-height: 300px;
}

/* Board Size Selector for Multiplayer */
.board-size-selector-mp {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-light);
}

.board-size-selector-mp h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.size-btn-mp {
  padding: 0.75rem 1.5rem;
  background: var(--bg-primary);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
}

.size-btn-mp:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.size-btn-mp.active {
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
}

/* Active Players Card */

.active-players-card h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.player-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}

.player-stats {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.challenge-btn {
  padding: 0.5rem 1.25rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
}

.challenge-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

.no-players,
.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
  font-style: italic;
}

/* Return Button */
.return-btn {
  padding: 1rem 2rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  justify-self: center;
}

.return-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

/* Username Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-secondary);
  padding: 2.5rem;
  border-radius: 20px;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 20px 60px rgba(147, 51, 234, 0.4);
  max-width: 500px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.username-modal h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.username-modal input {
  width: 100%;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.username-modal input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid var(--danger);
}

.submit-btn {
  width: 100%;
  padding: 1rem 2rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.5);
}

/* Challenge Notification */
.challenge-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 16px;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 8px 32px rgba(147, 51, 234, 0.4);
  z-index: 1500;
  max-width: 350px;
  transform: translateX(400px);
  transition: transform 0.4s ease;
}

.challenge-notification.active {
  transform: translateX(0);
}

.challenge-content h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.challenge-content p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.challenge-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.accept-btn,
.decline-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
}

.accept-btn {
  background: var(--success);
  color: white;
}

.accept-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.decline-btn {
  background: var(--danger);
  color: white;
}

.decline-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Status Message Variants */
.status-message.success {
  border-color: var(--success);
  color: var(--success);
}

.status-message.error {
  border-color: var(--danger);
  color: var(--danger);
}

.status-message.warning {
  border-color: #f59e0b;
  color: #f59e0b;
}

.status-message.info {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

/* Responsive Multiplayer Styles */
@media (max-width: 768px) {
  .mode-selector {
    flex-direction: column;
  }

  .mode-btn {
    justify-content: center;
  }

  .multiplayer-panel {
    padding: 1.5rem;
  }

  .challenge-notification {
    right: 1rem;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
  }

  .modal-content {
    padding: 2rem 1.5rem;
  }
}

/* Surrender Button */
.surrender-btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.surrender-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
}

/* Game Over Modal */
.game-over-modal {
  max-width: 450px;
  text-align: center;
}

.game-over-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease-in-out;
}

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

.game-over-modal h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-over-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.game-over-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
}

.game-over-stats .stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.game-over-stats .stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.game-over-stats .stat-value {
  color: var(--accent-primary);
  font-size: 1.5rem;
  font-weight: 700;
}

.game-over-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rematch-btn,
.lobby-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rematch-btn {
  background: var(--accent-gradient);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.3);
}

.rematch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.5);
}

.lobby-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-light);
}

.lobby-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

/* Surrender Confirmation Modal */
.surrender-modal {
  max-width: 400px;
  text-align: center;
}

.surrender-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.surrender-modal h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--danger);
}

.surrender-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.confirm-surrender-btn,
.cancel-surrender-btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
}

.confirm-surrender-btn {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.confirm-surrender-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
}

.cancel-surrender-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-light);
}

.cancel-surrender-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}
